diff --git a/cypress-tests/cypress/e2e/PaymentTest/00017-BankRedirect.cy.js b/cypress-tests/cypress/e2e/PaymentTest/00017-BankRedirect.cy.js index 921ab856bbd..85a63ca008c 100644 --- a/cypress-tests/cypress/e2e/PaymentTest/00017-BankRedirect.cy.js +++ b/cypress-tests/cypress/e2e/PaymentTest/00017-BankRedirect.cy.js @@ -27,7 +27,7 @@ describe("Bank Redirect tests", () => { it("create-payment-call-test", () => { let data = getConnectorDetails(globalState.get("connectorId"))[ "bank_redirect_pm" - ]["blikPaymentIntent"]; + ]["BlikPaymentIntent"]; let req_data = data["Request"]; let res_data = data["Response"]; cy.createPaymentIntentTest( @@ -49,7 +49,7 @@ describe("Bank Redirect tests", () => { it("Confirm bank redirect", () => { let data = getConnectorDetails(globalState.get("connectorId"))[ "bank_redirect_pm" - ]["blik"]; + ]["Blik"]; let req_data = data["Request"]; let res_data = data["Response"]; cy.confirmBankRedirectCallTest( @@ -104,7 +104,7 @@ describe("Bank Redirect tests", () => { it("Confirm bank redirect", () => { let data = getConnectorDetails(globalState.get("connectorId"))[ "bank_redirect_pm" - ]["eps"]; + ]["Eps"]; let req_data = data["Request"]; let res_data = data["Response"]; cy.confirmBankRedirectCallTest( @@ -170,7 +170,7 @@ describe("Bank Redirect tests", () => { it("Confirm bank redirect", () => { let data = getConnectorDetails(globalState.get("connectorId"))[ "bank_redirect_pm" - ]["ideal"]; + ]["Ideal"]; let req_data = data["Request"]; let res_data = data["Response"]; cy.confirmBankRedirectCallTest( @@ -235,7 +235,7 @@ describe("Bank Redirect tests", () => { it("Confirm bank redirect", () => { let data = getConnectorDetails(globalState.get("connectorId"))[ "bank_redirect_pm" - ]["giropay"]; + ]["Giropay"]; let req_data = data["Request"]; let res_data = data["Response"]; cy.confirmBankRedirectCallTest( @@ -300,7 +300,7 @@ describe("Bank Redirect tests", () => { it("Confirm bank redirect", () => { let data = getConnectorDetails(globalState.get("connectorId"))[ "bank_redirect_pm" - ]["sofort"]; + ]["Sofort"]; let req_data = data["Request"]; let res_data = data["Response"]; cy.confirmBankRedirectCallTest( @@ -365,7 +365,7 @@ describe("Bank Redirect tests", () => { it("Confirm bank redirect", () => { let data = getConnectorDetails(globalState.get("connectorId"))[ "bank_redirect_pm" - ]["przelewy24"]; + ]["Przelewy24"]; let req_data = data["Request"]; let res_data = data["Response"]; cy.confirmBankRedirectCallTest( diff --git a/cypress-tests/cypress/e2e/PaymentTest/00020-Variations.cy.js b/cypress-tests/cypress/e2e/PaymentTest/00020-Variations.cy.js index b413f0d0d0f..b96121a0520 100644 --- a/cypress-tests/cypress/e2e/PaymentTest/00020-Variations.cy.js +++ b/cypress-tests/cypress/e2e/PaymentTest/00020-Variations.cy.js @@ -15,7 +15,7 @@ describe("Corner cases", () => { ); }); - context("[Payment] [Payment create] Invalid Card Info", () => { + context("[Payment] Invalid Info", () => { before("seed global state", () => { cy.task("getGlobalState").then((state) => { globalState = new State(state); @@ -26,9 +26,9 @@ describe("Corner cases", () => { cy.task("setGlobalState", globalState.data); }); - it("[Payment create] Invalid card number", () => { + it("[Payment] Invalid card number", () => { let data = getConnectorDetails(globalState.get("commons"))["card_pm"][ - "invalidCardNumber" + "InvalidCardNumber" ]; let req_data = data["Request"]; let res_data = data["Response"]; @@ -43,9 +43,9 @@ describe("Corner cases", () => { ); }); - it("[Payment create] Invalid expiry month", () => { + it("[Payment] Invalid expiry month", () => { let data = getConnectorDetails(globalState.get("commons"))["card_pm"][ - "invalidExpiryMonth" + "InvalidExpiryMonth" ]; let req_data = data["Request"]; let res_data = data["Response"]; @@ -60,9 +60,9 @@ describe("Corner cases", () => { ); }); - it("[Payment create] Invalid expiry year", () => { + it("[Payment] Invalid expiry year", () => { let data = getConnectorDetails(globalState.get("commons"))["card_pm"][ - "invalidExpiryYear" + "InvalidExpiryYear" ]; let req_data = data["Request"]; let res_data = data["Response"]; @@ -77,9 +77,94 @@ describe("Corner cases", () => { ); }); - it("[Payment create] Invalid card CVV", () => { + it("[Payment] Invalid card CVV", () => { let data = getConnectorDetails(globalState.get("commons"))["card_pm"][ - "invalidCardCvv" + "InvalidCardCvv" + ]; + let req_data = data["Request"]; + let res_data = data["Response"]; + + cy.createConfirmPaymentTest( + paymentIntentBody, + req_data, + res_data, + "three_ds", + "automatic", + globalState + ); + }); + + it("[Payment] Invalid currency", () => { + let data = getConnectorDetails(globalState.get("commons"))["card_pm"][ + "InvalidCurrency" + ]; + let req_data = data["Request"]; + let res_data = data["Response"]; + + cy.createConfirmPaymentTest( + paymentIntentBody, + req_data, + res_data, + "three_ds", + "automatic", + globalState + ); + }); + + it("[Payment] Invalid capture method", () => { + let data = getConnectorDetails(globalState.get("commons"))["card_pm"][ + "InvalidCaptureMethod" + ]; + let req_data = data["Request"]; + let res_data = data["Response"]; + + cy.createConfirmPaymentTest( + paymentIntentBody, + req_data, + res_data, + "three_ds", + "automatic", + globalState + ); + }); + + it("[Payment] Invalid payment method", () => { + let data = getConnectorDetails(globalState.get("commons"))["card_pm"][ + "InvalidPaymentMethod" + ]; + let req_data = data["Request"]; + let res_data = data["Response"]; + + cy.createConfirmPaymentTest( + paymentIntentBody, + req_data, + res_data, + "three_ds", + "automatic", + globalState + ); + }); + + it("[Payment] Invalid `amount_to_capture`", () => { + let data = getConnectorDetails(globalState.get("commons"))["card_pm"][ + "InvalidAmountToCapture" + ]; + let req_data = data["Request"]; + let res_data = data["Response"]; + + cy.createConfirmPaymentTest( + paymentIntentBody, + req_data, + res_data, + "three_ds", + "automatic", + globalState + ); + }); + + it("[Payment] Missing required params", () => { + let data = getConnectorDetails(globalState.get("commons"))["card_pm"][ + "MissingRequiredParam" ]; let req_data = data["Request"]; let res_data = data["Response"]; @@ -159,7 +244,7 @@ describe("Corner cases", () => { } }); - it("Create payment intent", () => { + it("Create payment intent and confirm", () => { let data = getConnectorDetails(globalState.get("connectorId"))["card_pm"][ "No3DSManualCapture" ]; @@ -220,7 +305,7 @@ describe("Corner cases", () => { } }); - it("Create payment intent", () => { + it("Create payment intent and confirm", () => { let data = getConnectorDetails(globalState.get("connectorId"))["card_pm"][ "No3DSAutoCapture" ]; @@ -266,6 +351,70 @@ describe("Corner cases", () => { }); }); + context("[Payment] Confirm successful payment", () => { + let should_continue = 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 (!should_continue) { + this.skip(); + } + }); + + it("Create payment intent and confirm", () => { + let data = getConnectorDetails(globalState.get("connectorId"))["card_pm"][ + "No3DSAutoCapture" + ]; + + let req_data = data["Request"]; + let res_data = data["Response"]; + + cy.createConfirmPaymentTest( + paymentCreateConfirmBody, + req_data, + res_data, + "no_three_ds", + "automatic", + globalState + ); + + if (should_continue) + should_continue = utils.should_continue_further(res_data); + }); + + it("Retrieve payment", () => { + cy.retrievePaymentCallTest(globalState); + }); + + it("Confirm call", () => { + let data = getConnectorDetails(globalState.get("commons"))["card_pm"][ + "ConfirmSuccessfulPayment" + ]; + let req_data = data["Request"]; + let res_data = data["Response"]; + + cy.confirmCallTest( + fixtures.confirmBody, + req_data, + res_data, + true, + globalState + ); + + if (should_continue) + should_continue = utils.should_continue_further(res_data); + }); + }); + context("[Payment] Void successful payment", () => { let should_continue = true; // variable that will be used to skip tests if a previous test fails @@ -285,7 +434,7 @@ describe("Corner cases", () => { } }); - it("Create payment intent", () => { + it("Create payment intent and confirm", () => { let data = getConnectorDetails(globalState.get("connectorId"))["card_pm"][ "No3DSAutoCapture" ]; @@ -311,15 +460,287 @@ describe("Corner cases", () => { }); it("Void call", () => { + // `commons` here is intentionally used as we need to pass `ResponseCustom` + let data = getConnectorDetails(globalState.get("commons"))["card_pm"][ + "Void" + ]; + let req_data = data["Request"]; + let res_data = data["ResponseCustom"]; + cy.voidCallTest(fixtures.voidBody, req_data, res_data, globalState); + + if (should_continue) + should_continue = utils.should_continue_further(res_data); + }); + }); + + context("[Payment] 3DS with greater capture", () => { + let should_continue = 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 (!should_continue) { + this.skip(); + } + }); + + it("Create payment intent and confirm", () => { let data = getConnectorDetails(globalState.get("connectorId"))["card_pm"][ - "VoidErrored" + "3DSManualCapture" ]; + let req_data = data["Request"]; let res_data = data["Response"]; - cy.voidCallTest(fixtures.voidBody, req_data, res_data, globalState); + + cy.createConfirmPaymentTest( + paymentCreateConfirmBody, + req_data, + res_data, + "three_ds", + "manual", + globalState + ); if (should_continue) should_continue = utils.should_continue_further(res_data); }); + + it("Retrieve payment", () => { + cy.retrievePaymentCallTest(globalState); + }); + + it("Handle redirection", () => { + let expected_redirection = fixtures.confirmBody["return_url"]; + cy.handleRedirection(globalState, expected_redirection); + }); + + it("Retrieve payment", () => { + cy.retrievePaymentCallTest(globalState); + }); + + it("Capture call", () => { + let data = getConnectorDetails(globalState.get("commons"))["card_pm"][ + "CaptureGreaterAmount" + ]; + + let req_data = data["Request"]; + let res_data = data["Response"]; + + cy.captureCallTest( + fixtures.captureBody, + req_data, + res_data, + 65000, + globalState + ); + + if (should_continue) + should_continue = utils.should_continue_further(res_data); + }); + }); + + context("[Payment] Refund exceeds captured Amount", () => { + let should_continue = 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 (!should_continue) { + this.skip(); + } + }); + + it("Create payment intent and confirm", () => { + let data = getConnectorDetails(globalState.get("connectorId"))["card_pm"][ + "No3DSAutoCapture" + ]; + + let req_data = data["Request"]; + let res_data = data["Response"]; + + cy.createConfirmPaymentTest( + paymentCreateConfirmBody, + req_data, + res_data, + "no_three_ds", + "automatic", + globalState + ); + + if (should_continue) + should_continue = utils.should_continue_further(res_data); + }); + + it("Retrieve payment", () => { + cy.retrievePaymentCallTest(globalState); + }); + + it("Refund call", () => { + // `commons` here is intentionally used as we need to pass `ResponseCustom` + let data = getConnectorDetails(globalState.get("commons"))["card_pm"][ + "Refund" + ]; + let req_data = data["Request"]; + let res_data = data["ResponseCustom"]; + cy.refundCallTest( + fixtures.refundBody, + req_data, + res_data, + 65000, + globalState + ); + if (should_continue) + should_continue = utils.should_continue_further(res_data); + }); + }); + + context("[Payment] Refund unsuccessful payment", () => { + let should_continue = 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 (!should_continue) { + this.skip(); + } + }); + + it("Create payment intent and confirm", () => { + let data = getConnectorDetails(globalState.get("connectorId"))["card_pm"][ + "No3DSAutoCapture" + ]; + + let req_data = data["Request"]; + let res_data = data["Response"]; + + cy.createConfirmPaymentTest( + paymentCreateConfirmBody, + req_data, + res_data, + "no_three_ds", + "automatic", + globalState + ); + + if (should_continue) + should_continue = utils.should_continue_further(res_data); + }); + + it("Retrieve payment", () => { + cy.retrievePaymentCallTest(globalState); + }); + + it("Refund call", () => { + // `commons` here is intentionally used as we need to pass `ResponseCustom` + let data = getConnectorDetails(globalState.get("commons"))["card_pm"][ + "Refund" + ]; + let req_data = data["Request"]; + let res_data = data["ResponseCustom"]; + cy.refundCallTest( + fixtures.refundBody, + req_data, + res_data, + 65000, + globalState + ); + if (should_continue) + should_continue = utils.should_continue_further(res_data); + }); + }); + + context("[Payment] Recurring mandate with greater mandate amount", () => { + let should_continue = 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 (!should_continue) { + this.skip(); + } + }); + + it("No 3DS CIT", () => { + let data = getConnectorDetails(globalState.get("connectorId"))["card_pm"][ + "MandateSingleUseNo3DSManualCapture" + ]; + let req_data = data["Request"]; + let res_data = data["Response"]; + cy.citForMandatesCallTest( + fixtures.citConfirmBody, + req_data, + res_data, + 6500, + true, + "manual", + "new_mandate", + globalState + ); + if (should_continue) + should_continue = utils.should_continue_further(res_data); + }); + + it("cit-capture-call-test", () => { + let data = getConnectorDetails(globalState.get("connectorId"))["card_pm"][ + "Capture" + ]; + let req_data = data["Request"]; + let res_data = data["Response"]; + cy.captureCallTest( + fixtures.captureBody, + req_data, + res_data, + 6500, + globalState + ); + if (should_continue) + should_continue = utils.should_continue_further(res_data); + }); + + it("Retrieve payment", () => { + cy.retrievePaymentCallTest(globalState); + }); + + it("Confirm No 3DS MIT", () => { + cy.mitForMandatesCallTest( + fixtures.mitConfirmBody, + 65000, + true, + "manual", + globalState + ); + }); }); }); diff --git a/cypress-tests/cypress/e2e/PaymentUtils/Adyen.js b/cypress-tests/cypress/e2e/PaymentUtils/Adyen.js index 92c21497b76..526764b2b3d 100644 --- a/cypress-tests/cypress/e2e/PaymentUtils/Adyen.js +++ b/cypress-tests/cypress/e2e/PaymentUtils/Adyen.js @@ -561,7 +561,7 @@ export const connectorDetails = { }, }, }), - ideal: { + Ideal: { Request: { payment_method: "bank_redirect", payment_method_type: "ideal", @@ -597,7 +597,7 @@ export const connectorDetails = { }, }, }, - giropay: { + Giropay: { Request: { payment_method: "bank_redirect", payment_method_type: "giropay", @@ -635,7 +635,7 @@ export const connectorDetails = { }, }, }, - sofort: { + Sofort: { Request: { payment_method: "bank_redirect", payment_method_type: "sofort", @@ -671,7 +671,7 @@ export const connectorDetails = { }, }, }, - eps: { + Eps: { Request: { payment_method: "bank_redirect", payment_method_type: "eps", @@ -707,7 +707,7 @@ export const connectorDetails = { }, }, }, - blik: { + Blik: { Request: { payment_method: "bank_redirect", payment_method_type: "blik", diff --git a/cypress-tests/cypress/e2e/PaymentUtils/Commons.js b/cypress-tests/cypress/e2e/PaymentUtils/Commons.js index 68c8fa61fc4..735c523fe99 100644 --- a/cypress-tests/cypress/e2e/PaymentUtils/Commons.js +++ b/cypress-tests/cypress/e2e/PaymentUtils/Commons.js @@ -128,6 +128,9 @@ export const getCustomExchange = (overrides) => { ...defaultExchange.Response, ...(overrides.Response || {}), }, + ...(overrides.ResponseCustom + ? { ResponseCustom: overrides.ResponseCustom } + : {}), }; }; @@ -383,7 +386,7 @@ export const connectorDetails = { }, }, }), - ideal: getCustomExchange({ + Ideal: getCustomExchange({ Request: { payment_method: "bank_redirect", payment_method_type: "ideal", @@ -410,7 +413,7 @@ export const connectorDetails = { }, }, }), - giropay: getCustomExchange({ + Giropay: getCustomExchange({ Request: { payment_method: "bank_redirect", payment_method_type: "giropay", @@ -440,7 +443,7 @@ export const connectorDetails = { }, }, }), - sofort: getCustomExchange({ + Sofort: getCustomExchange({ Request: { payment_method: "bank_redirect", payment_method_type: "sofort", @@ -467,7 +470,7 @@ export const connectorDetails = { }, }, }), - eps: getCustomExchange({ + Eps: getCustomExchange({ Request: { payment_method: "bank_redirect", payment_method_type: "eps", @@ -493,7 +496,7 @@ export const connectorDetails = { }, }, }), - przelewy24: getCustomExchange({ + Przelewy24: getCustomExchange({ Request: { payment_method: "bank_redirect", payment_method_type: "przelewy24", @@ -509,7 +512,7 @@ export const connectorDetails = { }, }, }), - blikPaymentIntent: getCustomExchange({ + BlikPaymentIntent: getCustomExchange({ Request: { currency: "PLN", }, @@ -520,7 +523,7 @@ export const connectorDetails = { }, }, }), - blik: getCustomExchange({ + Blik: getCustomExchange({ Request: { payment_method: "bank_redirect", payment_method_type: "blik", @@ -625,6 +628,17 @@ export const connectorDetails = { capture_method: "manual", }, }, + ResponseCustom: { + status: 400, + body: { + error: { + type: "invalid_request", + message: + "You cannot cancel this payment because it has status succeeded", + code: "IR_16", + }, + }, + }, }), Refund: getCustomExchange({ Request: { @@ -635,6 +649,16 @@ export const connectorDetails = { currency: "USD", customer_acceptance: null, }, + ResponseCustom: { + status: 400, + body: { + error: { + type: "invalid_request", + message: "The refund amount exceeds the amount captured", + code: "IR_13", + }, + }, + }, }), PartialRefund: getCustomExchange({ Request: { @@ -855,7 +879,7 @@ export const connectorDetails = { }, }, }), - invalidCardNumber: { + InvalidCardNumber: { Request: { currency: "USD", payment_method: "card", @@ -878,7 +902,7 @@ export const connectorDetails = { }, }, }, - invalidExpiryMonth: { + InvalidExpiryMonth: { Request: { currency: "USD", payment_method: "card", @@ -905,7 +929,7 @@ export const connectorDetails = { }, }, }, - invalidExpiryYear: { + InvalidExpiryYear: { Request: { currency: "USD", payment_method: "card", @@ -932,7 +956,7 @@ export const connectorDetails = { }, }, }, - invalidCardCvv: { + InvalidCardCvv: { Request: { currency: "USD", payment_method: "card", @@ -959,6 +983,134 @@ export const connectorDetails = { }, }, }, + InvalidCurrency: { + Request: { + currency: "United", + payment_method: "card", + payment_method_type: "debit", + setup_future_usage: "on_session", + payment_method_data: { + card: { + card_number: "4242424242424242", + card_exp_month: "01", + card_exp_year: "2023", + card_holder_name: "joseph Doe", + card_cvc: "123456", + }, + }, + }, + Response: { + status: 400, + body: { + error: + "Json deserialize error: unknown variant `United`, expected one of `AED`, `ALL`, `AMD`, `ANG`, `AOA`, `ARS`, `AUD`, `AWG`, `AZN`, `BAM`, `BBD`, `BDT`, `BGN`, `BHD`, `BIF`, `BMD`, `BND`, `BOB`, `BRL`, `BSD`, `BWP`, `BYN`, `BZD`, `CAD`, `CHF`, `CLP`, `CNY`, `COP`, `CRC`, `CUP`, `CVE`, `CZK`, `DJF`, `DKK`, `DOP`, `DZD`, `EGP`, `ETB`, `EUR`, `FJD`, `FKP`, `GBP`, `GEL`, `GHS`, `GIP`, `GMD`, `GNF`, `GTQ`, `GYD`, `HKD`, `HNL`, `HRK`, `HTG`, `HUF`, `IDR`, `ILS`, `INR`, `IQD`, `JMD`, `JOD`, `JPY`, `KES`, `KGS`, `KHR`, `KMF`, `KRW`, `KWD`, `KYD`, `KZT`, `LAK`, `LBP`, `LKR`, `LRD`, `LSL`, `LYD`, `MAD`, `MDL`, `MGA`, `MKD`, `MMK`, `MNT`, `MOP`, `MRU`, `MUR`, `MVR`, `MWK`, `MXN`, `MYR`, `MZN`, `NAD`, `NGN`, `NIO`, `NOK`, `NPR`, `NZD`, `OMR`, `PAB`, `PEN`, `PGK`, `PHP`, `PKR`, `PLN`, `PYG`, `QAR`, `RON`, `RSD`, `RUB`, `RWF`, `SAR`, `SBD`, `SCR`, `SEK`, `SGD`, `SHP`, `SLE`, `SLL`, `SOS`, `SRD`, `SSP`, `STN`, `SVC`, `SZL`, `THB`, `TND`, `TOP`, `TRY`, `TTD`, `TWD`, `TZS`, `UAH`, `UGX`, `USD`, `UYU`, `UZS`, `VES`, `VND`, `VUV`, `WST`, `XAF`, `XCD`, `XOF`, `XPF`, `YER`, `ZAR`, `ZMW`", + }, + }, + }, + InvalidCaptureMethod: { + Request: { + currency: "USD", + capture_method: "auto", + payment_method: "card", + payment_method_type: "debit", + setup_future_usage: "on_session", + payment_method_data: { + card: { + card_number: "4242424242424242", + card_exp_month: "01", + card_exp_year: "2023", + card_holder_name: "joseph Doe", + card_cvc: "123456", + }, + }, + }, + Response: { + status: 400, + body: { + error: + "Json deserialize error: unknown variant `auto`, expected one of `automatic`, `manual`, `manual_multiple`, `scheduled`", + }, + }, + }, + InvalidPaymentMethod: { + Request: { + currency: "USD", + payment_method: "this_supposed_to_be_a_card", + payment_method_type: "debit", + setup_future_usage: "on_session", + payment_method_data: { + card: { + card_number: "4242424242424242", + card_exp_month: "01", + card_exp_year: "2023", + card_holder_name: "joseph Doe", + card_cvc: "123456", + }, + }, + }, + Response: { + status: 400, + body: { + error: + "Json deserialize error: unknown variant `this_supposed_to_be_a_card`, expected one of `card`, `card_redirect`, `pay_later`, `wallet`, `bank_redirect`, `bank_transfer`, `crypto`, `bank_debit`, `reward`, `real_time_payment`, `upi`, `voucher`, `gift_card`, `open_banking`", + }, + }, + }, + InvalidAmountToCapture: { + Request: { + currency: "USD", + amount_to_capture: 10000, + payment_method: "card", + payment_method_type: "debit", + setup_future_usage: "on_session", + payment_method_data: { + card: { + card_number: "4242424242424242", + card_exp_month: "01", + card_exp_year: "2026", + card_holder_name: "joseph Doe", + card_cvc: "123", + }, + }, + }, + Response: { + status: 400, + body: { + error: { + type: "invalid_request", + message: + "amount_to_capture contains invalid data. Expected format is amount_to_capture lesser than amount", + code: "IR_05", + }, + }, + }, + }, + MissingRequiredParam: { + Request: { + currency: "USD", + payment_method_type: "debit", + setup_future_usage: "on_session", + payment_method_data: { + card: { + card_number: "4242424242424242", + card_exp_month: "01", + card_exp_year: "2026", + card_holder_name: "joseph Doe", + card_cvc: "123", + }, + }, + }, + Response: { + status: 400, + body: { + error: { + type: "invalid_request", + message: "Missing required param: payment_method", + code: "IR_04", + }, + }, + }, + }, PaymentIntentErrored: { Request: { currency: "USD", @@ -996,7 +1148,7 @@ export const connectorDetails = { }, }, }, - CaptureCapturedAmount: { + CaptureCapturedAmount: getCustomExchange({ Request: { Request: { payment_method: "card", @@ -1018,15 +1170,23 @@ export const connectorDetails = { }, }, }, - }, - VoidErrored: getCustomExchange({ + }), + ConfirmSuccessfulPayment: getCustomExchange({ + Request: { + payment_method: "card", + payment_method_data: { + card: successfulNo3DSCardDetails, + }, + currency: "USD", + customer_acceptance: null, + }, Response: { status: 400, body: { error: { type: "invalid_request", message: - "You cannot cancel this payment because it has status succeeded", + "You cannot confirm this payment because it has status succeeded", code: "IR_16", }, }, diff --git a/cypress-tests/cypress/e2e/PaymentUtils/Paypal.js b/cypress-tests/cypress/e2e/PaymentUtils/Paypal.js index 0471a742715..80d9e3e96b2 100644 --- a/cypress-tests/cypress/e2e/PaymentUtils/Paypal.js +++ b/cypress-tests/cypress/e2e/PaymentUtils/Paypal.js @@ -266,7 +266,7 @@ export const connectorDetails = { }, }, }), - ideal: { + Ideal: { Request: { payment_method: "bank_redirect", payment_method_type: "ideal", @@ -302,7 +302,7 @@ export const connectorDetails = { }, }, }, - giropay: { + Giropay: { Request: { payment_method: "bank_redirect", payment_method_type: "giropay", @@ -341,7 +341,7 @@ export const connectorDetails = { }, }, }, - sofort: { + Sofort: { Request: { payment_method: "bank_redirect", payment_method_type: "sofort", @@ -378,7 +378,7 @@ export const connectorDetails = { }, }, }, - eps: { + Eps: { Request: { payment_method: "bank_redirect", payment_method_type: "eps", diff --git a/cypress-tests/cypress/e2e/PaymentUtils/Stripe.js b/cypress-tests/cypress/e2e/PaymentUtils/Stripe.js index ddbf47f2103..f289f6fc698 100644 --- a/cypress-tests/cypress/e2e/PaymentUtils/Stripe.js +++ b/cypress-tests/cypress/e2e/PaymentUtils/Stripe.js @@ -527,7 +527,7 @@ export const connectorDetails = { }, }, }), - ideal: { + Ideal: { Request: { payment_method: "bank_redirect", payment_method_type: "ideal", @@ -563,7 +563,7 @@ export const connectorDetails = { }, }, }, - giropay: { + Giropay: { Request: { payment_method: "bank_redirect", payment_method_type: "giropay", @@ -600,7 +600,7 @@ export const connectorDetails = { }, }, }, - sofort: { + Sofort: { Request: { payment_method: "bank_redirect", payment_method_type: "sofort", @@ -634,7 +634,7 @@ export const connectorDetails = { }, }, }, - eps: { + Eps: { Request: { payment_method: "bank_redirect", payment_method_type: "eps", @@ -670,7 +670,7 @@ export const connectorDetails = { }, }, }, - blik: { + Blik: { Request: { payment_method: "bank_redirect", payment_method_type: "blik", @@ -690,7 +690,7 @@ export const connectorDetails = { }, }, }, - przelewy24: { + Przelewy24: { Request: { payment_method: "bank_redirect", payment_method_type: "przelewy24", diff --git a/cypress-tests/cypress/e2e/PaymentUtils/Trustpay.js b/cypress-tests/cypress/e2e/PaymentUtils/Trustpay.js index 31a1d76a89c..3afc666d330 100644 --- a/cypress-tests/cypress/e2e/PaymentUtils/Trustpay.js +++ b/cypress-tests/cypress/e2e/PaymentUtils/Trustpay.js @@ -255,7 +255,7 @@ export const connectorDetails = { }, }, }), - ideal: { + Ideal: { Request: { payment_method: "bank_redirect", payment_method_type: "ideal", @@ -291,7 +291,7 @@ export const connectorDetails = { }, }, }, - giropay: { + Giropay: { Request: { payment_method: "bank_redirect", payment_method_type: "giropay", @@ -329,7 +329,7 @@ export const connectorDetails = { }, }, }, - sofort: { + Sofort: { Request: { payment_method: "bank_redirect", payment_method_type: "sofort", @@ -364,7 +364,7 @@ export const connectorDetails = { }, }, }, - eps: { + Eps: { Request: { payment_method: "bank_redirect", payment_method_type: "eps", @@ -400,7 +400,7 @@ export const connectorDetails = { }, }, }, - blik: { + Blik: { Request: { payment_method: "bank_redirect", payment_method_type: "blik", diff --git a/cypress-tests/cypress/support/commands.js b/cypress-tests/cypress/support/commands.js index fe263807190..9c565d2d8de 100644 --- a/cypress-tests/cypress/support/commands.js +++ b/cypress-tests/cypress/support/commands.js @@ -1214,6 +1214,16 @@ Cypress.Commands.add( `Invalid capture method ${response.body.capture_method}` ); } + } else if (response.status === 400) { + if (response.body.error.message === "Mandate Validation Failed") { + expect(response.body.error.code).to.equal("HE_03"); + expect(response.body.error.message).to.equal( + "Mandate Validation Failed" + ); + expect(response.body.error.reason).to.equal( + "request amount is greater than mandate amount" + ); + } } else { throw new Error( `Error Response: ${response.status}\n${response.body.error.message}\n${response.body.error.code}`