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

ci(cypress): add autoretries tests (#11458)

likhinbopannad2ae095559d4
diff --git a/.github/data/gateway_status_map.csv b/.github/data/gateway_status_map.csv
index 576bba2da1..7b21259882 100644
--- a/.github/data/gateway_status_map.csv
+++ b/.github/data/gateway_status_map.csv
@@ -6,4 +6,22 @@ adyen,Payment,SetupMandate,2,Refused,failure,,retry,2025-12-08 15:03:03,2026-01-
stripe,Payment,Authorize,card_declined,Your card was declined.,failure,,do_default,2025-12-02 13:36:57,2026-01-05 19:13:24,FALSE,UE_1000,Issue with Payment Method details,,FALSE,"{""retry"": {""decision"": ""do_default"", ""step_up_possible"": false, ""clear_pan_possible"": false, ""alternate_network_possible"": false}}",retry,payment_method_issue,Issue with Payment Method details,Issue with Payment Method details
stripe,Payment,CompleteAuthorize,card_declined,Your card was declined.,failure,,do_default,2025-12-08 18:00:44,2026-01-05 19:13:25,FALSE,UE_1000,Issue with Payment Method details,,FALSE,"{""retry"": {""decision"": ""do_default"", ""step_up_possible"": false, ""clear_pan_possible"": false, ""alternate_network_possible"": false}}",retry,payment_method_issue,Issue with Payment Method details,Issue with Payment Method details
stripe,Payment,PSync,card_declined,Your card was declined.,failure,,do_default,2025-12-02 13:39:08,2026-01-05 19:13:24,FALSE,UE_1000,Issue with Payment Method details,,FALSE,"{""retry"": {""decision"": ""do_default"", ""step_up_possible"": false, ""clear_pan_possible"": false, ""alternate_network_possible"": false}}",retry,payment_method_issue,Issue with Payment Method details,Issue with Payment Method details
-stripe,Payment,SetupMandate,card_declined,Your card was declined.,failure,,do_default,2025-12-02 13:40:40,2026-01-05 19:13:24,FALSE,UE_1000,Issue with Payment Method details,,FALSE,"{""retry"": {""decision"": ""do_default"", ""step_up_possible"": false, ""clear_pan_possible"": false, ""alternate_network_possible"": false}}",retry,payment_method_issue,Issue with Payment Method details,Issue with Payment Method details
\ No newline at end of file
+stripe,Payment,SetupMandate,card_declined,Your card was declined.,failure,,do_default,2025-12-02 13:40:40,2026-01-05 19:13:24,FALSE,UE_1000,Issue with Payment Method details,,FALSE,"{""retry"": {""decision"": ""do_default"", ""step_up_possible"": false, ""clear_pan_possible"": false, ""alternate_network_possible"": false}}",retry,payment_method_issue,Issue with Payment Method details,Issue with Payment Method details
+stripe,Payment,Authorize,Network:Visa|IssuerCode:01,Network:Visa|IssuerCode:01,failure,,retry,2026-03-24 05:49:43,2026-04-01 14:17:19,false,UE_3000,Technical issue with PSP,,false,"{""retry"": {""decision"": ""retry"", ""step_up_possible"": false, ""clear_pan_possible"": false, ""alternate_network_possible"": false}}",retry,do_not_honor,Do not honor,Something went wrong. Try again or contact your bank
+cybersource,Payment,Authorize,INVALID_DATA,Declined - One or more fields in the request contains invalid data,failure,,retry,2025-12-02 07:40:16,2026-03-11 08:34:41,false,UE_1000,Issue with Payment Method details,,false,"{""retry"": {""decision"": ""retry"", ""step_up_possible"": false, ""clear_pan_possible"": false, ""alternate_network_possible"": false}}",retry,payment_method_issue,Issue with Payment Method details,Issue with Payment Method details
+airwallex,Payment,Authorize,validation_error,invalid pan,failure,,retry,2026-03-11 11:36:29,2026-03-11 11:36:29,false,,,,false,"{""retry"": {""decision"": ""retry"", ""step_up_possible"": false, ""clear_pan_possible"": false, ""alternate_network_possible"": false}}",retry,,,
+authorizedotnet,Payment,Authorize,2,This transaction has been declined.,failure,,retry,2025-12-02 07:40:07,2026-03-11 11:51:52,false,UE_3000,Technical issue with PSP,,false,"{""retry"": {""decision"": ""retry"", ""step_up_possible"": false, ""clear_pan_possible"": false, ""alternate_network_possible"": false}}",retry,do_not_honor,Do not honor,Something went wrong. Try again or contact your bank
+nuvei,Payment,Authorize,-1,Decline,failure,,retry,2026-03-11 11:58:42,2026-03-11 11:58:42,false,,,,false,"{""retry"": {""decision"": ""retry"", ""step_up_possible"": false, ""clear_pan_possible"": false, ""alternate_network_possible"": false}}",retry,,,
+paypal,Payment,Authorize,0500,DO_NOT_HONOR.,failure,,retry,2026-03-16 09:47:18,2026-03-16 09:47:18,false,,,,false,"{""retry"": {""decision"": ""retry"", ""step_up_possible"": false, ""clear_pan_possible"": false, ""alternate_network_possible"": false}}",retry,,,
+trustpay,Payment,Authorize,85,the card is not enrolled for a supported 3DS version,failure,,retry,2026-03-16 09:53:07,2026-03-16 09:53:18,false,,,,false,"{""retry"": {""decision"": ""retry"", ""step_up_possible"": false, ""clear_pan_possible"": false, ""alternate_network_possible"": false}}",retry,,,
+checkout,Payment,Authorize,2005C,Transaction not supported/blocked by issuer,failure,,retry,2026-03-16 10:48:43,2026-03-16 10:48:43,false,,,,false,"{""retry"": {""decision"": ""retry"", ""step_up_possible"": false, ""clear_pan_possible"": false, ""alternate_network_possible"": false}}",retry,,,
+finix,Payment,Authorize,DO_NOT_HONOR,RAW MESSAGE,failure,,retry,2026-03-16 11:02:08,2026-03-16 11:02:08,false,,,,false,"{""retry"": {""decision"": ""retry"", ""step_up_possible"": false, ""clear_pan_possible"": false, ""alternate_network_possible"": false}}",retry,,,
+fiuu,Payment,Authorize,05,Do not honor,failure,,retry,2026-03-16 11:25:15,2026-03-16 11:25:15,false,,,,false,"{""retry"": {""decision"": ""retry"", ""step_up_possible"": false, ""clear_pan_possible"": false, ""alternate_network_possible"": false}}",retry,,,
+nmi,Payment,Authorize,200,DECLINE,failure,,retry,2025-12-02 07:40:50,2025-12-24 09:05:16,false,UE_3000,Technical issue with PSP,,false,"{""retry"": {""decision"": ""retry"", ""step_up_possible"": false, ""clear_pan_possible"": false, ""alternate_network_possible"": false}}",retry,do_not_honor,Do not honor,Something went wrong. Try again or contact your bank
+bankofamerica,Payment,Authorize,INVALID_DATA,INVALID_DATA,failure,,retry,2025-12-02 07:40:24,2026-03-16 12:06:28,false,UE_4000,Issue with Integration,processor_decline_incorrect_data,false,"{""retry"": {""decision"": ""retry"", ""step_up_possible"": false, ""clear_pan_possible"": false, ""alternate_network_possible"": false}}",retry,missing_or_invalid_param,Missing or invalid parameter,Something went wrong. Try another payment method or contact your bank
+datatrans,Payment,Authorize,DECLINED,Declined,failure,,retry,2026-03-16 12:10:53,2026-03-16 12:10:53,false,,,,false,"{""retry"": {""decision"": ""retry"", ""step_up_possible"": false, ""clear_pan_possible"": false, ""alternate_network_possible"": false}}",retry,,,
+globalpay,Payment,Authorize,111,(111)[ test system ] Strong Customer Authentication Required,failure,,retry,2026-03-16 12:17:22,2026-03-16 12:17:22,false,,,,false,"{""retry"": {""decision"": ""retry"", ""step_up_possible"": false, ""clear_pan_possible"": false, ""alternate_network_possible"": false}}",retry,,,
+nexinets,Payment,Authorize,12000,Could not process request,failure,,retry,2026-03-16 12:22:35,2026-03-16 12:22:35,false,,,,false,"{""retry"": {""decision"": ""retry"", ""step_up_possible"": false, ""clear_pan_possible"": false, ""alternate_network_possible"": false}}",retry,,,
+powertranz,Payment,Authorize,05,Do Not Honor,failure,,retry,2026-03-16 12:26:45,2026-03-16 12:26:45,false,,,,false,"{""retry"": {""decision"": ""retry"", ""step_up_possible"": false, ""clear_pan_possible"": false, ""alternate_network_possible"": false}}",retry,,,
+shift4,Payment,Authorize,invalid_number,"Your request was in test mode, but used a non test card. For a list of valid test cards, visit our doc site.",failure,,retry,2026-03-16 13:42:10,2026-03-16 13:42:10,false,,,,false,"{""retry"": {""decision"": ""retry"", ""step_up_possible"": false, ""clear_pan_possible"": false, ""alternate_network_possible"": false}}",retry,,,
+worldpayvantiv,Payment,Authorize,1,Invalid credentials. Contact [email protected].,failure,,retry,2026-03-16 13:45:41,2026-03-16 13:45:41,false,,,,false,"{""retry"": {""decision"": ""retry"", ""step_up_possible"": false, ""clear_pan_possible"": false, ""alternate_network_possible"": false}}",retry,,,
\ No newline at end of file
diff --git a/crates/router/src/core/payments/retry.rs b/crates/router/src/core/payments/retry.rs
index 5647a998a0..a6fe313788 100644
--- a/crates/router/src/core/payments/retry.rs
+++ b/crates/router/src/core/payments/retry.rs
@@ -102,7 +102,7 @@ where
};
if should_step_up {
- router_data = do_retry(
+ router_data = Box::pin(do_retry(
&state.clone(),
req_state.clone(),
original_connector_data,
@@ -121,7 +121,7 @@ where
initial_gsm.clone(),
#[cfg(feature = "pm_modular")]
feature_config,
- )
+ ))
.await?;
}
// Step up is not applicable so proceed with auto retries flow
@@ -209,7 +209,7 @@ where
(connector_routing_data.connector_data, routing_decision)
};
- router_data = do_retry(
+ router_data = Box::pin(do_retry(
&state.clone(),
req_state.clone(),
&connector,
@@ -229,7 +229,7 @@ where
gsm.clone(),
#[cfg(feature = "pm_modular")]
feature_config,
- )
+ ))
.await?;
retries = retries.map(|i| i - 1);
diff --git a/cypress-tests/cypress/e2e/configs/Payment/Nmi.js b/cypress-tests/cypress/e2e/configs/Payment/Nmi.js
index 2115ab9dc5..0e4878f071 100644
--- a/cypress-tests/cypress/e2e/configs/Payment/Nmi.js
+++ b/cypress-tests/cypress/e2e/configs/Payment/Nmi.js
@@ -6,6 +6,14 @@ const successfulNo3DSCardDetails = {
card_cvc: "999",
};
+const failedNoThreeDsCardDetails = {
+ card_number: "4242424242424242",
+ card_exp_month: "10",
+ card_exp_year: "30",
+ card_holder_name: "REFUSED13",
+ card_cvc: "737",
+};
+
const successfulThreeDSTestCardDetails = {
card_number: "4000000000002503",
card_exp_month: "10",
@@ -642,6 +650,24 @@ export const connectorDetails = {
},
},
},
+ No3DSFailPayment: {
+ Request: {
+ payment_method: "card",
+ payment_method_data: {
+ card: failedNoThreeDsCardDetails,
+ },
+ customer_acceptance: null,
+ setup_future_usage: "on_session",
+ },
+ Response: {
+ status: 200,
+ body: {
+ status: "failed",
+ error_code: "200",
+ error_message: "DECLINE",
+ },
+ },
+ },
},
webhook: {
TransactionIdConfig: {
diff --git a/cypress-tests/cypress/e2e/configs/Payment/Stripe.js b/cypress-tests/cypress/e2e/configs/Payment/Stripe.js
index 2539a9557b..473cbb71e4 100644
--- a/cypress-tests/cypress/e2e/configs/Payment/Stripe.js
+++ b/cypress-tests/cypress/e2e/configs/Payment/Stripe.js
@@ -298,8 +298,6 @@ export const connectorDetails = {
error_code: "card_declined",
error_message:
"message - Your card was declined., decline_code - generic_decline",
- unified_code: "UE_1000",
- unified_message: "Issue with Payment Method details",
},
},
},
diff --git a/cypress-tests/cypress/e2e/configs/Payment/Utils.js b/cypress-tests/cypress/e2e/configs/Payment/Utils.js
index 2cfad737c0..ac32326dca 100644
--- a/cypress-tests/cypress/e2e/configs/Payment/Utils.js
+++ b/cypress-tests/cypress/e2e/configs/Payment/Utils.js
@@ -499,6 +499,28 @@ export const CONNECTOR_LISTS = {
"worldpay",
],
CARD_INSTALLMENTS: ["adyen"],
+ AUTO_RETRY: [
+ "cybersource",
+ "checkout",
+ "stripe",
+ "adyen",
+ "airwallex",
+ "authorizedotnet",
+ "bankofamerica",
+ "datatrans",
+ "finix",
+ "fiuu",
+ "globalpay",
+ "nexinets",
+ "nmi",
+ "nuvei",
+ "paypal",
+ "powertranz",
+ "shift4",
+ "trustpay",
+ "worldpay",
+ "worldpayvantiv",
+ ],
// Add more inclusion lists
},
};
diff --git a/cypress-tests/cypress/e2e/spec/Payment/42-AutoRetries.cy.js b/cypress-tests/cypress/e2e/spec/Payment/42-AutoRetries.cy.js
new file mode 100644
index 0000000000..ec5c7075aa
--- /dev/null
+++ b/cypress-tests/cypress/e2e/spec/Payment/42-AutoRetries.cy.js
@@ -0,0 +1,242 @@
+import * as fixtures from "../../../fixtures/imports";
+import State from "../../../utils/State";
+import { payment_methods_enabled } from "../../configs/Payment/Commons";
+import getConnectorDetails, * as utils from "../../configs/Payment/Utils";
+
+let globalState;
+
+describe("Auto Retry Tests", () => {
+ before("seed global state", () => {
+ cy.task("getGlobalState").then((state) => {
+ globalState = new State(state);
+ });
+ });
+
+ after("flush global state", () => {
+ cy.task("setGlobalState", globalState.data);
+ });
+
+ context("Create Secondary Connector for the same profile", () => {
+ it("Create Secondary Connector", () => {
+ const CONNECTOR_POOL = ["stripe", "adyen", "cybersource"];
+ const primaryConnector = globalState.get("connectorId");
+
+ const secondaryConnector = CONNECTOR_POOL.find(
+ (connector) => connector !== primaryConnector
+ );
+
+ globalState.set("connectorId", secondaryConnector);
+ globalState.set("secondaryConnector", secondaryConnector);
+
+ cy.createConnectorCallTest(
+ "payment_processor",
+ fixtures.createConnectorBody,
+ payment_methods_enabled,
+ globalState,
+ "profile",
+ "merchantConnectorSecondary"
+ ).then(() => {
+ globalState.set("connectorId", primaryConnector);
+ });
+ });
+ });
+
+ context("auto retries enabled with max retries = 1", () => {
+ it("Update Business Profile -> Create Payment Intent -> Confirm Payment -> Retrieve Payment", () => {
+ let shouldContinue = true;
+
+ cy.step(
+ "Update Business Profile to enable auto retries with 1 max retry",
+ () => {
+ if (!shouldContinue) {
+ cy.task("cli_log", "Skipping step: Update Business Profile");
+ return;
+ }
+
+ const connectorId = globalState.get("connectorId");
+ if (
+ utils.shouldIncludeConnector(
+ connectorId,
+ utils.CONNECTOR_LISTS.INCLUDE.AUTO_RETRY
+ )
+ ) {
+ cy.log(
+ `Skipping Auto Retry - connector not supported: ${connectorId}`
+ );
+ shouldContinue = false;
+ return;
+ }
+
+ const updateBusinessProfileBody = {
+ is_auto_retries_enabled: true,
+ max_auto_retries_enabled: 1,
+ };
+
+ cy.UpdateBusinessProfileTest(
+ updateBusinessProfileBody,
+ false, // is_connector_agnostic_enabled
+ false, // collect_billing_address_from_wallet_connector
+ false, // collect_shipping_address_from_wallet_connector
+ false, // always_collect_billing_address_from_wallet_connector
+ false, // always_collect_shipping_address_from_wallet_connector
+ globalState
+ );
+
+ globalState.set("max_auto_retries_enabled", 1);
+ }
+ );
+
+ cy.step("Create Payment Intent", () => {
+ if (!shouldContinue) {
+ cy.task("cli_log", "Skipping step: Create Payment Intent");
+ return;
+ }
+
+ const data = getConnectorDetails(globalState.get("connectorId"))[
+ "card_pm"
+ ]["PaymentIntent"];
+
+ cy.createPaymentIntentTest(
+ fixtures.createPaymentBody,
+ data,
+ "no_three_ds",
+ "automatic",
+ globalState
+ );
+
+ if (!utils.should_continue_further(data)) {
+ shouldContinue = false;
+ }
+ });
+
+ cy.step("Confirm Payment", () => {
+ if (!shouldContinue) {
+ cy.task("cli_log", "Skipping step: Confirm Payment");
+ return;
+ }
+
+ const activeConnector = globalState.get("connectorId");
+
+ const data =
+ getConnectorDetails(activeConnector)["card_pm"]["No3DSFailPayment"];
+
+ cy.confirmCallAutoRetryTest(
+ fixtures.confirmBody,
+ data,
+ true,
+ globalState
+ );
+ });
+
+ cy.step("Retrieve Payment", () => {
+ if (!shouldContinue) {
+ cy.task("cli_log", "Skipping step: Retrieve Payment");
+ return;
+ }
+
+ const data = getConnectorDetails(globalState.get("connectorId"))[
+ "card_pm"
+ ]["No3DSFailPayment"];
+
+ cy.retrievePaymentCallAutoRetryTest({ globalState, data });
+ });
+ });
+ });
+
+ context("auto retries enabled with max retries = 0", () => {
+ it("Update Business Profile -> Create Payment Intent -> Confirm Payment -> Retrieve Payment", () => {
+ let shouldContinue = true;
+
+ cy.step(
+ "Update Business Profile to enable auto retries with 0 max retries",
+ () => {
+ const connectorId = globalState.get("connectorId");
+ if (
+ utils.shouldIncludeConnector(
+ connectorId,
+ utils.CONNECTOR_LISTS.INCLUDE.AUTO_RETRY
+ )
+ ) {
+ cy.log(
+ `Skipping Auto Retry - connector not supported: ${connectorId}`
+ );
+ shouldContinue = false;
+ return;
+ }
+
+ const body = {
+ is_auto_retries_enabled: true,
+ max_auto_retries_enabled: 0,
+ };
+
+ cy.UpdateBusinessProfileTest(
+ body,
+ false, // is_connector_agnostic_enabled
+ false, // collect_billing_address_from_wallet_connector
+ false, // collect_shipping_address_from_wallet_connector
+ false, // always_collect_billing_address_from_wallet_connector
+ false, // always_collect_shipping_address_from_wallet_connector
+ globalState
+ );
+
+ globalState.set("max_auto_retries_enabled", 0);
+ }
+ );
+
+ cy.step("Create Payment Intent", () => {
+ if (!shouldContinue) {
+ cy.task("cli_log", "Skipping step: Create Payment Intent");
+ return;
+ }
+
+ const data = getConnectorDetails(globalState.get("connectorId"))[
+ "card_pm"
+ ]["PaymentIntent"];
+
+ cy.createPaymentIntentTest(
+ fixtures.createPaymentBody,
+ data,
+ "no_three_ds",
+ "automatic",
+ globalState
+ );
+
+ if (!utils.should_continue_further(data)) {
+ shouldContinue = false;
+ }
+ });
+
+ cy.step("Confirm Payment", () => {
+ if (!shouldContinue) {
+ cy.task("cli_log", "Skipping step: Confirm Payment");
+ return;
+ }
+
+ const activeConnector = globalState.get("connectorId");
+
+ const data =
+ getConnectorDetails(activeConnector)["card_pm"]["No3DSFailPayment"];
+
+ cy.confirmCallAutoRetryTest(
+ fixtures.confirmBody,
+ data,
+ true,
+ globalState
+ );
+ });
+
+ cy.step("Retrieve Payment", () => {
+ if (!shouldContinue) {
+ cy.task("cli_log", "Skipping step: Retrieve Payment");
+ return;
+ }
+
+ const data = getConnectorDetails(globalState.get("connectorId"))[
+ "card_pm"
+ ]["No3DSFailPayment"];
+
+ cy.retrievePaymentCallAutoRetryTest({ globalState, data });
+ });
+ });
+ });
+});
diff --git a/cypress-tests/cypress/e2e/spec/Payment/42-DynamicFields.cy.js b/cypress-tests/cypress/e2e/spec/Payment/43-DynamicFields.cy.js
similarity index 100%
rename from cypress-tests/cypress/e2e/spec/Payment/42-DynamicFields.cy.js
rename to cypress-tests/cypress/e2e/spec/Payment/43-DynamicFields.cy.js
diff --git a/cypress-tests/cypress/e2e/spec/Payment/43-PaymentWebhook.cy.js b/cypress-tests/cypress/e2e/spec/Payment/44-PaymentWebhook.cy.js
similarity index 100%
rename from cypress-tests/cypress/e2e/spec/Payment/43-PaymentWebhook.cy.js
rename to cypress-tests/cypress/e2e/spec/Payment/44-PaymentWebhook.cy.js
diff --git a/cypress-tests/cypress/support/commands.js b/cypress-tests/cypress/support/commands.js
index 7634bd24ab..001c689433 100644
--- a/cypress-tests/cypress/support/commands.js
+++ b/cypress-tests/cypress/support/commands.js
@@ -2386,6 +2386,70 @@ Cypress.Commands.add(
}
);
+Cypress.Commands.add(
+ "confirmCallAutoRetryTest",
+ (confirmBody, data, confirm, globalState) => {
+ const { Request: reqData = {}, Response: resData = {} } = data || {};
+
+ const apiKey = globalState.get("publishableKey");
+ const baseUrl = globalState.get("baseUrl");
+
+ const paymentIntentID = globalState.get("paymentID");
+ const profileId = globalState.get("profileId");
+
+ const maxRetries = globalState.get("max_auto_retries_enabled");
+ const primaryConnector = globalState.get("connectorId");
+ const secondaryConnector = globalState.get("secondaryConnector");
+
+ const url = `${baseUrl}/payments/${paymentIntentID}/confirm`;
+
+ confirmBody.client_secret = globalState.get("clientSecret");
+ confirmBody.confirm = confirm;
+ confirmBody.profile_id = profileId;
+
+ for (const key in reqData) {
+ confirmBody[key] = reqData[key];
+ }
+
+ cy.request({
+ method: "POST",
+ url,
+ headers: {
+ "Content-Type": "application/json",
+ "api-key": apiKey,
+ },
+ failOnStatusCode: false,
+ body: confirmBody,
+ }).then((response) => {
+ logRequestId(response.headers["x-request-id"]);
+ storeRequestId(response.headers["x-request-id"], globalState);
+
+ expect(response.headers["content-type"]).to.include("application/json");
+
+ if (response.status === 200) {
+ expect(paymentIntentID).to.equal(response.body.payment_id);
+
+ if (maxRetries === 0) {
+ // If retries are disabled, it MUST stay on the primary connector and FAIL
+ expect(response.body.connector).to.equal(primaryConnector);
+ expect(response.body.status).to.be.oneOf(["failed", "processing"]);
+ } else {
+ // If retries are enabled, it should have fallen back to the secondary connector
+ expect(response.body.connector).to.equal(secondaryConnector);
+ }
+
+ globalState.set("paymentIntentStatus", response.body.status);
+ globalState.set(
+ "connectorTransactionID",
+ response.body.connector_transaction_id
+ );
+ } else {
+ defaultErrorHandler(response, resData);
+ }
+ });
+ }
+);
+
Cypress.Commands.add(
"confirmBankRedirectCallTest",
(confirmBody, data, confirm, globalState) => {
@@ -3267,6 +3331,57 @@ Cypress.Commands.add(
}
);
+Cypress.Commands.add(
+ "retrievePaymentCallAutoRetryTest",
+ ({ globalState, attempt = null, expectedIntentStatus }) => {
+ const paymentId = globalState.get("paymentID");
+ const baseUrl = globalState.get("baseUrl");
+ const apiKey = globalState.get("apiKey");
+ const maxRetries = globalState.get("max_auto_retries_enabled");
+ const url = `${baseUrl}/payments/${paymentId}?force_sync=true&expand_attempts=true`;
+
+ cy.request({
+ method: "GET",
+ url: url,
+ headers: {
+ "Content-Type": "application/json",
+ "api-key": apiKey,
+ },
+ failOnStatusCode: false,
+ }).then((response) => {
+ logRequestId(response.headers["x-request-id"]);
+ storeRequestId(response.headers["x-request-id"], globalState);
+
+ expect(response.status).to.equal(200);
+ expect(response.headers["content-type"]).to.include("application/json");
+ expect(response.body.payment_id).to.equal(paymentId);
+ expect(response.body.amount).to.equal(globalState.get("paymentAmount"));
+ expect(response.body.profile_id).to.not.be.null;
+ expect(response.body.billing).to.not.be.null;
+ expect(response.body.customer).to.not.be.empty;
+
+ if (expectedIntentStatus) {
+ expect(response.body.status).to.equal(expectedIntentStatus);
+ }
+
+ if (response.body.attempts && response.body.attempts.length > 0) {
+ // Expected attempts = initial attempt (1) + max_auto_retries
+ const expectedAttempts = (maxRetries || 0) + 1;
+
+ expect(response.body.attempts.length).to.equal(expectedAttempts);
+ expect(response.body.attempt_count).to.equal(
+ attempt || expectedAttempts
+ );
+
+ response.body.attempts.forEach((attemptObj) => {
+ expect(attemptObj.attempt_id).to.include(paymentId);
+ expect(attemptObj.connector).to.not.be.null;
+ });
+ }
+ });
+ }
+);
+
Cypress.Commands.add("refundCallTest", (requestBody, data, globalState) => {
const {
Configs: configs = {},