export type CartSource = 'NotSet' | 'ProgCentral' | 'Tanc' | 'MyAccount' | 'CommerceApi' | 'Pos' | 'ProgAnywhere' | 'ProgConnect' | 'ProgMarketplaceSingleCart'; export type Store = {progressiveMerchantId?: number | undefined, merchantStoreId?: (string | null) | undefined, salesAssociate?: (string | null) | undefined, merchantApplicationIdentifier?: (string | null) | undefined, merchantTerminalId?: (string | null) | undefined, isNotifyStoreOnApplication?: boolean | undefined, source?: CartSource | undefined}; export type OrderConfirmation = {applicationId?: number | undefined, cartId?: number | undefined, store?: Store | undefined}; export type CreateApiApplicationCartOrderconfirmationArgs = {body: OrderConfirmation}; export type CreateApiApplicationCartOrderconfirmationOptions = {baseUrl?: string | undefined, basicAuth?: {username: string, password: string} | undefined, fetch?: typeof fetch | undefined}; /** * Submit order confirmation * * POST /application/cart/orderconfirmation */ export const createApiApplicationCartOrderconfirmation = async (args: CreateApiApplicationCartOrderconfirmationArgs, options?: CreateApiApplicationCartOrderconfirmationOptions) => { const {baseUrl = "https://capi.beta.progleasing.com/api/v1", fetch: fetchFn = fetch, basicAuth} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('content-type', "application/json") if (basicAuth !== undefined) headers.set('authorization', `Basic ${btoa(`${basicAuth.username}:${basicAuth.password}`)}`) const url = `${baseUrl.replace(/\/+$/, '')}/application/cart/orderconfirmation${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 };