import {z} from 'zod' export type PaymentMethod = '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' | 'network_token'; export type PaymentMethodType = 'ach' | 'affirm' | 'afterpay_clearpay' | 'alfamart' | 'ali_pay' | 'ali_pay_hk' | 'alma' | 'amazon_pay' | 'paysera' | 'apple_pay' | 'atome' | 'bacs' | 'bancontact_card' | 'becs' | 'benefit' | 'bizum' | 'blik' | 'bluecode' | 'boleto' | 'bca_bank_transfer' | 'bni_va' | 'breadpay' | 'bri_va' | 'bhn_card_network' | 'card_redirect' | 'cimb_va' | 'classic' | 'credit' | 'crypto_currency' | 'cashapp' | 'dana' | 'danamon_va' | 'debit' | 'duit_now' | 'efecty' | 'eft' | 'eft_debit_order' | 'eps' | 'flexiti' | 'fps' | 'evoucher' | 'giropay' | 'givex' | 'google_pay' | 'go_pay' | 'gcash' | 'ideal' | 'interac' | 'indomaret' | 'klarna' | 'kakao_pay' | 'local_bank_redirect' | 'mandiri_va' | 'knet' | 'mb_way' | 'mobile_pay' | 'momo' | 'momo_atm' | 'multibanco' | 'online_banking_thailand' | 'online_banking_czech_republic' | 'online_banking_finland' | 'online_banking_fpx' | 'online_banking_poland' | 'online_banking_slovakia' | 'oxxo' | 'pago_efectivo' | 'permata_bank_transfer' | 'open_banking_uk' | 'pay_bright' | 'payjustnow' | 'paypal' | 'paze' | 'pix' | 'pix_key' | 'pix_emv' | 'pix_qr' | 'pix_automatico_qr' | 'pix_automatico_push' | 'pay_safe_card' | 'przelewy24' | 'prompt_pay' | 'pse' | 'qris' | 'red_compra' | 'red_pagos' | 'samsung_pay' | 'sepa' | 'sepa_bank_transfer' | 'sepa_guarenteed_debit' | 'skrill' | 'sofort' | 'swish' | 'touch_n_go' | 'trustly' | 'twint' | 'upi_collect' | 'upi_intent' | 'upi_qr' | 'vipps' | 'viet_qr' | 'venmo' | 'walley' | 'we_chat_pay' | 'seven_eleven' | 'lawson' | 'mini_stop' | 'family_mart' | 'seicomart' | 'pay_easy' | 'local_bank_transfer' | 'mifinity' | 'open_banking_pis' | 'direct_carrier_billing' | 'instant_bank_transfer' | 'instant_bank_transfer_finland' | 'instant_bank_transfer_poland' | 'revolut_pay' | 'indonesian_bank_transfer' | 'open_banking' | 'network_token'; export type CardNetwork = 'Visa' | 'Mastercard' | 'AmericanExpress' | 'JCB' | 'DinersClub' | 'Discover' | 'CartesBancaires' | 'UnionPay' | 'Interac' | 'RuPay' | 'Maestro' | 'Star' | 'Pulse' | 'Accel' | 'Nyce' | 'Prop' | 'PrivateLabel' | 'Dinacard'; export type EligibilityCard = {card_number: string, card_exp_month?: (string | null) | undefined, card_exp_year?: (string | null) | undefined, card_cvc?: (string | null) | undefined, card_holder_name?: (string | null) | undefined, card_issuer?: (string | null) | undefined, card_network?: (CardNetwork | null) | undefined, card_type?: (string | null) | undefined, card_issuing_country?: (string | null) | undefined, card_issuing_country_code?: (string | null) | undefined, bank_code?: (string | null) | undefined, nick_name?: (string | null) | undefined}; export type CountryAlpha2 = 'AF' | 'AX' | 'AL' | 'DZ' | 'AS' | 'AD' | 'AO' | 'AI' | 'AQ' | 'AG' | 'AR' | 'AM' | 'AW' | 'AU' | 'AT' | 'AZ' | 'BS' | 'BH' | 'BD' | 'BB' | 'BY' | 'BE' | 'BZ' | 'BJ' | 'BM' | 'BT' | 'BO' | 'BQ' | 'BA' | 'BW' | 'BV' | 'BR' | 'IO' | 'BN' | 'BG' | 'BF' | 'BI' | 'KH' | 'CM' | 'CA' | 'CV' | 'KY' | 'CF' | 'TD' | 'CL' | 'CN' | 'CX' | 'CC' | 'CO' | 'KM' | 'CG' | 'CD' | 'CK' | 'CR' | 'CI' | 'HR' | 'CU' | 'CW' | 'CY' | 'CZ' | 'DK' | 'DJ' | 'DM' | 'DO' | 'EC' | 'EG' | 'SV' | 'GQ' | 'ER' | 'EE' | 'ET' | 'FK' | 'FO' | 'FJ' | 'FI' | 'FR' | 'GF' | 'PF' | 'TF' | 'GA' | 'GM' | 'GE' | 'DE' | 'GH' | 'GI' | 'GR' | 'GL' | 'GD' | 'GP' | 'GU' | 'GT' | 'GG' | 'GN' | 'GW' | 'GY' | 'HT' | 'HM' | 'VA' | 'HN' | 'HK' | 'HU' | 'IS' | 'IN' | 'ID' | 'IR' | 'IQ' | 'IE' | 'IM' | 'IL' | 'IT' | 'JM' | 'JP' | 'JE' | 'JO' | 'KZ' | 'KE' | 'KI' | 'KP' | 'KR' | 'KW' | 'KG' | 'LA' | 'LV' | 'LB' | 'LS' | 'LR' | 'LY' | 'LI' | 'LT' | 'LU' | 'MO' | 'MK' | 'MG' | 'MW' | 'MY' | 'MV' | 'ML' | 'MT' | 'MH' | 'MQ' | 'MR' | 'MU' | 'YT' | 'MX' | 'FM' | 'MD' | 'MC' | 'MN' | 'ME' | 'MS' | 'MA' | 'MZ' | 'MM' | 'NA' | 'NR' | 'NP' | 'NL' | 'NC' | 'NZ' | 'NI' | 'NE' | 'NG' | 'NU' | 'NF' | 'MP' | 'NO' | 'OM' | 'PK' | 'PW' | 'PS' | 'PA' | 'PG' | 'PY' | 'PE' | 'PH' | 'PN' | 'PL' | 'PT' | 'PR' | 'QA' | 'RE' | 'RO' | 'RU' | 'RW' | 'BL' | 'SH' | 'KN' | 'LC' | 'MF' | 'PM' | 'VC' | 'WS' | 'SM' | 'ST' | 'SA' | 'SN' | 'RS' | 'SC' | 'SL' | 'SG' | 'SX' | 'SK' | 'SI' | 'SB' | 'SO' | 'ZA' | 'GS' | 'SS' | 'ES' | 'LK' | 'SD' | 'SR' | 'SJ' | 'SZ' | 'SE' | 'CH' | 'SY' | 'TW' | 'TJ' | 'TZ' | 'TH' | 'TL' | 'TG' | 'TK' | 'TO' | 'TT' | 'TN' | 'TR' | 'TM' | 'TC' | 'TV' | 'UG' | 'UA' | 'AE' | 'GB' | 'UM' | 'UY' | 'UZ' | 'VU' | 'VE' | 'VN' | 'VG' | 'VI' | 'WF' | 'EH' | 'YE' | 'ZM' | 'ZW' | 'US'; export type AddressDetails = {city?: (string | null) | undefined, country?: (CountryAlpha2 | null) | undefined, line1?: (string | null) | undefined, line2?: (string | null) | undefined, line3?: (string | null) | undefined, zip?: (string | null) | undefined, state?: (string | null) | undefined, first_name?: (string | null) | undefined, last_name?: (string | null) | undefined, origin_zip?: (string | null) | undefined}; export type PhoneDetails = {number?: (string | null) | undefined, country_code?: (string | null) | undefined}; export type Address = {address?: (AddressDetails | null) | undefined, phone?: (PhoneDetails | null) | undefined, email?: (string | null) | undefined}; export type CardRedirectData = {knet: Record} | {benefit: Record} | {momo_atm: Record} | {card_redirect: Record}; export type AliPayHkRedirection = Record; export type AliPayQr = Record; export type AliPayRedirection = Record; export type AmazonPayWalletData = {checkout_session_id: string}; export type AmazonPayRedirectData = Record; export type ApplePayCryptogramData = {online_payment_cryptogram: string, eci_indicator: string}; export type ApplePayPredecryptData = {application_primary_account_number: string, application_expiration_month: string, application_expiration_year: string, payment_data: ApplePayCryptogramData}; export type ApplePayPaymentData = ApplePayPredecryptData | string; export type ApplepayPaymentMethod = {display_name: string, network: string, type: string, card_exp_month?: (string | null) | undefined, card_exp_year?: (string | null) | undefined, auth_code?: (string | null) | undefined}; export type ApplePayWalletData = {payment_data: ApplePayPaymentData, payment_method: ApplepayPaymentMethod, transaction_identifier: string}; export type ApplePayRedirectData = Record; export type ApplePayThirdPartySdkData = {token?: (string | null) | undefined}; export type CashappQr = Record; export type GcashRedirection = Record; export type GoPayRedirection = Record; export type GooglePayAssuranceDetails = {card_holder_authenticated: boolean, account_verified: boolean}; export type GooglePayCardFundingSource = 'CREDIT' | 'DEBIT' | 'PREPAID' | 'UNKNOWN'; export type GooglePayPaymentMethodInfo = {card_network: string, card_details: string, assurance_details?: (GooglePayAssuranceDetails | null) | undefined, card_funding_source?: (GooglePayCardFundingSource | null) | undefined}; export type GPayPredecryptData = {card_exp_month: string, card_exp_year: string, application_primary_account_number: string, cryptogram: string, eci_indicator: string}; export type GpayEcryptedTokenizationData = {type: string, token: string}; export type GpayTokenizationData = GPayPredecryptData | GpayEcryptedTokenizationData; export type GooglePayWalletData = {type: string, description: string, info: GooglePayPaymentMethodInfo, tokenization_data: GpayTokenizationData}; export type GooglePayRedirectData = Record; export type GooglePayThirdPartySdkData = {token?: (string | null) | undefined}; export type KakaoPayRedirection = Record; export type MbWayRedirection = {telephone_number: string}; export type MifinityData = {date_of_birth: string, language_preference?: (string | null) | undefined}; export type MobilePayRedirection = Record; export type MomoRedirection = Record; export type PaypalRedirection = {email?: (string | null) | undefined}; export type PayPalWalletData = {token: string}; export type PayseraData = Record; export type PazeWalletData = {complete_response: string}; export type RevolutPayData = Record; export type SamsungPayCardBrand = 'visa' | 'mastercard' | 'amex' | 'discover' | 'unknown'; export type SamsungPayTokenData = {type?: (string | null) | undefined, version: string, data: string}; export type SamsungPayWebWalletData = {method?: (string | null) | undefined, recurring_payment?: (boolean | null) | undefined, card_brand: SamsungPayCardBrand, card_last4digits: string, '3_d_s': SamsungPayTokenData}; export type SamsungPayAppWalletData = {'3_d_s': SamsungPayTokenData, payment_card_brand: SamsungPayCardBrand, payment_currency_type: string, payment_last4_dpan?: (string | null) | undefined, payment_last4_fpan: string, merchant_ref?: (string | null) | undefined, method?: (string | null) | undefined, recurring_payment?: (boolean | null) | undefined}; export type SamsungPayWalletCredentials = SamsungPayWebWalletData | SamsungPayAppWalletData; export type SamsungPayWalletData = {payment_credential: SamsungPayWalletCredentials}; export type SkrillData = Record; export type SwishQrData = Record; export type TouchNGoRedirection = Record; export type WeChatPayQr = Record; export type WeChatPayRedirection = Record; export type WalletData = {ali_pay_hk_redirect: AliPayHkRedirection} | {ali_pay_qr: AliPayQr} | {ali_pay_redirect: AliPayRedirection} | {amazon_pay: AmazonPayWalletData} | {amazon_pay_redirect: AmazonPayRedirectData} | {apple_pay: ApplePayWalletData} | {apple_pay_redirect: ApplePayRedirectData} | {apple_pay_third_party_sdk: ApplePayThirdPartySdkData} | {bluecode_redirect: Record} | {cashapp_qr: CashappQr} | {dana_redirect: Record} | {gcash_redirect: GcashRedirection} | {go_pay_redirect: GoPayRedirection} | {google_pay: GooglePayWalletData} | {google_pay_redirect: GooglePayRedirectData} | {google_pay_third_party_sdk: GooglePayThirdPartySdkData} | {kakao_pay_redirect: KakaoPayRedirection} | {mb_way_redirect: MbWayRedirection} | {mifinity: MifinityData} | {mobile_pay_redirect: MobilePayRedirection} | {momo_redirect: MomoRedirection} | {paypal_redirect: PaypalRedirection} | {paypal_sdk: PayPalWalletData} | {paysera: PayseraData} | {paze: PazeWalletData} | {revolut_pay: RevolutPayData} | {samsung_pay: SamsungPayWalletData} | {skrill: SkrillData} | {swish_qr: SwishQrData} | {touch_n_go_redirect: TouchNGoRedirection} | {twint_redirect: Record} | {vipps_redirect: Record} | {we_chat_pay_qr: WeChatPayQr} | {we_chat_pay_redirect: WeChatPayRedirection}; export type PayLaterData = {klarna_redirect: {billing_email?: (string | null) | undefined, billing_country?: (CountryAlpha2 | null) | undefined}} | {klarna_sdk: {token: string}} | {affirm_redirect: Record} | {afterpay_clearpay_redirect: {billing_email?: (string | null) | undefined, billing_name?: (string | null) | undefined}} | {pay_bright_redirect: Record} | {flexiti_redirect: Record} | {walley_redirect: Record} | {alma_redirect: Record} | {atome_redirect: Record} | {breadpay_redirect: Record} | {payjustnow_redirect: Record}; export type BankRedirectBilling = {billing_name: string, email: string}; export type BankNames = 'absa' | 'american_express' | 'affin_bank' | 'agro_bank' | 'alliance_bank' | 'am_bank' | 'bank_of_america' | 'bank_of_china' | 'bank_islam' | 'bank_muamalat' | 'bank_rakyat' | 'bank_simpanan_nasional' | 'barclays' | 'blik_p_s_p' | 'capital_one' | 'chase' | 'citi' | 'cimb_bank' | 'discover' | 'navy_federal_credit_union' | 'pentagon_federal_credit_union' | 'synchrony_bank' | 'wells_fargo' | 'abn_amro' | 'asn_bank' | 'bunq' | 'handelsbanken' | 'hong_leong_bank' | 'hsbc_bank' | 'ing' | 'knab' | 'kuwait_finance_house' | 'moneyou' | 'rabobank' | 'regiobank' | 'revolut' | 'sns_bank' | 'triodos_bank' | 'van_lanschot' | 'arzte_und_apotheker_bank' | 'austrian_anadi_bank_ag' | 'bank_austria' | 'bank99_ag' | 'bankhaus_carl_spangler' | 'bankhaus_schelhammer_und_schattera_ag' | 'bank_millennium' | 'bank_p_e_k_a_o_s_a' | 'bawag_psk_ag' | 'bks_bank_ag' | 'brull_kallmus_bank_ag' | 'btv_vier_lander_bank' | 'capital_bank_grawe_gruppe_ag' | 'ceska_sporitelna' | 'dolomitenbank' | 'easybank_ag' | 'e_platby_v_u_b' | 'erste_bank_und_sparkassen' | 'friesland_bank' | 'hypo_alpeadriabank_international_ag' | 'hypo_noe_lb_fur_niederosterreich_u_wien' | 'hypo_oberosterreich_salzburg_steiermark' | 'hypo_tirol_bank_ag' | 'hypo_vorarlberg_bank_ag' | 'hypo_bank_burgenland_aktiengesellschaft' | 'komercni_banka' | 'm_bank' | 'marchfelder_bank' | 'maybank' | 'oberbank_ag' | 'osterreichische_arzte_und_apothekerbank' | 'ocbc_bank' | 'pay_with_i_n_g' | 'place_z_i_p_k_o' | 'platnosc_online_karta_platnicza' | 'posojilnica_bank_e_gen' | 'postova_banka' | 'public_bank' | 'raiffeisen_bankengruppe_osterreich' | 'rhb_bank' | 'schelhammer_capital_bank_ag' | 'standard_chartered_bank' | 'schoellerbank_ag' | 'sparda_bank_wien' | 'sporo_pay' | 'santander_przelew24' | 'tatra_pay' | 'viamo' | 'volksbank_gruppe' | 'volkskreditbank_ag' | 'vr_bank_braunau' | 'uob_bank' | 'pay_with_alior_bank' | 'banki_spoldzielcze' | 'pay_with_inteligo' | 'b_n_p_paribas_poland' | 'bank_nowy_s_a' | 'credit_agricole' | 'pay_with_b_o_s' | 'pay_with_citi_handlowy' | 'pay_with_plus_bank' | 'toyota_bank' | 'velo_bank' | 'e_transfer_pocztowy24' | 'plus_bank' | 'etransfer_pocztowy24' | 'banki_spbdzielcze' | 'bank_nowy_bfg_sa' | 'getin_bank' | 'blik' | 'noble_pay' | 'idea_bank' | 'envelo_bank' | 'nest_przelew' | 'mbank_mtransfer' | 'inteligo' | 'pbac_z_ipko' | 'bnp_paribas' | 'bank_pekao_sa' | 'volkswagen_bank' | 'alior_bank' | 'boz' | 'bangkok_bank' | 'krungsri_bank' | 'krung_thai_bank' | 'the_siam_commercial_bank' | 'kasikorn_bank' | 'open_bank_success' | 'open_bank_failure' | 'open_bank_cancelled' | 'aib' | 'bank_of_scotland' | 'danske_bank' | 'first_direct' | 'first_trust' | 'halifax' | 'lloyds' | 'monzo' | 'nat_west' | 'nationwide_bank' | 'royal_bank_of_scotland' | 'starling' | 'tsb_bank' | 'tesco_bank' | 'ulster_bank' | 'yoursafe' | 'n26' | 'nationale_nederlanden'; export type BankRedirectData = {bancontact_card: {card_number: string, card_exp_month: string, card_exp_year: string, card_holder_name: string, billing_details?: (BankRedirectBilling | null) | undefined}} | {bizum: Record} | {blik: {blik_code?: (string | null) | undefined}} | {eps: {billing_details?: (BankRedirectBilling | null) | undefined, bank_name: BankNames, country: CountryAlpha2}} | {giropay: {billing_details?: (BankRedirectBilling | null) | undefined, bank_account_bic?: (string | null) | undefined, bank_account_iban?: (string | null) | undefined, country: CountryAlpha2}} | {ideal: {billing_details?: (BankRedirectBilling | null) | undefined, bank_name: BankNames, country: CountryAlpha2}} | {interac: {country?: (CountryAlpha2 | null) | undefined, email?: (string | null) | undefined}} | {online_banking_czech_republic: {issuer: BankNames}} | {online_banking_finland: {email?: (string | null) | undefined}} | {online_banking_poland: {issuer: BankNames}} | {online_banking_slovakia: {issuer: BankNames}} | {open_banking_uk: {issuer: BankNames, country: CountryAlpha2}} | {przelewy24: {bank_name?: (BankNames | null) | undefined, billing_details?: (BankRedirectBilling | null) | undefined}} | {sofort: {billing_details?: (BankRedirectBilling | null) | undefined, country: CountryAlpha2, preferred_language?: (string | null) | undefined}} | {trustly: {country?: (CountryAlpha2 | null) | undefined}} | {online_banking_fpx: {issuer: BankNames}} | {online_banking_thailand: {issuer: BankNames}} | {local_bank_redirect: Record} | {eft: {provider: string}} | {open_banking: Record}; export type BankDebitBilling = {name?: (string | null) | undefined, email?: (string | null) | undefined, address?: (AddressDetails | null) | undefined}; export type BankType = 'checking' | 'savings'; export type BankDebitData = {ach_bank_debit: {billing_details?: (BankDebitBilling | null) | undefined, account_number: string, routing_number: string, bank_account_holder_name: string, bank_name: string, bank_type: string, bank_holder_type: string}} | {sepa_bank_debit: {billing_details?: (BankDebitBilling | null) | undefined, iban: string, bank_account_holder_name: string}} | {sepa_guarenteed_bank_debit: {billing_details?: (BankDebitBilling | null) | undefined, iban: string, bank_account_holder_name: string}} | {becs_bank_debit: {billing_details?: (BankDebitBilling | null) | undefined, account_number: string, bsb_number: string, bank_account_holder_name?: (string | null) | undefined}} | {bacs_bank_debit: {billing_details?: (BankDebitBilling | null) | undefined, account_number: string, sort_code: string, bank_account_holder_name: string}} | {eft_debit_order: {billing_details?: (BankDebitBilling | null) | undefined, account_number: string, branch_code?: (string | null) | undefined, bank_account_holder_name?: (string | null) | undefined, bank_name?: (BankNames | null) | undefined, bank_type?: (BankType | null) | undefined}}; export type AchBillingDetails = {email?: (string | null) | undefined}; export type SepaAndBacsBillingDetails = {email?: (string | null) | undefined, name?: (string | null) | undefined}; export type MultibancoBillingDetails = {email?: (string | null) | undefined}; export type DokuBillingDetails = {first_name?: (string | null) | undefined, last_name?: (string | null) | undefined, email?: (string | null) | undefined}; export type BankTransferData = {ach_bank_transfer: {billing_details?: (AchBillingDetails | null) | undefined}} | {sepa_bank_transfer: {billing_details?: (SepaAndBacsBillingDetails | null) | undefined, country: CountryAlpha2}} | {bacs_bank_transfer: {billing_details?: (SepaAndBacsBillingDetails | null) | undefined}} | {multibanco_bank_transfer: {billing_details?: (MultibancoBillingDetails | null) | undefined}} | {permata_bank_transfer: {billing_details?: (DokuBillingDetails | null) | undefined}} | {bca_bank_transfer: {billing_details?: (DokuBillingDetails | null) | undefined}} | {bni_va_bank_transfer: {billing_details?: (DokuBillingDetails | null) | undefined}} | {bri_va_bank_transfer: {billing_details?: (DokuBillingDetails | null) | undefined}} | {cimb_va_bank_transfer: {billing_details?: (DokuBillingDetails | null) | undefined}} | {danamon_va_bank_transfer: {billing_details?: (DokuBillingDetails | null) | undefined}} | {mandiri_va_bank_transfer: {billing_details?: (DokuBillingDetails | null) | undefined}} | {pix: {pix_key?: (string | null) | undefined, cpf?: (string | null) | undefined, cnpj?: (string | null) | undefined, source_bank_account_id?: (string | null) | undefined, destination_bank_account_id?: (string | null) | undefined, expiry_date?: (string | null) | undefined}} | {pix_emv: Record} | {pix_qr: Record} | {pix_automatico_qr: Record} | {pix_automatico_push: {account_number?: (string | null) | undefined, branch_code?: (string | null) | undefined, bank_identifier?: (string | null) | undefined}} | {pse: Record} | {local_bank_transfer: {bank_code?: (string | null) | undefined}} | {instant_bank_transfer: Record} | {instant_bank_transfer_finland: Record} | {instant_bank_transfer_poland: Record} | {indonesian_bank_transfer: {bank_name?: (BankNames | null) | undefined}}; export type RealTimePaymentData = {fps: Record} | {duit_now: Record} | {prompt_pay: Record} | {viet_qr: Record} | {qris: Record}; export type CryptoData = {pay_currency?: (string | null) | undefined, network?: (string | null) | undefined}; export type UpiSource = 'UPI_CC' | 'UPI_CL' | 'UPI_ACCOUNT' | 'UPI_CC_CL' | 'UPI_PPI' | 'UPI_VOUCHER'; export type UpiCollectData = {vpa_id?: (string | null) | undefined, upi_source?: (UpiSource | null) | undefined}; export type UpiIntentData = {upi_source?: (UpiSource | null) | undefined, app_name?: (string | null) | undefined}; export type UpiQrData = {upi_source?: (UpiSource | null) | undefined}; export type UpiData = {upi_collect: UpiCollectData} | {upi_intent: UpiIntentData} | {upi_qr: UpiQrData}; export type DocumentKind = 'cpf' | 'cnpj' | 'psn' | 'other'; export type BoletoVoucherData = {social_security_number?: (string | null) | undefined, bank_number?: (string | null) | undefined, document_type?: (DocumentKind | null) | undefined, fine_percentage?: (string | null) | undefined, fine_quantity_days?: (string | null) | undefined, interest_percentage?: (string | null) | undefined, write_off_quantity_days?: (string | null) | undefined, messages?: (Array | null) | undefined, due_date?: (string | null) | undefined}; export type AlfamartVoucherData = {first_name?: (string | null) | undefined, last_name?: (string | null) | undefined, email?: (string | null) | undefined}; export type IndomaretVoucherData = {first_name?: (string | null) | undefined, last_name?: (string | null) | undefined, email?: (string | null) | undefined}; export type JCSVoucherData = {first_name?: (string | null) | undefined, last_name?: (string | null) | undefined, email?: (string | null) | undefined, phone_number?: (string | null) | undefined}; export type VoucherData = {boleto: BoletoVoucherData} | 'efecty' | 'pago_efectivo' | 'red_compra' | 'red_pagos' | {alfamart: AlfamartVoucherData} | {indomaret: IndomaretVoucherData} | 'oxxo' | {seven_eleven: JCSVoucherData} | {lawson: JCSVoucherData} | {mini_stop: JCSVoucherData} | {family_mart: JCSVoucherData} | {seicomart: JCSVoucherData} | {pay_easy: JCSVoucherData}; export type GiftCardDetails = {number: string, cvc: string}; export type BHNGiftCardDetails = {account_number: string, pin: string, cvv2: string, expiration_date: string}; export type GiftCardData = {givex: GiftCardDetails} | {pay_safe_card: Record} | {bhn_card_network: BHNGiftCardDetails}; export type CardToken = {card_holder_name: string, card_cvc?: (string | null) | undefined, card_cvc_token?: (string | null) | undefined}; export type OpenBankingData = {open_banking_pis: Record}; export type MobilePaymentData = {direct_carrier_billing: {msisdn: string, client_uid?: (string | null) | undefined}}; export type NetworkTokenData = {network_token: string, token_exp_month: string, token_exp_year: string, token_cryptogram: string, card_network?: (CardNetwork | null) | undefined, card_type?: (string | null) | undefined, card_issuing_country?: (string | null) | undefined, bank_code?: (string | null) | undefined, card_holder_name: string, card_issuer?: (string | null) | undefined, nick_name?: (string | null) | undefined, eci?: (string | null) | undefined, par?: (string | null) | undefined}; export type EligibilityPaymentMethodDataRequest = {card: EligibilityCard, billing?: (Address | null) | undefined} | null | {card_redirect: CardRedirectData, billing?: (Address | null) | undefined} | null | {wallet: WalletData, billing?: (Address | null) | undefined} | null | {pay_later: PayLaterData, billing?: (Address | null) | undefined} | null | {bank_redirect: BankRedirectData, billing?: (Address | null) | undefined} | null | {bank_debit: BankDebitData, billing?: (Address | null) | undefined} | null | {bank_transfer: BankTransferData, billing?: (Address | null) | undefined} | null | {real_time_payment: RealTimePaymentData, billing?: (Address | null) | undefined} | null | {crypto: CryptoData, billing?: (Address | null) | undefined} | null | {upi: UpiData, billing?: (Address | null) | undefined} | null | {voucher: VoucherData, billing?: (Address | null) | undefined} | null | {gift_card: GiftCardData, billing?: (Address | null) | undefined} | null | {card_token: CardToken, billing?: (Address | null) | undefined} | null | {open_banking: OpenBankingData, billing?: (Address | null) | undefined} | null | {mobile_payment: MobilePaymentData, billing?: (Address | null) | undefined} | null | {network_token: NetworkTokenData, billing?: (Address | null) | undefined} | null; export type BrowserInformation = {color_depth?: (number | null) | undefined, java_enabled?: (boolean | null) | undefined, java_script_enabled?: (boolean | null) | undefined, language?: (string | null) | undefined, screen_height?: (number | null) | undefined, screen_width?: (number | null) | undefined, time_zone?: (number | null) | undefined, ip_address?: (string | null) | undefined, accept_header?: (string | null) | undefined, user_agent?: (string | null) | undefined, os_type?: (string | null) | undefined, os_version?: (string | null) | undefined, device_model?: (string | null) | undefined, accept_language?: (string | null) | undefined, referer?: (string | null) | undefined}; export type PaymentsEligibilityRequest = {client_secret: string, payment_method_type: PaymentMethod, payment_method_subtype?: (PaymentMethodType | null) | undefined, payment_method_data?: (EligibilityPaymentMethodDataRequest | null) | undefined, browser_info?: (BrowserInformation | null) | undefined, payment_token: string}; export type CreateApiPaymentsPaymentIdEligibilityArgs = {payment_id: string, body: PaymentsEligibilityRequest}; export type CreateApiPaymentsPaymentIdEligibilityOptions = {baseUrl: string, publishableKey?: string | undefined, fetch?: typeof fetch | undefined}; export const nextActionCall = z.union([z.literal("post_session_tokens"), z.literal("confirm"), z.literal("sync"), z.literal("complete_authorize"), z.literal("await_merchant_callback"), z.object({deny: z.object({message: z.string()})}), z.literal("eligibility_check")]); export const sdkNextAction = z.object({next_action: nextActionCall, should_block_confirm: z.boolean().nullable().optional()}); export const minorUnit = z.number().int(); export const surchargePercentage = z.object({percentage: z.number()}); export const surchargeResponse = z.discriminatedUnion("type", [z.object({type: z.literal("fixed"), value: minorUnit}), z.object({type: z.literal("rate"), value: surchargePercentage})]); export const surchargeDetailsResponse = z.object({surcharge: surchargeResponse, tax_on_surcharge: surchargePercentage.nullable().optional(), display_surcharge_amount: z.number(), display_tax_on_surcharge_amount: z.number(), display_total_surcharge_amount: z.number()}); export const paymentsEligibilityResponse = z.object({payment_id: z.string(), sdk_next_action: sdkNextAction, surcharge_details: surchargeDetailsResponse.nullable().optional()}); export const validateResponse = async ( schema: { readonly '~standard': { readonly validate: (value: unknown) => ({ readonly value: Output; readonly issues?: undefined } | { readonly issues: ReadonlyArray<{ readonly message: string; readonly path?: ReadonlyArray | undefined }> }) | Promise<{ readonly value: Output; readonly issues?: undefined } | { readonly issues: ReadonlyArray<{ readonly message: string; readonly path?: ReadonlyArray | undefined }> }> } }, value: unknown ): Promise => { const result = await schema['~standard'].validate(value) if (result.issues !== undefined) { const detail = result.issues .map(({ message, path }) => path?.length ? `${path.map((segment) => String(typeof segment === 'object' ? segment.key : segment)).join('.')}: ${message}` : message ) .join('; ') throw new Error(`Response does not match the schema: ${detail}`, { cause: { issues: result.issues } }) } return result.value }; /** * Payments - Submit Eligibility Data * * POST /payments/{payment_id}/eligibility */ export const createApiPaymentsPaymentIdEligibility = async (args: CreateApiPaymentsPaymentIdEligibilityArgs, options: CreateApiPaymentsPaymentIdEligibilityOptions) => { const {baseUrl, fetch: fetchFn = fetch, publishableKey} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('content-type', "application/json") headers.set('accept', "application/json") if (publishableKey !== undefined) headers.set("api-key", publishableKey) const url = `${baseUrl.replace(/\/+$/, '')}/payments/${encodeURIComponent(String(args.payment_id))}/eligibility${query.size > 0 ? `?${query}` : ''}` const res = await fetchFn(url, {method: "POST", headers, body: JSON.stringify(args.body)}) if (!res.ok) throw new Error(`Request failed with status ${res.status}`, {cause: {status: res.status, body: await res.text()}}) return validateResponse(paymentsEligibilityResponse, await res.json()) };