/**
 * Card types
 */
type CardTypes = "AMEX" | "BC" | "CartaSi" | "Dankort" | "Delta" | "DinersClub" | "Discover" | "Electron" | "Elo" | "enRoute" | "Hipercard" | "JCB" | "Maestro" | "MasterCard" | "MC_Alaska" | "MC_Canada" | "Switch" | "Troy" | "UATP" | "UnionPay" | "Visa";

/**
 * Physical address
 */
declare class Address {
    /**
     * Billing address line 1
     */
    address1: string | undefined;
    /**
     * Billing address line 2
     */
    address2: string | undefined;
    /**
     * Billing address line 3
     */
    address3: string | undefined;
    /**
     * Billing address locality (such as city)
     */
    locality: string | undefined;
    /**
     * Billing address administrative area (province, state, etc.)
     */
    administrativeArea: string | undefined;
    /**
     * Billing address ISO-3166-1 country code
     */
    country: string | undefined;
    /**
     * Billing address postal code (e.g. zip)
     */
    postalCode: string | undefined;
}

/**
 * Card details required for 3DS
 */
declare class CardData {
    /**
     * Card Brand
     */
    cardType: CardTypes;
    /**
     * PAN
     */
    cardNumber: string;
    /**
     * Expiration Year
     */
    expirationYear: number;
    /**
     * Expiration month (1..12)
     */
    expirationMonth: number;
    /**
     * Name on card
     */
    cardHolderName: string;
    /**
     * security Code
     */
    securityCode: string;
    /**
     * Issue Number
     */
    issueNumber: string;
    /**
     * ownerId
     */
    ownerId: string;
    /**
     * Cardholder email address
     * To be removed once old 3ds is deprecated
     * */
    customerEmail: string | undefined;
    /**
     * Cardholder phone number (incl. country code, no '+' sign, digits only)
     * To be removed once old 3ds is deprecated
     * */
    customerPhone: string | undefined;
    /**
     * Billing address
     */
    billingAddress: Address | undefined;
}

/**
 * Message sent to client
 */
declare class ClientMessage {
    /**
     * Message type
     */
    messageType: MessageType;
    /**
     * Provider Name
     */
    providerName: ProviderName;
}
/**
 * Authenticated message
*/
declare class ClientAuthenticatedMessage extends ClientMessage {
    /**
     * Authentication data
     */
    threeDS: ThreeDS;
}
/**
 * FingerPrint Required message
*/
declare class ClientFingerPrintRequiredMessage extends ClientMessage {
    /**
     * Uri of the Device fingerprint flow src
     */
    fingerPrintUri: string;
    /**
     * Additional data used for Device fingerprint flow
     */
    fingerPrintData: string;
}
/**
 * Challenge Required message
*/
declare class ClientChallengeRequiredMessage extends ClientMessage {
    /**
     * Url to use for the client  challenge flow
     */
    ascUri: string;
}
/**
 * Technical problem message
*/
declare class ClientTechnicalProblemDetectedMessage extends ClientMessage {
    /**
     * Reason for technical problem
     */
    reason: string;
    /**
     * MPI Reference
     */
    reference: string;
}
/**
 * Model of received 3DS data
 */
declare class ThreeDS {
    /**
     * Authentication Value
    */
    authenticationValue: string;
    /**
     * ECI
    */
    eci: string;
    /**
     * Transaction Id
    */
    xid: string;
    /**
     * 3DS version
    */
    version: string;
    /**
     * (masterCard) Service level Indication
    */
    sli: string;
}
/**
 * Provider names
 */
type ProviderName = "Unknown" | "Shift4" | "CyberSource";
/**
 * Client message type enumeration
*/
type MessageType = 
/**
 * The initial state
 */
"NeverUsed" | 
/**
 * Authenticated
 */
"Authenticated" | 
/**
 * Attempt Without Authentication
 */
"AttemptWithoutAuthentication" | 
/**
* Rejected
*/
"Rejected" | 
/**
 * Device FingerPrint Required
 */
"FingerPrintRequired" | 
/**
 * Device FingerPrint Required
 */
"FingerPrintCompleted" | 
/**
 * Challenge required
 */
"ChallengeRequired" | 
/**
 * A technical problem
 */
"TechnicalProblem" | 
/**
 * Card is not enrolled for 3DS
 */
"CardNotEnrolled" | 
/**
 * No response has been received from MPI
 */
"NoResponse";

/**
 * message returned by host
 */
declare class CreateSessionResponse {
    /** Was the request successful? */
    success: boolean;
    /**
     * Error message
     */
    message: string;
    /**
     * Token to be used as Bearer authentication in next iteration with the host
     */
    token: string;
    /**
     * The actual payload
     */
    clientMessage: ClientMessage;
}

