From 79630955a21c69767506440a03652a21e8cc6fd6 Mon Sep 17 00:00:00 2001 From: likhinbopanna Date: Fri, 21 Jun 2024 19:58:25 +0530 Subject: [PATCH 1/3] ci(cypress): Fix payment method id for non supported connectors --- .../PaymentTest/00018-MandatesUsingPMID.cy.js | 43 +++++++++++++++++-- .../cypress/e2e/PaymentUtils/Trustpay.js | 16 +++---- 2 files changed, 47 insertions(+), 12 deletions(-) diff --git a/cypress-tests/cypress/e2e/PaymentTest/00018-MandatesUsingPMID.cy.js b/cypress-tests/cypress/e2e/PaymentTest/00018-MandatesUsingPMID.cy.js index affef3d148..6eea1bd682 100644 --- a/cypress-tests/cypress/e2e/PaymentTest/00018-MandatesUsingPMID.cy.js +++ b/cypress-tests/cypress/e2e/PaymentTest/00018-MandatesUsingPMID.cy.js @@ -16,10 +16,8 @@ describe("Card - Mandates using Payment Method Id flow test", () => { }); }); - beforeEach(function () { - if (!should_continue) { - this.skip(); - } + after("flush global state", () => { + cy.task("setGlobalState", globalState.data); }); afterEach("flush global state", () => { @@ -30,6 +28,13 @@ describe("Card - Mandates using Payment Method Id flow test", () => { "Card - NoThreeDS Create and Confirm Automatic CIT and MIT payment flow test", () => { let should_continue = true; + + beforeEach(function () { + if (!should_continue) { + this.skip(); + } + }); + it("Create No 3DS Payment Intent", () => { let data = getConnectorDetails(globalState.get("connectorId"))[ "card_pm" @@ -81,6 +86,12 @@ describe("Card - Mandates using Payment Method Id flow test", () => { () => { let should_continue = true; + beforeEach(function () { + if (!should_continue) { + this.skip(); + } + }); + it("Create No 3DS Payment Intent", () => { let data = getConnectorDetails(globalState.get("connectorId"))[ "card_pm" @@ -144,6 +155,12 @@ describe("Card - Mandates using Payment Method Id flow test", () => { () => { let should_continue = true; + beforeEach(function () { + if (!should_continue) { + this.skip(); + } + }); + it("Confirm No 3DS CIT", () => { console.log("confirm -> " + globalState.get("connectorId")); let data = getConnectorDetails(globalState.get("connectorId"))[ @@ -180,6 +197,12 @@ describe("Card - Mandates using Payment Method Id flow test", () => { () => { let should_continue = true; + beforeEach(function () { + if (!should_continue) { + this.skip(); + } + }); + it("Confirm No 3DS CIT", () => { console.log("confirm -> " + globalState.get("connectorId")); let data = getConnectorDetails(globalState.get("connectorId"))[ @@ -253,6 +276,12 @@ describe("Card - Mandates using Payment Method Id flow test", () => { () => { let should_continue = true; + beforeEach(function () { + if (!should_continue) { + this.skip(); + } + }); + it("Confirm 3DS CIT", () => { console.log("confirm -> " + globalState.get("connectorId")); let data = getConnectorDetails(globalState.get("connectorId"))[ @@ -294,6 +323,12 @@ describe("Card - Mandates using Payment Method Id flow test", () => { () => { let should_continue = true; + beforeEach(function () { + if (!should_continue) { + this.skip(); + } + }); + it("Confirm 3DS CIT", () => { console.log("confirm -> " + globalState.get("connectorId")); let data = getConnectorDetails(globalState.get("connectorId"))[ diff --git a/cypress-tests/cypress/e2e/PaymentUtils/Trustpay.js b/cypress-tests/cypress/e2e/PaymentUtils/Trustpay.js index cb787ffab4..27f397fcf4 100644 --- a/cypress-tests/cypress/e2e/PaymentUtils/Trustpay.js +++ b/cypress-tests/cypress/e2e/PaymentUtils/Trustpay.js @@ -227,7 +227,7 @@ export const connectorDetails = { card: successfulThreeDSTestCardDetails, }, currency: "USD", - mandate_data: singleUseMandateData, + mandate_data: singleUseMandateData, }, Response: { status: 400, @@ -246,7 +246,7 @@ export const connectorDetails = { card: successfulThreeDSTestCardDetails, }, currency: "USD", - mandate_data: singleUseMandateData, + mandate_data: singleUseMandateData, }, Response: { status: 400, @@ -265,7 +265,7 @@ export const connectorDetails = { card: successfulNo3DSCardDetails, }, currency: "USD", - mandate_data: singleUseMandateData, + mandate_data: singleUseMandateData, }, Response: { status: 400, @@ -284,7 +284,7 @@ export const connectorDetails = { card: successfulNo3DSCardDetails, }, currency: "USD", - mandate_data: singleUseMandateData, + mandate_data: singleUseMandateData, }, Response: { status: 400, @@ -303,7 +303,7 @@ export const connectorDetails = { card: successfulNo3DSCardDetails, }, currency: "USD", - mandate_data: multiUseMandateData, + mandate_data: multiUseMandateData, }, Response: { status: 400, @@ -322,7 +322,7 @@ export const connectorDetails = { card: successfulNo3DSCardDetails, }, currency: "USD", - mandate_data: multiUseMandateData, + mandate_data: multiUseMandateData, }, Response: { status: 400, @@ -485,7 +485,7 @@ export const connectorDetails = { type: "invalid_request", message: "Payment method type not supported", code: "HE_03", - reason: "debit mandate payment is not supported by trustpay", + reason: "manual is not supported by trustpay", }, }, }, @@ -542,7 +542,7 @@ export const connectorDetails = { type: "invalid_request", message: "Payment method type not supported", code: "HE_03", - reason: "debit mandate payment is not supported by trustpay", + reason: "manual is not supported by trustpay", }, }, }, From abb1892416d203fc9949521fe060e267f1c0fa8c Mon Sep 17 00:00:00 2001 From: likhinbopanna Date: Sat, 22 Jun 2024 01:13:04 +0530 Subject: [PATCH 2/3] add-bank-redirect-paypal --- .../cypress/e2e/PaymentUtils/Paypal.js | 166 +++++++++++++++++- .../cypress/support/redirectionHandler.js | 18 ++ 2 files changed, 182 insertions(+), 2 deletions(-) diff --git a/cypress-tests/cypress/e2e/PaymentUtils/Paypal.js b/cypress-tests/cypress/e2e/PaymentUtils/Paypal.js index a34d90cfb8..525bb17997 100644 --- a/cypress-tests/cypress/e2e/PaymentUtils/Paypal.js +++ b/cypress-tests/cypress/e2e/PaymentUtils/Paypal.js @@ -1,3 +1,5 @@ +import { getCustomExchange } from "./Commons"; + const successfulNo3DSCardDetails = { card_number: "4012000033330026", card_exp_month: "01", @@ -232,7 +234,7 @@ export const connectorDetails = { }, MandateSingleUse3DSManualCapture: { Request: { - payment_method_data: { + payment_method_data: { card: successfulThreeDSTestCardDetails, }, currency: "USD", @@ -336,7 +338,7 @@ export const connectorDetails = { card: successfulThreeDSTestCardDetails, }, currency: "USD", - mandate_data: multiUseMandateData, + mandate_data: multiUseMandateData, }, Response: { status: 400, @@ -545,4 +547,164 @@ export const connectorDetails = { }, }, }, + bank_redirect_pm: { + PaymentIntent: getCustomExchange({ + Request: { + currency: "EUR", + }, + Response: { + status: 200, + body: { + status: "requires_payment_method", + }, + }, + }), + ideal: { + Request: { + payment_method: "bank_redirect", + payment_method_type: "ideal", + payment_method_data: { + bank_redirect: { + ideal: { + bank_name: "ing", + }, + }, + }, + billing: { + address: { + line1: "1467", + line2: "Harrison Street", + line3: "Harrison Street", + city: "San Fransico", + state: "California", + zip: "94122", + country: "NL", + first_name: "joseph", + last_name: "Doe", + }, + phone: { + number: "8056594427", + country_code: "+91", + }, + }, + }, + Response: { + status: 200, + body: { + status: "requires_customer_action", + }, + }, + }, + giropay: { + Request: { + payment_method: "bank_redirect", + payment_method_type: "giropay", + payment_method_data: { + bank_redirect: { + giropay: { + bank_name: "", + bank_account_bic: "", + bank_account_iban: "", + }, + }, + }, + billing: { + address: { + line1: "1467", + line2: "Harrison Street", + line3: "Harrison Street", + city: "San Fransico", + state: "California", + zip: "94122", + country: "DE", + first_name: "joseph", + last_name: "Doe", + }, + phone: { + number: "8056594427", + country_code: "+91", + }, + }, + }, + Response: { + status: 200, + body: { + status: "requires_customer_action", + }, + }, + }, + sofort: { + Request: { + payment_method: "bank_redirect", + payment_method_type: "sofort", + payment_method_data: { + bank_redirect: { + sofort: { + preferred_language: "en", + }, + }, + }, + billing: { + address: { + line1: "1467", + line2: "Harrison Street", + line3: "Harrison Street", + city: "San Fransico", + state: "California", + zip: "94122", + country: "AT", + first_name: "joseph", + last_name: "Doe", + }, + phone: { + number: "8056594427", + country_code: "+91", + }, + }, + }, + Response: { + status: 200, + body: { + status: "failed", + error_code: "PERMISSION_DENIED", + }, + }, + }, + eps: { + Request: { + payment_method: "bank_redirect", + payment_method_type: "eps", + payment_method_data: { + bank_redirect: { + eps: { + bank_name: "ing", + }, + }, + }, + billing: { + address: { + line1: "1467", + line2: "Harrison Street", + line3: "Harrison Street", + city: "San Fransico", + state: "California", + zip: "94122", + country: "AT", + first_name: "joseph", + last_name: "Doe", + }, + phone: { + number: "8056594427", + country_code: "+91", + }, + }, + }, + Response: { + status: 200, + body: { + status: "requires_customer_action", + }, + }, + }, + }, }; diff --git a/cypress-tests/cypress/support/redirectionHandler.js b/cypress-tests/cypress/support/redirectionHandler.js index c290b4ae42..ce320c73a1 100644 --- a/cypress-tests/cypress/support/redirectionHandler.js +++ b/cypress-tests/cypress/support/redirectionHandler.js @@ -198,6 +198,24 @@ function bankRedirectRedirection( } verifyUrl = true; break; + case "paypal": + switch (payment_method_type) { + case "eps": + cy.get('button[name="Successful"][value="SUCCEEDED"]').click(); + break; + case "ideal": + cy.get('button[name="Successful"][value="SUCCEEDED"]').click(); + break; + case "giropay": + cy.get('button[name="Successful"][value="SUCCEEDED"]').click(); + break; + default: + throw new Error( + `Unsupported payment method type: ${payment_method_type}` + ); + } + verifyUrl = true; + break; case "stripe": switch (payment_method_type) { case "eps": From eec7577cccd8495b5037952ef97fa93bf4e0f28a Mon Sep 17 00:00:00 2001 From: likhinbopanna Date: Sat, 22 Jun 2024 02:19:22 +0530 Subject: [PATCH 3/3] add-ideal-trustpay --- cypress-tests/cypress/support/redirectionHandler.js | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/cypress-tests/cypress/support/redirectionHandler.js b/cypress-tests/cypress/support/redirectionHandler.js index ce320c73a1..e36b7726b5 100644 --- a/cypress-tests/cypress/support/redirectionHandler.js +++ b/cypress-tests/cypress/support/redirectionHandler.js @@ -264,13 +264,8 @@ function bankRedirectRedirection( cy.get("input#submitButton.btn.btn-primary").click(); break; case "ideal": - cy.get("p").should( - "contain.text", - "Choose your iDeal Issuer Bank please" - ); - cy.get("#issuerSearchInput").click(); - cy.get("#issuerSearchInput").type("ING{enter}"); - cy.get("#trustpay__selectIssuer_submit").click(); + cy.contains("button", "Select your bank").click(); + cy.get('[data-testid="ideal-box-bank-item-INGBNL2A"]').click(); break; case "giropay": cy.get("._transactionId__header__iXVd_").should(