import {z} from 'zod' export type PaymentSetupPresentmentDetails = {amount?: number | undefined, currency?: string | undefined}; export type PaymentMethodStatus = 'unavailable' | 'action_required' | 'ready' | 'initialization_required' | 'invalid'; export type PaymentMethodFlags = Array; export type PaymentSetupInstrument = {status?: PaymentMethodStatus | undefined, flags?: PaymentMethodFlags | undefined, id?: string | undefined, type?: string | undefined, action?: ({type?: 'set_instrument' | undefined}) | undefined}; export type KlarnaAccountHolder = {name?: string | undefined}; export type Klarna = {status?: PaymentMethodStatus | undefined, flags?: PaymentMethodFlags | undefined, initialization?: ('disabled' | 'enabled') | undefined, action?: ({type?: 'sdk' | undefined, client_token?: string | undefined, session_id?: string | undefined}) | undefined, account_holder?: KlarnaAccountHolder | undefined, iban?: string | undefined}; export type StcPay = {status?: PaymentMethodStatus | undefined, flags?: PaymentMethodFlags | undefined, initialization?: ('disabled' | 'enabled') | undefined, otp?: string | undefined, action?: ({type?: 'otp' | undefined}) | undefined}; export type Tabby = {status?: PaymentMethodStatus | undefined, flags?: PaymentMethodFlags | undefined, initialization?: ('disabled' | 'enabled') | undefined, payment_types?: Array | undefined}; export type Bizum = {status?: PaymentMethodStatus | undefined, flags?: PaymentMethodFlags | undefined}; export type PayNow = {status?: PaymentMethodStatus | undefined, flags?: PaymentMethodFlags | undefined}; export type Qpay = {status?: PaymentMethodStatus | undefined, flags?: PaymentMethodFlags | undefined, national_id?: string | undefined, description?: string | undefined}; export type Eps = {status?: PaymentMethodStatus | undefined, flags?: PaymentMethodFlags | undefined}; export type Ideal = {status?: PaymentMethodStatus | undefined, flags?: PaymentMethodFlags | undefined, description?: string | undefined}; export type Knet = {status?: PaymentMethodStatus | undefined, flags?: PaymentMethodFlags | undefined, language?: ('en' | 'ar') | undefined}; export type Bancontact = {status?: PaymentMethodStatus | undefined, flags?: PaymentMethodFlags | undefined, account_holder_name?: string | undefined}; export type Benefit = {status?: PaymentMethodStatus | undefined, flags?: PaymentMethodFlags | undefined}; export type Blik = {status?: PaymentMethodStatus | undefined, flags?: PaymentMethodFlags | undefined, partner_code?: string | undefined}; export type Vipps = {status?: PaymentMethodStatus | undefined, flags?: PaymentMethodFlags | undefined}; export type Twint = {status?: PaymentMethodStatus | undefined, flags?: PaymentMethodFlags | undefined}; export type TerminalType = 'web' | 'wap' | 'app'; export type OsType = 'android' | 'ios'; export type AlipayCn = {status?: PaymentMethodStatus | undefined, flags?: PaymentMethodFlags | undefined, terminal_type?: TerminalType | undefined, os_type?: OsType | undefined}; export type AlipayHK = {status?: PaymentMethodStatus | undefined, flags?: PaymentMethodFlags | undefined, terminal_type?: TerminalType | undefined, os_type?: OsType | undefined}; export type GCash = {status?: PaymentMethodStatus | undefined, flags?: PaymentMethodFlags | undefined, terminal_type?: TerminalType | undefined, os_type?: OsType | undefined}; export type Tng = {status?: PaymentMethodStatus | undefined, flags?: PaymentMethodFlags | undefined, terminal_type?: TerminalType | undefined, os_type?: OsType | undefined}; export type Dana = {status?: PaymentMethodStatus | undefined, flags?: PaymentMethodFlags | undefined, terminal_type?: TerminalType | undefined, os_type?: OsType | undefined}; export type MobilePay = {status?: PaymentMethodStatus | undefined, flags?: PaymentMethodFlags | undefined}; export type Tamara = {status?: PaymentMethodStatus | undefined, flags?: PaymentMethodFlags | undefined, initialization?: ('disabled' | 'enabled') | undefined, risk_assessment?: ({premium_customer?: boolean | undefined, risk_score?: number | undefined, order_count_last24h?: number | undefined, linked_device_count?: number | undefined}) | undefined}; export type MBWay = {status?: PaymentMethodStatus | undefined, flags?: PaymentMethodFlags | undefined}; export type Multibanco = {status?: PaymentMethodStatus | undefined, flags?: PaymentMethodFlags | undefined, account_holder_name?: string | undefined}; export type WeChatPay = {status?: PaymentMethodStatus | undefined, flags?: PaymentMethodFlags | undefined}; export type KakaoPay = {status?: PaymentMethodStatus | undefined, flags?: PaymentMethodFlags | undefined, terminal_type?: TerminalType | undefined, os_type?: OsType | undefined}; export type TrueMoney = {status?: PaymentMethodStatus | undefined, flags?: PaymentMethodFlags | undefined, terminal_type?: TerminalType | undefined, os_type?: OsType | undefined}; export type Octopus = {status?: PaymentMethodStatus | undefined, flags?: PaymentMethodFlags | undefined}; export type P24 = {status?: PaymentMethodStatus | undefined, flags?: PaymentMethodFlags | undefined, account_holder?: ({name?: string | undefined, email?: string | undefined}) | undefined}; export type Alma = {status?: PaymentMethodStatus | undefined, flags?: PaymentMethodFlags | undefined}; export type Swish = {status?: PaymentMethodStatus | undefined, flags?: PaymentMethodFlags | undefined, billing_descriptor?: string | undefined, account_holder?: ({first_name?: string | undefined, last_name?: string | undefined}) | undefined}; export type Sequra = {status?: PaymentMethodStatus | undefined, flags?: PaymentMethodFlags | undefined}; export type Ach = {status?: PaymentMethodStatus | undefined, flags?: PaymentMethodFlags | undefined, account_type?: ('savings' | 'current' | 'cash') | undefined, account_holder?: ({type?: ('individual' | 'corporate' | 'government') | undefined, first_name?: string | undefined, last_name?: string | undefined, company_name?: string | undefined, date_of_birth?: string | undefined, identification?: ({type?: string | undefined, issuing_country?: string | undefined, number?: string | undefined}) | undefined}) | undefined, account_number?: string | undefined, bank_code?: string | undefined, country?: string | undefined}; export type Sepa = {status?: PaymentMethodStatus | undefined, flags?: PaymentMethodFlags | undefined, account_holder?: ({type?: ('individual' | 'corporate') | undefined, first_name?: string | undefined, last_name?: string | undefined, company_name?: string | undefined}) | undefined, account_number?: string | undefined, country?: string | undefined, currency?: string | undefined, mandate?: ({id?: string | undefined, type?: ('core' | 'b2b') | undefined, date_of_signature?: string | undefined}) | undefined}; export type Bacs = {status?: PaymentMethodStatus | undefined, flags?: PaymentMethodFlags | undefined, initialization?: ('disabled' | 'enabled') | undefined, instrument_id?: string | undefined, account_holder?: ({type?: ('individual' | 'corporate') | undefined, first_name?: string | undefined, last_name?: string | undefined, company_name?: string | undefined, email?: string | undefined}) | undefined, account_number?: string | undefined, bank_code?: string | undefined, country?: string | undefined, currency?: string | undefined, allow_partial_match?: boolean | undefined}; export type PayByBank = {status?: PaymentMethodStatus | undefined, flags?: PaymentMethodFlags | undefined, bank_id?: string | undefined, action?: ({type?: 'select_bank' | undefined, banks?: (Array<{bank_id?: string | undefined, display_name?: string | undefined, logo_url?: string | undefined, available?: boolean | undefined}>) | undefined}) | undefined}; export type PayPal = {status?: PaymentMethodStatus | undefined, flags?: PaymentMethodFlags | undefined, initialization?: ('disabled' | 'enabled') | undefined, user_action?: ('pay_now' | 'continue') | undefined, brand_name?: string | undefined, shipping_preference?: ('no_shipping' | 'get_from_file' | 'set_provided_address') | undefined, action?: ({type?: 'sdk' | undefined, order_id?: string | undefined}) | undefined}; export type CashApp = {status?: PaymentMethodStatus | undefined, flags?: PaymentMethodFlags | undefined, initialization?: ('disabled' | 'enabled') | undefined, customer_profile_sharing?: boolean | undefined, customer_profile?: ({customer_id?: string | undefined, cashtag?: string | undefined, reference_id?: string | undefined, full_name?: string | undefined, given_name?: string | undefined, middle_name?: string | undefined, family_name?: string | undefined, suffix?: string | undefined, birth_date?: string | undefined, address?: ({address_line_1?: string | undefined, address_line_2?: string | undefined, address_line_3?: string | undefined, locality?: string | undefined, sublocality?: string | undefined, administrative_district_level_1?: string | undefined, postal_code?: string | undefined, country?: string | undefined}) | undefined, phone_number?: string | undefined, email_address?: string | undefined, customer_since?: string | undefined}) | undefined, reference?: string | undefined, action?: ({type?: 'redirect' | undefined, redirect_url?: string | undefined}) | undefined}; export type PaymentSetupNetworkToken = {number: string, expiry_month: number, expiry_year: number, cryptogram?: string | undefined, eci?: string | undefined}; export type PaymentSetupPhone = {country_code?: string | undefined, number?: string | undefined}; export type PaymentSetupAccountHolder = {type?: ('individual' | 'government' | 'corporate') | undefined, first_name?: string | undefined, last_name?: string | undefined, middle_name?: string | undefined, company_name?: string | undefined, account_name_inquiry?: boolean | undefined}; export type GooglePay = {status?: PaymentMethodStatus | undefined, flags?: PaymentMethodFlags | undefined, token_data?: ({protocol_version?: string | undefined, signature?: string | undefined, signed_message?: string | undefined, tokenization_key?: string | undefined}) | undefined, token?: ({id: string, expires_on?: string | undefined}) | undefined, network_token?: PaymentSetupNetworkToken | undefined, store_for_future_use?: boolean | undefined, phone?: PaymentSetupPhone | undefined, account_holder?: PaymentSetupAccountHolder | undefined, schemes?: (Array<'accel' | 'amex' | 'china_union_pay' | 'diners' | 'discover' | 'jcb' | 'mada' | 'maestro' | 'mastercard' | 'nyce' | 'omannet' | 'pulse' | 'shazam' | 'star' | 'upi' | 'visa'>) | undefined, preferred_scheme?: ('visa' | 'mastercard') | undefined}; export type ApplePay = {status?: PaymentMethodStatus | undefined, flags?: PaymentMethodFlags | undefined, token_data?: ({version?: string | undefined, data?: string | undefined, signature?: string | undefined, header?: ({ephemeral_public_key?: string | undefined, public_key_hash?: string | undefined, transaction_id?: string | undefined}) | undefined}) | undefined, token?: ({id: string, expires_on?: string | undefined}) | undefined, network_token?: PaymentSetupNetworkToken | undefined, store_for_future_use?: boolean | undefined, phone?: PaymentSetupPhone | undefined, account_holder?: PaymentSetupAccountHolder | undefined, schemes?: (Array<'accel' | 'amex' | 'cartes_bancaires' | 'china_union_pay' | 'diners' | 'discover' | 'jcb' | 'mada' | 'maestro' | 'mastercard' | 'nyce' | 'omannet' | 'pulse' | 'shazam' | 'star' | 'upi' | 'visa'>) | undefined, preferred_scheme?: ('visa' | 'mastercard' | 'cartes_bancaires') | undefined}; export type Card = {status?: PaymentMethodStatus | undefined, flags?: PaymentMethodFlags | undefined, token?: ({id?: string | undefined}) | undefined, details?: ({number?: string | undefined, last4?: string | undefined, bin?: string | undefined, scheme?: string | undefined, expiry_month?: number | undefined, expiry_year?: number | undefined, name?: string | undefined, cvv?: string | undefined, stored?: boolean | undefined, expires_on?: string | undefined, allow_update?: boolean | undefined}) | undefined, store_for_future_use?: boolean | undefined, phone?: PaymentSetupPhone | undefined, account_holder?: PaymentSetupAccountHolder | undefined, schemes?: (Array<'accel' | 'amex' | 'cartes_bancaires' | 'china_union_pay' | 'diners' | 'discover' | 'jcb' | 'mada' | 'maestro' | 'mastercard' | 'nyce' | 'omannet' | 'pulse' | 'shazam' | 'star' | 'upi' | 'visa'>) | undefined, preferred_scheme?: ('visa' | 'mastercard' | 'cartes_bancaires') | undefined}; export type Stablecoin = {status?: PaymentMethodStatus | undefined, flags?: PaymentMethodFlags | undefined}; export type PaymentSetupMerchantAccount = {id?: string | undefined, registration_date?: string | undefined, last_modified?: string | undefined, returning_customer?: boolean | undefined, first_transaction_date?: string | undefined, last_transaction_date?: string | undefined, total_order_count?: number | undefined, last_payment_amount?: number | undefined}; export type OrderItem = {name?: string | undefined, quantity?: number | undefined, unit_price?: number | undefined, total_amount?: number | undefined, reference?: string | undefined, discount_amount?: number | undefined, url?: string | undefined, image_url?: string | undefined, type?: string | undefined, category?: string | undefined}; export type PaymentSetupAddress = {address_line1?: string | undefined, address_line2?: string | undefined, city?: string | undefined, state?: string | undefined, zip?: string | undefined, country?: string | undefined}; export type PaymentSetupShipping = {first_name?: string | undefined, last_name?: string | undefined, email?: string | undefined, phone?: PaymentSetupPhone | undefined, address?: PaymentSetupAddress | undefined, method?: string | undefined, delay?: number | undefined}; export type PaymentSetupSubMerchant = {id?: string | undefined, product_category?: string | undefined, number_of_sales?: number | undefined, registration_date?: string | undefined}; export type PaymentSetupAmountAllocation = {id: string, amount: number, reference?: string | undefined, commission?: ({amount?: number | undefined, percentage?: number | undefined}) | undefined}; export type PaymentSetupBilling = {address?: PaymentSetupAddress | undefined}; export type PaymentSetupFlightLegDetails = {flight_number?: string | undefined, carrier_code?: string | undefined, class_of_travelling?: string | undefined, departure_airport?: string | undefined, departure_date?: string | undefined, departure_time?: string | undefined, arrival_airport?: string | undefined, stop_over_code?: string | undefined, fare_basis_code?: string | undefined}; export type PaymentSetupAirline = {ticket?: ({number?: string | undefined, issue_date?: string | undefined, issuing_carrier_code?: string | undefined, travel_package_indicator?: string | undefined, travel_agency_name?: string | undefined, travel_agency_code?: string | undefined}) | undefined, passengers?: (Array<{first_name?: string | undefined, last_name?: string | undefined, date_of_birth?: string | undefined, address?: ({country?: string | undefined}) | undefined}>) | undefined, flight_leg_details?: Array | undefined, total_number_of_passengers?: number | undefined, travel_type?: string | undefined, trip_type?: string | undefined, refundable?: boolean | undefined, delivery_recipient?: string | undefined, ancillaries?: string | undefined, insurance?: ({type?: string | undefined, company?: string | undefined, price?: ({amount?: number | undefined, currency?: string | undefined}) | undefined}) | undefined}; export type PaymentSetupAccommodation = {name?: string | undefined, booking_reference?: string | undefined, check_in_date?: string | undefined, check_out_date?: string | undefined, address?: ({address_line1?: string | undefined, city?: string | undefined, state?: string | undefined, country?: string | undefined, zip?: string | undefined}) | undefined, number_of_rooms?: number | undefined, guests?: (Array<{first_name?: string | undefined, last_name?: string | undefined, date_of_birth?: string | undefined}>) | undefined, room?: (Array<{rate?: number | undefined, number_of_nights?: number | undefined, type?: string | undefined}>) | undefined, total_number_of_guests?: number | undefined, refundable?: boolean | undefined, delivery_recipient?: string | undefined, host?: ({registration_date?: string | undefined, total_reservation_count?: number | undefined}) | undefined}; export type PaymentSetupAccountFundingTransaction = {enabled?: boolean | undefined, purpose?: ('donations' | 'education' | 'emergency_need' | 'expatriation' | 'family_support' | 'financial_services' | 'gifts' | 'income' | 'insurance' | 'investment' | 'it_services' | 'leisure' | 'loan_payment' | 'medical_treatment' | 'other' | 'pension' | 'royalties' | 'savings' | 'travel_and_tourism') | undefined, sender?: ({date_of_birth?: string | undefined, reference?: string | undefined, identification?: ({type?: ('passport' | 'driving_license' | 'national_id') | undefined, number?: string | undefined, issuing_country?: string | undefined}) | undefined}) | undefined, recipient?: ({date_of_birth?: string | undefined, account_number?: string | undefined, first_name?: string | undefined, last_name?: string | undefined, address?: PaymentSetupAddress | undefined}) | undefined}; export type PaymentSetupTerminal = {id?: string | undefined, local_date_time?: string | undefined}; export type PaymentSetupBillingDescriptor = {name?: string | undefined, city?: string | undefined, reference?: string | undefined}; export type PaymentId = string; export type ServerTimestamp = string; export type Address = {address_line1?: string | undefined, address_line2?: string | undefined, city?: string | undefined, state?: string | undefined, zip?: string | undefined, country?: string | undefined}; export type PhoneNumber = {country_code?: string | undefined, number?: string | undefined}; export type PaymentResponseAchAccountHolder = {account_name_inquiry?: ('full_match' | 'partial_match' | 'no_match' | 'not_performed') | undefined, account_name_inquiry_details?: ({description?: string | undefined}) | undefined}; export type AccountHolderEps = {first_name: string, last_name: string}; export type PaymentDetailsResponseSource = {type: 'card', id?: string | undefined, billing_address?: Address | undefined, phone?: PhoneNumber | undefined, expiry_month: number, expiry_year: number, name?: string | undefined, scheme?: string | undefined, scheme_local?: string | undefined, local_schemes?: Array | undefined, last4: string, fingerprint: string, bin: string, card_type?: ('CREDIT' | 'DEBIT' | 'PREPAID' | 'CHARGE' | 'DEFERRED DEBIT') | undefined, card_category?: ('CONSUMER' | 'COMMERCIAL') | undefined, card_wallet_type?: ('applepay' | 'googlepay') | undefined, issuer?: string | undefined, issuer_country?: string | undefined, product_id?: string | undefined, product_type?: string | undefined, avs_check?: string | undefined, cvv_check?: string | undefined, payment_account_reference?: string | undefined, encrypted_card_number?: string | undefined, account_update_status?: ('card_updated' | 'card_expiry_updated' | 'card_closed' | 'contact_cardholder') | undefined, account_update_failure_code?: string | undefined, account_holder?: Record | undefined} | {type: 'ach', id: string, account_holder?: PaymentResponseAchAccountHolder | undefined} | {type: 'alma'} | {type: 'bancontact', iban?: string | undefined, bic?: string | undefined} | {type: 'blik', id?: string | undefined} | {type: 'currency_account', id: string, amount?: number | undefined} | {type: 'eps', purpose?: string | undefined, bic?: string | undefined, iban?: string | undefined, account_holder_name?: string | undefined, account_holder?: AccountHolderEps | undefined} | {type: 'ideal', account_holder?: string | undefined, account_holder_name?: string | undefined, bic?: string | undefined, description?: string | undefined, iban?: string | undefined} | {type: 'klarna', account_holder?: ({first_name?: string | undefined, last_name?: string | undefined, billing_address?: ({address_line1?: string | undefined, address_line2?: string | undefined, city: string, zip: string, country: string}) | undefined, email?: string | undefined, date_of_birth?: string | undefined, account_holder_name?: string | undefined, iban?: string | undefined, account_number?: string | undefined, bank_code?: string | undefined, bank_name?: string | undefined, bic?: string | undefined, gender?: string | undefined, phone?: ({country_code?: string | undefined, number?: string | undefined}) | undefined}) | undefined} | {type: 'knet', language?: ('ar' | 'en') | undefined, user_defined_field1?: string | undefined, user_defined_field2?: string | undefined, user_defined_field3?: string | undefined, user_defined_field4?: string | undefined, user_defined_field5?: string | undefined, card_token?: string | undefined, ptlf?: string | undefined, knet_payment_id?: string | undefined, knet_result?: string | undefined, inquiry_result?: string | undefined, bank_reference?: string | undefined, knet_transaction_id?: string | undefined, auth_code?: string | undefined, auth_response_code?: string | undefined, post_date?: string | undefined, avr?: string | undefined, error?: string | undefined, error_text?: string | undefined} | {type: 'multibanco', payment_reference?: string | undefined, service_supplier_id?: string | undefined} | {type: 'p24', p24_descriptor?: string | undefined} | {type: 'paypal', account_holder?: ({email?: string | undefined, full_name?: string | undefined}) | undefined} | {type: 'qpay', description: string, qpay_status?: string | undefined, status_message?: string | undefined, confirmation_id?: string | undefined, pun: string} | {type: 'sepa', id: string} | {type: 'bacs', id: string} | {type: 'swish'} | {type: 'sequra'} | {type: 'tamara'}; export type PaymentResponseDestination = {type: 'bank_account', id: string}; export type PaymentResponseBalances = {total_authorized?: number | undefined, total_voided?: number | undefined, available_to_void?: number | undefined, total_captured?: number | undefined, available_to_capture?: number | undefined, total_refunded?: number | undefined, available_to_refund?: number | undefined}; export type ResponseCode = 'Y' | 'N' | 'U' | 'A' | 'C' | 'D' | 'R' | 'I'; export type TrustedListing = {status?: ('Y' | 'N' | 'E' | 'P' | 'R' | 'U') | undefined, source?: string | undefined}; export type Type3dsData = {downgraded?: boolean | undefined, enrolled?: string | undefined, signature_valid?: string | undefined, authentication_response?: ResponseCode | undefined, authentication_status_reason?: string | undefined, cryptogram?: string | undefined, xid?: string | undefined, eci?: string | undefined, version?: string | undefined, exemption?: ('3ds_outage' | 'data_share' | 'low_risk_program' | 'low_value' | 'none' | 'other' | 'out_of_sca_scope' | 'sca_delegation' | 'secure_corporate_payment' | 'transaction_risk_assessment' | 'trusted_listing' | 'trusted_listing_prompt') | undefined, exemption_applied?: string | undefined, challenged?: boolean | undefined, upgrade_reason?: string | undefined, trusted_listing?: TrustedListing | undefined}; export type PaymentAuthenticationData = {experience?: ('google_spa' | '3ds') | undefined}; export type CustomerSummary = {registration_date?: string | undefined, first_transaction_date?: string | undefined, last_payment_date?: string | undefined, total_order_count?: number | undefined, last_payment_amount?: number | undefined, is_premium_customer?: boolean | undefined, is_returning_customer?: boolean | undefined, lifetime_value?: number | undefined}; export type LocalBillingDescriptor = {name: string, character_set: 'kanji' | 'katakana'}; export type BillingDescriptor = {name: string, city: string, reference?: string | undefined, local_descriptors?: (Array | null) | undefined}; export type IPAddress = string; export type PaymentDetailsResponseSender = {type: 'individual' | 'corporate' | 'instrument', reference?: string | undefined, first_name: string, last_name: string, address: Address} | {type: 'individual' | 'corporate' | 'instrument', reference?: string | undefined, company_name: string, address?: Address | undefined} | {type: 'individual' | 'corporate' | 'instrument', reference?: string | undefined}; export type AmountAllocations = Array<{id: string, amount: number, reference?: string | undefined, commission?: ({amount?: number | undefined, percentage?: number | undefined}) | undefined}>; export type PaymentRecipient = {dob?: string | undefined, account_number?: string | undefined, address?: Address | undefined, zip?: string | undefined, first_name?: string | undefined, last_name?: string | undefined}; export type AirlineData = Array<{ticket?: ({number?: string | undefined, issue_date?: string | undefined, issuing_carrier_code?: string | undefined, travel_package_indicator?: string | undefined, travel_agency_name?: string | undefined, travel_agency_code?: string | undefined}) | undefined, passenger?: (Array<{first_name?: string | undefined, last_name?: string | undefined, date_of_birth?: string | undefined, address?: ({country?: string | undefined}) | undefined}>) | undefined, flight_leg_details?: (Array<{flight_number?: string | undefined, carrier_code?: string | undefined, class_of_travelling?: string | undefined, departure_airport?: string | undefined, departure_date?: string | undefined, departure_time?: string | undefined, arrival_airport?: string | undefined, stop_over_code?: string | undefined, fare_basis_code?: string | undefined}>) | undefined}>; export type AccommodationData = Array<{name?: string | undefined, booking_reference?: string | undefined, check_in_date?: string | undefined, check_out_date?: string | undefined, address?: ({address_line1?: string | undefined, zip?: string | undefined}) | undefined, state?: string | undefined, country?: string | undefined, city?: string | undefined, number_of_rooms?: number | undefined, guests?: (Array<{first_name?: string | undefined, last_name?: string | undefined, date_of_birth?: string | undefined}>) | undefined, room?: (Array<{rate?: string | undefined, number_of_nights_at_room_rate?: string | undefined}>) | undefined, property_phone?: (Array<{country_code?: string | undefined, number?: string | undefined}>) | undefined, customer_service_phone?: (Array<{country_code?: string | undefined, number?: string | undefined}>) | undefined}>; export type ProcessingData = {preferred_scheme?: ('mastercard' | 'visa' | 'cartes_bancaires' | 'accel' | 'discover' | 'eftpos' | 'maestro' | 'nyce' | 'pulse' | 'star') | undefined, app_id?: string | undefined, airline_data?: AirlineData | undefined, accommodation_data?: AccommodationData | undefined, partner_customer_id?: string | undefined, partner_payment_id?: string | undefined, partner_code?: string | undefined, failure_code?: string | undefined, partner_response_code?: string | undefined, tax_amount?: number | undefined, locale?: string | undefined, retrieval_reference_number?: string | undefined, partner_order_id?: string | undefined, partner_status?: string | undefined, partner_transaction_id?: string | undefined, partner_error_codes?: Array | undefined, partner_merchant_advice_code?: string | undefined, partner_error_message?: string | undefined, partner_authorization_code?: string | undefined, partner_authorization_response_code?: string | undefined, partner_fraud_status?: string | undefined, pan_type_processed?: ('fpan' | 'dpan') | undefined, fallback_source_used?: boolean | undefined, custom_payment_method_ids?: Array | undefined, aft?: boolean | undefined, merchant_category_code?: string | undefined, scheme_merchant_id?: string | undefined, scheme?: string | undefined, scheme_transaction_link_id?: string | undefined}; export type Items = Array<{type?: ('digital' | 'discount' | 'physical') | undefined, sub_type?: ('blockchain' | 'cbdc' | 'cryptocurrency' | 'nft' | 'stablecoin') | undefined, name?: string | undefined, quantity?: number | undefined, unit_price?: number | undefined, reference?: string | undefined, commodity_code?: string | undefined, unit_of_measure?: string | undefined, total_amount?: number | undefined, tax_rate?: number | undefined, tax_amount?: number | undefined, tax_exempt?: boolean | undefined, discount_amount?: number | undefined, wxpay_goods_id?: string | undefined, url?: string | undefined, image_url?: string | undefined, service_ends_on?: string | undefined, purchase_country?: string | undefined, foreign_retailer_amount?: number | undefined}>; export type ActionId = string; export type PaymentActionSummary = {id: ActionId, type: 'Authorization' | 'Card Verification' | 'Void' | 'Capture' | 'Refund', response_code: string, response_summary?: string | undefined}; export type Timestamp = string; export type RetryGetResponse = {enabled: boolean, attempts_made?: number | undefined, max_attempts?: number | undefined, ends_on?: Timestamp | undefined, next_attempt_on?: Timestamp | undefined}; export type Link = {href: string}; export type PaymentDetails = {id: PaymentId, requested_on: ServerTimestamp, source?: PaymentDetailsResponseSource | undefined, destination?: PaymentResponseDestination | undefined, amount: number, amount_requested?: number | undefined, currency: string, payment_type?: ('Regular' | 'Recurring' | 'MOTO' | 'Installment' | 'PayLater' | 'Unscheduled') | undefined, payment_plan?: ({amount_variability?: ('Fixed' | 'Variable') | undefined, days_between_payments?: number | undefined, total_number_of_payments?: number | undefined, current_payment_number?: number | undefined, expiry?: string | undefined, name?: string | undefined, start_date?: string | undefined, amount?: number | undefined} | {financing?: boolean | undefined, days_between_payments?: number | undefined, total_number_of_payments?: number | undefined, current_payment_number?: number | undefined, expiry?: string | undefined, name?: string | undefined, start_date?: string | undefined, amount?: number | undefined}) | undefined, reference?: string | undefined, description?: string | undefined, approved: boolean, expires_on?: string | undefined, status: 'Pending' | 'Authorized' | 'Card Verified' | 'Voided' | 'Partially Captured' | 'Captured' | 'Partially Refunded' | 'Refunded' | 'Declined' | 'Canceled' | 'Expired' | 'Paid' | 'Retry Scheduled', balances?: PaymentResponseBalances | undefined, '3ds'?: Type3dsData | undefined, authentication?: PaymentAuthenticationData | undefined, risk?: ({flagged?: boolean | undefined, score?: number | undefined}) | undefined, customer?: ({id: string, email?: string | undefined, name?: string | undefined, summary?: CustomerSummary | undefined}) | undefined, billing_descriptor?: BillingDescriptor | undefined, shipping?: ({address?: Address | undefined, phone?: PhoneNumber | undefined}) | undefined, payment_ip?: IPAddress | undefined, sender?: PaymentDetailsResponseSender | undefined, amount_allocations?: AmountAllocations | undefined, recipient?: PaymentRecipient | undefined, processing?: ProcessingData | undefined, items?: Items | undefined, metadata?: Record | undefined, eci?: string | undefined, scheme_id?: string | undefined, actions?: Array | undefined, retry?: RetryGetResponse | undefined, cko_network_token_available?: boolean | undefined, instruction?: ({purpose?: string | undefined}) | undefined, _links: {self: Link, actions: Link, authorize?: Link | undefined, void?: Link | undefined, capture?: Link | undefined, refund?: Link | undefined}}; export type PaymentSetup = {id?: string | undefined, processing_channel_id: string, amount: number, currency: string, presentment_details?: PaymentSetupPresentmentDetails | undefined, payment_type?: ('regular' | 'recurring' | 'moto' | 'installment' | 'pay_later' | 'unscheduled') | undefined, reference?: string | undefined, description?: string | undefined, payment_methods?: ({auto_confirm?: string | undefined, instrument?: PaymentSetupInstrument | undefined, klarna?: Klarna | undefined, stcpay?: StcPay | undefined, tabby?: Tabby | undefined, bizum?: Bizum | undefined, paynow?: PayNow | undefined, qpay?: Qpay | undefined, eps?: Eps | undefined, ideal?: Ideal | undefined, knet?: Knet | undefined, bancontact?: Bancontact | undefined, benefit?: Benefit | undefined, blik?: Blik | undefined, vipps?: Vipps | undefined, twint?: Twint | undefined, alipay_cn?: AlipayCn | undefined, alipay_hk?: AlipayHK | undefined, gcash?: GCash | undefined, tng?: Tng | undefined, dana?: Dana | undefined, mobilepay?: MobilePay | undefined, tamara?: Tamara | undefined, mbway?: MBWay | undefined, multibanco?: Multibanco | undefined, wechatpay?: WeChatPay | undefined, kakaopay?: KakaoPay | undefined, truemoney?: TrueMoney | undefined, octopus?: Octopus | undefined, p24?: P24 | undefined, alma?: Alma | undefined, swish?: Swish | undefined, sequra?: Sequra | undefined, ach?: Ach | undefined, sepa?: Sepa | undefined, bacs?: Bacs | undefined, paybybank?: PayByBank | undefined, paypal?: PayPal | undefined, cashapp?: CashApp | undefined, googlepay?: GooglePay | undefined, applepay?: ApplePay | undefined, card?: Card | undefined, stablecoin?: Stablecoin | undefined}) | undefined, available_payment_methods?: Array | undefined, settings?: ({success_url?: string | undefined, failure_url?: string | undefined, capture?: boolean | undefined, excluded_payment_methods?: Array | undefined}) | undefined, risk?: ({enabled?: boolean | undefined}) | undefined, customer?: ({country?: string | undefined, id?: string | undefined, email?: ({address?: string | undefined, verified?: boolean | undefined}) | undefined, name?: string | undefined, tax_number?: string | undefined, phone?: PaymentSetupPhone | undefined, device?: ({locale?: string | undefined, fingerprint?: string | undefined, ipv4?: string | undefined, ipv6?: string | undefined, client?: ('web' | 'mobile_web' | 'app') | undefined, os?: ('android' | 'ios') | undefined}) | undefined, merchant_account?: PaymentSetupMerchantAccount | undefined}) | undefined, order?: ({items?: Array | undefined, shipping?: PaymentSetupShipping | undefined, sub_merchants?: Array | undefined, invoice_id?: string | undefined, shipping_amount?: number | undefined, discount_amount?: number | undefined, tax_amount?: number | undefined, tipping_amount?: number | undefined, surcharge_amount?: number | undefined, amount_allocations?: Array | undefined}) | undefined, billing?: PaymentSetupBilling | undefined, industry?: ({airline?: Array | undefined, accommodation?: Array | undefined}) | undefined, account_funding_transaction?: PaymentSetupAccountFundingTransaction | undefined, terminal?: PaymentSetupTerminal | undefined, billing_descriptor?: PaymentSetupBillingDescriptor | undefined, metadata?: ({[key: string]: string | number | boolean}) | undefined, latest_payment?: PaymentDetails | undefined}; export type UpdateApiPaymentsSetupsIdArgs = {id: string, body: PaymentSetup}; export type UpdateApiPaymentsSetupsIdOptions = {baseUrl: string, OAuth?: string | undefined, fetch?: typeof fetch | undefined}; export const paymentSetupPresentmentDetails = z.object({amount: z.number().int().optional(), currency: z.string().optional()}); export const paymentMethodStatus = z.enum(["unavailable", "action_required", "ready", "initialization_required", "invalid"]); export const paymentMethodFlags = z.array(z.string()); export const paymentSetupInstrument = z.object({status: paymentMethodStatus.optional(), flags: paymentMethodFlags.optional(), id: z.string().optional(), type: z.string().optional(), action: z.object({type: z.literal("set_instrument").optional()}).optional()}); export const klarnaAccountHolder = z.object({name: z.string().optional()}); export const klarna = z.object({status: paymentMethodStatus.optional(), flags: paymentMethodFlags.optional(), initialization: z.enum(["disabled", "enabled"]).optional(), action: z.object({type: z.literal("sdk").optional(), client_token: z.string().optional(), session_id: z.string().optional()}).optional(), account_holder: klarnaAccountHolder.optional(), iban: z.string().optional()}); export const stcPay = z.object({status: paymentMethodStatus.optional(), flags: paymentMethodFlags.optional(), initialization: z.enum(["disabled", "enabled"]).optional(), otp: z.string().optional(), action: z.object({type: z.literal("otp").optional()}).optional()}); export const tabby = z.object({status: paymentMethodStatus.optional(), flags: paymentMethodFlags.optional(), initialization: z.enum(["disabled", "enabled"]).optional(), payment_types: z.array(z.string()).optional()}); export const bizum = z.object({status: paymentMethodStatus.optional(), flags: paymentMethodFlags.optional()}); export const payNow = z.object({status: paymentMethodStatus.optional(), flags: paymentMethodFlags.optional()}); export const qpay = z.object({status: paymentMethodStatus.optional(), flags: paymentMethodFlags.optional(), national_id: z.string().optional(), description: z.string().max(255).optional()}); export const eps = z.object({status: paymentMethodStatus.optional(), flags: paymentMethodFlags.optional()}); export const ideal = z.object({status: paymentMethodStatus.optional(), flags: paymentMethodFlags.optional(), description: z.string().max(35).optional()}); export const knet = z.object({status: paymentMethodStatus.optional(), flags: paymentMethodFlags.optional(), language: z.enum(["en", "ar"]).optional()}); export const bancontact = z.object({status: paymentMethodStatus.optional(), flags: paymentMethodFlags.optional(), account_holder_name: z.string().min(3).max(100).optional()}); export const benefit = z.object({status: paymentMethodStatus.optional(), flags: paymentMethodFlags.optional()}); export const blik = z.object({status: paymentMethodStatus.optional(), flags: paymentMethodFlags.optional(), partner_code: z.string().optional()}); export const vipps = z.object({status: paymentMethodStatus.optional(), flags: paymentMethodFlags.optional()}); export const twint = z.object({status: paymentMethodStatus.optional(), flags: paymentMethodFlags.optional()}); export const terminalType = z.enum(["web", "wap", "app"]); export const osType = z.enum(["android", "ios"]); export const alipayCn = z.object({status: paymentMethodStatus.optional(), flags: paymentMethodFlags.optional(), terminal_type: terminalType.optional(), os_type: osType.optional()}); export const alipayHK = z.object({status: paymentMethodStatus.optional(), flags: paymentMethodFlags.optional(), terminal_type: terminalType.optional(), os_type: osType.optional()}); export const gCash = z.object({status: paymentMethodStatus.optional(), flags: paymentMethodFlags.optional(), terminal_type: terminalType.optional(), os_type: osType.optional()}); export const tng = z.object({status: paymentMethodStatus.optional(), flags: paymentMethodFlags.optional(), terminal_type: terminalType.optional(), os_type: osType.optional()}); export const dana = z.object({status: paymentMethodStatus.optional(), flags: paymentMethodFlags.optional(), terminal_type: terminalType.optional(), os_type: osType.optional()}); export const mobilePay = z.object({status: paymentMethodStatus.optional(), flags: paymentMethodFlags.optional()}); export const tamara = z.object({status: paymentMethodStatus.optional(), flags: paymentMethodFlags.optional(), initialization: z.enum(["disabled", "enabled"]).optional(), risk_assessment: z.object({premium_customer: z.boolean().optional(), risk_score: z.number().int().optional(), order_count_last24h: z.number().int().optional(), linked_device_count: z.number().int().optional()}).optional()}); export const mBWay = z.object({status: paymentMethodStatus.optional(), flags: paymentMethodFlags.optional()}); export const multibanco = z.object({status: paymentMethodStatus.optional(), flags: paymentMethodFlags.optional(), account_holder_name: z.string().min(3).max(100).optional()}); export const weChatPay = z.object({status: paymentMethodStatus.optional(), flags: paymentMethodFlags.optional()}); export const kakaoPay = z.object({status: paymentMethodStatus.optional(), flags: paymentMethodFlags.optional(), terminal_type: terminalType.optional(), os_type: osType.optional()}); export const trueMoney = z.object({status: paymentMethodStatus.optional(), flags: paymentMethodFlags.optional(), terminal_type: terminalType.optional(), os_type: osType.optional()}); export const octopus = z.object({status: paymentMethodStatus.optional(), flags: paymentMethodFlags.optional()}); export const p24 = z.object({status: paymentMethodStatus.optional(), flags: paymentMethodFlags.optional(), account_holder: z.object({name: z.string().min(3).max(100).optional(), email: z.string().max(254).optional()}).optional()}); export const alma = z.object({status: paymentMethodStatus.optional(), flags: paymentMethodFlags.optional()}); export const swish = z.object({status: paymentMethodStatus.optional(), flags: paymentMethodFlags.optional(), billing_descriptor: z.string().optional(), account_holder: z.object({first_name: z.string().min(1).optional(), last_name: z.string().min(1).optional()}).optional()}); export const sequra = z.object({status: paymentMethodStatus.optional(), flags: paymentMethodFlags.optional()}); export const ach = z.object({status: paymentMethodStatus.optional(), flags: paymentMethodFlags.optional(), account_type: z.enum(["savings", "current", "cash"]).optional(), account_holder: z.object({type: z.enum(["individual", "corporate", "government"]).optional(), first_name: z.string().optional(), last_name: z.string().optional(), company_name: z.string().optional(), date_of_birth: z.string().optional(), identification: z.object({type: z.string().optional(), issuing_country: z.string().optional(), number: z.string().optional()}).optional()}).optional(), account_number: z.string().min(4).max(17).optional(), bank_code: z.string().min(8).max(9).optional(), country: z.string().min(2).max(2).optional()}); export const sepa = z.object({status: paymentMethodStatus.optional(), flags: paymentMethodFlags.optional(), account_holder: z.object({type: z.enum(["individual", "corporate"]).optional(), first_name: z.string().optional(), last_name: z.string().optional(), company_name: z.string().optional()}).optional(), account_number: z.string().optional(), country: z.string().min(2).max(2).optional(), currency: z.string().optional(), mandate: z.object({id: z.string().optional(), type: z.enum(["core", "b2b"]).optional(), date_of_signature: z.string().optional()}).optional()}); export const bacs = z.object({status: paymentMethodStatus.optional(), flags: paymentMethodFlags.optional(), initialization: z.enum(["disabled", "enabled"]).optional(), instrument_id: z.string().optional(), account_holder: z.object({type: z.enum(["individual", "corporate"]).optional(), first_name: z.string().optional(), last_name: z.string().optional(), company_name: z.string().optional(), email: z.string().optional()}).optional(), account_number: z.string().optional(), bank_code: z.string().optional(), country: z.string().min(2).max(2).optional(), currency: z.string().optional(), allow_partial_match: z.boolean().optional()}); export const payByBank = z.object({status: paymentMethodStatus.optional(), flags: paymentMethodFlags.optional(), bank_id: z.string().optional(), action: z.object({type: z.literal("select_bank").optional(), banks: z.array(z.object({bank_id: z.string().optional(), display_name: z.string().optional(), logo_url: z.string().optional(), available: z.boolean().optional()})).optional()}).optional()}); export const payPal = z.object({status: paymentMethodStatus.optional(), flags: paymentMethodFlags.optional(), initialization: z.enum(["disabled", "enabled"]).optional(), user_action: z.enum(["pay_now", "continue"]).optional(), brand_name: z.string().max(127).optional(), shipping_preference: z.enum(["no_shipping", "get_from_file", "set_provided_address"]).optional(), action: z.object({type: z.literal("sdk").optional(), order_id: z.string().optional()}).optional()}); export const cashApp = z.object({status: paymentMethodStatus.optional(), flags: paymentMethodFlags.optional(), initialization: z.enum(["disabled", "enabled"]).optional(), customer_profile_sharing: z.boolean().optional(), customer_profile: z.object({customer_id: z.string().optional(), cashtag: z.string().optional(), reference_id: z.string().optional(), full_name: z.string().optional(), given_name: z.string().optional(), middle_name: z.string().optional(), family_name: z.string().optional(), suffix: z.string().optional(), birth_date: z.string().optional(), address: z.object({address_line_1: z.string().optional(), address_line_2: z.string().optional(), address_line_3: z.string().optional(), locality: z.string().optional(), sublocality: z.string().optional(), administrative_district_level_1: z.string().optional(), postal_code: z.string().optional(), country: z.string().max(2).optional()}).optional(), phone_number: z.string().optional(), email_address: z.string().optional(), customer_since: z.string().optional()}).optional(), reference: z.string().max(80).optional(), action: z.object({type: z.literal("redirect").optional(), redirect_url: z.string().optional()}).optional()}); export const paymentSetupNetworkToken = z.object({number: z.string(), expiry_month: z.number().int().gte(1).lte(12), expiry_year: z.number().int(), cryptogram: z.string().max(100).optional(), eci: z.string().max(2).optional()}); export const paymentSetupPhone = z.object({country_code: z.string().min(1).max(7).optional(), number: z.string().min(6).max(25).optional()}); export const paymentSetupAccountHolder = z.object({type: z.enum(["individual", "government", "corporate"]).optional(), first_name: z.string().optional(), last_name: z.string().optional(), middle_name: z.string().optional(), company_name: z.string().optional(), account_name_inquiry: z.boolean().optional()}); export const googlePay = z.object({status: paymentMethodStatus.optional(), flags: paymentMethodFlags.optional(), token_data: z.object({protocol_version: z.string().optional(), signature: z.string().optional(), signed_message: z.string().optional(), tokenization_key: z.string().optional()}).optional(), token: z.object({id: z.string(), expires_on: z.string().optional()}).optional(), network_token: paymentSetupNetworkToken.optional(), store_for_future_use: z.boolean().optional(), phone: paymentSetupPhone.optional(), account_holder: paymentSetupAccountHolder.optional(), schemes: z.array(z.enum(["accel", "amex", "china_union_pay", "diners", "discover", "jcb", "mada", "maestro", "mastercard", "nyce", "omannet", "pulse", "shazam", "star", "upi", "visa"])).optional(), preferred_scheme: z.enum(["visa", "mastercard"]).optional()}); export const applePay = z.object({status: paymentMethodStatus.optional(), flags: paymentMethodFlags.optional(), token_data: z.object({version: z.string().optional(), data: z.string().optional(), signature: z.string().optional(), header: z.object({ephemeral_public_key: z.string().optional(), public_key_hash: z.string().optional(), transaction_id: z.string().optional()}).optional()}).optional(), token: z.object({id: z.string(), expires_on: z.string().optional()}).optional(), network_token: paymentSetupNetworkToken.optional(), store_for_future_use: z.boolean().optional(), phone: paymentSetupPhone.optional(), account_holder: paymentSetupAccountHolder.optional(), schemes: z.array(z.enum(["accel", "amex", "cartes_bancaires", "china_union_pay", "diners", "discover", "jcb", "mada", "maestro", "mastercard", "nyce", "omannet", "pulse", "shazam", "star", "upi", "visa"])).optional(), preferred_scheme: z.enum(["visa", "mastercard", "cartes_bancaires"]).optional()}); export const card = z.object({status: paymentMethodStatus.optional(), flags: paymentMethodFlags.optional(), token: z.object({id: z.string().optional()}).optional(), details: z.object({number: z.string().optional(), last4: z.string().optional(), bin: z.string().optional(), scheme: z.string().optional(), expiry_month: z.number().int().optional(), expiry_year: z.number().int().optional(), name: z.string().optional(), cvv: z.string().optional(), stored: z.boolean().optional(), expires_on: z.string().optional(), allow_update: z.boolean().optional()}).optional(), store_for_future_use: z.boolean().optional(), phone: paymentSetupPhone.optional(), account_holder: paymentSetupAccountHolder.optional(), schemes: z.array(z.enum(["accel", "amex", "cartes_bancaires", "china_union_pay", "diners", "discover", "jcb", "mada", "maestro", "mastercard", "nyce", "omannet", "pulse", "shazam", "star", "upi", "visa"])).optional(), preferred_scheme: z.enum(["visa", "mastercard", "cartes_bancaires"]).optional()}); export const stablecoin = z.object({status: paymentMethodStatus.optional(), flags: paymentMethodFlags.optional()}); export const paymentSetupMerchantAccount = z.object({id: z.string().optional(), registration_date: z.string().optional(), last_modified: z.string().optional(), returning_customer: z.boolean().optional(), first_transaction_date: z.string().optional(), last_transaction_date: z.string().optional(), total_order_count: z.number().int().optional(), last_payment_amount: z.number().optional()}); export const orderItem = z.object({name: z.string().optional(), quantity: z.number().int().optional(), unit_price: z.number().optional(), total_amount: z.number().optional(), reference: z.string().optional(), discount_amount: z.number().optional(), url: z.string().max(1024).optional(), image_url: z.string().max(1024).optional(), type: z.string().optional(), category: z.string().optional()}); export const paymentSetupAddress = z.object({address_line1: z.string().max(200).optional(), address_line2: z.string().max(200).optional(), city: z.string().max(50).optional(), state: z.string().max(50).optional(), zip: z.string().max(50).optional(), country: z.string().max(2).optional()}); export const paymentSetupShipping = z.object({first_name: z.string().max(50).optional(), last_name: z.string().max(50).optional(), email: z.string().max(100).optional(), phone: paymentSetupPhone.optional(), address: paymentSetupAddress.optional(), method: z.string().optional(), delay: z.number().int().gte(0).lte(365).optional()}); export const paymentSetupSubMerchant = z.object({id: z.string().optional(), product_category: z.string().optional(), number_of_sales: z.number().int().optional(), registration_date: z.string().optional()}); export const paymentSetupAmountAllocation = z.object({id: z.string(), amount: z.number().int().gte(0).lte(9999999999), reference: z.string().max(50).optional(), commission: z.object({amount: z.number().int().gte(0).optional(), percentage: z.number().gte(0).lte(100).optional()}).optional()}); export const paymentSetupBilling = z.object({address: paymentSetupAddress.optional()}); export const paymentSetupFlightLegDetails = z.object({flight_number: z.string().optional(), carrier_code: z.string().optional(), class_of_travelling: z.string().optional(), departure_airport: z.string().optional(), departure_date: z.string().optional(), departure_time: z.string().optional(), arrival_airport: z.string().optional(), stop_over_code: z.string().optional(), fare_basis_code: z.string().optional()}); export const paymentSetupAirline = z.object({ticket: z.object({number: z.string().optional(), issue_date: z.string().optional(), issuing_carrier_code: z.string().optional(), travel_package_indicator: z.string().optional(), travel_agency_name: z.string().optional(), travel_agency_code: z.string().optional()}).optional(), passengers: z.array(z.object({first_name: z.string().optional(), last_name: z.string().optional(), date_of_birth: z.string().optional(), address: z.object({country: z.string().optional()}).optional()})).optional(), flight_leg_details: z.array(paymentSetupFlightLegDetails).optional(), total_number_of_passengers: z.number().int().optional(), travel_type: z.string().optional(), trip_type: z.string().optional(), refundable: z.boolean().optional(), delivery_recipient: z.string().optional(), ancillaries: z.string().optional(), insurance: z.object({type: z.string().optional(), company: z.string().optional(), price: z.object({amount: z.number().optional(), currency: z.string().optional()}).optional()}).optional()}); export const paymentSetupAccommodation = z.object({name: z.string().optional(), booking_reference: z.string().optional(), check_in_date: z.string().optional(), check_out_date: z.string().optional(), address: z.object({address_line1: z.string().optional(), city: z.string().optional(), state: z.string().optional(), country: z.string().optional(), zip: z.string().optional()}).optional(), number_of_rooms: z.number().int().optional(), guests: z.array(z.object({first_name: z.string().optional(), last_name: z.string().optional(), date_of_birth: z.string().optional()})).optional(), room: z.array(z.object({rate: z.number().optional(), number_of_nights: z.number().int().optional(), type: z.string().optional()})).optional(), total_number_of_guests: z.number().int().optional(), refundable: z.boolean().optional(), delivery_recipient: z.string().optional(), host: z.object({registration_date: z.string().optional(), total_reservation_count: z.number().int().optional()}).optional()}); export const paymentSetupAccountFundingTransaction = z.object({enabled: z.boolean().optional(), purpose: z.enum(["donations", "education", "emergency_need", "expatriation", "family_support", "financial_services", "gifts", "income", "insurance", "investment", "it_services", "leisure", "loan_payment", "medical_treatment", "other", "pension", "royalties", "savings", "travel_and_tourism"]).optional(), sender: z.object({date_of_birth: z.string().optional(), reference: z.string().optional(), identification: z.object({type: z.enum(["passport", "driving_license", "national_id"]).optional(), number: z.string().optional(), issuing_country: z.string().optional()}).optional()}).optional(), recipient: z.object({date_of_birth: z.string().optional(), account_number: z.string().max(34).optional(), first_name: z.string().max(50).optional(), last_name: z.string().max(50).optional(), address: paymentSetupAddress.optional()}).optional()}); export const paymentSetupTerminal = z.object({id: z.string().min(8).max(8).optional(), local_date_time: z.string().optional()}); export const paymentSetupBillingDescriptor = z.object({name: z.string().max(25).optional(), city: z.string().max(13).optional(), reference: z.string().max(50).optional()}); export const paymentId = z.string().min(30).max(30); export const serverTimestamp = z.string(); export const address = z.object({address_line1: z.string().max(200).optional(), address_line2: z.string().max(200).optional(), city: z.string().max(50).optional(), state: z.string().max(3).optional(), zip: z.string().max(50).optional(), country: z.string().min(2).max(2).optional()}); export const phoneNumber = z.object({country_code: z.string().min(1).max(7).optional(), number: z.string().max(25).optional()}); export const paymentResponseAchAccountHolder = z.object({account_name_inquiry: z.enum(["full_match", "partial_match", "no_match", "not_performed"]).optional(), account_name_inquiry_details: z.object({description: z.string().optional()}).optional()}); export const accountHolderEps = z.object({first_name: z.string(), last_name: z.string()}); export const paymentDetailsResponseSource = z.discriminatedUnion("type", [z.object({type: z.literal("card"), id: z.string().optional(), billing_address: address.optional(), phone: phoneNumber.optional(), expiry_month: z.number().int().gte(1), expiry_year: z.number().int(), name: z.string().optional(), scheme: z.string().optional(), scheme_local: z.string().optional(), local_schemes: z.array(z.string()).optional(), last4: z.string(), fingerprint: z.string(), bin: z.string().max(8), card_type: z.enum(["CREDIT", "DEBIT", "PREPAID", "CHARGE", "DEFERRED DEBIT"]).optional(), card_category: z.enum(["CONSUMER", "COMMERCIAL"]).optional(), card_wallet_type: z.enum(["applepay", "googlepay"]).optional(), issuer: z.string().optional(), issuer_country: z.string().min(2).max(2).optional(), product_id: z.string().optional(), product_type: z.string().optional(), avs_check: z.string().optional(), cvv_check: z.string().optional(), payment_account_reference: z.string().optional(), encrypted_card_number: z.string().optional(), account_update_status: z.enum(["card_updated", "card_expiry_updated", "card_closed", "contact_cardholder"]).optional(), account_update_failure_code: z.string().optional(), account_holder: z.object({}).optional()}), z.object({type: z.literal("ach"), id: z.string(), account_holder: paymentResponseAchAccountHolder.optional()}), z.object({type: z.literal("alma")}), z.object({type: z.literal("bancontact"), iban: z.string().max(34).optional(), bic: z.string().max(11).optional()}), z.object({type: z.literal("blik"), id: z.string().optional()}), z.object({type: z.literal("currency_account"), id: z.string(), amount: z.number().int().optional()}), z.object({type: z.literal("eps"), purpose: z.string().max(27).optional(), bic: z.string().max(11).optional(), iban: z.string().max(34).optional(), account_holder_name: z.string().optional(), account_holder: accountHolderEps.optional()}), z.object({type: z.literal("ideal"), account_holder: z.string().optional(), account_holder_name: z.string().optional(), bic: z.string().optional(), description: z.string().optional(), iban: z.string().max(34).optional()}), z.object({type: z.literal("klarna"), account_holder: z.object({first_name: z.string().optional(), last_name: z.string().optional(), billing_address: z.object({address_line1: z.string().optional(), address_line2: z.string().optional(), city: z.string(), zip: z.string(), country: z.string().min(2).max(2)}).optional(), email: z.string().optional(), date_of_birth: z.string().optional(), account_holder_name: z.string().optional(), iban: z.string().optional(), account_number: z.string().optional(), bank_code: z.string().optional(), bank_name: z.string().optional(), bic: z.string().optional(), gender: z.string().optional(), phone: z.object({country_code: z.string().min(1).max(7).optional(), number: z.string().min(6).max(25).optional()}).optional()}).optional()}), z.object({type: z.literal("knet"), language: z.enum(["ar", "en"]).optional(), user_defined_field1: z.string().optional(), user_defined_field2: z.string().optional(), user_defined_field3: z.string().optional(), user_defined_field4: z.string().optional(), user_defined_field5: z.string().optional(), card_token: z.string().optional(), ptlf: z.string().max(45).optional(), knet_payment_id: z.string().optional(), knet_result: z.string().optional(), inquiry_result: z.string().optional(), bank_reference: z.string().optional(), knet_transaction_id: z.string().optional(), auth_code: z.string().optional(), auth_response_code: z.string().optional(), post_date: z.string().optional(), avr: z.string().optional(), error: z.string().optional(), error_text: z.string().optional()}), z.object({type: z.literal("multibanco"), payment_reference: z.string().optional(), service_supplier_id: z.string().optional()}), z.object({type: z.literal("p24"), p24_descriptor: z.string().optional()}), z.object({type: z.literal("paypal"), account_holder: z.object({email: z.string().optional(), full_name: z.string().optional()}).optional()}), z.object({type: z.literal("qpay"), description: z.string(), qpay_status: z.string().optional(), status_message: z.string().optional(), confirmation_id: z.string().optional(), pun: z.string()}), z.object({type: z.literal("sepa"), id: z.string()}), z.object({type: z.literal("bacs"), id: z.string()}), z.object({type: z.literal("swish")}), z.object({type: z.literal("sequra")}), z.object({type: z.literal("tamara")})]); export const paymentResponseDestination = z.object({type: z.literal("bank_account"), id: z.string()}); export const paymentResponseBalances = z.object({total_authorized: z.number().int().optional(), total_voided: z.number().int().optional(), available_to_void: z.number().int().optional(), total_captured: z.number().int().optional(), available_to_capture: z.number().int().optional(), total_refunded: z.number().int().optional(), available_to_refund: z.number().int().optional()}); export const responseCode = z.enum(["Y", "N", "U", "A", "C", "D", "R", "I"]); export const trustedListing = z.object({status: z.enum(["Y", "N", "E", "P", "R", "U"]).optional(), source: z.string().optional()}); export const schema3dsData = z.object({downgraded: z.boolean().optional(), enrolled: z.string().optional(), signature_valid: z.string().optional(), authentication_response: responseCode.optional(), authentication_status_reason: z.string().optional(), cryptogram: z.string().optional(), xid: z.string().optional(), eci: z.string().optional(), version: z.string().optional(), exemption: z.enum(["3ds_outage", "data_share", "low_risk_program", "low_value", "none", "other", "out_of_sca_scope", "sca_delegation", "secure_corporate_payment", "transaction_risk_assessment", "trusted_listing", "trusted_listing_prompt"]).optional(), exemption_applied: z.string().optional(), challenged: z.boolean().optional(), upgrade_reason: z.string().optional(), trusted_listing: trustedListing.optional()}); export const paymentAuthenticationData = z.object({experience: z.enum(["google_spa", "3ds"]).optional()}); export const customerSummary = z.object({registration_date: z.string().optional(), first_transaction_date: z.string().optional(), last_payment_date: z.string().optional(), total_order_count: z.number().int().optional(), last_payment_amount: z.number().optional(), is_premium_customer: z.boolean().optional(), is_returning_customer: z.boolean().optional(), lifetime_value: z.number().optional()}); export const localBillingDescriptor = z.object({name: z.string(), character_set: z.enum(["kanji", "katakana"])}); export const billingDescriptor = z.object({name: z.string().max(25), city: z.string().max(13), reference: z.string().max(50).optional(), local_descriptors: z.array(localBillingDescriptor).nullable().optional()}); export const iPAddress = z.string().max(45); export const paymentDetailsResponseSender = z.discriminatedUnion("type", [z.object({type: z.enum(["individual", "corporate", "instrument"]), reference: z.string().optional(), first_name: z.string(), last_name: z.string(), address: address}), z.object({type: z.enum(["individual", "corporate", "instrument"]), reference: z.string().optional(), company_name: z.string(), address: address.optional()}), z.object({type: z.enum(["individual", "corporate", "instrument"]), reference: z.string().optional()})]); export const amountAllocations = z.array(z.object({id: z.string(), amount: z.number().int().gte(0).lte(9999999999), reference: z.string().max(50).optional(), commission: z.object({amount: z.number().int().gte(0).optional(), percentage: z.number().gte(0).lte(100).optional()}).optional()})); export const paymentRecipient = z.object({dob: z.string().max(10).optional(), account_number: z.string().max(34).optional(), address: address.optional(), zip: z.string().max(10).optional(), first_name: z.string().max(50).optional(), last_name: z.string().max(50).optional()}); export const airlineData = z.array(z.object({ticket: z.object({number: z.string().optional(), issue_date: z.string().optional(), issuing_carrier_code: z.string().optional(), travel_package_indicator: z.string().optional(), travel_agency_name: z.string().optional(), travel_agency_code: z.string().optional()}).optional(), passenger: z.array(z.object({first_name: z.string().optional(), last_name: z.string().optional(), date_of_birth: z.string().optional(), address: z.object({country: z.string().optional()}).optional()})).optional(), flight_leg_details: z.array(z.object({flight_number: z.string().optional(), carrier_code: z.string().optional(), class_of_travelling: z.string().optional(), departure_airport: z.string().optional(), departure_date: z.string().optional(), departure_time: z.string().optional(), arrival_airport: z.string().optional(), stop_over_code: z.string().optional(), fare_basis_code: z.string().optional()})).optional()})); export const accommodationData = z.array(z.object({name: z.string().optional(), booking_reference: z.string().optional(), check_in_date: z.string().optional(), check_out_date: z.string().optional(), address: z.object({address_line1: z.string().optional(), zip: z.string().optional()}).optional(), state: z.string().optional(), country: z.string().optional(), city: z.string().optional(), number_of_rooms: z.number().int().optional(), guests: z.array(z.object({first_name: z.string().optional(), last_name: z.string().optional(), date_of_birth: z.string().optional()})).optional(), room: z.array(z.object({rate: z.string().optional(), number_of_nights_at_room_rate: z.string().optional()})).optional(), property_phone: z.array(z.object({country_code: z.string().optional(), number: z.string().optional()})).optional(), customer_service_phone: z.array(z.object({country_code: z.string().optional(), number: z.string().optional()})).optional()})); export const processingData = z.object({preferred_scheme: z.enum(["mastercard", "visa", "cartes_bancaires", "accel", "discover", "eftpos", "maestro", "nyce", "pulse", "star"]).optional(), app_id: z.string().optional(), airline_data: airlineData.optional(), accommodation_data: accommodationData.optional(), partner_customer_id: z.string().optional(), partner_payment_id: z.string().optional(), partner_code: z.string().min(6).max(6).optional(), failure_code: z.string().optional(), partner_response_code: z.string().optional(), tax_amount: z.number().optional(), locale: z.string().min(2).max(10).optional(), retrieval_reference_number: z.string().optional(), partner_order_id: z.string().optional(), partner_status: z.string().optional(), partner_transaction_id: z.string().optional(), partner_error_codes: z.array(z.string()).optional(), partner_merchant_advice_code: z.string().optional(), partner_error_message: z.string().optional(), partner_authorization_code: z.string().optional(), partner_authorization_response_code: z.string().optional(), partner_fraud_status: z.string().optional(), pan_type_processed: z.enum(["fpan", "dpan"]).optional(), fallback_source_used: z.boolean().optional(), custom_payment_method_ids: z.array(z.string()).optional(), aft: z.boolean().optional(), merchant_category_code: z.string().optional(), scheme_merchant_id: z.string().optional(), scheme: z.string().optional(), scheme_transaction_link_id: z.string().optional()}); export const items = z.array(z.object({type: z.enum(["digital", "discount", "physical"]).optional(), sub_type: z.enum(["blockchain", "cbdc", "cryptocurrency", "nft", "stablecoin"]).optional(), name: z.string().max(255).optional(), quantity: z.number().int().gte(1).optional(), unit_price: z.number().int().gte(0).optional(), reference: z.string().max(255).optional(), commodity_code: z.string().max(12).optional(), unit_of_measure: z.string().max(12).optional(), total_amount: z.number().optional(), tax_rate: z.number().optional(), tax_amount: z.number().optional(), tax_exempt: z.boolean().optional(), discount_amount: z.number().optional(), wxpay_goods_id: z.string().max(32).optional(), url: z.string().max(1024).optional(), image_url: z.string().max(1024).optional(), service_ends_on: z.string().optional(), purchase_country: z.string().max(2).optional(), foreign_retailer_amount: z.number().int().gte(0).optional()})); export const actionId = z.string().min(30).max(30); export const paymentActionSummary = z.object({id: actionId, type: z.enum(["Authorization", "Card Verification", "Void", "Capture", "Refund"]), response_code: z.string(), response_summary: z.string().optional()}); export const timestamp = z.string(); export const retryGetResponse = z.object({enabled: z.boolean(), attempts_made: z.number().int().gte(0).optional(), max_attempts: z.number().int().gte(1).lte(15).optional(), ends_on: timestamp.optional(), next_attempt_on: timestamp.optional()}); export const link = z.object({href: z.string()}); export const paymentDetails = z.object({id: paymentId, requested_on: serverTimestamp, source: paymentDetailsResponseSource.optional(), destination: paymentResponseDestination.optional(), amount: z.number().int(), amount_requested: z.number().int().optional(), currency: z.string().min(3).max(3), payment_type: z.enum(["Regular", "Recurring", "MOTO", "Installment", "PayLater", "Unscheduled"]).optional(), payment_plan: z.union([z.object({amount_variability: z.enum(["Fixed", "Variable"]).optional(), days_between_payments: z.number().int().optional(), total_number_of_payments: z.number().int().optional(), current_payment_number: z.number().int().optional(), expiry: z.string().optional(), name: z.string().max(35).optional(), start_date: z.string().optional(), amount: z.number().int().gte(1).optional()}), z.object({financing: z.boolean().optional(), days_between_payments: z.number().int().optional(), total_number_of_payments: z.number().int().optional(), current_payment_number: z.number().int().optional(), expiry: z.string().optional(), name: z.string().max(35).optional(), start_date: z.string().optional(), amount: z.number().int().gte(1).optional()})]).optional(), reference: z.string().optional(), description: z.string().optional(), approved: z.boolean(), expires_on: z.string().optional(), status: z.enum(["Pending", "Authorized", "Card Verified", "Voided", "Partially Captured", "Captured", "Partially Refunded", "Refunded", "Declined", "Canceled", "Expired", "Paid", "Retry Scheduled"]), balances: paymentResponseBalances.optional(), "3ds": schema3dsData.optional(), authentication: paymentAuthenticationData.optional(), risk: z.object({flagged: z.boolean().optional(), score: z.number().gte(0).lte(100).optional()}).optional(), customer: z.object({id: z.string(), email: z.string().optional(), name: z.string().optional(), summary: customerSummary.optional()}).optional(), billing_descriptor: billingDescriptor.optional(), shipping: z.object({address: address.optional(), phone: phoneNumber.optional()}).optional(), payment_ip: iPAddress.optional(), sender: paymentDetailsResponseSender.optional(), amount_allocations: amountAllocations.optional(), recipient: paymentRecipient.optional(), processing: processingData.optional(), items: items.optional(), metadata: z.object({}).optional(), eci: z.string().optional(), scheme_id: z.string().optional(), actions: z.array(paymentActionSummary).optional(), retry: retryGetResponse.optional(), cko_network_token_available: z.boolean().optional(), instruction: z.object({purpose: z.string().optional()}).optional(), _links: z.object({self: link, actions: link, authorize: link.optional(), void: link.optional(), capture: link.optional(), refund: link.optional()})}); export const paymentSetup = z.object({id: z.string().optional(), processing_channel_id: z.string(), amount: z.number(), currency: z.string(), presentment_details: paymentSetupPresentmentDetails.optional(), payment_type: z.enum(["regular", "recurring", "moto", "installment", "pay_later", "unscheduled"]).optional(), reference: z.string().max(80).optional(), description: z.string().max(100).optional(), payment_methods: z.object({auto_confirm: z.string().optional(), instrument: paymentSetupInstrument.optional(), klarna: klarna.optional(), stcpay: stcPay.optional(), tabby: tabby.optional(), bizum: bizum.optional(), paynow: payNow.optional(), qpay: qpay.optional(), eps: eps.optional(), ideal: ideal.optional(), knet: knet.optional(), bancontact: bancontact.optional(), benefit: benefit.optional(), blik: blik.optional(), vipps: vipps.optional(), twint: twint.optional(), alipay_cn: alipayCn.optional(), alipay_hk: alipayHK.optional(), gcash: gCash.optional(), tng: tng.optional(), dana: dana.optional(), mobilepay: mobilePay.optional(), tamara: tamara.optional(), mbway: mBWay.optional(), multibanco: multibanco.optional(), wechatpay: weChatPay.optional(), kakaopay: kakaoPay.optional(), truemoney: trueMoney.optional(), octopus: octopus.optional(), p24: p24.optional(), alma: alma.optional(), swish: swish.optional(), sequra: sequra.optional(), ach: ach.optional(), sepa: sepa.optional(), bacs: bacs.optional(), paybybank: payByBank.optional(), paypal: payPal.optional(), cashapp: cashApp.optional(), googlepay: googlePay.optional(), applepay: applePay.optional(), card: card.optional(), stablecoin: stablecoin.optional()}).optional(), available_payment_methods: z.array(z.string()).optional(), settings: z.object({success_url: z.string().max(255).optional(), failure_url: z.string().max(255).optional(), capture: z.boolean().optional(), excluded_payment_methods: z.array(z.string()).optional()}).optional(), risk: z.object({enabled: z.boolean().optional()}).optional(), customer: z.object({country: z.string().min(2).max(2).optional(), id: z.string().optional(), email: z.object({address: z.string().optional(), verified: z.boolean().optional()}).optional(), name: z.string().max(100).optional(), tax_number: z.string().optional(), phone: paymentSetupPhone.optional(), device: z.object({locale: z.string().optional(), fingerprint: z.string().optional(), ipv4: z.string().optional(), ipv6: z.string().optional(), client: z.enum(["web", "mobile_web", "app"]).optional(), os: z.enum(["android", "ios"]).optional()}).optional(), merchant_account: paymentSetupMerchantAccount.optional()}).optional(), order: z.object({items: z.array(orderItem).optional(), shipping: paymentSetupShipping.optional(), sub_merchants: z.array(paymentSetupSubMerchant).optional(), invoice_id: z.string().optional(), shipping_amount: z.number().int().gte(0).optional(), discount_amount: z.number().int().gte(0).optional(), tax_amount: z.number().int().gte(0).optional(), tipping_amount: z.number().int().gte(0).optional(), surcharge_amount: z.number().int().gte(0).optional(), amount_allocations: z.array(paymentSetupAmountAllocation).optional()}).optional(), billing: paymentSetupBilling.optional(), industry: z.object({airline: z.array(paymentSetupAirline).optional(), accommodation: z.array(paymentSetupAccommodation).optional()}).optional(), account_funding_transaction: paymentSetupAccountFundingTransaction.optional(), terminal: paymentSetupTerminal.optional(), billing_descriptor: paymentSetupBillingDescriptor.optional(), metadata: z.record(z.string(), z.union([z.string().max(255), z.number(), z.boolean()])).optional(), latest_payment: paymentDetails.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 }; /** * Update a Payment Setup * * PUT /payments/setups/{id} * * Also accepts auth: ApiSecretKey */ export const updateApiPaymentsSetupsId = async (args: UpdateApiPaymentsSetupsIdArgs, options: UpdateApiPaymentsSetupsIdOptions) => { const {baseUrl, fetch: fetchFn = fetch, OAuth} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('content-type', "application/json") headers.set('accept', "application/json") if (OAuth !== undefined) headers.set('authorization', `Bearer ${OAuth}`) const url = `${baseUrl.replace(/\/+$/, '')}/payments/setups/${encodeURIComponent(String(args.id))}${query.size > 0 ? `?${query}` : ''}` const res = await fetchFn(url, {method: "PUT", 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(paymentSetup, await res.json()) };