Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(cypress): fix cypress throwing error when connectorId is not passed and miscellaneous fixes #5746

Merged
merged 7 commits into from
Sep 2, 2024
Merged
2 changes: 1 addition & 1 deletion cypress-tests/cypress.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ const path = require("path");

let globalState;
// Fetch from environment variable
const connectorId = process.env.CYPRESS_CONNECTOR;
const connectorId = process.env.CYPRESS_CONNECTOR || "service";
const reportName = process.env.REPORT_NAME || `${connectorId}_report`;

module.exports = defineConfig({
Expand Down
10 changes: 6 additions & 4 deletions cypress-tests/cypress/e2e/PaymentUtils/Commons.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,13 @@ function normalise(input) {
// Add more known exceptions here
};

if (exceptions[input.toLowerCase()]) {
return exceptions[input.toLowerCase()];
} else {
return input;
if (typeof input !== "string") {
const spec_name = Cypress.spec.name.split("-")[1].split(".")[0];
return `${spec_name}`;
}

const lowerCaseInput = input.toLowerCase();
return exceptions[lowerCaseInput] || input;
}

const successfulNo3DSCardDetails = {
Expand Down
281 changes: 140 additions & 141 deletions cypress-tests/cypress/e2e/PaymentUtils/Fiservemea.js
Original file line number Diff line number Diff line change
@@ -1,164 +1,163 @@
const successfulNo3DSCardDetails = {
card_number: "5204740000001002",
card_exp_month: "10",
card_exp_year: "24",
card_holder_name: "Joseph Doe",
card_cvc: "002",
};

export const connectorDetails = {
card_pm: {
PaymentIntent: {
Request: {
payment_method: "card",
payment_method_data: {
card: successfulNo3DSCardDetails,
},
currency: "EUR",
customer_acceptance: null,
setup_future_usage: "on_session",
},
Response: {
status: 200,
body: {
status: "requires_payment_method",
},
},
card_number: "5204740000001002",
card_exp_month: "10",
card_exp_year: "24",
card_holder_name: "Joseph Doe",
card_cvc: "002",
};

export const connectorDetails = {
card_pm: {
PaymentIntent: {
Request: {
payment_method: "card",
payment_method_data: {
card: successfulNo3DSCardDetails,
},
currency: "EUR",
customer_acceptance: null,
setup_future_usage: "on_session",
},
No3DSManualCapture: {
Request: {
payment_method: "card",
payment_method_data: {
card: successfulNo3DSCardDetails,
},
currency: "EUR",
customer_acceptance: null,
setup_future_usage: "on_session",
},
Response: {
status: 200,
body: {
status: "requires_capture",
},
Response: {
status: 200,
body: {
status: "requires_payment_method",
},
},
No3DSAutoCapture: {
Request: {
payment_method: "card",
payment_method_data: {
card: successfulNo3DSCardDetails,
},
currency: "EUR",
customer_acceptance: null,
setup_future_usage: "on_session",
},
Response: {
status: 200,
body: {
status: "succeeded",
},
},
},
No3DSManualCapture: {
Request: {
payment_method: "card",
payment_method_data: {
card: successfulNo3DSCardDetails,
},
currency: "EUR",
customer_acceptance: null,
setup_future_usage: "on_session",
},
Capture: {
Request: {
payment_method: "card",
payment_method_data: {
card: successfulNo3DSCardDetails,
},
currency: "EUR",
customer_acceptance: null,
},
Response: {
status: 200,
body: {
status: "succeeded",
amount: 6500,
amount_capturable: 0,
amount_received: 6500,
},
Response: {
status: 200,
body: {
status: "requires_capture",
},
},
PartialCapture: {
Request: {},
Response: {
status: 200,
body: {
status: "partially_captured",
amount: 6500,
amount_capturable: 0,
amount_received: 100,
},
},
},
No3DSAutoCapture: {
Request: {
payment_method: "card",
payment_method_data: {
card: successfulNo3DSCardDetails,
},
currency: "EUR",
customer_acceptance: null,
setup_future_usage: "on_session",
},
Void: {
Request: {},
Response: {
status: 200,
body: {
status: "cancelled",
},
Response: {
status: 200,
body: {
status: "succeeded",
},
},
Refund: {
Request: {
payment_method: "card",
payment_method_data: {
card: successfulNo3DSCardDetails,
},
currency: "EUR",
customer_acceptance: null,
},
Capture: {
Request: {
payment_method: "card",
payment_method_data: {
card: successfulNo3DSCardDetails,
},
currency: "EUR",
customer_acceptance: null,
},
Response: {
status: 200,
body: {
status: "succeeded",
amount: 6500,
amount_capturable: 0,
amount_received: 6500,
},
Response: {
status: 200,
body: {
status: "succeeded",
},
},
},
PartialCapture: {
Request: {},
Response: {
status: 200,
body: {
status: "partially_captured",
amount: 6500,
amount_capturable: 0,
amount_received: 100,
},
},
PartialRefund: {
Request: {
payment_method: "card",
payment_method_data: {
card: successfulNo3DSCardDetails,
},
currency: "EUR",
customer_acceptance: null,
},
Void: {
Request: {},
Response: {
status: 200,
body: {
status: "cancelled",
},
Response: {
status: 200,
body: {
status: "succeeded",
},
},
},
Refund: {
Request: {
payment_method: "card",
payment_method_data: {
card: successfulNo3DSCardDetails,
},
currency: "EUR",
customer_acceptance: null,
},
Response: {
status: 200,
body: {
status: "succeeded",
},
},
SyncRefund: {
Request: {
payment_method: "card",
payment_method_data: {
card: successfulNo3DSCardDetails,
},
currency: "EUR",
customer_acceptance: null,
},
PartialRefund: {
Request: {
payment_method: "card",
payment_method_data: {
card: successfulNo3DSCardDetails,
},
currency: "EUR",
customer_acceptance: null,
},
Response: {
status: 200,
body: {
status: "succeeded",
},
Response: {
status: 200,
body: {
status: "succeeded",
},
},
},
SyncRefund: {
Request: {
payment_method: "card",
payment_method_data: {
card: successfulNo3DSCardDetails,
},
currency: "EUR",
customer_acceptance: null,
},
Response: {
status: 200,
body: {
status: "succeeded",
},
},
ZeroAuthMandate: {
Response: {
status: 501,
body: {
error: {
type: "invalid_request",
message: "Setup Mandate flow for Fiservemea is not implemented",
code: "IR_00",
},
},
ZeroAuthMandate: {
Response: {
status: 501,
body: {
error: {
type: "invalid_request",
message: "Setup Mandate flow for Fiservemea is not implemented",
code: "IR_00",
},
},
},
},
};
},
};
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,6 @@ describe("Rule Based Routing Test", () => {
let res_data = data["Response"];

cy.createJWTToken(req_data, res_data, globalState);
if (should_continue)
should_continue = utils.should_continue_further(res_data);
});

it("merchant retrieve call", () => {
Expand Down
9 changes: 5 additions & 4 deletions cypress-tests/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion cypress-tests/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
"author": "",
"license": "ISC",
"devDependencies": {
"cypress": "^13.13.3",
"cypress": "^13.14.1",
"cypress-mochawesome-reporter": "^3.8.2",
"jsqr": "^1.4.0"
},
Expand Down
Loading