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
test(cypress): add Bitpay crypto payment coverage (#12672)
HS-QUALIBOT73ceb03b6728
diff --git a/cypress-tests/cypress/e2e/configs/Payment/Bitpay.js b/cypress-tests/cypress/e2e/configs/Payment/Bitpay.jsnew file mode 100644index 0000000000..346b7e82ca--- /dev/null+++ b/cypress-tests/cypress/e2e/configs/Payment/Bitpay.js@@ -0,0 +1,62 @@+import { standardBillingAddress } from "./Commons";++export const connectorDetails = {+ crypto_pm: {+ PaymentIntent: {+ Request: {+ currency: "USD",+ customer_acceptance: null,+ setup_future_usage: "on_session",+ },+ Response: {+ status: 200,+ body: {+ status: "requires_payment_method",+ },+ },+ },+ CryptoCurrency: {+ Request: {+ payment_method: "crypto",+ payment_method_type: "crypto_currency",+ payment_method_data: {+ crypto: {+ network: "bitcoin",+ pay_currency: "BTC",+ },+ },+ billing: standardBillingAddress,+ },+ Response: {+ status: 200,+ body: {+ status: "requires_customer_action",+ },+ },+ },+ CryptoCurrencyManualCapture: {+ Request: {+ payment_method: "crypto",+ payment_method_type: "crypto_currency",+ payment_method_data: {+ crypto: {+ network: "bitcoin",+ pay_currency: "BTC",+ },+ },+ billing: standardBillingAddress,+ },+ Response: {+ status: 400,+ body: {+ error: {+ type: "invalid_request",+ message: "Payment method type not supported",+ code: "IR_19",+ reason: "manual is not supported by bitpay",+ },+ },+ },+ },+ },+};diff --git a/cypress-tests/cypress/e2e/configs/Payment/Utils.js b/cypress-tests/cypress/e2e/configs/Payment/Utils.jsindex 3f256762a5..5f248b8dd5 100644--- a/cypress-tests/cypress/e2e/configs/Payment/Utils.js+++ b/cypress-tests/cypress/e2e/configs/Payment/Utils.js@@ -13,6 +13,7 @@ import { connectorDetails as bamboraConnectorDetails } from "./Bambora.js";import { connectorDetails as bamboraapacConnectorDetails } from "./Bamboraapac.js";import { connectorDetails as bankOfAmericaConnectorDetails } from "./BankOfAmerica.js";import { connectorDetails as barclaycardConnectorDetails } from "./Barclaycard.js";+import { connectorDetails as bitpayConnectorDetails } from "./Bitpay.js";import { connectorDetails as billwerkConnectorDetails } from "./Billwerk.js";import { connectorDetails as bluesnapConnectorDetails } from "./Bluesnap.js";import { connectorDetails as braintreeConnectorDetails } from "./Braintree.js";@@ -91,6 +92,7 @@ const connectorDetails = {bamboraapac: bamboraapacConnectorDetails,barclaycard: barclaycardConnectorDetails,bankofamerica: bankOfAmericaConnectorDetails,+ bitpay: bitpayConnectorDetails,billwerk: billwerkConnectorDetails,bluesnap: bluesnapConnectorDetails,braintree: braintreeConnectorDetails,diff --git a/cypress-tests/cypress/support/redirectionHandler.js b/cypress-tests/cypress/support/redirectionHandler.jsindex 45adc598ec..67d1167f86 100644--- a/cypress-tests/cypress/support/redirectionHandler.js+++ b/cypress-tests/cypress/support/redirectionHandler.js@@ -134,40 +134,97 @@ function cryptoRedirection(connectorId,paymentMethodType) {- // Crypto payments are async → never verify return URLconst verifyUrl = false;if (redirectionUrl && redirectionUrl.href) {cy.visit(redirectionUrl.href);- // Ensure redirect happened- waitForRedirect(redirectionUrl.href);+ if (connectorId !== "bitpay") {+ waitForRedirect(redirectionUrl.href);+ }cy.wait(CONSTANTS.WAIT_TIME / 5);- // Verify QR is present- cy.get("canvas.BbpsQr__canvas", { timeout: 5000 })- .should("exist")- .and("be.visible");+ if (connectorId === "bitpay") {+ cy.document().should("have.property", "readyState", "complete");+ cy.wait(3000);- handleFlow(- redirectionUrl,- expectedUrl,- connectorId,- ({ paymentMethodType }) => {- switch (paymentMethodType) {- case "crypto_currency":- cy.log("Handling crypto currency payment redirection");- break;+ cy.scrollTo("bottom");+ cy.wait(1000);- default:- throw new Error(- `Unsupported crypto payment method type: ${paymentMethodType}`- );+ cy.get("body").then(($body) => {+ const loginLink = $body+ .find('a[href*="login"]:visible, button:visible')+ .filter((_, el) => /log\s*in|sign\s*in|account/i.test(el.innerText))+ .first();++ if (loginLink.length > 0) {+ cy.wrap(loginLink).click({ force: true });+ cy.log("Clicked login link");+ } else {+ cy.log("Login link not found");}- },- { paymentMethodType }- );+ });++ cy.wait(2000);++ cy.get('input[type="email"], input[name="email"]', { timeout: 10000 })+ .should("be.visible")+ .clear()+ .type("[email protected]", { delay: 50 });++ cy.get("body").then(($body) => {+ const continueBtn = $body+ .find('button:visible, input[type="submit"]:visible')+ .filter((_, el) =>+ /continue|next/i.test(el.innerText || el.value || "")+ )+ .first();++ if (continueBtn.length > 0) {+ cy.wrap(continueBtn).click({ force: true });+ cy.log("Clicked continue after email");+ }+ });++ cy.wait(2000);++ cy.get('input[type="password"], input[name="password"]', {+ timeout: 10000,+ })+ .should("be.visible")+ .clear()+ .type("venkatkarthik123@", { delay: 50 });++ cy.get('button[type="submit"], input[type="submit"]', { timeout: 10000 })+ .should("be.visible")+ .click();++ cy.log("Submitted Bitpay login credentials");+ } else {+ cy.get("canvas.BbpsQr__canvas", { timeout: 5000 })+ .should("exist")+ .and("be.visible");++ handleFlow(+ redirectionUrl,+ expectedUrl,+ connectorId,+ ({ paymentMethodType }) => {+ switch (paymentMethodType) {+ case "crypto_currency":+ cy.log("Handling crypto currency payment redirection");+ break;++ default:+ throw new Error(+ `Unsupported crypto payment method type: ${paymentMethodType}`+ );+ }+ },+ { paymentMethodType }+ );+ }} else {cy.log("Skipping crypto redirection - no valid redirect URL provided");}@@ -738,14 +795,14 @@ function affirmPayLaterRedirection(case "email":cy.get("body").then(($body) => {const emailInputs = $body.find(- 'input[data-testid*="email"]:visible, input[type="email"]:visible, input[autocomplete="email"]:visible'+ 'input[data-testid*="email"]:visible, input[type="email"]:visible, input[autocomplete="email"]:visible, input[data-test="email-input"]:visible');if (emailInputs.length > 0) {cy.wrap(emailInputs.first()).click().clear()- .type("[email protected]", { delay: 50 });- cy.log("Entered email [email protected]");+ .type("[email protected]", { delay: 50 });+ cy.log("Entered email [email protected]");}});break;