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 PML test and Dynamic Fields Test for Novalnet (#6544)
Debarati Ghatak638e1f230a54
diff --git a/cypress-tests/cypress/e2e/PaymentMethodListTest/00000-PaymentMethodListTests.cy.js b/cypress-tests/cypress/e2e/PaymentMethodListTest/00000-PaymentMethodListTests.cy.jsindex 89b27a6b27..0f754831d4 100644--- a/cypress-tests/cypress/e2e/PaymentMethodListTest/00000-PaymentMethodListTests.cy.js+++ b/cypress-tests/cypress/e2e/PaymentMethodListTest/00000-PaymentMethodListTests.cy.js@@ -6,6 +6,7 @@ import {cardCreditEnabled,cardCreditEnabledInUs,cardCreditEnabledInUsd,+ cardCreditEnabledInEur,createPaymentBodyWithCurrency,createPaymentBodyWithCurrencyCountry,} from "../PaymentMethodListUtils/Commons";@@ -68,7 +69,8 @@ describe("Payment Method list using Constraint Graph flow tests", () => {// creating payment with currency as EUR and no billing addressit("create-payment-call-test", () => {- const data = getConnectorDetails("stripe")["pm_list"]["PaymentIntent"];+ const data =+ getConnectorDetails("connector")["pm_list"]["PaymentIntent"];const newData = {...data,@@ -88,7 +90,7 @@ describe("Payment Method list using Constraint Graph flow tests", () => {// payment method list which should only have ideal with stripeit("payment-method-list-call-test", () => {const data =- getConnectorDetails("stripe")["pm_list"]["PmListResponse"][+ getConnectorDetails("connector")["pm_list"]["PmListResponse"]["PmListWithStripeForIdeal"];cy.paymentMethodListTestLessThanEqualToOnePaymentMethod(@@ -151,7 +153,8 @@ describe("Payment Method list using Constraint Graph flow tests", () => {// creating payment with currency as INR and no billing addressit("create-payment-call-test", () => {- const data = getConnectorDetails("stripe")["pm_list"]["PaymentIntent"];+ const data =+ getConnectorDetails("connector")["pm_list"]["PaymentIntent"];const newData = {...data,@@ -171,7 +174,7 @@ describe("Payment Method list using Constraint Graph flow tests", () => {// payment method list which should only have ideal with stripeit("payment-method-list-call-test", () => {const data =- getConnectorDetails("stripe")["pm_list"]["PmListResponse"][+ getConnectorDetails("connector")["pm_list"]["PmListResponse"]["PmListNull"];cy.paymentMethodListTestLessThanEqualToOnePaymentMethod(@@ -234,7 +237,8 @@ describe("Payment Method list using Constraint Graph flow tests", () => {// creating payment with currency as USD and billing address as USit("create-payment-call-test", () => {- const data = getConnectorDetails("stripe")["pm_list"]["PaymentIntent"];+ const data =+ getConnectorDetails("connector")["pm_list"]["PaymentIntent"];const newData = {...data,@@ -254,7 +258,7 @@ describe("Payment Method list using Constraint Graph flow tests", () => {// payment method list which should only have credit with Stripe and Cybersourceit("payment-method-list-call-test", () => {const data =- getConnectorDetails("stripe")["pm_list"]["PmListResponse"][+ getConnectorDetails("connector")["pm_list"]["PmListResponse"]["PmListWithCreditTwoConnector"];cy.paymentMethodListTestTwoConnectorsForOnePaymentMethodCredit(@@ -317,7 +321,8 @@ describe("Payment Method list using Constraint Graph flow tests", () => {// creating payment with currency as EUR and billing address as USit("create-payment-call-test", () => {- const data = getConnectorDetails("stripe")["pm_list"]["PaymentIntent"];+ const data =+ getConnectorDetails("connector")["pm_list"]["PaymentIntent"];const newData = {...data,@@ -337,7 +342,7 @@ describe("Payment Method list using Constraint Graph flow tests", () => {// payment method list which shouldn't have anythingit("payment-method-list-call-test", () => {const data =- getConnectorDetails("stripe")["pm_list"]["PmListResponse"][+ getConnectorDetails("connector")["pm_list"]["PmListResponse"]["PmListNull"];cy.paymentMethodListTestLessThanEqualToOnePaymentMethod(@@ -402,7 +407,8 @@ describe("Payment Method list using Constraint Graph flow tests", () => {// creating payment with currency as USD and billing address as INit("create-payment-call-test", () => {- const data = getConnectorDetails("stripe")["pm_list"]["PaymentIntent"];+ const data =+ getConnectorDetails("connector")["pm_list"]["PaymentIntent"];const newData = {...data,@@ -422,7 +428,7 @@ describe("Payment Method list using Constraint Graph flow tests", () => {// payment method list which should have credit with stripe and cybersource and no idealit("payment-method-list-call-test", () => {const data =- getConnectorDetails("stripe")["pm_list"]["PmListResponse"][+ getConnectorDetails("connector")["pm_list"]["PmListResponse"]["PmListWithCreditTwoConnector"];cy.paymentMethodListTestTwoConnectorsForOnePaymentMethodCredit(@@ -486,7 +492,8 @@ describe("Payment Method list using Constraint Graph flow tests", () => {// creating payment with currency as USD and billing address as INit("create-payment-call-test", () => {- const data = getConnectorDetails("stripe")["pm_list"]["PaymentIntent"];+ const data =+ getConnectorDetails("connector")["pm_list"]["PaymentIntent"];const newData = {...data,@@ -506,7 +513,7 @@ describe("Payment Method list using Constraint Graph flow tests", () => {// payment method list which should have credit with stripe and cybersource and no idealit("payment-method-list-call-test", () => {const data =- getConnectorDetails("stripe")["pm_list"]["PmListResponse"][+ getConnectorDetails("connector")["pm_list"]["PmListResponse"]["PmListWithCreditTwoConnector"];cy.paymentMethodListTestTwoConnectorsForOnePaymentMethodCredit(@@ -569,7 +576,8 @@ describe("Payment Method list using Constraint Graph flow tests", () => {// creating payment with currency as EUR and no billing addressit("create-payment-call-test", () => {- const data = getConnectorDetails("stripe")["pm_list"]["PaymentIntent"];+ const data =+ getConnectorDetails("connector")["pm_list"]["PaymentIntent"];const newData = {...data,@@ -589,7 +597,7 @@ describe("Payment Method list using Constraint Graph flow tests", () => {// payment method list which should only have ideal with stripeit("payment-method-list-call-test", () => {const data =- getConnectorDetails("stripe")["pm_list"]["PmListResponse"][+ getConnectorDetails("connector")["pm_list"]["PmListResponse"]["PmListWithStripeForIdeal"];cy.paymentMethodListTestLessThanEqualToOnePaymentMethod(@@ -599,4 +607,179 @@ describe("Payment Method list using Constraint Graph flow tests", () => {});});++ context(+ `+ MCA1 -> Stripe configured with credit = { currency = "USD" }\n+ MCA2 -> Novalnet configured with credit = { currency = "EUR" }\n+ Payment is done with currency as as USD and no billing address\n+ The resultant Payment Method list should only have credit with stripe\n+ `,+ () => {+ before("seed global state", () => {+ cy.task("getGlobalState").then((state) => {+ globalState = new State(state);+ });+ });++ after("flush global state", () => {+ cy.task("setGlobalState", globalState.data);+ });++ it("merchant-create-call-test", () => {+ cy.merchantCreateCallTest(fixtures.merchantCreateBody, globalState);+ });++ it("api-key-create-call-test", () => {+ cy.apiKeyCreateTest(fixtures.apiKeyCreateBody, globalState);+ });++ it("customer-create-call-test", () => {+ cy.createCustomerCallTest(fixtures.customerCreateBody, globalState);+ });++ // stripe connector create with card credit enabled in USD+ it("connector-create-call-test", () => {+ cy.createNamedConnectorCallTest(+ "payment_processor",+ fixtures.createConnectorBody,+ cardCreditEnabledInUsd,+ globalState,+ "stripe",+ "stripe_US_default"+ );+ });++ // novalnet connector create with card credit enabled in EUR+ it("connector-create-call-test", () => {+ cy.createNamedConnectorCallTest(+ "payment_processor",+ fixtures.createConnectorBody,+ cardCreditEnabledInEur,+ globalState,+ "novalnet",+ "novalnet_DE_default"+ );+ });++ // creating payment with currency as USD and no billing email+ // billing.email is mandatory for novalnet+ it("create-payment-call-test", () => {+ const data =+ getConnectorDetails("connector")["pm_list"]["PaymentIntent"];+ const newData = {+ ...data,+ Request: data.RequestCurrencyUSD,+ RequestCurrencyUSD: undefined, // we do not need this anymore+ };++ cy.createPaymentIntentTest(+ createPaymentBodyWithCurrency("USD"),+ newData,+ "no_three_ds",+ "automatic",+ globalState+ );+ });++ // payment method list should only have credit with stripe+ it("payment-method-list-call-test", () => {+ const data =+ getConnectorDetails("connector")["pm_list"]["PmListResponse"][+ "PmListWithCreditOneConnector"+ ];+ cy.paymentMethodListTestLessThanEqualToOnePaymentMethod(+ data,+ globalState+ );+ });+ }+ );+ context(+ `+ MCA1 -> Stripe configured with credit = { currency = "USD" }\n+ MCA2 -> Novalnet configured with credit = { currency = "EUR" }\n+ Payment is done with currency as as EUR and billing address for 3ds credit card\n+ The resultant Payment Method list should only have credit with novalnet\n+ `,+ () => {+ before("seed global state", () => {+ cy.task("getGlobalState").then((state) => {+ globalState = new State(state);+ });+ });++ after("flush global state", () => {+ cy.task("setGlobalState", globalState.data);+ });++ it("merchant-create-call-test", () => {+ cy.merchantCreateCallTest(fixtures.merchantCreateBody, globalState);+ });++ it("api-key-create-call-test", () => {+ cy.apiKeyCreateTest(fixtures.apiKeyCreateBody, globalState);+ });++ it("customer-create-call-test", () => {+ cy.createCustomerCallTest(fixtures.customerCreateBody, globalState);+ });++ // stripe connector create with card credit enabled in USD+ it("connector-create-call-test", () => {+ cy.createNamedConnectorCallTest(+ "payment_processor",+ fixtures.createConnectorBody,+ cardCreditEnabledInUsd,+ globalState,+ "stripe",+ "stripe_US_default"+ );+ });++ // novalnet connector create with card credit enabled in EUR+ it("connector-create-call-test", () => {+ cy.createNamedConnectorCallTest(+ "payment_processor",+ fixtures.createConnectorBody,+ cardCreditEnabledInEur,+ globalState,+ "novalnet",+ "novalnet_DE_default"+ );+ });++ // creating payment with currency as EUR and billing email+ // billing.email is mandatory for novalnet+ it("create-payment-call-test", () => {+ const data =+ getConnectorDetails("connector")["pm_list"]["PaymentIntent"];+ const newData = {+ ...data,+ Request: data.RequestCurrencyEUR,+ RequestCurrencyEUR: undefined, // we do not need this anymore+ };++ cy.createPaymentIntentTest(+ createPaymentBodyWithCurrencyCountry("EUR", "IN", "IN"),+ newData,+ "three_ds",+ "automatic",+ globalState+ );+ });++ // payment method list should only have credit with novalnet+ it("payment-method-list-call-test", () => {+ const data =+ getConnectorDetails("connector")["pm_list"]["PmListResponse"][+ "PmListWithCreditOneConnector"+ ];+ cy.paymentMethodListTestLessThanEqualToOnePaymentMethod(+ data,+ globalState+ );+ });+ }+ );});diff --git a/cypress-tests/cypress/e2e/PaymentMethodListUtils/Commons.js b/cypress-tests/cypress/e2e/PaymentMethodListUtils/Commons.jsindex ae72465b60..e782b32368 100644--- a/cypress-tests/cypress/e2e/PaymentMethodListUtils/Commons.js+++ b/cypress-tests/cypress/e2e/PaymentMethodListUtils/Commons.js@@ -58,6 +58,26 @@ export const cardCreditEnabledInUs = [},];+export const cardCreditEnabledInEur = [+ {+ payment_method: "card",+ payment_method_types: [+ {+ payment_method_type: "credit",+ card_networks: ["Visa"],+ minimum_amount: 0,+ accepted_currencies: {+ type: "enable_only",+ list: ["EUR"],+ },+ maximum_amount: 68607706,+ recurring_enabled: false,+ installment_payment_enabled: true,+ },+ ],+ },+];+export const bankRedirectIdealEnabled = [{payment_method: "bank_redirect",diff --git a/cypress-tests/cypress/e2e/PaymentMethodListUtils/Stripe.js b/cypress-tests/cypress/e2e/PaymentMethodListUtils/Connector.jssimilarity index 100%rename from cypress-tests/cypress/e2e/PaymentMethodListUtils/Stripe.jsrename to cypress-tests/cypress/e2e/PaymentMethodListUtils/Connector.jsdiff --git a/cypress-tests/cypress/e2e/PaymentMethodListUtils/Utils.js b/cypress-tests/cypress/e2e/PaymentMethodListUtils/Utils.jsindex f7d199164f..64e127608a 100644--- a/cypress-tests/cypress/e2e/PaymentMethodListUtils/Utils.js+++ b/cypress-tests/cypress/e2e/PaymentMethodListUtils/Utils.js@@ -1,9 +1,9 @@import { connectorDetails as CommonConnectorDetails } from "./Commons.js";-import { connectorDetails as stripeConnectorDetails } from "./Stripe.js";+import { connectorDetails as ConnectorDetails } from "./Connector.js";const connectorDetails = {commons: CommonConnectorDetails,- stripe: stripeConnectorDetails,+ connector: ConnectorDetails,};export default function getConnectorDetails(connectorId) {diff --git a/cypress-tests/cypress/e2e/PaymentUtils/Novalnet.js b/cypress-tests/cypress/e2e/PaymentUtils/Novalnet.jsindex 0a8235141d..52e6acd648 100644--- a/cypress-tests/cypress/e2e/PaymentUtils/Novalnet.js+++ b/cypress-tests/cypress/e2e/PaymentUtils/Novalnet.js@@ -207,4 +207,167 @@ export const connectorDetails = {},},},+ pm_list: {+ PmListResponse: {+ PmListNull: {+ payment_methods: [],+ },+ pmListDynamicFieldWithoutBilling: {+ payment_methods: [+ {+ payment_method: "card",+ payment_method_types: [+ {+ payment_method_type: "credit",+ card_networks: [+ {+ eligible_connectors: ["novalnet"],+ },+ ],+ required_fields: {+ "billing.address.first_name": {+ required_field:+ "payment_method_data.billing.address.first_name",+ display_name: "first_name",+ field_type: "user_full_name",+ value: null,+ },+ "billing.address.last_name": {+ required_field:+ "payment_method_data.billing.address.last_name",+ display_name: "last_name",+ field_type: "user_full_name",+ value: null,+ },+ "billing.email": {+ required_field: "payment_method_data.billing.email",+ display_name: "email_address",+ field_type: "user_email_address",+ value: "[email protected]",+ },+ },+ },+ ],+ },+ ],+ },+ pmListDynamicFieldWithBilling: {+ payment_methods: [+ {+ payment_method: "card",+ payment_method_types: [+ {+ payment_method_type: "credit",+ card_networks: [+ {+ eligible_connectors: ["novalnet"],+ },+ ],+ required_fields: {+ "billing.address.first_name": {+ required_field:+ "payment_method_data.billing.address.first_name",+ display_name: "first_name",+ field_type: "user_full_name",+ value: "joseph",+ },+ "billing.address.last_name": {+ required_field:+ "payment_method_data.billing.address.last_name",+ display_name: "last_name",+ field_type: "user_full_name",+ value: "Doe",+ },+ "billing.email": {+ required_field: "payment_method_data.billing.email",+ display_name: "email_address",+ field_type: "user_email_address",+ value: "[email protected]",+ },+ },+ },+ ],+ },+ ],+ },+ pmListDynamicFieldWithNames: {+ payment_methods: [+ {+ payment_method: "card",+ payment_method_types: [+ {+ payment_method_type: "credit",+ card_networks: [+ {+ eligible_connectors: ["novalnet"],+ },+ ],+ required_fields: {+ "billing.address.first_name": {+ required_field:+ "payment_method_data.billing.address.first_name",+ display_name: "first_name",+ field_type: "user_full_name",+ value: "joseph",+ },+ "billing.address.last_name": {+ required_field:+ "payment_method_data.billing.address.last_name",+ display_name: "last_name",+ field_type: "user_full_name",+ value: "Doe",+ },+ "billing.email": {+ required_field: "payment_method_data.billing.email",+ display_name: "email_address",+ field_type: "user_email_address",+ value: "[email protected]",+ },+ },+ },+ ],+ },+ ],+ },+ pmListDynamicFieldWithEmail: {+ payment_methods: [+ {+ payment_method: "card",+ payment_method_types: [+ {+ payment_method_type: "credit",+ card_networks: [+ {+ eligible_connectors: ["novalnet"],+ },+ ],+ required_fields: {+ "billing.address.first_name": {+ required_field:+ "payment_method_data.billing.address.first_name",+ display_name: "first_name",+ field_type: "user_full_name",+ value: "joseph",+ },+ "billing.address.last_name": {+ required_field:+ "payment_method_data.billing.address.last_name",+ display_name: "last_name",+ field_type: "user_full_name",+ value: "Doe",+ },+ "billing.email": {+ required_field: "payment_method_data.billing.email",+ display_name: "email_address",+ field_type: "user_email_address",+ value: "[email protected]",+ },+ },+ },+ ],+ },+ ],+ },+ },+ },};