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): Add save card flow (#4327)
Gnanasundari245a0a8cee7637
diff --git a/cypress-tests/cypress/e2e/ConnectorTest/00003-NoThreeDSAutoCapture.cy.js b/cypress-tests/cypress/e2e/ConnectorTest/00003-NoThreeDSAutoCapture.cy.jsindex 3d86d292a0..935d8d634d 100644--- a/cypress-tests/cypress/e2e/ConnectorTest/00003-NoThreeDSAutoCapture.cy.js+++ b/cypress-tests/cypress/e2e/ConnectorTest/00003-NoThreeDSAutoCapture.cy.js@@ -25,7 +25,7 @@ describe("Card - NoThreeDS payment flow test", () => {it("create-payment-call-test", () => {let det = getConnectorDetails(globalState.get("connectorId"))["No3DS"];- cy.createPaymentIntentTest(createPaymentBody, det.currency, "no_three_ds", "automatic", globalState);+ cy.createPaymentIntentTest(createPaymentBody, det, "no_three_ds", "automatic", globalState);});it("payment_methods-call-test", () => {diff --git a/cypress-tests/cypress/e2e/ConnectorTest/00004-ThreeDSAutoCapture.cy.js b/cypress-tests/cypress/e2e/ConnectorTest/00004-ThreeDSAutoCapture.cy.jsindex 7766935df0..4b1f2d6e8c 100644--- a/cypress-tests/cypress/e2e/ConnectorTest/00004-ThreeDSAutoCapture.cy.js+++ b/cypress-tests/cypress/e2e/ConnectorTest/00004-ThreeDSAutoCapture.cy.js@@ -26,7 +26,7 @@ describe("Card - ThreeDS payment flow test", () => {it("create-payment-call-test", () => {let det = getConnectorDetails(globalState.get("connectorId"))["No3DS"];- cy.createPaymentIntentTest(createPaymentBody, det.currency, "three_ds", "automatic", globalState);+ cy.createPaymentIntentTest(createPaymentBody, det, "three_ds", "automatic", globalState);});it("payment_methods-call-test", () => {diff --git a/cypress-tests/cypress/e2e/ConnectorTest/00005-NoThreeDSManualCapture.cy.js b/cypress-tests/cypress/e2e/ConnectorTest/00005-NoThreeDSManualCapture.cy.jsindex 8fef11b830..5c0a09ec59 100644--- a/cypress-tests/cypress/e2e/ConnectorTest/00005-NoThreeDSManualCapture.cy.js+++ b/cypress-tests/cypress/e2e/ConnectorTest/00005-NoThreeDSManualCapture.cy.js@@ -28,7 +28,7 @@ describe("Card - NoThreeDS Manual payment flow test", () => {it("create-payment-call-test", () => {let det = getConnectorDetails(globalState.get("connectorId"))["No3DS"];- cy.createPaymentIntentTest(createPaymentBody, det.currency, "no_three_ds", "manual", globalState);+ cy.createPaymentIntentTest(createPaymentBody, det, "no_three_ds", "manual", globalState);});it("payment_methods-call-test", () => {@@ -90,7 +90,7 @@ describe("Card - NoThreeDS Manual payment flow test", () => {it("create-payment-call-test", () => {let det = getConnectorDetails(globalState.get("connectorId"))["No3DS"];- cy.createPaymentIntentTest(createPaymentBody, det.currency, "no_three_ds", "manual", globalState);+ cy.createPaymentIntentTest(createPaymentBody, det, "no_three_ds", "manual", globalState);});it("payment_methods-call-test", () => {diff --git a/cypress-tests/cypress/e2e/ConnectorTest/00006-VoidPayment.cy.js b/cypress-tests/cypress/e2e/ConnectorTest/00006-VoidPayment.cy.jsindex ef5262716e..7459a6cb83 100644--- a/cypress-tests/cypress/e2e/ConnectorTest/00006-VoidPayment.cy.js+++ b/cypress-tests/cypress/e2e/ConnectorTest/00006-VoidPayment.cy.js@@ -24,7 +24,7 @@ describe("Card - NoThreeDS Manual payment flow test", () => {context("Card - void payment in Requires_capture state flow test", () => {it("create-payment-call-test", () => {let det = getConnectorDetails(globalState.get("connectorId"))["No3DS"];- cy.createPaymentIntentTest(createPaymentBody, det.currency, "no_three_ds", "manual", globalState);+ cy.createPaymentIntentTest(createPaymentBody, det, "no_three_ds", "manual", globalState);});it("payment_methods-call-test", () => {@@ -46,7 +46,7 @@ describe("Card - NoThreeDS Manual payment flow test", () => {context("Card - void payment in Requires_payment_method state flow test", () => {it("create-payment-call-test", () => {let det = getConnectorDetails(globalState.get("connectorId"))["No3DS"];- cy.createPaymentIntentTest(createPaymentBody, det.currency, "no_three_ds", "manual", globalState);+ cy.createPaymentIntentTest(createPaymentBody, det, "no_three_ds", "manual", globalState);});it("payment_methods-call-test", () => {@@ -61,7 +61,7 @@ describe("Card - NoThreeDS Manual payment flow test", () => {context("Card - void payment in Requires_payment_method state flow test", () => {it("create-payment-call-test", () => {let det = getConnectorDetails(globalState.get("connectorId"))["No3DS"];- cy.createPaymentIntentTest(createPaymentBody, det.currency, "no_three_ds", "manual", globalState);+ cy.createPaymentIntentTest(createPaymentBody, det, "no_three_ds", "manual", globalState);});it("payment_methods-call-test", () => {diff --git a/cypress-tests/cypress/e2e/ConnectorTest/00007-SyncPayment.cy.js b/cypress-tests/cypress/e2e/ConnectorTest/00007-SyncPayment.cy.jsindex 02b030e356..645af22313 100644--- a/cypress-tests/cypress/e2e/ConnectorTest/00007-SyncPayment.cy.js+++ b/cypress-tests/cypress/e2e/ConnectorTest/00007-SyncPayment.cy.js@@ -21,7 +21,7 @@ describe("Card - Sync payment flow test", () => {})it("create-payment-call-test", () => {let det = getConnectorDetails(globalState.get("connectorId"))["No3DS"];- cy.createPaymentIntentTest(createPaymentBody, det.currency, "no_three_ds", "automatic", globalState);+ cy.createPaymentIntentTest(createPaymentBody, det, "no_three_ds", "automatic", globalState);});it("payment_methods-call-test", () => {diff --git a/cypress-tests/cypress/e2e/ConnectorTest/00008-RefundPayment.cy.js b/cypress-tests/cypress/e2e/ConnectorTest/00008-RefundPayment.cy.jsindex 73f92381a1..d3b1f467b2 100644--- a/cypress-tests/cypress/e2e/ConnectorTest/00008-RefundPayment.cy.js+++ b/cypress-tests/cypress/e2e/ConnectorTest/00008-RefundPayment.cy.js@@ -29,7 +29,7 @@ describe("Card - Refund flow test", () => {it("create-payment-call-test", () => {let det = getConnectorDetails(globalState.get("connectorId"))["No3DS"];- cy.createPaymentIntentTest(createPaymentBody, det.currency, "no_three_ds", "automatic", globalState);+ cy.createPaymentIntentTest(createPaymentBody, det, "no_three_ds", "automatic", globalState);});it("payment_methods-call-test", () => {@@ -57,7 +57,7 @@ describe("Card - Refund flow test", () => {it("create-payment-call-test", () => {let det = getConnectorDetails(globalState.get("connectorId"))["No3DS"];- cy.createPaymentIntentTest(createPaymentBody, det.currency, "no_three_ds", "automatic", globalState);+ cy.createPaymentIntentTest(createPaymentBody, det, "no_three_ds", "automatic", globalState);});it("payment_methods-call-test", () => {@@ -138,7 +138,7 @@ describe("Card - Refund flow test", () => {it("create-payment-call-test", () => {let det = getConnectorDetails(globalState.get("connectorId"))["No3DS"];- cy.createPaymentIntentTest(createPaymentBody, det.currency, "no_three_ds", "manual", globalState);+ cy.createPaymentIntentTest(createPaymentBody, det, "no_three_ds", "manual", globalState);});it("payment_methods-call-test", () => {@@ -181,7 +181,7 @@ describe("Card - Refund flow test", () => {it("create-payment-call-test", () => {let det = getConnectorDetails(globalState.get("connectorId"))["No3DS"];- cy.createPaymentIntentTest(createPaymentBody, det.currency, "no_three_ds", "manual", globalState);+ cy.createPaymentIntentTest(createPaymentBody, det, "no_three_ds", "manual", globalState);});it("payment_methods-call-test", () => {@@ -222,13 +222,16 @@ describe("Card - Refund flow test", () => {let det = getConnectorDetails(globalState.get("connectorId"))["No3DS"];cy.syncRefundCallTest(det, globalState);});+ it("list-refund-call-test", () => {+ cy.listRefundCallTest(globalState);+ });});context("Card - Full Refund for partially captured No-3DS payment", () => {it("create-payment-call-test", () => {let det = getConnectorDetails(globalState.get("connectorId"))["No3DS"];- cy.createPaymentIntentTest(createPaymentBody, det.currency, "no_three_ds", "manual", globalState);+ cy.createPaymentIntentTest(createPaymentBody, det, "no_three_ds", "manual", globalState);});it("payment_methods-call-test", () => {@@ -271,7 +274,7 @@ describe("Card - Refund flow test", () => {it("create-payment-call-test", () => {let det = getConnectorDetails(globalState.get("connectorId"))["No3DS"];- cy.createPaymentIntentTest(createPaymentBody, det.currency, "no_three_ds", "manual", globalState);+ cy.createPaymentIntentTest(createPaymentBody, det, "no_three_ds", "manual", globalState);});it("payment_methods-call-test", () => {@@ -313,10 +316,9 @@ describe("Card - Refund flow test", () => {context("Card - Full Refund for Create + Confirm Automatic CIT and MIT payment flow test", () => {it("Confirm No 3DS CIT", () => {- console.log("confirm -> " + globalState.get("connectorId"));let det = getConnectorDetails(globalState.get("connectorId"))["MandateMultiUseNo3DS"];console.log("det -> " + det.card);- cy.citForMandatesCallTest(citConfirmBody, det, true, "automatic", globalState);+ cy.citForMandatesCallTest(citConfirmBody, 7000, det, true, "automatic", "new_mandate", globalState);});it("Confirm No 3DS MIT", () => {@@ -326,6 +328,16 @@ describe("Card - Refund flow test", () => {it("Confirm No 3DS MIT", () => {cy.mitForMandatesCallTest(mitConfirmBody, 7000, true, "automatic", globalState);});++ it("refund-call-test", () => {+ let det = getConnectorDetails(globalState.get("connectorId"))["No3DS"];+ cy.refundCallTest(refundBody, 7000, det, globalState);+ });++ it("sync-refund-call-test", () => {+ let det = getConnectorDetails(globalState.get("connectorId"))["No3DS"];+ cy.syncRefundCallTest(det, globalState);+ });});});diff --git a/cypress-tests/cypress/e2e/ConnectorTest/00009-SyncRefund.cy.js b/cypress-tests/cypress/e2e/ConnectorTest/00009-SyncRefund.cy.jsindex 890ca2fcbe..8d35475f22 100644--- a/cypress-tests/cypress/e2e/ConnectorTest/00009-SyncRefund.cy.js+++ b/cypress-tests/cypress/e2e/ConnectorTest/00009-SyncRefund.cy.js@@ -23,7 +23,7 @@ describe("Card - Sync Refund flow test", () => {it("create-payment-call-test", () => {let det = getConnectorDetails(globalState.get("connectorId"))["No3DS"];- cy.createPaymentIntentTest(createPaymentBody, det.currency, "no_three_ds", "automatic", globalState);+ cy.createPaymentIntentTest(createPaymentBody, det, "no_three_ds", "automatic", globalState);});it("payment_methods-call-test", () => {diff --git a/cypress-tests/cypress/e2e/ConnectorTest/00010-CreateSingleuseMandate.cy.js b/cypress-tests/cypress/e2e/ConnectorTest/00010-CreateSingleuseMandate.cy.jsindex a80368dd3f..a3ad2a8f52 100644--- a/cypress-tests/cypress/e2e/ConnectorTest/00010-CreateSingleuseMandate.cy.js+++ b/cypress-tests/cypress/e2e/ConnectorTest/00010-CreateSingleuseMandate.cy.js@@ -27,7 +27,7 @@ describe("Card - SingleUse Mandates flow test", () => {console.log("confirm -> " + globalState.get("connectorId"));let det = getConnectorDetails(globalState.get("connectorId"))["MandateSingleUseNo3DS"];console.log("det -> " + det.card);- cy.citForMandatesCallTest(citConfirmBody, det, true, "automatic", globalState);+ cy.citForMandatesCallTest(citConfirmBody,7000, det, true, "automatic", "new_mandate", globalState);});it("Confirm No 3DS MIT", () => {@@ -41,7 +41,7 @@ describe("Card - SingleUse Mandates flow test", () => {console.log("confirm -> " + globalState.get("connectorId"));let det = getConnectorDetails(globalState.get("connectorId"))["MandateSingleUseNo3DS"];console.log("det -> " + det.card);- cy.citForMandatesCallTest(citConfirmBody, det, true, "manual", globalState);+ cy.citForMandatesCallTest(citConfirmBody,7000, det, true, "manual", "new_mandate", globalState);});it("cit-capture-call-test", () => {@@ -71,7 +71,7 @@ describe("Card - SingleUse Mandates flow test", () => {console.log("confirm -> " + globalState.get("connectorId"));let det = getConnectorDetails(globalState.get("connectorId"))["MandateSingleUse3DS"];console.log("det -> " + det.card);- cy.citForMandatesCallTest(citConfirmBody, det, true, "automatic", globalState);+ cy.citForMandatesCallTest(citConfirmBody,6500, det, true, "automatic", "new_mandate", globalState);});it("cit-capture-call-test", () => {diff --git a/cypress-tests/cypress/e2e/ConnectorTest/00011-CreateMultiuseMandate.cy.js b/cypress-tests/cypress/e2e/ConnectorTest/00011-CreateMultiuseMandate.cy.jsindex 74aa5ece67..65939d1e44 100644--- a/cypress-tests/cypress/e2e/ConnectorTest/00011-CreateMultiuseMandate.cy.js+++ b/cypress-tests/cypress/e2e/ConnectorTest/00011-CreateMultiuseMandate.cy.js@@ -22,13 +22,14 @@ describe("Card - MultiUse Mandates flow test", () => {cy.task('setGlobalState', globalState.data);})+context("Card - NoThreeDS Create + Confirm Automatic CIT and MIT payment flow test", () => {it("Confirm No 3DS CIT", () => {console.log("confirm -> " + globalState.get("connectorId"));let det = getConnectorDetails(globalState.get("connectorId"))["MandateMultiUseNo3DS"];console.log("det -> " + det.card);- cy.citForMandatesCallTest(citConfirmBody, det, true, "automatic", globalState);+ cy.citForMandatesCallTest(citConfirmBody, 7000, det, true, "automatic","new_mandate", globalState);});it("Confirm No 3DS MIT", () => {@@ -45,7 +46,7 @@ describe("Card - MultiUse Mandates flow test", () => {console.log("confirm -> " + globalState.get("connectorId"));let det = getConnectorDetails(globalState.get("connectorId"))["MandateMultiUseNo3DS"];console.log("det -> " + det.card);- cy.citForMandatesCallTest(citConfirmBody, det, true, "manual", globalState);+ cy.citForMandatesCallTest(citConfirmBody, 7000, det, true, "manual","new_mandate", globalState);});it("cit-capture-call-test", () => {@@ -81,7 +82,7 @@ describe("Card - MultiUse Mandates flow test", () => {console.log("confirm -> " + globalState.get("connectorId"));let det = getConnectorDetails(globalState.get("connectorId"))["MandateMultiUse3DS"];console.log("det -> " + det.card);- cy.citForMandatesCallTest(citConfirmBody, det, true, "automatic", globalState);+ cy.citForMandatesCallTest(citConfirmBody, 6500, det, true, "automatic", "new_mandate", globalState);});it("cit-capture-call-test", () => {diff --git a/cypress-tests/cypress/e2e/ConnectorTest/00012-ListAndRevokeMandate.cy.js b/cypress-tests/cypress/e2e/ConnectorTest/00012-ListAndRevokeMandate.cy.jsindex 00f676cab5..0ceb92d5ec 100644--- a/cypress-tests/cypress/e2e/ConnectorTest/00012-ListAndRevokeMandate.cy.js+++ b/cypress-tests/cypress/e2e/ConnectorTest/00012-ListAndRevokeMandate.cy.js@@ -28,7 +28,7 @@ describe("Card - SingleUse Mandates flow test", () => {console.log("confirm -> " + globalState.get("connectorId"));let det = getConnectorDetails(globalState.get("connectorId"))["MandateSingleUseNo3DS"];console.log("det -> " + det.card);- cy.citForMandatesCallTest(citConfirmBody, det, true, "automatic", globalState);+ cy.citForMandatesCallTest(citConfirmBody,7000, det, true, "automatic", "new_mandate", globalState);});it("Confirm No 3DS MIT", () => {diff --git a/cypress-tests/cypress/e2e/ConnectorTest/00013-SaveCardFlow.cy.js b/cypress-tests/cypress/e2e/ConnectorTest/00013-SaveCardFlow.cy.jsnew file mode 100644index 0000000000..744b730b58--- /dev/null+++ b/cypress-tests/cypress/e2e/ConnectorTest/00013-SaveCardFlow.cy.js@@ -0,0 +1,129 @@+import createPaymentBody from "../../fixtures/create-payment-body.json";+import confirmBody from "../../fixtures/confirm-body.json";+import createConfirmPaymentBody from "../../fixtures/create-confirm-body.json";+import customerCreateBody from "../../fixtures/create-customer-body.json";+import captureBody from "../../fixtures/capture-flow-body.json";+import getConnectorDetails from "../ConnectorUtils/utils";+import State from "../../utils/State";+let globalState;++describe("Card - SaveCard payment flow test", () => {++ before("seed global state", () => {++ cy.task('getGlobalState').then((state) => {+ globalState = new State(state);+ console.log("seeding globalState -> " + JSON.stringify(globalState));+ })+ })++ after("flush global state", () => {+ console.log("flushing globalState -> "+ JSON.stringify(globalState));+ cy.task('setGlobalState', globalState.data);+ })+++ context("Save card for NoThreeDS automatic capture payment- Create+Confirm", () => {+ it("customer-create-call-test", () => {+ cy.createCustomerCallTest(customerCreateBody, globalState);+ });++ it("create+confirm-payment-call-test", () => {+ let det = getConnectorDetails(globalState.get("connectorId"))["SaveCardUseNo3DS"];+ cy.createConfirmPaymentTest( createConfirmPaymentBody, det,"no_three_ds", "automatic", globalState);+ });++ it("retrieve-payment-call-test", () => {+ cy.retrievePaymentCallTest(globalState);+ });++ it("retrieve-customerPM-call-test", () => {+ cy.listCustomerPMCallTest(globalState);+ });++ it("create-payment-call-test", () => {+ let det = getConnectorDetails(globalState.get("connectorId"))["No3DS"];+ cy.createPaymentIntentTest( createPaymentBody, det, "no_three_ds", "automatic", globalState);+ });++ it ("confirm-save-card-payment-call-test", () => {+ let det = getConnectorDetails(globalState.get("connectorId"))["SaveCardUseNo3DS"];+ cy.saveCardConfirmCallTest(confirmBody,det,globalState);+ });++ });++ context("Save card for NoThreeDS manual full capture payment- Create+Confirm", () => {+ it("customer-create-call-test", () => {+ cy.createCustomerCallTest(customerCreateBody, globalState);+ });++ it("create+confirm-payment-call-test", () => {+ let det = getConnectorDetails(globalState.get("connectorId"))["SaveCardUseNo3DS"];+ cy.createConfirmPaymentTest( createConfirmPaymentBody, det,"no_three_ds", "automatic", globalState);+ });++ it("retrieve-payment-call-test", () => {+ cy.retrievePaymentCallTest(globalState);+ });++ it("retrieve-customerPM-call-test", () => {+ cy.listCustomerPMCallTest(globalState);+ });++ it("create-payment-call-test", () => {+ let det = getConnectorDetails(globalState.get("connectorId"))["No3DS"];+ cy.createPaymentIntentTest( createPaymentBody, det, "no_three_ds", "manual", globalState);+ });+++ it ("confirm-save-card-payment-call-test", () => {+ let det = getConnectorDetails(globalState.get("connectorId"))["SaveCardUseNo3DS"];+ cy.saveCardConfirmCallTest(confirmBody,det,globalState);+ });++ it("capture-call-test", () => {+ let det = getConnectorDetails(globalState.get("connectorId"))["No3DS"];+ cy.captureCallTest(captureBody, 6500, det.paymentSuccessfulStatus, globalState);+ });++++ });++ context("Save card for NoThreeDS manual partial capture payment- Create + Confirm", () => {+ it("customer-create-call-test", () => {+ cy.createCustomerCallTest(customerCreateBody, globalState);+ });++ it("create+confirm-payment-call-test", () => {+ let det = getConnectorDetails(globalState.get("connectorId"))["SaveCardUseNo3DS"];+ cy.createConfirmPaymentTest( createConfirmPaymentBody, det,"no_three_ds", "automatic", globalState);+ });++ it("retrieve-payment-call-test", () => {+ cy.retrievePaymentCallTest(globalState);+ });++ it("retrieve-customerPM-call-test", () => {+ cy.listCustomerPMCallTest(globalState);+ });++ it("create-payment-call-test", () => {+ let det = getConnectorDetails(globalState.get("connectorId"))["No3DS"];+ cy.createPaymentIntentTest( createPaymentBody, det, "no_three_ds", "manual", globalState);+ });+++ it ("confirm-save-card-payment-call-test", () => {+ let det = getConnectorDetails(globalState.get("connectorId"))["SaveCardUseNo3DS"];+ cy.saveCardConfirmCallTest(confirmBody,det,globalState);+ });++ it("capture-call-test", () => {+ let det = getConnectorDetails(globalState.get("connectorId"))["No3DS"];+ cy.captureCallTest(captureBody, 5500, det.paymentSuccessfulStatus, globalState);+ });+ });++});\ No newline at end of filediff --git a/cypress-tests/cypress/e2e/ConnectorTest/00014-ZeroAuthMandate.cy.js b/cypress-tests/cypress/e2e/ConnectorTest/00014-ZeroAuthMandate.cy.jsnew file mode 100644index 0000000000..41d6c3a7b1--- /dev/null+++ b/cypress-tests/cypress/e2e/ConnectorTest/00014-ZeroAuthMandate.cy.js@@ -0,0 +1,50 @@+import captureBody from "../../fixtures/capture-flow-body.json";+import citConfirmBody from "../../fixtures/create-mandate-cit.json";+import mitConfirmBody from "../../fixtures/create-mandate-mit.json";+import getConnectorDetails from "../ConnectorUtils/utils";+import State from "../../utils/State";++let globalState;++describe("Card - SingleUse Mandates flow test", () => {++ before("seed global state", () => {++ cy.task('getGlobalState').then((state) => {+ globalState = new State(state);+ console.log("seeding globalState -> " + JSON.stringify(globalState));+ })+ })++ after("flush global state", () => {+ console.log("flushing globalState -> " + JSON.stringify(globalState));+ cy.task('setGlobalState', globalState.data);+ })++ context("Card - NoThreeDS Create + Confirm Automatic CIT and Single use MIT payment flow test", () => {++ it("Confirm No 3DS CIT", () => {+ let det = getConnectorDetails(globalState.get("connectorId"))["MandateSingleUseNo3DS"];+ cy.citForMandatesCallTest(citConfirmBody, 0, det, true, "automatic", "setup_mandate", globalState);+ });++ it("Confirm No 3DS MIT", () => {+ cy.mitForMandatesCallTest(mitConfirmBody, 7000, true, "automatic", globalState);+ });+ });+ context("Card - NoThreeDS Create + Confirm Automatic CIT and Multi use MIT payment flow test", () => {++ it("Confirm No 3DS CIT", () => {+ let det = getConnectorDetails(globalState.get("connectorId"))["MandateSingleUseNo3DS"];+ cy.citForMandatesCallTest(citConfirmBody,0, det, true, "automatic", "setup_mandate", globalState);+ });++ it("Confirm No 3DS MIT", () => {+ cy.mitForMandatesCallTest(mitConfirmBody, 7000, true, "automatic", globalState);+ });+ it("Confirm No 3DS MIT", () => {+ cy.mitForMandatesCallTest(mitConfirmBody, 7000, true, "automatic", globalState);+ });+ });++});\ No newline at end of filediff --git a/cypress-tests/cypress/e2e/ConnectorUtils/Adyen.js b/cypress-tests/cypress/e2e/ConnectorUtils/Adyen.jsindex 3c1e00c53b..a7526a8069 100644--- a/cypress-tests/cypress/e2e/ConnectorUtils/Adyen.js+++ b/cypress-tests/cypress/e2e/ConnectorUtils/Adyen.js@@ -22,7 +22,9 @@ export const connectorDetails = {"paymentSuccessfulStatus": "requires_customer_action","paymentSyncStatus": "succeeded","refundStatus": "pending",- "refundSyncStatus": "pending"+ "refundSyncStatus": "pending",+ "customer_acceptance":null,+ "setup_future_usage": "on_session",},"No3DS": {"card": successfulNo3DSCardDetails,@@ -30,7 +32,9 @@ export const connectorDetails = {"paymentSuccessfulStatus": "succeeded","paymentSyncStatus": "succeeded","refundStatus": "pending",- "refundSyncStatus": "pending"+ "refundSyncStatus": "pending",+ "customer_acceptance":null,+ "setup_future_usage": "on_session",},"MandateSingleUse3DS": {"card": successfulThreeDSTestCardDetails,@@ -41,7 +45,7 @@ export const connectorDetails = {"refundSyncStatus": "pending","mandate_type": {"single_use": {- "amount": 6000,+ "amount": 8000,"currency": "USD"}}@@ -55,7 +59,7 @@ export const connectorDetails = {"refundSyncStatus": "pending","mandate_type": {"single_use": {- "amount": 6000,+ "amount": 8000,"currency": "USD"}}@@ -69,7 +73,7 @@ export const connectorDetails = {"refundSyncStatus": "pending","mandate_type": {"multi_use": {- "amount": 6000,+ "amount": 8000,"currency": "USD"}}@@ -83,9 +87,26 @@ export const connectorDetails = {"refundSyncStatus": "pending","mandate_type": {"multi_use": {- "amount": 6000,+ "amount": 8000,"currency": "USD"}}},+ "SaveCardUseNo3DS": {+ "card": successfulNo3DSCardDetails,+ "currency":"USD",+ "paymentSuccessfulStatus": "succeeded",+ "paymentSyncStatus": "succeeded",+ "refundStatus": "succeeded",+ "refundSyncStatus": "succeeded",+ "setup_future_usage": "on_session",+ "customer_acceptance": {+ "acceptance_type": "offline",+ "accepted_at": "1963-05-03T04:07:52.723Z",+ "online": {+ "ip_address": "127.0.0.1",+ "user_agent": "amet irure esse"+ }+ },+ },};\ No newline at end of filediff --git a/cypress-tests/cypress/e2e/ConnectorUtils/BankOfAmerica.js b/cypress-tests/cypress/e2e/ConnectorUtils/BankOfAmerica.jsindex 07d0494519..31e9360f03 100644--- a/cypress-tests/cypress/e2e/ConnectorUtils/BankOfAmerica.js+++ b/cypress-tests/cypress/e2e/ConnectorUtils/BankOfAmerica.js@@ -22,7 +22,9 @@ export const connectorDetails = {"paymentSuccessfulStatus": "requires_customer_action","paymentSyncStatus": "succeeded","refundStatus": "pending",- "refundSyncStatus": "pending"+ "refundSyncStatus": "pending",+ "customer_acceptance":null,+ "setup_future_usage": "on_session",},"No3DS": {"card": successfulNo3DSCardDetails,@@ -30,7 +32,9 @@ export const connectorDetails = {"paymentSuccessfulStatus": "succeeded","paymentSyncStatus": "succeeded","refundStatus": "pending",- "refundSyncStatus": "pending"+ "refundSyncStatus": "pending",+ "customer_acceptance":null,+ "setup_future_usage": "on_session",},"MandateSingleUse3DS": {"card": successfulThreeDSTestCardDetails,@@ -88,4 +92,22 @@ export const connectorDetails = {}}},+ "SaveCardUseNo3DS": {+ "card": successfulNo3DSCardDetails,+ "currency":"USD",+ "paymentSuccessfulStatus": "succeeded",+ "paymentSyncStatus": "succeeded",+ "refundStatus": "succeeded",+ "refundSyncStatus": "succeeded",+ "setup_future_usage": "on_session",+ "customer_acceptance": {+ "acceptance_type": "offline",+ "accepted_at": "1963-05-03T04:07:52.723Z",+ "online": {+ "ip_address": "127.0.0.1",+ "user_agent": "amet irure esse"+ }+ },+ },+};\ No newline at end of filediff --git a/cypress-tests/cypress/e2e/ConnectorUtils/Bluesnap.js b/cypress-tests/cypress/e2e/ConnectorUtils/Bluesnap.jsindex 95d18f0ab8..4e26fcfc07 100644--- a/cypress-tests/cypress/e2e/ConnectorUtils/Bluesnap.js+++ b/cypress-tests/cypress/e2e/ConnectorUtils/Bluesnap.js@@ -21,7 +21,9 @@ export const connectorDetails = {"paymentSuccessfulStatus": "requires_customer_action","paymentSyncStatus": "succeeded","refundStatus": "succeeded",- "refundSyncStatus": "succeeded"+ "refundSyncStatus": "succeeded",+ "customer_acceptance":null,+ "setup_future_usage": "on_session",},"No3DS": {"card": successfulNo3DSCardDetails,@@ -30,6 +32,8 @@ export const connectorDetails = {"paymentSyncStatus": "succeeded","refundStatus": "succeeded","refundSyncStatus": "succeeded",+ "customer_acceptance":null,+ "setup_future_usage": "on_session",},"MandateSingleUse3DS": {"card": successfulThreeDSTestCardDetails,@@ -87,4 +91,21 @@ export const connectorDetails = {}}},+ "SaveCardUseNo3DS": {+ "card": successfulNo3DSCardDetails,+ "currency":"USD",+ "paymentSuccessfulStatus": "succeeded",+ "paymentSyncStatus": "succeeded",+ "refundStatus": "succeeded",+ "refundSyncStatus": "succeeded",+ "setup_future_usage": "on_session",+ "customer_acceptance": {+ "acceptance_type": "offline",+ "accepted_at": "1963-05-03T04:07:52.723Z",+ "online": {+ "ip_address": "127.0.0.1",+ "user_agent": "amet irure esse"+ }+ },+ },};\ No newline at end of filediff --git a/cypress-tests/cypress/e2e/ConnectorUtils/Cybersource.js b/cypress-tests/cypress/e2e/ConnectorUtils/Cybersource.jsindex b4839f0e2b..4a14b599a8 100644--- a/cypress-tests/cypress/e2e/ConnectorUtils/Cybersource.js+++ b/cypress-tests/cypress/e2e/ConnectorUtils/Cybersource.js@@ -22,6 +22,8 @@ export const connectorDetails = {"paymentSyncStatus": "succeeded","refundStatus": "pending","refundSyncStatus": "pending",+ "customer_acceptance":null,+ "setup_future_usage": "on_session",},"No3DS": {"card": successfulNo3DSCardDetails,@@ -30,6 +32,8 @@ export const connectorDetails = {"paymentSyncStatus": "succeeded","refundStatus": "pending","refundSyncStatus": "pending",+ "customer_acceptance":null,+ "setup_future_usage": "on_session",},"MandateSingleUse3DS": {"card": successfulThreeDSTestCardDetails,@@ -87,4 +91,21 @@ export const connectorDetails = {}}},+ "SaveCardUseNo3DS": {+ "card": successfulNo3DSCardDetails,+ "currency":"USD",+ "paymentSuccessfulStatus": "succeeded",+ "paymentSyncStatus": "succeeded",+ "refundStatus": "succeeded",+ "refundSyncStatus": "succeeded",+ "setup_future_usage": "on_session",+ "customer_acceptance": {+ "acceptance_type": "offline",+ "accepted_at": "1963-05-03T04:07:52.723Z",+ "online": {+ "ip_address": "127.0.0.1",+ "user_agent": "amet irure esse"+ }+ },+ },};\ No newline at end of filediff --git a/cypress-tests/cypress/e2e/ConnectorUtils/Nmi.js b/cypress-tests/cypress/e2e/ConnectorUtils/Nmi.jsindex 75774165fa..248ba4cfcd 100644--- a/cypress-tests/cypress/e2e/ConnectorUtils/Nmi.js+++ b/cypress-tests/cypress/e2e/ConnectorUtils/Nmi.js@@ -21,7 +21,9 @@ export const connectorDetails = {"paymentSuccessfulStatus": "requires_customer_action","paymentSyncStatus": "succeeded","refundStatus": "pending",- "refundSyncStatus": "succeeded"+ "refundSyncStatus": "succeeded",+ "customer_acceptance":null,+ "setup_future_usage": "on_session",},"No3DS": {@@ -30,7 +32,9 @@ export const connectorDetails = {"paymentSuccessfulStatus": "processing","paymentSyncStatus": "succeeded","refundStatus": "pending",- "refundSyncStatus": "succeeded"+ "refundSyncStatus": "succeeded",+ "customer_acceptance":null,+ "setup_future_usage": "on_session",},"MandateSingleUse3DS": {"card": successfulThreeDSTestCardDetails,@@ -88,4 +92,21 @@ export const connectorDetails = {}}},+ "SaveCardUseNo3DS": {+ "card": successfulNo3DSCardDetails,+ "currency":"USD",+ "paymentSuccessfulStatus": "processing",+ "paymentSyncStatus": "succeeded",+ "refundStatus": "pending",+ "refundSyncStatus": "succeeded",+ "setup_future_usage": "on_session",+ "customer_acceptance": {+ "acceptance_type": "offline",+ "accepted_at": "1963-05-03T04:07:52.723Z",+ "online": {+ "ip_address": "127.0.0.1",+ "user_agent": "amet irure esse"+ }+ },+ },};\ No newline at end of filediff --git a/cypress-tests/cypress/e2e/ConnectorUtils/Paypal.js b/cypress-tests/cypress/e2e/ConnectorUtils/Paypal.jsindex a3ced376cf..6488d39f43 100644--- a/cypress-tests/cypress/e2e/ConnectorUtils/Paypal.js+++ b/cypress-tests/cypress/e2e/ConnectorUtils/Paypal.js@@ -21,6 +21,8 @@ export const connectorDetails = {"currency": "USD","paymentSuccessfulStatus": "requires_customer_action","paymentSyncStatus": "processing",+ "customer_acceptance":null,+ "setup_future_usage": "on_session",},"No3DS": {@@ -28,6 +30,8 @@ export const connectorDetails = {"currency": "USD","paymentSuccessfulStatus": "processing","paymentSyncStatus": "processing",+ "customer_acceptance":null,+ "setup_future_usage": "on_session",},"MandateSingleUse3DS": {@@ -77,5 +81,22 @@ export const connectorDetails = {"currency": "USD"}}- }+ },+ "SaveCardUseNo3DS": {+ "card": successfulNo3DSCardDetails,+ "currency":"USD",+ "paymentSuccessfulStatus": "processing",+ "paymentSyncStatus": "succeeded",+ "refundStatus": "succeeded",+ "refundSyncStatus": "succeeded",+ "setup_future_usage": "on_session",+ "customer_acceptance": {+ "acceptance_type": "offline",+ "accepted_at": "1963-05-03T04:07:52.723Z",+ "online": {+ "ip_address": "127.0.0.1",+ "user_agent": "amet irure esse"+ }+ },+ },};\ No newline at end of filediff --git a/cypress-tests/cypress/e2e/ConnectorUtils/Stripe.js b/cypress-tests/cypress/e2e/ConnectorUtils/Stripe.jsindex 04dfd4b73a..bd4a73f33a 100644--- a/cypress-tests/cypress/e2e/ConnectorUtils/Stripe.js+++ b/cypress-tests/cypress/e2e/ConnectorUtils/Stripe.js@@ -24,7 +24,9 @@ export const connectorDetails = {"paymentSuccessfulStatus": "requires_customer_action","paymentSyncStatus": "succeeded","refundStatus": "succeeded",- "refundSyncStatus": "succeeded"+ "refundSyncStatus": "succeeded",+ "customer_acceptance":null,+ "setup_future_usage": "on_session"},"No3DS": {"card": successfulTestCardDetails,@@ -32,7 +34,9 @@ export const connectorDetails = {"paymentSuccessfulStatus": "succeeded","paymentSyncStatus": "succeeded","refundStatus": "succeeded",- "refundSyncStatus": "succeeded"+ "refundSyncStatus": "succeeded",+ "customer_acceptance":null,+ "setup_future_usage": "on_session"},"MandateSingleUse3DS": {"card": successfulThreeDSTestCardDetails,@@ -90,4 +94,21 @@ export const connectorDetails = {}}},+ "SaveCardUseNo3DS": {+ "card": successfulTestCardDetails,+ "currency":"USD",+ "paymentSuccessfulStatus": "succeeded",+ "paymentSyncStatus": "succeeded",+ "refundStatus": "succeeded",+ "refundSyncStatus": "succeeded",+ "setup_future_usage": "on_session",+ "customer_acceptance": {+ "acceptance_type": "offline",+ "accepted_at": "1963-05-03T04:07:52.723Z",+ "online": {+ "ip_address": "127.0.0.1",+ "user_agent": "amet irure esse"+ }+ },+ },};\ No newline at end of filediff --git a/cypress-tests/cypress/e2e/ConnectorUtils/Trustpay.js b/cypress-tests/cypress/e2e/ConnectorUtils/Trustpay.jsindex f190e145f9..c1c4155d10 100644--- a/cypress-tests/cypress/e2e/ConnectorUtils/Trustpay.js+++ b/cypress-tests/cypress/e2e/ConnectorUtils/Trustpay.js@@ -22,6 +22,8 @@ export const connectorDetails = {"paymentSyncStatus": "succeeded","refundStatus": "succeeded","refundSyncStatus": "succeeded",+ "customer_acceptance": null,+ "setup_future_usage": "on_session",},"No3DS": {"card": successfulNo3DSCardDetails,@@ -30,6 +32,8 @@ export const connectorDetails = {"paymentSyncStatus": "succeeded","refundStatus": "succeeded","refundSyncStatus": "succeeded",+ "customer_acceptance": null,+ "setup_future_usage": "on_session",},"MandateSingleUse3DS": {"card": successfulThreeDSTestCardDetails,@@ -87,4 +91,21 @@ export const connectorDetails = {}}},+ "SaveCardUseNo3DS": {+ "card": successfulNo3DSCardDetails,+ "currency":"USD",+ "paymentSuccessfulStatus": "succeeded",+ "paymentSyncStatus": "succeeded",+ "refundStatus": "succeeded",+ "refundSyncStatus": "succeeded",+ "setup_future_usage": "on_session",+ "customer_acceptance": {+ "acceptance_type": "offline",+ "accepted_at": "1963-05-03T04:07:52.723Z",+ "online": {+ "ip_address": "127.0.0.1",+ "user_agent": "amet irure esse"+ }+ },+ },};\ No newline at end of filediff --git a/cypress-tests/cypress/fixtures/confirm-body.json b/cypress-tests/cypress/fixtures/confirm-body.jsonindex e0ffceffec..376e423ded 100644--- a/cypress-tests/cypress/fixtures/confirm-body.json+++ b/cypress-tests/cypress/fixtures/confirm-body.json@@ -15,6 +15,14 @@"card_network": "Visa"}},+ "customer_acceptance": {+ "acceptance_type": "offline",+ "accepted_at": "1963-05-03T04:07:52.723Z",+ "online": {+ "ip_address": "127.0.0.1",+ "user_agent": "amet irure esse"+ }+ },"billing": {"address": {"state": "New York",diff --git a/cypress-tests/cypress/fixtures/create-confirm-body.json b/cypress-tests/cypress/fixtures/create-confirm-body.jsonindex c835ed3ea1..e2c0311506 100644--- a/cypress-tests/cypress/fixtures/create-confirm-body.json+++ b/cypress-tests/cypress/fixtures/create-confirm-body.json@@ -16,6 +16,14 @@"authentication_type": "no_three_ds","return_url": "https://duck.com","setup_future_usage": "on_session",+ "customer_acceptance": {+ "acceptance_type": "offline",+ "accepted_at": "1963-05-03T04:07:52.723Z",+ "online": {+ "ip_address": "127.0.0.1",+ "user_agent": "amet irure esse"+ }+ },"payment_method": "card","payment_method_type": "debit","payment_method_data": {diff --git a/cypress-tests/cypress/fixtures/create-connector-body.json b/cypress-tests/cypress/fixtures/create-connector-body.jsonindex 068a59a695..2065283277 100644--- a/cypress-tests/cypress/fixtures/create-connector-body.json+++ b/cypress-tests/cypress/fixtures/create-connector-body.json@@ -28,7 +28,7 @@"UnionPay","RuPay"],- "minimum_amount": 1,+ "minimum_amount": 0,"maximum_amount": 68607706,"recurring_enabled": false,"installment_payment_enabled": true@@ -46,7 +46,7 @@"UnionPay","RuPay"],- "minimum_amount": 1,+ "minimum_amount": 0,"maximum_amount": 68607706,"recurring_enabled": false,"installment_payment_enabled": truediff --git a/cypress-tests/cypress/fixtures/create-mandate-cit.json b/cypress-tests/cypress/fixtures/create-mandate-cit.jsonindex 49837e77ba..1236ba0b70 100644--- a/cypress-tests/cypress/fixtures/create-mandate-cit.json+++ b/cypress-tests/cypress/fixtures/create-mandate-cit.json@@ -4,7 +4,6 @@"confirm": true,"capture_method": "automatic","capture_on": "2022-09-10T10:11:12Z",- "amount_to_capture": 7000,"customer_id": "StripeCustomer","email": "[email protected]","name": "John Doe",@@ -41,6 +40,7 @@}}},+ "payment_type":"setup_mandate","billing": {"address": {"line1": "1467",diff --git a/cypress-tests/cypress/fixtures/create-payment-body.json b/cypress-tests/cypress/fixtures/create-payment-body.jsonindex 14ef202a07..acd2160e8a 100644--- a/cypress-tests/cypress/fixtures/create-payment-body.json+++ b/cypress-tests/cypress/fixtures/create-payment-body.json@@ -4,6 +4,7 @@"authentication_type": "three_ds","description": "Joseph First Crypto","email": "[email protected]",+ "setup_future_usage":"","connector_metadata": {"noon": {"order_category": "applepay"diff --git a/cypress-tests/cypress/fixtures/save-card-confirm-body.json b/cypress-tests/cypress/fixtures/save-card-confirm-body.jsonnew file mode 100644index 0000000000..777e1b110b--- /dev/null+++ b/cypress-tests/cypress/fixtures/save-card-confirm-body.json@@ -0,0 +1,6 @@+{+ "client_secret": "{{client_secret}}",+ "payment_method": "card",+ "payment_token": "{{payment_token}}",+ "card_cvc": "card_cvc"+}\ No newline at end of filediff --git a/cypress-tests/cypress/support/commands.js b/cypress-tests/cypress/support/commands.jsindex 9ab3b092ac..ce743887a4 100644--- a/cypress-tests/cypress/support/commands.js+++ b/cypress-tests/cypress/support/commands.js@@ -26,7 +26,7 @@// commands.js or your custom support fileimport * as RequestBodyUtils from "../utils/RequestBodyUtils";-import ConnectorAuthDetails from "../../../.github/secrets/creds.json";+import ConnectorAuthDetails from "../../creds.json";@@ -46,6 +46,13 @@ Cypress.Commands.add("merchantCreateCallTest", (merchantCreateBody, globalState)},body: merchantCreateBody,}).then((response) => {++ const xRequestId = response.headers['x-request-id'];+ if (xRequestId) {+ cy.task('cli_log', "x-request-id ->> " + xRequestId);+ } else {+ cy.task('cli_log', "x-request-id is not available in the response headers");+ }// Handle the response as neededconsole.log(response.body);globalState.set("publishableKey", response.body.publishable_key);@@ -63,6 +70,13 @@ Cypress.Commands.add("apiKeyCreateTest", (apiKeyCreateBody, globalState) => {},body: apiKeyCreateBody,}).then((response) => {++ const xRequestId = response.headers['x-request-id'];+ if (xRequestId) {+ cy.task('cli_log', "x-request-id ->> " + xRequestId);+ } else {+ cy.task('cli_log', "x-request-id is not available in the response headers");+ }// Handle the response as neededconsole.log(response.body);globalState.set("apiKey", response.body.api_key);@@ -124,6 +138,13 @@ Cypress.Commands.add("createCustomerCallTest", (customerCreateBody, globalState)},body: customerCreateBody,}).then((response) => {++ const xRequestId = response.headers['x-request-id'];+ if (xRequestId) {+ cy.task('cli_log', "x-request-id ->> " + xRequestId);+ } else {+ cy.task('cli_log', "x-request-id is not available in the response headers");+ }// Handle the response as neededconsole.log(response);@@ -131,13 +152,15 @@ Cypress.Commands.add("createCustomerCallTest", (customerCreateBody, globalState)});});-Cypress.Commands.add("createPaymentIntentTest", (request, currency, authentication_type, capture_method, globalState) => {- if (!request || typeof request !== "object" || !currency || !authentication_type) {+Cypress.Commands.add("createPaymentIntentTest", (request, det, authentication_type, capture_method, globalState) => {+ if (!request || typeof request !== "object" || !det.currency || !authentication_type) {throw new Error("Invalid parameters provided to createPaymentIntentTest command");}- request.currency = currency;+ request.currency = det.currency;request.authentication_type = authentication_type;request.capture_method = capture_method;+ request.setup_future_usage= det.setup_future_usage;+ request.customer_id = globalState.get("customerId");globalState.set("paymentAmount", request.amount);cy.request({method: "POST",@@ -149,6 +172,12 @@ Cypress.Commands.add("createPaymentIntentTest", (request, currency, authenticati},body: request,}).then((response) => {+ const xRequestId = response.headers['x-request-id'];+ if (xRequestId) {+ cy.task('cli_log', "x-request-id ->> " + xRequestId);+ } else {+ cy.task('cli_log', "x-request-id is not available in the response headers");+ }expect(response.headers["content-type"]).to.include("application/json");expect(response.body).to.have.property("client_secret");const clientSecret = response.body.client_secret;@@ -174,6 +203,12 @@ Cypress.Commands.add("paymentMethodsCallTest", (globalState) => {"api-key": globalState.get("publishableKey"),},}).then((response) => {+ const xRequestId = response.headers['x-request-id'];+ if (xRequestId) {+ cy.task('cli_log', "x-request-id ->> " + xRequestId);+ } else {+ cy.task('cli_log', "x-request-id is not available in the response headers");+ }console.log(response);expect(response.headers["content-type"]).to.include("application/json");expect(response.body).to.have.property("redirect_url");@@ -189,6 +224,7 @@ Cypress.Commands.add("confirmCallTest", (confirmBody, details, confirm, globalStconfirmBody.payment_method_data.card = details.card;confirmBody.confirm = confirm;confirmBody.client_secret = globalState.get("clientSecret");+ confirmBody.customer_acceptance = details.customer_acceptance;cy.request({method: "POST",@@ -199,6 +235,12 @@ Cypress.Commands.add("confirmCallTest", (confirmBody, details, confirm, globalSt},body: confirmBody,}).then((response) => {+ const xRequestId = response.headers['x-request-id'];+ if (xRequestId) {+ cy.task('cli_log', "x-request-id ->> " + xRequestId);+ } else {+ cy.task('cli_log', "x-request-id is not available in the response headers");+ }expect(response.headers["content-type"]).to.include("application/json");console.log(response.body);globalState.set("paymentID", paymentIntentID);@@ -237,6 +279,10 @@ Cypress.Commands.add("createConfirmPaymentTest", (createConfirmPaymentBody, detacreateConfirmPaymentBody.authentication_type = authentication_type;createConfirmPaymentBody.currency = details.currency;createConfirmPaymentBody.capture_method = capture_method;+ createConfirmPaymentBody.customer_acceptance = details.customer_acceptance;+ createConfirmPaymentBody.setup_future_usage = details.setup_future_usage;+ createConfirmPaymentBody.customer_id = globalState.get("customerId");+cy.request({method: "POST",url: `${globalState.get("baseUrl")}/payments`,@@ -246,6 +292,12 @@ Cypress.Commands.add("createConfirmPaymentTest", (createConfirmPaymentBody, deta},body: createConfirmPaymentBody,}).then((response) => {+ const xRequestId = response.headers['x-request-id'];+ if (xRequestId) {+ cy.task('cli_log', "x-request-id ->> " + xRequestId);+ } else {+ cy.task('cli_log', "x-request-id is not available in the response headers");+ }expect(response.headers["content-type"]).to.include("application/json");expect(response.body).to.have.property("status");console.log(response.body);@@ -278,6 +330,63 @@ Cypress.Commands.add("createConfirmPaymentTest", (createConfirmPaymentBody, deta});});+// This is consequent saved card payment confirm call test(Using payment token)+Cypress.Commands.add("saveCardConfirmCallTest", (confirmBody,det,globalState) => {+ const paymentIntentID = globalState.get("paymentID");+ confirmBody.card_cvc = det.card.card_cvc;+ confirmBody.payment_token = globalState.get("paymentToken");+ confirmBody.client_secret = globalState.get("clientSecret");+ console.log("conf conn ->" + globalState.get("connectorId"));+ cy.request({+ method: "POST",+ url: `${globalState.get("baseUrl")}/payments/${paymentIntentID}/confirm`,+ headers: {+ "Content-Type": "application/json",+ "api-key": globalState.get("publishableKey"),+ },+ body: confirmBody,+ })+ .then((response) => {+ const xRequestId = response.headers['x-request-id'];+ if (xRequestId) {+ cy.task('cli_log', "x-request-id ->> " + xRequestId);+ } else {+ cy.task('cli_log', "x-request-id is not available in the response headers");+ }+ expect(response.headers["content-type"]).to.include("application/json");+ console.log(response.body);+ globalState.set("paymentID", paymentIntentID);+ 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");+ const nextActionUrl = response.body.next_action.redirect_to_url;+ } else if (response.body.authentication_type === "no_three_ds") {+ expect(response.body.status).to.equal(det.paymentSuccessfulStatus);+ expect(response.body.customer_id).to.equal(globalState.get("customerId"));+ } else {+ // Handle other authentication types as needed+ throw new Error(`Unsupported authentication type: ${authentication_type}`);+ }+ } 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")+ }+ else if (response.body.authentication_type === "no_three_ds") {+ expect(response.body.status).to.equal("requires_capture");+ expect(response.body.customer_id).to.equal(globalState.get("customerId"));+ } else {+ // Handle other authentication types as needed+ throw new Error(`Unsupported authentication type: ${authentication_type}`);+ }+ }+ else {+ throw new Error(`Unsupported capture method: ${capture_method}`);+ }+ });+});+Cypress.Commands.add("captureCallTest", (requestBody, amount_to_capture, paymentSuccessfulStatus, globalState) => {const payment_id = globalState.get("paymentID");@@ -292,15 +401,27 @@ Cypress.Commands.add("captureCallTest", (requestBody, amount_to_capture, payment},body: requestBody,}).then((response) => {+ const xRequestId = response.headers['x-request-id'];+ if (xRequestId) {+ cy.task('cli_log', "x-request-id ->> " + xRequestId);+ } else {+ cy.task('cli_log', "x-request-id is not available in the response headers");+ }expect(response.headers["content-type"]).to.include("application/json");expect(response.body.payment_id).to.equal(payment_id);console.log(response.body);- if (amount_to_capture == amount) {+ if (amount_to_capture == amount && response.body.status == "succeeded") {expect(response.body.amount).to.equal(amount_to_capture);expect(response.body.amount_capturable).to.equal(0);expect(response.body.amount_received).to.equal(amount);expect(response.body.status).to.equal(paymentSuccessfulStatus);- } else {+ }else if (response.body.status=="processing") {+ expect(response.body.amount).to.equal(amount);+ expect(response.body.amount_capturable).to.equal(amount);+ expect(response.body.amount_received).to.equal(0);+ expect(response.body.status).to.equal(paymentSuccessfulStatus);+ }+ else {expect(response.body.amount).to.equal(amount);expect(response.body.amount_capturable).to.equal(0);expect(response.body.amount_received).to.equal(amount_to_capture);@@ -320,6 +441,12 @@ Cypress.Commands.add("voidCallTest", (requestBody, globalState) => {},body: requestBody,}).then((response) => {+ const xRequestId = response.headers['x-request-id'];+ if (xRequestId) {+ cy.task('cli_log', "x-request-id ->> " + xRequestId);+ } else {+ cy.task('cli_log', "x-request-id is not available in the response headers");+ }expect(response.headers["content-type"]).to.include("application/json");expect(response.body.payment_id).to.equal(payment_id);expect(response.body.amount).to.equal(globalState.get("paymentAmount"));@@ -341,6 +468,12 @@ Cypress.Commands.add("retrievePaymentCallTest", (globalState) => {"api-key": globalState.get("apiKey"),},}).then((response) => {+ const xRequestId = response.headers['x-request-id'];+ if (xRequestId) {+ cy.task('cli_log', "x-request-id ->> " + xRequestId);+ } else {+ cy.task('cli_log', "x-request-id is not available in the response headers");+ }expect(response.headers["content-type"]).to.include("application/json");console.log(response.body);expect(response.body.payment_id).to.equal(payment_id);@@ -363,6 +496,12 @@ Cypress.Commands.add("refundCallTest", (requestBody, refund_amount, det, globalS},body: requestBody}).then((response) => {+ const xRequestId = response.headers['x-request-id'];+ if (xRequestId) {+ cy.task('cli_log', "x-request-id ->> " + xRequestId);+ } else {+ cy.task('cli_log', "x-request-id is not available in the response headers");+ }expect(response.headers["content-type"]).to.include("application/json");console.log(response.body);globalState.set("refundId", response.body.refund_id);@@ -376,22 +515,30 @@ Cypress.Commands.add("syncRefundCallTest", (det, globalState) => {const refundId = globalState.get("refundId");cy.request({method: "GET",- url: `${globalState.get("baseUrl")}/refunds/${refundId}?force_sync=true`,+ url: `${globalState.get("baseUrl")}/refunds/${refundId}`,headers: {"Content-Type": "application/json","api-key": globalState.get("apiKey"),},}).then((response) => {+ const xRequestId = response.headers['x-request-id'];+ if (xRequestId) {+ cy.task('cli_log', "x-request-id ->> " + xRequestId);+ } else {+ cy.task('cli_log', "x-request-id is not available in the response headers");+ }expect(response.headers["content-type"]).to.include("application/json");console.log(response.body);expect(response.body.status).to.equal(det.refundSyncStatus);});});-Cypress.Commands.add("citForMandatesCallTest", (requestBody, details, confirm, capture_method, globalState) => {+Cypress.Commands.add("citForMandatesCallTest", (requestBody,amount, details, confirm, capture_method, payment_type, globalState) => {requestBody.payment_method_data.card = details.card;+ requestBody.payment_type=payment_type;requestBody.confirm = confirm;+ requestBody.amount = amount;requestBody.currency = details.currency;requestBody.capture_method = capture_method;requestBody.mandate_data.mandate_type = details.mandate_type;@@ -406,6 +553,12 @@ Cypress.Commands.add("citForMandatesCallTest", (requestBody, details, confirm, c},body: requestBody,}).then((response) => {+ const xRequestId = response.headers['x-request-id'];+ if (xRequestId) {+ cy.task('cli_log', "x-request-id ->> " + xRequestId);+ } else {+ cy.task('cli_log', "x-request-id is not available in the response headers");+ }expect(response.headers["content-type"]).to.include("application/json");expect(response.body).to.have.property("mandate_id");console.log(response.body);@@ -457,6 +610,12 @@ Cypress.Commands.add("mitForMandatesCallTest", (requestBody, amount, confirm, ca},body: requestBody,}).then((response) => {+ const xRequestId = response.headers['x-request-id'];+ if (xRequestId) {+ cy.task('cli_log', "x-request-id ->> " + xRequestId);+ } else {+ cy.task('cli_log', "x-request-id is not available in the response headers");+ }expect(response.headers["content-type"]).to.include("application/json");globalState.set("paymentID", response.body.payment_id);console.log(response.body);@@ -503,6 +662,12 @@ Cypress.Commands.add("listMandateCallTest", (globalState) => {"api-key": globalState.get("apiKey"),},}).then((response) => {+ const xRequestId = response.headers['x-request-id'];+ if (xRequestId) {+ cy.task('cli_log', "x-request-id ->> " + xRequestId);+ } else {+ cy.task('cli_log', "x-request-id is not available in the response headers");+ }expect(response.headers["content-type"]).to.include("application/json");console.log(response.body);let i = 0;@@ -525,6 +690,12 @@ Cypress.Commands.add("revokeMandateCallTest", (globalState) => {},failOnStatusCode: false}).then((response) => {+ const xRequestId = response.headers['x-request-id'];+ if (xRequestId) {+ cy.task('cli_log', "x-request-id ->> " + xRequestId);+ } else {+ cy.task('cli_log', "x-request-id is not available in the response headers");+ }expect(response.headers["content-type"]).to.include("application/json");console.log(response.body);if (response.body.status === 200) {@@ -564,4 +735,57 @@ Cypress.Commands.add("handleRedirection", (globalState, expected_redirection) =>cy.window().its('location.origin').should('eq', expected_url);})}-});\ No newline at end of file+});++Cypress.Commands.add("listCustomerPMCallTest", (globalState) => {+ console.log("customerID------>" + globalState.get("customerId"));+ const customerId = globalState.get("customerId");+ cy.request({+ method: "GET",+ url: `${globalState.get("baseUrl")}/customers/${customerId}/payment_methods`,+ headers: {+ "Content-Type": "application/json",+ "api-key": globalState.get("apiKey"),+ },+ }).then((response) => {+ const xRequestId = response.headers['x-request-id'];+ if (xRequestId) {+ cy.task('cli_log', "x-request-id ->> " + xRequestId);+ } else {+ cy.task('cli_log', "x-request-id is not available in the response headers");+ }+ expect(response.headers["content-type"]).to.include("application/json");+ console.log(response.body);+ if (response.body.customer_payment_methods[0]?.payment_token) {+ const paymentToken = response.body.customer_payment_methods[0].payment_token;+ globalState.set("paymentToken", paymentToken); // Set paymentToken in globalState+ expect(paymentToken).to.equal(globalState.get("paymentToken")); // Verify paymentToken+ }+ else {+ throw new Error(`Payment token not found`);+ }+ });+});++Cypress.Commands.add("listRefundCallTest", (globalState) => {+ cy.request({+ method: "POST",+ url: `${globalState.get("baseUrl")}/refunds/list`,+ headers: {+ "Content-Type": "application/json",+ "api-key": globalState.get("apiKey"),+ },+ body:{"offset":0}+ }).then((response) => {+ const xRequestId = response.headers['x-request-id'];+ if (xRequestId) {+ cy.task('cli_log', "x-request-id ->> " + xRequestId);+ } else {+ cy.task('cli_log', "x-request-id is not available in the response headers");+ }+ expect(response.headers["content-type"]).to.include("application/json");+ console.log(response.body);+ expect(response.body.data).to.be.an('array').and.not.empty;++ });+ });\ No newline at end of file