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
test(cypress): add coverage for blocklist card_bin widening, customer_acceptance_support and payment_account_reference (#14844)
HS-QUALIBOTabf13c9b7566
diff --git a/cypress-tests/cypress/e2e/configs/Payment/Utils.js b/cypress-tests/cypress/e2e/configs/Payment/Utils.jsindex b9bab1a955..b99c4fcc70 100644--- a/cypress-tests/cypress/e2e/configs/Payment/Utils.js+++ b/cypress-tests/cypress/e2e/configs/Payment/Utils.js@@ -622,6 +622,7 @@ export const CONNECTOR_LISTS = {"fiservcommercehub","givepayments","ilixium",+ "stripe","truelayer","trustly",],diff --git a/cypress-tests/cypress/e2e/configs/PaymentMethodList/Commons.js b/cypress-tests/cypress/e2e/configs/PaymentMethodList/Commons.jsindex 034598d72d..b66530786e 100644--- a/cypress-tests/cypress/e2e/configs/PaymentMethodList/Commons.js+++ b/cypress-tests/cypress/e2e/configs/PaymentMethodList/Commons.js@@ -58,6 +58,31 @@ export const cardCreditEnabledInUs = [},];+export const openBankingEnabledInGb = [+ {+ payment_method: "bank_redirect",+ payment_method_types: [+ {+ payment_method_type: "open_banking",+ payment_experience: null,+ card_networks: null,+ accepted_currencies: {+ type: "enable_only",+ list: ["GBP"],+ },+ accepted_countries: {+ type: "enable_only",+ list: ["GB"],+ },+ minimum_amount: 1,+ maximum_amount: 68607706,+ recurring_enabled: true,+ installment_payment_enabled: true,+ },+ ],+ },+];+export const cardCreditEnabledInEur = [{payment_method: "card",diff --git a/cypress-tests/cypress/e2e/configs/PaymentMethodList/Connector.js b/cypress-tests/cypress/e2e/configs/PaymentMethodList/Connector.jsindex aee9aa0f53..8da649cc06 100644--- a/cypress-tests/cypress/e2e/configs/PaymentMethodList/Connector.js+++ b/cypress-tests/cypress/e2e/configs/PaymentMethodList/Connector.js@@ -27,6 +27,24 @@ export const connectorDetails = {},},PmListResponse: {+ PmListCustomerAcceptanceSupportCardCredit: {+ customer_acceptance_support: [+ {+ paymentMethod: "card",+ paymentMethodType: "credit",+ expected: "supported",+ },+ ],+ },+ PmListCustomerAcceptanceSupportOpenBanking: {+ customer_acceptance_support: [+ {+ paymentMethod: "bank_redirect",+ paymentMethodType: "open_banking",+ expected: "partially_supported",+ },+ ],+ },PmListNull: {payment_methods: [],},diff --git a/cypress-tests/cypress/e2e/spec/PaymentMethodList/00001-CustomerAcceptanceSupport.cy.js b/cypress-tests/cypress/e2e/spec/PaymentMethodList/00001-CustomerAcceptanceSupport.cy.jsnew file mode 100644index 0000000000..fc8a021bab--- /dev/null+++ b/cypress-tests/cypress/e2e/spec/PaymentMethodList/00001-CustomerAcceptanceSupport.cy.js@@ -0,0 +1,166 @@+import * as fixtures from "../../../fixtures/imports";+import State from "../../../utils/State";+import {+ cardCreditEnabledInUs,+ openBankingEnabledInGb,+ createPaymentBodyWithCurrency,+ createPaymentBodyWithCurrencyCountry,+} from "../../configs/PaymentMethodList/Commons";+import getConnectorDetails from "../../configs/PaymentMethodList/Utils";++let globalState;+let pristineGlobalStateData;++describe("Payment Method List - customer_acceptance_support field", () => {+ before("snapshot global state before creating throwaway merchants", () => {+ cy.task("getGlobalState").then((state) => {+ pristineGlobalStateData = JSON.parse(JSON.stringify(state));+ });+ });++ after("restore global state for specs running after this one", () => {+ cy.task("setGlobalState", pristineGlobalStateData);+ });++ context(+ `+ MCA1 -> Stripe configured with credit = { country = "US" }\n+ Payment is done with country as US and currency as USD\n+ card.credit should report "supported" (configured in customer_acceptance_support.card.credit)\n+ `,+ () => {+ before("seed global state", () => {+ cy.task("getGlobalState").then((state) => {+ globalState = new State(state);+ });+ });++ after("flush global state", () => {+ cy.task("setGlobalState", globalState.data);+ });++ it("merchant-create-call-test", () => {+ cy.merchantCreateCallTest(fixtures.merchantCreateBody, globalState);+ });++ it("api-key-create-call-test", () => {+ cy.apiKeyCreateTest(fixtures.apiKeyCreateBody, globalState);+ });++ it("customer-create-call-test", () => {+ cy.createCustomerCallTest(fixtures.customerCreateBody, globalState);+ });++ it("connector-create-call-test", () => {+ cy.createNamedConnectorCallTest(+ "payment_processor",+ fixtures.createConnectorBody,+ cardCreditEnabledInUs,+ globalState,+ "stripe",+ "stripe_US_default"+ );+ });++ it("create-payment-call-test", () => {+ const data =+ getConnectorDetails("connector")["pm_list"]["PaymentIntent"];++ const newData = {+ ...data,+ Request: data.RequestCurrencyUSD,+ RequestCurrencyUSD: undefined,+ };++ cy.createPaymentIntentTest(+ createPaymentBodyWithCurrency("USD"),+ newData,+ "no_three_ds",+ "automatic",+ globalState+ );+ });++ it("payment-method-list-call-test: card.credit is supported", () => {+ const data =+ getConnectorDetails("connector")["pm_list"]["PmListResponse"][+ "PmListCustomerAcceptanceSupportCardCredit"+ ];+ cy.paymentMethodsCallTest(globalState, data);+ });+ }+ );++ context(+ `+ MCA2 -> Volt configured with bank_redirect.open_banking = { country = "GB", currency = "GBP" }\n+ Payment is done with country as GB and currency as GBP\n+ bank_redirect.open_banking should report "partially_supported" (configured in customer_acceptance_support.bank_redirect.open_banking)\n+ `,+ () => {+ before("seed global state", () => {+ cy.task("getGlobalState").then((state) => {+ globalState = new State(state);+ });+ });++ after("flush global state", () => {+ cy.task("setGlobalState", globalState.data);+ });++ it("merchant-create-call-test", () => {+ cy.merchantCreateCallTest(fixtures.merchantCreateBody, globalState);+ });++ it("api-key-create-call-test", () => {+ cy.apiKeyCreateTest(fixtures.apiKeyCreateBody, globalState);+ });++ it("customer-create-call-test", () => {+ cy.createCustomerCallTest(fixtures.customerCreateBody, globalState);+ });++ it("connector-create-call-test", () => {+ cy.createNamedConnectorCallTest(+ "payment_processor",+ fixtures.createConnectorBody,+ openBankingEnabledInGb,+ globalState,+ "volt",+ "volt_GB_default"+ );+ });++ it("create-payment-call-test", () => {+ const data =+ getConnectorDetails("connector")["pm_list"]["PaymentIntent"];++ const newData = {+ ...data,+ Request: {+ currency: "GBP",+ customer_acceptance: null,+ setup_future_usage: "off_session",+ authentication_type: "no_three_ds",+ },+ };++ cy.createPaymentIntentTest(+ createPaymentBodyWithCurrencyCountry("GBP", "GB", "GB"),+ newData,+ "no_three_ds",+ "automatic",+ globalState+ );+ });++ it("payment-method-list-call-test: bank_redirect.open_banking is partially_supported", () => {+ const data =+ getConnectorDetails("connector")["pm_list"]["PmListResponse"][+ "PmListCustomerAcceptanceSupportOpenBanking"+ ];+ cy.paymentMethodsCallTest(globalState, data);+ });+ }+ );+});diff --git a/cypress-tests/cypress/support/commands.js b/cypress-tests/cypress/support/commands.jsindex b954d1a32f..4d1b4da78e 100644--- a/cypress-tests/cypress/support/commands.js+++ b/cypress-tests/cypress/support/commands.js@@ -3317,6 +3317,24 @@ Cypress.Commands.add("paymentMethodsCallTest", (globalState, data = null) => {}}+ // Verify customer_acceptance_support for each listed payment method type+ if (resData?.customer_acceptance_support) {+ resData.customer_acceptance_support.forEach(+ ({ paymentMethod, paymentMethodType, expected }) => {+ const pmType = response.body.payment_methods+ .find((pm) => pm.payment_method === paymentMethod)+ ?.payment_method_types.find(+ (type) => type.payment_method_type === paymentMethodType+ );+ expect(pmType, `${paymentMethod}.${paymentMethodType}`).to.exist;+ expect(+ pmType.customer_acceptance_support,+ `${paymentMethod}.${paymentMethodType} customer_acceptance_support`+ ).to.equal(expected);+ }+ );+ }+expect(response.body).to.have.property("redirect_url");expect(response.body).to.have.property("payment_methods");if (