Skip to content

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

test(cypress): add paylater coverage for adyen (#13055)

HS-QUALIBOTa2c083c2f512
diff --git a/cypress-tests/cypress/e2e/configs/Payment/Adyen.js b/cypress-tests/cypress/e2e/configs/Payment/Adyen.js
index 18301cf1f0..82e1cad2bd 100644
--- a/cypress-tests/cypress/e2e/configs/Payment/Adyen.js
+++ b/cypress-tests/cypress/e2e/configs/Payment/Adyen.js
@@ -2016,10 +2016,213 @@ export const connectorDetails = {
},
},
}),
+ AutoCapture: getCustomExchange({
+ Request: {
+ currency: "EUR",
+ capture_method: "automatic",
+ },
+ Response: {
+ status: 200,
+ body: {
+ status: "requires_payment_method",
+ },
+ },
+ }),
+ ManualCapture: getCustomExchange({
+ Request: {
+ currency: "EUR",
+ capture_method: "manual",
+ },
+ Response: {
+ status: 200,
+ body: {
+ status: "requires_payment_method",
+ },
+ },
+ }),
+ PaymentIntent: getCustomExchange({
+ Request: {
+ currency: "USD",
+ capture_method: "manual",
+ },
+ Response: {
+ status: 200,
+ body: {
+ status: "requires_payment_method",
+ },
+ },
+ }),
+ Refund: getCustomExchange({
+ Request: {
+ amount: 6000,
+ },
+ Response: {
+ status: 200,
+ body: {
+ status: "pending",
+ },
+ },
+ }),
+ PartialRefund: getCustomExchange({
+ Request: {
+ amount: 2000,
+ },
+ Response: {
+ status: 200,
+ body: {
+ status: "pending",
+ },
+ },
+ }),
+ SyncRefund: getCustomExchange({}),
Capture: getCustomExchange({
Request: {
amount_to_capture: 6000,
},
+ Response: {
+ status: 200,
+ body: {
+ status: "processing",
+ amount: 6000,
+ amount_capturable: 6000,
+ amount_received: null,
+ },
+ },
+ }),
+ AtomeAutoCapture: getCustomExchange({
+ Request: {
+ currency: "SGD",
+ capture_method: "automatic",
+ customer_acceptance: {
+ acceptance_type: "online",
+ },
+ order_details: [
+ {
+ product_name: "Test Product",
+ quantity: 1,
+ amount: 6000,
+ },
+ ],
+ billing: {
+ address: {
+ line1: "123 Test Street",
+ line2: "Unit 4",
+ city: "Singapore",
+ state: "Singapore",
+ zip: "018956",
+ country: "SG",
+ first_name: "John",
+ last_name: "Doe",
+ },
+ phone: {
+ number: "91234567",
+ country_code: "+65",
+ },
+ email: "[email protected]",
+ },
+ shipping: {
+ address: {
+ line1: "123 Test Street",
+ line2: "Unit 4",
+ city: "Singapore",
+ state: "Singapore",
+ zip: "018956",
+ country: "SG",
+ first_name: "John",
+ last_name: "Doe",
+ },
+ },
+ },
+ Response: {
+ status: 200,
+ body: {
+ status: "requires_payment_method",
+ },
+ },
+ }),
+ Atome: getCustomExchange({
+ Request: {
+ payment_method: "pay_later",
+ payment_method_type: "atome",
+ payment_experience: "redirect_to_url",
+ payment_method_data: {
+ pay_later: {
+ atome_redirect: {},
+ },
+ },
+ customer_acceptance: {
+ acceptance_type: "online",
+ },
+ billing: {
+ address: {
+ line1: "123 Test Street",
+ line2: "Unit 4",
+ city: "Singapore",
+ state: "Singapore",
+ zip: "018956",
+ country: "SG",
+ first_name: "John",
+ last_name: "Doe",
+ },
+ phone: {
+ number: "91234567",
+ country_code: "+65",
+ },
+ email: "[email protected]",
+ },
+ shipping: {
+ address: {
+ line1: "123 Test Street",
+ line2: "Unit 4",
+ city: "Singapore",
+ state: "Singapore",
+ zip: "018956",
+ country: "SG",
+ first_name: "John",
+ last_name: "Doe",
+ },
+ },
+ },
+ Response: {
+ status: 200,
+ body: {
+ status: "requires_customer_action",
+ },
+ },
+ }),
+ CaptureOnWrongStatus: getCustomExchange({
+ Request: {
+ amount_to_capture: 6000,
+ },
+ Response: {
+ status: 400,
+ body: {
+ error: {
+ type: "invalid_request",
+ message:
+ "This Payment could not be captured because it has a payment.status of requires_customer_action. The expected state is requires_capture, partially_captured_and_capturable, processing",
+ code: "IR_14",
+ },
+ },
+ },
+ }),
+ ConfirmWithoutPmData: getCustomExchange({
+ Request: {
+ payment_method: undefined,
+ payment_method_type: undefined,
+ payment_experience: undefined,
+ payment_method_data: undefined,
+ order_details: undefined,
+ },
+ Response: {
+ status: 400,
+ body: {
+ error: {
+ type: "invalid_request",
+ code: "IR_06",
+ },
+ },
+ },
}),
},
diff --git a/cypress-tests/cypress/e2e/configs/Payment/Commons.js b/cypress-tests/cypress/e2e/configs/Payment/Commons.js
index 0830175af9..71fb16974e 100644
--- a/cypress-tests/cypress/e2e/configs/Payment/Commons.js
+++ b/cypress-tests/cypress/e2e/configs/Payment/Commons.js
@@ -1711,6 +1711,170 @@ export const connectorDetails = {
}),
SyncRefund: getCustomExchange({}),
SyncRefundScheduled: getCustomExchange({}),
+ AfterpayClearplay: getCustomExchange({
+ Request: {
+ payment_method: "pay_later",
+ payment_method_type: "afterpay_clearpay",
+ payment_experience: "redirect_to_url",
+ payment_method_data: {
+ pay_later: {
+ afterpay_clearpay_redirect: {},
+ },
+ },
+ billing: {
+ phone: {
+ number: "4155552671",
+ country_code: "+1",
+ },
+ address: {
+ line1: "1467",
+ line2: "Harrison Street",
+ city: "San Francisco",
+ state: "California",
+ zip: "94122",
+ country: "US",
+ first_name: "joseph",
+ last_name: "Doe",
+ },
+ },
+ shipping: {
+ address: {
+ line1: "1467",
+ line2: "Harrison Street",
+ city: "San Francisco",
+ state: "California",
+ zip: "94122",
+ country: "US",
+ first_name: "joseph",
+ last_name: "Doe",
+ },
+ },
+ order_details: [
+ {
+ product_name: "Test Product",
+ quantity: 1,
+ amount: 6000,
+ },
+ ],
+ },
+ }),
+ Alma: getCustomExchange({
+ Request: {
+ payment_method: "pay_later",
+ payment_method_type: "alma",
+ payment_experience: "redirect_to_url",
+ payment_method_data: {
+ pay_later: {
+ alma_redirect: {},
+ },
+ },
+ billing: {
+ phone: {
+ number: "612345678",
+ country_code: "+33",
+ },
+ address: {
+ line1: "123 Rue de Test",
+ city: "Paris",
+ state: "Ile-de-France",
+ zip: "75001",
+ country: "FR",
+ first_name: "Jean",
+ last_name: "Dupont",
+ },
+ },
+ shipping: {
+ address: {
+ line1: "123 Rue de Test",
+ city: "Paris",
+ state: "Ile-de-France",
+ zip: "75001",
+ country: "FR",
+ first_name: "Jean",
+ last_name: "Dupont",
+ },
+ },
+ },
+ }),
+ Atome: getCustomExchange({
+ Request: {
+ payment_method: "pay_later",
+ payment_method_type: "atome",
+ payment_experience: "redirect_to_url",
+ payment_method_data: {
+ pay_later: {
+ atome_redirect: {},
+ },
+ },
+ billing: {
+ phone: {
+ number: "91234567",
+ country_code: "+65",
+ },
+ address: {
+ line1: "123 Test Street",
+ city: "Singapore",
+ state: "Singapore",
+ zip: "018956",
+ country: "SG",
+ first_name: "John",
+ last_name: "Doe",
+ },
+ },
+ shipping: {
+ address: {
+ line1: "123 Test Street",
+ city: "Singapore",
+ state: "Singapore",
+ zip: "018956",
+ country: "SG",
+ first_name: "John",
+ last_name: "Doe",
+ },
+ },
+ order_details: [
+ {
+ product_name: "Test Product",
+ quantity: 1,
+ amount: 6000,
+ },
+ ],
+ },
+ }),
+ CaptureOnWrongStatus: getCustomExchange({
+ Request: {
+ amount_to_capture: 6000,
+ },
+ Response: {
+ status: 400,
+ body: {
+ error: {
+ type: "invalid_request",
+ message:
+ "This Payment could not be captured because it has a payment.status of requires_customer_action. The expected state is requires_capture, partially_captured_and_capturable, processing",
+ code: "IR_14",
+ },
+ },
+ },
+ }),
+ ConfirmWithoutPmData: getCustomExchange({
+ Request: {
+ payment_method: undefined,
+ payment_method_type: undefined,
+ payment_experience: undefined,
+ payment_method_data: undefined,
+ order_details: undefined,
+ },
+ Response: {
+ status: 400,
+ body: {
+ error: {
+ type: "invalid_request",
+ code: "IR_04",
+ },
+ },
+ },
+ }),
},
real_time_payment_pm: {
PaymentIntent: getCustomExchange({
diff --git a/cypress-tests/cypress/e2e/configs/Payment/Modifiers.js b/cypress-tests/cypress/e2e/configs/Payment/Modifiers.js
index c0872887e4..63cee888f3 100644
--- a/cypress-tests/cypress/e2e/configs/Payment/Modifiers.js
+++ b/cypress-tests/cypress/e2e/configs/Payment/Modifiers.js
@@ -203,6 +203,8 @@ const CURRENCY_MAP = {
Paypal: "EUR",
MbWay: "EUR",
Mifinity: "EUR", // Mifinity wallet payment method
+ Alma: "EUR", // French pay_later
+ Atome: "SGD", // Singapore pay_later
// Voucher payment methods
Boleto: "BRL",
diff --git a/cypress-tests/cypress/e2e/configs/Payment/Stripe.js b/cypress-tests/cypress/e2e/configs/Payment/Stripe.js
index cc1c1a400c..15485aab82 100644
--- a/cypress-tests/cypress/e2e/configs/Payment/Stripe.js
+++ b/cypress-tests/cypress/e2e/configs/Payment/Stripe.js
@@ -1403,6 +1403,24 @@ export const connectorDetails = {
},
},
}),
+ ConfirmWithoutPmData: getCustomExchange({
+ Request: {
+ payment_method: undefined,
+ payment_method_type: undefined,
+ payment_experience: undefined,
+ payment_method_data: undefined,
+ order_details: undefined,
+ },
+ Response: {
+ status: 400,
+ body: {
+ error: {
+ type: "invalid_request",
+ code: "IR_06",
+ },
+ },
+ },
+ }),
},
auth_service_eligibility: {
// Storage flag does not affect authentication outcome — both enabled and
diff --git a/cypress-tests/cypress/e2e/configs/Payment/Utils.js b/cypress-tests/cypress/e2e/configs/Payment/Utils.js
index b711623188..2ca093a96d 100644
--- a/cypress-tests/cypress/e2e/configs/Payment/Utils.js
+++ b/cypress-tests/cypress/e2e/configs/Payment/Utils.js
@@ -268,6 +268,9 @@ export function getValueByKey(jsonObject, key, keyNumber = 0) {
}
export const should_continue_further = (data) => {
+ if (!data) {
+ return false;
+ }
const resData = data.Response || {};
const configData = validateConfig(data.Configs) || {};
@@ -618,6 +621,7 @@ export const CONNECTOR_LISTS = {
"affirm",
],
AFFIRM: ["stripe"],
+ ATOME: ["adyen"],
AUTH_SERVICE_ELIGIBILITY: ["stripe", "cybersource"],
STEP_UP_AUTH: ["cybersource"],
PARTIAL_AUTH: ["nuvei", "checkout", "worldpay", "worldpayvantiv"],
diff --git a/cypress-tests/cypress/e2e/spec/Payment/43-PayLater.cy.js b/cypress-tests/cypress/e2e/spec/Payment/43-PayLater.cy.js
index 10dcb10a1e..0905daf6f2 100644
--- a/cypress-tests/cypress/e2e/spec/Payment/43-PayLater.cy.js
+++ b/cypress-tests/cypress/e2e/spec/Payment/43-PayLater.cy.js
@@ -192,18 +192,103 @@ describe("PayLater tests", () => {
});
});
- context("Affirm PayLater - Auto Capture flow test", () => {
- before("skip if connector does not support Affirm", function () {
- if (
- shouldIncludeConnector(
- globalState.get("connectorId"),
- CONNECTOR_LISTS.INCLUDE.AFFIRM
- )
- ) {
- this.skip();
- }
- });
- it("Create Payment Intent -> List Merchant Payment Methods -> Confirm Payment -> Handle PayLater Redirection -> Retrieve Payment", () => {
+ context(
+ "Klarna PayLater - Manual Capture with Capture and Retrieve flow test",
+ () => {
+ it("Create Payment Intent -> List Merchant Payment Methods -> Confirm Payment -> Handle PayLater Redirection -> Capture Payment -> Retrieve Payment after Capture", () => {
+ let shouldContinue = true;
+
+ cy.step("Create Payment Intent", () => {
+ const data = getConnectorDetails(globalState.get("connectorId"))[
+ "pay_later_pm"
+ ]["ManualCapture"];
+ cy.createPaymentIntentTest(
+ fixtures.createPaymentBody,
+ data,
+ "three_ds",
+ "manual",
+ 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", () => {
+ if (!shouldContinue) {
+ cy.task("cli_log", "Skipping step: Confirm Payment");
+ return;
+ }
+ const confirmData = getConnectorDetails(
+ globalState.get("connectorId")
+ )["pay_later_pm"]["Klarna"];
+ cy.confirmBankRedirectCallTest(
+ fixtures.confirmBody,
+ confirmData,
+ true,
+ globalState
+ );
+ if (!utils.should_continue_further(confirmData)) {
+ shouldContinue = false;
+ }
+ });
+
+ cy.step("Handle PayLater Redirection", () => {
+ if (!shouldContinue) {
+ cy.task("cli_log", "Skipping step: Handle PayLater Redirection");
+ return;
+ }
+ const expected_redirection =
+ globalState.get("baseUrl") + "/payments/completion";
+ const payment_method_type = globalState.get("paymentMethodType");
+ cy.handlePayLaterRedirection(
+ globalState,
+ payment_method_type,
+ expected_redirection
+ );
+ });
+
+ cy.step("Capture Payment on wrong status", () => {
+ if (!shouldContinue) {
+ cy.task(
+ "cli_log",
+ "Skipping step: Capture Payment on wrong status"
+ );
+ return;
+ }
+ const captureData = getConnectorDetails(
+ globalState.get("connectorId")
+ )["pay_later_pm"]["CaptureOnWrongStatus"];
+ cy.captureCallTest(fixtures.captureBody, captureData, globalState);
+ });
+
+ cy.step("Retrieve Payment after failed Capture", () => {
+ if (!shouldContinue) {
+ cy.task(
+ "cli_log",
+ "Skipping step: Retrieve Payment after failed Capture"
+ );
+ return;
+ }
+ const klarnaData = getConnectorDetails(
+ globalState.get("connectorId")
+ )["pay_later_pm"]["Klarna"];
+ cy.retrievePaymentCallTest({ globalState, data: klarnaData });
+ });
+ });
+ }
+ );
+
+ context("Klarna PayLater - Separate Create and Confirm flow test", () => {
+ it("Create Payment Intent -> List Merchant Payment Methods -> Confirm Payment -> Handle PayLater Redirection", () => {
let shouldContinue = true;
cy.step("Create Payment Intent", () => {
@@ -237,7 +322,7 @@ describe("PayLater tests", () => {
}
const confirmData = getConnectorDetails(globalState.get("connectorId"))[
"pay_later_pm"
- ]["Affirm"];
+ ]["Klarna"];
cy.confirmBankRedirectCallTest(
fixtures.confirmBody,
confirmData,
@@ -272,26 +357,16 @@ describe("PayLater tests", () => {
);
return;
}
- const data = getConnectorDetails(globalState.get("connectorId"))[
+ const confirmData = getConnectorDetails(globalState.get("connectorId"))[
"pay_later_pm"
- ]["Affirm"];
- cy.retrievePaymentCallTest({ globalState, data });
+ ]["Klarna"];
+ cy.retrievePaymentCallTest({ globalState, data: confirmData });
});
});
});
- context("Affirm PayLater - Manual Capture flow test", () => {
- before("skip if connector does not support Affirm", function () {
- if (
- shouldIncludeConnector(
- globalState.get("connectorId"),
- CONNECTOR_LISTS.INCLUDE.AFFIRM
- )
- ) {
- this.skip();
- }
- });
- it("Create Payment Intent -> List Merchant Payment Methods -> Confirm Payment -> Handle PayLater Redirection -> Retrieve Payment", () => {
+ context("Capture on wrong status - Error test", () => {
+ it("Create Payment Intent -> Confirm Payment -> Attempt Capture on requires_customer_action status", () => {
let shouldContinue = true;
cy.step("Create Payment Intent", () => {
@@ -325,73 +400,41 @@ describe("PayLater tests", () => {
}
const confirmData = getConnectorDetails(globalState.get("connectorId"))[
"pay_later_pm"
- ]["Affirm"];
+ ]["Klarna"];
cy.confirmBankRedirectCallTest(
fixtures.confirmBody,
confirmData,
true,
globalState
);
- if (!utils.should_continue_further(confirmData)) {
- shouldContinue = false;
- }
- });
-
- cy.step("Handle PayLater Redirection", () => {
- if (!shouldContinue) {
- cy.task("cli_log", "Skipping step: Handle PayLater Redirection");
- return;
- }
- const expected_redirection =
- globalState.get("baseUrl") + "/payments/completion";
- const payment_method_type = globalState.get("paymentMethodType");
- cy.handlePayLaterRedirection(
- globalState,
- payment_method_type,
- expected_redirection
- );
});
- cy.step("Retrieve Payment after Redirection", () => {
+ cy.step("Attempt Capture on wrong status", () => {
if (!shouldContinue) {
- cy.task(
- "cli_log",
- "Skipping step: Retrieve Payment after Redirection"
- );
+ cy.task("cli_log", "Skipping step: Attempt Capture on wrong status");
return;
}
- const data = getConnectorDetails(globalState.get("connectorId"))[
+ const captureData = getConnectorDetails(globalState.get("connectorId"))[
"pay_later_pm"
- ]["Affirm"];
- cy.retrievePaymentCallTest({ globalState, data });
+ ]["CaptureOnWrongStatus"];
+ cy.captureCallTest(fixtures.captureBody, captureData, globalState);
});
});
});
- context("Affirm - Full Payment and Refund Flow", () => {
- beforeEach(function () {
- if (
- shouldIncludeConnector(
- globalState.get("connectorId"),
- CONNECTOR_LISTS.INCLUDE.AFFIRM_PAY_LATER
- )
- ) {
- this.skip();
- }
- });
-
- it("Create Payment Intent -> Payment Methods Call -> Confirm Payment Intent -> Handle Redirection -> Retrieve Payment -> Refund Payment -> Sync Refund", () => {
+ context("Confirm without payment_method_data - Error test", () => {
+ it("Create Payment Intent -> List Merchant Payment Methods -> Confirm Payment without payment_method_data", () => {
let shouldContinue = true;
cy.step("Create Payment Intent", () => {
const data = getConnectorDetails(globalState.get("connectorId"))[
"pay_later_pm"
- ]["PaymentIntent"];
+ ]["AutoCapture"];
cy.createPaymentIntentTest(
fixtures.createPaymentBody,
data,
- "no_three_ds",
- "manual",
+ "three_ds",
+ "automatic",
globalState
);
if (!utils.should_continue_further(data)) {
@@ -399,131 +442,58 @@ describe("PayLater tests", () => {
}
});
- cy.step("Payment Methods Call", () => {
+ cy.step("List Merchant Payment Methods", () => {
if (!shouldContinue) {
- cy.task("cli_log", "Skipping step: Payment Methods Call");
+ cy.task("cli_log", "Skipping step: List Merchant Payment Methods");
return;
}
cy.paymentMethodsCallTest(globalState);
});
- cy.step("Confirm Payment Intent", () => {
+ cy.step("Confirm Payment without payment_method_data", () => {
if (!shouldContinue) {
- cy.task("cli_log", "Skipping step: Confirm Payment Intent");
+ cy.task(
+ "cli_log",
+ "Skipping step: Confirm Payment without payment_method_data"
+ );
return;
}
const confirmData = getConnectorDetails(globalState.get("connectorId"))[
"pay_later_pm"
- ]["AffirmManualCapture"];
+ ]["ConfirmWithoutPmData"];
cy.confirmBankRedirectCallTest(
fixtures.confirmBody,
confirmData,
true,
globalState
);
- if (!utils.should_continue_further(confirmData)) {
- shouldContinue = false;
- }
- });
-
- cy.step("Handle Redirection", () => {
- if (!shouldContinue) {
- cy.task("cli_log", "Skipping step: Handle Redirection");
- return;
- }
- const expected_redirection =
- globalState.get("baseUrl") + "/payments/completion";
- const payment_method_type = globalState.get("paymentMethodType");
- cy.handleAffirmRedirection(
- globalState,
- payment_method_type,
- expected_redirection
- );
- cy.task("cli_log", "Affirm redirection handler completed");
- });
-
- cy.step("Retrieve Payment after Confirmation", () => {
- if (!shouldContinue) {
- cy.task(
- "cli_log",
- "Skipping step: Retrieve Payment after Confirmation"
- );
- return;
- }
- const confirmData = getConnectorDetails(globalState.get("connectorId"))[
- "pay_later_pm"
- ]["AffirmManualCapture"];
- cy.retrievePaymentCallTest({ globalState, data: confirmData });
- if (!utils.should_continue_further(confirmData)) {
- shouldContinue = false;
- }
- });
-
- cy.step("Capture Payment", () => {
- if (!shouldContinue) {
- cy.task("cli_log", "Skipping step: Capture Payment");
- return;
- }
- const captureData = getConnectorDetails(globalState.get("connectorId"))[
- "pay_later_pm"
- ]["Capture"];
- cy.captureCallTest(fixtures.captureBody, captureData, globalState);
- if (!utils.should_continue_further(captureData)) {
- shouldContinue = false;
- }
- });
-
- cy.step("Refund Payment", () => {
- if (!shouldContinue) {
- cy.task("cli_log", "Skipping step: Refund Payment");
- return;
- }
- const refundData = getConnectorDetails(globalState.get("connectorId"))[
- "pay_later_pm"
- ]["Refund"];
- cy.refundCallTest(fixtures.refundBody, refundData, globalState);
- if (!utils.should_continue_further(refundData)) {
- shouldContinue = false;
- }
- });
-
- cy.step("Sync Refund Payment", () => {
- if (!shouldContinue) {
- cy.task("cli_log", "Skipping step: Sync Refund Payment");
- return;
- }
- const syncRefundData = getConnectorDetails(
- globalState.get("connectorId")
- )["pay_later_pm"]["SyncRefund"];
- cy.syncRefundCallTest(syncRefundData, globalState);
});
});
});
- context("Affirm - Partial Refund Flow", () => {
- beforeEach(function () {
+ context("Atome PayLater - Auto Capture flow test", () => {
+ before("skip if connector does not support Atome", function () {
if (
shouldIncludeConnector(
globalState.get("connectorId"),
- CONNECTOR_LISTS.INCLUDE.AFFIRM_PAY_LATER
+ CONNECTOR_LISTS.INCLUDE.ATOME
)
) {
this.skip();
}
});
-
- it("Create Payment Intent -> Payment Methods Call -> Confirm Payment Intent -> Handle Redirection -> Retrieve Payment -> Partial Refund -> Sync Refund", () => {
+ it("Create Payment Intent -> List Merchant Payment Methods -> Confirm Payment -> Handle PayLater Redirection -> Retrieve Payment", () => {
let shouldContinue = true;
cy.step("Create Payment Intent", () => {
const data = getConnectorDetails(globalState.get("connectorId"))[
"pay_later_pm"
- ]["PaymentIntent"];
+ ]["AtomeAutoCapture"];
cy.createPaymentIntentTest(
fixtures.createPaymentBody,
data,
- "no_three_ds",
- "manual",
+ "three_ds",
+ "automatic",
globalState
);
if (!utils.should_continue_further(data)) {
@@ -531,22 +501,22 @@ describe("PayLater tests", () => {
}
});
- cy.step("Payment Methods Call", () => {
+ cy.step("List Merchant Payment Methods", () => {
if (!shouldContinue) {
- cy.task("cli_log", "Skipping step: Payment Methods Call");
+ cy.task("cli_log", "Skipping step: List Merchant Payment Methods");
return;
}
cy.paymentMethodsCallTest(globalState);
});
- cy.step("Confirm Payment Intent", () => {
+ cy.step("Confirm Payment", () => {
if (!shouldContinue) {
- cy.task("cli_log", "Skipping step: Confirm Payment Intent");
+ cy.task("cli_log", "Skipping step: Confirm Payment");
return;
}
const confirmData = getConnectorDetails(globalState.get("connectorId"))[
"pay_later_pm"
- ]["AffirmManualCapture"];
+ ]["Atome"];
cy.confirmBankRedirectCallTest(
fixtures.confirmBody,
confirmData,
@@ -558,75 +528,33 @@ describe("PayLater tests", () => {
}
});
- cy.step("Handle Redirection", () => {
+ cy.step("Handle PayLater Redirection", () => {
if (!shouldContinue) {
- cy.task("cli_log", "Skipping step: Handle Redirection");
+ cy.task("cli_log", "Skipping step: Handle PayLater Redirection");
return;
}
const expected_redirection =
globalState.get("baseUrl") + "/payments/completion";
const payment_method_type = globalState.get("paymentMethodType");
- cy.handleAffirmRedirection(
+ cy.handlePayLaterRedirection(
globalState,
payment_method_type,
expected_redirection
);
});
- cy.step("Retrieve Payment after Confirmation", () => {
+ cy.step("Retrieve Payment after Redirection", () => {
if (!shouldContinue) {
cy.task(
"cli_log",
- "Skipping step: Retrieve Payment after Confirmation"
+ "Skipping step: Retrieve Payment after Redirection"
);
return;
}
- const confirmData = getConnectorDetails(globalState.get("connectorId"))[
- "pay_later_pm"
- ]["AffirmManualCapture"];
- cy.retrievePaymentCallTest({ globalState, data: confirmData });
- if (!utils.should_continue_further(confirmData)) {
- shouldContinue = false;
- }
- });
-
- cy.step("Capture Payment", () => {
- if (!shouldContinue) {
- cy.task("cli_log", "Skipping step: Capture Payment");
- return;
- }
- const captureData = getConnectorDetails(globalState.get("connectorId"))[
+ const data = getConnectorDetails(globalState.get("connectorId"))[
"pay_later_pm"
- ]["Capture"];
- cy.captureCallTest(fixtures.captureBody, captureData, globalState);
- if (!utils.should_continue_further(captureData)) {
- shouldContinue = false;
- }
- });
-
- cy.step("Partial Refund Payment", () => {
- if (!shouldContinue) {
- cy.task("cli_log", "Skipping step: Partial Refund Payment");
- return;
- }
- const partialRefundData = getConnectorDetails(
- globalState.get("connectorId")
- )["pay_later_pm"]["PartialRefund"];
- cy.refundCallTest(fixtures.refundBody, partialRefundData, globalState);
- if (!utils.should_continue_further(partialRefundData)) {
- shouldContinue = false;
- }
- });
-
- cy.step("Sync Refund Payment", () => {
- if (!shouldContinue) {
- cy.task("cli_log", "Skipping step: Sync Refund Payment");
- return;
- }
- const syncRefundData = getConnectorDetails(
- globalState.get("connectorId")
- )["pay_later_pm"]["SyncRefund"];
- cy.syncRefundCallTest(syncRefundData, globalState);
+ ]["Atome"];
+ cy.retrievePaymentCallTest({ globalState, data });
});
});
});
diff --git a/cypress-tests/cypress/support/commands.js b/cypress-tests/cypress/support/commands.js
index 56e5ef5965..19349581ce 100644
--- a/cypress-tests/cypress/support/commands.js
+++ b/cypress-tests/cypress/support/commands.js
@@ -3143,6 +3143,16 @@ Cypress.Commands.add(
response.body.next_action.redirect_to_url
);
}
+ if (
+ resData.Response &&
+ resData.Response.body &&
+ resData.Response.body.status
+ ) {
+ expect(
+ response.body.status,
+ "status should match config"
+ ).to.equal(resData.Response.body.status);
+ }
} else if (response.body.status === "failed") {
expect(response.body.error_code).to.equal(
resData.body.error_code