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
feat(cypress): add cypress test-cases for manual retry (#9505)
Sakil Mostak1ff66a720b29
diff --git a/cypress-tests/cypress/e2e/configs/Payment/Commons.js b/cypress-tests/cypress/e2e/configs/Payment/Commons.jsindex d39270c695..c014761bf0 100644--- a/cypress-tests/cypress/e2e/configs/Payment/Commons.js+++ b/cypress-tests/cypress/e2e/configs/Payment/Commons.js@@ -738,6 +738,62 @@ export const connectorDetails = {body: {},},}),+ ManualRetryPaymentDisabled: getCustomExchange({+ Request: {+ payment_method: "card",+ payment_method_data: {+ card: successfulNo3DSCardDetails,+ },+ customer_acceptance: null,+ setup_future_usage: "on_session",+ },+ Response: {+ status: 400,+ body: {+ type: "invalid_request",+ message:+ "You cannot confirm this payment because it has status failed, you can enable `manual_retry` in profile to try this payment again",+ code: "IR_16",+ },+ },+ }),+ ManualRetryPaymentEnabled: getCustomExchange({+ Request: {+ payment_method: "card",+ payment_method_data: {+ card: successfulNo3DSCardDetails,+ },+ customer_acceptance: null,+ setup_future_usage: "on_session",+ },+ Response: {+ status: 200,+ body: {+ status: "succeeded",+ payment_method: "card",+ attempt_count: 2,+ },+ },+ }),+ ManualRetryPaymentCutoffExpired: getCustomExchange({+ Request: {+ payment_method: "card",+ payment_method_data: {+ card: successfulNo3DSCardDetails,+ },+ customer_acceptance: null,+ setup_future_usage: "on_session",+ },+ Response: {+ status: 400,+ body: {+ type: "invalid_request",+ message:+ "You cannot confirm this payment using `manual_retry` because the allowed duration has expired",+ code: "IR_16",+ },+ },+ }),Capture: getCustomExchange({Request: {amount_to_capture: 6000,diff --git a/cypress-tests/cypress/e2e/configs/Payment/Cybersource.js b/cypress-tests/cypress/e2e/configs/Payment/Cybersource.jsindex ed689ebc69..877d5dc5df 100644--- a/cypress-tests/cypress/e2e/configs/Payment/Cybersource.js+++ b/cypress-tests/cypress/e2e/configs/Payment/Cybersource.js@@ -288,6 +288,161 @@ export const connectorDetails = {},},},+ No3DSFailPayment: {+ Request: {+ payment_method: "card",+ payment_method_data: {+ billing: {+ address: {+ city: "sakilmostak",+ country: "US",+ line1: "here",+ line2: "there",+ line3: "anywhere",+ zip: "560090",+ state: "Washingtonr",+ first_name: "One",+ last_name: "Two",+ },+ phone: {+ number: "1234567890",+ country_code: "+1",+ },+ email: "[email protected]",+ },+ card: successfulNo3DSCardDetails,+ },+ currency: "USD",+ customer_acceptance: null,+ setup_future_usage: "on_session",+ billing: billing_with_newline,+ },+ Response: {+ status: 200,+ body: {+ status: "failed",+ error_message:+ "Declined - One or more fields in the request contains invalid data, detailed_error_information: orderInformation.billTo.administrativeArea : INVALID_DATA",+ attempt_count: 1,+ },+ },+ },+ ManualRetryPaymentDisabled: {+ Request: {+ payment_method: "card",+ payment_method_data: {+ billing: {+ address: {+ city: "sakilmostak",+ country: "US",+ line1: "here",+ line2: "there",+ line3: "anywhere",+ zip: "560090",+ state: "Washingtonr",+ first_name: "One",+ last_name: "Two",+ },+ phone: {+ number: "1234567890",+ country_code: "+1",+ },+ email: "[email protected]",+ },+ card: successfulNo3DSCardDetails,+ },+ currency: "USD",+ customer_acceptance: null,+ setup_future_usage: "on_session",+ billing: billing_with_newline,+ },+ Response: {+ status: 400,+ body: {+ type: "invalid_request",+ message:+ "You cannot confirm this payment because it has status failed, you can enable `manual_retry` in profile to try this payment again",+ code: "IR_16",+ },+ },+ },+ ManualRetryPaymentEnabled: {+ Request: {+ payment_method: "card",+ payment_method_data: {+ billing: {+ address: {+ city: "sakilmostak",+ country: "US",+ line1: "here",+ line2: "there",+ line3: "anywhere",+ zip: "560090",+ state: "Washington",+ first_name: "One",+ last_name: "Two",+ },+ phone: {+ number: "1234567890",+ country_code: "+1",+ },+ email: "[email protected]",+ },+ card: successfulNo3DSCardDetails,+ },+ currency: "USD",+ customer_acceptance: null,+ setup_future_usage: "on_session",+ billing: billing_with_newline,+ },+ Response: {+ status: 200,+ body: {+ status: "succeeded",+ payment_method: "card",+ attempt_count: 2,+ },+ },+ },+ ManualRetryPaymentCutoffExpired: {+ Request: {+ payment_method: "card",+ payment_method_data: {+ billing: {+ address: {+ city: "sakilmostak",+ country: "US",+ line1: "here",+ line2: "there",+ line3: "anywhere",+ zip: "560090",+ state: "Washington",+ first_name: "One",+ last_name: "Two",+ },+ phone: {+ number: "1234567890",+ country_code: "+1",+ },+ email: "[email protected]",+ },+ card: successfulNo3DSCardDetails,+ },+ currency: "USD",+ customer_acceptance: null,+ setup_future_usage: "on_session",+ billing: billing_with_newline,+ },+ Response: {+ status: 400,+ body: {+ type: "invalid_request",+ message:+ "You cannot confirm this payment using `manual_retry` because the allowed duration has expired",+ code: "IR_16",+ },+ },+ },Capture: {Configs: {CONNECTOR_CREDENTIAL: {diff --git a/cypress-tests/cypress/e2e/configs/Payment/Utils.js b/cypress-tests/cypress/e2e/configs/Payment/Utils.jsindex 4edb577a10..90166c488e 100644--- a/cypress-tests/cypress/e2e/configs/Payment/Utils.js+++ b/cypress-tests/cypress/e2e/configs/Payment/Utils.js@@ -416,6 +416,7 @@ export const CONNECTOR_LISTS = {// ucs connectorsUCS_CONNECTORS: ["authorizedotnet"],OVERCAPTURE: ["adyen"],+ MANUAL_RETRY: ["cybersource"],// Add more inclusion lists},};diff --git a/cypress-tests/cypress/e2e/spec/Payment/00032-ManualRetry.cy.js b/cypress-tests/cypress/e2e/spec/Payment/00032-ManualRetry.cy.jsnew file mode 100644index 0000000000..958b208f53--- /dev/null+++ b/cypress-tests/cypress/e2e/spec/Payment/00032-ManualRetry.cy.js@@ -0,0 +1,306 @@+import * as fixtures from "../../../fixtures/imports";+import State from "../../../utils/State";+import getConnectorDetails, * as utils from "../../configs/Payment/Utils";++const MANUAL_RETRY_EXPIRATION = 35000;++describe("Manual Retry Tests", () => {+ let globalState;++ before("seed global state", () => {+ cy.task("getGlobalState").then((state) => {+ globalState = new State(state);+ });+ });++ after("flush global state", () => {+ cy.task("setGlobalState", globalState.data);+ });++ context("manual-retry-disabled-test", () => {+ let shouldContinue = true; // variable that will be used to skip tests if a previous test fails++ beforeEach(function () {+ if (!shouldContinue) {+ this.skip();+ }++ const connectorId = globalState.get("connectorId");+ if (+ utils.shouldIncludeConnector(+ connectorId,+ utils.CONNECTOR_LISTS.INCLUDE.MANUAL_RETRY+ )+ ) {+ cy.log(+ `Skipping Manul Retry - connector not supported: ${connectorId}`+ );+ this.skip();+ }+ });++ it("Update Profile with is_manual_retry_enabled", () => {+ const updateBusinessProfileBody = {+ is_manual_retry_enabled: false,+ };+ 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+ );+ });++ it("create-payment-call-test", () => {+ const data = getConnectorDetails(globalState.get("connectorId"))[+ "card_pm"+ ]["PaymentIntent"];++ cy.createPaymentIntentTest(+ fixtures.createPaymentBody,+ data,+ "no_three_ds",+ "automatic",+ globalState+ );++ if (shouldContinue) shouldContinue = utils.should_continue_further(data);+ });++ it("First Confirm with Failed Status", () => {+ const data = getConnectorDetails(globalState.get("connectorId"))[+ "card_pm"+ ]["No3DSFailPayment"];++ cy.confirmCallTest(fixtures.confirmBody, data, true, globalState);+ });++ it("Second Confirm with Error thrown", () => {+ const data = getConnectorDetails(globalState.get("connectorId"))[+ "card_pm"+ ]["ManualRetryPaymentDisabled"];++ cy.confirmCallTest(fixtures.confirmBody, data, true, globalState);++ if (shouldContinue) shouldContinue = utils.should_continue_further(data);+ });+ });++ context("manual-retry-enabled-test", () => {+ let shouldContinue = true; // variable that will be used to skip tests if a previous test fails++ beforeEach(function () {+ if (!shouldContinue) {+ this.skip();+ }++ const connectorId = globalState.get("connectorId");+ if (+ utils.shouldIncludeConnector(+ connectorId,+ utils.CONNECTOR_LISTS.INCLUDE.MANUAL_RETRY+ )+ ) {+ cy.log(+ `Skipping Manul Retry - connector not supported: ${connectorId}`+ );+ this.skip();+ }+ });++ it("Update Profile with is_manual_retry_enabled", () => {+ const updateBusinessProfileBody = {+ is_manual_retry_enabled: true,+ };+ 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+ );+ });++ it("create-payment-call-test", () => {+ const data = getConnectorDetails(globalState.get("connectorId"))[+ "card_pm"+ ]["PaymentIntent"];++ cy.createPaymentIntentTest(+ fixtures.createPaymentBody,+ data,+ "no_three_ds",+ "automatic",+ globalState+ );++ if (shouldContinue) shouldContinue = utils.should_continue_further(data);+ });++ it("First Confirm with Failed Status", () => {+ const data = getConnectorDetails(globalState.get("connectorId"))[+ "card_pm"+ ]["No3DSFailPayment"];++ cy.confirmCallTest(fixtures.confirmBody, data, true, globalState);+ });++ it("Retry Confirm with Successful Status", () => {+ const data = getConnectorDetails(globalState.get("connectorId"))[+ "card_pm"+ ]["ManualRetryPaymentEnabled"];++ cy.confirmCallTest(fixtures.confirmBody, data, true, globalState);++ if (shouldContinue) shouldContinue = utils.should_continue_further(data);+ });+ });++ context("manual-retry-cutoff-test", () => {+ let shouldContinue = true; // variable that will be used to skip tests if a previous test fails++ beforeEach(function () {+ if (!shouldContinue) {+ this.skip();+ }++ const connectorId = globalState.get("connectorId");+ if (+ utils.shouldIncludeConnector(+ connectorId,+ utils.CONNECTOR_LISTS.INCLUDE.MANUAL_RETRY+ )+ ) {+ cy.log(+ `Skipping Manul Retry - connector not supported: ${connectorId}`+ );+ this.skip();+ }+ });++ it("Update Profile with is_manual_retry_enabled", () => {+ const updateBusinessProfileBody = {+ is_manual_retry_enabled: true,+ session_expiry: 60,+ };+ 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+ );+ });++ it("create-payment-call-test", () => {+ const data = getConnectorDetails(globalState.get("connectorId"))[+ "card_pm"+ ]["PaymentIntent"];++ cy.createPaymentIntentTest(+ fixtures.createPaymentBody,+ data,+ "no_three_ds",+ "automatic",+ globalState+ );++ if (shouldContinue) shouldContinue = utils.should_continue_further(data);+ });++ it("First Confirm with Failed Status", () => {+ const data = getConnectorDetails(globalState.get("connectorId"))[+ "card_pm"+ ]["No3DSFailPayment"];++ cy.confirmCallTest(fixtures.confirmBody, data, true, globalState);+ });++ it("Retry Confirm after cutoff is expired (Should Throw Error)", () => {+ // wait for 35 seconds+ // eslint-disable-next-line cypress/no-unnecessary-waiting+ cy.wait(MANUAL_RETRY_EXPIRATION);+ const data = getConnectorDetails(globalState.get("connectorId"))[+ "card_pm"+ ]["ManualRetryPaymentCutoffExpired"];++ cy.confirmCallTest(fixtures.confirmBody, data, true, globalState);++ if (shouldContinue) shouldContinue = utils.should_continue_further(data);+ });+ });++ context("first-confirm-after-cutoff-test", () => {+ let shouldContinue = true; // variable that will be used to skip tests if a previous test fails++ beforeEach(function () {+ if (!shouldContinue) {+ this.skip();+ }++ const connectorId = globalState.get("connectorId");+ if (+ utils.shouldIncludeConnector(+ connectorId,+ utils.CONNECTOR_LISTS.INCLUDE.MANUAL_RETRY+ )+ ) {+ cy.log(+ `Skipping Manul Retry - connector not supported: ${connectorId}`+ );+ this.skip();+ }+ });++ it("Update Profile with is_manual_retry_enabled", () => {+ const updateBusinessProfileBody = {+ is_manual_retry_enabled: true,+ session_expiry: 60,+ };+ 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+ );+ });++ it("create-payment-call-test", () => {+ const data = getConnectorDetails(globalState.get("connectorId"))[+ "card_pm"+ ]["PaymentIntent"];++ cy.createPaymentIntentTest(+ fixtures.createPaymentBody,+ data,+ "no_three_ds",+ "automatic",+ globalState+ );++ if (shouldContinue) shouldContinue = utils.should_continue_further(data);+ });++ it("First Confirm after Manual Retry Cutoff (Should Succeed)", () => {+ // wait for 35 seconds+ // eslint-disable-next-line cypress/no-unnecessary-waiting+ cy.wait(MANUAL_RETRY_EXPIRATION);++ const data = getConnectorDetails(globalState.get("connectorId"))[+ "card_pm"+ ]["No3DSAutoCapture"];++ cy.confirmCallTest(fixtures.confirmBody, data, true, globalState);+ });+ });+});