export type CreateApiV3MerchantsMIdCustomersCustomerIdCardsArgs = {'User-Agent': string, mId: string, customerId: string, body: {id?: string | undefined, first6: string, last4: string, firstName?: string | undefined, lastName?: string | undefined, expirationDate?: string | undefined, additionalInfo?: ({default?: string | undefined}) | undefined, cardType?: string | undefined, token?: string | undefined, tokenType?: ('MULTIPAY' | 'FINANCIAL' | 'CTOKEN') | undefined, modifiedTime?: number | undefined, customer?: ({id?: string | undefined}) | undefined}}; export type CreateApiV3MerchantsMIdCustomersCustomerIdCardsOptions = {baseUrl?: string | undefined, bearerAuth?: string | undefined, fetch?: typeof fetch | undefined}; /** * Create a credit/debit card entry for a customer * * POST /v3/merchants/{mId}/customers/{customerId}/cards */ export const createApiV3MerchantsMIdCustomersCustomerIdCards = async (args: CreateApiV3MerchantsMIdCustomersCustomerIdCardsArgs, options?: CreateApiV3MerchantsMIdCustomersCustomerIdCardsOptions) => { const {baseUrl = "https://apisandbox.dev.clover.com", fetch: fetchFn = fetch, bearerAuth} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('content-type', "application/json") if (args['User-Agent'] != null) headers.set("User-Agent", String(args['User-Agent'])) if (bearerAuth !== undefined) headers.set('authorization', `Bearer ${bearerAuth}`) const url = `${baseUrl.replace(/\/+$/, '')}/v3/merchants/${encodeURIComponent(String(args.mId))}/customers/${encodeURIComponent(String(args.customerId))}/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 };