import {z} from 'zod' export type AdditionalDataDto = {total_items?: number | undefined, device_channel?: ('SDK' | 'BROWSER') | undefined, status_reason?: string | undefined, challenge_indicator?: ('01' | '02' | '03' | '04' | '90') | undefined, challenge_cancel?: ('01' | '02' | '03' | '04' | '05' | '06' | '07') | undefined, acs_url?: string | undefined, acs_operator_id?: string | undefined, network_score?: unknown | undefined, reason_code?: string | undefined, reason_desc?: string | undefined}; export type ThreedAuthenticationDto = {eci_flag?: ('05' | '06' | '07' | '02' | '01' | '00') | undefined, enrolled?: ('Y' | 'N' | 'U' | 'B') | undefined, cavv?: string | undefined, cavv_algorithm?: string | undefined, pares_status?: ('Y' | 'N' | 'U' | 'A' | 'C' | 'R') | undefined, xid?: string | undefined, threeds_version?: ('1.0.2' | '2.1.0' | '2.2.0') | undefined, ds_transaction_id?: string | undefined, signature_verification?: ('Y' | 'N') | undefined, verification?: (Array<'DENIED' | 'NON_PARTICIPATION' | 'UNABLE_TO_AUTHENTICATE' | 'MERCHANT_NOT_ENROLLED' | 'WITH_CRYPTOGRAM' | 'WITHOUT_CRYPTOGRAM'>) | undefined, error_desc?: string | undefined, error_no?: string | undefined, authentication_amount?: number | undefined, additional_data?: AdditionalDataDto | undefined}; export type PaymentFrequency = {time_unit: 'DAY' | 'WEEK' | 'MONTH' | 'YEAR', value?: number | undefined}; export type ProcessingModelDetailsDto = {total_payment_number?: number | undefined, total_payment_amount?: number | undefined, first_payment_amount?: number | undefined, payment_frequency?: PaymentFrequency | undefined, processing_model: 'UNSCHEDULED_CREDENTIAL_ON_FILE' | 'CREDENTIAL_ON_FILE' | 'RECURRING' | 'NONE' | 'REAUTHORIZATION', merchant_signup_code?: string | undefined, current_payment_number?: number | undefined, amount_fixed?: boolean | undefined}; export type CustomerDetailsShippingInformationDto = {address: string, city: string, country: unknown, postal_code: string, email?: string | undefined, first_name?: string | undefined, last_name?: string | undefined, phone?: string | undefined, state?: string | undefined}; export type CustomerDetailsDto = {title?: string | undefined, first_name?: string | undefined, middle_name?: string | undefined, last_name?: string | undefined, company_name?: string | undefined, phone_number?: string | undefined, email_address?: string | undefined, shipping?: CustomerDetailsShippingInformationDto | undefined, billing?: ({address_1?: string | undefined, address_2?: string | undefined, address_3?: string | undefined, city?: string | undefined, country?: ('ZZ' | 'AD' | 'AE' | 'AF' | 'AG' | 'AI' | 'AL' | 'AM' | 'AO' | 'AQ' | 'AR' | 'AS' | 'AT' | 'AU' | 'AW' | 'AX' | 'AZ' | 'BA' | 'BB' | 'BD' | 'BE' | 'BF' | 'BG' | 'BH' | 'BI' | 'BJ' | 'BL' | 'BM' | 'BN' | 'BO' | 'BQ' | 'BR' | 'BS' | 'BT' | 'BV' | 'BW' | 'BY' | 'BZ' | 'CA' | 'CC' | 'CD' | 'CF' | 'CG' | 'CH' | 'CI' | 'CK' | 'CL' | 'CM' | 'CN' | 'CO' | 'CR' | 'CU' | 'CV' | 'CW' | 'CX' | 'CY' | 'CZ' | 'DE' | 'DJ' | 'DK' | 'DM' | 'DO' | 'DZ' | 'EC' | 'EE' | 'EG' | 'EH' | 'ER' | 'ES' | 'ET' | 'FI' | 'FJ' | 'FK' | 'FM' | 'FO' | 'FR' | 'GA' | 'GB' | 'GD' | 'GE' | 'GF' | 'GG' | 'GH' | 'GI' | 'GL' | 'GM' | 'GN' | 'GP' | 'GQ' | 'GR' | 'GS' | 'GT' | 'GU' | 'GW' | 'GY' | 'HK' | 'HM' | 'HN' | 'HR' | 'HT' | 'HU' | 'ID' | 'IE' | 'IL' | 'IM' | 'IN' | 'IO' | 'IQ' | 'IR' | 'IS' | 'IT' | 'JE' | 'JM' | 'JO' | 'JP' | 'KE' | 'KG' | 'KH' | 'KI' | 'KM' | 'KN' | 'KP' | 'KR' | 'KW' | 'KY' | 'KZ' | 'LA' | 'LB' | 'LC' | 'LI' | 'LK' | 'LR' | 'LS' | 'LT' | 'LU' | 'LV' | 'LY' | 'MA' | 'MC' | 'MD' | 'ME' | 'MF' | 'MG' | 'MH' | 'MK' | 'ML' | 'MM' | 'MN' | 'MO' | 'MP' | 'MQ' | 'MR' | 'MS' | 'MT' | 'MU' | 'MV' | 'MW' | 'MX' | 'MY' | 'MZ' | 'NA' | 'NC' | 'NE' | 'NF' | 'NG' | 'NI' | 'NL' | 'NO' | 'NP' | 'NR' | 'NU' | 'NZ' | 'OM' | 'PA' | 'PE' | 'PF' | 'PG' | 'PH' | 'PK' | 'PL' | 'PM' | 'PN' | 'PR' | 'PS' | 'PT' | 'PW' | 'PY' | 'QA' | 'RE' | 'RO' | 'RS' | 'RU' | 'RW' | 'SA' | 'SB' | 'SC' | 'SD' | 'SE' | 'SG' | 'SH' | 'SI' | 'SJ' | 'SK' | 'SL' | 'SM' | 'SN' | 'SO' | 'SR' | 'SS' | 'ST' | 'SV' | 'SX' | 'SY' | 'SZ' | 'TC' | 'TD' | 'TF' | 'TG' | 'TH' | 'TJ' | 'TK' | 'TL' | 'TM' | 'TN' | 'TO' | 'TR' | 'TT' | 'TV' | 'TW' | 'TZ' | 'UA' | 'UG' | 'UM' | 'US' | 'UY' | 'UZ' | 'VA' | 'VC' | 'VE' | 'VG' | 'VI' | 'VN' | 'VU' | 'WF' | 'WS' | 'YE' | 'YT' | 'ZA' | 'ZM' | 'ZW') | undefined, phone?: string | undefined, postal_code?: string | undefined, state?: string | undefined}) | undefined, language?: string | undefined}; export type CardBrand = string; export type InstalmentDto = {down_payment_amount?: number | undefined, number_of_instalments?: number | undefined, instalment_amount?: number | undefined}; export type TokenPreferenceDto = {token_scope: string, reuse_token_type?: ('CHASE' | 'INTERNAL' | 'TAVE') | undefined, token_type?: ('REUSE' | 'ANALYTICS' | 'REUSE_AND_ANALYTICS') | undefined, token_expiry_date?: string | undefined}; export type PromoFinancingDetails = {promoFinancingType?: ('PROMO_APR' | 'PROMO_AND_AFTER_APR') | undefined, promoPlan?: string | undefined, promoPlanExpiry?: string | undefined}; export type EncryptedCardPaymentRequest = {payment_provider_contract: unknown, amount: number, auth_type?: ('PRE_AUTH' | 'FINAL_AUTH') | undefined, capture_now?: boolean | undefined, customer?: unknown | undefined, customer_ip?: (string | string) | undefined, dynamic_descriptor?: string | undefined, invoice_number?: string | undefined, merchant_reference?: string | undefined, threed_authentication?: ThreedAuthenticationDto | undefined, stored_credential?: ({stored_credential_type: 'SIGNUP' | 'CHARGE', processing_model_details: ProcessingModelDetailsDto, first_payment?: boolean | undefined, scheme_reference?: string | undefined}) | undefined, shipping_information?: ({address: string, city: string, country: unknown, postal_code: string, email?: string | undefined, first_name?: string | undefined, last_name?: string | undefined, phone?: number | undefined, state?: string | undefined}) | undefined, customer_details?: CustomerDetailsDto | undefined, shopper_interaction?: ('ECOMMERCE' | 'MAIL' | 'TELEPHONE') | undefined, user_agent?: string | undefined, sales_description?: string | undefined, sca_exemption?: ('1' | '2' | '3' | '4' | '5' | '6') | undefined, currency_code: 'AED' | 'AFN' | 'ALL' | 'AMD' | 'ANG' | 'AOA' | 'ARS' | 'AUD' | 'AWG' | 'AZN' | 'BAM' | 'BBD' | 'BDT' | 'BGN' | 'BHD' | 'BIF' | 'BMD' | 'BND' | 'BOB' | 'BOV' | 'BRL' | 'BSD' | 'BTN' | 'BWP' | 'BYR' | 'BZD' | 'CAD' | 'CDF' | 'CHE' | 'CHF' | 'CHW' | 'CLF' | 'CLP' | 'CNY' | 'COP' | 'COU' | 'CRC' | 'CUC' | 'CUP' | 'CVE' | 'CZK' | 'DJF' | 'DKK' | 'DOP' | 'DZD' | 'EGP' | 'ERN' | 'ETB' | 'EUR' | 'FJD' | 'FKP' | 'GBP' | 'GEL' | 'GHS' | 'GIP' | 'GMD' | 'GNF' | 'GTQ' | 'GYD' | 'HKD' | 'HNL' | 'HRK' | 'HTG' | 'HUF' | 'IDR' | 'ILS' | 'INR' | 'IQD' | 'IRR' | 'ISK' | 'JMD' | 'JOD' | 'JPY' | 'KES' | 'KGS' | 'KHR' | 'KMF' | 'KPW' | 'KRW' | 'KWD' | 'KYD' | 'KZT' | 'LAK' | 'LBP' | 'LKR' | 'LRD' | 'LSL' | 'LTL' | 'LVL' | 'LYD' | 'MAD' | 'MDL' | 'MGA' | 'MKD' | 'MMK' | 'MNT' | 'MOP' | 'MRO' | 'MUR' | 'MVR' | 'MWK' | 'MXN' | 'MXV' | 'MYR' | 'MZN' | 'NAD' | 'NGN' | 'NIO' | 'NOK' | 'NPR' | 'NZD' | 'OMR' | 'PAB' | 'PEN' | 'PGK' | 'PHP' | 'PKR' | 'PLN' | 'PYG' | 'QAR' | 'RON' | 'RSD' | 'RUB' | 'RWF' | 'SAR' | 'SBD' | 'SCR' | 'SDG' | 'SEK' | 'SGD' | 'SHP' | 'SLL' | 'SOS' | 'SRD' | 'SSP' | 'STD' | 'SVC' | 'SYP' | 'SZL' | 'THB' | 'TJS' | 'TMT' | 'TND' | 'TOP' | 'TRY' | 'TTD' | 'TWD' | 'TZS' | 'UAH' | 'UGX' | 'USD' | 'USN' | 'USS' | 'UYI' | 'UYU' | 'UZS' | 'VEF' | 'VND' | 'VUV' | 'WST' | 'XAF' | 'XAG' | 'XAU' | 'XBA' | 'XBB' | 'XBC' | 'XBD' | 'XCD' | 'XDR' | 'XOF' | 'XPD' | 'XPF' | 'XPT' | 'XTS' | 'XXX' | 'YER' | 'ZAR' | 'ZMK' | 'ZMW' | 'BTC', card_brand?: CardBrand | undefined, brand_choice?: ('MERCHANT' | 'CARDHOLDER') | undefined, credit_term?: ('STANDARD' | 'PREFERED' | 'DEBIT' | 'INSTALMENT_STANDARD' | 'INSTALMENT_CREDIT') | undefined, instalment?: InstalmentDto | undefined, refusal_reason?: ('ACQUIRER_COMMS_FAILURE' | 'ACQUIRER_REFUSED' | 'CARD_BRAND_NOT_ACCEPTED' | 'CARD_EXPIRED' | 'CARD_NOT_ACCEPTED' | 'CARD_NOT_VALID' | 'CARD_PRODUCT_NOT_ACCEPTED' | 'ORIGINAL_TRANSACTION_NOT_FOUND' | 'INVALID_BIN' | 'PARTIAL_AUTH_NOT_ALLOWED' | 'RECEIPT_FAILURE' | 'REFUND_NOT_ACCEPTED' | 'THREEDSECURE_FAILED_ACS' | 'THREEDSECURE_FAILED_AUTH' | 'THREEDSECURE_FAILED_COMMS' | 'UNAPPROVED_OPERATOR' | 'UNKNOWN_REASON') | undefined, encrypted_card: string, token_preference?: TokenPreferenceDto | undefined, encrypted_svc_access_code?: string | undefined, public_key_alias: string, promo_code?: string | undefined, promo_financing_details?: PromoFinancingDetails | undefined, purchase_order_number?: string | undefined, tax_indicator?: ('TAX_PROVIDED' | 'TAX_NOT_PROVIDED' | 'NON_TAXABLE') | undefined, receipt_type?: ('FULL_RECEIPT' | 'INVOICE' | 'INVOICE_RECEIPT' | 'SIMPLE_RECEIPT' | 'NONE') | undefined}; export type TokenDetailsRequestBody = {expiry_month?: number | undefined, expiry_year?: number | undefined}; export type DetailedAmount = {gratuity_amount?: number | undefined, tax_amount?: number | undefined, surcharge_amount?: number | undefined}; export type TokenPaymentRequest = {payment_provider_contract: unknown, amount: number, auth_type?: ('PRE_AUTH' | 'FINAL_AUTH') | undefined, capture_now?: boolean | undefined, customer?: unknown | undefined, customer_ip?: (string | string) | undefined, dynamic_descriptor?: string | undefined, invoice_number?: string | undefined, merchant_reference?: string | undefined, threed_authentication?: ThreedAuthenticationDto | undefined, encrypted_cvv?: string | undefined, encrypted_svc_access_code?: string | undefined, public_key_alias?: string | undefined, stored_credential?: ({stored_credential_type: 'SIGNUP' | 'CHARGE', processing_model_details: ProcessingModelDetailsDto, first_payment?: boolean | undefined, scheme_reference?: string | undefined}) | undefined, receipt_type?: ('FULL_RECEIPT' | 'INVOICE' | 'INVOICE_RECEIPT' | 'SIMPLE_RECEIPT' | 'NONE') | undefined, shipping_information?: ({address: string, city: string, country: unknown, postal_code: string, email?: string | undefined, first_name?: string | undefined, last_name?: string | undefined, phone?: number | undefined, state?: string | undefined}) | undefined, customer_details?: CustomerDetailsDto | undefined, shopper_interaction?: ('ECOMMERCE' | 'MAIL' | 'TELEPHONE') | undefined, user_agent?: string | undefined, sales_description?: string | undefined, sca_exemption?: ('1' | '2' | '3' | '4' | '5' | '6') | undefined, currency_code: 'AED' | 'AFN' | 'ALL' | 'AMD' | 'ANG' | 'AOA' | 'ARS' | 'AUD' | 'AWG' | 'AZN' | 'BAM' | 'BBD' | 'BDT' | 'BGN' | 'BHD' | 'BIF' | 'BMD' | 'BND' | 'BOB' | 'BOV' | 'BRL' | 'BSD' | 'BTN' | 'BWP' | 'BYR' | 'BZD' | 'CAD' | 'CDF' | 'CHE' | 'CHF' | 'CHW' | 'CLF' | 'CLP' | 'CNY' | 'COP' | 'COU' | 'CRC' | 'CUC' | 'CUP' | 'CVE' | 'CZK' | 'DJF' | 'DKK' | 'DOP' | 'DZD' | 'EGP' | 'ERN' | 'ETB' | 'EUR' | 'FJD' | 'FKP' | 'GBP' | 'GEL' | 'GHS' | 'GIP' | 'GMD' | 'GNF' | 'GTQ' | 'GYD' | 'HKD' | 'HNL' | 'HRK' | 'HTG' | 'HUF' | 'IDR' | 'ILS' | 'INR' | 'IQD' | 'IRR' | 'ISK' | 'JMD' | 'JOD' | 'JPY' | 'KES' | 'KGS' | 'KHR' | 'KMF' | 'KPW' | 'KRW' | 'KWD' | 'KYD' | 'KZT' | 'LAK' | 'LBP' | 'LKR' | 'LRD' | 'LSL' | 'LTL' | 'LVL' | 'LYD' | 'MAD' | 'MDL' | 'MGA' | 'MKD' | 'MMK' | 'MNT' | 'MOP' | 'MRO' | 'MUR' | 'MVR' | 'MWK' | 'MXN' | 'MXV' | 'MYR' | 'MZN' | 'NAD' | 'NGN' | 'NIO' | 'NOK' | 'NPR' | 'NZD' | 'OMR' | 'PAB' | 'PEN' | 'PGK' | 'PHP' | 'PKR' | 'PLN' | 'PYG' | 'QAR' | 'RON' | 'RSD' | 'RUB' | 'RWF' | 'SAR' | 'SBD' | 'SCR' | 'SDG' | 'SEK' | 'SGD' | 'SHP' | 'SLL' | 'SOS' | 'SRD' | 'SSP' | 'STD' | 'SVC' | 'SYP' | 'SZL' | 'THB' | 'TJS' | 'TMT' | 'TND' | 'TOP' | 'TRY' | 'TTD' | 'TWD' | 'TZS' | 'UAH' | 'UGX' | 'USD' | 'USN' | 'USS' | 'UYI' | 'UYU' | 'UZS' | 'VEF' | 'VND' | 'VUV' | 'WST' | 'XAF' | 'XAG' | 'XAU' | 'XBA' | 'XBB' | 'XBC' | 'XBD' | 'XCD' | 'XDR' | 'XOF' | 'XPD' | 'XPF' | 'XPT' | 'XTS' | 'XXX' | 'YER' | 'ZAR' | 'ZMK' | 'ZMW' | 'BTC', card_brand?: CardBrand | undefined, brand_choice?: ('MERCHANT' | 'CARDHOLDER') | undefined, credit_term?: ('STANDARD' | 'PREFERED' | 'DEBIT' | 'INSTALMENT_STANDARD' | 'INSTALMENT_CREDIT') | undefined, instalment?: InstalmentDto | undefined, refusal_reason?: ('ACQUIRER_COMMS_FAILURE' | 'ACQUIRER_REFUSED' | 'CARD_BRAND_NOT_ACCEPTED' | 'CARD_EXPIRED' | 'CARD_NOT_ACCEPTED' | 'CARD_NOT_VALID' | 'CARD_PRODUCT_NOT_ACCEPTED' | 'ORIGINAL_TRANSACTION_NOT_FOUND' | 'INVALID_BIN' | 'PARTIAL_AUTH_NOT_ALLOWED' | 'RECEIPT_FAILURE' | 'REFUND_NOT_ACCEPTED' | 'THREEDSECURE_FAILED_ACS' | 'THREEDSECURE_FAILED_AUTH' | 'THREEDSECURE_FAILED_COMMS' | 'UNAPPROVED_OPERATOR' | 'UNKNOWN_REASON') | undefined, reuse_token: string, reuse_token_type?: ('CHASE' | 'INTERNAL' | 'TAVE') | undefined, reuse_token_details?: TokenDetailsRequestBody | undefined, promo_code?: string | undefined, promo_financing_details?: PromoFinancingDetails | undefined, purchase_order_number?: string | undefined, tax_indicator?: ('TAX_PROVIDED' | 'TAX_NOT_PROVIDED' | 'NON_TAXABLE') | undefined, detailed_amount?: DetailedAmount | undefined}; export type CreateApiApiV2TransactionsCardArgs = {'x-vfi-api-idempotencykey'?: string | undefined, body: EncryptedCardPaymentRequest | TokenPaymentRequest}; export type CreateApiApiV2TransactionsCardOptions = {baseUrl?: string | undefined, BasicAuth?: {username: string, password: string} | undefined, fetch?: typeof fetch | undefined}; export const customerDetailsShippingInformationDto = z.object({address: z.string().max(300), city: z.string().max(28), country: z.string().min(2).max(2), postal_code: z.string().min(1).max(16), email: z.string().min(3).max(254).optional(), first_name: z.string().max(100).optional(), last_name: z.string().max(100).optional(), phone: z.string().max(18).optional(), state: z.string().max(35).optional()}); export const customerDetailsDto = z.object({title: z.string().max(120).optional(), first_name: z.string().max(100).optional(), middle_name: z.string().max(100).optional(), last_name: z.string().max(100).optional(), company_name: z.string().max(100).optional(), phone_number: z.string().max(25).optional(), email_address: z.string().optional(), shipping: customerDetailsShippingInformationDto.optional(), billing: z.object({address_1: z.string().max(40).optional(), address_2: z.string().max(40).optional(), address_3: z.string().max(40).optional(), city: z.string().max(28).optional(), country: z.enum(["ZZ", "AD", "AE", "AF", "AG", "AI", "AL", "AM", "AO", "AQ", "AR", "AS", "AT", "AU", "AW", "AX", "AZ", "BA", "BB", "BD", "BE", "BF", "BG", "BH", "BI", "BJ", "BL", "BM", "BN", "BO", "BQ", "BR", "BS", "BT", "BV", "BW", "BY", "BZ", "CA", "CC", "CD", "CF", "CG", "CH", "CI", "CK", "CL", "CM", "CN", "CO", "CR", "CU", "CV", "CW", "CX", "CY", "CZ", "DE", "DJ", "DK", "DM", "DO", "DZ", "EC", "EE", "EG", "EH", "ER", "ES", "ET", "FI", "FJ", "FK", "FM", "FO", "FR", "GA", "GB", "GD", "GE", "GF", "GG", "GH", "GI", "GL", "GM", "GN", "GP", "GQ", "GR", "GS", "GT", "GU", "GW", "GY", "HK", "HM", "HN", "HR", "HT", "HU", "ID", "IE", "IL", "IM", "IN", "IO", "IQ", "IR", "IS", "IT", "JE", "JM", "JO", "JP", "KE", "KG", "KH", "KI", "KM", "KN", "KP", "KR", "KW", "KY", "KZ", "LA", "LB", "LC", "LI", "LK", "LR", "LS", "LT", "LU", "LV", "LY", "MA", "MC", "MD", "ME", "MF", "MG", "MH", "MK", "ML", "MM", "MN", "MO", "MP", "MQ", "MR", "MS", "MT", "MU", "MV", "MW", "MX", "MY", "MZ", "NA", "NC", "NE", "NF", "NG", "NI", "NL", "NO", "NP", "NR", "NU", "NZ", "OM", "PA", "PE", "PF", "PG", "PH", "PK", "PL", "PM", "PN", "PR", "PS", "PT", "PW", "PY", "QA", "RE", "RO", "RS", "RU", "RW", "SA", "SB", "SC", "SD", "SE", "SG", "SH", "SI", "SJ", "SK", "SL", "SM", "SN", "SO", "SR", "SS", "ST", "SV", "SX", "SY", "SZ", "TC", "TD", "TF", "TG", "TH", "TJ", "TK", "TL", "TM", "TN", "TO", "TR", "TT", "TV", "TW", "TZ", "UA", "UG", "UM", "US", "UY", "UZ", "VA", "VC", "VE", "VG", "VI", "VN", "VU", "WF", "WS", "YE", "YT", "ZA", "ZM", "ZW"]).optional(), phone: z.string().max(25).optional(), postal_code: z.string().max(10).optional(), state: z.string().max(35).optional()}).optional(), language: z.string().optional()}); export const storedCredential = z.object({reference: z.string().optional(), stored_credential_type: z.string().optional(), scheme_reference: z.string().optional(), processing_model: z.enum(["UNSCHEDULED_CREDENTIAL_ON_FILE", "CREDENTIAL_ON_FILE", "RECURRING", "REAUTHORIZATION", "NONE"]).optional(), details: z.enum(["UNSCHEDULED_CREDENTIAL_ON_FILE", "CREDENTIAL_ON_FILE", "RECURRING"]).optional()}); export const details = z.object({auto_capture: z.boolean().optional(), mid: z.string().optional()}); export const threedAuthentication = z.object({eci_flag: z.enum(["05", "06", "07", "02", "01", "00"]).optional(), enrolled: z.enum(["Y", "N", "U", "B"]).optional(), cavv: z.string().min(28).max(48).optional(), cavv_algorithm: z.string().optional(), pares_status: z.enum(["Y", "N", "U", "A", "C", "R"]).optional(), xid: z.string().optional(), threeds_version: z.enum(["1.0.2", "2.1.0", "2.2.0"]).optional(), ds_transaction_id: z.string().optional()}); export const acquirerResponseCode = z.string().max(4); export const acquirerResponseMessage = z.string(); export const acquirerAuthorizingNetworkID = z.string(); export const acquirerAuthorizingNetworkIdDescriptor = z.string(); export const initiatorTraceId = z.string().max(40); export const settlementDate = z.string(); export const additionalData = z.object({acquirer_response_code: acquirerResponseCode.optional(), acquirer_response_message: acquirerResponseMessage.optional(), acquirer_authorizing_network_id: acquirerAuthorizingNetworkID.optional(), acquirer_authorizing_network_id_descriptor: acquirerAuthorizingNetworkIdDescriptor.optional(), initiator_trace_id: initiatorTraceId.optional(), settlement_date: settlementDate.optional(), issuer_receipt_text: z.string().optional()}); export const issuerCountryEnum = z.enum(["ZZZ", "ABW", "AFG", "AGO", "AIA", "ALA", "ALB", "AND", "ARE", "ARG", "ARM", "ASM", "ATA", "ATF", "ATG", "AUS", "AUT", "AZE", "BDI", "BEL", "BEN", "BES", "BFA", "BGD", "BGR", "BHR", "BHS", "BIH", "BLM", "BLR", "BLZ", "BMU", "BOL", "BRA", "BRB", "BSB", "BRN", "BTN", "BVT", "BWA", "CAF", "CAN", "CCK", "CHE", "CHL", "CHN", "CIV", "CMR", "COD", "COG", "COK", "COL", "COM", "CPV", "CRI", "CUB", "CUW", "CXR", "CYM", "CYP", "CZE", "DEU", "DJI", "DMA", "DNK", "DOM", "DZA", "ECU", "EGY", "ERI", "ESH", "ESP", "EST", "ETH", "FIN", "FJI", "FLK", "FRA", "FRO", "FSM", "GAB", "GBR", "GEO", "GGY", "GHA", "GIB", "GIN", "GLP", "GMB", "GNB", "GNQ", "GRC", "GRD", "GRL", "GTM", "GUF", "GUM", "GUY", "HKG", "HMD", "HND", "HRV", "HTI", "HUN", "IDN", "IMN", "IND", "IOT", "IRL", "IRN", "IRQ", "ISL", "ISR", "ITA", "JAM", "JEY", "JOR", "JPN", "KAZ", "KEN", "KGZ", "KHM", "KIR", "KNA", "KOR", "KWT", "LAO", "LBN", "LBR", "LBY", "LCA", "LIE", "LKA", "LSO", "LTU", "LUX", "LVA", "MAC", "MAF", "MAR", "MCO", "MDA", "MDG", "MDV", "MEX", "MHL", "MKD", "MLI", "MLT", "MMR", "MNE", "MNG", "MNP", "MOZ", "MRT", "MSR", "MTQ", "MUS", "MWI", "MYS", "MYT", "NAM", "NCL", "NER", "NFK", "NGA", "NIC", "NIU", "NLD", "NOR", "NPL", "NRU", "NZL", "OMN", "PAK", "PAN", "PCN", "PER", "PHL", "PLW", "PNG", "POL", "PRI", "PRK", "PRT", "PRY", "PSE", "PYF", "QAT", "REU", "ROU", "RUS", "RWA", "SAU", "SDN", "SEN", "SGC", "SGP", "SHN", "SJM", "SLB", "SLE", "SLV", "SMR", "SOM", "SPM", "SRB", "SSD", "STP", "SUR", "SVK", "SVN", "SWE", "SWZ", "SXM", "SYC", "SYR", "TCA", "TCD", "TGO", "THA", "TJK", "TKL", "TKM", "TLS", "TON", "TTO", "TUN", "TUR", "TUV", "TWN", "TZA", "UGA", "UKR", "UMI", "URY", "USA", "UZB", "VAT", "VCT", "VEN", "VGB", "VIR", "VNM", "VUT", "WLF", "WSM", "YEM", "ZAF", "ZMB", "ZWE"]); export const tokenDetails = z.object({reuse_token: z.string().min(14).max(255).optional(), reuse_token_type: z.enum(["CHASE", "INTERNAL", "TAVE"]).optional(), analytics_token: z.string().optional(), token_expiry_date: z.string().optional(), token_scope: z.string().optional(), token_status: z.enum(["DELETED", "ACTIVE", "SUSPENDED"]).optional(), created_at: z.string().optional(), updated_at: z.string().optional(), variant: z.string().optional(), type: z.enum(["CREDIT", "DEBIT"]).optional(), issuer_name: z.string().optional(), issuer_country: issuerCountryEnum.optional(), brand: z.string().optional(), expiry_year: z.number().int().lte(9999).optional(), expiry_month: z.number().int().lte(12).optional(), card_holder_name: z.string().max(30).optional(), last_four: z.string().max(4).optional(), bin: z.string().min(4).max(11).optional(), currency_code: z.enum(["AED", "AFN", "ALL", "AMD", "ANG", "AOA", "ARS", "AUD", "AWG", "AZN", "BAM", "BBD", "BDT", "BGN", "BHD", "BIF", "BMD", "BND", "BOB", "BOV", "BRL", "BSD", "BTN", "BWP", "BYR", "BZD", "CAD", "CDF", "CHE", "CHF", "CHW", "CLF", "CLP", "CNY", "COP", "COU", "CRC", "CUC", "CUP", "CVE", "CZK", "DJF", "DKK", "DOP", "DZD", "EGP", "ERN", "ETB", "EUR", "FJD", "FKP", "GBP", "GEL", "GHS", "GIP", "GMD", "GNF", "GTQ", "GYD", "HKD", "HNL", "HRK", "HTG", "HUF", "IDR", "ILS", "INR", "IQD", "IRR", "ISK", "JMD", "JOD", "JPY", "KES", "KGS", "KHR", "KMF", "KPW", "KRW", "KWD", "KYD", "KZT", "LAK", "LBP", "LKR", "LRD", "LSL", "LTL", "LVL", "LYD", "MAD", "MDL", "MGA", "MKD", "MMK", "MNT", "MOP", "MRO", "MUR", "MVR", "MWK", "MXN", "MXV", "MYR", "MZN", "NAD", "NGN", "NIO", "NOK", "NPR", "NZD", "OMR", "PAB", "PEN", "PGK", "PHP", "PKR", "PLN", "PYG", "QAR", "RON", "RSD", "RUB", "RWF", "SAR", "SBD", "SCR", "SDG", "SEK", "SGD", "SHP", "SLL", "SOS", "SRD", "SSP", "STD", "SVC", "SYP", "SZL", "THB", "TJS", "TMT", "TND", "TOP", "TRY", "TTD", "TWD", "TZS", "UAH", "UGX", "USD", "USN", "USS", "UYI", "UYU", "UZS", "VEF", "VND", "VUV", "WST", "XAF", "XAG", "XAU", "XBA", "XBB", "XBC", "XBD", "XCD", "XDR", "XOF", "XPD", "XPF", "XPT", "XTS", "XXX", "YER", "ZAR", "ZMK", "ZMW", "BTC"]).optional()}); export const promoFinancingResults = z.object({promoFinancingType: z.enum(["PROMO_APR", "PROMO_AND_AFTER_APR", "NO_PROMO", "ERROR"]).optional(), promoAnnualPercentageRateType: z.enum(["FIXED", "VARIABLE"]).optional(), promoAnnualPercentageRate: z.number().optional(), annualPercentageRateType: z.enum(["FIXED", "VARIABLE"]).optional(), annualPercentageRate: z.number().optional(), promoDurationDescription: z.string().optional(), promoDescription: z.string().optional()}); export const amountDecimal = z.number(); export const paymentPlanOption = z.object({number_of_instalments: z.number().int().gte(1).optional(), first_instalment_amount: amountDecimal.optional(), instalment_amount: amountDecimal.optional(), interest_rate: z.number().optional(), annual_percentage_rate: z.number().optional(), handling_fee: amountDecimal.optional(), total_amount_with_cost: amountDecimal.optional()}); export const ecomPaymentResponseIssuerInstalmentResult = z.object({instalment_program: z.literal("MCINST").optional(), payment_option: z.enum(["FULL", "FULL_OR_INSTALMENT", "INSTALMENT"]).optional(), payment_plan_option: z.array(paymentPlanOption).optional(), number_of_instalments: z.number().int().gte(0).optional(), min_number_of_instalments: z.number().int().optional(), max_number_of_instalments: z.number().int().optional(), interest_rate: z.number().optional(), annual_percentage_rate: z.number().optional(), handling_fee: amountDecimal.optional(), down_payment_amount: amountDecimal.optional(), instalment_amount: amountDecimal.optional(), total_amount_with_cost: amountDecimal.optional()}); export const ecomResponseCard = z.object({id: z.string().optional(), payment_provider_contract: z.string().optional(), amount: z.number().int().optional(), blocked: z.boolean().optional(), created_at: z.string().optional(), customer: z.string().optional(), merchant_reference: z.string().optional(), payment_product: z.string().optional(), payment_product_type: z.string().optional(), processor_reference: z.string().optional(), processor_details: z.object({}).optional(), status: z.enum(["INITIATED", "AUTHORIZED", "AUTHORIZATION_VOIDED", "CANCELLED", "CUSTOMER_ACCEPTED", "REFUNDED", "FAILED", "PENDING", "DECLINED", "SETTLEMENT_CANCELLED", "SETTLEMENT_REQUESTED", "SETTLEMENT_SUBMITTED", "SETTLEMENT_COMPLETED", "SETTLEMENT_PARTIAL", "SETTLEMENT_DECLINED", "VOIDED", "UNKNOWN"]).optional(), status_reason: z.string().optional(), shipping_information: z.object({address: z.string().max(300), city: z.string().max(28), country: z.string().min(2).max(2), postal_code: z.string().min(1).max(16), email: z.string().min(3).max(254).optional(), first_name: z.string().max(100).optional(), last_name: z.string().max(100).optional(), phone: z.number().optional(), state: z.string().max(35).optional()}).optional(), customer_details: customerDetailsDto.optional(), arn: z.string().optional(), authorization_code: z.string().max(6).optional(), avs_result: z.enum(["A", "B", "C", "D", "E", "F", "G", "I", "K", "L", "M", "N", "O", "P", "R", "S", "T", "U", "W", "X", "Y", "Z"]).optional(), card: z.string().optional(), created_by: z.string().optional(), cvv_present: z.boolean().optional(), cvv_result: z.enum(["0", "1", "2", "3", "4", "5", "6", "9", "M", "Y", "N", "P", "S", "U"]).optional(), cavv_result: z.enum(["0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "99", "A", "B", "C", "D", "I", "U", "NA"]).optional(), invoice_number: z.string().max(127).optional(), stored_credential: storedCredential.optional(), details: details.optional(), reason_code: z.string().max(4).optional(), rrn: z.string().max(12).optional(), shopper_interaction: z.enum(["ECOMMERCE", "MAIL", "TELEPHONE"]).optional(), stan: z.string().optional(), threed_authentication: threedAuthentication.optional(), reversal_status: z.enum(["NONE", "REQUIRED", "COMPLETED"]).optional(), geo_location: z.array(z.number()).optional(), city: z.string().optional(), country_code: z.string().optional(), additional_data: additionalData.optional(), token_details: tokenDetails.optional(), promo_code: z.string().optional(), promo_financing_result: promoFinancingResults.optional(), purchase_order_number: z.string().max(17).optional(), issuer_instalment_result: ecomPaymentResponseIssuerInstalmentResult.optional(), balance_amount: z.number().int().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 }; /** * Initiate a payment * * POST /api/v2/transactions/card * * Also accepts auth: BearerAuth */ export const createApiApiV2TransactionsCard = async (args: CreateApiApiV2TransactionsCardArgs, options?: CreateApiApiV2TransactionsCardOptions) => { const {baseUrl = "https://emea.gsc.verifone.cloud/oidc/checkout-service", fetch: fetchFn = fetch, BasicAuth} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('content-type', "application/json") headers.set('accept', "application/json") if (args['x-vfi-api-idempotencykey'] != null) headers.set("x-vfi-api-idempotencykey", String(args['x-vfi-api-idempotencykey'])) if (BasicAuth !== undefined) headers.set('authorization', `Basic ${btoa(`${BasicAuth.username}:${BasicAuth.password}`)}`) const url = `${baseUrl.replace(/\/+$/, '')}/api/v2/transactions/card${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(ecomResponseCard, await res.json()) };