Skip to content

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

feat(cypress): add iatapay connector (#5093)

Pa1NarKf03dc7a1c9bc
diff --git a/cypress-tests/cypress/e2e/PaymentTest/00008-RefundPayment.cy.js b/cypress-tests/cypress/e2e/PaymentTest/00008-RefundPayment.cy.js
index eadab2bb43..163607e42c 100644
--- a/cypress-tests/cypress/e2e/PaymentTest/00008-RefundPayment.cy.js
+++ b/cypress-tests/cypress/e2e/PaymentTest/00008-RefundPayment.cy.js
@@ -4,15 +4,14 @@ import createConfirmPaymentBody from "../../fixtures/create-confirm-body.json";
import citConfirmBody from "../../fixtures/create-mandate-cit.json";
import mitConfirmBody from "../../fixtures/create-mandate-mit.json";
import createPaymentBody from "../../fixtures/create-payment-body.json";
-import refundBody from "../../fixtures/refund-flow-body.json";
import listRefundCall from "../../fixtures/list-refund-call-body.json";
+import refundBody from "../../fixtures/refund-flow-body.json";
import State from "../../utils/State";
-import getConnectorDetails from "../PaymentUtils/utils";
-import * as utils from "../PaymentUtils/utils";
+import getConnectorDetails, * as utils from "../PaymentUtils/utils";
let globalState;
-describe("Card - Refund flow test", () => {
+describe("Card - Refund flow - No 3DS", () => {
before("seed global state", () => {
cy.task("getGlobalState").then((state) => {
globalState = new State(state);
@@ -708,15 +707,7 @@ describe("Card - Refund flow test", () => {
);
});
-context("Card - Full Refund flow test for 3DS", () => {
- let should_continue = true; // variable that will be used to skip tests if a previous test fails
-
- beforeEach(function () {
- if (!should_continue) {
- this.skip();
- }
- });
-
+describe("Card - Refund flow - 3DS", () => {
before("seed global state", () => {
cy.task("getGlobalState").then((state) => {
globalState = new State(state);
@@ -727,186 +718,70 @@ context("Card - Full Refund flow test for 3DS", () => {
cy.task("setGlobalState", globalState.data);
});
- it("create-payment-call-test", () => {
- let data = getConnectorDetails(globalState.get("connectorId"))["card_pm"][
- "PaymentIntent"
- ];
- let req_data = data["Request"];
- let res_data = data["Response"];
- cy.createPaymentIntentTest(
- createPaymentBody,
- req_data,
- res_data,
- "three_ds",
- "automatic",
- globalState
- );
- if (should_continue)
- should_continue = utils.should_continue_further(res_data);
- });
-
- it("payment_methods-call-test", () => {
- cy.paymentMethodsCallTest(globalState);
- });
-
- it("Confirm 3DS", () => {
- let data = getConnectorDetails(globalState.get("connectorId"))["card_pm"][
- "3DSAutoCapture"
- ];
- let req_data = data["Request"];
- let res_data = data["Response"];
- cy.confirmCallTest(confirmBody, req_data, res_data, true, globalState);
- if (should_continue)
- should_continue = utils.should_continue_further(res_data);
- });
-
- 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 data = getConnectorDetails(globalState.get("connectorId"))["card_pm"][
- "Refund"
- ];
- let req_data = data["Request"];
- let res_data = data["Response"];
- cy.refundCallTest(refundBody, req_data, res_data, 6500, globalState);
- if (should_continue)
- should_continue = utils.should_continue_further(res_data);
- });
-});
-
-context("Card - Partial Refund flow test for 3DS", () => {
- let should_continue = true; // variable that will be used to skip tests if a previous test fails
-
- beforeEach(function () {
- if (!should_continue) {
- this.skip();
- }
- });
-
- it("create-payment-call-test", () => {
- let data = getConnectorDetails(globalState.get("connectorId"))["card_pm"][
- "PaymentIntent"
- ];
- let req_data = data["Request"];
- let res_data = data["Response"];
- cy.createPaymentIntentTest(
- createPaymentBody,
- req_data,
- res_data,
- "three_ds",
- "automatic",
- globalState
- );
- if (should_continue)
- should_continue = utils.should_continue_further(res_data);
- });
-
- it("payment_methods-call-test", () => {
- cy.paymentMethodsCallTest(globalState);
- });
-
- it("Confirm 3DS", () => {
- let data = getConnectorDetails(globalState.get("connectorId"))["card_pm"][
- "3DSAutoCapture"
- ];
- let req_data = data["Request"];
- let res_data = data["Response"];
- console.log("det -> " + data.card);
- cy.confirmCallTest(confirmBody, req_data, res_data, true, globalState);
- if (should_continue)
- should_continue = utils.should_continue_further(res_data);
- });
-
- 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 data = getConnectorDetails(globalState.get("connectorId"))["card_pm"][
- "PartialRefund"
- ];
- let req_data = data["Request"];
- let res_data = data["Response"];
- cy.refundCallTest(refundBody, req_data, res_data, 1200, globalState);
- if (should_continue)
- should_continue = utils.should_continue_further(res_data);
- });
+ context("Card - Full Refund flow test for 3DS", () => {
+ let should_continue = true; // variable that will be used to skip tests if a previous test fails
- it("refund-call-test", () => {
- let data = getConnectorDetails(globalState.get("connectorId"))["card_pm"][
- "PartialRefund"
- ];
- let req_data = data["Request"];
- let res_data = data["Response"];
- cy.refundCallTest(refundBody, req_data, res_data, 1200, globalState);
- if (should_continue)
- should_continue = utils.should_continue_further(res_data);
- });
-});
+ beforeEach(function () {
+ if (!should_continue) {
+ this.skip();
+ }
+ });
-context("Fully Refund Card-ThreeDS payment flow test Create+Confirm", () => {
- let should_continue = true; // variable that will be used to skip tests if a previous test fails
+ it("create-payment-call-test", () => {
+ let data = getConnectorDetails(globalState.get("connectorId"))["card_pm"][
+ "PaymentIntent"
+ ];
+ let req_data = data["Request"];
+ let res_data = data["Response"];
+ cy.createPaymentIntentTest(
+ createPaymentBody,
+ req_data,
+ res_data,
+ "three_ds",
+ "automatic",
+ globalState
+ );
+ if (should_continue)
+ should_continue = utils.should_continue_further(res_data);
+ });
- beforeEach(function () {
- if (!should_continue) {
- this.skip();
- }
- });
+ it("payment_methods-call-test", () => {
+ cy.paymentMethodsCallTest(globalState);
+ });
- it("create+confirm-payment-call-test", () => {
- let data = getConnectorDetails(globalState.get("connectorId"))["card_pm"][
- "3DSAutoCapture"
- ];
- let req_data = data["Request"];
- let res_data = data["Response"];
- cy.createConfirmPaymentTest(
- createConfirmPaymentBody,
- req_data,
- res_data,
- "three_ds",
- "automatic",
- globalState
- );
- if (should_continue)
- should_continue = utils.should_continue_further(res_data);
- });
+ it("Confirm 3DS", () => {
+ let data = getConnectorDetails(globalState.get("connectorId"))["card_pm"][
+ "3DSAutoCapture"
+ ];
+ let req_data = data["Request"];
+ let res_data = data["Response"];
+ cy.confirmCallTest(confirmBody, req_data, res_data, true, globalState);
+ if (should_continue)
+ should_continue = utils.should_continue_further(res_data);
+ });
- it("Handle redirection", () => {
- let expected_redirection = confirmBody["return_url"];
- cy.handleRedirection(globalState, expected_redirection);
- });
+ it("Handle redirection", () => {
+ let expected_redirection = confirmBody["return_url"];
+ cy.handleRedirection(globalState, expected_redirection);
+ });
- it("retrieve-payment-call-test", () => {
- cy.retrievePaymentCallTest(globalState);
- });
+ it("retrieve-payment-call-test", () => {
+ cy.retrievePaymentCallTest(globalState);
+ });
- it("refund-call-test", () => {
- let data = getConnectorDetails(globalState.get("connectorId"))["card_pm"][
- "Refund"
- ];
- let req_data = data["Request"];
- let res_data = data["Response"];
- cy.refundCallTest(refundBody, req_data, res_data, 6500, globalState);
- if (should_continue)
- should_continue = utils.should_continue_further(res_data);
+ it("refund-call-test", () => {
+ let data = getConnectorDetails(globalState.get("connectorId"))["card_pm"][
+ "Refund"
+ ];
+ let req_data = data["Request"];
+ let res_data = data["Response"];
+ cy.refundCallTest(refundBody, req_data, res_data, 6500, globalState);
+ if (should_continue)
+ should_continue = utils.should_continue_further(res_data);
+ });
});
-});
-context(
- "Partially Refund Card-ThreeDS payment flow test Create+Confirm",
- () => {
+ context("Card - Partial Refund flow test for 3DS", () => {
let should_continue = true; // variable that will be used to skip tests if a previous test fails
beforeEach(function () {
@@ -915,14 +790,14 @@ context(
}
});
- it("create+confirm-payment-call-test", () => {
+ it("create-payment-call-test", () => {
let data = getConnectorDetails(globalState.get("connectorId"))["card_pm"][
- "3DSAutoCapture"
+ "PaymentIntent"
];
let req_data = data["Request"];
let res_data = data["Response"];
- cy.createConfirmPaymentTest(
- createConfirmPaymentBody,
+ cy.createPaymentIntentTest(
+ createPaymentBody,
req_data,
res_data,
"three_ds",
@@ -933,6 +808,22 @@ context(
should_continue = utils.should_continue_further(res_data);
});
+ it("payment_methods-call-test", () => {
+ cy.paymentMethodsCallTest(globalState);
+ });
+
+ it("Confirm 3DS", () => {
+ let data = getConnectorDetails(globalState.get("connectorId"))["card_pm"][
+ "3DSAutoCapture"
+ ];
+ let req_data = data["Request"];
+ let res_data = data["Response"];
+ console.log("det -> " + data.card);
+ cy.confirmCallTest(confirmBody, req_data, res_data, true, globalState);
+ if (should_continue)
+ should_continue = utils.should_continue_further(res_data);
+ });
+
it("Handle redirection", () => {
let expected_redirection = confirmBody["return_url"];
cy.handleRedirection(globalState, expected_redirection);
@@ -948,7 +839,7 @@ context(
];
let req_data = data["Request"];
let res_data = data["Response"];
- cy.refundCallTest(refundBody, req_data, res_data, 3000, globalState);
+ cy.refundCallTest(refundBody, req_data, res_data, 1200, globalState);
if (should_continue)
should_continue = utils.should_continue_further(res_data);
});
@@ -959,346 +850,456 @@ context(
];
let req_data = data["Request"];
let res_data = data["Response"];
- cy.refundCallTest(refundBody, req_data, res_data, 3000, globalState);
+ cy.refundCallTest(refundBody, req_data, res_data, 1200, globalState);
if (should_continue)
should_continue = utils.should_continue_further(res_data);
});
+ });
- it("sync-refund-call-test", () => {
+ context("Fully Refund Card-ThreeDS payment flow test Create+Confirm", () => {
+ let should_continue = true; // variable that will be used to skip tests if a previous test fails
+
+ beforeEach(function () {
+ if (!should_continue) {
+ this.skip();
+ }
+ });
+
+ it("create+confirm-payment-call-test", () => {
let data = getConnectorDetails(globalState.get("connectorId"))["card_pm"][
- "SyncRefund"
+ "3DSAutoCapture"
];
let req_data = data["Request"];
let res_data = data["Response"];
- cy.syncRefundCallTest(req_data, res_data, globalState);
+ cy.createConfirmPaymentTest(
+ createConfirmPaymentBody,
+ req_data,
+ res_data,
+ "three_ds",
+ "automatic",
+ globalState
+ );
if (should_continue)
should_continue = utils.should_continue_further(res_data);
});
- }
-);
-
-context("Card - Full Refund for fully captured 3DS payment", () => {
- let should_continue = true; // variable that will be used to skip tests if a previous test fails
- beforeEach(function () {
- if (!should_continue) {
- this.skip();
- }
- });
+ it("Handle redirection", () => {
+ let expected_redirection = confirmBody["return_url"];
+ cy.handleRedirection(globalState, expected_redirection);
+ });
- it("create-payment-call-test", () => {
- let data = getConnectorDetails(globalState.get("connectorId"))["card_pm"][
- "PaymentIntent"
- ];
- let req_data = data["Request"];
- let res_data = data["Response"];
- cy.createPaymentIntentTest(
- createPaymentBody,
- req_data,
- res_data,
- "three_ds",
- "manual",
- globalState
- );
- if (should_continue)
- should_continue = utils.should_continue_further(res_data);
- });
+ it("retrieve-payment-call-test", () => {
+ cy.retrievePaymentCallTest(globalState);
+ });
- it("payment_methods-call-test", () => {
- cy.paymentMethodsCallTest(globalState);
+ it("refund-call-test", () => {
+ let data = getConnectorDetails(globalState.get("connectorId"))["card_pm"][
+ "Refund"
+ ];
+ let req_data = data["Request"];
+ let res_data = data["Response"];
+ cy.refundCallTest(refundBody, req_data, res_data, 6500, globalState);
+ if (should_continue)
+ should_continue = utils.should_continue_further(res_data);
+ });
});
- it("Confirm 3DS", () => {
- let data = getConnectorDetails(globalState.get("connectorId"))["card_pm"][
- "3DSManualCapture"
- ];
- let req_data = data["Request"];
- let res_data = data["Response"];
- console.log("det -> " + data.card);
- cy.confirmCallTest(confirmBody, req_data, res_data, true, globalState);
- if (should_continue)
- should_continue = utils.should_continue_further(res_data);
- });
+ context(
+ "Partially Refund Card-ThreeDS payment flow test Create+Confirm",
+ () => {
+ let should_continue = true; // variable that will be used to skip tests if a previous test fails
- it("Handle redirection", () => {
- let expected_redirection = confirmBody["return_url"];
- cy.handleRedirection(globalState, expected_redirection);
- });
+ beforeEach(function () {
+ if (!should_continue) {
+ this.skip();
+ }
+ });
- it("retrieve-payment-call-test", () => {
- cy.retrievePaymentCallTest(globalState);
- });
+ it("create+confirm-payment-call-test", () => {
+ let data = getConnectorDetails(globalState.get("connectorId"))[
+ "card_pm"
+ ]["3DSAutoCapture"];
+ let req_data = data["Request"];
+ let res_data = data["Response"];
+ cy.createConfirmPaymentTest(
+ createConfirmPaymentBody,
+ req_data,
+ res_data,
+ "three_ds",
+ "automatic",
+ globalState
+ );
+ if (should_continue)
+ should_continue = utils.should_continue_further(res_data);
+ });
- it("capture-call-test", () => {
- let data = getConnectorDetails(globalState.get("connectorId"))["card_pm"][
- "Capture"
- ];
- let req_data = data["Request"];
- let res_data = data["Response"];
- cy.captureCallTest(captureBody, req_data, res_data, 6500, globalState);
- if (should_continue)
- should_continue = utils.should_continue_further(res_data);
- });
+ it("Handle redirection", () => {
+ let expected_redirection = confirmBody["return_url"];
+ cy.handleRedirection(globalState, expected_redirection);
+ });
- it("retrieve-payment-call-test", () => {
- cy.retrievePaymentCallTest(globalState);
- });
+ it("retrieve-payment-call-test", () => {
+ cy.retrievePaymentCallTest(globalState);
+ });
- it("refund-call-test", () => {
- let data = getConnectorDetails(globalState.get("connectorId"))["card_pm"][
- "Refund"
- ];
- let req_data = data["Request"];
- let res_data = data["Response"];
- cy.refundCallTest(refundBody, req_data, res_data, 6500, globalState);
- if (should_continue)
- should_continue = utils.should_continue_further(res_data);
- });
-});
+ it("refund-call-test", () => {
+ let data = getConnectorDetails(globalState.get("connectorId"))[
+ "card_pm"
+ ]["PartialRefund"];
+ let req_data = data["Request"];
+ let res_data = data["Response"];
+ cy.refundCallTest(refundBody, req_data, res_data, 3000, globalState);
+ if (should_continue)
+ should_continue = utils.should_continue_further(res_data);
+ });
-context("Card - Partial Refund for fully captured 3DS payment", () => {
- let should_continue = true; // variable that will be used to skip tests if a previous test fails
+ it("refund-call-test", () => {
+ let data = getConnectorDetails(globalState.get("connectorId"))[
+ "card_pm"
+ ]["PartialRefund"];
+ let req_data = data["Request"];
+ let res_data = data["Response"];
+ cy.refundCallTest(refundBody, req_data, res_data, 3000, globalState);
+ if (should_continue)
+ should_continue = utils.should_continue_further(res_data);
+ });
- beforeEach(function () {
- if (!should_continue) {
- this.skip();
+ it("sync-refund-call-test", () => {
+ let data = getConnectorDetails(globalState.get("connectorId"))[
+ "card_pm"
+ ]["SyncRefund"];
+ let req_data = data["Request"];
+ let res_data = data["Response"];
+ cy.syncRefundCallTest(req_data, res_data, globalState);
+ if (should_continue)
+ should_continue = utils.should_continue_further(res_data);
+ });
}
- });
+ );
- it("create-payment-call-test", () => {
- let data = getConnectorDetails(globalState.get("connectorId"))["card_pm"][
- "PaymentIntent"
- ];
- let req_data = data["Request"];
- let res_data = data["Response"];
- cy.createPaymentIntentTest(
- createPaymentBody,
- req_data,
- res_data,
- "three_ds",
- "manual",
- globalState
- );
- if (should_continue)
- should_continue = utils.should_continue_further(res_data);
- });
+ context("Card - Full Refund for fully captured 3DS payment", () => {
+ let should_continue = true; // variable that will be used to skip tests if a previous test fails
- it("payment_methods-call-test", () => {
- cy.paymentMethodsCallTest(globalState);
- });
+ beforeEach(function () {
+ if (!should_continue) {
+ this.skip();
+ }
+ });
- it("Confirm 3DS", () => {
- let data = getConnectorDetails(globalState.get("connectorId"))["card_pm"][
- "3DSManualCapture"
- ];
- let req_data = data["Request"];
- let res_data = data["Response"];
- console.log("det -> " + data.card);
- cy.confirmCallTest(confirmBody, req_data, res_data, true, globalState);
- if (should_continue)
- should_continue = utils.should_continue_further(res_data);
- });
+ it("create-payment-call-test", () => {
+ let data = getConnectorDetails(globalState.get("connectorId"))["card_pm"][
+ "PaymentIntent"
+ ];
+ let req_data = data["Request"];
+ let res_data = data["Response"];
+ cy.createPaymentIntentTest(
+ createPaymentBody,
+ req_data,
+ res_data,
+ "three_ds",
+ "manual",
+ globalState
+ );
+ if (should_continue)
+ should_continue = utils.should_continue_further(res_data);
+ });
- it("Handle redirection", () => {
- let expected_redirection = confirmBody["return_url"];
- cy.handleRedirection(globalState, expected_redirection);
- });
+ it("payment_methods-call-test", () => {
+ cy.paymentMethodsCallTest(globalState);
+ });
- it("retrieve-payment-call-test", () => {
- cy.retrievePaymentCallTest(globalState);
- });
+ it("Confirm 3DS", () => {
+ let data = getConnectorDetails(globalState.get("connectorId"))["card_pm"][
+ "3DSManualCapture"
+ ];
+ let req_data = data["Request"];
+ let res_data = data["Response"];
+ console.log("det -> " + data.card);
+ cy.confirmCallTest(confirmBody, req_data, res_data, true, globalState);
+ if (should_continue)
+ should_continue = utils.should_continue_further(res_data);
+ });
- it("capture-call-test", () => {
- let data = getConnectorDetails(globalState.get("connectorId"))["card_pm"][
- "Capture"
- ];
- let req_data = data["Request"];
- let res_data = data["Response"];
- cy.captureCallTest(captureBody, req_data, res_data, 6500, globalState);
- if (should_continue)
- should_continue = utils.should_continue_further(res_data);
- });
+ it("Handle redirection", () => {
+ let expected_redirection = confirmBody["return_url"];
+ cy.handleRedirection(globalState, expected_redirection);
+ });
- it("retrieve-payment-call-test", () => {
- cy.retrievePaymentCallTest(globalState);
- });
+ it("retrieve-payment-call-test", () => {
+ cy.retrievePaymentCallTest(globalState);
+ });
- it("refund-call-test", () => {
- let data = getConnectorDetails(globalState.get("connectorId"))["card_pm"][
- "Refund"
- ];
- let req_data = data["Request"];
- let res_data = data["Response"];
- cy.refundCallTest(refundBody, req_data, res_data, 5000, globalState);
- if (should_continue)
- should_continue = utils.should_continue_further(res_data);
- });
- it("refund-call-test", () => {
- let data = getConnectorDetails(globalState.get("connectorId"))["card_pm"][
- "Refund"
- ];
- let req_data = data["Request"];
- let res_data = data["Response"];
- cy.refundCallTest(refundBody, req_data, res_data, 1500, globalState);
- if (should_continue)
- should_continue = utils.should_continue_further(res_data);
- });
-});
+ it("capture-call-test", () => {
+ let data = getConnectorDetails(globalState.get("connectorId"))["card_pm"][
+ "Capture"
+ ];
+ let req_data = data["Request"];
+ let res_data = data["Response"];
+ cy.captureCallTest(captureBody, req_data, res_data, 6500, globalState);
+ if (should_continue)
+ should_continue = utils.should_continue_further(res_data);
+ });
-context("Card - Full Refund for partially captured 3DS payment", () => {
- let should_continue = true; // variable that will be used to skip tests if a previous test fails
+ it("retrieve-payment-call-test", () => {
+ cy.retrievePaymentCallTest(globalState);
+ });
- beforeEach(function () {
- if (!should_continue) {
- this.skip();
- }
+ it("refund-call-test", () => {
+ let data = getConnectorDetails(globalState.get("connectorId"))["card_pm"][
+ "Refund"
+ ];
+ let req_data = data["Request"];
+ let res_data = data["Response"];
+ cy.refundCallTest(refundBody, req_data, res_data, 6500, globalState);
+ if (should_continue)
+ should_continue = utils.should_continue_further(res_data);
+ });
});
- it("create-payment-call-test", () => {
- let data = getConnectorDetails(globalState.get("connectorId"))["card_pm"][
- "PaymentIntent"
- ];
- let req_data = data["Request"];
- let res_data = data["Response"];
- cy.createPaymentIntentTest(
- createPaymentBody,
- req_data,
- res_data,
- "three_ds",
- "manual",
- globalState
- );
- if (should_continue)
- should_continue = utils.should_continue_further(res_data);
- });
+ context("Card - Partial Refund for fully captured 3DS payment", () => {
+ let should_continue = true; // variable that will be used to skip tests if a previous test fails
- it("payment_methods-call-test", () => {
- cy.paymentMethodsCallTest(globalState);
- });
+ beforeEach(function () {
+ if (!should_continue) {
+ this.skip();
+ }
+ });
- it("Confirm 3DS", () => {
- let data = getConnectorDetails(globalState.get("connectorId"))["card_pm"][
- "3DSManualCapture"
- ];
- let req_data = data["Request"];
- let res_data = data["Response"];
- console.log("det -> " + data.card);
- cy.confirmCallTest(confirmBody, req_data, res_data, true, globalState);
- if (should_continue)
- should_continue = utils.should_continue_further(res_data);
- });
+ it("create-payment-call-test", () => {
+ let data = getConnectorDetails(globalState.get("connectorId"))["card_pm"][
+ "PaymentIntent"
+ ];
+ let req_data = data["Request"];
+ let res_data = data["Response"];
+ cy.createPaymentIntentTest(
+ createPaymentBody,
+ req_data,
+ res_data,
+ "three_ds",
+ "manual",
+ globalState
+ );
+ if (should_continue)
+ should_continue = utils.should_continue_further(res_data);
+ });
- it("Handle redirection", () => {
- let expected_redirection = confirmBody["return_url"];
- cy.handleRedirection(globalState, expected_redirection);
- });
+ it("payment_methods-call-test", () => {
+ cy.paymentMethodsCallTest(globalState);
+ });
- it("retrieve-payment-call-test", () => {
- cy.retrievePaymentCallTest(globalState);
- });
+ it("Confirm 3DS", () => {
+ let data = getConnectorDetails(globalState.get("connectorId"))["card_pm"][
+ "3DSManualCapture"
+ ];
+ let req_data = data["Request"];
+ let res_data = data["Response"];
+ console.log("det -> " + data.card);
+ cy.confirmCallTest(confirmBody, req_data, res_data, true, globalState);
+ if (should_continue)
+ should_continue = utils.should_continue_further(res_data);
+ });
- it("capture-call-test", () => {
- let data = getConnectorDetails(globalState.get("connectorId"))["card_pm"][
- "PartialCapture"
- ];
- let req_data = data["Request"];
- let res_data = data["Response"];
- cy.captureCallTest(captureBody, req_data, res_data, 100, globalState);
- if (should_continue)
- should_continue = utils.should_continue_further(res_data);
- });
+ it("Handle redirection", () => {
+ let expected_redirection = confirmBody["return_url"];
+ cy.handleRedirection(globalState, expected_redirection);
+ });
- it("retrieve-payment-call-test", () => {
- cy.retrievePaymentCallTest(globalState);
- });
+ it("retrieve-payment-call-test", () => {
+ cy.retrievePaymentCallTest(globalState);
+ });
- it("refund-call-test", () => {
- let data = getConnectorDetails(globalState.get("connectorId"))["card_pm"][
- "Refund"
- ];
- let req_data = data["Request"];
- let res_data = data["Response"];
- cy.refundCallTest(refundBody, req_data, res_data, 100, globalState);
- if (should_continue)
- should_continue = utils.should_continue_further(res_data);
- });
-});
+ it("capture-call-test", () => {
+ let data = getConnectorDetails(globalState.get("connectorId"))["card_pm"][
+ "Capture"
+ ];
+ let req_data = data["Request"];
+ let res_data = data["Response"];
+ cy.captureCallTest(captureBody, req_data, res_data, 6500, globalState);
+ if (should_continue)
+ should_continue = utils.should_continue_further(res_data);
+ });
-context("Card - partial Refund for partially captured 3DS payment", () => {
- let should_continue = true; // variable that will be used to skip tests if a previous test fails
+ it("retrieve-payment-call-test", () => {
+ cy.retrievePaymentCallTest(globalState);
+ });
- beforeEach(function () {
- if (!should_continue) {
- this.skip();
- }
+ it("refund-call-test", () => {
+ let data = getConnectorDetails(globalState.get("connectorId"))["card_pm"][
+ "Refund"
+ ];
+ let req_data = data["Request"];
+ let res_data = data["Response"];
+ cy.refundCallTest(refundBody, req_data, res_data, 5000, globalState);
+ if (should_continue)
+ should_continue = utils.should_continue_further(res_data);
+ });
+ it("refund-call-test", () => {
+ let data = getConnectorDetails(globalState.get("connectorId"))["card_pm"][
+ "Refund"
+ ];
+ let req_data = data["Request"];
+ let res_data = data["Response"];
+ cy.refundCallTest(refundBody, req_data, res_data, 1500, globalState);
+ if (should_continue)
+ should_continue = utils.should_continue_further(res_data);
+ });
});
- it("create-payment-call-test", () => {
- let data = getConnectorDetails(globalState.get("connectorId"))["card_pm"][
- "PaymentIntent"
- ];
- let req_data = data["Request"];
- let res_data = data["Response"];
- cy.createPaymentIntentTest(
- createPaymentBody,
- req_data,
- res_data,
- "three_ds",
- "manual",
- globalState
- );
- if (should_continue)
- should_continue = utils.should_continue_further(res_data);
- });
+ context("Card - Full Refund for partially captured 3DS payment", () => {
+ let should_continue = true; // variable that will be used to skip tests if a previous test fails
- it("payment_methods-call-test", () => {
- cy.paymentMethodsCallTest(globalState);
- });
+ beforeEach(function () {
+ if (!should_continue) {
+ this.skip();
+ }
+ });
- it("Confirm 3DS", () => {
- let data = getConnectorDetails(globalState.get("connectorId"))["card_pm"][
- "3DSManualCapture"
- ];
- let req_data = data["Request"];
- let res_data = data["Response"];
- console.log("det -> " + data.card);
- cy.confirmCallTest(confirmBody, req_data, res_data, true, globalState);
- if (should_continue)
- should_continue = utils.should_continue_further(res_data);
- });
+ it("create-payment-call-test", () => {
+ let data = getConnectorDetails(globalState.get("connectorId"))["card_pm"][
+ "PaymentIntent"
+ ];
+ let req_data = data["Request"];
+ let res_data = data["Response"];
+ cy.createPaymentIntentTest(
+ createPaymentBody,
+ req_data,
+ res_data,
+ "three_ds",
+ "manual",
+ globalState
+ );
+ if (should_continue)
+ should_continue = utils.should_continue_further(res_data);
+ });
- it("Handle redirection", () => {
- let expected_redirection = confirmBody["return_url"];
- cy.handleRedirection(globalState, expected_redirection);
- });
+ it("payment_methods-call-test", () => {
+ cy.paymentMethodsCallTest(globalState);
+ });
- it("retrieve-payment-call-test", () => {
- cy.retrievePaymentCallTest(globalState);
- });
+ it("Confirm 3DS", () => {
+ let data = getConnectorDetails(globalState.get("connectorId"))["card_pm"][
+ "3DSManualCapture"
+ ];
+ let req_data = data["Request"];
+ let res_data = data["Response"];
+ console.log("det -> " + data.card);
+ cy.confirmCallTest(confirmBody, req_data, res_data, true, globalState);
+ if (should_continue)
+ should_continue = utils.should_continue_further(res_data);
+ });
- it("capture-call-test", () => {
- let data = getConnectorDetails(globalState.get("connectorId"))["card_pm"][
- "PartialCapture"
- ];
- let req_data = data["Request"];
- let res_data = data["Response"];
- cy.captureCallTest(captureBody, req_data, res_data, 100, globalState);
- if (should_continue)
- should_continue = utils.should_continue_further(res_data);
- });
+ 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 data = getConnectorDetails(globalState.get("connectorId"))["card_pm"][
+ "PartialCapture"
+ ];
+ let req_data = data["Request"];
+ let res_data = data["Response"];
+ cy.captureCallTest(captureBody, req_data, res_data, 100, globalState);
+ if (should_continue)
+ should_continue = utils.should_continue_further(res_data);
+ });
- it("retrieve-payment-call-test", () => {
- cy.retrievePaymentCallTest(globalState);
+ it("retrieve-payment-call-test", () => {
+ cy.retrievePaymentCallTest(globalState);
+ });
+
+ it("refund-call-test", () => {
+ let data = getConnectorDetails(globalState.get("connectorId"))["card_pm"][
+ "Refund"
+ ];
+ let req_data = data["Request"];
+ let res_data = data["Response"];
+ cy.refundCallTest(refundBody, req_data, res_data, 100, globalState);
+ if (should_continue)
+ should_continue = utils.should_continue_further(res_data);
+ });
});
- it("refund-call-test", () => {
- let data = getConnectorDetails(globalState.get("connectorId"))["card_pm"][
- "Refund"
- ];
- let req_data = data["Request"];
- let res_data = data["Response"];
- cy.refundCallTest(refundBody, req_data, res_data, 50, globalState);
- if (should_continue)
- should_continue = utils.should_continue_further(res_data);
+ context("Card - partial Refund for partially captured 3DS payment", () => {
+ let should_continue = true; // variable that will be used to skip tests if a previous test fails
+
+ beforeEach(function () {
+ if (!should_continue) {
+ this.skip();
+ }
+ });
+
+ it("create-payment-call-test", () => {
+ let data = getConnectorDetails(globalState.get("connectorId"))["card_pm"][
+ "PaymentIntent"
+ ];
+ let req_data = data["Request"];
+ let res_data = data["Response"];
+ cy.createPaymentIntentTest(
+ createPaymentBody,
+ req_data,
+ res_data,
+ "three_ds",
+ "manual",
+ globalState
+ );
+ if (should_continue)
+ should_continue = utils.should_continue_further(res_data);
+ });
+
+ it("payment_methods-call-test", () => {
+ cy.paymentMethodsCallTest(globalState);
+ });
+
+ it("Confirm 3DS", () => {
+ let data = getConnectorDetails(globalState.get("connectorId"))["card_pm"][
+ "3DSManualCapture"
+ ];
+ let req_data = data["Request"];
+ let res_data = data["Response"];
+ console.log("det -> " + data.card);
+ cy.confirmCallTest(confirmBody, req_data, res_data, true, globalState);
+ if (should_continue)
+ should_continue = utils.should_continue_further(res_data);
+ });
+
+ 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 data = getConnectorDetails(globalState.get("connectorId"))["card_pm"][
+ "PartialCapture"
+ ];
+ let req_data = data["Request"];
+ let res_data = data["Response"];
+ cy.captureCallTest(captureBody, req_data, res_data, 100, globalState);
+ if (should_continue)
+ should_continue = utils.should_continue_further(res_data);
+ });
+
+ it("retrieve-payment-call-test", () => {
+ cy.retrievePaymentCallTest(globalState);
+ });
+
+ it("refund-call-test", () => {
+ let data = getConnectorDetails(globalState.get("connectorId"))["card_pm"][
+ "Refund"
+ ];
+ let req_data = data["Request"];
+ let res_data = data["Response"];
+ cy.refundCallTest(refundBody, req_data, res_data, 50, globalState);
+ if (should_continue)
+ should_continue = utils.should_continue_further(res_data);
+ });
});
});
diff --git a/cypress-tests/cypress/e2e/PaymentTest/00018-MandatesUsingPMID.cy.js b/cypress-tests/cypress/e2e/PaymentTest/00018-MandatesUsingPMID.cy.js
index 6eea1bd682..926e8f3631 100644
--- a/cypress-tests/cypress/e2e/PaymentTest/00018-MandatesUsingPMID.cy.js
+++ b/cypress-tests/cypress/e2e/PaymentTest/00018-MandatesUsingPMID.cy.js
@@ -34,7 +34,7 @@ describe("Card - Mandates using Payment Method Id flow test", () => {
this.skip();
}
});
-
+
it("Create No 3DS Payment Intent", () => {
let data = getConnectorDetails(globalState.get("connectorId"))[
"card_pm"
diff --git a/cypress-tests/cypress/e2e/PaymentTest/00019-UPI.cy.js b/cypress-tests/cypress/e2e/PaymentTest/00019-UPI.cy.js
new file mode 100644
index 0000000000..331f36c0c2
--- /dev/null
+++ b/cypress-tests/cypress/e2e/PaymentTest/00019-UPI.cy.js
@@ -0,0 +1,177 @@
+import confirmBody from "../../fixtures/confirm-body.json";
+import createPaymentBody from "../../fixtures/create-payment-body.json";
+import refundBody from "../../fixtures/refund-flow-body.json";
+import State from "../../utils/State";
+import getConnectorDetails, * as utils from "../PaymentUtils/utils";
+
+let globalState;
+
+describe("UPI Payments - Hyperswitch", () => {
+ let should_continue = true; // variable that will be used to skip tests if a previous test fails
+
+ context("[Payment] [UPI - UPI Collect] Create & Confirm + Refund", () => {
+ before("seed global state", () => {
+ cy.task("getGlobalState").then((state) => {
+ globalState = new State(state);
+ });
+ });
+
+ afterEach("flush global state", () => {
+ cy.task("setGlobalState", globalState.data);
+ });
+
+ beforeEach(function () {
+ if (!should_continue) {
+ this.skip();
+ }
+ });
+
+ it("Create payment intent", () => {
+ let data = getConnectorDetails(globalState.get("connectorId"))["upi_pm"][
+ "PaymentIntent"
+ ];
+ let req_data = data["Request"];
+ let res_data = data["Response"];
+
+ cy.createPaymentIntentTest(
+ createPaymentBody,
+ req_data,
+ res_data,
+ "three_ds",
+ "automatic",
+ globalState
+ );
+
+ if (should_continue)
+ should_continue = utils.should_continue_further(res_data);
+ });
+
+ it("List Merchant payment methods", () => {
+ cy.paymentMethodsCallTest(globalState);
+ });
+
+ it("Confirm payment", () => {
+ let data = getConnectorDetails(globalState.get("connectorId"))["upi_pm"][
+ "UpiCollect"
+ ];
+ let req_data = data["Request"];
+ let res_data = data["Response"];
+
+ cy.confirmUpiCall(confirmBody, req_data, res_data, true, globalState);
+
+ if (should_continue)
+ should_continue = utils.should_continue_further(res_data);
+ });
+
+ it("Handle UPI Redirection", () => {
+ let expected_redirection = confirmBody["return_url"];
+ let payment_method_type = globalState.get("paymentMethodType");
+ cy.handleUpiRedirection(
+ globalState,
+ payment_method_type,
+ expected_redirection
+ );
+ });
+
+ it("Retrieve payment", () => {
+ cy.retrievePaymentCallTest(globalState);
+ });
+
+ it("Refund payment", () => {
+ let data = getConnectorDetails(globalState.get("connectorId"))["upi_pm"][
+ "Refund"
+ ];
+ let req_data = data["Request"];
+ let res_data = data["Response"];
+ cy.refundCallTest(refundBody, req_data, res_data, 6500, globalState);
+
+ if (should_continue)
+ should_continue = utils.should_continue_further(res_data);
+ });
+ });
+
+ // Skipping UPI Intent intentionally as connector is throwing 5xx during redirection
+ context.skip("[Payment] [UPI - UPI Intent] Create & Confirm", () => {
+ should_continue = true; // variable that will be used to skip tests if a previous test fails
+
+ before("seed global state", () => {
+ cy.task("getGlobalState").then((state) => {
+ globalState = new State(state);
+ });
+ });
+
+ after("flush global state", () => {
+ cy.task("setGlobalState", globalState.data);
+ });
+
+ beforeEach(function () {
+ if (!should_continue) {
+ this.skip();
+ }
+ });
+
+ it("Create payment intent", () => {
+ let data = getConnectorDetails(globalState.get("connectorId"))["upi_pm"][
+ "PaymentIntent"
+ ];
+ let req_data = data["Request"];
+ let res_data = data["Response"];
+
+ cy.createPaymentIntentTest(
+ createPaymentBody,
+ req_data,
+ res_data,
+ "three_ds",
+ "automatic",
+ globalState
+ );
+
+ if (should_continue)
+ should_continue = utils.should_continue_further(res_data);
+ });
+
+ it("List Merchant payment methods", () => {
+ cy.paymentMethodsCallTest(globalState);
+ });
+
+ it("Confirm payment", () => {
+ let data = getConnectorDetails(globalState.get("connectorId"))["upi_pm"][
+ "UpiIntent"
+ ];
+ let req_data = data["Request"];
+ let res_data = data["Response"];
+
+ cy.confirmUpiCall(confirmBody, req_data, res_data, true, globalState);
+
+ if (should_continue)
+ should_continue = utils.should_continue_further(res_data);
+ });
+
+ it("Handle UPI Redirection", () => {
+ let expected_redirection = confirmBody["return_url"];
+ let payment_method_type = globalState.get("paymentMethodType");
+ cy.handleUpiRedirection(
+ globalState,
+ payment_method_type,
+ expected_redirection
+ );
+ });
+
+ it("Retrieve payment", () => {
+ cy.retrievePaymentCallTest(globalState);
+ });
+ });
+});
+
+// TODO: This test is incomplete. Above has to be replicated here with changes to support SCL
+describe.skip("UPI Payments -- Hyperswitch Stripe Compatibility Layer", () => {
+ before("seed global state", () => {
+ cy.task("getGlobalState").then((state) => {
+ globalState = new State(state);
+ });
+ });
+
+ after("flush global state", () => {
+ cy.task("setGlobalState", globalState.data);
+ });
+});
diff --git a/cypress-tests/cypress/e2e/PaymentUtils/Adyen.js b/cypress-tests/cypress/e2e/PaymentUtils/Adyen.js
index 7d179e6495..9d489b713f 100644
--- a/cypress-tests/cypress/e2e/PaymentUtils/Adyen.js
+++ b/cypress-tests/cypress/e2e/PaymentUtils/Adyen.js
@@ -736,4 +736,64 @@ export const connectorDetails = {
},
},
},
+
+ upi_pm: {
+ PaymentIntent: {
+ Request: {
+ currency: "INR",
+ },
+ Response: {
+ status: 200,
+ body: {
+ status: "requires_payment_method",
+ },
+ },
+ },
+ UpiCollect: {
+ Request: {
+ payment_method: "upi",
+ payment_method_type: "upi_collect",
+ payment_method_data: {
+ upi: {
+ upi_collect: {
+ vpa_id: "successtest@iata",
+ },
+ },
+ },
+ },
+ Response: {
+ status: 400,
+ body: {
+ error: {
+ type: "invalid_request",
+ message: "Payment method type not supported",
+ code: "HE_03",
+ reason: "automatic for upi_collect is not supported by adyen",
+ },
+ },
+ },
+ },
+ UpiIntent: {
+ Request: {
+ payment_method: "upi",
+ payment_method_type: "upi_intent",
+ payment_method_data: {
+ upi: {
+ upi_intent: {},
+ },
+ },
+ },
+ Response: {
+ status: 400,
+ body: {
+ error: {
+ type: "invalid_request",
+ message: "Payment method type not supported",
+ code: "HE_03",
+ reason: "automatic for upi_intent is not supported by adyen",
+ },
+ },
+ },
+ },
+ },
};
diff --git a/cypress-tests/cypress/e2e/PaymentUtils/BankOfAmerica.js b/cypress-tests/cypress/e2e/PaymentUtils/BankOfAmerica.js
index 596b520343..fe37a11346 100644
--- a/cypress-tests/cypress/e2e/PaymentUtils/BankOfAmerica.js
+++ b/cypress-tests/cypress/e2e/PaymentUtils/BankOfAmerica.js
@@ -202,8 +202,8 @@ export const connectorDetails = {
card: successfulThreeDSTestCardDetails,
},
currency: "USD",
- mandate_data: singleUseMandateData
- },
+ mandate_data: singleUseMandateData,
+ },
Response: {
status: 200,
body: {
@@ -217,7 +217,7 @@ export const connectorDetails = {
card: successfulThreeDSTestCardDetails,
},
currency: "USD",
- mandate_data: singleUseMandateData
+ mandate_data: singleUseMandateData,
},
Response: {
status: 200,
@@ -228,11 +228,11 @@ export const connectorDetails = {
},
MandateSingleUseNo3DSAutoCapture: {
Request: {
- payment_method_data: {
+ payment_method_data: {
card: successfulNo3DSCardDetails,
},
currency: "USD",
- mandate_data: singleUseMandateData
+ mandate_data: singleUseMandateData,
},
Response: {
status: 200,
@@ -243,11 +243,11 @@ export const connectorDetails = {
},
MandateSingleUseNo3DSManualCapture: {
Request: {
- payment_method_data: {
+ payment_method_data: {
card: successfulNo3DSCardDetails,
},
currency: "USD",
- mandate_data: singleUseMandateData
+ mandate_data: singleUseMandateData,
},
Response: {
status: 200,
@@ -258,11 +258,11 @@ export const connectorDetails = {
},
MandateMultiUseNo3DSAutoCapture: {
Request: {
- payment_method_data: {
+ payment_method_data: {
card: successfulNo3DSCardDetails,
},
currency: "USD",
- mandate_data: multiUseMandateData
+ mandate_data: multiUseMandateData,
},
Response: {
status: 200,
@@ -273,11 +273,11 @@ export const connectorDetails = {
},
MandateMultiUseNo3DSManualCapture: {
Request: {
- payment_method_data: {
+ payment_method_data: {
card: successfulNo3DSCardDetails,
},
currency: "USD",
- mandate_data: multiUseMandateData
+ mandate_data: multiUseMandateData,
},
Response: {
status: 200,
@@ -292,7 +292,7 @@ export const connectorDetails = {
card: successfulThreeDSTestCardDetails,
},
currency: "USD",
- mandate_data: multiUseMandateData
+ mandate_data: multiUseMandateData,
},
Response: {
status: 200,
@@ -307,7 +307,7 @@ export const connectorDetails = {
card: successfulThreeDSTestCardDetails,
},
currency: "USD",
- mandate_data: multiUseMandateData
+ mandate_data: multiUseMandateData,
},
Response: {
status: 200,
@@ -318,11 +318,11 @@ export const connectorDetails = {
},
ZeroAuthMandate: {
Request: {
- payment_method_data: {
+ payment_method_data: {
card: successfulNo3DSCardDetails,
},
currency: "USD",
- mandate_data: singleUseMandateData
+ mandate_data: singleUseMandateData,
},
Response: {
status: 200,
diff --git a/cypress-tests/cypress/e2e/PaymentUtils/Bluesnap.js b/cypress-tests/cypress/e2e/PaymentUtils/Bluesnap.js
index 19fcb6e1f0..aa61184aed 100644
--- a/cypress-tests/cypress/e2e/PaymentUtils/Bluesnap.js
+++ b/cypress-tests/cypress/e2e/PaymentUtils/Bluesnap.js
@@ -198,7 +198,7 @@ export const connectorDetails = {
},
MandateSingleUse3DSAutoCapture: {
Request: {
- payment_method_data: {
+ payment_method_data: {
card: successfulThreeDSTestCardDetails,
},
currency: "USD",
@@ -218,11 +218,11 @@ export const connectorDetails = {
},
MandateSingleUse3DSManualCapture: {
Request: {
- payment_method_data: {
+ payment_method_data: {
card: successfulThreeDSTestCardDetails,
},
currency: "USD",
- mandate_data: singleUseMandateData,
+ mandate_data: singleUseMandateData,
},
Response: {
status: 400,
@@ -242,7 +242,7 @@ export const connectorDetails = {
card: successfulNo3DSCardDetails,
},
currency: "USD",
- mandate_data: singleUseMandateData,
+ mandate_data: singleUseMandateData,
},
Response: {
status: 400,
@@ -302,7 +302,7 @@ export const connectorDetails = {
card: successfulNo3DSCardDetails,
},
currency: "USD",
- mandate_data: multiUseMandateData,
+ mandate_data: multiUseMandateData,
},
Response: {
status: 400,
@@ -318,7 +318,7 @@ export const connectorDetails = {
},
MandateMultiUse3DSAutoCapture: {
Request: {
- payment_method_data: {
+ payment_method_data: {
card: successfulThreeDSTestCardDetails,
},
currency: "USD",
@@ -338,7 +338,7 @@ export const connectorDetails = {
},
MandateMultiUse3DSManualCapture: {
Request: {
- payment_method_data: {
+ payment_method_data: {
card: successfulThreeDSTestCardDetails,
},
currency: "USD",
@@ -358,11 +358,11 @@ export const connectorDetails = {
},
ZeroAuthMandate: {
Request: {
- payment_method_data: {
+ payment_method_data: {
card: successfulNo3DSCardDetails,
},
currency: "USD",
- mandate_data: singleUseMandateData
+ mandate_data: singleUseMandateData,
},
Response: {
status: 501,
diff --git a/cypress-tests/cypress/e2e/PaymentUtils/Commons.js b/cypress-tests/cypress/e2e/PaymentUtils/Commons.js
index 31d779106f..d15ff44d70 100644
--- a/cypress-tests/cypress/e2e/PaymentUtils/Commons.js
+++ b/cypress-tests/cypress/e2e/PaymentUtils/Commons.js
@@ -82,6 +82,100 @@ export const getCustomExchange = (overrides) => {
};
export const payment_methods_enabled = [
+ {
+ payment_method: "bank_redirect",
+ payment_method_types: [
+ {
+ payment_method_type: "blik",
+ payment_experience: null,
+ card_networks: null,
+ accepted_currencies: null,
+ accepted_countries: null,
+ minimum_amount: 1,
+ maximum_amount: 68607706,
+ recurring_enabled: true,
+ installment_payment_enabled: true,
+ },
+ {
+ payment_method_type: "eps",
+ payment_experience: null,
+ card_networks: null,
+ accepted_currencies: null,
+ accepted_countries: null,
+ minimum_amount: 1,
+ maximum_amount: 68607706,
+ recurring_enabled: true,
+ installment_payment_enabled: true,
+ },
+ {
+ payment_method_type: "ideal",
+ payment_experience: null,
+ card_networks: null,
+ accepted_currencies: null,
+ accepted_countries: null,
+ minimum_amount: 1,
+ maximum_amount: 68607706,
+ recurring_enabled: true,
+ installment_payment_enabled: true,
+ },
+ {
+ payment_method_type: "giropay",
+ payment_experience: null,
+ card_networks: null,
+ accepted_currencies: null,
+ accepted_countries: null,
+ minimum_amount: 1,
+ maximum_amount: 68607706,
+ recurring_enabled: true,
+ installment_payment_enabled: true,
+ },
+ {
+ payment_method_type: "local_bank_redirect",
+ payment_experience: null,
+ card_networks: null,
+ accepted_currencies: null,
+ accepted_countries: null,
+ minimum_amount: 1,
+ maximum_amount: 68607706,
+ recurring_enabled: true,
+ installment_payment_enabled: true,
+ },
+ {
+ payment_method_type: "przelewy24",
+ payment_experience: null,
+ card_networks: null,
+ accepted_currencies: null,
+ accepted_countries: null,
+ minimum_amount: 1,
+ maximum_amount: 68607706,
+ recurring_enabled: true,
+ installment_payment_enabled: true,
+ },
+ {
+ payment_method_type: "sofort",
+ payment_experience: null,
+ card_networks: null,
+ accepted_currencies: null,
+ accepted_countries: null,
+ minimum_amount: 1,
+ maximum_amount: 68607706,
+ recurring_enabled: true,
+ installment_payment_enabled: true,
+ },
+ ],
+ },
+ {
+ payment_method: "bank_transfer",
+ payment_method_types: [
+ {
+ payment_method_type: "pix",
+ minimum_amount: 0,
+ maximum_amount: 68607706,
+ recurring_enabled: false,
+ installment_payment_enabled: true,
+ },
+ ],
+ },
{
payment_method: "card",
payment_method_types: [
@@ -124,85 +218,60 @@ export const payment_methods_enabled = [
],
},
{
- payment_method: "bank_transfer",
- payment_method_types: [
- {
- payment_method_type: "pix",
- minimum_amount: 0,
- maximum_amount: 68607706,
- recurring_enabled: false,
- installment_payment_enabled: true,
- },
- ],
- },
- {
- payment_method: "bank_redirect",
+ payment_method: "real_time_payment",
payment_method_types: [
{
- payment_method_type: "ideal",
- payment_experience: null,
- card_networks: null,
- accepted_currencies: null,
- accepted_countries: null,
+ payment_method_type: "duit_now",
minimum_amount: 1,
maximum_amount: 68607706,
recurring_enabled: true,
installment_payment_enabled: true,
+ payment_experience: "redirect_to_url",
},
{
- payment_method_type: "giropay",
- payment_experience: null,
- card_networks: null,
- accepted_currencies: null,
- accepted_countries: null,
+ payment_method_type: "fps",
minimum_amount: 1,
maximum_amount: 68607706,
recurring_enabled: true,
installment_payment_enabled: true,
+ payment_experience: "redirect_to_url",
},
{
- payment_method_type: "sofort",
- payment_experience: null,
- card_networks: null,
- accepted_currencies: null,
- accepted_countries: null,
+ payment_method_type: "prompt_pay",
minimum_amount: 1,
maximum_amount: 68607706,
recurring_enabled: true,
installment_payment_enabled: true,
+ payment_experience: "redirect_to_url",
},
{
- payment_method_type: "eps",
- payment_experience: null,
- card_networks: null,
- accepted_currencies: null,
- accepted_countries: null,
+ payment_method_type: "viet_qr",
minimum_amount: 1,
maximum_amount: 68607706,
recurring_enabled: true,
installment_payment_enabled: true,
+ payment_experience: "redirect_to_url",
},
+ ],
+ },
+ {
+ payment_method: "upi",
+ payment_method_types: [
{
- payment_method_type: "blik",
- payment_experience: null,
- card_networks: null,
- accepted_currencies: null,
- accepted_countries: null,
+ payment_method_type: "upi_collect",
minimum_amount: 1,
maximum_amount: 68607706,
recurring_enabled: true,
installment_payment_enabled: true,
+ payment_experience: "redirect_to_url",
},
{
- payment_method_type: "przelewy24",
- payment_experience: null,
- card_networks: null,
- accepted_currencies: null,
- accepted_countries: null,
+ payment_method_type: "upi_intent",
minimum_amount: 1,
maximum_amount: 68607706,
recurring_enabled: true,
installment_payment_enabled: true,
+ payment_experience: "redirect_to_url",
},
],
},
@@ -224,89 +293,49 @@ export const connectorDetails = {
},
},
}),
- "3DSManualCapture": {
+ "3DSManualCapture": getCustomExchange({
Request: {
card: successfulThreeDSTestCardDetails,
currency: "USD",
customer_acceptance: null,
setup_future_usage: "on_session",
},
- Response: {
- status: 200,
- body: {
- status: "processing",
- },
- },
- },
- "3DSAutoCapture": {
+ }),
+ "3DSAutoCapture": getCustomExchange({
Request: {
card: successfulThreeDSTestCardDetails,
currency: "USD",
customer_acceptance: null,
setup_future_usage: "on_session",
},
- Response: {
- status: 200,
- body: {
- status: "processing",
- },
- },
- },
- No3DSManualCapture: {
+ }),
+ No3DSManualCapture: getCustomExchange({
Request: {
card: successfulNo3DSCardDetails,
currency: "USD",
customer_acceptance: null,
setup_future_usage: "on_session",
},
- Response: {
- status: 200,
- body: {
- status: "processing",
- },
- },
- },
- No3DSAutoCapture: {
+ }),
+ No3DSAutoCapture: getCustomExchange({
Request: {
card: successfulNo3DSCardDetails,
currency: "USD",
customer_acceptance: null,
setup_future_usage: "on_session",
},
- Response: {
- status: 200,
- body: {
- status: "processing",
- },
- },
- },
- Capture: {
+ }),
+ Capture: getCustomExchange({
Request: {
card: successfulNo3DSCardDetails,
currency: "USD",
customer_acceptance: null,
},
- Response: {
- status: 200,
- body: {
- status: "processing",
- amount: 6500,
- amount_capturable: 6500,
- },
- },
- },
- PartialCapture: {
+ }),
+ PartialCapture: getCustomExchange({
Request: {},
- Response: {
- status: 200,
- body: {
- status: "processing",
- amount: 6500,
- amount_capturable: 6500,
- },
- },
- },
- Void: {
+ }),
+ Void: getCustomExchange({
Request: {},
Response: {
status: 400,
@@ -319,61 +348,28 @@ export const connectorDetails = {
},
},
},
- },
- Refund: {
+ }),
+ Refund: getCustomExchange({
Request: {
card: successfulNo3DSCardDetails,
currency: "USD",
customer_acceptance: null,
},
- Response: {
- status: 400,
- body: {
- error: {
- type: "invalid_request",
- message:
- "This Payment could not be refund because it has a status of processing. The expected state is succeeded, partially_captured",
- code: "IR_14",
- },
- },
- },
- },
- PartialRefund: {
+ }),
+ PartialRefund: getCustomExchange({
Request: {
card: successfulNo3DSCardDetails,
currency: "USD",
customer_acceptance: null,
},
- Response: {
- status: 400,
- body: {
- error: {
- type: "invalid_request",
- message:
- "This Payment could not be refund because it has a status of processing. The expected state is succeeded, partially_captured",
- code: "IR_14",
- },
- },
- },
- },
- SyncRefund: {
+ }),
+ SyncRefund: getCustomExchange({
Request: {
card: successfulNo3DSCardDetails,
currency: "USD",
customer_acceptance: null,
},
- Response: {
- status: 400,
- body: {
- error: {
- type: "invalid_request",
- message:
- "This Payment could not be refund because it has a status of processing. The expected state is succeeded, partially_captured",
- code: "IR_14",
- },
- },
- },
- },
+ }),
MandateSingleUse3DSAutoCapture: getCustomExchange({
Request: {
card: successfulThreeDSTestCardDetails,
@@ -796,4 +792,41 @@ export const connectorDetails = {
},
}),
},
+ upi_pm: {
+ PaymentIntent: getCustomExchange({
+ Request: {
+ currency: "INR",
+ },
+ Response: {
+ status: 200,
+ body: {
+ status: "requires_payment_method",
+ },
+ },
+ }),
+ UpiCollect: getCustomExchange({
+ Request: {
+ payment_method: "upi",
+ payment_method_type: "upi_collect",
+ payment_method_data: {
+ upi: {
+ upi_collect: {
+ vpa_id: "successtest@ita",
+ },
+ },
+ },
+ },
+ }),
+ UpiIntent: getCustomExchange({
+ Request: {
+ payment_method: "upi",
+ payment_method_type: "upi_intent",
+ payment_method_data: {
+ upi: {
+ upi_intent: {},
+ },
+ },
+ },
+ }),
+ },
};
diff --git a/cypress-tests/cypress/e2e/PaymentUtils/Cybersource.js b/cypress-tests/cypress/e2e/PaymentUtils/Cybersource.js
index 0ed998e74e..fe37a11346 100644
--- a/cypress-tests/cypress/e2e/PaymentUtils/Cybersource.js
+++ b/cypress-tests/cypress/e2e/PaymentUtils/Cybersource.js
@@ -203,7 +203,7 @@ export const connectorDetails = {
},
currency: "USD",
mandate_data: singleUseMandateData,
- },
+ },
Response: {
status: 200,
body: {
@@ -228,7 +228,7 @@ export const connectorDetails = {
},
MandateSingleUseNo3DSAutoCapture: {
Request: {
- payment_method_data: {
+ payment_method_data: {
card: successfulNo3DSCardDetails,
},
currency: "USD",
@@ -243,7 +243,7 @@ export const connectorDetails = {
},
MandateSingleUseNo3DSManualCapture: {
Request: {
- payment_method_data: {
+ payment_method_data: {
card: successfulNo3DSCardDetails,
},
currency: "USD",
@@ -258,7 +258,7 @@ export const connectorDetails = {
},
MandateMultiUseNo3DSAutoCapture: {
Request: {
- payment_method_data: {
+ payment_method_data: {
card: successfulNo3DSCardDetails,
},
currency: "USD",
@@ -273,7 +273,7 @@ export const connectorDetails = {
},
MandateMultiUseNo3DSManualCapture: {
Request: {
- payment_method_data: {
+ payment_method_data: {
card: successfulNo3DSCardDetails,
},
currency: "USD",
@@ -318,11 +318,11 @@ export const connectorDetails = {
},
ZeroAuthMandate: {
Request: {
- payment_method_data: {
+ payment_method_data: {
card: successfulNo3DSCardDetails,
},
currency: "USD",
- mandate_data: singleUseMandateData
+ mandate_data: singleUseMandateData,
},
Response: {
status: 200,
diff --git a/cypress-tests/cypress/e2e/PaymentUtils/Iatapay.js b/cypress-tests/cypress/e2e/PaymentUtils/Iatapay.js
new file mode 100644
index 0000000000..ae5e61137b
--- /dev/null
+++ b/cypress-tests/cypress/e2e/PaymentUtils/Iatapay.js
@@ -0,0 +1,412 @@
+const successfulNo3DSCardDetails = {
+ card_number: "371449635398431",
+ card_exp_month: "03",
+ card_exp_year: "30",
+ card_holder_name: "John Doe",
+ card_cvc: "7373",
+};
+
+const successfulThreeDSTestCardDetails = {
+ card_number: "4917610000000000",
+ card_exp_month: "03",
+ card_exp_year: "30",
+ card_holder_name: "Joseph Doe",
+ card_cvc: "737",
+};
+
+const multiUseMandateData = {
+ customer_acceptance: {
+ acceptance_type: "offline",
+ accepted_at: "1963-05-03T04:07:52.723Z",
+ online: {
+ ip_address: "125.0.0.1",
+ user_agent: "amet irure esse",
+ },
+ },
+ mandate_type: {
+ multi_use: {
+ amount: 8000,
+ currency: "USD",
+ },
+ },
+};
+
+const singleUseMandateData = {
+ customer_acceptance: {
+ acceptance_type: "offline",
+ accepted_at: "1963-05-03T04:07:52.723Z",
+ online: {
+ ip_address: "125.0.0.1",
+ user_agent: "amet irure esse",
+ },
+ },
+ mandate_type: {
+ single_use: {
+ amount: 8000,
+ currency: "USD",
+ },
+ },
+};
+
+export const connectorDetails = {
+ bank_redirect_pm: {
+ ideal: {
+ Request: {
+ payment_method: "bank_redirect",
+ payment_method_type: "ideal",
+ payment_method_data: {
+ bank_redirect: {
+ ideal: {},
+ },
+ },
+ billing: {
+ address: {
+ line1: "1467",
+ line2: "Harrison Street",
+ line3: "Harrison Street",
+ city: "San Fransico",
+ state: "California",
+ zip: "94122",
+ country: "NL",
+ first_name: "john",
+ last_name: "doe",
+ },
+ },
+ },
+ Response: {
+ status: 200,
+ body: {
+ status: "failed",
+ error_code: "BAD_REQUEST",
+ error_message: "Payment country has to be enabled on merchant",
+ },
+ },
+ },
+ },
+ card_pm: {
+ Capture: {
+ Request: {
+ card: successfulNo3DSCardDetails,
+ currency: "USD",
+ customer_acceptance: null,
+ },
+ Response: {
+ status: 404,
+ body: {
+ error: {
+ type: "invalid_request",
+ message: "Payment does not exist in our records",
+ code: "HE_02",
+ },
+ },
+ },
+ },
+ No3DSManualCapture: {
+ Request: {
+ card: successfulNo3DSCardDetails,
+ currency: "USD",
+ },
+ Response: {
+ status: 400,
+ body: {
+ error: {
+ type: "invalid_request",
+ message: "Payment method type not supported",
+ code: "HE_03",
+ },
+ },
+ },
+ },
+ "3DSManualCapture": {
+ Request: {
+ card: successfulThreeDSTestCardDetails,
+ currency: "USD",
+ customer_acceptance: null,
+ setup_future_usage: "on_session",
+ },
+ Response: {
+ status: 400,
+ body: {
+ error: {
+ type: "invalid_request",
+ message: "Payment method type not supported",
+ code: "HE_03",
+ },
+ },
+ },
+ },
+ MandateMultiUseNo3DSAutoCapture: {
+ Request: {
+ payment_method_data: {
+ card: successfulNo3DSCardDetails,
+ },
+ currency: "USD",
+ mandate_data: multiUseMandateData,
+ },
+ Response: {
+ status: 400,
+ body: {
+ error: {
+ type: "invalid_request",
+ message: "Payment method type not supported",
+ code: "HE_03",
+ },
+ },
+ },
+ },
+ MandateSingleUseNo3DSAutoCapture: {
+ Request: {
+ payment_method_data: {
+ card: successfulNo3DSCardDetails,
+ },
+ currency: "USD",
+ mandate_data: singleUseMandateData,
+ },
+ Response: {
+ status: 400,
+ body: {
+ error: {
+ type: "invalid_request",
+ message: "Payment method type not supported",
+ code: "HE_03",
+ },
+ },
+ },
+ },
+ MandateSingleUseNo3DSManualCapture: {
+ Request: {
+ payment_method_data: {
+ card: successfulNo3DSCardDetails,
+ },
+ currency: "USD",
+ mandate_data: singleUseMandateData,
+ },
+ Response: {
+ status: 400,
+ body: {
+ error: {
+ type: "invalid_request",
+ message: "Payment method type not supported",
+ code: "HE_03",
+ },
+ },
+ },
+ },
+ MandateMultiUseNo3DSManualCapture: {
+ Request: {
+ payment_method_data: {
+ card: successfulNo3DSCardDetails,
+ },
+ currency: "USD",
+ mandate_data: multiUseMandateData,
+ },
+ Response: {
+ status: 400,
+ body: {
+ error: {
+ type: "invalid_request",
+ message: "Payment method type not supported",
+ code: "HE_03",
+ },
+ },
+ },
+ },
+ PaymentMethodIdMandateNo3DSAutoCapture: {
+ Request: {
+ payment_method_data: {
+ card: successfulNo3DSCardDetails,
+ },
+ currency: "USD",
+ mandate_data: null,
+ customer_acceptance: {
+ acceptance_type: "offline",
+ accepted_at: "1963-05-03T04:07:52.723Z",
+ online: {
+ ip_address: "125.0.0.1",
+ user_agent: "amet irure esse",
+ },
+ },
+ },
+ Response: {
+ status: 400,
+ body: {
+ error: {
+ type: "invalid_request",
+ message: "Payment method type not supported",
+ code: "HE_03",
+ },
+ },
+ },
+ },
+ PaymentMethodIdMandateNo3DSManualCapture: {
+ Request: {
+ payment_method_data: {
+ card: successfulNo3DSCardDetails,
+ },
+ currency: "USD",
+ mandate_data: null,
+ customer_acceptance: {
+ acceptance_type: "offline",
+ accepted_at: "1963-05-03T04:07:52.723Z",
+ online: {
+ ip_address: "125.0.0.1",
+ user_agent: "amet irure esse",
+ },
+ },
+ },
+ Response: {
+ status: 400,
+ body: {
+ error: {
+ type: "invalid_request",
+ message: "Payment method type not supported",
+ code: "HE_03",
+ },
+ },
+ },
+ },
+ PaymentMethodIdMandate3DSAutoCapture: {
+ Request: {
+ payment_method_data: {
+ card: successfulThreeDSTestCardDetails,
+ },
+ currency: "USD",
+ mandate_data: null,
+ authentication_type: "three_ds",
+ customer_acceptance: {
+ acceptance_type: "offline",
+ accepted_at: "1963-05-03T04:07:52.723Z",
+ online: {
+ ip_address: "125.0.0.1",
+ user_agent: "amet irure esse",
+ },
+ },
+ },
+ Response: {
+ status: 400,
+ body: {
+ error: {
+ type: "invalid_request",
+ message: "Payment method type not supported",
+ code: "HE_03",
+ },
+ },
+ },
+ },
+ PaymentMethodIdMandate3DSManualCapture: {
+ Request: {
+ payment_method_data: {
+ card: successfulThreeDSTestCardDetails,
+ },
+ mandate_data: null,
+ authentication_type: "three_ds",
+ customer_acceptance: {
+ acceptance_type: "offline",
+ accepted_at: "1963-05-03T04:07:52.723Z",
+ online: {
+ ip_address: "125.0.0.1",
+ user_agent: "amet irure esse",
+ },
+ },
+ },
+ Response: {
+ status: 400,
+ body: {
+ error: {
+ type: "invalid_request",
+ message: "Payment method type not supported",
+ code: "HE_03",
+ },
+ },
+ },
+ },
+ ZeroAuthMandate: {
+ Request: {
+ payment_method_data: {
+ card: successfulNo3DSCardDetails,
+ },
+ currency: "USD",
+ mandate_data: singleUseMandateData,
+ },
+ Response: {
+ status: 501,
+ body: {
+ error: {
+ type: "invalid_request",
+ message: "Setup Mandate flow for Iatapay is not implemented",
+ code: "IR_00",
+ },
+ },
+ },
+ },
+ Void: {
+ Request: {},
+ Response: {
+ status: 200,
+ body: {
+ status: "cancelled",
+ },
+ },
+ },
+ },
+ upi_pm: {
+ PaymentIntent: {
+ Request: {
+ currency: "INR",
+ },
+ Response: {
+ status: 200,
+ body: {
+ status: "requires_payment_method",
+ },
+ },
+ },
+ UpiCollect: {
+ Request: {
+ payment_method: "upi",
+ payment_method_type: "upi_collect",
+ payment_method_data: {
+ upi: {
+ upi_collect: {
+ vpa_id: "successtest@iata",
+ },
+ },
+ },
+ },
+ Response: {
+ status: 200,
+ body: {
+ status: "requires_customer_action",
+ },
+ },
+ },
+ UpiIntent: {
+ Request: {
+ payment_method: "upi",
+ payment_method_type: "upi_intent",
+ payment_method_data: {
+ upi: {
+ upi_intent: {},
+ },
+ },
+ },
+ Response: {
+ status: 200,
+ body: {
+ status: "requires_customer_action",
+ },
+ },
+ },
+ Refund: {
+ Request: {
+ amount: 6500,
+ },
+ Response: {
+ status: 200,
+ body: {
+ status: "pending",
+ },
+ },
+ },
+ },
+};
diff --git a/cypress-tests/cypress/e2e/PaymentUtils/Nmi.js b/cypress-tests/cypress/e2e/PaymentUtils/Nmi.js
index f637def7fe..7e9369cb44 100644
--- a/cypress-tests/cypress/e2e/PaymentUtils/Nmi.js
+++ b/cypress-tests/cypress/e2e/PaymentUtils/Nmi.js
@@ -361,11 +361,11 @@ export const connectorDetails = {
},
ZeroAuthMandate: {
Request: {
- payment_method_data: {
+ payment_method_data: {
card: successfulNo3DSCardDetails,
},
currency: "USD",
- mandate_data: singleUseMandateData
+ mandate_data: singleUseMandateData,
},
Response: {
status: 501,
diff --git a/cypress-tests/cypress/e2e/PaymentUtils/utils.js b/cypress-tests/cypress/e2e/PaymentUtils/utils.js
index f14c68ce94..3f41549bb8 100644
--- a/cypress-tests/cypress/e2e/PaymentUtils/utils.js
+++ b/cypress-tests/cypress/e2e/PaymentUtils/utils.js
@@ -3,6 +3,7 @@ import { connectorDetails as bankOfAmericaConnectorDetails } from "./BankOfAmeri
import { connectorDetails as bluesnapConnectorDetails } from "./Bluesnap.js";
import { connectorDetails as CommonConnectorDetails } from "./Commons.js";
import { connectorDetails as cybersourceConnectorDetails } from "./Cybersource.js";
+import { connectorDetails as iatapayConnectorDetails } from "./Iatapay.js";
import { connectorDetails as nmiConnectorDetails } from "./Nmi.js";
import { connectorDetails as paypalConnectorDetails } from "./Paypal.js";
import { connectorDetails as stripeConnectorDetails } from "./Stripe.js";
@@ -14,6 +15,7 @@ const connectorDetails = {
bluesnap: bluesnapConnectorDetails,
commons: CommonConnectorDetails,
cybersource: cybersourceConnectorDetails,
+ iatapay: iatapayConnectorDetails,
nmi: nmiConnectorDetails,
paypal: paypalConnectorDetails,
stripe: stripeConnectorDetails,
diff --git a/cypress-tests/cypress/e2e/PayoutTest/00004-BankTransfer.cy.js b/cypress-tests/cypress/e2e/PayoutTest/00004-BankTransfer.cy.js
index 8c2e401231..9001cb212b 100644
--- a/cypress-tests/cypress/e2e/PayoutTest/00004-BankTransfer.cy.js
+++ b/cypress-tests/cypress/e2e/PayoutTest/00004-BankTransfer.cy.js
@@ -5,7 +5,7 @@ import * as utils from "../PayoutUtils/utils";
let globalState;
// TODO: Add test for Bank Transfer - ACH
-describe("[Payout] [Bank Transfer - ACH]", () => {
+describe.skip("[Payout] [Bank Transfer - ACH]", () => {
let should_continue = true; // variable that will be used to skip tests if a previous test fails
before("seed global state", () => {
@@ -31,7 +31,7 @@ describe("[Payout] [Bank Transfer - ACH]", () => {
});
// TODO: Add test for Bank Transfer - BACS
-describe("[Payout] [Bank Transfer - BACS]", () => {
+describe.skip("[Payout] [Bank Transfer - BACS]", () => {
let should_continue = true; // variable that will be used to skip tests if a previous test fails
before("seed global state", () => {
diff --git a/cypress-tests/cypress/support/commands.js b/cypress-tests/cypress/support/commands.js
index dbad47ab2c..de311a4697 100644
--- a/cypress-tests/cypress/support/commands.js
+++ b/cypress-tests/cypress/support/commands.js
@@ -547,6 +547,64 @@ Cypress.Commands.add(
}
);
+Cypress.Commands.add(
+ "confirmUpiCall",
+ (confirmBody, req_data, res_data, confirm, globalState) => {
+ const paymentId = globalState.get("paymentID");
+ for (const key in req_data) {
+ confirmBody[key] = req_data[key];
+ }
+ confirmBody.confirm = confirm;
+ confirmBody.client_secret = globalState.get("clientSecret");
+ globalState.set("paymentMethodType", confirmBody.payment_method_type);
+
+ cy.request({
+ method: "POST",
+ url: `${globalState.get("baseUrl")}/payments/${paymentId}/confirm`,
+ headers: {
+ "Content-Type": "application/json",
+ "api-key": globalState.get("publishableKey"),
+ },
+ failOnStatusCode: false,
+ body: confirmBody,
+ }).then((response) => {
+ logRequestId(response.headers["x-request-id"]);
+
+ expect(res_data.status).to.equal(response.status);
+ expect(response.headers["content-type"]).to.include("application/json");
+
+ if (response.status === 200) {
+ if (
+ response.body.capture_method === "automatic" ||
+ response.body.capture_method === "manual"
+ ) {
+ if (response.body.payment_method_type === "upi_collect") {
+ expect(response.body)
+ .to.have.property("next_action")
+ .to.have.property("redirect_to_url");
+ globalState.set(
+ "nextActionUrl",
+ response.body.next_action.redirect_to_url
+ );
+ } else if (response.body.payment_method_type === "upi_intent") {
+ expect(response.body)
+ .to.have.property("next_action")
+ .to.have.property("qr_code_fetch_url");
+ globalState.set(
+ "nextActionUrl",
+ response.body.next_action.qr_code_fetch_url
+ );
+ }
+ } else {
+ defaultErrorHandler(response, res_data);
+ }
+ } else {
+ defaultErrorHandler(response, res_data);
+ }
+ });
+ }
+);
+
Cypress.Commands.add(
"createConfirmPaymentTest",
(
@@ -1103,11 +1161,27 @@ Cypress.Commands.add(
"handleBankTransferRedirection",
(globalState, payment_method_type, expected_redirection) => {
let connectorId = globalState.get("connectorId");
+ let expected_url = new URL(expected_redirection);
let redirection_url = new URL(globalState.get("nextActionUrl"));
cy.log(payment_method_type);
handleRedirection(
"bank_transfer",
- { redirection_url, expected_redirection },
+ { redirection_url, expected_url },
+ connectorId,
+ payment_method_type
+ );
+ }
+);
+
+Cypress.Commands.add(
+ "handleUpiRedirection",
+ (globalState, payment_method_type, expected_redirection) => {
+ let connectorId = globalState.get("connectorId");
+ let expected_url = new URL(expected_redirection);
+ let redirection_url = new URL(globalState.get("nextActionUrl"));
+ handleRedirection(
+ "upi",
+ { redirection_url, expected_url },
connectorId,
payment_method_type
);
diff --git a/cypress-tests/cypress/support/redirectionHandler.js b/cypress-tests/cypress/support/redirectionHandler.js
index e9281bcc41..12e86f6448 100644
--- a/cypress-tests/cypress/support/redirectionHandler.js
+++ b/cypress-tests/cypress/support/redirectionHandler.js
@@ -1,5 +1,10 @@
import jsQR from "jsqr";
+// Define constants for wait times
+const TIMEOUT = 20000; // 20 seconds
+const WAIT_TIME = 10000; // 10 seconds
+const WAIT_TIME_IATAPAY = 20000; // 20 seconds
+
export function handleRedirection(
redirection_type,
urls,
@@ -7,9 +12,6 @@ export function handleRedirection(
payment_method_type
) {
switch (redirection_type) {
- case "three_ds":
- threeDsRedirection(urls.redirection_url, urls.expected_url, connectorId);
- break;
case "bank_redirect":
bankRedirectRedirection(
urls.redirection_url,
@@ -26,6 +28,17 @@ export function handleRedirection(
payment_method_type
);
break;
+ case "three_ds":
+ threeDsRedirection(urls.redirection_url, urls.expected_url, connectorId);
+ break;
+ case "upi":
+ upiRedirection(
+ urls.redirection_url,
+ urls.expected_url,
+ connectorId,
+ payment_method_type
+ );
+ break;
default:
throw new Error(`Redirection known: ${redirection_type}`);
}
@@ -58,63 +71,6 @@ function bankTransferRedirection(
});
}
-function threeDsRedirection(redirection_url, expected_url, connectorId) {
- cy.visit(redirection_url.href);
- if (connectorId == "adyen") {
- cy.get("iframe")
- .its("0.contentDocument.body")
- .within((body) => {
- cy.get('input[type="password"]').click();
- cy.get('input[type="password"]').type("password");
- cy.get("#buttonSubmit").click();
- });
- } else if (connectorId === "bankofamerica" || connectorId === "cybersource") {
- cy.get("iframe", { timeout: 15000 })
- .its("0.contentDocument.body")
- .within((body) => {
- cy.get('input[type="text"]').click().type("1234");
- cy.get('input[value="SUBMIT"]').click();
- });
- } else if (connectorId === "nmi" || connectorId === "noon") {
- cy.get("iframe", { timeout: 150000 })
- .its("0.contentDocument.body")
- .within((body) => {
- cy.get("iframe", { timeout: 20000 })
- .its("0.contentDocument.body")
- .within((body) => {
- cy.get('form[name="cardholderInput"]', { timeout: 20000 })
- .should("exist")
- .then((form) => {
- cy.get('input[name="challengeDataEntry"]').click().type("1234");
- cy.get('input[value="SUBMIT"]').click();
- });
- });
- });
- } else if (connectorId === "stripe") {
- cy.get("iframe", { timeout: 15000 })
- .its("0.contentDocument.body")
- .within((body) => {
- cy.get("iframe")
- .its("0.contentDocument.body")
- .within((body) => {
- cy.get("#test-source-authorize-3ds").click();
- });
- });
- } else if (connectorId === "trustpay") {
- cy.get('form[name="challengeForm"]', { timeout: 10000 })
- .should("exist")
- .then((form) => {
- cy.get("#outcomeSelect").select("Approve").should("have.value", "Y");
- cy.get('button[type="submit"]').click();
- });
- } else {
- // If connectorId is neither of adyen, trustpay, nmi, stripe, bankofamerica or cybersource, wait for 10 seconds
- cy.wait(10000);
- }
-
- verifyReturnUrl(redirection_url, expected_url, true);
-}
-
function bankRedirectRedirection(
redirection_url,
expected_url,
@@ -167,7 +123,7 @@ function bankRedirectRedirection(
cy.wait(5000);
break;
case "sofort":
- cy.get(".modal-overlay.modal-shown.in", { timeout: 5000 }).then(
+ cy.get(".modal-overlay.modal-shown.in", { timeout: TIMEOUT }).then(
($modal) => {
// If modal is found, handle it
if ($modal.length > 0) {
@@ -294,7 +250,110 @@ function bankRedirectRedirection(
default:
throw new Error(`Unsupported connector: ${connectorId}`);
}
- verifyReturnUrl(redirection_url, expected_url, verifyUrl);
+
+ cy.then(() => {
+ verifyReturnUrl(redirection_url, expected_url, verifyUrl);
+ });
+}
+
+function threeDsRedirection(redirection_url, expected_url, connectorId) {
+ cy.visit(redirection_url.href);
+ if (connectorId === "adyen") {
+ cy.get("iframe")
+ .its("0.contentDocument.body")
+ .within((body) => {
+ cy.get('input[type="password"]').click();
+ cy.get('input[type="password"]').type("password");
+ cy.get("#buttonSubmit").click();
+ });
+ } else if (connectorId === "bankofamerica" || connectorId === "cybersource") {
+ cy.get("iframe", { timeout: TIMEOUT })
+ .its("0.contentDocument.body")
+ .within((body) => {
+ cy.get('input[type="text"]').click().type("1234");
+ cy.get('input[value="SUBMIT"]').click();
+ });
+ } else if (connectorId === "nmi" || connectorId === "noon") {
+ cy.get("iframe", { timeout: TIMEOUT })
+ .its("0.contentDocument.body")
+ .within((body) => {
+ cy.get("iframe", { timeout: TIMEOUT })
+ .its("0.contentDocument.body")
+ .within((body) => {
+ cy.get('form[name="cardholderInput"]', { timeout: TIMEOUT })
+ .should("exist")
+ .then((form) => {
+ cy.get('input[name="challengeDataEntry"]').click().type("1234");
+ cy.get('input[value="SUBMIT"]').click();
+ });
+ });
+ });
+ } else if (connectorId === "stripe") {
+ cy.get("iframe", { timeout: TIMEOUT })
+ .its("0.contentDocument.body")
+ .within((body) => {
+ cy.get("iframe")
+ .its("0.contentDocument.body")
+ .within((body) => {
+ cy.get("#test-source-authorize-3ds").click();
+ });
+ });
+ } else if (connectorId === "trustpay") {
+ cy.get('form[name="challengeForm"]', { timeout: WAIT_TIME })
+ .should("exist")
+ .then((form) => {
+ cy.get("#outcomeSelect").select("Approve").should("have.value", "Y");
+ cy.get('button[type="submit"]').click();
+ });
+ } else {
+ // If connectorId is neither of adyen, trustpay, nmi, stripe, bankofamerica or cybersource, wait for 10 seconds
+ cy.wait(WAIT_TIME);
+ }
+
+ cy.then(() => {
+ verifyReturnUrl(redirection_url, expected_url, true);
+ });
+}
+
+function upiRedirection(
+ redirection_url,
+ expected_url,
+ connectorId,
+ payment_method_type
+) {
+ let verifyUrl = false;
+ if (connectorId === "iatapay") {
+ switch (payment_method_type) {
+ case "upi_collect":
+ cy.visit(redirection_url.href);
+ cy.wait(WAIT_TIME_IATAPAY).then(() => {
+ verifyUrl = true;
+ });
+ break;
+ case "upi_intent":
+ cy.request(redirection_url.href).then((response) => {
+ expect(response.status).to.eq(200);
+ expect(response.body).to.have.property("iataPaymentId");
+ expect(response.body).to.have.property("status", "INITIATED");
+ expect(response.body.qrInfoData).to.be.an("object");
+ expect(response.body.qrInfoData).to.have.property("qr");
+ expect(response.body.qrInfoData).to.have.property("qrLink");
+ });
+ verifyUrl = false;
+ break;
+ default:
+ throw new Error(
+ `Unsupported payment method type: ${payment_method_type}`
+ );
+ }
+ } else {
+ // If connectorId is not iatapay, wait for 10 seconds
+ cy.wait(WAIT_TIME);
+ }
+
+ cy.then(() => {
+ verifyReturnUrl(redirection_url, expected_url, verifyUrl);
+ });
}
function verifyReturnUrl(redirection_url, expected_url, forward_flow) {