Open source, composable payments platform | PCI compliant | SaaS and Self-host options | Enables connectivity to multiple payment, payout, fraud, vault and tokenization providers | Uplifts authorization with intelligent routing and revenue recovery | Reduce payment processing costs with cost observability | Reduces payment ops with reconciliation
Rust adyenbeginner-friendlyfeaturedfinancefintechhacktoberfesthigh-performanceopen-sourceorchestrationpaymentpayment-gatewaypayment-integrationpayment-processingpaymentspayments-platformrestful-apirustsdkstripeworks-with-react
test(cypress): add auth_code population coverage for checkout (#13741)
HS-QUALIBOTd6476ea67b87
diff --git a/cypress-tests/cypress/e2e/configs/Payment/Checkout.js b/cypress-tests/cypress/e2e/configs/Payment/Checkout.jsindex 03869ed1dc..d0b1b0461d 100644--- a/cypress-tests/cypress/e2e/configs/Payment/Checkout.js+++ b/cypress-tests/cypress/e2e/configs/Payment/Checkout.js@@ -212,6 +212,7 @@ export const connectorDetails = {status: 200,body: {status: "requires_capture",+ payment_method_data: {},},},},@@ -228,6 +229,7 @@ export const connectorDetails = {status: 200,body: {status: "succeeded",+ payment_method_data: {},},},},diff --git a/cypress-tests/cypress/support/commands.js b/cypress-tests/cypress/support/commands.jsindex e540ecfa9f..5ed9cab32a 100644--- a/cypress-tests/cypress/support/commands.js+++ b/cypress-tests/cypress/support/commands.js@@ -3300,9 +3300,17 @@ Cypress.Commands.add(}}for (const key in resData.body) {- expect(resData.body[key], [key]).to.deep.equal(- response.body[key]- );+ if (key === "payment_method_data" && globalState.get("connectorId") === "checkout") {+ expect(response.body[key], [key]).to.not.be.empty;+ expect(+ response.body[key]?.card?.auth_code,+ "payment_method_data.card.auth_code"+ ).to.be.a("string").and.not.be.empty;+ } else {+ expect(resData.body[key], [key]).to.deep.equal(+ response.body[key]+ );+ }}} else if (response.body.authentication_type === "no_three_ds") {// Handle pay later methods that require redirect (Affirm, Klarna, etc.)@@ -3328,9 +3336,17 @@ Cypress.Commands.add();}for (const key in resData.body) {- expect(resData.body[key], [key]).to.deep.equal(- response.body[key]- );+ if (key === "payment_method_data" && globalState.get("connectorId") === "checkout") {+ expect(response.body[key], [key]).to.not.be.empty;+ expect(+ response.body[key]?.card?.auth_code,+ "payment_method_data.card.auth_code"+ ).to.be.a("string").and.not.be.empty;+ } else {+ expect(resData.body[key], [key]).to.deep.equal(+ response.body[key]+ );+ }if (response.body.setup_future_usage === "off_session" &&response.body.status === "succeeded" &&@@ -3386,9 +3402,17 @@ Cypress.Commands.add(}}for (const key in resData.body) {- expect(resData.body[key], [key]).to.deep.equal(- response.body[key]- );+ if (key === "payment_method_data" && globalState.get("connectorId") === "checkout") {+ expect(response.body[key], [key]).to.not.be.empty;+ expect(+ response.body[key]?.card?.auth_code,+ "payment_method_data.card.auth_code"+ ).to.be.a("string").and.not.be.empty;+ } else {+ expect(resData.body[key], [key]).to.deep.equal(+ response.body[key]+ );+ }}} else if (response.body.authentication_type === "no_three_ds") {// Handle pay later methods that require redirect (Affirm, Klarna, etc.)@@ -3403,9 +3427,17 @@ Cypress.Commands.add(globalState.set("nextActionType", "redirect_to_url");}for (const key in resData.body) {- expect(resData.body[key], [key]).to.deep.equal(- response.body[key]- );+ if (key === "payment_method_data" && globalState.get("connectorId") === "checkout") {+ expect(response.body[key], [key]).to.not.be.empty;+ expect(+ response.body[key]?.card?.auth_code,+ "payment_method_data.card.auth_code"+ ).to.be.a("string").and.not.be.empty;+ } else {+ expect(resData.body[key], [key]).to.deep.equal(+ response.body[key]+ );+ }if (response.body.setup_future_usage === "off_session" &&response.body.status === "succeeded" &&@@ -4073,15 +4105,31 @@ Cypress.Commands.add(}}for (const key in resData.body) {- expect(resData.body[key], [key]).to.deep.equal(- response.body[key]- );+ if (key === "payment_method_data" && globalState.get("connectorId") === "checkout") {+ expect(response.body[key], [key]).to.not.be.empty;+ expect(+ response.body[key]?.card?.auth_code,+ "payment_method_data.card.auth_code"+ ).to.be.a("string").and.not.be.empty;+ } else {+ expect(resData.body[key], [key]).to.deep.equal(+ response.body[key]+ );+ }}} else if (response.body.authentication_type === "no_three_ds") {for (const key in resData.body) {- expect(resData.body[key], [key]).to.deep.equal(- response.body[key]- );+ if (key === "payment_method_data" && globalState.get("connectorId") === "checkout") {+ expect(response.body[key], [key]).to.not.be.empty;+ expect(+ response.body[key]?.card?.auth_code,+ "payment_method_data.card.auth_code"+ ).to.be.a("string").and.not.be.empty;+ } else {+ expect(resData.body[key], [key]).to.deep.equal(+ response.body[key]+ );+ }}} else {throw new Error(@@ -4118,15 +4166,31 @@ Cypress.Commands.add(}}for (const key in resData.body) {- expect(resData.body[key], [key]).to.deep.equal(- response.body[key]- );+ if (key === "payment_method_data" && globalState.get("connectorId") === "checkout") {+ expect(response.body[key], [key]).to.not.be.empty;+ expect(+ response.body[key]?.card?.auth_code,+ "payment_method_data.card.auth_code"+ ).to.be.a("string").and.not.be.empty;+ } else {+ expect(resData.body[key], [key]).to.deep.equal(+ response.body[key]+ );+ }}} else if (response.body.authentication_type === "no_three_ds") {for (const key in resData.body) {- expect(resData.body[key], [key]).to.deep.equal(- response.body[key]- );+ if (key === "payment_method_data" && globalState.get("connectorId") === "checkout") {+ expect(response.body[key], [key]).to.not.be.empty;+ expect(+ response.body[key]?.card?.auth_code,+ "payment_method_data.card.auth_code"+ ).to.be.a("string").and.not.be.empty;+ } else {+ expect(resData.body[key], [key]).to.deep.equal(+ response.body[key]+ );+ }}} else {throw new Error(@@ -4245,9 +4309,17 @@ Cypress.Commands.add(}} else if (response.body.authentication_type === "no_three_ds") {for (const key in resData.body) {- expect(resData.body[key], [key]).to.deep.equal(- response.body[key]- );+ if (key === "payment_method_data" && globalState.get("connectorId") === "checkout") {+ expect(response.body[key], [key]).to.not.be.empty;+ expect(+ response.body[key]?.card?.auth_code,+ "payment_method_data.card.auth_code"+ ).to.be.a("string").and.not.be.empty;+ } else {+ expect(resData.body[key], [key]).to.deep.equal(+ response.body[key]+ );+ }}expect(response.body.customer_id).to.equal(globalState.get("customerId") ?? null@@ -4294,9 +4366,17 @@ Cypress.Commands.add();} else if (response.body.authentication_type === "no_three_ds") {for (const key in resData.body) {- expect(resData.body[key], [key]).to.deep.equal(- response.body[key]- );+ if (key === "payment_method_data" && globalState.get("connectorId") === "checkout") {+ expect(response.body[key], [key]).to.not.be.empty;+ expect(+ response.body[key]?.card?.auth_code,+ "payment_method_data.card.auth_code"+ ).to.be.a("string").and.not.be.empty;+ } else {+ expect(resData.body[key], [key]).to.deep.equal(+ response.body[key]+ );+ }}expect(response.body.customer_id).to.equal(globalState.get("customerId") ?? null@@ -4363,7 +4443,15 @@ Cypress.Commands.add(if (response.body.capture_method !== undefined) {expect(response.body.payment_id).to.equal(paymentId);for (const key in resData.body) {- expect(resData.body[key]).to.equal(response.body[key]);+ if (key === "payment_method_data" && globalState.get("connectorId") === "checkout") {+ expect(response.body[key], [key]).to.not.be.empty;+ expect(+ response.body[key]?.card?.auth_code,+ "payment_method_data.card.auth_code"+ ).to.be.a("string").and.not.be.empty;+ } else {+ expect(resData.body[key], [key]).to.equal(response.body[key]);+ }}} else {defaultErrorHandler(response, resData);@@ -5002,9 +5090,17 @@ Cypress.Commands.add(// Response body key comparison runs for all three_ds paths, including succeeded status// — the redirect URL is extracted above when status !== succeeded, but all response keys are verified herefor (const key in resData.body) {- expect(resData.body[key], [key]).to.deep.equal(- response.body[key]- );+ if (key === "payment_method_data" && globalState.get("connectorId") === "checkout") {+ expect(response.body[key], [key]).to.not.be.empty;+ expect(+ response.body[key]?.card?.auth_code,+ "payment_method_data.card.auth_code"+ ).to.be.a("string").and.not.be.empty;+ } else {+ expect(resData.body[key], [key]).to.deep.equal(+ response.body[key]+ );+ }}} else if (response.body.authentication_type === "no_three_ds") {if (@@ -5075,9 +5171,17 @@ Cypress.Commands.add(// Response body key comparison runs for all three_ds paths, including succeeded status// — the redirect URL is extracted above when status !== succeeded, but all response keys are verified herefor (const key in resData.body) {- expect(resData.body[key], [key]).to.deep.equal(- response.body[key]- );+ if (key === "payment_method_data" && globalState.get("connectorId") === "checkout") {+ expect(response.body[key], [key]).to.not.be.empty;+ expect(+ response.body[key]?.card?.auth_code,+ "payment_method_data.card.auth_code"+ ).to.be.a("string").and.not.be.empty;+ } else {+ expect(resData.body[key], [key]).to.deep.equal(+ response.body[key]+ );+ }}} else if (response.body.authentication_type === "no_three_ds") {if (