diff --git a/cypress-tests/cypress/e2e/PaymentTest/00020-MandatesUsingNTID.cy.js b/cypress-tests/cypress/e2e/PaymentTest/00020-MandatesUsingNTID.cy.js index edd46f7f8348..dcccfd390bf1 100644 --- a/cypress-tests/cypress/e2e/PaymentTest/00020-MandatesUsingNTID.cy.js +++ b/cypress-tests/cypress/e2e/PaymentTest/00020-MandatesUsingNTID.cy.js @@ -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", @@ -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", @@ -75,8 +89,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", @@ -84,8 +105,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", @@ -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", @@ -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", @@ -176,8 +218,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", @@ -185,8 +234,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", @@ -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", diff --git a/cypress-tests/cypress/support/commands.js b/cypress-tests/cypress/support/commands.js index 317c4b2967a4..2e63e7e15c71 100644 --- a/cypress-tests/cypress/support/commands.js +++ b/cypress-tests/cypress/support/commands.js @@ -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; @@ -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}` @@ -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}` @@ -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); } }); }