From 4fe29769d705d6345c88244be3fb9a627beebc40 Mon Sep 17 00:00:00 2001 From: gnanasundarig Date: Thu, 14 Nov 2024 16:16:00 +0530 Subject: [PATCH 01/12] ci(Cypress): Add list and revoke for zero auth mandate payments --- .../00013-ListAndRevokeMandate.cy.js | 53 ++++++++++++++++++- cypress-tests/cypress/support/commands.js | 8 +-- 2 files changed, 54 insertions(+), 7 deletions(-) diff --git a/cypress-tests/cypress/e2e/PaymentTest/00013-ListAndRevokeMandate.cy.js b/cypress-tests/cypress/e2e/PaymentTest/00013-ListAndRevokeMandate.cy.js index 9091135d539..f341db19f6c 100644 --- a/cypress-tests/cypress/e2e/PaymentTest/00013-ListAndRevokeMandate.cy.js +++ b/cypress-tests/cypress/e2e/PaymentTest/00013-ListAndRevokeMandate.cy.js @@ -4,7 +4,7 @@ import getConnectorDetails, * as utils from "../PaymentUtils/Utils"; let globalState; -describe("Card - SingleUse Mandates flow test", () => { +describe("Card - List and revoke Mandates flow test", () => { before("seed global state", () => { cy.task("getGlobalState").then((state) => { globalState = new State(state); @@ -71,4 +71,55 @@ describe("Card - SingleUse Mandates flow test", () => { }); } ); + context("Card - Zero auth CIT and MIT payment flow test", () => { + 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("Confirm No 3DS CIT", () => { + let data = getConnectorDetails(globalState.get("connectorId"))["card_pm"][ + "ZeroAuthMandate" + ]; + let req_data = data["Request"]; + let res_data = data["Response"]; + cy.citForMandatesCallTest( + fixtures.citConfirmBody, + req_data, + res_data, + 0, + true, + "automatic", + "setup_mandate", + globalState + ); + if (should_continue) + should_continue = utils.should_continue_further(res_data); + }); + + it("list-mandate-call-test", () => { + cy.listMandateCallTest(globalState); + }); + + it("Confirm No 3DS MIT", () => { + cy.mitForMandatesCallTest( + fixtures.mitConfirmBody, + 7000, + true, + "automatic", + globalState + ); + }); + + it("list-mandate-call-test", () => { + cy.listMandateCallTest(globalState); + }); + + it("revoke-mandate-call-test", () => { + cy.revokeMandateCallTest(globalState); + }); + }); }); diff --git a/cypress-tests/cypress/support/commands.js b/cypress-tests/cypress/support/commands.js index 6204c86f44a..6c8ce593512 100644 --- a/cypress-tests/cypress/support/commands.js +++ b/cypress-tests/cypress/support/commands.js @@ -1964,9 +1964,7 @@ Cypress.Commands.add( } else if (response.body.authentication_type === "no_three_ds") { if (response.body.connector === "fiuu") { expect(response.body.status).to.equal("failed"); - } else { - expect(response.body.status).to.equal("succeeded"); - } + } } else { throw new Error( `Invalid authentication type ${response.body.authentication_type}` @@ -2046,9 +2044,7 @@ Cypress.Commands.add( } else if (response.body.authentication_type === "no_three_ds") { if (response.body.connector === "fiuu") { expect(response.body.status).to.equal("failed"); - } else { - expect(response.body.status).to.equal("succeeded"); - } + } } else { throw new Error( `Invalid authentication type ${response.body.authentication_type}` From 851437b99851551a2722cb626354378bba661a3b Mon Sep 17 00:00:00 2001 From: gnanasundarig Date: Wed, 20 Nov 2024 18:55:29 +0530 Subject: [PATCH 02/12] ci(cypress): Added Config Testcases --- .../PaymentTest/00023-ConnectorAgnostic.cy.js | 18 +- .../e2e/PaymentTest/00024-ConfigTest.cy.js | 382 ++++++++++++++++++ .../fixtures/update-business-profile.json | 6 +- cypress-tests/cypress/support/commands.js | 67 ++- 4 files changed, 466 insertions(+), 7 deletions(-) create mode 100644 cypress-tests/cypress/e2e/PaymentTest/00024-ConfigTest.cy.js diff --git a/cypress-tests/cypress/e2e/PaymentTest/00023-ConnectorAgnostic.cy.js b/cypress-tests/cypress/e2e/PaymentTest/00023-ConnectorAgnostic.cy.js index 64abe296b29..774fb6d903c 100644 --- a/cypress-tests/cypress/e2e/PaymentTest/00023-ConnectorAgnostic.cy.js +++ b/cypress-tests/cypress/e2e/PaymentTest/00023-ConnectorAgnostic.cy.js @@ -102,7 +102,11 @@ describe("Connector Agnostic Tests", () => { it("Enable Connector Agnostic for Business Profile", () => { cy.UpdateBusinessProfileTest( fixtures.updateBusinessProfile, - true, + true, // is_connector_agnostic_enabled + false, // collect_billing_address_from_wallet_connector + false, //collect_shipping_address_from_wallet_connector + false, //always_collect_billing_address_from_wallet_connector + false, //always_collect_shipping_address_from_wallet_connector globalState ); }); @@ -160,7 +164,11 @@ describe("Connector Agnostic Tests", () => { it("Enable Connector Agnostic for Business Profile", () => { cy.UpdateBusinessProfileTest( fixtures.updateBusinessProfile, - true, + true, // is_connector_agnostic_enabled + false, // collect_billing_address_from_wallet_connector + false, //collect_shipping_address_from_wallet_connector + false, //always_collect_billing_address_from_wallet_connector + false, //always_collect_shipping_address_from_wallet_connector globalState ); }); @@ -220,7 +228,11 @@ describe("Connector Agnostic Tests", () => { it("Enable Connector Agnostic for Business Profile", () => { cy.UpdateBusinessProfileTest( fixtures.updateBusinessProfile, - true, + true, // is_connector_agnostic_enabled + false, // collect_billing_address_from_wallet_connector + false, //collect_shipping_address_from_wallet_connector + false, //always_collect_billing_address_from_wallet_connector + false, //always_collect_shipping_address_from_wallet_connector globalState ); }); diff --git a/cypress-tests/cypress/e2e/PaymentTest/00024-ConfigTest.cy.js b/cypress-tests/cypress/e2e/PaymentTest/00024-ConfigTest.cy.js new file mode 100644 index 00000000000..ac46b799a48 --- /dev/null +++ b/cypress-tests/cypress/e2e/PaymentTest/00024-ConfigTest.cy.js @@ -0,0 +1,382 @@ +import * as fixtures from "../../fixtures/imports"; +import State from "../../utils/State"; +import { payment_methods_enabled } from "../PaymentUtils/Commons"; +import getConnectorDetails, * as utils from "../PaymentUtils/Utils"; +let globalState; +describe("Config Tests", () => { + before("seed global state", () => { + cy.task("getGlobalState").then((state) => { + globalState = new State(state); + }); + }); + + after("flush global state", () => { + cy.task("setGlobalState", globalState.data); + }); + + context( + "Update collect_billing_details_from_wallet_connector to true and verifying in payment method list, this config should be true", + () => { + let should_continue = true; + + beforeEach(function () { + if (!should_continue) { + this.skip(); + } + }); + + it("Create Business Profile", () => { + cy.createBusinessProfileTest( + fixtures.createBusinessProfile, + globalState + ); + }); + + it("connector-create-call-test", () => { + cy.createConnectorCallTest( + "payment_processor", + fixtures.createConnectorBody, + payment_methods_enabled, + globalState + ); + }); + + it("Create Customer", () => { + cy.createCustomerCallTest(fixtures.customerCreateBody, globalState); + }); + + it("Update collect_billing_details_from_wallet_connector to true", () => { + cy.UpdateBusinessProfileTest( + fixtures.updateBusinessProfile, + true, // is_connector_agnostic_enabled + true, // collect_billing_address_from_wallet_connector + false, //collect_shipping_address_from_wallet_connector + false, //always_collect_billing_address_from_wallet_connector + false, //always_collect_shipping_address_from_wallet_connector + globalState + ); + }); + + it("Create Payment Intent", () => { + let data = getConnectorDetails(globalState.get("connectorId"))[ + "card_pm" + ]["PaymentIntentOffSession"]; + let req_data = data["Request"]; + let res_data = data["Response"]; + cy.createPaymentIntentTest( + fixtures.createPaymentBody, + req_data, + res_data, + "no_three_ds", + "automatic", + globalState + ); + if (should_continue) + should_continue = utils.should_continue_further(res_data); + }); + it("payment_methods-call-test", () => { + cy.paymentMethodsCallTest(globalState); + }); + } + ); + + context( + "Update collect_shipping_details_from_wallet_connector to true and verifying in payment method list, this config should be true", + () => { + let should_continue = true; + + beforeEach(function () { + if (!should_continue) { + this.skip(); + } + }); + + it("Update collect_shipping_details_from_wallet_connector to true", () => { + cy.UpdateBusinessProfileTest( + fixtures.updateBusinessProfile, + true, // is_connector_agnostic_enabled + false, // collect_billing_address_from_wallet_connector + false, //collect_shipping_address_from_wallet_connector + false, //always_collect_billing_address_from_wallet_connector + false, //always_collect_shipping_address_from_wallet_connector + globalState + ); + }); + + it("Create Payment Intent", () => { + let data = getConnectorDetails(globalState.get("connectorId"))[ + "card_pm" + ]["PaymentIntentOffSession"]; + let req_data = data["Request"]; + let res_data = data["Response"]; + cy.createPaymentIntentTest( + fixtures.createPaymentBody, + req_data, + res_data, + "no_three_ds", + "automatic", + globalState + ); + if (should_continue) + should_continue = utils.should_continue_further(res_data); + }); + + it("payment_methods-call-test", () => { + cy.paymentMethodsCallTest(globalState); + }); + } + ); + + context( + "Update always_collect_billing_details_from_wallet_connector to true and verifying in payment method list, this config should be true", + () => { + let should_continue = true; + + beforeEach(function () { + if (!should_continue) { + this.skip(); + } + }); + + it("Update always_collect_billing_details_from_wallet_connector to true", () => { + cy.UpdateBusinessProfileTest( + fixtures.updateBusinessProfile, + true, // is_connector_agnostic_enabled + false, // collect_billing_address_from_wallet_connector + false, //collect_shipping_address_from_wallet_connector + true, //always_collect_billing_address_from_wallet_connector + false, //always_collect_shipping_address_from_wallet_connector + globalState + ); + }); + + it("Create Payment Intent", () => { + let data = getConnectorDetails(globalState.get("connectorId"))[ + "card_pm" + ]["PaymentIntentOffSession"]; + let req_data = data["Request"]; + let res_data = data["Response"]; + cy.createPaymentIntentTest( + fixtures.createPaymentBody, + req_data, + res_data, + "no_three_ds", + "automatic", + globalState + ); + if (should_continue) + should_continue = utils.should_continue_further(res_data); + }); + + it("payment_methods-call-test", () => { + cy.paymentMethodsCallTest(globalState); + }); + } + ); + + context( + "Update always_collect_shipping_details_from_wallet_connector to true and verifying in payment method list, this config should be true", + () => { + let should_continue = true; + + beforeEach(function () { + if (!should_continue) { + this.skip(); + } + }); + + it("Update always_collect_shipping_details_from_wallet_connector to true", () => { + cy.UpdateBusinessProfileTest( + fixtures.updateBusinessProfile, + true, // is_connector_agnostic_enabled + false, // collect_billing_address_from_wallet_connector + false, //collect_shipping_address_from_wallet_connector + false, //always_collect_billing_address_from_wallet_connector + true, //always_collect_shipping_address_from_wallet_connector + globalState + ); + }); + + it("Create Payment Intent", () => { + let data = getConnectorDetails(globalState.get("connectorId"))[ + "card_pm" + ]["PaymentIntentOffSession"]; + let req_data = data["Request"]; + let res_data = data["Response"]; + cy.createPaymentIntentTest( + fixtures.createPaymentBody, + req_data, + res_data, + "no_three_ds", + "automatic", + globalState + ); + if (should_continue) + should_continue = utils.should_continue_further(res_data); + }); + + it("payment_methods-call-test", () => { + cy.paymentMethodsCallTest(globalState); + }); + } + ); + + context( + "Update always_collect_shipping_details_from_wallet_connector & collect_shipping_details_from_wallet_connector to true and verifying in payment method list, this config should be true", + () => { + let should_continue = true; + + beforeEach(function () { + if (!should_continue) { + this.skip(); + } + }); + + it("Update both always & collect_shipping_details_from_wallet_connector to true", () => { + cy.UpdateBusinessProfileTest( + fixtures.updateBusinessProfile, + true, // is_connector_agnostic_enabled + false, // collect_billing_address_from_wallet_connector + true, //collect_shipping_address_from_wallet_connector + false, //always_collect_billing_address_from_wallet_connector + true, //always_collect_shipping_address_from_wallet_connector + globalState + ); + }); + + it("Create Payment Intent", () => { + let data = getConnectorDetails(globalState.get("connectorId"))[ + "card_pm" + ]["PaymentIntentOffSession"]; + let req_data = data["Request"]; + let res_data = data["Response"]; + cy.createPaymentIntentTest( + fixtures.createPaymentBody, + req_data, + res_data, + "no_three_ds", + "automatic", + globalState + ); + if (should_continue) + should_continue = utils.should_continue_further(res_data); + }); + + it("payment_methods-call-test", () => { + cy.paymentMethodsCallTest(globalState); + }); + } + ); + context( + "Update always_collect_billing_details_from_wallet_connector & to collect_billing_details_from_wallet_connector to true and verifying in payment method list, this config should be true", + () => { + let should_continue = true; + + beforeEach(function () { + if (!should_continue) { + this.skip(); + } + }); + + it("Update both always & collect_billing_details_from_wallet_connector to true", () => { + cy.UpdateBusinessProfileTest( + fixtures.updateBusinessProfile, + true, // is_connector_agnostic_enabled + true, // collect_billing_address_from_wallet_connector + false, //collect_shipping_address_from_wallet_connector + true, //always_collect_billing_address_from_wallet_connector + false, //always_collect_shipping_address_from_wallet_connector + globalState + ); + }); + + it("Create Payment Intent", () => { + let data = getConnectorDetails(globalState.get("connectorId"))[ + "card_pm" + ]["PaymentIntentOffSession"]; + let req_data = data["Request"]; + let res_data = data["Response"]; + cy.createPaymentIntentTest( + fixtures.createPaymentBody, + req_data, + res_data, + "no_three_ds", + "automatic", + globalState + ); + if (should_continue) + should_continue = utils.should_continue_further(res_data); + }); + + it("payment_methods-call-test", () => { + cy.paymentMethodsCallTest(globalState); + }); + } + ); + + context( + "Update all config(Collect address config) to false and verifying in payment method list, both config should be false", + () => { + let should_continue = true; + + beforeEach(function () { + if (!should_continue) { + this.skip(); + } + }); + + it("Create Business Profile", () => { + cy.createBusinessProfileTest( + fixtures.createBusinessProfile, + globalState + ); + }); + + it("connector-create-call-test", () => { + cy.createConnectorCallTest( + "payment_processor", + fixtures.createConnectorBody, + payment_methods_enabled, + globalState + ); + }); + + it("Create Customer", () => { + cy.createCustomerCallTest(fixtures.customerCreateBody, globalState); + }); + + it("Update all config to false", () => { + cy.UpdateBusinessProfileTest( + fixtures.updateBusinessProfile, + true, // is_connector_agnostic_enabled + false, // collect_billing_address_from_wallet_connector + false, //collect_shipping_address_from_wallet_connector + false, //always_collect_billing_address_from_wallet_connector + false, //always_collect_shipping_address_from_wallet_connector + globalState + ); + }); + + it("Create Payment Intent", () => { + let data = getConnectorDetails(globalState.get("connectorId"))[ + "card_pm" + ]["PaymentIntentOffSession"]; + let req_data = data["Request"]; + let res_data = data["Response"]; + cy.createPaymentIntentTest( + fixtures.createPaymentBody, + req_data, + res_data, + "no_three_ds", + "automatic", + globalState + ); + if (should_continue) + should_continue = utils.should_continue_further(res_data); + }); + it("payment_methods-call-test", () => { + cy.paymentMethodsCallTest(globalState); + }); + } + ); +}); diff --git a/cypress-tests/cypress/fixtures/update-business-profile.json b/cypress-tests/cypress/fixtures/update-business-profile.json index 9d69534bae6..f9782748a3b 100644 --- a/cypress-tests/cypress/fixtures/update-business-profile.json +++ b/cypress-tests/cypress/fixtures/update-business-profile.json @@ -1,3 +1,7 @@ { - "is_connector_agnostic_mit_enabled": true + "is_connector_agnostic_mit_enabled": true, + "collect_shipping_details_from_wallet_connector": true, + "collect_billing_details_from_wallet_connector": true, + "always_collect_billing_details_from_wallet_connector": true, + "always_collect_shipping_details_from_wallet_connector": true } diff --git a/cypress-tests/cypress/support/commands.js b/cypress-tests/cypress/support/commands.js index 6c8ce593512..714af447c72 100644 --- a/cypress-tests/cypress/support/commands.js +++ b/cypress-tests/cypress/support/commands.js @@ -196,9 +196,25 @@ Cypress.Commands.add( Cypress.Commands.add( "UpdateBusinessProfileTest", - (updateBusinessProfile, is_connector_agnostic_mit_enabled, globalState) => { + ( + updateBusinessProfile, + is_connector_agnostic_mit_enabled, + collect_billing_details_from_wallet_connector, + collect_shipping_details_from_wallet_connector, + always_collect_billing_details_from_wallet_connector, + always_collect_shipping_details_from_wallet_connector, + globalState + ) => { updateBusinessProfile.is_connector_agnostic_mit_enabled = is_connector_agnostic_mit_enabled; + updateBusinessProfile.collect_shipping_details_from_wallet_connector = + collect_shipping_details_from_wallet_connector; + updateBusinessProfile.collect_billing_details_from_wallet_connector = + collect_billing_details_from_wallet_connector; + updateBusinessProfile.always_collect_billing_details_from_wallet_connector = + always_collect_billing_details_from_wallet_connector; + updateBusinessProfile.always_collect_shipping_details_from_wallet_connector = + always_collect_shipping_details_from_wallet_connector; const merchant_id = globalState.get("merchantId"); const profile_id = globalState.get("profileId"); cy.request({ @@ -213,6 +229,24 @@ Cypress.Commands.add( failOnStatusCode: false, }).then((response) => { logRequestId(response.headers["x-request-id"]); + if (response.status === 200) { + globalState.set( + "collectBillingDetails", + response.body.collect_billing_details_from_wallet_connector + ); + globalState.set( + "collectShippingDetails", + response.body.collect_shipping_details_from_wallet_connector + ); + globalState.set( + "alwaysCollectBillingDetails", + response.body.always_collect_billing_details_from_wallet_connector + ); + globalState.set( + "alwaysCollectShippingDetails", + response.body.always_collect_shipping_details_from_wallet_connector + ); + } }); } ); @@ -996,6 +1030,33 @@ Cypress.Commands.add("paymentMethodsCallTest", (globalState) => { expect(response.headers["content-type"]).to.include("application/json"); expect(response.body).to.have.property("redirect_url"); expect(response.body).to.have.property("payment_methods"); + if ( + globalState.get("collectBillingDetails") === true || + globalState.get("alwaysCollectBillingDetails") === true + ) { + expect( + response.body.collect_billing_details_from_wallets, + "collectBillingDetailsFromWallets" + ).to.be.true; + } else + expect( + response.body.collect_billing_details_from_wallets, + "collectBillingDetailsFromWallets" + ).to.be.false; + + if ( + globalState.get("collectShippingDetails") === true || + globalState.get("alwaysCollectShippingDetails") === true + ) { + expect( + response.body.collect_shipping_details_from_wallets, + "collectShippingDetailsFromWallets" + ).to.be.true; + } else + expect( + response.body.collect_shipping_details_from_wallets, + "collectShippingDetailsFromWallets" + ).to.be.false; globalState.set("paymentID", paymentIntentID); cy.log(response); }); @@ -1964,7 +2025,7 @@ Cypress.Commands.add( } else if (response.body.authentication_type === "no_three_ds") { if (response.body.connector === "fiuu") { expect(response.body.status).to.equal("failed"); - } + } } else { throw new Error( `Invalid authentication type ${response.body.authentication_type}` @@ -2044,7 +2105,7 @@ Cypress.Commands.add( } else if (response.body.authentication_type === "no_three_ds") { if (response.body.connector === "fiuu") { expect(response.body.status).to.equal("failed"); - } + } } else { throw new Error( `Invalid authentication type ${response.body.authentication_type}` From e0a2b5027bd93d97ec1d4f6d1d6d6b91b78fa105 Mon Sep 17 00:00:00 2001 From: Gnanasundari24 <118818938+Gnanasundari24@users.noreply.github.com> Date: Fri, 22 Nov 2024 16:02:28 +0530 Subject: [PATCH 03/12] Lints Changes Co-authored-by: Pa1NarK <69745008+pixincreate@users.noreply.github.com> --- .../cypress/e2e/PaymentTest/00013-ListAndRevokeMandate.cy.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/cypress-tests/cypress/e2e/PaymentTest/00013-ListAndRevokeMandate.cy.js b/cypress-tests/cypress/e2e/PaymentTest/00013-ListAndRevokeMandate.cy.js index f341db19f6c..3c91013126c 100644 --- a/cypress-tests/cypress/e2e/PaymentTest/00013-ListAndRevokeMandate.cy.js +++ b/cypress-tests/cypress/e2e/PaymentTest/00013-ListAndRevokeMandate.cy.js @@ -84,8 +84,10 @@ describe("Card - List and revoke Mandates flow test", () => { let data = getConnectorDetails(globalState.get("connectorId"))["card_pm"][ "ZeroAuthMandate" ]; + let req_data = data["Request"]; let res_data = data["Response"]; + cy.citForMandatesCallTest( fixtures.citConfirmBody, req_data, @@ -96,6 +98,7 @@ describe("Card - List and revoke Mandates flow test", () => { "setup_mandate", globalState ); + if (should_continue) should_continue = utils.should_continue_further(res_data); }); From c5da61021d9bb1bf8b2d4be31bd202800d6671ae Mon Sep 17 00:00:00 2001 From: Gnanasundari24 <118818938+Gnanasundari24@users.noreply.github.com> Date: Fri, 22 Nov 2024 16:02:44 +0530 Subject: [PATCH 04/12] Lint Changes Co-authored-by: Pa1NarK <69745008+pixincreate@users.noreply.github.com> --- .../cypress/e2e/PaymentTest/00023-ConnectorAgnostic.cy.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/cypress-tests/cypress/e2e/PaymentTest/00023-ConnectorAgnostic.cy.js b/cypress-tests/cypress/e2e/PaymentTest/00023-ConnectorAgnostic.cy.js index 774fb6d903c..601650a1168 100644 --- a/cypress-tests/cypress/e2e/PaymentTest/00023-ConnectorAgnostic.cy.js +++ b/cypress-tests/cypress/e2e/PaymentTest/00023-ConnectorAgnostic.cy.js @@ -104,9 +104,9 @@ describe("Connector Agnostic Tests", () => { fixtures.updateBusinessProfile, true, // is_connector_agnostic_enabled false, // collect_billing_address_from_wallet_connector - false, //collect_shipping_address_from_wallet_connector - false, //always_collect_billing_address_from_wallet_connector - false, //always_collect_shipping_address_from_wallet_connector + false, // collect_shipping_address_from_wallet_connector + false, // always_collect_billing_address_from_wallet_connector + false, // always_collect_shipping_address_from_wallet_connector globalState ); }); From 82b1f2dafb46424ee74926002533111142da57dd Mon Sep 17 00:00:00 2001 From: Gnanasundari24 <118818938+Gnanasundari24@users.noreply.github.com> Date: Fri, 22 Nov 2024 16:02:55 +0530 Subject: [PATCH 05/12] Lint Changes Co-authored-by: Pa1NarK <69745008+pixincreate@users.noreply.github.com> --- .../cypress/e2e/PaymentTest/00023-ConnectorAgnostic.cy.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/cypress-tests/cypress/e2e/PaymentTest/00023-ConnectorAgnostic.cy.js b/cypress-tests/cypress/e2e/PaymentTest/00023-ConnectorAgnostic.cy.js index 601650a1168..56242be999c 100644 --- a/cypress-tests/cypress/e2e/PaymentTest/00023-ConnectorAgnostic.cy.js +++ b/cypress-tests/cypress/e2e/PaymentTest/00023-ConnectorAgnostic.cy.js @@ -166,9 +166,9 @@ describe("Connector Agnostic Tests", () => { fixtures.updateBusinessProfile, true, // is_connector_agnostic_enabled false, // collect_billing_address_from_wallet_connector - false, //collect_shipping_address_from_wallet_connector - false, //always_collect_billing_address_from_wallet_connector - false, //always_collect_shipping_address_from_wallet_connector + false, // collect_shipping_address_from_wallet_connector + false, // always_collect_billing_address_from_wallet_connector + false, // always_collect_shipping_address_from_wallet_connector globalState ); }); From a2d5f62e75e52a704ae6759b03e06bfa1d8812cd Mon Sep 17 00:00:00 2001 From: Gnanasundari24 <118818938+Gnanasundari24@users.noreply.github.com> Date: Fri, 22 Nov 2024 16:03:12 +0530 Subject: [PATCH 06/12] Lints Co-authored-by: Pa1NarK <69745008+pixincreate@users.noreply.github.com> --- .../cypress/e2e/PaymentTest/00023-ConnectorAgnostic.cy.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/cypress-tests/cypress/e2e/PaymentTest/00023-ConnectorAgnostic.cy.js b/cypress-tests/cypress/e2e/PaymentTest/00023-ConnectorAgnostic.cy.js index 56242be999c..c7cb47a9f46 100644 --- a/cypress-tests/cypress/e2e/PaymentTest/00023-ConnectorAgnostic.cy.js +++ b/cypress-tests/cypress/e2e/PaymentTest/00023-ConnectorAgnostic.cy.js @@ -230,9 +230,9 @@ describe("Connector Agnostic Tests", () => { fixtures.updateBusinessProfile, true, // is_connector_agnostic_enabled false, // collect_billing_address_from_wallet_connector - false, //collect_shipping_address_from_wallet_connector - false, //always_collect_billing_address_from_wallet_connector - false, //always_collect_shipping_address_from_wallet_connector + false, // collect_shipping_address_from_wallet_connector + false, // always_collect_billing_address_from_wallet_connector + false, // always_collect_shipping_address_from_wallet_connector globalState ); }); From fb378a558595fb73ef607ead53ed46a20a79c468 Mon Sep 17 00:00:00 2001 From: Gnanasundari24 <118818938+Gnanasundari24@users.noreply.github.com> Date: Fri, 22 Nov 2024 16:03:27 +0530 Subject: [PATCH 07/12] Lints Co-authored-by: Pa1NarK <69745008+pixincreate@users.noreply.github.com> --- cypress-tests/cypress/e2e/PaymentTest/00024-ConfigTest.cy.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/cypress-tests/cypress/e2e/PaymentTest/00024-ConfigTest.cy.js b/cypress-tests/cypress/e2e/PaymentTest/00024-ConfigTest.cy.js index ac46b799a48..eccc3f0f68c 100644 --- a/cypress-tests/cypress/e2e/PaymentTest/00024-ConfigTest.cy.js +++ b/cypress-tests/cypress/e2e/PaymentTest/00024-ConfigTest.cy.js @@ -2,7 +2,9 @@ import * as fixtures from "../../fixtures/imports"; import State from "../../utils/State"; import { payment_methods_enabled } from "../PaymentUtils/Commons"; import getConnectorDetails, * as utils from "../PaymentUtils/Utils"; + let globalState; + describe("Config Tests", () => { before("seed global state", () => { cy.task("getGlobalState").then((state) => { From a20661d99af6cd259d0fe4fd3ce2718b9de109f7 Mon Sep 17 00:00:00 2001 From: Gnanasundari24 <118818938+Gnanasundari24@users.noreply.github.com> Date: Fri, 22 Nov 2024 16:03:43 +0530 Subject: [PATCH 08/12] Lint Changes Co-authored-by: Pa1NarK <69745008+pixincreate@users.noreply.github.com> --- cypress-tests/cypress/e2e/PaymentTest/00024-ConfigTest.cy.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/cypress-tests/cypress/e2e/PaymentTest/00024-ConfigTest.cy.js b/cypress-tests/cypress/e2e/PaymentTest/00024-ConfigTest.cy.js index eccc3f0f68c..9f0081eb072 100644 --- a/cypress-tests/cypress/e2e/PaymentTest/00024-ConfigTest.cy.js +++ b/cypress-tests/cypress/e2e/PaymentTest/00024-ConfigTest.cy.js @@ -296,8 +296,10 @@ describe("Config Tests", () => { let data = getConnectorDetails(globalState.get("connectorId"))[ "card_pm" ]["PaymentIntentOffSession"]; + let req_data = data["Request"]; let res_data = data["Response"]; + cy.createPaymentIntentTest( fixtures.createPaymentBody, req_data, @@ -306,6 +308,7 @@ describe("Config Tests", () => { "automatic", globalState ); + if (should_continue) should_continue = utils.should_continue_further(res_data); }); From e12d2a2a4503da276a0935276d0eb74929cae863 Mon Sep 17 00:00:00 2001 From: Gnanasundari24 <118818938+Gnanasundari24@users.noreply.github.com> Date: Fri, 22 Nov 2024 16:03:59 +0530 Subject: [PATCH 09/12] Lints Co-authored-by: Pa1NarK <69745008+pixincreate@users.noreply.github.com> --- cypress-tests/cypress/e2e/PaymentTest/00024-ConfigTest.cy.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/cypress-tests/cypress/e2e/PaymentTest/00024-ConfigTest.cy.js b/cypress-tests/cypress/e2e/PaymentTest/00024-ConfigTest.cy.js index 9f0081eb072..cf1196647eb 100644 --- a/cypress-tests/cypress/e2e/PaymentTest/00024-ConfigTest.cy.js +++ b/cypress-tests/cypress/e2e/PaymentTest/00024-ConfigTest.cy.js @@ -366,8 +366,10 @@ describe("Config Tests", () => { let data = getConnectorDetails(globalState.get("connectorId"))[ "card_pm" ]["PaymentIntentOffSession"]; + let req_data = data["Request"]; let res_data = data["Response"]; + cy.createPaymentIntentTest( fixtures.createPaymentBody, req_data, @@ -376,9 +378,11 @@ describe("Config Tests", () => { "automatic", globalState ); + if (should_continue) should_continue = utils.should_continue_further(res_data); }); + it("payment_methods-call-test", () => { cy.paymentMethodsCallTest(globalState); }); From 645df1ba2c9c990fdb69700d28482131e9794ebf Mon Sep 17 00:00:00 2001 From: Gnanasundari24 <118818938+Gnanasundari24@users.noreply.github.com> Date: Fri, 22 Nov 2024 16:04:12 +0530 Subject: [PATCH 10/12] Lints Co-authored-by: Pa1NarK <69745008+pixincreate@users.noreply.github.com> --- .../cypress/e2e/PaymentTest/00024-ConfigTest.cy.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/cypress-tests/cypress/e2e/PaymentTest/00024-ConfigTest.cy.js b/cypress-tests/cypress/e2e/PaymentTest/00024-ConfigTest.cy.js index cf1196647eb..20fbfa4e42f 100644 --- a/cypress-tests/cypress/e2e/PaymentTest/00024-ConfigTest.cy.js +++ b/cypress-tests/cypress/e2e/PaymentTest/00024-ConfigTest.cy.js @@ -285,9 +285,9 @@ describe("Config Tests", () => { fixtures.updateBusinessProfile, true, // is_connector_agnostic_enabled true, // collect_billing_address_from_wallet_connector - false, //collect_shipping_address_from_wallet_connector - true, //always_collect_billing_address_from_wallet_connector - false, //always_collect_shipping_address_from_wallet_connector + false, // collect_shipping_address_from_wallet_connector + true, // always_collect_billing_address_from_wallet_connector + false, // always_collect_shipping_address_from_wallet_connector globalState ); }); From d3fcb6476b4d6ba02fdb5b02b54ae934bbbc7a7a Mon Sep 17 00:00:00 2001 From: Gnanasundari24 <118818938+Gnanasundari24@users.noreply.github.com> Date: Fri, 22 Nov 2024 16:04:24 +0530 Subject: [PATCH 11/12] Lints Co-authored-by: Pa1NarK <69745008+pixincreate@users.noreply.github.com> --- .../cypress/e2e/PaymentTest/00024-ConfigTest.cy.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/cypress-tests/cypress/e2e/PaymentTest/00024-ConfigTest.cy.js b/cypress-tests/cypress/e2e/PaymentTest/00024-ConfigTest.cy.js index 20fbfa4e42f..8b16b608b6a 100644 --- a/cypress-tests/cypress/e2e/PaymentTest/00024-ConfigTest.cy.js +++ b/cypress-tests/cypress/e2e/PaymentTest/00024-ConfigTest.cy.js @@ -355,9 +355,9 @@ describe("Config Tests", () => { fixtures.updateBusinessProfile, true, // is_connector_agnostic_enabled false, // collect_billing_address_from_wallet_connector - false, //collect_shipping_address_from_wallet_connector - false, //always_collect_billing_address_from_wallet_connector - false, //always_collect_shipping_address_from_wallet_connector + false, // collect_shipping_address_from_wallet_connector + false, // always_collect_billing_address_from_wallet_connector + false, // always_collect_shipping_address_from_wallet_connector globalState ); }); From 2ba7eccd755e44e9d90b069fcca6eb66c53c54f4 Mon Sep 17 00:00:00 2001 From: gnanasundarig Date: Fri, 22 Nov 2024 16:43:56 +0530 Subject: [PATCH 12/12] ci(cypress) : Unified fixtures for business profile --- .../PaymentTest/00023-ConnectorAgnostic.cy.js | 20 ++++++++++++------- .../e2e/PaymentTest/00024-ConfigTest.cy.js | 18 ++++++++--------- .../cypress/fixtures/business-profile.json | 13 ++++++++++++ .../fixtures/create-business-profile.json | 3 --- cypress-tests/cypress/fixtures/imports.js | 6 ++---- .../fixtures/update-business-profile.json | 7 ------- 6 files changed, 37 insertions(+), 30 deletions(-) create mode 100644 cypress-tests/cypress/fixtures/business-profile.json delete mode 100644 cypress-tests/cypress/fixtures/create-business-profile.json delete mode 100644 cypress-tests/cypress/fixtures/update-business-profile.json diff --git a/cypress-tests/cypress/e2e/PaymentTest/00023-ConnectorAgnostic.cy.js b/cypress-tests/cypress/e2e/PaymentTest/00023-ConnectorAgnostic.cy.js index 774fb6d903c..77d50fe8132 100644 --- a/cypress-tests/cypress/e2e/PaymentTest/00023-ConnectorAgnostic.cy.js +++ b/cypress-tests/cypress/e2e/PaymentTest/00023-ConnectorAgnostic.cy.js @@ -26,7 +26,7 @@ describe("Connector Agnostic Tests", () => { it("Create Business Profile", () => { cy.createBusinessProfileTest( - fixtures.createBusinessProfile, + fixtures.businessProfile.bpCreate, globalState ); }); @@ -85,7 +85,7 @@ describe("Connector Agnostic Tests", () => { it("Create Business Profile", () => { cy.createBusinessProfileTest( - fixtures.createBusinessProfile, + fixtures.businessProfile.bpCreate, globalState ); }); @@ -101,7 +101,7 @@ describe("Connector Agnostic Tests", () => { it("Enable Connector Agnostic for Business Profile", () => { cy.UpdateBusinessProfileTest( - fixtures.updateBusinessProfile, + fixtures.businessProfile.bpUpdate, true, // is_connector_agnostic_enabled false, // collect_billing_address_from_wallet_connector false, //collect_shipping_address_from_wallet_connector @@ -145,7 +145,10 @@ describe("Connector Agnostic Tests", () => { }); it("Create Business Profile", () => { - cy.createBusinessProfileTest(fixtures.createBusinessProfile, globalState); + cy.createBusinessProfileTest( + fixtures.businessProfile.bpCreate, + globalState + ); }); it("connector-create-call-test", () => { @@ -163,7 +166,7 @@ describe("Connector Agnostic Tests", () => { it("Enable Connector Agnostic for Business Profile", () => { cy.UpdateBusinessProfileTest( - fixtures.updateBusinessProfile, + fixtures.businessProfile.bpUpdate, true, // is_connector_agnostic_enabled false, // collect_billing_address_from_wallet_connector false, //collect_shipping_address_from_wallet_connector @@ -213,7 +216,10 @@ describe("Connector Agnostic Tests", () => { }); it("Create Business Profile", () => { - cy.createBusinessProfileTest(fixtures.createBusinessProfile, globalState); + cy.createBusinessProfileTest( + fixtures.businessProfile.bpCreate, + globalState + ); }); it("connector-create-call-test", () => { @@ -227,7 +233,7 @@ describe("Connector Agnostic Tests", () => { it("Enable Connector Agnostic for Business Profile", () => { cy.UpdateBusinessProfileTest( - fixtures.updateBusinessProfile, + fixtures.businessProfile.bpUpdate, true, // is_connector_agnostic_enabled false, // collect_billing_address_from_wallet_connector false, //collect_shipping_address_from_wallet_connector diff --git a/cypress-tests/cypress/e2e/PaymentTest/00024-ConfigTest.cy.js b/cypress-tests/cypress/e2e/PaymentTest/00024-ConfigTest.cy.js index ac46b799a48..0fc40631c5f 100644 --- a/cypress-tests/cypress/e2e/PaymentTest/00024-ConfigTest.cy.js +++ b/cypress-tests/cypress/e2e/PaymentTest/00024-ConfigTest.cy.js @@ -27,7 +27,7 @@ describe("Config Tests", () => { it("Create Business Profile", () => { cy.createBusinessProfileTest( - fixtures.createBusinessProfile, + fixtures.businessProfile.bpCreate, globalState ); }); @@ -47,7 +47,7 @@ describe("Config Tests", () => { it("Update collect_billing_details_from_wallet_connector to true", () => { cy.UpdateBusinessProfileTest( - fixtures.updateBusinessProfile, + fixtures.businessProfile.bpUpdate, true, // is_connector_agnostic_enabled true, // collect_billing_address_from_wallet_connector false, //collect_shipping_address_from_wallet_connector @@ -93,7 +93,7 @@ describe("Config Tests", () => { it("Update collect_shipping_details_from_wallet_connector to true", () => { cy.UpdateBusinessProfileTest( - fixtures.updateBusinessProfile, + fixtures.businessProfile.bpUpdate, true, // is_connector_agnostic_enabled false, // collect_billing_address_from_wallet_connector false, //collect_shipping_address_from_wallet_connector @@ -140,7 +140,7 @@ describe("Config Tests", () => { it("Update always_collect_billing_details_from_wallet_connector to true", () => { cy.UpdateBusinessProfileTest( - fixtures.updateBusinessProfile, + fixtures.businessProfile.bpUpdate, true, // is_connector_agnostic_enabled false, // collect_billing_address_from_wallet_connector false, //collect_shipping_address_from_wallet_connector @@ -187,7 +187,7 @@ describe("Config Tests", () => { it("Update always_collect_shipping_details_from_wallet_connector to true", () => { cy.UpdateBusinessProfileTest( - fixtures.updateBusinessProfile, + fixtures.businessProfile.bpUpdate, true, // is_connector_agnostic_enabled false, // collect_billing_address_from_wallet_connector false, //collect_shipping_address_from_wallet_connector @@ -234,7 +234,7 @@ describe("Config Tests", () => { it("Update both always & collect_shipping_details_from_wallet_connector to true", () => { cy.UpdateBusinessProfileTest( - fixtures.updateBusinessProfile, + fixtures.businessProfile.bpUpdate, true, // is_connector_agnostic_enabled false, // collect_billing_address_from_wallet_connector true, //collect_shipping_address_from_wallet_connector @@ -280,7 +280,7 @@ describe("Config Tests", () => { it("Update both always & collect_billing_details_from_wallet_connector to true", () => { cy.UpdateBusinessProfileTest( - fixtures.updateBusinessProfile, + fixtures.businessProfile.bpUpdate, true, // is_connector_agnostic_enabled true, // collect_billing_address_from_wallet_connector false, //collect_shipping_address_from_wallet_connector @@ -327,7 +327,7 @@ describe("Config Tests", () => { it("Create Business Profile", () => { cy.createBusinessProfileTest( - fixtures.createBusinessProfile, + fixtures.businessProfile.bpCreate, globalState ); }); @@ -347,7 +347,7 @@ describe("Config Tests", () => { it("Update all config to false", () => { cy.UpdateBusinessProfileTest( - fixtures.updateBusinessProfile, + fixtures.businessProfile.bpUpdate, true, // is_connector_agnostic_enabled false, // collect_billing_address_from_wallet_connector false, //collect_shipping_address_from_wallet_connector diff --git a/cypress-tests/cypress/fixtures/business-profile.json b/cypress-tests/cypress/fixtures/business-profile.json new file mode 100644 index 00000000000..8d7bf637b59 --- /dev/null +++ b/cypress-tests/cypress/fixtures/business-profile.json @@ -0,0 +1,13 @@ +{ + "bpCreate": { + "profile_name": "default" + }, + + "bpUpdate": { + "is_connector_agnostic_mit_enabled": true, + "collect_shipping_details_from_wallet_connector": true, + "collect_billing_details_from_wallet_connector": true, + "always_collect_billing_details_from_wallet_connector": true, + "always_collect_shipping_details_from_wallet_connector": true + } +} diff --git a/cypress-tests/cypress/fixtures/create-business-profile.json b/cypress-tests/cypress/fixtures/create-business-profile.json deleted file mode 100644 index cdce8636157..00000000000 --- a/cypress-tests/cypress/fixtures/create-business-profile.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "profile_name": "default" -} \ No newline at end of file diff --git a/cypress-tests/cypress/fixtures/imports.js b/cypress-tests/cypress/fixtures/imports.js index 900e4f4ea3a..617edd6f98f 100644 --- a/cypress-tests/cypress/fixtures/imports.js +++ b/cypress-tests/cypress/fixtures/imports.js @@ -1,8 +1,8 @@ +import businessProfile from "./business-profile.json"; import captureBody from "./capture-flow-body.json"; import configs from "./configs.json"; import confirmBody from "./confirm-body.json"; import apiKeyCreateBody from "./create-api-key-body.json"; -import createBusinessProfile from "./create-business-profile.json"; import createConfirmPaymentBody from "./create-confirm-body.json"; import createConnectorBody from "./create-connector-body.json"; import customerCreateBody from "./create-customer-body.json"; @@ -20,7 +20,6 @@ import routingConfigBody from "./routing-config-body.json"; import saveCardConfirmBody from "./save-card-confirm-body.json"; import sessionTokenBody from "./session-token.json"; import apiKeyUpdateBody from "./update-api-key-body.json"; -import updateBusinessProfile from "./update-business-profile.json"; import updateConnectorBody from "./update-connector-body.json"; import customerUpdateBody from "./update-customer-body.json"; import voidBody from "./void-payment-body.json"; @@ -28,11 +27,11 @@ import voidBody from "./void-payment-body.json"; export { apiKeyCreateBody, apiKeyUpdateBody, + businessProfile, captureBody, citConfirmBody, configs, confirmBody, - createBusinessProfile, createConfirmPaymentBody, createConnectorBody, createPaymentBody, @@ -49,7 +48,6 @@ export { routingConfigBody, saveCardConfirmBody, sessionTokenBody, - updateBusinessProfile, updateConnectorBody, voidBody, }; diff --git a/cypress-tests/cypress/fixtures/update-business-profile.json b/cypress-tests/cypress/fixtures/update-business-profile.json deleted file mode 100644 index f9782748a3b..00000000000 --- a/cypress-tests/cypress/fixtures/update-business-profile.json +++ /dev/null @@ -1,7 +0,0 @@ -{ - "is_connector_agnostic_mit_enabled": true, - "collect_shipping_details_from_wallet_connector": true, - "collect_billing_details_from_wallet_connector": true, - "always_collect_billing_details_from_wallet_connector": true, - "always_collect_shipping_details_from_wallet_connector": true -}