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
ci(cypress): add external authentication flow for peachpaymenets (#15129)
likhinbopanna36bdbea60cfa
diff --git a/cypress-tests/cypress/e2e/configs/Payment/Commons.js b/cypress-tests/cypress/e2e/configs/Payment/Commons.jsindex aade4c9cd1..fcd2265635 100644--- a/cypress-tests/cypress/e2e/configs/Payment/Commons.js+++ b/cypress-tests/cypress/e2e/configs/Payment/Commons.js@@ -5985,6 +5985,16 @@ export const connectorDetails = {body: {},},}),+ ThreeDSAuthenticationFrictionless: getCustomExchange({+ Request: {+ device_channel: "BRW",+ threeds_method_comp_ind: "Y",+ },+ Response: {+ status: 200,+ body: { trans_status: "Y" },+ },+ }),ThreeDSAuthenticationUnconfirmed: getCustomExchange({Request: {device_channel: "BRW",diff --git a/cypress-tests/cypress/e2e/configs/Payment/Peachpayments.js b/cypress-tests/cypress/e2e/configs/Payment/Peachpayments.jsindex e6cc954d07..b163dc6cac 100644--- a/cypress-tests/cypress/e2e/configs/Payment/Peachpayments.js+++ b/cypress-tests/cypress/e2e/configs/Payment/Peachpayments.js@@ -61,7 +61,45 @@ const billingAddress = {},};+// These cards exercise Netcetera's sandbox authentication scenarios.+const stepUpConfirm = (cardNumber) => ({+ Request: {+ payment_method: "card",+ payment_method_data: {+ card: {+ card_number: cardNumber,+ card_exp_month: "01",+ card_exp_year: "50",+ card_holder_name: "joseph Doe",+ card_cvc: "123",+ },+ },+ currency: "USD",+ authentication_type: "three_ds",+ request_external_three_ds_authentication: true,+ setup_future_usage: "off_session",+ billing: billingAddress,+ },+ Response: {+ status: 200,+ body: {+ status: "requires_customer_action",+ authentication_type: "three_ds",+ },+ },+});+export const connectorDetails = {+ step_up_auth: {+ ConfirmPayment: stepUpConfirm("4000000000002701"),+ StepUpAuthWithMerchantCodes: stepUpConfirm("4000000000002701"),+ ThreeDSAuthenticationWithMerchantCodes: {+ Request: { device_channel: "BRW", threeds_method_comp_ind: "Y" },+ Response: { status: 200, body: {} },+ },+ ConfirmPaymentVisaFrictionless: stepUpConfirm("5522604003479299"),+ ConfirmPaymentMastercardChallenge: stepUpConfirm("5306889942833340"),+ },card_pm: {PaymentIntent: {Request: {diff --git a/cypress-tests/cypress/e2e/configs/Payment/Utils.js b/cypress-tests/cypress/e2e/configs/Payment/Utils.jsindex b99c4fcc70..2950884eff 100644--- a/cypress-tests/cypress/e2e/configs/Payment/Utils.js+++ b/cypress-tests/cypress/e2e/configs/Payment/Utils.js@@ -781,7 +781,7 @@ export const CONNECTOR_LISTS = {PAYJUSTNOWINSTORE: ["payjustnowinstore"],AUTH_SERVICE_ELIGIBILITY: ["stripe", "cybersource"],VAULT_TOKENIZATION: ["stripe"],- STEP_UP_AUTH: ["cybersource"],+ STEP_UP_AUTH: ["cybersource", "peachpayments"],PARTIAL_AUTH: ["nuvei", "checkout", "worldpayvantiv"],PAYMENT_RESPONSE_HASH: ["stripe"],MULTIPLE_CAPTURE: ["adyen", "checkout"],diff --git a/cypress-tests/cypress/e2e/spec/Payment/47-StepUpAuth.cy.js b/cypress-tests/cypress/e2e/spec/Payment/47-StepUpAuth.cy.jsindex f7610fecd7..f46f13bf4e 100644--- a/cypress-tests/cypress/e2e/spec/Payment/47-StepUpAuth.cy.js+++ b/cypress-tests/cypress/e2e/spec/Payment/47-StepUpAuth.cy.js@@ -68,32 +68,41 @@ describe("Step-Up Auth payment flow test", () => {cy.task("setGlobalState", globalState.data);});- it("create authentication processor connector", () => {- const createConnectorBody = { ...fixtures.createConnectorBody };- createConnectorBody.connector_name = "netcetera";-- cy.createAuthenticationProcessorConnectorTest(- createConnectorBody,- globalState- );- });-- it("update business profile with auth connector", () => {- const bpUpdateAuthConnector = {- authentication_connector_details: {- authentication_connectors: ["netcetera"],- three_ds_requestor_url: "https://example.com",- },- };- cy.UpdateBusinessProfileTest(- bpUpdateAuthConnector,- false,- false,- false,- false,- false,- globalState- );+ it("Create authentication processor and update profile", () => {+ cy.step("create authentication processor connector", () => {+ const createConnectorBody = { ...fixtures.createConnectorBody };+ createConnectorBody.connector_name = "netcetera";++ cy.createAuthenticationProcessorConnectorTest(+ createConnectorBody,+ globalState+ );+ });++ cy.step("update business profile with auth connector", () => {+ if (!globalState.get("authProcessorConnectorId")) {+ cy.task(+ "cli_log",+ "Skipping step: update business profile with auth connector"+ );+ return;+ }+ const bpUpdateAuthConnector = {+ authentication_connector_details: {+ authentication_connectors: ["netcetera"],+ three_ds_requestor_url: "https://example.com",+ },+ };+ cy.UpdateBusinessProfileTest(+ bpUpdateAuthConnector,+ false,+ false,+ false,+ false,+ false,+ globalState+ );+ });});});@@ -119,7 +128,101 @@ describe("Step-Up Auth payment flow test", () => {cy.task("setGlobalState", globalState.data);});- it("create payment intent with three_ds", () => {+ it("Create, confirm, authenticate and retrieve payment", () => {+ cy.step("create payment intent with three_ds", () => {+ const data = getConnectorDetails(globalState.get("connectorId"))[+ "step_up_auth"+ ]["PaymentIntentOnly"];++ cy.createPaymentIntentTest(+ fixtures.createPaymentBody,+ data,+ "three_ds",+ "automatic",+ globalState+ );++ if (!utils.should_continue_further(data)) {+ shouldContinue = false;+ }+ });++ cy.step("confirm payment with three_ds card", () => {+ if (!shouldContinue) {+ cy.task(+ "cli_log",+ "Skipping step: confirm payment with three_ds card"+ );+ return;+ }+ const data = getConnectorDetails(globalState.get("connectorId"))[+ "step_up_auth"+ ]["ConfirmPayment"];++ cy.createConfirmPaymentTest(+ fixtures.createConfirmPaymentBody,+ data,+ "three_ds",+ "automatic",+ globalState+ );++ if (!utils.should_continue_further(data)) {+ shouldContinue = false;+ }+ });++ cy.step("call 3ds authentication endpoint", () => {+ if (!shouldContinue) {+ cy.task(+ "cli_log",+ "Skipping step: call 3ds authentication endpoint"+ );+ return;+ }+ const data = getConnectorDetails(globalState.get("connectorId"))[+ "step_up_auth"+ ]["ThreeDSAuthentication"];++ cy.threeDSAuthenticationCallTest(+ fixtures.threeDSAuthenticationBody,+ data,+ globalState+ );+ });++ cy.step("retrieve payment", () => {+ if (!shouldContinue) {+ cy.task("cli_log", "Skipping step: retrieve payment");+ return;+ }+ cy.retrievePaymentCallTest({ globalState });+ });+ });+ }+ );++ context("Step-Up Auth negative - 3ds auth without confirmed payment", () => {+ let shouldContinue = true;++ before(function () {+ if (!globalState.get("authProcessorConnectorId")) {+ shouldContinue = false;+ }+ });++ beforeEach(function () {+ if (!shouldContinue) {+ this.skip();+ }+ });++ afterEach("flush global state", () => {+ cy.task("setGlobalState", globalState.data);+ });++ it("Reject authentication without a confirmed payment", () => {+ cy.step("create payment intent with three_ds only", () => {const data = getConnectorDetails(globalState.get("connectorId"))["step_up_auth"]["PaymentIntentOnly"];@@ -137,39 +240,17 @@ describe("Step-Up Auth payment flow test", () => {}});- it("confirm payment with three_ds card", () => {+ cy.step("call 3ds authentication - should fail with IR_16", () => {if (!shouldContinue) {cy.task("cli_log",- "Skipping step: confirm payment with three_ds card"+ "Skipping step: call 3ds authentication - should fail with IR_16");return;}const data = getConnectorDetails(globalState.get("connectorId"))["step_up_auth"- ]["ConfirmPayment"];-- cy.createConfirmPaymentTest(- fixtures.createConfirmPaymentBody,- data,- "three_ds",- "automatic",- globalState- );-- if (!utils.should_continue_further(data)) {- shouldContinue = false;- }- });-- it("call 3ds authentication endpoint", () => {- if (!shouldContinue) {- cy.task("cli_log", "Skipping step: call 3ds authentication endpoint");- return;- }- const data = getConnectorDetails(globalState.get("connectorId"))[- "step_up_auth"- ]["ThreeDSAuthentication"];+ ]["ThreeDSAuthenticationUnconfirmed"];cy.threeDSAuthenticationCallTest(fixtures.threeDSAuthenticationBody,@@ -177,71 +258,6 @@ describe("Step-Up Auth payment flow test", () => {globalState);});-- it("retrieve payment", () => {- if (!shouldContinue) {- cy.task("cli_log", "Skipping step: retrieve payment");- return;- }- cy.retrievePaymentCallTest({ globalState });- });- }- );-- context("Step-Up Auth negative - 3ds auth without confirmed payment", () => {- let shouldContinue = true;-- before(function () {- if (!globalState.get("authProcessorConnectorId")) {- shouldContinue = false;- }- });-- beforeEach(function () {- if (!shouldContinue) {- this.skip();- }- });-- afterEach("flush global state", () => {- cy.task("setGlobalState", globalState.data);- });-- it("create payment intent with three_ds only", () => {- const data = getConnectorDetails(globalState.get("connectorId"))[- "step_up_auth"- ]["PaymentIntentOnly"];-- cy.createPaymentIntentTest(- fixtures.createPaymentBody,- data,- "three_ds",- "automatic",- globalState- );-- if (!utils.should_continue_further(data)) {- shouldContinue = false;- }- });-- it("call 3ds authentication - should fail with IR_04", () => {- if (!shouldContinue) {- cy.task(- "cli_log",- "Skipping step: call 3ds authentication - should fail with IR_04"- );- return;- }- const data = getConnectorDetails(globalState.get("connectorId"))[- "step_up_auth"- ]["ThreeDSAuthenticationUnconfirmed"];-- cy.threeDSAuthenticationCallTest(- fixtures.threeDSAuthenticationBody,- data,- globalState- );});});@@ -280,93 +296,8 @@ describe("Step-Up Auth payment flow test", () => {cy.task("setGlobalState", globalState.data);});- it("create payment intent with three_ds", () => {- const data = getConnectorDetails(globalState.get("connectorId"))[- "step_up_auth"- ]["PaymentIntentOnly"];-- cy.createPaymentIntentTest(- fixtures.createPaymentBody,- data,- "three_ds",- "automatic",- globalState- );-- if (!utils.should_continue_further(data)) {- shouldContinue = false;- }- });-- it("confirm payment with three_ds card", () => {- if (!shouldContinue) {- cy.task("cli_log", "Skipping step: confirm payment with three_ds card");- return;- }- const data = getConnectorDetails(globalState.get("connectorId"))[- "step_up_auth"- ]["StepUpAuthWithMerchantCodes"];-- cy.createConfirmPaymentTest(- fixtures.createConfirmPaymentBody,- data,- "three_ds",- "automatic",- globalState- );-- if (!utils.should_continue_further(data)) {- shouldContinue = false;- }- });-- it("call 3ds authentication endpoint", () => {- if (!shouldContinue) {- cy.task("cli_log", "Skipping step: call 3ds authentication endpoint");- return;- }- const data = getConnectorDetails(globalState.get("connectorId"))[- "step_up_auth"- ]["ThreeDSAuthenticationWithMerchantCodes"];-- cy.threeDSAuthenticationCallTest(- fixtures.threeDSAuthenticationBody,- data,- globalState- );- });-- it("retrieve payment", () => {- if (!shouldContinue) {- cy.task("cli_log", "Skipping step: retrieve payment");- return;- }- cy.retrievePaymentCallTest({ globalState });- });- });-- context(- "Step-Up Auth Visa frictionless - create, confirm, authenticate and retrieve",- () => {- let shouldContinue = true;-- before(function () {- if (!globalState.get("authProcessorConnectorId")) {- shouldContinue = false;- }- });-- beforeEach(function () {- if (!shouldContinue) {- this.skip();- }- });-- afterEach("flush global state", () => {- cy.task("setGlobalState", globalState.data);- });-- it("create payment intent with three_ds for visa frictionless", () => {+ it("Authenticate payment with merchant codes", () => {+ cy.step("create payment intent with three_ds", () => {const data = getConnectorDetails(globalState.get("connectorId"))["step_up_auth"]["PaymentIntentOnly"];@@ -384,17 +315,17 @@ describe("Step-Up Auth payment flow test", () => {}});- it("confirm payment with visa frictionless card", () => {+ cy.step("confirm payment with three_ds card", () => {if (!shouldContinue) {cy.task("cli_log",- "Skipping step: confirm payment with visa frictionless card"+ "Skipping step: confirm payment with three_ds card");return;}const data = getConnectorDetails(globalState.get("connectorId"))["step_up_auth"- ]["ConfirmPaymentVisaFrictionless"];+ ]["StepUpAuthWithMerchantCodes"];cy.createConfirmPaymentTest(fixtures.createConfirmPaymentBody,@@ -409,59 +340,34 @@ describe("Step-Up Auth payment flow test", () => {}});- it("call 3ds authentication endpoint for visa frictionless", () => {+ cy.step("call 3ds authentication endpoint", () => {if (!shouldContinue) {- cy.task(- "cli_log",- "Skipping step: call 3ds authentication endpoint for visa frictionless"- );+ cy.task("cli_log", "Skipping step: call 3ds authentication endpoint");return;}const data = getConnectorDetails(globalState.get("connectorId"))["step_up_auth"- ]["ThreeDSAuthentication"];+ ]["ThreeDSAuthenticationWithMerchantCodes"];cy.threeDSAuthenticationCallTest(fixtures.threeDSAuthenticationBody,data,globalState);-- if (!utils.should_continue_further(data)) {- shouldContinue = false;- }});- it("authorize payment after visa frictionless authentication", () => {+ cy.step("retrieve payment", () => {if (!shouldContinue) {- cy.task(- "cli_log",- "Skipping step: authorize payment after visa frictionless authentication"- );- return;- }- const data = getConnectorDetails(globalState.get("connectorId"))[- "step_up_auth"- ]["AuthorizeAfterFrictionlessAuth"];-- cy.authorizeViaThreeDsAuthorizeUrlTest(data, globalState);- });-- it("retrieve payment for visa frictionless", () => {- if (!shouldContinue) {- cy.task(- "cli_log",- "Skipping step: retrieve payment for visa frictionless"- );+ cy.task("cli_log", "Skipping step: retrieve payment");return;}cy.retrievePaymentCallTest({ globalState });});- }- );+ });+ });context(- "Step-Up Auth Mastercard challenge - create, confirm, authenticate and retrieve",+ "Step-Up Auth Visa frictionless - create, confirm, authenticate and retrieve",() => {let shouldContinue = true;@@ -481,77 +387,211 @@ describe("Step-Up Auth payment flow test", () => {cy.task("setGlobalState", globalState.data);});- it("create payment intent with three_ds for mastercard challenge", () => {- const data = getConnectorDetails(globalState.get("connectorId"))[- "step_up_auth"- ]["PaymentIntentOnly"];-- cy.createPaymentIntentTest(- fixtures.createPaymentBody,- data,- "three_ds",- "automatic",- globalState+ it("Authenticate and authorize a Visa frictionless payment", () => {+ cy.step(+ "create payment intent with three_ds for visa frictionless",+ () => {+ const data = getConnectorDetails(globalState.get("connectorId"))[+ "step_up_auth"+ ]["PaymentIntentOnly"];++ cy.createPaymentIntentTest(+ fixtures.createPaymentBody,+ data,+ "three_ds",+ "automatic",+ globalState+ );++ if (!utils.should_continue_further(data)) {+ shouldContinue = false;+ }+ });- if (!utils.should_continue_further(data)) {- shouldContinue = false;- }- });-- it("confirm payment with mastercard challenge card", () => {- if (!shouldContinue) {- cy.task(- "cli_log",- "Skipping step: confirm payment with mastercard challenge card"+ cy.step("confirm payment with visa frictionless card", () => {+ if (!shouldContinue) {+ cy.task(+ "cli_log",+ "Skipping step: confirm payment with visa frictionless card"+ );+ return;+ }+ const data = getConnectorDetails(globalState.get("connectorId"))[+ "step_up_auth"+ ]["ConfirmPaymentVisaFrictionless"];++ cy.createConfirmPaymentTest(+ fixtures.createConfirmPaymentBody,+ data,+ "three_ds",+ "automatic",+ globalState);- return;- }- const data = getConnectorDetails(globalState.get("connectorId"))[- "step_up_auth"- ]["ConfirmPaymentMastercardChallenge"];- cy.createConfirmPaymentTest(- fixtures.createConfirmPaymentBody,- data,- "three_ds",- "automatic",- globalState+ if (!utils.should_continue_further(data)) {+ shouldContinue = false;+ }+ });++ cy.step(+ "call 3ds authentication endpoint for visa frictionless",+ () => {+ if (!shouldContinue) {+ cy.task(+ "cli_log",+ "Skipping step: call 3ds authentication endpoint for visa frictionless"+ );+ return;+ }+ const data = getConnectorDetails(globalState.get("connectorId"))[+ "step_up_auth"+ ]["ThreeDSAuthenticationFrictionless"];++ cy.threeDSAuthenticationCallTest(+ fixtures.threeDSAuthenticationBody,+ data,+ globalState+ );++ if (!utils.should_continue_further(data)) {+ shouldContinue = false;+ }+ });- if (!utils.should_continue_further(data)) {+ cy.step(+ "authorize payment after visa frictionless authentication",+ () => {+ if (!shouldContinue) {+ cy.task(+ "cli_log",+ "Skipping step: authorize payment after visa frictionless authentication"+ );+ return;+ }+ const data = getConnectorDetails(globalState.get("connectorId"))[+ "step_up_auth"+ ]["AuthorizeAfterFrictionlessAuth"];++ cy.authorizeViaThreeDsAuthorizeUrlTest(data, globalState);+ }+ );++ cy.step("retrieve payment for visa frictionless", () => {+ if (!shouldContinue) {+ cy.task(+ "cli_log",+ "Skipping step: retrieve payment for visa frictionless"+ );+ return;+ }+ cy.retrievePaymentCallTest({ globalState });+ });+ });+ }+ );++ context(+ "Step-Up Auth Mastercard challenge - create, confirm, authenticate and retrieve",+ () => {+ let shouldContinue = true;++ before(function () {+ if (!globalState.get("authProcessorConnectorId")) {shouldContinue = false;}});- it("call 3ds authentication endpoint for mastercard challenge", () => {+ beforeEach(function () {if (!shouldContinue) {- cy.task(- "cli_log",- "Skipping step: call 3ds authentication endpoint for mastercard challenge"- );- return;+ this.skip();}- const data = getConnectorDetails(globalState.get("connectorId"))[- "step_up_auth"- ]["ThreeDSAuthentication"];+ });- cy.threeDSAuthenticationCallTest(- fixtures.threeDSAuthenticationBody,- data,- globalState- );+ afterEach("flush global state", () => {+ cy.task("setGlobalState", globalState.data);});- it("retrieve payment for mastercard challenge", () => {- if (!shouldContinue) {- cy.task(- "cli_log",- "Skipping step: retrieve payment for mastercard challenge"+ it("Authenticate a Mastercard challenge payment", () => {+ cy.step(+ "create payment intent with three_ds for mastercard challenge",+ () => {+ const data = getConnectorDetails(globalState.get("connectorId"))[+ "step_up_auth"+ ]["PaymentIntentOnly"];++ cy.createPaymentIntentTest(+ fixtures.createPaymentBody,+ data,+ "three_ds",+ "automatic",+ globalState+ );++ if (!utils.should_continue_further(data)) {+ shouldContinue = false;+ }+ }+ );++ cy.step("confirm payment with mastercard challenge card", () => {+ if (!shouldContinue) {+ cy.task(+ "cli_log",+ "Skipping step: confirm payment with mastercard challenge card"+ );+ return;+ }+ const data = getConnectorDetails(globalState.get("connectorId"))[+ "step_up_auth"+ ]["ConfirmPaymentMastercardChallenge"];++ cy.createConfirmPaymentTest(+ fixtures.createConfirmPaymentBody,+ data,+ "three_ds",+ "automatic",+ globalState);- return;- }- cy.retrievePaymentCallTest({ globalState });++ if (!utils.should_continue_further(data)) {+ shouldContinue = false;+ }+ });++ cy.step(+ "call 3ds authentication endpoint for mastercard challenge",+ () => {+ if (!shouldContinue) {+ cy.task(+ "cli_log",+ "Skipping step: call 3ds authentication endpoint for mastercard challenge"+ );+ return;+ }+ const data = getConnectorDetails(globalState.get("connectorId"))[+ "step_up_auth"+ ]["ThreeDSAuthentication"];++ cy.threeDSAuthenticationCallTest(+ fixtures.threeDSAuthenticationBody,+ data,+ globalState+ );+ }+ );++ cy.step("retrieve payment for mastercard challenge", () => {+ if (!shouldContinue) {+ cy.task(+ "cli_log",+ "Skipping step: retrieve payment for mastercard challenge"+ );+ return;+ }+ cy.retrievePaymentCallTest({ globalState });+ });});});diff --git a/cypress-tests/cypress/support/commands.js b/cypress-tests/cypress/support/commands.jsindex e7e073e847..0b8aaa02e0 100644--- a/cypress-tests/cypress/support/commands.js+++ b/cypress-tests/cypress/support/commands.js@@ -2131,6 +2131,7 @@ Cypress.Commands.add(logRequestId(response.headers["x-request-id"]);cy.wrap(response).then(() => {+ expect(response.status).to.eq(resData.status);if (response.status === 200) {expect(response.headers["content-type"]).to.include("application/json"