export type IssuingCardId = string; export type LastFour = string; export type IssuingCurrency = unknown; export type OobSimulateTransactionDetails = {last_four?: LastFour | undefined, merchant_name?: string | undefined, purchase_amount?: number | undefined, purchase_currency?: IssuingCurrency | undefined}; export type SimulateOobAuthenticationRequest = {card_id: IssuingCardId, transaction_details?: OobSimulateTransactionDetails | undefined}; export type CreateApiIssuingSimulateOobAuthenticationArgs = {body: SimulateOobAuthenticationRequest}; export type CreateApiIssuingSimulateOobAuthenticationOptions = {baseUrl: string, OAuth?: string | undefined, fetch?: typeof fetch | undefined}; /** * Simulate an out-of-band (OOB) authentication request. * * POST /issuing/simulate/oob/authentication */ export const createApiIssuingSimulateOobAuthentication = async (args: CreateApiIssuingSimulateOobAuthenticationArgs, options: CreateApiIssuingSimulateOobAuthenticationOptions) => { const {baseUrl, fetch: fetchFn = fetch, OAuth} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('content-type', "application/json") if (OAuth !== undefined) headers.set('authorization', `Bearer ${OAuth}`) const url = `${baseUrl.replace(/\/+$/, '')}/issuing/simulate/oob/authentication${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 };