export type WireBankDetails = {account_number: unknown, routing_number: unknown}; export type ScanDetails = {account_number: unknown, sort_code: unknown}; export type AccountDetailsIdentifier = {iban: unknown} | {wire: WireBankDetails} | {scan: ScanDetails}; export type SimulateInboundRequest = {amount: number, beneficiary_account_id: string, external_id?: (string | null) | undefined, reference: string, remitter?: (AccountDetailsIdentifier | null) | undefined, remitter_iban?: (unknown | null) | undefined, remitter_name?: (unknown | null) | undefined}; export type CreateApiV1SimulateInboundPaymentArgs = {body: SimulateInboundRequest}; export type CreateApiV1SimulateInboundPaymentOptions = {baseUrl?: string | undefined, fetch?: typeof fetch | undefined}; /** * Simulate inbound payment * * POST /v1/simulate/inbound-payment */ export const createApiV1SimulateInboundPayment = async (args: CreateApiV1SimulateInboundPaymentArgs, options?: CreateApiV1SimulateInboundPaymentOptions) => { const {baseUrl = "https://auth-sandbox.fuse.me", fetch: fetchFn = fetch} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('content-type', "application/json") const url = `${baseUrl.replace(/\/+$/, '')}/v1/simulate/inbound-payment${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 };