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

154 KB
Raw Blame
// This file is the default. To override, add to connector.js
import { getCurrency, getCustomExchange } from "./Modifiers";

export const OFFER_QUOTE_ID_PLACEHOLDER = "OFFER_QUOTE_ID_FROM_STATE";

export const blockedPaymentErrorBodyForIssuingCountry = {
  status: 200,
  expectBlockedPayment: true,
  body: {
    error: {
      type: "blocked",
      message:
        "Cards issued in your region aren't supported for this transaction, please try a different card",
      code: "HE_03",
      reason: "Blocked",
    },
  },
};

export const blockedPaymentErrorBodyForDebitCard = {
  status: 200,
  expectBlockedPayment: true,
  body: {
    error: {
      type: "blocked",
      message:
        "Debit cards are not accepted for this transaction, please try a different card",
      code: "HE_03",
      reason: "Blocked",
    },
  },
};

export const blockedPaymentErrorBodyForCardSubtype = {
  status: 200,
  expectBlockedPayment: true,
  body: {
    error: {
      type: "blocked",
      message:
        "This card is not accepted for this transaction, please try a different card",
      code: "HE_03",
      reason: "Blocked",
    },
  },
};

export const blockedPaymentErrorBodyForBinUnavailable = {
  status: 200,
  expectBlockedPayment: true,
  body: {
    error: {
      type: "blocked",
      message:
        "We couldn't verify this card's information, please try a different card",
      code: "HE_03",
      reason: "Blocked",
    },
  },
};

export const customerAcceptance = {
  acceptance_type: "offline",
  accepted_at: "1963-05-03T04:07:52.723Z",
  online: {
    ip_address: "127.0.0.1",
    user_agent:
      "Mozilla/5.0 (iPhone; CPU iPhone OS 18_5 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/22F76 [FBAN/FBIOS;FBAV/520.0.0.38.101;FBBV/756351453;FBDV/iPhone14,7;FBMD/iPhone;FBSN/iOS;FBSV/18.5;FBSS/3;FBID/phone;FBLC/fr_FR;FBOP/5;FBRV/760683563;IABMV/1]",
  },
};

export const cardCreditEnabled = [
  {
    payment_method: "card",
    payment_method_types: [
      {
        payment_method_type: "credit",
        card_networks: [
          "Visa",
          "Mastercard",
          "AmericanExpress",
          "Discover",
          "JCB",
          "DinersClub",
          "UnionPay",
          "RuPay",
          "Interac",
        ],
        minimum_amount: 0,
        maximum_amount: 68607706,
        recurring_enabled: false,
        installment_payment_enabled: true,
      },
    ],
  },
];

export const successfulNo3DSCardDetails = {
  card_number: "4111111111111111",
  card_exp_month: "08",
  card_exp_year: "30",
  card_holder_name: "joseph Doe",
  card_cvc: "999",
};

// Card the Offer Engine saved-card flow (53-OfferEngine.cy.js) saves and
// quotes. Kept apart from successfulNo3DSCardDetails, which the plain-card
// offer flow already uses.
export const offerEngineSavedCardDetails = {
  ...successfulNo3DSCardDetails,
  card_number: "4242424242424242",
};

const blocklistedCardDetails = {
  card_number: "4242424242424242",
  card_exp_month: "01",
  card_exp_year: "2050",
  card_holder_name: "John Smith",
  card_cvc: "349",
  card_network: "Visa",
};

const successfulThreeDSTestCardDetails = {
  card_number: "4111111111111111",
  card_exp_month: "10",
  card_exp_year: "30",
  card_holder_name: "morino",
  card_cvc: "999",
};

const PaymentMethodCardDetails = {
  card_number: "4111111145551142",
  card_exp_month: "03",
  card_exp_year: "30",
  card_holder_name: "Joseph Doe",
};

export const singleUseMandateData = {
  customer_acceptance: customerAcceptance,
  mandate_type: {
    single_use: {
      amount: 8000,
      currency: "USD",
    },
  },
};

export const multiUseMandateData = {
  customer_acceptance: customerAcceptance,
  mandate_type: {
    multi_use: {
      amount: 8000,
      currency: "USD",
    },
  },
};

export const standardBillingAddress = {
  address: {
    line1: "1467",
    line2: "Harrison Street",
    line3: "Harrison Street",
    city: "San Fransico",
    state: "CA",
    zip: "94122",
    country: "US",
    first_name: "John",
    last_name: "Doe",
  },
  phone: {
    number: "8056594427",
    country_code: "+91",
  },
};

export const cardRequiredField = {
  "payment_method_data.card.card_number": {
    required_field: "payment_method_data.card.card_number",
    display_name: "card_number",
    field_type: "user_card_number",
    value: null,
  },
  "payment_method_data.card.card_exp_year": {
    required_field: "payment_method_data.card.card_exp_year",
    display_name: "card_exp_year",
    field_type: "user_card_expiry_year",
    value: null,
  },
  "payment_method_data.card.card_cvc": {
    required_field: "payment_method_data.card.card_cvc",
    display_name: "card_cvc",
    field_type: "user_card_cvc",
    value: null,
  },
  "payment_method_data.card.card_exp_month": {
    required_field: "payment_method_data.card.card_exp_month",
    display_name: "card_exp_month",
    field_type: "user_card_expiry_month",
    value: null,
  },
};

export const fullNameRequiredField = {
  "billing.address.last_name": {
    required_field: "payment_method_data.billing.address.last_name",
    display_name: "card_holder_name",
    field_type: "user_full_name",
    value: "Doe",
  },
  "billing.address.first_name": {
    required_field: "payment_method_data.billing.address.first_name",
    display_name: "card_holder_name",
    field_type: "user_full_name",
    value: "joseph",
  },
};

export const billingRequiredField = {};

// Bank debit specific billing addresses - derived from standardBillingAddress
export const sepaBillingAddress = {
  address: {
    ...standardBillingAddress.address,
    city: "Amsterdam",
    state: "North Holland",
    zip: "1012",
    country: "NL",
  },
  email: "[email protected]",
};

export const achBillingAddress = {
  address: {
    ...standardBillingAddress.address,
    city: "San Francisco",
    state: "California",
  },
  email: "[email protected]",
};

export const bacsBillingAddress = {
  address: {
    ...standardBillingAddress.address,
    city: "London",
    state: "England",
    zip: "SW1A 1AA",
    country: "GB",
  },
  email: "[email protected]",
};

export const payment_methods_enabled = [
  {
    payment_method: "bank_redirect",
    payment_method_types: [
      {
        payment_method_type: "blik",
        payment_experience: null,
        card_networks: null,
        accepted_currencies: null,
        accepted_countries: null,
        minimum_amount: 1,
        maximum_amount: 68607706,
        recurring_enabled: true,
        installment_payment_enabled: true,
      },
      {
        payment_method_type: "trustly",
        payment_experience: null,
        card_networks: null,
        accepted_currencies: null,
        accepted_countries: null,
        minimum_amount: 1,
        maximum_amount: 68607706,
        recurring_enabled: true,
        installment_payment_enabled: true,
      },
      {
        payment_method_type: "eps",
        payment_experience: null,
        card_networks: null,
        accepted_currencies: null,
        accepted_countries: null,
        minimum_amount: 1,
        maximum_amount: 68607706,
        recurring_enabled: true,
        installment_payment_enabled: true,
      },
      {
        payment_method_type: "ideal",
        payment_experience: null,
        card_networks: null,
        accepted_currencies: null,
        accepted_countries: null,
        minimum_amount: 1,
        maximum_amount: 68607706,
        recurring_enabled: true,
        installment_payment_enabled: true,
      },
      {
        payment_method_type: "giropay",
        payment_experience: null,
        card_networks: null,
        accepted_currencies: null,
        accepted_countries: null,
        minimum_amount: 1,
        maximum_amount: 68607706,
        recurring_enabled: true,
        installment_payment_enabled: true,
      },
      {
        payment_method_type: "local_bank_redirect",
        payment_experience: null,
        card_networks: null,
        accepted_currencies: null,
        accepted_countries: null,
        minimum_amount: 1,
        maximum_amount: 68607706,
        recurring_enabled: true,
        installment_payment_enabled: true,
      },
      {
        payment_method_type: "przelewy24",
        payment_experience: null,
        card_networks: null,
        accepted_currencies: null,
        accepted_countries: null,
        minimum_amount: 1,
        maximum_amount: 68607706,
        recurring_enabled: true,
        installment_payment_enabled: true,
      },
      {
        payment_method_type: "open_banking_uk",
        payment_experience: null,
        card_networks: null,
        accepted_currencies: null,
        accepted_countries: null,
        minimum_amount: 1,
        maximum_amount: 68607706,
        recurring_enabled: true,
        installment_payment_enabled: true,
      },
      {
        payment_method_type: "open_banking",
        payment_experience: null,
        card_networks: null,
        accepted_currencies: null,
        accepted_countries: null,
        minimum_amount: 1,
        maximum_amount: 68607706,
        recurring_enabled: true,
        installment_payment_enabled: true,
      },
      {
        payment_method_type: "online_banking_fpx",
        payment_experience: null,
        card_networks: null,
        accepted_currencies: null,
        accepted_countries: null,
        minimum_amount: 1,
        maximum_amount: 68607706,
        recurring_enabled: true,
        installment_payment_enabled: true,
      },
      {
        payment_method_type: "sofort",
        payment_experience: null,
        card_networks: null,
        accepted_currencies: null,
        accepted_countries: null,
        minimum_amount: 1,
        maximum_amount: 68607706,
        recurring_enabled: true,
        installment_payment_enabled: true,
      },
      {
        payment_method_type: "trustly",
        payment_experience: null,
        card_networks: null,
        accepted_currencies: null,
        accepted_countries: null,
        minimum_amount: 1,
        maximum_amount: 68607706,
        recurring_enabled: true,
        installment_payment_enabled: true,
      },
      {
        payment_method_type: "interac",
        payment_experience: null,
        card_networks: null,
        accepted_currencies: null,
        accepted_countries: null,
        minimum_amount: 1,
        maximum_amount: 68607706,
        recurring_enabled: true,
        installment_payment_enabled: true,
      },
      {
        payment_method_type: "bancontact_card",
        payment_experience: null,
        card_networks: null,
        accepted_currencies: null,
        accepted_countries: null,
        minimum_amount: 1,
        maximum_amount: 68607706,
        recurring_enabled: true,
        installment_payment_enabled: true,
      },
      {
        payment_method_type: "eft",
        payment_experience: null,
        card_networks: null,
        accepted_currencies: null,
        accepted_countries: null,
        minimum_amount: 1,
        maximum_amount: 68607706,
        recurring_enabled: true,
        installment_payment_enabled: true,
      },
    ],
  },
  {
    payment_method: "bank_debit",
    payment_method_types: [
      {
        payment_method_type: "sepa",
        minimum_amount: 1,
        maximum_amount: 68607706,
        recurring_enabled: true,
        installment_payment_enabled: true,
      },
    ],
  },
  {
    payment_method: "bank_transfer",
    payment_method_types: [
      {
        payment_method_type: "pix",
        minimum_amount: 0,
        maximum_amount: 68607706,
        recurring_enabled: false,
        installment_payment_enabled: true,
      },
      {
        payment_method_type: "ach",
        minimum_amount: 0,
        maximum_amount: 68607706,
        recurring_enabled: false,
      },
      {
        payment_method_type: "instant_bank_transfer_finland",
        minimum_amount: 1,
        maximum_amount: 68607706,
        recurring_enabled: true,
        installment_payment_enabled: true,
      },
      {
        payment_method_type: "instant_bank_transfer_poland",
        minimum_amount: 1,
        maximum_amount: 68607706,
        recurring_enabled: true,
        installment_payment_enabled: true,
      },
    ],
  },
  {
    payment_method: "bank_debit",
    payment_method_types: [
      {
        payment_method_type: "ach",
        minimum_amount: 1,
        maximum_amount: 68607706,
        recurring_enabled: true,
        installment_payment_enabled: true,
      },
      {
        payment_method_type: "sepa",
        minimum_amount: 1,
        maximum_amount: 68607706,
        recurring_enabled: true,
        installment_payment_enabled: true,
      },
      {
        payment_method_type: "bacs",
        minimum_amount: 1,
        maximum_amount: 68607706,
        recurring_enabled: true,
        installment_payment_enabled: true,
      },
      {
        payment_method_type: "becs",
        minimum_amount: 1,
        maximum_amount: 68607706,
        recurring_enabled: true,
        installment_payment_enabled: true,
      },
    ],
  },
  {
    payment_method: "card",
    payment_method_types: [
      {
        payment_method_type: "credit",
        card_networks: [
          "AmericanExpress",
          "Discover",
          "Interac",
          "JCB",
          "Mastercard",
          "Visa",
          "DinersClub",
          "UnionPay",
          "RuPay",
        ],
        minimum_amount: 0,
        maximum_amount: 68607706,
        recurring_enabled: false,
        installment_payment_enabled: true,
      },
      {
        payment_method_type: "debit",
        card_networks: [
          "AmericanExpress",
          "Discover",
          "Interac",
          "JCB",
          "Mastercard",
          "Visa",
          "DinersClub",
          "UnionPay",
          "RuPay",
        ],
        minimum_amount: 0,
        maximum_amount: 68607706,
        recurring_enabled: false,
        installment_payment_enabled: true,
      },
    ],
  },
  {
    payment_method: "real_time_payment",
    payment_method_types: [
      {
        payment_method_type: "duit_now",
        minimum_amount: 1,
        maximum_amount: 68607706,
        recurring_enabled: true,
        installment_payment_enabled: true,
        payment_experience: "redirect_to_url",
      },
      {
        payment_method_type: "fps",
        minimum_amount: 1,
        maximum_amount: 68607706,
        recurring_enabled: true,
        installment_payment_enabled: true,
        payment_experience: "redirect_to_url",
      },
      {
        payment_method_type: "prompt_pay",
        minimum_amount: 1,
        maximum_amount: 68607706,
        recurring_enabled: true,
        installment_payment_enabled: true,
        payment_experience: "redirect_to_url",
      },
      {
        payment_method_type: "viet_qr",
        minimum_amount: 1,
        maximum_amount: 68607706,
        recurring_enabled: true,
        installment_payment_enabled: true,
        payment_experience: "redirect_to_url",
      },
      {
        payment_method_type: "qris",
        minimum_amount: 1,
        maximum_amount: 68607706,
        recurring_enabled: true,
        installment_payment_enabled: false,
        payment_experience: "redirect_to_url",
      },
    ],
  },
  {
    payment_method: "upi",
    payment_method_types: [
      {
        payment_method_type: "upi_collect",
        minimum_amount: 1,
        maximum_amount: 68607706,
        recurring_enabled: true,
        installment_payment_enabled: true,
        payment_experience: "redirect_to_url",
      },
      {
        payment_method_type: "upi_intent",
        minimum_amount: 1,
        maximum_amount: 68607706,
        recurring_enabled: true,
        installment_payment_enabled: true,
        payment_experience: "redirect_to_url",
      },
    ],
  },
  {
    payment_method: "wallet",
    payment_method_types: [
      {
        payment_method_type: "apple_pay",
        minimum_amount: 1,
        maximum_amount: 68607706,
        recurring_enabled: true,
        installment_payment_enabled: true,
        payment_experience: "invoke_sdk_client",
      },
      {
        payment_method_type: "google_pay",
        minimum_amount: 1,
        maximum_amount: 68607706,
        recurring_enabled: true,
        installment_payment_enabled: true,
        payment_experience: "invoke_sdk_client",
      },
      {
        payment_method_type: "bluecode",
        payment_experience: "redirect_to_url",
        minimum_amount: 1,
        maximum_amount: 68607706,
        recurring_enabled: false,
        installment_payment_enabled: false,
      },
      {
        payment_method_type: "skrill",
        payment_experience: "redirect_to_url",
        minimum_amount: 1,
        maximum_amount: 68607706,
        recurring_enabled: false,
        installment_payment_enabled: false,
      },
      {
        payment_method_type: "ali_pay_hk",
        payment_experience: "redirect_to_url",
        minimum_amount: 1,
        maximum_amount: 68607706,
        recurring_enabled: false,
        installment_payment_enabled: false,
      },
      {
        payment_method_type: "mifinity",
        payment_experience: "redirect_to_url",
        minimum_amount: 1,
        maximum_amount: 68607706,
        recurring_enabled: false,
        installment_payment_enabled: false,
      },
      {
        payment_method_type: "paypal",
        payment_experience: "redirect_to_url",
        minimum_amount: 1,
        maximum_amount: 68607706,
        recurring_enabled: false,
        installment_payment_enabled: false,
      },
      {
        payment_method_type: "kakao_pay",
        payment_experience: "redirect_to_url",
        minimum_amount: 1,
        maximum_amount: 68607706,
        recurring_enabled: false,
        installment_payment_enabled: false,
      },
      {
        payment_method_type: "ali_pay",
        payment_experience: "redirect_to_url",
        minimum_amount: 1,
        maximum_amount: 68607706,
        recurring_enabled: false,
        installment_payment_enabled: false,
      },
      {
        payment_method_type: "gcash",
        payment_experience: "redirect_to_url",
        minimum_amount: 1,
        maximum_amount: 68607706,
        recurring_enabled: false,
        installment_payment_enabled: false,
      },
      {
        payment_method_type: "we_chat_pay",
        payment_experience: "redirect_to_url",
        minimum_amount: 1,
        maximum_amount: 68607706,
        recurring_enabled: false,
        installment_payment_enabled: false,
      },
      {
        payment_method_type: "momo",
        payment_experience: "redirect_to_url",
        minimum_amount: 1,
        maximum_amount: 68607706,
        recurring_enabled: false,
        installment_payment_enabled: false,
      },
      {
        payment_method_type: "twint",
        payment_experience: "redirect_to_url",
        minimum_amount: 1,
        maximum_amount: 68607706,
        recurring_enabled: false,
        installment_payment_enabled: false,
      },
      {
        payment_method_type: "vipps",
        payment_experience: "redirect_to_url",
        minimum_amount: 1,
        maximum_amount: 68607706,
        recurring_enabled: false,
        installment_payment_enabled: false,
      },
      {
        payment_method_type: "dana",
        payment_experience: "redirect_to_url",
        minimum_amount: 1,
        maximum_amount: 68607706,
        recurring_enabled: false,
        installment_payment_enabled: false,
      },
      {
        payment_method_type: "go_pay",
        payment_experience: "redirect_to_url",
        minimum_amount: 1,
        maximum_amount: 68607706,
        recurring_enabled: false,
        installment_payment_enabled: false,
      },
      {
        payment_method_type: "mb_way",
        payment_experience: "redirect_to_url",
        minimum_amount: 1,
        maximum_amount: 68607706,
        recurring_enabled: false,
        installment_payment_enabled: false,
      },
      {
        payment_method_type: "amazon_pay",
        payment_experience: "redirect_to_url",
        minimum_amount: 1,
        maximum_amount: 68607706,
        recurring_enabled: false,
        installment_payment_enabled: false,
      },
      {
        payment_method_type: "cashapp",
        payment_experience: "display_qr_code",
        minimum_amount: 1,
        maximum_amount: 68607706,
        recurring_enabled: false,
        installment_payment_enabled: false,
      },
      {
        payment_method_type: "revolut_pay",
        payment_experience: "redirect_to_url",
        minimum_amount: 1,
        maximum_amount: 68607706,
        recurring_enabled: false,
        installment_payment_enabled: false,
      },
    ],
  },
  {
    payment_method: "reward",
    payment_method_types: [
      {
        payment_method_type: "evoucher",
        payment_experience: "redirect_to_url",
        card_networks: null,
        accepted_currencies: null,
        accepted_countries: null,
        minimum_amount: 0,
        maximum_amount: 68607706,
        recurring_enabled: true,
        installment_payment_enabled: false,
      },
      {
        payment_method_type: "classic",
        payment_experience: "redirect_to_url",
        card_networks: null,
        accepted_currencies: null,
        accepted_countries: null,
        minimum_amount: 0,
        maximum_amount: 68607706,
        recurring_enabled: true,
        installment_payment_enabled: false,
      },
    ],
  },
  {
    payment_method: "voucher",
    payment_method_types: [
      {
        payment_method_type: "boleto",
        payment_experience: null,
        card_networks: null,
        accepted_currencies: null,
        accepted_countries: null,
        minimum_amount: 1,
        maximum_amount: 68607706,
        recurring_enabled: false,
        installment_payment_enabled: false,
      },
      {
        payment_method_type: "oxxo",
        payment_experience: null,
        card_networks: null,
        accepted_currencies: null,
        accepted_countries: null,
        minimum_amount: 1,
        maximum_amount: 68607706,
        recurring_enabled: false,
        installment_payment_enabled: false,
      },
      {
        payment_method_type: "alfamart",
        payment_experience: null,
        card_networks: null,
        accepted_currencies: null,
        accepted_countries: null,
        minimum_amount: 1,
        maximum_amount: 68607706,
        recurring_enabled: false,
        installment_payment_enabled: false,
      },
      {
        payment_method_type: "indomaret",
        payment_experience: null,
        card_networks: null,
        accepted_currencies: null,
        accepted_countries: null,
        minimum_amount: 1,
        maximum_amount: 68607706,
        recurring_enabled: false,
        installment_payment_enabled: false,
      },
      {
        payment_method_type: "seven_eleven",
        payment_experience: null,
        card_networks: null,
        accepted_currencies: null,
        accepted_countries: null,
        minimum_amount: 1,
        maximum_amount: 68607706,
        recurring_enabled: false,
        installment_payment_enabled: false,
      },
      {
        payment_method_type: "lawson",
        payment_experience: null,
        card_networks: null,
        accepted_currencies: null,
        accepted_countries: null,
        minimum_amount: 1,
        maximum_amount: 68607706,
        recurring_enabled: false,
        installment_payment_enabled: false,
      },
      {
        payment_method_type: "mini_stop",
        payment_experience: null,
        card_networks: null,
        accepted_currencies: null,
        accepted_countries: null,
        minimum_amount: 1,
        maximum_amount: 68607706,
        recurring_enabled: false,
        installment_payment_enabled: false,
      },
      {
        payment_method_type: "family_mart",
        payment_experience: null,
        card_networks: null,
        accepted_currencies: null,
        accepted_countries: null,
        minimum_amount: 1,
        maximum_amount: 68607706,
        recurring_enabled: false,
        installment_payment_enabled: false,
      },
      {
        payment_method_type: "seicomart",
        payment_experience: null,
        card_networks: null,
        accepted_currencies: null,
        accepted_countries: null,
        minimum_amount: 1,
        maximum_amount: 68607706,
        recurring_enabled: false,
        installment_payment_enabled: false,
      },
      {
        payment_method_type: "pay_easy",
        payment_experience: null,
        card_networks: null,
        accepted_currencies: null,
        accepted_countries: null,
        minimum_amount: 1,
        maximum_amount: 68607706,
        recurring_enabled: false,
        installment_payment_enabled: false,
      },
    ],
  },
  {
    payment_method: "gift_card",
    payment_method_types: [
      {
        payment_method_type: "givex",
        payment_experience: null,
        card_networks: null,
        accepted_currencies: null,
        accepted_countries: null,
        minimum_amount: 1,
        maximum_amount: 68607706,
        recurring_enabled: false,
        installment_payment_enabled: false,
      },
      {
        payment_method_type: "pay_safe_card",
        payment_experience: "redirect_to_url",
        card_networks: null,
        accepted_currencies: null,
        accepted_countries: null,
        minimum_amount: 1,
        maximum_amount: 68607706,
        recurring_enabled: false,
        installment_payment_enabled: false,
      },
    ],
  },
  {
    payment_method: "crypto",
    payment_method_types: [
      {
        payment_method_type: "crypto_currency",
        payment_experience: "redirect_to_url",
        card_networks: null,
        accepted_currencies: null,
        accepted_countries: null,
        minimum_amount: 0,
        maximum_amount: 68607706,
        recurring_enabled: true,
        installment_payment_enabled: false,
      },
    ],
  },
  {
    payment_method: "pay_later",
    payment_method_types: [
      {
        payment_method_type: "klarna",
        payment_experience: "redirect_to_url",
        card_networks: null,
        accepted_currencies: null,
        accepted_countries: null,
        minimum_amount: 1,
        maximum_amount: 68607706,
        recurring_enabled: false,
        installment_payment_enabled: false,
      },
      {
        payment_method_type: "payjustnow",
        payment_experience: "redirect_to_url",
        card_networks: null,
        accepted_currencies: {
          type: "enable_only",
          list: ["ZAR"],
        },
        accepted_countries: {
          type: "enable_only",
          list: ["ZA"],
        },
        minimum_amount: 100,
        maximum_amount: 100000000,
        recurring_enabled: false,
        installment_payment_enabled: false,
      },
      {
        payment_method_type: "affirm",
        payment_experience: "redirect_to_url",
        card_networks: null,
        accepted_currencies: null,
        accepted_countries: null,
        minimum_amount: 1,
        maximum_amount: 68607706,
        recurring_enabled: false,
        installment_payment_enabled: false,
      },
      {
        payment_method_type: "atome",
        payment_experience: "redirect_to_url",
        card_networks: null,
        accepted_currencies: null,
        accepted_countries: null,
        minimum_amount: 1,
        maximum_amount: 68607706,
        recurring_enabled: false,
        installment_payment_enabled: false,
      },
      {
        payment_method_type: "afterpay_clearpay",
        payment_experience: "redirect_to_url",
        card_networks: null,
        accepted_currencies: null,
        accepted_countries: null,
        minimum_amount: 1,
        maximum_amount: 68607706,
        recurring_enabled: false,
        installment_payment_enabled: false,
      },
      {
        payment_method_type: "alma",
        payment_experience: "redirect_to_url",
        card_networks: null,
        accepted_currencies: null,
        accepted_countries: null,
        minimum_amount: 1,
        maximum_amount: 68607706,
        recurring_enabled: false,
        installment_payment_enabled: false,
      },
      {
        payment_method_type: "walley",
        payment_experience: "redirect_to_url",
        card_networks: null,
        accepted_currencies: null,
        accepted_countries: null,
        minimum_amount: 1,
        maximum_amount: 68607706,
        recurring_enabled: false,
        installment_payment_enabled: false,
      },
    ],
  },
  {
    payment_method: "card_redirect",
    payment_method_types: [
      {
        payment_method_type: "card_redirect",
        payment_experience: null,
        card_networks: null,
        accepted_currencies: null,
        accepted_countries: null,
        minimum_amount: 1,
        maximum_amount: 68607706,
        recurring_enabled: true,
        installment_payment_enabled: true,
      },
    ],
  },
  {
    payment_method: "open_banking",
    payment_method_types: [
      {
        payment_method_type: "open_banking_pis",
        minimum_amount: 1,
        maximum_amount: 68607706,
        recurring_enabled: false,
        installment_payment_enabled: false,
      },
    ],
  },
];

