Skip to content

Commit

Permalink
ci(cypress): Fix payment method id for non supported connectors (#5075)
Browse files Browse the repository at this point in the history
  • Loading branch information
likhinbopanna authored Jun 24, 2024
1 parent e658899 commit 9600461
Show file tree
Hide file tree
Showing 4 changed files with 231 additions and 21 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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", () => {
Expand All @@ -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"
Expand Down Expand Up @@ -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"
Expand Down Expand Up @@ -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"))[
Expand Down Expand Up @@ -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"))[
Expand Down Expand Up @@ -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"))[
Expand Down Expand Up @@ -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"))[
Expand Down
166 changes: 164 additions & 2 deletions cypress-tests/cypress/e2e/PaymentUtils/Paypal.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import { getCustomExchange } from "./Commons";

const successfulNo3DSCardDetails = {
card_number: "4012000033330026",
card_exp_month: "01",
Expand Down Expand Up @@ -232,7 +234,7 @@ export const connectorDetails = {
},
MandateSingleUse3DSManualCapture: {
Request: {
payment_method_data: {
payment_method_data: {
card: successfulThreeDSTestCardDetails,
},
currency: "USD",
Expand Down Expand Up @@ -336,7 +338,7 @@ export const connectorDetails = {
card: successfulThreeDSTestCardDetails,
},
currency: "USD",
mandate_data: multiUseMandateData,
mandate_data: multiUseMandateData,
},
Response: {
status: 400,
Expand Down Expand Up @@ -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",
},
},
},
},
};
16 changes: 8 additions & 8 deletions cypress-tests/cypress/e2e/PaymentUtils/Trustpay.js
Original file line number Diff line number Diff line change
Expand Up @@ -227,7 +227,7 @@ export const connectorDetails = {
card: successfulThreeDSTestCardDetails,
},
currency: "USD",
mandate_data: singleUseMandateData,
mandate_data: singleUseMandateData,
},
Response: {
status: 400,
Expand All @@ -246,7 +246,7 @@ export const connectorDetails = {
card: successfulThreeDSTestCardDetails,
},
currency: "USD",
mandate_data: singleUseMandateData,
mandate_data: singleUseMandateData,
},
Response: {
status: 400,
Expand All @@ -265,7 +265,7 @@ export const connectorDetails = {
card: successfulNo3DSCardDetails,
},
currency: "USD",
mandate_data: singleUseMandateData,
mandate_data: singleUseMandateData,
},
Response: {
status: 400,
Expand All @@ -284,7 +284,7 @@ export const connectorDetails = {
card: successfulNo3DSCardDetails,
},
currency: "USD",
mandate_data: singleUseMandateData,
mandate_data: singleUseMandateData,
},
Response: {
status: 400,
Expand All @@ -303,7 +303,7 @@ export const connectorDetails = {
card: successfulNo3DSCardDetails,
},
currency: "USD",
mandate_data: multiUseMandateData,
mandate_data: multiUseMandateData,
},
Response: {
status: 400,
Expand All @@ -322,7 +322,7 @@ export const connectorDetails = {
card: successfulNo3DSCardDetails,
},
currency: "USD",
mandate_data: multiUseMandateData,
mandate_data: multiUseMandateData,
},
Response: {
status: 400,
Expand Down Expand Up @@ -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",
},
},
},
Expand Down Expand Up @@ -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",
},
},
},
Expand Down
27 changes: 20 additions & 7 deletions cypress-tests/cypress/support/redirectionHandler.js
Original file line number Diff line number Diff line change
Expand Up @@ -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":
Expand Down Expand Up @@ -246,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(
Expand Down

0 comments on commit 9600461

Please sign in to comment.