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 invalid publishable key tests (#10049)
likhinbopannaf96e01d0eea5
diff --git a/cypress-tests/cypress/e2e/configs/Payment/Commons.js b/cypress-tests/cypress/e2e/configs/Payment/Commons.jsindex c014761bf0..b7c4cc26c6 100644--- a/cypress-tests/cypress/e2e/configs/Payment/Commons.js+++ b/cypress-tests/cypress/e2e/configs/Payment/Commons.js@@ -1620,6 +1620,19 @@ export const connectorDetails = {},},},+ InvalidPublishableKey: {+ Request: {},+ Response: {+ status: 401,+ body: {+ error: {+ type: "invalid_request",+ message: "API key not provided or invalid API key used",+ code: "IR_01",+ },+ },+ },+ },DDCRaceConditionServerSide: getCustomExchange({Request: {payment_method: "card",diff --git a/cypress-tests/cypress/e2e/spec/Payment/00022-Variations.cy.js b/cypress-tests/cypress/e2e/spec/Payment/00022-Variations.cy.jsindex 92cbe8fa4f..ac62bb55d6 100644--- a/cypress-tests/cypress/e2e/spec/Payment/00022-Variations.cy.js+++ b/cypress-tests/cypress/e2e/spec/Payment/00022-Variations.cy.js@@ -880,4 +880,88 @@ describe("Corner cases", () => {cy.createCustomerCallTest(customerData, globalState);});});++ context("Confirm Payment with Invalid Publishable Key", () => {+ let shouldContinue = true;++ beforeEach(function () {+ if (!shouldContinue) {+ this.skip();+ }+ });++ it("Create Payment Intent", () => {+ 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("Confirm payment with invalid publishable key", () => {+ const data = getConnectorDetails(globalState.get("connectorId"))[+ "card_pm"+ ]["InvalidPublishableKey"];++ const originalKey = globalState.get("publishableKey");+ //set invalid publishable key+ cy.then(() => globalState.set("publishableKey", "pk_snd_invalid_key"));+ cy.confirmCallTest(fixtures.confirmBody, data, true, globalState);++ // Restore key synchronously after test+ cy.then(() => globalState.set("publishableKey", originalKey));++ if (shouldContinue) shouldContinue = utils.should_continue_further(data);+ });+ });++ context("Retrieve session token with invalid publishable key", () => {+ let shouldContinue = true;++ beforeEach(function () {+ if (!shouldContinue) {+ this.skip();+ }+ });++ it("Create Payment Intent", () => {+ 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("Session call with invalid publishable key", () => {+ const data = getConnectorDetails(globalState.get("connectorId"))[+ "card_pm"+ ]["InvalidPublishableKey"];++ const originalKey = globalState.get("publishableKey");+ // set invalid publishable key+ cy.then(() => globalState.set("publishableKey", "pk_snd_invalid_key"));+ cy.sessionTokenCall(fixtures.sessionTokenBody, data, globalState);++ // Restore key synchronously after test+ cy.then(() => globalState.set("publishableKey", originalKey));++ if (shouldContinue) shouldContinue = utils.should_continue_further(data);+ });+ });});