// Shared expected responses for the platform refund list and filter APIs.
// These assertions are connector-agnostic (identical for every connector),
// so they are centralized here instead of being inlined in the spec.

// Auth negative: connected-merchant api key (or platform key with the
// x-connected-merchant-id header) on a platform-level refunds endpoint
export const platformRefundsConnectedAccountOperationError = {
  status: 400,
  error: {
    type: "invalid_request",
    code: "IR_49",
    message: "API does not support connected account operation",
  },
};

// Auth negative: standard merchant key or missing api key on a
// platform-level refunds endpoint
export const platformRefundsInvalidApiKeyError = {
  status: 401,
  error: {
    type: "invalid_request",
    code: "IR_01",
    message: "API key not provided or invalid API key used",
  },
};

// Query validation negatives for the platform refund list
export const platformRefundsListLimitZeroError = {
  status: 400,
  rawError:
    "Query deserialize error: list limit 0 is invalid, it must be between 1 and 100",
};

export const platformRefundsListLimitAboveMaxError = {
  status: 400,
  rawError:
    "Query deserialize error: list limit 1000 is invalid, it must be between 1 and 100",
};

export const platformRefundsListInvalidOffsetError = {
  status: 400,
  rawError:
    "Query deserialize error: list offset 999999 is invalid, it must be at most 20000",
};

