Open source, composable payments platform | PCI compliant | SaaS and Self-host options | Enables connectivity to multiple payment, payout, fraud, vault and tokenization providers | Uplifts authorization with intelligent routing and revenue recovery | Reduce payment processing costs with cost observability | Reduces payment ops with reconciliation
Rust adyenbeginner-friendlyfeaturedfinancefintechhacktoberfesthigh-performanceopen-sourceorchestrationpaymentpayment-gatewaypayment-integrationpayment-processingpaymentspayments-platformrestful-apirustsdkstripeworks-with-react
test(cypress): add Klarna PayLater mandate test cases for Adyen connector (#13280)
likhinbopanna5c3fdb197bcf
diff --git a/cypress-tests/cypress/e2e/configs/Payment/Adyen.js b/cypress-tests/cypress/e2e/configs/Payment/Adyen.jsindex 5356467b67..3e31b8bb13 100644--- a/cypress-tests/cypress/e2e/configs/Payment/Adyen.js+++ b/cypress-tests/cypress/e2e/configs/Payment/Adyen.js@@ -2016,6 +2016,50 @@ export const connectorDetails = {},},}),+ KlarnaMandateAutoCapture: getCustomExchange({+ Request: {+ payment_method: "pay_later",+ payment_method_type: "klarna",+ payment_experience: "redirect_to_url",+ payment_method_data: {+ pay_later: {+ klarna_redirect: {+ billing_email: "[email protected]",+ billing_country: "DE",+ },+ },+ },+ setup_future_usage: "off_session",+ customer_acceptance: customerAcceptance,+ billing: {+ email: "[email protected]",+ address: {+ line1: "1467",+ line2: "Harrison Street",+ line3: "Harrison Street",+ city: "San Fransico",+ state: "California",+ zip: "94122",+ country: "DE",+ first_name: "joseph",+ last_name: "Doe",+ },+ },+ order_details: [+ {+ product_name: "Test Product",+ quantity: 1,+ amount: 6000,+ },+ ],+ },+ Response: {+ status: 200,+ body: {+ status: "requires_customer_action",+ },+ },+ }),AutoCapture: getCustomExchange({Request: {currency: "EUR",diff --git a/cypress-tests/cypress/e2e/configs/Payment/Utils.js b/cypress-tests/cypress/e2e/configs/Payment/Utils.jsindex 609e2c0c81..3900ca6e26 100644--- a/cypress-tests/cypress/e2e/configs/Payment/Utils.js+++ b/cypress-tests/cypress/e2e/configs/Payment/Utils.js@@ -693,6 +693,7 @@ export const CONNECTOR_LISTS = {"payjustnow","payjustnowinstore",],+ PAY_LATER_KLARNA_MANDATE: ["adyen"],AFFIRM: ["stripe"],ATOME: ["adyen"],PAYJUSTNOW: ["payjustnow"],diff --git a/cypress-tests/cypress/e2e/spec/Payment/43-PayLater.cy.js b/cypress-tests/cypress/e2e/spec/Payment/43-PayLater.cy.jsindex 0b4d19899d..e7241f2716 100644--- a/cypress-tests/cypress/e2e/spec/Payment/43-PayLater.cy.js+++ b/cypress-tests/cypress/e2e/spec/Payment/43-PayLater.cy.js@@ -365,6 +365,77 @@ describe("PayLater tests", () => {});});+ context("Klarna PayLater - Mandate AutoCapture flow test (CIT only)", () => {+ before(function () {+ if (+ shouldIncludeConnector(+ globalState.get("connectorId"),+ CONNECTOR_LISTS.INCLUDE.PAY_LATER_KLARNA_MANDATE+ )+ ) {+ this.skip();+ }+ });++ it("Create Payment Intent -> List Merchant Payment Methods -> Confirm with Customer Acceptance (off_session) -> Retrieve Payment", () => {+ let shouldContinue = true;++ cy.step("Create Payment Intent", () => {+ const data = getConnectorDetails(globalState.get("connectorId"))[+ "pay_later_pm"+ ]["AutoCapture"];+ cy.createPaymentIntentTest(+ fixtures.createPaymentBody,+ data,+ "three_ds",+ "automatic",+ globalState+ );+ if (!utils.should_continue_further(data)) {+ shouldContinue = false;+ }+ });++ cy.step("List Merchant Payment Methods", () => {+ if (!shouldContinue) {+ cy.task("cli_log", "Skipping step: List Merchant Payment Methods");+ return;+ }+ cy.paymentMethodsCallTest(globalState);+ });++ cy.step("Confirm Payment with Customer Acceptance (off_session)", () => {+ if (!shouldContinue) {+ cy.task("cli_log", "Skipping step: Confirm Payment");+ return;+ }+ const confirmData = getConnectorDetails(globalState.get("connectorId"))[+ "pay_later_pm"+ ]["KlarnaMandateAutoCapture"];+ cy.confirmBankRedirectCallTest(+ fixtures.confirmBody,+ confirmData,+ true,+ globalState+ );+ if (!utils.should_continue_further(confirmData)) {+ shouldContinue = false;+ }+ });++ cy.step("Retrieve Payment", () => {+ if (!shouldContinue) {+ cy.task("cli_log", "Skipping step: Retrieve Payment");+ return;+ }+ const data = getConnectorDetails(globalState.get("connectorId"))[+ "pay_later_pm"+ ]["KlarnaMandateAutoCapture"];+ cy.retrievePaymentCallTest({ globalState, data });+ });+ });+ });+context("Capture on wrong status - Error test", () => {it("Create Payment Intent -> Confirm Payment -> Attempt Capture on requires_customer_action status", () => {let shouldContinue = true;