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

Ci(Cypress): Fix SaveCard Flow Test (#4633)

Gnanasundari24040d85826aea
diff --git a/cypress-tests/cypress/e2e/ConnectorTest/00013-SaveCardFlow.cy.js b/cypress-tests/cypress/e2e/ConnectorTest/00013-SaveCardFlow.cy.js
index f3e240aa88..eda63cc02f 100644
--- a/cypress-tests/cypress/e2e/ConnectorTest/00013-SaveCardFlow.cy.js
+++ b/cypress-tests/cypress/e2e/ConnectorTest/00013-SaveCardFlow.cy.js
@@ -3,7 +3,7 @@ import confirmBody from "../../fixtures/confirm-body.json";
import createPaymentBody from "../../fixtures/create-payment-body.json";
import createConfirmPaymentBody from "../../fixtures/create-confirm-body.json";
import customerCreateBody from "../../fixtures/create-customer-body.json";
-import SaveCardConfirmBody from "../../fixtures/save-card-confirm-body.json";
+import saveCardConfirmBody from "../../fixtures/save-card-confirm-body.json";
import getConnectorDetails from "../ConnectorUtils/utils";
import State from "../../utils/State";
let globalState;
@@ -44,7 +44,7 @@ describe("Card - SaveCard payment flow test", () => {
it ("confirm-save-card-payment-call-test", () => {
let det = getConnectorDetails(globalState.get("connectorId"))["card_pm"]["SaveCardUseNo3DS"];
- cy.saveCardConfirmCallTest(SaveCardConfirmBody,det,globalState);
+ cy.saveCardConfirmCallTest(saveCardConfirmBody,det,globalState);
});
});
@@ -75,7 +75,7 @@ describe("Card - SaveCard payment flow test", () => {
it ("confirm-save-card-payment-call-test", () => {
let det = getConnectorDetails(globalState.get("connectorId"))["card_pm"]["SaveCardUseNo3DS"];
- cy.saveCardConfirmCallTest(SaveCardConfirmBody,det,globalState);
+ cy.saveCardConfirmCallTest(saveCardConfirmBody,det,globalState);
});
it("capture-call-test", () => {
@@ -110,7 +110,7 @@ describe("Card - SaveCard payment flow test", () => {
it ("confirm-save-card-payment-call-test", () => {
let det = getConnectorDetails(globalState.get("connectorId"))["card_pm"]["SaveCardUseNo3DS"];
- cy.saveCardConfirmCallTest(SaveCardConfirmBody,det,globalState);
+ cy.saveCardConfirmCallTest(saveCardConfirmBody,det,globalState);
});
it("capture-call-test", () => {
diff --git a/cypress-tests/cypress/fixtures/create-payment-body.json b/cypress-tests/cypress/fixtures/create-payment-body.json
index 8dd1ff9579..6459b4af65 100644
--- a/cypress-tests/cypress/fixtures/create-payment-body.json
+++ b/cypress-tests/cypress/fixtures/create-payment-body.json
@@ -10,6 +10,7 @@
"order_category": "applepay"
}
},
+
"metadata": {
"udf1": "value1",
"new_customer": "true",
diff --git a/cypress-tests/cypress/fixtures/save-card-confirm-body.json b/cypress-tests/cypress/fixtures/save-card-confirm-body.json
index 676e91871f..9a39a3f649 100644
--- a/cypress-tests/cypress/fixtures/save-card-confirm-body.json
+++ b/cypress-tests/cypress/fixtures/save-card-confirm-body.json
@@ -2,5 +2,31 @@
"client_secret": "{{client_secret}}",
"payment_method": "card",
"payment_token": "{{payment_token}}",
- "card_cvc": "card_cvc"
+ "card_cvc": "card_cvc",
+ "billing": {
+ "address": {
+ "line1": "1467",
+ "line2": "Harrison Street",
+ "line3": "Harrison Street",
+ "city": "San Fransico",
+ "state": "California",
+ "zip": "94122",
+ "country": "US",
+ "first_name": "john",
+ "last_name": "doe"
+ }
+ },
+ "shipping": {
+ "address": {
+ "line1": "1467",
+ "line2": "Harrison Street",
+ "line3": "Harrison Street",
+ "city": "San Fransico",
+ "state": "California",
+ "zip": "94122",
+ "country": "US",
+ "first_name": "john",
+ "last_name": "doe"
+ }
+ }
}
diff --git a/cypress-tests/cypress/support/commands.js b/cypress-tests/cypress/support/commands.js
index e6acee3664..e6518f7025 100644
--- a/cypress-tests/cypress/support/commands.js
+++ b/cypress-tests/cypress/support/commands.js
@@ -154,7 +154,7 @@ Cypress.Commands.add("createPaymentIntentTest", (request, det, authentication_ty
body: request,
}).then((response) => {
logRequestId(response.headers['x-request-id']);
-
+ console.log(response);
expect(response.headers["content-type"]).to.include("application/json");
expect(response.body).to.have.property("client_secret");
const clientSecret = response.body.client_secret;
@@ -208,7 +208,7 @@ Cypress.Commands.add("confirmCallTest", (confirmBody, details, confirm, globalSt
body: confirmBody,
}).then((response) => {
logRequestId(response.headers['x-request-id']);
-
+ console.log(response);
expect(response.headers["content-type"]).to.include("application/json");
globalState.set("paymentID", paymentIntentID);
if (response.body.capture_method === "automatic") {
@@ -260,7 +260,7 @@ Cypress.Commands.add("createConfirmPaymentTest", (createConfirmPaymentBody, deta
body: createConfirmPaymentBody,
}).then((response) => {
logRequestId(response.headers['x-request-id']);
-
+ console.log(response);
expect(response.headers["content-type"]).to.include("application/json");
expect(response.body).to.have.property("status");
globalState.set("paymentAmount", createConfirmPaymentBody.amount);
@@ -295,11 +295,11 @@ Cypress.Commands.add("createConfirmPaymentTest", (createConfirmPaymentBody, deta
});
// This is consequent saved card payment confirm call test(Using payment token)
-Cypress.Commands.add("saveCardConfirmCallTest", (SaveCardConfirmBody,det,globalState) => {
+Cypress.Commands.add("saveCardConfirmCallTest", (saveCardConfirmBody,det,globalState) => {
const paymentIntentID = globalState.get("paymentID");
- SaveCardConfirmBody.card_cvc = det.card_cvc;
- SaveCardConfirmBody.payment_token = globalState.get("paymentToken");
- SaveCardConfirmBody.client_secret = globalState.get("clientSecret");
+ saveCardConfirmBody.card_cvc = det.card.card_cvc;
+ saveCardConfirmBody.payment_token = globalState.get("paymentToken");
+ saveCardConfirmBody.client_secret = globalState.get("clientSecret");
console.log("conf conn ->" + globalState.get("connectorId"));
cy.request({
method: "POST",
@@ -308,11 +308,12 @@ Cypress.Commands.add("saveCardConfirmCallTest", (SaveCardConfirmBody,det,globalS
"Content-Type": "application/json",
"api-key": globalState.get("publishableKey"),
},
- body: SaveCardConfirmBody,
+ body: saveCardConfirmBody,
+
})
.then((response) => {
logRequestId(response.headers['x-request-id']);
-
+ console.log(response);
expect(response.headers["content-type"]).to.include("application/json");
globalState.set("paymentID", paymentIntentID);
if (response.body.capture_method === "automatic") {