ci(cypress): Add testcases for unified error code and message (#6796)

This commit is contained in:
Gnanasundari24
2024-12-13 13:24:25 +05:30
committed by GitHub
parent 2a66f4a392
commit b506bc18e4
4 changed files with 119 additions and 0 deletions

View File

@ -673,4 +673,52 @@ describe("Corner cases", () => {
);
});
});
context("Card-NoThreeDS fail payment flow test", () => {
let shouldContinue = true; // variable that will be used to skip tests if a previous test fails
before("seed global state", () => {
cy.task("getGlobalState").then((state) => {
globalState = new State(state);
});
});
after("flush global state", () => {
cy.task("setGlobalState", globalState.data);
});
beforeEach(function () {
if (!shouldContinue) {
this.skip();
}
});
it("create-payment-call-test", () => {
const data = getConnectorDetails(globalState.get("connectorId"))[
"card_pm"
]["PaymentIntent"];
cy.createPaymentIntentTest(
fixtures.createPaymentBody,
data,
"no_three_ds",
"automatic",
globalState
);
if (shouldContinue) shouldContinue = utils.should_continue_further(data);
});
it("Confirm No 3DS", () => {
const data = getConnectorDetails(globalState.get("connectorId"))[
"card_pm"
]["No3DSFailPayment"];
cy.confirmCallTest(fixtures.confirmBody, data, true, globalState);
if (shouldContinue) shouldContinue = utils.should_continue_further(data);
});
it("retrieve-payment-call-test", () => {
cy.retrievePaymentCallTest(globalState);
});
});
});

View File

@ -16,6 +16,14 @@ const successfulThreeDSTestCardDetails = {
card_cvc: "737",
};
const failedNo3DSCardDetails = {
card_number: "4242424242424242",
card_exp_month: "01",
card_exp_year: "25",
card_holder_name: "joseph Doe",
card_cvc: "123",
};
const singleUseMandateData = {
customer_acceptance: {
acceptance_type: "offline",
@ -182,6 +190,26 @@ export const connectorDetails = {
},
},
},
No3DSFailPayment: {
Request: {
payment_method: "card",
payment_method_data: {
card: failedNo3DSCardDetails,
},
customer_acceptance: null,
setup_future_usage: "on_session",
},
Response: {
status: 200,
body: {
status: "failed",
error_code: "2",
error_message: "Refused",
unified_code: "UE_9000",
unified_message: "Something went wrong",
},
},
},
Capture: {
Request: {
payment_method: "card",

View File

@ -708,6 +708,20 @@ export const connectorDetails = {
setup_future_usage: "on_session",
},
}),
No3DSFailPayment: getCustomExchange({
Request: {
payment_method: "card",
payment_method_data: {
card: successfulNo3DSCardDetails,
},
customer_acceptance: null,
setup_future_usage: "on_session",
},
Response: {
status: 200,
body: {},
},
}),
Capture: getCustomExchange({
Request: {
payment_method: "card",

View File

@ -16,6 +16,14 @@ const successfulThreeDSTestCardDetails = {
card_cvc: "737",
};
const failedNo3DSCardDetails = {
card_number: "4000000000000002",
card_exp_month: "01",
card_exp_year: "25",
card_holder_name: "joseph Doe",
card_cvc: "123",
};
const singleUseMandateData = {
customer_acceptance: {
acceptance_type: "offline",
@ -254,6 +262,27 @@ export const connectorDetails = {
},
},
},
No3DSFailPayment: {
Request: {
payment_method: "card",
payment_method_data: {
card: failedNo3DSCardDetails,
},
customer_acceptance: null,
setup_future_usage: "on_session",
},
Response: {
status: 200,
body: {
status: "failed",
error_code: "card_declined",
error_message:
"message - Your card was declined., decline_code - generic_decline",
unified_code: "UE_9000",
unified_message: "Something went wrong",
},
},
},
Capture: {
Request: {
payment_method: "card",