UNPKG

bluetime-ewallet

Version:

BlueTime Orchestra library for eWallet payments (GooglePay, Applepay, payPal, Banks...)

331 lines (328 loc) 9.73 kB
// Generated by dts-bundle-generator v9.5.1 export type ButtonColor = "Light" | "Dark"; export type ButtonText = "None" | "Pay" | "Buy" | "Subscribe" | "Book" | "Checkout" | "Donate"; export type DeploymentStage = /** * Dev */ "Dev" | /** * Plan (pre qa) */ "Plan" | /** * QA */ "QA" | /** * Pilot (staging) */ "Pilot" | /** * Production */ "Prod"; export type EWalletName = "Mock" | "GooglePay" | "PayPal" | "ApplePay" | "BankPay" | "CardPay"; declare namespace i18n { /** Supported languages */ enum supportedLanguages { "en" = "en", "he" = "he", "cs" = "cs", "el" = "el", "de" = "de", "es" = "es", "fi" = "fi", "fr" = "fr", "it" = "ja", "ko" = "ko", "no" = "no", "nl" = "nl", "pl" = "pl", "pt" = "pt", "ru" = "ru", "sk" = "sk", "sr" = "sr", "sv" = "sv", "tr" = "tr", "zh" = "zh", "xx" = "xx" } function autoDetectLanguage(): supportedLanguages; /** * Load language resource. * Re-loading is supported * @param language */ function setLanguage(language: supportedLanguages, deploymentStage?: DeploymentStage): Promise<boolean>; /** * @param key Get translation for a key * @returns the translation; if not found - return the keyword itself */ function text(key: string): string; } declare class eWallatButton { /** Name of eWallet */ name: EWalletName; /** DOM element to place the button in */ domEntitySelector: string; } declare class TokenModel { /** token */ token: string; } declare class ValidateEWalletSessionResults { /** Is session valid? */ Success: boolean; /** Human readable message */ Message: string; /** session data to be sent back to eWallet */ Data: string; } declare class ButtonProperties { /** button color */ color: ButtonColor; /** button type */ text: ButtonText; /** Width (optional) in style format */ width: string; /** Height (optional) in style format */ height: string; } declare class RequiredAncillaryInfo { /** Billing info requirements */ billingInfo: RequiredBillingInfo | undefined; /** Shipping info requirements */ shippingInfo: RequiredShippingInfo | undefined; } declare class RequiredBaseInfo { /** true for required */ phoneRequired: boolean; /** true for required */ emailAddressRequired: boolean; } declare class RequiredBillingInfo extends RequiredBaseInfo { details: AddressLevel; } declare class RequiredShippingInfo extends RequiredBaseInfo { } declare enum AddressLevel { /** Name, country, postal code and optional phone and email address */ MIN = "MIN", /** Full address: MIN and: Street address, locality (e.g City) and administrative Area (State or province) */ FULL = "FULL" } declare class MinAddress { /** A telephone number */ phoneNumber: string | undefined; /** email address */ emailAddress: string | undefined; /** ISO-3166-1 Alpha-2 country code. */ countryCode: string | undefined; /** The full name of the addressee. */ name: string | undefined; /** Postal or ZIP code */ postalCode: string | undefined; } declare class FullAddress extends MinAddress { /** The first line of the address. */ addressLines: string[] | undefined; /** City, town, neighborhood, or suburb. */ locality: string | undefined; /** A country subdivision, such as a state or province. */ administrativeArea: string | undefined; } declare class EWalletChargeResults { /** Are results valid */ success: boolean; /** Error/Success textual message */ message: string; /** Results data from eWallet */ data: object; } declare class PaymentGatewayResult { /** Authorization code from the payment gateway. */ authorizationCode: string; /** The currency of the transaction. Based on the <a href="https://en.wikipedia.org/wiki/ISO_4217#Active_codes" target="_blank">ISO 4217 */ currency: string; /** Amount in Currency */ amount: number; /** The operation that was performed. Possible values are `PreAuth`, `Capture`, `Charge`, `Refund` and `Void` */ operationType: string; /** The payment gateway result code. */ operationResultCode: GetawayOperationResult; /** The payment gateway result description. */ operationResultDescription: string; /** The response message from the payment gateway */ customGatewayResponse: any; /** Payment gateway name */ gatewayName: string; /** The transaction ID from the payment gateway. This transaction ID is then used for subsequent operations such as Capture (see `[PUT] /PaymentGateway/capture`) and Void (see `DELETE /PaymentGateway/void`) */ gatewayReference: string; /** The payment gateway result code. */ gatewayResultCode: string; /** The payment gateway result description. */ gatewayResultDescription: string; /** The payment gateway result code. */ gatewayResultSubCode: string; /** The payment gateway result description. */ gatewayResultSubDescription: string; } export type GetawayOperationResult = "Success" | "Accepted" | "Rejected" | "TemporaryFailure" | "FatalFailure" | "NotImplemented"; declare class BankCardBase { /** Expiration Month */ expirationMonth: number; /** Expiration Year */ expirationYear: number; /** Card brand */ type: string; /** cardholder name */ nameOnCard: string; /** Issue number */ issueNumber: string; /** Card owner Id */ ownerId: string; } declare class BankCard extends BankCardBase { /** Masked PAN */ number: string; /** CVV / CCV... */ securityCode: string; } declare class ThreeDS { /** * Authentication Value */ authenticationValue: string; /** * ECI */ eci: string; /** * Transaction Id */ xid: string; /** * 3DS version */ version: string; /** * (masterCard) Service level Indication */ sli: string; } declare class TokenAndMaskedCardModel { /** token */ token: string; /** token location */ tokenLocation: string; /** Masked bank card */ bankCard: BankCard; /** Optional 3ds data */ threeDs: ThreeDS; /** Error Message */ errorMessage: string; } declare class EWalletResultData { /** Indicates whether client operation was successfu */ clientSuccess: boolean; /** In case client operation was unsuccessful */ clientErrorMessage: any; /** Results for Charge operation by a Payment gateway */ upgChargeResults: PaymentGatewayResult | undefined; /** Results for Charge operation by a non-Payment gateway, such as PayPal, Bank transfer */ directChargeResults: EWalletChargeResults | undefined; /** Results for Credit card Tokenization */ tokenAndMaskedCardModel: TokenAndMaskedCardModel | undefined; } declare class ClientPaymentDataResults { /** Was the operation successful */ success: boolean; /** Error message */ message: string | undefined; /** Payment data */ data: any; /** Result code */ resultCode: ClientPaymentResultCode; } /** Formal status code for Payment results */ export type ClientPaymentResultCode = "OK" | "Canceled" | "Other"; export declare class Engine { /** holds the original request */ private _eWalletToken; private _ewalletsRequest; private _availableEWallets; private _displayedEWallets; private _selectedProviderName?; private _selectedProvider; private _requiredAncillaryInfo; /** * Constructor * @param eWalletToken the eWallet token received from the host * @param requiredAncillaryInfo [optional] The required Ancillary Info, such as billing/shipping data */ constructor(eWalletToken: string, requiredAncillaryInfo: RequiredAncillaryInfo | undefined, language?: i18n.supportedLanguages | undefined); /** * Get the session type (by token) * @returns session type */ getSessionType(): string; /** * Check available eWallets (subset of the requested one) * @returns a list of available eWallets */ checkAvailability(): Promise<Array<EWalletName>>; /** * Start payment process using specified list of eWallet providers and their respective button properties. * @param eWalletList list of requested eWallet providers and their respective button properties. * @param callback a callback handler that will be called once the payment operation is complete * @param buttonProperties [optional] Button properties */ payBy(eWalletList: Array<eWallatButton>, callback: (results: TokenModel | undefined) => void, buttonProperties: ButtonProperties | undefined, requiredAncillaryInfo?: RequiredAncillaryInfo | undefined): void; /** * Get the Billing info from the eWallet, based on the requiredAncillaryInfo parameter in payBy method * @returns the Billing info */ getBillingInfo(): FullAddress | MinAddress | undefined; /** * Get the Shipping info from the eWallet, based on the requiredAncillaryInfo parameter in payBy method * @returns the Billing info */ getShippingInfo(): FullAddress | undefined; /** * Parse the result token * @param resultToken * @returns eWalleet operation result */ parseResultToken(resultToken: string): [ EWalletResultData, boolean ]; /** * Handler for pay button click. * Disable all buttons and initialize session with the clicked button associated eWallet provider * @param eWalletName eWallet name * @param ev onClick event */ payButtonClicked(eWalletName: string, ev: Event): Promise<ClientPaymentDataResults>; /** handle payment session failure */ sessionFailed(): void; /** * Handler of session validation event * @param eWalletName name of eWallet * @param sessionData payment data */ validateSession: (sessionData: string) => Promise<ValidateEWalletSessionResults | undefined>; /** * Handler of post - payment event * @param eWalletName name of eWallet * @param paymentData payment data */ performPayment(eWalletName: string, paymentData: string): Promise<TokenModel | undefined>; /** * Returns name of eWallet provider * @returns name of provider */ getSelectedProviderName(): string | undefined; } export {};