import {z} from 'zod' export type BillingDataSerializerField = {name?: (string | null) | undefined, first_name?: (string | null) | undefined, last_name?: (string | null) | undefined, email?: (string | null) | undefined, phone_number?: (string | null) | undefined, address?: string | undefined, address1?: string | undefined, apartment?: string | undefined, floor?: string | undefined, building?: string | undefined, street?: string | undefined, city?: string | undefined, state?: (string | null) | undefined, country?: string | undefined, postal_code?: string | undefined, mobile_wallet_number?: (string | null) | undefined}; export type ShippingData = {phone_number?: (string | null) | undefined, first_name?: string | undefined, last_name?: string | undefined, email?: (string | null) | undefined, address?: string | undefined, country?: string | undefined, state?: string | undefined, city?: string | undefined, postal_code?: string | undefined, street?: string | undefined, floor?: string | undefined, building?: string | undefined, apartment?: string | undefined, description?: (string | null) | undefined, shipping_method?: string | undefined, area?: string | undefined, created: string, modified: string}; export type GeneralAmountsTitle = {en: string, ar?: string | undefined, fr?: string | undefined}; export type Discount = {title: GeneralAmountsTitle, value: unknown, type: 'percentage' | 'amount'}; export type Fees = {title: GeneralAmountsTitle, value: unknown, discount?: (Discount | null) | undefined}; export type StatementDescriptor = {business_name?: (string | null) | undefined, business_city?: (string | null) | undefined, business_country?: (string | null) | undefined}; export type ProductItems = {name: string, amount: unknown, unit_amount?: unknown | undefined, description: string, quantity: number, category?: ('Animals & Pet Supplies' | 'Apparel & Accessories' | 'Arts & Entertainment' | 'Baby & Toddler' | 'Business & Industrial' | 'Cameras & Optics' | 'Electronics' | 'Food, Beverages & Tobacco' | 'Furniture' | 'Hardware' | 'Health & Beauty' | 'Home & Garden' | 'Luggage & Bags' | 'Mature' | 'Media' | 'Office Supplies' | 'Religious & Ceremonial' | 'Software' | 'Sporting Goods' | 'Toys & Games' | 'Vehicles & Parts' | 'Crypto') | undefined, subcategory?: ('Live Animals' | 'Pet Supplies' | 'Clothing' | 'Clothing Accessories' | 'Costumes & Accessories' | 'Handbag & Wallet Accessories' | 'Handbags, Wallets & Cases' | 'Jewelry' | 'Shoe Accessories' | 'Shoes' | 'Event Tickets' | 'Hobbies & Creative Arts' | 'Party & Celebration' | 'Baby Bathing' | 'Baby Gift Sets' | 'Baby Health' | 'Baby Safety' | 'Baby Toys & Activity Equipment' | 'Baby Transport' | 'Baby Transport Accessories' | 'Diapering' | 'Nursing & Feeding' | 'Potty Training' | 'Swaddling & Receiving Blankets' | 'Advertising & Marketing' | 'Agriculture' | 'Automation Control Components' | 'Construction' | 'Dentistry' | 'Film & Television' | 'Finance & Insurance' | 'Food Service' | 'Forestry & Logging' | 'Hairdressing & Cosmetology' | 'Heavy Machinery' | 'Hotel & Hospitality' | 'Industrial Storage' | 'Industrial Storage Accessories' | 'Janitorial Carts & Caddies' | 'Law Enforcement' | 'Manufacturing' | 'Material Handling' | 'Medical' | 'Mining & Quarrying' | 'Piercing & Tattooing' | 'Retail' | 'Science & Laboratory' | 'Signage' | 'Work Safety Protective Gear' | 'Camera & Optic Accessories' | 'Cameras' | 'Optics' | 'Photography' | 'Arcade Equipment' | 'Audio' | 'Circuit Boards & Components' | 'Communications' | 'Components' | 'Computers' | 'Electronics Accessories' | 'GPS Accessories' | 'GPS Navigation Systems' | 'GPS Tracking Devices' | 'Marine Electronics' | 'Networking' | 'Print, Copy, Scan & Fax' | 'Radar Detectors' | 'Speed Radars' | 'Toll Collection Devices' | 'Video' | 'Video Game Console Accessories' | 'Video Game Consoles' | 'Beverages' | 'Food Items' | 'Tobacco Products' | 'Baby & Toddler Furniture' | 'Beds & Accessories' | 'Benches' | 'Cabinets & Storage' | 'Carts & Islands' | 'Chair Accessories' | 'Chairs' | 'Entertainment Centers & TV Stands' | 'Furniture Sets' | 'Futon Frames' | 'Futon Pads' | 'Futons' | 'Office Furniture' | 'Office Furniture Accessories' | 'Ottomans' | 'Outdoor Furniture' | 'Outdoor Furniture Accessories' | 'Room Divider Accessories' | 'Room Dividers' | 'Shelving' | 'Shelving Accessories' | 'Sofa Accessories' | 'Sofas' | 'Table Accessories' | 'Tables' | 'Building Consumables' | 'Building Materials' | 'Fencing & Barriers' | 'Fuel' | 'Fuel Containers & Tanks' | 'Hardware Accessories' | 'Hardware Pumps' | 'Heating, Ventilation & Air Conditioning' | 'Locks & Keys' | 'Plumbing' | 'Power & Electrical Supplies' | 'Small Engines' | 'Storage Tanks' | 'Tool Accessories' | 'Tools' | 'Health Care' | 'Jewelry Cleaning & Care' | 'Personal Care' | 'Bathroom Accessories' | 'Business & Home Security' | 'Decor' | 'Emergency Preparedness' | 'Fireplace & Wood Stove Accessories' | 'Fireplaces' | 'Flood, Fire & Gas Safety' | 'Household Appliance Accessories' | 'Household Appliances' | 'Household Supplies' | 'Kitchen & Dining' | 'Lawn & Garden' | 'Lighting' | 'Lighting Accessories' | 'Linens & Bedding' | 'Parasols & Rain Umbrellas' | 'Plants' | 'Pool & Spa' | 'Smoking Accessories' | 'Umbrella Sleeves & Cases' | 'Wood Stoves' | 'Backpacks' | 'Briefcases' | 'Cosmetic & Toiletry Bags' | 'Diaper Bags' | 'Dry Boxes' | 'Duffel Bags' | 'Fanny Packs' | 'Garment Bags' | 'Luggage Accessories' | 'Messenger Bags' | 'Shopping Totes' | 'Suitcases' | 'Train Cases' | 'Erotic' | 'Weapons' | 'Books' | 'Carpentry & Woodworking Project Plans' | 'DVDs & Videos' | 'Magazines & Newspapers' | 'Music & Sound Recordings' | 'Product Manuals' | 'Sheet Music' | 'Book Accessories' | 'Desk Pads & Blotters' | 'Filing & Organization' | 'General Office Supplies' | 'Impulse Sealers' | 'Lap Desks' | 'Name Plates' | 'Office & Chair Mats' | 'Office Carts' | 'Office Equipment' | 'Office Instruments' | 'Paper Handling' | 'Presentation Supplies' | 'Shipping Supplies' | 'Memorial Ceremony Supplies' | 'Religious Items' | 'Wedding Ceremony Supplies' | 'Computer Software' | 'Digital Goods & Currency' | 'Video Game Software' | 'Athletics' | 'Exercise & Fitness' | 'Indoor Games' | 'Outdoor Recreation' | 'Game Timers' | 'Games' | 'Outdoor Play Equipment' | 'Puzzles' | 'Toys' | 'Vehicle Parts & Accessories' | 'Vehicles' | 'Cryptocurrency' | 'Token') | undefined, type?: ('Physical' | 'Digital') | undefined, image_url?: (string | null) | undefined, sku?: string | undefined, tax?: unknown | undefined, extra_information: unknown, discount?: (Discount | null) | undefined}; export type FraudDataDeliveryDetailsSerializerField = {delivery_type: 'DIGITAL' | 'PHYSICAL' | 'HYBRID', delivery_method: string}; export type FraudDataSerializerField = {order_type: 'web' | 'mobile' | 'ios' | 'android' | 'mail_order' | 'merchant_initiated' | 'unknown' | 'WEB' | 'MOBILE' | 'IOS' | 'ANDROID' | 'MAIL_ORDER' | 'MERCHANT_INITIATED' | 'UNKNOWN', primary_delivery_details: FraudDataDeliveryDetailsSerializerField, account_id: string, customer_created_at: number, forter_token_cookie?: string | undefined}; export type CustomFormFields = {name: string, value?: string | undefined, label: string, type: 'CharField' | 'BooleanField' | 'IntegerField' | 'ChoiceField', required: boolean, choices: unknown, help_text?: string | undefined, max_length?: number | undefined, min_length?: number | undefined, min_value?: number | undefined, max_value?: number | undefined}; export type CustomFormDefinition = {form_title: string, fields: Array}; export type CardTokenData = {cvv?: (string | null) | undefined}; export type ThreeDS = {enabled: boolean, challenge_indicator?: string | undefined}; export type RecurringData = {mh_subscription_id?: string | undefined, agreement_id?: string | undefined, number_of_payments?: number | undefined, days_between_payments?: number | undefined, expiry_date?: string | undefined}; export type CKOPrevCitPayload = {previous_payment_id: string}; export type NoonSubscription = {identifier: string}; export type NOONPrevCitPayload = {subscription: NoonSubscription}; export type APSPrevCitPayload = {agreement_id: string}; export type MPGSAgreement = {id: string}; export type MPGSPrevCitPayload = {agreement: MPGSAgreement}; export type GeideaCofAgreement = {id: string}; export type GEIDEAPrevCitPayload = {cofAgreement: GeideaCofAgreement}; export type CYBERSOURCEPrevCitPayload = {agreementId: string}; export type PrevCitPayload = {CKO?: CKOPrevCitPayload | undefined, NOON?: NOONPrevCitPayload | undefined, APS?: APSPrevCitPayload | undefined, MPGS?: MPGSPrevCitPayload | undefined, GEIDEA?: GEIDEAPrevCitPayload | undefined, CYBERSOURCE?: CYBERSOURCEPrevCitPayload | undefined}; export type RedirectBrandingData = {color?: string | undefined, background_color?: string | undefined, size?: string | undefined, icon?: string | undefined, animate?: string | undefined}; export type AFTBaseAddress = {first_name: string, last_name: string, address?: string | undefined, postal_code?: string | undefined, city?: string | undefined, country: string}; export type Recipient = {first_name: string, last_name: string, address?: string | undefined, postal_code?: string | undefined, city?: string | undefined, country: string, account_type: 'wallet' | 'bank_account' | 'iban' | 'card_number', id: string}; export type AftData = {type: 'account_to_account' | 'supplier_payments' | 'bank_initiated_p2p' | 'bill_payment' | 'cash_deposit' | 'card_bill_payment' | 'funds_disbursement' | 'funds_transfer' | 'government_disbursement' | 'loyalty' | 'merchant_settlement' | 'gambling_payout' | 'payroll' | 'p2p' | 'prepaid_topup' | 'wallet_transfer' | 'cryptocurrency' | 'b2b_payment' | 'debit_topup' | 'other', purpose: 'family_support' | 'expatriation' | 'travel' | 'education' | 'medical_treatment' | 'emergency_need' | 'savings' | 'gifts' | 'other' | 'salary' | 'crowd_lending' | 'crypto_purchase' | 'high_risk_securities' | 'donations' | 'financial_services' | 'insurance' | 'investment' | 'it_services' | 'leisure' | 'pension' | 'royalties' | 'high_risk' | 'income' | 'loan_payment', sender: AFTBaseAddress, recipient: Recipient}; export type Device = {user_agent: string, timestamp?: string | undefined, language?: string | undefined, color_depth?: string | undefined, screen_height?: string | undefined, screen_width?: string | undefined, timezone?: string | undefined}; export type BaseIntent = {id: string, description?: string | undefined, amount: unknown, amount_currency: string, operation?: ('purchase' | 'authorize' | 'PURCHASE' | 'AUTHORIZE' | '') | undefined, webhook_url: string, billing_data?: BillingDataSerializerField | undefined, shipping_data?: ShippingData | undefined, fees?: Array | undefined, statement_descriptor?: StatementDescriptor | undefined, account?: string | undefined, flow_id?: string | undefined, payment_provider?: (string | null) | undefined, product_items?: Array | undefined, fraud_data?: FraudDataSerializerField | undefined, custom_fields: unknown, custom_form_definition?: CustomFormDefinition | undefined, card_token?: string | undefined, card_token_data?: CardTokenData | undefined, bankaccount_token?: string | undefined, tokenize_card?: boolean | undefined, customer?: string | undefined, hide_amount_sidebar?: boolean | undefined, hide_payment_method_selector?: boolean | undefined, hide_payment_header?: boolean | undefined, hide_header?: boolean | undefined, form_only?: boolean | undefined, back_url?: string | undefined, top_up_wallet?: boolean | undefined, use_wallet?: boolean | undefined, authorization_type?: ('incremental' | 'final' | 'INCREMENTAL' | 'FINAL' | '') | undefined, threeds?: ThreeDS | undefined, show_save_card_checkbox?: boolean | undefined, allow_tokenize_card?: boolean | undefined, show_mandatory_save_card_checkbox?: boolean | undefined, expires_after_seconds?: number | undefined, show_countdown_timer?: boolean | undefined, hidden_methods?: (Array<'CASH_OUTLET' | 'MOBILE_WALLET' | 'CARD' | 'USSD' | 'KNET' | 'CASH_COLLECTION' | 'AMAN_MASARY' | 'PAYPAL' | 'PAY_AT_FAWRY' | 'VALU' | 'SHAHRY' | 'CASH_ON_DELIVERY' | 'BANK_INSTALLMENTS' | 'BANK_TRANSFERS' | 'REFERENCE_NUMBER' | 'SELFSERVE_WALLET' | 'APPLE_PAY' | 'CLICK2PAY' | 'GOOGLE_PAY' | 'CAREEM_PAY' | 'PAY_FLEX' | 'M_PESA' | 'MOBILE_MONEY' | 'CRYPTO_WALLET' | 'NAPS' | 'FORSA' | 'SYMPL' | 'TABBY' | 'SOUHOOLA' | 'GETGO' | 'SAMSUNG_PAY' | 'QPAY' | 'TAMARA' | 'BENEFIT' | 'RAZER' | 'ININAL' | 'STC' | 'MOKAFAA' | 'SADAD' | 'EFAWATEERCOM' | 'OMANNET' | 'MADA' | 'TAPTOPAY' | 'GRABPAY' | 'GRABPAYPAYLATER' | 'SHOPEEPAY' | 'SHOPEEPAYPAYLATER' | 'ATOME' | 'TOUCHNGO' | 'BOOST' | 'PAYNOW' | 'UPI' | 'ZAINCASH' | 'WALAONE' | 'QITAF' | 'EFT' | 'CAPITEC_PAY'>) | undefined, create_customer?: boolean | undefined, customer_details: unknown, hide_loader_message?: boolean | undefined, hide_form_header_message?: boolean | undefined, hide_navigation_to_payment_methods?: boolean | undefined, successful_redirect_url?: string | undefined, pending_external_action_redirect_url?: string | undefined, failed_redirect_url?: string | undefined, processed_redirect_url?: string | undefined, closed_redirect_url?: string | undefined, time_expired_redirect_url?: string | undefined, use_external_api?: boolean | undefined, ip_address?: string | undefined, payment_type?: ('regular' | 'recurring' | 'moto' | 'installment' | 'unscheduled' | 'REGULAR' | 'RECURRING' | 'MOTO' | 'INSTALLMENT' | 'UNSCHEDULED' | '') | undefined, previous_transaction_id?: string | undefined, recurring_data?: RecurringData | undefined, prev_cit_payload?: PrevCitPayload | undefined, custom_webhook_headers: unknown, paying_with_network_token?: boolean | undefined, merchant_initiated?: boolean | undefined, discount?: (Discount | null) | undefined, partial_wallet?: boolean | undefined, redirect_branding_data?: RedirectBrandingData | undefined, aft?: boolean | undefined, aft_data?: AftData | undefined, vault_region?: ('sa' | 'default' | '') | undefined, device_info?: Device | undefined, created: string, modified: string, processed_at?: (string | null) | undefined, last_indexed_at?: (string | null) | undefined, sdk_cp_version?: (string | null) | undefined, for_sandbox: boolean, redirect_strategy?: ('redirect_inside_embed' | 'redirect_entire_window' | 'redirect_to_new_tab' | '' | 'null' | null) | undefined, intent_sdk_state?: (string | null) | undefined, intent_sdk_state_details: unknown, mh_version?: (string | null) | undefined, risk_data: unknown, provider_fields: unknown, success_message?: (string | null) | undefined, fail_message?: (string | null) | undefined, mixpanel_status?: ('NOT_SENT' | 'SENDING' | 'SENT' | '' | 'null' | null) | undefined, mixpanel_transition_state?: (string | null) | undefined, loyalty_data: unknown, loyalty_context: unknown, hide_retry_button?: boolean | undefined, hide_try_different_method_button?: boolean | undefined, hide_iframe_go_back?: (boolean | null) | undefined, intent_reseted?: (boolean | null) | undefined, do_risk_checker?: (boolean | null) | undefined, fraud_data_collected: unknown, payment_method?: ('CASH_OUTLET' | 'MOBILE_WALLET' | 'CARD' | 'USSD' | 'KNET' | 'CASH_COLLECTION' | 'AMAN_MASARY' | 'PAYPAL' | 'PAY_AT_FAWRY' | 'VALU' | 'SHAHRY' | 'CASH_ON_DELIVERY' | 'BANK_INSTALLMENTS' | 'BANK_TRANSFERS' | 'REFERENCE_NUMBER' | 'SELFSERVE_WALLET' | 'APPLE_PAY' | 'CLICK2PAY' | 'GOOGLE_PAY' | 'CAREEM_PAY' | 'PAY_FLEX' | 'M_PESA' | 'MOBILE_MONEY' | 'CRYPTO_WALLET' | 'NAPS' | 'FORSA' | 'SYMPL' | 'TABBY' | 'SOUHOOLA' | 'GETGO' | 'SAMSUNG_PAY' | 'QPAY' | 'TAMARA' | 'BENEFIT' | 'RAZER' | 'ININAL' | 'STC' | 'MOKAFAA' | 'SADAD' | 'EFAWATEERCOM' | 'OMANNET' | 'MADA' | 'TAPTOPAY' | 'GRABPAY' | 'GRABPAYPAYLATER' | 'SHOPEEPAY' | 'SHOPEEPAYPAYLATER' | 'ATOME' | 'TOUCHNGO' | 'BOOST' | 'PAYNOW' | 'UPI' | 'ZAINCASH' | 'WALAONE' | 'QITAF' | 'EFT' | 'CAPITEC_PAY' | '' | 'null' | null) | undefined, recommended_payment_methods: unknown, paying_network_token_payload: unknown, bin_lookup_result: unknown, show_back_to_merchant_button?: (boolean | null) | undefined, last_fraud_service?: (string | null) | undefined, require_early_apple_pay_receipt?: (boolean | null) | undefined, requires_early_receipt?: (boolean | null) | undefined, merchant_reference?: (string | null) | undefined, hide_filled_billing_fields?: (boolean | null) | undefined, apple_pay_receipt: unknown, apple_pay_reset_method_button?: (boolean | null) | undefined, google_pay_receipt: unknown, click2pay_receipt: unknown, receipt: unknown, is_embedded?: (boolean | null) | undefined, merchant_origin?: (string | null) | undefined, number_of_transactions?: (number | null) | undefined, polymorphic_ctype: number | null, agentic_token?: (string | null) | undefined, paying_bankaccount_token?: (string | null) | undefined, tokenizing_subscription?: (string | null) | undefined}; export type CreateApiApiV14PaymentsChargeCardTokenArgs = {body: BaseIntent}; export type CreateApiApiV14PaymentsChargeCardTokenOptions = {baseUrl?: string | undefined, ApiKeyAuth?: string | undefined, fetch?: typeof fetch | undefined}; export const billingDataSerializerField = z.object({name: z.string().max(100).nullable().optional(), first_name: z.string().max(100).nullable().optional(), last_name: z.string().max(150).nullable().optional(), email: z.string().nullable().optional(), phone_number: z.string().nullable().optional(), address: z.string().max(500).optional(), address1: z.string().max(500).optional(), apartment: z.string().max(10).optional(), floor: z.string().max(10).optional(), building: z.string().max(255).optional(), street: z.string().max(500).optional(), city: z.string().max(255).optional(), state: z.string().max(255).nullable().optional(), country: z.string().max(255).optional(), postal_code: z.string().max(10).optional(), mobile_wallet_number: z.string().nullable().optional()}); export const shippingData = z.object({phone_number: z.string().nullable().optional(), first_name: z.string().max(100).optional(), last_name: z.string().max(150).optional(), email: z.string().nullable().optional(), address: z.string().max(150).optional(), country: z.string().max(50).optional(), state: z.string().max(50).optional(), city: z.string().max(50).optional(), postal_code: z.string().max(10).optional(), street: z.string().max(50).optional(), floor: z.string().max(10).optional(), building: z.string().max(10).optional(), apartment: z.string().max(10).optional(), description: z.string().nullable().optional(), shipping_method: z.string().max(50).optional(), area: z.string().max(50).optional(), created: z.string(), modified: z.string()}); export const generalAmountsTitle = z.object({en: z.string(), ar: z.string().optional(), fr: z.string().optional()}); export const discount = z.object({title: generalAmountsTitle, value: z.string(), type: z.enum(["percentage", "amount"])}); export const fees = z.object({title: generalAmountsTitle, value: z.string(), discount: discount.nullable().optional()}); export const statementDescriptor = z.object({business_name: z.string().nullable().optional(), business_city: z.string().nullable().optional(), business_country: z.string().nullable().optional()}); export const productItems = z.object({name: z.string(), amount: z.string(), unit_amount: z.string().optional(), description: z.string(), quantity: z.number().int(), category: z.enum(["Animals & Pet Supplies", "Apparel & Accessories", "Arts & Entertainment", "Baby & Toddler", "Business & Industrial", "Cameras & Optics", "Electronics", "Food, Beverages & Tobacco", "Furniture", "Hardware", "Health & Beauty", "Home & Garden", "Luggage & Bags", "Mature", "Media", "Office Supplies", "Religious & Ceremonial", "Software", "Sporting Goods", "Toys & Games", "Vehicles & Parts", "Crypto"]).optional(), subcategory: z.enum(["Live Animals", "Pet Supplies", "Clothing", "Clothing Accessories", "Costumes & Accessories", "Handbag & Wallet Accessories", "Handbags, Wallets & Cases", "Jewelry", "Shoe Accessories", "Shoes", "Event Tickets", "Hobbies & Creative Arts", "Party & Celebration", "Baby Bathing", "Baby Gift Sets", "Baby Health", "Baby Safety", "Baby Toys & Activity Equipment", "Baby Transport", "Baby Transport Accessories", "Diapering", "Nursing & Feeding", "Potty Training", "Swaddling & Receiving Blankets", "Advertising & Marketing", "Agriculture", "Automation Control Components", "Construction", "Dentistry", "Film & Television", "Finance & Insurance", "Food Service", "Forestry & Logging", "Hairdressing & Cosmetology", "Heavy Machinery", "Hotel & Hospitality", "Industrial Storage", "Industrial Storage Accessories", "Janitorial Carts & Caddies", "Law Enforcement", "Manufacturing", "Material Handling", "Medical", "Mining & Quarrying", "Piercing & Tattooing", "Retail", "Science & Laboratory", "Signage", "Work Safety Protective Gear", "Camera & Optic Accessories", "Cameras", "Optics", "Photography", "Arcade Equipment", "Audio", "Circuit Boards & Components", "Communications", "Components", "Computers", "Electronics Accessories", "GPS Accessories", "GPS Navigation Systems", "GPS Tracking Devices", "Marine Electronics", "Networking", "Print, Copy, Scan & Fax", "Radar Detectors", "Speed Radars", "Toll Collection Devices", "Video", "Video Game Console Accessories", "Video Game Consoles", "Beverages", "Food Items", "Tobacco Products", "Baby & Toddler Furniture", "Beds & Accessories", "Benches", "Cabinets & Storage", "Carts & Islands", "Chair Accessories", "Chairs", "Entertainment Centers & TV Stands", "Furniture Sets", "Futon Frames", "Futon Pads", "Futons", "Office Furniture", "Office Furniture Accessories", "Ottomans", "Outdoor Furniture", "Outdoor Furniture Accessories", "Room Divider Accessories", "Room Dividers", "Shelving", "Shelving Accessories", "Sofa Accessories", "Sofas", "Table Accessories", "Tables", "Building Consumables", "Building Materials", "Fencing & Barriers", "Fuel", "Fuel Containers & Tanks", "Hardware Accessories", "Hardware Pumps", "Heating, Ventilation & Air Conditioning", "Locks & Keys", "Plumbing", "Power & Electrical Supplies", "Small Engines", "Storage Tanks", "Tool Accessories", "Tools", "Health Care", "Jewelry Cleaning & Care", "Personal Care", "Bathroom Accessories", "Business & Home Security", "Decor", "Emergency Preparedness", "Fireplace & Wood Stove Accessories", "Fireplaces", "Flood, Fire & Gas Safety", "Household Appliance Accessories", "Household Appliances", "Household Supplies", "Kitchen & Dining", "Lawn & Garden", "Lighting", "Lighting Accessories", "Linens & Bedding", "Parasols & Rain Umbrellas", "Plants", "Pool & Spa", "Smoking Accessories", "Umbrella Sleeves & Cases", "Wood Stoves", "Backpacks", "Briefcases", "Cosmetic & Toiletry Bags", "Diaper Bags", "Dry Boxes", "Duffel Bags", "Fanny Packs", "Garment Bags", "Luggage Accessories", "Messenger Bags", "Shopping Totes", "Suitcases", "Train Cases", "Erotic", "Weapons", "Books", "Carpentry & Woodworking Project Plans", "DVDs & Videos", "Magazines & Newspapers", "Music & Sound Recordings", "Product Manuals", "Sheet Music", "Book Accessories", "Desk Pads & Blotters", "Filing & Organization", "General Office Supplies", "Impulse Sealers", "Lap Desks", "Name Plates", "Office & Chair Mats", "Office Carts", "Office Equipment", "Office Instruments", "Paper Handling", "Presentation Supplies", "Shipping Supplies", "Memorial Ceremony Supplies", "Religious Items", "Wedding Ceremony Supplies", "Computer Software", "Digital Goods & Currency", "Video Game Software", "Athletics", "Exercise & Fitness", "Indoor Games", "Outdoor Recreation", "Game Timers", "Games", "Outdoor Play Equipment", "Puzzles", "Toys", "Vehicle Parts & Accessories", "Vehicles", "Cryptocurrency", "Token"]).optional(), type: z.enum(["Physical", "Digital"]).optional(), image_url: z.string().max(2000).nullable().optional(), sku: z.string().optional(), tax: z.string().optional(), extra_information: z.unknown(), discount: discount.nullable().optional()}); export const fraudDataDeliveryDetailsSerializerField = z.object({delivery_type: z.enum(["DIGITAL", "PHYSICAL", "HYBRID"]), delivery_method: z.string()}); export const fraudDataSerializerField = z.object({order_type: z.enum(["web", "mobile", "ios", "android", "mail_order", "merchant_initiated", "unknown", "WEB", "MOBILE", "IOS", "ANDROID", "MAIL_ORDER", "MERCHANT_INITIATED", "UNKNOWN"]), primary_delivery_details: fraudDataDeliveryDetailsSerializerField, account_id: z.string(), customer_created_at: z.number().int(), forter_token_cookie: z.string().optional()}); export const customFormFields = z.object({name: z.string(), value: z.string().optional(), label: z.string(), type: z.enum(["CharField", "BooleanField", "IntegerField", "ChoiceField"]), required: z.boolean(), choices: z.unknown(), help_text: z.string().optional(), max_length: z.number().int().gte(1).lte(255).optional(), min_length: z.number().int().gte(1).lte(255).optional(), min_value: z.number().int().gte(-2147483648).lte(2147483647).optional(), max_value: z.number().int().gte(-2147483648).lte(2147483648).optional()}); export const customFormDefinition = z.object({form_title: z.string(), fields: z.array(customFormFields)}); export const cardTokenData = z.object({cvv: z.string().min(3).max(4).nullable().optional()}); export const threeDS = z.object({enabled: z.boolean(), challenge_indicator: z.string().optional()}); export const recurringData = z.object({mh_subscription_id: z.string().optional(), agreement_id: z.string().optional(), number_of_payments: z.number().int().optional(), days_between_payments: z.number().int().optional(), expiry_date: z.string().optional()}); export const cKOPrevCitPayload = z.object({previous_payment_id: z.string()}); export const noonSubscription = z.object({identifier: z.string()}); export const nOONPrevCitPayload = z.object({subscription: noonSubscription}); export const aPSPrevCitPayload = z.object({agreement_id: z.string()}); export const mPGSAgreement = z.object({id: z.string()}); export const mPGSPrevCitPayload = z.object({agreement: mPGSAgreement}); export const geideaCofAgreement = z.object({id: z.string()}); export const gEIDEAPrevCitPayload = z.object({cofAgreement: geideaCofAgreement}); export const cYBERSOURCEPrevCitPayload = z.object({agreementId: z.string()}); export const prevCitPayload = z.object({CKO: cKOPrevCitPayload.optional(), NOON: nOONPrevCitPayload.optional(), APS: aPSPrevCitPayload.optional(), MPGS: mPGSPrevCitPayload.optional(), GEIDEA: gEIDEAPrevCitPayload.optional(), CYBERSOURCE: cYBERSOURCEPrevCitPayload.optional()}); export const redirectBrandingData = z.object({color: z.string().optional(), background_color: z.string().optional(), size: z.string().optional(), icon: z.string().max(2000).optional(), animate: z.string().optional()}); export const aFTBaseAddress = z.object({first_name: z.string().max(100), last_name: z.string().max(100), address: z.string().max(255).optional(), postal_code: z.string().max(20).optional(), city: z.string().max(100).optional(), country: z.string().max(2)}); export const recipient = z.object({first_name: z.string().max(100), last_name: z.string().max(100), address: z.string().max(255).optional(), postal_code: z.string().max(20).optional(), city: z.string().max(100).optional(), country: z.string().max(2), account_type: z.enum(["wallet", "bank_account", "iban", "card_number"]), id: z.string().max(100)}); export const aftData = z.object({type: z.enum(["account_to_account", "supplier_payments", "bank_initiated_p2p", "bill_payment", "cash_deposit", "card_bill_payment", "funds_disbursement", "funds_transfer", "government_disbursement", "loyalty", "merchant_settlement", "gambling_payout", "payroll", "p2p", "prepaid_topup", "wallet_transfer", "cryptocurrency", "b2b_payment", "debit_topup", "other"]), purpose: z.enum(["family_support", "expatriation", "travel", "education", "medical_treatment", "emergency_need", "savings", "gifts", "other", "salary", "crowd_lending", "crypto_purchase", "high_risk_securities", "donations", "financial_services", "insurance", "investment", "it_services", "leisure", "pension", "royalties", "high_risk", "income", "loan_payment"]), sender: aFTBaseAddress, recipient: recipient}); export const device = z.object({user_agent: z.string(), timestamp: z.string().optional(), language: z.string().optional(), color_depth: z.string().optional(), screen_height: z.string().optional(), screen_width: z.string().optional(), timezone: z.string().optional()}); export const baseIntent = z.object({id: z.string(), description: z.string().optional(), amount: z.string(), amount_currency: z.string(), operation: z.enum(["purchase", "authorize", "PURCHASE", "AUTHORIZE", ""]).optional(), webhook_url: z.string().max(2000), billing_data: billingDataSerializerField.optional(), shipping_data: shippingData.optional(), fees: z.array(fees).optional(), statement_descriptor: statementDescriptor.optional(), account: z.string().optional(), flow_id: z.string().optional(), payment_provider: z.string().nullable().optional(), product_items: z.array(productItems).optional(), fraud_data: fraudDataSerializerField.optional(), custom_fields: z.unknown(), custom_form_definition: customFormDefinition.optional(), card_token: z.string().optional(), card_token_data: cardTokenData.optional(), bankaccount_token: z.string().optional(), tokenize_card: z.boolean().optional(), customer: z.string().optional(), hide_amount_sidebar: z.boolean().optional(), hide_payment_method_selector: z.boolean().optional(), hide_payment_header: z.boolean().optional(), hide_header: z.boolean().optional(), form_only: z.boolean().optional(), back_url: z.string().max(2000).optional(), top_up_wallet: z.boolean().optional(), use_wallet: z.boolean().optional(), authorization_type: z.enum(["incremental", "final", "INCREMENTAL", "FINAL", ""]).optional(), threeds: threeDS.optional(), show_save_card_checkbox: z.boolean().optional(), allow_tokenize_card: z.boolean().optional(), show_mandatory_save_card_checkbox: z.boolean().optional(), expires_after_seconds: z.number().int().optional(), show_countdown_timer: z.boolean().optional(), hidden_methods: z.array(z.enum(["CASH_OUTLET", "MOBILE_WALLET", "CARD", "USSD", "KNET", "CASH_COLLECTION", "AMAN_MASARY", "PAYPAL", "PAY_AT_FAWRY", "VALU", "SHAHRY", "CASH_ON_DELIVERY", "BANK_INSTALLMENTS", "BANK_TRANSFERS", "REFERENCE_NUMBER", "SELFSERVE_WALLET", "APPLE_PAY", "CLICK2PAY", "GOOGLE_PAY", "CAREEM_PAY", "PAY_FLEX", "M_PESA", "MOBILE_MONEY", "CRYPTO_WALLET", "NAPS", "FORSA", "SYMPL", "TABBY", "SOUHOOLA", "GETGO", "SAMSUNG_PAY", "QPAY", "TAMARA", "BENEFIT", "RAZER", "ININAL", "STC", "MOKAFAA", "SADAD", "EFAWATEERCOM", "OMANNET", "MADA", "TAPTOPAY", "GRABPAY", "GRABPAYPAYLATER", "SHOPEEPAY", "SHOPEEPAYPAYLATER", "ATOME", "TOUCHNGO", "BOOST", "PAYNOW", "UPI", "ZAINCASH", "WALAONE", "QITAF", "EFT", "CAPITEC_PAY"])).optional(), create_customer: z.boolean().optional(), customer_details: z.unknown(), hide_loader_message: z.boolean().optional(), hide_form_header_message: z.boolean().optional(), hide_navigation_to_payment_methods: z.boolean().optional(), successful_redirect_url: z.string().max(2000).optional(), pending_external_action_redirect_url: z.string().max(2000).optional(), failed_redirect_url: z.string().max(2000).optional(), processed_redirect_url: z.string().max(2000).optional(), closed_redirect_url: z.string().max(2000).optional(), time_expired_redirect_url: z.string().max(2000).optional(), use_external_api: z.boolean().optional(), ip_address: z.string().optional(), payment_type: z.enum(["regular", "recurring", "moto", "installment", "unscheduled", "REGULAR", "RECURRING", "MOTO", "INSTALLMENT", "UNSCHEDULED", ""]).optional(), previous_transaction_id: z.string().optional(), recurring_data: recurringData.optional(), prev_cit_payload: prevCitPayload.optional(), custom_webhook_headers: z.unknown(), paying_with_network_token: z.boolean().optional(), merchant_initiated: z.boolean().optional(), discount: discount.nullable().optional(), partial_wallet: z.boolean().optional(), redirect_branding_data: redirectBrandingData.optional(), aft: z.boolean().optional(), aft_data: aftData.optional(), vault_region: z.enum(["sa", "default", ""]).optional(), device_info: device.optional(), created: z.string(), modified: z.string(), processed_at: z.string().nullable().optional(), last_indexed_at: z.string().nullable().optional(), sdk_cp_version: z.string().max(255).nullable().optional(), for_sandbox: z.boolean(), redirect_strategy: z.enum(["redirect_inside_embed", "redirect_entire_window", "redirect_to_new_tab", "", "null"]).nullable().optional(), intent_sdk_state: z.string().max(100).nullable().optional(), intent_sdk_state_details: z.unknown(), mh_version: z.string().max(20).nullable().optional(), risk_data: z.unknown(), provider_fields: z.unknown(), success_message: z.string().max(255).nullable().optional(), fail_message: z.string().max(255).nullable().optional(), mixpanel_status: z.enum(["NOT_SENT", "SENDING", "SENT", "", "null"]).nullable().optional(), mixpanel_transition_state: z.string().nullable().optional(), loyalty_data: z.unknown(), loyalty_context: z.unknown(), hide_retry_button: z.boolean().optional(), hide_try_different_method_button: z.boolean().optional(), hide_iframe_go_back: z.boolean().nullable().optional(), intent_reseted: z.boolean().nullable().optional(), do_risk_checker: z.boolean().nullable().optional(), fraud_data_collected: z.unknown(), payment_method: z.enum(["CASH_OUTLET", "MOBILE_WALLET", "CARD", "USSD", "KNET", "CASH_COLLECTION", "AMAN_MASARY", "PAYPAL", "PAY_AT_FAWRY", "VALU", "SHAHRY", "CASH_ON_DELIVERY", "BANK_INSTALLMENTS", "BANK_TRANSFERS", "REFERENCE_NUMBER", "SELFSERVE_WALLET", "APPLE_PAY", "CLICK2PAY", "GOOGLE_PAY", "CAREEM_PAY", "PAY_FLEX", "M_PESA", "MOBILE_MONEY", "CRYPTO_WALLET", "NAPS", "FORSA", "SYMPL", "TABBY", "SOUHOOLA", "GETGO", "SAMSUNG_PAY", "QPAY", "TAMARA", "BENEFIT", "RAZER", "ININAL", "STC", "MOKAFAA", "SADAD", "EFAWATEERCOM", "OMANNET", "MADA", "TAPTOPAY", "GRABPAY", "GRABPAYPAYLATER", "SHOPEEPAY", "SHOPEEPAYPAYLATER", "ATOME", "TOUCHNGO", "BOOST", "PAYNOW", "UPI", "ZAINCASH", "WALAONE", "QITAF", "EFT", "CAPITEC_PAY", "", "null"]).nullable().optional(), recommended_payment_methods: z.unknown(), paying_network_token_payload: z.unknown(), bin_lookup_result: z.unknown(), show_back_to_merchant_button: z.boolean().nullable().optional(), last_fraud_service: z.string().max(255).nullable().optional(), require_early_apple_pay_receipt: z.boolean().nullable().optional(), requires_early_receipt: z.boolean().nullable().optional(), merchant_reference: z.string().max(90).nullable().optional(), hide_filled_billing_fields: z.boolean().nullable().optional(), apple_pay_receipt: z.unknown(), apple_pay_reset_method_button: z.boolean().nullable().optional(), google_pay_receipt: z.unknown(), click2pay_receipt: z.unknown(), receipt: z.unknown(), is_embedded: z.boolean().nullable().optional(), merchant_origin: z.string().max(2000).nullable().optional(), number_of_transactions: z.number().int().gte(-2147483648).lte(2147483647).nullable().optional(), polymorphic_ctype: z.number().int().nullable(), agentic_token: z.string().nullable().optional(), paying_bankaccount_token: z.string().nullable().optional(), tokenizing_subscription: z.string().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 }; /** * Charge card token * * POST /api/v1.4/payments/charge-card-token/ * * Also accepts auth: AccessTokenAuth */ export const createApiApiV14PaymentsChargeCardToken = async (args: CreateApiApiV14PaymentsChargeCardTokenArgs, options?: CreateApiApiV14PaymentsChargeCardTokenOptions) => { const {baseUrl = "https://web.moneyhash.io", fetch: fetchFn = fetch, ApiKeyAuth} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('content-type', "application/json") headers.set('accept', "application/json") if (ApiKeyAuth !== undefined) headers.set("X-Api-Key", ApiKeyAuth) const url = `${baseUrl.replace(/\/+$/, '')}/api/v1.4/payments/charge-card-token/${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(baseIntent, await res.json()) };