export type IncomingPaymentTrackDetails = {status: 'rejected' | 'pending' | 'executed' | 'received', status_code?: ('G000' | 'G001' | 'G002' | 'G003' | 'G004') | undefined, rejection_reason_code?: string | undefined}; export type CreateApiIncomingPaymentsIdTrackArgs = {id: string, body: IncomingPaymentTrackDetails}; export type CreateApiIncomingPaymentsIdTrackOptions = {baseUrl?: string | undefined, sec0?: string | undefined, fetch?: typeof fetch | undefined}; /** * Track incoming payment * * POST /incoming_payments/{id}/track */ export const createApiIncomingPaymentsIdTrack = async (args: CreateApiIncomingPaymentsIdTrackArgs, options?: CreateApiIncomingPaymentsIdTrackOptions) => { const {baseUrl = "https://sandbox.numeral.io/v1", fetch: fetchFn = fetch, sec0} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('content-type', "application/json") if (sec0 !== undefined) headers.set("x-api-key", sec0) const url = `${baseUrl.replace(/\/+$/, '')}/incoming_payments/${encodeURIComponent(String(args.id))}/track${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 undefined };