mirror of
https://github.com/juspay/hyperswitch.git
synced 2025-10-27 19:46:48 +08:00
ci(cypress): Add bank redirects for stripe (#4772)
Co-authored-by: Likhin Bopanna <likhin.bopanna@likhinbopanna-DQK43G6YDT.local>
This commit is contained in:
@ -301,7 +301,65 @@ describe("Bank Redirect tests", () => {
|
||||
cy.handleBankRedirectRedirection(
|
||||
globalState,
|
||||
payment_method_type,
|
||||
expected_redirection,
|
||||
expected_redirection
|
||||
);
|
||||
});
|
||||
});
|
||||
|
||||
context("Przelewy24 Create and Confirm 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("create-payment-call-test", () => {
|
||||
let data = getConnectorDetails(globalState.get("connectorId"))[
|
||||
"bank_redirect_pm"
|
||||
]["PaymentIntent"];
|
||||
let req_data = data["Request"];
|
||||
let res_data = data["Response"];
|
||||
cy.createPaymentIntentTest(
|
||||
createPaymentBody,
|
||||
req_data,
|
||||
res_data,
|
||||
"three_ds",
|
||||
"automatic",
|
||||
globalState
|
||||
);
|
||||
if (should_continue)
|
||||
should_continue = utils.should_continue_further(res_data);
|
||||
});
|
||||
|
||||
it("payment_methods-call-test", () => {
|
||||
cy.paymentMethodsCallTest(globalState);
|
||||
});
|
||||
|
||||
it("Confirm bank redirect", () => {
|
||||
let data = getConnectorDetails(globalState.get("connectorId"))[
|
||||
"bank_redirect_pm"
|
||||
]["przelewy24"];
|
||||
let req_data = data["Request"];
|
||||
let res_data = data["Response"];
|
||||
cy.confirmBankRedirectCallTest(
|
||||
confirmBody,
|
||||
req_data,
|
||||
res_data,
|
||||
true,
|
||||
globalState
|
||||
);
|
||||
if (should_continue)
|
||||
should_continue = utils.should_continue_further(res_data);
|
||||
});
|
||||
|
||||
it("Handle bank redirect redirection", () => {
|
||||
let expected_redirection = confirmBody["return_url"];
|
||||
let payment_method_type = globalState.get("paymentMethodType");
|
||||
cy.handleBankRedirectRedirection(
|
||||
globalState,
|
||||
payment_method_type,
|
||||
expected_redirection
|
||||
);
|
||||
});
|
||||
});
|
||||
|
||||
@ -441,7 +441,6 @@ export const connectorDetails = {
|
||||
bank_name: "",
|
||||
bank_account_bic: "",
|
||||
bank_account_iban: "",
|
||||
preferred_language: "en",
|
||||
country: "DE",
|
||||
},
|
||||
},
|
||||
@ -493,6 +492,33 @@ export const connectorDetails = {
|
||||
},
|
||||
},
|
||||
},
|
||||
przelewy24: {
|
||||
Request: {
|
||||
payment_method: "bank_redirect",
|
||||
payment_method_type: "przelewy24",
|
||||
payment_method_data: {
|
||||
bank_redirect: {
|
||||
przelewy24: {
|
||||
bank_name: "citi",
|
||||
billing_details: {
|
||||
email: "guest@juspay.in",
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
Response: {
|
||||
status: 400,
|
||||
body: {
|
||||
error: {
|
||||
type: "invalid_request",
|
||||
message: "Payment method type not supported",
|
||||
code: "HE_03",
|
||||
reason: "automatic for przelewy24 is not supported by adyen",
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
blik: {
|
||||
Request: {
|
||||
payment_method: "bank_redirect",
|
||||
|
||||
@ -481,6 +481,22 @@ export const connectorDetails = {
|
||||
},
|
||||
},
|
||||
}),
|
||||
przelewy24: getCustomExchange({
|
||||
Request: {
|
||||
payment_method: "bank_redirect",
|
||||
payment_method_type: "przelewy24",
|
||||
payment_method_data: {
|
||||
bank_redirect: {
|
||||
przelewy24: {
|
||||
bank_name: "citi",
|
||||
billing_details: {
|
||||
email: "guest@juspay.in",
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
}),
|
||||
blikPaymentIntent: getCustomExchange({
|
||||
Request: {
|
||||
currency: "PLN",
|
||||
|
||||
@ -1,3 +1,5 @@
|
||||
import { getCustomExchange } from "./Commons";
|
||||
|
||||
const successfulTestCard = "4242424242424242";
|
||||
const successful3DSCard = "4000002760003184";
|
||||
|
||||
@ -370,4 +372,137 @@ 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",
|
||||
country: "NL",
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
Response: {
|
||||
status: 200,
|
||||
body: {
|
||||
status: "requires_customer_action",
|
||||
},
|
||||
},
|
||||
},
|
||||
giropay: {
|
||||
Request: {
|
||||
payment_method: "bank_redirect",
|
||||
payment_method_type: "giropay",
|
||||
payment_method_data: {
|
||||
bank_redirect: {
|
||||
giropay: {
|
||||
country: "DE",
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
Response: {
|
||||
status: 200,
|
||||
body: {
|
||||
status: "requires_customer_action",
|
||||
},
|
||||
},
|
||||
},
|
||||
sofort: {
|
||||
Request: {
|
||||
payment_method: "bank_redirect",
|
||||
payment_method_type: "sofort",
|
||||
payment_method_data: {
|
||||
bank_redirect: {
|
||||
sofort: {
|
||||
country: "DE",
|
||||
preferred_language: "en",
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
Response: {
|
||||
status: 200,
|
||||
body: {
|
||||
status: "requires_customer_action",
|
||||
},
|
||||
},
|
||||
},
|
||||
eps: {
|
||||
Request: {
|
||||
payment_method: "bank_redirect",
|
||||
payment_method_type: "eps",
|
||||
payment_method_data: {
|
||||
bank_redirect: {
|
||||
eps: {
|
||||
bank_name: "bank_austria",
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
Response: {
|
||||
status: 200,
|
||||
body: {
|
||||
status: "requires_customer_action",
|
||||
},
|
||||
},
|
||||
},
|
||||
blik: {
|
||||
Request: {
|
||||
payment_method: "bank_redirect",
|
||||
payment_method_type: "blik",
|
||||
payment_method_data: {
|
||||
bank_redirect: {
|
||||
blik: {
|
||||
blik_code: "777987",
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
Response: {
|
||||
status: 200,
|
||||
body: {
|
||||
status: "failed",
|
||||
error_code: "payment_intent_invalid_parameter",
|
||||
},
|
||||
},
|
||||
},
|
||||
przelewy24: {
|
||||
Request: {
|
||||
payment_method: "bank_redirect",
|
||||
payment_method_type: "przelewy24",
|
||||
payment_method_data: {
|
||||
bank_redirect: {
|
||||
przelewy24: {
|
||||
bank_name: "citi",
|
||||
billing_details: {
|
||||
email: "guest@juspay.in",
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
Response: {
|
||||
status: 200,
|
||||
body: {
|
||||
status: "requires_customer_action",
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
};
|
||||
|
||||
@ -470,7 +470,6 @@ export const connectorDetails = {
|
||||
bank_name: "",
|
||||
bank_account_bic: "",
|
||||
bank_account_iban: "",
|
||||
preferred_language: "en",
|
||||
country: "DE",
|
||||
},
|
||||
},
|
||||
|
||||
@ -122,6 +122,17 @@
|
||||
"maximum_amount": 68607706,
|
||||
"recurring_enabled": true,
|
||||
"installment_payment_enabled": true
|
||||
},
|
||||
{
|
||||
"payment_method_type": "przelewy24",
|
||||
"payment_experience": null,
|
||||
"card_networks": null,
|
||||
"accepted_currencies": null,
|
||||
"accepted_countries": null,
|
||||
"minimum_amount": 1,
|
||||
"maximum_amount": 68607706,
|
||||
"recurring_enabled": true,
|
||||
"installment_payment_enabled": true
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
@ -193,7 +193,31 @@ function bankRedirectRedirection(
|
||||
break;
|
||||
default:
|
||||
throw new Error(
|
||||
`Unsupported payment method type: ${payment_method_type}`,
|
||||
`Unsupported payment method type: ${payment_method_type}`
|
||||
);
|
||||
}
|
||||
verifyUrl = true;
|
||||
break;
|
||||
case "stripe":
|
||||
switch (payment_method_type) {
|
||||
case "eps":
|
||||
cy.get('a[name="success"]').click();
|
||||
break;
|
||||
case "ideal":
|
||||
cy.get('a[name="success"]').click();
|
||||
break;
|
||||
case "giropay":
|
||||
cy.get('a[name="success"]').click();
|
||||
break;
|
||||
case "sofort":
|
||||
cy.get('a[name="success"]').click();
|
||||
break;
|
||||
case "przelewy24":
|
||||
cy.get('a[name="success"]').click();
|
||||
break;
|
||||
default:
|
||||
throw new Error(
|
||||
`Unsupported payment method type: ${payment_method_type}`
|
||||
);
|
||||
}
|
||||
verifyUrl = true;
|
||||
|
||||
Reference in New Issue
Block a user