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

43.0 KB
Raw Blame
import {
  connectorDetails as commonConnectorDetails,
  customerAcceptance,
} from "./Commons";
import { getCustomExchange, getIframeRedirectionConfig } from "./Modifiers";

const successfulNo3DSCardDetails = {
  card_number: "4242424242424242",
  card_exp_month: "01",
  card_exp_year: "50",
  card_holder_name: "joseph Doe",
  card_cvc: "123",
};

const successfulThreeDSTestCardDetails = {
  card_number: "4000000000002701",
  card_exp_month: "01",
  card_exp_year: "50",
  card_holder_name: "joseph Doe",
  card_cvc: "123",
};

const visaFrictionlessCardDetails = {
  card_number: "4929251897047956",
  card_exp_month: "01",
  card_exp_year: "50",
  card_holder_name: "joseph Doe",
  card_cvc: "123",
};

const mastercardChallengeCardDetails = {
  card_number: "5306889942833340",
  card_exp_month: "01",
  card_exp_year: "50",
  card_holder_name: "joseph Doe",
  card_cvc: "123",
};

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

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

const payment_method_data_no3ds = {
  card: {
    last4: "4242",
    card_type: "CREDIT",
    card_subtype: null,
    card_segment_type: null,
    funding_source: null,
    card_network: "Visa",
    card_issuer: "STRIPE PAYMENTS UK LIMITED",
    card_issuing_country: "UNITEDKINGDOM",
    card_isin: "424242",
    card_extended_bin: null,
    card_exp_month: "01",
    card_exp_year: "50",
    card_holder_name: "joseph Doe",
    payment_checks: {
      avs_response: {
        code: "Y",
        codeRaw: "Y",
      },
      card_verification: null,
    },
    authentication_data: null,
    auth_code: null,
  },
  billing: null,
};

const payment_method_data_3ds = {
  card: {
    last4: "2701",
    card_type: "CREDIT",
    card_subtype: "VISA TRADITIONAL",
    card_segment_type: "consumer",
    funding_source: "CREDIT",
    card_network: "Visa",
    card_issuer: "INTL HDQTRS CENTER OWNED",
    card_issuing_country: "UNITED STATES OF AMERICA",
    card_isin: "400000",
    card_extended_bin: null,
    card_exp_month: "01",
    card_exp_year: "50",
    card_holder_name: "joseph Doe",
    payment_checks: null,
    authentication_data: null,
    auth_code: null,
  },
  billing: null,
};

const billing_with_newline = {
  address: {
    line1: "1467",
    line2: "Harrison Street\nApt 101",
    line3: "Harrison Street\nApt 101",
    city: "San Fransico\n city",
    state: "California",
    zip: "94122",
    country: "NL",
    first_name: "joseph",
    last_name: "Doe",
  },
  phone: {
    number: "9123456789",
    country_code: "+91",
  },
};

