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 billing descriptor tests for Stripe, Nuvei, TrustPay, Finix (#11921)
HS-QUALIBOT4e716d99d528
diff --git a/cypress-tests/cypress/e2e/configs/Payment/Finix.js b/cypress-tests/cypress/e2e/configs/Payment/Finix.jsindex fd3bee5fd5..efb6a10834 100644--- a/cypress-tests/cypress/e2e/configs/Payment/Finix.js+++ b/cypress-tests/cypress/e2e/configs/Payment/Finix.js@@ -695,6 +695,37 @@ export const connectorDetails = {},},},+ PaymentIntentWithBillingDescriptor: {+ Request: {+ currency: "USD",+ amount: 6540,+ authentication_type: "no_three_ds",+ capture_method: "automatic",+ billing_descriptor: {+ statement_descriptor: "QA-BillingDesc",+ },+ },+ Response: {+ status: 200,+ body: {+ status: "requires_payment_method",+ },+ },+ },+ PaymentConfirmWithBillingDescriptor: {+ Request: {+ payment_method: "card",+ payment_method_data: { card: successfulNo3DSCardDetails },+ customer_acceptance: null,+ setup_future_usage: "on_session",+ },+ Response: {+ status: 200,+ body: {+ status: "succeeded",+ },+ },+ },},pm_list: {PmListResponse: {diff --git a/cypress-tests/cypress/e2e/configs/Payment/Nuvei.js b/cypress-tests/cypress/e2e/configs/Payment/Nuvei.jsindex a4177f2700..959dc9c296 100644--- a/cypress-tests/cypress/e2e/configs/Payment/Nuvei.js+++ b/cypress-tests/cypress/e2e/configs/Payment/Nuvei.js@@ -735,6 +735,74 @@ export const connectorDetails = {},},},+ PaymentIntentWithBillingDescriptor: {+ Request: {+ currency: "USD",+ amount: 6540,+ authentication_type: "no_three_ds",+ capture_method: "automatic",+ billing_descriptor: {+ name: "Juspay",+ phone: "8056594427",+ },+ email: "[email protected]",+ },+ Response: {+ status: 200,+ body: {+ status: "requires_payment_method",+ },+ },+ },+ PaymentConfirmWithBillingDescriptor: {+ Request: {+ payment_method: "card",+ payment_method_data: { card: successfulNo3DSCardDetails },+ customer_acceptance: null,+ setup_future_usage: "on_session",+ },+ Response: {+ status: 200,+ body: {+ status: "succeeded",+ },+ },+ },+ PaymentIntentWithBillingDescriptorInvalidPhone: {+ Request: {+ currency: "USD",+ amount: 6540,+ authentication_type: "no_three_ds",+ capture_method: "automatic",+ billing_descriptor: {+ name: "Juspay",+ phone: "12345678901234",+ },+ email: "[email protected]",+ },+ Response: {+ status: 200,+ body: {+ status: "requires_payment_method",+ },+ },+ },+ PaymentConfirmWithBillingDescriptorInvalidPhone: {+ Request: {+ payment_method: "card",+ payment_method_data: { card: successfulNo3DSCardDetails },+ customer_acceptance: null,+ setup_future_usage: "on_session",+ },+ Response: {+ status: 400,+ body: {+ error: {+ code: "IR_47",+ },+ },+ },+ },},// Bank redirect payment methodsbank_redirect_pm: {diff --git a/cypress-tests/cypress/e2e/configs/Payment/Stripe.js b/cypress-tests/cypress/e2e/configs/Payment/Stripe.jsindex f0aec4a52f..46e5f9bc89 100644--- a/cypress-tests/cypress/e2e/configs/Payment/Stripe.js+++ b/cypress-tests/cypress/e2e/configs/Payment/Stripe.js@@ -907,6 +907,38 @@ export const connectorDetails = {},},},+ PaymentIntentWithBillingDescriptor: {+ Request: {+ currency: "USD",+ amount: 6540,+ authentication_type: "no_three_ds",+ capture_method: "automatic",+ billing_descriptor: {+ statement_descriptor: "QA-BillingDesc",+ statement_descriptor_suffix: "SUFFIX1",+ },+ },+ Response: {+ status: 200,+ body: {+ status: "requires_payment_method",+ },+ },+ },+ PaymentConfirmWithBillingDescriptor: {+ Request: {+ payment_method: "card",+ payment_method_data: { card: successfulNo3DSCardDetails },+ customer_acceptance: null,+ setup_future_usage: "on_session",+ },+ Response: {+ status: 200,+ body: {+ status: "succeeded",+ },+ },+ },},bank_transfer_pm: {Ach: {diff --git a/cypress-tests/cypress/e2e/configs/Payment/Trustpay.js b/cypress-tests/cypress/e2e/configs/Payment/Trustpay.jsindex f5120198e9..f677d4826b 100644--- a/cypress-tests/cypress/e2e/configs/Payment/Trustpay.js+++ b/cypress-tests/cypress/e2e/configs/Payment/Trustpay.js@@ -618,6 +618,64 @@ export const connectorDetails = {},},},+ PaymentIntentWithBillingDescriptor: {+ Request: {+ currency: "EUR",+ amount: 6540,+ authentication_type: "no_three_ds",+ capture_method: "automatic",+ billing_descriptor: {+ statement_descriptor: "QA-BillingDesc",+ },+ billing: {+ address: {+ line1: "123 Test St",+ city: "San Francisco",+ state: "California",+ zip: "94122",+ country: "US",+ first_name: "John",+ last_name: "Doe",+ },+ },+ email: "[email protected]",+ name: "John Doe",+ },+ Response: {+ status: 200,+ body: {+ status: "requires_payment_method",+ },+ },+ },+ PaymentConfirmWithBillingDescriptor: {+ Request: {+ payment_method: "card",+ payment_method_data: { card: successfulNo3DSCardDetails },+ customer_acceptance: null,+ setup_future_usage: "on_session",+ browser_info: {+ user_agent:+ "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36",+ accept_header:+ "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8",+ language: "en-US",+ color_depth: 24,+ screen_height: 768,+ screen_width: 1280,+ time_zone: -330,+ java_enabled: true,+ java_script_enabled: true,+ ip_address: "127.0.0.1",+ },+ },+ Response: {+ status: 200,+ body: {+ status: "succeeded",+ },+ },+ },},bank_redirect_pm: {Ideal: {diff --git a/cypress-tests/cypress/e2e/configs/Payment/Utils.js b/cypress-tests/cypress/e2e/configs/Payment/Utils.jsindex c0bd29ec6f..354cf95a83 100644--- a/cypress-tests/cypress/e2e/configs/Payment/Utils.js+++ b/cypress-tests/cypress/e2e/configs/Payment/Utils.js@@ -508,7 +508,15 @@ export const CONNECTOR_LISTS = {"stripe",],CARD_INSTALLMENTS: ["adyen"],- BILLING_DESCRIPTOR: ["adyen", "checkout"],+ BILLING_DESCRIPTOR: [+ "adyen",+ "checkout",+ "stripe",+ "nuvei",+ "trustpay",+ "finix",+ ],+ BILLING_DESCRIPTOR_INVALID_PHONE: ["nuvei"],AUTO_RETRY: ["cybersource","checkout",diff --git a/cypress-tests/cypress/e2e/spec/Payment/43-BillingDescriptor.cy.js b/cypress-tests/cypress/e2e/spec/Payment/43-BillingDescriptor.cy.jsindex d1e50177bb..2135198764 100644--- a/cypress-tests/cypress/e2e/spec/Payment/43-BillingDescriptor.cy.js+++ b/cypress-tests/cypress/e2e/spec/Payment/43-BillingDescriptor.cy.js@@ -40,66 +40,128 @@ describe("Card - Billing Descriptor payment flow test", () => {});context("Card-NoThreeDS payment with billing descriptor", () => {- let shouldContinue = true;-- it("Create Payment Intent with billing descriptor", () => {- const data = getConnectorDetails(globalState.get("connectorId"))[- "card_pm"- ]["PaymentIntentWithBillingDescriptor"];-- cy.createPaymentIntentTest(- fixtures.createPaymentBody,- data,- "no_three_ds",- "automatic",- globalState- );-- if (!utils.should_continue_further(data)) {- shouldContinue = false;- }- });+ it("Create Payment Intent -> Payment Methods -> Confirm Payment -> Retrieve Payment", () => {+ let shouldContinue = true;- it("Payment Methods Call", () => {- if (!shouldContinue) {- cy.task("cli_log", "Skipping step: Payment Methods Call");- return;- }- cy.paymentMethodsCallTest(globalState);- });+ cy.step("Create Payment Intent with billing descriptor", () => {+ const data = getConnectorDetails(globalState.get("connectorId"))[+ "card_pm"+ ]["PaymentIntentWithBillingDescriptor"];- it("Confirm Payment with billing descriptor", () => {- if (!shouldContinue) {- cy.task(- "cli_log",- "Skipping step: Confirm Payment with billing descriptor"+ cy.createPaymentIntentTest(+ fixtures.createPaymentBody,+ data,+ "no_three_ds",+ "automatic",+ globalState);- return;- }- const data = getConnectorDetails(globalState.get("connectorId"))[- "card_pm"- ]["PaymentConfirmWithBillingDescriptor"];- cy.confirmCallTest(fixtures.confirmBody, data, true, globalState);+ if (!utils.should_continue_further(data)) {+ shouldContinue = false;+ }+ });- if (!utils.should_continue_further(data)) {- shouldContinue = false;- }- });+ cy.step("Payment Methods Call", () => {+ if (!shouldContinue) {+ cy.task("cli_log", "Skipping step: Payment Methods Call");+ return;+ }+ cy.paymentMethodsCallTest(globalState);+ });- it("Retrieve Payment with billing descriptor", () => {- if (!shouldContinue) {- cy.task(- "cli_log",- "Skipping step: Retrieve Payment with billing descriptor"- );- return;- }- const data = getConnectorDetails(globalState.get("connectorId"))[- "card_pm"- ]["PaymentConfirmWithBillingDescriptor"];+ cy.step("Confirm Payment with billing descriptor", () => {+ if (!shouldContinue) {+ cy.task("cli_log", "Skipping step: Confirm Payment");+ return;+ }+ const data = getConnectorDetails(globalState.get("connectorId"))[+ "card_pm"+ ]["PaymentConfirmWithBillingDescriptor"];++ cy.confirmCallTest(fixtures.confirmBody, data, true, globalState);++ if (!utils.should_continue_further(data)) {+ shouldContinue = false;+ }+ });- cy.retrievePaymentCallTest({ globalState, data });+ cy.step("Retrieve Payment with billing descriptor", () => {+ if (!shouldContinue) {+ cy.task("cli_log", "Skipping step: Retrieve Payment");+ return;+ }+ const data = getConnectorDetails(globalState.get("connectorId"))[+ "card_pm"+ ]["PaymentConfirmWithBillingDescriptor"];++ cy.retrievePaymentCallTest({ globalState, data });+ });});});++ context(+ "Card-NoThreeDS payment with invalid billing descriptor (field length validation)",+ () => {+ it("Create Payment Intent -> Payment Methods -> Confirm Payment (expect error)", () => {+ let shouldContinue = true;++ cy.step(+ "Create Payment Intent with invalid billing descriptor phone",+ () => {+ if (+ shouldIncludeConnector(+ connector,+ CONNECTOR_LISTS.INCLUDE.BILLING_DESCRIPTOR_INVALID_PHONE+ )+ ) {+ cy.log(+ `Skipping: ${connector} does not support billing descriptor field length validation test`+ );+ shouldContinue = false;+ return;+ }++ const data = getConnectorDetails(globalState.get("connectorId"))[+ "card_pm"+ ]["PaymentIntentWithBillingDescriptorInvalidPhone"];++ cy.createPaymentIntentTest(+ fixtures.createPaymentBody,+ data,+ "no_three_ds",+ "automatic",+ globalState+ );++ if (!utils.should_continue_further(data)) {+ shouldContinue = false;+ }+ }+ );++ cy.step("Payment Methods Call", () => {+ if (!shouldContinue) {+ cy.task("cli_log", "Skipping step: Payment Methods Call");+ return;+ }+ cy.paymentMethodsCallTest(globalState);+ });++ cy.step(+ "Confirm Payment with invalid billing descriptor phone (expect error)",+ () => {+ if (!shouldContinue) {+ cy.task("cli_log", "Skipping step: Confirm Payment");+ return;+ }+ const data = getConnectorDetails(globalState.get("connectorId"))[+ "card_pm"+ ]["PaymentConfirmWithBillingDescriptorInvalidPhone"];++ cy.confirmCallTest(fixtures.confirmBody, data, true, globalState);+ }+ );+ });+ }+ );});