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
fix(cypress): Cypress for WorldpayWPG (#11751)
Vani Gupta00bdf77a48c5
diff --git a/cypress-tests/cypress/e2e/configs/Payment/Worldpayxml.js b/cypress-tests/cypress/e2e/configs/Payment/Worldpayxml.jsindex 2970c5c68c..37abb18ff4 100644--- a/cypress-tests/cypress/e2e/configs/Payment/Worldpayxml.js+++ b/cypress-tests/cypress/e2e/configs/Payment/Worldpayxml.js@@ -66,6 +66,9 @@ export const connectorDetails = {},},"3DSManualCapture": getCustomExchange({+ Configs: {+ TRIGGER_SKIP: true,+ },Request: {amount: 6000,payment_method: "card",@@ -76,8 +79,17 @@ export const connectorDetails = {customer_acceptance: null,setup_future_usage: "on_session",},+ Response: {+ status: 200,+ body: {+ status: "requires_customer_action",+ },+ },}),"3DSAutoCapture": {+ Configs: {+ TRIGGER_SKIP: true,+ },Request: {payment_method: "card",amount: 6000,@@ -481,24 +493,86 @@ export const connectorDetails = {status: "processing",},},- },- SaveCardUseNo3DSAutoCaptureOffSession: {- Configs: {- TRIGGER_SKIP: true,+ PaymentMethodIdMandate3DSAutoCapture: {+ Configs: {+ TRIGGER_SKIP: true,+ },+ Request: {+ payment_method: "card",+ payment_method_type: "debit",+ payment_method_data: {+ card: successful3DSTestCardDetails,+ },+ mandate_data: null,+ authentication_type: "three_ds",+ customer_acceptance: customerAcceptance,+ },+ Response: {+ status: 200,+ body: {+ status: "requires_customer_action",+ },+ },},- Request: {- payment_method: "card",- payment_method_type: "debit",- payment_method_data: {- card: successfulNo3DSCardDetails,- },- setup_future_usage: "off_session",- customer_acceptance: customerAcceptance,+ PaymentMethodIdMandate3DSManualCapture: {+ Configs: {+ TRIGGER_SKIP: true,+ },+ Request: {+ payment_method: "card",+ payment_method_type: "debit",+ payment_method_data: {+ card: successful3DSTestCardDetails,+ },+ mandate_data: null,+ authentication_type: "three_ds",+ customer_acceptance: customerAcceptance,+ },+ Response: {+ status: 200,+ body: {+ status: "requires_customer_action",+ },+ },},- Response: {- status: 200,- body: {- status: "processing",+ SaveCardUseNo3DSAutoCaptureOffSession: {+ Configs: {+ TRIGGER_SKIP: true,+ },+ Request: {+ payment_method: "card",+ payment_method_type: "debit",+ payment_method_data: {+ card: successfulNo3DSCardDetails,+ },+ setup_future_usage: "off_session",+ customer_acceptance: customerAcceptance,+ },+ Response: {+ status: 200,+ body: {+ status: "processing",+ },+ },+ },+ SaveCardUse3DSAutoCaptureOffSession: {+ Configs: {+ TRIGGER_SKIP: true,+ },+ Request: {+ payment_method: "card",+ payment_method_type: "debit",+ payment_method_data: {+ card: successfulNo3DSCardDetails,+ },+ setup_future_usage: "off_session",+ customer_acceptance: customerAcceptance,+ },+ Response: {+ status: 200,+ body: {+ status: "requires_customer_action",+ },},},},diff --git a/cypress-tests/cypress/support/commands.js b/cypress-tests/cypress/support/commands.jsindex 8c1d6e46e8..fb5f7f3f1e 100644--- a/cypress-tests/cypress/support/commands.js+++ b/cypress-tests/cypress/support/commands.js@@ -2307,13 +2307,23 @@ Cypress.Commands.add(if (response.body.capture_method === "automatic") {if (response.body.authentication_type === "three_ds") {- expect(response.body)- .to.have.property("next_action")- .to.have.property("redirect_to_url");- globalState.set(- "nextActionUrl",- response.body.next_action.redirect_to_url- );+ if (response.body.next_action.type === "invoke_ddc") {+ expect(response.body.next_action)+ .to.have.property("type")+ .to.equal("invoke_ddc");+ globalState.set(+ "nextActionUrl",+ response.body.next_action.ddc_data.iframe_url+ );+ } else {+ expect(response.body)+ .to.have.property("next_action")+ .to.have.property("redirect_to_url");+ globalState.set(+ "nextActionUrl",+ response.body.next_action.redirect_to_url+ );+ }for (const key in resData.body) {expect(resData.body[key], [key]).to.deep.equal(response.body[key]@@ -2341,13 +2351,24 @@ Cypress.Commands.add(}} else if (response.body.capture_method === "manual") {if (response.body.authentication_type === "three_ds") {- expect(response.body)- .to.have.property("next_action")- .to.have.property("redirect_to_url");- globalState.set(- "nextActionUrl",- response.body.next_action.redirect_to_url- );+ expect(response.body).to.have.property("next_action");+ if (response.body.next_action.type === "invoke_ddc") {+ expect(response.body.next_action)+ .to.have.property("type")+ .to.equal("invoke_ddc");+ globalState.set(+ "nextActionUrl",+ response.body.next_action.ddc_data.iframe_url+ );+ } else {+ expect(response.body.next_action).to.have.property(+ "redirect_to_url"+ );+ globalState.set(+ "nextActionUrl",+ response.body.next_action.redirect_to_url+ );+ }for (const key in resData.body) {expect(resData.body[key], [key]).to.deep.equal(response.body[key]@@ -2844,13 +2865,24 @@ Cypress.Commands.add(if (response.body.capture_method === "automatic") {if (response.body.authentication_type === "three_ds") {- expect(response.body)- .to.have.property("next_action")- .to.have.property("redirect_to_url");- globalState.set(- "nextActionUrl",- response.body.next_action.redirect_to_url- );+ expect(response.body).to.have.property("next_action");+ if (response.body.next_action.type === "invoke_ddc") {+ expect(response.body.next_action)+ .to.have.property("type")+ .to.equal("invoke_ddc");+ globalState.set(+ "nextActionUrl",+ response.body.next_action.ddc_data.iframe_url+ );+ } else {+ expect(response.body.next_action).to.have.property(+ "redirect_to_url"+ );+ globalState.set(+ "nextActionUrl",+ response.body.next_action.redirect_to_url+ );+ }for (const key in resData.body) {expect(resData.body[key], [key]).to.deep.equal(response.body[key]@@ -2869,13 +2901,23 @@ Cypress.Commands.add(}} else if (response.body.capture_method === "manual") {if (response.body.authentication_type === "three_ds") {- expect(response.body)- .to.have.property("next_action")- .to.have.property("redirect_to_url");- globalState.set(- "nextActionUrl",- response.body.next_action.redirect_to_url- );+ if (response.body.next_action.type === "invoke_ddc") {+ expect(response.body.next_action)+ .to.have.property("type")+ .to.equal("invoke_ddc");+ globalState.set(+ "nextActionUrl",+ response.body.next_action.ddc_data.iframe_url+ );+ } else {+ expect(response.body)+ .to.have.property("next_action")+ .to.have.property("redirect_to_url");+ globalState.set(+ "nextActionUrl",+ response.body.next_action.redirect_to_url+ );+ }for (const key in resData.body) {expect(resData.body[key], [key]).to.deep.equal(response.body[key]@@ -3552,14 +3594,26 @@ Cypress.Commands.add(if (response.body.capture_method === "automatic") {expect(response.body).to.have.property("mandate_id");if (response.body.authentication_type === "three_ds") {- expect(response.body)- .to.have.property("next_action")- .to.have.property("redirect_to_url");- const nextActionUrl = response.body.next_action.redirect_to_url;- globalState.set(- "nextActionUrl",- response.body.next_action.redirect_to_url- );+ let nextActionUrl = null;+ if (response.body.next_action.type === "invoke_ddc") {+ expect(response.body.next_action)+ .to.have.property("type")+ .to.equal("invoke_ddc");+ nextActionUrl = response.body.next_action.ddc_data.iframe_url;+ globalState.set(+ "nextActionUrl",+ response.body.next_action.ddc_data.iframe_url+ );+ } else {+ expect(response.body)+ .to.have.property("next_action")+ .to.have.property("redirect_to_url");+ nextActionUrl = response.body.next_action.redirect_to_url;+ globalState.set(+ "nextActionUrl",+ response.body.next_action.redirect_to_url+ );+ }cy.log(nextActionUrl);for (const key in resData.body) {expect(resData.body[key], [key]).to.deep.equal(@@ -3590,14 +3644,26 @@ Cypress.Commands.add(}} else if (response.body.capture_method === "manual") {if (response.body.authentication_type === "three_ds") {- expect(response.body)- .to.have.property("next_action")- .to.have.property("redirect_to_url");- const nextActionUrl = response.body.next_action.redirect_to_url;- globalState.set(- "nextActionUrl",- response.body.next_action.redirect_to_url- );+ let nextActionUrl = null;+ if (response.body.next_action.type === "invoke_ddc") {+ expect(response.body.next_action)+ .to.have.property("type")+ .to.equal("invoke_ddc");+ nextActionUrl = response.body.next_action.ddc_data.iframe_url;+ globalState.set(+ "nextActionUrl",+ response.body.next_action.ddc_data.iframe_url+ );+ } else {+ expect(response.body)+ .to.have.property("next_action")+ .to.have.property("redirect_to_url");+ nextActionUrl = response.body.next_action.redirect_to_url;+ globalState.set(+ "nextActionUrl",+ response.body.next_action.redirect_to_url+ );+ }cy.log(nextActionUrl);for (const key in resData.body) {expect(resData.body[key], [key]).to.deep.equal(