export const connectorDetails = {
  card_pm: {
    PaymentIntent: {
      Request: {
        currency: "USD",
        customer_acceptance: null,
        setup_future_usage: "on_session",
      },
      Response: {
        status: 200,
        body: {
          status: "requires_payment_method",
          setup_future_usage: "on_session",
        },
      },
    },
    ...getIframeRedirectionConfig({
      cardDetails: successfulThreeDSTestCardDetails,
    }),
    PaymentIntentOffSession: {
      Configs: {
        CONNECTOR_CREDENTIAL: {
          specName: ["incrementalAuth"],
          value: "connector_2",
        },
      },
      Request: {
        currency: "USD",
        amount: 6000,
        authentication_type: "no_three_ds",
        customer_acceptance: null,
        setup_future_usage: "off_session",
      },
      Response: {
        status: 200,
        body: {
          status: "requires_payment_method",
          setup_future_usage: "off_session",
        },
      },
    },
    SessionToken: {
      Response: {
        status: 200,
        body: {
          session_token: [
            {
              wallet_name: "apple_pay",
              connector: "cybersource",
            },
            {
              wallet_name: "google_pay",
              connector: "cybersource",
            },
          ],
        },
      },
    },
    PaymentIntentWithShippingCost: {
      Request: {
        currency: "USD",
        shipping_cost: 50,
      },
      Response: {
        status: 200,
        body: {
          status: "requires_payment_method",
          shipping_cost: 50,
          amount: 6000,
        },
      },
    },
    PaymentConfirmWithShippingCost: {
      Request: {
        payment_method: "card",
        payment_method_data: {
          card: successfulNo3DSCardDetails,
        },
        customer_acceptance: null,
        setup_future_usage: "on_session",
      },
      Response: {
        status: 200,
        body: {
          status: "succeeded",
          shipping_cost: 50,
          amount_received: 6050,
          amount: 6000,
          net_amount: 6050,
        },
      },
    },
    "3DSManualCapture": {
      Configs: {
        CONNECTOR_CREDENTIAL: {
          value: "connector_1",
        },
      },
      Request: {
        payment_method: "card",
        payment_method_data: {
          card: successfulThreeDSTestCardDetails,
        },
        currency: "USD",
        customer_acceptance: null,
        setup_future_usage: "on_session",
      },
      Response: {
        status: 200,
        body: {
          status: "requires_customer_action",
          setup_future_usage: "on_session",
          payment_method_data: payment_method_data_3ds,
        },
      },
    },
    "3DSAutoCapture": {
      Configs: {
        CONNECTOR_CREDENTIAL: {
          value: "connector_1",
        },
      },
      Request: {
        payment_method: "card",
        payment_method_data: {
          card: successfulThreeDSTestCardDetails,
        },
        currency: "USD",
        customer_acceptance: null,
        setup_future_usage: "on_session",
      },
      Response: {
        status: 200,
        body: {
          status: "requires_customer_action",
          setup_future_usage: "on_session",
          payment_method_data: payment_method_data_3ds,
        },
      },
    },
    No3DSManualCapture: {
      Configs: {
        CONNECTOR_CREDENTIAL: {
          value: "connector_1",
        },
      },
      Request: {
        payment_method: "card",
        payment_method_data: {
          card: successfulNo3DSCardDetails,
        },
        currency: "USD",
        customer_acceptance: null,
        setup_future_usage: "on_session",
      },
      Response: {
        status: 200,
        body: {
          status: "requires_capture",
          payment_method: "card",
          attempt_count: 1,
          payment_method_data: payment_method_data_no3ds,
        },
      },
    },
    No3DSAutoCapture: {
      Configs: {
        CONNECTOR_CREDENTIAL: {
          value: "connector_1",
        },
      },
      Request: {
        payment_method: "card",
        payment_method_data: {
          card: successfulNo3DSCardDetails,
        },
        currency: "USD",
        customer_acceptance: null,
        setup_future_usage: "on_session",
        billing: billing_with_newline,
      },
      Response: {
        status: 200,
        body: {
          status: "succeeded",
          payment_method: "card",
          attempt_count: 1,
          payment_method_data: payment_method_data_no3ds,
        },
      },
    },
    No3DSFailPayment: {
      Request: {
        payment_method: "card",
        payment_method_data: {
          billing: {
            address: {
              city: "sakilmostak",
              country: "US",
              line1: "here",
              line2: "there",
              line3: "anywhere",
              zip: "560090",
              state: "Washingtonr",
              first_name: "One",
              last_name: "Two",
            },
            phone: {
              number: "1234567890",
              country_code: "+1",
            },
            email: "[email protected]",
          },
          card: successfulNo3DSCardDetails,
        },
        currency: "USD",
        customer_acceptance: null,
        setup_future_usage: "on_session",
        billing: billing_with_newline,
      },
      Response: {
        status: 200,
        body: {
          status: "failed",
          error_message:
            "Declined - One or more fields in the request contains invalid data, detailed_error_information: orderInformation.billTo.administrativeArea : INVALID_DATA",
          attempt_count: 1,
        },
      },
    },
    ManualRetryPaymentDisabled: {
      Request: {
        payment_method: "card",
        payment_method_data: {
          billing: {
            address: {
              city: "sakilmostak",
              country: "US",
              line1: "here",
              line2: "there",
              line3: "anywhere",
              zip: "560090",
              state: "Washingtonr",
              first_name: "One",
              last_name: "Two",
            },
            phone: {
              number: "1234567890",
              country_code: "+1",
            },
            email: "[email protected]",
          },
          card: successfulNo3DSCardDetails,
        },
        currency: "USD",
        customer_acceptance: null,
        setup_future_usage: "on_session",
        billing: billing_with_newline,
      },
      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: {
      Request: {
        payment_method: "card",
        payment_method_data: {
          billing: {
            address: {
              city: "sakilmostak",
              country: "US",
              line1: "here",
              line2: "there",
              line3: "anywhere",
              zip: "560090",
              state: "Washington",
              first_name: "One",
              last_name: "Two",
            },
            phone: {
              number: "1234567890",
              country_code: "+1",
            },
            email: "[email protected]",
          },
          card: successfulNo3DSCardDetails,
        },
        currency: "USD",
        customer_acceptance: null,
        setup_future_usage: "on_session",
        billing: billing_with_newline,
      },
      Response: {
        status: 200,
        body: {
          status: "succeeded",
          payment_method: "card",
          attempt_count: 2,
        },
      },
    },
    ManualRetryPaymentCutoffExpired: {
      Request: {
        payment_method: "card",
        payment_method_data: {
          billing: {
            address: {
              city: "sakilmostak",
              country: "US",
              line1: "here",
              line2: "there",
              line3: "anywhere",
              zip: "560090",
              state: "Washington",
              first_name: "One",
              last_name: "Two",
            },
            phone: {
              number: "1234567890",
              country_code: "+1",
            },
            email: "[email protected]",
          },
          card: successfulNo3DSCardDetails,
        },
        currency: "USD",
        customer_acceptance: null,
        setup_future_usage: "on_session",
        billing: billing_with_newline,
      },
      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",
        },
      },
    },
    Capture: {
      Configs: {
        CONNECTOR_CREDENTIAL: {
          value: "connector_1",
        },
      },
      Request: {
        amount_to_capture: 6000,
      },
      Response: {
        status: 200,
        body: {
          status: "processing",
          amount: 6000,
          amount_capturable: 6000,
          amount_received: null,
        },
      },
    },
    PartialCapture: {
      Configs: {
        CONNECTOR_CREDENTIAL: {
          value: "connector_1",
        },
      },
      Request: {
        amount_to_capture: 2000,
      },
      Response: {
        status: 200,
        body: {
          status: "processing",
          amount: 6000,
          amount_capturable: 6000,
          amount_received: null,
        },
      },
    },
    Void: {
      Configs: {
        CONNECTOR_CREDENTIAL: {
          value: "connector_1",
        },
      },
      Request: {},
      Response: {
        status: 200,
        body: {
          status: "cancelled",
        },
      },
    },
    Refund: {
      Configs: {
        CONNECTOR_CREDENTIAL: {
          value: "connector_1",
        },
      },
      Request: {
        amount: 6000,
      },
      Response: {
        status: 200,
        body: {
          status: "pending",
        },
      },
    },
    manualPaymentRefund: {
      Configs: {
        CONNECTOR_CREDENTIAL: {
          value: "connector_1",
        },
      },
      Request: {
        amount: 6000,
      },
      Response: {
        status: 400,
        body: {
          error: {
            type: "invalid_request",
            message:
              "This Payment could not be refund because it has a status of processing. The expected state is succeeded, partially_captured",
            code: "IR_14",
          },
        },
      },
    },
    manualPaymentPartialRefund: {
      Configs: {
        CONNECTOR_CREDENTIAL: {
          value: "connector_1",
        },
      },
      Request: {
        amount: 2000,
      },
      Response: {
        status: 400,
        body: {
          error: {
            type: "invalid_request",
            message:
              "This Payment could not be refund because it has a status of processing. The expected state is succeeded, partially_captured",
            code: "IR_14",
          },
        },
      },
    },
    PartialRefund: {
      Configs: {
        CONNECTOR_CREDENTIAL: {
          value: "connector_1",
        },
      },
      Request: {
        amount: 2000,
      },
      Response: {
        status: 200,
        body: {
          status: "pending",
        },
      },
    },
    SyncRefund: {
      Configs: {
        CONNECTOR_CREDENTIAL: {
          value: "connector_1",
        },
      },
      Response: {
        status: 200,
        body: {
          status: "pending",
        },
      },
    },
    IncrementalAuth: {
      Request: {
        amount: 8000,
      },
      Response: {
        status: 200,
        body: {
          status: "requires_capture",
          amount: 8000,
          amount_capturable: 8000,
          amount_received: null,
        },
      },
    },
    MandateSingleUse3DSAutoCapture: {
      Configs: {
        CONNECTOR_CREDENTIAL: {
          value: "connector_1",
        },
      },
      Request: {
        payment_method: "card",
        payment_method_data: {
          card: successfulThreeDSTestCardDetails,
        },
        currency: "USD",
        mandate_data: singleUseMandateData,
      },
      Response: {
        status: 200,
        body: {
          status: "succeeded",
        },
      },
    },
    MandateSingleUse3DSManualCapture: {
      Configs: {
        CONNECTOR_CREDENTIAL: {
          value: "connector_1",
        },
      },
      Request: {
        payment_method: "card",
        payment_method_data: {
          card: successfulThreeDSTestCardDetails,
        },
        currency: "USD",
        mandate_data: singleUseMandateData,
      },
      Response: {
        status: 200,
        body: {
          status: "requires_customer_action",
        },
      },
    },
    MandateSingleUseNo3DSAutoCapture: {
      Configs: {
        CONNECTOR_CREDENTIAL: {
          value: "connector_1",
        },
      },
      Request: {
        amount: 6000,
        payment_method: "card",
        payment_method_data: {
          card: successfulNo3DSCardDetails,
        },
        currency: "USD",
        mandate_data: singleUseMandateData,
      },
      Response: {
        status: 200,
        body: {
          status: "succeeded",
        },
      },
    },
    MandateSingleUseNo3DSManualCapture: {
      Configs: {
        CONNECTOR_CREDENTIAL: {
          value: "connector_1",
        },
      },
      Request: {
        amount: 6000,
        payment_method: "card",
        payment_method_data: {
          card: successfulNo3DSCardDetails,
        },
        currency: "USD",
        mandate_data: singleUseMandateData,
      },
      Response: {
        status: 200,
        body: {
          status: "requires_capture",
        },
      },
    },
    MandateMultiUseNo3DSAutoCapture: {
      Configs: {
        CONNECTOR_CREDENTIAL: {
          value: "connector_1",
        },
      },
      Request: {
        amount: 6000,
        payment_method: "card",
        payment_method_data: {
          card: successfulNo3DSCardDetails,
        },
        currency: "USD",
        mandate_data: multiUseMandateData,
      },
      Response: {
        status: 200,
        body: {
          status: "succeeded",
        },
      },
    },
    MandateMultiUseNo3DSManualCapture: {
      Configs: {
        CONNECTOR_CREDENTIAL: {
          value: "connector_1",
        },
      },
      Request: {
        amount: 6000,
        payment_method: "card",
        payment_method_data: {
          card: successfulNo3DSCardDetails,
        },
        currency: "USD",
        mandate_data: multiUseMandateData,
      },
      Response: {
        status: 200,
        body: {
          status: "requires_capture",
        },
      },
    },
    MandateMultiUse3DSAutoCapture: {
      Configs: {
        CONNECTOR_CREDENTIAL: {
          value: "connector_1",
        },
      },
      Request: {
        payment_method: "card",
        payment_method_data: {
          card: successfulThreeDSTestCardDetails,
        },
        currency: "USD",
        mandate_data: multiUseMandateData,
      },
      Response: {
        status: 200,
        body: {
          status: "requires_capture",
        },
      },
    },
    MandateMultiUse3DSManualCapture: {
      Configs: {
        CONNECTOR_CREDENTIAL: {
          value: "connector_1",
        },
      },
      Request: {
        payment_method: "card",
        payment_method_data: {
          card: successfulThreeDSTestCardDetails,
        },
        currency: "USD",
        mandate_data: multiUseMandateData,
      },
      Response: {
        status: 200,
        body: {
          status: "requires_capture",
        },
      },
    },
    MITAutoCapture: getCustomExchange({
      Configs: {
        CONNECTOR_CREDENTIAL: {
          value: "connector_1",
        },
      },
      ...commonConnectorDetails.card_pm.MITAutoCapture,
    }),
    MITAutoCaptureWithCustomerAcceptance: getCustomExchange({
      Configs: {
        CONNECTOR_CREDENTIAL: {
          value: "connector_1",
        },
      },
      ...commonConnectorDetails.card_pm.MITAutoCaptureWithCustomerAcceptance,
    }),
    MITManualCapture: {
      Configs: {
        CONNECTOR_CREDENTIAL: {
          value: "connector_1",
        },
      },
      Request: { amount: 6000 },
      Response: {
        status: 200,
        body: {
          status: "requires_capture",
        },
      },
    },
    ZeroAuthMandate: {
      Configs: {
        CONNECTOR_CREDENTIAL: {
          value: "connector_1",
        },
      },
      Request: {
        amount: 0,
        payment_method: "card",
        payment_method_data: {
          card: successfulNo3DSCardDetails,
        },
        currency: "USD",
        mandate_data: singleUseMandateData,
      },
      Response: {
        status: 200,
        body: {
          status: "succeeded",
        },
      },
    },
    ZeroAuthPaymentIntent: {
      Request: {
        amount: 0,
        setup_future_usage: "off_session",
        currency: "USD",
      },
      Response: {
        status: 200,
        body: {
          status: "requires_payment_method",
          setup_future_usage: "off_session",
        },
      },
    },
    ZeroAuthConfirmPayment: {
      Configs: {
        CONNECTOR_CREDENTIAL: {
          value: "connector_1",
        },
      },
      Request: {
        amount: 0,
        payment_type: "setup_mandate",
        payment_method: "card",
        payment_method_type: "credit",
        payment_method_data: {
          card: successfulNo3DSCardDetails,
        },
        mandate_data: null,
        customer_acceptance: customerAcceptance,
      },
      Response: {
        status: 200,
        body: {
          status: "succeeded",
          setup_future_usage: "off_session",
        },
      },
    },
    SaveCardUseNo3DSAutoCapture: {
      Configs: {
        CONNECTOR_CREDENTIAL: {
          value: "connector_1",
        },
      },
      Request: {
        payment_method: "card",
        payment_method_type: "debit",
        payment_method_data: {
          card: successfulNo3DSCardDetails,
        },
        currency: "USD",
        setup_future_usage: "on_session",
        customer_acceptance: customerAcceptance,
      },
      Response: {
        status: 200,
        body: {
          status: "succeeded",
        },
      },
    },
    SaveCardUseNo3DSAutoCaptureOffSession: {
      Configs: {
        CONNECTOR_CREDENTIAL: {
          value: "connector_1",
        },
      },
      Request: {
        payment_method: "card",
        payment_method_type: "debit",
        payment_method_data: {
          card: successfulNo3DSCardDetails,
        },
        setup_future_usage: "off_session",
        customer_acceptance: customerAcceptance,
      },
      Response: {
        status: 200,
        body: {
          status: "succeeded",
        },
      },
    },
    SaveCardUse3DSAutoCaptureOffSession: {
      Configs: {
        CONNECTOR_CREDENTIAL: {
          value: "connector_1",
        },
      },
      Request: {
        payment_method: "card",
        payment_method_type: "debit",
        payment_method_data: {
          card: successfulThreeDSTestCardDetails,
        },
        setup_future_usage: "off_session",
        customer_acceptance: customerAcceptance,
      },
      Response: {
        status: 200,
        body: {
          status: "requires_customer_action",
        },
      },
    },
    SaveCardUseNo3DSManualCaptureOffSession: {
      Configs: {
        CONNECTOR_CREDENTIAL: {
          specName: ["incrementalAuth"],
          value: "connector_2",
        },
      },
      Request: {
        payment_method: "card",
        payment_method_type: "debit",
        payment_method_data: {
          card: successfulNo3DSCardDetails,
        },
        setup_future_usage: "off_session",
        customer_acceptance: customerAcceptance,
      },
      Response: {
        status: 200,
        body: {
          status: "requires_capture",
        },
      },
    },
    SaveCardConfirmAutoCaptureOffSession: {
      Configs: {
        CONNECTOR_CREDENTIAL: {
          value: "connector_1",
        },
      },
      Request: {
        setup_future_usage: "off_session",
      },
      Response: {
        status: 200,
        body: {
          status: "succeeded",
        },
      },
    },
    SaveCardConfirmManualCaptureOffSession: {
      Configs: {
        CONNECTOR_CREDENTIAL: {
          value: "connector_1",
        },
      },
      Request: {
        setup_future_usage: "off_session",
      },
      Response: {
        status: 200,
        body: {
          status: "requires_capture",
        },
      },
    },
    SaveCardUseNo3DSManualCapture: {
      Configs: {
        CONNECTOR_CREDENTIAL: {
          value: "connector_1",
        },
      },
      Request: {
        payment_method: "card",
        payment_method_data: {
          card: successfulNo3DSCardDetails,
        },
        currency: "USD",
        setup_future_usage: "on_session",
        customer_acceptance: customerAcceptance,
      },
      Response: {
        status: 200,
        body: {
          status: "requires_capture",
        },
      },
    },
    PaymentMethodIdMandateNo3DSAutoCapture: {
      Configs: {
        CONNECTOR_CREDENTIAL: {
          value: "connector_1",
        },
      },
      Request: {
        amount: 6000,
        payment_method: "card",
        payment_method_data: {
          card: successfulNo3DSCardDetails,
        },
        currency: "USD",
        mandate_data: null,
        customer_acceptance: customerAcceptance,
      },
      Response: {
        status: 200,
        body: {
          status: "succeeded",
        },
      },
    },
    PaymentMethodIdMandateNo3DSManualCapture: {
      Configs: {
        CONNECTOR_CREDENTIAL: {
          value: "connector_1",
        },
      },
      Request: {
        amount: 6000,
        payment_method: "card",
        payment_method_data: {
          card: successfulNo3DSCardDetails,
        },
        currency: "USD",
        mandate_data: null,
        customer_acceptance: customerAcceptance,
      },
      Response: {
        status: 200,
        body: {
          status: "requires_capture",
        },
      },
    },
    PaymentMethodIdMandate3DSAutoCapture: {
      Configs: {
        CONNECTOR_CREDENTIAL: {
          value: "connector_1",
        },
      },
      Request: {
        amount: 6000,
        payment_method: "card",
        payment_method_data: {
          card: successfulThreeDSTestCardDetails,
        },
        currency: "USD",
        mandate_data: null,
        authentication_type: "three_ds",
        customer_acceptance: customerAcceptance,
      },
      Response: {
        status: 200,
        body: {
          status: "requires_customer_action",
        },
      },
    },
    PaymentMethodIdMandate3DSManualCapture: {
      Configs: {
        CONNECTOR_CREDENTIAL: {
          value: "connector_1",
        },
      },
      Request: {
        amount: 6000,
        payment_method: "card",
        payment_method_data: {
          card: successfulThreeDSTestCardDetails,
        },
        mandate_data: null,
        authentication_type: "three_ds",
        customer_acceptance: customerAcceptance,
      },
      Response: {
        status: 200,
        body: {
          status: "requires_customer_action",
        },
      },
    },
  },
  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",
        },
      },
    }),
  },
  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: {},
      },
    }),
    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",
          },
        },
      },
    }),
    StepUpAuthWithMerchantCodes: 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",
        },
      },
    }),
    ThreeDSAuthenticationWithMerchantCodes: getCustomExchange({
      Request: {
        device_channel: "BRW",
        threeds_method_comp_ind: "Y",
      },
      Response: {
        status: 200,
        body: {},
      },
    }),
    ConfirmPaymentVisaFrictionless: getCustomExchange({
      Request: {
        payment_method: "card",
        payment_method_data: {
          card: visaFrictionlessCardDetails,
        },
        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",
        },
      },
    }),
    ConfirmPaymentMastercardChallenge: getCustomExchange({
      Request: {
        payment_method: "card",
        payment_method_data: {
          card: mastercardChallengeCardDetails,
        },
        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",
        },
      },
    }),
    AuthorizeAfterFrictionlessAuth: getCustomExchange({
      Request: {},
      Response: {
        status: 200,
        body: {
          status: "succeeded",
        },
      },
    }),
  },
  pm_list: {
    PmListResponse: {
      PmListNull: {
        payment_methods: [],
      },
      pmListDynamicFieldWithoutBilling: {
        payment_methods: [
          {
            payment_method: "card",
            payment_method_types: [
              {
                payment_method_type: "credit",
                card_networks: [
                  {
                    eligible_connectors: ["cybersource"],
                  },
                ],
                required_fields: {
                  "billing.address.first_name": {
                    required_field:
                      "payment_method_data.billing.address.first_name",
                    display_name: "card_holder_name",
                    field_type: "user_full_name",
                    value: null,
                  },
                  "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_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_year": {
                    required_field: "payment_method_data.card.card_exp_year",
                    display_name: "card_exp_year",
                    field_type: "user_card_expiry_year",
                    value: null,
                  },
                  "billing.address.last_name": {
                    required_field:
                      "payment_method_data.billing.address.last_name",
                    display_name: "card_holder_name",
                    field_type: "user_full_name",
                    value: null,
                  },
                  "billing.address.state": {
                    required_field: "payment_method_data.billing.address.state",
                    display_name: "state",
                    field_type: "user_address_state",
                    value: null,
                  },
                  "billing.email": {
                    required_field: "payment_method_data.billing.email",
                    display_name: "email",
                    field_type: "user_email_address",
                    value: "[email protected]",
                  },
                  "billing.address.zip": {
                    required_field: "payment_method_data.billing.address.zip",
                    display_name: "zip",
                    field_type: "user_address_pincode",
                    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,
                  },
                  "billing.address.line1": {
                    required_field: "payment_method_data.billing.address.line1",
                    display_name: "line1",
                    field_type: "user_address_line1",
                    value: null,
                  },
                  "billing.address.city": {
                    required_field: "payment_method_data.billing.address.city",
                    display_name: "city",
                    field_type: "user_address_city",
                    value: null,
                  },
                },
              },
            ],
          },
        ],
      },
      pmListDynamicFieldWithBilling: {
        payment_methods: [
          {
            payment_method: "card",
            payment_method_types: [
              {
                payment_method_type: "credit",
                card_networks: [
                  {
                    eligible_connectors: ["cybersource"],
                  },
                ],
                required_fields: {
                  "billing.address.city": {
                    required_field: "payment_method_data.billing.address.city",
                    display_name: "city",
                    field_type: "user_address_city",
                    value: "San Fransico",
                  },
                  "billing.address.state": {
                    required_field: "payment_method_data.billing.address.state",
                    display_name: "state",
                    field_type: "user_address_state",
                    value: "CA",
                  },
                  "billing.address.zip": {
                    required_field: "payment_method_data.billing.address.zip",
                    display_name: "zip",
                    field_type: "user_address_pincode",
                    value: "94122",
                  },
                  "billing.address.country": {
                    required_field:
                      "payment_method_data.billing.address.country",
                    display_name: "country",
                    field_type: {
                      user_address_country: {
                        options: ["ALL"],
                      },
                    },
                    value: "US",
                  },
                  "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",
                  },
                  "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.email": {
                    required_field: "payment_method_data.billing.email",
                    display_name: "email",
                    field_type: "user_email_address",
                    value: "[email protected]",
                  },
                  "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,
                  },
                  "billing.address.line1": {
                    required_field: "payment_method_data.billing.address.line1",
                    display_name: "line1",
                    field_type: "user_address_line1",
                    value: "1467",
                  },
                  "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,
                  },
                  "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,
                  },
                },
              },
            ],
          },
        ],
      },
      pmListDynamicFieldWithNames: {
        payment_methods: [
          {
            payment_method: "card",
            payment_method_types: [
              {
                payment_method_type: "credit",
                card_networks: [
                  {
                    eligible_connectors: ["cybersource"],
                  },
                ],
                required_fields: {
                  "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",
                  },
                },
              },
            ],
          },
        ],
      },
      pmListDynamicFieldWithEmail: {
        payment_methods: [
          {
            payment_method: "card",
            payment_method_types: [
              {
                payment_method_type: "credit",
                card_networks: [
                  {
                    eligible_connectors: ["cybersource"],
                  },
                ],
                required_fields: {
                  "billing.email": {
                    required_field: "payment_method_data.billing.email",
                    display_name: "email",
                    field_type: "user_email_address",
                    value: "[email protected]",
                  },
                },
              },
            ],
          },
        ],
      },
    },
  },
};