export type PatchApiV0PaymentsPaymentIdArgs = {'payment-id': string, body: {'rejection-reason'?: (string | null) | undefined}}; export type PatchApiV0PaymentsPaymentIdOptions = {baseUrl?: string | undefined, apiKeyAuth?: string | undefined, fetch?: typeof fetch | undefined}; /** * Updates a payment * * PATCH /v0/payments/{payment-id} */ export const patchApiV0PaymentsPaymentId = async (args: PatchApiV0PaymentsPaymentIdArgs, options?: PatchApiV0PaymentsPaymentIdOptions) => { const {baseUrl = "https://api.griffin.com", fetch: fetchFn = fetch, apiKeyAuth} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('content-type', "application/json") if (apiKeyAuth !== undefined) headers.set("Authorization", apiKeyAuth) const url = `${baseUrl.replace(/\/+$/, '')}/v0/payments/${encodeURIComponent(String(args['payment-id']))}${query.size > 0 ? `?${query}` : ''}` const res = await fetchFn(url, {method: "PATCH", 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 };