export type QPilotCoreModelsDtoRequestsVaultCardDetails = {number: string, cvv: string, expiryMonth: string, expiryYear: string, brand?: (string | null) | undefined, lastFourDigits?: (string | null) | undefined}; export type QPilotCoreModelsDtoRequestsVaultBillingAddress = {firstName?: (string | null) | undefined, lastName?: (string | null) | undefined, address1?: (string | null) | undefined, city?: (string | null) | undefined, province?: (string | null) | undefined, zip?: (string | null) | undefined, country?: (string | null) | undefined}; export type QPilotCoreModelsDtoRequestsVaultCardRequest = {card: QPilotCoreModelsDtoRequestsVaultCardDetails, billingAddress: QPilotCoreModelsDtoRequestsVaultBillingAddress}; export type UpdateApiSitesSiteIdPaymentMethodsIdVaultArgs = {siteId: number, id: number, body: QPilotCoreModelsDtoRequestsVaultCardRequest}; export type UpdateApiSitesSiteIdPaymentMethodsIdVaultOptions = {baseUrl?: string | undefined, Bearer?: string | undefined, fetch?: typeof fetch | undefined}; /** * Update an existing payment method by re-vaulting and re-tokenizing * * PUT /Sites/{siteId}/PaymentMethods/{id}/vault */ export const updateApiSitesSiteIdPaymentMethodsIdVault = async (args: UpdateApiSitesSiteIdPaymentMethodsIdVaultArgs, options?: UpdateApiSitesSiteIdPaymentMethodsIdVaultOptions) => { const {baseUrl = "https://api.qpilot.cloud", fetch: fetchFn = fetch, Bearer} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('content-type', "application/json") if (Bearer !== undefined) headers.set("Authorization", Bearer) const url = `${baseUrl.replace(/\/+$/, '')}/Sites/${encodeURIComponent(String(args.siteId))}/PaymentMethods/${encodeURIComponent(String(args.id))}/vault${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 };