bananas-commerce
Version:
A client for bananas-commerce with support for TypeScript
65 lines (64 loc) • 2.82 kB
TypeScript
import { components } from "../types/openapi.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 Klarna extends Extension<"klarna", paths, {
siteCode: string;
}> {
readonly name = "klarna";
/**
* Initializes or updates a purchase with Klarna as the PSP. If `shipping` is specified, a shipping
* reference must be retrieved before initializing the purchase. The data and session identifier
* included in the response is used to initialize the Klarna widget.
*/
begin(args: KlarnaBegin.Args): Promise<KlarnaBegin.Result>;
/**
* Confirms a purchase with Klarna as the PSP. If `shipping` is
* specified, it must be called after confirming the delivery.
*/
confirm(args: KlarnaConfirm.Args): Promise<KlarnaConfirm.Result>;
}
export declare namespace KlarnaBegin {
type Args = CamelCasedObjectKeys<components["schemas"]["KCOCheckoutRequest"]>;
type Result = VariableResult<{
success: Success;
conflict: Conflict;
"invalid-args": InvalidArgs;
unprocessable: Unprocessable;
"internal-error": InternalError;
}>;
/** `200` */
type Success = CamelCasedObjectKeys<components["schemas"]["KCOCheckoutResponse"]>;
/** `400` */
type InvalidArgs = CamelCasedObjectKeys<components["schemas"]["ErrorDetail_LocationErrors_"]>;
/** `409` */
type Conflict = CamelCasedObjectKeys<components["schemas"]["ErrorDetail_str_"]>;
/** `422` */
type Unprocessable = CamelCasedObjectKeys<components["schemas"]["KCOCheckoutErrorResponse"]>;
/** `503` */
type InternalError = CamelCasedObjectKeys<components["schemas"]["ErrorDetail_str_"]>;
}
export declare namespace KlarnaConfirm {
type Args = CamelCasedObjectKeys<components["schemas"]["KCOCheckoutRequest"]> & {
merchantId: string;
orderId: string;
};
type Result = VariableResult<{
success: Success;
"invalid-args": InvalidArgs;
conflict: Conflict;
"unprocessable-entity": UnprocessableEntity;
"internal-error": InternalError;
}>;
/** `200` */
type Success = CamelCasedObjectKeys<components["schemas"]["KCOCheckoutResponse"]>;
/** `400` */
type InvalidArgs = CamelCasedObjectKeys<components["schemas"]["ErrorDetail_LocationErrors_"]>;
/** `404` */
type Conflict = CamelCasedObjectKeys<components["schemas"]["ErrorDetail_str_"]>;
/** `422` */
type UnprocessableEntity = CamelCasedObjectKeys<components["schemas"]["KCOCheckoutErrorResponse"]>;
/** `503` */
type InternalError = CamelCasedObjectKeys<components["schemas"]["ErrorDetail_str_"]>;
}