Skip to content

Commit

Permalink
enhancement: move ntid mit to configs
Browse files Browse the repository at this point in the history
  • Loading branch information
likhinbopanna committed Nov 27, 2024
1 parent 695d773 commit 9468ba1
Show file tree
Hide file tree
Showing 2 changed files with 88 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,15 @@ describe("Card - Mandates using Network Transaction Id flow test", () => {
});

it("Confirm No 3DS MIT", () => {
let data = getConnectorDetails(globalState.get("connectorId"))[
"card_pm"
]["MITAutoCapture"];
let req_data = data["Request"];
let res_data = data["Response"];
cy.mitUsingNTID(
fixtures.ntidConfirmBody,
req_data,
res_data,
7000,
true,
"automatic",
Expand All @@ -52,8 +59,15 @@ describe("Card - Mandates using Network Transaction Id flow test", () => {
});

it("Confirm No 3DS MIT", () => {
let data = getConnectorDetails(globalState.get("connectorId"))[
"card_pm"
]["MITManualCapture"];
let req_data = data["Request"];
let res_data = data["Response"];
cy.mitUsingNTID(
fixtures.ntidConfirmBody,
req_data,
res_data,
7000,
true,
"manual",
Expand All @@ -75,17 +89,31 @@ describe("Card - Mandates using Network Transaction Id flow test", () => {
});

it("Confirm No 3DS MIT", () => {
let data = getConnectorDetails(globalState.get("connectorId"))[
"card_pm"
]["MITAutoCapture"];
let req_data = data["Request"];
let res_data = data["Response"];
cy.mitUsingNTID(
fixtures.ntidConfirmBody,
req_data,
res_data,
7000,
true,
"automatic",
globalState
);
});
it("Confirm No 3DS MIT", () => {
let data = getConnectorDetails(globalState.get("connectorId"))[
"card_pm"
]["MITAutoCapture"];
let req_data = data["Request"];
let res_data = data["Response"];
cy.mitUsingNTID(
fixtures.ntidConfirmBody,
req_data,
res_data,
7000,
true,
"automatic",
Expand All @@ -107,8 +135,15 @@ describe("Card - Mandates using Network Transaction Id flow test", () => {
});

it("Confirm No 3DS MIT 1", () => {
let data = getConnectorDetails(globalState.get("connectorId"))[
"card_pm"
]["MITManualCapture"];
let req_data = data["Request"];
let res_data = data["Response"];
cy.mitUsingNTID(
fixtures.ntidConfirmBody,
req_data,
res_data,
6500,
true,
"manual",
Expand All @@ -135,8 +170,15 @@ describe("Card - Mandates using Network Transaction Id flow test", () => {
});

it("Confirm No 3DS MIT 2", () => {
let data = getConnectorDetails(globalState.get("connectorId"))[
"card_pm"
]["MITManualCapture"];
let req_data = data["Request"];
let res_data = data["Response"];
cy.mitUsingNTID(
fixtures.ntidConfirmBody,
req_data,
res_data,
6500,
true,
"manual",
Expand Down Expand Up @@ -176,17 +218,31 @@ describe("Card - Mandates using Network Transaction Id flow test", () => {
});

it("Confirm No 3DS MIT", () => {
let data = getConnectorDetails(globalState.get("connectorId"))[
"card_pm"
]["MITAutoCapture"];
let req_data = data["Request"];
let res_data = data["Response"];
cy.mitUsingNTID(
fixtures.ntidConfirmBody,
req_data,
res_data,
7000,
true,
"automatic",
globalState
);
});
it("Confirm No 3DS MIT", () => {
let data = getConnectorDetails(globalState.get("connectorId"))[
"card_pm"
]["MITAutoCapture"];
let req_data = data["Request"];
let res_data = data["Response"];
cy.mitUsingNTID(
fixtures.ntidConfirmBody,
req_data,
res_data,
7000,
true,
"automatic",
Expand All @@ -208,8 +264,15 @@ describe("Card - Mandates using Network Transaction Id flow test", () => {
});

it("Confirm No 3DS MIT", () => {
let data = getConnectorDetails(globalState.get("connectorId"))[
"card_pm"
]["MITAutoCapture"];
let req_data = data["Request"];
let res_data = data["Response"];
cy.mitUsingNTID(
fixtures.ntidConfirmBody,
req_data,
res_data,
7000,
true,
"automatic",
Expand Down
32 changes: 25 additions & 7 deletions cypress-tests/cypress/support/commands.js
Original file line number Diff line number Diff line change
Expand Up @@ -2115,8 +2115,18 @@ Cypress.Commands.add(

Cypress.Commands.add(
"mitUsingNTID",
(requestBody, amount, confirm, capture_method, globalState) => {

(
requestBody,
req_data,
res_data,
amount,
confirm,
capture_method,
globalState
) => {
for (const key in req_data) {
requestBody[key] = req_data[key];
}
requestBody.amount = amount;
requestBody.confirm = confirm;
requestBody.capture_method = capture_method;
Expand Down Expand Up @@ -2153,8 +2163,13 @@ Cypress.Commands.add(
.to.have.property("redirect_to_url");
const nextActionUrl = response.body.next_action.redirect_to_url;
cy.log(nextActionUrl);
for (const key in res_data.body) {
expect(res_data.body[key]).to.equal(response.body[key]);
}
} else if (response.body.authentication_type === "no_three_ds") {
expect(response.body.status).to.equal("succeeded");
for (const key in res_data.body) {
expect(res_data.body[key]).to.equal(response.body[key]);
}
} else {
throw new Error(
`Invalid authentication type ${response.body.authentication_type}`
Expand All @@ -2167,8 +2182,13 @@ Cypress.Commands.add(
.to.have.property("redirect_to_url");
const nextActionUrl = response.body.next_action.redirect_to_url;
cy.log(nextActionUrl);
for (const key in res_data.body) {
expect(res_data.body[key]).to.equal(response.body[key]);
}
} else if (response.body.authentication_type === "no_three_ds") {
expect(response.body.status).to.equal("requires_capture");
for (const key in res_data.body) {
expect(res_data.body[key]).to.equal(response.body[key]);
}
} else {
throw new Error(
`Invalid authentication type ${response.body.authentication_type}`
Expand All @@ -2180,9 +2200,7 @@ Cypress.Commands.add(
);
}
} else {
throw new Error(
`Error Response: ${response.status}\n${response.body.error.message}\n${response.body.error.code}`
);
defaultErrorHandler(response, res_data);
}
});
}
Expand Down

0 comments on commit 9468ba1

Please sign in to comment.