internetmarke
Version:
A node implementation to use the Internetmarke web service of Deutsche Post.
63 lines (62 loc) • 1.73 kB
TypeScript
import { Amount } from './utils/amount';
export interface UserCredentials {
username: string;
password: string;
}
export interface UserData {
userToken?: string;
walletBalance?: number;
showTermsAndCondition?: boolean;
infoMessage?: string;
email?: string;
marketplace?: boolean;
anonymous?: boolean;
postpaid?: boolean;
showBannerFooter?: boolean;
}
export interface UserInfo {
isAuthenticated: boolean;
username?: string;
walletBalance?: Amount;
orderIds?: number[];
infoMessage?: string;
showTermsAndCondition?: boolean;
}
declare const CREDENTIALS: unique symbol;
declare const TOKEN: unique symbol;
/**
* The Portokasse user that is billed for ordered vouchers.
*/
export declare class User {
private [CREDENTIALS];
private [TOKEN];
private walletBalance;
private infoMessage?;
private orderIds;
private showTermsAndCondition;
/**
* Set the credentials to use the services.
*
* @param credentials The credentials that authenticate the user.
*/
setCredentials(credentials: UserCredentials): void;
/**
* Update the user data as retrieved from the service.
*
* @param data The user data from the service.
* @param initialData Determines whether to reset the token in case non is
* provided.
*/
load(data: UserData, initialData?: boolean): void;
getCredentials(): UserCredentials;
isAuthenticated(): boolean;
/**
* Add an order id to the user to assign it to him.
*
* @param orderIdThe order id that has been added to the user.
*/
addOrderId(orderId: number): void;
getToken(): string | null;
getInfo(): UserInfo;
}
export {};