@mia-burton/klarna-node
Version:
A Node.js module for Klarna
45 lines (44 loc) • 1.56 kB
TypeScript
import { ClientInterface } from './client.interface';
import { Location, OrderResponse, SessionResponse, OrderInput, Order, UrlsInput, PaymentSession } from './types';
export declare class Client implements ClientInterface {
private readonly uid;
private readonly password;
private readonly live;
private baseUrl;
private restClient;
/**
* Create a Klarna client
* @param uid string - Api key given from Klarna
* @param password string - Password given from Klarna
* @param live boolean - Switch live sandbox env
*/
constructor(uid: string, password: string, location: Location, live?: boolean);
private setLocation;
/**
* @param theOrder
* @param urls Insert {session.id} and/or {order.id} as placeholder
* @return Promise<SessionResponse>
* @throws CreateSessionError
*/
createPaymentSession(theOrder: OrderInput, urls: UrlsInput): Promise<SessionResponse>;
getPaymentSession(theId: string): Promise<PaymentSession>;
/**
* @param theOrder
* @returns Promise<OrderResponse>
* @throws CreateOrderError
*/
createOrder(theSessionId: string): Promise<OrderResponse>;
/**
* @param theId
* @returns {Promise<Order>}
*/
getOrder(theId: string): Promise<Order>;
/**
* Create a capture for the givend order of the given amount
* @param theOrderId
* @param theAmount
* @returns {Promise<string>}
*/
captureOrder(theOrderId: string, theAmount: number): Promise<string>;
private initAxios;
}