Skip to content

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

4.6 KB
Raw Blame
import { standardBillingAddress } from "./Commons";

const successfulNo3DSCardDetails = {
  card_number: "4111111111111111",
  card_exp_month: "03",
  card_exp_year: "30",
  card_holder_name: "John Doe",
  card_cvc: "737",
};

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 cryptopay",
          },
        },
      },
    },
  },
  card_pm: {
    // Auto fallback capture method flow (PR #14452) - cryptopay does not support
    // manual capture; with auto_fallback_capture_method enabled on the business
    // profile, manual capture payments fall back to automatic capture.
    AutoFallbackCaptureMethod: {
      PaymentIntent: {
        Request: {
          currency: "USD",
          customer_acceptance: null,
          setup_future_usage: "on_session",
        },
        Response: {
          status: 200,
          body: {
            status: "requires_payment_method",
            capture_method_applied: null,
          },
        },
      },
      AutoFallbackDisabled: {
        Configs: {
          skipBillingAssertion: true,
        },
        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 cryptopay",
            },
          },
        },
      },
      AutoFallbackEnabled: {
        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",
            capture_method: "manual",
            capture_method_applied: "automatic",
          },
        },
      },
    },
    ZeroAuthMandate: {
      Request: {
        amount: 0,
      },
      Response: {
        status: 501,
        body: {
          error: {
            type: "invalid_request",
            message: "Setup Mandate flow for Cryptopay is not implemented",
            code: "IR_00",
          },
        },
      },
    },
    ZeroAuthPaymentIntent: {
      Request: {
        amount: 0,
        setup_future_usage: "off_session",
        currency: "USD",
      },
      Response: {
        status: 200,
        body: {
          status: "requires_payment_method",
          setup_future_usage: "off_session",
        },
      },
    },
    ZeroAuthConfirmPayment: {
      Request: {
        amount: 0,
        payment_type: "setup_mandate",
        payment_method: "card",
        payment_method_type: "credit",
        payment_method_data: {
          card: successfulNo3DSCardDetails,
        },
      },
      Response: {
        status: 501,
        body: {
          error: {
            type: "invalid_request",
            message: "Setup Mandate flow for Cryptopay is not implemented",
            code: "IR_00",
          },
        },
      },
    },
  },
};