// Maps the refund object status (RefundResponse.status:
// succeeded/failed/pending/review) to the platform refund list filter
// variant (the refund_status query param and the list item's refund_status
// field: success/failure/pending/manual_review)
export const refundStatusFilterMap = {
  succeeded: "success",
  failed: "failure",
  pending: "pending",
  review: "manual_review",
};

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({
        Request: {
          currency: getCurrency(paymentMethodType),
        },
        Response: {
          status: 200,
          body: {
            status: "requires_payment_method",
          },
        },
      }),

    Pix: getCustomExchange({
      Request: {
        payment_method: "bank_transfer",
        payment_method_type: "pix",
        payment_method_data: {
          bank_transfer: {
            pix: {},
          },
        },
        billing: {
          address: {
            line1: "1467",
            line2: "Harrison Street",
            line3: "Harrison Street",
            city: "San Fransico",
            state: "California",
            zip: "94122",
            country: "BR",
            first_name: "john",
            last_name: "doe",
          },
        },
        currency: "BRL",
      },
    }),
    Ach: getCustomExchange({
      Request: {
        payment_method: "bank_transfer",
        payment_method_type: "ach",
        payment_method_data: {
          bank_transfer: {
            ach_bank_transfer: {},
          },
        },
        billing: {
          address: {
            line1: "1467",
            line2: "Harrison Street",
            line3: "Harrison Street",
            city: "San Fransico",
            state: "California",
            zip: "94122",
            country: "BR",
            first_name: "john",
            last_name: "doe",
          },
        },
        currency: "BRL",
      },
    }),
    InstantBankTransferFinland: getCustomExchange({
      Request: {
        payment_method: "bank_transfer",
        payment_method_type: "instant_bank_transfer_finland",
        payment_method_data: {
          bank_transfer: {
            instant_bank_transfer_finland: {},
          },
        },
        billing: {
          address: {
            line1: "1467",
            line2: "Harrison Street",
            line3: "Harrison Street",
            city: "San Fransico",
            state: "California",
            zip: "94122",
            country: "FI",
            first_name: "john",
            last_name: "doe",
          },
        },
        currency: "EUR",
      },
    }),
    InstantBankTransferPoland: getCustomExchange({
      Request: {
        payment_method: "bank_transfer",
        payment_method_type: "instant_bank_transfer_poland",
        payment_method_data: {
          bank_transfer: {
            instant_bank_transfer_poland: {},
          },
        },
        billing: {
          address: {
            line1: "1467",
            line2: "Harrison Street",
            line3: "Harrison Street",
            city: "San Fransico",
            state: "California",
            zip: "94122",
            country: "PL",
            first_name: "john",
            last_name: "doe",
          },
        },
        currency: "PLN",
      },
    }),
  },
  bank_redirect_pm: {
    PaymentIntent: (paymentMethodType) =>
      getCustomExchange({
        Request: {
          currency: getCurrency(paymentMethodType),
        },
        Response: {
          status: 200,
          body: {
            status: "requires_payment_method",
          },
        },
      }),
    Ideal: {
      ...getCustomExchange({
        Request: {
          payment_method: "bank_redirect",
          payment_method_type: "ideal",
          payment_method_data: {
            bank_redirect: {
              ideal: {
                bank_name: "ing",
                country: "NL",
              },
            },
          },
          billing: {
            address: {
              line1: "1467",
              line2: "Harrison Street",
              line3: "Harrison Street",
              city: "San Fransico",
              state: "California",
              zip: "94122",
              country: "NL",
              first_name: "john",
              last_name: "doe",
            },
          },
        },
      }),
      MandateSingleUseAutoCapture: getCustomExchange({
        Request: { amount: 6540 },
        Response: {
          status: 200,
          body: {
            status: "requires_customer_action",
          },
        },
        Configs: {
          TRIGGER_SKIP: true,
        },
      }),
    },
    BancontactCard: {
      ...getCustomExchange({
        Request: {
          payment_method: "bank_redirect",
          payment_method_type: "bancontact_card",
          payment_method_data: {
            bank_redirect: {
              bancontact_card: {
                card_number: "6703444444444449",
                card_exp_month: "03",
                card_exp_year: "2030",
              },
            },
          },
          billing: standardBillingAddress,
        },
      }),
      MandateSingleUseAutoCapture: getCustomExchange({
        Request: { amount: 6540 },
        Response: {
          status: 200,
          body: {
            status: "requires_customer_action",
          },
        },
      }),
    },
    OpenBankingUk: {
      ...getCustomExchange({
        Request: {
          payment_method: "bank_redirect",
          payment_method_type: "open_banking_uk",
          payment_method_data: {
            bank_redirect: {
              open_banking_uk: {
                issuer: "citi",
                country: "GB",
              },
            },
          },
          billing: standardBillingAddress,
        },
      }),
      MandateSingleUseAutoCapture: getCustomExchange({
        Request: { amount: 6540 },
        Response: {
          status: 200,
          body: {
            status: "requires_customer_action",
          },
        },
        Configs: {
          TRIGGER_SKIP: true,
        },
      }),
    },
    OnlineBankingFpx: getCustomExchange({
      Request: {
        payment_method: "bank_redirect",
        payment_method_type: "online_banking_fpx",
        payment_method_data: {
          bank_redirect: {
            online_banking_fpx: {
              issuer: "affin_bank",
            },
          },
        },
        billing: standardBillingAddress,
      },
    }),
    Giropay: getCustomExchange({
      Request: {
        payment_method: "bank_redirect",
        payment_method_type: "giropay",
        payment_method_data: {
          bank_redirect: {
            giropay: {
              bank_name: "",
              bank_account_bic: "",
              bank_account_iban: "",
              preferred_language: "en",
              country: "DE",
            },
          },
        },
        billing: {
          address: {
            line1: "1467",
            line2: "Harrison Street",
            line3: "Harrison Street",
            city: "San Fransico",
            state: "California",
            zip: "94122",
            country: "DE",
            first_name: "john",
            last_name: "doe",
          },
        },
      },
    }),
    Sofort: getCustomExchange({
      Request: {
        payment_method: "bank_redirect",
        payment_method_type: "sofort",
        payment_method_data: {
          bank_redirect: {
            sofort: {
              country: "DE",
              preferred_language: "en",
            },
          },
        },
        billing: {
          address: {
            line1: "1467",
            line2: "Harrison Street",
            line3: "Harrison Street",
            city: "San Fransico",
            state: "California",
            zip: "94122",
            country: "DE",
            first_name: "john",
            last_name: "doe",
          },
        },
      },
    }),
    Eps: getCustomExchange({
      Request: {
        payment_method: "bank_redirect",
        payment_method_type: "eps",
        payment_method_data: {
          bank_redirect: {
            eps: {
              bank_name: "ing",
            },
          },
        },
        billing: {
          address: {
            line1: "1467",
            line2: "Harrison Street",
            line3: "Harrison Street",
            city: "San Fransico",
            state: "California",
            zip: "94122",
            country: "AT",
            first_name: "john",
            last_name: "doe",
          },
        },
      },
    }),
    Przelewy24: getCustomExchange({
      Request: {
        payment_method: "bank_redirect",
        payment_method_type: "przelewy24",
        payment_method_data: {
          bank_redirect: {
            przelewy24: {
              bank_name: "citi",
              billing_details: {
                email: "[email protected]",
              },
            },
          },
        },
      },
    }),
    Blik: getCustomExchange({
      Request: {
        payment_method: "bank_redirect",
        payment_method_type: "blik",
        payment_method_data: {
          bank_redirect: {
            blik: {
              blik_code: "777987",
            },
          },
        },
        billing: {
          address: {
            line1: "1467",
            line2: "Harrison Street",
            line3: "Harrison Street",
            city: "San Fransico",
            state: "California",
            zip: "94122",
            country: "PL",
            first_name: "john",
            last_name: "doe",
          },
        },
      },
    }),
    Interac: getCustomExchange({
      Request: {
        payment_method: "bank_redirect",
        payment_method_type: "interac",
        payment_method_data: {
          bank_redirect: {
            interac: {
              bank_name: "ing",
            },
          },
        },
        billing: {
          ...standardBillingAddress,
          address: {
            ...standardBillingAddress.address,
            country: "CA",
          },
        },
      },
    }),
    Trustly: {
      ...getCustomExchange({
        Configs: {
          TRIGGER_SKIP: true,
        },
        Request: {
          payment_method: "bank_redirect",
          payment_method_type: "trustly",
          payment_method_data: {
            bank_redirect: {
              trustly: {
                country: "NL",
              },
            },
          },
          billing: standardBillingAddress,
        },
      }),
      MandateSingleUseAutoCapture: getCustomExchange({
        Configs: {
          TRIGGER_SKIP: true,
        },
        Request: { amount: 6540 },
        Response: {
          status: 200,
          body: {
            status: "requires_customer_action",
          },
        },
      }),
    },
    Eft: getCustomExchange({
      Request: {
        payment_method: "bank_redirect",
        payment_method_type: "eft",
        payment_method_data: {
          bank_redirect: {
            eft: {
              provider: "ozow",
            },
          },
        },
      },
    }),
  },
  bank_debit_pm: {
    PaymentIntent: (paymentMethodType) => {
      const currencyMap = { Sepa: "EUR", Ach: "USD", Becs: "AUD", Bacs: "GBP" };
      return getCustomExchange({
        Request: {
          currency: currencyMap[paymentMethodType] || "USD",
        },
        Response: {
          status: 200,
          body: {
            status: "requires_payment_method",
          },
        },
      });
    },
    Sepa: getCustomExchange({
      Request: {
        payment_method: "bank_debit",
        payment_method_type: "sepa",
        payment_method_data: {
          bank_debit: {
            sepa_bank_debit: {
              iban: "DE89370400440532013000",
              bank_account_holder_name: "Test Account",
            },
          },
        },
        billing: {
          address: {
            country: "DE",
          },
          email: "[email protected]",
        },
      },
    }),
    Ach: getCustomExchange({
      Request: {
        payment_method: "bank_debit",
        payment_method_type: "ach",
        payment_method_data: {
          bank_debit: {
            ach_bank_debit: {
              account_number: "000123456789",
              routing_number: "110000000",
              bank_account_holder_name: "Test Account",
            },
          },
        },
        billing: {
          address: {
            country: "US",
          },
          email: "[email protected]",
        },
      },
    }),
    Becs: getCustomExchange({
      Request: {
        payment_method: "bank_debit",
        payment_method_type: "becs",
        payment_method_data: {
          bank_debit: {
            becs_bank_debit: {
              account_number: "000123456",
              bsb_number: "000000",
              bank_account_holder_name: "Test Account",
            },
          },
        },
        billing: {
          address: {
            country: "AU",
          },
          email: "[email protected]",
        },
      },
    }),
    Bacs: getCustomExchange({
      Request: {
        payment_method: "bank_debit",
        payment_method_type: "bacs",
        payment_method_data: {
          bank_debit: {
            bacs_bank_debit: {
              account_number: "00012345",
              sort_code: "108800",
              bank_account_holder_name: "Test Account",
            },
          },
        },
        billing: {
          address: {
            country: "GB",
          },
          email: "[email protected]",
        },
      },
    }),
    get MandateSingleUseSepa() {
      return this.Sepa;
    },
    get MandateSingleUseBecs() {
      return this.Becs;
    },
    get MandateSingleUseAch() {
      return this.Ach;
    },
    get MandateSingleUseBacs() {
      return this.Bacs;
    },
    MITAutoCaptureSepa: getCustomExchange({
      Request: {
        amount: 6540,
        off_session: true,
        confirm: true,
        currency: "EUR",
      },
    }),
    MITAutoCaptureBecs: getCustomExchange({
      Request: {
        amount: 6540,
        off_session: true,
        confirm: true,
        currency: "AUD",
      },
    }),
    MITAutoCaptureAch: getCustomExchange({
      Request: {
        amount: 6540,
        off_session: true,
        confirm: true,
        currency: "USD",
      },
    }),
    MITAutoCaptureBacs: getCustomExchange({
      Request: {
        amount: 6540,
        off_session: true,
        confirm: true,
        currency: "GBP",
      },
    }),
    BankdebitMIT: getCustomExchange({
      Request: {
        currency: "EUR",
        off_session: true,
      },
    }),
    SepaMandate: getCustomExchange({
      Request: {
        payment_method: "bank_debit",
        payment_method_type: "sepa",
        payment_method_data: {
          bank_debit: {
            sepa_bank_debit: {
              iban: "DE89370400440532013000",
              bank_account_holder_name: "Test Account",
            },
          },
        },
        billing: {
          address: {
            country: "DE",
          },
          email: "[email protected]",
        },
      },
    }),
  },
  wallet_pm: {
    PaymentIntent: (paymentMethodType) =>
      getCustomExchange({
        Request: {
          currency: getCurrency(paymentMethodType),
        },
        Response: {
          status: 200,
          body: {
            status: "requires_payment_method",
          },
        },
      }),
    Bluecode: getCustomExchange({
      Request: {
        payment_method: "wallet",
        payment_method_type: "bluecode",
        payment_method_data: {
          wallet: {
            bluecode_redirect: {},
          },
        },
        billing: {
          ...standardBillingAddress,
          address: {
            ...standardBillingAddress.address,
            country: "AT",
          },
        },
      },
    }),
    AliPayHk: getCustomExchange({
      Request: {
        payment_method: "wallet",
        payment_method_type: "ali_pay_hk",
        payment_method_data: {
          wallet: {
            ali_pay_hk_redirect: {},
          },
        },
        billing: {
          ...standardBillingAddress,
          address: {
            ...standardBillingAddress.address,
            country: "HK",
          },
        },
      },
      Configs: {
        TRIGGER_SKIP: true,
      },
    }),
    Mifinity: getCustomExchange({
      Request: {
        payment_method: "wallet",
        payment_method_type: "mifinity",
        authentication_type: "no_three_ds",
        billing: {
          ...standardBillingAddress,
          address: {
            ...standardBillingAddress.address,
            country: "GB",
          },
          phone: {
            number: "1234567890",
            country_code: "+44",
          },
          email: "[email protected]",
        },
        payment_method_data: {
          wallet: {
            mifinity: {
              date_of_birth: "1990-01-01",
              language_preference: "en",
            },
          },
        },
      },
    }),
    PaypalRedirect: getCustomExchange({
      Request: {
        payment_method: "wallet",
        payment_method_type: "paypal",
        authentication_type: "no_three_ds",
        payment_method_data: {
          wallet: {
            paypal_redirect: {},
          },
        },
        billing: standardBillingAddress,
      },
      Response: {
        status: 200,
        body: {
          status: "requires_customer_action",
        },
      },
    }),
    PaypalRedirectMandateCIT: getCustomExchange({
      Request: {
        payment_method: "wallet",
        payment_method_type: "paypal",
        authentication_type: "no_three_ds",
        billing: standardBillingAddress,
        payment_method_data: {
          wallet: {
            paypal_redirect: {},
          },
        },
        setup_future_usage: "off_session",
        mandate_data: {
          customer_acceptance: customerAcceptance,
          mandate_type: {
            single_use: {
              amount: 8000,
              currency: "EUR",
            },
          },
        },
      },
      Response: {
        status: 200,
        body: {
          status: "requires_customer_action",
        },
      },
    }),
    Skrill: getCustomExchange({
      Request: {
        payment_method: "wallet",
        payment_method_type: "skrill",
        payment_method_data: {
          wallet: {
            skrill: {},
          },
        },
      },
    }),
  },
  pay_later_pm: {
    PaymentIntent: (paymentMethodType) =>
      getCustomExchange({
        Request: {
          currency: getCurrency(paymentMethodType),
        },
        Response: {
          status: 200,
          body: {
            status: "requires_payment_method",
          },
        },
      }),
    Klarna: getCustomExchange({
      Request: {
        payment_method: "pay_later",
        payment_method_type: "klarna",
        payment_experience: "redirect_to_url",
        payment_method_data: {
          pay_later: {
            klarna_redirect: {
              billing_email: "[email protected]",
              billing_country: "DE",
            },
          },
        },
        billing: {
          email: "[email protected]",
          address: {
            line1: "1467",
            line2: "Harrison Street",
            line3: "Harrison Street",
            city: "San Fransico",
            state: "California",
            zip: "94122",
            country: "DE",
            first_name: "joseph",
            last_name: "Doe",
          },
        },
        order_details: [
          {
            product_name: "Test Product",
            quantity: 1,
            amount: 6000,
          },
        ],
      },
    }),
    Affirm: getCustomExchange({
      Request: {
        payment_method: "pay_later",
        payment_method_type: "affirm",
        payment_experience: "redirect_to_url",
        payment_method_data: {
          pay_later: {
            affirm_redirect: {},
          },
        },
        billing: {
          email: "[email protected]",
          address: {
            line1: "1467",
            line2: "Harrison Street",
            line3: "Harrison Street",
            city: "San Fransico",
            state: "California",
            zip: "94122",
            country: "US",
            first_name: "joseph",
            last_name: "Doe",
          },
        },
        order_details: [
          {
            product_name: "Test Product",
            quantity: 1,
            amount: 6000,
          },
        ],
      },
    }),
    AutoCapture: getCustomExchange({
      Request: {
        currency: "EUR",
        capture_method: "automatic",
      },
      Response: {
        status: 200,
        body: {
          status: "requires_payment_method",
        },
      },
    }),
    ManualCapture: getCustomExchange({
      Request: {
        currency: "EUR",
        capture_method: "manual",
      },
      Response: {
        status: 200,
        body: {
          status: "requires_payment_method",
        },
      },
    }),
    AffirmManualCapture: getCustomExchange({
      Request: {
        payment_method: "pay_later",
        payment_method_type: "affirm",
        payment_experience: "redirect_to_url",
        payment_method_data: {
          pay_later: {
            affirm_redirect: {
              billing_email: "[email protected]",
              billing_country: "US",
            },
          },
        },
        billing: {
          email: "[email protected]",
          address: {
            line1: "1467",
            line2: "Harrison Street",
            line3: "Harrison Street",
            city: "San Francisco",
            state: "California",
            zip: "94122",
            country: "US",
            first_name: "joseph",
            last_name: "Doe",
          },
          phone: {
            number: "8056599999",
            country_code: "+1",
          },
        },
        order_details: [
          {
            product_name: "Test Product",
            quantity: 1,
            amount: 6000,
          },
        ],
      },
    }),
    Capture: getCustomExchange({
      Request: {
        amount_to_capture: 6000,
      },
    }),
    Refund: getCustomExchange({
      Request: {
        amount: 6000,
      },
    }),
    PartialRefund: getCustomExchange({
      Request: {
        amount: 2000,
      },
    }),
    SyncRefund: getCustomExchange({}),
    Payjustnow: getCustomExchange({
      Request: {
        payment_method: "pay_later",
        payment_method_type: "payjustnow",
        payment_method_data: {
          pay_later: {
            payjustnow_redirect: {},
          },
        },
        billing: {
          email: "[email protected]",
          address: {
            line1: "123 Main Street",
            line2: "",
            line3: "",
            city: "Johannesburg",
            state: "Gauteng",
            zip: "2001",
            country: "ZA",
            first_name: "Test",
            last_name: "Customer",
          },
        },
      },
    }),
    Payjustnowinstore: getCustomExchange({
      Request: {
        payment_method: "pay_later",
        payment_method_type: "payjustnow",
        payment_method_data: {
          pay_later: {
            payjustnow_redirect: {},
          },
        },
        billing: {
          email: "[email protected]",
          address: {
            line1: "123 Main Street",
            line2: "",
            line3: "",
            city: "Johannesburg",
            state: "Gauteng",
            zip: "2001",
            country: "ZA",
            first_name: "Test",
            last_name: "Customer",
          },
        },
      },
    }),
    SyncRefundScheduled: getCustomExchange({}),
    AfterpayClearpay: getCustomExchange({
      Request: {
        payment_method: "pay_later",
        payment_method_type: "afterpay_clearpay",
        payment_experience: "redirect_to_url",
        payment_method_data: {
          pay_later: {
            afterpay_clearpay_redirect: {},
          },
        },
        billing: {
          phone: {
            number: "4155552671",
            country_code: "+1",
          },
          address: {
            line1: "1467",
            line2: "Harrison Street",
            city: "San Francisco",
            state: "California",
            zip: "94122",
            country: "US",
            first_name: "joseph",
            last_name: "Doe",
          },
        },
        shipping: {
          address: {
            line1: "1467",
            line2: "Harrison Street",
            city: "San Francisco",
            state: "California",
            zip: "94122",
            country: "US",
            first_name: "joseph",
            last_name: "Doe",
          },
        },
        order_details: [
          {
            product_name: "Test Product",
            quantity: 1,
            amount: 6000,
          },
        ],
      },
    }),
    Alma: getCustomExchange({
      Request: {
        payment_method: "pay_later",
        payment_method_type: "alma",
        payment_experience: "redirect_to_url",
        payment_method_data: {
          pay_later: {
            alma_redirect: {},
          },
        },
        billing: {
          email: "[email protected]",
          phone: {
            number: "612345678",
            country_code: "+33",
          },
          address: {
            line1: "123 Rue de Test",
            city: "Paris",
            state: "Ile-de-France",
            zip: "75001",
            country: "FR",
            first_name: "Jean",
            last_name: "Dupont",
          },
        },
        shipping: {
          address: {
            line1: "123 Rue de Test",
            city: "Paris",
            state: "Ile-de-France",
            zip: "75001",
            country: "FR",
            first_name: "Jean",
            last_name: "Dupont",
          },
        },
      },
    }),
    Atome: getCustomExchange({
      Request: {
        payment_method: "pay_later",
        payment_method_type: "atome",
        payment_experience: "redirect_to_url",
        payment_method_data: {
          pay_later: {
            atome_redirect: {},
          },
        },
        billing: {
          phone: {
            number: "91234567",
            country_code: "+65",
          },
          address: {
            line1: "123 Test Street",
            city: "Singapore",
            state: "Singapore",
            zip: "018956",
            country: "SG",
            first_name: "John",
            last_name: "Doe",
          },
        },
        shipping: {
          address: {
            line1: "123 Test Street",
            city: "Singapore",
            state: "Singapore",
            zip: "018956",
            country: "SG",
            first_name: "John",
            last_name: "Doe",
          },
        },
        order_details: [
          {
            product_name: "Test Product",
            quantity: 1,
            amount: 6000,
          },
        ],
      },
    }),
    Walley: getCustomExchange({
      Request: {
        payment_method: "pay_later",
        payment_method_type: "walley",
        payment_experience: "redirect_to_url",
        payment_method_data: {
          pay_later: {
            walley_redirect: {},
          },
        },
        billing: {
          email: "[email protected]",
          phone: {
            number: "0701234567",
            country_code: "+46",
          },
          address: {
            line1: "123 Test Street",
            city: "Stockholm",
            state: "Stockholm",
            zip: "11122",
            country: "SE",
            first_name: "Lars",
            last_name: "Eriksson",
          },
        },
        shipping: {
          address: {
            line1: "123 Test Street",
            city: "Stockholm",
            state: "Stockholm",
            zip: "11122",
            country: "SE",
            first_name: "Lars",
            last_name: "Eriksson",
          },
        },
        order_details: [
          {
            product_name: "Test Product",
            quantity: 1,
            amount: 6000,
          },
        ],
      },
    }),
    CaptureOnWrongStatus: getCustomExchange({
      Request: {
        amount_to_capture: 6000,
      },
      Response: {
        status: 400,
        body: {
          error: {
            type: "invalid_request",
            message:
              "This Payment could not be captured because it has a payment.status of requires_customer_action. The expected state is requires_capture, partially_captured_and_capturable, processing",
            code: "IR_14",
          },
        },
      },
    }),
    ConfirmWithoutPmData: getCustomExchange({
      Request: {
        payment_method: undefined,
        payment_method_type: undefined,
        payment_experience: undefined,
        payment_method_data: undefined,
        order_details: undefined,
      },
      Response: {
        status: 400,
        body: {
          error: {
            type: "invalid_request",
            code: "IR_04",
          },
        },
      },
    }),
  },
  real_time_payment_pm: {
    PaymentIntent: getCustomExchange({
      Request: {
        currency: "MYR",
        customer_acceptance: null,
        setup_future_usage: "on_session",
        billing: standardBillingAddress,
      },
      Response: {
        status: 200,
        body: {
          status: "requires_payment_method",
        },
      },
    }),
    DuitNow: getCustomExchange({
      Request: {
        payment_method: "real_time_payment",
        payment_method_type: "duit_now",
        payment_method_data: {
          real_time_payment: {
            duit_now: {},
          },
        },
        billing: standardBillingAddress,
      },
    }),
    Qris: getCustomExchange({
      Request: {
        payment_method: "real_time_payment",
        payment_method_type: "qris",
        payment_method_data: {
          real_time_payment: {
            qris: {},
          },
        },
        billing: standardBillingAddress,
      },
    }),
    QrisMandate: getCustomExchange({
      Request: {
        payment_method: "real_time_payment",
        payment_method_type: "qris",
        payment_method_data: {
          real_time_payment: {
            qris: {},
          },
        },
        billing: standardBillingAddress,
        setup_future_usage: "off_session",
        mandate_data: {
          customer_acceptance: {
            acceptance_type: "online",
            accepted_at: "2026-07-13T18:09:53Z",
            online: {
              ip_address: "127.0.0.1",
              user_agent: "test-agent",
            },
          },
        },
      },
    }),
  },
  card_pm: {
    PaymentIntent: getCustomExchange({
      Request: {
        currency: "USD",
      },
      Response: {
        status: 200,
        body: {
          status: "requires_payment_method",
        },
      },
    }),
    PaymentIntentOffSession: getCustomExchange({
      Request: {
        currency: "USD",
      },
      Response: {
        status: 200,
        body: {
          status: "requires_payment_method",
        },
      },
    }),
    PaymentIntentWithShippingCost: getCustomExchange({
      Request: {
        currency: "USD",
        shipping_cost: 50,
      },
      Response: {
        status: 200,
        body: {
          status: "requires_payment_method",
          shipping_cost: 50,
          amount: 6000,
        },
      },
    }),
    PaymentIntentWithBillingDescriptor: getCustomExchange({
      Request: {
        currency: "USD",
        billing_descriptor: {
          name: "Test Business",
          city: "San Francisco",
          phone: "1234567890",
          statement_descriptor: "Test Descriptor",
          statement_descriptor_suffix: "Suffix",
          reference: "REF123",
        },
      },
      Response: {
        status: 200,
        body: {
          status: "requires_payment_method",
        },
      },
    }),
    PaymentConfirmWithBillingDescriptor: getCustomExchange({
      Request: {
        payment_method: "card",
        payment_method_data: {
          card: successfulNo3DSCardDetails,
        },
        billing_descriptor: {
          name: "Test Business",
          city: "San Francisco",
          phone: "1234567890",
          statement_descriptor: "Test Descriptor",
          statement_descriptor_suffix: "Suffix",
          reference: "REF123",
        },
      },
      Response: {
        status: 200,
        body: {
          status: "succeeded",
        },
      },
    }),
    PaymentConfirmWithShippingCost: getCustomExchange({
      Request: {
        payment_method: "card",
        payment_method_data: {
          card: successfulNo3DSCardDetails,
        },
        customer_acceptance: null,
        setup_future_usage: "on_session",
      },
    }),
    "3DSManualCapture": getCustomExchange({
      Request: {
        payment_method: "card",
        payment_method_data: {
          card: successfulThreeDSTestCardDetails,
        },
        currency: "USD",
        customer_acceptance: null,
        setup_future_usage: "on_session",
      },
    }),
    "3DSAutoCapture": getCustomExchange({
      Request: {
        payment_method: "card",
        payment_method_data: {
          card: successfulThreeDSTestCardDetails,
        },
        currency: "USD",
        customer_acceptance: null,
        setup_future_usage: "on_session",
      },
    }),
    SessionToken: {
      Response: {
        status: 200,
        body: {
          session_token: [],
        },
      },
    },
    No3DSManualCapture: getCustomExchange({
      Request: {
        payment_method: "card",
        payment_method_data: {
          card: successfulNo3DSCardDetails,
        },
        currency: "USD",
        customer_acceptance: null,
        setup_future_usage: "on_session",
      },
    }),
    No3DSAutoCapture: getCustomExchange({
      Request: {
        payment_method: "card",
        payment_method_data: {
          card: successfulNo3DSCardDetails,
        },
        currency: "USD",
        customer_acceptance: null,
        setup_future_usage: "on_session",
      },
    }),
    ExtendedCardInfo: getCustomExchange({
      Request: {
        payment_method: "card",
        payment_method_data: {
          card: successfulNo3DSCardDetails,
        },
        currency: "USD",
        customer_acceptance: null,
        setup_future_usage: "on_session",
      },
      Response: {
        status: 200,
        body: {
          status: "succeeded",
        },
      },
    }),
    No3DSFailPayment: getCustomExchange({
      Request: {
        payment_method: "card",
        payment_method_data: {
          card: successfulNo3DSCardDetails,
        },
        customer_acceptance: null,
        setup_future_usage: "on_session",
      },
    }),
    ManualRetryPaymentDisabled: getCustomExchange({
      Request: {
        payment_method: "card",
        payment_method_data: {
          card: successfulNo3DSCardDetails,
        },
        customer_acceptance: null,
        setup_future_usage: "on_session",
      },
      Response: {
        status: 400,
        body: {
          type: "invalid_request",
          message:
            "You cannot confirm this payment because it has status failed, you can enable `manual_retry` in profile to try this payment again",
          code: "IR_16",
        },
      },
    }),
    ManualRetryPaymentEnabled: getCustomExchange({
      Request: {
        payment_method: "card",
        payment_method_data: {
          card: successfulNo3DSCardDetails,
        },
        customer_acceptance: null,
        setup_future_usage: "on_session",
      },
      Response: {
        status: 200,
        body: {
          status: "succeeded",
          payment_method: "card",
          attempt_count: 2,
        },
      },
    }),
    ManualRetryPaymentCutoffExpired: getCustomExchange({
      Request: {
        payment_method: "card",
        payment_method_data: {
          card: successfulNo3DSCardDetails,
        },
        customer_acceptance: null,
        setup_future_usage: "on_session",
      },
      Response: {
        status: 400,
        body: {
          type: "invalid_request",
          message:
            "You cannot confirm this payment using `manual_retry` because the allowed duration has expired",
          code: "IR_16",
        },
      },
    }),
    PaymentIntentWithSessionExpiry: getCustomExchange({
      Request: {
        currency: "USD",
        session_expiry: 60,
      },
      Response: {
        status: 200,
        body: {
          status: "requires_payment_method",
        },
      },
    }),
    SessionExpiredConfirmPayment: getCustomExchange({
      Request: {
        payment_method: "card",
        payment_method_data: {
          card: successfulNo3DSCardDetails,
        },
        customer_acceptance: null,
        setup_future_usage: "on_session",
      },
      Response: {
        status: 400,
        body: {
          error: {
            type: "invalid_request",
            message: "The provided client_secret has expired",
            code: "IR_08",
          },
        },
      },
    }),
    Capture: getCustomExchange({
      Request: {
        amount_to_capture: 6000,
      },
    }),
    PartialCapture: getCustomExchange({
      Request: {
        amount_to_capture: 2000,
      },
    }),
    MultipleCapture: getCustomExchange({
      Request: {
        amount_to_capture: 3000,
      },
    }),
    MultipleCapturePartial: getCustomExchange({
      Request: {
        amount_to_capture: 2000,
      },
    }),
    MultipleCaptureFinal: getCustomExchange({
      Request: {
        amount_to_capture: 2000,
      },
    }),
    MultipleCaptureRetrieve: getCustomExchange({}),
    MultipleCaptureOvercapture: getCustomExchange({
      Request: {
        amount_to_capture: 7000,
      },
    }),
    Void: getCustomExchange({
      Request: {},
      Response: {
        status: 200,
        body: {
          status: "cancelled",
          capture_method: "manual",
        },
      },
      ResponseCustom: {
        status: 400,
        body: {
          error: {
            type: "invalid_request",
            message:
              "You cannot cancel this payment because it has status succeeded",
            code: "IR_16",
          },
        },
      },
    }),
    VoidAfterConfirm: getCustomExchange({
      Request: {},
      Response: {
        status: 200,
        body: {
          status: "cancelled",
          capture_method: "manual",
        },
      },
      ResponseCustom: {
        status: 400,
        body: {
          error: {
            type: "invalid_request",
            message:
              "You cannot cancel this payment because it has status succeeded",
            code: "IR_16",
          },
        },
      },
    }),
    Refund: getCustomExchange({
      Request: {
        amount: 6000,
      },
    }),
    manualPaymentRefund: getCustomExchange({
      Request: {
        amount: 6000,
      },
      Response: {
        status: 200,
        body: {
          status: "pending",
        },
      },
    }),
    manualPaymentPartialRefund: getCustomExchange({
      Request: {
        amount: 2000,
      },
      Response: {
        status: 200,
        body: {
          status: "pending",
        },
      },
    }),
    ManualRefundUpdate: getCustomExchange({
      Request: {
        status: "succeeded",
      },
      Response: {
        status: 200,
        body: {},
      },
    }),
    ManualRefundUpdateErrorCode: getCustomExchange({
      Request: {
        status: "succeeded",
        error_code: {
          set: "TEST_ERROR_CODE",
        },
        error_message: {
          set: "Test error message for manual update",
        },
      },
      Response: {
        status: 200,
        body: {},
      },
    }),
    ManualRefundUpdatePartialRefund: getCustomExchange({
      Request: {
        status: "succeeded",
      },
      Response: {
        status: 200,
        body: {},
      },
    }),
    ManualRefundUpdateIdempotency: getCustomExchange({
      Request: {
        status: "succeeded",
        error_code: {
          set: "IDEMPOTENCY_TEST",
        },
        error_message: {
          set: "First manual update for idempotency test",
        },
      },
      Response: {
        status: 200,
        body: {},
      },
    }),
    ManualRefundUpdateUnset: getCustomExchange({
      Request: {
        error_code: {
          unset: null,
        },
        error_message: {
          unset: null,
        },
      },
      Response: {
        status: 200,
        body: {},
      },
    }),
    ManualRefundUpdateConnectorRefundId: getCustomExchange({
      Request: {
        connector_refund_id: "updated_refund_id",
      },
      Response: {
        status: 200,
        body: {},
      },
    }),
    ManualRefundUpdateConnectorRefundIdWithStatus: getCustomExchange({
      Request: {
        connector_refund_id: "combined_refund_id",
        status: "succeeded",
      },
      Response: {
        status: 200,
        body: {},
      },
    }),
    SyncRefundManualUpdateSucceeded: getCustomExchange({
      Response: {
        status: 200,
        body: {
          status: "succeeded",
        },
      },
    }),
    SyncRefundManualUpdateErrorCode: getCustomExchange({
      Response: {
        status: 200,
        body: {
          status: "succeeded",
          error_code: "TEST_ERROR_CODE",
          error_message: "Test error message for manual update",
        },
      },
    }),
    SyncRefundManualUpdatePartialRefund: getCustomExchange({
      Response: {
        status: 200,
        body: {
          status: "succeeded",
        },
      },
    }),
    SyncRefundManualUpdateIdempotency: getCustomExchange({
      Response: {
        status: 200,
        body: {
          status: "succeeded",
          error_code: "IDEMPOTENCY_TEST",
          error_message: "First manual update for idempotency test",
        },
      },
    }),
    SyncRefundManualUpdateUnset: getCustomExchange({
      Response: {
        status: 200,
        body: {
          status: "succeeded",
          error_code: null,
          error_message: null,
        },
      },
    }),
    SyncRefundManualUpdateConnectorRefundId: getCustomExchange({
      Response: {
        status: 200,
        body: {
          connector_refund_id: "updated_refund_id",
        },
      },
    }),
    SyncRefundManualUpdateConnectorRefundIdWithStatus: getCustomExchange({
      Response: {
        status: 200,
        body: {
          connector_refund_id: "combined_refund_id",
          status: "succeeded",
        },
      },
    }),
    PartialRefund: getCustomExchange({
      Request: {
        amount: 2000,
      },
    }),
    SyncRefund: getCustomExchange({}),
    SyncRefundScheduled: getCustomExchange({}),
    RefundInstant: getCustomExchange({
      Request: {
        amount: 6000,
        refund_type: "instant",
      },
      Response: {
        status: 200,
        body: {
          status: "succeeded",
        },
      },
    }),
    RefundScheduled: getCustomExchange({
      Request: {
        amount: 6000,
        refund_type: "scheduled",
      },
      Response: {
        status: 200,
        body: {
          status: "pending",
        },
      },
    }),
    PartialAuth: getCustomExchange({
      Request: {
        enable_partial_authorization: true,
      },
      Response: {
        status: 200,
        body: {
          status: "succeeded",
        },
      },
    }),
    MandateSingleUse3DSAutoCapture: getCustomExchange({
      Request: {
        payment_method: "card",
        payment_method_data: {
          card: successfulThreeDSTestCardDetails,
        },
        currency: "USD",
        mandate_data: singleUseMandateData,
      },
    }),
    MandateSingleUse3DSManualCapture: getCustomExchange({
      Request: {
        payment_method: "card",
        payment_method_data: {
          card: successfulThreeDSTestCardDetails,
        },
        currency: "USD",
        mandate_data: singleUseMandateData,
      },
    }),
    MandateSingleUseNo3DSAutoCapture: getCustomExchange({
      Request: {
        amount: 6000,
        payment_method: "card",
        payment_method_data: {
          card: successfulNo3DSCardDetails,
        },
        currency: "USD",
        mandate_data: singleUseMandateData,
      },
    }),
    MandateSingleUseNo3DSManualCapture: getCustomExchange({
      Request: {
        amount: 6000,
        payment_method: "card",
        payment_method_data: {
          card: successfulNo3DSCardDetails,
        },
        currency: "USD",
        mandate_data: singleUseMandateData,
      },
    }),
    MandateMultiUseNo3DSAutoCapture: getCustomExchange({
      Request: {
        amount: 6000,
        payment_method: "card",
        payment_method_data: {
          card: successfulNo3DSCardDetails,
        },
        currency: "USD",
        mandate_data: multiUseMandateData,
      },
    }),
    MandateMultiUseNo3DSManualCapture: getCustomExchange({
      Request: {
        amount: 6000,
        payment_method: "card",
        payment_method_data: {
          card: successfulNo3DSCardDetails,
        },
        currency: "USD",
        mandate_data: multiUseMandateData,
      },
    }),
    MandateMultiUse3DSAutoCapture: getCustomExchange({
      Request: {
        payment_method: "card",
        payment_method_data: {
          card: successfulThreeDSTestCardDetails,
        },
        currency: "USD",
        mandate_data: multiUseMandateData,
      },
    }),
    MandateMultiUse3DSManualCapture: getCustomExchange({
      Request: {
        payment_method: "card",
        payment_method_data: {
          card: successfulThreeDSTestCardDetails,
        },
        currency: "USD",
        mandate_data: multiUseMandateData,
      },
    }),
    ZeroAuthMandate: getCustomExchange({
      Request: {
        amount: 0,
        payment_method: "card",
        payment_method_data: {
          card: successfulNo3DSCardDetails,
        },
        currency: "USD",
        mandate_data: singleUseMandateData,
      },
    }),
    ZeroAuthPaymentIntent: getCustomExchange({
      Request: {
        amount: 0,
        setup_future_usage: "off_session",
        currency: "USD",
        payment_type: "setup_mandate",
      },
    }),
    ZeroAuthConfirmPayment: getCustomExchange({
      Request: {
        amount: 0,
        payment_type: "setup_mandate",
        payment_method: "card",
        payment_method_data: {
          card: successfulNo3DSCardDetails,
        },
        mandate_data: null,
        customer_acceptance: customerAcceptance,
      },
    }),
    ZeroAuthConfirmPaymentManual: getCustomExchange({
      Request: {
        amount: 0,
        payment_type: "setup_mandate",
        payment_method: "card",
        payment_method_data: {
          card: successfulNo3DSCardDetails,
        },
        mandate_data: null,
        customer_acceptance: customerAcceptance,
      },
    }),
    SaveCardUseNo3DSAutoCapture: getCustomExchange({
      Request: {
        payment_method: "card",
        payment_method_data: {
          card: successfulNo3DSCardDetails,
        },
        currency: "USD",
        setup_future_usage: "on_session",
        customer_acceptance: customerAcceptance,
      },
    }),
    SaveCardUseNo3DSAutoCaptureOffSession: getCustomExchange({
      Request: {
        payment_method: "card",
        payment_method_data: {
          card: successfulNo3DSCardDetails,
        },
        setup_future_usage: "off_session",
        customer_acceptance: customerAcceptance,
      },
    }),
    SaveCardUse3DSAutoCaptureOffSession: getCustomExchange({
      Request: {
        payment_method: "card",
        payment_method_data: {
          card: successfulThreeDSTestCardDetails,
        },
        setup_future_usage: "off_session",
        customer_acceptance: customerAcceptance,
      },
    }),
    SaveCardUseNo3DSManualCaptureOffSession: getCustomExchange({
      Request: {
        payment_method: "card",
        payment_method_data: {
          card: successfulNo3DSCardDetails,
        },
        setup_future_usage: "off_session",
        customer_acceptance: customerAcceptance,
      },
    }),
    SaveCardConfirmAutoCaptureOffSession: getCustomExchange({
      Request: {
        setup_future_usage: "off_session",
      },
      ResponseCustom: {
        status: 400,
        body: {
          error: {
            message:
              "No eligible connector was found for the current payment method configuration",
            type: "invalid_request",
          },
        },
      },
    }),
    SaveCardConfirmManualCaptureOffSession: getCustomExchange({
      Request: {
        setup_future_usage: "off_session",
      },
    }),
    SaveCardConfirmAutoCaptureOffSessionWithoutBilling: {
      Request: {
        setup_future_usage: "off_session",
        billing: null,
      },
      Response: {
        status: 200,
        body: {
          status: "succeeded",
          billing: null,
        },
      },
    },
    SaveCardUseNo3DSManualCapture: getCustomExchange({
      Request: {
        payment_method: "card",
        payment_method_data: {
          card: successfulNo3DSCardDetails,
        },
        currency: "USD",
        setup_future_usage: "on_session",
        customer_acceptance: customerAcceptance,
      },
    }),
    PaymentMethod: {
      Request: {
        payment_method: "card",
        payment_method_type: "credit",
        payment_method_issuer: "Gpay",
        payment_method_issuer_code: "jp_hdfc",
        card: PaymentMethodCardDetails,
      },
      Response: {
        status: 200,
        body: {},
      },
    },
    PaymentMethodIdMandateNo3DSAutoCapture: getCustomExchange({
      Request: {
        amount: 6000,
        payment_method: "card",
        payment_method_data: {
          card: successfulNo3DSCardDetails,
        },
        currency: "USD",
        mandate_data: null,
        customer_acceptance: customerAcceptance,
      },
    }),
    PaymentMethodIdMandateNo3DSManualCapture: getCustomExchange({
      Request: {
        amount: 6000,
        payment_method: "card",
        payment_method_data: {
          card: successfulNo3DSCardDetails,
        },
        currency: "USD",
        mandate_data: null,
        customer_acceptance: customerAcceptance,
      },
    }),
    PaymentMethodIdMandate3DSAutoCapture: getCustomExchange({
      Request: {
        amount: 6000,
        payment_method: "card",
        payment_method_data: {
          card: successfulThreeDSTestCardDetails,
        },
        currency: "USD",
        mandate_data: null,
        authentication_type: "three_ds",
        customer_acceptance: customerAcceptance,
      },
    }),
    PaymentMethodIdMandate3DSManualCapture: getCustomExchange({
      Request: {
        amount: 6000,
        payment_method: "card",
        payment_method_data: {
          card: successfulThreeDSTestCardDetails,
        },
        mandate_data: null,
        authentication_type: "three_ds",
        customer_acceptance: customerAcceptance,
      },
    }),
    InvalidCardNumber: {
      Request: {
        currency: "USD",
        payment_method: "card",
        payment_method_type: "debit",
        setup_future_usage: "on_session",
        payment_method_data: {
          card: {
            card_number: "123456",
            card_exp_month: "10",
            card_exp_year: "25",
            card_holder_name: "joseph Doe",
            card_cvc: "123",
          },
        },
      },
      Response: {
        status: 400,
        body: {
          error: {
            error_type: "invalid_request",
            message: "Json deserialize error: invalid card number length",
            code: "IR_06",
          },
        },
      },
    },
    InvalidExpiryMonth: {
      Request: {
        currency: "USD",
        payment_method: "card",
        payment_method_type: "debit",
        setup_future_usage: "on_session",
        payment_method_data: {
          card: {
            card_number: "4242424242424242",
            card_exp_month: "00",
            card_exp_year: "2023",
            card_holder_name: "joseph Doe",
            card_cvc: "123",
          },
        },
      },
      Response: {
        status: 400,
        body: {
          error: {
            type: "invalid_request",
            message: "Invalid Expiry Month",
            code: "IR_16",
          },
        },
      },
    },
    InvalidExpiryYear: {
      Request: {
        currency: "USD",
        payment_method: "card",
        payment_method_type: "debit",
        setup_future_usage: "on_session",
        payment_method_data: {
          card: {
            card_number: "4242424242424242",
            card_exp_month: "01",
            card_exp_year: "2023",
            card_holder_name: "joseph Doe",
            card_cvc: "123",
          },
        },
      },
      Response: {
        status: 400,
        body: {
          error: {
            type: "invalid_request",
            message: "Invalid Expiry Year",
            code: "IR_16",
          },
        },
      },
    },
    InvalidCardCvv: {
      Request: {
        currency: "USD",
        payment_method: "card",
        payment_method_type: "debit",
        setup_future_usage: "on_session",
        payment_method_data: {
          card: {
            card_number: "4242424242424242",
            card_exp_month: "01",
            card_exp_year: "2023",
            card_holder_name: "joseph Doe",
            card_cvc: "123456",
          },
        },
      },
      Response: {
        status: 400,
        body: {
          error: {
            type: "invalid_request",
            message: "Invalid card_cvc length",
            code: "IR_16",
          },
        },
      },
    },
    InvalidCurrency: {
      Request: {
        currency: "United",
        payment_method: "card",
        payment_method_type: "debit",
        setup_future_usage: "on_session",
        payment_method_data: {
          card: {
            card_number: "4242424242424242",
            card_exp_month: "01",
            card_exp_year: "2023",
            card_holder_name: "joseph Doe",
            card_cvc: "123456",
          },
        },
      },
      Response: {
        status: 400,
        body: {
          error: {
            error_type: "invalid_request",
            message:
              "Json deserialize error: unknown variant `United`, expected one of `AED`, `AFN`, `ALL`, `AMD`, `ANG`, `AOA`, `ARS`, `AUD`, `AWG`, `AZN`, `BAM`, `BBD`, `BDT`, `BGN`, `BHD`, `BIF`, `BMD`, `BND`, `BOB`, `BRL`, `BSD`, `BTN`, `BWP`, `BYN`, `BZD`, `CAD`, `CDF`, `CHF`, `CLF`, `CLP`, `CNY`, `COP`, `CRC`, `CUC`, `CUP`, `CVE`, `CZK`, `DJF`, `DKK`, `DOP`, `DZD`, `EGP`, `ERN`, `ETB`, `EUR`, `FJD`, `FKP`, `GBP`, `GEL`, `GHS`, `GIP`, `GMD`, `GNF`, `GTQ`, `GYD`, `HKD`, `HNL`, `HRK`, `HTG`, `HUF`, `IDR`, `ILS`, `INR`, `IQD`, `IRR`, `ISK`, `JMD`, `JOD`, `JPY`, `KES`, `KGS`, `KHR`, `KMF`, `KPW`, `KRW`, `KWD`, `KYD`, `KZT`, `LAK`, `LBP`, `LKR`, `LRD`, `LSL`, `LYD`, `MAD`, `MDL`, `MGA`, `MKD`, `MMK`, `MNT`, `MOP`, `MRU`, `MUR`, `MVR`, `MWK`, `MXN`, `MYR`, `MZN`, `NAD`, `NGN`, `NIO`, `NOK`, `NPR`, `NZD`, `OMR`, `PAB`, `PEN`, `PGK`, `PHP`, `PKR`, `PLN`, `PYG`, `QAR`, `RON`, `RSD`, `RUB`, `RWF`, `SAR`, `SBD`, `SCR`, `SDG`, `SEK`, `SGD`, `SHP`, `SLE`, `SLL`, `SOS`, `SRD`, `SSP`, `STD`, `STN`, `SVC`, `SYP`, `SZL`, `THB`, `TJS`, `TMT`, `TND`, `TOP`, `TRY`, `TTD`, `TWD`, `TZS`, `UAH`, `UGX`, `USD`, `UYU`, `UZS`, `VES`, `VND`, `VUV`, `WST`, `XAF`, `XCD`, `XOF`, `XPF`, `YER`, `ZAR`, `ZMW`, `ZWL`",
            code: "IR_06",
          },
        },
      },
    },
    InvalidCaptureMethod: {
      Request: {
        currency: "USD",
        capture_method: "auto",
        payment_method: "card",
        payment_method_type: "debit",
        setup_future_usage: "on_session",
        payment_method_data: {
          card: {
            card_number: "4242424242424242",
            card_exp_month: "01",
            card_exp_year: "2023",
            card_holder_name: "joseph Doe",
            card_cvc: "123456",
          },
        },
      },
      Response: {
        status: 400,
        body: {
          error: {
            error_type: "invalid_request",
            message:
              "Json deserialize error: unknown variant `auto`, expected one of `automatic`, `manual`, `manual_multiple`, `scheduled`",
            code: "IR_06",
          },
        },
      },
    },
    InvalidPaymentMethod: {
      Request: {
        currency: "USD",
        payment_method: "this_supposed_to_be_a_card",
        payment_method_type: "debit",
        setup_future_usage: "on_session",
        payment_method_data: {
          card: {
            card_number: "4242424242424242",
            card_exp_month: "01",
            card_exp_year: "2023",
            card_holder_name: "joseph Doe",
            card_cvc: "123456",
          },
        },
      },
      Response: {
        status: 400,
        body: {
          error: {
            error_type: "invalid_request",
            message:
              "Json deserialize error: unknown variant `this_supposed_to_be_a_card`, expected one of `card`, `card_redirect`, `pay_later`, `wallet`, `bank_redirect`, `bank_transfer`, `crypto`, `bank_debit`, `reward`, `real_time_payment`, `upi`, `voucher`, `gift_card`, `open_banking`, `mobile_payment`",
            code: "IR_06",
          },
        },
      },
    },
    InvalidAmountToCapture: {
      Request: {
        currency: "USD",
        amount_to_capture: 10000,
        payment_method: "card",
        payment_method_type: "debit",
        setup_future_usage: "on_session",
        payment_method_data: {
          card: {
            card_number: "4242424242424242",
            card_exp_month: "01",
            card_exp_year: "2030",
            card_holder_name: "joseph Doe",
            card_cvc: "123",
          },
        },
      },
      Response: {
        status: 400,
        body: {
          error: {
            type: "invalid_request",
            message:
              "amount_to_capture contains invalid data. Expected format is amount_to_capture lesser than amount",
            code: "IR_05",
          },
        },
      },
    },
    MissingRequiredParam: {
      Request: {
        currency: "USD",
        payment_method_type: "debit",
        setup_future_usage: "on_session",
        payment_method_data: {
          card: {
            card_number: "4242424242424242",
            card_exp_month: "01",
            card_exp_year: "2030",
            card_holder_name: "joseph Doe",
            card_cvc: "123",
          },
        },
      },
      Response: {
        status: 400,
        body: {
          error: {
            type: "invalid_request",
            message: "Missing required param: payment_method",
            code: "IR_04",
          },
        },
      },
    },
    PaymentIntentErrored: {
      Request: {
        currency: "USD",
      },
      Response: {
        status: 422,
        body: {
          error: {
            type: "invalid_request",
            message:
              "A payment token or payment method data or ctp service details is required",
            code: "IR_06",
          },
        },
      },
    },
    CaptureGreaterAmount: {
      Request: {
        amount_to_capture: 6000000,
      },
      Response: {
        status: 400,
        body: {
          error: {
            type: "invalid_request",
            message: "amount_to_capture is greater than amount",
            code: "IR_06",
          },
        },
      },
    },
    CaptureCapturedAmount: getCustomExchange({
      Request: {
        Request: {
          amount_to_capture: 6000,
        },
      },
      Response: {
        status: 400,
        body: {
          error: {
            type: "invalid_request",
            message:
              "This Payment could not be captured because it has a payment.status of succeeded. The expected state is requires_capture, partially_captured_and_capturable, processing",
            code: "IR_14",
          },
        },
      },
    }),
    ConfirmSuccessfulPayment: getCustomExchange({
      Request: {
        payment_method: "card",
        payment_method_data: {
          card: successfulNo3DSCardDetails,
        },
        currency: "USD",
        customer_acceptance: null,
      },
      Response: {
        status: 400,
        body: {
          error: {
            type: "invalid_request",
            message:
              "You cannot confirm this payment because it has status succeeded",
            code: "IR_16",
          },
        },
      },
    }),
    RefundGreaterAmount: {
      Request: {
        amount: 6000000,
      },
      Response: {
        status: 400,
        body: {
          error: {
            type: "invalid_request",
            message: "The refund amount exceeds the amount captured",
            code: "IR_13",
          },
        },
      },
    },
    MITAutoCapture: getCustomExchange({
      Request: { amount: 6000 },
      Response: {
        status: 200,
        body: {
          status: "succeeded",
        },
      },
      ResponseCustom: {
        status: 400,
        body: {
          error: {
            message:
              "No eligible connector was found for the current payment method configuration",
            type: "invalid_request",
          },
        },
      },
    }),
    MITWithoutBillingAddress: getCustomExchange({
      Request: {
        amount: 6000,
        billing: null,
      },
      Response: {
        status: 200,
        body: {
          status: "succeeded",
        },
      },
    }),
    MITAutoCaptureWithCustomerAcceptance: getCustomExchange({
      Request: {
        amount: 6000,
        customer_acceptance: {
          acceptance_type: "offline",
          accepted_at: "1963-05-03T04:07:52.723Z",
          online: {
            ip_address: "127.0.0.1",
            user_agent: "amet irure esse",
          },
        },
      },
      Response: {
        status: 200,
        body: {
          status: "succeeded",
        },
      },
      ResponseCustom: {
        status: 400,
        body: {
          error: {
            message:
              "No eligible connector was found for the current payment method configuration",
            type: "invalid_request",
          },
        },
      },
    }),
    MITWithLimitedCardData: getCustomExchange({
      Request: {},
      Response: {
        status: 200,
        body: {
          status: "succeeded",
        },
      },
    }),
    // MIT whose amount exceeds the single use mandate amount, used to assert
    // the mandate validation failure response
    MITExceedingMandateAmount: getCustomExchange({
      Request: {
        amount: 60000,
      },
      Response: {
        status: 200,
        body: {
          status: "succeeded",
        },
      },
    }),
    PartnerMerchantIdentifier: getCustomExchange({
      Request: {
        currency: "USD",
        customer_acceptance: null,
        setup_future_usage: "on_session",
        billing: {
          address: {
            line1: "1467",
            line2: "Harrison Street",
            line3: "Harrison Street",
            city: "San Francisco",
            state: "California",
            zip: "94122",
            country: "US",
            first_name: "joseph",
            last_name: "Doe",
          },
        },
        partner_merchant_identifier_details: {
          partner_details: {
            name: "TestPartner",
            version: "1.0.0",
            integrator: "TestIntegrator123",
          },
          merchant_details: {
            name: "TestMerchantApp",
            version: "2.0.0",
          },
        },
      },
      Response: {
        status: 200,
        body: {
          status: "requires_payment_method",
        },
      },
    }),
    PaymentWithoutBilling: {
      Request: {
        currency: "USD",
        customer_acceptance: null,
        setup_future_usage: "on_session",
        authentication_type: "no_three_ds",
      },
      Response: {
        status: 200,
        body: {
          status: "requires_payment_method",
        },
      },
    },
    PaymentWithBilling: {
      Request: {
        currency: "USD",
        setup_future_usage: "on_session",
        billing: {
          address: {
            line1: "1467",
            line2: "CA",
            line3: "Harrison Street",
            city: "San Fransico",
            state: "CA",
            zip: "94122",
            country: "US",
            first_name: "joseph",
            last_name: "Doe",
          },
          phone: {
            number: "9111222333",
            country_code: "+91",
          },
        },
        email: "[email protected]",
      },
      Response: {
        status: 200,
        body: {
          status: "requires_payment_method",
        },
      },
    },
    PaymentWithFullName: {
      Request: {
        currency: "USD",
        setup_future_usage: "on_session",
        billing: {
          address: {
            first_name: "joseph",
            last_name: "Doe",
          },
          phone: {
            number: "9111222333",
            country_code: "+91",
          },
        },
      },
      Response: {
        status: 200,
        body: {
          status: "requires_payment_method",
        },
      },
    },
    PaymentWithBillingEmail: {
      Request: {
        currency: "USD",
        setup_future_usage: "on_session",
        email: "[email protected]",
        billing: {
          address: {
            first_name: "joseph",
            last_name: "Doe",
          },
          phone: {
            number: "9111222333",
            country_code: "+91",
          },
          email: "[email protected]",
        },
      },
      Response: {
        status: 200,
        body: {
          status: "requires_payment_method",
        },
      },
    },
    DuplicatePaymentID: {
      Request: {
        payment_method: "card",
        payment_method_data: {
          card: successfulNo3DSCardDetails,
        },
        currency: "USD",
        customer_acceptance: null,
        setup_future_usage: "on_session",
      },
      Response: {
        status: 400,
        body: {
          error: {
            type: "invalid_request",
            message:
              "The payment with the specified payment_id already exists in our records",
            code: "HE_01",
          },
        },
      },
    },
    DuplicateRefundID: {
      Request: {
        amount: 2000,
      },
      Response: {
        status: 400,
        body: {
          error: {
            type: "invalid_request",
            message:
              "Duplicate refund request. Refund already attempted with the refund ID",
            code: "HE_01",
          },
        },
      },
    },
    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",
        payment_method_type: "debit",
        payment_method_data: {
          card: successfulThreeDSTestCardDetails,
        },
        currency: "USD",
        customer_acceptance: null,
        setup_future_usage: "on_session",
      },
      Response: {
        status: 200,
        body: {
          status: "requires_customer_action",
        },
      },
      DDCConfig: {
        collectionReferenceParam: "collectionReference",
        firstSubmissionValue: "",
        secondSubmissionValue: "race_condition_test_ddc_123",
      },
    }),
    DDCRaceConditionClientSide: getCustomExchange({
      Request: {
        payment_method: "card",
        payment_method_type: "debit",
        payment_method_data: {
          card: successfulThreeDSTestCardDetails,
        },
        currency: "USD",
        customer_acceptance: null,
        setup_future_usage: "on_session",
      },
      Response: {
        status: 200,
        body: {
          status: "requires_customer_action",
        },
      },
      DDCConfig: {
        collectionReferenceParam: "collectionReference",
        delayBeforeSubmission: 2000,
        raceConditionScript: `
          <script>
            console.log("INJECTING_RACE_CONDITION_TEST");
            
            // Track submission attempts and ddcProcessed flag behavior
            window.testResults = {
              submissionAttempts: 0,
              actualSubmissions: 0,
              blockedSubmissions: 0
            };
            
            // Override the submitCollectionReference function to test race conditions
            var originalSubmit = window.submitCollectionReference;
            
            window.submitCollectionReference = function(collectionReference) {
              window.testResults.submissionAttempts++;
              console.log("SUBMISSION_ATTEMPT_" + window.testResults.submissionAttempts + ": " + collectionReference);
              
              // Check if ddcProcessed flag would block this
              if (window.ddcProcessed) {
                window.testResults.blockedSubmissions++;
                console.log("SUBMISSION_BLOCKED_BY_DDC_PROCESSED_FLAG");
                return;
              }
              
              window.testResults.actualSubmissions++;
              console.log("SUBMISSION_PROCEEDING: " + collectionReference);
              
              if (originalSubmit) {
                return originalSubmit(collectionReference);
              }
            };
            
            // Submit first value at configured timing
            setTimeout(function() {
              console.log("FIRST_SUBMISSION_TRIGGERED_AT_100MS");
              window.submitCollectionReference("");
            }, 100);
            
            // Submit second value at configured timing (should be blocked)
            setTimeout(function() {
              console.log("SECOND_SUBMISSION_ATTEMPTED_AT_200MS");
              window.submitCollectionReference("test_ddc_123");
            }, 200);
          </script>
        `,
      },
    }),
    PaymentIntentWithInstallments: getCustomExchange({
      Request: {
        currency: "BRL",
        installment_options: [
          {
            payment_method: "card",
            installments: [
              {
                number_of_installments: [3, 6, 12],
                billing_frequency: "month",
                interest_rate: 5.0,
              },
            ],
          },
        ],
      },
      Response: {
        status: 200,
        body: {
          status: "requires_payment_method",
        },
      },
    }),
    CardInstallmentConfirm: getCustomExchange({
      Request: {
        payment_method: "card",
        payment_method_type: "credit",
        payment_method_data: {
          card: successfulNo3DSCardDetails,
        },
        installment_data: {
          number_of_installments: 3,
          billing_frequency: "month",
        },
      },
      Response: {
        status: 200,
        body: {
          status: "succeeded",
        },
      },
    }),
    PaymentIntentWithInstallmentsAndConfirmTrue: getCustomExchange({
      Request: {
        currency: "BRL",
        confirm: true,
        installment_options: [
          {
            payment_method: "card",
            installments: [
              {
                number_of_installments: [3, 6, 12],
                billing_frequency: "month",
                interest_rate: 5.0,
              },
            ],
          },
        ],
      },
      Response: {
        status: 422,
        body: {
          error: {
            type: "invalid_request",
            message:
              "installment_options and installment_data are not supported when confirm is true.",
            code: "IR_06",
          },
        },
      },
    }),
    external_three_ds: getCustomExchange({
      Request: {
        payment_method: "card",
        payment_method_data: {
          card: successfulNo3DSCardDetails,
        },
        authentication_type: "three_ds",
        request_external_three_ds_authentication: true,
        three_ds_data: {
          authentication_cryptogram: {
            cavv: {
              authentication_cryptogram: "3q2+78r+ur7erb7vyv66vv////8=",
            },
          },
          ds_trans_id: "c4e59ceb-a382-4d6a-bc87-385d591fa09d",
          version: "2.1.0",
          eci: "05",
          transaction_status: "Y",
          exemption_indicator: "low_value",
        },
      },
    }),
    CardTestingGuard: {
      FailConfirm: getCustomExchange({
        Request: {
          payment_method: "card",
          payment_method_data: {
            card: successfulNo3DSCardDetails,
          },
          customer_acceptance: null,
          setup_future_usage: "on_session",
        },
        Response: {
          status: 200,
          body: {
            status: "failed",
          },
        },
      }),
      GuestFailConfirm: getCustomExchange({
        Request: {
          payment_method: "card",
          payment_method_data: {
            card: successfulNo3DSCardDetails,
          },
          customer_acceptance: null,
        },
        Response: {
          status: 200,
          expectBlockedPayment: true,
          body: {
            status: "failed",
          },
        },
      }),
      BlockedConfirm: getCustomExchange({
        Request: {
          payment_method: "card",
          payment_method_data: {
            card: successfulNo3DSCardDetails,
          },
          customer_acceptance: null,
          setup_future_usage: "on_session",
        },
        Response: {
          status: 400,
          body: {
            error: {
              type: "invalid_request",
              code: "IR_16",
              message: "Blocked due to suspicious activity",
            },
          },
        },
      }),
      GuestBlockedConfirm: getCustomExchange({
        Request: {
          payment_method: "card",
          payment_method_data: {
            card: successfulNo3DSCardDetails,
          },
          customer_acceptance: null,
        },
        Response: {
          status: 400,
          body: {
            error: {
              type: "invalid_request",
              code: "IR_16",
              message: "Blocked due to suspicious activity",
            },
          },
        },
      }),
    },
    L2L3Data: getCustomExchange({
      Request: {
        payment_method: "card",
        payment_method_data: {
          card: successfulNo3DSCardDetails,
        },
        metadata: {
          order_tax_amount: 500,
          shipping_cost: 100,
          order_po_number: "PO-12345",
        },
        customer_acceptance: null,
        setup_future_usage: "on_session",
      },
      Response: {
        status: 200,
        body: {
          status: "succeeded",
        },
      },
    }),
    UseBillingAsPaymentMethodBilling: getCustomExchange({
      Request: {
        payment_method: "card",
        payment_method_data: {
          card: successfulNo3DSCardDetails,
        },
        currency: "USD",
      },
    }),
    UseBillingAsPaymentMethodBillingDisabled: getCustomExchange({
      Request: {
        payment_method: "card",
        payment_method_data: {
          card: successfulNo3DSCardDetails,
        },
        currency: "USD",
      },
    }),
    ManualPaymentUpdate: getCustomExchange({
      Request: {
        attempt_status: "pending",
        error_code: "TEST_ERROR",
        error_message: "Manual test error message",
      },
      Response: {
        status: 200,
        body: {
          attempt_status: "pending",
        },
      },
    }),
    ManualPaymentUpdateStatusOnly: getCustomExchange({
      Request: {
        attempt_status: "pending",
      },
      Response: {
        status: 200,
        body: {
          attempt_status: "pending",
        },
      },
    }),
    ManualPaymentUpdateAmountCaptured: getCustomExchange({
      Configs: {
        skipBillingAssertion: true,
      },
      Request: {
        attempt_status: "charged",
        amount_captured: 2500,
      },
      Response: {
        status: 200,
        body: {
          attempt_status: "charged",
          amount_captured: 2500,
          amount_capturable: 6000,
        },
      },
    }),
    ManualPaymentUpdateAmountCapturedExceedsAmount: getCustomExchange({
      Request: {
        attempt_status: "charged",
        amount_captured: 6001,
      },
      Response: {
        status: 422,
        body: {
          error: {
            type: "invalid_request",
            message: "amount_captured should be less than or equal to amount",
            code: "IR_06",
          },
        },
      },
    }),
    ManualPaymentUpdateAmountCapturedBoundary: getCustomExchange({
      Configs: {
        skipBillingAssertion: true,
      },
      Request: {
        attempt_status: "charged",
        amount_captured: 6000,
      },
      Response: {
        status: 200,
        body: {
          attempt_status: "charged",
          amount_captured: 6000,
          amount_capturable: 6000,
        },
      },
    }),
    // Current-API-actual behaviour: zero amount_captured is accepted (200) —
    // no zero guard exists upstream (crates/router/src/core/payments.rs:14025-14032).
    ManualPaymentUpdateAmountCapturedZero: getCustomExchange({
      Configs: {
        skipBillingAssertion: true,
      },
      Request: {
        attempt_status: "charged",
        amount_captured: 0,
      },
      Response: {
        status: 200,
        body: {
          attempt_status: "charged",
          amount_captured: 0,
          amount_capturable: 6000,
        },
      },
    }),
    ManualPaymentUpdateAmountCapturedWithoutStatus: getCustomExchange({
      Configs: {
        skipBillingAssertion: true,
      },
      Request: {
        amount_captured: 2500,
      },
      Response: {
        status: 200,
        body: {
          attempt_status: "payment_method_awaited",
          amount_captured: 2500,
          amount_capturable: 6000,
        },
      },
    }),
    ManualPaymentUpdateAmountCapturedInvalidType: getCustomExchange({
      Request: {
        attempt_status: "charged",
        amount_captured: 25.5,
      },
      Response: {
        status: 400,
        body: {
          error: {
            error_type: "invalid_request",
            // The trailing " at line 1 column N" of the live message is
            // omitted — the column depends on the serialized request body,
            // and defaultErrorHandler matches deserialize errors by substring.
            message:
              "Json deserialize error: invalid type: floating point `25.5`, expected i64",
            code: "IR_06",
          },
        },
      },
    }),
    OrderDetails: getCustomExchange({
      Request: {
        payment_method: "card",
        payment_method_data: {
          card: successfulNo3DSCardDetails,
        },
        currency: "USD",
        order_details: [
          {
            product_name: "Test Product",
            quantity: 1,
            amount: 6000,
          },
        ],
      },
      Response: {
        status: 200,
        body: {
          status: "succeeded",
        },
      },
    }),
    OrderDetailsMultipleItems: getCustomExchange({
      Request: {
        payment_method: "card",
        payment_method_data: {
          card: successfulNo3DSCardDetails,
        },
        currency: "USD",
        order_details: [
          {
            product_name: "Test Product 1",
            quantity: 1,
            amount: 3000,
          },
          {
            product_name: "Test Product 2",
            quantity: 2,
            amount: 1500,
          },
        ],
      },
      Response: {
        status: 200,
        body: {
          status: "succeeded",
        },
      },
    }),
    OrderDetailsMissingProductName: getCustomExchange({
      Request: {
        payment_method: "card",
        payment_method_data: {
          card: successfulNo3DSCardDetails,
        },
        currency: "USD",
        order_details: [
          {
            quantity: 1,
            amount: 6000,
          },
        ],
      },
      Response: {
        status: 400,
        body: {
          error: {
            error_type: "invalid_request",
            code: "IR_06",
          },
        },
      },
    }),
    ClientSessionInvalidConfirm: getCustomExchange({
      Request: {
        payment_method: "card",
        payment_method_data: {
          card: successfulNo3DSCardDetails,
        },
        currency: "USD",
        customer_acceptance: null,
        setup_future_usage: "on_session",
      },
      Response: {
        status: 401,
        body: {
          error: {
            type: "invalid_request",
            message: "API key not provided or invalid API key used",
            code: "IR_01",
          },
        },
      },
    }),
    // WebhookConfig: webhook_username and webhook_password are masked
    // placeholders — not real credentials. They are safe to use in any
    // connector config as placeholder webhook auth data.
    WebhookConfig: {
      Create: getCustomExchange({
        Request: {
          webhook_details: {
            webhook_version: "1.0.2",
            webhook_username: "<WEBHOOK_USERNAME>",
            webhook_password: "<WEBHOOK_PASSWORD>",
            webhook_url: "https://example.com/webhook",
            payment_created_enabled: true,
            payment_succeeded_enabled: true,
            payment_failed_enabled: false,
            payment_statuses_enabled: ["succeeded", "failed"],
            refund_statuses_enabled: ["success", "failure"],
            payout_statuses_enabled: ["success", "failed"],
            dispute_statuses_enabled: ["dispute_opened", "dispute_won"],
            mandate_statuses_enabled: ["active"],
            invoice_statuses_enabled: ["invoice_paid"],
          },
        },
        Response: {
          status: 200,
          body: {
            webhook_details: {
              payment_failed_enabled: false,
              payment_statuses_enabled: ["succeeded", "failed"],
              refund_statuses_enabled: ["success", "failure"],
              payout_statuses_enabled: ["success", "failed"],
              dispute_statuses_enabled: ["dispute_opened", "dispute_won"],
              mandate_statuses_enabled: ["active"],
              invoice_statuses_enabled: ["invoice_paid"],
            },
          },
        },
      }),
      Update: getCustomExchange({
        Request: {
          webhook_details: {
            webhook_version: "1.0.2",
            webhook_username: "<WEBHOOK_USERNAME_UPDATED>",
            webhook_password: "<WEBHOOK_PASSWORD_UPDATED>",
            webhook_url: "https://example.com/webhook_updated",
            payment_created_enabled: true,
            payment_succeeded_enabled: true,
            payment_failed_enabled: true,
            payment_statuses_enabled: [
              "succeeded",
              "failed",
              "cancelled",
              "processing",
            ],
            refund_statuses_enabled: ["success", "failure"],
            payout_statuses_enabled: ["success", "failed", "initiated"],
            dispute_statuses_enabled: [
              "dispute_opened",
              "dispute_expired",
              "dispute_accepted",
              "dispute_cancelled",
              "dispute_challenged",
              "dispute_won",
              "dispute_lost",
            ],
            mandate_statuses_enabled: ["active", "revoked"],
            invoice_statuses_enabled: ["invoice_paid"],
          },
        },
        Response: {
          status: 200,
          body: {
            webhook_details: {
              payment_failed_enabled: true,
              payment_statuses_enabled: [
                "succeeded",
                "failed",
                "cancelled",
                "processing",
              ],
              refund_statuses_enabled: ["success", "failure"],
              payout_statuses_enabled: ["success", "failed", "initiated"],
              dispute_statuses_enabled: [
                "dispute_opened",
                "dispute_expired",
                "dispute_accepted",
                "dispute_cancelled",
                "dispute_challenged",
                "dispute_won",
                "dispute_lost",
              ],
              mandate_statuses_enabled: ["active", "revoked"],
              invoice_statuses_enabled: ["invoice_paid"],
            },
          },
        },
      }),
    },
    BlockImplicitCustomerCreationAllowed: getCustomExchange({
      Request: {
        currency: "EUR",
        amount: 6500,
        email: null,
      },
      Response: {
        status: 200,
        body: {
          status: "requires_payment_method",
        },
      },
    }),
    BlockImplicitCustomerCreationBlocked: getCustomExchange({
      Request: {
        currency: "EUR",
        amount: 6500,
        email: null,
      },
      Response: {
        status: 404,
        body: {
          error: {
            type: "invalid_request",
            code: "HE_02",
            message: "Customer does not exist in our records",
          },
        },
      },
    }),
    // Builds the same message validate_integration_type (server_integration.rs)
    // produces for a header/merchant-integration_type mismatch. Used by
    // integrationTypeChecker/paymentUpdate in commands.js, which
    // 54-IntegrationTypeValidation.cy.js calls into.
    IntegrationTypeValidation: (expectedStatus, header, merchantConfig) => ({
      Request: {
        currency: "USD",
        amount: 6540,
      },
      Response: {
        status: expectedStatus,
        body:
          expectedStatus === 200
            ? { status: "requires_payment_method" }
            : {
                error: {
                  code: "IR_06",
                  message: integrationTypeMismatchMessage(
                    header,
                    merchantConfig
                  ),
                },
              },
      },
    }),
  },
  upi_pm: {
    PaymentIntent: getCustomExchange({
      Request: {
        currency: "INR",
      },
      Response: {
        status: 200,
        body: {
          status: "requires_payment_method",
        },
      },
    }),
    UpiCollect: getCustomExchange({
      Request: {
        payment_method: "upi",
        payment_method_type: "upi_collect",
        payment_method_data: {
          upi: {
            upi_collect: {
              vpa_id: "successtest@iata",
            },
          },
        },
      },
    }),
    UpiIntent: getCustomExchange({
      Request: {
        payment_method: "upi",
        payment_method_type: "upi_intent",
        payment_method_data: {
          upi: {
            upi_intent: {},
          },
        },
      },
    }),
  },
  reward_pm: {
    PaymentIntentUSD: getCustomExchange({
      Request: {
        currency: "USD",
        amount: 6000,
        customer_acceptance: null,
        setup_future_usage: "on_session",
        billing: standardBillingAddress,
      },
      Response: {
        status: 200,
        body: {
          status: "requires_payment_method",
        },
      },
    }),
    PaymentIntentEUR: getCustomExchange({
      Request: {
        currency: "EUR",
        amount: 6000,
        customer_acceptance: null,
        setup_future_usage: "on_session",
        billing: standardBillingAddress,
      },
      Response: {
        status: 200,
        body: {
          status: "requires_payment_method",
        },
      },
    }),
    Evoucher: getCustomExchange({
      Request: {
        payment_method: "reward",
        payment_method_type: "evoucher",
        payment_method_data: "reward",
        billing: standardBillingAddress,
      },
    }),
    Classic: getCustomExchange({
      Request: {
        payment_method: "reward",
        payment_method_type: "classic",
        payment_method_data: "reward",
        billing: standardBillingAddress,
      },
    }),
  },
  crypto_pm: {
    PaymentIntent: getCustomExchange({
      Request: {
        currency: "USD",
        customer_acceptance: null,
        setup_future_usage: "on_session",
      },
      Response: {
        status: 200,
        body: {
          status: "requires_payment_method",
        },
      },
    }),
    CryptoCurrency: getCustomExchange({
      Request: {
        payment_method: "crypto",
        payment_method_type: "crypto_currency",
        payment_method_data: {
          crypto: {
            network: "bitcoin",
            pay_currency: "BTC",
          },
        },
        billing: standardBillingAddress,
      },
    }),
    CryptoCurrencyManualCapture: getCustomExchange({
      Request: {
        payment_method: "crypto",
        payment_method_type: "crypto_currency",
        payment_method_data: {
          crypto: {
            network: "bitcoin",
            pay_currency: "BTC",
          },
        },
        billing: standardBillingAddress,
      },
    }),
  },
  pm_list: {
    PmListResponse: {
      PmListNull: {
        payment_methods: [],
      },
      pmListDynamicFieldWithoutBilling: {
        payment_methods: [
          {
            payment_method: "card",
            payment_method_types: [
              {
                payment_method_type: "credit",
                card_networks: [],
                required_fields: {},
              },
            ],
          },
        ],
      },
      pmListDynamicFieldWithBilling: {
        payment_methods: [
          {
            payment_method: "card",
            payment_method_types: [
              {
                payment_method_type: "credit",
                card_networks: [],
                required_fields: {},
              },
            ],
          },
        ],
      },
      pmListDynamicFieldWithNames: {
        payment_methods: [
          {
            payment_method: "card",
            payment_method_types: [
              {
                payment_method_type: "credit",
                card_networks: [],
                required_fields: {},
              },
            ],
          },
        ],
      },
      pmListDynamicFieldWithEmail: {
        payment_methods: [
          {
            payment_method: "card",
            payment_method_types: [
              {
                payment_method_type: "credit",
                card_networks: [],
                required_fields: {},
              },
            ],
          },
        ],
      },
    },
  },
  return_url_variations: {
    return_url_too_long: getCustomExchange({
      Request: {
        customer_id: "customer_1234567890",
        return_url: "http://example.com/" + "a".repeat(2031),
      },
      Response: {
        status: 400,
        body: {
          error: {
            message:
              "return_url must be at most 2048 characters long. Received 2050 characters",
            code: "IR_06",
            type: "invalid_request",
          },
        },
      },
    }),
    return_url_invalid_format: getCustomExchange({
      Request: {
        return_url: "not_a_valid_url",
      },
      Response: {
        status: 400,
        body: {
          error: {
            message:
              'Json deserialize error: relative URL without a base: "not_a_valid_url" at line 1 column 357',
            code: "IR_06",
            error_type: "invalid_request",
          },
        },
      },
    }),
  },
  eligibility_api: {
    PaymentIntentForBlocklist: getCustomExchange({
      Request: {
        currency: "USD",
        amount: 6500,
        // 15 min: the spec reuses this intent across several Superposition
        // updates, longer than the 60s profile expiry left by earlier specs.
        session_expiry: 900,
      },
      Response: {
        status: 200,
        body: {
          status: "requires_payment_method",
        },
      },
    }),
    BlocklistedCardDenied: getCustomExchange({
      Request: {
        payment_method_type: "card",
        payment_method_data: {
          card: blocklistedCardDetails,
          billing: standardBillingAddress,
        },
      },
      Response: {
        status: 200,
        body: {
          sdk_next_action: {
            next_action: {
              deny: {
                message:
                  "We're unable to accept this card, please try another card or a different payment method",
              },
            },
          },
        },
      },
    }),
    NonBlocklistedCardAllowed: getCustomExchange({
      Request: {
        payment_method_type: "card",
        payment_method_data: {
          card: successfulNo3DSCardDetails,
          billing: standardBillingAddress,
        },
      },
      Response: {
        status: 200,
        body: {
          // Should not have deny action for non-blocklisted cards
        },
      },
    }),
  },
  offer_engine: {
    PaymentIntentForOffer: getCustomExchange({
      Request: {
        currency: "USD",
        amount: 100000,
      },
      Response: {
        status: 200,
        body: {
          status: "requires_payment_method",
        },
      },
    }),
    OfferEligibilityCheck: getCustomExchange({
      Request: {
        payment_method_type: "card",
        payment_method_data: {
          card: successfulNo3DSCardDetails,
          billing: standardBillingAddress,
        },
      },
      Response: {
        status: 200,
        body: {
          amount_details: {
            total_amount: 100000,
            net_amount: 98000,
            currency: "USD",
          },
          offer_details: {
            uplifted_offer_quote_ids: [""],
            eligible_offers: [
              {
                offer_amount: 2000,
                currency: "USD",
                code: "TESTHS",
              },
            ],
          },
        },
      },
    }),
    ConfirmWithOfferApplied: getCustomExchange({
      Request: {
        payment_method: "card",
        payment_method_data: {
          card: successfulNo3DSCardDetails,
          billing: standardBillingAddress,
        },
        offer_details: {
          offer_quote_ids: [OFFER_QUOTE_ID_PLACEHOLDER],
        },
      },
      Response: {
        status: 200,
        body: {
          status: "succeeded",
          amount: 100000,
          net_amount: 98000,
          amount_received: 98000,
          currency: "USD",
        },
      },
    }),
    AppliedOfferOnRetrieve: getCustomExchange({
      Request: {},
      Response: {
        status: 200,
        body: {
          status: "succeeded",
          net_amount: 98000,
          amount_received: 98000,
          applied_offer: {
            offer_amount: 2000,
            currency: "USD",
          },
        },
      },
    }),
    ConfirmWithoutOffer: getCustomExchange({
      Request: {
        payment_method: "card",
        payment_method_data: {
          card: successfulNo3DSCardDetails,
          billing: standardBillingAddress,
        },
      },
      Response: {
        status: 200,
        body: {
          status: "succeeded",
          amount: 100000,
          net_amount: 100000,
          amount_received: 100000,
          currency: "USD",
          applied_offer: null,
        },
      },
    }),
    // PR #13850: a saved-card confirm carries only payment_token + card_token
    // (CVC), not the PAN. Verifies /apply still resolves card_bin/network
    // correctly at confirm time for a repeat customer, instead of sending
    // them null (the bug this PR fixed). Card is saved via the existing
    // card_pm.SaveCardUseNo3DSAutoCapture fixture; the eligibility/confirm/
    // retrieve expectations for this flow are identical to the plain-card
    // case above (OfferEligibilityCheck/ConfirmWithOfferApplied/
    // AppliedOfferOnRetrieve), reused directly rather than duplicated here —
    // saveCardConfirmCallTest already strips payment_method_data out of
    // whatever confirm fixture it's given.
    // PR #13766: once a card has availed an offer, Offer Engine blocks that
    // same card (via card_alias, a PAN-free fingerprint) from availing it
    // again, independent of the customer.
    VelocityEligibilityCheckSecondUse: getCustomExchange({
      Request: {
        payment_method_type: "card",
        payment_method_data: {
          card: successfulNo3DSCardDetails,
          billing: standardBillingAddress,
        },
      },
      Response: {
        status: 200,
        body: {
          amount_details: {
            total_amount: 100000,
            net_amount: 100000,
            currency: "USD",
          },
        },
      },
    }),
  },
  auth_service_eligibility: {
    OrgEnabledMerchantEnabled: getCustomExchange({
      Request: {
        payment_method: "card",
        payment_method_data: {
          card: successfulThreeDSTestCardDetails,
        },
        currency: "USD",
        amount: 6500,
      },
      Response: {
        status: 200,
        body: {
          status: "requires_customer_action",
          authentication_type: "three_ds",
        },
      },
    }),
    OrgEnabledMerchantDisabled: getCustomExchange({
      Request: {
        payment_method: "card",
        payment_method_data: {
          card: successfulThreeDSTestCardDetails,
        },
        currency: "USD",
        amount: 6500,
      },
      Response: {
        status: 200,
        body: {
          status: "requires_customer_action",
          authentication_type: "three_ds",
        },
      },
    }),
    OrgDisabledMerchantEnabled: getCustomExchange({
      Request: {
        payment_method: "card",
        payment_method_data: {
          card: successfulNo3DSCardDetails,
        },
        currency: "USD",
        amount: 6500,
      },
      Response: {
        status: 200,
        body: {
          status: "succeeded",
          authentication_type: "no_three_ds",
        },
      },
    }),
    OrgDisabledMerchantDisabled: getCustomExchange({
      Request: {
        payment_method: "card",
        payment_method_data: {
          card: successfulNo3DSCardDetails,
        },
        currency: "USD",
        amount: 6500,
      },
      Response: {
        status: 200,
        body: {
          status: "succeeded",
          authentication_type: "no_three_ds",
        },
      },
    }),
    MerchantOnlyEnabled: getCustomExchange({
      Request: {
        payment_method: "card",
        payment_method_data: {
          card: successfulThreeDSTestCardDetails,
        },
        currency: "USD",
        amount: 6500,
      },
      Response: {
        status: 200,
        body: {
          status: "requires_customer_action",
          authentication_type: "three_ds",
        },
      },
    }),
    MerchantOnlyDisabled: getCustomExchange({
      Request: {
        payment_method: "card",
        payment_method_data: {
          card: successfulNo3DSCardDetails,
        },
        currency: "USD",
        amount: 6500,
      },
      Response: {
        status: 200,
        body: {
          status: "succeeded",
          authentication_type: "no_three_ds",
        },
      },
    }),
    NoConfigDefault: getCustomExchange({
      Request: {
        payment_method: "card",
        payment_method_data: {
          card: successfulThreeDSTestCardDetails,
        },
        currency: "USD",
        amount: 6500,
      },
      Response: {
        status: 200,
        body: {
          status: "requires_customer_action",
          authentication_type: "three_ds",
        },
      },
    }),
    // Storage flag does not affect authentication outcome — both enabled and
    // disabled flows produce the same 3DS challenge. Distinction is only
    // observable via Redis, which cannot be asserted through the API layer.
    EligibilityStorageEnabled: getCustomExchange({
      Request: {
        payment_method: "card",
        payment_method_data: {
          card: successfulThreeDSTestCardDetails,
        },
        currency: "USD",
        amount: 6500,
      },
      Response: {
        status: 200,
        body: {
          status: "requires_customer_action",
          authentication_type: "three_ds",
        },
      },
    }),
    // Storage flag does not affect authentication outcome — both enabled and
    // disabled flows produce the same 3DS challenge. Distinction is only
    // observable via Redis, which cannot be asserted through the API layer.
    EligibilityStorageDisabled: getCustomExchange({
      Request: {
        payment_method: "card",
        payment_method_data: {
          card: successfulThreeDSTestCardDetails,
        },
        currency: "USD",
        amount: 6500,
      },
      Response: {
        status: 200,
        body: {
          status: "requires_customer_action",
          authentication_type: "three_ds",
        },
      },
    }),
  },
  threeds_routing_region_uas: (() => {
    // Region only selects which UAS deployment the pre/post-auth calls are
    // routed to — it does not change the observable payment outcome. All
    // scenarios below intentionally share one exchange definition, since a
    // valid region, an invalid region (falls back to default), and no
    // config at all (also falls back to default) are all expected to
    // produce the same 3DS challenge.
    const uasRoutingRegionExchange = getCustomExchange({
      Request: {
        payment_method: "card",
        payment_method_data: {
          card: successfulThreeDSTestCardDetails,
        },
        currency: "USD",
        amount: 6500,
      },
      Response: {
        status: 200,
        body: {
          status: "requires_customer_action",
          authentication_type: "three_ds",
        },
      },
    });
    return {
      Region1: uasRoutingRegionExchange,
      Region2: uasRoutingRegionExchange,
      InvalidRegion: uasRoutingRegionExchange,
      NoConfigDefault: uasRoutingRegionExchange,
    };
  })(),
  Dispute: {
    ListDisputes: {
      Response: {
        status: 200,
      },
    },
    ListDisputesWithConnectorFilter: {
      Response: {
        status: 200,
      },
    },
    ListDisputesWithTimeRange: {
      Response: {
        status: 200,
      },
    },
    ListDisputesWithInvalidStatusFilter: {
      Response: {
        status: 400,
      },
    },
    ListDisputesWithInvalidStageFilter: {
      Response: {
        status: 400,
      },
    },
    ListDisputesWithLimit: {
      Response: {
        status: 200,
      },
    },
    ListDisputesWithLargeTimeRange: {
      Response: {
        status: 200,
      },
    },
    RetrieveDispute: {
      Response: {
        status: 200,
      },
    },
    RetrieveNonExistentDispute: {
      Response: {
        status: 404,
        body: {
          error: {
            code: "HE_04",
          },
        },
      },
    },
    AcceptDispute: {
      Response: {
        status: 200,
      },
    },
    AcceptNonExistentDispute: {
      Response: {
        status: 404,
        body: {
          error: {
            code: "HE_04",
          },
        },
      },
    },
    SubmitEvidence: {
      Response: {
        status: 200,
      },
    },
    SubmitEvidenceNonExistentDispute: {
      Response: {
        status: 404,
        body: {
          error: {
            code: "HE_04",
          },
        },
      },
    },
    SubmitEvidenceEmptyBody: {
      Response: {
        status: 400,
      },
    },
    RetrieveEvidence: {
      Response: {
        status: 200,
      },
    },
    AttachEvidenceFileMissingType: {
      Response: {
        status: 400,
        body: {
          error: {
            code: "IR_04",
          },
        },
      },
    },
    FetchDisputes: {
      Response: {},
    },
    FetchDisputesWithTimeRange: {
      Response: {},
    },
    FetchDisputesMissingParams: {
      Response: {
        status: 400,
      },
    },
    FetchDisputesInvalidConnector: {
      Response: {
        status: 400,
      },
    },
  },
  mandate_id_too_long: getCustomExchange({
    Request: {
      mandate_id: "mnd_" + "a".repeat(63),
      off_session: true,
    },
    Response: {
      status: 400,
      body: {
        error: {
          message:
            "mandate_id must be at most 64 characters long. Received 67 characters",
          code: "IR_06",
          type: "invalid_request",
        },
      },
    },
  }),
  payment_method_blocking_pm: {
    BlockIssuingCountry: getCustomExchange({
      Request: {
        payment_method: "card",
        payment_method_data: {
          card: {
            card_number: "4000000000000002",
            card_exp_month: "03",
            card_exp_year: "30",
            card_holder_name: "joseph Doeeee",
            card_cvc: "737",
            card_network: "Visa",
          },
        },
      },
      Response: blockedPaymentErrorBodyForIssuingCountry,
    }),
    BlockCardType: getCustomExchange({
      Request: {
        payment_method: "card",
        payment_method_data: {
          card: {
            card_number: "4111111111111111",
            card_exp_month: "03",
            card_exp_year: "30",
            card_holder_name: "joseph Doeeee",
            card_cvc: "737",
            card_network: "Visa",
          },
        },
      },
      Response: blockedPaymentErrorBodyForDebitCard,
    }),
    BlockCardSubtype: getCustomExchange({
      Request: {
        payment_method: "card",
        payment_method_data: {
          card: {
            card_number: "378282246310005",
            card_exp_month: "03",
            card_exp_year: "30",
            card_holder_name: "joseph Doeeee",
            card_cvc: "737",
            card_network: "Visa",
          },
        },
      },
      Response: blockedPaymentErrorBodyForCardSubtype,
    }),
    BlockIfBinInfoUnavailable: getCustomExchange({
      Request: {
        payment_method: "card",
        payment_method_data: {
          card: {
            card_number: "6304000000000000",
            card_exp_month: "03",
            card_exp_year: "30",
            card_holder_name: "joseph Doeeee",
            card_cvc: "737",
            card_network: "Visa",
          },
        },
      },
      Response: blockedPaymentErrorBodyForBinUnavailable,
    }),
  },
  gift_card_pm: {
    GivexGiftCard: getCustomExchange({
      Request: {
        payment_method: "gift_card",
        payment_method_type: "givex",
        payment_method_data: {
          gift_card: {
            givex: {
              number: "6036280000000000000",
              cvc: "122222",
            },
          },
        },
        currency: "EUR",
        customer_acceptance: null,
      },
    }),
    GivexGiftCardInsufficientBalance: getCustomExchange({
      Request: {
        payment_method: "gift_card",
        payment_method_type: "givex",
        payment_method_data: {
          gift_card: {
            givex: {
              number: "6036280000000000000",
              cvc: "122222",
            },
          },
        },
        currency: "EUR",
        customer_acceptance: null,
      },
    }),
    GivexGiftCardCurrencyMismatch: getCustomExchange({
      Request: {
        payment_method: "gift_card",
        payment_method_type: "givex",
        payment_method_data: {
          gift_card: {
            givex: {
              number: "6036280000000000000",
              cvc: "122222",
            },
          },
        },
        currency: "USD",
        customer_acceptance: null,
      },
    }),
    ConnectorTestingData: getCustomExchange({
      Configs: { TRIGGER_SKIP: true },
      Request: {},
      Response: {
        status: 200,
        body: { status: "failed" },
      },
    }),
    ConnectorTestingDataConfirm: getCustomExchange({
      Configs: { TRIGGER_SKIP: true },
      Request: {},
      Response: {
        status: 200,
        body: { status: "failed" },
      },
    }),
    PaySafeCard: getCustomExchange({
      Request: {
        payment_method: "gift_card",
        payment_method_type: "pay_safe_card",
        payment_method_data: {
          gift_card: {
            pay_safe_card: {},
          },
        },
      },
    }),
  },
  voucher_pm: {
    PaymentIntent: (paymentMethodType) =>
      getCustomExchange({
        Request: {
          currency: getCurrency(paymentMethodType),
        },
        Response: {
          status: 200,
          body: {
            status: "requires_payment_method",
          },
        },
      }),
    Boleto: getCustomExchange({
      Request: {
        payment_method: "voucher",
        payment_method_type: "boleto",
        payment_method_data: {
          voucher: {
            boleto: {
              social_security_number: "12345678909",
              document_type: "cpf",
            },
          },
        },
        billing: {
          address: {
            line1: "Rua Test 123",
            city: "Sao Paulo",
            state: "SP",
            zip: "01310100",
            country: "BR",
            first_name: "Test",
            last_name: "User",
          },
          phone: {
            number: "11987654321",
            country_code: "+55",
          },
          email: "[email protected]",
        },
        currency: "BRL",
      },
    }),
    Oxxo: getCustomExchange({
      Request: {
        payment_method: "voucher",
        payment_method_type: "oxxo",
        payment_method_data: {
          voucher: {
            oxxo: null,
          },
        },
        billing: {
          address: {
            line1: "123 Test St",
            city: "Mexico City",
            state: "Mexico",
            zip: "06600",
            country: "MX",
            first_name: "Test",
            last_name: "User",
          },
          email: "[email protected]",
        },
        currency: "MXN",
      },
    }),
    Alfamart: getCustomExchange({
      Request: {
        payment_method: "voucher",
        payment_method_type: "alfamart",
        payment_method_data: {
          voucher: {
            alfamart: {
              first_name: "Test",
              last_name: "User",
              email: "[email protected]",
            },
          },
        },
        billing: {
          address: {
            line1: "Jl Test 123",
            city: "Jakarta",
            state: "DKI Jakarta",
            zip: "10110",
            country: "ID",
            first_name: "Test",
            last_name: "User",
          },
          email: "[email protected]",
        },
        currency: "IDR",
      },
    }),
    Indomaret: getCustomExchange({
      Request: {
        payment_method: "voucher",
        payment_method_type: "indomaret",
        payment_method_data: {
          voucher: {
            indomaret: {
              first_name: "Test",
              last_name: "User",
              email: "[email protected]",
            },
          },
        },
        billing: {
          address: {
            line1: "Jl Test 123",
            city: "Jakarta",
            state: "DKI Jakarta",
            zip: "10110",
            country: "ID",
            first_name: "Test",
            last_name: "User",
          },
          email: "[email protected]",
        },
        currency: "IDR",
      },
    }),
    SevenEleven: getCustomExchange({
      Request: {
        payment_method: "voucher",
        payment_method_type: "seven_eleven",
        payment_method_data: {
          voucher: {
            seven_eleven: {
              first_name: "Test",
              last_name: "User",
              email: "[email protected]",
            },
          },
        },
        billing: {
          address: {
            line1: "1-1 Test",
            city: "Tokyo",
            state: "Tokyo",
            zip: "1000001",
            country: "JP",
            first_name: "Test",
            last_name: "User",
          },
          phone: {
            number: "312345678",
            country_code: "+81",
          },
          email: "[email protected]",
        },
        currency: "JPY",
      },
    }),
    Lawson: getCustomExchange({
      Request: {
        payment_method: "voucher",
        payment_method_type: "lawson",
        payment_method_data: {
          voucher: {
            lawson: {
              first_name: "Test",
              last_name: "User",
              email: "[email protected]",
            },
          },
        },
        billing: {
          address: {
            line1: "1-1 Test",
            city: "Tokyo",
            state: "Tokyo",
            zip: "1000001",
            country: "JP",
            first_name: "Test",
            last_name: "User",
          },
          phone: {
            number: "312345678",
            country_code: "+81",
          },
          email: "[email protected]",
        },
        currency: "JPY",
      },
    }),
    MiniStop: getCustomExchange({
      Request: {
        payment_method: "voucher",
        payment_method_type: "mini_stop",
        payment_method_data: {
          voucher: {
            mini_stop: {
              first_name: "Test",
              last_name: "User",
              email: "[email protected]",
            },
          },
        },
        billing: {
          address: {
            line1: "1-1 Test",
            city: "Tokyo",
            state: "Tokyo",
            zip: "1000001",
            country: "JP",
            first_name: "Test",
            last_name: "User",
          },
          phone: {
            number: "312345678",
            country_code: "+81",
          },
          email: "[email protected]",
        },
        currency: "JPY",
      },
    }),
    FamilyMart: getCustomExchange({
      Request: {
        payment_method: "voucher",
        payment_method_type: "family_mart",
        payment_method_data: {
          voucher: {
            family_mart: {
              first_name: "Test",
              last_name: "User",
              email: "[email protected]",
            },
          },
        },
        billing: {
          address: {
            line1: "1-1 Test",
            city: "Tokyo",
            state: "Tokyo",
            zip: "1000001",
            country: "JP",
            first_name: "Test",
            last_name: "User",
          },
          phone: {
            number: "312345678",
            country_code: "+81",
          },
          email: "[email protected]",
        },
        currency: "JPY",
      },
    }),
    Seicomart: getCustomExchange({
      Request: {
        payment_method: "voucher",
        payment_method_type: "seicomart",
        payment_method_data: {
          voucher: {
            seicomart: {
              first_name: "Test",
              last_name: "User",
              email: "[email protected]",
            },
          },
        },
        billing: {
          address: {
            line1: "1-1 Test",
            city: "Tokyo",
            state: "Tokyo",
            zip: "1000001",
            country: "JP",
            first_name: "Test",
            last_name: "User",
          },
          phone: {
            number: "312345678",
            country_code: "+81",
          },
          email: "[email protected]",
        },
        currency: "JPY",
      },
    }),
    PayEasy: getCustomExchange({
      Request: {
        payment_method: "voucher",
        payment_method_type: "pay_easy",
        payment_method_data: {
          voucher: {
            pay_easy: {
              first_name: "Test",
              last_name: "User",
              email: "[email protected]",
            },
          },
        },
        billing: {
          address: {
            line1: "1-1 Test",
            city: "Tokyo",
            state: "Tokyo",
            zip: "1000001",
            country: "JP",
            first_name: "Test",
            last_name: "User",
          },
          phone: {
            number: "312345678",
            country_code: "+81",
          },
          email: "[email protected]",
        },
        currency: "JPY",
      },
    }),
  },
  pm_collect_link: {
    pmCollectLinkCreate: {
      Request: {
        return_url: "https://example.com/return",
      },
      Response: {
        status: 200,
      },
    },
    pmCollectLinkRender: {
      Response: {
        status: 200,
      },
    },
    pmCollectLinkRenderNotFound: {
      Response: {
        status: 404,
        body: {
          error: {
            type: "invalid_request",
            code: "IR_37",
            message: "payment method collect link not found",
          },
        },
      },
    },
  },
  payment_link_pm: {
    PaymentLinkBasic: getCustomExchange({
      Request: {
        currency: "USD",
        amount: 6000,
        description: "Test Payment Link",
        email: "[email protected]",
      },
      Response: {
        status: 200,
        body: {
          status: "requires_payment_method",
        },
      },
    }),

    PaymentLinkWithTheme: getCustomExchange({
      Request: {
        currency: "USD",
        amount: 7000,
        description: "Test with custom theme",
        email: "[email protected]",
        payment_link_config: {
          theme: "#FF6B35",
        },
      },
      Response: {
        status: 200,
      },
    }),
    PaymentLinkWithLogo: getCustomExchange({
      Request: {
        currency: "EUR",
        amount: 8000,
        description: "Test with merchant logo",
        email: "[email protected]",
        payment_link_config: {
          logo: "https://example.com/logo.png",
          seller_name: "Test Merchant Inc",
        },
      },
      Response: {
        status: 200,
      },
    }),
    PaymentLinkWithSdkLayout: getCustomExchange({
      Request: {
        currency: "GBP",
        amount: 5500,
        description: "Test with accordion layout",
        email: "[email protected]",
        payment_link_config: {
          sdk_layout: "accordion",
          display_sdk_only: false,
        },
      },
      Response: {
        status: 200,
      },
    }),
    PaymentLinkCardPayment: getCustomExchange({
      Request: {
        currency: "USD",
        amount: 6000,
        description: "Test Payment Link Card Payment",
        email: "[email protected]",
      },
      Response: {
        status: 200,
        body: {
          status: "requires_payment_method",
        },
      },
      CardData: {
        card_number: "4242424242424242",
        card_exp_month: "12",
        card_exp_year: "35",
        card_cvc: "123",
      },
    }),
    PaymentLink3DSCard: getCustomExchange({
      Request: {
        currency: "USD",
        amount: 6000,
        description: "Test Payment Link 3DS Card",
        email: "[email protected]",
        authentication_type: "three_ds",
      },
      CardData: {
        card_number: "4000002500003155",
        card_exp_month: "12",
        card_exp_year: "35",
        card_cvc: "123",
      },
      Response: {
        status: 200,
        body: {
          status: "requires_capture",
        },
      },
    }),
    PaymentLinkTabsLayout: getCustomExchange({
      Request: {
        currency: "EUR",
        amount: 6500,
        description: "Test with tabs layout",
        email: "[email protected]",
        payment_link_config: {
          sdk_layout: "tabs",
          display_sdk_only: false,
        },
      },
      Response: {
        status: 200,
        body: {
          status: "requires_payment_method",
        },
      },
      CardData: {
        card_number: "4242424242424242",
        card_exp_month: "12",
        card_exp_year: "35",
        card_cvc: "123",
      },
    }),
  },
  relay_pm: {
    RefundRelay: {
      Request: {
        type: "refund",
        data: {
          refund: {
            amount: 1000,
            currency: "USD",
          },
        },
      },
      Response: {
        status: 200,
        body: {
          type: "refund",
        },
      },
    },
    CaptureRelay: {
      Request: {
        type: "capture",
        data: {
          capture: {
            authorized_amount: 2000,
            amount_to_capture: 1500,
            currency: "USD",
          },
        },
      },
      Response: {
        status: 200,
        body: {
          type: "capture",
        },
      },
    },
    RetrieveRelay: {
      Request: {},
      Response: {
        status: 200,
        body: {
          type: "refund",
        },
      },
    },
    RetrieveCaptureRelay: {
      Request: {},
      Response: {
        status: 200,
        body: {
          type: "capture",
        },
      },
    },
    MissingConnectorId: {
      Request: {
        connector_resource_id: "test_connector_resource_id",
        type: "refund",
        data: {
          refund: {
            amount: 1000,
            currency: "USD",
          },
        },
      },
      Response: {
        status: 400,
        body: {
          error: {
            message: "Json deserialize error: missing field `connector_id`",
            code: "IR_06",
          },
        },
      },
    },
    InvalidRelayType: {
      Request: {
        connector_resource_id: "test_connector_resource_id",
        connector_id: "test_connector_id",
        type: "invalid_type",
        data: {
          refund: {
            amount: 1000,
            currency: "USD",
          },
        },
      },
      Response: {
        status: 400,
        body: {
          error: {
            message: "Json deserialize error: unknown variant `invalid_type`",
            code: "IR_06",
          },
        },
      },
    },
    RelayNotFound: {
      Request: {},
      Response: {
        status: 400,
        body: {
          error: {
            code: "IR_37",
            message: "relay not found",
          },
        },
      },
    },
  },
  card_redirect_pm: {
    PaymentIntent: getCustomExchange({
      Request: {
        currency: "USD",
      },
    }),
    CardRedirect: getCustomExchange({
      Request: {
        payment_method: "card_redirect",
        payment_method_type: "card_redirect",
        payment_method_data: {
          card_redirect: {
            card_redirect: {},
          },
        },
      },
    }),
  },
  step_up_auth: {
    PaymentIntentOnly: getCustomExchange({
      Request: {
        currency: "USD",
        authentication_type: "three_ds",
        request_external_three_ds_authentication: true,
        setup_future_usage: "off_session",
      },
      Response: {
        status: 200,
        body: {
          status: "requires_payment_method",
          authentication_type: "three_ds",
        },
      },
    }),
    ConfirmPayment: getCustomExchange({
      Request: {
        payment_method: "card",
        payment_method_data: {
          card: successfulThreeDSTestCardDetails,
        },
        currency: "USD",
        authentication_type: "three_ds",
        request_external_three_ds_authentication: true,
        setup_future_usage: "off_session",
      },
      Response: {
        status: 200,
        body: {
          status: "requires_customer_action",
          authentication_type: "three_ds",
        },
      },
    }),
    ThreeDSAuthentication: getCustomExchange({
      Request: {
        device_channel: "BRW",
        threeds_method_comp_ind: "Y",
      },
      Response: {
        status: 200,
        body: {},
      },
    }),
    ThreeDSAuthenticationFrictionless: getCustomExchange({
      Request: {
        device_channel: "BRW",
        threeds_method_comp_ind: "Y",
      },
      Response: {
        status: 200,
        body: { trans_status: "Y" },
      },
    }),
    ThreeDSAuthenticationUnconfirmed: getCustomExchange({
      Request: {
        device_channel: "BRW",
        threeds_method_comp_ind: "Y",
      },
      Response: {
        status: 400,
        body: {
          error: {
            type: "invalid_request",
            code: "IR_16",
            message:
              "You cannot authenticate this payment because payment_attempt.external_three_ds_authentication_attempted is false",
          },
        },
      },
    }),
    AuthorizeAfterFrictionlessAuth: getCustomExchange({
      Request: {},
      Response: {
        status: 200,
        body: {
          status: "succeeded",
        },
      },
    }),
  },
};

