export type CreateApiWithdrawalPayphoneNewArgs = {body: {amount: number, document_id: string, beneficiaryName: string, beneficiaryLastName: string, beneficiaryEmail: string, beneficiaryPhone: string, accountType: string, data: string, confirmationURL: string, currency: string, country: string, sign: string}}; export type CreateApiWithdrawalPayphoneNewOptions = {baseUrl?: string | undefined, BearerAuth?: string | undefined, fetch?: typeof fetch | undefined}; /** * Crear un nuevo retiro - Ecuador Payphone * * POST /withdrawal/payphone/new */ export const createApiWithdrawalPayphoneNew = async (args: CreateApiWithdrawalPayphoneNewArgs, options?: CreateApiWithdrawalPayphoneNewOptions) => { const {baseUrl = "https://sandbox.prontopaga.com/api", 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 (BearerAuth !== undefined) headers.set('authorization', `Bearer ${BearerAuth}`) const url = `${baseUrl.replace(/\/+$/, '')}/withdrawal/payphone/new${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 (await res.json()) as unknown };