UNPKG

bananas-commerce

Version:

A client for bananas-commerce with support for TypeScript

69 lines (68 loc) 3.04 kB
import { components } from "../types/openapi.js"; import { CountryCode, CountryCodeArgs, SiteArgs } from "../types/types.js"; import { CamelCasedObjectKeys } from "../util/casedObjectKeys.js"; import { paths } from "../types/openapi.js"; import { VariableResult } from "../util/formatVariableResult.js"; import { Extension } from "../extension.js"; export declare class Ingrid extends Extension<"ingrid", paths, { countryCode: CountryCode; siteCode: string; }> { readonly name = "ingrid"; /** * Initializes or updates an Ingrid-session, where the HTML-snippet for the Ingrid widget (`shipping_data`) * and a shipping reference `shipping.reference` is included in the response. The shipping reference * is used to initialize a purchase. If a shipping reference is specified in the arguments, a different * shipping reference may be returned. */ begin(args: IngridBegin.Args): Promise<IngridBegin.Result>; /** * Confirms the delivery of an Ingrid-session. It must be called before sealing a purchase * with the same shipping reference. */ confirm(args: IngridConfirm.Args): Promise<IngridConfirm.Result>; } /** @see {@link Ingrid.begin} */ export declare namespace IngridBegin { /** @see {@link Ingrid.begin} */ type Args = Omit<CamelCasedObjectKeys<components["schemas"]["IngridCheckoutRequest"]>, "countryCode"> & SiteArgs & CountryCodeArgs; type Result = VariableResult<{ updated: Updated; created: Created; empty: Empty; "invalid-args": InvalidArgs; "not-found": NotFound; "internal-error": InternalError; }>; /** `200` */ type Updated = CamelCasedObjectKeys<components["schemas"]["IngridSessionResponse"]>; /** `201` */ type Created = CamelCasedObjectKeys<components["schemas"]["IngridSessionResponse"]>; /** `202` */ type Empty = void; /** `400` */ type InvalidArgs = CamelCasedObjectKeys<components["schemas"]["ErrorDetail_LocationErrors_"]>; /** `404` */ type NotFound = CamelCasedObjectKeys<components["schemas"]["ErrorDetail_str_"]>; /** `503` */ type InternalError = CamelCasedObjectKeys<components["schemas"]["ErrorDetail_str_"]>; /** A created Ingrid session returned from {@link Ingrid.begin}. */ type Session = CamelCasedObjectKeys<components["schemas"]["IngridSessionResponse"]>; } /** @see {@link Ingrid.confirm} */ export declare namespace IngridConfirm { /** @see {@link Ingrid.confirm} */ type Args = CamelCasedObjectKeys<components["schemas"]["IngridConfirmRequest"]>; /** @see {@link Ingrid.confirm} */ type Result = VariableResult<{ success: Success; "invalid-args": InvalidArgs; "internal-error": InternalError; }>; /** `204` */ type Success = void; /** `400` */ type InvalidArgs = CamelCasedObjectKeys<components["schemas"]["ErrorDetail_DetailWithCode_"]>; /** `503` */ type InternalError = CamelCasedObjectKeys<components["schemas"]["ErrorDetail_str_"]>; }