export type Status = {status?: string | undefined}; export type UpdateApiV2PaymentrequestsPaymentRequestCodeStatusArgs = {paymentRequestCode: string, body: Status}; export type UpdateApiV2PaymentrequestsPaymentRequestCodeStatusOptions = {baseUrl?: string | undefined, bearerAuth?: string | undefined, fetch?: typeof fetch | undefined}; /** * Update the status of a payment request * * PUT /v2/paymentrequests/{paymentRequestCode}/status */ export const updateApiV2PaymentrequestsPaymentRequestCodeStatus = async (args: UpdateApiV2PaymentrequestsPaymentRequestCodeStatusArgs, options?: UpdateApiV2PaymentrequestsPaymentRequestCodeStatusOptions) => { const {baseUrl = "https://api.fire.com/business", fetch: fetchFn = fetch, bearerAuth} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('content-type', "application/json") if (bearerAuth !== undefined) headers.set('authorization', `Bearer ${bearerAuth}`) const url = `${baseUrl.replace(/\/+$/, '')}/v2/paymentrequests/${encodeURIComponent(String(args.paymentRequestCode))}/status${query.size > 0 ? `?${query}` : ''}` const res = await fetchFn(url, {method: "PUT", 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 };