import {z} from 'zod' export type ItemsPayablesCommonPayableAttachment = {object: 'Attachment', id: string, name: string, mime_type: string, url: string, include_in_check_insert?: boolean | undefined}; export type IsoCurrencyCode = 'AED' | 'AUD' | 'BHD' | 'BRL' | 'BSD' | 'CAD' | 'CHF' | 'CNY' | 'COP' | 'CRC' | 'CZK' | 'DKK' | 'DOP' | 'EGP' | 'EUR' | 'GBP' | 'GHS' | 'GTQ' | 'HKD' | 'HNL' | 'HUF' | 'IDR' | 'INR' | 'ILS' | 'JPY' | 'KES' | 'KRW' | 'KWD' | 'KZT' | 'MOP' | 'MXN' | 'MYR' | 'NGN' | 'NIO' | 'NOK' | 'NZD' | 'OMR' | 'PAB' | 'PEN' | 'PHP' | 'PKR' | 'PLN' | 'QAR' | 'RON' | 'SAR' | 'SEK' | 'SGD' | 'THB' | 'TRY' | 'TWD' | 'UGX' | 'USD' | 'UYU' | 'VND' | 'ZAR'; export type LedgersXeroXeroNewPayableMeta = {memo?: string | undefined, tax_style?: ('exclusive' | 'inclusive' | 'none') | undefined} | {[key: string]: unknown}; export type LedgersNetsuiteNetSuiteAccount = {id: string}; export type LedgersNetsuiteNetSuiteClass = {id: string}; export type LedgersNetsuiteNetSuiteLocation = {id: string}; export type LedgersNetsuiteNetSuitePostingPeriod = {id: string}; export type LedgersNetsuiteNetSuiteNewPayableMeta = {account?: LedgersNetsuiteNetSuiteAccount | undefined, class?: LedgersNetsuiteNetSuiteClass | undefined, location?: LedgersNetsuiteNetSuiteLocation | undefined, memo?: string | undefined, posting_period?: LedgersNetsuiteNetSuitePostingPeriod | undefined} | {[key: string]: unknown}; export type LedgersQboQBONewPayableMeta = {memo?: string | undefined} | {[key: string]: unknown}; export type LedgersQboQBOClass = {id: string}; export type LedgersQboQBODepartment = {id: string}; export type LedgersNetsuiteNetSuiteAmortizationSchedule = {id: string}; export type LedgersNetsuiteNetSuiteDepartment = {id: string}; export type LedgersSageSageAccount = {id: string}; export type LedgersSageSageClass = {id: string}; export type LedgersSageSageContract = {id: string}; export type LedgersSageSageDepartment = {id: string}; export type LedgersSageSageEmployee = {id: string}; export type LedgersSageSageItem = {id: string}; export type LedgersSageSageLocation = {id: string}; export type LedgersSageSageProject = {id: string}; export type LedgersSageSageTask = {id: string}; export type LedgersSageSageWarehouse = {id: string}; export type ItemsPayablesCommonNewPayableLineItem = {account?: {id: string} | undefined, amount: unknown, description: string, is_taxable?: boolean | undefined, item?: {id: string} | undefined, quantity?: unknown | undefined, style?: 'item' | undefined, tax?: {id: string} | undefined, unit_price: unknown, ledger?: ({[key: string]: unknown} | {billable?: ('billable' | 'not-billable') | undefined, class?: LedgersQboQBOClass | undefined, customer_ref?: string | undefined, department?: LedgersQboQBODepartment | undefined, markup?: unknown | undefined} | {[key: string]: unknown} | {amortiz_start_date?: string | undefined, amortization_end_date?: string | undefined, amortization_residual?: string | undefined, amortization_sched?: LedgersNetsuiteNetSuiteAmortizationSchedule | undefined, class?: LedgersNetsuiteNetSuiteClass | undefined, customer_ref?: string | undefined, department?: LedgersNetsuiteNetSuiteDepartment | undefined, location?: LedgersNetsuiteNetSuiteLocation | undefined} | {[key: string]: unknown} | {account?: LedgersSageSageAccount | undefined, class?: LedgersSageSageClass | undefined, contract?: LedgersSageSageContract | undefined, customer_ref?: string | undefined, department?: LedgersSageSageDepartment | undefined, employee?: LedgersSageSageEmployee | undefined, item?: LedgersSageSageItem | undefined, location?: LedgersSageSageLocation | undefined, project?: LedgersSageSageProject | undefined, task?: LedgersSageSageTask | undefined, vendor_ref?: string | undefined, warehouse?: LedgersSageSageWarehouse | undefined}) | undefined, purchase_order_id?: string | undefined, purchase_order_line_item_id?: string | undefined}; export type LedgersXeroXeroNewPayableLineItemMeta = {[key: string]: unknown}; export type LedgersQboQBONewPayableLineItemMeta = {billable?: ('billable' | 'not-billable') | undefined, class?: LedgersQboQBOClass | undefined, customer_ref?: string | undefined, department?: LedgersQboQBODepartment | undefined, markup?: unknown | undefined} | {[key: string]: unknown}; export type LedgersNetsuiteNetSuiteNewPayableLineItemMeta = {amortiz_start_date?: string | undefined, amortization_end_date?: string | undefined, amortization_residual?: string | undefined, amortization_sched?: LedgersNetsuiteNetSuiteAmortizationSchedule | undefined, class?: LedgersNetsuiteNetSuiteClass | undefined, customer_ref?: string | undefined, department?: LedgersNetsuiteNetSuiteDepartment | undefined, location?: LedgersNetsuiteNetSuiteLocation | undefined} | {[key: string]: unknown}; export type LedgersSageSageNewPayableLineItemMeta = {account?: LedgersSageSageAccount | undefined, class?: LedgersSageSageClass | undefined, contract?: LedgersSageSageContract | undefined, customer_ref?: string | undefined, department?: LedgersSageSageDepartment | undefined, employee?: LedgersSageSageEmployee | undefined, item?: LedgersSageSageItem | undefined, location?: LedgersSageSageLocation | undefined, project?: LedgersSageSageProject | undefined, task?: LedgersSageSageTask | undefined, vendor_ref?: string | undefined, warehouse?: LedgersSageSageWarehouse | undefined}; export type ItemsPayablesCommonUpdatePayableLineItem = {account?: {id: string} | undefined, amount?: unknown | undefined, description?: string | undefined, is_taxable?: boolean | undefined, item?: {id: string} | undefined, quantity?: unknown | undefined, style?: 'item' | undefined, tax?: {id: string} | undefined, unit_price?: unknown | undefined, id: string, ledger?: (LedgersXeroXeroNewPayableLineItemMeta | LedgersQboQBONewPayableLineItemMeta | LedgersNetsuiteNetSuiteNewPayableLineItemMeta | LedgersSageSageNewPayableLineItemMeta) | undefined, purchase_order_id?: string | undefined, purchase_order_line_item_id?: string | undefined}; export type ItemsPayablesAchACHDeliveryMethod = 'ach_expedited' | 'ach_next_day' | 'ach_same_day' | 'ach_standard' | 'real_time_payment'; export type ItemsPayablesAchNewPayableACHTypeDetails = {addenda_record?: string | undefined}; export type ItemsPayablesAchUpdatePayableACH = {acting_team_member: string, amount?: unknown | undefined, attachments?: Array | undefined, bill_number?: string | undefined, currency_code?: IsoCurrencyCode | undefined, due_on?: string | undefined, external_id?: (string | null) | undefined, issued_on?: string | undefined, ledger?: (LedgersXeroXeroNewPayableMeta | LedgersNetsuiteNetSuiteNewPayableMeta | LedgersQboQBONewPayableMeta) | undefined, line_items?: (Array) | undefined, message?: string | undefined, pay_to_company?: string | undefined, reference?: string | undefined, send_on?: (string | null) | undefined, version: number, withdraw_from_account?: string | undefined, delivery_method?: ItemsPayablesAchACHDeliveryMethod | undefined, pay_to_payment_method?: string | undefined, type: 'ach', type_details?: ItemsPayablesAchNewPayableACHTypeDetails | undefined}; export type ItemsPayablesCardUpdatePayableCard = {acting_team_member: string, amount?: unknown | undefined, attachments?: Array | undefined, bill_number?: string | undefined, currency_code?: IsoCurrencyCode | undefined, due_on?: string | undefined, external_id?: (string | null) | undefined, issued_on?: string | undefined, ledger?: (LedgersXeroXeroNewPayableMeta | LedgersNetsuiteNetSuiteNewPayableMeta | LedgersQboQBONewPayableMeta) | undefined, line_items?: (Array) | undefined, message?: string | undefined, pay_to_company?: string | undefined, reference?: string | undefined, send_on?: (string | null) | undefined, version: number, withdraw_from_account?: string | undefined, delivery_method?: 'card_instant' | undefined, pay_to_payment_method?: string | undefined, type: 'card'}; export type ItemsPayablesCheckCheckDeliveryMethod = 'check_international' | 'check_next_day' | 'check_priority' | 'check_priority_express' | 'check_priority_signature' | 'check_standard' | 'check_standard_certified' | 'check_two_day'; export type ItemsPayablesCheckUpdatePayableCheck = {acting_team_member: string, amount?: unknown | undefined, attachments?: Array | undefined, bill_number?: string | undefined, currency_code?: IsoCurrencyCode | undefined, due_on?: string | undefined, external_id?: (string | null) | undefined, issued_on?: string | undefined, ledger?: (LedgersXeroXeroNewPayableMeta | LedgersNetsuiteNetSuiteNewPayableMeta | LedgersQboQBONewPayableMeta) | undefined, line_items?: (Array) | undefined, message?: string | undefined, pay_to_company?: string | undefined, reference?: string | undefined, send_on?: (string | null) | undefined, version: number, withdraw_from_account?: string | undefined, delivery_method?: ItemsPayablesCheckCheckDeliveryMethod | undefined, pay_to_payment_method?: string | undefined, type: 'check'}; export type ItemsPayablesExternalUpdatePayableExternalTypeDetails = {paid_on: string, payment_method: 'ach' | 'check' | 'credit_card' | 'debit_card' | 'other' | 'payment_platform' | 'paypal' | 'wire_domestic' | 'wire_international', reference: string, skip_accounting_software?: boolean | undefined}; export type ItemsPayablesExternalUpdatePayableExternal = {acting_team_member: string, amount?: unknown | undefined, attachments?: Array | undefined, bill_number?: string | undefined, currency_code?: IsoCurrencyCode | undefined, due_on?: string | undefined, external_id?: (string | null) | undefined, issued_on?: string | undefined, ledger?: (LedgersXeroXeroNewPayableMeta | LedgersNetsuiteNetSuiteNewPayableMeta | LedgersQboQBONewPayableMeta) | undefined, line_items?: (Array) | undefined, message?: string | undefined, pay_to_company?: string | undefined, reference?: string | undefined, send_on?: (string | null) | undefined, version: number, withdraw_from_account?: string | undefined, type: 'external', type_details: ItemsPayablesExternalUpdatePayableExternalTypeDetails}; export type SharedSwiftChargeOption = 'sha' | 'our' | null; export type ItemsPayablesInternationalNewPayableInternationalTypeDetails = {addenda_record?: (string | null) | undefined, purpose_code?: (string | null) | undefined, swift_charge_option?: SharedSwiftChargeOption | undefined}; export type ItemsPayablesInternationalUpdatePayableInternational = {acting_team_member: string, amount?: unknown | undefined, attachments?: Array | undefined, bill_number?: string | undefined, currency_code?: IsoCurrencyCode | undefined, due_on?: string | undefined, external_id?: (string | null) | undefined, issued_on?: string | undefined, ledger?: (LedgersXeroXeroNewPayableMeta | LedgersNetsuiteNetSuiteNewPayableMeta | LedgersQboQBONewPayableMeta) | undefined, line_items?: (Array) | undefined, message?: string | undefined, pay_to_company?: string | undefined, reference?: string | undefined, send_on?: (string | null) | undefined, version: number, withdraw_from_account?: string | undefined, currency_code_recipient?: IsoCurrencyCode | undefined, delivery_method?: ('international_ach' | 'international_swift' | 'international_vendor_choice') | undefined, pay_to_payment_method?: string | undefined, type: 'international', type_details?: ItemsPayablesInternationalNewPayableInternationalTypeDetails | undefined}; export type ItemsPayablesVendorChoiceNewPayableVendorChoiceTypeDetails = {delivery_method_choices?: (Array<'ach' | 'card' | 'check' | 'paypal'>) | undefined}; export type ItemsPayablesVendorChoiceUpdatePayableVendorChoice = {acting_team_member: string, amount?: unknown | undefined, attachments?: Array | undefined, bill_number?: string | undefined, currency_code?: IsoCurrencyCode | undefined, due_on?: string | undefined, external_id?: (string | null) | undefined, issued_on?: string | undefined, ledger?: (LedgersXeroXeroNewPayableMeta | LedgersNetsuiteNetSuiteNewPayableMeta | LedgersQboQBONewPayableMeta) | undefined, line_items?: (Array) | undefined, message?: string | undefined, pay_to_company?: string | undefined, reference?: string | undefined, send_on?: (string | null) | undefined, version: number, withdraw_from_account?: string | undefined, type: 'vendor_choice', type_details?: ItemsPayablesVendorChoiceNewPayableVendorChoiceTypeDetails | undefined}; export type ItemsPayablesDiscriminatedUpdatePayable = ItemsPayablesAchUpdatePayableACH | ItemsPayablesCardUpdatePayableCard | ItemsPayablesCheckUpdatePayableCheck | ItemsPayablesExternalUpdatePayableExternal | ItemsPayablesInternationalUpdatePayableInternational | ItemsPayablesVendorChoiceUpdatePayableVendorChoice; export type PatchApiV1PayablesIdArgs = {id: string, 'Idempotency-Key'?: string | undefined, body: ItemsPayablesDiscriminatedUpdatePayable}; export type PatchApiV1PayablesIdOptions = {baseUrl?: string | undefined, BearerAuth?: string | undefined, fetch?: typeof fetch | undefined}; export const isoCurrencyCode = z.enum(["AED", "AUD", "BHD", "BRL", "BSD", "CAD", "CHF", "CNY", "COP", "CRC", "CZK", "DKK", "DOP", "EGP", "EUR", "GBP", "GHS", "GTQ", "HKD", "HNL", "HUF", "IDR", "INR", "ILS", "JPY", "KES", "KRW", "KWD", "KZT", "MOP", "MXN", "MYR", "NGN", "NIO", "NOK", "NZD", "OMR", "PAB", "PEN", "PHP", "PKR", "PLN", "QAR", "RON", "SAR", "SEK", "SGD", "THB", "TRY", "TWD", "UGX", "USD", "UYU", "VND", "ZAR"]).min(3).max(3); export const itemsCommonStatus = z.enum(["canceled", "completed", "compliance_hold", "created", "externally_paid", "failed", "initiated", "issue", "needs_approval", "pending", "po_discrepancy_hold", "processing", "ready_to_send", "scheduled"]); export const itemsCommonStatusChangeItem = z.object({changed_at: z.string(), status: z.enum(["analyzing", "canceled", "completed", "compliance_hold", "created", "externally_paid", "failed", "import", "initiated", "issue", "needs_approval", "new", "ocr", "pending", "po_discrepancy_hold", "processing", "ready_to_send", "scheduled"])}); export const sharedSelfLink = z.string(); export const itemsCommonItemLinks = z.object({self: sharedSelfLink, confirmation: z.string().nullable().optional()}); export const itemsPayablesCommonPayableAttachment = z.object({object: z.literal("Attachment"), id: z.string(), name: z.string(), mime_type: z.string(), url: z.string(), include_in_check_insert: z.boolean().optional()}); export const itemsPayablesCommonPayableFailureDetail = z.object({description: z.string().optional(), occurred_at: z.string().optional(), type: z.enum(["compliance_failure", "funding_failure", "invalid_bank_account_currency", "invalid_bank_account_inactive", "invalid_company_name", "other_unknown", "rejected_refused", "technical_error"]).optional()}).nullable(); export const ledgersNetsuiteNetSuiteAccount = z.object({id: z.string()}); export const ledgersNetsuiteNetSuiteClass = z.object({id: z.string()}); export const ledgersNetsuiteNetSuiteLocation = z.object({id: z.string()}); export const ledgersNetsuiteNetSuitePostingPeriod = z.object({id: z.string()}); export const ledgersCommonLedgerCommonPayableMeta = z.object({id: z.string().nullable().optional(), status: z.enum(["canceled", "deleted", "draft", "error", "needs_approval", "needs_import", "no_ledger", "not_synced", "paid", "pending"]).optional()}).and(z.record(z.string(), z.unknown())); export const ledgersXeroXeroNewPayableLineItemMeta = z.record(z.string(), z.unknown()); export const ledgersQboQBOClass = z.object({id: z.string()}); export const ledgersQboQBODepartment = z.object({id: z.string()}); export const ledgersQboQBONewPayableLineItemMeta = z.object({billable: z.enum(["billable", "not-billable"]).optional(), class: ledgersQboQBOClass.optional(), customer_ref: z.string().optional(), department: ledgersQboQBODepartment.optional(), markup: z.string().optional()}).and(z.record(z.string(), z.unknown())); export const ledgersNetsuiteNetSuiteAmortizationSchedule = z.object({id: z.string()}); export const ledgersNetsuiteNetSuiteDepartment = z.object({id: z.string()}); export const ledgersNetsuiteNetSuiteNewPayableLineItemMeta = z.object({amortiz_start_date: z.string().optional(), amortization_end_date: z.string().optional(), amortization_residual: z.string().optional(), amortization_sched: ledgersNetsuiteNetSuiteAmortizationSchedule.optional(), class: ledgersNetsuiteNetSuiteClass.optional(), customer_ref: z.string().optional(), department: ledgersNetsuiteNetSuiteDepartment.optional(), location: ledgersNetsuiteNetSuiteLocation.optional()}).and(z.record(z.string(), z.unknown())); export const ledgersSageSageAccount = z.object({id: z.string()}); export const ledgersSageSageClass = z.object({id: z.string()}); export const ledgersSageSageContract = z.object({id: z.string()}); export const ledgersSageSageDepartment = z.object({id: z.string()}); export const ledgersSageSageEmployee = z.object({id: z.string()}); export const ledgersSageSageItem = z.object({id: z.string()}); export const ledgersSageSageLocation = z.object({id: z.string()}); export const ledgersSageSageProject = z.object({id: z.string()}); export const ledgersSageSageTask = z.object({id: z.string()}); export const ledgersSageSageWarehouse = z.object({id: z.string()}); export const ledgersSageSageNewPayableLineItemMeta = z.object({account: ledgersSageSageAccount.optional(), class: ledgersSageSageClass.optional(), contract: ledgersSageSageContract.optional(), customer_ref: z.string().optional(), department: ledgersSageSageDepartment.optional(), employee: ledgersSageSageEmployee.optional(), item: ledgersSageSageItem.optional(), location: ledgersSageSageLocation.optional(), project: ledgersSageSageProject.optional(), task: ledgersSageSageTask.optional(), vendor_ref: z.string().optional(), warehouse: ledgersSageSageWarehouse.optional()}); export const itemsPayablesCommonPayableLineItem = z.object({account: z.object({id: z.string()}).optional(), amount: z.string().optional(), description: z.string().optional(), is_taxable: z.boolean().optional(), item: z.object({id: z.string()}).optional(), quantity: z.string().optional(), style: z.literal("item").optional(), tax: z.object({id: z.string()}).optional(), unit_price: z.string().optional(), object: z.literal("LineItem"), id: z.string().nullable().optional(), ledger: z.union([ledgersXeroXeroNewPayableLineItemMeta, ledgersQboQBONewPayableLineItemMeta, ledgersNetsuiteNetSuiteNewPayableLineItemMeta, ledgersSageSageNewPayableLineItemMeta]).optional(), purchase_order_id: z.string().optional(), purchase_order_line_item_id: z.string().optional()}); export const companiesCompanyLinks = z.object({self: sharedSelfLink, compliance_checks: z.string(), contacts: z.string(), payables: z.string(), payment_methods: z.string(), receivables: z.string(), tax_forms: z.string()}); export const companiesCompactCompany = z.object({object: z.literal("Company"), id: z.string(), display_name: z.string(), links: companiesCompanyLinks}); export const paymentMethodsCommonPaymentMethodLinks = z.object({self: sharedSelfLink, company: z.string()}); export const paymentMethodsBankPaymentMethodBankTypeDetails = z.object({account_number: z.string(), account_type: z.enum(["checking", "savings"]), currency_code: z.enum(["AED", "AUD", "BHD", "BRL", "BSD", "CAD", "CHF", "CNY", "COP", "CRC", "CZK", "DKK", "DOP", "EGP", "EUR", "GBP", "GHS", "GTQ", "HKD", "HNL", "HUF", "IDR", "INR", "ILS", "JPY", "KES", "KRW", "KWD", "KZT", "MOP", "MXN", "MYR", "NGN", "NIO", "NOK", "NZD", "OMR", "PAB", "PEN", "PHP", "PKR", "PLN", "QAR", "RON", "SAR", "SEK", "SGD", "THB", "TRY", "TWD", "UGX", "USD", "UYU", "VND", "ZAR"]).min(3).max(3).optional(), institution_name: z.string(), logo: z.string().optional(), primary_color: z.string().min(4).max(7).optional(), routing_number: z.string().optional()}); export const accountsAccountLinks = z.object({self: sharedSelfLink}); export const accountsAccountBankTypeDetails = z.object({account_number: z.string(), account_type: z.enum(["checking", "savings"]), institution_name: z.string(), logo: z.string().optional(), primary_color: z.string().min(4).max(7).optional(), routing_number: z.string().min(9).max(9)}); export const accountsAccountExternalTypeDetails = z.object({}); export const accountsAccountPayPalTypeDetails = z.object({}); export const accountsCompactAccount = z.discriminatedUnion("type", [z.object({object: z.literal("Account"), id: z.string(), type: z.literal("bank"), links: accountsAccountLinks, type_details: accountsAccountBankTypeDetails}), z.object({object: z.literal("Account"), id: z.string(), type: z.literal("balance"), links: accountsAccountLinks, type_details: z.object({})}), z.object({object: z.literal("Account"), id: z.string(), type: z.literal("external"), links: accountsAccountLinks, type_details: accountsAccountExternalTypeDetails}), z.object({object: z.literal("Account"), id: z.string(), type: z.literal("paypal"), links: accountsAccountLinks, type_details: accountsAccountPayPalTypeDetails})]); export const itemsPayablesAchPayableACHTypeDetailsParty = z.object({transaction_id: z.string().max(65).nullable(), trace_id: z.string().max(65).nullable()}); export const itemsPayablesAchPayableACHTypeDetails = z.object({addenda_record: z.string().max(80).nullable().optional(), receiver: itemsPayablesAchPayableACHTypeDetailsParty, sender: itemsPayablesAchPayableACHTypeDetailsParty, transaction_id: z.string().max(65).nullable().optional()}); export const itemsPayablesAchPayableACH = z.object({id: z.string(), amount: z.string(), amount_due: z.string(), amount_recipient: z.number().optional(), amount_sender: z.number().optional(), amount_paid: z.string(), approved_at: z.string().nullable(), bill_number: z.string().nullable(), created_at: z.string().optional(), currency_code: isoCurrencyCode.nullable().optional(), currency_code_recipient: isoCurrencyCode.nullable().optional(), currency_code_sender: isoCurrencyCode.nullable().optional(), due_on: z.string(), exchange_rate: z.string().optional(), expected_on: z.string().nullable(), external_id: z.string().nullable(), fixed_side: z.enum(["sender", "recipient"]).optional(), issued_on: z.string(), is_exchange_rate_locked: z.boolean().optional(), reference: z.string().nullable().optional(), sent_on: z.string().nullable(), status: itemsCommonStatus, status_changed_at: z.string(), status_changes: z.array(itemsCommonStatusChangeItem), links: itemsCommonItemLinks, version: z.number().int().gte(1).optional(), object: z.literal("Payable"), attachments: z.object({object: z.literal("List"), results: z.array(itemsPayablesCommonPayableAttachment)}), delivery_method: z.enum(["ach_expedited", "ach_next_day", "ach_same_day", "ach_standard", "card_instant", "check_standard", "check_international", "check_next_day", "check_priority", "check_priority_express", "check_priority_signature", "check_standard_certified", "check_two_day", "international_ach", "international_swift", "international_vendor_choice", "paypal_direct", "real_time_payment"]).nullable(), delivery_network: z.enum(["ach", "fedex", "fednow", "local_rails", "mastercard", "paypal", "rtp", "swift", "usps", "visa"]).nullable().optional(), failure_detail: itemsPayablesCommonPayableFailureDetail.optional(), ledger: z.union([z.object({memo: z.string().optional(), tax_style: z.enum(["exclusive", "inclusive", "none"]).optional(), id: z.string().nullable().optional(), status: z.enum(["canceled", "deleted", "draft", "error", "needs_approval", "needs_import", "no_ledger", "not_synced", "paid", "pending"]).optional()}).and(z.record(z.string(), z.unknown())), z.object({memo: z.string().optional(), id: z.string().nullable().optional(), status: z.enum(["canceled", "deleted", "draft", "error", "needs_approval", "needs_import", "no_ledger", "not_synced", "paid", "pending"]).optional()}).and(z.record(z.string(), z.unknown())), z.object({account: ledgersNetsuiteNetSuiteAccount.optional(), class: ledgersNetsuiteNetSuiteClass.optional(), location: ledgersNetsuiteNetSuiteLocation.optional(), memo: z.string().optional(), posting_period: ledgersNetsuiteNetSuitePostingPeriod.optional(), id: z.string().nullable().optional(), status: z.enum(["canceled", "deleted", "draft", "error", "needs_approval", "needs_import", "no_ledger", "not_synced", "paid", "pending"]).optional()}).and(z.record(z.string(), z.unknown())), ledgersCommonLedgerCommonPayableMeta]).optional(), line_items: z.object({object: z.literal("List"), results: z.array(itemsPayablesCommonPayableLineItem)}).optional(), pay_to_company: companiesCompactCompany, pay_to_payment_method: z.object({object: z.literal("PaymentMethod"), id: z.string(), links: paymentMethodsCommonPaymentMethodLinks, type: z.literal("bank"), type_details: paymentMethodsBankPaymentMethodBankTypeDetails}).nullable(), send_on: z.string().nullable(), withdraw_from_account: accountsCompactAccount.optional(), type: z.literal("ach"), type_details: itemsPayablesAchPayableACHTypeDetails}); export const isoCountryCode = z.enum(["AD", "AE", "AF", "AG", "AI", "AL", "AM", "AO", "AR", "AS", "AT", "AU", "AW", "AX", "AZ", "BA", "BB", "BD", "BE", "BF", "BG", "BH", "BI", "BJ", "BL", "BM", "BN", "BO", "BQ", "BR", "BS", "BT", "BW", "BZ", "CA", "CC", "CD", "CF", "CG", "CH", "CI", "CL", "CM", "CN", "CO", "CR", "CV", "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", "GT", "GU", "GW", "GY", "HK", "HM", "HN", "HR", "HT", "HU", "ID", "IE", "IL", "IM", "IN", "IQ", "IS", "IT", "JE", "JM", "JO", "JP", "KE", "KG", "KH", "KI", "KM", "KN", "KR", "KW", "KY", "KZ", "LA", "LB", "LC", "LI", "LK", "LR", "LS", "LT", "LU", "LV", "MA", "MC", "MD", "ME", "MF", "MG", "MH", "MK", "ML", "MN", "MO", "MP", "MQ", "MR", "MS", "MT", "MU", "MV", "MX", "MW", "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", "PT", "PW", "PY", "QA", "RE", "RO", "RS", "RW", "SA", "SB", "SC", "SE", "SG", "SH", "SI", "SJ", "SK", "SL", "SM", "SN", "SO", "SR", "ST", "SV", "SX", "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", "VI", "VN", "VU", "XK", "WF", "WS", "XX", "YE", "YT", "ZA", "ZM", "ZW"]).min(2).max(2); export const paymentMethodsCardPaymentMethodCardTypeDetails = z.object({card_type: z.literal("debit").optional(), country_code: isoCountryCode.optional(), currency_code: isoCurrencyCode.optional(), expiration: z.object({month: z.string().optional(), year: z.string().optional()}).optional(), institution_name: z.string().optional(), is_instant_supported: z.boolean().optional(), last_four_digits: z.string().optional(), network: z.enum(["mastercard", "visa"]).optional()}); export const itemsPayablesCardPayableCardTypeDetailsReceiver = z.object({transaction_id: z.string().max(65).nullable()}); export const itemsPayablesCardPayableCardTypeDetailsTransactions = z.object({receiver: itemsPayablesCardPayableCardTypeDetailsReceiver}); export const itemsPayablesCardPayableCardTypeDetails = z.object({transactions: itemsPayablesCardPayableCardTypeDetailsTransactions}); export const itemsPayablesCardPayableCard = z.object({object: z.literal("Payable"), delivery_method: z.literal("card_instant").nullable(), pay_to_payment_method: z.object({object: z.literal("PaymentMethod"), id: z.string(), links: paymentMethodsCommonPaymentMethodLinks, type: z.literal("card"), type_details: paymentMethodsCardPaymentMethodCardTypeDetails}).nullable().optional(), type: z.literal("card"), type_details: itemsPayablesCardPayableCardTypeDetails, id: z.string(), amount: z.string(), amount_due: z.string(), amount_recipient: z.number().optional(), amount_sender: z.number().optional(), amount_paid: z.string(), approved_at: z.string().nullable(), bill_number: z.string().nullable(), created_at: z.string().optional(), currency_code: isoCurrencyCode.nullable().optional(), currency_code_recipient: isoCurrencyCode.nullable().optional(), currency_code_sender: isoCurrencyCode.nullable().optional(), due_on: z.string(), exchange_rate: z.string().optional(), expected_on: z.string().nullable(), external_id: z.string().nullable(), fixed_side: z.enum(["sender", "recipient"]).optional(), issued_on: z.string(), is_exchange_rate_locked: z.boolean().optional(), reference: z.string().nullable().optional(), sent_on: z.string().nullable(), status: itemsCommonStatus, status_changed_at: z.string(), status_changes: z.array(itemsCommonStatusChangeItem), links: itemsCommonItemLinks, version: z.number().int().gte(1).optional(), attachments: z.object({object: z.literal("List"), results: z.array(itemsPayablesCommonPayableAttachment)}), delivery_network: z.enum(["ach", "fedex", "fednow", "local_rails", "mastercard", "paypal", "rtp", "swift", "usps", "visa"]).nullable().optional(), failure_detail: itemsPayablesCommonPayableFailureDetail.optional(), ledger: z.union([z.object({memo: z.string().optional(), tax_style: z.enum(["exclusive", "inclusive", "none"]).optional(), id: z.string().nullable().optional(), status: z.enum(["canceled", "deleted", "draft", "error", "needs_approval", "needs_import", "no_ledger", "not_synced", "paid", "pending"]).optional()}).and(z.record(z.string(), z.unknown())), z.object({memo: z.string().optional(), id: z.string().nullable().optional(), status: z.enum(["canceled", "deleted", "draft", "error", "needs_approval", "needs_import", "no_ledger", "not_synced", "paid", "pending"]).optional()}).and(z.record(z.string(), z.unknown())), z.object({account: ledgersNetsuiteNetSuiteAccount.optional(), class: ledgersNetsuiteNetSuiteClass.optional(), location: ledgersNetsuiteNetSuiteLocation.optional(), memo: z.string().optional(), posting_period: ledgersNetsuiteNetSuitePostingPeriod.optional(), id: z.string().nullable().optional(), status: z.enum(["canceled", "deleted", "draft", "error", "needs_approval", "needs_import", "no_ledger", "not_synced", "paid", "pending"]).optional()}).and(z.record(z.string(), z.unknown())), ledgersCommonLedgerCommonPayableMeta]).optional(), line_items: z.object({object: z.literal("List"), results: z.array(itemsPayablesCommonPayableLineItem)}).optional(), pay_to_company: companiesCompactCompany, send_on: z.string().nullable(), withdraw_from_account: accountsCompactAccount.optional()}); export const paymentMethodsAddressPaymentMethodAddressTypeDetails = z.object({address_line_1: z.string(), address_line_2: z.string().nullable().optional(), city: z.string(), country: isoCountryCode, postal_code: z.string(), state: z.string(), attention_line: z.string().optional(), print_business_name: z.string().nullable().optional(), print_name: z.string().nullable().optional(), recipient: z.string().nullable().optional()}); export const itemsPayablesCheckPayableCheckTypeDetails = z.object({check_dated_on: z.string().nullable().optional(), check_number: z.string().nullable(), expires_on: z.string().nullable().optional(), tracking_number: z.string().min(10).max(22).nullable().optional(), tracking_url: z.string().nullable().optional()}); export const itemsPayablesCheckPayableCheck = z.object({object: z.literal("Payable"), pay_to_payment_method: z.object({object: z.literal("PaymentMethod"), id: z.string(), links: paymentMethodsCommonPaymentMethodLinks, type: z.literal("address"), type_details: paymentMethodsAddressPaymentMethodAddressTypeDetails}).nullable(), send_on: z.string().nullable(), type: z.literal("check"), type_details: itemsPayablesCheckPayableCheckTypeDetails, id: z.string(), amount: z.string(), amount_due: z.string(), amount_recipient: z.number().optional(), amount_sender: z.number().optional(), amount_paid: z.string(), approved_at: z.string().nullable(), bill_number: z.string().nullable(), created_at: z.string().optional(), currency_code: isoCurrencyCode.nullable().optional(), currency_code_recipient: isoCurrencyCode.nullable().optional(), currency_code_sender: isoCurrencyCode.nullable().optional(), due_on: z.string(), exchange_rate: z.string().optional(), expected_on: z.string().nullable(), external_id: z.string().nullable(), fixed_side: z.enum(["sender", "recipient"]).optional(), issued_on: z.string(), is_exchange_rate_locked: z.boolean().optional(), reference: z.string().nullable().optional(), sent_on: z.string().nullable(), status: itemsCommonStatus, status_changed_at: z.string(), status_changes: z.array(itemsCommonStatusChangeItem), links: itemsCommonItemLinks, version: z.number().int().gte(1).optional(), attachments: z.object({object: z.literal("List"), results: z.array(itemsPayablesCommonPayableAttachment)}), delivery_method: z.enum(["ach_expedited", "ach_next_day", "ach_same_day", "ach_standard", "card_instant", "check_standard", "check_international", "check_next_day", "check_priority", "check_priority_express", "check_priority_signature", "check_standard_certified", "check_two_day", "international_ach", "international_swift", "international_vendor_choice", "paypal_direct", "real_time_payment"]).nullable(), delivery_network: z.enum(["ach", "fedex", "fednow", "local_rails", "mastercard", "paypal", "rtp", "swift", "usps", "visa"]).nullable().optional(), failure_detail: itemsPayablesCommonPayableFailureDetail.optional(), ledger: z.union([z.object({memo: z.string().optional(), tax_style: z.enum(["exclusive", "inclusive", "none"]).optional(), id: z.string().nullable().optional(), status: z.enum(["canceled", "deleted", "draft", "error", "needs_approval", "needs_import", "no_ledger", "not_synced", "paid", "pending"]).optional()}).and(z.record(z.string(), z.unknown())), z.object({memo: z.string().optional(), id: z.string().nullable().optional(), status: z.enum(["canceled", "deleted", "draft", "error", "needs_approval", "needs_import", "no_ledger", "not_synced", "paid", "pending"]).optional()}).and(z.record(z.string(), z.unknown())), z.object({account: ledgersNetsuiteNetSuiteAccount.optional(), class: ledgersNetsuiteNetSuiteClass.optional(), location: ledgersNetsuiteNetSuiteLocation.optional(), memo: z.string().optional(), posting_period: ledgersNetsuiteNetSuitePostingPeriod.optional(), id: z.string().nullable().optional(), status: z.enum(["canceled", "deleted", "draft", "error", "needs_approval", "needs_import", "no_ledger", "not_synced", "paid", "pending"]).optional()}).and(z.record(z.string(), z.unknown())), ledgersCommonLedgerCommonPayableMeta]).optional(), line_items: z.object({object: z.literal("List"), results: z.array(itemsPayablesCommonPayableLineItem)}).optional(), pay_to_company: companiesCompactCompany, withdraw_from_account: accountsCompactAccount.optional()}); export const itemsPayablesExternalPayableExternalTypeDetails = z.object({paid_on: z.string(), payment_method: z.enum(["ach", "check", "credit_card", "debit_card", "other", "payment_platform", "paypal", "wire_domestic", "wire_international"]), reference: z.string()}); export const paymentMethodsAddressCompactPaymentMethodAddress = z.object({object: z.literal("PaymentMethod"), id: z.string(), links: paymentMethodsCommonPaymentMethodLinks, type: z.literal("address"), type_details: paymentMethodsAddressPaymentMethodAddressTypeDetails}); export const paymentMethodsBankCompactPaymentMethodBank = z.object({object: z.literal("PaymentMethod"), id: z.string(), links: paymentMethodsCommonPaymentMethodLinks, type: z.literal("bank"), type_details: paymentMethodsBankPaymentMethodBankTypeDetails}); export const paymentMethodsCardCompactPaymentMethodCard = z.object({object: z.literal("PaymentMethod"), id: z.string(), links: paymentMethodsCommonPaymentMethodLinks, type: z.literal("card"), type_details: paymentMethodsCardPaymentMethodCardTypeDetails}); export const sharedAddress = z.object({address_line_1: z.string(), address_line_2: z.string().nullable().optional(), city: z.string(), country: isoCountryCode, postal_code: z.string(), state: z.string().optional()}); export const paymentMethodsInternationalPaymentMethodInternationalTypeDetails = z.object({account_number: z.string().nullable().optional(), bank_code: z.string().nullable().optional(), beneficiary_details: z.record(z.string(), z.unknown()).nullable().optional(), bic_swift: z.string().nullable().optional(), branch_code: z.string().nullable().optional(), bsb_code: z.string().nullable().optional(), clabe: z.string().nullable().optional(), cnaps: z.string().nullable().optional(), country_code: isoCountryCode.optional(), currency_code: isoCurrencyCode.optional(), iban: z.string().nullable().optional(), ifsc: z.string().nullable().optional(), institution_name: z.string().nullable().optional(), payment_types: z.enum(["all", "priority", "regular"]).optional(), recipient_address: sharedAddress.optional(), sort_code: z.string().nullable().optional()}); export const paymentMethodsInternationalCompactPaymentMethodInternational = z.object({object: z.literal("PaymentMethod"), id: z.string(), links: paymentMethodsCommonPaymentMethodLinks, type: z.literal("international"), type_details: paymentMethodsInternationalPaymentMethodInternationalTypeDetails}); export const paymentMethodsPaypalPaymentMethodPayPalTypeDetails = z.object({email: z.string()}); export const paymentMethodsPaypalCompactPaymentMethodPayPal = z.object({object: z.literal("PaymentMethod"), id: z.string(), links: paymentMethodsCommonPaymentMethodLinks, type: z.literal("paypal"), type_details: paymentMethodsPaypalPaymentMethodPayPalTypeDetails}); export const itemsPayablesExternalPayableExternal = z.object({object: z.literal("Payable"), type: z.literal("external"), type_details: itemsPayablesExternalPayableExternalTypeDetails, id: z.string(), amount: z.string(), amount_due: z.string(), amount_recipient: z.number().optional(), amount_sender: z.number().optional(), amount_paid: z.string(), approved_at: z.string().nullable(), bill_number: z.string().nullable(), created_at: z.string().optional(), currency_code: isoCurrencyCode.nullable().optional(), currency_code_recipient: isoCurrencyCode.nullable().optional(), currency_code_sender: isoCurrencyCode.nullable().optional(), due_on: z.string(), exchange_rate: z.string().optional(), expected_on: z.string().nullable(), external_id: z.string().nullable(), fixed_side: z.enum(["sender", "recipient"]).optional(), issued_on: z.string(), is_exchange_rate_locked: z.boolean().optional(), reference: z.string().nullable().optional(), sent_on: z.string().nullable(), status: itemsCommonStatus, status_changed_at: z.string(), status_changes: z.array(itemsCommonStatusChangeItem), links: itemsCommonItemLinks, version: z.number().int().gte(1).optional(), attachments: z.object({object: z.literal("List"), results: z.array(itemsPayablesCommonPayableAttachment)}), delivery_method: z.enum(["ach_expedited", "ach_next_day", "ach_same_day", "ach_standard", "card_instant", "check_standard", "check_international", "check_next_day", "check_priority", "check_priority_express", "check_priority_signature", "check_standard_certified", "check_two_day", "international_ach", "international_swift", "international_vendor_choice", "paypal_direct", "real_time_payment"]).nullable(), delivery_network: z.enum(["ach", "fedex", "fednow", "local_rails", "mastercard", "paypal", "rtp", "swift", "usps", "visa"]).nullable().optional(), failure_detail: itemsPayablesCommonPayableFailureDetail.optional(), ledger: z.union([z.object({memo: z.string().optional(), tax_style: z.enum(["exclusive", "inclusive", "none"]).optional(), id: z.string().nullable().optional(), status: z.enum(["canceled", "deleted", "draft", "error", "needs_approval", "needs_import", "no_ledger", "not_synced", "paid", "pending"]).optional()}).and(z.record(z.string(), z.unknown())), z.object({memo: z.string().optional(), id: z.string().nullable().optional(), status: z.enum(["canceled", "deleted", "draft", "error", "needs_approval", "needs_import", "no_ledger", "not_synced", "paid", "pending"]).optional()}).and(z.record(z.string(), z.unknown())), z.object({account: ledgersNetsuiteNetSuiteAccount.optional(), class: ledgersNetsuiteNetSuiteClass.optional(), location: ledgersNetsuiteNetSuiteLocation.optional(), memo: z.string().optional(), posting_period: ledgersNetsuiteNetSuitePostingPeriod.optional(), id: z.string().nullable().optional(), status: z.enum(["canceled", "deleted", "draft", "error", "needs_approval", "needs_import", "no_ledger", "not_synced", "paid", "pending"]).optional()}).and(z.record(z.string(), z.unknown())), ledgersCommonLedgerCommonPayableMeta]).optional(), line_items: z.object({object: z.literal("List"), results: z.array(itemsPayablesCommonPayableLineItem)}).optional(), pay_to_company: companiesCompactCompany, pay_to_payment_method: z.union([paymentMethodsAddressCompactPaymentMethodAddress, paymentMethodsBankCompactPaymentMethodBank, paymentMethodsCardCompactPaymentMethodCard, paymentMethodsInternationalCompactPaymentMethodInternational, paymentMethodsPaypalCompactPaymentMethodPayPal]).nullable().optional(), send_on: z.string().nullable(), withdraw_from_account: accountsCompactAccount.optional()}); export const sharedSwiftChargeOption = z.enum(["sha", "our"]).nullable(); export const itemsPayablesInternationalPayableInternationalTypeDetails = z.object({addenda_record: z.string().max(80).nullable().optional(), purpose_code: z.string().nullable().optional(), swift_charge_option: sharedSwiftChargeOption.optional(), transaction_id: z.string().max(65).nullable().optional()}); export const itemsPayablesInternationalPayableInternational = z.object({object: z.literal("Payable"), pay_to_payment_method: z.object({object: z.literal("PaymentMethod"), id: z.string(), links: paymentMethodsCommonPaymentMethodLinks, type: z.literal("international"), type_details: paymentMethodsInternationalPaymentMethodInternationalTypeDetails}).nullable().optional(), type: z.literal("international"), type_details: itemsPayablesInternationalPayableInternationalTypeDetails, id: z.string(), amount: z.string(), amount_due: z.string(), amount_recipient: z.number().optional(), amount_sender: z.number().optional(), amount_paid: z.string(), approved_at: z.string().nullable(), bill_number: z.string().nullable(), created_at: z.string().optional(), currency_code: isoCurrencyCode.nullable().optional(), currency_code_recipient: isoCurrencyCode.nullable().optional(), currency_code_sender: isoCurrencyCode.nullable().optional(), due_on: z.string(), exchange_rate: z.string().optional(), expected_on: z.string().nullable(), external_id: z.string().nullable(), fixed_side: z.enum(["sender", "recipient"]).optional(), issued_on: z.string(), is_exchange_rate_locked: z.boolean().optional(), reference: z.string().nullable().optional(), sent_on: z.string().nullable(), status: itemsCommonStatus, status_changed_at: z.string(), status_changes: z.array(itemsCommonStatusChangeItem), links: itemsCommonItemLinks, version: z.number().int().gte(1).optional(), attachments: z.object({object: z.literal("List"), results: z.array(itemsPayablesCommonPayableAttachment)}), delivery_method: z.enum(["ach_expedited", "ach_next_day", "ach_same_day", "ach_standard", "card_instant", "check_standard", "check_international", "check_next_day", "check_priority", "check_priority_express", "check_priority_signature", "check_standard_certified", "check_two_day", "international_ach", "international_swift", "international_vendor_choice", "paypal_direct", "real_time_payment"]).nullable(), delivery_network: z.enum(["ach", "fedex", "fednow", "local_rails", "mastercard", "paypal", "rtp", "swift", "usps", "visa"]).nullable().optional(), failure_detail: itemsPayablesCommonPayableFailureDetail.optional(), ledger: z.union([z.object({memo: z.string().optional(), tax_style: z.enum(["exclusive", "inclusive", "none"]).optional(), id: z.string().nullable().optional(), status: z.enum(["canceled", "deleted", "draft", "error", "needs_approval", "needs_import", "no_ledger", "not_synced", "paid", "pending"]).optional()}).and(z.record(z.string(), z.unknown())), z.object({memo: z.string().optional(), id: z.string().nullable().optional(), status: z.enum(["canceled", "deleted", "draft", "error", "needs_approval", "needs_import", "no_ledger", "not_synced", "paid", "pending"]).optional()}).and(z.record(z.string(), z.unknown())), z.object({account: ledgersNetsuiteNetSuiteAccount.optional(), class: ledgersNetsuiteNetSuiteClass.optional(), location: ledgersNetsuiteNetSuiteLocation.optional(), memo: z.string().optional(), posting_period: ledgersNetsuiteNetSuitePostingPeriod.optional(), id: z.string().nullable().optional(), status: z.enum(["canceled", "deleted", "draft", "error", "needs_approval", "needs_import", "no_ledger", "not_synced", "paid", "pending"]).optional()}).and(z.record(z.string(), z.unknown())), ledgersCommonLedgerCommonPayableMeta]).optional(), line_items: z.object({object: z.literal("List"), results: z.array(itemsPayablesCommonPayableLineItem)}).optional(), pay_to_company: companiesCompactCompany, send_on: z.string().nullable(), withdraw_from_account: accountsCompactAccount.optional()}); export const itemsPayablesPaypalPayablePayPalTypeDetails = z.object({}); export const itemsPayablesPaypalPayablePayPal = z.object({object: z.literal("Payable"), delivery_method: z.literal("paypal_direct").nullable(), pay_to_payment_method: z.object({object: z.literal("PaymentMethod"), id: z.string(), links: paymentMethodsCommonPaymentMethodLinks, type: z.literal("paypal"), type_details: paymentMethodsPaypalPaymentMethodPayPalTypeDetails}).nullable().optional(), type: z.literal("paypal"), type_details: itemsPayablesPaypalPayablePayPalTypeDetails, id: z.string(), amount: z.string(), amount_due: z.string(), amount_recipient: z.number().optional(), amount_sender: z.number().optional(), amount_paid: z.string(), approved_at: z.string().nullable(), bill_number: z.string().nullable(), created_at: z.string().optional(), currency_code: isoCurrencyCode.nullable().optional(), currency_code_recipient: isoCurrencyCode.nullable().optional(), currency_code_sender: isoCurrencyCode.nullable().optional(), due_on: z.string(), exchange_rate: z.string().optional(), expected_on: z.string().nullable(), external_id: z.string().nullable(), fixed_side: z.enum(["sender", "recipient"]).optional(), issued_on: z.string(), is_exchange_rate_locked: z.boolean().optional(), reference: z.string().nullable().optional(), sent_on: z.string().nullable(), status: itemsCommonStatus, status_changed_at: z.string(), status_changes: z.array(itemsCommonStatusChangeItem), links: itemsCommonItemLinks, version: z.number().int().gte(1).optional(), attachments: z.object({object: z.literal("List"), results: z.array(itemsPayablesCommonPayableAttachment)}), delivery_network: z.enum(["ach", "fedex", "fednow", "local_rails", "mastercard", "paypal", "rtp", "swift", "usps", "visa"]).nullable().optional(), failure_detail: itemsPayablesCommonPayableFailureDetail.optional(), ledger: z.union([z.object({memo: z.string().optional(), tax_style: z.enum(["exclusive", "inclusive", "none"]).optional(), id: z.string().nullable().optional(), status: z.enum(["canceled", "deleted", "draft", "error", "needs_approval", "needs_import", "no_ledger", "not_synced", "paid", "pending"]).optional()}).and(z.record(z.string(), z.unknown())), z.object({memo: z.string().optional(), id: z.string().nullable().optional(), status: z.enum(["canceled", "deleted", "draft", "error", "needs_approval", "needs_import", "no_ledger", "not_synced", "paid", "pending"]).optional()}).and(z.record(z.string(), z.unknown())), z.object({account: ledgersNetsuiteNetSuiteAccount.optional(), class: ledgersNetsuiteNetSuiteClass.optional(), location: ledgersNetsuiteNetSuiteLocation.optional(), memo: z.string().optional(), posting_period: ledgersNetsuiteNetSuitePostingPeriod.optional(), id: z.string().nullable().optional(), status: z.enum(["canceled", "deleted", "draft", "error", "needs_approval", "needs_import", "no_ledger", "not_synced", "paid", "pending"]).optional()}).and(z.record(z.string(), z.unknown())), ledgersCommonLedgerCommonPayableMeta]).optional(), line_items: z.object({object: z.literal("List"), results: z.array(itemsPayablesCommonPayableLineItem)}).optional(), pay_to_company: companiesCompactCompany, send_on: z.string().nullable(), withdraw_from_account: accountsCompactAccount.optional()}); export const itemsPayablesVendorChoicePayableVendorChoiceTypeDetails = z.object({delivery_method_choices: z.array(z.enum(["ach", "card", "check", "paypal"])).optional()}); export const itemsPayablesVendorChoicePayableVendorChoice = z.object({object: z.literal("Payable"), type: z.literal("vendor_choice"), type_details: itemsPayablesVendorChoicePayableVendorChoiceTypeDetails, id: z.string(), amount: z.string(), amount_due: z.string(), amount_recipient: z.number().optional(), amount_sender: z.number().optional(), amount_paid: z.string(), approved_at: z.string().nullable(), bill_number: z.string().nullable(), created_at: z.string().optional(), currency_code: isoCurrencyCode.nullable().optional(), currency_code_recipient: isoCurrencyCode.nullable().optional(), currency_code_sender: isoCurrencyCode.nullable().optional(), due_on: z.string(), exchange_rate: z.string().optional(), expected_on: z.string().nullable(), external_id: z.string().nullable(), fixed_side: z.enum(["sender", "recipient"]).optional(), issued_on: z.string(), is_exchange_rate_locked: z.boolean().optional(), reference: z.string().nullable().optional(), sent_on: z.string().nullable(), status: itemsCommonStatus, status_changed_at: z.string(), status_changes: z.array(itemsCommonStatusChangeItem), links: itemsCommonItemLinks, version: z.number().int().gte(1).optional(), attachments: z.object({object: z.literal("List"), results: z.array(itemsPayablesCommonPayableAttachment)}), delivery_method: z.enum(["ach_expedited", "ach_next_day", "ach_same_day", "ach_standard", "card_instant", "check_standard", "check_international", "check_next_day", "check_priority", "check_priority_express", "check_priority_signature", "check_standard_certified", "check_two_day", "international_ach", "international_swift", "international_vendor_choice", "paypal_direct", "real_time_payment"]).nullable(), delivery_network: z.enum(["ach", "fedex", "fednow", "local_rails", "mastercard", "paypal", "rtp", "swift", "usps", "visa"]).nullable().optional(), failure_detail: itemsPayablesCommonPayableFailureDetail.optional(), ledger: z.union([z.object({memo: z.string().optional(), tax_style: z.enum(["exclusive", "inclusive", "none"]).optional(), id: z.string().nullable().optional(), status: z.enum(["canceled", "deleted", "draft", "error", "needs_approval", "needs_import", "no_ledger", "not_synced", "paid", "pending"]).optional()}).and(z.record(z.string(), z.unknown())), z.object({memo: z.string().optional(), id: z.string().nullable().optional(), status: z.enum(["canceled", "deleted", "draft", "error", "needs_approval", "needs_import", "no_ledger", "not_synced", "paid", "pending"]).optional()}).and(z.record(z.string(), z.unknown())), z.object({account: ledgersNetsuiteNetSuiteAccount.optional(), class: ledgersNetsuiteNetSuiteClass.optional(), location: ledgersNetsuiteNetSuiteLocation.optional(), memo: z.string().optional(), posting_period: ledgersNetsuiteNetSuitePostingPeriod.optional(), id: z.string().nullable().optional(), status: z.enum(["canceled", "deleted", "draft", "error", "needs_approval", "needs_import", "no_ledger", "not_synced", "paid", "pending"]).optional()}).and(z.record(z.string(), z.unknown())), ledgersCommonLedgerCommonPayableMeta]).optional(), line_items: z.object({object: z.literal("List"), results: z.array(itemsPayablesCommonPayableLineItem)}).optional(), pay_to_company: companiesCompactCompany, pay_to_payment_method: z.union([paymentMethodsAddressCompactPaymentMethodAddress, paymentMethodsBankCompactPaymentMethodBank, paymentMethodsCardCompactPaymentMethodCard, paymentMethodsInternationalCompactPaymentMethodInternational, paymentMethodsPaypalCompactPaymentMethodPayPal]).nullable().optional(), send_on: z.string().nullable(), withdraw_from_account: accountsCompactAccount.optional()}); export const itemsPayablesDiscriminatedPayable = z.discriminatedUnion("type", [itemsPayablesAchPayableACH, itemsPayablesCardPayableCard, itemsPayablesCheckPayableCheck, itemsPayablesExternalPayableExternal, itemsPayablesInternationalPayableInternational, itemsPayablesPaypalPayablePayPal, itemsPayablesVendorChoicePayableVendorChoice]); 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 Payable * * PATCH /v1/payables/{id} */ export const patchApiV1PayablesId = async (args: PatchApiV1PayablesIdArgs, options?: PatchApiV1PayablesIdOptions) => { const {baseUrl = "https://api.routable.com", fetch: fetchFn = fetch, BearerAuth} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('content-type', "application/json") headers.set('accept', "application/json") if (args['Idempotency-Key'] != null) headers.set("Idempotency-Key", String(args['Idempotency-Key'])) if (BearerAuth !== undefined) headers.set('authorization', `Bearer ${BearerAuth}`) const url = `${baseUrl.replace(/\/+$/, '')}/v1/payables/${encodeURIComponent(String(args.id))}${query.size > 0 ? `?${query}` : ''}` const res = await fetchFn(url, {method: "PATCH", 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(itemsPayablesDiscriminatedPayable, await res.json()) };