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): added phone code validation (#14386)
Vasanthe690ee01a326
diff --git a/cypress-tests/cypress/e2e/configs/Payment/Commons.js b/cypress-tests/cypress/e2e/configs/Payment/Commons.jsindex a52d5cce9a..810f7d8fbd 100644--- a/cypress-tests/cypress/e2e/configs/Payment/Commons.js+++ b/cypress-tests/cypress/e2e/configs/Payment/Commons.js@@ -1063,6 +1063,24 @@ export const payment_methods_enabled = [];export const connectorDetails = {+ customer: {+ CreateInvalidPhoneCountryCode: {+ Request: {+ phone_country_code: "United States",+ },+ Response: {+ status: 400,+ body: {+ error: {+ type: "invalid_request",+ message:+ 'Invalid value provided:phone_country_code must be a valid country calling code (e.g. "+1"), got "United States"',+ code: "IR_07",+ },+ },+ },+ },+ },bank_transfer_pm: {PaymentIntent: (paymentMethodType) =>getCustomExchange({diff --git a/cypress-tests/cypress/e2e/spec/Payment/02-CustomerCreate.cy.js b/cypress-tests/cypress/e2e/spec/Payment/02-CustomerCreate.cy.jsindex ca64eb0c3f..a7801e90d8 100644--- a/cypress-tests/cypress/e2e/spec/Payment/02-CustomerCreate.cy.js+++ b/cypress-tests/cypress/e2e/spec/Payment/02-CustomerCreate.cy.js@@ -1,5 +1,6 @@import * as fixtures from "../../../fixtures/imports";import State from "../../../utils/State";+import getConnectorDetails from "../../configs/Payment/Utils";let globalState;@@ -17,4 +18,26 @@ describe("Customer Create flow test", () => {it("customer-create-call-test", () => {cy.createCustomerCallTest(fixtures.customerCreateBody, globalState);});++ it("customer-create-call-test with valid phone_country_code", () => {+ const customerCreateBody = {+ ...fixtures.customerCreateBody,+ phone_country_code: "+1",+ };++ cy.createCustomerCallTest(customerCreateBody, globalState);+ });++ it("customer-create-call-test with invalid phone_country_code", () => {+ const data = getConnectorDetails(globalState.get("connectorId"))[+ "customer"+ ]["CreateInvalidPhoneCountryCode"];++ const customerCreateBody = {+ ...fixtures.customerCreateBody,+ ...data.Request,+ };++ cy.createCustomerCallTest(customerCreateBody, globalState, data);+ });});diff --git a/cypress-tests/cypress/support/commands.js b/cypress-tests/cypress/support/commands.jsindex 9267f2183f..17e2151927 100644--- a/cypress-tests/cypress/support/commands.js+++ b/cypress-tests/cypress/support/commands.js@@ -2492,7 +2492,7 @@ Cypress.Commands.add("connectorListByMid", (globalState) => {Cypress.Commands.add("createCustomerCallTest",- (customerCreateBody, globalState) => {+ (customerCreateBody, globalState, data = null) => {cy.request({method: "POST",url: `${globalState.get("baseUrl")}/customers`,@@ -2528,7 +2528,19 @@ Cypress.Commands.add("phone_country_code").to.equal(response.body.phone_country_code);} else if (response.status === 400) {- if (response.body.error.message.includes("already exists")) {+ if (data?.Response?.body?.error) {+ const resData = data.Response;+ expect(response.status, "response status").to.equal(resData.status);+ expect(response.body.error.type, "error type").to.equal(+ resData.body.error.type+ );+ expect(response.body.error.message, "error message").to.equal(+ resData.body.error.message+ );+ expect(response.body.error.code, "error code").to.equal(+ resData.body.error.code+ );+ } else if (response.body.error.message.includes("already exists")) {expect(response.body.error.code).to.equal("IR_12");expect(response.body.error.message).to.equal("Customer with the given `customer_id` already exists"