// Builds the same message validate_integration_type (server_integration.rs)
// produces for a header/merchant-integration_type mismatch. Used by
// integrationTypeChecker/paymentUpdate in commands.js, which
// 54-IntegrationTypeValidation.cy.js calls into.
export function integrationTypeMismatchMessage(header, merchantConfig) {
  const headerLabel = header ?? "client";
  const merchantLabel = merchantConfig ?? "client";
  return `\`x-integration-type\` header value \`${headerLabel}\` does not match the merchant integration type \`${merchantLabel}\``;
}
// Separate keys, not a reuse of ConfirmWithOfferApplied/
// AppliedOfferOnRetrieve in place, so that connectors which can't actually
// complete a saved-card confirm (e.g. ilixium, which doesn't implement
// repeat_payment) can override just these keys via getConnectorDetails()
// without disturbing the plain-card case, which still passes for them.
// Default to the exact same expectation as the plain-card case for every
// other connector.
connectorDetails.offer_engine.ConfirmWithOfferAppliedSavedCard =
  connectorDetails.offer_engine.ConfirmWithOfferApplied;
connectorDetails.offer_engine.AppliedOfferOnRetrieveSavedCard =
  connectorDetails.offer_engine.AppliedOfferOnRetrieve;
connectorDetails.offer_engine.SavedCardDetails = offerEngineSavedCardDetails;