export type EdubankCardDataOnlyDto = {color_depth: number, device_type?: 'BROWSER' | undefined, java_enabled: boolean, language?: string | undefined, screen_height: number, screen_width: number, time_zone_offset?: number | undefined, ip_address?: string | undefined}; export type EdubankTransactionCardEncryptedDto = {encrypted_card: string, data_only?: EdubankCardDataOnlyDto | undefined}; export type CreateApiV1TransactionsTransactionIdCardsArgs = {transaction_id: string, body: EdubankTransactionCardEncryptedDto}; export type CreateApiV1TransactionsTransactionIdCardsOptions = {baseUrl: string, xApiKey?: string | undefined, fetch?: typeof fetch | undefined}; /** * Pay transaction with credit card * * POST /v1/transactions/{transaction_id}/cards * * Also accepts auth: authorization, authorization */ export const createApiV1TransactionsTransactionIdCards = async (args: CreateApiV1TransactionsTransactionIdCardsArgs, options: CreateApiV1TransactionsTransactionIdCardsOptions) => { const {baseUrl, fetch: fetchFn = fetch, xApiKey} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('content-type', "application/json") if (xApiKey !== undefined) headers.set("x-api-key", xApiKey) const url = `${baseUrl.replace(/\/+$/, '')}/v1/transactions/${encodeURIComponent(String(args.transaction_id))}/cards${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 };