From b1c4e30e929fb8d31d854765d5f1ddad5e77f065 Mon Sep 17 00:00:00 2001 From: likhinbopanna <131246334+likhinbopanna@users.noreply.github.com> Date: Wed, 27 Nov 2024 23:48:13 +0530 Subject: [PATCH] ci(cypress): Move MIT requests to configs and add Paybox Mandates (#6650) --- .../e2e/PaymentTest/00009-RefundPayment.cy.js | 14 + .../00011-CreateSingleuseMandate.cy.js | 21 + .../00012-CreateMultiuseMandate.cy.js | 35 ++ .../00013-ListAndRevokeMandate.cy.js | 14 + .../PaymentTest/00015-ZeroAuthMandate.cy.js | 21 + .../PaymentTest/00019-MandatesUsingPMID.cy.js | 63 +++ .../PaymentTest/00020-MandatesUsingNTID.cy.js | 63 +++ .../e2e/PaymentTest/00022-Variations.cy.js | 37 +- .../cypress/e2e/PaymentUtils/Adyen.js | 18 + .../cypress/e2e/PaymentUtils/BankOfAmerica.js | 18 + .../cypress/e2e/PaymentUtils/Cybersource.js | 18 + .../cypress/e2e/PaymentUtils/Fiuu.js | 22 + .../cypress/e2e/PaymentUtils/Noon.js | 18 + .../cypress/e2e/PaymentUtils/Paybox.js | 531 +++++++++++++++++- .../cypress/e2e/PaymentUtils/Stripe.js | 18 + .../cypress/e2e/PaymentUtils/WellsFargo.js | 18 + cypress-tests/cypress/support/commands.js | 102 +++- 17 files changed, 988 insertions(+), 43 deletions(-) diff --git a/cypress-tests/cypress/e2e/PaymentTest/00009-RefundPayment.cy.js b/cypress-tests/cypress/e2e/PaymentTest/00009-RefundPayment.cy.js index 9eb64c0acf23..4eef1ac87371 100644 --- a/cypress-tests/cypress/e2e/PaymentTest/00009-RefundPayment.cy.js +++ b/cypress-tests/cypress/e2e/PaymentTest/00009-RefundPayment.cy.js @@ -815,8 +815,15 @@ describe("Card - Refund flow - No 3DS", () => { }); 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.mitForMandatesCallTest( fixtures.mitConfirmBody, + req_data, + res_data, 7000, true, "automatic", @@ -825,8 +832,15 @@ describe("Card - Refund flow - No 3DS", () => { }); 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.mitForMandatesCallTest( fixtures.mitConfirmBody, + req_data, + res_data, 7000, true, "automatic", diff --git a/cypress-tests/cypress/e2e/PaymentTest/00011-CreateSingleuseMandate.cy.js b/cypress-tests/cypress/e2e/PaymentTest/00011-CreateSingleuseMandate.cy.js index 5c1409138263..bace2a780183 100644 --- a/cypress-tests/cypress/e2e/PaymentTest/00011-CreateSingleuseMandate.cy.js +++ b/cypress-tests/cypress/e2e/PaymentTest/00011-CreateSingleuseMandate.cy.js @@ -49,8 +49,15 @@ describe("Card - SingleUse Mandates 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.mitForMandatesCallTest( fixtures.mitConfirmBody, + req_data, + res_data, 7000, true, "automatic", @@ -112,8 +119,15 @@ describe("Card - SingleUse Mandates 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.mitForMandatesCallTest( fixtures.mitConfirmBody, + req_data, + res_data, 6500, true, "manual", @@ -197,8 +211,15 @@ describe("Card - SingleUse Mandates 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.mitForMandatesCallTest( fixtures.mitConfirmBody, + req_data, + res_data, 7000, true, "automatic", diff --git a/cypress-tests/cypress/e2e/PaymentTest/00012-CreateMultiuseMandate.cy.js b/cypress-tests/cypress/e2e/PaymentTest/00012-CreateMultiuseMandate.cy.js index 3596af70fe1b..312c74c23c08 100644 --- a/cypress-tests/cypress/e2e/PaymentTest/00012-CreateMultiuseMandate.cy.js +++ b/cypress-tests/cypress/e2e/PaymentTest/00012-CreateMultiuseMandate.cy.js @@ -49,8 +49,15 @@ describe("Card - MultiUse Mandates 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.mitForMandatesCallTest( fixtures.mitConfirmBody, + req_data, + res_data, 7000, true, "automatic", @@ -58,8 +65,15 @@ describe("Card - MultiUse Mandates 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.mitForMandatesCallTest( fixtures.mitConfirmBody, + req_data, + res_data, 7000, true, "automatic", @@ -121,8 +135,15 @@ describe("Card - MultiUse Mandates 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.mitForMandatesCallTest( fixtures.mitConfirmBody, + req_data, + res_data, 6500, true, "manual", @@ -149,8 +170,15 @@ describe("Card - MultiUse Mandates 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.mitForMandatesCallTest( fixtures.mitConfirmBody, + req_data, + res_data, 6500, true, "manual", @@ -230,8 +258,15 @@ describe("Card - MultiUse Mandates 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.mitForMandatesCallTest( fixtures.mitConfirmBody, + req_data, + res_data, 6500, true, "automatic", diff --git a/cypress-tests/cypress/e2e/PaymentTest/00013-ListAndRevokeMandate.cy.js b/cypress-tests/cypress/e2e/PaymentTest/00013-ListAndRevokeMandate.cy.js index f341db19f6cc..cad829ba3107 100644 --- a/cypress-tests/cypress/e2e/PaymentTest/00013-ListAndRevokeMandate.cy.js +++ b/cypress-tests/cypress/e2e/PaymentTest/00013-ListAndRevokeMandate.cy.js @@ -49,8 +49,15 @@ describe("Card - List and revoke Mandates 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.mitForMandatesCallTest( fixtures.mitConfirmBody, + req_data, + res_data, 7000, true, "automatic", @@ -105,8 +112,15 @@ describe("Card - List and revoke Mandates 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.mitForMandatesCallTest( fixtures.mitConfirmBody, + req_data, + res_data, 7000, true, "automatic", diff --git a/cypress-tests/cypress/e2e/PaymentTest/00015-ZeroAuthMandate.cy.js b/cypress-tests/cypress/e2e/PaymentTest/00015-ZeroAuthMandate.cy.js index b90831427276..15e7597286a3 100644 --- a/cypress-tests/cypress/e2e/PaymentTest/00015-ZeroAuthMandate.cy.js +++ b/cypress-tests/cypress/e2e/PaymentTest/00015-ZeroAuthMandate.cy.js @@ -47,8 +47,15 @@ describe("Card - SingleUse Mandates 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.mitForMandatesCallTest( fixtures.mitConfirmBody, + req_data, + res_data, 7000, true, "automatic", @@ -89,8 +96,15 @@ describe("Card - SingleUse Mandates 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.mitForMandatesCallTest( fixtures.mitConfirmBody, + req_data, + res_data, 7000, true, "automatic", @@ -98,8 +112,15 @@ describe("Card - SingleUse Mandates 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.mitForMandatesCallTest( fixtures.mitConfirmBody, + req_data, + res_data, 7000, true, "automatic", diff --git a/cypress-tests/cypress/e2e/PaymentTest/00019-MandatesUsingPMID.cy.js b/cypress-tests/cypress/e2e/PaymentTest/00019-MandatesUsingPMID.cy.js index b2951e375862..401f662c67e2 100644 --- a/cypress-tests/cypress/e2e/PaymentTest/00019-MandatesUsingPMID.cy.js +++ b/cypress-tests/cypress/e2e/PaymentTest/00019-MandatesUsingPMID.cy.js @@ -67,8 +67,15 @@ describe("Card - Mandates using Payment Method 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.mitUsingPMId( fixtures.pmIdConfirmBody, + req_data, + res_data, 7000, true, "automatic", @@ -148,8 +155,15 @@ describe("Card - Mandates using Payment Method 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.mitUsingPMId( fixtures.pmIdConfirmBody, + req_data, + res_data, 7000, true, "automatic", @@ -193,8 +207,15 @@ describe("Card - Mandates using Payment Method 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.mitUsingPMId( fixtures.pmIdConfirmBody, + req_data, + res_data, 7000, true, "automatic", @@ -202,8 +223,15 @@ describe("Card - Mandates using Payment Method 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.mitUsingPMId( fixtures.pmIdConfirmBody, + req_data, + res_data, 7000, true, "automatic", @@ -265,8 +293,15 @@ describe("Card - Mandates using Payment Method 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.mitUsingPMId( fixtures.pmIdConfirmBody, + req_data, + res_data, 6500, true, "manual", @@ -293,8 +328,15 @@ describe("Card - Mandates using Payment Method 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.mitUsingPMId( fixtures.pmIdConfirmBody, + req_data, + res_data, 6500, true, "manual", @@ -361,8 +403,15 @@ describe("Card - Mandates using Payment Method 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.mitUsingPMId( fixtures.pmIdConfirmBody, + req_data, + res_data, 7000, true, "automatic", @@ -370,8 +419,15 @@ describe("Card - Mandates using Payment Method 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.mitUsingPMId( fixtures.pmIdConfirmBody, + req_data, + res_data, 7000, true, "automatic", @@ -438,8 +494,15 @@ describe("Card - Mandates using Payment Method 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.mitUsingPMId( fixtures.pmIdConfirmBody, + req_data, + res_data, 7000, true, "automatic", 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/e2e/PaymentTest/00022-Variations.cy.js b/cypress-tests/cypress/e2e/PaymentTest/00022-Variations.cy.js index b24b9f10f791..035b7da97abc 100644 --- a/cypress-tests/cypress/e2e/PaymentTest/00022-Variations.cy.js +++ b/cypress-tests/cypress/e2e/PaymentTest/00022-Variations.cy.js @@ -463,9 +463,15 @@ describe("Corner cases", () => { let data = getConnectorDetails(globalState.get("connectorId"))["card_pm"][ "Void" ]; - let commonData = getConnectorDetails(globalState.get("commons"))["card_pm"]["Void"]; + let commonData = getConnectorDetails(globalState.get("commons"))[ + "card_pm" + ]["Void"]; let req_data = data["Request"]; - let res_data = utils.getConnectorFlowDetails(data, commonData, "ResponseCustom"); + let res_data = utils.getConnectorFlowDetails( + data, + commonData, + "ResponseCustom" + ); cy.voidCallTest(fixtures.voidBody, req_data, res_data, globalState); if (should_continue) @@ -595,9 +601,15 @@ describe("Corner cases", () => { let data = getConnectorDetails(globalState.get("connectorId"))["card_pm"][ "Refund" ]; - let commonData = getConnectorDetails(globalState.get("commons"))["card_pm"]["Refund"]; + let commonData = getConnectorDetails(globalState.get("commons"))[ + "card_pm" + ]["Refund"]; let req_data = data["Request"]; - let res_data = utils.getConnectorFlowDetails(data, commonData, "ResponseCustom"); + let res_data = utils.getConnectorFlowDetails( + data, + commonData, + "ResponseCustom" + ); cy.refundCallTest( fixtures.refundBody, req_data, @@ -658,9 +670,15 @@ describe("Corner cases", () => { let data = getConnectorDetails(globalState.get("connectorId"))["card_pm"][ "Refund" ]; - let commonData = getConnectorDetails(globalState.get("commons"))["card_pm"]["Refund"]; + let commonData = getConnectorDetails(globalState.get("commons"))[ + "card_pm" + ]["Refund"]; let req_data = data["Request"]; - let res_data = utils.getConnectorFlowDetails(data, commonData, "ResponseCustom"); + let res_data = utils.getConnectorFlowDetails( + data, + commonData, + "ResponseCustom" + ); cy.refundCallTest( fixtures.refundBody, req_data, @@ -734,8 +752,15 @@ describe("Corner cases", () => { }); 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.mitForMandatesCallTest( fixtures.mitConfirmBody, + req_data, + res_data, 65000, true, "manual", diff --git a/cypress-tests/cypress/e2e/PaymentUtils/Adyen.js b/cypress-tests/cypress/e2e/PaymentUtils/Adyen.js index 9ce384c7a744..81525041147d 100644 --- a/cypress-tests/cypress/e2e/PaymentUtils/Adyen.js +++ b/cypress-tests/cypress/e2e/PaymentUtils/Adyen.js @@ -398,6 +398,24 @@ export const connectorDetails = { }, }, }, + MITAutoCapture: { + Request: {}, + Response: { + status: 200, + body: { + status: "succeeded", + }, + }, + }, + MITManualCapture: { + Request: {}, + Response: { + status: 200, + body: { + status: "requires_capture", + }, + }, + }, ZeroAuthMandate: { Request: { payment_method: "card", diff --git a/cypress-tests/cypress/e2e/PaymentUtils/BankOfAmerica.js b/cypress-tests/cypress/e2e/PaymentUtils/BankOfAmerica.js index 4a443e0962a2..af4dee5d5377 100644 --- a/cypress-tests/cypress/e2e/PaymentUtils/BankOfAmerica.js +++ b/cypress-tests/cypress/e2e/PaymentUtils/BankOfAmerica.js @@ -395,6 +395,24 @@ export const connectorDetails = { }, }, }, + MITAutoCapture: { + Request: {}, + Response: { + status: 200, + body: { + status: "succeeded", + }, + }, + }, + MITManualCapture: { + Request: {}, + Response: { + status: 200, + body: { + status: "requires_capture", + }, + }, + }, ZeroAuthMandate: { Request: { payment_method: "card", diff --git a/cypress-tests/cypress/e2e/PaymentUtils/Cybersource.js b/cypress-tests/cypress/e2e/PaymentUtils/Cybersource.js index ca24a50bcef3..72dc8f6479b8 100644 --- a/cypress-tests/cypress/e2e/PaymentUtils/Cybersource.js +++ b/cypress-tests/cypress/e2e/PaymentUtils/Cybersource.js @@ -458,6 +458,24 @@ export const connectorDetails = { }, }, }, + MITAutoCapture: { + Request: {}, + Response: { + status: 200, + body: { + status: "succeeded", + }, + }, + }, + MITManualCapture: { + Request: {}, + Response: { + status: 200, + body: { + status: "requires_capture", + }, + }, + }, ZeroAuthMandate: { Request: { payment_method: "card", diff --git a/cypress-tests/cypress/e2e/PaymentUtils/Fiuu.js b/cypress-tests/cypress/e2e/PaymentUtils/Fiuu.js index 4a910c7897c1..d82a5f128d68 100644 --- a/cypress-tests/cypress/e2e/PaymentUtils/Fiuu.js +++ b/cypress-tests/cypress/e2e/PaymentUtils/Fiuu.js @@ -360,6 +360,28 @@ export const connectorDetails = { }, }, }, + MITAutoCapture: { + Request: {}, + Response: { + status: 200, + body: { + status: "failed", + error_code: "The currency not allow for the RecordType", + error_message: "The currency not allow for the RecordType", + }, + }, + }, + MITManualCapture: { + Request: {}, + Response: { + status: 200, + body: { + status: "failed", + error_code: "The currency not allow for the RecordType", + error_message: "The currency not allow for the RecordType", + }, + }, + }, PaymentMethodIdMandateNo3DSAutoCapture: { Request: { payment_method: "card", diff --git a/cypress-tests/cypress/e2e/PaymentUtils/Noon.js b/cypress-tests/cypress/e2e/PaymentUtils/Noon.js index 70c056b6c92e..38b0c0c1117a 100644 --- a/cypress-tests/cypress/e2e/PaymentUtils/Noon.js +++ b/cypress-tests/cypress/e2e/PaymentUtils/Noon.js @@ -468,6 +468,24 @@ export const connectorDetails = { }, }, }, + MITAutoCapture: { + Request: {}, + Response: { + status: 200, + body: { + status: "succeeded", + }, + }, + }, + MITManualCapture: { + Request: {}, + Response: { + status: 200, + body: { + status: "requires_capture", + }, + }, + }, ZeroAuthMandate: { Response: { status: 501, diff --git a/cypress-tests/cypress/e2e/PaymentUtils/Paybox.js b/cypress-tests/cypress/e2e/PaymentUtils/Paybox.js index d1eb91692daa..70bfa5c32404 100644 --- a/cypress-tests/cypress/e2e/PaymentUtils/Paybox.js +++ b/cypress-tests/cypress/e2e/PaymentUtils/Paybox.js @@ -6,6 +6,57 @@ const successfulNo3DSCardDetails = { card_cvc: "222", }; +const successfulThreeDSTestCardDetails = { + card_number: "4000000000001091", + card_exp_month: "01", + card_exp_year: "25", + card_holder_name: "joseph Doe", + card_cvc: "123", +}; + +const singleUseMandateData = { + customer_acceptance: { + acceptance_type: "offline", + accepted_at: "1963-05-03T04:07:52.723Z", + online: { + ip_address: "125.0.0.1", + user_agent: "amet irure esse", + }, + }, + mandate_type: { + single_use: { + amount: 7000, + currency: "EUR", + }, + }, +}; + +const multiUseMandateData = { + customer_acceptance: { + acceptance_type: "offline", + accepted_at: "1963-05-03T04:07:52.723Z", + online: { + ip_address: "125.0.0.1", + user_agent: "amet irure esse", + }, + }, + mandate_type: { + multi_use: { + amount: 6500, + currency: "EUR", + }, + }, +}; + +const customerAcceptance = { + acceptance_type: "offline", + accepted_at: "1963-05-03T04:07:52.723Z", + online: { + ip_address: "125.0.0.1", + user_agent: "amet irure esse", + }, +}; + export const connectorDetails = { card_pm: { PaymentIntent: { @@ -21,6 +72,22 @@ export const connectorDetails = { }, }, }, + PaymentIntentOffSession: { + Request: { + currency: "EUR", + amount: 6500, + authentication_type: "no_three_ds", + customer_acceptance: null, + setup_future_usage: "off_session", + }, + Response: { + status: 200, + body: { + status: "requires_payment_method", + setup_future_usage: "off_session", + }, + }, + }, No3DSManualCapture: { Request: { currency: "EUR", @@ -52,7 +119,43 @@ export const connectorDetails = { Response: { status: 200, body: { - status: "processing", + status: "succeeded", + }, + }, + }, + "3DSManualCapture": { + Request: { + payment_method: "card", + payment_method_data: { + card: successfulThreeDSTestCardDetails, + }, + currency: "EUR", + customer_acceptance: null, + setup_future_usage: "on_session", + }, + Response: { + status: 200, + body: { + status: "requires_customer_action", + setup_future_usage: "on_session", + }, + }, + }, + "3DSAutoCapture": { + Request: { + payment_method: "card", + payment_method_data: { + card: successfulThreeDSTestCardDetails, + }, + currency: "EUR", + customer_acceptance: null, + setup_future_usage: "on_session", + }, + Response: { + status: 200, + body: { + status: "requires_customer_action", + setup_future_usage: "on_session", }, }, }, @@ -67,10 +170,10 @@ export const connectorDetails = { Response: { status: 200, body: { - status: "processing", + status: "succeeded", amount: 6500, - amount_capturable: 6500, - amount_received: null, + amount_capturable: 0, + amount_received: 6500, }, }, }, @@ -79,10 +182,24 @@ export const connectorDetails = { Response: { status: 200, body: { - status: "processing", + status: "partially_captured", amount: 6500, - amount_capturable: 6500, - amount_received: null, + amount_capturable: 0, + amount_received: 100, + }, + }, + }, + VoidAfterConfirm: { + Request: {}, + Response: { + status: 501, + body: { + status: "cancelled", + error: { + type: "invalid_request", + message: "Cancel/Void flow is not implemented", + code: "IR_00", + }, }, }, }, @@ -131,7 +248,405 @@ export const connectorDetails = { }, }, }, - + MandateSingleUse3DSAutoCapture: { + Request: { + payment_method: "card", + payment_method_data: { + card: successfulThreeDSTestCardDetails, + }, + currency: "EUR", + mandate_data: singleUseMandateData, + }, + Response: { + status: 400, + body: { + error: { + type: "invalid_request", + message: "Payment method type not supported", + code: "IR_19", + reason: + "Capture Not allowed in case of Creating the Subscriber is not supported by Paybox", + }, + }, + }, + }, + MandateSingleUse3DSManualCapture: { + Request: { + payment_method: "card", + payment_method_data: { + card: successfulThreeDSTestCardDetails, + }, + currency: "EUR", + mandate_data: singleUseMandateData, + }, + Response: { + status: 200, + body: { + status: "requires_customer_action", + }, + }, + }, + MandateSingleUseNo3DSAutoCapture: { + Request: { + payment_method: "card", + payment_method_data: { + card: successfulNo3DSCardDetails, + }, + currency: "EUR", + mandate_data: singleUseMandateData, + }, + Response: { + status: 400, + body: { + error: { + type: "invalid_request", + message: "Payment method type not supported", + code: "IR_19", + reason: + "Capture Not allowed in case of Creating the Subscriber is not supported by Paybox", + }, + }, + }, + }, + MandateSingleUseNo3DSManualCapture: { + Request: { + payment_method: "card", + payment_method_data: { + card: successfulNo3DSCardDetails, + }, + currency: "EUR", + mandate_data: singleUseMandateData, + }, + Response: { + status: 200, + body: { + status: "requires_capture", + }, + }, + }, + MandateMultiUseNo3DSAutoCapture: { + Request: { + payment_method: "card", + payment_method_data: { + card: successfulNo3DSCardDetails, + }, + currency: "EUR", + mandate_data: multiUseMandateData, + }, + Response: { + status: 200, + body: { + error: { + type: "invalid_request", + message: "Payment method type not supported", + code: "IR_19", + reason: + "Capture Not allowed in case of Creating the Subscriber is not supported by Paybox", + }, + }, + }, + }, + MandateMultiUseNo3DSManualCapture: { + Request: { + payment_method: "card", + payment_method_data: { + card: successfulNo3DSCardDetails, + }, + currency: "EUR", + mandate_data: multiUseMandateData, + }, + Response: { + status: 200, + body: { + status: "requires_capture", + }, + }, + }, + MandateMultiUse3DSAutoCapture: { + Request: { + payment_method: "card", + payment_method_data: { + card: successfulThreeDSTestCardDetails, + }, + currency: "EUR", + mandate_data: multiUseMandateData, + }, + Response: { + status: 400, + body: { + error: { + type: "invalid_request", + message: "Payment method type not supported", + code: "IR_19", + reason: + "Capture Not allowed in case of Creating the Subscriber is not supported by Paybox", + }, + }, + }, + }, + MandateMultiUse3DSManualCapture: { + Request: { + payment_method: "card", + payment_method_data: { + card: successfulThreeDSTestCardDetails, + }, + currency: "EUR", + mandate_data: multiUseMandateData, + }, + Response: { + status: 200, + body: { + status: "requires_capture", + }, + }, + }, + MITAutoCapture: { + Request: { + currency: "EUR", + amount: 6500, + }, + Response: { + status: 200, + body: { + status: "succeeded", + }, + }, + }, + MITManualCapture: { + Request: { + currency: "EUR", + }, + Response: { + status: 200, + body: { + status: "requires_capture", + }, + }, + }, + PaymentMethodIdMandateNo3DSAutoCapture: { + Request: { + payment_method: "card", + payment_method_data: { + card: successfulNo3DSCardDetails, + }, + currency: "EUR", + mandate_data: null, + customer_acceptance: customerAcceptance, + }, + Response: { + status: 400, + body: { + error: { + type: "invalid_request", + message: "Payment method type not supported", + code: "IR_19", + reason: + "Capture Not allowed in case of Creating the Subscriber is not supported by Paybox", + }, + }, + }, + }, + PaymentMethodIdMandateNo3DSManualCapture: { + Request: { + payment_method: "card", + payment_method_data: { + card: successfulNo3DSCardDetails, + }, + currency: "EUR", + mandate_data: null, + customer_acceptance: customerAcceptance, + }, + Response: { + status: 200, + body: { + status: "requires_capture", + }, + }, + }, + PaymentMethodIdMandate3DSAutoCapture: { + Request: { + payment_method: "card", + payment_method_data: { + card: successfulThreeDSTestCardDetails, + }, + currency: "EUR", + mandate_data: null, + authentication_type: "three_ds", + customer_acceptance: customerAcceptance, + }, + Response: { + status: 400, + body: { + error: { + type: "invalid_request", + message: "Payment method type not supported", + code: "IR_19", + reason: + "Capture Not allowed in case of Creating the Subscriber is not supported by Paybox", + }, + }, + }, + }, + PaymentMethodIdMandate3DSManualCapture: { + Request: { + payment_method: "card", + payment_method_data: { + card: successfulThreeDSTestCardDetails, + }, + mandate_data: null, + authentication_type: "three_ds", + customer_acceptance: customerAcceptance, + }, + Response: { + status: 200, + body: { + status: "requires_customer_action", + }, + }, + }, + ZeroAuthMandate: { + Request: { + payment_method: "card", + payment_method_data: { + card: successfulNo3DSCardDetails, + }, + currency: "EUR", + mandate_data: singleUseMandateData, + }, + Response: { + status: 200, + body: { + status: "processing", + }, + }, + }, + ZeroAuthPaymentIntent: { + Request: { + amount: 0, + setup_future_usage: "off_session", + currency: "EUR", + }, + Response: { + status: 200, + body: { + status: "requires_payment_method", + setup_future_usage: "off_session", + }, + }, + }, + ZeroAuthConfirmPayment: { + Request: { + payment_type: "setup_mandate", + payment_method: "card", + payment_method_type: "credit", + payment_method_data: { + card: successfulNo3DSCardDetails, + }, + }, + Response: { + status: 200, + body: { + status: "processing", + }, + }, + }, + SaveCardUseNo3DSAutoCapture: { + Request: { + payment_method: "card", + payment_method_type: "debit", + payment_method_data: { + card: successfulNo3DSCardDetails, + }, + currency: "EUR", + setup_future_usage: "on_session", + customer_acceptance: customerAcceptance, + }, + Response: { + status: 200, + body: { + status: "succeeded", + }, + }, + }, + SaveCardUseNo3DSAutoCaptureOffSession: { + Request: { + payment_method: "card", + payment_method_type: "debit", + payment_method_data: { + card: successfulNo3DSCardDetails, + }, + setup_future_usage: "off_session", + customer_acceptance: customerAcceptance, + }, + Response: { + status: 400, + body: { + error: { + type: "invalid_request", + message: "Payment method type not supported", + code: "IR_19", + reason: + "Capture Not allowed in case of Creating the Subscriber is not supported by Paybox", + }, + }, + }, + }, + SaveCardUseNo3DSManualCaptureOffSession: { + Request: { + payment_method: "card", + payment_method_type: "debit", + payment_method_data: { + card: successfulNo3DSCardDetails, + }, + setup_future_usage: "off_session", + customer_acceptance: customerAcceptance, + }, + Response: { + status: 200, + body: { + status: "requires_capture", + }, + }, + }, + SaveCardConfirmAutoCaptureOffSession: { + Request: { + setup_future_usage: "off_session", + }, + Response: { + status: 200, + body: { + status: "succeeded", + }, + }, + }, + SaveCardConfirmManualCaptureOffSession: { + Request: { + setup_future_usage: "off_session", + }, + Response: { + status: 200, + body: { + status: "requires_capture", + }, + }, + }, + SaveCardUseNo3DSManualCapture: { + Request: { + payment_method: "card", + payment_method_data: { + card: successfulNo3DSCardDetails, + }, + currency: "EUR", + setup_future_usage: "on_session", + customer_acceptance: customerAcceptance, + }, + Response: { + status: 200, + body: { + status: "requires_capture", + }, + }, + }, InvalidCardNumber: { Request: { currency: "EUR", diff --git a/cypress-tests/cypress/e2e/PaymentUtils/Stripe.js b/cypress-tests/cypress/e2e/PaymentUtils/Stripe.js index 98af56b882c6..984fe63b2fbe 100644 --- a/cypress-tests/cypress/e2e/PaymentUtils/Stripe.js +++ b/cypress-tests/cypress/e2e/PaymentUtils/Stripe.js @@ -448,6 +448,24 @@ export const connectorDetails = { }, }, }, + MITAutoCapture: { + Request: {}, + Response: { + status: 200, + body: { + status: "succeeded", + }, + }, + }, + MITManualCapture: { + Request: {}, + Response: { + status: 200, + body: { + status: "requires_capture", + }, + }, + }, ZeroAuthMandate: { Request: { payment_method: "card", diff --git a/cypress-tests/cypress/e2e/PaymentUtils/WellsFargo.js b/cypress-tests/cypress/e2e/PaymentUtils/WellsFargo.js index b25a6dc7e8bf..608343f1083d 100644 --- a/cypress-tests/cypress/e2e/PaymentUtils/WellsFargo.js +++ b/cypress-tests/cypress/e2e/PaymentUtils/WellsFargo.js @@ -362,6 +362,24 @@ export const connectorDetails = { }, }, }, + MITAutoCapture: { + Request: {}, + Response: { + status: 200, + body: { + status: "succeeded", + }, + }, + }, + MITManualCapture: { + Request: {}, + Response: { + status: 200, + body: { + status: "requires_capture", + }, + }, + }, ZeroAuthMandate: { Request: { payment_method: "card", diff --git a/cypress-tests/cypress/support/commands.js b/cypress-tests/cypress/support/commands.js index 48a62fb4388b..17c2270efef6 100644 --- a/cypress-tests/cypress/support/commands.js +++ b/cypress-tests/cypress/support/commands.js @@ -1926,7 +1926,18 @@ Cypress.Commands.add( Cypress.Commands.add( "mitForMandatesCallTest", - (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; @@ -1966,10 +1977,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], [key]).to.equal(response.body[key]); + } } else if (response.body.authentication_type === "no_three_ds") { - if (response.body.connector === "fiuu") { - expect(response.body.status).to.equal("failed"); - } + for (const key in res_data.body) { + expect(res_data.body[key], [key]).to.equal(response.body[key]); + } } else { throw new Error( `Invalid authentication type ${response.body.authentication_type}` @@ -1982,11 +1996,12 @@ 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], [key]).to.equal(response.body[key]); + } } else if (response.body.authentication_type === "no_three_ds") { - if (response.body.connector === "fiuu") { - expect(response.body.status).to.equal("failed"); - } else { - expect(response.body.status).to.equal("requires_capture"); + for (const key in res_data.body) { + expect(res_data.body[key], [key]).to.equal(response.body[key]); } } else { throw new Error( @@ -2009,9 +2024,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); } }); } @@ -2019,7 +2032,18 @@ Cypress.Commands.add( Cypress.Commands.add( "mitUsingPMId", - (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; @@ -2046,10 +2070,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], [key]).to.equal(response.body[key]); + } } else if (response.body.authentication_type === "no_three_ds") { - if (response.body.connector === "fiuu") { - expect(response.body.status).to.equal("failed"); - } + for (const key in res_data.body) { + expect(res_data.body[key], [key]).to.equal(response.body[key]); + } } else { throw new Error( `Invalid authentication type ${response.body.authentication_type}` @@ -2062,11 +2089,12 @@ 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], [key]).to.equal(response.body[key]); + } } else if (response.body.authentication_type === "no_three_ds") { - if (response.body.connector === "fiuu") { - expect(response.body.status).to.equal("failed"); - } else { - expect(response.body.status).to.equal("requires_capture"); + for (const key in res_data.body) { + expect(res_data.body[key], [key]).to.equal(response.body[key]); } } else { throw new Error( @@ -2079,9 +2107,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); } }); } @@ -2089,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; @@ -2127,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], [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], [key]).to.equal(response.body[key]); + } } else { throw new Error( `Invalid authentication type ${response.body.authentication_type}` @@ -2141,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], [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], [key]).to.equal(response.body[key]); + } } else { throw new Error( `Invalid authentication type ${response.body.authentication_type}` @@ -2154,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); } }); }