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
ci(cypress): Added 3DS Refund flow (#4635)
preetamrevankare79524b29554
diff --git a/cypress-tests/cypress/e2e/ConnectorTest/00008-RefundPayment.cy.js b/cypress-tests/cypress/e2e/ConnectorTest/00008-RefundPayment.cy.jsindex d45aa6dfec..68ce768b41 100644--- a/cypress-tests/cypress/e2e/ConnectorTest/00008-RefundPayment.cy.js+++ b/cypress-tests/cypress/e2e/ConnectorTest/00008-RefundPayment.cy.js@@ -342,3 +342,318 @@ describe("Card - Refund flow test", () => {});});+++ context("Card - Full Refund flow test for 3DS", () => {++ it("create-payment-call-test", () => {+ let det = getConnectorDetails(globalState.get("connectorId"))["card_pm"]["3DS"];+ cy.createPaymentIntentTest(createPaymentBody, det, "three_ds", "automatic", globalState);+ });++ it("payment_methods-call-test", () => {+ cy.paymentMethodsCallTest(globalState);+ });++ it("Confirm 3DS", () => {+ let det = getConnectorDetails(globalState.get("connectorId"))["card_pm"]["3DS"];+ cy.task('cli_log', "GLOBAL STATE -> " + JSON.stringify(globalState.data));+ cy.confirmCallTest(confirmBody, det, true, globalState);+ });++ it("Handle redirection", () => {+ let expected_redirection = confirmBody["return_url"];+ cy.handleRedirection(globalState, expected_redirection);+ })++ it("retrieve-payment-call-test", () => {+ cy.retrievePaymentCallTest(globalState);+ });++ it("refund-call-test", () => {+ let det = getConnectorDetails(globalState.get("connectorId"))["card_pm"]["3DS"];+ cy.refundCallTest(refundBody, 6500, det, globalState);+ });+ });++ context("Card - Partial Refund flow test for 3DS", () => {++ it("create-payment-call-test", () => {+ let det = getConnectorDetails(globalState.get("connectorId"))["card_pm"]["3DS"];+ cy.createPaymentIntentTest(createPaymentBody, det, "three_ds", "automatic", globalState);+ });++ it("payment_methods-call-test", () => {+ cy.paymentMethodsCallTest(globalState);+ });++ it("Confirm 3DS", () => {+ let det = getConnectorDetails(globalState.get("connectorId"))["card_pm"]["3DS"];+ cy.task('cli_log', "GLOBAL STATE -> " + JSON.stringify(globalState.data));+ cy.confirmCallTest(confirmBody, det, true, globalState);+ });++ it("Handle redirection", () => {+ let expected_redirection = confirmBody["return_url"];+ cy.handleRedirection(globalState, expected_redirection);+ })++ it("retrieve-payment-call-test", () => {+ cy.retrievePaymentCallTest(globalState);+ });++ it("refund-call-test", () => {+ let det = getConnectorDetails(globalState.get("connectorId"))["card_pm"]["3DS"];+ cy.refundCallTest(refundBody, 1200, det, globalState);+ });++ it("refund-call-test", () => {+ let det = getConnectorDetails(globalState.get("connectorId"))["card_pm"]["3DS"];+ cy.refundCallTest(refundBody, 1200, det, globalState);+ });+ });++ context("Fully Refund Card-ThreeDS payment flow test Create+Confirm", () => {++ it("create+confirm-payment-call-test", () => {+ console.log("confirm -> " + globalState.get("connectorId"));+ let det = getConnectorDetails(globalState.get("connectorId"))["card_pm"]["3DS"];+ cy.createConfirmPaymentTest( createConfirmPaymentBody, det,"three_ds", "automatic", globalState);+ });++ it("Handle redirection", () => {+ let expected_redirection = confirmBody["return_url"];+ cy.handleRedirection(globalState, expected_redirection);+ })++ it("retrieve-payment-call-test", () => {+ cy.retrievePaymentCallTest(globalState);+ });++ it("refund-call-test", () => {+ let det = getConnectorDetails(globalState.get("connectorId"))["card_pm"]["3DS"];+ cy.refundCallTest(refundBody, 6540, det, globalState);+ });++ });++ context("Partially Refund Card-ThreeDS payment flow test Create+Confirm", () => {++ it("create+confirm-payment-call-test", () => {+ let det = getConnectorDetails(globalState.get("connectorId"))["card_pm"]["3DS"];+ cy.createConfirmPaymentTest( createConfirmPaymentBody, det,"three_ds", "automatic", globalState);+ });++ it("Handle redirection", () => {+ let expected_redirection = confirmBody["return_url"];+ cy.handleRedirection(globalState, expected_redirection);+ })++ it("retrieve-payment-call-test", () => {+ cy.retrievePaymentCallTest(globalState);+ });++ it("refund-call-test", () => {+ let det = getConnectorDetails(globalState.get("connectorId"))["card_pm"]["3DS"];+ cy.refundCallTest(refundBody, 3000, det, globalState);+ });++ it("refund-call-test", () => {+ let det = getConnectorDetails(globalState.get("connectorId"))["card_pm"]["3DS"];+ cy.refundCallTest(refundBody, 3000, det, globalState);+ });++ it("sync-refund-call-test", () => {+ let det = getConnectorDetails(globalState.get("connectorId"))["card_pm"]["3DS"];+ cy.syncRefundCallTest(det, globalState);+ });++ });++ context("Card - Full Refund for fully captured 3DS payment", () => {++ it("create-payment-call-test", () => {+ let det = getConnectorDetails(globalState.get("connectorId"))["card_pm"]["3DS"];+ cy.createPaymentIntentTest(createPaymentBody, det, "three_ds", "manual", globalState);+ });++ it("payment_methods-call-test", () => {+ cy.paymentMethodsCallTest(globalState);+ });+++ it("confirm-call-test", () => {+ let det = getConnectorDetails(globalState.get("connectorId"))["card_pm"]["3DS"];+ cy.confirmCallTest(confirmBody, det, true, globalState);+ });++ it("Handle redirection", () => {+ let expected_redirection = confirmBody["return_url"];+ cy.handleRedirection(globalState, expected_redirection);+ })+++ it("retrieve-payment-call-test", () => {+ cy.retrievePaymentCallTest(globalState);+ });++ it("capture-call-test", () => {+ let det = getConnectorDetails(globalState.get("connectorId"))["card_pm"]["3DS"];+ cy.captureCallTest(captureBody, 6500, det.paymentSuccessfulStatus, globalState);+ });++ it("retrieve-payment-call-test", () => {+ cy.retrievePaymentCallTest(globalState);+ });++ it("refund-call-test", () => {+ let det = getConnectorDetails(globalState.get("connectorId"))["card_pm"]["3DS"];+ cy.refundCallTest(refundBody, 6500, det, globalState);+ });++ it("sync-refund-call-test", () => {+ let det = getConnectorDetails(globalState.get("connectorId"))["card_pm"]["3DS"];+ cy.syncRefundCallTest(det, globalState);+ });+ });++ context("Card - Partial Refund for fully captured 3DS payment", () => {++ it("create-payment-call-test", () => {+ let det = getConnectorDetails(globalState.get("connectorId"))["card_pm"]["3DS"];+ cy.createPaymentIntentTest(createPaymentBody, det, "three_ds", "manual", globalState);+ });++ it("payment_methods-call-test", () => {+ cy.paymentMethodsCallTest(globalState);+ });++ it("confirm-call-test", () => {+ let det = getConnectorDetails(globalState.get("connectorId"))["card_pm"]["3DS"];+ cy.confirmCallTest(confirmBody, det, true, globalState);+ });++ it("Handle redirection", () => {+ let expected_redirection = confirmBody["return_url"];+ cy.handleRedirection(globalState, expected_redirection);+ })++ it("retrieve-payment-call-test", () => {+ cy.retrievePaymentCallTest(globalState);+ });++ it("capture-call-test", () => {+ let det = getConnectorDetails(globalState.get("connectorId"))["card_pm"]["3DS"];+ cy.captureCallTest(captureBody, 6500, det.paymentSuccessfulStatus, globalState);+ });++ it("retrieve-payment-call-test", () => {+ cy.retrievePaymentCallTest(globalState);+ });++ it("refund-call-test", () => {+ let det = getConnectorDetails(globalState.get("connectorId"))["card_pm"]["3DS"];+ cy.refundCallTest(refundBody, 5000, det, globalState);+ });+ it("refund-call-test", () => {+ let det = getConnectorDetails(globalState.get("connectorId"))["card_pm"]["3DS"];+ cy.refundCallTest(refundBody, 500, det, globalState);+ });++ it("sync-refund-call-test", () => {+ let det = getConnectorDetails(globalState.get("connectorId"))["card_pm"]["3DS"];+ cy.syncRefundCallTest(det, globalState);+ });++ });++ context("Card - Full Refund for partially captured 3DS payment", () => {++ it("create-payment-call-test", () => {+ let det = getConnectorDetails(globalState.get("connectorId"))["card_pm"]["3DS"];+ cy.createPaymentIntentTest(createPaymentBody, det, "three_ds", "manual", globalState);+ });++ it("payment_methods-call-test", () => {+ cy.paymentMethodsCallTest(globalState);+ });++ it("confirm-call-test", () => {+ let det = getConnectorDetails(globalState.get("connectorId"))["card_pm"]["3DS"];+ cy.confirmCallTest(confirmBody, det, true, globalState);+ });++ it("Handle redirection", () => {+ let expected_redirection = confirmBody["return_url"];+ cy.handleRedirection(globalState, expected_redirection);+ })++ it("retrieve-payment-call-test", () => {+ cy.retrievePaymentCallTest(globalState);+ });++ it("capture-call-test", () => {+ let det = getConnectorDetails(globalState.get("connectorId"))["card_pm"]["3DS"];+ cy.captureCallTest(captureBody, 4000, det.paymentSuccessfulStatus, globalState);+ });++ it("retrieve-payment-call-test", () => {+ cy.retrievePaymentCallTest(globalState);+ });++ it("refund-call-test", () => {+ let det = getConnectorDetails(globalState.get("connectorId"))["card_pm"]["3DS"];+ cy.refundCallTest(refundBody, 4000, det, globalState);+ });++ it("sync-refund-call-test", () => {+ let det = getConnectorDetails(globalState.get("connectorId"))["card_pm"]["3DS"];+ cy.syncRefundCallTest(det, globalState);+ });+ });++ context("Card - partial Refund for partially captured 3DS payment", () => {++ it("create-payment-call-test", () => {+ let det = getConnectorDetails(globalState.get("connectorId"))["card_pm"]["3DS"];+ cy.createPaymentIntentTest(createPaymentBody, det, "three_ds", "manual", globalState);+ });++ it("payment_methods-call-test", () => {+ cy.paymentMethodsCallTest(globalState);+ });++ it("confirm-call-test", () => {+ let det = getConnectorDetails(globalState.get("connectorId"))["card_pm"]["3DS"];+ cy.confirmCallTest(confirmBody, det, true, globalState);+ });++ it("Handle redirection", () => {+ let expected_redirection = confirmBody["return_url"];+ cy.handleRedirection(globalState, expected_redirection);+ })++ it("retrieve-payment-call-test", () => {+ cy.retrievePaymentCallTest(globalState);+ });++ it("capture-call-test", () => {+ let det = getConnectorDetails(globalState.get("connectorId"))["card_pm"]["3DS"];+ cy.captureCallTest(captureBody, 4000, det.paymentSuccessfulStatus, globalState);+ });++ it("retrieve-payment-call-test", () => {+ cy.retrievePaymentCallTest(globalState);+ });++ it("refund-call-test", () => {+ let det = getConnectorDetails(globalState.get("connectorId"))["card_pm"]["3DS"];+ cy.refundCallTest(refundBody, 3000, det, globalState);+ });++ it("sync-refund-call-test", () => {+ let det = getConnectorDetails(globalState.get("connectorId"))["card_pm"]["3DS"];+ cy.syncRefundCallTest(det, globalState);+ });+ });+diff --git a/cypress-tests/cypress/e2e/ConnectorUtils/BankOfAmerica.js b/cypress-tests/cypress/e2e/ConnectorUtils/BankOfAmerica.jsindex d92b66e965..92b5f50981 100644--- a/cypress-tests/cypress/e2e/ConnectorUtils/BankOfAmerica.js+++ b/cypress-tests/cypress/e2e/ConnectorUtils/BankOfAmerica.js@@ -40,7 +40,7 @@ card_pm:{"MandateSingleUse3DS": {"card": successfulThreeDSTestCardDetails,"currency": "USD",- "paymentSuccessfulStatus": "requires_customer_action",+ "paymentSuccessfulStatus": "succeeded","paymentSyncStatus": "succeeded","refundStatus": "pending","refundSyncStatus": "pending",diff --git a/cypress-tests/cypress/e2e/ConnectorUtils/Bluesnap.js b/cypress-tests/cypress/e2e/ConnectorUtils/Bluesnap.jsindex 540152eb6c..523e6003ae 100644--- a/cypress-tests/cypress/e2e/ConnectorUtils/Bluesnap.js+++ b/cypress-tests/cypress/e2e/ConnectorUtils/Bluesnap.js@@ -39,7 +39,7 @@ card_pm:{"MandateSingleUse3DS": {"card": successfulThreeDSTestCardDetails,"currency": "USD",- "paymentSuccessfulStatus": "requires_customer_action",+ "paymentSuccessfulStatus": "succeeded","paymentSyncStatus": "succeeded","refundStatus": "succeeded","refundSyncStatus": "succeeded",diff --git a/cypress-tests/cypress/e2e/ConnectorUtils/Cybersource.js b/cypress-tests/cypress/e2e/ConnectorUtils/Cybersource.jsindex ec81ddc20c..c200adf64c 100644--- a/cypress-tests/cypress/e2e/ConnectorUtils/Cybersource.js+++ b/cypress-tests/cypress/e2e/ConnectorUtils/Cybersource.js@@ -39,7 +39,7 @@ card_pm:{"MandateSingleUse3DS": {"card": successfulThreeDSTestCardDetails,"currency": "USD",- "paymentSuccessfulStatus": "requires_customer_action",+ "paymentSuccessfulStatus": "succeeded","paymentSyncStatus": "succeeded","refundStatus": "pending","refundSyncStatus": "pending",diff --git a/cypress-tests/cypress/fixtures/create-mandate-cit.json b/cypress-tests/cypress/fixtures/create-mandate-cit.jsonindex e75aab9d00..c96284ea99 100644--- a/cypress-tests/cypress/fixtures/create-mandate-cit.json+++ b/cypress-tests/cypress/fixtures/create-mandate-cit.json@@ -11,7 +11,7 @@"phone_country_code": "+65","description": "Its my first payment request","authentication_type": "no_three_ds",- "return_url": "https://duck.com",+ "return_url": "https://hyperswitch.io","payment_method": "card","payment_method_type": "debit","payment_method_data": {diff --git a/cypress-tests/cypress/support/commands.js b/cypress-tests/cypress/support/commands.jsindex e6518f7025..3eeeb5a145 100644--- a/cypress-tests/cypress/support/commands.js+++ b/cypress-tests/cypress/support/commands.js@@ -498,6 +498,7 @@ Cypress.Commands.add("citForMandatesCallTest", (requestBody, amount, details, coexpect(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);cy.log(response.body);cy.log(nextActionUrl);} else if (response.body.authentication_type === "no_three_ds") {