/**
 * 3ds options
 */
declare class Options {
    /**
     * if set, indicates a required postmessage with the target host
     */
    postMessageTarget: string;
    /**
     * If true, the challenge form within the hosting page
     */
    displayChallengeFormWithinPage: boolean;
}

declare class Engine {
    /**
     * Base url for Api
     */
    private _oldModelStyle;
    /**
     * Urls for varios operations
     */
    private createSessionUrl;
    private getChallengeResultsUrl;
    private getFingerpringResultsUrl;
    /**
     * The session token as generated by ePayTools
     */
    private sessionToken;
    /**
     * handle for a Polling background task
     */
    private backgroundPollingInterval;
    /**
     * handle for the timer on the Polling operation
     */
    private timerPollingHandle;
    /**
     * An indication for the polling task to stop
     */
    private stopPollingSemaphore;
    /**
     * iFrame for challenge/fingerprint
     */
    private iFrame;
    /**
     * Provider Name
     */
    private _providerName;
    /**
     * The jwt from CyberSource response to Step 1: Setup Service (https://developer.cybersource.com/docs/cybs/en-us/payer-authentication/developer/all/rest/payer-auth/pa2-ccdc-setup-intro.html)
     */
    private _cyberSourceJwt;
    /**
     * Options
     */
    private _options;
    /**
     * Resolver of entry point
     */
    private resolver;
    private _supportedCardBrands;
    /**
     * Constructor
     * @param apiBaseUrl The url of the server. Leave the default for production
     */
    constructor(apiBaseUrl?: string, options?: Options | undefined);
    /**
     * Main function to perform a 3d secure authentication session
     *
     * @param {string} sessionToken - token obtained from the Orchestra service
     * @param {string} iFrameElementSelector - Selector of element in which a challenge iFrame is to be created
     * @param {CardData|undefined} cardData - The card details
     * @param {string|undefined} cardToken An optional token with which a host-stored card details can be recovered
     */
    perform3ds(sessionToken: string, iFrameElementSelector: string, cardData: CardData | undefined, cardToken?: string | undefined): Promise<ClientMessage>;
    /**
     * An event that is trigerred when a user interaction starts/ends.
     * It can be used by the caller in order to start/stop displaying a 'please wait' message
     */
    onPresentingGui: (isOn: boolean) => {};
    /**
     * Parse the session token and detect if it has a url field; In this case, it will override the baseUrl and path
     */
    parseSessionToken(token: string): boolean;
    /**
     * init 3DS Authentication Session
     * @param {CardData} cardData containing card info
     * @param cardToken An optional token with which a host-stored card details can be recovered
     */
    init3DSecAuthSession(cardData: CardData | undefined, cardToken: string | undefined): void;
    /**
     * Handle response for init session
     *
     * @param {CreateSessionResponse} createSessionResponse - message received from server
     */
    handleInitSessionResponse(createSessionResponse: CreateSessionResponse): void;
    /**
     * Start polling a 3DS result
     * @param {string} path - rightmost part of the path
     */
    startPollResults(url: string): void;
    /**
     * perform a single request to obtain status
     * @param urlAndPath
     */
    getStatusResult(urlAndPath: string): void;
    /**
     * Get Cyber Source jwt from ClientFingerPrintRequiredMessage
     * @param clientFingerPrintRequiredMessage Client FingerPrint Required Message
     * @returns the jwt string
     */
    getCyberSourceJwt(clientFingerPrintRequiredMessage: ClientFingerPrintRequiredMessage): string;
    /**
     * Perform challenge. Can be called either after session initiation or after a fingerprint test
     * @param {string} ascUri - the URI to use for iFrame src tag.
     */
    performChallenge(ascUri: string): void;
    /**
     * Get path from url
     * @param url
     * @returns path
     */
    getPathAndQueryStringParamsFromUrl(url: string): [string | undefined, string | undefined];
    /**
     * Scroll smoothly to element
     */
    scrollToElement(element: HTMLElement): void;
    /**
     * Stop polling for results
     */
    stopPollingResults(): void;
    /**
     * Handle Server result Message
     *
     * @param {*} message - message to be sent back to caller
     */
    handleServerResultMessage(message: ClientMessage): void;
    /**
     * Error reporting
     * @param {string} reason
     * @param {string} ref
     */
    handleError(reason: string, ref: string): void;
    /**
     * Cast an object to a given type
     */
    forceCast<T>(input: any): T;
}

export { CardData, ClientAuthenticatedMessage, ClientChallengeRequiredMessage, ClientFingerPrintRequiredMessage, ClientMessage, ClientTechnicalProblemDetectedMessage, Engine };
