export type GetApiPaymentReceiptsReceiptIdOptions = {baseUrl?: string | undefined, clientAuth?: {username: string, password: string} | undefined, fetch?: typeof fetch | undefined}; /** * Get a payment receipt * * GET /payment-receipts/{receipt-id} */ export const getApiPaymentReceiptsReceiptId = async (options?: GetApiPaymentReceiptsReceiptIdOptions) => { const {baseUrl = "https://api.nrich.qwist.cloud", fetch: fetchFn = fetch, clientAuth} = options ?? {} const query = new URLSearchParams() const headers = new Headers() if (clientAuth !== undefined) headers.set('authorization', `Basic ${btoa(`${clientAuth.username}:${clientAuth.password}`)}`) const url = `${baseUrl.replace(/\/+$/, '')}/payment-receipts/${encodeURIComponent(String(args['receipt-id']))}${query.size > 0 ? `?${query}` : ''}` const res = await fetchFn(url, {method: "GET", headers}) if (!res.ok) throw new Error(`Request failed with status ${res.status}`, {cause: {status: res.status, body: await res.text()}}) return undefined };