var timapi;
(function (timapi) {
    let TimeDateFormat;
    (function (TimeDateFormat) {
        TimeDateFormat["time"] = "hh:mm:ss";
        TimeDateFormat["date"] = "dd.MM.yyyy";
        TimeDateFormat["regular"] = "dd-MM-yyyy hh:mm:ss";
    })(TimeDateFormat = timapi.TimeDateFormat || (timapi.TimeDateFormat = {}));
    class TimeDate {
        constructor(yearOrFormatOrDate, monthOrValue, day, hour, minute, second) {
            let date;
            switch (arguments.length) {
                case 6: {
                    this.$year = yearOrFormatOrDate;
                    this.$month = monthOrValue;
                    this.$day = day;
                    this.$hour = hour;
                    this.$minute = minute;
                    this.$second = second;
                    break;
                }
                case 2: {
                    const format = yearOrFormatOrDate;
                    const value = monthOrValue;
                    this.initWithFormatAndValue(format, value);
                    break;
                }
                case 1: {
                    date = yearOrFormatOrDate;
                    break;
                }
                case 0: {
                    date = new Date();
                    break;
                }
                default: {
                    throw new Error("Invalid argument");
                }
            }
            if (date !== undefined) {
                this.$year = date.getFullYear();
                this.$month = date.getMonth();
                this.$day = date.getDate();
                this.$hour = date.getHours();
                this.$minute = date.getMinutes();
                this.$second = date.getSeconds();
            }
        }
        get $year() {
            return this.year;
        }
        set $year(value) {
            this.year = value;
        }
        get $month() {
            return this.month;
        }
        set $month(value) {
            this.month = value;
        }
        get $day() {
            return this.day;
        }
        set $day(value) {
            this.day = value;
        }
        get $hour() {
            return this.hour;
        }
        set $hour(value) {
            this.hour = value;
        }
        get $minute() {
            return this.minute;
        }
        set $minute(value) {
            this.minute = value;
        }
        get $second() {
            return this.second;
        }
        set $second(value) {
            this.second = value;
        }
        format(format) {
            const year4 = this.$year.toString();
            const year2 = (this.$year % 100).toString();
            const month = (this.$month + 1).toString();
            const day = this.$day.toString();
            const hour = this.$hour.toString();
            const minute = this.$minute.toString();
            const second = this.$second.toString();
            const result = format
                .replace("yyyy", "0".repeat(4 - year4.length) + year4)
                .replace("yy", "0".repeat(2 - year2.length) + year2)
                .replace("MM", "0".repeat(2 - month.length) + month)
                .replace("dd", "0".repeat(2 - day.length) + day)
                .replace("HH", "0".repeat(2 - hour.length) + hour)
                .replace("mm", "0".repeat(2 - minute.length) + minute)
                .replace("ss", "0".repeat(2 - second.length) + second)
                .replace("Z", "+0000");
            return result;
        }
        initWithFormatAndValue(format, value) {
            format = format.replace(/[^a-zA-Z0-9]/g, "");
            const startIndexYear = format.indexOf("y");
            const endIndexYear = format.lastIndexOf("y");
            this.$year = parseInt(value.slice(startIndexYear, endIndexYear + 1), undefined);
            const startIndexMonth = format.indexOf("M");
            const endIndexMonth = format.lastIndexOf("M");
            this.$month = parseInt(value.slice(startIndexMonth, endIndexMonth + 1), undefined);
            const startIndexDay = format.indexOf("d");
            const endIndexDay = format.lastIndexOf("d");
            this.$day = parseInt(value.slice(startIndexDay, endIndexDay + 1), undefined);
            const startIndexHour = format.indexOf("H");
            const endIndexHour = format.lastIndexOf("H");
            this.$hour = parseInt(value.slice(startIndexHour, endIndexHour + 1), undefined);
            const startIndexMinute = format.indexOf("m");
            const endIndexMinute = format.lastIndexOf("m");
            this.$minute = parseInt(value.slice(startIndexMinute, endIndexMinute + 1), undefined);
            const startIndexSecond = format.indexOf("s");
            const endIndexSecond = format.lastIndexOf("s");
            this.$second = parseInt(value.slice(startIndexSecond, endIndexSecond + 1), undefined);
        }
        toStringRegular() {
            return this.format(TimeDateFormat.regular);
        }
        toStringReceiptDate() {
            return this.format(TimeDateFormat.date);
        }
        toStringReceiptTime() {
            return this.format(TimeDateFormat.time);
        }
    }
    timapi.TimeDate = TimeDate;
})(timapi || (timapi = {}));
var timapi;
(function (timapi) {
    var logging;
    (function (logging) {
        let ErrorCode;
        (function (ErrorCode) {
            ErrorCode[ErrorCode["CLOSE_FAILURE"] = 0] = "CLOSE_FAILURE";
            ErrorCode[ErrorCode["FLUSH_FAILURE"] = 1] = "FLUSH_FAILURE";
            ErrorCode[ErrorCode["GENERIC_FAILURE"] = 2] = "GENERIC_FAILURE";
            ErrorCode[ErrorCode["OPEN_FAILURE"] = 3] = "OPEN_FAILURE";
            ErrorCode[ErrorCode["WRITE_FAILURE"] = 4] = "WRITE_FAILURE";
        })(ErrorCode = logging.ErrorCode || (logging.ErrorCode = {}));
        class ErrorManager {
            error(msg, ex, code) {
                console.error("Error [$code]: $msg");
            }
        }
        logging.ErrorManager = ErrorManager;
    })(logging = timapi.logging || (timapi.logging = {}));
})(timapi || (timapi = {}));
var timapi;
(function (timapi) {
    var logging;
    (function (logging) {
        let Level;
        (function (Level) {
            Level[Level["SEVERE"] = 0] = "SEVERE";
            Level[Level["WARNING"] = 1] = "WARNING";
            Level[Level["INFO"] = 2] = "INFO";
            Level[Level["CONFIG"] = 3] = "CONFIG";
            Level[Level["FINE"] = 4] = "FINE";
            Level[Level["FINER"] = 5] = "FINER";
            Level[Level["FINEST"] = 6] = "FINEST";
            Level[Level["OFF"] = 7] = "OFF";
        })(Level = logging.Level || (logging.Level = {}));
    })(logging = timapi.logging || (timapi.logging = {}));
})(timapi || (timapi = {}));
var timapi;
(function (timapi) {
    var logging;
    (function (logging) {
        class Log {
            constructor($name) {
                this.name = $name;
            }
            entering(sourceClass, sourceMethod, params) {
                if (!this.isLoggable(logging.Level.FINEST)) {
                    return;
                }
                let logMessage = "Entering ->[" +
                    sourceClass +
                    "]: " +
                    sourceMethod;
                if (params !== undefined) {
                    logMessage += "\nparams:";
                    this.log(logging.Level.FINEST, logMessage, params);
                }
                else {
                    this.log(logging.Level.FINEST, logMessage);
                }
            }
            exiting(sourceClass, sourceMethod, params) {
                if (!this.isLoggable(logging.Level.FINEST)) {
                    return;
                }
                let logMessage = "Exiting ->[" +
                    sourceClass +
                    "]: " +
                    sourceMethod;
                if (params !== undefined) {
                    logMessage += "\nparams:";
                    this.log(logging.Level.FINEST, logMessage, params);
                }
                else {
                    this.log(logging.Level.FINEST, logMessage);
                }
            }
            log(level, description, event) {
                if (!this.isLoggable(level)) {
                    return;
                }
                let logMessage = "[" +
                    this.stringForLogLevel(level) +
                    "]: " +
                    description;
                let stack = "";
                if ((level == logging.Level.SEVERE) || (level == logging.Level.WARNING)) {
                    stack = new Error().stack;
                }
                if (event !== undefined) {
                    console.log(logMessage, event, " (" + this.name + ")", stack);
                }
                else {
                    console.log(logMessage, " (" + this.name + ")", stack);
                }
            }
            isLoggable(level) {
                if (Log.logLevel == logging.Level.OFF) {
                    return false;
                }
                return level <= Log.logLevel;
            }
            stringForLogLevel(level) {
                switch (level) {
                    case logging.Level.CONFIG:
                        return "CONFIG";
                    case logging.Level.FINE:
                        return "FINE";
                    case logging.Level.FINER:
                        return "FINER";
                    case logging.Level.FINEST:
                        return "FINEST";
                    case logging.Level.INFO:
                        return "INFO";
                    case logging.Level.OFF:
                        return "OFF";
                    case logging.Level.SEVERE:
                        return "SEVERE";
                    case logging.Level.WARNING:
                        return "WARNING";
                    default:
                        return "";
                }
            }
        }
        Log.logLevel = logging.Level.SEVERE;
        logging.Log = Log;
    })(logging = timapi.logging || (timapi.logging = {}));
})(timapi || (timapi = {}));
var timapi;
(function (timapi) {
    var logging;
    (function (logging) {
        class Logger {
            constructor() {
                this.loggers = new Array();
            }
            static getInstance() {
                if (Logger._instance == undefined) {
                    Logger._instance = new Logger();
                }
                return Logger._instance;
            }
            static getLogger(name) {
                let logger = Logger.getInstance().$loggers[name];
                if (logger == undefined) {
                    logger = new logging.Log(name);
                }
                return logger;
            }
            get $loggers() {
                return this.loggers;
            }
        }
        logging.Logger = Logger;
    })(logging = timapi.logging || (timapi.logging = {}));
})(timapi || (timapi = {}));
var timapi;
(function (timapi) {
    var logging;
    (function (logging) {
        class LogHandler {
            close() {
            }
            flush() {
            }
            isLoggable(record) {
                return true;
            }
            publish(record) {
                console.log(record.$message);
            }
            reportError(msg, exception, code) {
                console.error(msg);
            }
        }
        logging.LogHandler = LogHandler;
    })(logging = timapi.logging || (timapi.logging = {}));
})(timapi || (timapi = {}));
var timapi;
(function (timapi) {
    var logging;
    (function (logging) {
        class LogRecord {
            constructor($level, $message) {
                this.level = $level;
                this.message = $message;
            }
            get $message() {
                return this.message;
            }
            set $message(value) {
                this.message = value;
            }
            get $level() {
                return this.level;
            }
            set $level(value) {
                this.level = value;
            }
        }
        logging.LogRecord = LogRecord;
    })(logging = timapi.logging || (timapi.logging = {}));
})(timapi || (timapi = {}));
var timapi;
(function (timapi) {
    var utils;
    (function (utils) {
        class StringBuilder {
            constructor(value) {
                this.holder = new Array();
                this.append(value);
            }
            append(value) {
                if (value !== undefined && value !== undefined) {
                    this.holder.push(value);
                }
                return this;
            }
            toString() {
                return this.holder.join("");
            }
        }
        utils.StringBuilder = StringBuilder;
    })(utils = timapi.utils || (timapi.utils = {}));
})(timapi || (timapi = {}));
var timapi;
(function (timapi) {
    var utils;
    (function (utils) {
        var ArrayAdditions;
        (function (ArrayAdditions_1) {
            class ArrayAdditions {
                static remove(element, arr) {
                    let keys = Object.getOwnPropertyNames(element);
                    return arr.filter(arrElement => {
                        return arrElement !== element;
                    });
                }
            }
            ArrayAdditions_1.ArrayAdditions = ArrayAdditions;
        })(ArrayAdditions = utils.ArrayAdditions || (utils.ArrayAdditions = {}));
    })(utils = timapi.utils || (timapi.utils = {}));
})(timapi || (timapi = {}));
timapi.logging = timapi.logging || {};
timapi.constants = timapi.constants || {};
timapi.protocol = timapi.protocol || {};
timapi.protocol.constants = timapi.protocol.constants || {};
timapi.protocol.sixml = timapi.protocol.sixml || {};
timapi.statemachine = timapi.statemachine || {};
timapi.statemachine.states = timapi.statemachine.states || {};
timapi.protocol.Container = function () {
};
timapi.protocol.Container.prototype.toXmlNode = Object.abstractFunction;
timapi.protocol.Container.prototype.xmlHasAttribute = function (node, name) {
    return node.attributes.has(name);
};
timapi.protocol.Container.prototype.xmlHasChild = function (node, name) {
    for (child of node.children) {
        if (child.name == name) {
            return true;
        }
    }
    return false;
};
timapi.protocol.Container.prototype.xmlGetAttribute = function (node, name) {
    return node.attributes.get(name);
};
timapi.protocol.Container.prototype.xmlGetChild = function (node, name) {
    for (child of node.children) {
        if (child.name == name) {
            return child;
        }
    }
    throw "No such element";
};
timapi.protocol.Container.prototype.xmlGetChildren = function (node, name) {
    var list = [];
    for (child of node.children) {
        if (child.name == name) {
            list.push(child);
        }
    }
    return list;
};
timapi.protocol.Container.prototype.xmlSetAttribute = function (node, name, value) {
    node.attributes.set(name, value);
};
timapi.protocol.Container.prototype.xmlAddChild = function (node, name, value) {
    if (arguments.length == 3 && typeof value === "string") {
        var child = new timapi.protocol.XmlNode(name);
        child.textContent = value;
        node.children.push(child);
    }
    else if (arguments.length == 3 && value instanceof timapi.protocol.Container) {
        node.children.push(value.toXmlNode());
    }
    else {
        throw new Error("Invalid argument");
    }
};
timapi.protocol.Message = function () {
};
timapi.protocol.Message.prototype = Object.create(timapi.protocol.Container.prototype);
timapi.protocol.TimeDate = timapi.TimeDate;
timapi.protocol.XmlNode = function (name) {
    this.name = name;
    this.children = [];
    this.attributes = new Map();
};
timapi.protocol.XmlNode.prototype.name = "";
timapi.protocol.XmlNode.prototype.textContent = "";
timapi.protocol.XmlNode.prototype.children = undefined;
timapi.protocol.XmlNode.prototype.attributes = undefined;
var timapi;
(function (timapi) {
    var protocol;
    (function (protocol) {
        class XmlWriter {
            constructor($useDoubleQuotes, $useAsciiEncoding) {
                this.stringDelimiter = "\"";
                this.encoding = "UTF-8";
                if ($useDoubleQuotes) {
                    this.stringDelimiter = "\"";
                }
                else {
                    this.stringDelimiter = "\'";
                }
                if ($useAsciiEncoding) {
                    this.encoding = "US-ASCII";
                }
                else {
                    this.encoding = "UTF-8";
                }
            }
            writeXml(node, builder) {
                if (builder == undefined) {
                    builder = new timapi.utils.StringBuilder();
                }
                builder.append("<?xml version=");
                builder.append(this.stringDelimiter);
                builder.append("1.0");
                builder.append(this.stringDelimiter);
                builder.append(" encoding=");
                builder.append(this.stringDelimiter);
                builder.append(this.encoding);
                builder.append(this.stringDelimiter);
                builder.append("?>");
                this.writeXmlNode(node, builder);
                return timapi.utils.StringHelper.makeString(builder);
            }
            writeXmlNode(node, builder) {
                builder.append("<").append(node.name);
                Array.from(node.attributes).forEach(function (entry) {
                    builder.append(" ");
                    builder.append(entry[0]);
                    builder.append("=");
                    builder.append(this.stringDelimiter);
                    builder.append(entry[1]);
                    builder.append(this.stringDelimiter);
                }, this);
                if (node.children.length === 0) {
                    if (node.textContent.length === 0) {
                        builder.append("/>");
                    }
                    else {
                        builder.append(">");
                        this.escapeXmlString(builder, node.textContent);
                        builder.append("</").append(node.name).append(">");
                    }
                }
                else {
                    builder.append(">");
                    for (let child of node.children) {
                        this.writeXmlNode(child, builder);
                    }
                    builder.append("</").append(node.name).append(">");
                }
            }
            escapeXmlString(builder, text) {
                let stringValue = text.toString();
                let len = stringValue.length;
                for (let i = 0; i < len; i++) {
                    let character = stringValue[i];
                    switch (character) {
                        case "<":
                            builder.append("&lt;");
                            break;
                        case ">":
                            builder.append("&gt;");
                            break;
                        case "\"":
                            builder.append("&quot;");
                            break;
                        case "&":
                            builder.append("&amp;");
                            break;
                        case "\'":
                            builder.append("&apos;");
                            break;
                        default:
                            if (character > 0x7e) {
                                builder.append("&#").append(character).append(";");
                            }
                            else {
                                builder.append(character);
                            }
                    }
                }
            }
        }
        protocol.XmlWriter = XmlWriter;
    })(protocol = timapi.protocol || (timapi.protocol = {}));
})(timapi || (timapi = {}));
var timapi;
(function (timapi) {
    var constants;
    (function (constants) {
        let RequestType;
        (function (RequestType) {
            RequestType[RequestType["connect"] = 0] = "connect";
            RequestType[RequestType["activate"] = 1] = "activate";
            RequestType[RequestType["applicationInformation"] = 2] = "applicationInformation";
            RequestType[RequestType["balance"] = 3] = "balance";
            RequestType[RequestType["changeSettings"] = 4] = "changeSettings";
            RequestType[RequestType["commit"] = 5] = "commit";
            RequestType[RequestType["counterRequest"] = 6] = "counterRequest";
            RequestType[RequestType["deactivate"] = 7] = "deactivate";
            RequestType[RequestType["dccRates"] = 8] = "dccRates";
            RequestType[RequestType["hardwareInformation"] = 9] = "hardwareInformation";
            RequestType[RequestType["initTransaction"] = 10] = "initTransaction";
            RequestType[RequestType["login"] = 11] = "login";
            RequestType[RequestType["logout"] = 12] = "logout";
            RequestType[RequestType["reboot"] = 13] = "reboot";
            RequestType[RequestType["reconciliation"] = 14] = "reconciliation";
            RequestType[RequestType["receiptRequest"] = 15] = "receiptRequest";
            RequestType[RequestType["reconfig"] = 16] = "reconfig";
            RequestType[RequestType["rollback"] = 17] = "rollback";
            RequestType[RequestType["softwareInformation"] = 18] = "softwareInformation";
            RequestType[RequestType["systemInformation"] = 19] = "systemInformation";
            RequestType[RequestType["softwareUpdate"] = 20] = "softwareUpdate";
            RequestType[RequestType["transaction"] = 21] = "transaction";
            RequestType[RequestType["closeReader"] = 22] = "closeReader";
            RequestType[RequestType["openReader"] = 23] = "openReader";
            RequestType[RequestType["ejectCard"] = 24] = "ejectCard";
            RequestType[RequestType["openMaintenanceWindow"] = 25] = "openMaintenanceWindow";
            RequestType[RequestType["closeMaintenanceWindow"] = 26] = "closeMaintenanceWindow";
            RequestType[RequestType["activateServiceMenu"] = 27] = "activateServiceMenu";
            RequestType[RequestType["openDialogMode"] = 28] = "openDialogMode";
            RequestType[RequestType["closeDialogMode"] = 29] = "closeDialogMode";
            RequestType[RequestType["showSignatureCapture"] = 30] = "showSignatureCapture";
            RequestType[RequestType["showDialog"] = 31] = "showDialog";
            RequestType[RequestType["balanceInquiry"] = 32] = "balanceInquiry";
            RequestType[RequestType["queryLoyalty"] = 33] = "queryLoyalty";
        })(RequestType = constants.RequestType || (constants.RequestType = {}));
    })(constants = timapi.constants || (timapi.constants = {}));
})(timapi || (timapi = {}));
timapi.constants.AdminFunctions = {
    login: 0,
    logout: 1,
    reconfig: 2,
    reboot: 3,
    softwareUpdate: 4,
    activate: 5,
    deactivate: 6,
    counterRequest: 7,
    reconciliation: 8,
    balance: 9,
    openDialogMode: 10,
    closeDialogMode: 11,
    transmitLog: 12,
    startReaderCleaning: 13,
    dccRates: 14,
    changeSettings: 15,
    receiptRequest: 16,
    closeReader: 17,
    openReader: 18,
    ejectCard: 19,
    openMaintenanceWindow: 20,
    closeMaintenanceWindow: 21,
    activateServiceMenu: 22
};
timapi.constants.BrandBarBrand = {
    alipay: 0,
    amex: 1,
    bonuscard: 2,
    cash: 3,
    conforama: 4,
    coopMobile: 5,
    cup: 6,
    diners: 7,
    dinerClub: 8,
    jcb: 9,
    lebara: 10,
    lycaMobile: 11,
    maestro: 12,
    masterCard: 13,
    mbudgetMc: 14,
    mcard: 15,
    mediaMarkt: 16,
    myOne: 17,
    salt: 18,
    pharmacard: 19,
    phonecard: 20,
    postCard: 21,
    powerCard: 22,
    reka: 23,
    sunrise: 24,
    supercardPlus: 25,
    swisscom: 26,
    visa: 27,
    visaElectron: 28,
    vpay: 29,
    wirCard: 30,
    yallo: 31
};
timapi.constants.BrandMode = {
    all: 0,
    selected: 1,
    off: 2
};
timapi.constants.CardReaderStatus = {
    cardReaderClosed: 0,
    cardManuallyEntered: 1,
    cardSwiped: 2,
    cardNotRemoved: 3,
    cardPresented: 4,
    cardReaderEmpty: 5,
    cardInserted: 6,
    cardEjected: 7
};
timapi.constants.ConnectionStatus = {
    disconnected: 0,
    loggedOut: 1,
    loggedIn: 2
};
timapi.constants.CounterType = {
    shift: 0,
    balance: 1
};
timapi.constants.Currency = {
    AED: { code: "AED", name: "UAE Dirham", exponent: 2 },
    AFN: { code: "AFN", name: "Afghani", exponent: 2 },
    ALL: { code: "ALL", name: "Lek", exponent: 2 },
    AMD: { code: "AMD", name: "Armenian Dram", exponent: 2 },
    ANG: { code: "ANG", name: "Netherlands Antillean Guilder", exponent: 2 },
    AOA: { code: "AOA", name: "Kwanza", exponent: 2 },
    ARS: { code: "ARS", name: "Argentine Peso", exponent: 2 },
    AUD: { code: "AUD", name: "Australian Dollar", exponent: 2 },
    AWG: { code: "AWG", name: "Aruban Florin", exponent: 2 },
    AZN: { code: "AZN", name: "Azerbaijanian Manat", exponent: 2 },
    BAM: { code: "BAM", name: "Convertible Mark", exponent: 2 },
    BBD: { code: "BBD", name: "Barbados Dollar", exponent: 2 },
    BDT: { code: "BDT", name: "Taka", exponent: 2 },
    BGN: { code: "BGN", name: "Bulgarian Lev", exponent: 2 },
    BHD: { code: "BHD", name: "Bahraini Dinar", exponent: 3 },
    BIF: { code: "BIF", name: "Burundi Franc", exponent: 0 },
    BMD: { code: "BMD", name: "Bermudian Dollar", exponent: 2 },
    BND: { code: "BND", name: "Brunei Dollar", exponent: 2 },
    BOB: { code: "BOB", name: "Boliviano", exponent: 2 },
    BOV: { code: "BOV", name: "Mvdol", exponent: 2 },
    BRL: { code: "BRL", name: "Brazilian Real", exponent: 2 },
    BSD: { code: "BSD", name: "Bahamian Dollar", exponent: 2 },
    BTN: { code: "BTN", name: "Ngultrum", exponent: 2 },
    BWP: { code: "BWP", name: "Pula", exponent: 2 },
    BYN: { code: "BYN", name: "Belarusian Ruble", exponent: 2 },
    BYR: { code: "BYR", name: "Belarusian Ruble", exponent: 0 },
    BZD: { code: "BZD", name: "Belize Dollar", exponent: 2 },
    CAD: { code: "CAD", name: "Canadian Dollar", exponent: 2 },
    CDF: { code: "CDF", name: "Congolese Franc", exponent: 2 },
    CHE: { code: "CHE", name: "WIR Euro", exponent: 2 },
    CHF: { code: "CHF", name: "Swiss Franc", exponent: 2 },
    CHW: { code: "CHW", name: "WIR Franc", exponent: 2 },
    CLF: { code: "CLF", name: "Unidad de Fomento", exponent: 4 },
    CLP: { code: "CLP", name: "Chilean Peso", exponent: 0 },
    CNY: { code: "CNY", name: "Yuan Renminbi", exponent: 2 },
    COP: { code: "COP", name: "Colombian Peso", exponent: 2 },
    COU: { code: "COU", name: "Unidad de Valor Real", exponent: 2 },
    CRC: { code: "CRC", name: "Costa Rican Colon", exponent: 2 },
    CUC: { code: "CUC", name: "Peso Convertible", exponent: 2 },
    CUP: { code: "CUP", name: "Cuban Peso", exponent: 2 },
    CVE: { code: "CVE", name: "Cabo Verde Escudo", exponent: 2 },
    CZK: { code: "CZK", name: "Czech Koruna", exponent: 2 },
    DJF: { code: "DJF", name: "Djibouti Franc", exponent: 0 },
    DKK: { code: "DKK", name: "Danish Krone", exponent: 2 },
    DOP: { code: "DOP", name: "Dominican Peso", exponent: 2 },
    DZD: { code: "DZD", name: "Algerian Dinar", exponent: 2 },
    EGP: { code: "EGP", name: "Egyptian Pound", exponent: 2 },
    ERN: { code: "ERN", name: "Nakfa", exponent: 2 },
    ETB: { code: "ETB", name: "Ethiopian Birr", exponent: 2 },
    EUR: { code: "EUR", name: "Euro", exponent: 2 },
    FJD: { code: "FJD", name: "Fiji Dollar", exponent: 2 },
    FKP: { code: "FKP", name: "Falkland Islands Pound", exponent: 2 },
    GBP: { code: "GBP", name: "Pound Sterling", exponent: 2 },
    GEL: { code: "GEL", name: "Lari", exponent: 2 },
    GHS: { code: "GHS", name: "Ghana Cedi", exponent: 2 },
    GIP: { code: "GIP", name: "Gibraltar Pound", exponent: 2 },
    GMD: { code: "GMD", name: "Dalasi", exponent: 2 },
    GNF: { code: "GNF", name: "Guinea Franc", exponent: 0 },
    GTQ: { code: "GTQ", name: "Quetzal", exponent: 2 },
    GYD: { code: "GYD", name: "Guyana Dollar", exponent: 2 },
    HKD: { code: "HKD", name: "Hong Kong Dollar", exponent: 2 },
    HNL: { code: "HNL", name: "Lempira", exponent: 2 },
    HRK: { code: "HRK", name: "Kuna", exponent: 2 },
    HTG: { code: "HTG", name: "Gourde", exponent: 2 },
    HUF: { code: "HUF", name: "Forint", exponent: 2 },
    IDR: { code: "IDR", name: "Rupiah", exponent: 2 },
    ILS: { code: "ILS", name: "New Israeli Sheqel", exponent: 2 },
    INR: { code: "INR", name: "Indian Rupee", exponent: 2 },
    IQD: { code: "IQD", name: "Iraqi Dinar", exponent: 3 },
    IRR: { code: "IRR", name: "Iranian Rial", exponent: 2 },
    ISK: { code: "ISK", name: "Iceland Krona", exponent: 0 },
    JMD: { code: "JMD", name: "Jamaican Dollar", exponent: 2 },
    JOD: { code: "JOD", name: "Jordanian Dinar", exponent: 3 },
    JPY: { code: "JPY", name: "Yen", exponent: 0 },
    KES: { code: "KES", name: "Kenyan Shilling", exponent: 2 },
    KGS: { code: "KGS", name: "Som", exponent: 2 },
    KHR: { code: "KHR", name: "Riel", exponent: 2 },
    KMF: { code: "KMF", name: "Comoro Franc", exponent: 0 },
    KPW: { code: "KPW", name: "North Korean Won", exponent: 2 },
    KRW: { code: "KRW", name: "Won", exponent: 0 },
    KWD: { code: "KWD", name: "Kuwaiti Dinar", exponent: 3 },
    KYD: { code: "KYD", name: "Cayman Islands Dollar", exponent: 2 },
    KZT: { code: "KZT", name: "Tenge", exponent: 2 },
    LAK: { code: "LAK", name: "Kip", exponent: 2 },
    LBP: { code: "LBP", name: "Lebanese Pound", exponent: 2 },
    LKR: { code: "LKR", name: "Sri Lanka Rupee", exponent: 2 },
    LRD: { code: "LRD", name: "Liberian Dollar", exponent: 2 },
    LSL: { code: "LSL", name: "Loti", exponent: 2 },
    LYD: { code: "LYD", name: "Libyan Dinar", exponent: 3 },
    MAD: { code: "MAD", name: "Moroccan Dirham", exponent: 2 },
    MDL: { code: "MDL", name: "Moldovan Leu", exponent: 2 },
    MGA: { code: "MGA", name: "Malagasy Ariary", exponent: 2 },
    MKD: { code: "MKD", name: "Denar", exponent: 2 },
    MMK: { code: "MMK", name: "Kyat", exponent: 2 },
    MNT: { code: "MNT", name: "Tugrik", exponent: 2 },
    MOP: { code: "MOP", name: "Pataca", exponent: 2 },
    MRO: { code: "MRO", name: "Ouguiya", exponent: 2 },
    MUR: { code: "MUR", name: "Mauritius Rupee", exponent: 2 },
    MVR: { code: "MVR", name: "Rufiyaa", exponent: 2 },
    MWK: { code: "MWK", name: "Malawi Kwacha", exponent: 2 },
    MXN: { code: "MXN", name: "Mexican Peso", exponent: 2 },
    MXV: { code: "MXV", name: "Mexican Unidad de Inversion (UDI)", exponent: 2 },
    MYR: { code: "MYR", name: "Malaysian Ringgit", exponent: 2 },
    MZN: { code: "MZN", name: "Mozambique Metical", exponent: 2 },
    NAD: { code: "NAD", name: "Namibia Dollar", exponent: 2 },
    NGN: { code: "NGN", name: "Naira", exponent: 2 },
    NIO: { code: "NIO", name: "Cordoba Oro", exponent: 2 },
    NOK: { code: "NOK", name: "Norwegian Krone", exponent: 2 },
    NPR: { code: "NPR", name: "Nepalese Rupee", exponent: 2 },
    NZD: { code: "NZD", name: "New Zealand Dollar", exponent: 2 },
    OMR: { code: "OMR", name: "Rial Omani", exponent: 3 },
    PAB: { code: "PAB", name: "Balboa", exponent: 2 },
    PEN: { code: "PEN", name: "Sol", exponent: 2 },
    PGK: { code: "PGK", name: "Kina", exponent: 2 },
    PHP: { code: "PHP", name: "Philippine Peso", exponent: 2 },
    PKR: { code: "PKR", name: "Pakistan Rupee", exponent: 2 },
    PLN: { code: "PLN", name: "Zloty", exponent: 2 },
    PTS: { code: "PTS", name: "VM Loyalty", exponent: 0 },
    PYG: { code: "PYG", name: "Guarani", exponent: 0 },
    QAR: { code: "QAR", name: "Qatari Rial", exponent: 2 },
    RON: { code: "RON", name: "Romanian Leu", exponent: 2 },
    RSD: { code: "RSD", name: "Serbian Dinar", exponent: 2 },
    RUB: { code: "RUB", name: "Russian Ruble", exponent: 2 },
    RWF: { code: "RWF", name: "Rwanda Franc", exponent: 0 },
    SAR: { code: "SAR", name: "Saudi Riyal", exponent: 2 },
    SBD: { code: "SBD", name: "Solomon Islands Dollar", exponent: 2 },
    SCR: { code: "SCR", name: "Seychelles Rupee", exponent: 2 },
    SDG: { code: "SDG", name: "Sudanese Pound", exponent: 2 },
    SEK: { code: "SEK", name: "Swedish Krona", exponent: 2 },
    SGD: { code: "SGD", name: "Singapore Dollar", exponent: 2 },
    SHP: { code: "SHP", name: "Saint Helena Pound", exponent: 2 },
    SLL: { code: "SLL", name: "Leone", exponent: 2 },
    SOS: { code: "SOS", name: "Somali Shilling", exponent: 2 },
    SRD: { code: "SRD", name: "Surinam Dollar", exponent: 2 },
    SSP: { code: "SSP", name: "South Sudanese Pound", exponent: 2 },
    STD: { code: "STD", name: "Dobra", exponent: 2 },
    SVC: { code: "SVC", name: "El Salvador Colon", exponent: 2 },
    SYP: { code: "SYP", name: "Syrian Pound", exponent: 2 },
    SZL: { code: "SZL", name: "Lilangeni", exponent: 2 },
    THB: { code: "THB", name: "Baht", exponent: 2 },
    TJS: { code: "TJS", name: "Somoni", exponent: 2 },
    TMT: { code: "TMT", name: "Turkmenistan New Manat", exponent: 2 },
    TND: { code: "TND", name: "Tunisian Dinar", exponent: 3 },
    TOP: { code: "TOP", name: "Pa’anga", exponent: 2 },
    TRY: { code: "TRY", name: "Turkish Lira", exponent: 2 },
    TTD: { code: "TTD", name: "Trinidad and Tobago Dollar", exponent: 2 },
    TWD: { code: "TWD", name: "New Taiwan Dollar", exponent: 2 },
    TZS: { code: "TZS", name: "Tanzanian Shilling", exponent: 2 },
    UAH: { code: "UAH", name: "Hryvnia", exponent: 2 },
    UGX: { code: "UGX", name: "Uganda Shilling", exponent: 0 },
    USD: { code: "USD", name: "US Dollar", exponent: 2 },
    USN: { code: "USN", name: "US Dollar (Next day)", exponent: 2 },
    UYI: { code: "UYI", name: "Uruguay Peso en Unidades Indexadas (URUIURUI)", exponent: 0 },
    UYU: { code: "UYU", name: "Peso Uruguayo", exponent: 2 },
    UZS: { code: "UZS", name: "Uzbekistan Sum", exponent: 2 },
    VEF: { code: "VEF", name: "Bolívar", exponent: 2 },
    VND: { code: "VND", name: "Dong", exponent: 0 },
    VUV: { code: "VUV", name: "Vatu", exponent: 0 },
    WST: { code: "WST", name: "Tala", exponent: 2 },
    XAF: { code: "XAF", name: "CFA Franc BEAC", exponent: 0 },
    XCD: { code: "XCD", name: "East Caribbean Dollar", exponent: 2 },
    XOF: { code: "XOF", name: "CFA Franc BCEAO", exponent: 0 },
    XPF: { code: "XPF", name: "CFP Franc", exponent: 0 },
    YER: { code: "YER", name: "Yemeni Rial", exponent: 2 },
    ZAR: { code: "ZAR", name: "Rand", exponent: 2 },
    ZMW: { code: "ZMW", name: "Zambian Kwacha", exponent: 2 },
    ZWL: { code: "ZWL", name: "Zimbabwe Dollar", exponent: 2 }
};
timapi.constants.CurrencyType = {
    local: 0,
    foreign: 1,
    dcc: 2
};
timapi.constants.Cvm = {
    pin: 0,
    pinSignature: 1,
    signature: 2,
    onDevice: 3,
    noCvm: 4
};
timapi.constants.DialogFunctions = {
    showSignatureCapture: 0,
    showDialog: 1,
    sendCardCommand: 2
};
timapi.constants.EcrInfoType = {
    os: 0,
    ecrApplication: 1,
    eftApi: 2,
    eftModule: 3
};
timapi.constants.FinancialTransactions = {
    purchase: 0,
    credit: 1,
    reversal: 2,
    preAuthorization: 3,
    cashAdvance: 4,
    commit: 5,
    rollback: 6,
    giro: 7,
    combined: 8,
    authorizeCredit: 9,
    authorizeDeposit: 10,
    finalizePurchase: 11,
    proceed: 12,
    purchaseForcedAcceptance: 13,
    purchaseWithCashback: 14,
    purchasePhoneAuthorized: 15,
    loadVoucher: 16,
    collectPoints: 17,
    purchaseReservation: 18,
    purchaseReservationPhoneAuthorized: 19,
    amtAdjustment: 20,
    purchasePhoneOrdered: 21,
    purchaseMailOrdered: 22
};
timapi.constants.Guides = {
    retail: 0,
    unattended: 1,
    advancedRetail: 2,
    banking: 3,
    petrol: 4,
    dialog: 5,
    remote: 6,
    gastro: 7,
    hospitality: 8,
    valueAddedServices: 9,
    austrianUseCases: 10
};
timapi.constants.HardwareType = {
    terminal: 0,
    eftApplication: 1,
    pinPad: 2,
    contactReader: 3,
    contactlessReader: 4,
    magStripeReader: 5
};
timapi.constants.ImageFileFormat = {
    jpeg: 0,
    png: 1
};
timapi.constants.KernelType = {
    emvContact: 0,
    entryPoint: 1,
    kernel1: 2,
    kernel2: 3,
    kernel3: 4,
    kernel4: 5,
    kernel5: 6,
    kernel6: 7,
    kernel7: 8
};
timapi.constants.ManagementStatus = {
    closed: 0,
    open: 1,
    dialog: 2
};
timapi.constants.MerchantAction = {
    signature: 0,
    none: 1
};
timapi.constants.MerchantOptionType = {
    additionalMerchantData: 0,
    multiAccountIndex: 1,
    multiContractIndex: 2,
    merchantTid: 3,
    clerkIdentifier: 4,
    fuelDispenserNumber: 5,
    posdnumber: 6,
    receiptNumber: 7,
    shiftNumber: 8
};
timapi.constants.NonFinancialTransactions = {
    cancel: 0,
    balanceInquiry: 1,
    clientIdentification: 2,
    initTransaction: 3,
    holdCommit: 4,
    reservation: 5,
    adjustReservation: 6,
    cancelReservation: 7,
    loyaltyData: 8,
    startCheckout: 9,
    finishCheckout: 10,
    provideLoyaltyBasket: 11
};
timapi.constants.PaymentProtocol = {
    ep2: 0,
    ev: 1,
    valueMaster: 2,
    v3cxml: 3
};
timapi.constants.PosEntryMode = {
    unspecified: 0,
    manual: 1,
    magStripeIncomplete: 2,
    barCode: 3,
    ocr: 4,
    icc: 5,
    magStripe: 6,
    magStripeFallback: 7,
    magStripeFallbackAgain: 8,
    magStripeFallbackIccFail: 9,
    emergencyDataEntry: 10,
    ecommerce: 11,
    ctlessIcc: 12,
    ctlessMagStrige: 13
};
timapi.constants.PrintFlag = {
    suppressHeader: 0,
    suppressSignature: 1,
    suppressEcrInfo: 2,
    suppressEftInfo: 3
};
timapi.constants.PrintFormat = {
    noPrint: 0,
    normal: 1,
    onDevice: 2,
    fieldsOnly: 3
};
timapi.constants.ProcessingDisposition = {
    onEcr: 0,
    onEft: 1
};
timapi.constants.ProtocolLevel = {
    sixml2_2: 0
};
timapi.constants.ProtocolType = {
    sixml: 0
};
timapi.constants.Reason = {
    ok: 0,
    corr: 1,
    stop: 2,
    cardReader: 3,
    autoConfirm: 4,
    timeout: 5,
    codeOk: 6,
    codeNok: 7,
    pinOk: 8,
    pinNok: 9
};
timapi.constants.ReceiptItemType = {
    actId: 0,
    accPer: 1,
    acqId: 2,
    aid: 3,
    amount: 4,
    amountDcc: 5,
    amountOther: 6,
    authCode: 7,
    authReslt: 8,
    authRespC: 9,
    authRespTextC: 10,
    brandName: 11,
    currency: 12,
    currencyDcc: 13,
    dccDisclaimer: 14,
    disclaimer: 15,
    exponent: 16,
    exponentDcc: 17,
    markupDcc: 18,
    markupExponentDcc: 19,
    cardNumberPrintableMerchant: 20,
    cardNumberPrintableCardholder: 21,
    rateDcc: 22,
    rateExponentDcc: 23,
    timeStampDate: 24,
    timeStampTime: 25,
    trmId: 26,
    trxRefNum: 27,
    trxSeqCnt: 28,
    posEntryMode: 29,
    cardExpiryDate: 30,
    cardNumberEnc: 31,
    amountSaldo: 32,
    ecrSeqCounter: 33,
    panReceiptDol: 34,
    panReceiptDolIndex: 35
};
timapi.constants.ReceiptRequestType = {
    reprint: 0,
    list: 1
};
timapi.constants.ReceiptType = {
    purchase: 0,
    credit: 1,
    reversal: 2
};
timapi.constants.Recipient = {
    merchant: 0,
    cardholder: 1,
    both: 2
};
timapi.constants.ResourceId = {
    enterMileage: 0,
    enterCarNumber: 1,
    enterDriverCode: 2,
    enterFleetId: 3,
    selectPump: 4,
    selectWashingStation: 5,
    selectProgram: 6,
    selectProduct: 7,
    loadCard: 8,
    readCode: 9,
    checkCode: 10,
    enterAdditionalInformation: 11,
    enterCostCenter: 12,
    enterEmployeeNumber: 13,
    enterLicensePlate: 14,
    enterProjectNumber: 15,
    petrolPrintReceipt: 16,
    petrolRemoveCard: 17,
    petrolOutOfOrder: 18,
    petrolInvalidEntry: 19,
    petrolRefuelAtPump: 20,
    petrolSeeOtherScreen: 21,
    petrolPleaseRefuel: 22,
    noRechargeCard: 23,
    showPhoneNumberWithAmount: 24,
    enterPhoneOrPrepaidNumber: 25,
    phoneNumberTooLong: 26,
    phoneNumberTooShort: 27,
    enterPhoneNumber: 28,
    pleaseWait: 29,
    processingDeclined: 30,
    processingOk: 31,
    registerCard: 32,
    welcomeCard: 33,
    showPhoneNumber: 34,
    interAccountTransfer: 35,
    interAccountTransferConfirmation: 36,
    disbursementFromAccount: 37,
    depositOwnAccount: 38,
    emptyDialog: 39,
    packetAcknowledgement: 40,
    pinEntry: 41,
    bankingInsertCard: 42,
    bankingPinCheck: 43,
    bankingShowSaldo: 44,
    bankingConfirmAmount: 45,
    bankingRemoveCard: 46,
    bankingWelcome: 47,
    commonRegular: 48,
    commonPleaseWait: 49,
    commonDataSaved: 50,
    commonCardInitialized: 51,
    commonCardDeinitialized: 52,
    commonRemoveCard: 53
};
timapi.constants.ResultCode = {
    ok: 0,
    apiCancelEcr: 0,
    apiInvalidAnswer: 1,
    apiDisabledFeature: 2,
    apiFunctionDisallowed: 3,
    apiPersistencyProblem: 4,
    apiConnectFailServer: 0,
    apiConnectFailTerminal: 1,
    apiConnectionLostServer: 2,
    apiConnectionLostTerminal: 3,
    ethernetDisconnected: 4,
    rs232Disconnected: 5,
    apiTimeoutServer: 6,
    apiTimeoutTerminal: 7,
    serverInvalidAnswer: 0,
    serverInvalidRequest: 1,
    serverDisabledFeature: 2,
    serverPersistencyProblem: 3,
    serverConnectFailTerminal: 0,
    serverConnectionLostTerminal: 1,
    serverTimeoutTerminal: 2,
    ccrUnavailable: 0,
    mcrUnavailable: 1,
    nfcUnavailable: 2,
    displayUnavailable: 3,
    pinPadUnavailable: 4,
    rs232Unavailable: 5,
    rs232NotConfigured: 6,
    cardReaderErrorCcr: 0,
    cardReaderErrorMcr: 1,
    cardReaderErrorNfc: 2,
    cardErrorCcr: 3,
    cardErrorMcr: 4,
    cardErrorNfc: 5,
    cardReadError: 6,
    cardReadTimeout: 7,
    cardInsertionTimeout: 8,
    cardReaderKeysLost: 9,
    cardReaderSecurityError: 10,
    cardTimeout: 11,
    cardNotReadable: 12,
    cardInvalidData: 13,
    cardFunctionNotFound: 14,
    cardFunctionNotAllowed: 15,
    pinPadSecurityError: 0,
    pinPadTampered: 1,
    pinPadKeysLost: 2,
    cardholderStop: 0,
    cardholderTimeout: 1,
    cardRemoved: 2,
    timTimeoutEcr: 0,
    timConnectFailPaymentHost: 1,
    timConnectionLostPaymentHost: 2,
    timTimeoutAnswerRs232: 3,
    timCommunicationFailure: 4,
    timConfigFailure: 5,
    timInitFailure: 6,
    sixmlGeneralError: 0,
    sixmlInvalidRequest: 1,
    sixmlWrongCashier: 2,
    sixmlWrongEcrId: 3,
    sixmlUnknownReferenceNumber: 4,
    sixmlWrongState: 5,
    busyOtherController: 6,
    busyMaintenance: 7,
    requestPending: 8,
    sixmlUnsupportedRequest: 9,
    trxNoCommonApplications: 0,
    trxLimitExceeded: 1,
    trxNoCommonCvm: 2,
    declinedCvmFailed: 3,
    trxReferral: 4,
    trxInvalidAuthResponse: 5,
    declinedGeneric: 6,
    declinedSaldoTooLow: 7,
    declinedWrongPin: 8,
    declinedCardBlocked: 9,
    declinedSecurityIssue: 10,
    declinedUsageControl: 11,
    declinedDoubleTransaction: 12,
    declinedGenericFirstAc: 13,
    declinedGenericSecondAc: 14,
    trxCommitTimeout: 15,
    trxRollbackImpossible: 16,
    cashbackAmountTooLow: 17,
    cashbackAmountTooHigh: 18,
    basketDeclined: 19,
    noTrxInGroupExceeded: 20,
    unsupportedCharactersInMessage: 21,
    loyaltyCheckInPending: 22,
    declinedCardError: 23,
    declinedCardExpired: 24,
    declinedTrxInvalid: 25,
    declinedTryLater: 26,
    declinedTryAnotherInterface: 27,
    declinedInvalidMerchant: 28,
    declinedRestrictionDeclined: 29,
    declinedWrongCurrency: 30,
    declinedAutoreversalPending: 31,
    declinedWrongCardNumber: 32,
    declinedWrongCardExpiryDate: 33,
    declinedRetryTemporaryUnavailable: 34,
    declinedServiceNotAllowed: 35,
    declinedCardholderInformationIssue: 36,
    declinedReferralWrongAuthCode: 37,
    declinedReferralWrongAmount: 38,
    declinedReferralOtherReason: 39,
    declinedCaptureCardGeneric: 40,
    declinedCaptureCardInfoToClient: 41,
    declinedCaptureCardOrderToClient: 42,
    declinedCaptureCardTimeoutRemovingCard: 43,
    declinedNotSupported: 44
};
timapi.constants.SecurityStatus = {
    disabled: 0,
    active: 1,
    tampered: 2
};
timapi.constants.SettingType = {
    displayBrightness: 0,
    displayContrast: 1,
    keypadTones: 2,
    alertTones: 3,
    language: 4
};
timapi.constants.SleepModeStatus = {
    enteringSleep: 0,
    wakingUp: 1
};
timapi.constants.StatusFunctions = {
    featureRequest: 0,
    terminalStatus: 1,
    systemInformation: 2,
    applicationInformation: 3,
    hardwareInformation: 4,
    keepAlive: 5,
    licenseChanged: 6
};
timapi.constants.Theme = {
    six: 0,
    swissPost: 1
};
timapi.constants.TransactionStatus = {
    busy: 0,
    idle: 1,
    waitForCard: 2,
    readingCard: 3,
    applicationSelection: 4,
    waitForProceed: 5,
    dccSelection: 6,
    enterTip: 7,
    pinEntry: 8,
    signatureCapture: 9,
    processing: 10,
    waitForCommit: 11
};
timapi.constants.TransactionType = {
    purchase: 0,
    credit: 1,
    reversal: 2,
    preAuthorization: 3,
    finalizePurchase: 4,
    cashAdvance: 5,
    purchaseForcedAcceptance: 6,
    purchaseWithCashback: 7,
    purchasePhoneAuthorized: 8,
    purchasePhoneOrdered: 9,
    purchaseMailOrdered: 10,
    giro: 11,
    combined: 12,
    authorizeCredit: 13,
    authorizeDeposit: 14,
    reservation: 15,
    adjustReservation: 16,
    cancelReservation: 17,
    purchaseReservation: 18,
    purchaseReservationPhoneAuthorized: 19
};
timapi.constants.UpdateStatus = {
    upToDate: 0,
    runningNoReboot: 1,
    runningReboot: 2
};
timapi.protocol.constants.AdminFunctions = {};
timapi.protocol.constants.AdminFunctions.timApi2Protocol = function (value) {
    var flags = 0;
    for (var each of value) {
        if (!this._timApi2Protocol.has(each)) {
            throw new Error("Invalid argument '" + value + "' (AdminFunctions)");
        }
        flags |= this._timApi2Protocol.get(each);
    }
    return flags;
};
timapi.protocol.constants.AdminFunctions.protocol2TimApi = function (value) {
    var set = new Set();
    for (var [k, v] of this._protocol2TimApi.entries()) {
        if ((value & k) != 0) {
            set.add(v);
        }
    }
    return set;
};
timapi.protocol.constants.AdminFunctions._timApi2Protocol =
    new Map([[timapi.constants.AdminFunctions.login, 0x1],
        [timapi.constants.AdminFunctions.logout, 0x2],
        [timapi.constants.AdminFunctions.reconfig, 0x4],
        [timapi.constants.AdminFunctions.reboot, 0x8],
        [timapi.constants.AdminFunctions.softwareUpdate, 0x10],
        [timapi.constants.AdminFunctions.activate, 0x20],
        [timapi.constants.AdminFunctions.deactivate, 0x40],
        [timapi.constants.AdminFunctions.counterRequest, 0x80],
        [timapi.constants.AdminFunctions.reconciliation, 0x100],
        [timapi.constants.AdminFunctions.balance, 0x200],
        [timapi.constants.AdminFunctions.openDialogMode, 0x400],
        [timapi.constants.AdminFunctions.closeDialogMode, 0x800],
        [timapi.constants.AdminFunctions.transmitLog, 0x1000],
        [timapi.constants.AdminFunctions.startReaderCleaning, 0x2000],
        [timapi.constants.AdminFunctions.dccRates, 0x4000],
        [timapi.constants.AdminFunctions.changeSettings, 0x8000],
        [timapi.constants.AdminFunctions.receiptRequest, 0x10000],
        [timapi.constants.AdminFunctions.closeReader, 0x20000],
        [timapi.constants.AdminFunctions.openReader, 0x40000],
        [timapi.constants.AdminFunctions.ejectCard, 0x80000],
        [timapi.constants.AdminFunctions.openMaintenanceWindow, 0x100000],
        [timapi.constants.AdminFunctions.closeMaintenanceWindow, 0x200000],
        [timapi.constants.AdminFunctions.activateServiceMenu, 0x400000]]);
timapi.protocol.constants.AdminFunctions._protocol2TimApi =
    new Map([[0x1, timapi.constants.AdminFunctions.login],
        [0x2, timapi.constants.AdminFunctions.logout],
        [0x4, timapi.constants.AdminFunctions.reconfig],
        [0x8, timapi.constants.AdminFunctions.reboot],
        [0x10, timapi.constants.AdminFunctions.softwareUpdate],
        [0x20, timapi.constants.AdminFunctions.activate],
        [0x40, timapi.constants.AdminFunctions.deactivate],
        [0x80, timapi.constants.AdminFunctions.counterRequest],
        [0x100, timapi.constants.AdminFunctions.reconciliation],
        [0x200, timapi.constants.AdminFunctions.balance],
        [0x400, timapi.constants.AdminFunctions.openDialogMode],
        [0x800, timapi.constants.AdminFunctions.closeDialogMode],
        [0x1000, timapi.constants.AdminFunctions.transmitLog],
        [0x2000, timapi.constants.AdminFunctions.startReaderCleaning],
        [0x4000, timapi.constants.AdminFunctions.dccRates],
        [0x8000, timapi.constants.AdminFunctions.changeSettings],
        [0x10000, timapi.constants.AdminFunctions.receiptRequest],
        [0x20000, timapi.constants.AdminFunctions.closeReader],
        [0x40000, timapi.constants.AdminFunctions.openReader],
        [0x80000, timapi.constants.AdminFunctions.ejectCard],
        [0x100000, timapi.constants.AdminFunctions.openMaintenanceWindow],
        [0x200000, timapi.constants.AdminFunctions.closeMaintenanceWindow],
        [0x400000, timapi.constants.AdminFunctions.activateServiceMenu]]);
timapi.protocol.constants.BrandBarBrand = {};
timapi.protocol.constants.BrandBarBrand.timApi2Protocol = function (value) {
    if (!this._timApi2Protocol.has(value)) {
        throw new Error("Invalid argument '" + value + "' (BrandBarBrand)");
    }
    return this._timApi2Protocol.get(value);
};
timapi.protocol.constants.BrandBarBrand.protocol2TimApi = function (value) {
    if (!this._protocol2TimApi.has(value)) {
        throw new Error("Invalid argument '" + value + "' (BrandBarBrand)");
    }
    return this._protocol2TimApi.get(value);
};
timapi.protocol.constants.BrandBarBrand.protocol2TimApiIfValid = function (value) {
    return this._protocol2TimApi.get(value);
};
timapi.protocol.constants.BrandBarBrand._timApi2Protocol =
    new Map([[timapi.constants.BrandBarBrand.alipay, "Alipay"],
        [timapi.constants.BrandBarBrand.amex, "Amex"],
        [timapi.constants.BrandBarBrand.bonuscard, "Bonuscard"],
        [timapi.constants.BrandBarBrand.cash, "Cash"],
        [timapi.constants.BrandBarBrand.conforama, "Conforama"],
        [timapi.constants.BrandBarBrand.coopMobile, "CoopMobile"],
        [timapi.constants.BrandBarBrand.cup, "CUP"],
        [timapi.constants.BrandBarBrand.diners, "Diners"],
        [timapi.constants.BrandBarBrand.dinerClub, "DinerClub"],
        [timapi.constants.BrandBarBrand.jcb, "Jcb"],
        [timapi.constants.BrandBarBrand.lebara, "Lebara"],
        [timapi.constants.BrandBarBrand.lycaMobile, "LycaMobile"],
        [timapi.constants.BrandBarBrand.maestro, "Maestro"],
        [timapi.constants.BrandBarBrand.masterCard, "MasterCard"],
        [timapi.constants.BrandBarBrand.mbudgetMc, "MBudgetMc"],
        [timapi.constants.BrandBarBrand.mcard, "MCard"],
        [timapi.constants.BrandBarBrand.mediaMarkt, "MediaMarkt"],
        [timapi.constants.BrandBarBrand.myOne, "MyOne"],
        [timapi.constants.BrandBarBrand.salt, "Salt."],
        [timapi.constants.BrandBarBrand.pharmacard, "Pharmacard"],
        [timapi.constants.BrandBarBrand.phonecard, "Phonecard"],
        [timapi.constants.BrandBarBrand.postCard, "PostCard"],
        [timapi.constants.BrandBarBrand.powerCard, "PowerCard"],
        [timapi.constants.BrandBarBrand.reka, "Reka"],
        [timapi.constants.BrandBarBrand.sunrise, "Sunrise"],
        [timapi.constants.BrandBarBrand.supercardPlus, "SupercardPlus"],
        [timapi.constants.BrandBarBrand.swisscom, "Swisscom"],
        [timapi.constants.BrandBarBrand.visa, "Visa"],
        [timapi.constants.BrandBarBrand.visaElectron, "VisaElectron"],
        [timapi.constants.BrandBarBrand.vpay, "VPay"],
        [timapi.constants.BrandBarBrand.wirCard, "WirCard"],
        [timapi.constants.BrandBarBrand.yallo, "Yallo"]]);
timapi.protocol.constants.BrandBarBrand._protocol2TimApi =
    new Map([["Alipay", timapi.constants.BrandBarBrand.alipay],
        ["Amex", timapi.constants.BrandBarBrand.amex],
        ["Bonuscard", timapi.constants.BrandBarBrand.bonuscard],
        ["Cash", timapi.constants.BrandBarBrand.cash],
        ["Conforama", timapi.constants.BrandBarBrand.conforama],
        ["CoopMobile", timapi.constants.BrandBarBrand.coopMobile],
        ["CUP", timapi.constants.BrandBarBrand.cup],
        ["Diners", timapi.constants.BrandBarBrand.diners],
        ["DinerClub", timapi.constants.BrandBarBrand.dinerClub],
        ["Jcb", timapi.constants.BrandBarBrand.jcb],
        ["Lebara", timapi.constants.BrandBarBrand.lebara],
        ["LycaMobile", timapi.constants.BrandBarBrand.lycaMobile],
        ["Maestro", timapi.constants.BrandBarBrand.maestro],
        ["MasterCard", timapi.constants.BrandBarBrand.masterCard],
        ["MBudgetMc", timapi.constants.BrandBarBrand.mbudgetMc],
        ["MCard", timapi.constants.BrandBarBrand.mcard],
        ["MediaMarkt", timapi.constants.BrandBarBrand.mediaMarkt],
        ["MyOne", timapi.constants.BrandBarBrand.myOne],
        ["Salt.", timapi.constants.BrandBarBrand.salt],
        ["Pharmacard", timapi.constants.BrandBarBrand.pharmacard],
        ["Phonecard", timapi.constants.BrandBarBrand.phonecard],
        ["PostCard", timapi.constants.BrandBarBrand.postCard],
        ["PowerCard", timapi.constants.BrandBarBrand.powerCard],
        ["Reka", timapi.constants.BrandBarBrand.reka],
        ["Sunrise", timapi.constants.BrandBarBrand.sunrise],
        ["SupercardPlus", timapi.constants.BrandBarBrand.supercardPlus],
        ["Swisscom", timapi.constants.BrandBarBrand.swisscom],
        ["Visa", timapi.constants.BrandBarBrand.visa],
        ["VisaElectron", timapi.constants.BrandBarBrand.visaElectron],
        ["VPay", timapi.constants.BrandBarBrand.vpay],
        ["WirCard", timapi.constants.BrandBarBrand.wirCard],
        ["Yallo", timapi.constants.BrandBarBrand.yallo]]);
timapi.protocol.constants.BrandMode = {};
timapi.protocol.constants.BrandMode.timApi2Protocol = function (value) {
    if (!this._timApi2Protocol.has(value)) {
        throw new Error("Invalid argument '" + value + "' (BrandMode)");
    }
    return this._timApi2Protocol.get(value);
};
timapi.protocol.constants.BrandMode.protocol2TimApi = function (value) {
    if (!this._protocol2TimApi.has(value)) {
        throw new Error("Invalid argument '" + value + "' (BrandMode)");
    }
    return this._protocol2TimApi.get(value);
};
timapi.protocol.constants.BrandMode.protocol2TimApiIfValid = function (value) {
    return this._protocol2TimApi.get(value);
};
timapi.protocol.constants.BrandMode._timApi2Protocol =
    new Map([[timapi.constants.BrandMode.all, "All"],
        [timapi.constants.BrandMode.selected, "Selected"],
        [timapi.constants.BrandMode.off, "Off"]]);
timapi.protocol.constants.BrandMode._protocol2TimApi =
    new Map([["All", timapi.constants.BrandMode.all],
        ["Selected", timapi.constants.BrandMode.selected],
        ["Off", timapi.constants.BrandMode.off]]);
timapi.protocol.constants.CardReaderStatus = {};
timapi.protocol.constants.CardReaderStatus.timApi2Protocol = function (value) {
    if (!this._timApi2Protocol.has(value)) {
        throw new Error("Invalid argument '" + value + "' (CardReaderStatus)");
    }
    return this._timApi2Protocol.get(value);
};
timapi.protocol.constants.CardReaderStatus.protocol2TimApi = function (value) {
    if (!this._protocol2TimApi.has(value)) {
        throw new Error("Invalid argument '" + value + "' (CardReaderStatus)");
    }
    return this._protocol2TimApi.get(value);
};
timapi.protocol.constants.CardReaderStatus.protocol2TimApiIfValid = function (value) {
    return this._protocol2TimApi.get(value);
};
timapi.protocol.constants.CardReaderStatus._timApi2Protocol =
    new Map([[timapi.constants.CardReaderStatus.cardReaderClosed, "CardReaderClosed"],
        [timapi.constants.CardReaderStatus.cardManuallyEntered, "CardManuallyEntered"],
        [timapi.constants.CardReaderStatus.cardSwiped, "CardSwiped"],
        [timapi.constants.CardReaderStatus.cardNotRemoved, "CardNotRemoved"],
        [timapi.constants.CardReaderStatus.cardPresented, "CardPresented"],
        [timapi.constants.CardReaderStatus.cardReaderEmpty, "CardReaderEmpty"],
        [timapi.constants.CardReaderStatus.cardInserted, "CardInserted"],
        [timapi.constants.CardReaderStatus.cardEjected, "CardEjected"]]);
timapi.protocol.constants.CardReaderStatus._protocol2TimApi =
    new Map([["CardReaderClosed", timapi.constants.CardReaderStatus.cardReaderClosed],
        ["CardManuallyEntered", timapi.constants.CardReaderStatus.cardManuallyEntered],
        ["CardSwiped", timapi.constants.CardReaderStatus.cardSwiped],
        ["CardNotRemoved", timapi.constants.CardReaderStatus.cardNotRemoved],
        ["CardPresented", timapi.constants.CardReaderStatus.cardPresented],
        ["CardReaderEmpty", timapi.constants.CardReaderStatus.cardReaderEmpty],
        ["CardInserted", timapi.constants.CardReaderStatus.cardInserted],
        ["CardEjected", timapi.constants.CardReaderStatus.cardEjected]]);
timapi.protocol.constants.ConnectionStatus = {};
timapi.protocol.constants.ConnectionStatus.timApi2Protocol = function (value) {
    if (!this._timApi2Protocol.has(value)) {
        throw new Error("Invalid argument '" + value + "' (ConnectionStatus)");
    }
    return this._timApi2Protocol.get(value);
};
timapi.protocol.constants.ConnectionStatus.protocol2TimApi = function (value) {
    if (!this._protocol2TimApi.has(value)) {
        throw new Error("Invalid argument '" + value + "' (ConnectionStatus)");
    }
    return this._protocol2TimApi.get(value);
};
timapi.protocol.constants.ConnectionStatus.protocol2TimApiIfValid = function (value) {
    return this._protocol2TimApi.get(value);
};
timapi.protocol.constants.ConnectionStatus._timApi2Protocol =
    new Map([[timapi.constants.ConnectionStatus.disconnected, "Disconnected"],
        [timapi.constants.ConnectionStatus.loggedOut, "LoggedOut"],
        [timapi.constants.ConnectionStatus.loggedIn, "LoggedIn"]]);
timapi.protocol.constants.ConnectionStatus._protocol2TimApi =
    new Map([["Disconnected", timapi.constants.ConnectionStatus.disconnected],
        ["LoggedOut", timapi.constants.ConnectionStatus.loggedOut],
        ["LoggedIn", timapi.constants.ConnectionStatus.loggedIn]]);
timapi.protocol.constants.CounterType = {};
timapi.protocol.constants.CounterType.timApi2Protocol = function (value) {
    if (!this._timApi2Protocol.has(value)) {
        throw new Error("Invalid argument '" + value + "' (CounterType)");
    }
    return this._timApi2Protocol.get(value);
};
timapi.protocol.constants.CounterType.protocol2TimApi = function (value) {
    if (!this._protocol2TimApi.has(value)) {
        throw new Error("Invalid argument '" + value + "' (CounterType)");
    }
    return this._protocol2TimApi.get(value);
};
timapi.protocol.constants.CounterType.protocol2TimApiIfValid = function (value) {
    return this._protocol2TimApi.get(value);
};
timapi.protocol.constants.CounterType._timApi2Protocol =
    new Map([[timapi.constants.CounterType.shift, "Shift"],
        [timapi.constants.CounterType.balance, "Balance"]]);
timapi.protocol.constants.CounterType._protocol2TimApi =
    new Map([["Shift", timapi.constants.CounterType.shift],
        ["Balance", timapi.constants.CounterType.balance]]);
timapi.protocol.constants.CurrencyType = {};
timapi.protocol.constants.CurrencyType.timApi2Protocol = function (value) {
    if (!this._timApi2Protocol.has(value)) {
        throw new Error("Invalid argument '" + value + "' (CurrencyType)");
    }
    return this._timApi2Protocol.get(value);
};
timapi.protocol.constants.CurrencyType.protocol2TimApi = function (value) {
    if (!this._protocol2TimApi.has(value)) {
        throw new Error("Invalid argument '" + value + "' (CurrencyType)");
    }
    return this._protocol2TimApi.get(value);
};
timapi.protocol.constants.CurrencyType.protocol2TimApiIfValid = function (value) {
    return this._protocol2TimApi.get(value);
};
timapi.protocol.constants.CurrencyType._timApi2Protocol =
    new Map([[timapi.constants.CurrencyType.local, "Local"],
        [timapi.constants.CurrencyType.foreign, "Foreign"],
        [timapi.constants.CurrencyType.dcc, "Dcc"]]);
timapi.protocol.constants.CurrencyType._protocol2TimApi =
    new Map([["Local", timapi.constants.CurrencyType.local],
        ["Foreign", timapi.constants.CurrencyType.foreign],
        ["Dcc", timapi.constants.CurrencyType.dcc]]);
timapi.protocol.constants.Cvm = {};
timapi.protocol.constants.Cvm.timApi2Protocol = function (value) {
    if (!this._timApi2Protocol.has(value)) {
        throw new Error("Invalid argument '" + value + "' (Cvm)");
    }
    return this._timApi2Protocol.get(value);
};
timapi.protocol.constants.Cvm.protocol2TimApi = function (value) {
    if (!this._protocol2TimApi.has(value)) {
        throw new Error("Invalid argument '" + value + "' (Cvm)");
    }
    return this._protocol2TimApi.get(value);
};
timapi.protocol.constants.Cvm.protocol2TimApiIfValid = function (value) {
    return this._protocol2TimApi.get(value);
};
timapi.protocol.constants.Cvm._timApi2Protocol =
    new Map([[timapi.constants.Cvm.pin, "Pin"],
        [timapi.constants.Cvm.pinSignature, "PinSignature"],
        [timapi.constants.Cvm.signature, "Signature"],
        [timapi.constants.Cvm.onDevice, "OnDevice"],
        [timapi.constants.Cvm.noCvm, "NoCvm"]]);
timapi.protocol.constants.Cvm._protocol2TimApi =
    new Map([["Pin", timapi.constants.Cvm.pin],
        ["PinSignature", timapi.constants.Cvm.pinSignature],
        ["Signature", timapi.constants.Cvm.signature],
        ["OnDevice", timapi.constants.Cvm.onDevice],
        ["NoCvm", timapi.constants.Cvm.noCvm]]);
timapi.protocol.constants.DialogFunctions = {};
timapi.protocol.constants.DialogFunctions.timApi2Protocol = function (value) {
    var flags = 0;
    for (var each of value) {
        if (!this._timApi2Protocol.has(each)) {
            throw new Error("Invalid argument '" + value + "' (DialogFunctions)");
        }
        flags |= this._timApi2Protocol.get(each);
    }
    return flags;
};
timapi.protocol.constants.DialogFunctions.protocol2TimApi = function (value) {
    var set = new Set();
    for (var [k, v] of this._protocol2TimApi.entries()) {
        if ((value & k) != 0) {
            set.add(v);
        }
    }
    return set;
};
timapi.protocol.constants.DialogFunctions._timApi2Protocol =
    new Map([[timapi.constants.DialogFunctions.showSignatureCapture, 0x1],
        [timapi.constants.DialogFunctions.showDialog, 0x2],
        [timapi.constants.DialogFunctions.sendCardCommand, 0x4]]);
timapi.protocol.constants.DialogFunctions._protocol2TimApi =
    new Map([[0x1, timapi.constants.DialogFunctions.showSignatureCapture],
        [0x2, timapi.constants.DialogFunctions.showDialog],
        [0x4, timapi.constants.DialogFunctions.sendCardCommand]]);
timapi.protocol.constants.EcrInfoType = {};
timapi.protocol.constants.EcrInfoType.timApi2Protocol = function (value) {
    if (!this._timApi2Protocol.has(value)) {
        throw new Error("Invalid argument '" + value + "' (EcrInfoType)");
    }
    return this._timApi2Protocol.get(value);
};
timapi.protocol.constants.EcrInfoType.protocol2TimApi = function (value) {
    if (!this._protocol2TimApi.has(value)) {
        throw new Error("Invalid argument '" + value + "' (EcrInfoType)");
    }
    return this._protocol2TimApi.get(value);
};
timapi.protocol.constants.EcrInfoType.protocol2TimApiIfValid = function (value) {
    return this._protocol2TimApi.get(value);
};
timapi.protocol.constants.EcrInfoType._timApi2Protocol =
    new Map([[timapi.constants.EcrInfoType.os, "Os"],
        [timapi.constants.EcrInfoType.ecrApplication, "EcrApplication"],
        [timapi.constants.EcrInfoType.eftApi, "EftAPI"],
        [timapi.constants.EcrInfoType.eftModule, "EftModule"]]);
timapi.protocol.constants.EcrInfoType._protocol2TimApi =
    new Map([["Os", timapi.constants.EcrInfoType.os],
        ["EcrApplication", timapi.constants.EcrInfoType.ecrApplication],
        ["EftAPI", timapi.constants.EcrInfoType.eftApi],
        ["EftModule", timapi.constants.EcrInfoType.eftModule]]);
timapi.protocol.constants.FeatureType = {
    sixmlGuides: "sixml:Guides",
    sixmlProtocolLevel: "sixml:ProtocolLevel",
    sixmlStatusFunctions: "sixml:StatusFunctions",
    sixmlAdminFunctions: "sixml:AdminFunctions",
    sixmlFinancialTransactions: "sixml:FinancialTransactions",
    sixmlNonFinancialTransactions: "sixml:NonFinancialTransactions",
    sixmlRemoteFunctions: "sixml:RemoteFunctions",
    sixmlDialogFunctions: "sixml:DialogFunctions",
    sixmlAutoCommit: "sixml:AutoCommit",
    sixmlAutoShiftManagement: "sixml:AutoShiftManagement",
    sixmlAutoShutterManagement: "sixml:AutoShutterManagement",
    sixmlSleepTimer: "sixml:SleepTimer",
    sixmlSwUpdateInformation: "sixml:SwUpdateInformation",
    sixmlRequestRepetition: "sixml:RequestRepetition",
    sixmlAllowClosedCardInsertion: "sixml:AllowClosedCardInsert",
    paymentDcc: "pay:Dcc",
    paymentDeclinedReceipts: "pay:DeclinedReceipts",
    paymentPartialApproval: "pay:PartialApproval",
    paymentPartialCommit: "pay:PartialCommit",
    ep2Available: "pp:ep2:Available",
    ep2Dcc: "pp:ep2:Dcc",
    ep2DeclinedReceipts: "pp:ep2:DeclinedReceipts",
    ep2MultiAccountSelection: "pp:ep2:MultiAccountSelection",
    ep2MultiContractSelection: "pp:ep2:MultiContractSelection",
    hardwarePrinterInstalled: "hw:Printer:Installed",
    hardwareDisplayCardholderInstalled: "hw:Display:Cardholder:Installed",
    hardwareDisplayMerchantInstalled: "hw:Display:Merchant:Installed",
    hardwareSettingDisplayBrightness: "hw:Setting:Display:Brightness",
    hardwareSettingDisplayContrast: "hw:Setting:Display:Contrast",
    hardwareSettingTonesAlert: "hw:Setting:Tones:Alert",
    hardwareSettingTonesKeypad: "hw:Setting:Tones:Keypad"
};
timapi.protocol.constants.FinancialTransactions = {};
timapi.protocol.constants.FinancialTransactions.timApi2Protocol = function (value) {
    var flags = 0;
    for (var each of value) {
        if (!this._timApi2Protocol.has(each)) {
            throw new Error("Invalid argument '" + value + "' (FinancialTransactions)");
        }
        flags |= this._timApi2Protocol.get(each);
    }
    return flags;
};
timapi.protocol.constants.FinancialTransactions.protocol2TimApi = function (value) {
    var set = new Set();
    for (var [k, v] of this._protocol2TimApi.entries()) {
        if ((value & k) != 0) {
            set.add(v);
        }
    }
    return set;
};
timapi.protocol.constants.FinancialTransactions._timApi2Protocol =
    new Map([[timapi.constants.FinancialTransactions.purchase, 0x1],
        [timapi.constants.FinancialTransactions.credit, 0x2],
        [timapi.constants.FinancialTransactions.reversal, 0x4],
        [timapi.constants.FinancialTransactions.preAuthorization, 0x8],
        [timapi.constants.FinancialTransactions.cashAdvance, 0x10],
        [timapi.constants.FinancialTransactions.commit, 0x20],
        [timapi.constants.FinancialTransactions.rollback, 0x40],
        [timapi.constants.FinancialTransactions.giro, 0x80],
        [timapi.constants.FinancialTransactions.combined, 0x100],
        [timapi.constants.FinancialTransactions.authorizeCredit, 0x200],
        [timapi.constants.FinancialTransactions.authorizeDeposit, 0x400],
        [timapi.constants.FinancialTransactions.finalizePurchase, 0x800],
        [timapi.constants.FinancialTransactions.proceed, 0x1000],
        [timapi.constants.FinancialTransactions.purchaseForcedAcceptance, 0x2000],
        [timapi.constants.FinancialTransactions.purchaseWithCashback, 0x4000],
        [timapi.constants.FinancialTransactions.purchasePhoneAuthorized, 0x8000],
        [timapi.constants.FinancialTransactions.loadVoucher, 0x10000],
        [timapi.constants.FinancialTransactions.collectPoints, 0x20000],
        [timapi.constants.FinancialTransactions.purchaseReservation, 0x40000],
        [timapi.constants.FinancialTransactions.purchaseReservationPhoneAuthorized, 0x80000],
        [timapi.constants.FinancialTransactions.amtAdjustment, 0x100000],
        [timapi.constants.FinancialTransactions.purchasePhoneOrdered, 0x200000],
        [timapi.constants.FinancialTransactions.purchaseMailOrdered, 0x400000]]);
timapi.protocol.constants.FinancialTransactions._protocol2TimApi =
    new Map([[0x1, timapi.constants.FinancialTransactions.purchase],
        [0x2, timapi.constants.FinancialTransactions.credit],
        [0x4, timapi.constants.FinancialTransactions.reversal],
        [0x8, timapi.constants.FinancialTransactions.preAuthorization],
        [0x10, timapi.constants.FinancialTransactions.cashAdvance],
        [0x20, timapi.constants.FinancialTransactions.commit],
        [0x40, timapi.constants.FinancialTransactions.rollback],
        [0x80, timapi.constants.FinancialTransactions.giro],
        [0x100, timapi.constants.FinancialTransactions.combined],
        [0x200, timapi.constants.FinancialTransactions.authorizeCredit],
        [0x400, timapi.constants.FinancialTransactions.authorizeDeposit],
        [0x800, timapi.constants.FinancialTransactions.finalizePurchase],
        [0x1000, timapi.constants.FinancialTransactions.proceed],
        [0x2000, timapi.constants.FinancialTransactions.purchaseForcedAcceptance],
        [0x4000, timapi.constants.FinancialTransactions.purchaseWithCashback],
        [0x8000, timapi.constants.FinancialTransactions.purchasePhoneAuthorized],
        [0x10000, timapi.constants.FinancialTransactions.loadVoucher],
        [0x20000, timapi.constants.FinancialTransactions.collectPoints],
        [0x40000, timapi.constants.FinancialTransactions.purchaseReservation],
        [0x80000, timapi.constants.FinancialTransactions.purchaseReservationPhoneAuthorized],
        [0x100000, timapi.constants.FinancialTransactions.amtAdjustment],
        [0x200000, timapi.constants.FinancialTransactions.purchasePhoneOrdered],
        [0x400000, timapi.constants.FinancialTransactions.purchaseMailOrdered]]);
timapi.protocol.constants.Function = {
    terminalStatus: "TerminalStatus",
    featureRequest: "FeatureRequest",
    systemInformation: "SystemInformation",
    applicationInformation: "ApplicationInformation",
    hardwareInformation: "HardwareInformation",
    keepAlive: "KeepAlive",
    licenseChanged: "LicenseChanged",
    login: "Login",
    logout: "Logout",
    reconfig: "Reconfig",
    reboot: "Reboot",
    softwareUpdate: "SoftwareUpdate",
    changeSettings: "ChangeSettings",
    activate: "Activate",
    deactivate: "Deactivate",
    counterRequest: "CounterRequest",
    reconciliation: "Reconciliation",
    balance: "Balance",
    dccRates: "DccRates",
    cancel: "Cancel",
    purchase: "Purchase",
    credit: "Credit",
    reversal: "Reversal",
    commit: "Commit",
    rollback: "Rollback",
    receiptRequest: "ReceiptRequest",
    preAuthorization: "PreAuthorization",
    finalizePurchase: "FinalizePurchase",
    initTransaction: "InitTransaction",
    closeReader: "CloseReader",
    openReader: "OpenReader",
    ejectCard: "EjectCard",
    openMaintenanceWindow: "OpenMaintenanceWindow",
    holdCommit: "HoldCommit",
    closeMaintenanceWindow: "CloseMaintenanceWindow",
    activateServiceMenu: "ActivateServiceMenu",
    amtAdjustment: "AmtAdjustment",
    balanceInquiry: "BalanceInquiry",
    cashAdvance: "CashAdvance",
    purchaseForcedAcceptance: "PurchaseForcedAcceptance",
    purchaseWithCashback: "PurchaseWithCashback",
    purchasePhoneAuthorized: "PurchasePhoneAuthorized",
    purchasePhoneOrdered: "PurchasePhoneOrdered",
    purchaseMailOrdered: "PurchaseMailOrdered",
    giro: "Giro",
    combined: "Combined",
    authorizeCredit: "AuthorizeCredit",
    authorizeDeposit: "AuthorizeDeposit",
    openDialogMode: "OpenDialogMode",
    closeDialogMode: "CloseDialogMode",
    showSignatureCapture: "ShowSignatureCapture",
    showDialog: "ShowDialog",
    sendCardCommand: "SendCardCommand",
    transmitLog: "TransmitLog",
    screenshot: "Screenshot",
    reservation: "Reservation",
    adjustReservation: "AdjustReservation",
    cancelReservation: "CancelReservation",
    purchaseReservation: "PurchaseReservation",
    purchaseReservationPhoneAuthorized: "PurchaseReservationPhoneAuthorized",
    loadVoucher: "LoadVoucher",
    collectPoints: "CollectPoints",
    loyaltyData: "LoyaltyData",
    startCheckout: "StartCheckout",
    finishCheckout: "FinishCheckout",
    provideLoyaltyBasket: "ProvideLoyaltyBasket",
    loyaltyInfo: "LoyaltyInfo"
};
timapi.protocol.constants.FunctionGroup = {
    status: "Status",
    admin: "Admin",
    finTransaction: "FinTransaction",
    nonFinTransaction: "NonFinTransaction",
    dialog: "Dialog",
    remote: "Remote"
};
timapi.protocol.constants.Guides = {};
timapi.protocol.constants.Guides.timApi2Protocol = function (value) {
    var flags = 0;
    for (var each of value) {
        if (!this._timApi2Protocol.has(each)) {
            throw new Error("Invalid argument '" + value + "' (Guides)");
        }
        flags |= this._timApi2Protocol.get(each);
    }
    return flags;
};
timapi.protocol.constants.Guides.protocol2TimApi = function (value) {
    var set = new Set();
    for (var [k, v] of this._protocol2TimApi.entries()) {
        if ((value & k) != 0) {
            set.add(v);
        }
    }
    return set;
};
timapi.protocol.constants.Guides._timApi2Protocol =
    new Map([[timapi.constants.Guides.retail, 0x1],
        [timapi.constants.Guides.unattended, 0x2],
        [timapi.constants.Guides.advancedRetail, 0x4],
        [timapi.constants.Guides.banking, 0x8],
        [timapi.constants.Guides.petrol, 0x10],
        [timapi.constants.Guides.dialog, 0x20],
        [timapi.constants.Guides.remote, 0x40],
        [timapi.constants.Guides.gastro, 0x80],
        [timapi.constants.Guides.hospitality, 0x100],
        [timapi.constants.Guides.valueAddedServices, 0x200],
        [timapi.constants.Guides.austrianUseCases, 0x400]]);
timapi.protocol.constants.Guides._protocol2TimApi =
    new Map([[0x1, timapi.constants.Guides.retail],
        [0x2, timapi.constants.Guides.unattended],
        [0x4, timapi.constants.Guides.advancedRetail],
        [0x8, timapi.constants.Guides.banking],
        [0x10, timapi.constants.Guides.petrol],
        [0x20, timapi.constants.Guides.dialog],
        [0x40, timapi.constants.Guides.remote],
        [0x80, timapi.constants.Guides.gastro],
        [0x100, timapi.constants.Guides.hospitality],
        [0x200, timapi.constants.Guides.valueAddedServices],
        [0x400, timapi.constants.Guides.austrianUseCases]]);
timapi.protocol.constants.HardwareType = {};
timapi.protocol.constants.HardwareType.timApi2Protocol = function (value) {
    if (!this._timApi2Protocol.has(value)) {
        throw new Error("Invalid argument '" + value + "' (HardwareType)");
    }
    return this._timApi2Protocol.get(value);
};
timapi.protocol.constants.HardwareType.protocol2TimApi = function (value) {
    if (!this._protocol2TimApi.has(value)) {
        throw new Error("Invalid argument '" + value + "' (HardwareType)");
    }
    return this._protocol2TimApi.get(value);
};
timapi.protocol.constants.HardwareType.protocol2TimApiIfValid = function (value) {
    return this._protocol2TimApi.get(value);
};
timapi.protocol.constants.HardwareType._timApi2Protocol =
    new Map([[timapi.constants.HardwareType.terminal, "Terminal"],
        [timapi.constants.HardwareType.eftApplication, "EftApplication"],
        [timapi.constants.HardwareType.pinPad, "PinPad"],
        [timapi.constants.HardwareType.contactReader, "ContactReader"],
        [timapi.constants.HardwareType.contactlessReader, "ContactlessReader"],
        [timapi.constants.HardwareType.magStripeReader, "MagStripeReader"]]);
timapi.protocol.constants.HardwareType._protocol2TimApi =
    new Map([["Terminal", timapi.constants.HardwareType.terminal],
        ["EftApplication", timapi.constants.HardwareType.eftApplication],
        ["PinPad", timapi.constants.HardwareType.pinPad],
        ["ContactReader", timapi.constants.HardwareType.contactReader],
        ["ContactlessReader", timapi.constants.HardwareType.contactlessReader],
        ["MagStripeReader", timapi.constants.HardwareType.magStripeReader]]);
timapi.protocol.constants.ImageFileFormat = {};
timapi.protocol.constants.ImageFileFormat.timApi2Protocol = function (value) {
    if (!this._timApi2Protocol.has(value)) {
        throw new Error("Invalid argument '" + value + "' (ImageFileFormat)");
    }
    return this._timApi2Protocol.get(value);
};
timapi.protocol.constants.ImageFileFormat.protocol2TimApi = function (value) {
    if (!this._protocol2TimApi.has(value)) {
        throw new Error("Invalid argument '" + value + "' (ImageFileFormat)");
    }
    return this._protocol2TimApi.get(value);
};
timapi.protocol.constants.ImageFileFormat.protocol2TimApiIfValid = function (value) {
    return this._protocol2TimApi.get(value);
};
timapi.protocol.constants.ImageFileFormat._timApi2Protocol =
    new Map([[timapi.constants.ImageFileFormat.jpeg, "Jpeg"],
        [timapi.constants.ImageFileFormat.png, "Png"]]);
timapi.protocol.constants.ImageFileFormat._protocol2TimApi =
    new Map([["Jpeg", timapi.constants.ImageFileFormat.jpeg],
        ["Png", timapi.constants.ImageFileFormat.png]]);
timapi.protocol.constants.KernelType = {};
timapi.protocol.constants.KernelType.timApi2Protocol = function (value) {
    if (!this._timApi2Protocol.has(value)) {
        throw new Error("Invalid argument '" + value + "' (KernelType)");
    }
    return this._timApi2Protocol.get(value);
};
timapi.protocol.constants.KernelType.protocol2TimApi = function (value) {
    if (!this._protocol2TimApi.has(value)) {
        throw new Error("Invalid argument '" + value + "' (KernelType)");
    }
    return this._protocol2TimApi.get(value);
};
timapi.protocol.constants.KernelType.protocol2TimApiIfValid = function (value) {
    return this._protocol2TimApi.get(value);
};
timapi.protocol.constants.KernelType._timApi2Protocol =
    new Map([[timapi.constants.KernelType.emvContact, -1],
        [timapi.constants.KernelType.entryPoint, 0],
        [timapi.constants.KernelType.kernel1, 1],
        [timapi.constants.KernelType.kernel2, 2],
        [timapi.constants.KernelType.kernel3, 3],
        [timapi.constants.KernelType.kernel4, 4],
        [timapi.constants.KernelType.kernel5, 5],
        [timapi.constants.KernelType.kernel6, 6],
        [timapi.constants.KernelType.kernel7, 7]]);
timapi.protocol.constants.KernelType._protocol2TimApi =
    new Map([[-1, timapi.constants.KernelType.emvContact],
        [0, timapi.constants.KernelType.entryPoint],
        [1, timapi.constants.KernelType.kernel1],
        [2, timapi.constants.KernelType.kernel2],
        [3, timapi.constants.KernelType.kernel3],
        [4, timapi.constants.KernelType.kernel4],
        [5, timapi.constants.KernelType.kernel5],
        [6, timapi.constants.KernelType.kernel6],
        [7, timapi.constants.KernelType.kernel7]]);
timapi.protocol.constants.ManagementStatus = {};
timapi.protocol.constants.ManagementStatus.timApi2Protocol = function (value) {
    if (!this._timApi2Protocol.has(value)) {
        throw new Error("Invalid argument '" + value + "' (ManagementStatus)");
    }
    return this._timApi2Protocol.get(value);
};
timapi.protocol.constants.ManagementStatus.protocol2TimApi = function (value) {
    if (!this._protocol2TimApi.has(value)) {
        throw new Error("Invalid argument '" + value + "' (ManagementStatus)");
    }
    return this._protocol2TimApi.get(value);
};
timapi.protocol.constants.ManagementStatus.protocol2TimApiIfValid = function (value) {
    return this._protocol2TimApi.get(value);
};
timapi.protocol.constants.ManagementStatus._timApi2Protocol =
    new Map([[timapi.constants.ManagementStatus.closed, "Closed"],
        [timapi.constants.ManagementStatus.open, "Open"],
        [timapi.constants.ManagementStatus.dialog, "Dialog"]]);
timapi.protocol.constants.ManagementStatus._protocol2TimApi =
    new Map([["Closed", timapi.constants.ManagementStatus.closed],
        ["Open", timapi.constants.ManagementStatus.open],
        ["Dialog", timapi.constants.ManagementStatus.dialog]]);
timapi.protocol.constants.MerchantAction = {};
timapi.protocol.constants.MerchantAction.timApi2Protocol = function (value) {
    if (!this._timApi2Protocol.has(value)) {
        throw new Error("Invalid argument '" + value + "' (MerchantAction)");
    }
    return this._timApi2Protocol.get(value);
};
timapi.protocol.constants.MerchantAction.protocol2TimApi = function (value) {
    if (!this._protocol2TimApi.has(value)) {
        throw new Error("Invalid argument '" + value + "' (MerchantAction)");
    }
    return this._protocol2TimApi.get(value);
};
timapi.protocol.constants.MerchantAction.protocol2TimApiIfValid = function (value) {
    return this._protocol2TimApi.get(value);
};
timapi.protocol.constants.MerchantAction._timApi2Protocol =
    new Map([[timapi.constants.MerchantAction.signature, "Signature"],
        [timapi.constants.MerchantAction.none, "None"]]);
timapi.protocol.constants.MerchantAction._protocol2TimApi =
    new Map([["Signature", timapi.constants.MerchantAction.signature],
        ["None", timapi.constants.MerchantAction.none]]);
timapi.protocol.constants.MerchantOptionType = {};
timapi.protocol.constants.MerchantOptionType.timApi2Protocol = function (value) {
    if (!this._timApi2Protocol.has(value)) {
        throw new Error("Invalid argument '" + value + "' (MerchantOptionType)");
    }
    return this._timApi2Protocol.get(value);
};
timapi.protocol.constants.MerchantOptionType.protocol2TimApi = function (value) {
    if (!this._protocol2TimApi.has(value)) {
        throw new Error("Invalid argument '" + value + "' (MerchantOptionType)");
    }
    return this._protocol2TimApi.get(value);
};
timapi.protocol.constants.MerchantOptionType.protocol2TimApiIfValid = function (value) {
    return this._protocol2TimApi.get(value);
};
timapi.protocol.constants.MerchantOptionType._timApi2Protocol =
    new Map([[timapi.constants.MerchantOptionType.additionalMerchantData, "AdditionalMerchantData"],
        [timapi.constants.MerchantOptionType.multiAccountIndex, "MultiAccountIndex"],
        [timapi.constants.MerchantOptionType.multiContractIndex, "MultiContractIndex"],
        [timapi.constants.MerchantOptionType.merchantTid, "MerchantTid"],
        [timapi.constants.MerchantOptionType.clerkIdentifier, "ClerkIdentifier"],
        [timapi.constants.MerchantOptionType.fuelDispenserNumber, "FuelDispenserNumber"],
        [timapi.constants.MerchantOptionType.posdnumber, "POSDNumber"],
        [timapi.constants.MerchantOptionType.receiptNumber, "ReceiptNumber"],
        [timapi.constants.MerchantOptionType.shiftNumber, "ShiftNumber"]]);
timapi.protocol.constants.MerchantOptionType._protocol2TimApi =
    new Map([["AdditionalMerchantData", timapi.constants.MerchantOptionType.additionalMerchantData],
        ["MultiAccountIndex", timapi.constants.MerchantOptionType.multiAccountIndex],
        ["MultiContractIndex", timapi.constants.MerchantOptionType.multiContractIndex],
        ["MerchantTid", timapi.constants.MerchantOptionType.merchantTid],
        ["ClerkIdentifier", timapi.constants.MerchantOptionType.clerkIdentifier],
        ["FuelDispenserNumber", timapi.constants.MerchantOptionType.fuelDispenserNumber],
        ["POSDNumber", timapi.constants.MerchantOptionType.posdnumber],
        ["ReceiptNumber", timapi.constants.MerchantOptionType.receiptNumber],
        ["ShiftNumber", timapi.constants.MerchantOptionType.shiftNumber]]);
timapi.protocol.constants.NonFinancialTransactions = {};
timapi.protocol.constants.NonFinancialTransactions.timApi2Protocol = function (value) {
    var flags = 0;
    for (var each of value) {
        if (!this._timApi2Protocol.has(each)) {
            throw new Error("Invalid argument '" + value + "' (NonFinancialTransactions)");
        }
        flags |= this._timApi2Protocol.get(each);
    }
    return flags;
};
timapi.protocol.constants.NonFinancialTransactions.protocol2TimApi = function (value) {
    var set = new Set();
    for (var [k, v] of this._protocol2TimApi.entries()) {
        if ((value & k) != 0) {
            set.add(v);
        }
    }
    return set;
};
timapi.protocol.constants.NonFinancialTransactions._timApi2Protocol =
    new Map([[timapi.constants.NonFinancialTransactions.cancel, 0x1],
        [timapi.constants.NonFinancialTransactions.balanceInquiry, 0x2],
        [timapi.constants.NonFinancialTransactions.clientIdentification, 0x4],
        [timapi.constants.NonFinancialTransactions.initTransaction, 0x8],
        [timapi.constants.NonFinancialTransactions.holdCommit, 0x10],
        [timapi.constants.NonFinancialTransactions.reservation, 0x20],
        [timapi.constants.NonFinancialTransactions.adjustReservation, 0x40],
        [timapi.constants.NonFinancialTransactions.cancelReservation, 0x80],
        [timapi.constants.NonFinancialTransactions.loyaltyData, 0x200],
        [timapi.constants.NonFinancialTransactions.startCheckout, 0x400],
        [timapi.constants.NonFinancialTransactions.finishCheckout, 0x800],
        [timapi.constants.NonFinancialTransactions.provideLoyaltyBasket, 0x1000]]);
timapi.protocol.constants.NonFinancialTransactions._protocol2TimApi =
    new Map([[0x1, timapi.constants.NonFinancialTransactions.cancel],
        [0x2, timapi.constants.NonFinancialTransactions.balanceInquiry],
        [0x4, timapi.constants.NonFinancialTransactions.clientIdentification],
        [0x8, timapi.constants.NonFinancialTransactions.initTransaction],
        [0x10, timapi.constants.NonFinancialTransactions.holdCommit],
        [0x20, timapi.constants.NonFinancialTransactions.reservation],
        [0x40, timapi.constants.NonFinancialTransactions.adjustReservation],
        [0x80, timapi.constants.NonFinancialTransactions.cancelReservation],
        [0x200, timapi.constants.NonFinancialTransactions.loyaltyData],
        [0x400, timapi.constants.NonFinancialTransactions.startCheckout],
        [0x800, timapi.constants.NonFinancialTransactions.finishCheckout],
        [0x1000, timapi.constants.NonFinancialTransactions.provideLoyaltyBasket]]);
timapi.protocol.constants.OptionType = {
    sixmlAutoCommit: "sixml:AutoCommit",
    sixmlProtocolLevel: "sixml:ProtocolLevel",
    sixmlCommitTimeout: "sixml:CommitTimeout",
    sixmlProceedTimeout: "sixml:ProceedTimeout",
    sixmlGuides: "sixml:Guides",
    sixmlCardInsertionTimeout: "sixml:CardInsertionTimeout",
    sixmlCardRemovalTimeout: "sixml:CardRemovalTimeout",
    sixmlAutoShiftManagement: "sixml:AutoShiftManagement",
    sixmlAutoShutterManagement: "sixml:AutoShutterManagement",
    sixmlPartialApproval: "sixml:PartialApproval",
    sixmlDcc: "sixml:Dcc",
    sixmlTip: "sixml:Tip",
    sixmlPartialCommit: "sixml:PartialCommit",
    sixmlProceedRequired: "sixml:ProceedRequired",
    sixmlAllowClosedCardInsert: "sixml:AllowClosedCardInsert",
    sixmlQrctimeout: "sixml:QRCTimeout",
    sixmlLateCheckinTimeout: "sixml:LateCheckinTimeout"
};
timapi.protocol.constants.PaymentProtocol = {};
timapi.protocol.constants.PaymentProtocol.timApi2Protocol = function (value) {
    if (!this._timApi2Protocol.has(value)) {
        throw new Error("Invalid argument '" + value + "' (PaymentProtocol)");
    }
    return this._timApi2Protocol.get(value);
};
timapi.protocol.constants.PaymentProtocol.protocol2TimApi = function (value) {
    if (!this._protocol2TimApi.has(value)) {
        throw new Error("Invalid argument '" + value + "' (PaymentProtocol)");
    }
    return this._protocol2TimApi.get(value);
};
timapi.protocol.constants.PaymentProtocol.protocol2TimApiIfValid = function (value) {
    return this._protocol2TimApi.get(value);
};
timapi.protocol.constants.PaymentProtocol._timApi2Protocol =
    new Map([[timapi.constants.PaymentProtocol.ep2, "ep2"],
        [timapi.constants.PaymentProtocol.ev, "ev"],
        [timapi.constants.PaymentProtocol.valueMaster, "vm"],
        [timapi.constants.PaymentProtocol.v3cxml, "3CXml"]]);
timapi.protocol.constants.PaymentProtocol._protocol2TimApi =
    new Map([["ep2", timapi.constants.PaymentProtocol.ep2],
        ["ev", timapi.constants.PaymentProtocol.ev],
        ["vm", timapi.constants.PaymentProtocol.valueMaster],
        ["3CXml", timapi.constants.PaymentProtocol.v3cxml]]);
timapi.protocol.constants.PosEntryMode = {};
timapi.protocol.constants.PosEntryMode.timApi2Protocol = function (value) {
    if (!this._timApi2Protocol.has(value)) {
        throw new Error("Invalid argument '" + value + "' (PosEntryMode)");
    }
    return this._timApi2Protocol.get(value);
};
timapi.protocol.constants.PosEntryMode.protocol2TimApi = function (value) {
    if (!this._protocol2TimApi.has(value)) {
        throw new Error("Invalid argument '" + value + "' (PosEntryMode)");
    }
    return this._protocol2TimApi.get(value);
};
timapi.protocol.constants.PosEntryMode.protocol2TimApiIfValid = function (value) {
    return this._protocol2TimApi.get(value);
};
timapi.protocol.constants.PosEntryMode._timApi2Protocol =
    new Map([[timapi.constants.PosEntryMode.unspecified, 0],
        [timapi.constants.PosEntryMode.manual, 1],
        [timapi.constants.PosEntryMode.magStripeIncomplete, 2],
        [timapi.constants.PosEntryMode.barCode, 3],
        [timapi.constants.PosEntryMode.ocr, 4],
        [timapi.constants.PosEntryMode.icc, 5],
        [timapi.constants.PosEntryMode.magStripe, 90],
        [timapi.constants.PosEntryMode.magStripeFallback, 91],
        [timapi.constants.PosEntryMode.magStripeFallbackAgain, 92],
        [timapi.constants.PosEntryMode.magStripeFallbackIccFail, 93],
        [timapi.constants.PosEntryMode.emergencyDataEntry, 94],
        [timapi.constants.PosEntryMode.ecommerce, 95],
        [timapi.constants.PosEntryMode.ctlessIcc, 97],
        [timapi.constants.PosEntryMode.ctlessMagStrige, 98]]);
timapi.protocol.constants.PosEntryMode._protocol2TimApi =
    new Map([[0, timapi.constants.PosEntryMode.unspecified],
        [1, timapi.constants.PosEntryMode.manual],
        [2, timapi.constants.PosEntryMode.magStripeIncomplete],
        [3, timapi.constants.PosEntryMode.barCode],
        [4, timapi.constants.PosEntryMode.ocr],
        [5, timapi.constants.PosEntryMode.icc],
        [90, timapi.constants.PosEntryMode.magStripe],
        [91, timapi.constants.PosEntryMode.magStripeFallback],
        [92, timapi.constants.PosEntryMode.magStripeFallbackAgain],
        [93, timapi.constants.PosEntryMode.magStripeFallbackIccFail],
        [94, timapi.constants.PosEntryMode.emergencyDataEntry],
        [95, timapi.constants.PosEntryMode.ecommerce],
        [97, timapi.constants.PosEntryMode.ctlessIcc],
        [98, timapi.constants.PosEntryMode.ctlessMagStrige]]);
timapi.protocol.constants.PrintFlag = {};
timapi.protocol.constants.PrintFlag.timApi2Protocol = function (value) {
    var flags = 0;
    for (var each of value) {
        if (!this._timApi2Protocol.has(each)) {
            throw new Error("Invalid argument '" + value + "' (PrintFlag)");
        }
        flags |= this._timApi2Protocol.get(each);
    }
    return flags;
};
timapi.protocol.constants.PrintFlag.protocol2TimApi = function (value) {
    var set = new Set();
    for (var [k, v] of this._protocol2TimApi.entries()) {
        if ((value & k) != 0) {
            set.add(v);
        }
    }
    return set;
};
timapi.protocol.constants.PrintFlag._timApi2Protocol =
    new Map([[timapi.constants.PrintFlag.suppressHeader, 0x1],
        [timapi.constants.PrintFlag.suppressSignature, 0x2],
        [timapi.constants.PrintFlag.suppressEcrInfo, 0x4],
        [timapi.constants.PrintFlag.suppressEftInfo, 0x8]]);
timapi.protocol.constants.PrintFlag._protocol2TimApi =
    new Map([[0x1, timapi.constants.PrintFlag.suppressHeader],
        [0x2, timapi.constants.PrintFlag.suppressSignature],
        [0x4, timapi.constants.PrintFlag.suppressEcrInfo],
        [0x8, timapi.constants.PrintFlag.suppressEftInfo]]);
timapi.protocol.constants.PrintFormat = {};
timapi.protocol.constants.PrintFormat.timApi2Protocol = function (value) {
    if (!this._timApi2Protocol.has(value)) {
        throw new Error("Invalid argument '" + value + "' (PrintFormat)");
    }
    return this._timApi2Protocol.get(value);
};
timapi.protocol.constants.PrintFormat.protocol2TimApi = function (value) {
    if (!this._protocol2TimApi.has(value)) {
        throw new Error("Invalid argument '" + value + "' (PrintFormat)");
    }
    return this._protocol2TimApi.get(value);
};
timapi.protocol.constants.PrintFormat.protocol2TimApiIfValid = function (value) {
    return this._protocol2TimApi.get(value);
};
timapi.protocol.constants.PrintFormat._timApi2Protocol =
    new Map([[timapi.constants.PrintFormat.noPrint, "NoPrint"],
        [timapi.constants.PrintFormat.normal, "Normal"],
        [timapi.constants.PrintFormat.onDevice, "OnDevice"],
        [timapi.constants.PrintFormat.fieldsOnly, "FieldsOnly"]]);
timapi.protocol.constants.PrintFormat._protocol2TimApi =
    new Map([["NoPrint", timapi.constants.PrintFormat.noPrint],
        ["Normal", timapi.constants.PrintFormat.normal],
        ["OnDevice", timapi.constants.PrintFormat.onDevice],
        ["FieldsOnly", timapi.constants.PrintFormat.fieldsOnly]]);
timapi.protocol.constants.ProcessingDisposition = {};
timapi.protocol.constants.ProcessingDisposition.timApi2Protocol = function (value) {
    if (!this._timApi2Protocol.has(value)) {
        throw new Error("Invalid argument '" + value + "' (ProcessingDisposition)");
    }
    return this._timApi2Protocol.get(value);
};
timapi.protocol.constants.ProcessingDisposition.protocol2TimApi = function (value) {
    if (!this._protocol2TimApi.has(value)) {
        throw new Error("Invalid argument '" + value + "' (ProcessingDisposition)");
    }
    return this._protocol2TimApi.get(value);
};
timapi.protocol.constants.ProcessingDisposition.protocol2TimApiIfValid = function (value) {
    return this._protocol2TimApi.get(value);
};
timapi.protocol.constants.ProcessingDisposition._timApi2Protocol =
    new Map([[timapi.constants.ProcessingDisposition.onEcr, "OnECR"],
        [timapi.constants.ProcessingDisposition.onEft, "OnEFT"]]);
timapi.protocol.constants.ProcessingDisposition._protocol2TimApi =
    new Map([["OnECR", timapi.constants.ProcessingDisposition.onEcr],
        ["OnEFT", timapi.constants.ProcessingDisposition.onEft]]);
timapi.protocol.constants.ProtocolLevel = {};
timapi.protocol.constants.ProtocolLevel.timApi2Protocol = function (value) {
    if (!this._timApi2Protocol.has(value)) {
        throw new Error("Invalid argument '" + value + "' (ProtocolLevel)");
    }
    return this._timApi2Protocol.get(value);
};
timapi.protocol.constants.ProtocolLevel.protocol2TimApi = function (value) {
    if (!this._protocol2TimApi.has(value)) {
        throw new Error("Invalid argument '" + value + "' (ProtocolLevel)");
    }
    return this._protocol2TimApi.get(value);
};
timapi.protocol.constants.ProtocolLevel.protocol2TimApiIfValid = function (value) {
    return this._protocol2TimApi.get(value);
};
timapi.protocol.constants.ProtocolLevel._timApi2Protocol =
    new Map([[timapi.constants.ProtocolLevel.sixml2_2, 3]]);
timapi.protocol.constants.ProtocolLevel._protocol2TimApi =
    new Map([[3, timapi.constants.ProtocolLevel.sixml2_2]]);
timapi.protocol.constants.ProtocolType = {};
timapi.protocol.constants.ProtocolType.timApi2Protocol = function (value) {
    if (!this._timApi2Protocol.has(value)) {
        throw new Error("Invalid argument '" + value + "' (ProtocolType)");
    }
    return this._timApi2Protocol.get(value);
};
timapi.protocol.constants.ProtocolType.protocol2TimApi = function (value) {
    if (!this._protocol2TimApi.has(value)) {
        throw new Error("Invalid argument '" + value + "' (ProtocolType)");
    }
    return this._protocol2TimApi.get(value);
};
timapi.protocol.constants.ProtocolType.protocol2TimApiIfValid = function (value) {
    return this._protocol2TimApi.get(value);
};
timapi.protocol.constants.ProtocolType._timApi2Protocol =
    new Map([[timapi.constants.ProtocolType.sixml, 1]]);
timapi.protocol.constants.ProtocolType._protocol2TimApi =
    new Map([[1, timapi.constants.ProtocolType.sixml]]);
timapi.protocol.constants.Reason = {};
timapi.protocol.constants.Reason.timApi2Protocol = function (value) {
    if (!this._timApi2Protocol.has(value)) {
        throw new Error("Invalid argument '" + value + "' (Reason)");
    }
    return this._timApi2Protocol.get(value);
};
timapi.protocol.constants.Reason.protocol2TimApi = function (value) {
    if (!this._protocol2TimApi.has(value)) {
        throw new Error("Invalid argument '" + value + "' (Reason)");
    }
    return this._protocol2TimApi.get(value);
};
timapi.protocol.constants.Reason.protocol2TimApiIfValid = function (value) {
    return this._protocol2TimApi.get(value);
};
timapi.protocol.constants.Reason._timApi2Protocol =
    new Map([[timapi.constants.Reason.ok, "Ok"],
        [timapi.constants.Reason.corr, "Corr"],
        [timapi.constants.Reason.stop, "Stop"],
        [timapi.constants.Reason.cardReader, "CardReader"],
        [timapi.constants.Reason.autoConfirm, "AutoConfirm"],
        [timapi.constants.Reason.timeout, "Timeout"],
        [timapi.constants.Reason.codeOk, "CodeOk"],
        [timapi.constants.Reason.codeNok, "CodeNok"],
        [timapi.constants.Reason.pinOk, "PinOk"],
        [timapi.constants.Reason.pinNok, "PinNok"]]);
timapi.protocol.constants.Reason._protocol2TimApi =
    new Map([["Ok", timapi.constants.Reason.ok],
        ["Corr", timapi.constants.Reason.corr],
        ["Stop", timapi.constants.Reason.stop],
        ["CardReader", timapi.constants.Reason.cardReader],
        ["AutoConfirm", timapi.constants.Reason.autoConfirm],
        ["Timeout", timapi.constants.Reason.timeout],
        ["CodeOk", timapi.constants.Reason.codeOk],
        ["CodeNok", timapi.constants.Reason.codeNok],
        ["PinOk", timapi.constants.Reason.pinOk],
        ["PinNok", timapi.constants.Reason.pinNok]]);
timapi.protocol.constants.ReceiptItemType = {};
timapi.protocol.constants.ReceiptItemType.timApi2Protocol = function (value) {
    if (!this._timApi2Protocol.has(value)) {
        throw new Error("Invalid argument '" + value + "' (ReceiptItemType)");
    }
    return this._timApi2Protocol.get(value);
};
timapi.protocol.constants.ReceiptItemType.protocol2TimApi = function (value) {
    if (!this._protocol2TimApi.has(value)) {
        throw new Error("Invalid argument '" + value + "' (ReceiptItemType)");
    }
    return this._protocol2TimApi.get(value);
};
timapi.protocol.constants.ReceiptItemType.protocol2TimApiIfValid = function (value) {
    return this._protocol2TimApi.get(value);
};
timapi.protocol.constants.ReceiptItemType._timApi2Protocol =
    new Map([[timapi.constants.ReceiptItemType.actId, "ActId"],
        [timapi.constants.ReceiptItemType.accPer, "AccPer"],
        [timapi.constants.ReceiptItemType.acqId, "AcqId"],
        [timapi.constants.ReceiptItemType.aid, "Aid"],
        [timapi.constants.ReceiptItemType.amount, "Amount"],
        [timapi.constants.ReceiptItemType.amountDcc, "AmountDcc"],
        [timapi.constants.ReceiptItemType.amountOther, "AmountOther"],
        [timapi.constants.ReceiptItemType.authCode, "AuthCode"],
        [timapi.constants.ReceiptItemType.authReslt, "AuthReslt"],
        [timapi.constants.ReceiptItemType.authRespC, "AuthRespC"],
        [timapi.constants.ReceiptItemType.authRespTextC, "AuthRespTextC"],
        [timapi.constants.ReceiptItemType.brandName, "BrandName"],
        [timapi.constants.ReceiptItemType.currency, "Currency"],
        [timapi.constants.ReceiptItemType.currencyDcc, "CurrencyDcc"],
        [timapi.constants.ReceiptItemType.dccDisclaimer, "DccDisclaimer"],
        [timapi.constants.ReceiptItemType.disclaimer, "Disclaimer"],
        [timapi.constants.ReceiptItemType.exponent, "Exponent"],
        [timapi.constants.ReceiptItemType.exponentDcc, "ExponentDcc"],
        [timapi.constants.ReceiptItemType.markupDcc, "MarkupDcc"],
        [timapi.constants.ReceiptItemType.markupExponentDcc, "MarkupExponentDcc"],
        [timapi.constants.ReceiptItemType.cardNumberPrintableMerchant, "CardNumberPrintableMerchant"],
        [timapi.constants.ReceiptItemType.cardNumberPrintableCardholder, "CardNumberPrintableCardholder"],
        [timapi.constants.ReceiptItemType.rateDcc, "RateDcc"],
        [timapi.constants.ReceiptItemType.rateExponentDcc, "RateExponentDcc"],
        [timapi.constants.ReceiptItemType.timeStampDate, "TimeStampDate"],
        [timapi.constants.ReceiptItemType.timeStampTime, "TimeStampTime"],
        [timapi.constants.ReceiptItemType.trmId, "TrmId"],
        [timapi.constants.ReceiptItemType.trxRefNum, "TrxRefNum"],
        [timapi.constants.ReceiptItemType.trxSeqCnt, "TrxSeqCnt"],
        [timapi.constants.ReceiptItemType.posEntryMode, "PosEntryMode"],
        [timapi.constants.ReceiptItemType.cardExpiryDate, "CardExpiryDate"],
        [timapi.constants.ReceiptItemType.cardNumberEnc, "CardNumberEnc"],
        [timapi.constants.ReceiptItemType.amountSaldo, "AmountSaldo"],
        [timapi.constants.ReceiptItemType.ecrSeqCounter, "EcrSeqCounter"],
        [timapi.constants.ReceiptItemType.panReceiptDol, "PanReceiptDol"],
        [timapi.constants.ReceiptItemType.panReceiptDolIndex, "PanReceiptDolIndex"]]);
timapi.protocol.constants.ReceiptItemType._protocol2TimApi =
    new Map([["ActId", timapi.constants.ReceiptItemType.actId],
        ["AccPer", timapi.constants.ReceiptItemType.accPer],
        ["AcqId", timapi.constants.ReceiptItemType.acqId],
        ["Aid", timapi.constants.ReceiptItemType.aid],
        ["Amount", timapi.constants.ReceiptItemType.amount],
        ["AmountDcc", timapi.constants.ReceiptItemType.amountDcc],
        ["AmountOther", timapi.constants.ReceiptItemType.amountOther],
        ["AuthCode", timapi.constants.ReceiptItemType.authCode],
        ["AuthReslt", timapi.constants.ReceiptItemType.authReslt],
        ["AuthRespC", timapi.constants.ReceiptItemType.authRespC],
        ["AuthRespTextC", timapi.constants.ReceiptItemType.authRespTextC],
        ["BrandName", timapi.constants.ReceiptItemType.brandName],
        ["Currency", timapi.constants.ReceiptItemType.currency],
        ["CurrencyDcc", timapi.constants.ReceiptItemType.currencyDcc],
        ["DccDisclaimer", timapi.constants.ReceiptItemType.dccDisclaimer],
        ["Disclaimer", timapi.constants.ReceiptItemType.disclaimer],
        ["Exponent", timapi.constants.ReceiptItemType.exponent],
        ["ExponentDcc", timapi.constants.ReceiptItemType.exponentDcc],
        ["MarkupDcc", timapi.constants.ReceiptItemType.markupDcc],
        ["MarkupExponentDcc", timapi.constants.ReceiptItemType.markupExponentDcc],
        ["CardNumberPrintableMerchant", timapi.constants.ReceiptItemType.cardNumberPrintableMerchant],
        ["CardNumberPrintableCardholder", timapi.constants.ReceiptItemType.cardNumberPrintableCardholder],
        ["RateDcc", timapi.constants.ReceiptItemType.rateDcc],
        ["RateExponentDcc", timapi.constants.ReceiptItemType.rateExponentDcc],
        ["TimeStampDate", timapi.constants.ReceiptItemType.timeStampDate],
        ["TimeStampTime", timapi.constants.ReceiptItemType.timeStampTime],
        ["TrmId", timapi.constants.ReceiptItemType.trmId],
        ["TrxRefNum", timapi.constants.ReceiptItemType.trxRefNum],
        ["TrxSeqCnt", timapi.constants.ReceiptItemType.trxSeqCnt],
        ["PosEntryMode", timapi.constants.ReceiptItemType.posEntryMode],
        ["CardExpiryDate", timapi.constants.ReceiptItemType.cardExpiryDate],
        ["CardNumberEnc", timapi.constants.ReceiptItemType.cardNumberEnc],
        ["AmountSaldo", timapi.constants.ReceiptItemType.amountSaldo],
        ["EcrSeqCounter", timapi.constants.ReceiptItemType.ecrSeqCounter],
        ["PanReceiptDol", timapi.constants.ReceiptItemType.panReceiptDol],
        ["PanReceiptDolIndex", timapi.constants.ReceiptItemType.panReceiptDolIndex]]);
timapi.protocol.constants.ReceiptRequestType = {};
timapi.protocol.constants.ReceiptRequestType.timApi2Protocol = function (value) {
    if (!this._timApi2Protocol.has(value)) {
        throw new Error("Invalid argument '" + value + "' (ReceiptRequestType)");
    }
    return this._timApi2Protocol.get(value);
};
timapi.protocol.constants.ReceiptRequestType.protocol2TimApi = function (value) {
    if (!this._protocol2TimApi.has(value)) {
        throw new Error("Invalid argument '" + value + "' (ReceiptRequestType)");
    }
    return this._protocol2TimApi.get(value);
};
timapi.protocol.constants.ReceiptRequestType.protocol2TimApiIfValid = function (value) {
    return this._protocol2TimApi.get(value);
};
timapi.protocol.constants.ReceiptRequestType._timApi2Protocol =
    new Map([[timapi.constants.ReceiptRequestType.reprint, "Reprint"],
        [timapi.constants.ReceiptRequestType.list, "List"]]);
timapi.protocol.constants.ReceiptRequestType._protocol2TimApi =
    new Map([["Reprint", timapi.constants.ReceiptRequestType.reprint],
        ["List", timapi.constants.ReceiptRequestType.list]]);
timapi.protocol.constants.ReceiptType = {};
timapi.protocol.constants.ReceiptType.timApi2Protocol = function (value) {
    if (!this._timApi2Protocol.has(value)) {
        throw new Error("Invalid argument '" + value + "' (ReceiptType)");
    }
    return this._timApi2Protocol.get(value);
};
timapi.protocol.constants.ReceiptType.protocol2TimApi = function (value) {
    if (!this._protocol2TimApi.has(value)) {
        throw new Error("Invalid argument '" + value + "' (ReceiptType)");
    }
    return this._protocol2TimApi.get(value);
};
timapi.protocol.constants.ReceiptType.protocol2TimApiIfValid = function (value) {
    return this._protocol2TimApi.get(value);
};
timapi.protocol.constants.ReceiptType._timApi2Protocol =
    new Map([[timapi.constants.ReceiptType.purchase, "Purchase"],
        [timapi.constants.ReceiptType.credit, "Credit"],
        [timapi.constants.ReceiptType.reversal, "Reversal"]]);
timapi.protocol.constants.ReceiptType._protocol2TimApi =
    new Map([["Purchase", timapi.constants.ReceiptType.purchase],
        ["Credit", timapi.constants.ReceiptType.credit],
        ["Reversal", timapi.constants.ReceiptType.reversal]]);
timapi.protocol.constants.Recipient = {};
timapi.protocol.constants.Recipient.timApi2Protocol = function (value) {
    if (!this._timApi2Protocol.has(value)) {
        throw new Error("Invalid argument '" + value + "' (Recipient)");
    }
    return this._timApi2Protocol.get(value);
};
timapi.protocol.constants.Recipient.protocol2TimApi = function (value) {
    if (!this._protocol2TimApi.has(value)) {
        throw new Error("Invalid argument '" + value + "' (Recipient)");
    }
    return this._protocol2TimApi.get(value);
};
timapi.protocol.constants.Recipient.protocol2TimApiIfValid = function (value) {
    return this._protocol2TimApi.get(value);
};
timapi.protocol.constants.Recipient._timApi2Protocol =
    new Map([[timapi.constants.Recipient.merchant, "Merchant"],
        [timapi.constants.Recipient.cardholder, "Cardholder"],
        [timapi.constants.Recipient.both, "Both"]]);
timapi.protocol.constants.Recipient._protocol2TimApi =
    new Map([["Merchant", timapi.constants.Recipient.merchant],
        ["Cardholder", timapi.constants.Recipient.cardholder],
        ["Both", timapi.constants.Recipient.both]]);
timapi.protocol.constants.ResourceId = {};
timapi.protocol.constants.ResourceId.timApi2Protocol = function (value) {
    if (!this._timApi2Protocol.has(value)) {
        throw new Error("Invalid argument '" + value + "' (ResourceId)");
    }
    return this._timApi2Protocol.get(value);
};
timapi.protocol.constants.ResourceId.protocol2TimApi = function (value) {
    if (!this._protocol2TimApi.has(value)) {
        throw new Error("Invalid argument '" + value + "' (ResourceId)");
    }
    return this._protocol2TimApi.get(value);
};
timapi.protocol.constants.ResourceId.protocol2TimApiIfValid = function (value) {
    return this._protocol2TimApi.get(value);
};
timapi.protocol.constants.ResourceId._timApi2Protocol =
    new Map([[timapi.constants.ResourceId.enterMileage, 100],
        [timapi.constants.ResourceId.enterCarNumber, 101],
        [timapi.constants.ResourceId.enterDriverCode, 102],
        [timapi.constants.ResourceId.enterFleetId, 103],
        [timapi.constants.ResourceId.selectPump, 104],
        [timapi.constants.ResourceId.selectWashingStation, 105],
        [timapi.constants.ResourceId.selectProgram, 106],
        [timapi.constants.ResourceId.selectProduct, 107],
        [timapi.constants.ResourceId.loadCard, 108],
        [timapi.constants.ResourceId.readCode, 109],
        [timapi.constants.ResourceId.checkCode, 110],
        [timapi.constants.ResourceId.enterAdditionalInformation, 111],
        [timapi.constants.ResourceId.enterCostCenter, 112],
        [timapi.constants.ResourceId.enterEmployeeNumber, 113],
        [timapi.constants.ResourceId.enterLicensePlate, 114],
        [timapi.constants.ResourceId.enterProjectNumber, 115],
        [timapi.constants.ResourceId.petrolPrintReceipt, 116],
        [timapi.constants.ResourceId.petrolRemoveCard, 117],
        [timapi.constants.ResourceId.petrolOutOfOrder, 118],
        [timapi.constants.ResourceId.petrolInvalidEntry, 119],
        [timapi.constants.ResourceId.petrolRefuelAtPump, 120],
        [timapi.constants.ResourceId.petrolSeeOtherScreen, 121],
        [timapi.constants.ResourceId.petrolPleaseRefuel, 122],
        [timapi.constants.ResourceId.noRechargeCard, 1000],
        [timapi.constants.ResourceId.showPhoneNumberWithAmount, 1001],
        [timapi.constants.ResourceId.enterPhoneOrPrepaidNumber, 1002],
        [timapi.constants.ResourceId.phoneNumberTooLong, 1003],
        [timapi.constants.ResourceId.phoneNumberTooShort, 1004],
        [timapi.constants.ResourceId.enterPhoneNumber, 1005],
        [timapi.constants.ResourceId.pleaseWait, 1006],
        [timapi.constants.ResourceId.processingDeclined, 1007],
        [timapi.constants.ResourceId.processingOk, 1008],
        [timapi.constants.ResourceId.registerCard, 1009],
        [timapi.constants.ResourceId.welcomeCard, 1010],
        [timapi.constants.ResourceId.showPhoneNumber, 1011],
        [timapi.constants.ResourceId.interAccountTransfer, 1012],
        [timapi.constants.ResourceId.interAccountTransferConfirmation, 1013],
        [timapi.constants.ResourceId.disbursementFromAccount, 1014],
        [timapi.constants.ResourceId.depositOwnAccount, 1015],
        [timapi.constants.ResourceId.emptyDialog, 1016],
        [timapi.constants.ResourceId.packetAcknowledgement, 1017],
        [timapi.constants.ResourceId.pinEntry, 1018],
        [timapi.constants.ResourceId.bankingInsertCard, 1100],
        [timapi.constants.ResourceId.bankingPinCheck, 1101],
        [timapi.constants.ResourceId.bankingShowSaldo, 1102],
        [timapi.constants.ResourceId.bankingConfirmAmount, 1103],
        [timapi.constants.ResourceId.bankingRemoveCard, 1104],
        [timapi.constants.ResourceId.bankingWelcome, 1105],
        [timapi.constants.ResourceId.commonRegular, 3000],
        [timapi.constants.ResourceId.commonPleaseWait, 3001],
        [timapi.constants.ResourceId.commonDataSaved, 3002],
        [timapi.constants.ResourceId.commonCardInitialized, 3003],
        [timapi.constants.ResourceId.commonCardDeinitialized, 3004],
        [timapi.constants.ResourceId.commonRemoveCard, 3005]]);
timapi.protocol.constants.ResourceId._protocol2TimApi =
    new Map([[100, timapi.constants.ResourceId.enterMileage],
        [101, timapi.constants.ResourceId.enterCarNumber],
        [102, timapi.constants.ResourceId.enterDriverCode],
        [103, timapi.constants.ResourceId.enterFleetId],
        [104, timapi.constants.ResourceId.selectPump],
        [105, timapi.constants.ResourceId.selectWashingStation],
        [106, timapi.constants.ResourceId.selectProgram],
        [107, timapi.constants.ResourceId.selectProduct],
        [108, timapi.constants.ResourceId.loadCard],
        [109, timapi.constants.ResourceId.readCode],
        [110, timapi.constants.ResourceId.checkCode],
        [111, timapi.constants.ResourceId.enterAdditionalInformation],
        [112, timapi.constants.ResourceId.enterCostCenter],
        [113, timapi.constants.ResourceId.enterEmployeeNumber],
        [114, timapi.constants.ResourceId.enterLicensePlate],
        [115, timapi.constants.ResourceId.enterProjectNumber],
        [116, timapi.constants.ResourceId.petrolPrintReceipt],
        [117, timapi.constants.ResourceId.petrolRemoveCard],
        [118, timapi.constants.ResourceId.petrolOutOfOrder],
        [119, timapi.constants.ResourceId.petrolInvalidEntry],
        [120, timapi.constants.ResourceId.petrolRefuelAtPump],
        [121, timapi.constants.ResourceId.petrolSeeOtherScreen],
        [122, timapi.constants.ResourceId.petrolPleaseRefuel],
        [1000, timapi.constants.ResourceId.noRechargeCard],
        [1001, timapi.constants.ResourceId.showPhoneNumberWithAmount],
        [1002, timapi.constants.ResourceId.enterPhoneOrPrepaidNumber],
        [1003, timapi.constants.ResourceId.phoneNumberTooLong],
        [1004, timapi.constants.ResourceId.phoneNumberTooShort],
        [1005, timapi.constants.ResourceId.enterPhoneNumber],
        [1006, timapi.constants.ResourceId.pleaseWait],
        [1007, timapi.constants.ResourceId.processingDeclined],
        [1008, timapi.constants.ResourceId.processingOk],
        [1009, timapi.constants.ResourceId.registerCard],
        [1010, timapi.constants.ResourceId.welcomeCard],
        [1011, timapi.constants.ResourceId.showPhoneNumber],
        [1012, timapi.constants.ResourceId.interAccountTransfer],
        [1013, timapi.constants.ResourceId.interAccountTransferConfirmation],
        [1014, timapi.constants.ResourceId.disbursementFromAccount],
        [1015, timapi.constants.ResourceId.depositOwnAccount],
        [1016, timapi.constants.ResourceId.emptyDialog],
        [1017, timapi.constants.ResourceId.packetAcknowledgement],
        [1018, timapi.constants.ResourceId.pinEntry],
        [1100, timapi.constants.ResourceId.bankingInsertCard],
        [1101, timapi.constants.ResourceId.bankingPinCheck],
        [1102, timapi.constants.ResourceId.bankingShowSaldo],
        [1103, timapi.constants.ResourceId.bankingConfirmAmount],
        [1104, timapi.constants.ResourceId.bankingRemoveCard],
        [1105, timapi.constants.ResourceId.bankingWelcome],
        [3000, timapi.constants.ResourceId.commonRegular],
        [3001, timapi.constants.ResourceId.commonPleaseWait],
        [3002, timapi.constants.ResourceId.commonDataSaved],
        [3003, timapi.constants.ResourceId.commonCardInitialized],
        [3004, timapi.constants.ResourceId.commonCardDeinitialized],
        [3005, timapi.constants.ResourceId.commonRemoveCard]]);
timapi.protocol.constants.ResultCode = {};
timapi.protocol.constants.ResultCode.timApi2Protocol = function (value) {
    if (!this._timApi2Protocol.has(value)) {
        throw new Error("Invalid argument '" + value + "' (ResultCode)");
    }
    return this._timApi2Protocol.get(value);
};
timapi.protocol.constants.ResultCode.protocol2TimApi = function (value) {
    if (!this._protocol2TimApi.has(value)) {
        throw new Error("Invalid argument '" + value + "' (ResultCode)");
    }
    return this._protocol2TimApi.get(value);
};
timapi.protocol.constants.ResultCode.protocol2TimApiIfValid = function (value) {
    return this._protocol2TimApi.get(value);
};
timapi.protocol.constants.ResultCode._timApi2Protocol =
    new Map([[timapi.constants.ResultCode.ok, 0],
        [timapi.constants.ResultCode.apiCancelEcr, 50],
        [timapi.constants.ResultCode.apiInvalidAnswer, 51],
        [timapi.constants.ResultCode.apiDisabledFeature, 52],
        [timapi.constants.ResultCode.apiFunctionDisallowed, 53],
        [timapi.constants.ResultCode.apiPersistencyProblem, 54],
        [timapi.constants.ResultCode.apiConnectFailServer, 100],
        [timapi.constants.ResultCode.apiConnectFailTerminal, 101],
        [timapi.constants.ResultCode.apiConnectionLostServer, 102],
        [timapi.constants.ResultCode.apiConnectionLostTerminal, 103],
        [timapi.constants.ResultCode.ethernetDisconnected, 104],
        [timapi.constants.ResultCode.rs232Disconnected, 105],
        [timapi.constants.ResultCode.apiTimeoutServer, 106],
        [timapi.constants.ResultCode.apiTimeoutTerminal, 107],
        [timapi.constants.ResultCode.serverInvalidAnswer, 200],
        [timapi.constants.ResultCode.serverInvalidRequest, 201],
        [timapi.constants.ResultCode.serverDisabledFeature, 202],
        [timapi.constants.ResultCode.serverPersistencyProblem, 203],
        [timapi.constants.ResultCode.serverConnectFailTerminal, 250],
        [timapi.constants.ResultCode.serverConnectionLostTerminal, 251],
        [timapi.constants.ResultCode.serverTimeoutTerminal, 252],
        [timapi.constants.ResultCode.ccrUnavailable, 300],
        [timapi.constants.ResultCode.mcrUnavailable, 301],
        [timapi.constants.ResultCode.nfcUnavailable, 302],
        [timapi.constants.ResultCode.displayUnavailable, 303],
        [timapi.constants.ResultCode.pinPadUnavailable, 304],
        [timapi.constants.ResultCode.rs232Unavailable, 305],
        [timapi.constants.ResultCode.rs232NotConfigured, 306],
        [timapi.constants.ResultCode.cardReaderErrorCcr, 400],
        [timapi.constants.ResultCode.cardReaderErrorMcr, 401],
        [timapi.constants.ResultCode.cardReaderErrorNfc, 402],
        [timapi.constants.ResultCode.cardErrorCcr, 403],
        [timapi.constants.ResultCode.cardErrorMcr, 404],
        [timapi.constants.ResultCode.cardErrorNfc, 405],
        [timapi.constants.ResultCode.cardReadError, 406],
        [timapi.constants.ResultCode.cardReadTimeout, 407],
        [timapi.constants.ResultCode.cardInsertionTimeout, 408],
        [timapi.constants.ResultCode.cardReaderKeysLost, 409],
        [timapi.constants.ResultCode.cardReaderSecurityError, 410],
        [timapi.constants.ResultCode.cardTimeout, 411],
        [timapi.constants.ResultCode.cardNotReadable, 412],
        [timapi.constants.ResultCode.cardInvalidData, 413],
        [timapi.constants.ResultCode.cardFunctionNotFound, 414],
        [timapi.constants.ResultCode.cardFunctionNotAllowed, 415],
        [timapi.constants.ResultCode.pinPadSecurityError, 500],
        [timapi.constants.ResultCode.pinPadTampered, 501],
        [timapi.constants.ResultCode.pinPadKeysLost, 502],
        [timapi.constants.ResultCode.cardholderStop, 550],
        [timapi.constants.ResultCode.cardholderTimeout, 551],
        [timapi.constants.ResultCode.cardRemoved, 552],
        [timapi.constants.ResultCode.timTimeoutEcr, 600],
        [timapi.constants.ResultCode.timConnectFailPaymentHost, 601],
        [timapi.constants.ResultCode.timConnectionLostPaymentHost, 602],
        [timapi.constants.ResultCode.timTimeoutAnswerRs232, 603],
        [timapi.constants.ResultCode.timCommunicationFailure, 604],
        [timapi.constants.ResultCode.timConfigFailure, 605],
        [timapi.constants.ResultCode.timInitFailure, 606],
        [timapi.constants.ResultCode.sixmlGeneralError, 700],
        [timapi.constants.ResultCode.sixmlInvalidRequest, 701],
        [timapi.constants.ResultCode.sixmlWrongCashier, 702],
        [timapi.constants.ResultCode.sixmlWrongEcrId, 703],
        [timapi.constants.ResultCode.sixmlUnknownReferenceNumber, 704],
        [timapi.constants.ResultCode.sixmlWrongState, 705],
        [timapi.constants.ResultCode.busyOtherController, 706],
        [timapi.constants.ResultCode.busyMaintenance, 707],
        [timapi.constants.ResultCode.requestPending, 708],
        [timapi.constants.ResultCode.sixmlUnsupportedRequest, 709],
        [timapi.constants.ResultCode.trxNoCommonApplications, 800],
        [timapi.constants.ResultCode.trxLimitExceeded, 801],
        [timapi.constants.ResultCode.trxNoCommonCvm, 802],
        [timapi.constants.ResultCode.declinedCvmFailed, 803],
        [timapi.constants.ResultCode.trxReferral, 804],
        [timapi.constants.ResultCode.trxInvalidAuthResponse, 805],
        [timapi.constants.ResultCode.declinedGeneric, 806],
        [timapi.constants.ResultCode.declinedSaldoTooLow, 807],
        [timapi.constants.ResultCode.declinedWrongPin, 808],
        [timapi.constants.ResultCode.declinedCardBlocked, 809],
        [timapi.constants.ResultCode.declinedSecurityIssue, 810],
        [timapi.constants.ResultCode.declinedUsageControl, 811],
        [timapi.constants.ResultCode.declinedDoubleTransaction, 812],
        [timapi.constants.ResultCode.declinedGenericFirstAc, 813],
        [timapi.constants.ResultCode.declinedGenericSecondAc, 814],
        [timapi.constants.ResultCode.trxCommitTimeout, 815],
        [timapi.constants.ResultCode.trxRollbackImpossible, 816],
        [timapi.constants.ResultCode.cashbackAmountTooLow, 817],
        [timapi.constants.ResultCode.cashbackAmountTooHigh, 818],
        [timapi.constants.ResultCode.basketDeclined, 819],
        [timapi.constants.ResultCode.noTrxInGroupExceeded, 820],
        [timapi.constants.ResultCode.unsupportedCharactersInMessage, 821],
        [timapi.constants.ResultCode.loyaltyCheckInPending, 822],
        [timapi.constants.ResultCode.declinedCardError, 823],
        [timapi.constants.ResultCode.declinedCardExpired, 824],
        [timapi.constants.ResultCode.declinedTrxInvalid, 825],
        [timapi.constants.ResultCode.declinedTryLater, 826],
        [timapi.constants.ResultCode.declinedTryAnotherInterface, 827],
        [timapi.constants.ResultCode.declinedInvalidMerchant, 828],
        [timapi.constants.ResultCode.declinedRestrictionDeclined, 829],
        [timapi.constants.ResultCode.declinedWrongCurrency, 830],
        [timapi.constants.ResultCode.declinedAutoreversalPending, 831],
        [timapi.constants.ResultCode.declinedWrongCardNumber, 832],
        [timapi.constants.ResultCode.declinedWrongCardExpiryDate, 833],
        [timapi.constants.ResultCode.declinedRetryTemporaryUnavailable, 834],
        [timapi.constants.ResultCode.declinedServiceNotAllowed, 835],
        [timapi.constants.ResultCode.declinedCardholderInformationIssue, 836],
        [timapi.constants.ResultCode.declinedReferralWrongAuthCode, 837],
        [timapi.constants.ResultCode.declinedReferralWrongAmount, 838],
        [timapi.constants.ResultCode.declinedReferralOtherReason, 839],
        [timapi.constants.ResultCode.declinedCaptureCardGeneric, 840],
        [timapi.constants.ResultCode.declinedCaptureCardInfoToClient, 841],
        [timapi.constants.ResultCode.declinedCaptureCardOrderToClient, 842],
        [timapi.constants.ResultCode.declinedCaptureCardTimeoutRemovingCard, 843],
        [timapi.constants.ResultCode.declinedNotSupported, 844]]);
timapi.protocol.constants.ResultCode._protocol2TimApi =
    new Map([[0, timapi.constants.ResultCode.ok],
        [50, timapi.constants.ResultCode.apiCancelEcr],
        [51, timapi.constants.ResultCode.apiInvalidAnswer],
        [52, timapi.constants.ResultCode.apiDisabledFeature],
        [53, timapi.constants.ResultCode.apiFunctionDisallowed],
        [54, timapi.constants.ResultCode.apiPersistencyProblem],
        [100, timapi.constants.ResultCode.apiConnectFailServer],
        [101, timapi.constants.ResultCode.apiConnectFailTerminal],
        [102, timapi.constants.ResultCode.apiConnectionLostServer],
        [103, timapi.constants.ResultCode.apiConnectionLostTerminal],
        [104, timapi.constants.ResultCode.ethernetDisconnected],
        [105, timapi.constants.ResultCode.rs232Disconnected],
        [106, timapi.constants.ResultCode.apiTimeoutServer],
        [107, timapi.constants.ResultCode.apiTimeoutTerminal],
        [200, timapi.constants.ResultCode.serverInvalidAnswer],
        [201, timapi.constants.ResultCode.serverInvalidRequest],
        [202, timapi.constants.ResultCode.serverDisabledFeature],
        [203, timapi.constants.ResultCode.serverPersistencyProblem],
        [250, timapi.constants.ResultCode.serverConnectFailTerminal],
        [251, timapi.constants.ResultCode.serverConnectionLostTerminal],
        [252, timapi.constants.ResultCode.serverTimeoutTerminal],
        [300, timapi.constants.ResultCode.ccrUnavailable],
        [301, timapi.constants.ResultCode.mcrUnavailable],
        [302, timapi.constants.ResultCode.nfcUnavailable],
        [303, timapi.constants.ResultCode.displayUnavailable],
        [304, timapi.constants.ResultCode.pinPadUnavailable],
        [305, timapi.constants.ResultCode.rs232Unavailable],
        [306, timapi.constants.ResultCode.rs232NotConfigured],
        [400, timapi.constants.ResultCode.cardReaderErrorCcr],
        [401, timapi.constants.ResultCode.cardReaderErrorMcr],
        [402, timapi.constants.ResultCode.cardReaderErrorNfc],
        [403, timapi.constants.ResultCode.cardErrorCcr],
        [404, timapi.constants.ResultCode.cardErrorMcr],
        [405, timapi.constants.ResultCode.cardErrorNfc],
        [406, timapi.constants.ResultCode.cardReadError],
        [407, timapi.constants.ResultCode.cardReadTimeout],
        [408, timapi.constants.ResultCode.cardInsertionTimeout],
        [409, timapi.constants.ResultCode.cardReaderKeysLost],
        [410, timapi.constants.ResultCode.cardReaderSecurityError],
        [411, timapi.constants.ResultCode.cardTimeout],
        [412, timapi.constants.ResultCode.cardNotReadable],
        [413, timapi.constants.ResultCode.cardInvalidData],
        [414, timapi.constants.ResultCode.cardFunctionNotFound],
        [415, timapi.constants.ResultCode.cardFunctionNotAllowed],
        [500, timapi.constants.ResultCode.pinPadSecurityError],
        [501, timapi.constants.ResultCode.pinPadTampered],
        [502, timapi.constants.ResultCode.pinPadKeysLost],
        [550, timapi.constants.ResultCode.cardholderStop],
        [551, timapi.constants.ResultCode.cardholderTimeout],
        [552, timapi.constants.ResultCode.cardRemoved],
        [600, timapi.constants.ResultCode.timTimeoutEcr],
        [601, timapi.constants.ResultCode.timConnectFailPaymentHost],
        [602, timapi.constants.ResultCode.timConnectionLostPaymentHost],
        [603, timapi.constants.ResultCode.timTimeoutAnswerRs232],
        [604, timapi.constants.ResultCode.timCommunicationFailure],
        [605, timapi.constants.ResultCode.timConfigFailure],
        [606, timapi.constants.ResultCode.timInitFailure],
        [700, timapi.constants.ResultCode.sixmlGeneralError],
        [701, timapi.constants.ResultCode.sixmlInvalidRequest],
        [702, timapi.constants.ResultCode.sixmlWrongCashier],
        [703, timapi.constants.ResultCode.sixmlWrongEcrId],
        [704, timapi.constants.ResultCode.sixmlUnknownReferenceNumber],
        [705, timapi.constants.ResultCode.sixmlWrongState],
        [706, timapi.constants.ResultCode.busyOtherController],
        [707, timapi.constants.ResultCode.busyMaintenance],
        [708, timapi.constants.ResultCode.requestPending],
        [709, timapi.constants.ResultCode.sixmlUnsupportedRequest],
        [800, timapi.constants.ResultCode.trxNoCommonApplications],
        [801, timapi.constants.ResultCode.trxLimitExceeded],
        [802, timapi.constants.ResultCode.trxNoCommonCvm],
        [803, timapi.constants.ResultCode.declinedCvmFailed],
        [804, timapi.constants.ResultCode.trxReferral],
        [805, timapi.constants.ResultCode.trxInvalidAuthResponse],
        [806, timapi.constants.ResultCode.declinedGeneric],
        [807, timapi.constants.ResultCode.declinedSaldoTooLow],
        [808, timapi.constants.ResultCode.declinedWrongPin],
        [809, timapi.constants.ResultCode.declinedCardBlocked],
        [810, timapi.constants.ResultCode.declinedSecurityIssue],
        [811, timapi.constants.ResultCode.declinedUsageControl],
        [812, timapi.constants.ResultCode.declinedDoubleTransaction],
        [813, timapi.constants.ResultCode.declinedGenericFirstAc],
        [814, timapi.constants.ResultCode.declinedGenericSecondAc],
        [815, timapi.constants.ResultCode.trxCommitTimeout],
        [816, timapi.constants.ResultCode.trxRollbackImpossible],
        [817, timapi.constants.ResultCode.cashbackAmountTooLow],
        [818, timapi.constants.ResultCode.cashbackAmountTooHigh],
        [819, timapi.constants.ResultCode.basketDeclined],
        [820, timapi.constants.ResultCode.noTrxInGroupExceeded],
        [821, timapi.constants.ResultCode.unsupportedCharactersInMessage],
        [822, timapi.constants.ResultCode.loyaltyCheckInPending],
        [823, timapi.constants.ResultCode.declinedCardError],
        [824, timapi.constants.ResultCode.declinedCardExpired],
        [825, timapi.constants.ResultCode.declinedTrxInvalid],
        [826, timapi.constants.ResultCode.declinedTryLater],
        [827, timapi.constants.ResultCode.declinedTryAnotherInterface],
        [828, timapi.constants.ResultCode.declinedInvalidMerchant],
        [829, timapi.constants.ResultCode.declinedRestrictionDeclined],
        [830, timapi.constants.ResultCode.declinedWrongCurrency],
        [831, timapi.constants.ResultCode.declinedAutoreversalPending],
        [832, timapi.constants.ResultCode.declinedWrongCardNumber],
        [833, timapi.constants.ResultCode.declinedWrongCardExpiryDate],
        [834, timapi.constants.ResultCode.declinedRetryTemporaryUnavailable],
        [835, timapi.constants.ResultCode.declinedServiceNotAllowed],
        [836, timapi.constants.ResultCode.declinedCardholderInformationIssue],
        [837, timapi.constants.ResultCode.declinedReferralWrongAuthCode],
        [838, timapi.constants.ResultCode.declinedReferralWrongAmount],
        [839, timapi.constants.ResultCode.declinedReferralOtherReason],
        [840, timapi.constants.ResultCode.declinedCaptureCardGeneric],
        [841, timapi.constants.ResultCode.declinedCaptureCardInfoToClient],
        [842, timapi.constants.ResultCode.declinedCaptureCardOrderToClient],
        [843, timapi.constants.ResultCode.declinedCaptureCardTimeoutRemovingCard],
        [844, timapi.constants.ResultCode.declinedNotSupported]]);
timapi.protocol.constants.SecurityStatus = {};
timapi.protocol.constants.SecurityStatus.timApi2Protocol = function (value) {
    if (!this._timApi2Protocol.has(value)) {
        throw new Error("Invalid argument '" + value + "' (SecurityStatus)");
    }
    return this._timApi2Protocol.get(value);
};
timapi.protocol.constants.SecurityStatus.protocol2TimApi = function (value) {
    if (!this._protocol2TimApi.has(value)) {
        throw new Error("Invalid argument '" + value + "' (SecurityStatus)");
    }
    return this._protocol2TimApi.get(value);
};
timapi.protocol.constants.SecurityStatus.protocol2TimApiIfValid = function (value) {
    return this._protocol2TimApi.get(value);
};
timapi.protocol.constants.SecurityStatus._timApi2Protocol =
    new Map([[timapi.constants.SecurityStatus.disabled, "Disabled"],
        [timapi.constants.SecurityStatus.active, "Active"],
        [timapi.constants.SecurityStatus.tampered, "Tampered"]]);
timapi.protocol.constants.SecurityStatus._protocol2TimApi =
    new Map([["Disabled", timapi.constants.SecurityStatus.disabled],
        ["Active", timapi.constants.SecurityStatus.active],
        ["Tampered", timapi.constants.SecurityStatus.tampered]]);
timapi.protocol.constants.SettingType = {};
timapi.protocol.constants.SettingType.timApi2Protocol = function (value) {
    if (!this._timApi2Protocol.has(value)) {
        throw new Error("Invalid argument '" + value + "' (SettingType)");
    }
    return this._timApi2Protocol.get(value);
};
timapi.protocol.constants.SettingType.protocol2TimApi = function (value) {
    if (!this._protocol2TimApi.has(value)) {
        throw new Error("Invalid argument '" + value + "' (SettingType)");
    }
    return this._protocol2TimApi.get(value);
};
timapi.protocol.constants.SettingType.protocol2TimApiIfValid = function (value) {
    return this._protocol2TimApi.get(value);
};
timapi.protocol.constants.SettingType._timApi2Protocol =
    new Map([[timapi.constants.SettingType.displayBrightness, "DisplayBrightness"],
        [timapi.constants.SettingType.displayContrast, "DisplayContrast"],
        [timapi.constants.SettingType.keypadTones, "KeypadTones"],
        [timapi.constants.SettingType.alertTones, "AlertTones"],
        [timapi.constants.SettingType.language, "Language"]]);
timapi.protocol.constants.SettingType._protocol2TimApi =
    new Map([["DisplayBrightness", timapi.constants.SettingType.displayBrightness],
        ["DisplayContrast", timapi.constants.SettingType.displayContrast],
        ["KeypadTones", timapi.constants.SettingType.keypadTones],
        ["AlertTones", timapi.constants.SettingType.alertTones],
        ["Language", timapi.constants.SettingType.language]]);
timapi.protocol.constants.SleepModeStatus = {};
timapi.protocol.constants.SleepModeStatus.timApi2Protocol = function (value) {
    if (!this._timApi2Protocol.has(value)) {
        throw new Error("Invalid argument '" + value + "' (SleepModeStatus)");
    }
    return this._timApi2Protocol.get(value);
};
timapi.protocol.constants.SleepModeStatus.protocol2TimApi = function (value) {
    if (!this._protocol2TimApi.has(value)) {
        throw new Error("Invalid argument '" + value + "' (SleepModeStatus)");
    }
    return this._protocol2TimApi.get(value);
};
timapi.protocol.constants.SleepModeStatus.protocol2TimApiIfValid = function (value) {
    return this._protocol2TimApi.get(value);
};
timapi.protocol.constants.SleepModeStatus._timApi2Protocol =
    new Map([[timapi.constants.SleepModeStatus.enteringSleep, "EnteringSleep"],
        [timapi.constants.SleepModeStatus.wakingUp, "WakingUp"]]);
timapi.protocol.constants.SleepModeStatus._protocol2TimApi =
    new Map([["EnteringSleep", timapi.constants.SleepModeStatus.enteringSleep],
        ["WakingUp", timapi.constants.SleepModeStatus.wakingUp]]);
timapi.protocol.constants.StatusFunctions = {};
timapi.protocol.constants.StatusFunctions.timApi2Protocol = function (value) {
    var flags = 0;
    for (var each of value) {
        if (!this._timApi2Protocol.has(each)) {
            throw new Error("Invalid argument '" + value + "' (StatusFunctions)");
        }
        flags |= this._timApi2Protocol.get(each);
    }
    return flags;
};
timapi.protocol.constants.StatusFunctions.protocol2TimApi = function (value) {
    var set = new Set();
    for (var [k, v] of this._protocol2TimApi.entries()) {
        if ((value & k) != 0) {
            set.add(v);
        }
    }
    return set;
};
timapi.protocol.constants.StatusFunctions._timApi2Protocol =
    new Map([[timapi.constants.StatusFunctions.featureRequest, 0x1],
        [timapi.constants.StatusFunctions.terminalStatus, 0x2],
        [timapi.constants.StatusFunctions.systemInformation, 0x4],
        [timapi.constants.StatusFunctions.applicationInformation, 0x8],
        [timapi.constants.StatusFunctions.hardwareInformation, 0x10],
        [timapi.constants.StatusFunctions.keepAlive, 0x20],
        [timapi.constants.StatusFunctions.licenseChanged, 0x40]]);
timapi.protocol.constants.StatusFunctions._protocol2TimApi =
    new Map([[0x1, timapi.constants.StatusFunctions.featureRequest],
        [0x2, timapi.constants.StatusFunctions.terminalStatus],
        [0x4, timapi.constants.StatusFunctions.systemInformation],
        [0x8, timapi.constants.StatusFunctions.applicationInformation],
        [0x10, timapi.constants.StatusFunctions.hardwareInformation],
        [0x20, timapi.constants.StatusFunctions.keepAlive],
        [0x40, timapi.constants.StatusFunctions.licenseChanged]]);
timapi.protocol.constants.Theme = {};
timapi.protocol.constants.Theme.timApi2Protocol = function (value) {
    if (!this._timApi2Protocol.has(value)) {
        throw new Error("Invalid argument '" + value + "' (Theme)");
    }
    return this._timApi2Protocol.get(value);
};
timapi.protocol.constants.Theme.protocol2TimApi = function (value) {
    if (!this._protocol2TimApi.has(value)) {
        throw new Error("Invalid argument '" + value + "' (Theme)");
    }
    return this._protocol2TimApi.get(value);
};
timapi.protocol.constants.Theme.protocol2TimApiIfValid = function (value) {
    return this._protocol2TimApi.get(value);
};
timapi.protocol.constants.Theme._timApi2Protocol =
    new Map([[timapi.constants.Theme.six, "Six"],
        [timapi.constants.Theme.swissPost, "SwissPost"]]);
timapi.protocol.constants.Theme._protocol2TimApi =
    new Map([["Six", timapi.constants.Theme.six],
        ["SwissPost", timapi.constants.Theme.swissPost]]);
timapi.protocol.constants.TransactionStatus = {};
timapi.protocol.constants.TransactionStatus.timApi2Protocol = function (value) {
    if (!this._timApi2Protocol.has(value)) {
        throw new Error("Invalid argument '" + value + "' (TransactionStatus)");
    }
    return this._timApi2Protocol.get(value);
};
timapi.protocol.constants.TransactionStatus.protocol2TimApi = function (value) {
    if (!this._protocol2TimApi.has(value)) {
        throw new Error("Invalid argument '" + value + "' (TransactionStatus)");
    }
    return this._protocol2TimApi.get(value);
};
timapi.protocol.constants.TransactionStatus.protocol2TimApiIfValid = function (value) {
    return this._protocol2TimApi.get(value);
};
timapi.protocol.constants.TransactionStatus._timApi2Protocol =
    new Map([[timapi.constants.TransactionStatus.busy, "Busy"],
        [timapi.constants.TransactionStatus.idle, "Idle"],
        [timapi.constants.TransactionStatus.waitForCard, "WaitForCard"],
        [timapi.constants.TransactionStatus.readingCard, "ReadingCard"],
        [timapi.constants.TransactionStatus.applicationSelection, "ApplicationSelection"],
        [timapi.constants.TransactionStatus.waitForProceed, "WaitForProceed"],
        [timapi.constants.TransactionStatus.dccSelection, "DccSelection"],
        [timapi.constants.TransactionStatus.enterTip, "EnterTip"],
        [timapi.constants.TransactionStatus.pinEntry, "PinEntry"],
        [timapi.constants.TransactionStatus.signatureCapture, "SignatureCapture"],
        [timapi.constants.TransactionStatus.processing, "Processing"],
        [timapi.constants.TransactionStatus.waitForCommit, "WaitForCommit"]]);
timapi.protocol.constants.TransactionStatus._protocol2TimApi =
    new Map([["Busy", timapi.constants.TransactionStatus.busy],
        ["Idle", timapi.constants.TransactionStatus.idle],
        ["WaitForCard", timapi.constants.TransactionStatus.waitForCard],
        ["ReadingCard", timapi.constants.TransactionStatus.readingCard],
        ["ApplicationSelection", timapi.constants.TransactionStatus.applicationSelection],
        ["WaitForProceed", timapi.constants.TransactionStatus.waitForProceed],
        ["DccSelection", timapi.constants.TransactionStatus.dccSelection],
        ["EnterTip", timapi.constants.TransactionStatus.enterTip],
        ["PinEntry", timapi.constants.TransactionStatus.pinEntry],
        ["SignatureCapture", timapi.constants.TransactionStatus.signatureCapture],
        ["Processing", timapi.constants.TransactionStatus.processing],
        ["WaitForCommit", timapi.constants.TransactionStatus.waitForCommit]]);
timapi.protocol.constants.TransactionType = {};
timapi.protocol.constants.TransactionType.timApi2Protocol = function (value) {
    if (!this._timApi2Protocol.has(value)) {
        throw new Error("Invalid argument '" + value + "' (TransactionType)");
    }
    return this._timApi2Protocol.get(value);
};
timapi.protocol.constants.TransactionType.protocol2TimApi = function (value) {
    if (!this._protocol2TimApi.has(value)) {
        throw new Error("Invalid argument '" + value + "' (TransactionType)");
    }
    return this._protocol2TimApi.get(value);
};
timapi.protocol.constants.TransactionType.protocol2TimApiIfValid = function (value) {
    return this._protocol2TimApi.get(value);
};
timapi.protocol.constants.TransactionType._timApi2Protocol =
    new Map([[timapi.constants.TransactionType.purchase, "Purchase"],
        [timapi.constants.TransactionType.credit, "Credit"],
        [timapi.constants.TransactionType.reversal, "Reversal"],
        [timapi.constants.TransactionType.preAuthorization, "PreAuthorization"],
        [timapi.constants.TransactionType.finalizePurchase, "FinalizePurchase"],
        [timapi.constants.TransactionType.cashAdvance, "CashAdvance"],
        [timapi.constants.TransactionType.purchaseForcedAcceptance, "PurchaseForcedAcceptance"],
        [timapi.constants.TransactionType.purchaseWithCashback, "PurchaseWithCashback"],
        [timapi.constants.TransactionType.purchasePhoneAuthorized, "PurchasePhoneAuthorized"],
        [timapi.constants.TransactionType.purchasePhoneOrdered, "PurchasePhoneOrdered"],
        [timapi.constants.TransactionType.purchaseMailOrdered, "PurchaseMailOrdered"],
        [timapi.constants.TransactionType.giro, "Giro"],
        [timapi.constants.TransactionType.combined, "Combined"],
        [timapi.constants.TransactionType.authorizeCredit, "AuthorizeCredit"],
        [timapi.constants.TransactionType.authorizeDeposit, "AuthorizeDeposit"],
        [timapi.constants.TransactionType.reservation, "Reservation"],
        [timapi.constants.TransactionType.adjustReservation, "AdjustReservation"],
        [timapi.constants.TransactionType.cancelReservation, "CancelReservation"],
        [timapi.constants.TransactionType.purchaseReservation, "PurchaseReservation"],
        [timapi.constants.TransactionType.purchaseReservationPhoneAuthorized, "PurchaseReservationPhoneAuthorized"]]);
timapi.protocol.constants.TransactionType._protocol2TimApi =
    new Map([["Purchase", timapi.constants.TransactionType.purchase],
        ["Credit", timapi.constants.TransactionType.credit],
        ["Reversal", timapi.constants.TransactionType.reversal],
        ["PreAuthorization", timapi.constants.TransactionType.preAuthorization],
        ["FinalizePurchase", timapi.constants.TransactionType.finalizePurchase],
        ["CashAdvance", timapi.constants.TransactionType.cashAdvance],
        ["PurchaseForcedAcceptance", timapi.constants.TransactionType.purchaseForcedAcceptance],
        ["PurchaseWithCashback", timapi.constants.TransactionType.purchaseWithCashback],
        ["PurchasePhoneAuthorized", timapi.constants.TransactionType.purchasePhoneAuthorized],
        ["PurchasePhoneOrdered", timapi.constants.TransactionType.purchasePhoneOrdered],
        ["PurchaseMailOrdered", timapi.constants.TransactionType.purchaseMailOrdered],
        ["Giro", timapi.constants.TransactionType.giro],
        ["Combined", timapi.constants.TransactionType.combined],
        ["AuthorizeCredit", timapi.constants.TransactionType.authorizeCredit],
        ["AuthorizeDeposit", timapi.constants.TransactionType.authorizeDeposit],
        ["Reservation", timapi.constants.TransactionType.reservation],
        ["AdjustReservation", timapi.constants.TransactionType.adjustReservation],
        ["CancelReservation", timapi.constants.TransactionType.cancelReservation],
        ["PurchaseReservation", timapi.constants.TransactionType.purchaseReservation],
        ["PurchaseReservationPhoneAuthorized", timapi.constants.TransactionType.purchaseReservationPhoneAuthorized]]);
timapi.protocol.constants.UpdateStatus = {};
timapi.protocol.constants.UpdateStatus.timApi2Protocol = function (value) {
    if (!this._timApi2Protocol.has(value)) {
        throw new Error("Invalid argument '" + value + "' (UpdateStatus)");
    }
    return this._timApi2Protocol.get(value);
};
timapi.protocol.constants.UpdateStatus.protocol2TimApi = function (value) {
    if (!this._protocol2TimApi.has(value)) {
        throw new Error("Invalid argument '" + value + "' (UpdateStatus)");
    }
    return this._protocol2TimApi.get(value);
};
timapi.protocol.constants.UpdateStatus.protocol2TimApiIfValid = function (value) {
    return this._protocol2TimApi.get(value);
};
timapi.protocol.constants.UpdateStatus._timApi2Protocol =
    new Map([[timapi.constants.UpdateStatus.upToDate, "UpToDate"],
        [timapi.constants.UpdateStatus.runningNoReboot, "RunningNoReboot"],
        [timapi.constants.UpdateStatus.runningReboot, "RunningReboot"]]);
timapi.protocol.constants.UpdateStatus._protocol2TimApi =
    new Map([["UpToDate", timapi.constants.UpdateStatus.upToDate],
        ["RunningNoReboot", timapi.constants.UpdateStatus.runningNoReboot],
        ["RunningReboot", timapi.constants.UpdateStatus.runningReboot]]);
timapi.protocol.sixml.AdditionalErrorInfo = function (a) {
    if (arguments.length == 1 && a instanceof timapi.protocol.sixml.AdditionalErrorInfo) {
        var value = a;
        this.value = value.value;
        this.additionalErrorInfoType = value.additionalErrorInfoType;
        return;
    }
    if (arguments.length == 1 && a instanceof timapi.protocol.XmlNode) {
        var node = a;
        this.value = node.textContent;
        if (this.xmlHasAttribute(node, "AdditionalErrorInfoType")) {
            this.additionalErrorInfoType = this.xmlGetAttribute(node, "AdditionalErrorInfoType");
        }
        return;
    }
    if (arguments.length != 0) {
        throw new Error("Invalid argument");
    }
};
timapi.protocol.sixml.AdditionalErrorInfo.prototype = Object.create(timapi.protocol.Container.prototype);
timapi.protocol.sixml.AdditionalErrorInfo.prototype.value = "";
timapi.protocol.sixml.AdditionalErrorInfo.prototype.additionalErrorInfoType = undefined;
timapi.protocol.sixml.AdditionalErrorInfo.prototype.toXmlNode = function () {
    var node = new timapi.protocol.XmlNode("sixml:AdditionalErrorInfo");
    node.textContent = this.value;
    if (this.additionalErrorInfoType != undefined) {
        this.xmlSetAttribute(node, "AdditionalErrorInfoType", this.additionalErrorInfoType);
    }
    return node;
};
timapi.protocol.sixml.AdditionalErrorInfoList = function (a) {
    this.additionalErrorInfo = [];
    if (arguments.length == 1 && a instanceof timapi.protocol.sixml.AdditionalErrorInfoList) {
        var value = a;
        for (var each of value.additionalErrorInfo) {
            this.additionalErrorInfo.push(each ? new timapi.protocol.sixml.AdditionalErrorInfo(each) : undefined);
        }
        return;
    }
    if (arguments.length == 1 && a instanceof timapi.protocol.XmlNode) {
        var node = a;
        for (var each of this.xmlGetChildren(node, "sixml:AdditionalErrorInfo")) {
            this.additionalErrorInfo.push(new timapi.protocol.sixml.AdditionalErrorInfo(each));
        }
        return;
    }
    if (arguments.length != 0) {
        throw new Error("Invalid argument");
    }
};
timapi.protocol.sixml.AdditionalErrorInfoList.prototype = Object.create(timapi.protocol.Container.prototype);
timapi.protocol.sixml.AdditionalErrorInfoList.prototype.additionalErrorInfo = undefined;
timapi.protocol.sixml.AdditionalErrorInfoList.prototype.toXmlNode = function () {
    var node = new timapi.protocol.XmlNode("sixml:AdditionalErrorInfoList");
    for (var each of this.additionalErrorInfo) {
        this.xmlAddChild(node, "sixml:AdditionalErrorInfo", each);
    }
    return node;
};
timapi.protocol.sixml.AdditionalInfoItem = function (a) {
    if (arguments.length == 1 && a instanceof timapi.protocol.sixml.AdditionalInfoItem) {
        var value = a;
        this.value = value.value;
        this.itemTextcode = value.itemTextcode;
        return;
    }
    if (arguments.length == 1 && a instanceof timapi.protocol.XmlNode) {
        var node = a;
        this.value = node.textContent;
        if (this.xmlHasAttribute(node, "ItemTextcode")) {
            this.itemTextcode = (this.xmlGetAttribute(node, "ItemTextcode") ? parseInt(this.xmlGetAttribute(node, "ItemTextcode")) : 0);
        }
        return;
    }
    if (arguments.length != 0) {
        throw new Error("Invalid argument");
    }
};
timapi.protocol.sixml.AdditionalInfoItem.prototype = Object.create(timapi.protocol.Container.prototype);
timapi.protocol.sixml.AdditionalInfoItem.prototype.value = "";
timapi.protocol.sixml.AdditionalInfoItem.prototype.itemTextcode = undefined;
timapi.protocol.sixml.AdditionalInfoItem.prototype.toXmlNode = function () {
    var node = new timapi.protocol.XmlNode("sixml:AdditionalInfoItem");
    node.textContent = this.value;
    if (this.itemTextcode != undefined) {
        this.xmlSetAttribute(node, "ItemTextcode", timapi.utils.StringHelper.makeString(this.itemTextcode));
    }
    return node;
};
timapi.protocol.sixml.AdditionalInfoList = function (a) {
    this.additionalInfoItem = [];
    if (arguments.length == 1 && a instanceof timapi.protocol.sixml.AdditionalInfoList) {
        var value = a;
        for (var each of value.additionalInfoItem) {
            this.additionalInfoItem.push(each ? new timapi.protocol.sixml.AdditionalInfoItem(each) : undefined);
        }
        return;
    }
    if (arguments.length == 1 && a instanceof timapi.protocol.XmlNode) {
        var node = a;
        for (var each of this.xmlGetChildren(node, "sixml:AdditionalInfoItem")) {
            this.additionalInfoItem.push(new timapi.protocol.sixml.AdditionalInfoItem(each));
        }
        return;
    }
    if (arguments.length != 0) {
        throw new Error("Invalid argument");
    }
};
timapi.protocol.sixml.AdditionalInfoList.prototype = Object.create(timapi.protocol.Container.prototype);
timapi.protocol.sixml.AdditionalInfoList.prototype.additionalInfoItem = undefined;
timapi.protocol.sixml.AdditionalInfoList.prototype.toXmlNode = function () {
    var node = new timapi.protocol.XmlNode("sixml:AdditionalInfoList");
    for (var each of this.additionalInfoItem) {
        this.xmlAddChild(node, "sixml:AdditionalInfoItem", each);
    }
    return node;
};
timapi.protocol.sixml.Amount = function (a) {
    if (arguments.length == 1 && a instanceof timapi.protocol.sixml.Amount) {
        var value = a;
        this.value = value.value;
        this.currency = value.currency;
        this.exponent = value.exponent;
        return;
    }
    if (arguments.length == 1 && a instanceof timapi.protocol.XmlNode) {
        var node = a;
        this.value = (node.textContent ? parseInt(node.textContent) : 0);
        if (this.xmlHasAttribute(node, "Currency")) {
            this.currency = this.xmlGetAttribute(node, "Currency");
        }
        if (this.xmlHasAttribute(node, "Exponent")) {
            this.exponent = (this.xmlGetAttribute(node, "Exponent") ? parseInt(this.xmlGetAttribute(node, "Exponent")) : 0);
        }
        return;
    }
    if (arguments.length != 0) {
        throw new Error("Invalid argument");
    }
};
timapi.protocol.sixml.Amount.prototype = Object.create(timapi.protocol.Container.prototype);
timapi.protocol.sixml.Amount.prototype.value = 0;
timapi.protocol.sixml.Amount.prototype.currency = undefined;
timapi.protocol.sixml.Amount.prototype.exponent = undefined;
timapi.protocol.sixml.Amount.prototype.toXmlNode = function () {
    var node = new timapi.protocol.XmlNode("sixml:Amount");
    node.textContent = timapi.utils.StringHelper.makeString(this.value);
    if (this.currency != undefined) {
        this.xmlSetAttribute(node, "Currency", this.currency);
    }
    if (this.exponent != undefined) {
        this.xmlSetAttribute(node, "Exponent", timapi.utils.StringHelper.makeString(this.exponent));
    }
    return node;
};
timapi.protocol.sixml.AmountDcc = function (a) {
    if (arguments.length == 1 && a instanceof timapi.protocol.sixml.AmountDcc) {
        var value = a;
        this.value = value.value;
        this.currency = value.currency;
        this.exponent = value.exponent;
        this.rate = value.rate;
        this.rateExponent = value.rateExponent;
        this.markup = value.markup;
        this.markupExponent = value.markupExponent;
        return;
    }
    if (arguments.length == 1 && a instanceof timapi.protocol.XmlNode) {
        var node = a;
        this.value = (node.textContent ? parseInt(node.textContent) : 0);
        if (this.xmlHasAttribute(node, "Currency")) {
            this.currency = this.xmlGetAttribute(node, "Currency");
        }
        if (this.xmlHasAttribute(node, "Exponent")) {
            this.exponent = (this.xmlGetAttribute(node, "Exponent") ? parseInt(this.xmlGetAttribute(node, "Exponent")) : 0);
        }
        if (this.xmlHasAttribute(node, "Rate")) {
            this.rate = (this.xmlGetAttribute(node, "Rate") ? parseInt(this.xmlGetAttribute(node, "Rate")) : 0);
        }
        if (this.xmlHasAttribute(node, "RateExponent")) {
            this.rateExponent = (this.xmlGetAttribute(node, "RateExponent") ? parseInt(this.xmlGetAttribute(node, "RateExponent")) : 0);
        }
        if (this.xmlHasAttribute(node, "Markup")) {
            this.markup = (this.xmlGetAttribute(node, "Markup") ? parseInt(this.xmlGetAttribute(node, "Markup")) : 0);
        }
        if (this.xmlHasAttribute(node, "MarkupExponent")) {
            this.markupExponent = (this.xmlGetAttribute(node, "MarkupExponent") ? parseInt(this.xmlGetAttribute(node, "MarkupExponent")) : 0);
        }
        return;
    }
    if (arguments.length != 0) {
        throw new Error("Invalid argument");
    }
};
timapi.protocol.sixml.AmountDcc.prototype = Object.create(timapi.protocol.Container.prototype);
timapi.protocol.sixml.AmountDcc.prototype.value = 0;
timapi.protocol.sixml.AmountDcc.prototype.currency = undefined;
timapi.protocol.sixml.AmountDcc.prototype.exponent = undefined;
timapi.protocol.sixml.AmountDcc.prototype.rate = undefined;
timapi.protocol.sixml.AmountDcc.prototype.rateExponent = undefined;
timapi.protocol.sixml.AmountDcc.prototype.markup = undefined;
timapi.protocol.sixml.AmountDcc.prototype.markupExponent = undefined;
timapi.protocol.sixml.AmountDcc.prototype.toXmlNode = function () {
    var node = new timapi.protocol.XmlNode("sixml:AmountDcc");
    node.textContent = timapi.utils.StringHelper.makeString(this.value);
    if (this.currency != undefined) {
        this.xmlSetAttribute(node, "Currency", this.currency);
    }
    if (this.exponent != undefined) {
        this.xmlSetAttribute(node, "Exponent", timapi.utils.StringHelper.makeString(this.exponent));
    }
    if (this.rate != undefined) {
        this.xmlSetAttribute(node, "Rate", timapi.utils.StringHelper.makeString(this.rate));
    }
    if (this.rateExponent != undefined) {
        this.xmlSetAttribute(node, "RateExponent", timapi.utils.StringHelper.makeString(this.rateExponent));
    }
    if (this.markup != undefined) {
        this.xmlSetAttribute(node, "Markup", timapi.utils.StringHelper.makeString(this.markup));
    }
    if (this.markupExponent != undefined) {
        this.xmlSetAttribute(node, "MarkupExponent", timapi.utils.StringHelper.makeString(this.markupExponent));
    }
    return node;
};
timapi.protocol.sixml.AmountDiscount = function (a) {
    if (arguments.length == 1 && a instanceof timapi.protocol.sixml.AmountDiscount) {
        var value = a;
        this.value = value.value;
        this.currency = value.currency;
        this.exponent = value.exponent;
        this.discountId = value.discountId;
        return;
    }
    if (arguments.length == 1 && a instanceof timapi.protocol.XmlNode) {
        var node = a;
        this.value = (node.textContent ? parseInt(node.textContent) : 0);
        if (this.xmlHasAttribute(node, "Currency")) {
            this.currency = this.xmlGetAttribute(node, "Currency");
        }
        if (this.xmlHasAttribute(node, "Exponent")) {
            this.exponent = (this.xmlGetAttribute(node, "Exponent") ? parseInt(this.xmlGetAttribute(node, "Exponent")) : 0);
        }
        if (this.xmlHasAttribute(node, "DiscountId")) {
            this.discountId = this.xmlGetAttribute(node, "DiscountId");
        }
        return;
    }
    if (arguments.length != 0) {
        throw new Error("Invalid argument");
    }
};
timapi.protocol.sixml.AmountDiscount.prototype = Object.create(timapi.protocol.Container.prototype);
timapi.protocol.sixml.AmountDiscount.prototype.value = 0;
timapi.protocol.sixml.AmountDiscount.prototype.currency = undefined;
timapi.protocol.sixml.AmountDiscount.prototype.exponent = undefined;
timapi.protocol.sixml.AmountDiscount.prototype.discountId = undefined;
timapi.protocol.sixml.AmountDiscount.prototype.toXmlNode = function () {
    var node = new timapi.protocol.XmlNode("sixml:AmountDiscount");
    node.textContent = timapi.utils.StringHelper.makeString(this.value);
    if (this.currency != undefined) {
        this.xmlSetAttribute(node, "Currency", this.currency);
    }
    if (this.exponent != undefined) {
        this.xmlSetAttribute(node, "Exponent", timapi.utils.StringHelper.makeString(this.exponent));
    }
    if (this.discountId != undefined) {
        this.xmlSetAttribute(node, "DiscountId", this.discountId);
    }
    return node;
};
timapi.protocol.sixml.AmountDue = function (a) {
    if (arguments.length == 1 && a instanceof timapi.protocol.sixml.AmountDue) {
        var value = a;
        this.value = value.value;
        this.currency = value.currency;
        this.exponent = value.exponent;
        return;
    }
    if (arguments.length == 1 && a instanceof timapi.protocol.XmlNode) {
        var node = a;
        this.value = (node.textContent ? parseInt(node.textContent) : 0);
        if (this.xmlHasAttribute(node, "Currency")) {
            this.currency = this.xmlGetAttribute(node, "Currency");
        }
        if (this.xmlHasAttribute(node, "Exponent")) {
            this.exponent = (this.xmlGetAttribute(node, "Exponent") ? parseInt(this.xmlGetAttribute(node, "Exponent")) : 0);
        }
        return;
    }
    if (arguments.length != 0) {
        throw new Error("Invalid argument");
    }
};
timapi.protocol.sixml.AmountDue.prototype = Object.create(timapi.protocol.Container.prototype);
timapi.protocol.sixml.AmountDue.prototype.value = 0;
timapi.protocol.sixml.AmountDue.prototype.currency = undefined;
timapi.protocol.sixml.AmountDue.prototype.exponent = undefined;
timapi.protocol.sixml.AmountDue.prototype.toXmlNode = function () {
    var node = new timapi.protocol.XmlNode("sixml:AmountDue");
    node.textContent = timapi.utils.StringHelper.makeString(this.value);
    if (this.currency != undefined) {
        this.xmlSetAttribute(node, "Currency", this.currency);
    }
    if (this.exponent != undefined) {
        this.xmlSetAttribute(node, "Exponent", timapi.utils.StringHelper.makeString(this.exponent));
    }
    return node;
};
timapi.protocol.sixml.AmountOther = function (a) {
    if (arguments.length == 1 && a instanceof timapi.protocol.sixml.AmountOther) {
        var value = a;
        this.value = value.value;
        this.currency = value.currency;
        this.exponent = value.exponent;
        return;
    }
    if (arguments.length == 1 && a instanceof timapi.protocol.XmlNode) {
        var node = a;
        this.value = (node.textContent ? parseInt(node.textContent) : 0);
        if (this.xmlHasAttribute(node, "Currency")) {
            this.currency = this.xmlGetAttribute(node, "Currency");
        }
        if (this.xmlHasAttribute(node, "Exponent")) {
            this.exponent = (this.xmlGetAttribute(node, "Exponent") ? parseInt(this.xmlGetAttribute(node, "Exponent")) : 0);
        }
        return;
    }
    if (arguments.length != 0) {
        throw new Error("Invalid argument");
    }
};
timapi.protocol.sixml.AmountOther.prototype = Object.create(timapi.protocol.Container.prototype);
timapi.protocol.sixml.AmountOther.prototype.value = 0;
timapi.protocol.sixml.AmountOther.prototype.currency = undefined;
timapi.protocol.sixml.AmountOther.prototype.exponent = undefined;
timapi.protocol.sixml.AmountOther.prototype.toXmlNode = function () {
    var node = new timapi.protocol.XmlNode("sixml:AmountOther");
    node.textContent = timapi.utils.StringHelper.makeString(this.value);
    if (this.currency != undefined) {
        this.xmlSetAttribute(node, "Currency", this.currency);
    }
    if (this.exponent != undefined) {
        this.xmlSetAttribute(node, "Exponent", timapi.utils.StringHelper.makeString(this.exponent));
    }
    return node;
};
timapi.protocol.sixml.AmountSaldo = function (a) {
    if (arguments.length == 1 && a instanceof timapi.protocol.sixml.AmountSaldo) {
        var value = a;
        this.value = value.value;
        this.currency = value.currency;
        this.exponent = value.exponent;
        return;
    }
    if (arguments.length == 1 && a instanceof timapi.protocol.XmlNode) {
        var node = a;
        this.value = (node.textContent ? parseInt(node.textContent) : 0);
        if (this.xmlHasAttribute(node, "Currency")) {
            this.currency = this.xmlGetAttribute(node, "Currency");
        }
        if (this.xmlHasAttribute(node, "Exponent")) {
            this.exponent = (this.xmlGetAttribute(node, "Exponent") ? parseInt(this.xmlGetAttribute(node, "Exponent")) : 0);
        }
        return;
    }
    if (arguments.length != 0) {
        throw new Error("Invalid argument");
    }
};
timapi.protocol.sixml.AmountSaldo.prototype = Object.create(timapi.protocol.Container.prototype);
timapi.protocol.sixml.AmountSaldo.prototype.value = 0;
timapi.protocol.sixml.AmountSaldo.prototype.currency = undefined;
timapi.protocol.sixml.AmountSaldo.prototype.exponent = undefined;
timapi.protocol.sixml.AmountSaldo.prototype.toXmlNode = function () {
    var node = new timapi.protocol.XmlNode("sixml:AmountSaldo");
    node.textContent = timapi.utils.StringHelper.makeString(this.value);
    if (this.currency != undefined) {
        this.xmlSetAttribute(node, "Currency", this.currency);
    }
    if (this.exponent != undefined) {
        this.xmlSetAttribute(node, "Exponent", timapi.utils.StringHelper.makeString(this.exponent));
    }
    return node;
};
timapi.protocol.sixml.AmountTax = function (a) {
    if (arguments.length == 1 && a instanceof timapi.protocol.sixml.AmountTax) {
        var value = a;
        this.value = value.value;
        this.currency = value.currency;
        this.exponent = value.exponent;
        return;
    }
    if (arguments.length == 1 && a instanceof timapi.protocol.XmlNode) {
        var node = a;
        this.value = (node.textContent ? parseInt(node.textContent) : 0);
        if (this.xmlHasAttribute(node, "Currency")) {
            this.currency = this.xmlGetAttribute(node, "Currency");
        }
        if (this.xmlHasAttribute(node, "Exponent")) {
            this.exponent = (this.xmlGetAttribute(node, "Exponent") ? parseInt(this.xmlGetAttribute(node, "Exponent")) : 0);
        }
        return;
    }
    if (arguments.length != 0) {
        throw new Error("Invalid argument");
    }
};
timapi.protocol.sixml.AmountTax.prototype = Object.create(timapi.protocol.Container.prototype);
timapi.protocol.sixml.AmountTax.prototype.value = 0;
timapi.protocol.sixml.AmountTax.prototype.currency = undefined;
timapi.protocol.sixml.AmountTax.prototype.exponent = undefined;
timapi.protocol.sixml.AmountTax.prototype.toXmlNode = function () {
    var node = new timapi.protocol.XmlNode("sixml:AmountTax");
    node.textContent = timapi.utils.StringHelper.makeString(this.value);
    if (this.currency != undefined) {
        this.xmlSetAttribute(node, "Currency", this.currency);
    }
    if (this.exponent != undefined) {
        this.xmlSetAttribute(node, "Exponent", timapi.utils.StringHelper.makeString(this.exponent));
    }
    return node;
};
timapi.protocol.sixml.AmountTip = function (a) {
    if (arguments.length == 1 && a instanceof timapi.protocol.sixml.AmountTip) {
        var value = a;
        this.value = value.value;
        this.currency = value.currency;
        this.exponent = value.exponent;
        return;
    }
    if (arguments.length == 1 && a instanceof timapi.protocol.XmlNode) {
        var node = a;
        this.value = (node.textContent ? parseInt(node.textContent) : 0);
        if (this.xmlHasAttribute(node, "Currency")) {
            this.currency = this.xmlGetAttribute(node, "Currency");
        }
        if (this.xmlHasAttribute(node, "Exponent")) {
            this.exponent = (this.xmlGetAttribute(node, "Exponent") ? parseInt(this.xmlGetAttribute(node, "Exponent")) : 0);
        }
        return;
    }
    if (arguments.length != 0) {
        throw new Error("Invalid argument");
    }
};
timapi.protocol.sixml.AmountTip.prototype = Object.create(timapi.protocol.Container.prototype);
timapi.protocol.sixml.AmountTip.prototype.value = 0;
timapi.protocol.sixml.AmountTip.prototype.currency = undefined;
timapi.protocol.sixml.AmountTip.prototype.exponent = undefined;
timapi.protocol.sixml.AmountTip.prototype.toXmlNode = function () {
    var node = new timapi.protocol.XmlNode("sixml:AmountTip");
    node.textContent = timapi.utils.StringHelper.makeString(this.value);
    if (this.currency != undefined) {
        this.xmlSetAttribute(node, "Currency", this.currency);
    }
    if (this.exponent != undefined) {
        this.xmlSetAttribute(node, "Exponent", timapi.utils.StringHelper.makeString(this.exponent));
    }
    return node;
};
timapi.protocol.sixml.AmountTotal = function (a) {
    if (arguments.length == 1 && a instanceof timapi.protocol.sixml.AmountTotal) {
        var value = a;
        this.value = value.value;
        this.currency = value.currency;
        this.exponent = value.exponent;
        return;
    }
    if (arguments.length == 1 && a instanceof timapi.protocol.XmlNode) {
        var node = a;
        this.value = (node.textContent ? parseInt(node.textContent) : 0);
        if (this.xmlHasAttribute(node, "Currency")) {
            this.currency = this.xmlGetAttribute(node, "Currency");
        }
        if (this.xmlHasAttribute(node, "Exponent")) {
            this.exponent = (this.xmlGetAttribute(node, "Exponent") ? parseInt(this.xmlGetAttribute(node, "Exponent")) : 0);
        }
        return;
    }
    if (arguments.length != 0) {
        throw new Error("Invalid argument");
    }
};
timapi.protocol.sixml.AmountTotal.prototype = Object.create(timapi.protocol.Container.prototype);
timapi.protocol.sixml.AmountTotal.prototype.value = 0;
timapi.protocol.sixml.AmountTotal.prototype.currency = undefined;
timapi.protocol.sixml.AmountTotal.prototype.exponent = undefined;
timapi.protocol.sixml.AmountTotal.prototype.toXmlNode = function () {
    var node = new timapi.protocol.XmlNode("sixml:AmountTotal");
    node.textContent = timapi.utils.StringHelper.makeString(this.value);
    if (this.currency != undefined) {
        this.xmlSetAttribute(node, "Currency", this.currency);
    }
    if (this.exponent != undefined) {
        this.xmlSetAttribute(node, "Exponent", timapi.utils.StringHelper.makeString(this.exponent));
    }
    return node;
};
timapi.protocol.sixml.Application = function (a) {
    if (arguments.length == 1 && a instanceof timapi.protocol.sixml.Application) {
        var value = a;
        this.aid = value.aid;
        this.applicationLabel = value.applicationLabel;
        return;
    }
    if (arguments.length == 1 && a instanceof timapi.protocol.XmlNode) {
        var node = a;
        if (this.xmlHasAttribute(node, "Aid")) {
            this.aid = this.xmlGetAttribute(node, "Aid");
        }
        if (this.xmlHasAttribute(node, "ApplicationLabel")) {
            this.applicationLabel = this.xmlGetAttribute(node, "ApplicationLabel");
        }
        return;
    }
    if (arguments.length != 0) {
        throw new Error("Invalid argument");
    }
};
timapi.protocol.sixml.Application.prototype = Object.create(timapi.protocol.Container.prototype);
timapi.protocol.sixml.Application.prototype.aid = undefined;
timapi.protocol.sixml.Application.prototype.applicationLabel = undefined;
timapi.protocol.sixml.Application.prototype.toXmlNode = function () {
    var node = new timapi.protocol.XmlNode("sixml:Application");
    if (this.aid != undefined) {
        this.xmlSetAttribute(node, "Aid", this.aid);
    }
    if (this.applicationLabel != undefined) {
        this.xmlSetAttribute(node, "ApplicationLabel", this.applicationLabel);
    }
    return node;
};
timapi.protocol.sixml.Basket = function (a) {
    this.item = [];
    if (arguments.length == 1 && a instanceof timapi.protocol.sixml.Basket) {
        var value = a;
        for (var each of value.item) {
            this.item.push(each ? new timapi.protocol.sixml.Item(each) : undefined);
        }
        this.loyaltyAuthResult = value.loyaltyAuthResult;
        return;
    }
    if (arguments.length == 1 && a instanceof timapi.protocol.XmlNode) {
        var node = a;
        for (var each of this.xmlGetChildren(node, "sixml:Item")) {
            this.item.push(new timapi.protocol.sixml.Item(each));
        }
        if (this.xmlHasChild(node, "sixml:LoyaltyAuthResult")) {
            this.loyaltyAuthResult = (this.xmlGetChild(node, "sixml:LoyaltyAuthResult").textContent ? parseInt(this.xmlGetChild(node, "sixml:LoyaltyAuthResult").textContent) : 0);
        }
        return;
    }
    if (arguments.length != 0) {
        throw new Error("Invalid argument");
    }
};
timapi.protocol.sixml.Basket.prototype = Object.create(timapi.protocol.Container.prototype);
timapi.protocol.sixml.Basket.prototype.item = undefined;
timapi.protocol.sixml.Basket.prototype.loyaltyAuthResult = undefined;
timapi.protocol.sixml.Basket.prototype.toXmlNode = function () {
    var node = new timapi.protocol.XmlNode("sixml:Basket");
    for (var each of this.item) {
        this.xmlAddChild(node, "sixml:Item", each);
    }
    if (this.loyaltyAuthResult != undefined) {
        this.xmlAddChild(node, "sixml:LoyaltyAuthResult", timapi.utils.StringHelper.makeString(this.loyaltyAuthResult));
    }
    return node;
};
timapi.protocol.sixml.Brand = function (a) {
    this.application = [];
    if (arguments.length == 1 && a instanceof timapi.protocol.sixml.Brand) {
        var value = a;
        this.brandName = value.brandName;
        this.dccAvailable = value.dccAvailable;
        this.paymentProtocol = value.paymentProtocol;
        this.acqId = value.acqId;
        this.lastInitDate = value.lastInitDate;
        for (var each of value.application) {
            this.application.push(each ? new timapi.protocol.sixml.Application(each) : undefined);
        }
        this.currencyList = value.currencyList ? new timapi.protocol.sixml.CurrencyList(value.currencyList) : undefined;
        return;
    }
    if (arguments.length == 1 && a instanceof timapi.protocol.XmlNode) {
        var node = a;
        if (this.xmlHasAttribute(node, "BrandName")) {
            this.brandName = this.xmlGetAttribute(node, "BrandName");
        }
        if (this.xmlHasAttribute(node, "DccAvailable")) {
            this.dccAvailable = this.xmlGetAttribute(node, "DccAvailable") == "1";
        }
        if (this.xmlHasAttribute(node, "PaymentProtocol")) {
            this.paymentProtocol = this.xmlGetAttribute(node, "PaymentProtocol");
        }
        if (this.xmlHasAttribute(node, "AcqId")) {
            this.acqId = (this.xmlGetAttribute(node, "AcqId") ? parseInt(this.xmlGetAttribute(node, "AcqId")) : 0);
        }
        if (this.xmlHasAttribute(node, "LastInitDate")) {
            this.lastInitDate = new timapi.protocol.TimeDate("yyyyMMdd'T'HHmmssZ", this.xmlGetAttribute(node, "LastInitDate"));
        }
        for (var each of this.xmlGetChildren(node, "sixml:Application")) {
            this.application.push(new timapi.protocol.sixml.Application(each));
        }
        if (this.xmlHasChild(node, "sixml:CurrencyList")) {
            this.currencyList = new timapi.protocol.sixml.CurrencyList(this.xmlGetChild(node, "sixml:CurrencyList"));
        }
        return;
    }
    if (arguments.length != 0) {
        throw new Error("Invalid argument");
    }
};
timapi.protocol.sixml.Brand.prototype = Object.create(timapi.protocol.Container.prototype);
timapi.protocol.sixml.Brand.prototype.brandName = undefined;
timapi.protocol.sixml.Brand.prototype.dccAvailable = undefined;
timapi.protocol.sixml.Brand.prototype.paymentProtocol = undefined;
timapi.protocol.sixml.Brand.prototype.acqId = undefined;
timapi.protocol.sixml.Brand.prototype.lastInitDate = undefined;
timapi.protocol.sixml.Brand.prototype.application = undefined;
timapi.protocol.sixml.Brand.prototype.currencyList = undefined;
timapi.protocol.sixml.Brand.prototype.toXmlNode = function () {
    var node = new timapi.protocol.XmlNode("sixml:Brand");
    if (this.brandName != undefined) {
        this.xmlSetAttribute(node, "BrandName", this.brandName);
    }
    if (this.dccAvailable != undefined) {
        this.xmlSetAttribute(node, "DccAvailable", (this.dccAvailable ? "1" : "0"));
    }
    if (this.paymentProtocol != undefined) {
        this.xmlSetAttribute(node, "PaymentProtocol", this.paymentProtocol);
    }
    if (this.acqId != undefined) {
        this.xmlSetAttribute(node, "AcqId", timapi.utils.StringHelper.makeString(this.acqId));
    }
    if (this.lastInitDate != undefined) {
        this.xmlSetAttribute(node, "LastInitDate", this.lastInitDate.format("yyyyMMdd'T'HHmmssZ"));
    }
    for (var each of this.application) {
        this.xmlAddChild(node, "sixml:Application", each);
    }
    if (this.currencyList != undefined) {
        this.xmlAddChild(node, "sixml:CurrencyList", this.currencyList);
    }
    return node;
};
timapi.protocol.sixml.BrandBar = function (a) {
    if (arguments.length == 1 && a instanceof timapi.protocol.sixml.BrandBar) {
        var value = a;
        this.value = value.value;
        this.brandMode = value.brandMode;
        return;
    }
    if (arguments.length == 1 && a instanceof timapi.protocol.XmlNode) {
        var node = a;
        this.value = node.textContent;
        if (this.xmlHasAttribute(node, "BrandMode")) {
            this.brandMode = this.xmlGetAttribute(node, "BrandMode");
        }
        return;
    }
    if (arguments.length != 0) {
        throw new Error("Invalid argument");
    }
};
timapi.protocol.sixml.BrandBar.prototype = Object.create(timapi.protocol.Container.prototype);
timapi.protocol.sixml.BrandBar.prototype.value = "";
timapi.protocol.sixml.BrandBar.prototype.brandMode = undefined;
timapi.protocol.sixml.BrandBar.prototype.toXmlNode = function () {
    var node = new timapi.protocol.XmlNode("sixml:BrandBar");
    node.textContent = this.value;
    if (this.brandMode != undefined) {
        this.xmlSetAttribute(node, "BrandMode", this.brandMode);
    }
    return node;
};
timapi.protocol.sixml.BrandList = function (a) {
    this.brand = [];
    if (arguments.length == 1 && a instanceof timapi.protocol.sixml.BrandList) {
        var value = a;
        for (var each of value.brand) {
            this.brand.push(each ? new timapi.protocol.sixml.Brand(each) : undefined);
        }
        return;
    }
    if (arguments.length == 1 && a instanceof timapi.protocol.XmlNode) {
        var node = a;
        for (var each of this.xmlGetChildren(node, "sixml:Brand")) {
            this.brand.push(new timapi.protocol.sixml.Brand(each));
        }
        return;
    }
    if (arguments.length != 0) {
        throw new Error("Invalid argument");
    }
};
timapi.protocol.sixml.BrandList.prototype = Object.create(timapi.protocol.Container.prototype);
timapi.protocol.sixml.BrandList.prototype.brand = undefined;
timapi.protocol.sixml.BrandList.prototype.toXmlNode = function () {
    var node = new timapi.protocol.XmlNode("sixml:BrandList");
    for (var each of this.brand) {
        this.xmlAddChild(node, "sixml:Brand", each);
    }
    return node;
};
timapi.protocol.sixml.CardData = function (a) {
    this.cardTrackData = [];
    if (arguments.length == 1 && a instanceof timapi.protocol.sixml.CardData) {
        var value = a;
        this.posEntryMode = value.posEntryMode;
        this.aid = value.aid;
        this.acc = value.acc;
        this.cardNumber = value.cardNumber;
        this.cardNumberPrintable = value.cardNumberPrintable;
        this.cardNumberPrintableCardholder = value.cardNumberPrintableCardholder;
        this.cardNumberEnc = value.cardNumberEnc;
        this.cardNumberEncKeyIndex = value.cardNumberEncKeyIndex;
        this.cardExpiryDate = value.cardExpiryDate;
        this.brandName = value.brandName;
        this.tenderName = value.tenderName;
        this.cardRef = value.cardRef;
        this.cardCountryCode = value.cardCountryCode;
        this.terminalCountryCode = value.terminalCountryCode;
        this.uid = value.uid;
        for (var each of value.cardTrackData) {
            this.cardTrackData.push(each ? new timapi.protocol.sixml.CardTrackData(each) : undefined);
        }
        this.loyaltyInformationList = value.loyaltyInformationList ? new timapi.protocol.sixml.LoyaltyInformationList(value.loyaltyInformationList) : undefined;
        this.processingDisposition = value.processingDisposition;
        this.cardType = value.cardType;
        this.cardholder = value.cardholder;
        this.language = value.language;
        return;
    }
    if (arguments.length == 1 && a instanceof timapi.protocol.XmlNode) {
        var node = a;
        if (this.xmlHasAttribute(node, "PosEntryMode")) {
            this.posEntryMode = (this.xmlGetAttribute(node, "PosEntryMode") ? parseInt(this.xmlGetAttribute(node, "PosEntryMode")) : 0);
        }
        if (this.xmlHasAttribute(node, "Aid")) {
            this.aid = this.xmlGetAttribute(node, "Aid");
        }
        if (this.xmlHasAttribute(node, "Acc")) {
            this.acc = this.xmlGetAttribute(node, "Acc");
        }
        if (this.xmlHasAttribute(node, "CardNumber")) {
            this.cardNumber = this.xmlGetAttribute(node, "CardNumber");
        }
        if (this.xmlHasAttribute(node, "CardNumberPrintable")) {
            this.cardNumberPrintable = this.xmlGetAttribute(node, "CardNumberPrintable");
        }
        if (this.xmlHasAttribute(node, "CardNumberPrintableCardholder")) {
            this.cardNumberPrintableCardholder = this.xmlGetAttribute(node, "CardNumberPrintableCardholder");
        }
        if (this.xmlHasAttribute(node, "CardNumberEnc")) {
            this.cardNumberEnc = timapi.ConversionHelper.hexStringToByte(this.xmlGetAttribute(node, "CardNumberEnc"));
        }
        if (this.xmlHasAttribute(node, "CardNumberEncKeyIndex")) {
            this.cardNumberEncKeyIndex = (this.xmlGetAttribute(node, "CardNumberEncKeyIndex") ? parseInt(this.xmlGetAttribute(node, "CardNumberEncKeyIndex")) : 0);
        }
        if (this.xmlHasAttribute(node, "CardExpiryDate")) {
            this.cardExpiryDate = new timapi.protocol.TimeDate("MMyy", this.xmlGetAttribute(node, "CardExpiryDate"));
        }
        if (this.xmlHasAttribute(node, "BrandName")) {
            this.brandName = this.xmlGetAttribute(node, "BrandName");
        }
        if (this.xmlHasAttribute(node, "TenderName")) {
            this.tenderName = this.xmlGetAttribute(node, "TenderName");
        }
        if (this.xmlHasAttribute(node, "CardRef")) {
            this.cardRef = this.xmlGetAttribute(node, "CardRef");
        }
        if (this.xmlHasAttribute(node, "CardCountryCode")) {
            this.cardCountryCode = (this.xmlGetAttribute(node, "CardCountryCode") ? parseInt(this.xmlGetAttribute(node, "CardCountryCode")) : 0);
        }
        if (this.xmlHasAttribute(node, "TerminalCountryCode")) {
            this.terminalCountryCode = (this.xmlGetAttribute(node, "TerminalCountryCode") ? parseInt(this.xmlGetAttribute(node, "TerminalCountryCode")) : 0);
        }
        if (this.xmlHasAttribute(node, "Uid")) {
            this.uid = this.xmlGetAttribute(node, "Uid");
        }
        for (var each of this.xmlGetChildren(node, "sixml:CardTrackData")) {
            this.cardTrackData.push(new timapi.protocol.sixml.CardTrackData(each));
        }
        if (this.xmlHasChild(node, "sixml:LoyaltyInformationList")) {
            this.loyaltyInformationList = new timapi.protocol.sixml.LoyaltyInformationList(this.xmlGetChild(node, "sixml:LoyaltyInformationList"));
        }
        if (this.xmlHasAttribute(node, "ProcessingDisposition")) {
            this.processingDisposition = this.xmlGetAttribute(node, "ProcessingDisposition");
        }
        if (this.xmlHasAttribute(node, "CardType")) {
            this.cardType = (this.xmlGetAttribute(node, "CardType") ? parseInt(this.xmlGetAttribute(node, "CardType")) : 0);
        }
        if (this.xmlHasAttribute(node, "Cardholder")) {
            this.cardholder = this.xmlGetAttribute(node, "Cardholder");
        }
        if (this.xmlHasChild(node, "sixml:Language")) {
            this.language = this.xmlGetChild(node, "sixml:Language").textContent;
        }
        return;
    }
    if (arguments.length != 0) {
        throw new Error("Invalid argument");
    }
};
timapi.protocol.sixml.CardData.prototype = Object.create(timapi.protocol.Container.prototype);
timapi.protocol.sixml.CardData.prototype.posEntryMode = undefined;
timapi.protocol.sixml.CardData.prototype.aid = undefined;
timapi.protocol.sixml.CardData.prototype.acc = undefined;
timapi.protocol.sixml.CardData.prototype.cardNumber = undefined;
timapi.protocol.sixml.CardData.prototype.cardNumberPrintable = undefined;
timapi.protocol.sixml.CardData.prototype.cardNumberPrintableCardholder = undefined;
timapi.protocol.sixml.CardData.prototype.cardNumberEnc = undefined;
timapi.protocol.sixml.CardData.prototype.cardNumberEncKeyIndex = undefined;
timapi.protocol.sixml.CardData.prototype.cardExpiryDate = undefined;
timapi.protocol.sixml.CardData.prototype.brandName = undefined;
timapi.protocol.sixml.CardData.prototype.tenderName = undefined;
timapi.protocol.sixml.CardData.prototype.cardRef = undefined;
timapi.protocol.sixml.CardData.prototype.cardCountryCode = undefined;
timapi.protocol.sixml.CardData.prototype.terminalCountryCode = undefined;
timapi.protocol.sixml.CardData.prototype.uid = undefined;
timapi.protocol.sixml.CardData.prototype.cardTrackData = undefined;
timapi.protocol.sixml.CardData.prototype.loyaltyInformationList = undefined;
timapi.protocol.sixml.CardData.prototype.processingDisposition = undefined;
timapi.protocol.sixml.CardData.prototype.cardType = undefined;
timapi.protocol.sixml.CardData.prototype.cardholder = undefined;
timapi.protocol.sixml.CardData.prototype.language = undefined;
timapi.protocol.sixml.CardData.prototype.toXmlNode = function () {
    var node = new timapi.protocol.XmlNode("sixml:CardData");
    if (this.posEntryMode != undefined) {
        this.xmlSetAttribute(node, "PosEntryMode", timapi.utils.StringHelper.makeString(this.posEntryMode));
    }
    if (this.aid != undefined) {
        this.xmlSetAttribute(node, "Aid", this.aid);
    }
    if (this.acc != undefined) {
        this.xmlSetAttribute(node, "Acc", this.acc);
    }
    if (this.cardNumber != undefined) {
        this.xmlSetAttribute(node, "CardNumber", this.cardNumber);
    }
    if (this.cardNumberPrintable != undefined) {
        this.xmlSetAttribute(node, "CardNumberPrintable", this.cardNumberPrintable);
    }
    if (this.cardNumberPrintableCardholder != undefined) {
        this.xmlSetAttribute(node, "CardNumberPrintableCardholder", this.cardNumberPrintableCardholder);
    }
    if (this.cardNumberEnc != undefined) {
        this.xmlSetAttribute(node, "CardNumberEnc", timapi.protocol.ConversionHelper.byteToHexString(this.cardNumberEnc));
    }
    if (this.cardNumberEncKeyIndex != undefined) {
        this.xmlSetAttribute(node, "CardNumberEncKeyIndex", timapi.utils.StringHelper.makeString(this.cardNumberEncKeyIndex));
    }
    if (this.cardExpiryDate != undefined) {
        this.xmlSetAttribute(node, "CardExpiryDate", this.cardExpiryDate.format("MMyy"));
    }
    if (this.brandName != undefined) {
        this.xmlSetAttribute(node, "BrandName", this.brandName);
    }
    if (this.tenderName != undefined) {
        this.xmlSetAttribute(node, "TenderName", this.tenderName);
    }
    if (this.cardRef != undefined) {
        this.xmlSetAttribute(node, "CardRef", this.cardRef);
    }
    if (this.cardCountryCode != undefined) {
        this.xmlSetAttribute(node, "CardCountryCode", timapi.utils.StringHelper.makeString(this.cardCountryCode));
    }
    if (this.terminalCountryCode != undefined) {
        this.xmlSetAttribute(node, "TerminalCountryCode", timapi.utils.StringHelper.makeString(this.terminalCountryCode));
    }
    if (this.uid != undefined) {
        this.xmlSetAttribute(node, "Uid", this.uid);
    }
    for (var each of this.cardTrackData) {
        this.xmlAddChild(node, "sixml:CardTrackData", each);
    }
    if (this.loyaltyInformationList != undefined) {
        this.xmlAddChild(node, "sixml:LoyaltyInformationList", this.loyaltyInformationList);
    }
    if (this.processingDisposition != undefined) {
        this.xmlSetAttribute(node, "ProcessingDisposition", this.processingDisposition);
    }
    if (this.cardType != undefined) {
        this.xmlSetAttribute(node, "CardType", timapi.utils.StringHelper.makeString(this.cardType));
    }
    if (this.cardholder != undefined) {
        this.xmlSetAttribute(node, "Cardholder", this.cardholder);
    }
    if (this.language != undefined) {
        this.xmlAddChild(node, "sixml:Language", this.language);
    }
    return node;
};
timapi.protocol.sixml.CardTrackData = function (a) {
    if (arguments.length == 1 && a instanceof timapi.protocol.sixml.CardTrackData) {
        var value = a;
        this.value = value.value;
        this.trackNum = value.trackNum;
        return;
    }
    if (arguments.length == 1 && a instanceof timapi.protocol.XmlNode) {
        var node = a;
        this.value = node.textContent;
        if (this.xmlHasAttribute(node, "TrackNum")) {
            this.trackNum = (this.xmlGetAttribute(node, "TrackNum") ? parseInt(this.xmlGetAttribute(node, "TrackNum")) : 0);
        }
        return;
    }
    if (arguments.length != 0) {
        throw new Error("Invalid argument");
    }
};
timapi.protocol.sixml.CardTrackData.prototype = Object.create(timapi.protocol.Container.prototype);
timapi.protocol.sixml.CardTrackData.prototype.value = "";
timapi.protocol.sixml.CardTrackData.prototype.trackNum = undefined;
timapi.protocol.sixml.CardTrackData.prototype.toXmlNode = function () {
    var node = new timapi.protocol.XmlNode("sixml:CardTrackData");
    node.textContent = this.value;
    if (this.trackNum != undefined) {
        this.xmlSetAttribute(node, "TrackNum", timapi.utils.StringHelper.makeString(this.trackNum));
    }
    return node;
};
timapi.protocol.sixml.ConfigData = function (a) {
    this.receiptHeader = [];
    if (arguments.length == 1 && a instanceof timapi.protocol.sixml.ConfigData) {
        var value = a;
        for (var each of value.receiptHeader) {
            this.receiptHeader.push(each ? new timapi.protocol.sixml.ReceiptHeader(each) : undefined);
        }
        this.language = value.language;
        return;
    }
    if (arguments.length == 1 && a instanceof timapi.protocol.XmlNode) {
        var node = a;
        for (var each of this.xmlGetChildren(node, "sixml:ReceiptHeader")) {
            this.receiptHeader.push(new timapi.protocol.sixml.ReceiptHeader(each));
        }
        if (this.xmlHasChild(node, "sixml:Language")) {
            this.language = this.xmlGetChild(node, "sixml:Language").textContent;
        }
        return;
    }
    if (arguments.length != 0) {
        throw new Error("Invalid argument");
    }
};
timapi.protocol.sixml.ConfigData.prototype = Object.create(timapi.protocol.Container.prototype);
timapi.protocol.sixml.ConfigData.prototype.receiptHeader = undefined;
timapi.protocol.sixml.ConfigData.prototype.language = undefined;
timapi.protocol.sixml.ConfigData.prototype.toXmlNode = function () {
    var node = new timapi.protocol.XmlNode("sixml:ConfigData");
    for (var each of this.receiptHeader) {
        this.xmlAddChild(node, "sixml:ReceiptHeader", each);
    }
    if (this.language != undefined) {
        this.xmlAddChild(node, "sixml:Language", this.language);
    }
    return node;
};
timapi.protocol.sixml.Counter = function (a) {
    this.total = [];
    if (arguments.length == 1 && a instanceof timapi.protocol.sixml.Counter) {
        var value = a;
        this.brandName = value.brandName;
        this.paymentProtocol = value.paymentProtocol;
        this.acqId = value.acqId;
        this.count = value.count;
        this.countDcc = value.countDcc;
        this.countForeign = value.countForeign;
        for (var each of value.total) {
            this.total.push(each ? new timapi.protocol.sixml.Total(each) : undefined);
        }
        return;
    }
    if (arguments.length == 1 && a instanceof timapi.protocol.XmlNode) {
        var node = a;
        if (this.xmlHasAttribute(node, "BrandName")) {
            this.brandName = this.xmlGetAttribute(node, "BrandName");
        }
        if (this.xmlHasAttribute(node, "PaymentProtocol")) {
            this.paymentProtocol = this.xmlGetAttribute(node, "PaymentProtocol");
        }
        if (this.xmlHasAttribute(node, "AcqId")) {
            this.acqId = (this.xmlGetAttribute(node, "AcqId") ? parseInt(this.xmlGetAttribute(node, "AcqId")) : 0);
        }
        if (this.xmlHasAttribute(node, "Count")) {
            this.count = (this.xmlGetAttribute(node, "Count") ? parseInt(this.xmlGetAttribute(node, "Count")) : 0);
        }
        if (this.xmlHasAttribute(node, "CountDcc")) {
            this.countDcc = (this.xmlGetAttribute(node, "CountDcc") ? parseInt(this.xmlGetAttribute(node, "CountDcc")) : 0);
        }
        if (this.xmlHasAttribute(node, "CountForeign")) {
            this.countForeign = (this.xmlGetAttribute(node, "CountForeign") ? parseInt(this.xmlGetAttribute(node, "CountForeign")) : 0);
        }
        for (var each of this.xmlGetChildren(node, "sixml:Total")) {
            this.total.push(new timapi.protocol.sixml.Total(each));
        }
        return;
    }
    if (arguments.length != 0) {
        throw new Error("Invalid argument");
    }
};
timapi.protocol.sixml.Counter.prototype = Object.create(timapi.protocol.Container.prototype);
timapi.protocol.sixml.Counter.prototype.brandName = undefined;
timapi.protocol.sixml.Counter.prototype.paymentProtocol = undefined;
timapi.protocol.sixml.Counter.prototype.acqId = undefined;
timapi.protocol.sixml.Counter.prototype.count = undefined;
timapi.protocol.sixml.Counter.prototype.countDcc = undefined;
timapi.protocol.sixml.Counter.prototype.countForeign = undefined;
timapi.protocol.sixml.Counter.prototype.total = undefined;
timapi.protocol.sixml.Counter.prototype.toXmlNode = function () {
    var node = new timapi.protocol.XmlNode("sixml:Counter");
    if (this.brandName != undefined) {
        this.xmlSetAttribute(node, "BrandName", this.brandName);
    }
    if (this.paymentProtocol != undefined) {
        this.xmlSetAttribute(node, "PaymentProtocol", this.paymentProtocol);
    }
    if (this.acqId != undefined) {
        this.xmlSetAttribute(node, "AcqId", timapi.utils.StringHelper.makeString(this.acqId));
    }
    if (this.count != undefined) {
        this.xmlSetAttribute(node, "Count", timapi.utils.StringHelper.makeString(this.count));
    }
    if (this.countDcc != undefined) {
        this.xmlSetAttribute(node, "CountDcc", timapi.utils.StringHelper.makeString(this.countDcc));
    }
    if (this.countForeign != undefined) {
        this.xmlSetAttribute(node, "CountForeign", timapi.utils.StringHelper.makeString(this.countForeign));
    }
    for (var each of this.total) {
        this.xmlAddChild(node, "sixml:Total", each);
    }
    return node;
};
timapi.protocol.sixml.Counters = function (a) {
    this.counter = [];
    if (arguments.length == 1 && a instanceof timapi.protocol.sixml.Counters) {
        var value = a;
        this.counterType = value.counterType;
        this.actSeqCounter = value.actSeqCounter;
        this.periodSeqCounter = value.periodSeqCounter;
        for (var each of value.counter) {
            this.counter.push(each ? new timapi.protocol.sixml.Counter(each) : undefined);
        }
        return;
    }
    if (arguments.length == 1 && a instanceof timapi.protocol.XmlNode) {
        var node = a;
        if (this.xmlHasAttribute(node, "CounterType")) {
            this.counterType = this.xmlGetAttribute(node, "CounterType");
        }
        if (this.xmlHasAttribute(node, "ActSeqCounter")) {
            this.actSeqCounter = (this.xmlGetAttribute(node, "ActSeqCounter") ? parseInt(this.xmlGetAttribute(node, "ActSeqCounter")) : 0);
        }
        if (this.xmlHasAttribute(node, "PeriodSeqCounter")) {
            this.periodSeqCounter = (this.xmlGetAttribute(node, "PeriodSeqCounter") ? parseInt(this.xmlGetAttribute(node, "PeriodSeqCounter")) : 0);
        }
        for (var each of this.xmlGetChildren(node, "sixml:Counter")) {
            this.counter.push(new timapi.protocol.sixml.Counter(each));
        }
        return;
    }
    if (arguments.length != 0) {
        throw new Error("Invalid argument");
    }
};
timapi.protocol.sixml.Counters.prototype = Object.create(timapi.protocol.Container.prototype);
timapi.protocol.sixml.Counters.prototype.counterType = undefined;
timapi.protocol.sixml.Counters.prototype.actSeqCounter = undefined;
timapi.protocol.sixml.Counters.prototype.periodSeqCounter = undefined;
timapi.protocol.sixml.Counters.prototype.counter = undefined;
timapi.protocol.sixml.Counters.prototype.toXmlNode = function () {
    var node = new timapi.protocol.XmlNode("sixml:Counters");
    if (this.counterType != undefined) {
        this.xmlSetAttribute(node, "CounterType", this.counterType);
    }
    if (this.actSeqCounter != undefined) {
        this.xmlSetAttribute(node, "ActSeqCounter", timapi.utils.StringHelper.makeString(this.actSeqCounter));
    }
    if (this.periodSeqCounter != undefined) {
        this.xmlSetAttribute(node, "PeriodSeqCounter", timapi.utils.StringHelper.makeString(this.periodSeqCounter));
    }
    for (var each of this.counter) {
        this.xmlAddChild(node, "sixml:Counter", each);
    }
    return node;
};
timapi.protocol.sixml.CurrencyItem = function (a) {
    if (arguments.length == 1 && a instanceof timapi.protocol.sixml.CurrencyItem) {
        var value = a;
        this.value = value.value;
        this.currencyType = value.currencyType;
        return;
    }
    if (arguments.length == 1 && a instanceof timapi.protocol.XmlNode) {
        var node = a;
        this.value = node.textContent;
        if (this.xmlHasAttribute(node, "CurrencyType")) {
            this.currencyType = this.xmlGetAttribute(node, "CurrencyType");
        }
        return;
    }
    if (arguments.length != 0) {
        throw new Error("Invalid argument");
    }
};
timapi.protocol.sixml.CurrencyItem.prototype = Object.create(timapi.protocol.Container.prototype);
timapi.protocol.sixml.CurrencyItem.prototype.value = "";
timapi.protocol.sixml.CurrencyItem.prototype.currencyType = undefined;
timapi.protocol.sixml.CurrencyItem.prototype.toXmlNode = function () {
    var node = new timapi.protocol.XmlNode("sixml:CurrencyItem");
    node.textContent = this.value;
    if (this.currencyType != undefined) {
        this.xmlSetAttribute(node, "CurrencyType", this.currencyType);
    }
    return node;
};
timapi.protocol.sixml.CurrencyList = function (a) {
    this.currencyItem = [];
    if (arguments.length == 1 && a instanceof timapi.protocol.sixml.CurrencyList) {
        var value = a;
        for (var each of value.currencyItem) {
            this.currencyItem.push(each ? new timapi.protocol.sixml.CurrencyItem(each) : undefined);
        }
        return;
    }
    if (arguments.length == 1 && a instanceof timapi.protocol.XmlNode) {
        var node = a;
        for (var each of this.xmlGetChildren(node, "sixml:CurrencyItem")) {
            this.currencyItem.push(new timapi.protocol.sixml.CurrencyItem(each));
        }
        return;
    }
    if (arguments.length != 0) {
        throw new Error("Invalid argument");
    }
};
timapi.protocol.sixml.CurrencyList.prototype = Object.create(timapi.protocol.Container.prototype);
timapi.protocol.sixml.CurrencyList.prototype.currencyItem = undefined;
timapi.protocol.sixml.CurrencyList.prototype.toXmlNode = function () {
    var node = new timapi.protocol.XmlNode("sixml:CurrencyList");
    for (var each of this.currencyItem) {
        this.xmlAddChild(node, "sixml:CurrencyItem", each);
    }
    return node;
};
timapi.protocol.sixml.DisplayContent = function (a) {
    this.displayLine = [];
    if (arguments.length == 1 && a instanceof timapi.protocol.sixml.DisplayContent) {
        var value = a;
        for (var each of value.displayLine) {
            this.displayLine.push(each ? new timapi.protocol.sixml.DisplayLine(each) : undefined);
        }
        return;
    }
    if (arguments.length == 1 && a instanceof timapi.protocol.XmlNode) {
        var node = a;
        for (var each of this.xmlGetChildren(node, "sixml:DisplayLine")) {
            this.displayLine.push(new timapi.protocol.sixml.DisplayLine(each));
        }
        return;
    }
    if (arguments.length != 0) {
        throw new Error("Invalid argument");
    }
};
timapi.protocol.sixml.DisplayContent.prototype = Object.create(timapi.protocol.Container.prototype);
timapi.protocol.sixml.DisplayContent.prototype.displayLine = undefined;
timapi.protocol.sixml.DisplayContent.prototype.toXmlNode = function () {
    var node = new timapi.protocol.XmlNode("sixml:DisplayContent");
    for (var each of this.displayLine) {
        this.xmlAddChild(node, "sixml:DisplayLine", each);
    }
    return node;
};
timapi.protocol.sixml.DisplayLine = function (a) {
    if (arguments.length == 1 && a instanceof timapi.protocol.sixml.DisplayLine) {
        var value = a;
        this.value = value.value;
        this.lineNum = value.lineNum;
        return;
    }
    if (arguments.length == 1 && a instanceof timapi.protocol.XmlNode) {
        var node = a;
        this.value = node.textContent;
        if (this.xmlHasAttribute(node, "LineNum")) {
            this.lineNum = (this.xmlGetAttribute(node, "LineNum") ? parseInt(this.xmlGetAttribute(node, "LineNum")) : 0);
        }
        return;
    }
    if (arguments.length != 0) {
        throw new Error("Invalid argument");
    }
};
timapi.protocol.sixml.DisplayLine.prototype = Object.create(timapi.protocol.Container.prototype);
timapi.protocol.sixml.DisplayLine.prototype.value = "";
timapi.protocol.sixml.DisplayLine.prototype.lineNum = undefined;
timapi.protocol.sixml.DisplayLine.prototype.toXmlNode = function () {
    var node = new timapi.protocol.XmlNode("sixml:DisplayLine");
    node.textContent = this.value;
    if (this.lineNum != undefined) {
        this.xmlSetAttribute(node, "LineNum", timapi.utils.StringHelper.makeString(this.lineNum));
    }
    return node;
};
timapi.protocol.sixml.EcrData = function (a) {
    this.ecrInfo = [];
    if (arguments.length == 1 && a instanceof timapi.protocol.sixml.EcrData) {
        var value = a;
        for (var each of value.ecrInfo) {
            this.ecrInfo.push(each ? new timapi.protocol.sixml.EcrInfo(each) : undefined);
        }
        return;
    }
    if (arguments.length == 1 && a instanceof timapi.protocol.XmlNode) {
        var node = a;
        for (var each of this.xmlGetChildren(node, "sixml:EcrInfo")) {
            this.ecrInfo.push(new timapi.protocol.sixml.EcrInfo(each));
        }
        return;
    }
    if (arguments.length != 0) {
        throw new Error("Invalid argument");
    }
};
timapi.protocol.sixml.EcrData.prototype = Object.create(timapi.protocol.Container.prototype);
timapi.protocol.sixml.EcrData.prototype.ecrInfo = undefined;
timapi.protocol.sixml.EcrData.prototype.toXmlNode = function () {
    var node = new timapi.protocol.XmlNode("sixml:EcrData");
    for (var each of this.ecrInfo) {
        this.xmlAddChild(node, "sixml:EcrInfo", each);
    }
    return node;
};
timapi.protocol.sixml.EcrInfo = function (a) {
    if (arguments.length == 1 && a instanceof timapi.protocol.sixml.EcrInfo) {
        var value = a;
        this.ecrInfoType = value.ecrInfoType;
        this.ecrInfoName = value.ecrInfoName;
        this.ecrInfoManufacturerName = value.ecrInfoManufacturerName;
        this.ecrInfoVers = value.ecrInfoVers;
        this.ecrInfoSerialNumber = value.ecrInfoSerialNumber;
        this.ecrInfoArchitecture = value.ecrInfoArchitecture;
        this.remoteIp = value.remoteIp;
        this.integratorSolution = value.integratorSolution;
        return;
    }
    if (arguments.length == 1 && a instanceof timapi.protocol.XmlNode) {
        var node = a;
        if (this.xmlHasAttribute(node, "EcrInfoType")) {
            this.ecrInfoType = this.xmlGetAttribute(node, "EcrInfoType");
        }
        if (this.xmlHasAttribute(node, "EcrInfoName")) {
            this.ecrInfoName = this.xmlGetAttribute(node, "EcrInfoName");
        }
        if (this.xmlHasAttribute(node, "EcrInfoManufacturerName")) {
            this.ecrInfoManufacturerName = this.xmlGetAttribute(node, "EcrInfoManufacturerName");
        }
        if (this.xmlHasAttribute(node, "EcrInfoVers")) {
            this.ecrInfoVers = this.xmlGetAttribute(node, "EcrInfoVers");
        }
        if (this.xmlHasAttribute(node, "EcrInfoSerialNumber")) {
            this.ecrInfoSerialNumber = this.xmlGetAttribute(node, "EcrInfoSerialNumber");
        }
        if (this.xmlHasAttribute(node, "EcrInfoArchitecture")) {
            this.ecrInfoArchitecture = this.xmlGetAttribute(node, "EcrInfoArchitecture");
        }
        if (this.xmlHasAttribute(node, "RemoteIp")) {
            this.remoteIp = this.xmlGetAttribute(node, "RemoteIp");
        }
        if (this.xmlHasAttribute(node, "IntegratorSolution")) {
            this.integratorSolution = this.xmlGetAttribute(node, "IntegratorSolution");
        }
        return;
    }
    if (arguments.length != 0) {
        throw new Error("Invalid argument");
    }
};
timapi.protocol.sixml.EcrInfo.prototype = Object.create(timapi.protocol.Container.prototype);
timapi.protocol.sixml.EcrInfo.prototype.ecrInfoType = undefined;
timapi.protocol.sixml.EcrInfo.prototype.ecrInfoName = undefined;
timapi.protocol.sixml.EcrInfo.prototype.ecrInfoManufacturerName = undefined;
timapi.protocol.sixml.EcrInfo.prototype.ecrInfoVers = undefined;
timapi.protocol.sixml.EcrInfo.prototype.ecrInfoSerialNumber = undefined;
timapi.protocol.sixml.EcrInfo.prototype.ecrInfoArchitecture = undefined;
timapi.protocol.sixml.EcrInfo.prototype.remoteIp = undefined;
timapi.protocol.sixml.EcrInfo.prototype.integratorSolution = undefined;
timapi.protocol.sixml.EcrInfo.prototype.toXmlNode = function () {
    var node = new timapi.protocol.XmlNode("sixml:EcrInfo");
    if (this.ecrInfoType != undefined) {
        this.xmlSetAttribute(node, "EcrInfoType", this.ecrInfoType);
    }
    if (this.ecrInfoName != undefined) {
        this.xmlSetAttribute(node, "EcrInfoName", this.ecrInfoName);
    }
    if (this.ecrInfoManufacturerName != undefined) {
        this.xmlSetAttribute(node, "EcrInfoManufacturerName", this.ecrInfoManufacturerName);
    }
    if (this.ecrInfoVers != undefined) {
        this.xmlSetAttribute(node, "EcrInfoVers", this.ecrInfoVers);
    }
    if (this.ecrInfoSerialNumber != undefined) {
        this.xmlSetAttribute(node, "EcrInfoSerialNumber", this.ecrInfoSerialNumber);
    }
    if (this.ecrInfoArchitecture != undefined) {
        this.xmlSetAttribute(node, "EcrInfoArchitecture", this.ecrInfoArchitecture);
    }
    if (this.remoteIp != undefined) {
        this.xmlSetAttribute(node, "RemoteIp", this.remoteIp);
    }
    if (this.integratorSolution != undefined) {
        this.xmlSetAttribute(node, "IntegratorSolution", this.integratorSolution);
    }
    return node;
};
timapi.protocol.sixml.Feature = function (a) {
    if (arguments.length == 1 && a instanceof timapi.protocol.sixml.Feature) {
        var value = a;
        this.value = value.value;
        this.featureType = value.featureType;
        return;
    }
    if (arguments.length == 1 && a instanceof timapi.protocol.XmlNode) {
        var node = a;
        this.value = node.textContent;
        if (this.xmlHasAttribute(node, "FeatureType")) {
            this.featureType = this.xmlGetAttribute(node, "FeatureType");
        }
        return;
    }
    if (arguments.length != 0) {
        throw new Error("Invalid argument");
    }
};
timapi.protocol.sixml.Feature.prototype = Object.create(timapi.protocol.Container.prototype);
timapi.protocol.sixml.Feature.prototype.value = "";
timapi.protocol.sixml.Feature.prototype.featureType = undefined;
timapi.protocol.sixml.Feature.prototype.toXmlNode = function () {
    var node = new timapi.protocol.XmlNode("sixml:Feature");
    node.textContent = this.value;
    if (this.featureType != undefined) {
        this.xmlSetAttribute(node, "FeatureType", this.featureType);
    }
    return node;
};
timapi.protocol.sixml.Features = function (a) {
    this.feature = [];
    if (arguments.length == 1 && a instanceof timapi.protocol.sixml.Features) {
        var value = a;
        for (var each of value.feature) {
            this.feature.push(each ? new timapi.protocol.sixml.Feature(each) : undefined);
        }
        return;
    }
    if (arguments.length == 1 && a instanceof timapi.protocol.XmlNode) {
        var node = a;
        for (var each of this.xmlGetChildren(node, "sixml:Feature")) {
            this.feature.push(new timapi.protocol.sixml.Feature(each));
        }
        return;
    }
    if (arguments.length != 0) {
        throw new Error("Invalid argument");
    }
};
timapi.protocol.sixml.Features.prototype = Object.create(timapi.protocol.Container.prototype);
timapi.protocol.sixml.Features.prototype.feature = undefined;
timapi.protocol.sixml.Features.prototype.toXmlNode = function () {
    var node = new timapi.protocol.XmlNode("sixml:Features");
    for (var each of this.feature) {
        this.xmlAddChild(node, "sixml:Feature", each);
    }
    return node;
};
timapi.protocol.sixml.Hardware = function (a) {
    if (arguments.length == 1 && a instanceof timapi.protocol.sixml.Hardware) {
        var value = a;
        this.hardwareType = value.hardwareType;
        this.serialNumber = value.serialNumber;
        this.productionDate = value.productionDate;
        this.productVersion = value.productVersion;
        this.firmwareVersion = value.firmwareVersion;
        this.securityStatus = value.securityStatus;
        this.lastCleaningDate = value.lastCleaningDate;
        return;
    }
    if (arguments.length == 1 && a instanceof timapi.protocol.XmlNode) {
        var node = a;
        if (this.xmlHasAttribute(node, "HardwareType")) {
            this.hardwareType = this.xmlGetAttribute(node, "HardwareType");
        }
        if (this.xmlHasAttribute(node, "SerialNumber")) {
            this.serialNumber = this.xmlGetAttribute(node, "SerialNumber");
        }
        if (this.xmlHasAttribute(node, "ProductionDate")) {
            this.productionDate = new timapi.protocol.TimeDate("yyyyMMdd", this.xmlGetAttribute(node, "ProductionDate"));
        }
        if (this.xmlHasAttribute(node, "ProductVersion")) {
            this.productVersion = this.xmlGetAttribute(node, "ProductVersion");
        }
        if (this.xmlHasAttribute(node, "FirmwareVersion")) {
            this.firmwareVersion = this.xmlGetAttribute(node, "FirmwareVersion");
        }
        if (this.xmlHasAttribute(node, "SecurityStatus")) {
            this.securityStatus = this.xmlGetAttribute(node, "SecurityStatus");
        }
        if (this.xmlHasAttribute(node, "LastCleaningDate")) {
            this.lastCleaningDate = new timapi.protocol.TimeDate("yyyyMMdd", this.xmlGetAttribute(node, "LastCleaningDate"));
        }
        return;
    }
    if (arguments.length != 0) {
        throw new Error("Invalid argument");
    }
};
timapi.protocol.sixml.Hardware.prototype = Object.create(timapi.protocol.Container.prototype);
timapi.protocol.sixml.Hardware.prototype.hardwareType = undefined;
timapi.protocol.sixml.Hardware.prototype.serialNumber = undefined;
timapi.protocol.sixml.Hardware.prototype.productionDate = undefined;
timapi.protocol.sixml.Hardware.prototype.productVersion = undefined;
timapi.protocol.sixml.Hardware.prototype.firmwareVersion = undefined;
timapi.protocol.sixml.Hardware.prototype.securityStatus = undefined;
timapi.protocol.sixml.Hardware.prototype.lastCleaningDate = undefined;
timapi.protocol.sixml.Hardware.prototype.toXmlNode = function () {
    var node = new timapi.protocol.XmlNode("sixml:Hardware");
    if (this.hardwareType != undefined) {
        this.xmlSetAttribute(node, "HardwareType", this.hardwareType);
    }
    if (this.serialNumber != undefined) {
        this.xmlSetAttribute(node, "SerialNumber", this.serialNumber);
    }
    if (this.productionDate != undefined) {
        this.xmlSetAttribute(node, "ProductionDate", this.productionDate.format("yyyyMMdd"));
    }
    if (this.productVersion != undefined) {
        this.xmlSetAttribute(node, "ProductVersion", this.productVersion);
    }
    if (this.firmwareVersion != undefined) {
        this.xmlSetAttribute(node, "FirmwareVersion", this.firmwareVersion);
    }
    if (this.securityStatus != undefined) {
        this.xmlSetAttribute(node, "SecurityStatus", this.securityStatus);
    }
    if (this.lastCleaningDate != undefined) {
        this.xmlSetAttribute(node, "LastCleaningDate", this.lastCleaningDate.format("yyyyMMdd"));
    }
    return node;
};
timapi.protocol.sixml.HardwareList = function (a) {
    this.hardware = [];
    if (arguments.length == 1 && a instanceof timapi.protocol.sixml.HardwareList) {
        var value = a;
        for (var each of value.hardware) {
            this.hardware.push(each ? new timapi.protocol.sixml.Hardware(each) : undefined);
        }
        return;
    }
    if (arguments.length == 1 && a instanceof timapi.protocol.XmlNode) {
        var node = a;
        for (var each of this.xmlGetChildren(node, "sixml:Hardware")) {
            this.hardware.push(new timapi.protocol.sixml.Hardware(each));
        }
        return;
    }
    if (arguments.length != 0) {
        throw new Error("Invalid argument");
    }
};
timapi.protocol.sixml.HardwareList.prototype = Object.create(timapi.protocol.Container.prototype);
timapi.protocol.sixml.HardwareList.prototype.hardware = undefined;
timapi.protocol.sixml.HardwareList.prototype.toXmlNode = function () {
    var node = new timapi.protocol.XmlNode("sixml:HardwareList");
    for (var each of this.hardware) {
        this.xmlAddChild(node, "sixml:Hardware", each);
    }
    return node;
};
timapi.protocol.sixml.Icon = function (a) {
    if (arguments.length == 1 && a instanceof timapi.protocol.sixml.Icon) {
        var value = a;
        return;
    }
    if (arguments.length == 1 && a instanceof timapi.protocol.XmlNode) {
        var node = a;
        return;
    }
    if (arguments.length != 0) {
        throw new Error("Invalid argument");
    }
};
timapi.protocol.sixml.Icon.prototype = Object.create(timapi.protocol.Container.prototype);
timapi.protocol.sixml.Icon.prototype.toXmlNode = function () {
    var node = new timapi.protocol.XmlNode("sixml:Icon");
    return node;
};
timapi.protocol.sixml.Item = function (a) {
    if (arguments.length == 1 && a instanceof timapi.protocol.sixml.Item) {
        var value = a;
        this.itemAuthResult = value.itemAuthResult;
        this.itemId = value.itemId;
        this.prodDescription = value.prodDescription;
        this.loyaltyId = value.loyaltyId;
        this.amount = value.amount ? new timapi.protocol.sixml.Amount(value.amount) : undefined;
        this.amountTotal = value.amountTotal ? new timapi.protocol.sixml.AmountTotal(value.amountTotal) : undefined;
        this.amountDiscount = value.amountDiscount ? new timapi.protocol.sixml.AmountDiscount(value.amountDiscount) : undefined;
        this.amountGross = value.amountGross ? new timapi.protocol.sixml.AmountGross(value.amountGross) : undefined;
        this.unitAmountGross = value.unitAmountGross ? new timapi.protocol.sixml.UnitAmountGross(value.unitAmountGross) : undefined;
        this.unitAmountDiscount = value.unitAmountDiscount ? new timapi.protocol.sixml.UnitAmountDiscount(value.unitAmountDiscount) : undefined;
        this.amountTax = value.amountTax ? new timapi.protocol.sixml.AmountTax(value.amountTax) : undefined;
        this.itemQuantity = value.itemQuantity ? new timapi.protocol.sixml.ItemQuantity(value.itemQuantity) : undefined;
        return;
    }
    if (arguments.length == 1 && a instanceof timapi.protocol.XmlNode) {
        var node = a;
        if (this.xmlHasAttribute(node, "ItemAuthResult")) {
            this.itemAuthResult = (this.xmlGetAttribute(node, "ItemAuthResult") ? parseInt(this.xmlGetAttribute(node, "ItemAuthResult")) : 0);
        }
        if (this.xmlHasAttribute(node, "ItemId")) {
            this.itemId = this.xmlGetAttribute(node, "ItemId");
        }
        if (this.xmlHasAttribute(node, "ProdDescription")) {
            this.prodDescription = this.xmlGetAttribute(node, "ProdDescription");
        }
        if (this.xmlHasAttribute(node, "LoyaltyId")) {
            this.loyaltyId = this.xmlGetAttribute(node, "LoyaltyId");
        }
        if (this.xmlHasChild(node, "sixml:Amount")) {
            this.amount = new timapi.protocol.sixml.Amount(this.xmlGetChild(node, "sixml:Amount"));
        }
        if (this.xmlHasChild(node, "sixml:AmountTotal")) {
            this.amountTotal = new timapi.protocol.sixml.AmountTotal(this.xmlGetChild(node, "sixml:AmountTotal"));
        }
        if (this.xmlHasChild(node, "sixml:AmountDiscount")) {
            this.amountDiscount = new timapi.protocol.sixml.AmountDiscount(this.xmlGetChild(node, "sixml:AmountDiscount"));
        }
        if (this.xmlHasChild(node, "sixml:AmountGross")) {
            this.amountGross = new timapi.protocol.sixml.AmountGross(this.xmlGetChild(node, "sixml:AmountGross"));
        }
        if (this.xmlHasChild(node, "sixml:UnitAmountGross")) {
            this.unitAmountGross = new timapi.protocol.sixml.UnitAmountGross(this.xmlGetChild(node, "sixml:UnitAmountGross"));
        }
        if (this.xmlHasChild(node, "sixml:UnitAmountDiscount")) {
            this.unitAmountDiscount = new timapi.protocol.sixml.UnitAmountDiscount(this.xmlGetChild(node, "sixml:UnitAmountDiscount"));
        }
        if (this.xmlHasChild(node, "sixml:AmountTax")) {
            this.amountTax = new timapi.protocol.sixml.AmountTax(this.xmlGetChild(node, "sixml:AmountTax"));
        }
        if (this.xmlHasChild(node, "sixml:ItemQuantity")) {
            this.itemQuantity = new timapi.protocol.sixml.ItemQuantity(this.xmlGetChild(node, "sixml:ItemQuantity"));
        }
        return;
    }
    if (arguments.length != 0) {
        throw new Error("Invalid argument");
    }
};
timapi.protocol.sixml.Item.prototype = Object.create(timapi.protocol.Container.prototype);
timapi.protocol.sixml.Item.prototype.itemAuthResult = undefined;
timapi.protocol.sixml.Item.prototype.itemId = undefined;
timapi.protocol.sixml.Item.prototype.prodDescription = undefined;
timapi.protocol.sixml.Item.prototype.loyaltyId = undefined;
timapi.protocol.sixml.Item.prototype.amount = undefined;
timapi.protocol.sixml.Item.prototype.amountTotal = undefined;
timapi.protocol.sixml.Item.prototype.amountDiscount = undefined;
timapi.protocol.sixml.Item.prototype.amountGross = undefined;
timapi.protocol.sixml.Item.prototype.unitAmountGross = undefined;
timapi.protocol.sixml.Item.prototype.unitAmountDiscount = undefined;
timapi.protocol.sixml.Item.prototype.amountTax = undefined;
timapi.protocol.sixml.Item.prototype.itemQuantity = undefined;
timapi.protocol.sixml.Item.prototype.toXmlNode = function () {
    var node = new timapi.protocol.XmlNode("sixml:Item");
    if (this.itemAuthResult != undefined) {
        this.xmlSetAttribute(node, "ItemAuthResult", timapi.utils.StringHelper.makeString(this.itemAuthResult));
    }
    if (this.itemId != undefined) {
        this.xmlSetAttribute(node, "ItemId", this.itemId);
    }
    if (this.prodDescription != undefined) {
        this.xmlSetAttribute(node, "ProdDescription", this.prodDescription);
    }
    if (this.loyaltyId != undefined) {
        this.xmlSetAttribute(node, "LoyaltyId", this.loyaltyId);
    }
    if (this.amount != undefined) {
        this.xmlAddChild(node, "sixml:Amount", this.amount);
    }
    if (this.amountTotal != undefined) {
        this.xmlAddChild(node, "sixml:AmountTotal", this.amountTotal);
    }
    if (this.amountDiscount != undefined) {
        this.xmlAddChild(node, "sixml:AmountDiscount", this.amountDiscount);
    }
    if (this.amountGross != undefined) {
        this.xmlAddChild(node, "sixml:AmountGross", this.amountGross);
    }
    if (this.unitAmountGross != undefined) {
        this.xmlAddChild(node, "sixml:UnitAmountGross", this.unitAmountGross);
    }
    if (this.unitAmountDiscount != undefined) {
        this.xmlAddChild(node, "sixml:UnitAmountDiscount", this.unitAmountDiscount);
    }
    if (this.amountTax != undefined) {
        this.xmlAddChild(node, "sixml:AmountTax", this.amountTax);
    }
    if (this.itemQuantity != undefined) {
        this.xmlAddChild(node, "sixml:ItemQuantity", this.itemQuantity);
    }
    return node;
};
timapi.protocol.sixml.ItemQuantity = function (a) {
    if (arguments.length == 1 && a instanceof timapi.protocol.sixml.ItemQuantity) {
        var value = a;
        this.value = value.value;
        this.itemQuantityType = value.itemQuantityType;
        this.exponent = value.exponent;
        return;
    }
    if (arguments.length == 1 && a instanceof timapi.protocol.XmlNode) {
        var node = a;
        this.value = (node.textContent ? parseInt(node.textContent) : 0);
        if (this.xmlHasAttribute(node, "ItemQuantityType")) {
            this.itemQuantityType = this.xmlGetAttribute(node, "ItemQuantityType");
        }
        if (this.xmlHasAttribute(node, "Exponent")) {
            this.exponent = (this.xmlGetAttribute(node, "Exponent") ? parseInt(this.xmlGetAttribute(node, "Exponent")) : 0);
        }
        return;
    }
    if (arguments.length != 0) {
        throw new Error("Invalid argument");
    }
};
timapi.protocol.sixml.ItemQuantity.prototype = Object.create(timapi.protocol.Container.prototype);
timapi.protocol.sixml.ItemQuantity.prototype.value = 0;
timapi.protocol.sixml.ItemQuantity.prototype.itemQuantityType = undefined;
timapi.protocol.sixml.ItemQuantity.prototype.exponent = undefined;
timapi.protocol.sixml.ItemQuantity.prototype.toXmlNode = function () {
    var node = new timapi.protocol.XmlNode("sixml:ItemQuantity");
    node.textContent = timapi.utils.StringHelper.makeString(this.value);
    if (this.itemQuantityType != undefined) {
        this.xmlSetAttribute(node, "ItemQuantityType", this.itemQuantityType);
    }
    if (this.exponent != undefined) {
        this.xmlSetAttribute(node, "Exponent", timapi.utils.StringHelper.makeString(this.exponent));
    }
    return node;
};
timapi.protocol.sixml.KernelVersion = function (a) {
    if (arguments.length == 1 && a instanceof timapi.protocol.sixml.KernelVersion) {
        var value = a;
        this.value = value.value;
        this.kernelType = value.kernelType;
        return;
    }
    if (arguments.length == 1 && a instanceof timapi.protocol.XmlNode) {
        var node = a;
        this.value = node.textContent;
        if (this.xmlHasAttribute(node, "KernelType")) {
            this.kernelType = (this.xmlGetAttribute(node, "KernelType") ? parseInt(this.xmlGetAttribute(node, "KernelType")) : 0);
        }
        return;
    }
    if (arguments.length != 0) {
        throw new Error("Invalid argument");
    }
};
timapi.protocol.sixml.KernelVersion.prototype = Object.create(timapi.protocol.Container.prototype);
timapi.protocol.sixml.KernelVersion.prototype.value = "";
timapi.protocol.sixml.KernelVersion.prototype.kernelType = undefined;
timapi.protocol.sixml.KernelVersion.prototype.toXmlNode = function () {
    var node = new timapi.protocol.XmlNode("sixml:KernelVersion");
    node.textContent = this.value;
    if (this.kernelType != undefined) {
        this.xmlSetAttribute(node, "KernelType", timapi.utils.StringHelper.makeString(this.kernelType));
    }
    return node;
};
timapi.protocol.sixml.KernelVersionList = function (a) {
    this.kernelVersion = [];
    if (arguments.length == 1 && a instanceof timapi.protocol.sixml.KernelVersionList) {
        var value = a;
        for (var each of value.kernelVersion) {
            this.kernelVersion.push(each ? new timapi.protocol.sixml.KernelVersion(each) : undefined);
        }
        return;
    }
    if (arguments.length == 1 && a instanceof timapi.protocol.XmlNode) {
        var node = a;
        for (var each of this.xmlGetChildren(node, "sixml:KernelVersion")) {
            this.kernelVersion.push(new timapi.protocol.sixml.KernelVersion(each));
        }
        return;
    }
    if (arguments.length != 0) {
        throw new Error("Invalid argument");
    }
};
timapi.protocol.sixml.KernelVersionList.prototype = Object.create(timapi.protocol.Container.prototype);
timapi.protocol.sixml.KernelVersionList.prototype.kernelVersion = undefined;
timapi.protocol.sixml.KernelVersionList.prototype.toXmlNode = function () {
    var node = new timapi.protocol.XmlNode("sixml:KernelVersionList");
    for (var each of this.kernelVersion) {
        this.xmlAddChild(node, "sixml:KernelVersion", each);
    }
    return node;
};
timapi.protocol.sixml.LogOptions = function (a) {
    if (arguments.length == 1 && a instanceof timapi.protocol.sixml.LogOptions) {
        var value = a;
        return;
    }
    if (arguments.length == 1 && a instanceof timapi.protocol.XmlNode) {
        var node = a;
        return;
    }
    if (arguments.length != 0) {
        throw new Error("Invalid argument");
    }
};
timapi.protocol.sixml.LogOptions.prototype = Object.create(timapi.protocol.Container.prototype);
timapi.protocol.sixml.LogOptions.prototype.toXmlNode = function () {
    var node = new timapi.protocol.XmlNode("sixml:LogOptions");
    return node;
};
timapi.protocol.sixml.LoyaltyInformation = function (a) {
    if (arguments.length == 1 && a instanceof timapi.protocol.sixml.LoyaltyInformation) {
        var value = a;
        this.value = value.value;
        this.loyaltyInfoType = value.loyaltyInfoType;
        this.loyaltyFunctionType = value.loyaltyFunctionType;
        this.loyaltyNumber = value.loyaltyNumber;
        return;
    }
    if (arguments.length == 1 && a instanceof timapi.protocol.XmlNode) {
        var node = a;
        this.value = timapi.ConversionHelper.hexStringToByte(node.textContent);
        if (this.xmlHasAttribute(node, "LoyaltyInfoType")) {
            this.loyaltyInfoType = this.xmlGetAttribute(node, "LoyaltyInfoType");
        }
        if (this.xmlHasAttribute(node, "LoyaltyFunctionType")) {
            this.loyaltyFunctionType = this.xmlGetAttribute(node, "LoyaltyFunctionType");
        }
        if (this.xmlHasAttribute(node, "LoyaltyNumber")) {
            this.loyaltyNumber = timapi.ConversionHelper.hexStringToByte(this.xmlGetAttribute(node, "LoyaltyNumber"));
        }
        return;
    }
    if (arguments.length != 0) {
        throw new Error("Invalid argument");
    }
};
timapi.protocol.sixml.LoyaltyInformation.prototype = Object.create(timapi.protocol.Container.prototype);
timapi.protocol.sixml.LoyaltyInformation.prototype.value = new Uint8Array(0);
timapi.protocol.sixml.LoyaltyInformation.prototype.loyaltyInfoType = undefined;
timapi.protocol.sixml.LoyaltyInformation.prototype.loyaltyFunctionType = undefined;
timapi.protocol.sixml.LoyaltyInformation.prototype.loyaltyNumber = undefined;
timapi.protocol.sixml.LoyaltyInformation.prototype.toXmlNode = function () {
    var node = new timapi.protocol.XmlNode("sixml:LoyaltyInformation");
    node.textContent = timapi.protocol.ConversionHelper.byteToHexString(this.value);
    if (this.loyaltyInfoType != undefined) {
        this.xmlSetAttribute(node, "LoyaltyInfoType", this.loyaltyInfoType);
    }
    if (this.loyaltyFunctionType != undefined) {
        this.xmlSetAttribute(node, "LoyaltyFunctionType", this.loyaltyFunctionType);
    }
    if (this.loyaltyNumber != undefined) {
        this.xmlSetAttribute(node, "LoyaltyNumber", timapi.protocol.ConversionHelper.byteToHexString(this.loyaltyNumber));
    }
    return node;
};
timapi.protocol.sixml.LoyaltyInformationList = function (a) {
    this.loyaltyInformation = [];
    if (arguments.length == 1 && a instanceof timapi.protocol.sixml.LoyaltyInformationList) {
        var value = a;
        for (var each of value.loyaltyInformation) {
            this.loyaltyInformation.push(each ? new timapi.protocol.sixml.LoyaltyInformation(each) : undefined);
        }
        return;
    }
    if (arguments.length == 1 && a instanceof timapi.protocol.XmlNode) {
        var node = a;
        for (var each of this.xmlGetChildren(node, "sixml:LoyaltyInformation")) {
            this.loyaltyInformation.push(new timapi.protocol.sixml.LoyaltyInformation(each));
        }
        return;
    }
    if (arguments.length != 0) {
        throw new Error("Invalid argument");
    }
};
timapi.protocol.sixml.LoyaltyInformationList.prototype = Object.create(timapi.protocol.Container.prototype);
timapi.protocol.sixml.LoyaltyInformationList.prototype.loyaltyInformation = undefined;
timapi.protocol.sixml.LoyaltyInformationList.prototype.toXmlNode = function () {
    var node = new timapi.protocol.XmlNode("sixml:LoyaltyInformationList");
    for (var each of this.loyaltyInformation) {
        this.xmlAddChild(node, "sixml:LoyaltyInformation", each);
    }
    return node;
};
timapi.protocol.sixml.MerchantOption = function (a) {
    if (arguments.length == 1 && a instanceof timapi.protocol.sixml.MerchantOption) {
        var value = a;
        this.value = value.value;
        this.merchantOptionType = value.merchantOptionType;
        return;
    }
    if (arguments.length == 1 && a instanceof timapi.protocol.XmlNode) {
        var node = a;
        this.value = node.textContent;
        if (this.xmlHasAttribute(node, "MerchantOptionType")) {
            this.merchantOptionType = this.xmlGetAttribute(node, "MerchantOptionType");
        }
        return;
    }
    if (arguments.length != 0) {
        throw new Error("Invalid argument");
    }
};
timapi.protocol.sixml.MerchantOption.prototype = Object.create(timapi.protocol.Container.prototype);
timapi.protocol.sixml.MerchantOption.prototype.value = "";
timapi.protocol.sixml.MerchantOption.prototype.merchantOptionType = undefined;
timapi.protocol.sixml.MerchantOption.prototype.toXmlNode = function () {
    var node = new timapi.protocol.XmlNode("sixml:MerchantOption");
    node.textContent = this.value;
    if (this.merchantOptionType != undefined) {
        this.xmlSetAttribute(node, "MerchantOptionType", this.merchantOptionType);
    }
    return node;
};
timapi.protocol.sixml.MerchantOptionList = function (a) {
    this.merchantOption = [];
    if (arguments.length == 1 && a instanceof timapi.protocol.sixml.MerchantOptionList) {
        var value = a;
        for (var each of value.merchantOption) {
            this.merchantOption.push(each ? new timapi.protocol.sixml.MerchantOption(each) : undefined);
        }
        return;
    }
    if (arguments.length == 1 && a instanceof timapi.protocol.XmlNode) {
        var node = a;
        for (var each of this.xmlGetChildren(node, "sixml:MerchantOption")) {
            this.merchantOption.push(new timapi.protocol.sixml.MerchantOption(each));
        }
        return;
    }
    if (arguments.length != 0) {
        throw new Error("Invalid argument");
    }
};
timapi.protocol.sixml.MerchantOptionList.prototype = Object.create(timapi.protocol.Container.prototype);
timapi.protocol.sixml.MerchantOptionList.prototype.merchantOption = undefined;
timapi.protocol.sixml.MerchantOptionList.prototype.toXmlNode = function () {
    var node = new timapi.protocol.XmlNode("sixml:MerchantOptionList");
    for (var each of this.merchantOption) {
        this.xmlAddChild(node, "sixml:MerchantOption", each);
    }
    return node;
};
timapi.protocol.sixml.NativeError = function (a) {
    if (arguments.length == 1 && a instanceof timapi.protocol.sixml.NativeError) {
        var value = a;
        this.errorCode = value.errorCode;
        this.errorMessage = value.errorMessage;
        this.errorSource = value.errorSource;
        return;
    }
    if (arguments.length == 1 && a instanceof timapi.protocol.XmlNode) {
        var node = a;
        if (this.xmlHasAttribute(node, "ErrorCode")) {
            this.errorCode = (this.xmlGetAttribute(node, "ErrorCode") ? parseInt(this.xmlGetAttribute(node, "ErrorCode")) : 0);
        }
        if (this.xmlHasAttribute(node, "ErrorMessage")) {
            this.errorMessage = this.xmlGetAttribute(node, "ErrorMessage");
        }
        if (this.xmlHasAttribute(node, "ErrorSource")) {
            this.errorSource = this.xmlGetAttribute(node, "ErrorSource");
        }
        return;
    }
    if (arguments.length != 0) {
        throw new Error("Invalid argument");
    }
};
timapi.protocol.sixml.NativeError.prototype = Object.create(timapi.protocol.Container.prototype);
timapi.protocol.sixml.NativeError.prototype.errorCode = undefined;
timapi.protocol.sixml.NativeError.prototype.errorMessage = undefined;
timapi.protocol.sixml.NativeError.prototype.errorSource = undefined;
timapi.protocol.sixml.NativeError.prototype.toXmlNode = function () {
    var node = new timapi.protocol.XmlNode("sixml:NativeError");
    if (this.errorCode != undefined) {
        this.xmlSetAttribute(node, "ErrorCode", timapi.utils.StringHelper.makeString(this.errorCode));
    }
    if (this.errorMessage != undefined) {
        this.xmlSetAttribute(node, "ErrorMessage", this.errorMessage);
    }
    if (this.errorSource != undefined) {
        this.xmlSetAttribute(node, "ErrorSource", this.errorSource);
    }
    return node;
};
timapi.protocol.sixml.NetworkInformation = function (a) {
    if (arguments.length == 1 && a instanceof timapi.protocol.sixml.NetworkInformation) {
        var value = a;
        this.terminalIp = value.terminalIp;
        this.terminalIpMask = value.terminalIpMask;
        this.terminalIpGw = value.terminalIpGw;
        this.terminalIpDns = value.terminalIpDns;
        return;
    }
    if (arguments.length == 1 && a instanceof timapi.protocol.XmlNode) {
        var node = a;
        if (this.xmlHasAttribute(node, "TerminalIp")) {
            this.terminalIp = this.xmlGetAttribute(node, "TerminalIp");
        }
        if (this.xmlHasAttribute(node, "TerminalIpMask")) {
            this.terminalIpMask = this.xmlGetAttribute(node, "TerminalIpMask");
        }
        if (this.xmlHasAttribute(node, "TerminalIpGw")) {
            this.terminalIpGw = this.xmlGetAttribute(node, "TerminalIpGw");
        }
        if (this.xmlHasAttribute(node, "TerminalIpDns")) {
            this.terminalIpDns = this.xmlGetAttribute(node, "TerminalIpDns");
        }
        return;
    }
    if (arguments.length != 0) {
        throw new Error("Invalid argument");
    }
};
timapi.protocol.sixml.NetworkInformation.prototype = Object.create(timapi.protocol.Container.prototype);
timapi.protocol.sixml.NetworkInformation.prototype.terminalIp = undefined;
timapi.protocol.sixml.NetworkInformation.prototype.terminalIpMask = undefined;
timapi.protocol.sixml.NetworkInformation.prototype.terminalIpGw = undefined;
timapi.protocol.sixml.NetworkInformation.prototype.terminalIpDns = undefined;
timapi.protocol.sixml.NetworkInformation.prototype.toXmlNode = function () {
    var node = new timapi.protocol.XmlNode("sixml:NetworkInformation");
    if (this.terminalIp != undefined) {
        this.xmlSetAttribute(node, "TerminalIp", this.terminalIp);
    }
    if (this.terminalIpMask != undefined) {
        this.xmlSetAttribute(node, "TerminalIpMask", this.terminalIpMask);
    }
    if (this.terminalIpGw != undefined) {
        this.xmlSetAttribute(node, "TerminalIpGw", this.terminalIpGw);
    }
    if (this.terminalIpDns != undefined) {
        this.xmlSetAttribute(node, "TerminalIpDns", this.terminalIpDns);
    }
    return node;
};
timapi.protocol.sixml.Notification = function (a) {
    if (arguments.length == 1 && a instanceof timapi.protocol.sixml.Notification) {
        var value = a;
        this.functionGroup = value.functionGroup;
        this.function = value.function;
        return;
    }
    if (arguments.length == 1 && a instanceof timapi.protocol.XmlNode) {
        var node = a;
        if (this.xmlHasAttribute(node, "FunctionGroup")) {
            this.functionGroup = this.xmlGetAttribute(node, "FunctionGroup");
        }
        if (this.xmlHasAttribute(node, "Function")) {
            this.function = this.xmlGetAttribute(node, "Function");
        }
        return;
    }
    if (arguments.length == 0) {
        return;
    }
    throw new Error("Invalid argument");
};
timapi.protocol.sixml.Notification.prototype = Object.create(timapi.protocol.Message.prototype);
timapi.protocol.sixml.Notification.prototype.functionGroup = undefined;
timapi.protocol.sixml.Notification.prototype.function = undefined;
timapi.protocol.sixml.Notification.prototype.toXmlNode = function () {
    var node = new timapi.protocol.XmlNode("sixml:Notification");
    this.xmlSetAttribute(node, "xmlns:sixml", "http://www.six-payment-services.com/");
    if (this.functionGroup != undefined) {
        this.xmlSetAttribute(node, "FunctionGroup", this.functionGroup);
    }
    if (this.function != undefined) {
        this.xmlSetAttribute(node, "Function", this.function);
    }
    return node;
};
timapi.protocol.sixml.Notification_Cancel = function (a) {
    if (arguments.length == 1 && a instanceof timapi.protocol.sixml.Notification_Cancel) {
        var value = a;
        this.functionGroup = value.functionGroup;
        this.function = value.function;
        this.retainCardFlag = value.retainCardFlag;
        this.silentFlag = value.silentFlag;
        return;
    }
    if (arguments.length == 1 && a instanceof timapi.protocol.XmlNode) {
        var node = a;
        if (this.xmlHasAttribute(node, "FunctionGroup")) {
            this.functionGroup = this.xmlGetAttribute(node, "FunctionGroup");
        }
        if (this.xmlHasAttribute(node, "Function")) {
            this.function = this.xmlGetAttribute(node, "Function");
        }
        if (this.xmlHasChild(node, "sixml:RetainCardFlag")) {
            this.retainCardFlag = this.xmlGetChild(node, "sixml:RetainCardFlag").textContent == "1";
        }
        if (this.xmlHasChild(node, "sixml:SilentFlag")) {
            this.silentFlag = this.xmlGetChild(node, "sixml:SilentFlag").textContent == "1";
        }
        return;
    }
    if (arguments.length == 0) {
        this.functionGroup = "NonFinTransaction";
        this.function = "Cancel";
        return;
    }
    throw new Error("Invalid argument");
};
timapi.protocol.sixml.Notification_Cancel.prototype = Object.create(timapi.protocol.Message.prototype);
timapi.protocol.sixml.Notification_Cancel.prototype.functionGroup = undefined;
timapi.protocol.sixml.Notification_Cancel.prototype.function = undefined;
timapi.protocol.sixml.Notification_Cancel.prototype.retainCardFlag = undefined;
timapi.protocol.sixml.Notification_Cancel.prototype.silentFlag = undefined;
timapi.protocol.sixml.Notification_Cancel.prototype.toXmlNode = function () {
    var node = new timapi.protocol.XmlNode("sixml:Notification");
    this.xmlSetAttribute(node, "xmlns:sixml", "http://www.six-payment-services.com/");
    if (this.functionGroup != undefined) {
        this.xmlSetAttribute(node, "FunctionGroup", this.functionGroup);
    }
    if (this.function != undefined) {
        this.xmlSetAttribute(node, "Function", this.function);
    }
    if (this.retainCardFlag != undefined) {
        this.xmlAddChild(node, "sixml:RetainCardFlag", (this.retainCardFlag ? "1" : "0"));
    }
    if (this.silentFlag != undefined) {
        this.xmlAddChild(node, "sixml:SilentFlag", (this.silentFlag ? "1" : "0"));
    }
    return node;
};
timapi.protocol.sixml.Notification_HoldCommit = function (a) {
    if (arguments.length == 1 && a instanceof timapi.protocol.sixml.Notification_HoldCommit) {
        var value = a;
        this.functionGroup = value.functionGroup;
        this.function = value.function;
        return;
    }
    if (arguments.length == 1 && a instanceof timapi.protocol.XmlNode) {
        var node = a;
        if (this.xmlHasAttribute(node, "FunctionGroup")) {
            this.functionGroup = this.xmlGetAttribute(node, "FunctionGroup");
        }
        if (this.xmlHasAttribute(node, "Function")) {
            this.function = this.xmlGetAttribute(node, "Function");
        }
        return;
    }
    if (arguments.length == 0) {
        this.functionGroup = "NonFinTransaction";
        this.function = "HoldCommit";
        return;
    }
    throw new Error("Invalid argument");
};
timapi.protocol.sixml.Notification_HoldCommit.prototype = Object.create(timapi.protocol.Message.prototype);
timapi.protocol.sixml.Notification_HoldCommit.prototype.functionGroup = undefined;
timapi.protocol.sixml.Notification_HoldCommit.prototype.function = undefined;
timapi.protocol.sixml.Notification_HoldCommit.prototype.toXmlNode = function () {
    var node = new timapi.protocol.XmlNode("sixml:Notification");
    this.xmlSetAttribute(node, "xmlns:sixml", "http://www.six-payment-services.com/");
    if (this.functionGroup != undefined) {
        this.xmlSetAttribute(node, "FunctionGroup", this.functionGroup);
    }
    if (this.function != undefined) {
        this.xmlSetAttribute(node, "Function", this.function);
    }
    return node;
};
timapi.protocol.sixml.Notification_KeepAlive = function (a) {
    if (arguments.length == 1 && a instanceof timapi.protocol.sixml.Notification_KeepAlive) {
        var value = a;
        this.functionGroup = value.functionGroup;
        this.function = value.function;
        return;
    }
    if (arguments.length == 1 && a instanceof timapi.protocol.XmlNode) {
        var node = a;
        if (this.xmlHasAttribute(node, "FunctionGroup")) {
            this.functionGroup = this.xmlGetAttribute(node, "FunctionGroup");
        }
        if (this.xmlHasAttribute(node, "Function")) {
            this.function = this.xmlGetAttribute(node, "Function");
        }
        return;
    }
    if (arguments.length == 0) {
        this.functionGroup = "Status";
        this.function = "KeepAlive";
        return;
    }
    throw new Error("Invalid argument");
};
timapi.protocol.sixml.Notification_KeepAlive.prototype = Object.create(timapi.protocol.Message.prototype);
timapi.protocol.sixml.Notification_KeepAlive.prototype.functionGroup = undefined;
timapi.protocol.sixml.Notification_KeepAlive.prototype.function = undefined;
timapi.protocol.sixml.Notification_KeepAlive.prototype.toXmlNode = function () {
    var node = new timapi.protocol.XmlNode("sixml:Notification");
    this.xmlSetAttribute(node, "xmlns:sixml", "http://www.six-payment-services.com/");
    if (this.functionGroup != undefined) {
        this.xmlSetAttribute(node, "FunctionGroup", this.functionGroup);
    }
    if (this.function != undefined) {
        this.xmlSetAttribute(node, "Function", this.function);
    }
    return node;
};
timapi.protocol.sixml.Notification_LicenseChanged = function (a) {
    if (arguments.length == 1 && a instanceof timapi.protocol.sixml.Notification_LicenseChanged) {
        var value = a;
        this.functionGroup = value.functionGroup;
        this.function = value.function;
        this.license = value.license;
        return;
    }
    if (arguments.length == 1 && a instanceof timapi.protocol.XmlNode) {
        var node = a;
        if (this.xmlHasAttribute(node, "FunctionGroup")) {
            this.functionGroup = this.xmlGetAttribute(node, "FunctionGroup");
        }
        if (this.xmlHasAttribute(node, "Function")) {
            this.function = this.xmlGetAttribute(node, "Function");
        }
        if (this.xmlHasChild(node, "sixml:License")) {
            this.license = (this.xmlGetChild(node, "sixml:License").textContent ? parseInt(this.xmlGetChild(node, "sixml:License").textContent) : 0);
        }
        return;
    }
    if (arguments.length == 0) {
        this.functionGroup = "Status";
        this.function = "LicenseChanged";
        return;
    }
    throw new Error("Invalid argument");
};
timapi.protocol.sixml.Notification_LicenseChanged.prototype = Object.create(timapi.protocol.Message.prototype);
timapi.protocol.sixml.Notification_LicenseChanged.prototype.functionGroup = undefined;
timapi.protocol.sixml.Notification_LicenseChanged.prototype.function = undefined;
timapi.protocol.sixml.Notification_LicenseChanged.prototype.license = undefined;
timapi.protocol.sixml.Notification_LicenseChanged.prototype.toXmlNode = function () {
    var node = new timapi.protocol.XmlNode("sixml:Notification");
    this.xmlSetAttribute(node, "xmlns:sixml", "http://www.six-payment-services.com/");
    if (this.functionGroup != undefined) {
        this.xmlSetAttribute(node, "FunctionGroup", this.functionGroup);
    }
    if (this.function != undefined) {
        this.xmlSetAttribute(node, "Function", this.function);
    }
    if (this.license != undefined) {
        this.xmlAddChild(node, "sixml:License", timapi.utils.StringHelper.makeString(this.license));
    }
    return node;
};
timapi.protocol.sixml.Notification_TerminalStatus = function (a) {
    if (arguments.length == 1 && a instanceof timapi.protocol.sixml.Notification_TerminalStatus) {
        var value = a;
        this.functionGroup = value.functionGroup;
        this.function = value.function;
        this.displayContent = value.displayContent ? new timapi.protocol.sixml.DisplayContent(value.displayContent) : undefined;
        this.cardReaderStatus = value.cardReaderStatus;
        this.transactionStatus = value.transactionStatus;
        this.connectionStatus = value.connectionStatus;
        this.managementStatus = value.managementStatus;
        this.sleepModeStatus = value.sleepModeStatus;
        this.receiptInformation = value.receiptInformation;
        this.cardData = value.cardData ? new timapi.protocol.sixml.CardData(value.cardData) : undefined;
        this.swUpdateAvailable = value.swUpdateAvailable;
        this.terminalId = value.terminalId;
        this.finalAmount = value.finalAmount ? new timapi.protocol.sixml.FinalAmount(value.finalAmount) : undefined;
        return;
    }
    if (arguments.length == 1 && a instanceof timapi.protocol.XmlNode) {
        var node = a;
        if (this.xmlHasAttribute(node, "FunctionGroup")) {
            this.functionGroup = this.xmlGetAttribute(node, "FunctionGroup");
        }
        if (this.xmlHasAttribute(node, "Function")) {
            this.function = this.xmlGetAttribute(node, "Function");
        }
        if (this.xmlHasChild(node, "sixml:DisplayContent")) {
            this.displayContent = new timapi.protocol.sixml.DisplayContent(this.xmlGetChild(node, "sixml:DisplayContent"));
        }
        if (this.xmlHasChild(node, "sixml:CardReaderStatus")) {
            this.cardReaderStatus = this.xmlGetChild(node, "sixml:CardReaderStatus").textContent;
        }
        if (this.xmlHasChild(node, "sixml:TransactionStatus")) {
            this.transactionStatus = this.xmlGetChild(node, "sixml:TransactionStatus").textContent;
        }
        if (this.xmlHasChild(node, "sixml:ConnectionStatus")) {
            this.connectionStatus = this.xmlGetChild(node, "sixml:ConnectionStatus").textContent;
        }
        if (this.xmlHasChild(node, "sixml:ManagementStatus")) {
            this.managementStatus = this.xmlGetChild(node, "sixml:ManagementStatus").textContent;
        }
        if (this.xmlHasChild(node, "sixml:SleepModeStatus")) {
            this.sleepModeStatus = this.xmlGetChild(node, "sixml:SleepModeStatus").textContent;
        }
        if (this.xmlHasChild(node, "sixml:ReceiptInformation")) {
            this.receiptInformation = this.xmlGetChild(node, "sixml:ReceiptInformation").textContent == "1";
        }
        if (this.xmlHasChild(node, "sixml:CardData")) {
            this.cardData = new timapi.protocol.sixml.CardData(this.xmlGetChild(node, "sixml:CardData"));
        }
        if (this.xmlHasChild(node, "sixml:SwUpdateAvailable")) {
            this.swUpdateAvailable = this.xmlGetChild(node, "sixml:SwUpdateAvailable").textContent == "1";
        }
        if (this.xmlHasChild(node, "sixml:TerminalId")) {
            this.terminalId = this.xmlGetChild(node, "sixml:TerminalId").textContent;
        }
        if (this.xmlHasChild(node, "sixml:FinalAmount")) {
            this.finalAmount = new timapi.protocol.sixml.FinalAmount(this.xmlGetChild(node, "sixml:FinalAmount"));
        }
        return;
    }
    if (arguments.length == 0) {
        this.functionGroup = "Status";
        this.function = "TerminalStatus";
        return;
    }
    throw new Error("Invalid argument");
};
timapi.protocol.sixml.Notification_TerminalStatus.prototype = Object.create(timapi.protocol.Message.prototype);
timapi.protocol.sixml.Notification_TerminalStatus.prototype.functionGroup = undefined;
timapi.protocol.sixml.Notification_TerminalStatus.prototype.function = undefined;
timapi.protocol.sixml.Notification_TerminalStatus.prototype.displayContent = undefined;
timapi.protocol.sixml.Notification_TerminalStatus.prototype.cardReaderStatus = undefined;
timapi.protocol.sixml.Notification_TerminalStatus.prototype.transactionStatus = undefined;
timapi.protocol.sixml.Notification_TerminalStatus.prototype.connectionStatus = undefined;
timapi.protocol.sixml.Notification_TerminalStatus.prototype.managementStatus = undefined;
timapi.protocol.sixml.Notification_TerminalStatus.prototype.sleepModeStatus = undefined;
timapi.protocol.sixml.Notification_TerminalStatus.prototype.receiptInformation = undefined;
timapi.protocol.sixml.Notification_TerminalStatus.prototype.cardData = undefined;
timapi.protocol.sixml.Notification_TerminalStatus.prototype.swUpdateAvailable = undefined;
timapi.protocol.sixml.Notification_TerminalStatus.prototype.terminalId = undefined;
timapi.protocol.sixml.Notification_TerminalStatus.prototype.finalAmount = undefined;
timapi.protocol.sixml.Notification_TerminalStatus.prototype.toXmlNode = function () {
    var node = new timapi.protocol.XmlNode("sixml:Notification");
    this.xmlSetAttribute(node, "xmlns:sixml", "http://www.six-payment-services.com/");
    if (this.functionGroup != undefined) {
        this.xmlSetAttribute(node, "FunctionGroup", this.functionGroup);
    }
    if (this.function != undefined) {
        this.xmlSetAttribute(node, "Function", this.function);
    }
    if (this.displayContent != undefined) {
        this.xmlAddChild(node, "sixml:DisplayContent", this.displayContent);
    }
    if (this.cardReaderStatus != undefined) {
        this.xmlAddChild(node, "sixml:CardReaderStatus", this.cardReaderStatus);
    }
    if (this.transactionStatus != undefined) {
        this.xmlAddChild(node, "sixml:TransactionStatus", this.transactionStatus);
    }
    if (this.connectionStatus != undefined) {
        this.xmlAddChild(node, "sixml:ConnectionStatus", this.connectionStatus);
    }
    if (this.managementStatus != undefined) {
        this.xmlAddChild(node, "sixml:ManagementStatus", this.managementStatus);
    }
    if (this.sleepModeStatus != undefined) {
        this.xmlAddChild(node, "sixml:SleepModeStatus", this.sleepModeStatus);
    }
    if (this.receiptInformation != undefined) {
        this.xmlAddChild(node, "sixml:ReceiptInformation", (this.receiptInformation ? "1" : "0"));
    }
    if (this.cardData != undefined) {
        this.xmlAddChild(node, "sixml:CardData", this.cardData);
    }
    if (this.swUpdateAvailable != undefined) {
        this.xmlAddChild(node, "sixml:SwUpdateAvailable", (this.swUpdateAvailable ? "1" : "0"));
    }
    if (this.terminalId != undefined) {
        this.xmlAddChild(node, "sixml:TerminalId", this.terminalId);
    }
    if (this.finalAmount != undefined) {
        this.xmlAddChild(node, "sixml:FinalAmount", this.finalAmount);
    }
    return node;
};
timapi.protocol.sixml.PlaceholderItem = function (a) {
    if (arguments.length == 1 && a instanceof timapi.protocol.sixml.PlaceholderItem) {
        var value = a;
        this.value = value.value;
        this.placeholderNumber = value.placeholderNumber;
        return;
    }
    if (arguments.length == 1 && a instanceof timapi.protocol.XmlNode) {
        var node = a;
        this.value = node.textContent;
        if (this.xmlHasAttribute(node, "PlaceholderNumber")) {
            this.placeholderNumber = (this.xmlGetAttribute(node, "PlaceholderNumber") ? parseInt(this.xmlGetAttribute(node, "PlaceholderNumber")) : 0);
        }
        return;
    }
    if (arguments.length != 0) {
        throw new Error("Invalid argument");
    }
};
timapi.protocol.sixml.PlaceholderItem.prototype = Object.create(timapi.protocol.Container.prototype);
timapi.protocol.sixml.PlaceholderItem.prototype.value = "";
timapi.protocol.sixml.PlaceholderItem.prototype.placeholderNumber = undefined;
timapi.protocol.sixml.PlaceholderItem.prototype.toXmlNode = function () {
    var node = new timapi.protocol.XmlNode("sixml:PlaceholderItem");
    node.textContent = this.value;
    if (this.placeholderNumber != undefined) {
        this.xmlSetAttribute(node, "PlaceholderNumber", timapi.utils.StringHelper.makeString(this.placeholderNumber));
    }
    return node;
};
timapi.protocol.sixml.PlaceholderItemList = function (a) {
    this.placeholderItem = [];
    if (arguments.length == 1 && a instanceof timapi.protocol.sixml.PlaceholderItemList) {
        var value = a;
        for (var each of value.placeholderItem) {
            this.placeholderItem.push(each ? new timapi.protocol.sixml.PlaceholderItem(each) : undefined);
        }
        return;
    }
    if (arguments.length == 1 && a instanceof timapi.protocol.XmlNode) {
        var node = a;
        for (var each of this.xmlGetChildren(node, "sixml:PlaceholderItem")) {
            this.placeholderItem.push(new timapi.protocol.sixml.PlaceholderItem(each));
        }
        return;
    }
    if (arguments.length != 0) {
        throw new Error("Invalid argument");
    }
};
timapi.protocol.sixml.PlaceholderItemList.prototype = Object.create(timapi.protocol.Container.prototype);
timapi.protocol.sixml.PlaceholderItemList.prototype.placeholderItem = undefined;
timapi.protocol.sixml.PlaceholderItemList.prototype.toXmlNode = function () {
    var node = new timapi.protocol.XmlNode("sixml:PlaceholderItemList");
    for (var each of this.placeholderItem) {
        this.xmlAddChild(node, "sixml:PlaceholderItem", each);
    }
    return node;
};
timapi.protocol.sixml.PpInfo = function (a) {
    if (arguments.length == 1 && a instanceof timapi.protocol.sixml.PpInfo) {
        var value = a;
        this.paymentProtocol = value.paymentProtocol;
        this.ppEp2transSeqCntOrig = value.ppEp2transSeqCntOrig;
        this.ppEp2transSeqCnt = value.ppEp2transSeqCnt;
        this.ppEp2authReslt = value.ppEp2authReslt;
        this.ppEp2authRespC = value.ppEp2authRespC;
        return;
    }
    if (arguments.length == 1 && a instanceof timapi.protocol.XmlNode) {
        var node = a;
        if (this.xmlHasAttribute(node, "PaymentProtocol")) {
            this.paymentProtocol = this.xmlGetAttribute(node, "PaymentProtocol");
        }
        if (this.xmlHasAttribute(node, "PpEp2TransSeqCntOrig")) {
            this.ppEp2transSeqCntOrig = (this.xmlGetAttribute(node, "PpEp2TransSeqCntOrig") ? parseInt(this.xmlGetAttribute(node, "PpEp2TransSeqCntOrig")) : 0);
        }
        if (this.xmlHasAttribute(node, "PpEp2TransSeqCnt")) {
            this.ppEp2transSeqCnt = (this.xmlGetAttribute(node, "PpEp2TransSeqCnt") ? parseInt(this.xmlGetAttribute(node, "PpEp2TransSeqCnt")) : 0);
        }
        if (this.xmlHasAttribute(node, "PpEp2AuthReslt")) {
            this.ppEp2authReslt = (this.xmlGetAttribute(node, "PpEp2AuthReslt") ? parseInt(this.xmlGetAttribute(node, "PpEp2AuthReslt")) : 0);
        }
        if (this.xmlHasAttribute(node, "PpEp2AuthRespC")) {
            this.ppEp2authRespC = this.xmlGetAttribute(node, "PpEp2AuthRespC");
        }
        return;
    }
    if (arguments.length != 0) {
        throw new Error("Invalid argument");
    }
};
timapi.protocol.sixml.PpInfo.prototype = Object.create(timapi.protocol.Container.prototype);
timapi.protocol.sixml.PpInfo.prototype.paymentProtocol = undefined;
timapi.protocol.sixml.PpInfo.prototype.ppEp2transSeqCntOrig = undefined;
timapi.protocol.sixml.PpInfo.prototype.ppEp2transSeqCnt = undefined;
timapi.protocol.sixml.PpInfo.prototype.ppEp2authReslt = undefined;
timapi.protocol.sixml.PpInfo.prototype.ppEp2authRespC = undefined;
timapi.protocol.sixml.PpInfo.prototype.toXmlNode = function () {
    var node = new timapi.protocol.XmlNode("sixml:PpInfo");
    if (this.paymentProtocol != undefined) {
        this.xmlSetAttribute(node, "PaymentProtocol", this.paymentProtocol);
    }
    if (this.ppEp2transSeqCntOrig != undefined) {
        this.xmlSetAttribute(node, "PpEp2TransSeqCntOrig", timapi.utils.StringHelper.makeString(this.ppEp2transSeqCntOrig));
    }
    if (this.ppEp2transSeqCnt != undefined) {
        this.xmlSetAttribute(node, "PpEp2TransSeqCnt", timapi.utils.StringHelper.makeString(this.ppEp2transSeqCnt));
    }
    if (this.ppEp2authReslt != undefined) {
        this.xmlSetAttribute(node, "PpEp2AuthReslt", timapi.utils.StringHelper.makeString(this.ppEp2authReslt));
    }
    if (this.ppEp2authRespC != undefined) {
        this.xmlSetAttribute(node, "PpEp2AuthRespC", this.ppEp2authRespC);
    }
    return node;
};
timapi.protocol.sixml.PrintData = function (a) {
    this.receipt = [];
    this.receiptItems = [];
    if (arguments.length == 1 && a instanceof timapi.protocol.sixml.PrintData) {
        var value = a;
        for (var each of value.receipt) {
            this.receipt.push(each ? new timapi.protocol.sixml.Receipt(each) : undefined);
        }
        for (var each of value.receiptItems) {
            this.receiptItems.push(each ? new timapi.protocol.sixml.ReceiptItems(each) : undefined);
        }
        return;
    }
    if (arguments.length == 1 && a instanceof timapi.protocol.XmlNode) {
        var node = a;
        for (var each of this.xmlGetChildren(node, "sixml:Receipt")) {
            this.receipt.push(new timapi.protocol.sixml.Receipt(each));
        }
        for (var each of this.xmlGetChildren(node, "sixml:ReceiptItems")) {
            this.receiptItems.push(new timapi.protocol.sixml.ReceiptItems(each));
        }
        return;
    }
    if (arguments.length != 0) {
        throw new Error("Invalid argument");
    }
};
timapi.protocol.sixml.PrintData.prototype = Object.create(timapi.protocol.Container.prototype);
timapi.protocol.sixml.PrintData.prototype.receipt = undefined;
timapi.protocol.sixml.PrintData.prototype.receiptItems = undefined;
timapi.protocol.sixml.PrintData.prototype.toXmlNode = function () {
    var node = new timapi.protocol.XmlNode("sixml:PrintData");
    for (var each of this.receipt) {
        this.xmlAddChild(node, "sixml:Receipt", each);
    }
    for (var each of this.receiptItems) {
        this.xmlAddChild(node, "sixml:ReceiptItems", each);
    }
    return node;
};
timapi.protocol.sixml.PrintOptionList = function (a) {
    this.printOptions = [];
    if (arguments.length == 1 && a instanceof timapi.protocol.sixml.PrintOptionList) {
        var value = a;
        for (var each of value.printOptions) {
            this.printOptions.push(each ? new timapi.protocol.sixml.PrintOptions(each) : undefined);
        }
        return;
    }
    if (arguments.length == 1 && a instanceof timapi.protocol.XmlNode) {
        var node = a;
        for (var each of this.xmlGetChildren(node, "sixml:PrintOptions")) {
            this.printOptions.push(new timapi.protocol.sixml.PrintOptions(each));
        }
        return;
    }
    if (arguments.length != 0) {
        throw new Error("Invalid argument");
    }
};
timapi.protocol.sixml.PrintOptionList.prototype = Object.create(timapi.protocol.Container.prototype);
timapi.protocol.sixml.PrintOptionList.prototype.printOptions = undefined;
timapi.protocol.sixml.PrintOptionList.prototype.toXmlNode = function () {
    var node = new timapi.protocol.XmlNode("sixml:PrintOptionList");
    for (var each of this.printOptions) {
        this.xmlAddChild(node, "sixml:PrintOptions", each);
    }
    return node;
};
timapi.protocol.sixml.PrintOptions = function (a) {
    if (arguments.length == 1 && a instanceof timapi.protocol.sixml.PrintOptions) {
        var value = a;
        this.recipient = value.recipient;
        this.printFormat = value.printFormat;
        this.printWidth = value.printWidth;
        this.printFlags = value.printFlags;
        return;
    }
    if (arguments.length == 1 && a instanceof timapi.protocol.XmlNode) {
        var node = a;
        if (this.xmlHasAttribute(node, "Recipient")) {
            this.recipient = this.xmlGetAttribute(node, "Recipient");
        }
        if (this.xmlHasAttribute(node, "PrintFormat")) {
            this.printFormat = this.xmlGetAttribute(node, "PrintFormat");
        }
        if (this.xmlHasAttribute(node, "PrintWidth")) {
            this.printWidth = (this.xmlGetAttribute(node, "PrintWidth") ? parseInt(this.xmlGetAttribute(node, "PrintWidth")) : 0);
        }
        if (this.xmlHasAttribute(node, "PrintFlags")) {
            this.printFlags = (this.xmlGetAttribute(node, "PrintFlags") ? parseInt(this.xmlGetAttribute(node, "PrintFlags")) : 0);
        }
        return;
    }
    if (arguments.length != 0) {
        throw new Error("Invalid argument");
    }
};
timapi.protocol.sixml.PrintOptions.prototype = Object.create(timapi.protocol.Container.prototype);
timapi.protocol.sixml.PrintOptions.prototype.recipient = undefined;
timapi.protocol.sixml.PrintOptions.prototype.printFormat = undefined;
timapi.protocol.sixml.PrintOptions.prototype.printWidth = undefined;
timapi.protocol.sixml.PrintOptions.prototype.printFlags = undefined;
timapi.protocol.sixml.PrintOptions.prototype.toXmlNode = function () {
    var node = new timapi.protocol.XmlNode("sixml:PrintOptions");
    if (this.recipient != undefined) {
        this.xmlSetAttribute(node, "Recipient", this.recipient);
    }
    if (this.printFormat != undefined) {
        this.xmlSetAttribute(node, "PrintFormat", this.printFormat);
    }
    if (this.printWidth != undefined) {
        this.xmlSetAttribute(node, "PrintWidth", timapi.utils.StringHelper.makeString(this.printWidth));
    }
    if (this.printFlags != undefined) {
        this.xmlSetAttribute(node, "PrintFlags", timapi.utils.StringHelper.makeString(this.printFlags));
    }
    return node;
};
timapi.protocol.sixml.ProtocolOption = function (a) {
    if (arguments.length == 1 && a instanceof timapi.protocol.sixml.ProtocolOption) {
        var value = a;
        this.value = value.value;
        this.optionType = value.optionType;
        return;
    }
    if (arguments.length == 1 && a instanceof timapi.protocol.XmlNode) {
        var node = a;
        this.value = node.textContent;
        if (this.xmlHasAttribute(node, "OptionType")) {
            this.optionType = this.xmlGetAttribute(node, "OptionType");
        }
        return;
    }
    if (arguments.length != 0) {
        throw new Error("Invalid argument");
    }
};
timapi.protocol.sixml.ProtocolOption.prototype = Object.create(timapi.protocol.Container.prototype);
timapi.protocol.sixml.ProtocolOption.prototype.value = "";
timapi.protocol.sixml.ProtocolOption.prototype.optionType = undefined;
timapi.protocol.sixml.ProtocolOption.prototype.toXmlNode = function () {
    var node = new timapi.protocol.XmlNode("sixml:ProtocolOption");
    node.textContent = this.value;
    if (this.optionType != undefined) {
        this.xmlSetAttribute(node, "OptionType", this.optionType);
    }
    return node;
};
timapi.protocol.sixml.ProtocolOptionList = function (a) {
    this.protocolOption = [];
    if (arguments.length == 1 && a instanceof timapi.protocol.sixml.ProtocolOptionList) {
        var value = a;
        for (var each of value.protocolOption) {
            this.protocolOption.push(each ? new timapi.protocol.sixml.ProtocolOption(each) : undefined);
        }
        return;
    }
    if (arguments.length == 1 && a instanceof timapi.protocol.XmlNode) {
        var node = a;
        for (var each of this.xmlGetChildren(node, "sixml:ProtocolOption")) {
            this.protocolOption.push(new timapi.protocol.sixml.ProtocolOption(each));
        }
        return;
    }
    if (arguments.length != 0) {
        throw new Error("Invalid argument");
    }
};
timapi.protocol.sixml.ProtocolOptionList.prototype = Object.create(timapi.protocol.Container.prototype);
timapi.protocol.sixml.ProtocolOptionList.prototype.protocolOption = undefined;
timapi.protocol.sixml.ProtocolOptionList.prototype.toXmlNode = function () {
    var node = new timapi.protocol.XmlNode("sixml:ProtocolOptionList");
    for (var each of this.protocolOption) {
        this.xmlAddChild(node, "sixml:ProtocolOption", each);
    }
    return node;
};
timapi.protocol.sixml.Receipt = function (a) {
    if (arguments.length == 1 && a instanceof timapi.protocol.sixml.Receipt) {
        var value = a;
        this.value = value.value;
        this.recipient = value.recipient;
        return;
    }
    if (arguments.length == 1 && a instanceof timapi.protocol.XmlNode) {
        var node = a;
        this.value = node.textContent;
        if (this.xmlHasAttribute(node, "Recipient")) {
            this.recipient = this.xmlGetAttribute(node, "Recipient");
        }
        return;
    }
    if (arguments.length != 0) {
        throw new Error("Invalid argument");
    }
};
timapi.protocol.sixml.Receipt.prototype = Object.create(timapi.protocol.Container.prototype);
timapi.protocol.sixml.Receipt.prototype.value = "";
timapi.protocol.sixml.Receipt.prototype.recipient = undefined;
timapi.protocol.sixml.Receipt.prototype.toXmlNode = function () {
    var node = new timapi.protocol.XmlNode("sixml:Receipt");
    node.textContent = this.value;
    if (this.recipient != undefined) {
        this.xmlSetAttribute(node, "Recipient", this.recipient);
    }
    return node;
};
timapi.protocol.sixml.ReceiptHeader = function (a) {
    if (arguments.length == 1 && a instanceof timapi.protocol.sixml.ReceiptHeader) {
        var value = a;
        this.value = value.value;
        this.lineNum = value.lineNum;
        return;
    }
    if (arguments.length == 1 && a instanceof timapi.protocol.XmlNode) {
        var node = a;
        this.value = node.textContent;
        if (this.xmlHasAttribute(node, "LineNum")) {
            this.lineNum = (this.xmlGetAttribute(node, "LineNum") ? parseInt(this.xmlGetAttribute(node, "LineNum")) : 0);
        }
        return;
    }
    if (arguments.length != 0) {
        throw new Error("Invalid argument");
    }
};
timapi.protocol.sixml.ReceiptHeader.prototype = Object.create(timapi.protocol.Container.prototype);
timapi.protocol.sixml.ReceiptHeader.prototype.value = "";
timapi.protocol.sixml.ReceiptHeader.prototype.lineNum = undefined;
timapi.protocol.sixml.ReceiptHeader.prototype.toXmlNode = function () {
    var node = new timapi.protocol.XmlNode("sixml:ReceiptHeader");
    node.textContent = this.value;
    if (this.lineNum != undefined) {
        this.xmlSetAttribute(node, "LineNum", timapi.utils.StringHelper.makeString(this.lineNum));
    }
    return node;
};
timapi.protocol.sixml.ReceiptItem = function (a) {
    if (arguments.length == 1 && a instanceof timapi.protocol.sixml.ReceiptItem) {
        var value = a;
        this.value = value.value;
        this.receiptItemType = value.receiptItemType;
        this.recipient = value.recipient;
        return;
    }
    if (arguments.length == 1 && a instanceof timapi.protocol.XmlNode) {
        var node = a;
        this.value = node.textContent;
        if (this.xmlHasAttribute(node, "ReceiptItemType")) {
            this.receiptItemType = this.xmlGetAttribute(node, "ReceiptItemType");
        }
        if (this.xmlHasAttribute(node, "Recipient")) {
            this.recipient = this.xmlGetAttribute(node, "Recipient");
        }
        return;
    }
    if (arguments.length != 0) {
        throw new Error("Invalid argument");
    }
};
timapi.protocol.sixml.ReceiptItem.prototype = Object.create(timapi.protocol.Container.prototype);
timapi.protocol.sixml.ReceiptItem.prototype.value = "";
timapi.protocol.sixml.ReceiptItem.prototype.receiptItemType = undefined;
timapi.protocol.sixml.ReceiptItem.prototype.recipient = undefined;
timapi.protocol.sixml.ReceiptItem.prototype.toXmlNode = function () {
    var node = new timapi.protocol.XmlNode("sixml:ReceiptItem");
    node.textContent = this.value;
    if (this.receiptItemType != undefined) {
        this.xmlSetAttribute(node, "ReceiptItemType", this.receiptItemType);
    }
    if (this.recipient != undefined) {
        this.xmlSetAttribute(node, "Recipient", this.recipient);
    }
    return node;
};
timapi.protocol.sixml.ReceiptItems = function (a) {
    this.receiptItem = [];
    if (arguments.length == 1 && a instanceof timapi.protocol.sixml.ReceiptItems) {
        var value = a;
        this.receiptType = value.receiptType;
        for (var each of value.receiptItem) {
            this.receiptItem.push(each ? new timapi.protocol.sixml.ReceiptItem(each) : undefined);
        }
        return;
    }
    if (arguments.length == 1 && a instanceof timapi.protocol.XmlNode) {
        var node = a;
        if (this.xmlHasAttribute(node, "ReceiptType")) {
            this.receiptType = this.xmlGetAttribute(node, "ReceiptType");
        }
        for (var each of this.xmlGetChildren(node, "sixml:ReceiptItem")) {
            this.receiptItem.push(new timapi.protocol.sixml.ReceiptItem(each));
        }
        return;
    }
    if (arguments.length != 0) {
        throw new Error("Invalid argument");
    }
};
timapi.protocol.sixml.ReceiptItems.prototype = Object.create(timapi.protocol.Container.prototype);
timapi.protocol.sixml.ReceiptItems.prototype.receiptType = undefined;
timapi.protocol.sixml.ReceiptItems.prototype.receiptItem = undefined;
timapi.protocol.sixml.ReceiptItems.prototype.toXmlNode = function () {
    var node = new timapi.protocol.XmlNode("sixml:ReceiptItems");
    if (this.receiptType != undefined) {
        this.xmlSetAttribute(node, "ReceiptType", this.receiptType);
    }
    for (var each of this.receiptItem) {
        this.xmlAddChild(node, "sixml:ReceiptItem", each);
    }
    return node;
};
timapi.protocol.sixml.Request = function (a) {
    if (arguments.length == 1 && a instanceof timapi.protocol.sixml.Request) {
        var value = a;
        this.functionGroup = value.functionGroup;
        this.function = value.function;
        this.sequenceNumber = value.sequenceNumber;
        this.repeat = value.repeat;
        return;
    }
    if (arguments.length == 1 && a instanceof timapi.protocol.XmlNode) {
        var node = a;
        if (this.xmlHasAttribute(node, "FunctionGroup")) {
            this.functionGroup = this.xmlGetAttribute(node, "FunctionGroup");
        }
        if (this.xmlHasAttribute(node, "Function")) {
            this.function = this.xmlGetAttribute(node, "Function");
        }
        if (this.xmlHasAttribute(node, "SequenceNumber")) {
            this.sequenceNumber = (this.xmlGetAttribute(node, "SequenceNumber") ? parseInt(this.xmlGetAttribute(node, "SequenceNumber")) : 0);
        }
        if (this.xmlHasAttribute(node, "Repeat")) {
            this.repeat = (this.xmlGetAttribute(node, "Repeat") ? parseInt(this.xmlGetAttribute(node, "Repeat")) : 0);
        }
        return;
    }
    if (arguments.length == 0) {
        return;
    }
    throw new Error("Invalid argument");
};
timapi.protocol.sixml.Request.prototype = Object.create(timapi.protocol.Message.prototype);
timapi.protocol.sixml.Request.prototype.functionGroup = undefined;
timapi.protocol.sixml.Request.prototype.function = undefined;
timapi.protocol.sixml.Request.prototype.sequenceNumber = undefined;
timapi.protocol.sixml.Request.prototype.repeat = undefined;
timapi.protocol.sixml.Request.prototype.toXmlNode = function () {
    var node = new timapi.protocol.XmlNode("sixml:Request");
    this.xmlSetAttribute(node, "xmlns:sixml", "http://www.six-payment-services.com/");
    if (this.functionGroup != undefined) {
        this.xmlSetAttribute(node, "FunctionGroup", this.functionGroup);
    }
    if (this.function != undefined) {
        this.xmlSetAttribute(node, "Function", this.function);
    }
    if (this.sequenceNumber != undefined) {
        this.xmlSetAttribute(node, "SequenceNumber", timapi.utils.StringHelper.makeString(this.sequenceNumber));
    }
    if (this.repeat != undefined) {
        this.xmlSetAttribute(node, "Repeat", timapi.utils.StringHelper.makeString(this.repeat));
    }
    return node;
};
timapi.protocol.sixml.Request_Activate = function (a) {
    if (arguments.length == 1 && a instanceof timapi.protocol.sixml.Request_Activate) {
        var value = a;
        this.functionGroup = value.functionGroup;
        this.function = value.function;
        this.sequenceNumber = value.sequenceNumber;
        this.usrId = value.usrId;
        return;
    }
    if (arguments.length == 1 && a instanceof timapi.protocol.XmlNode) {
        var node = a;
        if (this.xmlHasAttribute(node, "FunctionGroup")) {
            this.functionGroup = this.xmlGetAttribute(node, "FunctionGroup");
        }
        if (this.xmlHasAttribute(node, "Function")) {
            this.function = this.xmlGetAttribute(node, "Function");
        }
        if (this.xmlHasAttribute(node, "SequenceNumber")) {
            this.sequenceNumber = (this.xmlGetAttribute(node, "SequenceNumber") ? parseInt(this.xmlGetAttribute(node, "SequenceNumber")) : 0);
        }
        if (this.xmlHasChild(node, "sixml:UsrId")) {
            this.usrId = (this.xmlGetChild(node, "sixml:UsrId").textContent ? parseInt(this.xmlGetChild(node, "sixml:UsrId").textContent) : 0);
        }
        return;
    }
    if (arguments.length == 0) {
        this.functionGroup = "Admin";
        this.function = "Activate";
        return;
    }
    throw new Error("Invalid argument");
};
timapi.protocol.sixml.Request_Activate.prototype = Object.create(timapi.protocol.Message.prototype);
timapi.protocol.sixml.Request_Activate.prototype.functionGroup = undefined;
timapi.protocol.sixml.Request_Activate.prototype.function = undefined;
timapi.protocol.sixml.Request_Activate.prototype.sequenceNumber = undefined;
timapi.protocol.sixml.Request_Activate.prototype.usrId = undefined;
timapi.protocol.sixml.Request_Activate.prototype.toXmlNode = function () {
    var node = new timapi.protocol.XmlNode("sixml:Request");
    this.xmlSetAttribute(node, "xmlns:sixml", "http://www.six-payment-services.com/");
    if (this.functionGroup != undefined) {
        this.xmlSetAttribute(node, "FunctionGroup", this.functionGroup);
    }
    if (this.function != undefined) {
        this.xmlSetAttribute(node, "Function", this.function);
    }
    if (this.sequenceNumber != undefined) {
        this.xmlSetAttribute(node, "SequenceNumber", timapi.utils.StringHelper.makeString(this.sequenceNumber));
    }
    if (this.usrId != undefined) {
        this.xmlAddChild(node, "sixml:UsrId", timapi.utils.StringHelper.makeString(this.usrId));
    }
    return node;
};
timapi.protocol.sixml.Request_ActivateServiceMenu = function (a) {
    if (arguments.length == 1 && a instanceof timapi.protocol.sixml.Request_ActivateServiceMenu) {
        var value = a;
        this.functionGroup = value.functionGroup;
        this.function = value.function;
        this.sequenceNumber = value.sequenceNumber;
        return;
    }
    if (arguments.length == 1 && a instanceof timapi.protocol.XmlNode) {
        var node = a;
        if (this.xmlHasAttribute(node, "FunctionGroup")) {
            this.functionGroup = this.xmlGetAttribute(node, "FunctionGroup");
        }
        if (this.xmlHasAttribute(node, "Function")) {
            this.function = this.xmlGetAttribute(node, "Function");
        }
        if (this.xmlHasAttribute(node, "SequenceNumber")) {
            this.sequenceNumber = (this.xmlGetAttribute(node, "SequenceNumber") ? parseInt(this.xmlGetAttribute(node, "SequenceNumber")) : 0);
        }
        return;
    }
    if (arguments.length == 0) {
        this.functionGroup = "Admin";
        this.function = "ActivateServiceMenu";
        return;
    }
    throw new Error("Invalid argument");
};
timapi.protocol.sixml.Request_ActivateServiceMenu.prototype = Object.create(timapi.protocol.Message.prototype);
timapi.protocol.sixml.Request_ActivateServiceMenu.prototype.functionGroup = undefined;
timapi.protocol.sixml.Request_ActivateServiceMenu.prototype.function = undefined;
timapi.protocol.sixml.Request_ActivateServiceMenu.prototype.sequenceNumber = undefined;
timapi.protocol.sixml.Request_ActivateServiceMenu.prototype.toXmlNode = function () {
    var node = new timapi.protocol.XmlNode("sixml:Request");
    this.xmlSetAttribute(node, "xmlns:sixml", "http://www.six-payment-services.com/");
    if (this.functionGroup != undefined) {
        this.xmlSetAttribute(node, "FunctionGroup", this.functionGroup);
    }
    if (this.function != undefined) {
        this.xmlSetAttribute(node, "Function", this.function);
    }
    if (this.sequenceNumber != undefined) {
        this.xmlSetAttribute(node, "SequenceNumber", timapi.utils.StringHelper.makeString(this.sequenceNumber));
    }
    return node;
};
timapi.protocol.sixml.Request_AdjustReservation = function (a) {
    if (arguments.length == 1 && a instanceof timapi.protocol.sixml.Request_AdjustReservation) {
        var value = a;
        this.functionGroup = value.functionGroup;
        this.function = value.function;
        this.sequenceNumber = value.sequenceNumber;
        this.amount = value.amount ? new timapi.protocol.sixml.Amount(value.amount) : undefined;
        this.transactionData = value.transactionData ? new timapi.protocol.sixml.TransactionData(value.transactionData) : undefined;
        this.merchantOptionList = value.merchantOptionList ? new timapi.protocol.sixml.MerchantOptionList(value.merchantOptionList) : undefined;
        return;
    }
    if (arguments.length == 1 && a instanceof timapi.protocol.XmlNode) {
        var node = a;
        if (this.xmlHasAttribute(node, "FunctionGroup")) {
            this.functionGroup = this.xmlGetAttribute(node, "FunctionGroup");
        }
        if (this.xmlHasAttribute(node, "Function")) {
            this.function = this.xmlGetAttribute(node, "Function");
        }
        if (this.xmlHasAttribute(node, "SequenceNumber")) {
            this.sequenceNumber = (this.xmlGetAttribute(node, "SequenceNumber") ? parseInt(this.xmlGetAttribute(node, "SequenceNumber")) : 0);
        }
        if (this.xmlHasChild(node, "sixml:Amount")) {
            this.amount = new timapi.protocol.sixml.Amount(this.xmlGetChild(node, "sixml:Amount"));
        }
        if (this.xmlHasChild(node, "sixml:TransactionData")) {
            this.transactionData = new timapi.protocol.sixml.TransactionData(this.xmlGetChild(node, "sixml:TransactionData"));
        }
        if (this.xmlHasChild(node, "sixml:MerchantOptionList")) {
            this.merchantOptionList = new timapi.protocol.sixml.MerchantOptionList(this.xmlGetChild(node, "sixml:MerchantOptionList"));
        }
        return;
    }
    if (arguments.length == 0) {
        this.functionGroup = "NonFinTransaction";
        this.function = "AdjustReservation";
        return;
    }
    throw new Error("Invalid argument");
};
timapi.protocol.sixml.Request_AdjustReservation.prototype = Object.create(timapi.protocol.Message.prototype);
timapi.protocol.sixml.Request_AdjustReservation.prototype.functionGroup = undefined;
timapi.protocol.sixml.Request_AdjustReservation.prototype.function = undefined;
timapi.protocol.sixml.Request_AdjustReservation.prototype.sequenceNumber = undefined;
timapi.protocol.sixml.Request_AdjustReservation.prototype.amount = undefined;
timapi.protocol.sixml.Request_AdjustReservation.prototype.transactionData = undefined;
timapi.protocol.sixml.Request_AdjustReservation.prototype.merchantOptionList = undefined;
timapi.protocol.sixml.Request_AdjustReservation.prototype.toXmlNode = function () {
    var node = new timapi.protocol.XmlNode("sixml:Request");
    this.xmlSetAttribute(node, "xmlns:sixml", "http://www.six-payment-services.com/");
    if (this.functionGroup != undefined) {
        this.xmlSetAttribute(node, "FunctionGroup", this.functionGroup);
    }
    if (this.function != undefined) {
        this.xmlSetAttribute(node, "Function", this.function);
    }
    if (this.sequenceNumber != undefined) {
        this.xmlSetAttribute(node, "SequenceNumber", timapi.utils.StringHelper.makeString(this.sequenceNumber));
    }
    if (this.amount != undefined) {
        this.xmlAddChild(node, "sixml:Amount", this.amount);
    }
    if (this.transactionData != undefined) {
        this.xmlAddChild(node, "sixml:TransactionData", this.transactionData);
    }
    if (this.merchantOptionList != undefined) {
        this.xmlAddChild(node, "sixml:MerchantOptionList", this.merchantOptionList);
    }
    return node;
};
timapi.protocol.sixml.Request_ApplicationInformation = function (a) {
    if (arguments.length == 1 && a instanceof timapi.protocol.sixml.Request_ApplicationInformation) {
        var value = a;
        this.functionGroup = value.functionGroup;
        this.function = value.function;
        this.sequenceNumber = value.sequenceNumber;
        return;
    }
    if (arguments.length == 1 && a instanceof timapi.protocol.XmlNode) {
        var node = a;
        if (this.xmlHasAttribute(node, "FunctionGroup")) {
            this.functionGroup = this.xmlGetAttribute(node, "FunctionGroup");
        }
        if (this.xmlHasAttribute(node, "Function")) {
            this.function = this.xmlGetAttribute(node, "Function");
        }
        if (this.xmlHasAttribute(node, "SequenceNumber")) {
            this.sequenceNumber = (this.xmlGetAttribute(node, "SequenceNumber") ? parseInt(this.xmlGetAttribute(node, "SequenceNumber")) : 0);
        }
        return;
    }
    if (arguments.length == 0) {
        this.functionGroup = "Status";
        this.function = "ApplicationInformation";
        return;
    }
    throw new Error("Invalid argument");
};
timapi.protocol.sixml.Request_ApplicationInformation.prototype = Object.create(timapi.protocol.Message.prototype);
timapi.protocol.sixml.Request_ApplicationInformation.prototype.functionGroup = undefined;
timapi.protocol.sixml.Request_ApplicationInformation.prototype.function = undefined;
timapi.protocol.sixml.Request_ApplicationInformation.prototype.sequenceNumber = undefined;
timapi.protocol.sixml.Request_ApplicationInformation.prototype.toXmlNode = function () {
    var node = new timapi.protocol.XmlNode("sixml:Request");
    this.xmlSetAttribute(node, "xmlns:sixml", "http://www.six-payment-services.com/");
    if (this.functionGroup != undefined) {
        this.xmlSetAttribute(node, "FunctionGroup", this.functionGroup);
    }
    if (this.function != undefined) {
        this.xmlSetAttribute(node, "Function", this.function);
    }
    if (this.sequenceNumber != undefined) {
        this.xmlSetAttribute(node, "SequenceNumber", timapi.utils.StringHelper.makeString(this.sequenceNumber));
    }
    return node;
};
timapi.protocol.sixml.Request_AuthorizeCredit = function (a) {
    if (arguments.length == 1 && a instanceof timapi.protocol.sixml.Request_AuthorizeCredit) {
        var value = a;
        this.functionGroup = value.functionGroup;
        this.function = value.function;
        this.sequenceNumber = value.sequenceNumber;
        this.amount = value.amount ? new timapi.protocol.sixml.Amount(value.amount) : undefined;
        this.transactionData = value.transactionData ? new timapi.protocol.sixml.TransactionData(value.transactionData) : undefined;
        this.merchantOptionList = value.merchantOptionList ? new timapi.protocol.sixml.MerchantOptionList(value.merchantOptionList) : undefined;
        return;
    }
    if (arguments.length == 1 && a instanceof timapi.protocol.XmlNode) {
        var node = a;
        if (this.xmlHasAttribute(node, "FunctionGroup")) {
            this.functionGroup = this.xmlGetAttribute(node, "FunctionGroup");
        }
        if (this.xmlHasAttribute(node, "Function")) {
            this.function = this.xmlGetAttribute(node, "Function");
        }
        if (this.xmlHasAttribute(node, "SequenceNumber")) {
            this.sequenceNumber = (this.xmlGetAttribute(node, "SequenceNumber") ? parseInt(this.xmlGetAttribute(node, "SequenceNumber")) : 0);
        }
        if (this.xmlHasChild(node, "sixml:Amount")) {
            this.amount = new timapi.protocol.sixml.Amount(this.xmlGetChild(node, "sixml:Amount"));
        }
        if (this.xmlHasChild(node, "sixml:TransactionData")) {
            this.transactionData = new timapi.protocol.sixml.TransactionData(this.xmlGetChild(node, "sixml:TransactionData"));
        }
        if (this.xmlHasChild(node, "sixml:MerchantOptionList")) {
            this.merchantOptionList = new timapi.protocol.sixml.MerchantOptionList(this.xmlGetChild(node, "sixml:MerchantOptionList"));
        }
        return;
    }
    if (arguments.length == 0) {
        this.functionGroup = "FinTransaction";
        this.function = "AuthorizeCredit";
        return;
    }
    throw new Error("Invalid argument");
};
timapi.protocol.sixml.Request_AuthorizeCredit.prototype = Object.create(timapi.protocol.Message.prototype);
timapi.protocol.sixml.Request_AuthorizeCredit.prototype.functionGroup = undefined;
timapi.protocol.sixml.Request_AuthorizeCredit.prototype.function = undefined;
timapi.protocol.sixml.Request_AuthorizeCredit.prototype.sequenceNumber = undefined;
timapi.protocol.sixml.Request_AuthorizeCredit.prototype.amount = undefined;
timapi.protocol.sixml.Request_AuthorizeCredit.prototype.transactionData = undefined;
timapi.protocol.sixml.Request_AuthorizeCredit.prototype.merchantOptionList = undefined;
timapi.protocol.sixml.Request_AuthorizeCredit.prototype.toXmlNode = function () {
    var node = new timapi.protocol.XmlNode("sixml:Request");
    this.xmlSetAttribute(node, "xmlns:sixml", "http://www.six-payment-services.com/");
    if (this.functionGroup != undefined) {
        this.xmlSetAttribute(node, "FunctionGroup", this.functionGroup);
    }
    if (this.function != undefined) {
        this.xmlSetAttribute(node, "Function", this.function);
    }
    if (this.sequenceNumber != undefined) {
        this.xmlSetAttribute(node, "SequenceNumber", timapi.utils.StringHelper.makeString(this.sequenceNumber));
    }
    if (this.amount != undefined) {
        this.xmlAddChild(node, "sixml:Amount", this.amount);
    }
    if (this.transactionData != undefined) {
        this.xmlAddChild(node, "sixml:TransactionData", this.transactionData);
    }
    if (this.merchantOptionList != undefined) {
        this.xmlAddChild(node, "sixml:MerchantOptionList", this.merchantOptionList);
    }
    return node;
};
timapi.protocol.sixml.Request_AuthorizeDeposit = function (a) {
    if (arguments.length == 1 && a instanceof timapi.protocol.sixml.Request_AuthorizeDeposit) {
        var value = a;
        this.functionGroup = value.functionGroup;
        this.function = value.function;
        this.sequenceNumber = value.sequenceNumber;
        this.amount = value.amount ? new timapi.protocol.sixml.Amount(value.amount) : undefined;
        this.transactionData = value.transactionData ? new timapi.protocol.sixml.TransactionData(value.transactionData) : undefined;
        this.merchantOptionList = value.merchantOptionList ? new timapi.protocol.sixml.MerchantOptionList(value.merchantOptionList) : undefined;
        return;
    }
    if (arguments.length == 1 && a instanceof timapi.protocol.XmlNode) {
        var node = a;
        if (this.xmlHasAttribute(node, "FunctionGroup")) {
            this.functionGroup = this.xmlGetAttribute(node, "FunctionGroup");
        }
        if (this.xmlHasAttribute(node, "Function")) {
            this.function = this.xmlGetAttribute(node, "Function");
        }
        if (this.xmlHasAttribute(node, "SequenceNumber")) {
            this.sequenceNumber = (this.xmlGetAttribute(node, "SequenceNumber") ? parseInt(this.xmlGetAttribute(node, "SequenceNumber")) : 0);
        }
        if (this.xmlHasChild(node, "sixml:Amount")) {
            this.amount = new timapi.protocol.sixml.Amount(this.xmlGetChild(node, "sixml:Amount"));
        }
        if (this.xmlHasChild(node, "sixml:TransactionData")) {
            this.transactionData = new timapi.protocol.sixml.TransactionData(this.xmlGetChild(node, "sixml:TransactionData"));
        }
        if (this.xmlHasChild(node, "sixml:MerchantOptionList")) {
            this.merchantOptionList = new timapi.protocol.sixml.MerchantOptionList(this.xmlGetChild(node, "sixml:MerchantOptionList"));
        }
        return;
    }
    if (arguments.length == 0) {
        this.functionGroup = "FinTransaction";
        this.function = "AuthorizeDeposit";
        return;
    }
    throw new Error("Invalid argument");
};
timapi.protocol.sixml.Request_AuthorizeDeposit.prototype = Object.create(timapi.protocol.Message.prototype);
timapi.protocol.sixml.Request_AuthorizeDeposit.prototype.functionGroup = undefined;
timapi.protocol.sixml.Request_AuthorizeDeposit.prototype.function = undefined;
timapi.protocol.sixml.Request_AuthorizeDeposit.prototype.sequenceNumber = undefined;
timapi.protocol.sixml.Request_AuthorizeDeposit.prototype.amount = undefined;
timapi.protocol.sixml.Request_AuthorizeDeposit.prototype.transactionData = undefined;
timapi.protocol.sixml.Request_AuthorizeDeposit.prototype.merchantOptionList = undefined;
timapi.protocol.sixml.Request_AuthorizeDeposit.prototype.toXmlNode = function () {
    var node = new timapi.protocol.XmlNode("sixml:Request");
    this.xmlSetAttribute(node, "xmlns:sixml", "http://www.six-payment-services.com/");
    if (this.functionGroup != undefined) {
        this.xmlSetAttribute(node, "FunctionGroup", this.functionGroup);
    }
    if (this.function != undefined) {
        this.xmlSetAttribute(node, "Function", this.function);
    }
    if (this.sequenceNumber != undefined) {
        this.xmlSetAttribute(node, "SequenceNumber", timapi.utils.StringHelper.makeString(this.sequenceNumber));
    }
    if (this.amount != undefined) {
        this.xmlAddChild(node, "sixml:Amount", this.amount);
    }
    if (this.transactionData != undefined) {
        this.xmlAddChild(node, "sixml:TransactionData", this.transactionData);
    }
    if (this.merchantOptionList != undefined) {
        this.xmlAddChild(node, "sixml:MerchantOptionList", this.merchantOptionList);
    }
    return node;
};
timapi.protocol.sixml.Request_Balance = function (a) {
    if (arguments.length == 1 && a instanceof timapi.protocol.sixml.Request_Balance) {
        var value = a;
        this.functionGroup = value.functionGroup;
        this.function = value.function;
        this.sequenceNumber = value.sequenceNumber;
        return;
    }
    if (arguments.length == 1 && a instanceof timapi.protocol.XmlNode) {
        var node = a;
        if (this.xmlHasAttribute(node, "FunctionGroup")) {
            this.functionGroup = this.xmlGetAttribute(node, "FunctionGroup");
        }
        if (this.xmlHasAttribute(node, "Function")) {
            this.function = this.xmlGetAttribute(node, "Function");
        }
        if (this.xmlHasAttribute(node, "SequenceNumber")) {
            this.sequenceNumber = (this.xmlGetAttribute(node, "SequenceNumber") ? parseInt(this.xmlGetAttribute(node, "SequenceNumber")) : 0);
        }
        return;
    }
    if (arguments.length == 0) {
        this.functionGroup = "Admin";
        this.function = "Balance";
        return;
    }
    throw new Error("Invalid argument");
};
timapi.protocol.sixml.Request_Balance.prototype = Object.create(timapi.protocol.Message.prototype);
timapi.protocol.sixml.Request_Balance.prototype.functionGroup = undefined;
timapi.protocol.sixml.Request_Balance.prototype.function = undefined;
timapi.protocol.sixml.Request_Balance.prototype.sequenceNumber = undefined;
timapi.protocol.sixml.Request_Balance.prototype.toXmlNode = function () {
    var node = new timapi.protocol.XmlNode("sixml:Request");
    this.xmlSetAttribute(node, "xmlns:sixml", "http://www.six-payment-services.com/");
    if (this.functionGroup != undefined) {
        this.xmlSetAttribute(node, "FunctionGroup", this.functionGroup);
    }
    if (this.function != undefined) {
        this.xmlSetAttribute(node, "Function", this.function);
    }
    if (this.sequenceNumber != undefined) {
        this.xmlSetAttribute(node, "SequenceNumber", timapi.utils.StringHelper.makeString(this.sequenceNumber));
    }
    return node;
};
timapi.protocol.sixml.Request_BalanceInquiry = function (a) {
    if (arguments.length == 1 && a instanceof timapi.protocol.sixml.Request_BalanceInquiry) {
        var value = a;
        this.functionGroup = value.functionGroup;
        this.function = value.function;
        this.sequenceNumber = value.sequenceNumber;
        this.language = value.language;
        return;
    }
    if (arguments.length == 1 && a instanceof timapi.protocol.XmlNode) {
        var node = a;
        if (this.xmlHasAttribute(node, "FunctionGroup")) {
            this.functionGroup = this.xmlGetAttribute(node, "FunctionGroup");
        }
        if (this.xmlHasAttribute(node, "Function")) {
            this.function = this.xmlGetAttribute(node, "Function");
        }
        if (this.xmlHasAttribute(node, "SequenceNumber")) {
            this.sequenceNumber = (this.xmlGetAttribute(node, "SequenceNumber") ? parseInt(this.xmlGetAttribute(node, "SequenceNumber")) : 0);
        }
        if (this.xmlHasChild(node, "sixml:Language")) {
            this.language = this.xmlGetChild(node, "sixml:Language").textContent;
        }
        return;
    }
    if (arguments.length == 0) {
        this.functionGroup = "NonFinTransaction";
        this.function = "BalanceInquiry";
        return;
    }
    throw new Error("Invalid argument");
};
timapi.protocol.sixml.Request_BalanceInquiry.prototype = Object.create(timapi.protocol.Message.prototype);
timapi.protocol.sixml.Request_BalanceInquiry.prototype.functionGroup = undefined;
timapi.protocol.sixml.Request_BalanceInquiry.prototype.function = undefined;
timapi.protocol.sixml.Request_BalanceInquiry.prototype.sequenceNumber = undefined;
timapi.protocol.sixml.Request_BalanceInquiry.prototype.language = undefined;
timapi.protocol.sixml.Request_BalanceInquiry.prototype.toXmlNode = function () {
    var node = new timapi.protocol.XmlNode("sixml:Request");
    this.xmlSetAttribute(node, "xmlns:sixml", "http://www.six-payment-services.com/");
    if (this.functionGroup != undefined) {
        this.xmlSetAttribute(node, "FunctionGroup", this.functionGroup);
    }
    if (this.function != undefined) {
        this.xmlSetAttribute(node, "Function", this.function);
    }
    if (this.sequenceNumber != undefined) {
        this.xmlSetAttribute(node, "SequenceNumber", timapi.utils.StringHelper.makeString(this.sequenceNumber));
    }
    if (this.language != undefined) {
        this.xmlAddChild(node, "sixml:Language", this.language);
    }
    return node;
};
timapi.protocol.sixml.Request_CancelReservation = function (a) {
    if (arguments.length == 1 && a instanceof timapi.protocol.sixml.Request_CancelReservation) {
        var value = a;
        this.functionGroup = value.functionGroup;
        this.function = value.function;
        this.sequenceNumber = value.sequenceNumber;
        this.transactionData = value.transactionData ? new timapi.protocol.sixml.TransactionData(value.transactionData) : undefined;
        this.merchantOptionList = value.merchantOptionList ? new timapi.protocol.sixml.MerchantOptionList(value.merchantOptionList) : undefined;
        return;
    }
    if (arguments.length == 1 && a instanceof timapi.protocol.XmlNode) {
        var node = a;
        if (this.xmlHasAttribute(node, "FunctionGroup")) {
            this.functionGroup = this.xmlGetAttribute(node, "FunctionGroup");
        }
        if (this.xmlHasAttribute(node, "Function")) {
            this.function = this.xmlGetAttribute(node, "Function");
        }
        if (this.xmlHasAttribute(node, "SequenceNumber")) {
            this.sequenceNumber = (this.xmlGetAttribute(node, "SequenceNumber") ? parseInt(this.xmlGetAttribute(node, "SequenceNumber")) : 0);
        }
        if (this.xmlHasChild(node, "sixml:TransactionData")) {
            this.transactionData = new timapi.protocol.sixml.TransactionData(this.xmlGetChild(node, "sixml:TransactionData"));
        }
        if (this.xmlHasChild(node, "sixml:MerchantOptionList")) {
            this.merchantOptionList = new timapi.protocol.sixml.MerchantOptionList(this.xmlGetChild(node, "sixml:MerchantOptionList"));
        }
        return;
    }
    if (arguments.length == 0) {
        this.functionGroup = "NonFinTransaction";
        this.function = "CancelReservation";
        return;
    }
    throw new Error("Invalid argument");
};
timapi.protocol.sixml.Request_CancelReservation.prototype = Object.create(timapi.protocol.Message.prototype);
timapi.protocol.sixml.Request_CancelReservation.prototype.functionGroup = undefined;
timapi.protocol.sixml.Request_CancelReservation.prototype.function = undefined;
timapi.protocol.sixml.Request_CancelReservation.prototype.sequenceNumber = undefined;
timapi.protocol.sixml.Request_CancelReservation.prototype.transactionData = undefined;
timapi.protocol.sixml.Request_CancelReservation.prototype.merchantOptionList = undefined;
timapi.protocol.sixml.Request_CancelReservation.prototype.toXmlNode = function () {
    var node = new timapi.protocol.XmlNode("sixml:Request");
    this.xmlSetAttribute(node, "xmlns:sixml", "http://www.six-payment-services.com/");
    if (this.functionGroup != undefined) {
        this.xmlSetAttribute(node, "FunctionGroup", this.functionGroup);
    }
    if (this.function != undefined) {
        this.xmlSetAttribute(node, "Function", this.function);
    }
    if (this.sequenceNumber != undefined) {
        this.xmlSetAttribute(node, "SequenceNumber", timapi.utils.StringHelper.makeString(this.sequenceNumber));
    }
    if (this.transactionData != undefined) {
        this.xmlAddChild(node, "sixml:TransactionData", this.transactionData);
    }
    if (this.merchantOptionList != undefined) {
        this.xmlAddChild(node, "sixml:MerchantOptionList", this.merchantOptionList);
    }
    return node;
};
timapi.protocol.sixml.Request_CashAdvance = function (a) {
    if (arguments.length == 1 && a instanceof timapi.protocol.sixml.Request_CashAdvance) {
        var value = a;
        this.functionGroup = value.functionGroup;
        this.function = value.function;
        this.sequenceNumber = value.sequenceNumber;
        this.usrId = value.usrId;
        this.amount = value.amount ? new timapi.protocol.sixml.Amount(value.amount) : undefined;
        this.transactionData = value.transactionData ? new timapi.protocol.sixml.TransactionData(value.transactionData) : undefined;
        this.merchantOptionList = value.merchantOptionList ? new timapi.protocol.sixml.MerchantOptionList(value.merchantOptionList) : undefined;
        return;
    }
    if (arguments.length == 1 && a instanceof timapi.protocol.XmlNode) {
        var node = a;
        if (this.xmlHasAttribute(node, "FunctionGroup")) {
            this.functionGroup = this.xmlGetAttribute(node, "FunctionGroup");
        }
        if (this.xmlHasAttribute(node, "Function")) {
            this.function = this.xmlGetAttribute(node, "Function");
        }
        if (this.xmlHasAttribute(node, "SequenceNumber")) {
            this.sequenceNumber = (this.xmlGetAttribute(node, "SequenceNumber") ? parseInt(this.xmlGetAttribute(node, "SequenceNumber")) : 0);
        }
        if (this.xmlHasChild(node, "sixml:UsrId")) {
            this.usrId = (this.xmlGetChild(node, "sixml:UsrId").textContent ? parseInt(this.xmlGetChild(node, "sixml:UsrId").textContent) : 0);
        }
        if (this.xmlHasChild(node, "sixml:Amount")) {
            this.amount = new timapi.protocol.sixml.Amount(this.xmlGetChild(node, "sixml:Amount"));
        }
        if (this.xmlHasChild(node, "sixml:TransactionData")) {
            this.transactionData = new timapi.protocol.sixml.TransactionData(this.xmlGetChild(node, "sixml:TransactionData"));
        }
        if (this.xmlHasChild(node, "sixml:MerchantOptionList")) {
            this.merchantOptionList = new timapi.protocol.sixml.MerchantOptionList(this.xmlGetChild(node, "sixml:MerchantOptionList"));
        }
        return;
    }
    if (arguments.length == 0) {
        this.functionGroup = "FinTransaction";
        this.function = "CashAdvance";
        return;
    }
    throw new Error("Invalid argument");
};
timapi.protocol.sixml.Request_CashAdvance.prototype = Object.create(timapi.protocol.Message.prototype);
timapi.protocol.sixml.Request_CashAdvance.prototype.functionGroup = undefined;
timapi.protocol.sixml.Request_CashAdvance.prototype.function = undefined;
timapi.protocol.sixml.Request_CashAdvance.prototype.sequenceNumber = undefined;
timapi.protocol.sixml.Request_CashAdvance.prototype.usrId = undefined;
timapi.protocol.sixml.Request_CashAdvance.prototype.amount = undefined;
timapi.protocol.sixml.Request_CashAdvance.prototype.transactionData = undefined;
timapi.protocol.sixml.Request_CashAdvance.prototype.merchantOptionList = undefined;
timapi.protocol.sixml.Request_CashAdvance.prototype.toXmlNode = function () {
    var node = new timapi.protocol.XmlNode("sixml:Request");
    this.xmlSetAttribute(node, "xmlns:sixml", "http://www.six-payment-services.com/");
    if (this.functionGroup != undefined) {
        this.xmlSetAttribute(node, "FunctionGroup", this.functionGroup);
    }
    if (this.function != undefined) {
        this.xmlSetAttribute(node, "Function", this.function);
    }
    if (this.sequenceNumber != undefined) {
        this.xmlSetAttribute(node, "SequenceNumber", timapi.utils.StringHelper.makeString(this.sequenceNumber));
    }
    if (this.usrId != undefined) {
        this.xmlAddChild(node, "sixml:UsrId", timapi.utils.StringHelper.makeString(this.usrId));
    }
    if (this.amount != undefined) {
        this.xmlAddChild(node, "sixml:Amount", this.amount);
    }
    if (this.transactionData != undefined) {
        this.xmlAddChild(node, "sixml:TransactionData", this.transactionData);
    }
    if (this.merchantOptionList != undefined) {
        this.xmlAddChild(node, "sixml:MerchantOptionList", this.merchantOptionList);
    }
    return node;
};
timapi.protocol.sixml.Request_ChangeSettings = function (a) {
    if (arguments.length == 1 && a instanceof timapi.protocol.sixml.Request_ChangeSettings) {
        var value = a;
        this.functionGroup = value.functionGroup;
        this.function = value.function;
        this.sequenceNumber = value.sequenceNumber;
        this.settingsList = value.settingsList ? new timapi.protocol.sixml.SettingsList(value.settingsList) : undefined;
        return;
    }
    if (arguments.length == 1 && a instanceof timapi.protocol.XmlNode) {
        var node = a;
        if (this.xmlHasAttribute(node, "FunctionGroup")) {
            this.functionGroup = this.xmlGetAttribute(node, "FunctionGroup");
        }
        if (this.xmlHasAttribute(node, "Function")) {
            this.function = this.xmlGetAttribute(node, "Function");
        }
        if (this.xmlHasAttribute(node, "SequenceNumber")) {
            this.sequenceNumber = (this.xmlGetAttribute(node, "SequenceNumber") ? parseInt(this.xmlGetAttribute(node, "SequenceNumber")) : 0);
        }
        if (this.xmlHasChild(node, "sixml:SettingsList")) {
            this.settingsList = new timapi.protocol.sixml.SettingsList(this.xmlGetChild(node, "sixml:SettingsList"));
        }
        return;
    }
    if (arguments.length == 0) {
        this.functionGroup = "Admin";
        this.function = "ChangeSettings";
        return;
    }
    throw new Error("Invalid argument");
};
timapi.protocol.sixml.Request_ChangeSettings.prototype = Object.create(timapi.protocol.Message.prototype);
timapi.protocol.sixml.Request_ChangeSettings.prototype.functionGroup = undefined;
timapi.protocol.sixml.Request_ChangeSettings.prototype.function = undefined;
timapi.protocol.sixml.Request_ChangeSettings.prototype.sequenceNumber = undefined;
timapi.protocol.sixml.Request_ChangeSettings.prototype.settingsList = undefined;
timapi.protocol.sixml.Request_ChangeSettings.prototype.toXmlNode = function () {
    var node = new timapi.protocol.XmlNode("sixml:Request");
    this.xmlSetAttribute(node, "xmlns:sixml", "http://www.six-payment-services.com/");
    if (this.functionGroup != undefined) {
        this.xmlSetAttribute(node, "FunctionGroup", this.functionGroup);
    }
    if (this.function != undefined) {
        this.xmlSetAttribute(node, "Function", this.function);
    }
    if (this.sequenceNumber != undefined) {
        this.xmlSetAttribute(node, "SequenceNumber", timapi.utils.StringHelper.makeString(this.sequenceNumber));
    }
    if (this.settingsList != undefined) {
        this.xmlAddChild(node, "sixml:SettingsList", this.settingsList);
    }
    return node;
};
timapi.protocol.sixml.Request_CloseDialogMode = function (a) {
    if (arguments.length == 1 && a instanceof timapi.protocol.sixml.Request_CloseDialogMode) {
        var value = a;
        this.functionGroup = value.functionGroup;
        this.function = value.function;
        this.sequenceNumber = value.sequenceNumber;
        return;
    }
    if (arguments.length == 1 && a instanceof timapi.protocol.XmlNode) {
        var node = a;
        if (this.xmlHasAttribute(node, "FunctionGroup")) {
            this.functionGroup = this.xmlGetAttribute(node, "FunctionGroup");
        }
        if (this.xmlHasAttribute(node, "Function")) {
            this.function = this.xmlGetAttribute(node, "Function");
        }
        if (this.xmlHasAttribute(node, "SequenceNumber")) {
            this.sequenceNumber = (this.xmlGetAttribute(node, "SequenceNumber") ? parseInt(this.xmlGetAttribute(node, "SequenceNumber")) : 0);
        }
        return;
    }
    if (arguments.length == 0) {
        this.functionGroup = "Admin";
        this.function = "CloseDialogMode";
        return;
    }
    throw new Error("Invalid argument");
};
timapi.protocol.sixml.Request_CloseDialogMode.prototype = Object.create(timapi.protocol.Message.prototype);
timapi.protocol.sixml.Request_CloseDialogMode.prototype.functionGroup = undefined;
timapi.protocol.sixml.Request_CloseDialogMode.prototype.function = undefined;
timapi.protocol.sixml.Request_CloseDialogMode.prototype.sequenceNumber = undefined;
timapi.protocol.sixml.Request_CloseDialogMode.prototype.toXmlNode = function () {
    var node = new timapi.protocol.XmlNode("sixml:Request");
    this.xmlSetAttribute(node, "xmlns:sixml", "http://www.six-payment-services.com/");
    if (this.functionGroup != undefined) {
        this.xmlSetAttribute(node, "FunctionGroup", this.functionGroup);
    }
    if (this.function != undefined) {
        this.xmlSetAttribute(node, "Function", this.function);
    }
    if (this.sequenceNumber != undefined) {
        this.xmlSetAttribute(node, "SequenceNumber", timapi.utils.StringHelper.makeString(this.sequenceNumber));
    }
    return node;
};
timapi.protocol.sixml.Request_CloseMaintenanceWindow = function (a) {
    if (arguments.length == 1 && a instanceof timapi.protocol.sixml.Request_CloseMaintenanceWindow) {
        var value = a;
        this.functionGroup = value.functionGroup;
        this.function = value.function;
        this.sequenceNumber = value.sequenceNumber;
        return;
    }
    if (arguments.length == 1 && a instanceof timapi.protocol.XmlNode) {
        var node = a;
        if (this.xmlHasAttribute(node, "FunctionGroup")) {
            this.functionGroup = this.xmlGetAttribute(node, "FunctionGroup");
        }
        if (this.xmlHasAttribute(node, "Function")) {
            this.function = this.xmlGetAttribute(node, "Function");
        }
        if (this.xmlHasAttribute(node, "SequenceNumber")) {
            this.sequenceNumber = (this.xmlGetAttribute(node, "SequenceNumber") ? parseInt(this.xmlGetAttribute(node, "SequenceNumber")) : 0);
        }
        return;
    }
    if (arguments.length == 0) {
        this.functionGroup = "Admin";
        this.function = "CloseMaintenanceWindow";
        return;
    }
    throw new Error("Invalid argument");
};
timapi.protocol.sixml.Request_CloseMaintenanceWindow.prototype = Object.create(timapi.protocol.Message.prototype);
timapi.protocol.sixml.Request_CloseMaintenanceWindow.prototype.functionGroup = undefined;
timapi.protocol.sixml.Request_CloseMaintenanceWindow.prototype.function = undefined;
timapi.protocol.sixml.Request_CloseMaintenanceWindow.prototype.sequenceNumber = undefined;
timapi.protocol.sixml.Request_CloseMaintenanceWindow.prototype.toXmlNode = function () {
    var node = new timapi.protocol.XmlNode("sixml:Request");
    this.xmlSetAttribute(node, "xmlns:sixml", "http://www.six-payment-services.com/");
    if (this.functionGroup != undefined) {
        this.xmlSetAttribute(node, "FunctionGroup", this.functionGroup);
    }
    if (this.function != undefined) {
        this.xmlSetAttribute(node, "Function", this.function);
    }
    if (this.sequenceNumber != undefined) {
        this.xmlSetAttribute(node, "SequenceNumber", timapi.utils.StringHelper.makeString(this.sequenceNumber));
    }
    return node;
};
timapi.protocol.sixml.Request_CloseReader = function (a) {
    if (arguments.length == 1 && a instanceof timapi.protocol.sixml.Request_CloseReader) {
        var value = a;
        this.functionGroup = value.functionGroup;
        this.function = value.function;
        this.sequenceNumber = value.sequenceNumber;
        return;
    }
    if (arguments.length == 1 && a instanceof timapi.protocol.XmlNode) {
        var node = a;
        if (this.xmlHasAttribute(node, "FunctionGroup")) {
            this.functionGroup = this.xmlGetAttribute(node, "FunctionGroup");
        }
        if (this.xmlHasAttribute(node, "Function")) {
            this.function = this.xmlGetAttribute(node, "Function");
        }
        if (this.xmlHasAttribute(node, "SequenceNumber")) {
            this.sequenceNumber = (this.xmlGetAttribute(node, "SequenceNumber") ? parseInt(this.xmlGetAttribute(node, "SequenceNumber")) : 0);
        }
        return;
    }
    if (arguments.length == 0) {
        this.functionGroup = "Admin";
        this.function = "CloseReader";
        return;
    }
    throw new Error("Invalid argument");
};
timapi.protocol.sixml.Request_CloseReader.prototype = Object.create(timapi.protocol.Message.prototype);
timapi.protocol.sixml.Request_CloseReader.prototype.functionGroup = undefined;
timapi.protocol.sixml.Request_CloseReader.prototype.function = undefined;
timapi.protocol.sixml.Request_CloseReader.prototype.sequenceNumber = undefined;
timapi.protocol.sixml.Request_CloseReader.prototype.toXmlNode = function () {
    var node = new timapi.protocol.XmlNode("sixml:Request");
    this.xmlSetAttribute(node, "xmlns:sixml", "http://www.six-payment-services.com/");
    if (this.functionGroup != undefined) {
        this.xmlSetAttribute(node, "FunctionGroup", this.functionGroup);
    }
    if (this.function != undefined) {
        this.xmlSetAttribute(node, "Function", this.function);
    }
    if (this.sequenceNumber != undefined) {
        this.xmlSetAttribute(node, "SequenceNumber", timapi.utils.StringHelper.makeString(this.sequenceNumber));
    }
    return node;
};
timapi.protocol.sixml.Request_CollectPoints = function (a) {
    if (arguments.length == 1 && a instanceof timapi.protocol.sixml.Request_CollectPoints) {
        var value = a;
        this.functionGroup = value.functionGroup;
        this.function = value.function;
        this.sequenceNumber = value.sequenceNumber;
        this.amount = value.amount ? new timapi.protocol.sixml.Amount(value.amount) : undefined;
        this.transactionData = value.transactionData ? new timapi.protocol.sixml.TransactionData(value.transactionData) : undefined;
        this.merchantOptionList = value.merchantOptionList ? new timapi.protocol.sixml.MerchantOptionList(value.merchantOptionList) : undefined;
        return;
    }
    if (arguments.length == 1 && a instanceof timapi.protocol.XmlNode) {
        var node = a;
        if (this.xmlHasAttribute(node, "FunctionGroup")) {
            this.functionGroup = this.xmlGetAttribute(node, "FunctionGroup");
        }
        if (this.xmlHasAttribute(node, "Function")) {
            this.function = this.xmlGetAttribute(node, "Function");
        }
        if (this.xmlHasAttribute(node, "SequenceNumber")) {
            this.sequenceNumber = (this.xmlGetAttribute(node, "SequenceNumber") ? parseInt(this.xmlGetAttribute(node, "SequenceNumber")) : 0);
        }
        if (this.xmlHasChild(node, "sixml:Amount")) {
            this.amount = new timapi.protocol.sixml.Amount(this.xmlGetChild(node, "sixml:Amount"));
        }
        if (this.xmlHasChild(node, "sixml:TransactionData")) {
            this.transactionData = new timapi.protocol.sixml.TransactionData(this.xmlGetChild(node, "sixml:TransactionData"));
        }
        if (this.xmlHasChild(node, "sixml:MerchantOptionList")) {
            this.merchantOptionList = new timapi.protocol.sixml.MerchantOptionList(this.xmlGetChild(node, "sixml:MerchantOptionList"));
        }
        return;
    }
    if (arguments.length == 0) {
        this.functionGroup = "FinTransaction";
        this.function = "CollectPoints";
        return;
    }
    throw new Error("Invalid argument");
};
timapi.protocol.sixml.Request_CollectPoints.prototype = Object.create(timapi.protocol.Message.prototype);
timapi.protocol.sixml.Request_CollectPoints.prototype.functionGroup = undefined;
timapi.protocol.sixml.Request_CollectPoints.prototype.function = undefined;
timapi.protocol.sixml.Request_CollectPoints.prototype.sequenceNumber = undefined;
timapi.protocol.sixml.Request_CollectPoints.prototype.amount = undefined;
timapi.protocol.sixml.Request_CollectPoints.prototype.transactionData = undefined;
timapi.protocol.sixml.Request_CollectPoints.prototype.merchantOptionList = undefined;
timapi.protocol.sixml.Request_CollectPoints.prototype.toXmlNode = function () {
    var node = new timapi.protocol.XmlNode("sixml:Request");
    this.xmlSetAttribute(node, "xmlns:sixml", "http://www.six-payment-services.com/");
    if (this.functionGroup != undefined) {
        this.xmlSetAttribute(node, "FunctionGroup", this.functionGroup);
    }
    if (this.function != undefined) {
        this.xmlSetAttribute(node, "Function", this.function);
    }
    if (this.sequenceNumber != undefined) {
        this.xmlSetAttribute(node, "SequenceNumber", timapi.utils.StringHelper.makeString(this.sequenceNumber));
    }
    if (this.amount != undefined) {
        this.xmlAddChild(node, "sixml:Amount", this.amount);
    }
    if (this.transactionData != undefined) {
        this.xmlAddChild(node, "sixml:TransactionData", this.transactionData);
    }
    if (this.merchantOptionList != undefined) {
        this.xmlAddChild(node, "sixml:MerchantOptionList", this.merchantOptionList);
    }
    return node;
};
timapi.protocol.sixml.Request_Combined = function (a) {
    if (arguments.length == 1 && a instanceof timapi.protocol.sixml.Request_Combined) {
        var value = a;
        this.functionGroup = value.functionGroup;
        this.function = value.function;
        this.sequenceNumber = value.sequenceNumber;
        this.amount = value.amount ? new timapi.protocol.sixml.Amount(value.amount) : undefined;
        this.amountOther = value.amountOther ? new timapi.protocol.sixml.AmountOther(value.amountOther) : undefined;
        this.transactionData = value.transactionData ? new timapi.protocol.sixml.TransactionData(value.transactionData) : undefined;
        this.merchantOptionList = value.merchantOptionList ? new timapi.protocol.sixml.MerchantOptionList(value.merchantOptionList) : undefined;
        return;
    }
    if (arguments.length == 1 && a instanceof timapi.protocol.XmlNode) {
        var node = a;
        if (this.xmlHasAttribute(node, "FunctionGroup")) {
            this.functionGroup = this.xmlGetAttribute(node, "FunctionGroup");
        }
        if (this.xmlHasAttribute(node, "Function")) {
            this.function = this.xmlGetAttribute(node, "Function");
        }
        if (this.xmlHasAttribute(node, "SequenceNumber")) {
            this.sequenceNumber = (this.xmlGetAttribute(node, "SequenceNumber") ? parseInt(this.xmlGetAttribute(node, "SequenceNumber")) : 0);
        }
        if (this.xmlHasChild(node, "sixml:Amount")) {
            this.amount = new timapi.protocol.sixml.Amount(this.xmlGetChild(node, "sixml:Amount"));
        }
        if (this.xmlHasChild(node, "sixml:AmountOther")) {
            this.amountOther = new timapi.protocol.sixml.AmountOther(this.xmlGetChild(node, "sixml:AmountOther"));
        }
        if (this.xmlHasChild(node, "sixml:TransactionData")) {
            this.transactionData = new timapi.protocol.sixml.TransactionData(this.xmlGetChild(node, "sixml:TransactionData"));
        }
        if (this.xmlHasChild(node, "sixml:MerchantOptionList")) {
            this.merchantOptionList = new timapi.protocol.sixml.MerchantOptionList(this.xmlGetChild(node, "sixml:MerchantOptionList"));
        }
        return;
    }
    if (arguments.length == 0) {
        this.functionGroup = "FinTransaction";
        this.function = "Combined";
        return;
    }
    throw new Error("Invalid argument");
};
timapi.protocol.sixml.Request_Combined.prototype = Object.create(timapi.protocol.Message.prototype);
timapi.protocol.sixml.Request_Combined.prototype.functionGroup = undefined;
timapi.protocol.sixml.Request_Combined.prototype.function = undefined;
timapi.protocol.sixml.Request_Combined.prototype.sequenceNumber = undefined;
timapi.protocol.sixml.Request_Combined.prototype.amount = undefined;
timapi.protocol.sixml.Request_Combined.prototype.amountOther = undefined;
timapi.protocol.sixml.Request_Combined.prototype.transactionData = undefined;
timapi.protocol.sixml.Request_Combined.prototype.merchantOptionList = undefined;
timapi.protocol.sixml.Request_Combined.prototype.toXmlNode = function () {
    var node = new timapi.protocol.XmlNode("sixml:Request");
    this.xmlSetAttribute(node, "xmlns:sixml", "http://www.six-payment-services.com/");
    if (this.functionGroup != undefined) {
        this.xmlSetAttribute(node, "FunctionGroup", this.functionGroup);
    }
    if (this.function != undefined) {
        this.xmlSetAttribute(node, "Function", this.function);
    }
    if (this.sequenceNumber != undefined) {
        this.xmlSetAttribute(node, "SequenceNumber", timapi.utils.StringHelper.makeString(this.sequenceNumber));
    }
    if (this.amount != undefined) {
        this.xmlAddChild(node, "sixml:Amount", this.amount);
    }
    if (this.amountOther != undefined) {
        this.xmlAddChild(node, "sixml:AmountOther", this.amountOther);
    }
    if (this.transactionData != undefined) {
        this.xmlAddChild(node, "sixml:TransactionData", this.transactionData);
    }
    if (this.merchantOptionList != undefined) {
        this.xmlAddChild(node, "sixml:MerchantOptionList", this.merchantOptionList);
    }
    return node;
};
timapi.protocol.sixml.Request_Commit = function (a) {
    if (arguments.length == 1 && a instanceof timapi.protocol.sixml.Request_Commit) {
        var value = a;
        this.functionGroup = value.functionGroup;
        this.function = value.function;
        this.sequenceNumber = value.sequenceNumber;
        this.repeat = value.repeat;
        this.amount = value.amount ? new timapi.protocol.sixml.Amount(value.amount) : undefined;
        return;
    }
    if (arguments.length == 1 && a instanceof timapi.protocol.XmlNode) {
        var node = a;
        if (this.xmlHasAttribute(node, "FunctionGroup")) {
            this.functionGroup = this.xmlGetAttribute(node, "FunctionGroup");
        }
        if (this.xmlHasAttribute(node, "Function")) {
            this.function = this.xmlGetAttribute(node, "Function");
        }
        if (this.xmlHasAttribute(node, "SequenceNumber")) {
            this.sequenceNumber = (this.xmlGetAttribute(node, "SequenceNumber") ? parseInt(this.xmlGetAttribute(node, "SequenceNumber")) : 0);
        }
        if (this.xmlHasAttribute(node, "Repeat")) {
            this.repeat = (this.xmlGetAttribute(node, "Repeat") ? parseInt(this.xmlGetAttribute(node, "Repeat")) : 0);
        }
        if (this.xmlHasChild(node, "sixml:Amount")) {
            this.amount = new timapi.protocol.sixml.Amount(this.xmlGetChild(node, "sixml:Amount"));
        }
        return;
    }
    if (arguments.length == 0) {
        this.functionGroup = "FinTransaction";
        this.function = "Commit";
        return;
    }
    throw new Error("Invalid argument");
};
timapi.protocol.sixml.Request_Commit.prototype = Object.create(timapi.protocol.Message.prototype);
timapi.protocol.sixml.Request_Commit.prototype.functionGroup = undefined;
timapi.protocol.sixml.Request_Commit.prototype.function = undefined;
timapi.protocol.sixml.Request_Commit.prototype.sequenceNumber = undefined;
timapi.protocol.sixml.Request_Commit.prototype.repeat = undefined;
timapi.protocol.sixml.Request_Commit.prototype.amount = undefined;
timapi.protocol.sixml.Request_Commit.prototype.toXmlNode = function () {
    var node = new timapi.protocol.XmlNode("sixml:Request");
    this.xmlSetAttribute(node, "xmlns:sixml", "http://www.six-payment-services.com/");
    if (this.functionGroup != undefined) {
        this.xmlSetAttribute(node, "FunctionGroup", this.functionGroup);
    }
    if (this.function != undefined) {
        this.xmlSetAttribute(node, "Function", this.function);
    }
    if (this.sequenceNumber != undefined) {
        this.xmlSetAttribute(node, "SequenceNumber", timapi.utils.StringHelper.makeString(this.sequenceNumber));
    }
    if (this.repeat != undefined) {
        this.xmlSetAttribute(node, "Repeat", timapi.utils.StringHelper.makeString(this.repeat));
    }
    if (this.amount != undefined) {
        this.xmlAddChild(node, "sixml:Amount", this.amount);
    }
    return node;
};
timapi.protocol.sixml.Request_CounterRequest = function (a) {
    if (arguments.length == 1 && a instanceof timapi.protocol.sixml.Request_CounterRequest) {
        var value = a;
        this.functionGroup = value.functionGroup;
        this.function = value.function;
        this.sequenceNumber = value.sequenceNumber;
        this.counterType = value.counterType;
        return;
    }
    if (arguments.length == 1 && a instanceof timapi.protocol.XmlNode) {
        var node = a;
        if (this.xmlHasAttribute(node, "FunctionGroup")) {
            this.functionGroup = this.xmlGetAttribute(node, "FunctionGroup");
        }
        if (this.xmlHasAttribute(node, "Function")) {
            this.function = this.xmlGetAttribute(node, "Function");
        }
        if (this.xmlHasAttribute(node, "SequenceNumber")) {
            this.sequenceNumber = (this.xmlGetAttribute(node, "SequenceNumber") ? parseInt(this.xmlGetAttribute(node, "SequenceNumber")) : 0);
        }
        if (this.xmlHasChild(node, "sixml:CounterType")) {
            this.counterType = this.xmlGetChild(node, "sixml:CounterType").textContent;
        }
        return;
    }
    if (arguments.length == 0) {
        this.functionGroup = "Admin";
        this.function = "CounterRequest";
        return;
    }
    throw new Error("Invalid argument");
};
timapi.protocol.sixml.Request_CounterRequest.prototype = Object.create(timapi.protocol.Message.prototype);
timapi.protocol.sixml.Request_CounterRequest.prototype.functionGroup = undefined;
timapi.protocol.sixml.Request_CounterRequest.prototype.function = undefined;
timapi.protocol.sixml.Request_CounterRequest.prototype.sequenceNumber = undefined;
timapi.protocol.sixml.Request_CounterRequest.prototype.counterType = undefined;
timapi.protocol.sixml.Request_CounterRequest.prototype.toXmlNode = function () {
    var node = new timapi.protocol.XmlNode("sixml:Request");
    this.xmlSetAttribute(node, "xmlns:sixml", "http://www.six-payment-services.com/");
    if (this.functionGroup != undefined) {
        this.xmlSetAttribute(node, "FunctionGroup", this.functionGroup);
    }
    if (this.function != undefined) {
        this.xmlSetAttribute(node, "Function", this.function);
    }
    if (this.sequenceNumber != undefined) {
        this.xmlSetAttribute(node, "SequenceNumber", timapi.utils.StringHelper.makeString(this.sequenceNumber));
    }
    if (this.counterType != undefined) {
        this.xmlAddChild(node, "sixml:CounterType", this.counterType);
    }
    return node;
};
timapi.protocol.sixml.Request_Credit = function (a) {
    if (arguments.length == 1 && a instanceof timapi.protocol.sixml.Request_Credit) {
        var value = a;
        this.functionGroup = value.functionGroup;
        this.function = value.function;
        this.sequenceNumber = value.sequenceNumber;
        this.usrId = value.usrId;
        this.amount = value.amount ? new timapi.protocol.sixml.Amount(value.amount) : undefined;
        this.transactionData = value.transactionData ? new timapi.protocol.sixml.TransactionData(value.transactionData) : undefined;
        this.merchantOptionList = value.merchantOptionList ? new timapi.protocol.sixml.MerchantOptionList(value.merchantOptionList) : undefined;
        return;
    }
    if (arguments.length == 1 && a instanceof timapi.protocol.XmlNode) {
        var node = a;
        if (this.xmlHasAttribute(node, "FunctionGroup")) {
            this.functionGroup = this.xmlGetAttribute(node, "FunctionGroup");
        }
        if (this.xmlHasAttribute(node, "Function")) {
            this.function = this.xmlGetAttribute(node, "Function");
        }
        if (this.xmlHasAttribute(node, "SequenceNumber")) {
            this.sequenceNumber = (this.xmlGetAttribute(node, "SequenceNumber") ? parseInt(this.xmlGetAttribute(node, "SequenceNumber")) : 0);
        }
        if (this.xmlHasChild(node, "sixml:UsrId")) {
            this.usrId = (this.xmlGetChild(node, "sixml:UsrId").textContent ? parseInt(this.xmlGetChild(node, "sixml:UsrId").textContent) : 0);
        }
        if (this.xmlHasChild(node, "sixml:Amount")) {
            this.amount = new timapi.protocol.sixml.Amount(this.xmlGetChild(node, "sixml:Amount"));
        }
        if (this.xmlHasChild(node, "sixml:TransactionData")) {
            this.transactionData = new timapi.protocol.sixml.TransactionData(this.xmlGetChild(node, "sixml:TransactionData"));
        }
        if (this.xmlHasChild(node, "sixml:MerchantOptionList")) {
            this.merchantOptionList = new timapi.protocol.sixml.MerchantOptionList(this.xmlGetChild(node, "sixml:MerchantOptionList"));
        }
        return;
    }
    if (arguments.length == 0) {
        this.functionGroup = "FinTransaction";
        this.function = "Credit";
        return;
    }
    throw new Error("Invalid argument");
};
timapi.protocol.sixml.Request_Credit.prototype = Object.create(timapi.protocol.Message.prototype);
timapi.protocol.sixml.Request_Credit.prototype.functionGroup = undefined;
timapi.protocol.sixml.Request_Credit.prototype.function = undefined;
timapi.protocol.sixml.Request_Credit.prototype.sequenceNumber = undefined;
timapi.protocol.sixml.Request_Credit.prototype.usrId = undefined;
timapi.protocol.sixml.Request_Credit.prototype.amount = undefined;
timapi.protocol.sixml.Request_Credit.prototype.transactionData = undefined;
timapi.protocol.sixml.Request_Credit.prototype.merchantOptionList = undefined;
timapi.protocol.sixml.Request_Credit.prototype.toXmlNode = function () {
    var node = new timapi.protocol.XmlNode("sixml:Request");
    this.xmlSetAttribute(node, "xmlns:sixml", "http://www.six-payment-services.com/");
    if (this.functionGroup != undefined) {
        this.xmlSetAttribute(node, "FunctionGroup", this.functionGroup);
    }
    if (this.function != undefined) {
        this.xmlSetAttribute(node, "Function", this.function);
    }
    if (this.sequenceNumber != undefined) {
        this.xmlSetAttribute(node, "SequenceNumber", timapi.utils.StringHelper.makeString(this.sequenceNumber));
    }
    if (this.usrId != undefined) {
        this.xmlAddChild(node, "sixml:UsrId", timapi.utils.StringHelper.makeString(this.usrId));
    }
    if (this.amount != undefined) {
        this.xmlAddChild(node, "sixml:Amount", this.amount);
    }
    if (this.transactionData != undefined) {
        this.xmlAddChild(node, "sixml:TransactionData", this.transactionData);
    }
    if (this.merchantOptionList != undefined) {
        this.xmlAddChild(node, "sixml:MerchantOptionList", this.merchantOptionList);
    }
    return node;
};
timapi.protocol.sixml.Request_DccRates = function (a) {
    if (arguments.length == 1 && a instanceof timapi.protocol.sixml.Request_DccRates) {
        var value = a;
        this.functionGroup = value.functionGroup;
        this.function = value.function;
        this.sequenceNumber = value.sequenceNumber;
        return;
    }
    if (arguments.length == 1 && a instanceof timapi.protocol.XmlNode) {
        var node = a;
        if (this.xmlHasAttribute(node, "FunctionGroup")) {
            this.functionGroup = this.xmlGetAttribute(node, "FunctionGroup");
        }
        if (this.xmlHasAttribute(node, "Function")) {
            this.function = this.xmlGetAttribute(node, "Function");
        }
        if (this.xmlHasAttribute(node, "SequenceNumber")) {
            this.sequenceNumber = (this.xmlGetAttribute(node, "SequenceNumber") ? parseInt(this.xmlGetAttribute(node, "SequenceNumber")) : 0);
        }
        return;
    }
    if (arguments.length == 0) {
        this.functionGroup = "Admin";
        this.function = "DccRates";
        return;
    }
    throw new Error("Invalid argument");
};
timapi.protocol.sixml.Request_DccRates.prototype = Object.create(timapi.protocol.Message.prototype);
timapi.protocol.sixml.Request_DccRates.prototype.functionGroup = undefined;
timapi.protocol.sixml.Request_DccRates.prototype.function = undefined;
timapi.protocol.sixml.Request_DccRates.prototype.sequenceNumber = undefined;
timapi.protocol.sixml.Request_DccRates.prototype.toXmlNode = function () {
    var node = new timapi.protocol.XmlNode("sixml:Request");
    this.xmlSetAttribute(node, "xmlns:sixml", "http://www.six-payment-services.com/");
    if (this.functionGroup != undefined) {
        this.xmlSetAttribute(node, "FunctionGroup", this.functionGroup);
    }
    if (this.function != undefined) {
        this.xmlSetAttribute(node, "Function", this.function);
    }
    if (this.sequenceNumber != undefined) {
        this.xmlSetAttribute(node, "SequenceNumber", timapi.utils.StringHelper.makeString(this.sequenceNumber));
    }
    return node;
};
timapi.protocol.sixml.Request_Deactivate = function (a) {
    if (arguments.length == 1 && a instanceof timapi.protocol.sixml.Request_Deactivate) {
        var value = a;
        this.functionGroup = value.functionGroup;
        this.function = value.function;
        this.sequenceNumber = value.sequenceNumber;
        return;
    }
    if (arguments.length == 1 && a instanceof timapi.protocol.XmlNode) {
        var node = a;
        if (this.xmlHasAttribute(node, "FunctionGroup")) {
            this.functionGroup = this.xmlGetAttribute(node, "FunctionGroup");
        }
        if (this.xmlHasAttribute(node, "Function")) {
            this.function = this.xmlGetAttribute(node, "Function");
        }
        if (this.xmlHasAttribute(node, "SequenceNumber")) {
            this.sequenceNumber = (this.xmlGetAttribute(node, "SequenceNumber") ? parseInt(this.xmlGetAttribute(node, "SequenceNumber")) : 0);
        }
        return;
    }
    if (arguments.length == 0) {
        this.functionGroup = "Admin";
        this.function = "Deactivate";
        return;
    }
    throw new Error("Invalid argument");
};
timapi.protocol.sixml.Request_Deactivate.prototype = Object.create(timapi.protocol.Message.prototype);
timapi.protocol.sixml.Request_Deactivate.prototype.functionGroup = undefined;
timapi.protocol.sixml.Request_Deactivate.prototype.function = undefined;
timapi.protocol.sixml.Request_Deactivate.prototype.sequenceNumber = undefined;
timapi.protocol.sixml.Request_Deactivate.prototype.toXmlNode = function () {
    var node = new timapi.protocol.XmlNode("sixml:Request");
    this.xmlSetAttribute(node, "xmlns:sixml", "http://www.six-payment-services.com/");
    if (this.functionGroup != undefined) {
        this.xmlSetAttribute(node, "FunctionGroup", this.functionGroup);
    }
    if (this.function != undefined) {
        this.xmlSetAttribute(node, "Function", this.function);
    }
    if (this.sequenceNumber != undefined) {
        this.xmlSetAttribute(node, "SequenceNumber", timapi.utils.StringHelper.makeString(this.sequenceNumber));
    }
    return node;
};
timapi.protocol.sixml.Request_EjectCard = function (a) {
    if (arguments.length == 1 && a instanceof timapi.protocol.sixml.Request_EjectCard) {
        var value = a;
        this.functionGroup = value.functionGroup;
        this.function = value.function;
        this.sequenceNumber = value.sequenceNumber;
        return;
    }
    if (arguments.length == 1 && a instanceof timapi.protocol.XmlNode) {
        var node = a;
        if (this.xmlHasAttribute(node, "FunctionGroup")) {
            this.functionGroup = this.xmlGetAttribute(node, "FunctionGroup");
        }
        if (this.xmlHasAttribute(node, "Function")) {
            this.function = this.xmlGetAttribute(node, "Function");
        }
        if (this.xmlHasAttribute(node, "SequenceNumber")) {
            this.sequenceNumber = (this.xmlGetAttribute(node, "SequenceNumber") ? parseInt(this.xmlGetAttribute(node, "SequenceNumber")) : 0);
        }
        return;
    }
    if (arguments.length == 0) {
        this.functionGroup = "Admin";
        this.function = "EjectCard";
        return;
    }
    throw new Error("Invalid argument");
};
timapi.protocol.sixml.Request_EjectCard.prototype = Object.create(timapi.protocol.Message.prototype);
timapi.protocol.sixml.Request_EjectCard.prototype.functionGroup = undefined;
timapi.protocol.sixml.Request_EjectCard.prototype.function = undefined;
timapi.protocol.sixml.Request_EjectCard.prototype.sequenceNumber = undefined;
timapi.protocol.sixml.Request_EjectCard.prototype.toXmlNode = function () {
    var node = new timapi.protocol.XmlNode("sixml:Request");
    this.xmlSetAttribute(node, "xmlns:sixml", "http://www.six-payment-services.com/");
    if (this.functionGroup != undefined) {
        this.xmlSetAttribute(node, "FunctionGroup", this.functionGroup);
    }
    if (this.function != undefined) {
        this.xmlSetAttribute(node, "Function", this.function);
    }
    if (this.sequenceNumber != undefined) {
        this.xmlSetAttribute(node, "SequenceNumber", timapi.utils.StringHelper.makeString(this.sequenceNumber));
    }
    return node;
};
timapi.protocol.sixml.Request_FeatureRequest = function (a) {
    if (arguments.length == 1 && a instanceof timapi.protocol.sixml.Request_FeatureRequest) {
        var value = a;
        this.functionGroup = value.functionGroup;
        this.function = value.function;
        this.sequenceNumber = value.sequenceNumber;
        return;
    }
    if (arguments.length == 1 && a instanceof timapi.protocol.XmlNode) {
        var node = a;
        if (this.xmlHasAttribute(node, "FunctionGroup")) {
            this.functionGroup = this.xmlGetAttribute(node, "FunctionGroup");
        }
        if (this.xmlHasAttribute(node, "Function")) {
            this.function = this.xmlGetAttribute(node, "Function");
        }
        if (this.xmlHasAttribute(node, "SequenceNumber")) {
            this.sequenceNumber = (this.xmlGetAttribute(node, "SequenceNumber") ? parseInt(this.xmlGetAttribute(node, "SequenceNumber")) : 0);
        }
        return;
    }
    if (arguments.length == 0) {
        this.functionGroup = "Status";
        this.function = "FeatureRequest";
        return;
    }
    throw new Error("Invalid argument");
};
timapi.protocol.sixml.Request_FeatureRequest.prototype = Object.create(timapi.protocol.Message.prototype);
timapi.protocol.sixml.Request_FeatureRequest.prototype.functionGroup = undefined;
timapi.protocol.sixml.Request_FeatureRequest.prototype.function = undefined;
timapi.protocol.sixml.Request_FeatureRequest.prototype.sequenceNumber = undefined;
timapi.protocol.sixml.Request_FeatureRequest.prototype.toXmlNode = function () {
    var node = new timapi.protocol.XmlNode("sixml:Request");
    this.xmlSetAttribute(node, "xmlns:sixml", "http://www.six-payment-services.com/");
    if (this.functionGroup != undefined) {
        this.xmlSetAttribute(node, "FunctionGroup", this.functionGroup);
    }
    if (this.function != undefined) {
        this.xmlSetAttribute(node, "Function", this.function);
    }
    if (this.sequenceNumber != undefined) {
        this.xmlSetAttribute(node, "SequenceNumber", timapi.utils.StringHelper.makeString(this.sequenceNumber));
    }
    return node;
};
timapi.protocol.sixml.Request_FinalizePurchase = function (a) {
    if (arguments.length == 1 && a instanceof timapi.protocol.sixml.Request_FinalizePurchase) {
        var value = a;
        this.functionGroup = value.functionGroup;
        this.function = value.function;
        this.sequenceNumber = value.sequenceNumber;
        this.transactionData = value.transactionData ? new timapi.protocol.sixml.TransactionData(value.transactionData) : undefined;
        this.amount = value.amount ? new timapi.protocol.sixml.Amount(value.amount) : undefined;
        this.basket = value.basket ? new timapi.protocol.sixml.Basket(value.basket) : undefined;
        this.additionalInfoList = value.additionalInfoList ? new timapi.protocol.sixml.AdditionalInfoList(value.additionalInfoList) : undefined;
        return;
    }
    if (arguments.length == 1 && a instanceof timapi.protocol.XmlNode) {
        var node = a;
        if (this.xmlHasAttribute(node, "FunctionGroup")) {
            this.functionGroup = this.xmlGetAttribute(node, "FunctionGroup");
        }
        if (this.xmlHasAttribute(node, "Function")) {
            this.function = this.xmlGetAttribute(node, "Function");
        }
        if (this.xmlHasAttribute(node, "SequenceNumber")) {
            this.sequenceNumber = (this.xmlGetAttribute(node, "SequenceNumber") ? parseInt(this.xmlGetAttribute(node, "SequenceNumber")) : 0);
        }
        if (this.xmlHasChild(node, "sixml:TransactionData")) {
            this.transactionData = new timapi.protocol.sixml.TransactionData(this.xmlGetChild(node, "sixml:TransactionData"));
        }
        if (this.xmlHasChild(node, "sixml:Amount")) {
            this.amount = new timapi.protocol.sixml.Amount(this.xmlGetChild(node, "sixml:Amount"));
        }
        if (this.xmlHasChild(node, "sixml:Basket")) {
            this.basket = new timapi.protocol.sixml.Basket(this.xmlGetChild(node, "sixml:Basket"));
        }
        if (this.xmlHasChild(node, "sixml:AdditionalInfoList")) {
            this.additionalInfoList = new timapi.protocol.sixml.AdditionalInfoList(this.xmlGetChild(node, "sixml:AdditionalInfoList"));
        }
        return;
    }
    if (arguments.length == 0) {
        this.functionGroup = "FinTransaction";
        this.function = "FinalizePurchase";
        return;
    }
    throw new Error("Invalid argument");
};
timapi.protocol.sixml.Request_FinalizePurchase.prototype = Object.create(timapi.protocol.Message.prototype);
timapi.protocol.sixml.Request_FinalizePurchase.prototype.functionGroup = undefined;
timapi.protocol.sixml.Request_FinalizePurchase.prototype.function = undefined;
timapi.protocol.sixml.Request_FinalizePurchase.prototype.sequenceNumber = undefined;
timapi.protocol.sixml.Request_FinalizePurchase.prototype.transactionData = undefined;
timapi.protocol.sixml.Request_FinalizePurchase.prototype.amount = undefined;
timapi.protocol.sixml.Request_FinalizePurchase.prototype.basket = undefined;
timapi.protocol.sixml.Request_FinalizePurchase.prototype.additionalInfoList = undefined;
timapi.protocol.sixml.Request_FinalizePurchase.prototype.toXmlNode = function () {
    var node = new timapi.protocol.XmlNode("sixml:Request");
    this.xmlSetAttribute(node, "xmlns:sixml", "http://www.six-payment-services.com/");
    if (this.functionGroup != undefined) {
        this.xmlSetAttribute(node, "FunctionGroup", this.functionGroup);
    }
    if (this.function != undefined) {
        this.xmlSetAttribute(node, "Function", this.function);
    }
    if (this.sequenceNumber != undefined) {
        this.xmlSetAttribute(node, "SequenceNumber", timapi.utils.StringHelper.makeString(this.sequenceNumber));
    }
    if (this.transactionData != undefined) {
        this.xmlAddChild(node, "sixml:TransactionData", this.transactionData);
    }
    if (this.amount != undefined) {
        this.xmlAddChild(node, "sixml:Amount", this.amount);
    }
    if (this.basket != undefined) {
        this.xmlAddChild(node, "sixml:Basket", this.basket);
    }
    if (this.additionalInfoList != undefined) {
        this.xmlAddChild(node, "sixml:AdditionalInfoList", this.additionalInfoList);
    }
    return node;
};
timapi.protocol.sixml.Request_Giro = function (a) {
    if (arguments.length == 1 && a instanceof timapi.protocol.sixml.Request_Giro) {
        var value = a;
        this.functionGroup = value.functionGroup;
        this.function = value.function;
        this.sequenceNumber = value.sequenceNumber;
        this.amount = value.amount ? new timapi.protocol.sixml.Amount(value.amount) : undefined;
        this.language = value.language;
        this.transactionData = value.transactionData ? new timapi.protocol.sixml.TransactionData(value.transactionData) : undefined;
        this.merchantOptionList = value.merchantOptionList ? new timapi.protocol.sixml.MerchantOptionList(value.merchantOptionList) : undefined;
        return;
    }
    if (arguments.length == 1 && a instanceof timapi.protocol.XmlNode) {
        var node = a;
        if (this.xmlHasAttribute(node, "FunctionGroup")) {
            this.functionGroup = this.xmlGetAttribute(node, "FunctionGroup");
        }
        if (this.xmlHasAttribute(node, "Function")) {
            this.function = this.xmlGetAttribute(node, "Function");
        }
        if (this.xmlHasAttribute(node, "SequenceNumber")) {
            this.sequenceNumber = (this.xmlGetAttribute(node, "SequenceNumber") ? parseInt(this.xmlGetAttribute(node, "SequenceNumber")) : 0);
        }
        if (this.xmlHasChild(node, "sixml:Amount")) {
            this.amount = new timapi.protocol.sixml.Amount(this.xmlGetChild(node, "sixml:Amount"));
        }
        if (this.xmlHasChild(node, "sixml:Language")) {
            this.language = this.xmlGetChild(node, "sixml:Language").textContent;
        }
        if (this.xmlHasChild(node, "sixml:TransactionData")) {
            this.transactionData = new timapi.protocol.sixml.TransactionData(this.xmlGetChild(node, "sixml:TransactionData"));
        }
        if (this.xmlHasChild(node, "sixml:MerchantOptionList")) {
            this.merchantOptionList = new timapi.protocol.sixml.MerchantOptionList(this.xmlGetChild(node, "sixml:MerchantOptionList"));
        }
        return;
    }
    if (arguments.length == 0) {
        this.functionGroup = "FinTransaction";
        this.function = "Giro";
        return;
    }
    throw new Error("Invalid argument");
};
timapi.protocol.sixml.Request_Giro.prototype = Object.create(timapi.protocol.Message.prototype);
timapi.protocol.sixml.Request_Giro.prototype.functionGroup = undefined;
timapi.protocol.sixml.Request_Giro.prototype.function = undefined;
timapi.protocol.sixml.Request_Giro.prototype.sequenceNumber = undefined;
timapi.protocol.sixml.Request_Giro.prototype.amount = undefined;
timapi.protocol.sixml.Request_Giro.prototype.language = undefined;
timapi.protocol.sixml.Request_Giro.prototype.transactionData = undefined;
timapi.protocol.sixml.Request_Giro.prototype.merchantOptionList = undefined;
timapi.protocol.sixml.Request_Giro.prototype.toXmlNode = function () {
    var node = new timapi.protocol.XmlNode("sixml:Request");
    this.xmlSetAttribute(node, "xmlns:sixml", "http://www.six-payment-services.com/");
    if (this.functionGroup != undefined) {
        this.xmlSetAttribute(node, "FunctionGroup", this.functionGroup);
    }
    if (this.function != undefined) {
        this.xmlSetAttribute(node, "Function", this.function);
    }
    if (this.sequenceNumber != undefined) {
        this.xmlSetAttribute(node, "SequenceNumber", timapi.utils.StringHelper.makeString(this.sequenceNumber));
    }
    if (this.amount != undefined) {
        this.xmlAddChild(node, "sixml:Amount", this.amount);
    }
    if (this.language != undefined) {
        this.xmlAddChild(node, "sixml:Language", this.language);
    }
    if (this.transactionData != undefined) {
        this.xmlAddChild(node, "sixml:TransactionData", this.transactionData);
    }
    if (this.merchantOptionList != undefined) {
        this.xmlAddChild(node, "sixml:MerchantOptionList", this.merchantOptionList);
    }
    return node;
};
timapi.protocol.sixml.Request_HardwareInformation = function (a) {
    if (arguments.length == 1 && a instanceof timapi.protocol.sixml.Request_HardwareInformation) {
        var value = a;
        this.functionGroup = value.functionGroup;
        this.function = value.function;
        this.sequenceNumber = value.sequenceNumber;
        return;
    }
    if (arguments.length == 1 && a instanceof timapi.protocol.XmlNode) {
        var node = a;
        if (this.xmlHasAttribute(node, "FunctionGroup")) {
            this.functionGroup = this.xmlGetAttribute(node, "FunctionGroup");
        }
        if (this.xmlHasAttribute(node, "Function")) {
            this.function = this.xmlGetAttribute(node, "Function");
        }
        if (this.xmlHasAttribute(node, "SequenceNumber")) {
            this.sequenceNumber = (this.xmlGetAttribute(node, "SequenceNumber") ? parseInt(this.xmlGetAttribute(node, "SequenceNumber")) : 0);
        }
        return;
    }
    if (arguments.length == 0) {
        this.functionGroup = "Status";
        this.function = "HardwareInformation";
        return;
    }
    throw new Error("Invalid argument");
};
timapi.protocol.sixml.Request_HardwareInformation.prototype = Object.create(timapi.protocol.Message.prototype);
timapi.protocol.sixml.Request_HardwareInformation.prototype.functionGroup = undefined;
timapi.protocol.sixml.Request_HardwareInformation.prototype.function = undefined;
timapi.protocol.sixml.Request_HardwareInformation.prototype.sequenceNumber = undefined;
timapi.protocol.sixml.Request_HardwareInformation.prototype.toXmlNode = function () {
    var node = new timapi.protocol.XmlNode("sixml:Request");
    this.xmlSetAttribute(node, "xmlns:sixml", "http://www.six-payment-services.com/");
    if (this.functionGroup != undefined) {
        this.xmlSetAttribute(node, "FunctionGroup", this.functionGroup);
    }
    if (this.function != undefined) {
        this.xmlSetAttribute(node, "Function", this.function);
    }
    if (this.sequenceNumber != undefined) {
        this.xmlSetAttribute(node, "SequenceNumber", timapi.utils.StringHelper.makeString(this.sequenceNumber));
    }
    return node;
};
timapi.protocol.sixml.Request_InitTransaction = function (a) {
    if (arguments.length == 1 && a instanceof timapi.protocol.sixml.Request_InitTransaction) {
        var value = a;
        this.functionGroup = value.functionGroup;
        this.function = value.function;
        this.sequenceNumber = value.sequenceNumber;
        this.amount = value.amount ? new timapi.protocol.sixml.Amount(value.amount) : undefined;
        this.displayAmountFlag = value.displayAmountFlag;
        this.language = value.language;
        return;
    }
    if (arguments.length == 1 && a instanceof timapi.protocol.XmlNode) {
        var node = a;
        if (this.xmlHasAttribute(node, "FunctionGroup")) {
            this.functionGroup = this.xmlGetAttribute(node, "FunctionGroup");
        }
        if (this.xmlHasAttribute(node, "Function")) {
            this.function = this.xmlGetAttribute(node, "Function");
        }
        if (this.xmlHasAttribute(node, "SequenceNumber")) {
            this.sequenceNumber = (this.xmlGetAttribute(node, "SequenceNumber") ? parseInt(this.xmlGetAttribute(node, "SequenceNumber")) : 0);
        }
        if (this.xmlHasChild(node, "sixml:Amount")) {
            this.amount = new timapi.protocol.sixml.Amount(this.xmlGetChild(node, "sixml:Amount"));
        }
        if (this.xmlHasChild(node, "sixml:DisplayAmountFlag")) {
            this.displayAmountFlag = this.xmlGetChild(node, "sixml:DisplayAmountFlag").textContent == "1";
        }
        if (this.xmlHasChild(node, "sixml:Language")) {
            this.language = this.xmlGetChild(node, "sixml:Language").textContent;
        }
        return;
    }
    if (arguments.length == 0) {
        this.functionGroup = "NonFinTransaction";
        this.function = "InitTransaction";
        return;
    }
    throw new Error("Invalid argument");
};
timapi.protocol.sixml.Request_InitTransaction.prototype = Object.create(timapi.protocol.Message.prototype);
timapi.protocol.sixml.Request_InitTransaction.prototype.functionGroup = undefined;
timapi.protocol.sixml.Request_InitTransaction.prototype.function = undefined;
timapi.protocol.sixml.Request_InitTransaction.prototype.sequenceNumber = undefined;
timapi.protocol.sixml.Request_InitTransaction.prototype.amount = undefined;
timapi.protocol.sixml.Request_InitTransaction.prototype.displayAmountFlag = undefined;
timapi.protocol.sixml.Request_InitTransaction.prototype.language = undefined;
timapi.protocol.sixml.Request_InitTransaction.prototype.toXmlNode = function () {
    var node = new timapi.protocol.XmlNode("sixml:Request");
    this.xmlSetAttribute(node, "xmlns:sixml", "http://www.six-payment-services.com/");
    if (this.functionGroup != undefined) {
        this.xmlSetAttribute(node, "FunctionGroup", this.functionGroup);
    }
    if (this.function != undefined) {
        this.xmlSetAttribute(node, "Function", this.function);
    }
    if (this.sequenceNumber != undefined) {
        this.xmlSetAttribute(node, "SequenceNumber", timapi.utils.StringHelper.makeString(this.sequenceNumber));
    }
    if (this.amount != undefined) {
        this.xmlAddChild(node, "sixml:Amount", this.amount);
    }
    if (this.displayAmountFlag != undefined) {
        this.xmlAddChild(node, "sixml:DisplayAmountFlag", (this.displayAmountFlag ? "1" : "0"));
    }
    if (this.language != undefined) {
        this.xmlAddChild(node, "sixml:Language", this.language);
    }
    return node;
};
timapi.protocol.sixml.Request_LoadVoucher = function (a) {
    if (arguments.length == 1 && a instanceof timapi.protocol.sixml.Request_LoadVoucher) {
        var value = a;
        this.functionGroup = value.functionGroup;
        this.function = value.function;
        this.sequenceNumber = value.sequenceNumber;
        this.amount = value.amount ? new timapi.protocol.sixml.Amount(value.amount) : undefined;
        this.transactionData = value.transactionData ? new timapi.protocol.sixml.TransactionData(value.transactionData) : undefined;
        this.merchantOptionList = value.merchantOptionList ? new timapi.protocol.sixml.MerchantOptionList(value.merchantOptionList) : undefined;
        return;
    }
    if (arguments.length == 1 && a instanceof timapi.protocol.XmlNode) {
        var node = a;
        if (this.xmlHasAttribute(node, "FunctionGroup")) {
            this.functionGroup = this.xmlGetAttribute(node, "FunctionGroup");
        }
        if (this.xmlHasAttribute(node, "Function")) {
            this.function = this.xmlGetAttribute(node, "Function");
        }
        if (this.xmlHasAttribute(node, "SequenceNumber")) {
            this.sequenceNumber = (this.xmlGetAttribute(node, "SequenceNumber") ? parseInt(this.xmlGetAttribute(node, "SequenceNumber")) : 0);
        }
        if (this.xmlHasChild(node, "sixml:Amount")) {
            this.amount = new timapi.protocol.sixml.Amount(this.xmlGetChild(node, "sixml:Amount"));
        }
        if (this.xmlHasChild(node, "sixml:TransactionData")) {
            this.transactionData = new timapi.protocol.sixml.TransactionData(this.xmlGetChild(node, "sixml:TransactionData"));
        }
        if (this.xmlHasChild(node, "sixml:MerchantOptionList")) {
            this.merchantOptionList = new timapi.protocol.sixml.MerchantOptionList(this.xmlGetChild(node, "sixml:MerchantOptionList"));
        }
        return;
    }
    if (arguments.length == 0) {
        this.functionGroup = "FinTransaction";
        this.function = "LoadVoucher";
        return;
    }
    throw new Error("Invalid argument");
};
timapi.protocol.sixml.Request_LoadVoucher.prototype = Object.create(timapi.protocol.Message.prototype);
timapi.protocol.sixml.Request_LoadVoucher.prototype.functionGroup = undefined;
timapi.protocol.sixml.Request_LoadVoucher.prototype.function = undefined;
timapi.protocol.sixml.Request_LoadVoucher.prototype.sequenceNumber = undefined;
timapi.protocol.sixml.Request_LoadVoucher.prototype.amount = undefined;
timapi.protocol.sixml.Request_LoadVoucher.prototype.transactionData = undefined;
timapi.protocol.sixml.Request_LoadVoucher.prototype.merchantOptionList = undefined;
timapi.protocol.sixml.Request_LoadVoucher.prototype.toXmlNode = function () {
    var node = new timapi.protocol.XmlNode("sixml:Request");
    this.xmlSetAttribute(node, "xmlns:sixml", "http://www.six-payment-services.com/");
    if (this.functionGroup != undefined) {
        this.xmlSetAttribute(node, "FunctionGroup", this.functionGroup);
    }
    if (this.function != undefined) {
        this.xmlSetAttribute(node, "Function", this.function);
    }
    if (this.sequenceNumber != undefined) {
        this.xmlSetAttribute(node, "SequenceNumber", timapi.utils.StringHelper.makeString(this.sequenceNumber));
    }
    if (this.amount != undefined) {
        this.xmlAddChild(node, "sixml:Amount", this.amount);
    }
    if (this.transactionData != undefined) {
        this.xmlAddChild(node, "sixml:TransactionData", this.transactionData);
    }
    if (this.merchantOptionList != undefined) {
        this.xmlAddChild(node, "sixml:MerchantOptionList", this.merchantOptionList);
    }
    return node;
};
timapi.protocol.sixml.Request_Login = function (a) {
    if (arguments.length == 1 && a instanceof timapi.protocol.sixml.Request_Login) {
        var value = a;
        this.functionGroup = value.functionGroup;
        this.function = value.function;
        this.sequenceNumber = value.sequenceNumber;
        this.posId = value.posId;
        this.integratorId = value.integratorId;
        this.protocolOptionList = value.protocolOptionList ? new timapi.protocol.sixml.ProtocolOptionList(value.protocolOptionList) : undefined;
        this.printOptionList = value.printOptionList ? new timapi.protocol.sixml.PrintOptionList(value.printOptionList) : undefined;
        this.manufacturerFlags = value.manufacturerFlags;
        return;
    }
    if (arguments.length == 1 && a instanceof timapi.protocol.XmlNode) {
        var node = a;
        if (this.xmlHasAttribute(node, "FunctionGroup")) {
            this.functionGroup = this.xmlGetAttribute(node, "FunctionGroup");
        }
        if (this.xmlHasAttribute(node, "Function")) {
            this.function = this.xmlGetAttribute(node, "Function");
        }
        if (this.xmlHasAttribute(node, "SequenceNumber")) {
            this.sequenceNumber = (this.xmlGetAttribute(node, "SequenceNumber") ? parseInt(this.xmlGetAttribute(node, "SequenceNumber")) : 0);
        }
        if (this.xmlHasChild(node, "sixml:PosId")) {
            this.posId = this.xmlGetChild(node, "sixml:PosId").textContent;
        }
        if (this.xmlHasChild(node, "sixml:IntegratorId")) {
            this.integratorId = this.xmlGetChild(node, "sixml:IntegratorId").textContent;
        }
        if (this.xmlHasChild(node, "sixml:ProtocolOptionList")) {
            this.protocolOptionList = new timapi.protocol.sixml.ProtocolOptionList(this.xmlGetChild(node, "sixml:ProtocolOptionList"));
        }
        if (this.xmlHasChild(node, "sixml:PrintOptionList")) {
            this.printOptionList = new timapi.protocol.sixml.PrintOptionList(this.xmlGetChild(node, "sixml:PrintOptionList"));
        }
        if (this.xmlHasChild(node, "sixml:ManufacturerFlags")) {
            this.manufacturerFlags = (this.xmlGetChild(node, "sixml:ManufacturerFlags").textContent ? parseInt(this.xmlGetChild(node, "sixml:ManufacturerFlags").textContent) : 0);
        }
        return;
    }
    if (arguments.length == 0) {
        this.functionGroup = "Admin";
        this.function = "Login";
        return;
    }
    throw new Error("Invalid argument");
};
timapi.protocol.sixml.Request_Login.prototype = Object.create(timapi.protocol.Message.prototype);
timapi.protocol.sixml.Request_Login.prototype.functionGroup = undefined;
timapi.protocol.sixml.Request_Login.prototype.function = undefined;
timapi.protocol.sixml.Request_Login.prototype.sequenceNumber = undefined;
timapi.protocol.sixml.Request_Login.prototype.posId = undefined;
timapi.protocol.sixml.Request_Login.prototype.integratorId = undefined;
timapi.protocol.sixml.Request_Login.prototype.protocolOptionList = undefined;
timapi.protocol.sixml.Request_Login.prototype.printOptionList = undefined;
timapi.protocol.sixml.Request_Login.prototype.manufacturerFlags = undefined;
timapi.protocol.sixml.Request_Login.prototype.toXmlNode = function () {
    var node = new timapi.protocol.XmlNode("sixml:Request");
    this.xmlSetAttribute(node, "xmlns:sixml", "http://www.six-payment-services.com/");
    if (this.functionGroup != undefined) {
        this.xmlSetAttribute(node, "FunctionGroup", this.functionGroup);
    }
    if (this.function != undefined) {
        this.xmlSetAttribute(node, "Function", this.function);
    }
    if (this.sequenceNumber != undefined) {
        this.xmlSetAttribute(node, "SequenceNumber", timapi.utils.StringHelper.makeString(this.sequenceNumber));
    }
    if (this.posId != undefined) {
        this.xmlAddChild(node, "sixml:PosId", this.posId);
    }
    if (this.integratorId != undefined) {
        this.xmlAddChild(node, "sixml:IntegratorId", this.integratorId);
    }
    if (this.protocolOptionList != undefined) {
        this.xmlAddChild(node, "sixml:ProtocolOptionList", this.protocolOptionList);
    }
    if (this.printOptionList != undefined) {
        this.xmlAddChild(node, "sixml:PrintOptionList", this.printOptionList);
    }
    if (this.manufacturerFlags != undefined) {
        this.xmlAddChild(node, "sixml:ManufacturerFlags", timapi.utils.StringHelper.makeString(this.manufacturerFlags));
    }
    return node;
};
timapi.protocol.sixml.Request_Logout = function (a) {
    if (arguments.length == 1 && a instanceof timapi.protocol.sixml.Request_Logout) {
        var value = a;
        this.functionGroup = value.functionGroup;
        this.function = value.function;
        this.sequenceNumber = value.sequenceNumber;
        return;
    }
    if (arguments.length == 1 && a instanceof timapi.protocol.XmlNode) {
        var node = a;
        if (this.xmlHasAttribute(node, "FunctionGroup")) {
            this.functionGroup = this.xmlGetAttribute(node, "FunctionGroup");
        }
        if (this.xmlHasAttribute(node, "Function")) {
            this.function = this.xmlGetAttribute(node, "Function");
        }
        if (this.xmlHasAttribute(node, "SequenceNumber")) {
            this.sequenceNumber = (this.xmlGetAttribute(node, "SequenceNumber") ? parseInt(this.xmlGetAttribute(node, "SequenceNumber")) : 0);
        }
        return;
    }
    if (arguments.length == 0) {
        this.functionGroup = "Admin";
        this.function = "Logout";
        return;
    }
    throw new Error("Invalid argument");
};
timapi.protocol.sixml.Request_Logout.prototype = Object.create(timapi.protocol.Message.prototype);
timapi.protocol.sixml.Request_Logout.prototype.functionGroup = undefined;
timapi.protocol.sixml.Request_Logout.prototype.function = undefined;
timapi.protocol.sixml.Request_Logout.prototype.sequenceNumber = undefined;
timapi.protocol.sixml.Request_Logout.prototype.toXmlNode = function () {
    var node = new timapi.protocol.XmlNode("sixml:Request");
    this.xmlSetAttribute(node, "xmlns:sixml", "http://www.six-payment-services.com/");
    if (this.functionGroup != undefined) {
        this.xmlSetAttribute(node, "FunctionGroup", this.functionGroup);
    }
    if (this.function != undefined) {
        this.xmlSetAttribute(node, "Function", this.function);
    }
    if (this.sequenceNumber != undefined) {
        this.xmlSetAttribute(node, "SequenceNumber", timapi.utils.StringHelper.makeString(this.sequenceNumber));
    }
    return node;
};
timapi.protocol.sixml.Request_OpenDialogMode = function (a) {
    if (arguments.length == 1 && a instanceof timapi.protocol.sixml.Request_OpenDialogMode) {
        var value = a;
        this.functionGroup = value.functionGroup;
        this.function = value.function;
        this.sequenceNumber = value.sequenceNumber;
        return;
    }
    if (arguments.length == 1 && a instanceof timapi.protocol.XmlNode) {
        var node = a;
        if (this.xmlHasAttribute(node, "FunctionGroup")) {
            this.functionGroup = this.xmlGetAttribute(node, "FunctionGroup");
        }
        if (this.xmlHasAttribute(node, "Function")) {
            this.function = this.xmlGetAttribute(node, "Function");
        }
        if (this.xmlHasAttribute(node, "SequenceNumber")) {
            this.sequenceNumber = (this.xmlGetAttribute(node, "SequenceNumber") ? parseInt(this.xmlGetAttribute(node, "SequenceNumber")) : 0);
        }
        return;
    }
    if (arguments.length == 0) {
        this.functionGroup = "Admin";
        this.function = "OpenDialogMode";
        return;
    }
    throw new Error("Invalid argument");
};
timapi.protocol.sixml.Request_OpenDialogMode.prototype = Object.create(timapi.protocol.Message.prototype);
timapi.protocol.sixml.Request_OpenDialogMode.prototype.functionGroup = undefined;
timapi.protocol.sixml.Request_OpenDialogMode.prototype.function = undefined;
timapi.protocol.sixml.Request_OpenDialogMode.prototype.sequenceNumber = undefined;
timapi.protocol.sixml.Request_OpenDialogMode.prototype.toXmlNode = function () {
    var node = new timapi.protocol.XmlNode("sixml:Request");
    this.xmlSetAttribute(node, "xmlns:sixml", "http://www.six-payment-services.com/");
    if (this.functionGroup != undefined) {
        this.xmlSetAttribute(node, "FunctionGroup", this.functionGroup);
    }
    if (this.function != undefined) {
        this.xmlSetAttribute(node, "Function", this.function);
    }
    if (this.sequenceNumber != undefined) {
        this.xmlSetAttribute(node, "SequenceNumber", timapi.utils.StringHelper.makeString(this.sequenceNumber));
    }
    return node;
};
timapi.protocol.sixml.Request_OpenMaintenanceWindow = function (a) {
    if (arguments.length == 1 && a instanceof timapi.protocol.sixml.Request_OpenMaintenanceWindow) {
        var value = a;
        this.functionGroup = value.functionGroup;
        this.function = value.function;
        this.sequenceNumber = value.sequenceNumber;
        return;
    }
    if (arguments.length == 1 && a instanceof timapi.protocol.XmlNode) {
        var node = a;
        if (this.xmlHasAttribute(node, "FunctionGroup")) {
            this.functionGroup = this.xmlGetAttribute(node, "FunctionGroup");
        }
        if (this.xmlHasAttribute(node, "Function")) {
            this.function = this.xmlGetAttribute(node, "Function");
        }
        if (this.xmlHasAttribute(node, "SequenceNumber")) {
            this.sequenceNumber = (this.xmlGetAttribute(node, "SequenceNumber") ? parseInt(this.xmlGetAttribute(node, "SequenceNumber")) : 0);
        }
        return;
    }
    if (arguments.length == 0) {
        this.functionGroup = "Admin";
        this.function = "OpenMaintenanceWindow";
        return;
    }
    throw new Error("Invalid argument");
};
timapi.protocol.sixml.Request_OpenMaintenanceWindow.prototype = Object.create(timapi.protocol.Message.prototype);
timapi.protocol.sixml.Request_OpenMaintenanceWindow.prototype.functionGroup = undefined;
timapi.protocol.sixml.Request_OpenMaintenanceWindow.prototype.function = undefined;
timapi.protocol.sixml.Request_OpenMaintenanceWindow.prototype.sequenceNumber = undefined;
timapi.protocol.sixml.Request_OpenMaintenanceWindow.prototype.toXmlNode = function () {
    var node = new timapi.protocol.XmlNode("sixml:Request");
    this.xmlSetAttribute(node, "xmlns:sixml", "http://www.six-payment-services.com/");
    if (this.functionGroup != undefined) {
        this.xmlSetAttribute(node, "FunctionGroup", this.functionGroup);
    }
    if (this.function != undefined) {
        this.xmlSetAttribute(node, "Function", this.function);
    }
    if (this.sequenceNumber != undefined) {
        this.xmlSetAttribute(node, "SequenceNumber", timapi.utils.StringHelper.makeString(this.sequenceNumber));
    }
    return node;
};
timapi.protocol.sixml.Request_OpenReader = function (a) {
    if (arguments.length == 1 && a instanceof timapi.protocol.sixml.Request_OpenReader) {
        var value = a;
        this.functionGroup = value.functionGroup;
        this.function = value.function;
        this.sequenceNumber = value.sequenceNumber;
        return;
    }
    if (arguments.length == 1 && a instanceof timapi.protocol.XmlNode) {
        var node = a;
        if (this.xmlHasAttribute(node, "FunctionGroup")) {
            this.functionGroup = this.xmlGetAttribute(node, "FunctionGroup");
        }
        if (this.xmlHasAttribute(node, "Function")) {
            this.function = this.xmlGetAttribute(node, "Function");
        }
        if (this.xmlHasAttribute(node, "SequenceNumber")) {
            this.sequenceNumber = (this.xmlGetAttribute(node, "SequenceNumber") ? parseInt(this.xmlGetAttribute(node, "SequenceNumber")) : 0);
        }
        return;
    }
    if (arguments.length == 0) {
        this.functionGroup = "Admin";
        this.function = "OpenReader";
        return;
    }
    throw new Error("Invalid argument");
};
timapi.protocol.sixml.Request_OpenReader.prototype = Object.create(timapi.protocol.Message.prototype);
timapi.protocol.sixml.Request_OpenReader.prototype.functionGroup = undefined;
timapi.protocol.sixml.Request_OpenReader.prototype.function = undefined;
timapi.protocol.sixml.Request_OpenReader.prototype.sequenceNumber = undefined;
timapi.protocol.sixml.Request_OpenReader.prototype.toXmlNode = function () {
    var node = new timapi.protocol.XmlNode("sixml:Request");
    this.xmlSetAttribute(node, "xmlns:sixml", "http://www.six-payment-services.com/");
    if (this.functionGroup != undefined) {
        this.xmlSetAttribute(node, "FunctionGroup", this.functionGroup);
    }
    if (this.function != undefined) {
        this.xmlSetAttribute(node, "Function", this.function);
    }
    if (this.sequenceNumber != undefined) {
        this.xmlSetAttribute(node, "SequenceNumber", timapi.utils.StringHelper.makeString(this.sequenceNumber));
    }
    return node;
};
timapi.protocol.sixml.Request_PreAuthorization = function (a) {
    if (arguments.length == 1 && a instanceof timapi.protocol.sixml.Request_PreAuthorization) {
        var value = a;
        this.functionGroup = value.functionGroup;
        this.function = value.function;
        this.sequenceNumber = value.sequenceNumber;
        this.usrId = value.usrId;
        this.amount = value.amount ? new timapi.protocol.sixml.Amount(value.amount) : undefined;
        this.merchantOptionList = value.merchantOptionList ? new timapi.protocol.sixml.MerchantOptionList(value.merchantOptionList) : undefined;
        this.transactionData = value.transactionData ? new timapi.protocol.sixml.TransactionData(value.transactionData) : undefined;
        this.language = value.language;
        this.retainCardFlag = value.retainCardFlag;
        return;
    }
    if (arguments.length == 1 && a instanceof timapi.protocol.XmlNode) {
        var node = a;
        if (this.xmlHasAttribute(node, "FunctionGroup")) {
            this.functionGroup = this.xmlGetAttribute(node, "FunctionGroup");
        }
        if (this.xmlHasAttribute(node, "Function")) {
            this.function = this.xmlGetAttribute(node, "Function");
        }
        if (this.xmlHasAttribute(node, "SequenceNumber")) {
            this.sequenceNumber = (this.xmlGetAttribute(node, "SequenceNumber") ? parseInt(this.xmlGetAttribute(node, "SequenceNumber")) : 0);
        }
        if (this.xmlHasChild(node, "sixml:UsrId")) {
            this.usrId = (this.xmlGetChild(node, "sixml:UsrId").textContent ? parseInt(this.xmlGetChild(node, "sixml:UsrId").textContent) : 0);
        }
        if (this.xmlHasChild(node, "sixml:Amount")) {
            this.amount = new timapi.protocol.sixml.Amount(this.xmlGetChild(node, "sixml:Amount"));
        }
        if (this.xmlHasChild(node, "sixml:MerchantOptionList")) {
            this.merchantOptionList = new timapi.protocol.sixml.MerchantOptionList(this.xmlGetChild(node, "sixml:MerchantOptionList"));
        }
        if (this.xmlHasChild(node, "sixml:TransactionData")) {
            this.transactionData = new timapi.protocol.sixml.TransactionData(this.xmlGetChild(node, "sixml:TransactionData"));
        }
        if (this.xmlHasChild(node, "sixml:Language")) {
            this.language = this.xmlGetChild(node, "sixml:Language").textContent;
        }
        if (this.xmlHasChild(node, "sixml:RetainCardFlag")) {
            this.retainCardFlag = this.xmlGetChild(node, "sixml:RetainCardFlag").textContent == "1";
        }
        return;
    }
    if (arguments.length == 0) {
        this.functionGroup = "FinTransaction";
        this.function = "PreAuthorization";
        return;
    }
    throw new Error("Invalid argument");
};
timapi.protocol.sixml.Request_PreAuthorization.prototype = Object.create(timapi.protocol.Message.prototype);
timapi.protocol.sixml.Request_PreAuthorization.prototype.functionGroup = undefined;
timapi.protocol.sixml.Request_PreAuthorization.prototype.function = undefined;
timapi.protocol.sixml.Request_PreAuthorization.prototype.sequenceNumber = undefined;
timapi.protocol.sixml.Request_PreAuthorization.prototype.usrId = undefined;
timapi.protocol.sixml.Request_PreAuthorization.prototype.amount = undefined;
timapi.protocol.sixml.Request_PreAuthorization.prototype.merchantOptionList = undefined;
timapi.protocol.sixml.Request_PreAuthorization.prototype.transactionData = undefined;
timapi.protocol.sixml.Request_PreAuthorization.prototype.language = undefined;
timapi.protocol.sixml.Request_PreAuthorization.prototype.retainCardFlag = undefined;
timapi.protocol.sixml.Request_PreAuthorization.prototype.toXmlNode = function () {
    var node = new timapi.protocol.XmlNode("sixml:Request");
    this.xmlSetAttribute(node, "xmlns:sixml", "http://www.six-payment-services.com/");
    if (this.functionGroup != undefined) {
        this.xmlSetAttribute(node, "FunctionGroup", this.functionGroup);
    }
    if (this.function != undefined) {
        this.xmlSetAttribute(node, "Function", this.function);
    }
    if (this.sequenceNumber != undefined) {
        this.xmlSetAttribute(node, "SequenceNumber", timapi.utils.StringHelper.makeString(this.sequenceNumber));
    }
    if (this.usrId != undefined) {
        this.xmlAddChild(node, "sixml:UsrId", timapi.utils.StringHelper.makeString(this.usrId));
    }
    if (this.amount != undefined) {
        this.xmlAddChild(node, "sixml:Amount", this.amount);
    }
    if (this.merchantOptionList != undefined) {
        this.xmlAddChild(node, "sixml:MerchantOptionList", this.merchantOptionList);
    }
    if (this.transactionData != undefined) {
        this.xmlAddChild(node, "sixml:TransactionData", this.transactionData);
    }
    if (this.language != undefined) {
        this.xmlAddChild(node, "sixml:Language", this.language);
    }
    if (this.retainCardFlag != undefined) {
        this.xmlAddChild(node, "sixml:RetainCardFlag", (this.retainCardFlag ? "1" : "0"));
    }
    return node;
};
timapi.protocol.sixml.Request_Purchase = function (a) {
    if (arguments.length == 1 && a instanceof timapi.protocol.sixml.Request_Purchase) {
        var value = a;
        this.functionGroup = value.functionGroup;
        this.function = value.function;
        this.sequenceNumber = value.sequenceNumber;
        this.usrId = value.usrId;
        this.amount = value.amount ? new timapi.protocol.sixml.Amount(value.amount) : undefined;
        this.transactionData = value.transactionData ? new timapi.protocol.sixml.TransactionData(value.transactionData) : undefined;
        this.merchantOptionList = value.merchantOptionList ? new timapi.protocol.sixml.MerchantOptionList(value.merchantOptionList) : undefined;
        this.basket = value.basket ? new timapi.protocol.sixml.Basket(value.basket) : undefined;
        this.language = value.language;
        this.amountTip = value.amountTip ? new timapi.protocol.sixml.AmountTip(value.amountTip) : undefined;
        this.loyaltyCouponList = value.loyaltyCouponList ? new timapi.protocol.sixml.LoyaltyCouponList(value.loyaltyCouponList) : undefined;
        this.amountDiscount = value.amountDiscount ? new timapi.protocol.sixml.AmountDiscount(value.amountDiscount) : undefined;
        return;
    }
    if (arguments.length == 1 && a instanceof timapi.protocol.XmlNode) {
        var node = a;
        if (this.xmlHasAttribute(node, "FunctionGroup")) {
            this.functionGroup = this.xmlGetAttribute(node, "FunctionGroup");
        }
        if (this.xmlHasAttribute(node, "Function")) {
            this.function = this.xmlGetAttribute(node, "Function");
        }
        if (this.xmlHasAttribute(node, "SequenceNumber")) {
            this.sequenceNumber = (this.xmlGetAttribute(node, "SequenceNumber") ? parseInt(this.xmlGetAttribute(node, "SequenceNumber")) : 0);
        }
        if (this.xmlHasChild(node, "sixml:UsrId")) {
            this.usrId = (this.xmlGetChild(node, "sixml:UsrId").textContent ? parseInt(this.xmlGetChild(node, "sixml:UsrId").textContent) : 0);
        }
        if (this.xmlHasChild(node, "sixml:Amount")) {
            this.amount = new timapi.protocol.sixml.Amount(this.xmlGetChild(node, "sixml:Amount"));
        }
        if (this.xmlHasChild(node, "sixml:TransactionData")) {
            this.transactionData = new timapi.protocol.sixml.TransactionData(this.xmlGetChild(node, "sixml:TransactionData"));
        }
        if (this.xmlHasChild(node, "sixml:MerchantOptionList")) {
            this.merchantOptionList = new timapi.protocol.sixml.MerchantOptionList(this.xmlGetChild(node, "sixml:MerchantOptionList"));
        }
        if (this.xmlHasChild(node, "sixml:Basket")) {
            this.basket = new timapi.protocol.sixml.Basket(this.xmlGetChild(node, "sixml:Basket"));
        }
        if (this.xmlHasChild(node, "sixml:Language")) {
            this.language = this.xmlGetChild(node, "sixml:Language").textContent;
        }
        if (this.xmlHasChild(node, "sixml:AmountTip")) {
            this.amountTip = new timapi.protocol.sixml.AmountTip(this.xmlGetChild(node, "sixml:AmountTip"));
        }
        if (this.xmlHasChild(node, "sixml:LoyaltyCouponList")) {
            this.loyaltyCouponList = new timapi.protocol.sixml.LoyaltyCouponList(this.xmlGetChild(node, "sixml:LoyaltyCouponList"));
        }
        if (this.xmlHasChild(node, "sixml:AmountDiscount")) {
            this.amountDiscount = new timapi.protocol.sixml.AmountDiscount(this.xmlGetChild(node, "sixml:AmountDiscount"));
        }
        return;
    }
    if (arguments.length == 0) {
        this.functionGroup = "FinTransaction";
        this.function = "Purchase";
        return;
    }
    throw new Error("Invalid argument");
};
timapi.protocol.sixml.Request_Purchase.prototype = Object.create(timapi.protocol.Message.prototype);
timapi.protocol.sixml.Request_Purchase.prototype.functionGroup = undefined;
timapi.protocol.sixml.Request_Purchase.prototype.function = undefined;
timapi.protocol.sixml.Request_Purchase.prototype.sequenceNumber = undefined;
timapi.protocol.sixml.Request_Purchase.prototype.usrId = undefined;
timapi.protocol.sixml.Request_Purchase.prototype.amount = undefined;
timapi.protocol.sixml.Request_Purchase.prototype.transactionData = undefined;
timapi.protocol.sixml.Request_Purchase.prototype.merchantOptionList = undefined;
timapi.protocol.sixml.Request_Purchase.prototype.basket = undefined;
timapi.protocol.sixml.Request_Purchase.prototype.language = undefined;
timapi.protocol.sixml.Request_Purchase.prototype.amountTip = undefined;
timapi.protocol.sixml.Request_Purchase.prototype.loyaltyCouponList = undefined;
timapi.protocol.sixml.Request_Purchase.prototype.amountDiscount = undefined;
timapi.protocol.sixml.Request_Purchase.prototype.toXmlNode = function () {
    var node = new timapi.protocol.XmlNode("sixml:Request");
    this.xmlSetAttribute(node, "xmlns:sixml", "http://www.six-payment-services.com/");
    if (this.functionGroup != undefined) {
        this.xmlSetAttribute(node, "FunctionGroup", this.functionGroup);
    }
    if (this.function != undefined) {
        this.xmlSetAttribute(node, "Function", this.function);
    }
    if (this.sequenceNumber != undefined) {
        this.xmlSetAttribute(node, "SequenceNumber", timapi.utils.StringHelper.makeString(this.sequenceNumber));
    }
    if (this.usrId != undefined) {
        this.xmlAddChild(node, "sixml:UsrId", timapi.utils.StringHelper.makeString(this.usrId));
    }
    if (this.amount != undefined) {
        this.xmlAddChild(node, "sixml:Amount", this.amount);
    }
    if (this.transactionData != undefined) {
        this.xmlAddChild(node, "sixml:TransactionData", this.transactionData);
    }
    if (this.merchantOptionList != undefined) {
        this.xmlAddChild(node, "sixml:MerchantOptionList", this.merchantOptionList);
    }
    if (this.basket != undefined) {
        this.xmlAddChild(node, "sixml:Basket", this.basket);
    }
    if (this.language != undefined) {
        this.xmlAddChild(node, "sixml:Language", this.language);
    }
    if (this.amountTip != undefined) {
        this.xmlAddChild(node, "sixml:AmountTip", this.amountTip);
    }
    if (this.loyaltyCouponList != undefined) {
        this.xmlAddChild(node, "sixml:LoyaltyCouponList", this.loyaltyCouponList);
    }
    if (this.amountDiscount != undefined) {
        this.xmlAddChild(node, "sixml:AmountDiscount", this.amountDiscount);
    }
    return node;
};
timapi.protocol.sixml.Request_PurchaseForcedAcceptance = function (a) {
    if (arguments.length == 1 && a instanceof timapi.protocol.sixml.Request_PurchaseForcedAcceptance) {
        var value = a;
        this.functionGroup = value.functionGroup;
        this.function = value.function;
        this.sequenceNumber = value.sequenceNumber;
        this.usrId = value.usrId;
        this.amount = value.amount ? new timapi.protocol.sixml.Amount(value.amount) : undefined;
        this.transactionData = value.transactionData ? new timapi.protocol.sixml.TransactionData(value.transactionData) : undefined;
        this.merchantOptionList = value.merchantOptionList ? new timapi.protocol.sixml.MerchantOptionList(value.merchantOptionList) : undefined;
        return;
    }
    if (arguments.length == 1 && a instanceof timapi.protocol.XmlNode) {
        var node = a;
        if (this.xmlHasAttribute(node, "FunctionGroup")) {
            this.functionGroup = this.xmlGetAttribute(node, "FunctionGroup");
        }
        if (this.xmlHasAttribute(node, "Function")) {
            this.function = this.xmlGetAttribute(node, "Function");
        }
        if (this.xmlHasAttribute(node, "SequenceNumber")) {
            this.sequenceNumber = (this.xmlGetAttribute(node, "SequenceNumber") ? parseInt(this.xmlGetAttribute(node, "SequenceNumber")) : 0);
        }
        if (this.xmlHasChild(node, "sixml:UsrId")) {
            this.usrId = (this.xmlGetChild(node, "sixml:UsrId").textContent ? parseInt(this.xmlGetChild(node, "sixml:UsrId").textContent) : 0);
        }
        if (this.xmlHasChild(node, "sixml:Amount")) {
            this.amount = new timapi.protocol.sixml.Amount(this.xmlGetChild(node, "sixml:Amount"));
        }
        if (this.xmlHasChild(node, "sixml:TransactionData")) {
            this.transactionData = new timapi.protocol.sixml.TransactionData(this.xmlGetChild(node, "sixml:TransactionData"));
        }
        if (this.xmlHasChild(node, "sixml:MerchantOptionList")) {
            this.merchantOptionList = new timapi.protocol.sixml.MerchantOptionList(this.xmlGetChild(node, "sixml:MerchantOptionList"));
        }
        return;
    }
    if (arguments.length == 0) {
        this.functionGroup = "FinTransaction";
        this.function = "PurchaseForcedAcceptance";
        return;
    }
    throw new Error("Invalid argument");
};
timapi.protocol.sixml.Request_PurchaseForcedAcceptance.prototype = Object.create(timapi.protocol.Message.prototype);
timapi.protocol.sixml.Request_PurchaseForcedAcceptance.prototype.functionGroup = undefined;
timapi.protocol.sixml.Request_PurchaseForcedAcceptance.prototype.function = undefined;
timapi.protocol.sixml.Request_PurchaseForcedAcceptance.prototype.sequenceNumber = undefined;
timapi.protocol.sixml.Request_PurchaseForcedAcceptance.prototype.usrId = undefined;
timapi.protocol.sixml.Request_PurchaseForcedAcceptance.prototype.amount = undefined;
timapi.protocol.sixml.Request_PurchaseForcedAcceptance.prototype.transactionData = undefined;
timapi.protocol.sixml.Request_PurchaseForcedAcceptance.prototype.merchantOptionList = undefined;
timapi.protocol.sixml.Request_PurchaseForcedAcceptance.prototype.toXmlNode = function () {
    var node = new timapi.protocol.XmlNode("sixml:Request");
    this.xmlSetAttribute(node, "xmlns:sixml", "http://www.six-payment-services.com/");
    if (this.functionGroup != undefined) {
        this.xmlSetAttribute(node, "FunctionGroup", this.functionGroup);
    }
    if (this.function != undefined) {
        this.xmlSetAttribute(node, "Function", this.function);
    }
    if (this.sequenceNumber != undefined) {
        this.xmlSetAttribute(node, "SequenceNumber", timapi.utils.StringHelper.makeString(this.sequenceNumber));
    }
    if (this.usrId != undefined) {
        this.xmlAddChild(node, "sixml:UsrId", timapi.utils.StringHelper.makeString(this.usrId));
    }
    if (this.amount != undefined) {
        this.xmlAddChild(node, "sixml:Amount", this.amount);
    }
    if (this.transactionData != undefined) {
        this.xmlAddChild(node, "sixml:TransactionData", this.transactionData);
    }
    if (this.merchantOptionList != undefined) {
        this.xmlAddChild(node, "sixml:MerchantOptionList", this.merchantOptionList);
    }
    return node;
};
timapi.protocol.sixml.Request_PurchasePhoneAuthorized = function (a) {
    if (arguments.length == 1 && a instanceof timapi.protocol.sixml.Request_PurchasePhoneAuthorized) {
        var value = a;
        this.functionGroup = value.functionGroup;
        this.function = value.function;
        this.sequenceNumber = value.sequenceNumber;
        this.usrId = value.usrId;
        this.amount = value.amount ? new timapi.protocol.sixml.Amount(value.amount) : undefined;
        this.transactionData = value.transactionData ? new timapi.protocol.sixml.TransactionData(value.transactionData) : undefined;
        this.merchantOptionList = value.merchantOptionList ? new timapi.protocol.sixml.MerchantOptionList(value.merchantOptionList) : undefined;
        return;
    }
    if (arguments.length == 1 && a instanceof timapi.protocol.XmlNode) {
        var node = a;
        if (this.xmlHasAttribute(node, "FunctionGroup")) {
            this.functionGroup = this.xmlGetAttribute(node, "FunctionGroup");
        }
        if (this.xmlHasAttribute(node, "Function")) {
            this.function = this.xmlGetAttribute(node, "Function");
        }
        if (this.xmlHasAttribute(node, "SequenceNumber")) {
            this.sequenceNumber = (this.xmlGetAttribute(node, "SequenceNumber") ? parseInt(this.xmlGetAttribute(node, "SequenceNumber")) : 0);
        }
        if (this.xmlHasChild(node, "sixml:UsrId")) {
            this.usrId = (this.xmlGetChild(node, "sixml:UsrId").textContent ? parseInt(this.xmlGetChild(node, "sixml:UsrId").textContent) : 0);
        }
        if (this.xmlHasChild(node, "sixml:Amount")) {
            this.amount = new timapi.protocol.sixml.Amount(this.xmlGetChild(node, "sixml:Amount"));
        }
        if (this.xmlHasChild(node, "sixml:TransactionData")) {
            this.transactionData = new timapi.protocol.sixml.TransactionData(this.xmlGetChild(node, "sixml:TransactionData"));
        }
        if (this.xmlHasChild(node, "sixml:MerchantOptionList")) {
            this.merchantOptionList = new timapi.protocol.sixml.MerchantOptionList(this.xmlGetChild(node, "sixml:MerchantOptionList"));
        }
        return;
    }
    if (arguments.length == 0) {
        this.functionGroup = "FinTransaction";
        this.function = "PurchasePhoneAuthorized";
        return;
    }
    throw new Error("Invalid argument");
};
timapi.protocol.sixml.Request_PurchasePhoneAuthorized.prototype = Object.create(timapi.protocol.Message.prototype);
timapi.protocol.sixml.Request_PurchasePhoneAuthorized.prototype.functionGroup = undefined;
timapi.protocol.sixml.Request_PurchasePhoneAuthorized.prototype.function = undefined;
timapi.protocol.sixml.Request_PurchasePhoneAuthorized.prototype.sequenceNumber = undefined;
timapi.protocol.sixml.Request_PurchasePhoneAuthorized.prototype.usrId = undefined;
timapi.protocol.sixml.Request_PurchasePhoneAuthorized.prototype.amount = undefined;
timapi.protocol.sixml.Request_PurchasePhoneAuthorized.prototype.transactionData = undefined;
timapi.protocol.sixml.Request_PurchasePhoneAuthorized.prototype.merchantOptionList = undefined;
timapi.protocol.sixml.Request_PurchasePhoneAuthorized.prototype.toXmlNode = function () {
    var node = new timapi.protocol.XmlNode("sixml:Request");
    this.xmlSetAttribute(node, "xmlns:sixml", "http://www.six-payment-services.com/");
    if (this.functionGroup != undefined) {
        this.xmlSetAttribute(node, "FunctionGroup", this.functionGroup);
    }
    if (this.function != undefined) {
        this.xmlSetAttribute(node, "Function", this.function);
    }
    if (this.sequenceNumber != undefined) {
        this.xmlSetAttribute(node, "SequenceNumber", timapi.utils.StringHelper.makeString(this.sequenceNumber));
    }
    if (this.usrId != undefined) {
        this.xmlAddChild(node, "sixml:UsrId", timapi.utils.StringHelper.makeString(this.usrId));
    }
    if (this.amount != undefined) {
        this.xmlAddChild(node, "sixml:Amount", this.amount);
    }
    if (this.transactionData != undefined) {
        this.xmlAddChild(node, "sixml:TransactionData", this.transactionData);
    }
    if (this.merchantOptionList != undefined) {
        this.xmlAddChild(node, "sixml:MerchantOptionList", this.merchantOptionList);
    }
    return node;
};
timapi.protocol.sixml.Request_PurchaseReservation = function (a) {
    if (arguments.length == 1 && a instanceof timapi.protocol.sixml.Request_PurchaseReservation) {
        var value = a;
        this.functionGroup = value.functionGroup;
        this.function = value.function;
        this.sequenceNumber = value.sequenceNumber;
        this.transactionData = value.transactionData ? new timapi.protocol.sixml.TransactionData(value.transactionData) : undefined;
        this.amount = value.amount ? new timapi.protocol.sixml.Amount(value.amount) : undefined;
        this.merchantOptionList = value.merchantOptionList ? new timapi.protocol.sixml.MerchantOptionList(value.merchantOptionList) : undefined;
        return;
    }
    if (arguments.length == 1 && a instanceof timapi.protocol.XmlNode) {
        var node = a;
        if (this.xmlHasAttribute(node, "FunctionGroup")) {
            this.functionGroup = this.xmlGetAttribute(node, "FunctionGroup");
        }
        if (this.xmlHasAttribute(node, "Function")) {
            this.function = this.xmlGetAttribute(node, "Function");
        }
        if (this.xmlHasAttribute(node, "SequenceNumber")) {
            this.sequenceNumber = (this.xmlGetAttribute(node, "SequenceNumber") ? parseInt(this.xmlGetAttribute(node, "SequenceNumber")) : 0);
        }
        if (this.xmlHasChild(node, "sixml:TransactionData")) {
            this.transactionData = new timapi.protocol.sixml.TransactionData(this.xmlGetChild(node, "sixml:TransactionData"));
        }
        if (this.xmlHasChild(node, "sixml:Amount")) {
            this.amount = new timapi.protocol.sixml.Amount(this.xmlGetChild(node, "sixml:Amount"));
        }
        if (this.xmlHasChild(node, "sixml:MerchantOptionList")) {
            this.merchantOptionList = new timapi.protocol.sixml.MerchantOptionList(this.xmlGetChild(node, "sixml:MerchantOptionList"));
        }
        return;
    }
    if (arguments.length == 0) {
        this.functionGroup = "FinTransaction";
        this.function = "PurchaseReservation";
        return;
    }
    throw new Error("Invalid argument");
};
timapi.protocol.sixml.Request_PurchaseReservation.prototype = Object.create(timapi.protocol.Message.prototype);
timapi.protocol.sixml.Request_PurchaseReservation.prototype.functionGroup = undefined;
timapi.protocol.sixml.Request_PurchaseReservation.prototype.function = undefined;
timapi.protocol.sixml.Request_PurchaseReservation.prototype.sequenceNumber = undefined;
timapi.protocol.sixml.Request_PurchaseReservation.prototype.transactionData = undefined;
timapi.protocol.sixml.Request_PurchaseReservation.prototype.amount = undefined;
timapi.protocol.sixml.Request_PurchaseReservation.prototype.merchantOptionList = undefined;
timapi.protocol.sixml.Request_PurchaseReservation.prototype.toXmlNode = function () {
    var node = new timapi.protocol.XmlNode("sixml:Request");
    this.xmlSetAttribute(node, "xmlns:sixml", "http://www.six-payment-services.com/");
    if (this.functionGroup != undefined) {
        this.xmlSetAttribute(node, "FunctionGroup", this.functionGroup);
    }
    if (this.function != undefined) {
        this.xmlSetAttribute(node, "Function", this.function);
    }
    if (this.sequenceNumber != undefined) {
        this.xmlSetAttribute(node, "SequenceNumber", timapi.utils.StringHelper.makeString(this.sequenceNumber));
    }
    if (this.transactionData != undefined) {
        this.xmlAddChild(node, "sixml:TransactionData", this.transactionData);
    }
    if (this.amount != undefined) {
        this.xmlAddChild(node, "sixml:Amount", this.amount);
    }
    if (this.merchantOptionList != undefined) {
        this.xmlAddChild(node, "sixml:MerchantOptionList", this.merchantOptionList);
    }
    return node;
};
timapi.protocol.sixml.Request_PurchaseWithCashback = function (a) {
    if (arguments.length == 1 && a instanceof timapi.protocol.sixml.Request_PurchaseWithCashback) {
        var value = a;
        this.functionGroup = value.functionGroup;
        this.function = value.function;
        this.sequenceNumber = value.sequenceNumber;
        this.usrId = value.usrId;
        this.amount = value.amount ? new timapi.protocol.sixml.Amount(value.amount) : undefined;
        this.amountOther = value.amountOther ? new timapi.protocol.sixml.AmountOther(value.amountOther) : undefined;
        this.transactionData = value.transactionData ? new timapi.protocol.sixml.TransactionData(value.transactionData) : undefined;
        this.merchantOptionList = value.merchantOptionList ? new timapi.protocol.sixml.MerchantOptionList(value.merchantOptionList) : undefined;
        return;
    }
    if (arguments.length == 1 && a instanceof timapi.protocol.XmlNode) {
        var node = a;
        if (this.xmlHasAttribute(node, "FunctionGroup")) {
            this.functionGroup = this.xmlGetAttribute(node, "FunctionGroup");
        }
        if (this.xmlHasAttribute(node, "Function")) {
            this.function = this.xmlGetAttribute(node, "Function");
        }
        if (this.xmlHasAttribute(node, "SequenceNumber")) {
            this.sequenceNumber = (this.xmlGetAttribute(node, "SequenceNumber") ? parseInt(this.xmlGetAttribute(node, "SequenceNumber")) : 0);
        }
        if (this.xmlHasChild(node, "sixml:UsrId")) {
            this.usrId = (this.xmlGetChild(node, "sixml:UsrId").textContent ? parseInt(this.xmlGetChild(node, "sixml:UsrId").textContent) : 0);
        }
        if (this.xmlHasChild(node, "sixml:Amount")) {
            this.amount = new timapi.protocol.sixml.Amount(this.xmlGetChild(node, "sixml:Amount"));
        }
        if (this.xmlHasChild(node, "sixml:AmountOther")) {
            this.amountOther = new timapi.protocol.sixml.AmountOther(this.xmlGetChild(node, "sixml:AmountOther"));
        }
        if (this.xmlHasChild(node, "sixml:TransactionData")) {
            this.transactionData = new timapi.protocol.sixml.TransactionData(this.xmlGetChild(node, "sixml:TransactionData"));
        }
        if (this.xmlHasChild(node, "sixml:MerchantOptionList")) {
            this.merchantOptionList = new timapi.protocol.sixml.MerchantOptionList(this.xmlGetChild(node, "sixml:MerchantOptionList"));
        }
        return;
    }
    if (arguments.length == 0) {
        this.functionGroup = "FinTransaction";
        this.function = "PurchaseWithCashback";
        return;
    }
    throw new Error("Invalid argument");
};
timapi.protocol.sixml.Request_PurchaseWithCashback.prototype = Object.create(timapi.protocol.Message.prototype);
timapi.protocol.sixml.Request_PurchaseWithCashback.prototype.functionGroup = undefined;
timapi.protocol.sixml.Request_PurchaseWithCashback.prototype.function = undefined;
timapi.protocol.sixml.Request_PurchaseWithCashback.prototype.sequenceNumber = undefined;
timapi.protocol.sixml.Request_PurchaseWithCashback.prototype.usrId = undefined;
timapi.protocol.sixml.Request_PurchaseWithCashback.prototype.amount = undefined;
timapi.protocol.sixml.Request_PurchaseWithCashback.prototype.amountOther = undefined;
timapi.protocol.sixml.Request_PurchaseWithCashback.prototype.transactionData = undefined;
timapi.protocol.sixml.Request_PurchaseWithCashback.prototype.merchantOptionList = undefined;
timapi.protocol.sixml.Request_PurchaseWithCashback.prototype.toXmlNode = function () {
    var node = new timapi.protocol.XmlNode("sixml:Request");
    this.xmlSetAttribute(node, "xmlns:sixml", "http://www.six-payment-services.com/");
    if (this.functionGroup != undefined) {
        this.xmlSetAttribute(node, "FunctionGroup", this.functionGroup);
    }
    if (this.function != undefined) {
        this.xmlSetAttribute(node, "Function", this.function);
    }
    if (this.sequenceNumber != undefined) {
        this.xmlSetAttribute(node, "SequenceNumber", timapi.utils.StringHelper.makeString(this.sequenceNumber));
    }
    if (this.usrId != undefined) {
        this.xmlAddChild(node, "sixml:UsrId", timapi.utils.StringHelper.makeString(this.usrId));
    }
    if (this.amount != undefined) {
        this.xmlAddChild(node, "sixml:Amount", this.amount);
    }
    if (this.amountOther != undefined) {
        this.xmlAddChild(node, "sixml:AmountOther", this.amountOther);
    }
    if (this.transactionData != undefined) {
        this.xmlAddChild(node, "sixml:TransactionData", this.transactionData);
    }
    if (this.merchantOptionList != undefined) {
        this.xmlAddChild(node, "sixml:MerchantOptionList", this.merchantOptionList);
    }
    return node;
};
timapi.protocol.sixml.Request_Reboot = function (a) {
    if (arguments.length == 1 && a instanceof timapi.protocol.sixml.Request_Reboot) {
        var value = a;
        this.functionGroup = value.functionGroup;
        this.function = value.function;
        this.sequenceNumber = value.sequenceNumber;
        return;
    }
    if (arguments.length == 1 && a instanceof timapi.protocol.XmlNode) {
        var node = a;
        if (this.xmlHasAttribute(node, "FunctionGroup")) {
            this.functionGroup = this.xmlGetAttribute(node, "FunctionGroup");
        }
        if (this.xmlHasAttribute(node, "Function")) {
            this.function = this.xmlGetAttribute(node, "Function");
        }
        if (this.xmlHasAttribute(node, "SequenceNumber")) {
            this.sequenceNumber = (this.xmlGetAttribute(node, "SequenceNumber") ? parseInt(this.xmlGetAttribute(node, "SequenceNumber")) : 0);
        }
        return;
    }
    if (arguments.length == 0) {
        this.functionGroup = "Admin";
        this.function = "Reboot";
        return;
    }
    throw new Error("Invalid argument");
};
timapi.protocol.sixml.Request_Reboot.prototype = Object.create(timapi.protocol.Message.prototype);
timapi.protocol.sixml.Request_Reboot.prototype.functionGroup = undefined;
timapi.protocol.sixml.Request_Reboot.prototype.function = undefined;
timapi.protocol.sixml.Request_Reboot.prototype.sequenceNumber = undefined;
timapi.protocol.sixml.Request_Reboot.prototype.toXmlNode = function () {
    var node = new timapi.protocol.XmlNode("sixml:Request");
    this.xmlSetAttribute(node, "xmlns:sixml", "http://www.six-payment-services.com/");
    if (this.functionGroup != undefined) {
        this.xmlSetAttribute(node, "FunctionGroup", this.functionGroup);
    }
    if (this.function != undefined) {
        this.xmlSetAttribute(node, "Function", this.function);
    }
    if (this.sequenceNumber != undefined) {
        this.xmlSetAttribute(node, "SequenceNumber", timapi.utils.StringHelper.makeString(this.sequenceNumber));
    }
    return node;
};
timapi.protocol.sixml.Request_ReceiptRequest = function (a) {
    if (arguments.length == 1 && a instanceof timapi.protocol.sixml.Request_ReceiptRequest) {
        var value = a;
        this.functionGroup = value.functionGroup;
        this.function = value.function;
        this.sequenceNumber = value.sequenceNumber;
        this.receiptRequestType = value.receiptRequestType;
        return;
    }
    if (arguments.length == 1 && a instanceof timapi.protocol.XmlNode) {
        var node = a;
        if (this.xmlHasAttribute(node, "FunctionGroup")) {
            this.functionGroup = this.xmlGetAttribute(node, "FunctionGroup");
        }
        if (this.xmlHasAttribute(node, "Function")) {
            this.function = this.xmlGetAttribute(node, "Function");
        }
        if (this.xmlHasAttribute(node, "SequenceNumber")) {
            this.sequenceNumber = (this.xmlGetAttribute(node, "SequenceNumber") ? parseInt(this.xmlGetAttribute(node, "SequenceNumber")) : 0);
        }
        if (this.xmlHasChild(node, "sixml:ReceiptRequestType")) {
            this.receiptRequestType = this.xmlGetChild(node, "sixml:ReceiptRequestType").textContent;
        }
        return;
    }
    if (arguments.length == 0) {
        this.functionGroup = "Admin";
        this.function = "ReceiptRequest";
        return;
    }
    throw new Error("Invalid argument");
};
timapi.protocol.sixml.Request_ReceiptRequest.prototype = Object.create(timapi.protocol.Message.prototype);
timapi.protocol.sixml.Request_ReceiptRequest.prototype.functionGroup = undefined;
timapi.protocol.sixml.Request_ReceiptRequest.prototype.function = undefined;
timapi.protocol.sixml.Request_ReceiptRequest.prototype.sequenceNumber = undefined;
timapi.protocol.sixml.Request_ReceiptRequest.prototype.receiptRequestType = undefined;
timapi.protocol.sixml.Request_ReceiptRequest.prototype.toXmlNode = function () {
    var node = new timapi.protocol.XmlNode("sixml:Request");
    this.xmlSetAttribute(node, "xmlns:sixml", "http://www.six-payment-services.com/");
    if (this.functionGroup != undefined) {
        this.xmlSetAttribute(node, "FunctionGroup", this.functionGroup);
    }
    if (this.function != undefined) {
        this.xmlSetAttribute(node, "Function", this.function);
    }
    if (this.sequenceNumber != undefined) {
        this.xmlSetAttribute(node, "SequenceNumber", timapi.utils.StringHelper.makeString(this.sequenceNumber));
    }
    if (this.receiptRequestType != undefined) {
        this.xmlAddChild(node, "sixml:ReceiptRequestType", this.receiptRequestType);
    }
    return node;
};
timapi.protocol.sixml.Request_Reconciliation = function (a) {
    if (arguments.length == 1 && a instanceof timapi.protocol.sixml.Request_Reconciliation) {
        var value = a;
        this.functionGroup = value.functionGroup;
        this.function = value.function;
        this.sequenceNumber = value.sequenceNumber;
        return;
    }
    if (arguments.length == 1 && a instanceof timapi.protocol.XmlNode) {
        var node = a;
        if (this.xmlHasAttribute(node, "FunctionGroup")) {
            this.functionGroup = this.xmlGetAttribute(node, "FunctionGroup");
        }
        if (this.xmlHasAttribute(node, "Function")) {
            this.function = this.xmlGetAttribute(node, "Function");
        }
        if (this.xmlHasAttribute(node, "SequenceNumber")) {
            this.sequenceNumber = (this.xmlGetAttribute(node, "SequenceNumber") ? parseInt(this.xmlGetAttribute(node, "SequenceNumber")) : 0);
        }
        return;
    }
    if (arguments.length == 0) {
        this.functionGroup = "Admin";
        this.function = "Reconciliation";
        return;
    }
    throw new Error("Invalid argument");
};
timapi.protocol.sixml.Request_Reconciliation.prototype = Object.create(timapi.protocol.Message.prototype);
timapi.protocol.sixml.Request_Reconciliation.prototype.functionGroup = undefined;
timapi.protocol.sixml.Request_Reconciliation.prototype.function = undefined;
timapi.protocol.sixml.Request_Reconciliation.prototype.sequenceNumber = undefined;
timapi.protocol.sixml.Request_Reconciliation.prototype.toXmlNode = function () {
    var node = new timapi.protocol.XmlNode("sixml:Request");
    this.xmlSetAttribute(node, "xmlns:sixml", "http://www.six-payment-services.com/");
    if (this.functionGroup != undefined) {
        this.xmlSetAttribute(node, "FunctionGroup", this.functionGroup);
    }
    if (this.function != undefined) {
        this.xmlSetAttribute(node, "Function", this.function);
    }
    if (this.sequenceNumber != undefined) {
        this.xmlSetAttribute(node, "SequenceNumber", timapi.utils.StringHelper.makeString(this.sequenceNumber));
    }
    return node;
};
timapi.protocol.sixml.Request_Reconfig = function (a) {
    if (arguments.length == 1 && a instanceof timapi.protocol.sixml.Request_Reconfig) {
        var value = a;
        this.functionGroup = value.functionGroup;
        this.function = value.function;
        this.sequenceNumber = value.sequenceNumber;
        return;
    }
    if (arguments.length == 1 && a instanceof timapi.protocol.XmlNode) {
        var node = a;
        if (this.xmlHasAttribute(node, "FunctionGroup")) {
            this.functionGroup = this.xmlGetAttribute(node, "FunctionGroup");
        }
        if (this.xmlHasAttribute(node, "Function")) {
            this.function = this.xmlGetAttribute(node, "Function");
        }
        if (this.xmlHasAttribute(node, "SequenceNumber")) {
            this.sequenceNumber = (this.xmlGetAttribute(node, "SequenceNumber") ? parseInt(this.xmlGetAttribute(node, "SequenceNumber")) : 0);
        }
        return;
    }
    if (arguments.length == 0) {
        this.functionGroup = "Admin";
        this.function = "Reconfig";
        return;
    }
    throw new Error("Invalid argument");
};
timapi.protocol.sixml.Request_Reconfig.prototype = Object.create(timapi.protocol.Message.prototype);
timapi.protocol.sixml.Request_Reconfig.prototype.functionGroup = undefined;
timapi.protocol.sixml.Request_Reconfig.prototype.function = undefined;
timapi.protocol.sixml.Request_Reconfig.prototype.sequenceNumber = undefined;
timapi.protocol.sixml.Request_Reconfig.prototype.toXmlNode = function () {
    var node = new timapi.protocol.XmlNode("sixml:Request");
    this.xmlSetAttribute(node, "xmlns:sixml", "http://www.six-payment-services.com/");
    if (this.functionGroup != undefined) {
        this.xmlSetAttribute(node, "FunctionGroup", this.functionGroup);
    }
    if (this.function != undefined) {
        this.xmlSetAttribute(node, "Function", this.function);
    }
    if (this.sequenceNumber != undefined) {
        this.xmlSetAttribute(node, "SequenceNumber", timapi.utils.StringHelper.makeString(this.sequenceNumber));
    }
    return node;
};
timapi.protocol.sixml.Request_Reservation = function (a) {
    if (arguments.length == 1 && a instanceof timapi.protocol.sixml.Request_Reservation) {
        var value = a;
        this.functionGroup = value.functionGroup;
        this.function = value.function;
        this.sequenceNumber = value.sequenceNumber;
        this.amount = value.amount ? new timapi.protocol.sixml.Amount(value.amount) : undefined;
        this.transactionData = value.transactionData ? new timapi.protocol.sixml.TransactionData(value.transactionData) : undefined;
        this.merchantOptionList = value.merchantOptionList ? new timapi.protocol.sixml.MerchantOptionList(value.merchantOptionList) : undefined;
        return;
    }
    if (arguments.length == 1 && a instanceof timapi.protocol.XmlNode) {
        var node = a;
        if (this.xmlHasAttribute(node, "FunctionGroup")) {
            this.functionGroup = this.xmlGetAttribute(node, "FunctionGroup");
        }
        if (this.xmlHasAttribute(node, "Function")) {
            this.function = this.xmlGetAttribute(node, "Function");
        }
        if (this.xmlHasAttribute(node, "SequenceNumber")) {
            this.sequenceNumber = (this.xmlGetAttribute(node, "SequenceNumber") ? parseInt(this.xmlGetAttribute(node, "SequenceNumber")) : 0);
        }
        if (this.xmlHasChild(node, "sixml:Amount")) {
            this.amount = new timapi.protocol.sixml.Amount(this.xmlGetChild(node, "sixml:Amount"));
        }
        if (this.xmlHasChild(node, "sixml:TransactionData")) {
            this.transactionData = new timapi.protocol.sixml.TransactionData(this.xmlGetChild(node, "sixml:TransactionData"));
        }
        if (this.xmlHasChild(node, "sixml:MerchantOptionList")) {
            this.merchantOptionList = new timapi.protocol.sixml.MerchantOptionList(this.xmlGetChild(node, "sixml:MerchantOptionList"));
        }
        return;
    }
    if (arguments.length == 0) {
        this.functionGroup = "NonFinTransaction";
        this.function = "Reservation";
        return;
    }
    throw new Error("Invalid argument");
};
timapi.protocol.sixml.Request_Reservation.prototype = Object.create(timapi.protocol.Message.prototype);
timapi.protocol.sixml.Request_Reservation.prototype.functionGroup = undefined;
timapi.protocol.sixml.Request_Reservation.prototype.function = undefined;
timapi.protocol.sixml.Request_Reservation.prototype.sequenceNumber = undefined;
timapi.protocol.sixml.Request_Reservation.prototype.amount = undefined;
timapi.protocol.sixml.Request_Reservation.prototype.transactionData = undefined;
timapi.protocol.sixml.Request_Reservation.prototype.merchantOptionList = undefined;
timapi.protocol.sixml.Request_Reservation.prototype.toXmlNode = function () {
    var node = new timapi.protocol.XmlNode("sixml:Request");
    this.xmlSetAttribute(node, "xmlns:sixml", "http://www.six-payment-services.com/");
    if (this.functionGroup != undefined) {
        this.xmlSetAttribute(node, "FunctionGroup", this.functionGroup);
    }
    if (this.function != undefined) {
        this.xmlSetAttribute(node, "Function", this.function);
    }
    if (this.sequenceNumber != undefined) {
        this.xmlSetAttribute(node, "SequenceNumber", timapi.utils.StringHelper.makeString(this.sequenceNumber));
    }
    if (this.amount != undefined) {
        this.xmlAddChild(node, "sixml:Amount", this.amount);
    }
    if (this.transactionData != undefined) {
        this.xmlAddChild(node, "sixml:TransactionData", this.transactionData);
    }
    if (this.merchantOptionList != undefined) {
        this.xmlAddChild(node, "sixml:MerchantOptionList", this.merchantOptionList);
    }
    return node;
};
timapi.protocol.sixml.Request_Reversal = function (a) {
    if (arguments.length == 1 && a instanceof timapi.protocol.sixml.Request_Reversal) {
        var value = a;
        this.functionGroup = value.functionGroup;
        this.function = value.function;
        this.sequenceNumber = value.sequenceNumber;
        this.usrId = value.usrId;
        this.transactionData = value.transactionData ? new timapi.protocol.sixml.TransactionData(value.transactionData) : undefined;
        this.merchantOptionList = value.merchantOptionList ? new timapi.protocol.sixml.MerchantOptionList(value.merchantOptionList) : undefined;
        return;
    }
    if (arguments.length == 1 && a instanceof timapi.protocol.XmlNode) {
        var node = a;
        if (this.xmlHasAttribute(node, "FunctionGroup")) {
            this.functionGroup = this.xmlGetAttribute(node, "FunctionGroup");
        }
        if (this.xmlHasAttribute(node, "Function")) {
            this.function = this.xmlGetAttribute(node, "Function");
        }
        if (this.xmlHasAttribute(node, "SequenceNumber")) {
            this.sequenceNumber = (this.xmlGetAttribute(node, "SequenceNumber") ? parseInt(this.xmlGetAttribute(node, "SequenceNumber")) : 0);
        }
        if (this.xmlHasChild(node, "sixml:UsrId")) {
            this.usrId = (this.xmlGetChild(node, "sixml:UsrId").textContent ? parseInt(this.xmlGetChild(node, "sixml:UsrId").textContent) : 0);
        }
        if (this.xmlHasChild(node, "sixml:TransactionData")) {
            this.transactionData = new timapi.protocol.sixml.TransactionData(this.xmlGetChild(node, "sixml:TransactionData"));
        }
        if (this.xmlHasChild(node, "sixml:MerchantOptionList")) {
            this.merchantOptionList = new timapi.protocol.sixml.MerchantOptionList(this.xmlGetChild(node, "sixml:MerchantOptionList"));
        }
        return;
    }
    if (arguments.length == 0) {
        this.functionGroup = "FinTransaction";
        this.function = "Reversal";
        return;
    }
    throw new Error("Invalid argument");
};
timapi.protocol.sixml.Request_Reversal.prototype = Object.create(timapi.protocol.Message.prototype);
timapi.protocol.sixml.Request_Reversal.prototype.functionGroup = undefined;
timapi.protocol.sixml.Request_Reversal.prototype.function = undefined;
timapi.protocol.sixml.Request_Reversal.prototype.sequenceNumber = undefined;
timapi.protocol.sixml.Request_Reversal.prototype.usrId = undefined;
timapi.protocol.sixml.Request_Reversal.prototype.transactionData = undefined;
timapi.protocol.sixml.Request_Reversal.prototype.merchantOptionList = undefined;
timapi.protocol.sixml.Request_Reversal.prototype.toXmlNode = function () {
    var node = new timapi.protocol.XmlNode("sixml:Request");
    this.xmlSetAttribute(node, "xmlns:sixml", "http://www.six-payment-services.com/");
    if (this.functionGroup != undefined) {
        this.xmlSetAttribute(node, "FunctionGroup", this.functionGroup);
    }
    if (this.function != undefined) {
        this.xmlSetAttribute(node, "Function", this.function);
    }
    if (this.sequenceNumber != undefined) {
        this.xmlSetAttribute(node, "SequenceNumber", timapi.utils.StringHelper.makeString(this.sequenceNumber));
    }
    if (this.usrId != undefined) {
        this.xmlAddChild(node, "sixml:UsrId", timapi.utils.StringHelper.makeString(this.usrId));
    }
    if (this.transactionData != undefined) {
        this.xmlAddChild(node, "sixml:TransactionData", this.transactionData);
    }
    if (this.merchantOptionList != undefined) {
        this.xmlAddChild(node, "sixml:MerchantOptionList", this.merchantOptionList);
    }
    return node;
};
timapi.protocol.sixml.Request_Rollback = function (a) {
    if (arguments.length == 1 && a instanceof timapi.protocol.sixml.Request_Rollback) {
        var value = a;
        this.functionGroup = value.functionGroup;
        this.function = value.function;
        this.sequenceNumber = value.sequenceNumber;
        this.repeat = value.repeat;
        return;
    }
    if (arguments.length == 1 && a instanceof timapi.protocol.XmlNode) {
        var node = a;
        if (this.xmlHasAttribute(node, "FunctionGroup")) {
            this.functionGroup = this.xmlGetAttribute(node, "FunctionGroup");
        }
        if (this.xmlHasAttribute(node, "Function")) {
            this.function = this.xmlGetAttribute(node, "Function");
        }
        if (this.xmlHasAttribute(node, "SequenceNumber")) {
            this.sequenceNumber = (this.xmlGetAttribute(node, "SequenceNumber") ? parseInt(this.xmlGetAttribute(node, "SequenceNumber")) : 0);
        }
        if (this.xmlHasAttribute(node, "Repeat")) {
            this.repeat = (this.xmlGetAttribute(node, "Repeat") ? parseInt(this.xmlGetAttribute(node, "Repeat")) : 0);
        }
        return;
    }
    if (arguments.length == 0) {
        this.functionGroup = "FinTransaction";
        this.function = "Rollback";
        return;
    }
    throw new Error("Invalid argument");
};
timapi.protocol.sixml.Request_Rollback.prototype = Object.create(timapi.protocol.Message.prototype);
timapi.protocol.sixml.Request_Rollback.prototype.functionGroup = undefined;
timapi.protocol.sixml.Request_Rollback.prototype.function = undefined;
timapi.protocol.sixml.Request_Rollback.prototype.sequenceNumber = undefined;
timapi.protocol.sixml.Request_Rollback.prototype.repeat = undefined;
timapi.protocol.sixml.Request_Rollback.prototype.toXmlNode = function () {
    var node = new timapi.protocol.XmlNode("sixml:Request");
    this.xmlSetAttribute(node, "xmlns:sixml", "http://www.six-payment-services.com/");
    if (this.functionGroup != undefined) {
        this.xmlSetAttribute(node, "FunctionGroup", this.functionGroup);
    }
    if (this.function != undefined) {
        this.xmlSetAttribute(node, "Function", this.function);
    }
    if (this.sequenceNumber != undefined) {
        this.xmlSetAttribute(node, "SequenceNumber", timapi.utils.StringHelper.makeString(this.sequenceNumber));
    }
    if (this.repeat != undefined) {
        this.xmlSetAttribute(node, "Repeat", timapi.utils.StringHelper.makeString(this.repeat));
    }
    return node;
};
timapi.protocol.sixml.Request_ShowDialog = function (a) {
    if (arguments.length == 1 && a instanceof timapi.protocol.sixml.Request_ShowDialog) {
        var value = a;
        this.functionGroup = value.functionGroup;
        this.function = value.function;
        this.sequenceNumber = value.sequenceNumber;
        this.resourceParameterList = value.resourceParameterList ? new timapi.protocol.sixml.ResourceParameterList(value.resourceParameterList) : undefined;
        this.resourceData = value.resourceData ? new timapi.protocol.sixml.ResourceData(value.resourceData) : undefined;
        this.brandBar = value.brandBar ? new timapi.protocol.sixml.BrandBar(value.brandBar) : undefined;
        return;
    }
    if (arguments.length == 1 && a instanceof timapi.protocol.XmlNode) {
        var node = a;
        if (this.xmlHasAttribute(node, "FunctionGroup")) {
            this.functionGroup = this.xmlGetAttribute(node, "FunctionGroup");
        }
        if (this.xmlHasAttribute(node, "Function")) {
            this.function = this.xmlGetAttribute(node, "Function");
        }
        if (this.xmlHasAttribute(node, "SequenceNumber")) {
            this.sequenceNumber = (this.xmlGetAttribute(node, "SequenceNumber") ? parseInt(this.xmlGetAttribute(node, "SequenceNumber")) : 0);
        }
        if (this.xmlHasChild(node, "sixml:ResourceParameterList")) {
            this.resourceParameterList = new timapi.protocol.sixml.ResourceParameterList(this.xmlGetChild(node, "sixml:ResourceParameterList"));
        }
        if (this.xmlHasChild(node, "sixml:ResourceData")) {
            this.resourceData = new timapi.protocol.sixml.ResourceData(this.xmlGetChild(node, "sixml:ResourceData"));
        }
        if (this.xmlHasChild(node, "sixml:BrandBar")) {
            this.brandBar = new timapi.protocol.sixml.BrandBar(this.xmlGetChild(node, "sixml:BrandBar"));
        }
        return;
    }
    if (arguments.length == 0) {
        this.functionGroup = "Dialog";
        this.function = "ShowDialog";
        return;
    }
    throw new Error("Invalid argument");
};
timapi.protocol.sixml.Request_ShowDialog.prototype = Object.create(timapi.protocol.Message.prototype);
timapi.protocol.sixml.Request_ShowDialog.prototype.functionGroup = undefined;
timapi.protocol.sixml.Request_ShowDialog.prototype.function = undefined;
timapi.protocol.sixml.Request_ShowDialog.prototype.sequenceNumber = undefined;
timapi.protocol.sixml.Request_ShowDialog.prototype.resourceParameterList = undefined;
timapi.protocol.sixml.Request_ShowDialog.prototype.resourceData = undefined;
timapi.protocol.sixml.Request_ShowDialog.prototype.brandBar = undefined;
timapi.protocol.sixml.Request_ShowDialog.prototype.toXmlNode = function () {
    var node = new timapi.protocol.XmlNode("sixml:Request");
    this.xmlSetAttribute(node, "xmlns:sixml", "http://www.six-payment-services.com/");
    if (this.functionGroup != undefined) {
        this.xmlSetAttribute(node, "FunctionGroup", this.functionGroup);
    }
    if (this.function != undefined) {
        this.xmlSetAttribute(node, "Function", this.function);
    }
    if (this.sequenceNumber != undefined) {
        this.xmlSetAttribute(node, "SequenceNumber", timapi.utils.StringHelper.makeString(this.sequenceNumber));
    }
    if (this.resourceParameterList != undefined) {
        this.xmlAddChild(node, "sixml:ResourceParameterList", this.resourceParameterList);
    }
    if (this.resourceData != undefined) {
        this.xmlAddChild(node, "sixml:ResourceData", this.resourceData);
    }
    if (this.brandBar != undefined) {
        this.xmlAddChild(node, "sixml:BrandBar", this.brandBar);
    }
    return node;
};
timapi.protocol.sixml.Request_ShowSignatureCapture = function (a) {
    if (arguments.length == 1 && a instanceof timapi.protocol.sixml.Request_ShowSignatureCapture) {
        var value = a;
        this.functionGroup = value.functionGroup;
        this.function = value.function;
        this.sequenceNumber = value.sequenceNumber;
        this.signatureData = value.signatureData ? new timapi.protocol.sixml.SignatureData(value.signatureData) : undefined;
        this.brandBar = value.brandBar ? new timapi.protocol.sixml.BrandBar(value.brandBar) : undefined;
        return;
    }
    if (arguments.length == 1 && a instanceof timapi.protocol.XmlNode) {
        var node = a;
        if (this.xmlHasAttribute(node, "FunctionGroup")) {
            this.functionGroup = this.xmlGetAttribute(node, "FunctionGroup");
        }
        if (this.xmlHasAttribute(node, "Function")) {
            this.function = this.xmlGetAttribute(node, "Function");
        }
        if (this.xmlHasAttribute(node, "SequenceNumber")) {
            this.sequenceNumber = (this.xmlGetAttribute(node, "SequenceNumber") ? parseInt(this.xmlGetAttribute(node, "SequenceNumber")) : 0);
        }
        if (this.xmlHasChild(node, "sixml:SignatureData")) {
            this.signatureData = new timapi.protocol.sixml.SignatureData(this.xmlGetChild(node, "sixml:SignatureData"));
        }
        if (this.xmlHasChild(node, "sixml:BrandBar")) {
            this.brandBar = new timapi.protocol.sixml.BrandBar(this.xmlGetChild(node, "sixml:BrandBar"));
        }
        return;
    }
    if (arguments.length == 0) {
        this.functionGroup = "Dialog";
        this.function = "ShowSignatureCapture";
        return;
    }
    throw new Error("Invalid argument");
};
timapi.protocol.sixml.Request_ShowSignatureCapture.prototype = Object.create(timapi.protocol.Message.prototype);
timapi.protocol.sixml.Request_ShowSignatureCapture.prototype.functionGroup = undefined;
timapi.protocol.sixml.Request_ShowSignatureCapture.prototype.function = undefined;
timapi.protocol.sixml.Request_ShowSignatureCapture.prototype.sequenceNumber = undefined;
timapi.protocol.sixml.Request_ShowSignatureCapture.prototype.signatureData = undefined;
timapi.protocol.sixml.Request_ShowSignatureCapture.prototype.brandBar = undefined;
timapi.protocol.sixml.Request_ShowSignatureCapture.prototype.toXmlNode = function () {
    var node = new timapi.protocol.XmlNode("sixml:Request");
    this.xmlSetAttribute(node, "xmlns:sixml", "http://www.six-payment-services.com/");
    if (this.functionGroup != undefined) {
        this.xmlSetAttribute(node, "FunctionGroup", this.functionGroup);
    }
    if (this.function != undefined) {
        this.xmlSetAttribute(node, "Function", this.function);
    }
    if (this.sequenceNumber != undefined) {
        this.xmlSetAttribute(node, "SequenceNumber", timapi.utils.StringHelper.makeString(this.sequenceNumber));
    }
    if (this.signatureData != undefined) {
        this.xmlAddChild(node, "sixml:SignatureData", this.signatureData);
    }
    if (this.brandBar != undefined) {
        this.xmlAddChild(node, "sixml:BrandBar", this.brandBar);
    }
    return node;
};
timapi.protocol.sixml.Request_SoftwareUpdate = function (a) {
    if (arguments.length == 1 && a instanceof timapi.protocol.sixml.Request_SoftwareUpdate) {
        var value = a;
        this.functionGroup = value.functionGroup;
        this.function = value.function;
        this.sequenceNumber = value.sequenceNumber;
        return;
    }
    if (arguments.length == 1 && a instanceof timapi.protocol.XmlNode) {
        var node = a;
        if (this.xmlHasAttribute(node, "FunctionGroup")) {
            this.functionGroup = this.xmlGetAttribute(node, "FunctionGroup");
        }
        if (this.xmlHasAttribute(node, "Function")) {
            this.function = this.xmlGetAttribute(node, "Function");
        }
        if (this.xmlHasAttribute(node, "SequenceNumber")) {
            this.sequenceNumber = (this.xmlGetAttribute(node, "SequenceNumber") ? parseInt(this.xmlGetAttribute(node, "SequenceNumber")) : 0);
        }
        return;
    }
    if (arguments.length == 0) {
        this.functionGroup = "Admin";
        this.function = "SoftwareUpdate";
        return;
    }
    throw new Error("Invalid argument");
};
timapi.protocol.sixml.Request_SoftwareUpdate.prototype = Object.create(timapi.protocol.Message.prototype);
timapi.protocol.sixml.Request_SoftwareUpdate.prototype.functionGroup = undefined;
timapi.protocol.sixml.Request_SoftwareUpdate.prototype.function = undefined;
timapi.protocol.sixml.Request_SoftwareUpdate.prototype.sequenceNumber = undefined;
timapi.protocol.sixml.Request_SoftwareUpdate.prototype.toXmlNode = function () {
    var node = new timapi.protocol.XmlNode("sixml:Request");
    this.xmlSetAttribute(node, "xmlns:sixml", "http://www.six-payment-services.com/");
    if (this.functionGroup != undefined) {
        this.xmlSetAttribute(node, "FunctionGroup", this.functionGroup);
    }
    if (this.function != undefined) {
        this.xmlSetAttribute(node, "Function", this.function);
    }
    if (this.sequenceNumber != undefined) {
        this.xmlSetAttribute(node, "SequenceNumber", timapi.utils.StringHelper.makeString(this.sequenceNumber));
    }
    return node;
};
timapi.protocol.sixml.Request_SystemInformation = function (a) {
    if (arguments.length == 1 && a instanceof timapi.protocol.sixml.Request_SystemInformation) {
        var value = a;
        this.functionGroup = value.functionGroup;
        this.function = value.function;
        this.sequenceNumber = value.sequenceNumber;
        this.ecrData = value.ecrData ? new timapi.protocol.sixml.EcrData(value.ecrData) : undefined;
        return;
    }
    if (arguments.length == 1 && a instanceof timapi.protocol.XmlNode) {
        var node = a;
        if (this.xmlHasAttribute(node, "FunctionGroup")) {
            this.functionGroup = this.xmlGetAttribute(node, "FunctionGroup");
        }
        if (this.xmlHasAttribute(node, "Function")) {
            this.function = this.xmlGetAttribute(node, "Function");
        }
        if (this.xmlHasAttribute(node, "SequenceNumber")) {
            this.sequenceNumber = (this.xmlGetAttribute(node, "SequenceNumber") ? parseInt(this.xmlGetAttribute(node, "SequenceNumber")) : 0);
        }
        if (this.xmlHasChild(node, "sixml:EcrData")) {
            this.ecrData = new timapi.protocol.sixml.EcrData(this.xmlGetChild(node, "sixml:EcrData"));
        }
        return;
    }
    if (arguments.length == 0) {
        this.functionGroup = "Status";
        this.function = "SystemInformation";
        return;
    }
    throw new Error("Invalid argument");
};
timapi.protocol.sixml.Request_SystemInformation.prototype = Object.create(timapi.protocol.Message.prototype);
timapi.protocol.sixml.Request_SystemInformation.prototype.functionGroup = undefined;
timapi.protocol.sixml.Request_SystemInformation.prototype.function = undefined;
timapi.protocol.sixml.Request_SystemInformation.prototype.sequenceNumber = undefined;
timapi.protocol.sixml.Request_SystemInformation.prototype.ecrData = undefined;
timapi.protocol.sixml.Request_SystemInformation.prototype.toXmlNode = function () {
    var node = new timapi.protocol.XmlNode("sixml:Request");
    this.xmlSetAttribute(node, "xmlns:sixml", "http://www.six-payment-services.com/");
    if (this.functionGroup != undefined) {
        this.xmlSetAttribute(node, "FunctionGroup", this.functionGroup);
    }
    if (this.function != undefined) {
        this.xmlSetAttribute(node, "Function", this.function);
    }
    if (this.sequenceNumber != undefined) {
        this.xmlSetAttribute(node, "SequenceNumber", timapi.utils.StringHelper.makeString(this.sequenceNumber));
    }
    if (this.ecrData != undefined) {
        this.xmlAddChild(node, "sixml:EcrData", this.ecrData);
    }
    return node;
};
timapi.protocol.sixml.Request_TerminalStatus = function (a) {
    if (arguments.length == 1 && a instanceof timapi.protocol.sixml.Request_TerminalStatus) {
        var value = a;
        this.functionGroup = value.functionGroup;
        this.function = value.function;
        this.sequenceNumber = value.sequenceNumber;
        return;
    }
    if (arguments.length == 1 && a instanceof timapi.protocol.XmlNode) {
        var node = a;
        if (this.xmlHasAttribute(node, "FunctionGroup")) {
            this.functionGroup = this.xmlGetAttribute(node, "FunctionGroup");
        }
        if (this.xmlHasAttribute(node, "Function")) {
            this.function = this.xmlGetAttribute(node, "Function");
        }
        if (this.xmlHasAttribute(node, "SequenceNumber")) {
            this.sequenceNumber = (this.xmlGetAttribute(node, "SequenceNumber") ? parseInt(this.xmlGetAttribute(node, "SequenceNumber")) : 0);
        }
        return;
    }
    if (arguments.length == 0) {
        this.functionGroup = "Status";
        this.function = "TerminalStatus";
        return;
    }
    throw new Error("Invalid argument");
};
timapi.protocol.sixml.Request_TerminalStatus.prototype = Object.create(timapi.protocol.Message.prototype);
timapi.protocol.sixml.Request_TerminalStatus.prototype.functionGroup = undefined;
timapi.protocol.sixml.Request_TerminalStatus.prototype.function = undefined;
timapi.protocol.sixml.Request_TerminalStatus.prototype.sequenceNumber = undefined;
timapi.protocol.sixml.Request_TerminalStatus.prototype.toXmlNode = function () {
    var node = new timapi.protocol.XmlNode("sixml:Request");
    this.xmlSetAttribute(node, "xmlns:sixml", "http://www.six-payment-services.com/");
    if (this.functionGroup != undefined) {
        this.xmlSetAttribute(node, "FunctionGroup", this.functionGroup);
    }
    if (this.function != undefined) {
        this.xmlSetAttribute(node, "Function", this.function);
    }
    if (this.sequenceNumber != undefined) {
        this.xmlSetAttribute(node, "SequenceNumber", timapi.utils.StringHelper.makeString(this.sequenceNumber));
    }
    return node;
};
timapi.protocol.sixml.ResourceData = function (a) {
    if (arguments.length == 1 && a instanceof timapi.protocol.sixml.ResourceData) {
        var value = a;
        this.resourceId = value.resourceId;
        this.timeout = value.timeout;
        this.theme = value.theme;
        this.language = value.language;
        this.placeholderItemList = value.placeholderItemList ? new timapi.protocol.sixml.PlaceholderItemList(value.placeholderItemList) : undefined;
        return;
    }
    if (arguments.length == 1 && a instanceof timapi.protocol.XmlNode) {
        var node = a;
        if (this.xmlHasAttribute(node, "ResourceId")) {
            this.resourceId = (this.xmlGetAttribute(node, "ResourceId") ? parseInt(this.xmlGetAttribute(node, "ResourceId")) : 0);
        }
        if (this.xmlHasAttribute(node, "Timeout")) {
            this.timeout = (this.xmlGetAttribute(node, "Timeout") ? parseInt(this.xmlGetAttribute(node, "Timeout")) : 0);
        }
        if (this.xmlHasAttribute(node, "Theme")) {
            this.theme = this.xmlGetAttribute(node, "Theme");
        }
        if (this.xmlHasChild(node, "sixml:Language")) {
            this.language = this.xmlGetChild(node, "sixml:Language").textContent;
        }
        if (this.xmlHasChild(node, "sixml:PlaceholderItemList")) {
            this.placeholderItemList = new timapi.protocol.sixml.PlaceholderItemList(this.xmlGetChild(node, "sixml:PlaceholderItemList"));
        }
        return;
    }
    if (arguments.length != 0) {
        throw new Error("Invalid argument");
    }
};
timapi.protocol.sixml.ResourceData.prototype = Object.create(timapi.protocol.Container.prototype);
timapi.protocol.sixml.ResourceData.prototype.resourceId = undefined;
timapi.protocol.sixml.ResourceData.prototype.timeout = undefined;
timapi.protocol.sixml.ResourceData.prototype.theme = undefined;
timapi.protocol.sixml.ResourceData.prototype.language = undefined;
timapi.protocol.sixml.ResourceData.prototype.placeholderItemList = undefined;
timapi.protocol.sixml.ResourceData.prototype.toXmlNode = function () {
    var node = new timapi.protocol.XmlNode("sixml:ResourceData");
    if (this.resourceId != undefined) {
        this.xmlSetAttribute(node, "ResourceId", timapi.utils.StringHelper.makeString(this.resourceId));
    }
    if (this.timeout != undefined) {
        this.xmlSetAttribute(node, "Timeout", timapi.utils.StringHelper.makeString(this.timeout));
    }
    if (this.theme != undefined) {
        this.xmlSetAttribute(node, "Theme", this.theme);
    }
    if (this.language != undefined) {
        this.xmlAddChild(node, "sixml:Language", this.language);
    }
    if (this.placeholderItemList != undefined) {
        this.xmlAddChild(node, "sixml:PlaceholderItemList", this.placeholderItemList);
    }
    return node;
};
timapi.protocol.sixml.ResourceInformation = function (a) {
    if (arguments.length == 1 && a instanceof timapi.protocol.sixml.ResourceInformation) {
        var value = a;
        this.reason = value.reason;
        this.cardData = value.cardData ? new timapi.protocol.sixml.CardData(value.cardData) : undefined;
        this.inputValue = value.inputValue;
        return;
    }
    if (arguments.length == 1 && a instanceof timapi.protocol.XmlNode) {
        var node = a;
        if (this.xmlHasAttribute(node, "Reason")) {
            this.reason = this.xmlGetAttribute(node, "Reason");
        }
        if (this.xmlHasChild(node, "sixml:CardData")) {
            this.cardData = new timapi.protocol.sixml.CardData(this.xmlGetChild(node, "sixml:CardData"));
        }
        if (this.xmlHasChild(node, "sixml:InputValue")) {
            this.inputValue = this.xmlGetChild(node, "sixml:InputValue").textContent;
        }
        return;
    }
    if (arguments.length != 0) {
        throw new Error("Invalid argument");
    }
};
timapi.protocol.sixml.ResourceInformation.prototype = Object.create(timapi.protocol.Container.prototype);
timapi.protocol.sixml.ResourceInformation.prototype.reason = undefined;
timapi.protocol.sixml.ResourceInformation.prototype.cardData = undefined;
timapi.protocol.sixml.ResourceInformation.prototype.inputValue = undefined;
timapi.protocol.sixml.ResourceInformation.prototype.toXmlNode = function () {
    var node = new timapi.protocol.XmlNode("sixml:ResourceInformation");
    if (this.reason != undefined) {
        this.xmlSetAttribute(node, "Reason", this.reason);
    }
    if (this.cardData != undefined) {
        this.xmlAddChild(node, "sixml:CardData", this.cardData);
    }
    if (this.inputValue != undefined) {
        this.xmlAddChild(node, "sixml:InputValue", this.inputValue);
    }
    return node;
};
timapi.protocol.sixml.Response = function (a) {
    if (arguments.length == 1 && a instanceof timapi.protocol.sixml.Response) {
        var value = a;
        this.functionGroup = value.functionGroup;
        this.function = value.function;
        this.sequenceNumber = value.sequenceNumber;
        this.resultCode = value.resultCode;
        this.timeStamp = value.timeStamp;
        this.repeat = value.repeat;
        return;
    }
    if (arguments.length == 1 && a instanceof timapi.protocol.XmlNode) {
        var node = a;
        if (this.xmlHasAttribute(node, "FunctionGroup")) {
            this.functionGroup = this.xmlGetAttribute(node, "FunctionGroup");
        }
        if (this.xmlHasAttribute(node, "Function")) {
            this.function = this.xmlGetAttribute(node, "Function");
        }
        if (this.xmlHasAttribute(node, "SequenceNumber")) {
            this.sequenceNumber = (this.xmlGetAttribute(node, "SequenceNumber") ? parseInt(this.xmlGetAttribute(node, "SequenceNumber")) : 0);
        }
        if (this.xmlHasAttribute(node, "ResultCode")) {
            this.resultCode = (this.xmlGetAttribute(node, "ResultCode") ? parseInt(this.xmlGetAttribute(node, "ResultCode")) : 0);
        }
        if (this.xmlHasAttribute(node, "TimeStamp")) {
            this.timeStamp = new timapi.protocol.TimeDate("yyyyMMdd'T'HHmmssZ", this.xmlGetAttribute(node, "TimeStamp"));
        }
        if (this.xmlHasAttribute(node, "Repeat")) {
            this.repeat = (this.xmlGetAttribute(node, "Repeat") ? parseInt(this.xmlGetAttribute(node, "Repeat")) : 0);
        }
        return;
    }
    if (arguments.length == 0) {
        return;
    }
    throw new Error("Invalid argument");
};
timapi.protocol.sixml.Response.prototype = Object.create(timapi.protocol.Message.prototype);
timapi.protocol.sixml.Response.prototype.functionGroup = undefined;
timapi.protocol.sixml.Response.prototype.function = undefined;
timapi.protocol.sixml.Response.prototype.sequenceNumber = undefined;
timapi.protocol.sixml.Response.prototype.resultCode = undefined;
timapi.protocol.sixml.Response.prototype.timeStamp = undefined;
timapi.protocol.sixml.Response.prototype.repeat = undefined;
timapi.protocol.sixml.Response.prototype.toXmlNode = function () {
    var node = new timapi.protocol.XmlNode("sixml:Response");
    this.xmlSetAttribute(node, "xmlns:sixml", "http://www.six-payment-services.com/");
    if (this.functionGroup != undefined) {
        this.xmlSetAttribute(node, "FunctionGroup", this.functionGroup);
    }
    if (this.function != undefined) {
        this.xmlSetAttribute(node, "Function", this.function);
    }
    if (this.sequenceNumber != undefined) {
        this.xmlSetAttribute(node, "SequenceNumber", timapi.utils.StringHelper.makeString(this.sequenceNumber));
    }
    if (this.resultCode != undefined) {
        this.xmlSetAttribute(node, "ResultCode", timapi.utils.StringHelper.makeString(this.resultCode));
    }
    if (this.timeStamp != undefined) {
        this.xmlSetAttribute(node, "TimeStamp", this.timeStamp.format("yyyyMMdd'T'HHmmssZ"));
    }
    if (this.repeat != undefined) {
        this.xmlSetAttribute(node, "Repeat", timapi.utils.StringHelper.makeString(this.repeat));
    }
    return node;
};
timapi.protocol.sixml.Response_Activate = function (a) {
    if (arguments.length == 1 && a instanceof timapi.protocol.sixml.Response_Activate) {
        var value = a;
        this.functionGroup = value.functionGroup;
        this.function = value.function;
        this.sequenceNumber = value.sequenceNumber;
        this.resultCode = value.resultCode;
        this.timeStamp = value.timeStamp;
        this.printData = value.printData ? new timapi.protocol.sixml.PrintData(value.printData) : undefined;
        this.actSeqCounter = value.actSeqCounter;
        return;
    }
    if (arguments.length == 1 && a instanceof timapi.protocol.XmlNode) {
        var node = a;
        if (this.xmlHasAttribute(node, "FunctionGroup")) {
            this.functionGroup = this.xmlGetAttribute(node, "FunctionGroup");
        }
        if (this.xmlHasAttribute(node, "Function")) {
            this.function = this.xmlGetAttribute(node, "Function");
        }
        if (this.xmlHasAttribute(node, "SequenceNumber")) {
            this.sequenceNumber = (this.xmlGetAttribute(node, "SequenceNumber") ? parseInt(this.xmlGetAttribute(node, "SequenceNumber")) : 0);
        }
        if (this.xmlHasAttribute(node, "ResultCode")) {
            this.resultCode = (this.xmlGetAttribute(node, "ResultCode") ? parseInt(this.xmlGetAttribute(node, "ResultCode")) : 0);
        }
        if (this.xmlHasAttribute(node, "TimeStamp")) {
            this.timeStamp = new timapi.protocol.TimeDate("yyyyMMdd'T'HHmmssZ", this.xmlGetAttribute(node, "TimeStamp"));
        }
        if (this.xmlHasChild(node, "sixml:PrintData")) {
            this.printData = new timapi.protocol.sixml.PrintData(this.xmlGetChild(node, "sixml:PrintData"));
        }
        if (this.xmlHasChild(node, "sixml:ActSeqCounter")) {
            this.actSeqCounter = (this.xmlGetChild(node, "sixml:ActSeqCounter").textContent ? parseInt(this.xmlGetChild(node, "sixml:ActSeqCounter").textContent) : 0);
        }
        return;
    }
    if (arguments.length == 0) {
        this.functionGroup = "Admin";
        this.function = "Activate";
        return;
    }
    throw new Error("Invalid argument");
};
timapi.protocol.sixml.Response_Activate.prototype = Object.create(timapi.protocol.Message.prototype);
timapi.protocol.sixml.Response_Activate.prototype.functionGroup = undefined;
timapi.protocol.sixml.Response_Activate.prototype.function = undefined;
timapi.protocol.sixml.Response_Activate.prototype.sequenceNumber = undefined;
timapi.protocol.sixml.Response_Activate.prototype.resultCode = undefined;
timapi.protocol.sixml.Response_Activate.prototype.timeStamp = undefined;
timapi.protocol.sixml.Response_Activate.prototype.printData = undefined;
timapi.protocol.sixml.Response_Activate.prototype.actSeqCounter = undefined;
timapi.protocol.sixml.Response_Activate.prototype.toXmlNode = function () {
    var node = new timapi.protocol.XmlNode("sixml:Response");
    this.xmlSetAttribute(node, "xmlns:sixml", "http://www.six-payment-services.com/");
    if (this.functionGroup != undefined) {
        this.xmlSetAttribute(node, "FunctionGroup", this.functionGroup);
    }
    if (this.function != undefined) {
        this.xmlSetAttribute(node, "Function", this.function);
    }
    if (this.sequenceNumber != undefined) {
        this.xmlSetAttribute(node, "SequenceNumber", timapi.utils.StringHelper.makeString(this.sequenceNumber));
    }
    if (this.resultCode != undefined) {
        this.xmlSetAttribute(node, "ResultCode", timapi.utils.StringHelper.makeString(this.resultCode));
    }
    if (this.timeStamp != undefined) {
        this.xmlSetAttribute(node, "TimeStamp", this.timeStamp.format("yyyyMMdd'T'HHmmssZ"));
    }
    if (this.printData != undefined) {
        this.xmlAddChild(node, "sixml:PrintData", this.printData);
    }
    if (this.actSeqCounter != undefined) {
        this.xmlAddChild(node, "sixml:ActSeqCounter", timapi.utils.StringHelper.makeString(this.actSeqCounter));
    }
    return node;
};
timapi.protocol.sixml.Response_ActivateServiceMenu = function (a) {
    if (arguments.length == 1 && a instanceof timapi.protocol.sixml.Response_ActivateServiceMenu) {
        var value = a;
        this.functionGroup = value.functionGroup;
        this.function = value.function;
        this.sequenceNumber = value.sequenceNumber;
        this.resultCode = value.resultCode;
        this.timeStamp = value.timeStamp;
        return;
    }
    if (arguments.length == 1 && a instanceof timapi.protocol.XmlNode) {
        var node = a;
        if (this.xmlHasAttribute(node, "FunctionGroup")) {
            this.functionGroup = this.xmlGetAttribute(node, "FunctionGroup");
        }
        if (this.xmlHasAttribute(node, "Function")) {
            this.function = this.xmlGetAttribute(node, "Function");
        }
        if (this.xmlHasAttribute(node, "SequenceNumber")) {
            this.sequenceNumber = (this.xmlGetAttribute(node, "SequenceNumber") ? parseInt(this.xmlGetAttribute(node, "SequenceNumber")) : 0);
        }
        if (this.xmlHasAttribute(node, "ResultCode")) {
            this.resultCode = (this.xmlGetAttribute(node, "ResultCode") ? parseInt(this.xmlGetAttribute(node, "ResultCode")) : 0);
        }
        if (this.xmlHasAttribute(node, "TimeStamp")) {
            this.timeStamp = new timapi.protocol.TimeDate("yyyyMMdd'T'HHmmssZ", this.xmlGetAttribute(node, "TimeStamp"));
        }
        return;
    }
    if (arguments.length == 0) {
        this.functionGroup = "Admin";
        this.function = "ActivateServiceMenu";
        return;
    }
    throw new Error("Invalid argument");
};
timapi.protocol.sixml.Response_ActivateServiceMenu.prototype = Object.create(timapi.protocol.Message.prototype);
timapi.protocol.sixml.Response_ActivateServiceMenu.prototype.functionGroup = undefined;
timapi.protocol.sixml.Response_ActivateServiceMenu.prototype.function = undefined;
timapi.protocol.sixml.Response_ActivateServiceMenu.prototype.sequenceNumber = undefined;
timapi.protocol.sixml.Response_ActivateServiceMenu.prototype.resultCode = undefined;
timapi.protocol.sixml.Response_ActivateServiceMenu.prototype.timeStamp = undefined;
timapi.protocol.sixml.Response_ActivateServiceMenu.prototype.toXmlNode = function () {
    var node = new timapi.protocol.XmlNode("sixml:Response");
    this.xmlSetAttribute(node, "xmlns:sixml", "http://www.six-payment-services.com/");
    if (this.functionGroup != undefined) {
        this.xmlSetAttribute(node, "FunctionGroup", this.functionGroup);
    }
    if (this.function != undefined) {
        this.xmlSetAttribute(node, "Function", this.function);
    }
    if (this.sequenceNumber != undefined) {
        this.xmlSetAttribute(node, "SequenceNumber", timapi.utils.StringHelper.makeString(this.sequenceNumber));
    }
    if (this.resultCode != undefined) {
        this.xmlSetAttribute(node, "ResultCode", timapi.utils.StringHelper.makeString(this.resultCode));
    }
    if (this.timeStamp != undefined) {
        this.xmlSetAttribute(node, "TimeStamp", this.timeStamp.format("yyyyMMdd'T'HHmmssZ"));
    }
    return node;
};
timapi.protocol.sixml.Response_AdjustReservation = function (a) {
    if (arguments.length == 1 && a instanceof timapi.protocol.sixml.Response_AdjustReservation) {
        var value = a;
        this.functionGroup = value.functionGroup;
        this.function = value.function;
        this.sequenceNumber = value.sequenceNumber;
        this.resultCode = value.resultCode;
        this.timeStamp = value.timeStamp;
        this.amount = value.amount ? new timapi.protocol.sixml.Amount(value.amount) : undefined;
        this.amountDcc = value.amountDcc ? new timapi.protocol.sixml.AmountDcc(value.amountDcc) : undefined;
        this.amountDue = value.amountDue ? new timapi.protocol.sixml.AmountDue(value.amountDue) : undefined;
        this.transactionInformation = value.transactionInformation ? new timapi.protocol.sixml.TransactionInformation(value.transactionInformation) : undefined;
        this.dccDisclaimer = value.dccDisclaimer;
        this.disclaimer = value.disclaimer;
        this.cardData = value.cardData ? new timapi.protocol.sixml.CardData(value.cardData) : undefined;
        this.printData = value.printData ? new timapi.protocol.sixml.PrintData(value.printData) : undefined;
        return;
    }
    if (arguments.length == 1 && a instanceof timapi.protocol.XmlNode) {
        var node = a;
        if (this.xmlHasAttribute(node, "FunctionGroup")) {
            this.functionGroup = this.xmlGetAttribute(node, "FunctionGroup");
        }
        if (this.xmlHasAttribute(node, "Function")) {
            this.function = this.xmlGetAttribute(node, "Function");
        }
        if (this.xmlHasAttribute(node, "SequenceNumber")) {
            this.sequenceNumber = (this.xmlGetAttribute(node, "SequenceNumber") ? parseInt(this.xmlGetAttribute(node, "SequenceNumber")) : 0);
        }
        if (this.xmlHasAttribute(node, "ResultCode")) {
            this.resultCode = (this.xmlGetAttribute(node, "ResultCode") ? parseInt(this.xmlGetAttribute(node, "ResultCode")) : 0);
        }
        if (this.xmlHasAttribute(node, "TimeStamp")) {
            this.timeStamp = new timapi.protocol.TimeDate("yyyyMMdd'T'HHmmssZ", this.xmlGetAttribute(node, "TimeStamp"));
        }
        if (this.xmlHasChild(node, "sixml:Amount")) {
            this.amount = new timapi.protocol.sixml.Amount(this.xmlGetChild(node, "sixml:Amount"));
        }
        if (this.xmlHasChild(node, "sixml:AmountDcc")) {
            this.amountDcc = new timapi.protocol.sixml.AmountDcc(this.xmlGetChild(node, "sixml:AmountDcc"));
        }
        if (this.xmlHasChild(node, "sixml:AmountDue")) {
            this.amountDue = new timapi.protocol.sixml.AmountDue(this.xmlGetChild(node, "sixml:AmountDue"));
        }
        if (this.xmlHasChild(node, "sixml:TransactionInformation")) {
            this.transactionInformation = new timapi.protocol.sixml.TransactionInformation(this.xmlGetChild(node, "sixml:TransactionInformation"));
        }
        if (this.xmlHasChild(node, "sixml:DccDisclaimer")) {
            this.dccDisclaimer = this.xmlGetChild(node, "sixml:DccDisclaimer").textContent;
        }
        if (this.xmlHasChild(node, "sixml:Disclaimer")) {
            this.disclaimer = this.xmlGetChild(node, "sixml:Disclaimer").textContent;
        }
        if (this.xmlHasChild(node, "sixml:CardData")) {
            this.cardData = new timapi.protocol.sixml.CardData(this.xmlGetChild(node, "sixml:CardData"));
        }
        if (this.xmlHasChild(node, "sixml:PrintData")) {
            this.printData = new timapi.protocol.sixml.PrintData(this.xmlGetChild(node, "sixml:PrintData"));
        }
        return;
    }
    if (arguments.length == 0) {
        this.functionGroup = "NonFinTransaction";
        this.function = "AdjustReservation";
        return;
    }
    throw new Error("Invalid argument");
};
timapi.protocol.sixml.Response_AdjustReservation.prototype = Object.create(timapi.protocol.Message.prototype);
timapi.protocol.sixml.Response_AdjustReservation.prototype.functionGroup = undefined;
timapi.protocol.sixml.Response_AdjustReservation.prototype.function = undefined;
timapi.protocol.sixml.Response_AdjustReservation.prototype.sequenceNumber = undefined;
timapi.protocol.sixml.Response_AdjustReservation.prototype.resultCode = undefined;
timapi.protocol.sixml.Response_AdjustReservation.prototype.timeStamp = undefined;
timapi.protocol.sixml.Response_AdjustReservation.prototype.amount = undefined;
timapi.protocol.sixml.Response_AdjustReservation.prototype.amountDcc = undefined;
timapi.protocol.sixml.Response_AdjustReservation.prototype.amountDue = undefined;
timapi.protocol.sixml.Response_AdjustReservation.prototype.transactionInformation = undefined;
timapi.protocol.sixml.Response_AdjustReservation.prototype.dccDisclaimer = undefined;
timapi.protocol.sixml.Response_AdjustReservation.prototype.disclaimer = undefined;
timapi.protocol.sixml.Response_AdjustReservation.prototype.cardData = undefined;
timapi.protocol.sixml.Response_AdjustReservation.prototype.printData = undefined;
timapi.protocol.sixml.Response_AdjustReservation.prototype.toXmlNode = function () {
    var node = new timapi.protocol.XmlNode("sixml:Response");
    this.xmlSetAttribute(node, "xmlns:sixml", "http://www.six-payment-services.com/");
    if (this.functionGroup != undefined) {
        this.xmlSetAttribute(node, "FunctionGroup", this.functionGroup);
    }
    if (this.function != undefined) {
        this.xmlSetAttribute(node, "Function", this.function);
    }
    if (this.sequenceNumber != undefined) {
        this.xmlSetAttribute(node, "SequenceNumber", timapi.utils.StringHelper.makeString(this.sequenceNumber));
    }
    if (this.resultCode != undefined) {
        this.xmlSetAttribute(node, "ResultCode", timapi.utils.StringHelper.makeString(this.resultCode));
    }
    if (this.timeStamp != undefined) {
        this.xmlSetAttribute(node, "TimeStamp", this.timeStamp.format("yyyyMMdd'T'HHmmssZ"));
    }
    if (this.amount != undefined) {
        this.xmlAddChild(node, "sixml:Amount", this.amount);
    }
    if (this.amountDcc != undefined) {
        this.xmlAddChild(node, "sixml:AmountDcc", this.amountDcc);
    }
    if (this.amountDue != undefined) {
        this.xmlAddChild(node, "sixml:AmountDue", this.amountDue);
    }
    if (this.transactionInformation != undefined) {
        this.xmlAddChild(node, "sixml:TransactionInformation", this.transactionInformation);
    }
    if (this.dccDisclaimer != undefined) {
        this.xmlAddChild(node, "sixml:DccDisclaimer", this.dccDisclaimer);
    }
    if (this.disclaimer != undefined) {
        this.xmlAddChild(node, "sixml:Disclaimer", this.disclaimer);
    }
    if (this.cardData != undefined) {
        this.xmlAddChild(node, "sixml:CardData", this.cardData);
    }
    if (this.printData != undefined) {
        this.xmlAddChild(node, "sixml:PrintData", this.printData);
    }
    return node;
};
timapi.protocol.sixml.Response_ApplicationInformation = function (a) {
    if (arguments.length == 1 && a instanceof timapi.protocol.sixml.Response_ApplicationInformation) {
        var value = a;
        this.functionGroup = value.functionGroup;
        this.function = value.function;
        this.sequenceNumber = value.sequenceNumber;
        this.resultCode = value.resultCode;
        this.timeStamp = value.timeStamp;
        this.brandList = value.brandList ? new timapi.protocol.sixml.BrandList(value.brandList) : undefined;
        return;
    }
    if (arguments.length == 1 && a instanceof timapi.protocol.XmlNode) {
        var node = a;
        if (this.xmlHasAttribute(node, "FunctionGroup")) {
            this.functionGroup = this.xmlGetAttribute(node, "FunctionGroup");
        }
        if (this.xmlHasAttribute(node, "Function")) {
            this.function = this.xmlGetAttribute(node, "Function");
        }
        if (this.xmlHasAttribute(node, "SequenceNumber")) {
            this.sequenceNumber = (this.xmlGetAttribute(node, "SequenceNumber") ? parseInt(this.xmlGetAttribute(node, "SequenceNumber")) : 0);
        }
        if (this.xmlHasAttribute(node, "ResultCode")) {
            this.resultCode = (this.xmlGetAttribute(node, "ResultCode") ? parseInt(this.xmlGetAttribute(node, "ResultCode")) : 0);
        }
        if (this.xmlHasAttribute(node, "TimeStamp")) {
            this.timeStamp = new timapi.protocol.TimeDate("yyyyMMdd'T'HHmmssZ", this.xmlGetAttribute(node, "TimeStamp"));
        }
        if (this.xmlHasChild(node, "sixml:BrandList")) {
            this.brandList = new timapi.protocol.sixml.BrandList(this.xmlGetChild(node, "sixml:BrandList"));
        }
        return;
    }
    if (arguments.length == 0) {
        this.functionGroup = "Status";
        this.function = "ApplicationInformation";
        return;
    }
    throw new Error("Invalid argument");
};
timapi.protocol.sixml.Response_ApplicationInformation.prototype = Object.create(timapi.protocol.Message.prototype);
timapi.protocol.sixml.Response_ApplicationInformation.prototype.functionGroup = undefined;
timapi.protocol.sixml.Response_ApplicationInformation.prototype.function = undefined;
timapi.protocol.sixml.Response_ApplicationInformation.prototype.sequenceNumber = undefined;
timapi.protocol.sixml.Response_ApplicationInformation.prototype.resultCode = undefined;
timapi.protocol.sixml.Response_ApplicationInformation.prototype.timeStamp = undefined;
timapi.protocol.sixml.Response_ApplicationInformation.prototype.brandList = undefined;
timapi.protocol.sixml.Response_ApplicationInformation.prototype.toXmlNode = function () {
    var node = new timapi.protocol.XmlNode("sixml:Response");
    this.xmlSetAttribute(node, "xmlns:sixml", "http://www.six-payment-services.com/");
    if (this.functionGroup != undefined) {
        this.xmlSetAttribute(node, "FunctionGroup", this.functionGroup);
    }
    if (this.function != undefined) {
        this.xmlSetAttribute(node, "Function", this.function);
    }
    if (this.sequenceNumber != undefined) {
        this.xmlSetAttribute(node, "SequenceNumber", timapi.utils.StringHelper.makeString(this.sequenceNumber));
    }
    if (this.resultCode != undefined) {
        this.xmlSetAttribute(node, "ResultCode", timapi.utils.StringHelper.makeString(this.resultCode));
    }
    if (this.timeStamp != undefined) {
        this.xmlSetAttribute(node, "TimeStamp", this.timeStamp.format("yyyyMMdd'T'HHmmssZ"));
    }
    if (this.brandList != undefined) {
        this.xmlAddChild(node, "sixml:BrandList", this.brandList);
    }
    return node;
};
timapi.protocol.sixml.Response_AuthorizeCredit = function (a) {
    if (arguments.length == 1 && a instanceof timapi.protocol.sixml.Response_AuthorizeCredit) {
        var value = a;
        this.functionGroup = value.functionGroup;
        this.function = value.function;
        this.sequenceNumber = value.sequenceNumber;
        this.resultCode = value.resultCode;
        this.timeStamp = value.timeStamp;
        this.amount = value.amount ? new timapi.protocol.sixml.Amount(value.amount) : undefined;
        this.amountSaldo = value.amountSaldo ? new timapi.protocol.sixml.AmountSaldo(value.amountSaldo) : undefined;
        this.disclaimer = value.disclaimer;
        this.printData = value.printData ? new timapi.protocol.sixml.PrintData(value.printData) : undefined;
        this.transactionInformation = value.transactionInformation ? new timapi.protocol.sixml.TransactionInformation(value.transactionInformation) : undefined;
        this.cardData = value.cardData ? new timapi.protocol.sixml.CardData(value.cardData) : undefined;
        return;
    }
    if (arguments.length == 1 && a instanceof timapi.protocol.XmlNode) {
        var node = a;
        if (this.xmlHasAttribute(node, "FunctionGroup")) {
            this.functionGroup = this.xmlGetAttribute(node, "FunctionGroup");
        }
        if (this.xmlHasAttribute(node, "Function")) {
            this.function = this.xmlGetAttribute(node, "Function");
        }
        if (this.xmlHasAttribute(node, "SequenceNumber")) {
            this.sequenceNumber = (this.xmlGetAttribute(node, "SequenceNumber") ? parseInt(this.xmlGetAttribute(node, "SequenceNumber")) : 0);
        }
        if (this.xmlHasAttribute(node, "ResultCode")) {
            this.resultCode = (this.xmlGetAttribute(node, "ResultCode") ? parseInt(this.xmlGetAttribute(node, "ResultCode")) : 0);
        }
        if (this.xmlHasAttribute(node, "TimeStamp")) {
            this.timeStamp = new timapi.protocol.TimeDate("yyyyMMdd'T'HHmmssZ", this.xmlGetAttribute(node, "TimeStamp"));
        }
        if (this.xmlHasChild(node, "sixml:Amount")) {
            this.amount = new timapi.protocol.sixml.Amount(this.xmlGetChild(node, "sixml:Amount"));
        }
        if (this.xmlHasChild(node, "sixml:AmountSaldo")) {
            this.amountSaldo = new timapi.protocol.sixml.AmountSaldo(this.xmlGetChild(node, "sixml:AmountSaldo"));
        }
        if (this.xmlHasChild(node, "sixml:Disclaimer")) {
            this.disclaimer = this.xmlGetChild(node, "sixml:Disclaimer").textContent;
        }
        if (this.xmlHasChild(node, "sixml:PrintData")) {
            this.printData = new timapi.protocol.sixml.PrintData(this.xmlGetChild(node, "sixml:PrintData"));
        }
        if (this.xmlHasChild(node, "sixml:TransactionInformation")) {
            this.transactionInformation = new timapi.protocol.sixml.TransactionInformation(this.xmlGetChild(node, "sixml:TransactionInformation"));
        }
        if (this.xmlHasChild(node, "sixml:CardData")) {
            this.cardData = new timapi.protocol.sixml.CardData(this.xmlGetChild(node, "sixml:CardData"));
        }
        return;
    }
    if (arguments.length == 0) {
        this.functionGroup = "FinTransaction";
        this.function = "AuthorizeCredit";
        return;
    }
    throw new Error("Invalid argument");
};
timapi.protocol.sixml.Response_AuthorizeCredit.prototype = Object.create(timapi.protocol.Message.prototype);
timapi.protocol.sixml.Response_AuthorizeCredit.prototype.functionGroup = undefined;
timapi.protocol.sixml.Response_AuthorizeCredit.prototype.function = undefined;
timapi.protocol.sixml.Response_AuthorizeCredit.prototype.sequenceNumber = undefined;
timapi.protocol.sixml.Response_AuthorizeCredit.prototype.resultCode = undefined;
timapi.protocol.sixml.Response_AuthorizeCredit.prototype.timeStamp = undefined;
timapi.protocol.sixml.Response_AuthorizeCredit.prototype.amount = undefined;
timapi.protocol.sixml.Response_AuthorizeCredit.prototype.amountSaldo = undefined;
timapi.protocol.sixml.Response_AuthorizeCredit.prototype.disclaimer = undefined;
timapi.protocol.sixml.Response_AuthorizeCredit.prototype.printData = undefined;
timapi.protocol.sixml.Response_AuthorizeCredit.prototype.transactionInformation = undefined;
timapi.protocol.sixml.Response_AuthorizeCredit.prototype.cardData = undefined;
timapi.protocol.sixml.Response_AuthorizeCredit.prototype.toXmlNode = function () {
    var node = new timapi.protocol.XmlNode("sixml:Response");
    this.xmlSetAttribute(node, "xmlns:sixml", "http://www.six-payment-services.com/");
    if (this.functionGroup != undefined) {
        this.xmlSetAttribute(node, "FunctionGroup", this.functionGroup);
    }
    if (this.function != undefined) {
        this.xmlSetAttribute(node, "Function", this.function);
    }
    if (this.sequenceNumber != undefined) {
        this.xmlSetAttribute(node, "SequenceNumber", timapi.utils.StringHelper.makeString(this.sequenceNumber));
    }
    if (this.resultCode != undefined) {
        this.xmlSetAttribute(node, "ResultCode", timapi.utils.StringHelper.makeString(this.resultCode));
    }
    if (this.timeStamp != undefined) {
        this.xmlSetAttribute(node, "TimeStamp", this.timeStamp.format("yyyyMMdd'T'HHmmssZ"));
    }
    if (this.amount != undefined) {
        this.xmlAddChild(node, "sixml:Amount", this.amount);
    }
    if (this.amountSaldo != undefined) {
        this.xmlAddChild(node, "sixml:AmountSaldo", this.amountSaldo);
    }
    if (this.disclaimer != undefined) {
        this.xmlAddChild(node, "sixml:Disclaimer", this.disclaimer);
    }
    if (this.printData != undefined) {
        this.xmlAddChild(node, "sixml:PrintData", this.printData);
    }
    if (this.transactionInformation != undefined) {
        this.xmlAddChild(node, "sixml:TransactionInformation", this.transactionInformation);
    }
    if (this.cardData != undefined) {
        this.xmlAddChild(node, "sixml:CardData", this.cardData);
    }
    return node;
};
timapi.protocol.sixml.Response_AuthorizeDeposit = function (a) {
    if (arguments.length == 1 && a instanceof timapi.protocol.sixml.Response_AuthorizeDeposit) {
        var value = a;
        this.functionGroup = value.functionGroup;
        this.function = value.function;
        this.sequenceNumber = value.sequenceNumber;
        this.resultCode = value.resultCode;
        this.timeStamp = value.timeStamp;
        this.amount = value.amount ? new timapi.protocol.sixml.Amount(value.amount) : undefined;
        this.amountSaldo = value.amountSaldo ? new timapi.protocol.sixml.AmountSaldo(value.amountSaldo) : undefined;
        this.disclaimer = value.disclaimer;
        this.printData = value.printData ? new timapi.protocol.sixml.PrintData(value.printData) : undefined;
        this.transactionInformation = value.transactionInformation ? new timapi.protocol.sixml.TransactionInformation(value.transactionInformation) : undefined;
        this.cardData = value.cardData ? new timapi.protocol.sixml.CardData(value.cardData) : undefined;
        return;
    }
    if (arguments.length == 1 && a instanceof timapi.protocol.XmlNode) {
        var node = a;
        if (this.xmlHasAttribute(node, "FunctionGroup")) {
            this.functionGroup = this.xmlGetAttribute(node, "FunctionGroup");
        }
        if (this.xmlHasAttribute(node, "Function")) {
            this.function = this.xmlGetAttribute(node, "Function");
        }
        if (this.xmlHasAttribute(node, "SequenceNumber")) {
            this.sequenceNumber = (this.xmlGetAttribute(node, "SequenceNumber") ? parseInt(this.xmlGetAttribute(node, "SequenceNumber")) : 0);
        }
        if (this.xmlHasAttribute(node, "ResultCode")) {
            this.resultCode = (this.xmlGetAttribute(node, "ResultCode") ? parseInt(this.xmlGetAttribute(node, "ResultCode")) : 0);
        }
        if (this.xmlHasAttribute(node, "TimeStamp")) {
            this.timeStamp = new timapi.protocol.TimeDate("yyyyMMdd'T'HHmmssZ", this.xmlGetAttribute(node, "TimeStamp"));
        }
        if (this.xmlHasChild(node, "sixml:Amount")) {
            this.amount = new timapi.protocol.sixml.Amount(this.xmlGetChild(node, "sixml:Amount"));
        }
        if (this.xmlHasChild(node, "sixml:AmountSaldo")) {
            this.amountSaldo = new timapi.protocol.sixml.AmountSaldo(this.xmlGetChild(node, "sixml:AmountSaldo"));
        }
        if (this.xmlHasChild(node, "sixml:Disclaimer")) {
            this.disclaimer = this.xmlGetChild(node, "sixml:Disclaimer").textContent;
        }
        if (this.xmlHasChild(node, "sixml:PrintData")) {
            this.printData = new timapi.protocol.sixml.PrintData(this.xmlGetChild(node, "sixml:PrintData"));
        }
        if (this.xmlHasChild(node, "sixml:TransactionInformation")) {
            this.transactionInformation = new timapi.protocol.sixml.TransactionInformation(this.xmlGetChild(node, "sixml:TransactionInformation"));
        }
        if (this.xmlHasChild(node, "sixml:CardData")) {
            this.cardData = new timapi.protocol.sixml.CardData(this.xmlGetChild(node, "sixml:CardData"));
        }
        return;
    }
    if (arguments.length == 0) {
        this.functionGroup = "FinTransaction";
        this.function = "AuthorizeDeposit";
        return;
    }
    throw new Error("Invalid argument");
};
timapi.protocol.sixml.Response_AuthorizeDeposit.prototype = Object.create(timapi.protocol.Message.prototype);
timapi.protocol.sixml.Response_AuthorizeDeposit.prototype.functionGroup = undefined;
timapi.protocol.sixml.Response_AuthorizeDeposit.prototype.function = undefined;
timapi.protocol.sixml.Response_AuthorizeDeposit.prototype.sequenceNumber = undefined;
timapi.protocol.sixml.Response_AuthorizeDeposit.prototype.resultCode = undefined;
timapi.protocol.sixml.Response_AuthorizeDeposit.prototype.timeStamp = undefined;
timapi.protocol.sixml.Response_AuthorizeDeposit.prototype.amount = undefined;
timapi.protocol.sixml.Response_AuthorizeDeposit.prototype.amountSaldo = undefined;
timapi.protocol.sixml.Response_AuthorizeDeposit.prototype.disclaimer = undefined;
timapi.protocol.sixml.Response_AuthorizeDeposit.prototype.printData = undefined;
timapi.protocol.sixml.Response_AuthorizeDeposit.prototype.transactionInformation = undefined;
timapi.protocol.sixml.Response_AuthorizeDeposit.prototype.cardData = undefined;
timapi.protocol.sixml.Response_AuthorizeDeposit.prototype.toXmlNode = function () {
    var node = new timapi.protocol.XmlNode("sixml:Response");
    this.xmlSetAttribute(node, "xmlns:sixml", "http://www.six-payment-services.com/");
    if (this.functionGroup != undefined) {
        this.xmlSetAttribute(node, "FunctionGroup", this.functionGroup);
    }
    if (this.function != undefined) {
        this.xmlSetAttribute(node, "Function", this.function);
    }
    if (this.sequenceNumber != undefined) {
        this.xmlSetAttribute(node, "SequenceNumber", timapi.utils.StringHelper.makeString(this.sequenceNumber));
    }
    if (this.resultCode != undefined) {
        this.xmlSetAttribute(node, "ResultCode", timapi.utils.StringHelper.makeString(this.resultCode));
    }
    if (this.timeStamp != undefined) {
        this.xmlSetAttribute(node, "TimeStamp", this.timeStamp.format("yyyyMMdd'T'HHmmssZ"));
    }
    if (this.amount != undefined) {
        this.xmlAddChild(node, "sixml:Amount", this.amount);
    }
    if (this.amountSaldo != undefined) {
        this.xmlAddChild(node, "sixml:AmountSaldo", this.amountSaldo);
    }
    if (this.disclaimer != undefined) {
        this.xmlAddChild(node, "sixml:Disclaimer", this.disclaimer);
    }
    if (this.printData != undefined) {
        this.xmlAddChild(node, "sixml:PrintData", this.printData);
    }
    if (this.transactionInformation != undefined) {
        this.xmlAddChild(node, "sixml:TransactionInformation", this.transactionInformation);
    }
    if (this.cardData != undefined) {
        this.xmlAddChild(node, "sixml:CardData", this.cardData);
    }
    return node;
};
timapi.protocol.sixml.Response_Balance = function (a) {
    if (arguments.length == 1 && a instanceof timapi.protocol.sixml.Response_Balance) {
        var value = a;
        this.functionGroup = value.functionGroup;
        this.function = value.function;
        this.sequenceNumber = value.sequenceNumber;
        this.resultCode = value.resultCode;
        this.timeStamp = value.timeStamp;
        this.printData = value.printData ? new timapi.protocol.sixml.PrintData(value.printData) : undefined;
        this.counters = value.counters ? new timapi.protocol.sixml.Counters(value.counters) : undefined;
        return;
    }
    if (arguments.length == 1 && a instanceof timapi.protocol.XmlNode) {
        var node = a;
        if (this.xmlHasAttribute(node, "FunctionGroup")) {
            this.functionGroup = this.xmlGetAttribute(node, "FunctionGroup");
        }
        if (this.xmlHasAttribute(node, "Function")) {
            this.function = this.xmlGetAttribute(node, "Function");
        }
        if (this.xmlHasAttribute(node, "SequenceNumber")) {
            this.sequenceNumber = (this.xmlGetAttribute(node, "SequenceNumber") ? parseInt(this.xmlGetAttribute(node, "SequenceNumber")) : 0);
        }
        if (this.xmlHasAttribute(node, "ResultCode")) {
            this.resultCode = (this.xmlGetAttribute(node, "ResultCode") ? parseInt(this.xmlGetAttribute(node, "ResultCode")) : 0);
        }
        if (this.xmlHasAttribute(node, "TimeStamp")) {
            this.timeStamp = new timapi.protocol.TimeDate("yyyyMMdd'T'HHmmssZ", this.xmlGetAttribute(node, "TimeStamp"));
        }
        if (this.xmlHasChild(node, "sixml:PrintData")) {
            this.printData = new timapi.protocol.sixml.PrintData(this.xmlGetChild(node, "sixml:PrintData"));
        }
        if (this.xmlHasChild(node, "sixml:Counters")) {
            this.counters = new timapi.protocol.sixml.Counters(this.xmlGetChild(node, "sixml:Counters"));
        }
        return;
    }
    if (arguments.length == 0) {
        this.functionGroup = "Admin";
        this.function = "Balance";
        return;
    }
    throw new Error("Invalid argument");
};
timapi.protocol.sixml.Response_Balance.prototype = Object.create(timapi.protocol.Message.prototype);
timapi.protocol.sixml.Response_Balance.prototype.functionGroup = undefined;
timapi.protocol.sixml.Response_Balance.prototype.function = undefined;
timapi.protocol.sixml.Response_Balance.prototype.sequenceNumber = undefined;
timapi.protocol.sixml.Response_Balance.prototype.resultCode = undefined;
timapi.protocol.sixml.Response_Balance.prototype.timeStamp = undefined;
timapi.protocol.sixml.Response_Balance.prototype.printData = undefined;
timapi.protocol.sixml.Response_Balance.prototype.counters = undefined;
timapi.protocol.sixml.Response_Balance.prototype.toXmlNode = function () {
    var node = new timapi.protocol.XmlNode("sixml:Response");
    this.xmlSetAttribute(node, "xmlns:sixml", "http://www.six-payment-services.com/");
    if (this.functionGroup != undefined) {
        this.xmlSetAttribute(node, "FunctionGroup", this.functionGroup);
    }
    if (this.function != undefined) {
        this.xmlSetAttribute(node, "Function", this.function);
    }
    if (this.sequenceNumber != undefined) {
        this.xmlSetAttribute(node, "SequenceNumber", timapi.utils.StringHelper.makeString(this.sequenceNumber));
    }
    if (this.resultCode != undefined) {
        this.xmlSetAttribute(node, "ResultCode", timapi.utils.StringHelper.makeString(this.resultCode));
    }
    if (this.timeStamp != undefined) {
        this.xmlSetAttribute(node, "TimeStamp", this.timeStamp.format("yyyyMMdd'T'HHmmssZ"));
    }
    if (this.printData != undefined) {
        this.xmlAddChild(node, "sixml:PrintData", this.printData);
    }
    if (this.counters != undefined) {
        this.xmlAddChild(node, "sixml:Counters", this.counters);
    }
    return node;
};
timapi.protocol.sixml.Response_BalanceInquiry = function (a) {
    if (arguments.length == 1 && a instanceof timapi.protocol.sixml.Response_BalanceInquiry) {
        var value = a;
        this.functionGroup = value.functionGroup;
        this.function = value.function;
        this.sequenceNumber = value.sequenceNumber;
        this.resultCode = value.resultCode;
        this.timeStamp = value.timeStamp;
        this.amountSaldo = value.amountSaldo ? new timapi.protocol.sixml.AmountSaldo(value.amountSaldo) : undefined;
        this.transactionInformation = value.transactionInformation ? new timapi.protocol.sixml.TransactionInformation(value.transactionInformation) : undefined;
        this.disclaimer = value.disclaimer;
        this.printData = value.printData ? new timapi.protocol.sixml.PrintData(value.printData) : undefined;
        this.cardData = value.cardData ? new timapi.protocol.sixml.CardData(value.cardData) : undefined;
        return;
    }
    if (arguments.length == 1 && a instanceof timapi.protocol.XmlNode) {
        var node = a;
        if (this.xmlHasAttribute(node, "FunctionGroup")) {
            this.functionGroup = this.xmlGetAttribute(node, "FunctionGroup");
        }
        if (this.xmlHasAttribute(node, "Function")) {
            this.function = this.xmlGetAttribute(node, "Function");
        }
        if (this.xmlHasAttribute(node, "SequenceNumber")) {
            this.sequenceNumber = (this.xmlGetAttribute(node, "SequenceNumber") ? parseInt(this.xmlGetAttribute(node, "SequenceNumber")) : 0);
        }
        if (this.xmlHasAttribute(node, "ResultCode")) {
            this.resultCode = (this.xmlGetAttribute(node, "ResultCode") ? parseInt(this.xmlGetAttribute(node, "ResultCode")) : 0);
        }
        if (this.xmlHasAttribute(node, "TimeStamp")) {
            this.timeStamp = new timapi.protocol.TimeDate("yyyyMMdd'T'HHmmssZ", this.xmlGetAttribute(node, "TimeStamp"));
        }
        if (this.xmlHasChild(node, "sixml:AmountSaldo")) {
            this.amountSaldo = new timapi.protocol.sixml.AmountSaldo(this.xmlGetChild(node, "sixml:AmountSaldo"));
        }
        if (this.xmlHasChild(node, "sixml:TransactionInformation")) {
            this.transactionInformation = new timapi.protocol.sixml.TransactionInformation(this.xmlGetChild(node, "sixml:TransactionInformation"));
        }
        if (this.xmlHasChild(node, "sixml:Disclaimer")) {
            this.disclaimer = this.xmlGetChild(node, "sixml:Disclaimer").textContent;
        }
        if (this.xmlHasChild(node, "sixml:PrintData")) {
            this.printData = new timapi.protocol.sixml.PrintData(this.xmlGetChild(node, "sixml:PrintData"));
        }
        if (this.xmlHasChild(node, "sixml:CardData")) {
            this.cardData = new timapi.protocol.sixml.CardData(this.xmlGetChild(node, "sixml:CardData"));
        }
        return;
    }
    if (arguments.length == 0) {
        this.functionGroup = "NonFinTransaction";
        this.function = "BalanceInquiry";
        return;
    }
    throw new Error("Invalid argument");
};
timapi.protocol.sixml.Response_BalanceInquiry.prototype = Object.create(timapi.protocol.Message.prototype);
timapi.protocol.sixml.Response_BalanceInquiry.prototype.functionGroup = undefined;
timapi.protocol.sixml.Response_BalanceInquiry.prototype.function = undefined;
timapi.protocol.sixml.Response_BalanceInquiry.prototype.sequenceNumber = undefined;
timapi.protocol.sixml.Response_BalanceInquiry.prototype.resultCode = undefined;
timapi.protocol.sixml.Response_BalanceInquiry.prototype.timeStamp = undefined;
timapi.protocol.sixml.Response_BalanceInquiry.prototype.amountSaldo = undefined;
timapi.protocol.sixml.Response_BalanceInquiry.prototype.transactionInformation = undefined;
timapi.protocol.sixml.Response_BalanceInquiry.prototype.disclaimer = undefined;
timapi.protocol.sixml.Response_BalanceInquiry.prototype.printData = undefined;
timapi.protocol.sixml.Response_BalanceInquiry.prototype.cardData = undefined;
timapi.protocol.sixml.Response_BalanceInquiry.prototype.toXmlNode = function () {
    var node = new timapi.protocol.XmlNode("sixml:Response");
    this.xmlSetAttribute(node, "xmlns:sixml", "http://www.six-payment-services.com/");
    if (this.functionGroup != undefined) {
        this.xmlSetAttribute(node, "FunctionGroup", this.functionGroup);
    }
    if (this.function != undefined) {
        this.xmlSetAttribute(node, "Function", this.function);
    }
    if (this.sequenceNumber != undefined) {
        this.xmlSetAttribute(node, "SequenceNumber", timapi.utils.StringHelper.makeString(this.sequenceNumber));
    }
    if (this.resultCode != undefined) {
        this.xmlSetAttribute(node, "ResultCode", timapi.utils.StringHelper.makeString(this.resultCode));
    }
    if (this.timeStamp != undefined) {
        this.xmlSetAttribute(node, "TimeStamp", this.timeStamp.format("yyyyMMdd'T'HHmmssZ"));
    }
    if (this.amountSaldo != undefined) {
        this.xmlAddChild(node, "sixml:AmountSaldo", this.amountSaldo);
    }
    if (this.transactionInformation != undefined) {
        this.xmlAddChild(node, "sixml:TransactionInformation", this.transactionInformation);
    }
    if (this.disclaimer != undefined) {
        this.xmlAddChild(node, "sixml:Disclaimer", this.disclaimer);
    }
    if (this.printData != undefined) {
        this.xmlAddChild(node, "sixml:PrintData", this.printData);
    }
    if (this.cardData != undefined) {
        this.xmlAddChild(node, "sixml:CardData", this.cardData);
    }
    return node;
};
timapi.protocol.sixml.Response_CancelReservation = function (a) {
    if (arguments.length == 1 && a instanceof timapi.protocol.sixml.Response_CancelReservation) {
        var value = a;
        this.functionGroup = value.functionGroup;
        this.function = value.function;
        this.sequenceNumber = value.sequenceNumber;
        this.resultCode = value.resultCode;
        this.timeStamp = value.timeStamp;
        this.amount = value.amount ? new timapi.protocol.sixml.Amount(value.amount) : undefined;
        this.transactionInformation = value.transactionInformation ? new timapi.protocol.sixml.TransactionInformation(value.transactionInformation) : undefined;
        this.disclaimer = value.disclaimer;
        this.printData = value.printData ? new timapi.protocol.sixml.PrintData(value.printData) : undefined;
        return;
    }
    if (arguments.length == 1 && a instanceof timapi.protocol.XmlNode) {
        var node = a;
        if (this.xmlHasAttribute(node, "FunctionGroup")) {
            this.functionGroup = this.xmlGetAttribute(node, "FunctionGroup");
        }
        if (this.xmlHasAttribute(node, "Function")) {
            this.function = this.xmlGetAttribute(node, "Function");
        }
        if (this.xmlHasAttribute(node, "SequenceNumber")) {
            this.sequenceNumber = (this.xmlGetAttribute(node, "SequenceNumber") ? parseInt(this.xmlGetAttribute(node, "SequenceNumber")) : 0);
        }
        if (this.xmlHasAttribute(node, "ResultCode")) {
            this.resultCode = (this.xmlGetAttribute(node, "ResultCode") ? parseInt(this.xmlGetAttribute(node, "ResultCode")) : 0);
        }
        if (this.xmlHasAttribute(node, "TimeStamp")) {
            this.timeStamp = new timapi.protocol.TimeDate("yyyyMMdd'T'HHmmssZ", this.xmlGetAttribute(node, "TimeStamp"));
        }
        if (this.xmlHasChild(node, "sixml:Amount")) {
            this.amount = new timapi.protocol.sixml.Amount(this.xmlGetChild(node, "sixml:Amount"));
        }
        if (this.xmlHasChild(node, "sixml:TransactionInformation")) {
            this.transactionInformation = new timapi.protocol.sixml.TransactionInformation(this.xmlGetChild(node, "sixml:TransactionInformation"));
        }
        if (this.xmlHasChild(node, "sixml:Disclaimer")) {
            this.disclaimer = this.xmlGetChild(node, "sixml:Disclaimer").textContent;
        }
        if (this.xmlHasChild(node, "sixml:PrintData")) {
            this.printData = new timapi.protocol.sixml.PrintData(this.xmlGetChild(node, "sixml:PrintData"));
        }
        return;
    }
    if (arguments.length == 0) {
        this.functionGroup = "NonFinTransaction";
        this.function = "CancelReservation";
        return;
    }
    throw new Error("Invalid argument");
};
timapi.protocol.sixml.Response_CancelReservation.prototype = Object.create(timapi.protocol.Message.prototype);
timapi.protocol.sixml.Response_CancelReservation.prototype.functionGroup = undefined;
timapi.protocol.sixml.Response_CancelReservation.prototype.function = undefined;
timapi.protocol.sixml.Response_CancelReservation.prototype.sequenceNumber = undefined;
timapi.protocol.sixml.Response_CancelReservation.prototype.resultCode = undefined;
timapi.protocol.sixml.Response_CancelReservation.prototype.timeStamp = undefined;
timapi.protocol.sixml.Response_CancelReservation.prototype.amount = undefined;
timapi.protocol.sixml.Response_CancelReservation.prototype.transactionInformation = undefined;
timapi.protocol.sixml.Response_CancelReservation.prototype.disclaimer = undefined;
timapi.protocol.sixml.Response_CancelReservation.prototype.printData = undefined;
timapi.protocol.sixml.Response_CancelReservation.prototype.toXmlNode = function () {
    var node = new timapi.protocol.XmlNode("sixml:Response");
    this.xmlSetAttribute(node, "xmlns:sixml", "http://www.six-payment-services.com/");
    if (this.functionGroup != undefined) {
        this.xmlSetAttribute(node, "FunctionGroup", this.functionGroup);
    }
    if (this.function != undefined) {
        this.xmlSetAttribute(node, "Function", this.function);
    }
    if (this.sequenceNumber != undefined) {
        this.xmlSetAttribute(node, "SequenceNumber", timapi.utils.StringHelper.makeString(this.sequenceNumber));
    }
    if (this.resultCode != undefined) {
        this.xmlSetAttribute(node, "ResultCode", timapi.utils.StringHelper.makeString(this.resultCode));
    }
    if (this.timeStamp != undefined) {
        this.xmlSetAttribute(node, "TimeStamp", this.timeStamp.format("yyyyMMdd'T'HHmmssZ"));
    }
    if (this.amount != undefined) {
        this.xmlAddChild(node, "sixml:Amount", this.amount);
    }
    if (this.transactionInformation != undefined) {
        this.xmlAddChild(node, "sixml:TransactionInformation", this.transactionInformation);
    }
    if (this.disclaimer != undefined) {
        this.xmlAddChild(node, "sixml:Disclaimer", this.disclaimer);
    }
    if (this.printData != undefined) {
        this.xmlAddChild(node, "sixml:PrintData", this.printData);
    }
    return node;
};
timapi.protocol.sixml.Response_CashAdvance = function (a) {
    if (arguments.length == 1 && a instanceof timapi.protocol.sixml.Response_CashAdvance) {
        var value = a;
        this.functionGroup = value.functionGroup;
        this.function = value.function;
        this.sequenceNumber = value.sequenceNumber;
        this.resultCode = value.resultCode;
        this.timeStamp = value.timeStamp;
        this.transactionInformation = value.transactionInformation ? new timapi.protocol.sixml.TransactionInformation(value.transactionInformation) : undefined;
        this.amount = value.amount ? new timapi.protocol.sixml.Amount(value.amount) : undefined;
        this.amountDue = value.amountDue ? new timapi.protocol.sixml.AmountDue(value.amountDue) : undefined;
        this.amountDcc = value.amountDcc ? new timapi.protocol.sixml.AmountDcc(value.amountDcc) : undefined;
        this.amountSaldo = value.amountSaldo ? new timapi.protocol.sixml.AmountSaldo(value.amountSaldo) : undefined;
        this.dccDisclaimer = value.dccDisclaimer;
        this.disclaimer = value.disclaimer;
        this.cardData = value.cardData ? new timapi.protocol.sixml.CardData(value.cardData) : undefined;
        this.printData = value.printData ? new timapi.protocol.sixml.PrintData(value.printData) : undefined;
        return;
    }
    if (arguments.length == 1 && a instanceof timapi.protocol.XmlNode) {
        var node = a;
        if (this.xmlHasAttribute(node, "FunctionGroup")) {
            this.functionGroup = this.xmlGetAttribute(node, "FunctionGroup");
        }
        if (this.xmlHasAttribute(node, "Function")) {
            this.function = this.xmlGetAttribute(node, "Function");
        }
        if (this.xmlHasAttribute(node, "SequenceNumber")) {
            this.sequenceNumber = (this.xmlGetAttribute(node, "SequenceNumber") ? parseInt(this.xmlGetAttribute(node, "SequenceNumber")) : 0);
        }
        if (this.xmlHasAttribute(node, "ResultCode")) {
            this.resultCode = (this.xmlGetAttribute(node, "ResultCode") ? parseInt(this.xmlGetAttribute(node, "ResultCode")) : 0);
        }
        if (this.xmlHasAttribute(node, "TimeStamp")) {
            this.timeStamp = new timapi.protocol.TimeDate("yyyyMMdd'T'HHmmssZ", this.xmlGetAttribute(node, "TimeStamp"));
        }
        if (this.xmlHasChild(node, "sixml:TransactionInformation")) {
            this.transactionInformation = new timapi.protocol.sixml.TransactionInformation(this.xmlGetChild(node, "sixml:TransactionInformation"));
        }
        if (this.xmlHasChild(node, "sixml:Amount")) {
            this.amount = new timapi.protocol.sixml.Amount(this.xmlGetChild(node, "sixml:Amount"));
        }
        if (this.xmlHasChild(node, "sixml:AmountDue")) {
            this.amountDue = new timapi.protocol.sixml.AmountDue(this.xmlGetChild(node, "sixml:AmountDue"));
        }
        if (this.xmlHasChild(node, "sixml:AmountDcc")) {
            this.amountDcc = new timapi.protocol.sixml.AmountDcc(this.xmlGetChild(node, "sixml:AmountDcc"));
        }
        if (this.xmlHasChild(node, "sixml:AmountSaldo")) {
            this.amountSaldo = new timapi.protocol.sixml.AmountSaldo(this.xmlGetChild(node, "sixml:AmountSaldo"));
        }
        if (this.xmlHasChild(node, "sixml:DccDisclaimer")) {
            this.dccDisclaimer = this.xmlGetChild(node, "sixml:DccDisclaimer").textContent;
        }
        if (this.xmlHasChild(node, "sixml:Disclaimer")) {
            this.disclaimer = this.xmlGetChild(node, "sixml:Disclaimer").textContent;
        }
        if (this.xmlHasChild(node, "sixml:CardData")) {
            this.cardData = new timapi.protocol.sixml.CardData(this.xmlGetChild(node, "sixml:CardData"));
        }
        if (this.xmlHasChild(node, "sixml:PrintData")) {
            this.printData = new timapi.protocol.sixml.PrintData(this.xmlGetChild(node, "sixml:PrintData"));
        }
        return;
    }
    if (arguments.length == 0) {
        this.functionGroup = "FinTransaction";
        this.function = "CashAdvance";
        return;
    }
    throw new Error("Invalid argument");
};
timapi.protocol.sixml.Response_CashAdvance.prototype = Object.create(timapi.protocol.Message.prototype);
timapi.protocol.sixml.Response_CashAdvance.prototype.functionGroup = undefined;
timapi.protocol.sixml.Response_CashAdvance.prototype.function = undefined;
timapi.protocol.sixml.Response_CashAdvance.prototype.sequenceNumber = undefined;
timapi.protocol.sixml.Response_CashAdvance.prototype.resultCode = undefined;
timapi.protocol.sixml.Response_CashAdvance.prototype.timeStamp = undefined;
timapi.protocol.sixml.Response_CashAdvance.prototype.transactionInformation = undefined;
timapi.protocol.sixml.Response_CashAdvance.prototype.amount = undefined;
timapi.protocol.sixml.Response_CashAdvance.prototype.amountDue = undefined;
timapi.protocol.sixml.Response_CashAdvance.prototype.amountDcc = undefined;
timapi.protocol.sixml.Response_CashAdvance.prototype.amountSaldo = undefined;
timapi.protocol.sixml.Response_CashAdvance.prototype.dccDisclaimer = undefined;
timapi.protocol.sixml.Response_CashAdvance.prototype.disclaimer = undefined;
timapi.protocol.sixml.Response_CashAdvance.prototype.cardData = undefined;
timapi.protocol.sixml.Response_CashAdvance.prototype.printData = undefined;
timapi.protocol.sixml.Response_CashAdvance.prototype.toXmlNode = function () {
    var node = new timapi.protocol.XmlNode("sixml:Response");
    this.xmlSetAttribute(node, "xmlns:sixml", "http://www.six-payment-services.com/");
    if (this.functionGroup != undefined) {
        this.xmlSetAttribute(node, "FunctionGroup", this.functionGroup);
    }
    if (this.function != undefined) {
        this.xmlSetAttribute(node, "Function", this.function);
    }
    if (this.sequenceNumber != undefined) {
        this.xmlSetAttribute(node, "SequenceNumber", timapi.utils.StringHelper.makeString(this.sequenceNumber));
    }
    if (this.resultCode != undefined) {
        this.xmlSetAttribute(node, "ResultCode", timapi.utils.StringHelper.makeString(this.resultCode));
    }
    if (this.timeStamp != undefined) {
        this.xmlSetAttribute(node, "TimeStamp", this.timeStamp.format("yyyyMMdd'T'HHmmssZ"));
    }
    if (this.transactionInformation != undefined) {
        this.xmlAddChild(node, "sixml:TransactionInformation", this.transactionInformation);
    }
    if (this.amount != undefined) {
        this.xmlAddChild(node, "sixml:Amount", this.amount);
    }
    if (this.amountDue != undefined) {
        this.xmlAddChild(node, "sixml:AmountDue", this.amountDue);
    }
    if (this.amountDcc != undefined) {
        this.xmlAddChild(node, "sixml:AmountDcc", this.amountDcc);
    }
    if (this.amountSaldo != undefined) {
        this.xmlAddChild(node, "sixml:AmountSaldo", this.amountSaldo);
    }
    if (this.dccDisclaimer != undefined) {
        this.xmlAddChild(node, "sixml:DccDisclaimer", this.dccDisclaimer);
    }
    if (this.disclaimer != undefined) {
        this.xmlAddChild(node, "sixml:Disclaimer", this.disclaimer);
    }
    if (this.cardData != undefined) {
        this.xmlAddChild(node, "sixml:CardData", this.cardData);
    }
    if (this.printData != undefined) {
        this.xmlAddChild(node, "sixml:PrintData", this.printData);
    }
    return node;
};
timapi.protocol.sixml.Response_ChangeSettings = function (a) {
    if (arguments.length == 1 && a instanceof timapi.protocol.sixml.Response_ChangeSettings) {
        var value = a;
        this.functionGroup = value.functionGroup;
        this.function = value.function;
        this.sequenceNumber = value.sequenceNumber;
        this.resultCode = value.resultCode;
        this.timeStamp = value.timeStamp;
        return;
    }
    if (arguments.length == 1 && a instanceof timapi.protocol.XmlNode) {
        var node = a;
        if (this.xmlHasAttribute(node, "FunctionGroup")) {
            this.functionGroup = this.xmlGetAttribute(node, "FunctionGroup");
        }
        if (this.xmlHasAttribute(node, "Function")) {
            this.function = this.xmlGetAttribute(node, "Function");
        }
        if (this.xmlHasAttribute(node, "SequenceNumber")) {
            this.sequenceNumber = (this.xmlGetAttribute(node, "SequenceNumber") ? parseInt(this.xmlGetAttribute(node, "SequenceNumber")) : 0);
        }
        if (this.xmlHasAttribute(node, "ResultCode")) {
            this.resultCode = (this.xmlGetAttribute(node, "ResultCode") ? parseInt(this.xmlGetAttribute(node, "ResultCode")) : 0);
        }
        if (this.xmlHasAttribute(node, "TimeStamp")) {
            this.timeStamp = new timapi.protocol.TimeDate("yyyyMMdd'T'HHmmssZ", this.xmlGetAttribute(node, "TimeStamp"));
        }
        return;
    }
    if (arguments.length == 0) {
        this.functionGroup = "Admin";
        this.function = "ChangeSettings";
        return;
    }
    throw new Error("Invalid argument");
};
timapi.protocol.sixml.Response_ChangeSettings.prototype = Object.create(timapi.protocol.Message.prototype);
timapi.protocol.sixml.Response_ChangeSettings.prototype.functionGroup = undefined;
timapi.protocol.sixml.Response_ChangeSettings.prototype.function = undefined;
timapi.protocol.sixml.Response_ChangeSettings.prototype.sequenceNumber = undefined;
timapi.protocol.sixml.Response_ChangeSettings.prototype.resultCode = undefined;
timapi.protocol.sixml.Response_ChangeSettings.prototype.timeStamp = undefined;
timapi.protocol.sixml.Response_ChangeSettings.prototype.toXmlNode = function () {
    var node = new timapi.protocol.XmlNode("sixml:Response");
    this.xmlSetAttribute(node, "xmlns:sixml", "http://www.six-payment-services.com/");
    if (this.functionGroup != undefined) {
        this.xmlSetAttribute(node, "FunctionGroup", this.functionGroup);
    }
    if (this.function != undefined) {
        this.xmlSetAttribute(node, "Function", this.function);
    }
    if (this.sequenceNumber != undefined) {
        this.xmlSetAttribute(node, "SequenceNumber", timapi.utils.StringHelper.makeString(this.sequenceNumber));
    }
    if (this.resultCode != undefined) {
        this.xmlSetAttribute(node, "ResultCode", timapi.utils.StringHelper.makeString(this.resultCode));
    }
    if (this.timeStamp != undefined) {
        this.xmlSetAttribute(node, "TimeStamp", this.timeStamp.format("yyyyMMdd'T'HHmmssZ"));
    }
    return node;
};
timapi.protocol.sixml.Response_CloseDialogMode = function (a) {
    if (arguments.length == 1 && a instanceof timapi.protocol.sixml.Response_CloseDialogMode) {
        var value = a;
        this.functionGroup = value.functionGroup;
        this.function = value.function;
        this.sequenceNumber = value.sequenceNumber;
        this.resultCode = value.resultCode;
        this.timeStamp = value.timeStamp;
        return;
    }
    if (arguments.length == 1 && a instanceof timapi.protocol.XmlNode) {
        var node = a;
        if (this.xmlHasAttribute(node, "FunctionGroup")) {
            this.functionGroup = this.xmlGetAttribute(node, "FunctionGroup");
        }
        if (this.xmlHasAttribute(node, "Function")) {
            this.function = this.xmlGetAttribute(node, "Function");
        }
        if (this.xmlHasAttribute(node, "SequenceNumber")) {
            this.sequenceNumber = (this.xmlGetAttribute(node, "SequenceNumber") ? parseInt(this.xmlGetAttribute(node, "SequenceNumber")) : 0);
        }
        if (this.xmlHasAttribute(node, "ResultCode")) {
            this.resultCode = (this.xmlGetAttribute(node, "ResultCode") ? parseInt(this.xmlGetAttribute(node, "ResultCode")) : 0);
        }
        if (this.xmlHasAttribute(node, "TimeStamp")) {
            this.timeStamp = new timapi.protocol.TimeDate("yyyyMMdd'T'HHmmssZ", this.xmlGetAttribute(node, "TimeStamp"));
        }
        return;
    }
    if (arguments.length == 0) {
        this.functionGroup = "Admin";
        this.function = "CloseDialogMode";
        return;
    }
    throw new Error("Invalid argument");
};
timapi.protocol.sixml.Response_CloseDialogMode.prototype = Object.create(timapi.protocol.Message.prototype);
timapi.protocol.sixml.Response_CloseDialogMode.prototype.functionGroup = undefined;
timapi.protocol.sixml.Response_CloseDialogMode.prototype.function = undefined;
timapi.protocol.sixml.Response_CloseDialogMode.prototype.sequenceNumber = undefined;
timapi.protocol.sixml.Response_CloseDialogMode.prototype.resultCode = undefined;
timapi.protocol.sixml.Response_CloseDialogMode.prototype.timeStamp = undefined;
timapi.protocol.sixml.Response_CloseDialogMode.prototype.toXmlNode = function () {
    var node = new timapi.protocol.XmlNode("sixml:Response");
    this.xmlSetAttribute(node, "xmlns:sixml", "http://www.six-payment-services.com/");
    if (this.functionGroup != undefined) {
        this.xmlSetAttribute(node, "FunctionGroup", this.functionGroup);
    }
    if (this.function != undefined) {
        this.xmlSetAttribute(node, "Function", this.function);
    }
    if (this.sequenceNumber != undefined) {
        this.xmlSetAttribute(node, "SequenceNumber", timapi.utils.StringHelper.makeString(this.sequenceNumber));
    }
    if (this.resultCode != undefined) {
        this.xmlSetAttribute(node, "ResultCode", timapi.utils.StringHelper.makeString(this.resultCode));
    }
    if (this.timeStamp != undefined) {
        this.xmlSetAttribute(node, "TimeStamp", this.timeStamp.format("yyyyMMdd'T'HHmmssZ"));
    }
    return node;
};
timapi.protocol.sixml.Response_CloseMaintenanceWindow = function (a) {
    if (arguments.length == 1 && a instanceof timapi.protocol.sixml.Response_CloseMaintenanceWindow) {
        var value = a;
        this.functionGroup = value.functionGroup;
        this.function = value.function;
        this.sequenceNumber = value.sequenceNumber;
        this.resultCode = value.resultCode;
        this.timeStamp = value.timeStamp;
        return;
    }
    if (arguments.length == 1 && a instanceof timapi.protocol.XmlNode) {
        var node = a;
        if (this.xmlHasAttribute(node, "FunctionGroup")) {
            this.functionGroup = this.xmlGetAttribute(node, "FunctionGroup");
        }
        if (this.xmlHasAttribute(node, "Function")) {
            this.function = this.xmlGetAttribute(node, "Function");
        }
        if (this.xmlHasAttribute(node, "SequenceNumber")) {
            this.sequenceNumber = (this.xmlGetAttribute(node, "SequenceNumber") ? parseInt(this.xmlGetAttribute(node, "SequenceNumber")) : 0);
        }
        if (this.xmlHasAttribute(node, "ResultCode")) {
            this.resultCode = (this.xmlGetAttribute(node, "ResultCode") ? parseInt(this.xmlGetAttribute(node, "ResultCode")) : 0);
        }
        if (this.xmlHasAttribute(node, "TimeStamp")) {
            this.timeStamp = new timapi.protocol.TimeDate("yyyyMMdd'T'HHmmssZ", this.xmlGetAttribute(node, "TimeStamp"));
        }
        return;
    }
    if (arguments.length == 0) {
        this.functionGroup = "Admin";
        this.function = "CloseMaintenanceWindow";
        return;
    }
    throw new Error("Invalid argument");
};
timapi.protocol.sixml.Response_CloseMaintenanceWindow.prototype = Object.create(timapi.protocol.Message.prototype);
timapi.protocol.sixml.Response_CloseMaintenanceWindow.prototype.functionGroup = undefined;
timapi.protocol.sixml.Response_CloseMaintenanceWindow.prototype.function = undefined;
timapi.protocol.sixml.Response_CloseMaintenanceWindow.prototype.sequenceNumber = undefined;
timapi.protocol.sixml.Response_CloseMaintenanceWindow.prototype.resultCode = undefined;
timapi.protocol.sixml.Response_CloseMaintenanceWindow.prototype.timeStamp = undefined;
timapi.protocol.sixml.Response_CloseMaintenanceWindow.prototype.toXmlNode = function () {
    var node = new timapi.protocol.XmlNode("sixml:Response");
    this.xmlSetAttribute(node, "xmlns:sixml", "http://www.six-payment-services.com/");
    if (this.functionGroup != undefined) {
        this.xmlSetAttribute(node, "FunctionGroup", this.functionGroup);
    }
    if (this.function != undefined) {
        this.xmlSetAttribute(node, "Function", this.function);
    }
    if (this.sequenceNumber != undefined) {
        this.xmlSetAttribute(node, "SequenceNumber", timapi.utils.StringHelper.makeString(this.sequenceNumber));
    }
    if (this.resultCode != undefined) {
        this.xmlSetAttribute(node, "ResultCode", timapi.utils.StringHelper.makeString(this.resultCode));
    }
    if (this.timeStamp != undefined) {
        this.xmlSetAttribute(node, "TimeStamp", this.timeStamp.format("yyyyMMdd'T'HHmmssZ"));
    }
    return node;
};
timapi.protocol.sixml.Response_CloseReader = function (a) {
    if (arguments.length == 1 && a instanceof timapi.protocol.sixml.Response_CloseReader) {
        var value = a;
        this.functionGroup = value.functionGroup;
        this.function = value.function;
        this.sequenceNumber = value.sequenceNumber;
        this.resultCode = value.resultCode;
        this.timeStamp = value.timeStamp;
        return;
    }
    if (arguments.length == 1 && a instanceof timapi.protocol.XmlNode) {
        var node = a;
        if (this.xmlHasAttribute(node, "FunctionGroup")) {
            this.functionGroup = this.xmlGetAttribute(node, "FunctionGroup");
        }
        if (this.xmlHasAttribute(node, "Function")) {
            this.function = this.xmlGetAttribute(node, "Function");
        }
        if (this.xmlHasAttribute(node, "SequenceNumber")) {
            this.sequenceNumber = (this.xmlGetAttribute(node, "SequenceNumber") ? parseInt(this.xmlGetAttribute(node, "SequenceNumber")) : 0);
        }
        if (this.xmlHasAttribute(node, "ResultCode")) {
            this.resultCode = (this.xmlGetAttribute(node, "ResultCode") ? parseInt(this.xmlGetAttribute(node, "ResultCode")) : 0);
        }
        if (this.xmlHasAttribute(node, "TimeStamp")) {
            this.timeStamp = new timapi.protocol.TimeDate("yyyyMMdd'T'HHmmssZ", this.xmlGetAttribute(node, "TimeStamp"));
        }
        return;
    }
    if (arguments.length == 0) {
        this.functionGroup = "Admin";
        this.function = "CloseReader";
        return;
    }
    throw new Error("Invalid argument");
};
timapi.protocol.sixml.Response_CloseReader.prototype = Object.create(timapi.protocol.Message.prototype);
timapi.protocol.sixml.Response_CloseReader.prototype.functionGroup = undefined;
timapi.protocol.sixml.Response_CloseReader.prototype.function = undefined;
timapi.protocol.sixml.Response_CloseReader.prototype.sequenceNumber = undefined;
timapi.protocol.sixml.Response_CloseReader.prototype.resultCode = undefined;
timapi.protocol.sixml.Response_CloseReader.prototype.timeStamp = undefined;
timapi.protocol.sixml.Response_CloseReader.prototype.toXmlNode = function () {
    var node = new timapi.protocol.XmlNode("sixml:Response");
    this.xmlSetAttribute(node, "xmlns:sixml", "http://www.six-payment-services.com/");
    if (this.functionGroup != undefined) {
        this.xmlSetAttribute(node, "FunctionGroup", this.functionGroup);
    }
    if (this.function != undefined) {
        this.xmlSetAttribute(node, "Function", this.function);
    }
    if (this.sequenceNumber != undefined) {
        this.xmlSetAttribute(node, "SequenceNumber", timapi.utils.StringHelper.makeString(this.sequenceNumber));
    }
    if (this.resultCode != undefined) {
        this.xmlSetAttribute(node, "ResultCode", timapi.utils.StringHelper.makeString(this.resultCode));
    }
    if (this.timeStamp != undefined) {
        this.xmlSetAttribute(node, "TimeStamp", this.timeStamp.format("yyyyMMdd'T'HHmmssZ"));
    }
    return node;
};
timapi.protocol.sixml.Response_CollectPoints = function (a) {
    if (arguments.length == 1 && a instanceof timapi.protocol.sixml.Response_CollectPoints) {
        var value = a;
        this.functionGroup = value.functionGroup;
        this.function = value.function;
        this.sequenceNumber = value.sequenceNumber;
        this.resultCode = value.resultCode;
        this.timeStamp = value.timeStamp;
        this.transactionInformation = value.transactionInformation ? new timapi.protocol.sixml.TransactionInformation(value.transactionInformation) : undefined;
        this.amount = value.amount ? new timapi.protocol.sixml.Amount(value.amount) : undefined;
        this.amountSaldo = value.amountSaldo ? new timapi.protocol.sixml.AmountSaldo(value.amountSaldo) : undefined;
        this.disclaimer = value.disclaimer;
        this.cardData = value.cardData ? new timapi.protocol.sixml.CardData(value.cardData) : undefined;
        this.printData = value.printData ? new timapi.protocol.sixml.PrintData(value.printData) : undefined;
        return;
    }
    if (arguments.length == 1 && a instanceof timapi.protocol.XmlNode) {
        var node = a;
        if (this.xmlHasAttribute(node, "FunctionGroup")) {
            this.functionGroup = this.xmlGetAttribute(node, "FunctionGroup");
        }
        if (this.xmlHasAttribute(node, "Function")) {
            this.function = this.xmlGetAttribute(node, "Function");
        }
        if (this.xmlHasAttribute(node, "SequenceNumber")) {
            this.sequenceNumber = (this.xmlGetAttribute(node, "SequenceNumber") ? parseInt(this.xmlGetAttribute(node, "SequenceNumber")) : 0);
        }
        if (this.xmlHasAttribute(node, "ResultCode")) {
            this.resultCode = (this.xmlGetAttribute(node, "ResultCode") ? parseInt(this.xmlGetAttribute(node, "ResultCode")) : 0);
        }
        if (this.xmlHasAttribute(node, "TimeStamp")) {
            this.timeStamp = new timapi.protocol.TimeDate("yyyyMMdd'T'HHmmssZ", this.xmlGetAttribute(node, "TimeStamp"));
        }
        if (this.xmlHasChild(node, "sixml:TransactionInformation")) {
            this.transactionInformation = new timapi.protocol.sixml.TransactionInformation(this.xmlGetChild(node, "sixml:TransactionInformation"));
        }
        if (this.xmlHasChild(node, "sixml:Amount")) {
            this.amount = new timapi.protocol.sixml.Amount(this.xmlGetChild(node, "sixml:Amount"));
        }
        if (this.xmlHasChild(node, "sixml:AmountSaldo")) {
            this.amountSaldo = new timapi.protocol.sixml.AmountSaldo(this.xmlGetChild(node, "sixml:AmountSaldo"));
        }
        if (this.xmlHasChild(node, "sixml:Disclaimer")) {
            this.disclaimer = this.xmlGetChild(node, "sixml:Disclaimer").textContent;
        }
        if (this.xmlHasChild(node, "sixml:CardData")) {
            this.cardData = new timapi.protocol.sixml.CardData(this.xmlGetChild(node, "sixml:CardData"));
        }
        if (this.xmlHasChild(node, "sixml:PrintData")) {
            this.printData = new timapi.protocol.sixml.PrintData(this.xmlGetChild(node, "sixml:PrintData"));
        }
        return;
    }
    if (arguments.length == 0) {
        this.functionGroup = "FinTransaction";
        this.function = "CollectPoints";
        return;
    }
    throw new Error("Invalid argument");
};
timapi.protocol.sixml.Response_CollectPoints.prototype = Object.create(timapi.protocol.Message.prototype);
timapi.protocol.sixml.Response_CollectPoints.prototype.functionGroup = undefined;
timapi.protocol.sixml.Response_CollectPoints.prototype.function = undefined;
timapi.protocol.sixml.Response_CollectPoints.prototype.sequenceNumber = undefined;
timapi.protocol.sixml.Response_CollectPoints.prototype.resultCode = undefined;
timapi.protocol.sixml.Response_CollectPoints.prototype.timeStamp = undefined;
timapi.protocol.sixml.Response_CollectPoints.prototype.transactionInformation = undefined;
timapi.protocol.sixml.Response_CollectPoints.prototype.amount = undefined;
timapi.protocol.sixml.Response_CollectPoints.prototype.amountSaldo = undefined;
timapi.protocol.sixml.Response_CollectPoints.prototype.disclaimer = undefined;
timapi.protocol.sixml.Response_CollectPoints.prototype.cardData = undefined;
timapi.protocol.sixml.Response_CollectPoints.prototype.printData = undefined;
timapi.protocol.sixml.Response_CollectPoints.prototype.toXmlNode = function () {
    var node = new timapi.protocol.XmlNode("sixml:Response");
    this.xmlSetAttribute(node, "xmlns:sixml", "http://www.six-payment-services.com/");
    if (this.functionGroup != undefined) {
        this.xmlSetAttribute(node, "FunctionGroup", this.functionGroup);
    }
    if (this.function != undefined) {
        this.xmlSetAttribute(node, "Function", this.function);
    }
    if (this.sequenceNumber != undefined) {
        this.xmlSetAttribute(node, "SequenceNumber", timapi.utils.StringHelper.makeString(this.sequenceNumber));
    }
    if (this.resultCode != undefined) {
        this.xmlSetAttribute(node, "ResultCode", timapi.utils.StringHelper.makeString(this.resultCode));
    }
    if (this.timeStamp != undefined) {
        this.xmlSetAttribute(node, "TimeStamp", this.timeStamp.format("yyyyMMdd'T'HHmmssZ"));
    }
    if (this.transactionInformation != undefined) {
        this.xmlAddChild(node, "sixml:TransactionInformation", this.transactionInformation);
    }
    if (this.amount != undefined) {
        this.xmlAddChild(node, "sixml:Amount", this.amount);
    }
    if (this.amountSaldo != undefined) {
        this.xmlAddChild(node, "sixml:AmountSaldo", this.amountSaldo);
    }
    if (this.disclaimer != undefined) {
        this.xmlAddChild(node, "sixml:Disclaimer", this.disclaimer);
    }
    if (this.cardData != undefined) {
        this.xmlAddChild(node, "sixml:CardData", this.cardData);
    }
    if (this.printData != undefined) {
        this.xmlAddChild(node, "sixml:PrintData", this.printData);
    }
    return node;
};
timapi.protocol.sixml.Response_Combined = function (a) {
    if (arguments.length == 1 && a instanceof timapi.protocol.sixml.Response_Combined) {
        var value = a;
        this.functionGroup = value.functionGroup;
        this.function = value.function;
        this.sequenceNumber = value.sequenceNumber;
        this.resultCode = value.resultCode;
        this.timeStamp = value.timeStamp;
        this.amount = value.amount ? new timapi.protocol.sixml.Amount(value.amount) : undefined;
        this.amountSaldo = value.amountSaldo ? new timapi.protocol.sixml.AmountSaldo(value.amountSaldo) : undefined;
        this.disclaimer = value.disclaimer;
        this.printData = value.printData ? new timapi.protocol.sixml.PrintData(value.printData) : undefined;
        this.transactionInformation = value.transactionInformation ? new timapi.protocol.sixml.TransactionInformation(value.transactionInformation) : undefined;
        this.cardData = value.cardData ? new timapi.protocol.sixml.CardData(value.cardData) : undefined;
        return;
    }
    if (arguments.length == 1 && a instanceof timapi.protocol.XmlNode) {
        var node = a;
        if (this.xmlHasAttribute(node, "FunctionGroup")) {
            this.functionGroup = this.xmlGetAttribute(node, "FunctionGroup");
        }
        if (this.xmlHasAttribute(node, "Function")) {
            this.function = this.xmlGetAttribute(node, "Function");
        }
        if (this.xmlHasAttribute(node, "SequenceNumber")) {
            this.sequenceNumber = (this.xmlGetAttribute(node, "SequenceNumber") ? parseInt(this.xmlGetAttribute(node, "SequenceNumber")) : 0);
        }
        if (this.xmlHasAttribute(node, "ResultCode")) {
            this.resultCode = (this.xmlGetAttribute(node, "ResultCode") ? parseInt(this.xmlGetAttribute(node, "ResultCode")) : 0);
        }
        if (this.xmlHasAttribute(node, "TimeStamp")) {
            this.timeStamp = new timapi.protocol.TimeDate("yyyyMMdd'T'HHmmssZ", this.xmlGetAttribute(node, "TimeStamp"));
        }
        if (this.xmlHasChild(node, "sixml:Amount")) {
            this.amount = new timapi.protocol.sixml.Amount(this.xmlGetChild(node, "sixml:Amount"));
        }
        if (this.xmlHasChild(node, "sixml:AmountSaldo")) {
            this.amountSaldo = new timapi.protocol.sixml.AmountSaldo(this.xmlGetChild(node, "sixml:AmountSaldo"));
        }
        if (this.xmlHasChild(node, "sixml:Disclaimer")) {
            this.disclaimer = this.xmlGetChild(node, "sixml:Disclaimer").textContent;
        }
        if (this.xmlHasChild(node, "sixml:PrintData")) {
            this.printData = new timapi.protocol.sixml.PrintData(this.xmlGetChild(node, "sixml:PrintData"));
        }
        if (this.xmlHasChild(node, "sixml:TransactionInformation")) {
            this.transactionInformation = new timapi.protocol.sixml.TransactionInformation(this.xmlGetChild(node, "sixml:TransactionInformation"));
        }
        if (this.xmlHasChild(node, "sixml:CardData")) {
            this.cardData = new timapi.protocol.sixml.CardData(this.xmlGetChild(node, "sixml:CardData"));
        }
        return;
    }
    if (arguments.length == 0) {
        this.functionGroup = "FinTransaction";
        this.function = "Combined";
        return;
    }
    throw new Error("Invalid argument");
};
timapi.protocol.sixml.Response_Combined.prototype = Object.create(timapi.protocol.Message.prototype);
timapi.protocol.sixml.Response_Combined.prototype.functionGroup = undefined;
timapi.protocol.sixml.Response_Combined.prototype.function = undefined;
timapi.protocol.sixml.Response_Combined.prototype.sequenceNumber = undefined;
timapi.protocol.sixml.Response_Combined.prototype.resultCode = undefined;
timapi.protocol.sixml.Response_Combined.prototype.timeStamp = undefined;
timapi.protocol.sixml.Response_Combined.prototype.amount = undefined;
timapi.protocol.sixml.Response_Combined.prototype.amountSaldo = undefined;
timapi.protocol.sixml.Response_Combined.prototype.disclaimer = undefined;
timapi.protocol.sixml.Response_Combined.prototype.printData = undefined;
timapi.protocol.sixml.Response_Combined.prototype.transactionInformation = undefined;
timapi.protocol.sixml.Response_Combined.prototype.cardData = undefined;
timapi.protocol.sixml.Response_Combined.prototype.toXmlNode = function () {
    var node = new timapi.protocol.XmlNode("sixml:Response");
    this.xmlSetAttribute(node, "xmlns:sixml", "http://www.six-payment-services.com/");
    if (this.functionGroup != undefined) {
        this.xmlSetAttribute(node, "FunctionGroup", this.functionGroup);
    }
    if (this.function != undefined) {
        this.xmlSetAttribute(node, "Function", this.function);
    }
    if (this.sequenceNumber != undefined) {
        this.xmlSetAttribute(node, "SequenceNumber", timapi.utils.StringHelper.makeString(this.sequenceNumber));
    }
    if (this.resultCode != undefined) {
        this.xmlSetAttribute(node, "ResultCode", timapi.utils.StringHelper.makeString(this.resultCode));
    }
    if (this.timeStamp != undefined) {
        this.xmlSetAttribute(node, "TimeStamp", this.timeStamp.format("yyyyMMdd'T'HHmmssZ"));
    }
    if (this.amount != undefined) {
        this.xmlAddChild(node, "sixml:Amount", this.amount);
    }
    if (this.amountSaldo != undefined) {
        this.xmlAddChild(node, "sixml:AmountSaldo", this.amountSaldo);
    }
    if (this.disclaimer != undefined) {
        this.xmlAddChild(node, "sixml:Disclaimer", this.disclaimer);
    }
    if (this.printData != undefined) {
        this.xmlAddChild(node, "sixml:PrintData", this.printData);
    }
    if (this.transactionInformation != undefined) {
        this.xmlAddChild(node, "sixml:TransactionInformation", this.transactionInformation);
    }
    if (this.cardData != undefined) {
        this.xmlAddChild(node, "sixml:CardData", this.cardData);
    }
    return node;
};
timapi.protocol.sixml.Response_Commit = function (a) {
    if (arguments.length == 1 && a instanceof timapi.protocol.sixml.Response_Commit) {
        var value = a;
        this.functionGroup = value.functionGroup;
        this.function = value.function;
        this.sequenceNumber = value.sequenceNumber;
        this.resultCode = value.resultCode;
        this.timeStamp = value.timeStamp;
        this.repeat = value.repeat;
        this.printData = value.printData ? new timapi.protocol.sixml.PrintData(value.printData) : undefined;
        return;
    }
    if (arguments.length == 1 && a instanceof timapi.protocol.XmlNode) {
        var node = a;
        if (this.xmlHasAttribute(node, "FunctionGroup")) {
            this.functionGroup = this.xmlGetAttribute(node, "FunctionGroup");
        }
        if (this.xmlHasAttribute(node, "Function")) {
            this.function = this.xmlGetAttribute(node, "Function");
        }
        if (this.xmlHasAttribute(node, "SequenceNumber")) {
            this.sequenceNumber = (this.xmlGetAttribute(node, "SequenceNumber") ? parseInt(this.xmlGetAttribute(node, "SequenceNumber")) : 0);
        }
        if (this.xmlHasAttribute(node, "ResultCode")) {
            this.resultCode = (this.xmlGetAttribute(node, "ResultCode") ? parseInt(this.xmlGetAttribute(node, "ResultCode")) : 0);
        }
        if (this.xmlHasAttribute(node, "TimeStamp")) {
            this.timeStamp = new timapi.protocol.TimeDate("yyyyMMdd'T'HHmmssZ", this.xmlGetAttribute(node, "TimeStamp"));
        }
        if (this.xmlHasAttribute(node, "Repeat")) {
            this.repeat = (this.xmlGetAttribute(node, "Repeat") ? parseInt(this.xmlGetAttribute(node, "Repeat")) : 0);
        }
        if (this.xmlHasChild(node, "sixml:PrintData")) {
            this.printData = new timapi.protocol.sixml.PrintData(this.xmlGetChild(node, "sixml:PrintData"));
        }
        return;
    }
    if (arguments.length == 0) {
        this.functionGroup = "FinTransaction";
        this.function = "Commit";
        return;
    }
    throw new Error("Invalid argument");
};
timapi.protocol.sixml.Response_Commit.prototype = Object.create(timapi.protocol.Message.prototype);
timapi.protocol.sixml.Response_Commit.prototype.functionGroup = undefined;
timapi.protocol.sixml.Response_Commit.prototype.function = undefined;
timapi.protocol.sixml.Response_Commit.prototype.sequenceNumber = undefined;
timapi.protocol.sixml.Response_Commit.prototype.resultCode = undefined;
timapi.protocol.sixml.Response_Commit.prototype.timeStamp = undefined;
timapi.protocol.sixml.Response_Commit.prototype.repeat = undefined;
timapi.protocol.sixml.Response_Commit.prototype.printData = undefined;
timapi.protocol.sixml.Response_Commit.prototype.toXmlNode = function () {
    var node = new timapi.protocol.XmlNode("sixml:Response");
    this.xmlSetAttribute(node, "xmlns:sixml", "http://www.six-payment-services.com/");
    if (this.functionGroup != undefined) {
        this.xmlSetAttribute(node, "FunctionGroup", this.functionGroup);
    }
    if (this.function != undefined) {
        this.xmlSetAttribute(node, "Function", this.function);
    }
    if (this.sequenceNumber != undefined) {
        this.xmlSetAttribute(node, "SequenceNumber", timapi.utils.StringHelper.makeString(this.sequenceNumber));
    }
    if (this.resultCode != undefined) {
        this.xmlSetAttribute(node, "ResultCode", timapi.utils.StringHelper.makeString(this.resultCode));
    }
    if (this.timeStamp != undefined) {
        this.xmlSetAttribute(node, "TimeStamp", this.timeStamp.format("yyyyMMdd'T'HHmmssZ"));
    }
    if (this.repeat != undefined) {
        this.xmlSetAttribute(node, "Repeat", timapi.utils.StringHelper.makeString(this.repeat));
    }
    if (this.printData != undefined) {
        this.xmlAddChild(node, "sixml:PrintData", this.printData);
    }
    return node;
};
timapi.protocol.sixml.Response_CounterRequest = function (a) {
    if (arguments.length == 1 && a instanceof timapi.protocol.sixml.Response_CounterRequest) {
        var value = a;
        this.functionGroup = value.functionGroup;
        this.function = value.function;
        this.sequenceNumber = value.sequenceNumber;
        this.resultCode = value.resultCode;
        this.timeStamp = value.timeStamp;
        this.counters = value.counters ? new timapi.protocol.sixml.Counters(value.counters) : undefined;
        return;
    }
    if (arguments.length == 1 && a instanceof timapi.protocol.XmlNode) {
        var node = a;
        if (this.xmlHasAttribute(node, "FunctionGroup")) {
            this.functionGroup = this.xmlGetAttribute(node, "FunctionGroup");
        }
        if (this.xmlHasAttribute(node, "Function")) {
            this.function = this.xmlGetAttribute(node, "Function");
        }
        if (this.xmlHasAttribute(node, "SequenceNumber")) {
            this.sequenceNumber = (this.xmlGetAttribute(node, "SequenceNumber") ? parseInt(this.xmlGetAttribute(node, "SequenceNumber")) : 0);
        }
        if (this.xmlHasAttribute(node, "ResultCode")) {
            this.resultCode = (this.xmlGetAttribute(node, "ResultCode") ? parseInt(this.xmlGetAttribute(node, "ResultCode")) : 0);
        }
        if (this.xmlHasAttribute(node, "TimeStamp")) {
            this.timeStamp = new timapi.protocol.TimeDate("yyyyMMdd'T'HHmmssZ", this.xmlGetAttribute(node, "TimeStamp"));
        }
        if (this.xmlHasChild(node, "sixml:Counters")) {
            this.counters = new timapi.protocol.sixml.Counters(this.xmlGetChild(node, "sixml:Counters"));
        }
        return;
    }
    if (arguments.length == 0) {
        this.functionGroup = "Admin";
        this.function = "CounterRequest";
        return;
    }
    throw new Error("Invalid argument");
};
timapi.protocol.sixml.Response_CounterRequest.prototype = Object.create(timapi.protocol.Message.prototype);
timapi.protocol.sixml.Response_CounterRequest.prototype.functionGroup = undefined;
timapi.protocol.sixml.Response_CounterRequest.prototype.function = undefined;
timapi.protocol.sixml.Response_CounterRequest.prototype.sequenceNumber = undefined;
timapi.protocol.sixml.Response_CounterRequest.prototype.resultCode = undefined;
timapi.protocol.sixml.Response_CounterRequest.prototype.timeStamp = undefined;
timapi.protocol.sixml.Response_CounterRequest.prototype.counters = undefined;
timapi.protocol.sixml.Response_CounterRequest.prototype.toXmlNode = function () {
    var node = new timapi.protocol.XmlNode("sixml:Response");
    this.xmlSetAttribute(node, "xmlns:sixml", "http://www.six-payment-services.com/");
    if (this.functionGroup != undefined) {
        this.xmlSetAttribute(node, "FunctionGroup", this.functionGroup);
    }
    if (this.function != undefined) {
        this.xmlSetAttribute(node, "Function", this.function);
    }
    if (this.sequenceNumber != undefined) {
        this.xmlSetAttribute(node, "SequenceNumber", timapi.utils.StringHelper.makeString(this.sequenceNumber));
    }
    if (this.resultCode != undefined) {
        this.xmlSetAttribute(node, "ResultCode", timapi.utils.StringHelper.makeString(this.resultCode));
    }
    if (this.timeStamp != undefined) {
        this.xmlSetAttribute(node, "TimeStamp", this.timeStamp.format("yyyyMMdd'T'HHmmssZ"));
    }
    if (this.counters != undefined) {
        this.xmlAddChild(node, "sixml:Counters", this.counters);
    }
    return node;
};
timapi.protocol.sixml.Response_Credit = function (a) {
    if (arguments.length == 1 && a instanceof timapi.protocol.sixml.Response_Credit) {
        var value = a;
        this.functionGroup = value.functionGroup;
        this.function = value.function;
        this.sequenceNumber = value.sequenceNumber;
        this.resultCode = value.resultCode;
        this.timeStamp = value.timeStamp;
        this.transactionInformation = value.transactionInformation ? new timapi.protocol.sixml.TransactionInformation(value.transactionInformation) : undefined;
        this.amount = value.amount ? new timapi.protocol.sixml.Amount(value.amount) : undefined;
        this.amountDcc = value.amountDcc ? new timapi.protocol.sixml.AmountDcc(value.amountDcc) : undefined;
        this.amountSaldo = value.amountSaldo ? new timapi.protocol.sixml.AmountSaldo(value.amountSaldo) : undefined;
        this.dccDisclaimer = value.dccDisclaimer;
        this.disclaimer = value.disclaimer;
        this.cardData = value.cardData ? new timapi.protocol.sixml.CardData(value.cardData) : undefined;
        this.printData = value.printData ? new timapi.protocol.sixml.PrintData(value.printData) : undefined;
        return;
    }
    if (arguments.length == 1 && a instanceof timapi.protocol.XmlNode) {
        var node = a;
        if (this.xmlHasAttribute(node, "FunctionGroup")) {
            this.functionGroup = this.xmlGetAttribute(node, "FunctionGroup");
        }
        if (this.xmlHasAttribute(node, "Function")) {
            this.function = this.xmlGetAttribute(node, "Function");
        }
        if (this.xmlHasAttribute(node, "SequenceNumber")) {
            this.sequenceNumber = (this.xmlGetAttribute(node, "SequenceNumber") ? parseInt(this.xmlGetAttribute(node, "SequenceNumber")) : 0);
        }
        if (this.xmlHasAttribute(node, "ResultCode")) {
            this.resultCode = (this.xmlGetAttribute(node, "ResultCode") ? parseInt(this.xmlGetAttribute(node, "ResultCode")) : 0);
        }
        if (this.xmlHasAttribute(node, "TimeStamp")) {
            this.timeStamp = new timapi.protocol.TimeDate("yyyyMMdd'T'HHmmssZ", this.xmlGetAttribute(node, "TimeStamp"));
        }
        if (this.xmlHasChild(node, "sixml:TransactionInformation")) {
            this.transactionInformation = new timapi.protocol.sixml.TransactionInformation(this.xmlGetChild(node, "sixml:TransactionInformation"));
        }
        if (this.xmlHasChild(node, "sixml:Amount")) {
            this.amount = new timapi.protocol.sixml.Amount(this.xmlGetChild(node, "sixml:Amount"));
        }
        if (this.xmlHasChild(node, "sixml:AmountDcc")) {
            this.amountDcc = new timapi.protocol.sixml.AmountDcc(this.xmlGetChild(node, "sixml:AmountDcc"));
        }
        if (this.xmlHasChild(node, "sixml:AmountSaldo")) {
            this.amountSaldo = new timapi.protocol.sixml.AmountSaldo(this.xmlGetChild(node, "sixml:AmountSaldo"));
        }
        if (this.xmlHasChild(node, "sixml:DccDisclaimer")) {
            this.dccDisclaimer = this.xmlGetChild(node, "sixml:DccDisclaimer").textContent;
        }
        if (this.xmlHasChild(node, "sixml:Disclaimer")) {
            this.disclaimer = this.xmlGetChild(node, "sixml:Disclaimer").textContent;
        }
        if (this.xmlHasChild(node, "sixml:CardData")) {
            this.cardData = new timapi.protocol.sixml.CardData(this.xmlGetChild(node, "sixml:CardData"));
        }
        if (this.xmlHasChild(node, "sixml:PrintData")) {
            this.printData = new timapi.protocol.sixml.PrintData(this.xmlGetChild(node, "sixml:PrintData"));
        }
        return;
    }
    if (arguments.length == 0) {
        this.functionGroup = "FinTransaction";
        this.function = "Credit";
        return;
    }
    throw new Error("Invalid argument");
};
timapi.protocol.sixml.Response_Credit.prototype = Object.create(timapi.protocol.Message.prototype);
timapi.protocol.sixml.Response_Credit.prototype.functionGroup = undefined;
timapi.protocol.sixml.Response_Credit.prototype.function = undefined;
timapi.protocol.sixml.Response_Credit.prototype.sequenceNumber = undefined;
timapi.protocol.sixml.Response_Credit.prototype.resultCode = undefined;
timapi.protocol.sixml.Response_Credit.prototype.timeStamp = undefined;
timapi.protocol.sixml.Response_Credit.prototype.transactionInformation = undefined;
timapi.protocol.sixml.Response_Credit.prototype.amount = undefined;
timapi.protocol.sixml.Response_Credit.prototype.amountDcc = undefined;
timapi.protocol.sixml.Response_Credit.prototype.amountSaldo = undefined;
timapi.protocol.sixml.Response_Credit.prototype.dccDisclaimer = undefined;
timapi.protocol.sixml.Response_Credit.prototype.disclaimer = undefined;
timapi.protocol.sixml.Response_Credit.prototype.cardData = undefined;
timapi.protocol.sixml.Response_Credit.prototype.printData = undefined;
timapi.protocol.sixml.Response_Credit.prototype.toXmlNode = function () {
    var node = new timapi.protocol.XmlNode("sixml:Response");
    this.xmlSetAttribute(node, "xmlns:sixml", "http://www.six-payment-services.com/");
    if (this.functionGroup != undefined) {
        this.xmlSetAttribute(node, "FunctionGroup", this.functionGroup);
    }
    if (this.function != undefined) {
        this.xmlSetAttribute(node, "Function", this.function);
    }
    if (this.sequenceNumber != undefined) {
        this.xmlSetAttribute(node, "SequenceNumber", timapi.utils.StringHelper.makeString(this.sequenceNumber));
    }
    if (this.resultCode != undefined) {
        this.xmlSetAttribute(node, "ResultCode", timapi.utils.StringHelper.makeString(this.resultCode));
    }
    if (this.timeStamp != undefined) {
        this.xmlSetAttribute(node, "TimeStamp", this.timeStamp.format("yyyyMMdd'T'HHmmssZ"));
    }
    if (this.transactionInformation != undefined) {
        this.xmlAddChild(node, "sixml:TransactionInformation", this.transactionInformation);
    }
    if (this.amount != undefined) {
        this.xmlAddChild(node, "sixml:Amount", this.amount);
    }
    if (this.amountDcc != undefined) {
        this.xmlAddChild(node, "sixml:AmountDcc", this.amountDcc);
    }
    if (this.amountSaldo != undefined) {
        this.xmlAddChild(node, "sixml:AmountSaldo", this.amountSaldo);
    }
    if (this.dccDisclaimer != undefined) {
        this.xmlAddChild(node, "sixml:DccDisclaimer", this.dccDisclaimer);
    }
    if (this.disclaimer != undefined) {
        this.xmlAddChild(node, "sixml:Disclaimer", this.disclaimer);
    }
    if (this.cardData != undefined) {
        this.xmlAddChild(node, "sixml:CardData", this.cardData);
    }
    if (this.printData != undefined) {
        this.xmlAddChild(node, "sixml:PrintData", this.printData);
    }
    return node;
};
timapi.protocol.sixml.Response_DccRates = function (a) {
    if (arguments.length == 1 && a instanceof timapi.protocol.sixml.Response_DccRates) {
        var value = a;
        this.functionGroup = value.functionGroup;
        this.function = value.function;
        this.sequenceNumber = value.sequenceNumber;
        this.resultCode = value.resultCode;
        this.timeStamp = value.timeStamp;
        this.printData = value.printData ? new timapi.protocol.sixml.PrintData(value.printData) : undefined;
        return;
    }
    if (arguments.length == 1 && a instanceof timapi.protocol.XmlNode) {
        var node = a;
        if (this.xmlHasAttribute(node, "FunctionGroup")) {
            this.functionGroup = this.xmlGetAttribute(node, "FunctionGroup");
        }
        if (this.xmlHasAttribute(node, "Function")) {
            this.function = this.xmlGetAttribute(node, "Function");
        }
        if (this.xmlHasAttribute(node, "SequenceNumber")) {
            this.sequenceNumber = (this.xmlGetAttribute(node, "SequenceNumber") ? parseInt(this.xmlGetAttribute(node, "SequenceNumber")) : 0);
        }
        if (this.xmlHasAttribute(node, "ResultCode")) {
            this.resultCode = (this.xmlGetAttribute(node, "ResultCode") ? parseInt(this.xmlGetAttribute(node, "ResultCode")) : 0);
        }
        if (this.xmlHasAttribute(node, "TimeStamp")) {
            this.timeStamp = new timapi.protocol.TimeDate("yyyyMMdd'T'HHmmssZ", this.xmlGetAttribute(node, "TimeStamp"));
        }
        if (this.xmlHasChild(node, "sixml:PrintData")) {
            this.printData = new timapi.protocol.sixml.PrintData(this.xmlGetChild(node, "sixml:PrintData"));
        }
        return;
    }
    if (arguments.length == 0) {
        this.functionGroup = "Admin";
        this.function = "DccRates";
        return;
    }
    throw new Error("Invalid argument");
};
timapi.protocol.sixml.Response_DccRates.prototype = Object.create(timapi.protocol.Message.prototype);
timapi.protocol.sixml.Response_DccRates.prototype.functionGroup = undefined;
timapi.protocol.sixml.Response_DccRates.prototype.function = undefined;
timapi.protocol.sixml.Response_DccRates.prototype.sequenceNumber = undefined;
timapi.protocol.sixml.Response_DccRates.prototype.resultCode = undefined;
timapi.protocol.sixml.Response_DccRates.prototype.timeStamp = undefined;
timapi.protocol.sixml.Response_DccRates.prototype.printData = undefined;
timapi.protocol.sixml.Response_DccRates.prototype.toXmlNode = function () {
    var node = new timapi.protocol.XmlNode("sixml:Response");
    this.xmlSetAttribute(node, "xmlns:sixml", "http://www.six-payment-services.com/");
    if (this.functionGroup != undefined) {
        this.xmlSetAttribute(node, "FunctionGroup", this.functionGroup);
    }
    if (this.function != undefined) {
        this.xmlSetAttribute(node, "Function", this.function);
    }
    if (this.sequenceNumber != undefined) {
        this.xmlSetAttribute(node, "SequenceNumber", timapi.utils.StringHelper.makeString(this.sequenceNumber));
    }
    if (this.resultCode != undefined) {
        this.xmlSetAttribute(node, "ResultCode", timapi.utils.StringHelper.makeString(this.resultCode));
    }
    if (this.timeStamp != undefined) {
        this.xmlSetAttribute(node, "TimeStamp", this.timeStamp.format("yyyyMMdd'T'HHmmssZ"));
    }
    if (this.printData != undefined) {
        this.xmlAddChild(node, "sixml:PrintData", this.printData);
    }
    return node;
};
timapi.protocol.sixml.Response_Deactivate = function (a) {
    if (arguments.length == 1 && a instanceof timapi.protocol.sixml.Response_Deactivate) {
        var value = a;
        this.functionGroup = value.functionGroup;
        this.function = value.function;
        this.sequenceNumber = value.sequenceNumber;
        this.resultCode = value.resultCode;
        this.timeStamp = value.timeStamp;
        this.printData = value.printData ? new timapi.protocol.sixml.PrintData(value.printData) : undefined;
        this.counters = value.counters ? new timapi.protocol.sixml.Counters(value.counters) : undefined;
        return;
    }
    if (arguments.length == 1 && a instanceof timapi.protocol.XmlNode) {
        var node = a;
        if (this.xmlHasAttribute(node, "FunctionGroup")) {
            this.functionGroup = this.xmlGetAttribute(node, "FunctionGroup");
        }
        if (this.xmlHasAttribute(node, "Function")) {
            this.function = this.xmlGetAttribute(node, "Function");
        }
        if (this.xmlHasAttribute(node, "SequenceNumber")) {
            this.sequenceNumber = (this.xmlGetAttribute(node, "SequenceNumber") ? parseInt(this.xmlGetAttribute(node, "SequenceNumber")) : 0);
        }
        if (this.xmlHasAttribute(node, "ResultCode")) {
            this.resultCode = (this.xmlGetAttribute(node, "ResultCode") ? parseInt(this.xmlGetAttribute(node, "ResultCode")) : 0);
        }
        if (this.xmlHasAttribute(node, "TimeStamp")) {
            this.timeStamp = new timapi.protocol.TimeDate("yyyyMMdd'T'HHmmssZ", this.xmlGetAttribute(node, "TimeStamp"));
        }
        if (this.xmlHasChild(node, "sixml:PrintData")) {
            this.printData = new timapi.protocol.sixml.PrintData(this.xmlGetChild(node, "sixml:PrintData"));
        }
        if (this.xmlHasChild(node, "sixml:Counters")) {
            this.counters = new timapi.protocol.sixml.Counters(this.xmlGetChild(node, "sixml:Counters"));
        }
        return;
    }
    if (arguments.length == 0) {
        this.functionGroup = "Admin";
        this.function = "Deactivate";
        return;
    }
    throw new Error("Invalid argument");
};
timapi.protocol.sixml.Response_Deactivate.prototype = Object.create(timapi.protocol.Message.prototype);
timapi.protocol.sixml.Response_Deactivate.prototype.functionGroup = undefined;
timapi.protocol.sixml.Response_Deactivate.prototype.function = undefined;
timapi.protocol.sixml.Response_Deactivate.prototype.sequenceNumber = undefined;
timapi.protocol.sixml.Response_Deactivate.prototype.resultCode = undefined;
timapi.protocol.sixml.Response_Deactivate.prototype.timeStamp = undefined;
timapi.protocol.sixml.Response_Deactivate.prototype.printData = undefined;
timapi.protocol.sixml.Response_Deactivate.prototype.counters = undefined;
timapi.protocol.sixml.Response_Deactivate.prototype.toXmlNode = function () {
    var node = new timapi.protocol.XmlNode("sixml:Response");
    this.xmlSetAttribute(node, "xmlns:sixml", "http://www.six-payment-services.com/");
    if (this.functionGroup != undefined) {
        this.xmlSetAttribute(node, "FunctionGroup", this.functionGroup);
    }
    if (this.function != undefined) {
        this.xmlSetAttribute(node, "Function", this.function);
    }
    if (this.sequenceNumber != undefined) {
        this.xmlSetAttribute(node, "SequenceNumber", timapi.utils.StringHelper.makeString(this.sequenceNumber));
    }
    if (this.resultCode != undefined) {
        this.xmlSetAttribute(node, "ResultCode", timapi.utils.StringHelper.makeString(this.resultCode));
    }
    if (this.timeStamp != undefined) {
        this.xmlSetAttribute(node, "TimeStamp", this.timeStamp.format("yyyyMMdd'T'HHmmssZ"));
    }
    if (this.printData != undefined) {
        this.xmlAddChild(node, "sixml:PrintData", this.printData);
    }
    if (this.counters != undefined) {
        this.xmlAddChild(node, "sixml:Counters", this.counters);
    }
    return node;
};
timapi.protocol.sixml.Response_EjectCard = function (a) {
    if (arguments.length == 1 && a instanceof timapi.protocol.sixml.Response_EjectCard) {
        var value = a;
        this.functionGroup = value.functionGroup;
        this.function = value.function;
        this.sequenceNumber = value.sequenceNumber;
        this.resultCode = value.resultCode;
        this.timeStamp = value.timeStamp;
        return;
    }
    if (arguments.length == 1 && a instanceof timapi.protocol.XmlNode) {
        var node = a;
        if (this.xmlHasAttribute(node, "FunctionGroup")) {
            this.functionGroup = this.xmlGetAttribute(node, "FunctionGroup");
        }
        if (this.xmlHasAttribute(node, "Function")) {
            this.function = this.xmlGetAttribute(node, "Function");
        }
        if (this.xmlHasAttribute(node, "SequenceNumber")) {
            this.sequenceNumber = (this.xmlGetAttribute(node, "SequenceNumber") ? parseInt(this.xmlGetAttribute(node, "SequenceNumber")) : 0);
        }
        if (this.xmlHasAttribute(node, "ResultCode")) {
            this.resultCode = (this.xmlGetAttribute(node, "ResultCode") ? parseInt(this.xmlGetAttribute(node, "ResultCode")) : 0);
        }
        if (this.xmlHasAttribute(node, "TimeStamp")) {
            this.timeStamp = new timapi.protocol.TimeDate("yyyyMMdd'T'HHmmssZ", this.xmlGetAttribute(node, "TimeStamp"));
        }
        return;
    }
    if (arguments.length == 0) {
        this.functionGroup = "Admin";
        this.function = "EjectCard";
        return;
    }
    throw new Error("Invalid argument");
};
timapi.protocol.sixml.Response_EjectCard.prototype = Object.create(timapi.protocol.Message.prototype);
timapi.protocol.sixml.Response_EjectCard.prototype.functionGroup = undefined;
timapi.protocol.sixml.Response_EjectCard.prototype.function = undefined;
timapi.protocol.sixml.Response_EjectCard.prototype.sequenceNumber = undefined;
timapi.protocol.sixml.Response_EjectCard.prototype.resultCode = undefined;
timapi.protocol.sixml.Response_EjectCard.prototype.timeStamp = undefined;
timapi.protocol.sixml.Response_EjectCard.prototype.toXmlNode = function () {
    var node = new timapi.protocol.XmlNode("sixml:Response");
    this.xmlSetAttribute(node, "xmlns:sixml", "http://www.six-payment-services.com/");
    if (this.functionGroup != undefined) {
        this.xmlSetAttribute(node, "FunctionGroup", this.functionGroup);
    }
    if (this.function != undefined) {
        this.xmlSetAttribute(node, "Function", this.function);
    }
    if (this.sequenceNumber != undefined) {
        this.xmlSetAttribute(node, "SequenceNumber", timapi.utils.StringHelper.makeString(this.sequenceNumber));
    }
    if (this.resultCode != undefined) {
        this.xmlSetAttribute(node, "ResultCode", timapi.utils.StringHelper.makeString(this.resultCode));
    }
    if (this.timeStamp != undefined) {
        this.xmlSetAttribute(node, "TimeStamp", this.timeStamp.format("yyyyMMdd'T'HHmmssZ"));
    }
    return node;
};
timapi.protocol.sixml.Response_Error = function (a) {
    if (arguments.length == 1 && a instanceof timapi.protocol.sixml.Response_Error) {
        var value = a;
        this.functionGroup = value.functionGroup;
        this.function = value.function;
        this.sequenceNumber = value.sequenceNumber;
        this.resultCode = value.resultCode;
        this.timeStamp = value.timeStamp;
        this.errorMessage = value.errorMessage;
        this.nativeError = value.nativeError ? new timapi.protocol.sixml.NativeError(value.nativeError) : undefined;
        this.ppInfo = value.ppInfo ? new timapi.protocol.sixml.PpInfo(value.ppInfo) : undefined;
        this.additionalErrorInfoList = value.additionalErrorInfoList ? new timapi.protocol.sixml.AdditionalErrorInfoList(value.additionalErrorInfoList) : undefined;
        this.printData = value.printData ? new timapi.protocol.sixml.PrintData(value.printData) : undefined;
        this.basket = value.basket ? new timapi.protocol.sixml.Basket(value.basket) : undefined;
        return;
    }
    if (arguments.length == 1 && a instanceof timapi.protocol.XmlNode) {
        var node = a;
        if (this.xmlHasAttribute(node, "FunctionGroup")) {
            this.functionGroup = this.xmlGetAttribute(node, "FunctionGroup");
        }
        if (this.xmlHasAttribute(node, "Function")) {
            this.function = this.xmlGetAttribute(node, "Function");
        }
        if (this.xmlHasAttribute(node, "SequenceNumber")) {
            this.sequenceNumber = (this.xmlGetAttribute(node, "SequenceNumber") ? parseInt(this.xmlGetAttribute(node, "SequenceNumber")) : 0);
        }
        if (this.xmlHasAttribute(node, "ResultCode")) {
            this.resultCode = (this.xmlGetAttribute(node, "ResultCode") ? parseInt(this.xmlGetAttribute(node, "ResultCode")) : 0);
        }
        if (this.xmlHasAttribute(node, "TimeStamp")) {
            this.timeStamp = new timapi.protocol.TimeDate("yyyyMMdd'T'HHmmssZ", this.xmlGetAttribute(node, "TimeStamp"));
        }
        if (this.xmlHasChild(node, "sixml:ErrorMessage")) {
            this.errorMessage = this.xmlGetChild(node, "sixml:ErrorMessage").textContent;
        }
        if (this.xmlHasChild(node, "sixml:NativeError")) {
            this.nativeError = new timapi.protocol.sixml.NativeError(this.xmlGetChild(node, "sixml:NativeError"));
        }
        if (this.xmlHasChild(node, "sixml:PpInfo")) {
            this.ppInfo = new timapi.protocol.sixml.PpInfo(this.xmlGetChild(node, "sixml:PpInfo"));
        }
        if (this.xmlHasChild(node, "sixml:AdditionalErrorInfoList")) {
            this.additionalErrorInfoList = new timapi.protocol.sixml.AdditionalErrorInfoList(this.xmlGetChild(node, "sixml:AdditionalErrorInfoList"));
        }
        if (this.xmlHasChild(node, "sixml:PrintData")) {
            this.printData = new timapi.protocol.sixml.PrintData(this.xmlGetChild(node, "sixml:PrintData"));
        }
        if (this.xmlHasChild(node, "sixml:Basket")) {
            this.basket = new timapi.protocol.sixml.Basket(this.xmlGetChild(node, "sixml:Basket"));
        }
        return;
    }
    if (arguments.length == 0) {
        return;
    }
    throw new Error("Invalid argument");
};
timapi.protocol.sixml.Response_Error.prototype = Object.create(timapi.protocol.Message.prototype);
timapi.protocol.sixml.Response_Error.prototype.functionGroup = undefined;
timapi.protocol.sixml.Response_Error.prototype.function = undefined;
timapi.protocol.sixml.Response_Error.prototype.sequenceNumber = undefined;
timapi.protocol.sixml.Response_Error.prototype.resultCode = undefined;
timapi.protocol.sixml.Response_Error.prototype.timeStamp = undefined;
timapi.protocol.sixml.Response_Error.prototype.errorMessage = undefined;
timapi.protocol.sixml.Response_Error.prototype.nativeError = undefined;
timapi.protocol.sixml.Response_Error.prototype.ppInfo = undefined;
timapi.protocol.sixml.Response_Error.prototype.additionalErrorInfoList = undefined;
timapi.protocol.sixml.Response_Error.prototype.printData = undefined;
timapi.protocol.sixml.Response_Error.prototype.basket = undefined;
timapi.protocol.sixml.Response_Error.prototype.toXmlNode = function () {
    var node = new timapi.protocol.XmlNode("sixml:Response");
    this.xmlSetAttribute(node, "xmlns:sixml", "http://www.six-payment-services.com/");
    if (this.functionGroup != undefined) {
        this.xmlSetAttribute(node, "FunctionGroup", this.functionGroup);
    }
    if (this.function != undefined) {
        this.xmlSetAttribute(node, "Function", this.function);
    }
    if (this.sequenceNumber != undefined) {
        this.xmlSetAttribute(node, "SequenceNumber", timapi.utils.StringHelper.makeString(this.sequenceNumber));
    }
    if (this.resultCode != undefined) {
        this.xmlSetAttribute(node, "ResultCode", timapi.utils.StringHelper.makeString(this.resultCode));
    }
    if (this.timeStamp != undefined) {
        this.xmlSetAttribute(node, "TimeStamp", this.timeStamp.format("yyyyMMdd'T'HHmmssZ"));
    }
    if (this.errorMessage != undefined) {
        this.xmlAddChild(node, "sixml:ErrorMessage", this.errorMessage);
    }
    if (this.nativeError != undefined) {
        this.xmlAddChild(node, "sixml:NativeError", this.nativeError);
    }
    if (this.ppInfo != undefined) {
        this.xmlAddChild(node, "sixml:PpInfo", this.ppInfo);
    }
    if (this.additionalErrorInfoList != undefined) {
        this.xmlAddChild(node, "sixml:AdditionalErrorInfoList", this.additionalErrorInfoList);
    }
    if (this.printData != undefined) {
        this.xmlAddChild(node, "sixml:PrintData", this.printData);
    }
    if (this.basket != undefined) {
        this.xmlAddChild(node, "sixml:Basket", this.basket);
    }
    return node;
};
timapi.protocol.sixml.Response_FeatureRequest = function (a) {
    if (arguments.length == 1 && a instanceof timapi.protocol.sixml.Response_FeatureRequest) {
        var value = a;
        this.functionGroup = value.functionGroup;
        this.function = value.function;
        this.sequenceNumber = value.sequenceNumber;
        this.resultCode = value.resultCode;
        this.timeStamp = value.timeStamp;
        this.features = value.features ? new timapi.protocol.sixml.Features(value.features) : undefined;
        this.terminalId = value.terminalId;
        return;
    }
    if (arguments.length == 1 && a instanceof timapi.protocol.XmlNode) {
        var node = a;
        if (this.xmlHasAttribute(node, "FunctionGroup")) {
            this.functionGroup = this.xmlGetAttribute(node, "FunctionGroup");
        }
        if (this.xmlHasAttribute(node, "Function")) {
            this.function = this.xmlGetAttribute(node, "Function");
        }
        if (this.xmlHasAttribute(node, "SequenceNumber")) {
            this.sequenceNumber = (this.xmlGetAttribute(node, "SequenceNumber") ? parseInt(this.xmlGetAttribute(node, "SequenceNumber")) : 0);
        }
        if (this.xmlHasAttribute(node, "ResultCode")) {
            this.resultCode = (this.xmlGetAttribute(node, "ResultCode") ? parseInt(this.xmlGetAttribute(node, "ResultCode")) : 0);
        }
        if (this.xmlHasAttribute(node, "TimeStamp")) {
            this.timeStamp = new timapi.protocol.TimeDate("yyyyMMdd'T'HHmmssZ", this.xmlGetAttribute(node, "TimeStamp"));
        }
        if (this.xmlHasChild(node, "sixml:Features")) {
            this.features = new timapi.protocol.sixml.Features(this.xmlGetChild(node, "sixml:Features"));
        }
        if (this.xmlHasChild(node, "sixml:TerminalId")) {
            this.terminalId = this.xmlGetChild(node, "sixml:TerminalId").textContent;
        }
        return;
    }
    if (arguments.length == 0) {
        this.functionGroup = "Status";
        this.function = "FeatureRequest";
        return;
    }
    throw new Error("Invalid argument");
};
timapi.protocol.sixml.Response_FeatureRequest.prototype = Object.create(timapi.protocol.Message.prototype);
timapi.protocol.sixml.Response_FeatureRequest.prototype.functionGroup = undefined;
timapi.protocol.sixml.Response_FeatureRequest.prototype.function = undefined;
timapi.protocol.sixml.Response_FeatureRequest.prototype.sequenceNumber = undefined;
timapi.protocol.sixml.Response_FeatureRequest.prototype.resultCode = undefined;
timapi.protocol.sixml.Response_FeatureRequest.prototype.timeStamp = undefined;
timapi.protocol.sixml.Response_FeatureRequest.prototype.features = undefined;
timapi.protocol.sixml.Response_FeatureRequest.prototype.terminalId = undefined;
timapi.protocol.sixml.Response_FeatureRequest.prototype.toXmlNode = function () {
    var node = new timapi.protocol.XmlNode("sixml:Response");
    this.xmlSetAttribute(node, "xmlns:sixml", "http://www.six-payment-services.com/");
    if (this.functionGroup != undefined) {
        this.xmlSetAttribute(node, "FunctionGroup", this.functionGroup);
    }
    if (this.function != undefined) {
        this.xmlSetAttribute(node, "Function", this.function);
    }
    if (this.sequenceNumber != undefined) {
        this.xmlSetAttribute(node, "SequenceNumber", timapi.utils.StringHelper.makeString(this.sequenceNumber));
    }
    if (this.resultCode != undefined) {
        this.xmlSetAttribute(node, "ResultCode", timapi.utils.StringHelper.makeString(this.resultCode));
    }
    if (this.timeStamp != undefined) {
        this.xmlSetAttribute(node, "TimeStamp", this.timeStamp.format("yyyyMMdd'T'HHmmssZ"));
    }
    if (this.features != undefined) {
        this.xmlAddChild(node, "sixml:Features", this.features);
    }
    if (this.terminalId != undefined) {
        this.xmlAddChild(node, "sixml:TerminalId", this.terminalId);
    }
    return node;
};
timapi.protocol.sixml.Response_FinalizePurchase = function (a) {
    if (arguments.length == 1 && a instanceof timapi.protocol.sixml.Response_FinalizePurchase) {
        var value = a;
        this.functionGroup = value.functionGroup;
        this.function = value.function;
        this.sequenceNumber = value.sequenceNumber;
        this.resultCode = value.resultCode;
        this.timeStamp = value.timeStamp;
        this.printData = value.printData ? new timapi.protocol.sixml.PrintData(value.printData) : undefined;
        this.basket = value.basket ? new timapi.protocol.sixml.Basket(value.basket) : undefined;
        this.amount = value.amount ? new timapi.protocol.sixml.Amount(value.amount) : undefined;
        this.transactionInformation = value.transactionInformation ? new timapi.protocol.sixml.TransactionInformation(value.transactionInformation) : undefined;
        return;
    }
    if (arguments.length == 1 && a instanceof timapi.protocol.XmlNode) {
        var node = a;
        if (this.xmlHasAttribute(node, "FunctionGroup")) {
            this.functionGroup = this.xmlGetAttribute(node, "FunctionGroup");
        }
        if (this.xmlHasAttribute(node, "Function")) {
            this.function = this.xmlGetAttribute(node, "Function");
        }
        if (this.xmlHasAttribute(node, "SequenceNumber")) {
            this.sequenceNumber = (this.xmlGetAttribute(node, "SequenceNumber") ? parseInt(this.xmlGetAttribute(node, "SequenceNumber")) : 0);
        }
        if (this.xmlHasAttribute(node, "ResultCode")) {
            this.resultCode = (this.xmlGetAttribute(node, "ResultCode") ? parseInt(this.xmlGetAttribute(node, "ResultCode")) : 0);
        }
        if (this.xmlHasAttribute(node, "TimeStamp")) {
            this.timeStamp = new timapi.protocol.TimeDate("yyyyMMdd'T'HHmmssZ", this.xmlGetAttribute(node, "TimeStamp"));
        }
        if (this.xmlHasChild(node, "sixml:PrintData")) {
            this.printData = new timapi.protocol.sixml.PrintData(this.xmlGetChild(node, "sixml:PrintData"));
        }
        if (this.xmlHasChild(node, "sixml:Basket")) {
            this.basket = new timapi.protocol.sixml.Basket(this.xmlGetChild(node, "sixml:Basket"));
        }
        if (this.xmlHasChild(node, "sixml:Amount")) {
            this.amount = new timapi.protocol.sixml.Amount(this.xmlGetChild(node, "sixml:Amount"));
        }
        if (this.xmlHasChild(node, "sixml:TransactionInformation")) {
            this.transactionInformation = new timapi.protocol.sixml.TransactionInformation(this.xmlGetChild(node, "sixml:TransactionInformation"));
        }
        return;
    }
    if (arguments.length == 0) {
        this.functionGroup = "FinTransaction";
        this.function = "FinalizePurchase";
        return;
    }
    throw new Error("Invalid argument");
};
timapi.protocol.sixml.Response_FinalizePurchase.prototype = Object.create(timapi.protocol.Message.prototype);
timapi.protocol.sixml.Response_FinalizePurchase.prototype.functionGroup = undefined;
timapi.protocol.sixml.Response_FinalizePurchase.prototype.function = undefined;
timapi.protocol.sixml.Response_FinalizePurchase.prototype.sequenceNumber = undefined;
timapi.protocol.sixml.Response_FinalizePurchase.prototype.resultCode = undefined;
timapi.protocol.sixml.Response_FinalizePurchase.prototype.timeStamp = undefined;
timapi.protocol.sixml.Response_FinalizePurchase.prototype.printData = undefined;
timapi.protocol.sixml.Response_FinalizePurchase.prototype.basket = undefined;
timapi.protocol.sixml.Response_FinalizePurchase.prototype.amount = undefined;
timapi.protocol.sixml.Response_FinalizePurchase.prototype.transactionInformation = undefined;
timapi.protocol.sixml.Response_FinalizePurchase.prototype.toXmlNode = function () {
    var node = new timapi.protocol.XmlNode("sixml:Response");
    this.xmlSetAttribute(node, "xmlns:sixml", "http://www.six-payment-services.com/");
    if (this.functionGroup != undefined) {
        this.xmlSetAttribute(node, "FunctionGroup", this.functionGroup);
    }
    if (this.function != undefined) {
        this.xmlSetAttribute(node, "Function", this.function);
    }
    if (this.sequenceNumber != undefined) {
        this.xmlSetAttribute(node, "SequenceNumber", timapi.utils.StringHelper.makeString(this.sequenceNumber));
    }
    if (this.resultCode != undefined) {
        this.xmlSetAttribute(node, "ResultCode", timapi.utils.StringHelper.makeString(this.resultCode));
    }
    if (this.timeStamp != undefined) {
        this.xmlSetAttribute(node, "TimeStamp", this.timeStamp.format("yyyyMMdd'T'HHmmssZ"));
    }
    if (this.printData != undefined) {
        this.xmlAddChild(node, "sixml:PrintData", this.printData);
    }
    if (this.basket != undefined) {
        this.xmlAddChild(node, "sixml:Basket", this.basket);
    }
    if (this.amount != undefined) {
        this.xmlAddChild(node, "sixml:Amount", this.amount);
    }
    if (this.transactionInformation != undefined) {
        this.xmlAddChild(node, "sixml:TransactionInformation", this.transactionInformation);
    }
    return node;
};
timapi.protocol.sixml.Response_Giro = function (a) {
    if (arguments.length == 1 && a instanceof timapi.protocol.sixml.Response_Giro) {
        var value = a;
        this.functionGroup = value.functionGroup;
        this.function = value.function;
        this.sequenceNumber = value.sequenceNumber;
        this.resultCode = value.resultCode;
        this.timeStamp = value.timeStamp;
        this.amount = value.amount ? new timapi.protocol.sixml.Amount(value.amount) : undefined;
        this.amountSaldo = value.amountSaldo ? new timapi.protocol.sixml.AmountSaldo(value.amountSaldo) : undefined;
        this.disclaimer = value.disclaimer;
        this.printData = value.printData ? new timapi.protocol.sixml.PrintData(value.printData) : undefined;
        this.transactionInformation = value.transactionInformation ? new timapi.protocol.sixml.TransactionInformation(value.transactionInformation) : undefined;
        this.cardData = value.cardData ? new timapi.protocol.sixml.CardData(value.cardData) : undefined;
        return;
    }
    if (arguments.length == 1 && a instanceof timapi.protocol.XmlNode) {
        var node = a;
        if (this.xmlHasAttribute(node, "FunctionGroup")) {
            this.functionGroup = this.xmlGetAttribute(node, "FunctionGroup");
        }
        if (this.xmlHasAttribute(node, "Function")) {
            this.function = this.xmlGetAttribute(node, "Function");
        }
        if (this.xmlHasAttribute(node, "SequenceNumber")) {
            this.sequenceNumber = (this.xmlGetAttribute(node, "SequenceNumber") ? parseInt(this.xmlGetAttribute(node, "SequenceNumber")) : 0);
        }
        if (this.xmlHasAttribute(node, "ResultCode")) {
            this.resultCode = (this.xmlGetAttribute(node, "ResultCode") ? parseInt(this.xmlGetAttribute(node, "ResultCode")) : 0);
        }
        if (this.xmlHasAttribute(node, "TimeStamp")) {
            this.timeStamp = new timapi.protocol.TimeDate("yyyyMMdd'T'HHmmssZ", this.xmlGetAttribute(node, "TimeStamp"));
        }
        if (this.xmlHasChild(node, "sixml:Amount")) {
            this.amount = new timapi.protocol.sixml.Amount(this.xmlGetChild(node, "sixml:Amount"));
        }
        if (this.xmlHasChild(node, "sixml:AmountSaldo")) {
            this.amountSaldo = new timapi.protocol.sixml.AmountSaldo(this.xmlGetChild(node, "sixml:AmountSaldo"));
        }
        if (this.xmlHasChild(node, "sixml:Disclaimer")) {
            this.disclaimer = this.xmlGetChild(node, "sixml:Disclaimer").textContent;
        }
        if (this.xmlHasChild(node, "sixml:PrintData")) {
            this.printData = new timapi.protocol.sixml.PrintData(this.xmlGetChild(node, "sixml:PrintData"));
        }
        if (this.xmlHasChild(node, "sixml:TransactionInformation")) {
            this.transactionInformation = new timapi.protocol.sixml.TransactionInformation(this.xmlGetChild(node, "sixml:TransactionInformation"));
        }
        if (this.xmlHasChild(node, "sixml:CardData")) {
            this.cardData = new timapi.protocol.sixml.CardData(this.xmlGetChild(node, "sixml:CardData"));
        }
        return;
    }
    if (arguments.length == 0) {
        this.functionGroup = "FinTransaction";
        this.function = "Giro";
        return;
    }
    throw new Error("Invalid argument");
};
timapi.protocol.sixml.Response_Giro.prototype = Object.create(timapi.protocol.Message.prototype);
timapi.protocol.sixml.Response_Giro.prototype.functionGroup = undefined;
timapi.protocol.sixml.Response_Giro.prototype.function = undefined;
timapi.protocol.sixml.Response_Giro.prototype.sequenceNumber = undefined;
timapi.protocol.sixml.Response_Giro.prototype.resultCode = undefined;
timapi.protocol.sixml.Response_Giro.prototype.timeStamp = undefined;
timapi.protocol.sixml.Response_Giro.prototype.amount = undefined;
timapi.protocol.sixml.Response_Giro.prototype.amountSaldo = undefined;
timapi.protocol.sixml.Response_Giro.prototype.disclaimer = undefined;
timapi.protocol.sixml.Response_Giro.prototype.printData = undefined;
timapi.protocol.sixml.Response_Giro.prototype.transactionInformation = undefined;
timapi.protocol.sixml.Response_Giro.prototype.cardData = undefined;
timapi.protocol.sixml.Response_Giro.prototype.toXmlNode = function () {
    var node = new timapi.protocol.XmlNode("sixml:Response");
    this.xmlSetAttribute(node, "xmlns:sixml", "http://www.six-payment-services.com/");
    if (this.functionGroup != undefined) {
        this.xmlSetAttribute(node, "FunctionGroup", this.functionGroup);
    }
    if (this.function != undefined) {
        this.xmlSetAttribute(node, "Function", this.function);
    }
    if (this.sequenceNumber != undefined) {
        this.xmlSetAttribute(node, "SequenceNumber", timapi.utils.StringHelper.makeString(this.sequenceNumber));
    }
    if (this.resultCode != undefined) {
        this.xmlSetAttribute(node, "ResultCode", timapi.utils.StringHelper.makeString(this.resultCode));
    }
    if (this.timeStamp != undefined) {
        this.xmlSetAttribute(node, "TimeStamp", this.timeStamp.format("yyyyMMdd'T'HHmmssZ"));
    }
    if (this.amount != undefined) {
        this.xmlAddChild(node, "sixml:Amount", this.amount);
    }
    if (this.amountSaldo != undefined) {
        this.xmlAddChild(node, "sixml:AmountSaldo", this.amountSaldo);
    }
    if (this.disclaimer != undefined) {
        this.xmlAddChild(node, "sixml:Disclaimer", this.disclaimer);
    }
    if (this.printData != undefined) {
        this.xmlAddChild(node, "sixml:PrintData", this.printData);
    }
    if (this.transactionInformation != undefined) {
        this.xmlAddChild(node, "sixml:TransactionInformation", this.transactionInformation);
    }
    if (this.cardData != undefined) {
        this.xmlAddChild(node, "sixml:CardData", this.cardData);
    }
    return node;
};
timapi.protocol.sixml.Response_HardwareInformation = function (a) {
    if (arguments.length == 1 && a instanceof timapi.protocol.sixml.Response_HardwareInformation) {
        var value = a;
        this.functionGroup = value.functionGroup;
        this.function = value.function;
        this.sequenceNumber = value.sequenceNumber;
        this.resultCode = value.resultCode;
        this.timeStamp = value.timeStamp;
        this.errorCode = value.errorCode;
        this.hardwareList = value.hardwareList ? new timapi.protocol.sixml.HardwareList(value.hardwareList) : undefined;
        this.kernelVersionList = value.kernelVersionList ? new timapi.protocol.sixml.KernelVersionList(value.kernelVersionList) : undefined;
        this.settingsList = value.settingsList ? new timapi.protocol.sixml.SettingsList(value.settingsList) : undefined;
        this.statisticsList = value.statisticsList ? new timapi.protocol.sixml.StatisticsList(value.statisticsList) : undefined;
        return;
    }
    if (arguments.length == 1 && a instanceof timapi.protocol.XmlNode) {
        var node = a;
        if (this.xmlHasAttribute(node, "FunctionGroup")) {
            this.functionGroup = this.xmlGetAttribute(node, "FunctionGroup");
        }
        if (this.xmlHasAttribute(node, "Function")) {
            this.function = this.xmlGetAttribute(node, "Function");
        }
        if (this.xmlHasAttribute(node, "SequenceNumber")) {
            this.sequenceNumber = (this.xmlGetAttribute(node, "SequenceNumber") ? parseInt(this.xmlGetAttribute(node, "SequenceNumber")) : 0);
        }
        if (this.xmlHasAttribute(node, "ResultCode")) {
            this.resultCode = (this.xmlGetAttribute(node, "ResultCode") ? parseInt(this.xmlGetAttribute(node, "ResultCode")) : 0);
        }
        if (this.xmlHasAttribute(node, "TimeStamp")) {
            this.timeStamp = new timapi.protocol.TimeDate("yyyyMMdd'T'HHmmssZ", this.xmlGetAttribute(node, "TimeStamp"));
        }
        if (this.xmlHasChild(node, "sixml:ErrorCode")) {
            this.errorCode = (this.xmlGetChild(node, "sixml:ErrorCode").textContent ? parseInt(this.xmlGetChild(node, "sixml:ErrorCode").textContent) : 0);
        }
        if (this.xmlHasChild(node, "sixml:HardwareList")) {
            this.hardwareList = new timapi.protocol.sixml.HardwareList(this.xmlGetChild(node, "sixml:HardwareList"));
        }
        if (this.xmlHasChild(node, "sixml:KernelVersionList")) {
            this.kernelVersionList = new timapi.protocol.sixml.KernelVersionList(this.xmlGetChild(node, "sixml:KernelVersionList"));
        }
        if (this.xmlHasChild(node, "sixml:SettingsList")) {
            this.settingsList = new timapi.protocol.sixml.SettingsList(this.xmlGetChild(node, "sixml:SettingsList"));
        }
        if (this.xmlHasChild(node, "sixml:StatisticsList")) {
            this.statisticsList = new timapi.protocol.sixml.StatisticsList(this.xmlGetChild(node, "sixml:StatisticsList"));
        }
        return;
    }
    if (arguments.length == 0) {
        this.functionGroup = "Status";
        this.function = "HardwareInformation";
        return;
    }
    throw new Error("Invalid argument");
};
timapi.protocol.sixml.Response_HardwareInformation.prototype = Object.create(timapi.protocol.Message.prototype);
timapi.protocol.sixml.Response_HardwareInformation.prototype.functionGroup = undefined;
timapi.protocol.sixml.Response_HardwareInformation.prototype.function = undefined;
timapi.protocol.sixml.Response_HardwareInformation.prototype.sequenceNumber = undefined;
timapi.protocol.sixml.Response_HardwareInformation.prototype.resultCode = undefined;
timapi.protocol.sixml.Response_HardwareInformation.prototype.timeStamp = undefined;
timapi.protocol.sixml.Response_HardwareInformation.prototype.errorCode = undefined;
timapi.protocol.sixml.Response_HardwareInformation.prototype.hardwareList = undefined;
timapi.protocol.sixml.Response_HardwareInformation.prototype.kernelVersionList = undefined;
timapi.protocol.sixml.Response_HardwareInformation.prototype.settingsList = undefined;
timapi.protocol.sixml.Response_HardwareInformation.prototype.statisticsList = undefined;
timapi.protocol.sixml.Response_HardwareInformation.prototype.toXmlNode = function () {
    var node = new timapi.protocol.XmlNode("sixml:Response");
    this.xmlSetAttribute(node, "xmlns:sixml", "http://www.six-payment-services.com/");
    if (this.functionGroup != undefined) {
        this.xmlSetAttribute(node, "FunctionGroup", this.functionGroup);
    }
    if (this.function != undefined) {
        this.xmlSetAttribute(node, "Function", this.function);
    }
    if (this.sequenceNumber != undefined) {
        this.xmlSetAttribute(node, "SequenceNumber", timapi.utils.StringHelper.makeString(this.sequenceNumber));
    }
    if (this.resultCode != undefined) {
        this.xmlSetAttribute(node, "ResultCode", timapi.utils.StringHelper.makeString(this.resultCode));
    }
    if (this.timeStamp != undefined) {
        this.xmlSetAttribute(node, "TimeStamp", this.timeStamp.format("yyyyMMdd'T'HHmmssZ"));
    }
    if (this.errorCode != undefined) {
        this.xmlAddChild(node, "sixml:ErrorCode", timapi.utils.StringHelper.makeString(this.errorCode));
    }
    if (this.hardwareList != undefined) {
        this.xmlAddChild(node, "sixml:HardwareList", this.hardwareList);
    }
    if (this.kernelVersionList != undefined) {
        this.xmlAddChild(node, "sixml:KernelVersionList", this.kernelVersionList);
    }
    if (this.settingsList != undefined) {
        this.xmlAddChild(node, "sixml:SettingsList", this.settingsList);
    }
    if (this.statisticsList != undefined) {
        this.xmlAddChild(node, "sixml:StatisticsList", this.statisticsList);
    }
    return node;
};
timapi.protocol.sixml.Response_InitTransaction = function (a) {
    if (arguments.length == 1 && a instanceof timapi.protocol.sixml.Response_InitTransaction) {
        var value = a;
        this.functionGroup = value.functionGroup;
        this.function = value.function;
        this.sequenceNumber = value.sequenceNumber;
        this.resultCode = value.resultCode;
        this.timeStamp = value.timeStamp;
        this.cardData = value.cardData ? new timapi.protocol.sixml.CardData(value.cardData) : undefined;
        return;
    }
    if (arguments.length == 1 && a instanceof timapi.protocol.XmlNode) {
        var node = a;
        if (this.xmlHasAttribute(node, "FunctionGroup")) {
            this.functionGroup = this.xmlGetAttribute(node, "FunctionGroup");
        }
        if (this.xmlHasAttribute(node, "Function")) {
            this.function = this.xmlGetAttribute(node, "Function");
        }
        if (this.xmlHasAttribute(node, "SequenceNumber")) {
            this.sequenceNumber = (this.xmlGetAttribute(node, "SequenceNumber") ? parseInt(this.xmlGetAttribute(node, "SequenceNumber")) : 0);
        }
        if (this.xmlHasAttribute(node, "ResultCode")) {
            this.resultCode = (this.xmlGetAttribute(node, "ResultCode") ? parseInt(this.xmlGetAttribute(node, "ResultCode")) : 0);
        }
        if (this.xmlHasAttribute(node, "TimeStamp")) {
            this.timeStamp = new timapi.protocol.TimeDate("yyyyMMdd'T'HHmmssZ", this.xmlGetAttribute(node, "TimeStamp"));
        }
        if (this.xmlHasChild(node, "sixml:CardData")) {
            this.cardData = new timapi.protocol.sixml.CardData(this.xmlGetChild(node, "sixml:CardData"));
        }
        return;
    }
    if (arguments.length == 0) {
        this.functionGroup = "NonFinTransaction";
        this.function = "InitTransaction";
        return;
    }
    throw new Error("Invalid argument");
};
timapi.protocol.sixml.Response_InitTransaction.prototype = Object.create(timapi.protocol.Message.prototype);
timapi.protocol.sixml.Response_InitTransaction.prototype.functionGroup = undefined;
timapi.protocol.sixml.Response_InitTransaction.prototype.function = undefined;
timapi.protocol.sixml.Response_InitTransaction.prototype.sequenceNumber = undefined;
timapi.protocol.sixml.Response_InitTransaction.prototype.resultCode = undefined;
timapi.protocol.sixml.Response_InitTransaction.prototype.timeStamp = undefined;
timapi.protocol.sixml.Response_InitTransaction.prototype.cardData = undefined;
timapi.protocol.sixml.Response_InitTransaction.prototype.toXmlNode = function () {
    var node = new timapi.protocol.XmlNode("sixml:Response");
    this.xmlSetAttribute(node, "xmlns:sixml", "http://www.six-payment-services.com/");
    if (this.functionGroup != undefined) {
        this.xmlSetAttribute(node, "FunctionGroup", this.functionGroup);
    }
    if (this.function != undefined) {
        this.xmlSetAttribute(node, "Function", this.function);
    }
    if (this.sequenceNumber != undefined) {
        this.xmlSetAttribute(node, "SequenceNumber", timapi.utils.StringHelper.makeString(this.sequenceNumber));
    }
    if (this.resultCode != undefined) {
        this.xmlSetAttribute(node, "ResultCode", timapi.utils.StringHelper.makeString(this.resultCode));
    }
    if (this.timeStamp != undefined) {
        this.xmlSetAttribute(node, "TimeStamp", this.timeStamp.format("yyyyMMdd'T'HHmmssZ"));
    }
    if (this.cardData != undefined) {
        this.xmlAddChild(node, "sixml:CardData", this.cardData);
    }
    return node;
};
timapi.protocol.sixml.Response_LoadVoucher = function (a) {
    if (arguments.length == 1 && a instanceof timapi.protocol.sixml.Response_LoadVoucher) {
        var value = a;
        this.functionGroup = value.functionGroup;
        this.function = value.function;
        this.sequenceNumber = value.sequenceNumber;
        this.resultCode = value.resultCode;
        this.timeStamp = value.timeStamp;
        this.transactionInformation = value.transactionInformation ? new timapi.protocol.sixml.TransactionInformation(value.transactionInformation) : undefined;
        this.amount = value.amount ? new timapi.protocol.sixml.Amount(value.amount) : undefined;
        this.amountSaldo = value.amountSaldo ? new timapi.protocol.sixml.AmountSaldo(value.amountSaldo) : undefined;
        this.disclaimer = value.disclaimer;
        this.cardData = value.cardData ? new timapi.protocol.sixml.CardData(value.cardData) : undefined;
        this.printData = value.printData ? new timapi.protocol.sixml.PrintData(value.printData) : undefined;
        return;
    }
    if (arguments.length == 1 && a instanceof timapi.protocol.XmlNode) {
        var node = a;
        if (this.xmlHasAttribute(node, "FunctionGroup")) {
            this.functionGroup = this.xmlGetAttribute(node, "FunctionGroup");
        }
        if (this.xmlHasAttribute(node, "Function")) {
            this.function = this.xmlGetAttribute(node, "Function");
        }
        if (this.xmlHasAttribute(node, "SequenceNumber")) {
            this.sequenceNumber = (this.xmlGetAttribute(node, "SequenceNumber") ? parseInt(this.xmlGetAttribute(node, "SequenceNumber")) : 0);
        }
        if (this.xmlHasAttribute(node, "ResultCode")) {
            this.resultCode = (this.xmlGetAttribute(node, "ResultCode") ? parseInt(this.xmlGetAttribute(node, "ResultCode")) : 0);
        }
        if (this.xmlHasAttribute(node, "TimeStamp")) {
            this.timeStamp = new timapi.protocol.TimeDate("yyyyMMdd'T'HHmmssZ", this.xmlGetAttribute(node, "TimeStamp"));
        }
        if (this.xmlHasChild(node, "sixml:TransactionInformation")) {
            this.transactionInformation = new timapi.protocol.sixml.TransactionInformation(this.xmlGetChild(node, "sixml:TransactionInformation"));
        }
        if (this.xmlHasChild(node, "sixml:Amount")) {
            this.amount = new timapi.protocol.sixml.Amount(this.xmlGetChild(node, "sixml:Amount"));
        }
        if (this.xmlHasChild(node, "sixml:AmountSaldo")) {
            this.amountSaldo = new timapi.protocol.sixml.AmountSaldo(this.xmlGetChild(node, "sixml:AmountSaldo"));
        }
        if (this.xmlHasChild(node, "sixml:Disclaimer")) {
            this.disclaimer = this.xmlGetChild(node, "sixml:Disclaimer").textContent;
        }
        if (this.xmlHasChild(node, "sixml:CardData")) {
            this.cardData = new timapi.protocol.sixml.CardData(this.xmlGetChild(node, "sixml:CardData"));
        }
        if (this.xmlHasChild(node, "sixml:PrintData")) {
            this.printData = new timapi.protocol.sixml.PrintData(this.xmlGetChild(node, "sixml:PrintData"));
        }
        return;
    }
    if (arguments.length == 0) {
        this.functionGroup = "FinTransaction";
        this.function = "LoadVoucher";
        return;
    }
    throw new Error("Invalid argument");
};
timapi.protocol.sixml.Response_LoadVoucher.prototype = Object.create(timapi.protocol.Message.prototype);
timapi.protocol.sixml.Response_LoadVoucher.prototype.functionGroup = undefined;
timapi.protocol.sixml.Response_LoadVoucher.prototype.function = undefined;
timapi.protocol.sixml.Response_LoadVoucher.prototype.sequenceNumber = undefined;
timapi.protocol.sixml.Response_LoadVoucher.prototype.resultCode = undefined;
timapi.protocol.sixml.Response_LoadVoucher.prototype.timeStamp = undefined;
timapi.protocol.sixml.Response_LoadVoucher.prototype.transactionInformation = undefined;
timapi.protocol.sixml.Response_LoadVoucher.prototype.amount = undefined;
timapi.protocol.sixml.Response_LoadVoucher.prototype.amountSaldo = undefined;
timapi.protocol.sixml.Response_LoadVoucher.prototype.disclaimer = undefined;
timapi.protocol.sixml.Response_LoadVoucher.prototype.cardData = undefined;
timapi.protocol.sixml.Response_LoadVoucher.prototype.printData = undefined;
timapi.protocol.sixml.Response_LoadVoucher.prototype.toXmlNode = function () {
    var node = new timapi.protocol.XmlNode("sixml:Response");
    this.xmlSetAttribute(node, "xmlns:sixml", "http://www.six-payment-services.com/");
    if (this.functionGroup != undefined) {
        this.xmlSetAttribute(node, "FunctionGroup", this.functionGroup);
    }
    if (this.function != undefined) {
        this.xmlSetAttribute(node, "Function", this.function);
    }
    if (this.sequenceNumber != undefined) {
        this.xmlSetAttribute(node, "SequenceNumber", timapi.utils.StringHelper.makeString(this.sequenceNumber));
    }
    if (this.resultCode != undefined) {
        this.xmlSetAttribute(node, "ResultCode", timapi.utils.StringHelper.makeString(this.resultCode));
    }
    if (this.timeStamp != undefined) {
        this.xmlSetAttribute(node, "TimeStamp", this.timeStamp.format("yyyyMMdd'T'HHmmssZ"));
    }
    if (this.transactionInformation != undefined) {
        this.xmlAddChild(node, "sixml:TransactionInformation", this.transactionInformation);
    }
    if (this.amount != undefined) {
        this.xmlAddChild(node, "sixml:Amount", this.amount);
    }
    if (this.amountSaldo != undefined) {
        this.xmlAddChild(node, "sixml:AmountSaldo", this.amountSaldo);
    }
    if (this.disclaimer != undefined) {
        this.xmlAddChild(node, "sixml:Disclaimer", this.disclaimer);
    }
    if (this.cardData != undefined) {
        this.xmlAddChild(node, "sixml:CardData", this.cardData);
    }
    if (this.printData != undefined) {
        this.xmlAddChild(node, "sixml:PrintData", this.printData);
    }
    return node;
};
timapi.protocol.sixml.Response_Login = function (a) {
    if (arguments.length == 1 && a instanceof timapi.protocol.sixml.Response_Login) {
        var value = a;
        this.functionGroup = value.functionGroup;
        this.function = value.function;
        this.sequenceNumber = value.sequenceNumber;
        this.resultCode = value.resultCode;
        this.timeStamp = value.timeStamp;
        return;
    }
    if (arguments.length == 1 && a instanceof timapi.protocol.XmlNode) {
        var node = a;
        if (this.xmlHasAttribute(node, "FunctionGroup")) {
            this.functionGroup = this.xmlGetAttribute(node, "FunctionGroup");
        }
        if (this.xmlHasAttribute(node, "Function")) {
            this.function = this.xmlGetAttribute(node, "Function");
        }
        if (this.xmlHasAttribute(node, "SequenceNumber")) {
            this.sequenceNumber = (this.xmlGetAttribute(node, "SequenceNumber") ? parseInt(this.xmlGetAttribute(node, "SequenceNumber")) : 0);
        }
        if (this.xmlHasAttribute(node, "ResultCode")) {
            this.resultCode = (this.xmlGetAttribute(node, "ResultCode") ? parseInt(this.xmlGetAttribute(node, "ResultCode")) : 0);
        }
        if (this.xmlHasAttribute(node, "TimeStamp")) {
            this.timeStamp = new timapi.protocol.TimeDate("yyyyMMdd'T'HHmmssZ", this.xmlGetAttribute(node, "TimeStamp"));
        }
        return;
    }
    if (arguments.length == 0) {
        this.functionGroup = "Admin";
        this.function = "Login";
        return;
    }
    throw new Error("Invalid argument");
};
timapi.protocol.sixml.Response_Login.prototype = Object.create(timapi.protocol.Message.prototype);
timapi.protocol.sixml.Response_Login.prototype.functionGroup = undefined;
timapi.protocol.sixml.Response_Login.prototype.function = undefined;
timapi.protocol.sixml.Response_Login.prototype.sequenceNumber = undefined;
timapi.protocol.sixml.Response_Login.prototype.resultCode = undefined;
timapi.protocol.sixml.Response_Login.prototype.timeStamp = undefined;
timapi.protocol.sixml.Response_Login.prototype.toXmlNode = function () {
    var node = new timapi.protocol.XmlNode("sixml:Response");
    this.xmlSetAttribute(node, "xmlns:sixml", "http://www.six-payment-services.com/");
    if (this.functionGroup != undefined) {
        this.xmlSetAttribute(node, "FunctionGroup", this.functionGroup);
    }
    if (this.function != undefined) {
        this.xmlSetAttribute(node, "Function", this.function);
    }
    if (this.sequenceNumber != undefined) {
        this.xmlSetAttribute(node, "SequenceNumber", timapi.utils.StringHelper.makeString(this.sequenceNumber));
    }
    if (this.resultCode != undefined) {
        this.xmlSetAttribute(node, "ResultCode", timapi.utils.StringHelper.makeString(this.resultCode));
    }
    if (this.timeStamp != undefined) {
        this.xmlSetAttribute(node, "TimeStamp", this.timeStamp.format("yyyyMMdd'T'HHmmssZ"));
    }
    return node;
};
timapi.protocol.sixml.Response_Logout = function (a) {
    if (arguments.length == 1 && a instanceof timapi.protocol.sixml.Response_Logout) {
        var value = a;
        this.functionGroup = value.functionGroup;
        this.function = value.function;
        this.sequenceNumber = value.sequenceNumber;
        this.resultCode = value.resultCode;
        this.timeStamp = value.timeStamp;
        return;
    }
    if (arguments.length == 1 && a instanceof timapi.protocol.XmlNode) {
        var node = a;
        if (this.xmlHasAttribute(node, "FunctionGroup")) {
            this.functionGroup = this.xmlGetAttribute(node, "FunctionGroup");
        }
        if (this.xmlHasAttribute(node, "Function")) {
            this.function = this.xmlGetAttribute(node, "Function");
        }
        if (this.xmlHasAttribute(node, "SequenceNumber")) {
            this.sequenceNumber = (this.xmlGetAttribute(node, "SequenceNumber") ? parseInt(this.xmlGetAttribute(node, "SequenceNumber")) : 0);
        }
        if (this.xmlHasAttribute(node, "ResultCode")) {
            this.resultCode = (this.xmlGetAttribute(node, "ResultCode") ? parseInt(this.xmlGetAttribute(node, "ResultCode")) : 0);
        }
        if (this.xmlHasAttribute(node, "TimeStamp")) {
            this.timeStamp = new timapi.protocol.TimeDate("yyyyMMdd'T'HHmmssZ", this.xmlGetAttribute(node, "TimeStamp"));
        }
        return;
    }
    if (arguments.length == 0) {
        this.functionGroup = "Admin";
        this.function = "Logout";
        return;
    }
    throw new Error("Invalid argument");
};
timapi.protocol.sixml.Response_Logout.prototype = Object.create(timapi.protocol.Message.prototype);
timapi.protocol.sixml.Response_Logout.prototype.functionGroup = undefined;
timapi.protocol.sixml.Response_Logout.prototype.function = undefined;
timapi.protocol.sixml.Response_Logout.prototype.sequenceNumber = undefined;
timapi.protocol.sixml.Response_Logout.prototype.resultCode = undefined;
timapi.protocol.sixml.Response_Logout.prototype.timeStamp = undefined;
timapi.protocol.sixml.Response_Logout.prototype.toXmlNode = function () {
    var node = new timapi.protocol.XmlNode("sixml:Response");
    this.xmlSetAttribute(node, "xmlns:sixml", "http://www.six-payment-services.com/");
    if (this.functionGroup != undefined) {
        this.xmlSetAttribute(node, "FunctionGroup", this.functionGroup);
    }
    if (this.function != undefined) {
        this.xmlSetAttribute(node, "Function", this.function);
    }
    if (this.sequenceNumber != undefined) {
        this.xmlSetAttribute(node, "SequenceNumber", timapi.utils.StringHelper.makeString(this.sequenceNumber));
    }
    if (this.resultCode != undefined) {
        this.xmlSetAttribute(node, "ResultCode", timapi.utils.StringHelper.makeString(this.resultCode));
    }
    if (this.timeStamp != undefined) {
        this.xmlSetAttribute(node, "TimeStamp", this.timeStamp.format("yyyyMMdd'T'HHmmssZ"));
    }
    return node;
};
timapi.protocol.sixml.Response_OpenDialogMode = function (a) {
    if (arguments.length == 1 && a instanceof timapi.protocol.sixml.Response_OpenDialogMode) {
        var value = a;
        this.functionGroup = value.functionGroup;
        this.function = value.function;
        this.sequenceNumber = value.sequenceNumber;
        this.resultCode = value.resultCode;
        this.timeStamp = value.timeStamp;
        return;
    }
    if (arguments.length == 1 && a instanceof timapi.protocol.XmlNode) {
        var node = a;
        if (this.xmlHasAttribute(node, "FunctionGroup")) {
            this.functionGroup = this.xmlGetAttribute(node, "FunctionGroup");
        }
        if (this.xmlHasAttribute(node, "Function")) {
            this.function = this.xmlGetAttribute(node, "Function");
        }
        if (this.xmlHasAttribute(node, "SequenceNumber")) {
            this.sequenceNumber = (this.xmlGetAttribute(node, "SequenceNumber") ? parseInt(this.xmlGetAttribute(node, "SequenceNumber")) : 0);
        }
        if (this.xmlHasAttribute(node, "ResultCode")) {
            this.resultCode = (this.xmlGetAttribute(node, "ResultCode") ? parseInt(this.xmlGetAttribute(node, "ResultCode")) : 0);
        }
        if (this.xmlHasAttribute(node, "TimeStamp")) {
            this.timeStamp = new timapi.protocol.TimeDate("yyyyMMdd'T'HHmmssZ", this.xmlGetAttribute(node, "TimeStamp"));
        }
        return;
    }
    if (arguments.length == 0) {
        this.functionGroup = "Admin";
        this.function = "OpenDialogMode";
        return;
    }
    throw new Error("Invalid argument");
};
timapi.protocol.sixml.Response_OpenDialogMode.prototype = Object.create(timapi.protocol.Message.prototype);
timapi.protocol.sixml.Response_OpenDialogMode.prototype.functionGroup = undefined;
timapi.protocol.sixml.Response_OpenDialogMode.prototype.function = undefined;
timapi.protocol.sixml.Response_OpenDialogMode.prototype.sequenceNumber = undefined;
timapi.protocol.sixml.Response_OpenDialogMode.prototype.resultCode = undefined;
timapi.protocol.sixml.Response_OpenDialogMode.prototype.timeStamp = undefined;
timapi.protocol.sixml.Response_OpenDialogMode.prototype.toXmlNode = function () {
    var node = new timapi.protocol.XmlNode("sixml:Response");
    this.xmlSetAttribute(node, "xmlns:sixml", "http://www.six-payment-services.com/");
    if (this.functionGroup != undefined) {
        this.xmlSetAttribute(node, "FunctionGroup", this.functionGroup);
    }
    if (this.function != undefined) {
        this.xmlSetAttribute(node, "Function", this.function);
    }
    if (this.sequenceNumber != undefined) {
        this.xmlSetAttribute(node, "SequenceNumber", timapi.utils.StringHelper.makeString(this.sequenceNumber));
    }
    if (this.resultCode != undefined) {
        this.xmlSetAttribute(node, "ResultCode", timapi.utils.StringHelper.makeString(this.resultCode));
    }
    if (this.timeStamp != undefined) {
        this.xmlSetAttribute(node, "TimeStamp", this.timeStamp.format("yyyyMMdd'T'HHmmssZ"));
    }
    return node;
};
timapi.protocol.sixml.Response_OpenMaintenanceWindow = function (a) {
    if (arguments.length == 1 && a instanceof timapi.protocol.sixml.Response_OpenMaintenanceWindow) {
        var value = a;
        this.functionGroup = value.functionGroup;
        this.function = value.function;
        this.sequenceNumber = value.sequenceNumber;
        this.resultCode = value.resultCode;
        this.timeStamp = value.timeStamp;
        return;
    }
    if (arguments.length == 1 && a instanceof timapi.protocol.XmlNode) {
        var node = a;
        if (this.xmlHasAttribute(node, "FunctionGroup")) {
            this.functionGroup = this.xmlGetAttribute(node, "FunctionGroup");
        }
        if (this.xmlHasAttribute(node, "Function")) {
            this.function = this.xmlGetAttribute(node, "Function");
        }
        if (this.xmlHasAttribute(node, "SequenceNumber")) {
            this.sequenceNumber = (this.xmlGetAttribute(node, "SequenceNumber") ? parseInt(this.xmlGetAttribute(node, "SequenceNumber")) : 0);
        }
        if (this.xmlHasAttribute(node, "ResultCode")) {
            this.resultCode = (this.xmlGetAttribute(node, "ResultCode") ? parseInt(this.xmlGetAttribute(node, "ResultCode")) : 0);
        }
        if (this.xmlHasAttribute(node, "TimeStamp")) {
            this.timeStamp = new timapi.protocol.TimeDate("yyyyMMdd'T'HHmmssZ", this.xmlGetAttribute(node, "TimeStamp"));
        }
        return;
    }
    if (arguments.length == 0) {
        this.functionGroup = "Admin";
        this.function = "OpenMaintenanceWindow";
        return;
    }
    throw new Error("Invalid argument");
};
timapi.protocol.sixml.Response_OpenMaintenanceWindow.prototype = Object.create(timapi.protocol.Message.prototype);
timapi.protocol.sixml.Response_OpenMaintenanceWindow.prototype.functionGroup = undefined;
timapi.protocol.sixml.Response_OpenMaintenanceWindow.prototype.function = undefined;
timapi.protocol.sixml.Response_OpenMaintenanceWindow.prototype.sequenceNumber = undefined;
timapi.protocol.sixml.Response_OpenMaintenanceWindow.prototype.resultCode = undefined;
timapi.protocol.sixml.Response_OpenMaintenanceWindow.prototype.timeStamp = undefined;
timapi.protocol.sixml.Response_OpenMaintenanceWindow.prototype.toXmlNode = function () {
    var node = new timapi.protocol.XmlNode("sixml:Response");
    this.xmlSetAttribute(node, "xmlns:sixml", "http://www.six-payment-services.com/");
    if (this.functionGroup != undefined) {
        this.xmlSetAttribute(node, "FunctionGroup", this.functionGroup);
    }
    if (this.function != undefined) {
        this.xmlSetAttribute(node, "Function", this.function);
    }
    if (this.sequenceNumber != undefined) {
        this.xmlSetAttribute(node, "SequenceNumber", timapi.utils.StringHelper.makeString(this.sequenceNumber));
    }
    if (this.resultCode != undefined) {
        this.xmlSetAttribute(node, "ResultCode", timapi.utils.StringHelper.makeString(this.resultCode));
    }
    if (this.timeStamp != undefined) {
        this.xmlSetAttribute(node, "TimeStamp", this.timeStamp.format("yyyyMMdd'T'HHmmssZ"));
    }
    return node;
};
timapi.protocol.sixml.Response_OpenReader = function (a) {
    if (arguments.length == 1 && a instanceof timapi.protocol.sixml.Response_OpenReader) {
        var value = a;
        this.functionGroup = value.functionGroup;
        this.function = value.function;
        this.sequenceNumber = value.sequenceNumber;
        this.resultCode = value.resultCode;
        this.timeStamp = value.timeStamp;
        return;
    }
    if (arguments.length == 1 && a instanceof timapi.protocol.XmlNode) {
        var node = a;
        if (this.xmlHasAttribute(node, "FunctionGroup")) {
            this.functionGroup = this.xmlGetAttribute(node, "FunctionGroup");
        }
        if (this.xmlHasAttribute(node, "Function")) {
            this.function = this.xmlGetAttribute(node, "Function");
        }
        if (this.xmlHasAttribute(node, "SequenceNumber")) {
            this.sequenceNumber = (this.xmlGetAttribute(node, "SequenceNumber") ? parseInt(this.xmlGetAttribute(node, "SequenceNumber")) : 0);
        }
        if (this.xmlHasAttribute(node, "ResultCode")) {
            this.resultCode = (this.xmlGetAttribute(node, "ResultCode") ? parseInt(this.xmlGetAttribute(node, "ResultCode")) : 0);
        }
        if (this.xmlHasAttribute(node, "TimeStamp")) {
            this.timeStamp = new timapi.protocol.TimeDate("yyyyMMdd'T'HHmmssZ", this.xmlGetAttribute(node, "TimeStamp"));
        }
        return;
    }
    if (arguments.length == 0) {
        this.functionGroup = "Admin";
        this.function = "OpenReader";
        return;
    }
    throw new Error("Invalid argument");
};
timapi.protocol.sixml.Response_OpenReader.prototype = Object.create(timapi.protocol.Message.prototype);
timapi.protocol.sixml.Response_OpenReader.prototype.functionGroup = undefined;
timapi.protocol.sixml.Response_OpenReader.prototype.function = undefined;
timapi.protocol.sixml.Response_OpenReader.prototype.sequenceNumber = undefined;
timapi.protocol.sixml.Response_OpenReader.prototype.resultCode = undefined;
timapi.protocol.sixml.Response_OpenReader.prototype.timeStamp = undefined;
timapi.protocol.sixml.Response_OpenReader.prototype.toXmlNode = function () {
    var node = new timapi.protocol.XmlNode("sixml:Response");
    this.xmlSetAttribute(node, "xmlns:sixml", "http://www.six-payment-services.com/");
    if (this.functionGroup != undefined) {
        this.xmlSetAttribute(node, "FunctionGroup", this.functionGroup);
    }
    if (this.function != undefined) {
        this.xmlSetAttribute(node, "Function", this.function);
    }
    if (this.sequenceNumber != undefined) {
        this.xmlSetAttribute(node, "SequenceNumber", timapi.utils.StringHelper.makeString(this.sequenceNumber));
    }
    if (this.resultCode != undefined) {
        this.xmlSetAttribute(node, "ResultCode", timapi.utils.StringHelper.makeString(this.resultCode));
    }
    if (this.timeStamp != undefined) {
        this.xmlSetAttribute(node, "TimeStamp", this.timeStamp.format("yyyyMMdd'T'HHmmssZ"));
    }
    return node;
};
timapi.protocol.sixml.Response_PreAuthorization = function (a) {
    if (arguments.length == 1 && a instanceof timapi.protocol.sixml.Response_PreAuthorization) {
        var value = a;
        this.functionGroup = value.functionGroup;
        this.function = value.function;
        this.sequenceNumber = value.sequenceNumber;
        this.resultCode = value.resultCode;
        this.timeStamp = value.timeStamp;
        this.amount = value.amount ? new timapi.protocol.sixml.Amount(value.amount) : undefined;
        this.amountDcc = value.amountDcc ? new timapi.protocol.sixml.AmountDcc(value.amountDcc) : undefined;
        this.basket = value.basket ? new timapi.protocol.sixml.Basket(value.basket) : undefined;
        this.additionalInfoList = value.additionalInfoList ? new timapi.protocol.sixml.AdditionalInfoList(value.additionalInfoList) : undefined;
        this.printData = value.printData ? new timapi.protocol.sixml.PrintData(value.printData) : undefined;
        this.dccDisclaimer = value.dccDisclaimer;
        this.disclaimer = value.disclaimer;
        this.amountSaldo = value.amountSaldo ? new timapi.protocol.sixml.AmountSaldo(value.amountSaldo) : undefined;
        this.cardData = value.cardData ? new timapi.protocol.sixml.CardData(value.cardData) : undefined;
        this.transactionInformation = value.transactionInformation ? new timapi.protocol.sixml.TransactionInformation(value.transactionInformation) : undefined;
        return;
    }
    if (arguments.length == 1 && a instanceof timapi.protocol.XmlNode) {
        var node = a;
        if (this.xmlHasAttribute(node, "FunctionGroup")) {
            this.functionGroup = this.xmlGetAttribute(node, "FunctionGroup");
        }
        if (this.xmlHasAttribute(node, "Function")) {
            this.function = this.xmlGetAttribute(node, "Function");
        }
        if (this.xmlHasAttribute(node, "SequenceNumber")) {
            this.sequenceNumber = (this.xmlGetAttribute(node, "SequenceNumber") ? parseInt(this.xmlGetAttribute(node, "SequenceNumber")) : 0);
        }
        if (this.xmlHasAttribute(node, "ResultCode")) {
            this.resultCode = (this.xmlGetAttribute(node, "ResultCode") ? parseInt(this.xmlGetAttribute(node, "ResultCode")) : 0);
        }
        if (this.xmlHasAttribute(node, "TimeStamp")) {
            this.timeStamp = new timapi.protocol.TimeDate("yyyyMMdd'T'HHmmssZ", this.xmlGetAttribute(node, "TimeStamp"));
        }
        if (this.xmlHasChild(node, "sixml:Amount")) {
            this.amount = new timapi.protocol.sixml.Amount(this.xmlGetChild(node, "sixml:Amount"));
        }
        if (this.xmlHasChild(node, "sixml:AmountDcc")) {
            this.amountDcc = new timapi.protocol.sixml.AmountDcc(this.xmlGetChild(node, "sixml:AmountDcc"));
        }
        if (this.xmlHasChild(node, "sixml:Basket")) {
            this.basket = new timapi.protocol.sixml.Basket(this.xmlGetChild(node, "sixml:Basket"));
        }
        if (this.xmlHasChild(node, "sixml:AdditionalInfoList")) {
            this.additionalInfoList = new timapi.protocol.sixml.AdditionalInfoList(this.xmlGetChild(node, "sixml:AdditionalInfoList"));
        }
        if (this.xmlHasChild(node, "sixml:PrintData")) {
            this.printData = new timapi.protocol.sixml.PrintData(this.xmlGetChild(node, "sixml:PrintData"));
        }
        if (this.xmlHasChild(node, "sixml:DccDisclaimer")) {
            this.dccDisclaimer = this.xmlGetChild(node, "sixml:DccDisclaimer").textContent;
        }
        if (this.xmlHasChild(node, "sixml:Disclaimer")) {
            this.disclaimer = this.xmlGetChild(node, "sixml:Disclaimer").textContent;
        }
        if (this.xmlHasChild(node, "sixml:AmountSaldo")) {
            this.amountSaldo = new timapi.protocol.sixml.AmountSaldo(this.xmlGetChild(node, "sixml:AmountSaldo"));
        }
        if (this.xmlHasChild(node, "sixml:CardData")) {
            this.cardData = new timapi.protocol.sixml.CardData(this.xmlGetChild(node, "sixml:CardData"));
        }
        if (this.xmlHasChild(node, "sixml:TransactionInformation")) {
            this.transactionInformation = new timapi.protocol.sixml.TransactionInformation(this.xmlGetChild(node, "sixml:TransactionInformation"));
        }
        return;
    }
    if (arguments.length == 0) {
        this.functionGroup = "FinTransaction";
        this.function = "PreAuthorization";
        return;
    }
    throw new Error("Invalid argument");
};
timapi.protocol.sixml.Response_PreAuthorization.prototype = Object.create(timapi.protocol.Message.prototype);
timapi.protocol.sixml.Response_PreAuthorization.prototype.functionGroup = undefined;
timapi.protocol.sixml.Response_PreAuthorization.prototype.function = undefined;
timapi.protocol.sixml.Response_PreAuthorization.prototype.sequenceNumber = undefined;
timapi.protocol.sixml.Response_PreAuthorization.prototype.resultCode = undefined;
timapi.protocol.sixml.Response_PreAuthorization.prototype.timeStamp = undefined;
timapi.protocol.sixml.Response_PreAuthorization.prototype.amount = undefined;
timapi.protocol.sixml.Response_PreAuthorization.prototype.amountDcc = undefined;
timapi.protocol.sixml.Response_PreAuthorization.prototype.basket = undefined;
timapi.protocol.sixml.Response_PreAuthorization.prototype.additionalInfoList = undefined;
timapi.protocol.sixml.Response_PreAuthorization.prototype.printData = undefined;
timapi.protocol.sixml.Response_PreAuthorization.prototype.dccDisclaimer = undefined;
timapi.protocol.sixml.Response_PreAuthorization.prototype.disclaimer = undefined;
timapi.protocol.sixml.Response_PreAuthorization.prototype.amountSaldo = undefined;
timapi.protocol.sixml.Response_PreAuthorization.prototype.cardData = undefined;
timapi.protocol.sixml.Response_PreAuthorization.prototype.transactionInformation = undefined;
timapi.protocol.sixml.Response_PreAuthorization.prototype.toXmlNode = function () {
    var node = new timapi.protocol.XmlNode("sixml:Response");
    this.xmlSetAttribute(node, "xmlns:sixml", "http://www.six-payment-services.com/");
    if (this.functionGroup != undefined) {
        this.xmlSetAttribute(node, "FunctionGroup", this.functionGroup);
    }
    if (this.function != undefined) {
        this.xmlSetAttribute(node, "Function", this.function);
    }
    if (this.sequenceNumber != undefined) {
        this.xmlSetAttribute(node, "SequenceNumber", timapi.utils.StringHelper.makeString(this.sequenceNumber));
    }
    if (this.resultCode != undefined) {
        this.xmlSetAttribute(node, "ResultCode", timapi.utils.StringHelper.makeString(this.resultCode));
    }
    if (this.timeStamp != undefined) {
        this.xmlSetAttribute(node, "TimeStamp", this.timeStamp.format("yyyyMMdd'T'HHmmssZ"));
    }
    if (this.amount != undefined) {
        this.xmlAddChild(node, "sixml:Amount", this.amount);
    }
    if (this.amountDcc != undefined) {
        this.xmlAddChild(node, "sixml:AmountDcc", this.amountDcc);
    }
    if (this.basket != undefined) {
        this.xmlAddChild(node, "sixml:Basket", this.basket);
    }
    if (this.additionalInfoList != undefined) {
        this.xmlAddChild(node, "sixml:AdditionalInfoList", this.additionalInfoList);
    }
    if (this.printData != undefined) {
        this.xmlAddChild(node, "sixml:PrintData", this.printData);
    }
    if (this.dccDisclaimer != undefined) {
        this.xmlAddChild(node, "sixml:DccDisclaimer", this.dccDisclaimer);
    }
    if (this.disclaimer != undefined) {
        this.xmlAddChild(node, "sixml:Disclaimer", this.disclaimer);
    }
    if (this.amountSaldo != undefined) {
        this.xmlAddChild(node, "sixml:AmountSaldo", this.amountSaldo);
    }
    if (this.cardData != undefined) {
        this.xmlAddChild(node, "sixml:CardData", this.cardData);
    }
    if (this.transactionInformation != undefined) {
        this.xmlAddChild(node, "sixml:TransactionInformation", this.transactionInformation);
    }
    return node;
};
timapi.protocol.sixml.Response_Purchase = function (a) {
    if (arguments.length == 1 && a instanceof timapi.protocol.sixml.Response_Purchase) {
        var value = a;
        this.functionGroup = value.functionGroup;
        this.function = value.function;
        this.sequenceNumber = value.sequenceNumber;
        this.resultCode = value.resultCode;
        this.timeStamp = value.timeStamp;
        this.transactionInformation = value.transactionInformation ? new timapi.protocol.sixml.TransactionInformation(value.transactionInformation) : undefined;
        this.amount = value.amount ? new timapi.protocol.sixml.Amount(value.amount) : undefined;
        this.amountDue = value.amountDue ? new timapi.protocol.sixml.AmountDue(value.amountDue) : undefined;
        this.amountDcc = value.amountDcc ? new timapi.protocol.sixml.AmountDcc(value.amountDcc) : undefined;
        this.amountSaldo = value.amountSaldo ? new timapi.protocol.sixml.AmountSaldo(value.amountSaldo) : undefined;
        this.dccDisclaimer = value.dccDisclaimer;
        this.disclaimer = value.disclaimer;
        this.cardData = value.cardData ? new timapi.protocol.sixml.CardData(value.cardData) : undefined;
        this.printData = value.printData ? new timapi.protocol.sixml.PrintData(value.printData) : undefined;
        this.basket = value.basket ? new timapi.protocol.sixml.Basket(value.basket) : undefined;
        this.additionalInfoList = value.additionalInfoList ? new timapi.protocol.sixml.AdditionalInfoList(value.additionalInfoList) : undefined;
        this.amountTip = value.amountTip ? new timapi.protocol.sixml.AmountTip(value.amountTip) : undefined;
        this.loyaltyCashbackAmount = value.loyaltyCashbackAmount ? new timapi.protocol.sixml.LoyaltyCashbackAmount(value.loyaltyCashbackAmount) : undefined;
        return;
    }
    if (arguments.length == 1 && a instanceof timapi.protocol.XmlNode) {
        var node = a;
        if (this.xmlHasAttribute(node, "FunctionGroup")) {
            this.functionGroup = this.xmlGetAttribute(node, "FunctionGroup");
        }
        if (this.xmlHasAttribute(node, "Function")) {
            this.function = this.xmlGetAttribute(node, "Function");
        }
        if (this.xmlHasAttribute(node, "SequenceNumber")) {
            this.sequenceNumber = (this.xmlGetAttribute(node, "SequenceNumber") ? parseInt(this.xmlGetAttribute(node, "SequenceNumber")) : 0);
        }
        if (this.xmlHasAttribute(node, "ResultCode")) {
            this.resultCode = (this.xmlGetAttribute(node, "ResultCode") ? parseInt(this.xmlGetAttribute(node, "ResultCode")) : 0);
        }
        if (this.xmlHasAttribute(node, "TimeStamp")) {
            this.timeStamp = new timapi.protocol.TimeDate("yyyyMMdd'T'HHmmssZ", this.xmlGetAttribute(node, "TimeStamp"));
        }
        if (this.xmlHasChild(node, "sixml:TransactionInformation")) {
            this.transactionInformation = new timapi.protocol.sixml.TransactionInformation(this.xmlGetChild(node, "sixml:TransactionInformation"));
        }
        if (this.xmlHasChild(node, "sixml:Amount")) {
            this.amount = new timapi.protocol.sixml.Amount(this.xmlGetChild(node, "sixml:Amount"));
        }
        if (this.xmlHasChild(node, "sixml:AmountDue")) {
            this.amountDue = new timapi.protocol.sixml.AmountDue(this.xmlGetChild(node, "sixml:AmountDue"));
        }
        if (this.xmlHasChild(node, "sixml:AmountDcc")) {
            this.amountDcc = new timapi.protocol.sixml.AmountDcc(this.xmlGetChild(node, "sixml:AmountDcc"));
        }
        if (this.xmlHasChild(node, "sixml:AmountSaldo")) {
            this.amountSaldo = new timapi.protocol.sixml.AmountSaldo(this.xmlGetChild(node, "sixml:AmountSaldo"));
        }
        if (this.xmlHasChild(node, "sixml:DccDisclaimer")) {
            this.dccDisclaimer = this.xmlGetChild(node, "sixml:DccDisclaimer").textContent;
        }
        if (this.xmlHasChild(node, "sixml:Disclaimer")) {
            this.disclaimer = this.xmlGetChild(node, "sixml:Disclaimer").textContent;
        }
        if (this.xmlHasChild(node, "sixml:CardData")) {
            this.cardData = new timapi.protocol.sixml.CardData(this.xmlGetChild(node, "sixml:CardData"));
        }
        if (this.xmlHasChild(node, "sixml:PrintData")) {
            this.printData = new timapi.protocol.sixml.PrintData(this.xmlGetChild(node, "sixml:PrintData"));
        }
        if (this.xmlHasChild(node, "sixml:Basket")) {
            this.basket = new timapi.protocol.sixml.Basket(this.xmlGetChild(node, "sixml:Basket"));
        }
        if (this.xmlHasChild(node, "sixml:AdditionalInfoList")) {
            this.additionalInfoList = new timapi.protocol.sixml.AdditionalInfoList(this.xmlGetChild(node, "sixml:AdditionalInfoList"));
        }
        if (this.xmlHasChild(node, "sixml:AmountTip")) {
            this.amountTip = new timapi.protocol.sixml.AmountTip(this.xmlGetChild(node, "sixml:AmountTip"));
        }
        if (this.xmlHasChild(node, "sixml:LoyaltyCashbackAmount")) {
            this.loyaltyCashbackAmount = new timapi.protocol.sixml.LoyaltyCashbackAmount(this.xmlGetChild(node, "sixml:LoyaltyCashbackAmount"));
        }
        return;
    }
    if (arguments.length == 0) {
        this.functionGroup = "FinTransaction";
        this.function = "Purchase";
        return;
    }
    throw new Error("Invalid argument");
};
timapi.protocol.sixml.Response_Purchase.prototype = Object.create(timapi.protocol.Message.prototype);
timapi.protocol.sixml.Response_Purchase.prototype.functionGroup = undefined;
timapi.protocol.sixml.Response_Purchase.prototype.function = undefined;
timapi.protocol.sixml.Response_Purchase.prototype.sequenceNumber = undefined;
timapi.protocol.sixml.Response_Purchase.prototype.resultCode = undefined;
timapi.protocol.sixml.Response_Purchase.prototype.timeStamp = undefined;
timapi.protocol.sixml.Response_Purchase.prototype.transactionInformation = undefined;
timapi.protocol.sixml.Response_Purchase.prototype.amount = undefined;
timapi.protocol.sixml.Response_Purchase.prototype.amountDue = undefined;
timapi.protocol.sixml.Response_Purchase.prototype.amountDcc = undefined;
timapi.protocol.sixml.Response_Purchase.prototype.amountSaldo = undefined;
timapi.protocol.sixml.Response_Purchase.prototype.dccDisclaimer = undefined;
timapi.protocol.sixml.Response_Purchase.prototype.disclaimer = undefined;
timapi.protocol.sixml.Response_Purchase.prototype.cardData = undefined;
timapi.protocol.sixml.Response_Purchase.prototype.printData = undefined;
timapi.protocol.sixml.Response_Purchase.prototype.basket = undefined;
timapi.protocol.sixml.Response_Purchase.prototype.additionalInfoList = undefined;
timapi.protocol.sixml.Response_Purchase.prototype.amountTip = undefined;
timapi.protocol.sixml.Response_Purchase.prototype.loyaltyCashbackAmount = undefined;
timapi.protocol.sixml.Response_Purchase.prototype.toXmlNode = function () {
    var node = new timapi.protocol.XmlNode("sixml:Response");
    this.xmlSetAttribute(node, "xmlns:sixml", "http://www.six-payment-services.com/");
    if (this.functionGroup != undefined) {
        this.xmlSetAttribute(node, "FunctionGroup", this.functionGroup);
    }
    if (this.function != undefined) {
        this.xmlSetAttribute(node, "Function", this.function);
    }
    if (this.sequenceNumber != undefined) {
        this.xmlSetAttribute(node, "SequenceNumber", timapi.utils.StringHelper.makeString(this.sequenceNumber));
    }
    if (this.resultCode != undefined) {
        this.xmlSetAttribute(node, "ResultCode", timapi.utils.StringHelper.makeString(this.resultCode));
    }
    if (this.timeStamp != undefined) {
        this.xmlSetAttribute(node, "TimeStamp", this.timeStamp.format("yyyyMMdd'T'HHmmssZ"));
    }
    if (this.transactionInformation != undefined) {
        this.xmlAddChild(node, "sixml:TransactionInformation", this.transactionInformation);
    }
    if (this.amount != undefined) {
        this.xmlAddChild(node, "sixml:Amount", this.amount);
    }
    if (this.amountDue != undefined) {
        this.xmlAddChild(node, "sixml:AmountDue", this.amountDue);
    }
    if (this.amountDcc != undefined) {
        this.xmlAddChild(node, "sixml:AmountDcc", this.amountDcc);
    }
    if (this.amountSaldo != undefined) {
        this.xmlAddChild(node, "sixml:AmountSaldo", this.amountSaldo);
    }
    if (this.dccDisclaimer != undefined) {
        this.xmlAddChild(node, "sixml:DccDisclaimer", this.dccDisclaimer);
    }
    if (this.disclaimer != undefined) {
        this.xmlAddChild(node, "sixml:Disclaimer", this.disclaimer);
    }
    if (this.cardData != undefined) {
        this.xmlAddChild(node, "sixml:CardData", this.cardData);
    }
    if (this.printData != undefined) {
        this.xmlAddChild(node, "sixml:PrintData", this.printData);
    }
    if (this.basket != undefined) {
        this.xmlAddChild(node, "sixml:Basket", this.basket);
    }
    if (this.additionalInfoList != undefined) {
        this.xmlAddChild(node, "sixml:AdditionalInfoList", this.additionalInfoList);
    }
    if (this.amountTip != undefined) {
        this.xmlAddChild(node, "sixml:AmountTip", this.amountTip);
    }
    if (this.loyaltyCashbackAmount != undefined) {
        this.xmlAddChild(node, "sixml:LoyaltyCashbackAmount", this.loyaltyCashbackAmount);
    }
    return node;
};
timapi.protocol.sixml.Response_PurchaseForcedAcceptance = function (a) {
    if (arguments.length == 1 && a instanceof timapi.protocol.sixml.Response_PurchaseForcedAcceptance) {
        var value = a;
        this.functionGroup = value.functionGroup;
        this.function = value.function;
        this.sequenceNumber = value.sequenceNumber;
        this.resultCode = value.resultCode;
        this.timeStamp = value.timeStamp;
        this.transactionInformation = value.transactionInformation ? new timapi.protocol.sixml.TransactionInformation(value.transactionInformation) : undefined;
        this.amount = value.amount ? new timapi.protocol.sixml.Amount(value.amount) : undefined;
        this.amountDue = value.amountDue ? new timapi.protocol.sixml.AmountDue(value.amountDue) : undefined;
        this.amountDcc = value.amountDcc ? new timapi.protocol.sixml.AmountDcc(value.amountDcc) : undefined;
        this.amountSaldo = value.amountSaldo ? new timapi.protocol.sixml.AmountSaldo(value.amountSaldo) : undefined;
        this.dccDisclaimer = value.dccDisclaimer;
        this.disclaimer = value.disclaimer;
        this.cardData = value.cardData ? new timapi.protocol.sixml.CardData(value.cardData) : undefined;
        this.printData = value.printData ? new timapi.protocol.sixml.PrintData(value.printData) : undefined;
        return;
    }
    if (arguments.length == 1 && a instanceof timapi.protocol.XmlNode) {
        var node = a;
        if (this.xmlHasAttribute(node, "FunctionGroup")) {
            this.functionGroup = this.xmlGetAttribute(node, "FunctionGroup");
        }
        if (this.xmlHasAttribute(node, "Function")) {
            this.function = this.xmlGetAttribute(node, "Function");
        }
        if (this.xmlHasAttribute(node, "SequenceNumber")) {
            this.sequenceNumber = (this.xmlGetAttribute(node, "SequenceNumber") ? parseInt(this.xmlGetAttribute(node, "SequenceNumber")) : 0);
        }
        if (this.xmlHasAttribute(node, "ResultCode")) {
            this.resultCode = (this.xmlGetAttribute(node, "ResultCode") ? parseInt(this.xmlGetAttribute(node, "ResultCode")) : 0);
        }
        if (this.xmlHasAttribute(node, "TimeStamp")) {
            this.timeStamp = new timapi.protocol.TimeDate("yyyyMMdd'T'HHmmssZ", this.xmlGetAttribute(node, "TimeStamp"));
        }
        if (this.xmlHasChild(node, "sixml:TransactionInformation")) {
            this.transactionInformation = new timapi.protocol.sixml.TransactionInformation(this.xmlGetChild(node, "sixml:TransactionInformation"));
        }
        if (this.xmlHasChild(node, "sixml:Amount")) {
            this.amount = new timapi.protocol.sixml.Amount(this.xmlGetChild(node, "sixml:Amount"));
        }
        if (this.xmlHasChild(node, "sixml:AmountDue")) {
            this.amountDue = new timapi.protocol.sixml.AmountDue(this.xmlGetChild(node, "sixml:AmountDue"));
        }
        if (this.xmlHasChild(node, "sixml:AmountDcc")) {
            this.amountDcc = new timapi.protocol.sixml.AmountDcc(this.xmlGetChild(node, "sixml:AmountDcc"));
        }
        if (this.xmlHasChild(node, "sixml:AmountSaldo")) {
            this.amountSaldo = new timapi.protocol.sixml.AmountSaldo(this.xmlGetChild(node, "sixml:AmountSaldo"));
        }
        if (this.xmlHasChild(node, "sixml:DccDisclaimer")) {
            this.dccDisclaimer = this.xmlGetChild(node, "sixml:DccDisclaimer").textContent;
        }
        if (this.xmlHasChild(node, "sixml:Disclaimer")) {
            this.disclaimer = this.xmlGetChild(node, "sixml:Disclaimer").textContent;
        }
        if (this.xmlHasChild(node, "sixml:CardData")) {
            this.cardData = new timapi.protocol.sixml.CardData(this.xmlGetChild(node, "sixml:CardData"));
        }
        if (this.xmlHasChild(node, "sixml:PrintData")) {
            this.printData = new timapi.protocol.sixml.PrintData(this.xmlGetChild(node, "sixml:PrintData"));
        }
        return;
    }
    if (arguments.length == 0) {
        this.functionGroup = "FinTransaction";
        this.function = "PurchaseForcedAcceptance";
        return;
    }
    throw new Error("Invalid argument");
};
timapi.protocol.sixml.Response_PurchaseForcedAcceptance.prototype = Object.create(timapi.protocol.Message.prototype);
timapi.protocol.sixml.Response_PurchaseForcedAcceptance.prototype.functionGroup = undefined;
timapi.protocol.sixml.Response_PurchaseForcedAcceptance.prototype.function = undefined;
timapi.protocol.sixml.Response_PurchaseForcedAcceptance.prototype.sequenceNumber = undefined;
timapi.protocol.sixml.Response_PurchaseForcedAcceptance.prototype.resultCode = undefined;
timapi.protocol.sixml.Response_PurchaseForcedAcceptance.prototype.timeStamp = undefined;
timapi.protocol.sixml.Response_PurchaseForcedAcceptance.prototype.transactionInformation = undefined;
timapi.protocol.sixml.Response_PurchaseForcedAcceptance.prototype.amount = undefined;
timapi.protocol.sixml.Response_PurchaseForcedAcceptance.prototype.amountDue = undefined;
timapi.protocol.sixml.Response_PurchaseForcedAcceptance.prototype.amountDcc = undefined;
timapi.protocol.sixml.Response_PurchaseForcedAcceptance.prototype.amountSaldo = undefined;
timapi.protocol.sixml.Response_PurchaseForcedAcceptance.prototype.dccDisclaimer = undefined;
timapi.protocol.sixml.Response_PurchaseForcedAcceptance.prototype.disclaimer = undefined;
timapi.protocol.sixml.Response_PurchaseForcedAcceptance.prototype.cardData = undefined;
timapi.protocol.sixml.Response_PurchaseForcedAcceptance.prototype.printData = undefined;
timapi.protocol.sixml.Response_PurchaseForcedAcceptance.prototype.toXmlNode = function () {
    var node = new timapi.protocol.XmlNode("sixml:Response");
    this.xmlSetAttribute(node, "xmlns:sixml", "http://www.six-payment-services.com/");
    if (this.functionGroup != undefined) {
        this.xmlSetAttribute(node, "FunctionGroup", this.functionGroup);
    }
    if (this.function != undefined) {
        this.xmlSetAttribute(node, "Function", this.function);
    }
    if (this.sequenceNumber != undefined) {
        this.xmlSetAttribute(node, "SequenceNumber", timapi.utils.StringHelper.makeString(this.sequenceNumber));
    }
    if (this.resultCode != undefined) {
        this.xmlSetAttribute(node, "ResultCode", timapi.utils.StringHelper.makeString(this.resultCode));
    }
    if (this.timeStamp != undefined) {
        this.xmlSetAttribute(node, "TimeStamp", this.timeStamp.format("yyyyMMdd'T'HHmmssZ"));
    }
    if (this.transactionInformation != undefined) {
        this.xmlAddChild(node, "sixml:TransactionInformation", this.transactionInformation);
    }
    if (this.amount != undefined) {
        this.xmlAddChild(node, "sixml:Amount", this.amount);
    }
    if (this.amountDue != undefined) {
        this.xmlAddChild(node, "sixml:AmountDue", this.amountDue);
    }
    if (this.amountDcc != undefined) {
        this.xmlAddChild(node, "sixml:AmountDcc", this.amountDcc);
    }
    if (this.amountSaldo != undefined) {
        this.xmlAddChild(node, "sixml:AmountSaldo", this.amountSaldo);
    }
    if (this.dccDisclaimer != undefined) {
        this.xmlAddChild(node, "sixml:DccDisclaimer", this.dccDisclaimer);
    }
    if (this.disclaimer != undefined) {
        this.xmlAddChild(node, "sixml:Disclaimer", this.disclaimer);
    }
    if (this.cardData != undefined) {
        this.xmlAddChild(node, "sixml:CardData", this.cardData);
    }
    if (this.printData != undefined) {
        this.xmlAddChild(node, "sixml:PrintData", this.printData);
    }
    return node;
};
timapi.protocol.sixml.Response_PurchasePhoneAuthorized = function (a) {
    if (arguments.length == 1 && a instanceof timapi.protocol.sixml.Response_PurchasePhoneAuthorized) {
        var value = a;
        this.functionGroup = value.functionGroup;
        this.function = value.function;
        this.sequenceNumber = value.sequenceNumber;
        this.resultCode = value.resultCode;
        this.timeStamp = value.timeStamp;
        this.transactionInformation = value.transactionInformation ? new timapi.protocol.sixml.TransactionInformation(value.transactionInformation) : undefined;
        this.amount = value.amount ? new timapi.protocol.sixml.Amount(value.amount) : undefined;
        this.amountDue = value.amountDue ? new timapi.protocol.sixml.AmountDue(value.amountDue) : undefined;
        this.amountDcc = value.amountDcc ? new timapi.protocol.sixml.AmountDcc(value.amountDcc) : undefined;
        this.amountSaldo = value.amountSaldo ? new timapi.protocol.sixml.AmountSaldo(value.amountSaldo) : undefined;
        this.dccDisclaimer = value.dccDisclaimer;
        this.disclaimer = value.disclaimer;
        this.cardData = value.cardData ? new timapi.protocol.sixml.CardData(value.cardData) : undefined;
        this.printData = value.printData ? new timapi.protocol.sixml.PrintData(value.printData) : undefined;
        return;
    }
    if (arguments.length == 1 && a instanceof timapi.protocol.XmlNode) {
        var node = a;
        if (this.xmlHasAttribute(node, "FunctionGroup")) {
            this.functionGroup = this.xmlGetAttribute(node, "FunctionGroup");
        }
        if (this.xmlHasAttribute(node, "Function")) {
            this.function = this.xmlGetAttribute(node, "Function");
        }
        if (this.xmlHasAttribute(node, "SequenceNumber")) {
            this.sequenceNumber = (this.xmlGetAttribute(node, "SequenceNumber") ? parseInt(this.xmlGetAttribute(node, "SequenceNumber")) : 0);
        }
        if (this.xmlHasAttribute(node, "ResultCode")) {
            this.resultCode = (this.xmlGetAttribute(node, "ResultCode") ? parseInt(this.xmlGetAttribute(node, "ResultCode")) : 0);
        }
        if (this.xmlHasAttribute(node, "TimeStamp")) {
            this.timeStamp = new timapi.protocol.TimeDate("yyyyMMdd'T'HHmmssZ", this.xmlGetAttribute(node, "TimeStamp"));
        }
        if (this.xmlHasChild(node, "sixml:TransactionInformation")) {
            this.transactionInformation = new timapi.protocol.sixml.TransactionInformation(this.xmlGetChild(node, "sixml:TransactionInformation"));
        }
        if (this.xmlHasChild(node, "sixml:Amount")) {
            this.amount = new timapi.protocol.sixml.Amount(this.xmlGetChild(node, "sixml:Amount"));
        }
        if (this.xmlHasChild(node, "sixml:AmountDue")) {
            this.amountDue = new timapi.protocol.sixml.AmountDue(this.xmlGetChild(node, "sixml:AmountDue"));
        }
        if (this.xmlHasChild(node, "sixml:AmountDcc")) {
            this.amountDcc = new timapi.protocol.sixml.AmountDcc(this.xmlGetChild(node, "sixml:AmountDcc"));
        }
        if (this.xmlHasChild(node, "sixml:AmountSaldo")) {
            this.amountSaldo = new timapi.protocol.sixml.AmountSaldo(this.xmlGetChild(node, "sixml:AmountSaldo"));
        }
        if (this.xmlHasChild(node, "sixml:DccDisclaimer")) {
            this.dccDisclaimer = this.xmlGetChild(node, "sixml:DccDisclaimer").textContent;
        }
        if (this.xmlHasChild(node, "sixml:Disclaimer")) {
            this.disclaimer = this.xmlGetChild(node, "sixml:Disclaimer").textContent;
        }
        if (this.xmlHasChild(node, "sixml:CardData")) {
            this.cardData = new timapi.protocol.sixml.CardData(this.xmlGetChild(node, "sixml:CardData"));
        }
        if (this.xmlHasChild(node, "sixml:PrintData")) {
            this.printData = new timapi.protocol.sixml.PrintData(this.xmlGetChild(node, "sixml:PrintData"));
        }
        return;
    }
    if (arguments.length == 0) {
        this.functionGroup = "FinTransaction";
        this.function = "PurchasePhoneAuthorized";
        return;
    }
    throw new Error("Invalid argument");
};
timapi.protocol.sixml.Response_PurchasePhoneAuthorized.prototype = Object.create(timapi.protocol.Message.prototype);
timapi.protocol.sixml.Response_PurchasePhoneAuthorized.prototype.functionGroup = undefined;
timapi.protocol.sixml.Response_PurchasePhoneAuthorized.prototype.function = undefined;
timapi.protocol.sixml.Response_PurchasePhoneAuthorized.prototype.sequenceNumber = undefined;
timapi.protocol.sixml.Response_PurchasePhoneAuthorized.prototype.resultCode = undefined;
timapi.protocol.sixml.Response_PurchasePhoneAuthorized.prototype.timeStamp = undefined;
timapi.protocol.sixml.Response_PurchasePhoneAuthorized.prototype.transactionInformation = undefined;
timapi.protocol.sixml.Response_PurchasePhoneAuthorized.prototype.amount = undefined;
timapi.protocol.sixml.Response_PurchasePhoneAuthorized.prototype.amountDue = undefined;
timapi.protocol.sixml.Response_PurchasePhoneAuthorized.prototype.amountDcc = undefined;
timapi.protocol.sixml.Response_PurchasePhoneAuthorized.prototype.amountSaldo = undefined;
timapi.protocol.sixml.Response_PurchasePhoneAuthorized.prototype.dccDisclaimer = undefined;
timapi.protocol.sixml.Response_PurchasePhoneAuthorized.prototype.disclaimer = undefined;
timapi.protocol.sixml.Response_PurchasePhoneAuthorized.prototype.cardData = undefined;
timapi.protocol.sixml.Response_PurchasePhoneAuthorized.prototype.printData = undefined;
timapi.protocol.sixml.Response_PurchasePhoneAuthorized.prototype.toXmlNode = function () {
    var node = new timapi.protocol.XmlNode("sixml:Response");
    this.xmlSetAttribute(node, "xmlns:sixml", "http://www.six-payment-services.com/");
    if (this.functionGroup != undefined) {
        this.xmlSetAttribute(node, "FunctionGroup", this.functionGroup);
    }
    if (this.function != undefined) {
        this.xmlSetAttribute(node, "Function", this.function);
    }
    if (this.sequenceNumber != undefined) {
        this.xmlSetAttribute(node, "SequenceNumber", timapi.utils.StringHelper.makeString(this.sequenceNumber));
    }
    if (this.resultCode != undefined) {
        this.xmlSetAttribute(node, "ResultCode", timapi.utils.StringHelper.makeString(this.resultCode));
    }
    if (this.timeStamp != undefined) {
        this.xmlSetAttribute(node, "TimeStamp", this.timeStamp.format("yyyyMMdd'T'HHmmssZ"));
    }
    if (this.transactionInformation != undefined) {
        this.xmlAddChild(node, "sixml:TransactionInformation", this.transactionInformation);
    }
    if (this.amount != undefined) {
        this.xmlAddChild(node, "sixml:Amount", this.amount);
    }
    if (this.amountDue != undefined) {
        this.xmlAddChild(node, "sixml:AmountDue", this.amountDue);
    }
    if (this.amountDcc != undefined) {
        this.xmlAddChild(node, "sixml:AmountDcc", this.amountDcc);
    }
    if (this.amountSaldo != undefined) {
        this.xmlAddChild(node, "sixml:AmountSaldo", this.amountSaldo);
    }
    if (this.dccDisclaimer != undefined) {
        this.xmlAddChild(node, "sixml:DccDisclaimer", this.dccDisclaimer);
    }
    if (this.disclaimer != undefined) {
        this.xmlAddChild(node, "sixml:Disclaimer", this.disclaimer);
    }
    if (this.cardData != undefined) {
        this.xmlAddChild(node, "sixml:CardData", this.cardData);
    }
    if (this.printData != undefined) {
        this.xmlAddChild(node, "sixml:PrintData", this.printData);
    }
    return node;
};
timapi.protocol.sixml.Response_PurchaseReservation = function (a) {
    if (arguments.length == 1 && a instanceof timapi.protocol.sixml.Response_PurchaseReservation) {
        var value = a;
        this.functionGroup = value.functionGroup;
        this.function = value.function;
        this.sequenceNumber = value.sequenceNumber;
        this.resultCode = value.resultCode;
        this.timeStamp = value.timeStamp;
        this.amount = value.amount ? new timapi.protocol.sixml.Amount(value.amount) : undefined;
        this.amountDcc = value.amountDcc ? new timapi.protocol.sixml.AmountDcc(value.amountDcc) : undefined;
        this.amountTip = value.amountTip ? new timapi.protocol.sixml.AmountTip(value.amountTip) : undefined;
        this.amountDue = value.amountDue ? new timapi.protocol.sixml.AmountDue(value.amountDue) : undefined;
        this.transactionInformation = value.transactionInformation ? new timapi.protocol.sixml.TransactionInformation(value.transactionInformation) : undefined;
        this.dccDisclaimer = value.dccDisclaimer;
        this.disclaimer = value.disclaimer;
        this.cardData = value.cardData ? new timapi.protocol.sixml.CardData(value.cardData) : undefined;
        this.printData = value.printData ? new timapi.protocol.sixml.PrintData(value.printData) : undefined;
        return;
    }
    if (arguments.length == 1 && a instanceof timapi.protocol.XmlNode) {
        var node = a;
        if (this.xmlHasAttribute(node, "FunctionGroup")) {
            this.functionGroup = this.xmlGetAttribute(node, "FunctionGroup");
        }
        if (this.xmlHasAttribute(node, "Function")) {
            this.function = this.xmlGetAttribute(node, "Function");
        }
        if (this.xmlHasAttribute(node, "SequenceNumber")) {
            this.sequenceNumber = (this.xmlGetAttribute(node, "SequenceNumber") ? parseInt(this.xmlGetAttribute(node, "SequenceNumber")) : 0);
        }
        if (this.xmlHasAttribute(node, "ResultCode")) {
            this.resultCode = (this.xmlGetAttribute(node, "ResultCode") ? parseInt(this.xmlGetAttribute(node, "ResultCode")) : 0);
        }
        if (this.xmlHasAttribute(node, "TimeStamp")) {
            this.timeStamp = new timapi.protocol.TimeDate("yyyyMMdd'T'HHmmssZ", this.xmlGetAttribute(node, "TimeStamp"));
        }
        if (this.xmlHasChild(node, "sixml:Amount")) {
            this.amount = new timapi.protocol.sixml.Amount(this.xmlGetChild(node, "sixml:Amount"));
        }
        if (this.xmlHasChild(node, "sixml:AmountDcc")) {
            this.amountDcc = new timapi.protocol.sixml.AmountDcc(this.xmlGetChild(node, "sixml:AmountDcc"));
        }
        if (this.xmlHasChild(node, "sixml:AmountTip")) {
            this.amountTip = new timapi.protocol.sixml.AmountTip(this.xmlGetChild(node, "sixml:AmountTip"));
        }
        if (this.xmlHasChild(node, "sixml:AmountDue")) {
            this.amountDue = new timapi.protocol.sixml.AmountDue(this.xmlGetChild(node, "sixml:AmountDue"));
        }
        if (this.xmlHasChild(node, "sixml:TransactionInformation")) {
            this.transactionInformation = new timapi.protocol.sixml.TransactionInformation(this.xmlGetChild(node, "sixml:TransactionInformation"));
        }
        if (this.xmlHasChild(node, "sixml:DccDisclaimer")) {
            this.dccDisclaimer = this.xmlGetChild(node, "sixml:DccDisclaimer").textContent;
        }
        if (this.xmlHasChild(node, "sixml:Disclaimer")) {
            this.disclaimer = this.xmlGetChild(node, "sixml:Disclaimer").textContent;
        }
        if (this.xmlHasChild(node, "sixml:CardData")) {
            this.cardData = new timapi.protocol.sixml.CardData(this.xmlGetChild(node, "sixml:CardData"));
        }
        if (this.xmlHasChild(node, "sixml:PrintData")) {
            this.printData = new timapi.protocol.sixml.PrintData(this.xmlGetChild(node, "sixml:PrintData"));
        }
        return;
    }
    if (arguments.length == 0) {
        this.functionGroup = "FinTransaction";
        this.function = "PurchaseReservation";
        return;
    }
    throw new Error("Invalid argument");
};
timapi.protocol.sixml.Response_PurchaseReservation.prototype = Object.create(timapi.protocol.Message.prototype);
timapi.protocol.sixml.Response_PurchaseReservation.prototype.functionGroup = undefined;
timapi.protocol.sixml.Response_PurchaseReservation.prototype.function = undefined;
timapi.protocol.sixml.Response_PurchaseReservation.prototype.sequenceNumber = undefined;
timapi.protocol.sixml.Response_PurchaseReservation.prototype.resultCode = undefined;
timapi.protocol.sixml.Response_PurchaseReservation.prototype.timeStamp = undefined;
timapi.protocol.sixml.Response_PurchaseReservation.prototype.amount = undefined;
timapi.protocol.sixml.Response_PurchaseReservation.prototype.amountDcc = undefined;
timapi.protocol.sixml.Response_PurchaseReservation.prototype.amountTip = undefined;
timapi.protocol.sixml.Response_PurchaseReservation.prototype.amountDue = undefined;
timapi.protocol.sixml.Response_PurchaseReservation.prototype.transactionInformation = undefined;
timapi.protocol.sixml.Response_PurchaseReservation.prototype.dccDisclaimer = undefined;
timapi.protocol.sixml.Response_PurchaseReservation.prototype.disclaimer = undefined;
timapi.protocol.sixml.Response_PurchaseReservation.prototype.cardData = undefined;
timapi.protocol.sixml.Response_PurchaseReservation.prototype.printData = undefined;
timapi.protocol.sixml.Response_PurchaseReservation.prototype.toXmlNode = function () {
    var node = new timapi.protocol.XmlNode("sixml:Response");
    this.xmlSetAttribute(node, "xmlns:sixml", "http://www.six-payment-services.com/");
    if (this.functionGroup != undefined) {
        this.xmlSetAttribute(node, "FunctionGroup", this.functionGroup);
    }
    if (this.function != undefined) {
        this.xmlSetAttribute(node, "Function", this.function);
    }
    if (this.sequenceNumber != undefined) {
        this.xmlSetAttribute(node, "SequenceNumber", timapi.utils.StringHelper.makeString(this.sequenceNumber));
    }
    if (this.resultCode != undefined) {
        this.xmlSetAttribute(node, "ResultCode", timapi.utils.StringHelper.makeString(this.resultCode));
    }
    if (this.timeStamp != undefined) {
        this.xmlSetAttribute(node, "TimeStamp", this.timeStamp.format("yyyyMMdd'T'HHmmssZ"));
    }
    if (this.amount != undefined) {
        this.xmlAddChild(node, "sixml:Amount", this.amount);
    }
    if (this.amountDcc != undefined) {
        this.xmlAddChild(node, "sixml:AmountDcc", this.amountDcc);
    }
    if (this.amountTip != undefined) {
        this.xmlAddChild(node, "sixml:AmountTip", this.amountTip);
    }
    if (this.amountDue != undefined) {
        this.xmlAddChild(node, "sixml:AmountDue", this.amountDue);
    }
    if (this.transactionInformation != undefined) {
        this.xmlAddChild(node, "sixml:TransactionInformation", this.transactionInformation);
    }
    if (this.dccDisclaimer != undefined) {
        this.xmlAddChild(node, "sixml:DccDisclaimer", this.dccDisclaimer);
    }
    if (this.disclaimer != undefined) {
        this.xmlAddChild(node, "sixml:Disclaimer", this.disclaimer);
    }
    if (this.cardData != undefined) {
        this.xmlAddChild(node, "sixml:CardData", this.cardData);
    }
    if (this.printData != undefined) {
        this.xmlAddChild(node, "sixml:PrintData", this.printData);
    }
    return node;
};
timapi.protocol.sixml.Response_PurchaseWithCashback = function (a) {
    if (arguments.length == 1 && a instanceof timapi.protocol.sixml.Response_PurchaseWithCashback) {
        var value = a;
        this.functionGroup = value.functionGroup;
        this.function = value.function;
        this.sequenceNumber = value.sequenceNumber;
        this.resultCode = value.resultCode;
        this.timeStamp = value.timeStamp;
        this.transactionInformation = value.transactionInformation ? new timapi.protocol.sixml.TransactionInformation(value.transactionInformation) : undefined;
        this.amount = value.amount ? new timapi.protocol.sixml.Amount(value.amount) : undefined;
        this.amountOther = value.amountOther ? new timapi.protocol.sixml.AmountOther(value.amountOther) : undefined;
        this.amountDue = value.amountDue ? new timapi.protocol.sixml.AmountDue(value.amountDue) : undefined;
        this.amountDcc = value.amountDcc ? new timapi.protocol.sixml.AmountDcc(value.amountDcc) : undefined;
        this.amountSaldo = value.amountSaldo ? new timapi.protocol.sixml.AmountSaldo(value.amountSaldo) : undefined;
        this.dccDisclaimer = value.dccDisclaimer;
        this.disclaimer = value.disclaimer;
        this.cardData = value.cardData ? new timapi.protocol.sixml.CardData(value.cardData) : undefined;
        this.printData = value.printData ? new timapi.protocol.sixml.PrintData(value.printData) : undefined;
        return;
    }
    if (arguments.length == 1 && a instanceof timapi.protocol.XmlNode) {
        var node = a;
        if (this.xmlHasAttribute(node, "FunctionGroup")) {
            this.functionGroup = this.xmlGetAttribute(node, "FunctionGroup");
        }
        if (this.xmlHasAttribute(node, "Function")) {
            this.function = this.xmlGetAttribute(node, "Function");
        }
        if (this.xmlHasAttribute(node, "SequenceNumber")) {
            this.sequenceNumber = (this.xmlGetAttribute(node, "SequenceNumber") ? parseInt(this.xmlGetAttribute(node, "SequenceNumber")) : 0);
        }
        if (this.xmlHasAttribute(node, "ResultCode")) {
            this.resultCode = (this.xmlGetAttribute(node, "ResultCode") ? parseInt(this.xmlGetAttribute(node, "ResultCode")) : 0);
        }
        if (this.xmlHasAttribute(node, "TimeStamp")) {
            this.timeStamp = new timapi.protocol.TimeDate("yyyyMMdd'T'HHmmssZ", this.xmlGetAttribute(node, "TimeStamp"));
        }
        if (this.xmlHasChild(node, "sixml:TransactionInformation")) {
            this.transactionInformation = new timapi.protocol.sixml.TransactionInformation(this.xmlGetChild(node, "sixml:TransactionInformation"));
        }
        if (this.xmlHasChild(node, "sixml:Amount")) {
            this.amount = new timapi.protocol.sixml.Amount(this.xmlGetChild(node, "sixml:Amount"));
        }
        if (this.xmlHasChild(node, "sixml:AmountOther")) {
            this.amountOther = new timapi.protocol.sixml.AmountOther(this.xmlGetChild(node, "sixml:AmountOther"));
        }
        if (this.xmlHasChild(node, "sixml:AmountDue")) {
            this.amountDue = new timapi.protocol.sixml.AmountDue(this.xmlGetChild(node, "sixml:AmountDue"));
        }
        if (this.xmlHasChild(node, "sixml:AmountDcc")) {
            this.amountDcc = new timapi.protocol.sixml.AmountDcc(this.xmlGetChild(node, "sixml:AmountDcc"));
        }
        if (this.xmlHasChild(node, "sixml:AmountSaldo")) {
            this.amountSaldo = new timapi.protocol.sixml.AmountSaldo(this.xmlGetChild(node, "sixml:AmountSaldo"));
        }
        if (this.xmlHasChild(node, "sixml:DccDisclaimer")) {
            this.dccDisclaimer = this.xmlGetChild(node, "sixml:DccDisclaimer").textContent;
        }
        if (this.xmlHasChild(node, "sixml:Disclaimer")) {
            this.disclaimer = this.xmlGetChild(node, "sixml:Disclaimer").textContent;
        }
        if (this.xmlHasChild(node, "sixml:CardData")) {
            this.cardData = new timapi.protocol.sixml.CardData(this.xmlGetChild(node, "sixml:CardData"));
        }
        if (this.xmlHasChild(node, "sixml:PrintData")) {
            this.printData = new timapi.protocol.sixml.PrintData(this.xmlGetChild(node, "sixml:PrintData"));
        }
        return;
    }
    if (arguments.length == 0) {
        this.functionGroup = "FinTransaction";
        this.function = "PurchaseWithCashback";
        return;
    }
    throw new Error("Invalid argument");
};
timapi.protocol.sixml.Response_PurchaseWithCashback.prototype = Object.create(timapi.protocol.Message.prototype);
timapi.protocol.sixml.Response_PurchaseWithCashback.prototype.functionGroup = undefined;
timapi.protocol.sixml.Response_PurchaseWithCashback.prototype.function = undefined;
timapi.protocol.sixml.Response_PurchaseWithCashback.prototype.sequenceNumber = undefined;
timapi.protocol.sixml.Response_PurchaseWithCashback.prototype.resultCode = undefined;
timapi.protocol.sixml.Response_PurchaseWithCashback.prototype.timeStamp = undefined;
timapi.protocol.sixml.Response_PurchaseWithCashback.prototype.transactionInformation = undefined;
timapi.protocol.sixml.Response_PurchaseWithCashback.prototype.amount = undefined;
timapi.protocol.sixml.Response_PurchaseWithCashback.prototype.amountOther = undefined;
timapi.protocol.sixml.Response_PurchaseWithCashback.prototype.amountDue = undefined;
timapi.protocol.sixml.Response_PurchaseWithCashback.prototype.amountDcc = undefined;
timapi.protocol.sixml.Response_PurchaseWithCashback.prototype.amountSaldo = undefined;
timapi.protocol.sixml.Response_PurchaseWithCashback.prototype.dccDisclaimer = undefined;
timapi.protocol.sixml.Response_PurchaseWithCashback.prototype.disclaimer = undefined;
timapi.protocol.sixml.Response_PurchaseWithCashback.prototype.cardData = undefined;
timapi.protocol.sixml.Response_PurchaseWithCashback.prototype.printData = undefined;
timapi.protocol.sixml.Response_PurchaseWithCashback.prototype.toXmlNode = function () {
    var node = new timapi.protocol.XmlNode("sixml:Response");
    this.xmlSetAttribute(node, "xmlns:sixml", "http://www.six-payment-services.com/");
    if (this.functionGroup != undefined) {
        this.xmlSetAttribute(node, "FunctionGroup", this.functionGroup);
    }
    if (this.function != undefined) {
        this.xmlSetAttribute(node, "Function", this.function);
    }
    if (this.sequenceNumber != undefined) {
        this.xmlSetAttribute(node, "SequenceNumber", timapi.utils.StringHelper.makeString(this.sequenceNumber));
    }
    if (this.resultCode != undefined) {
        this.xmlSetAttribute(node, "ResultCode", timapi.utils.StringHelper.makeString(this.resultCode));
    }
    if (this.timeStamp != undefined) {
        this.xmlSetAttribute(node, "TimeStamp", this.timeStamp.format("yyyyMMdd'T'HHmmssZ"));
    }
    if (this.transactionInformation != undefined) {
        this.xmlAddChild(node, "sixml:TransactionInformation", this.transactionInformation);
    }
    if (this.amount != undefined) {
        this.xmlAddChild(node, "sixml:Amount", this.amount);
    }
    if (this.amountOther != undefined) {
        this.xmlAddChild(node, "sixml:AmountOther", this.amountOther);
    }
    if (this.amountDue != undefined) {
        this.xmlAddChild(node, "sixml:AmountDue", this.amountDue);
    }
    if (this.amountDcc != undefined) {
        this.xmlAddChild(node, "sixml:AmountDcc", this.amountDcc);
    }
    if (this.amountSaldo != undefined) {
        this.xmlAddChild(node, "sixml:AmountSaldo", this.amountSaldo);
    }
    if (this.dccDisclaimer != undefined) {
        this.xmlAddChild(node, "sixml:DccDisclaimer", this.dccDisclaimer);
    }
    if (this.disclaimer != undefined) {
        this.xmlAddChild(node, "sixml:Disclaimer", this.disclaimer);
    }
    if (this.cardData != undefined) {
        this.xmlAddChild(node, "sixml:CardData", this.cardData);
    }
    if (this.printData != undefined) {
        this.xmlAddChild(node, "sixml:PrintData", this.printData);
    }
    return node;
};
timapi.protocol.sixml.Response_Reboot = function (a) {
    if (arguments.length == 1 && a instanceof timapi.protocol.sixml.Response_Reboot) {
        var value = a;
        this.functionGroup = value.functionGroup;
        this.function = value.function;
        this.sequenceNumber = value.sequenceNumber;
        this.resultCode = value.resultCode;
        this.timeStamp = value.timeStamp;
        return;
    }
    if (arguments.length == 1 && a instanceof timapi.protocol.XmlNode) {
        var node = a;
        if (this.xmlHasAttribute(node, "FunctionGroup")) {
            this.functionGroup = this.xmlGetAttribute(node, "FunctionGroup");
        }
        if (this.xmlHasAttribute(node, "Function")) {
            this.function = this.xmlGetAttribute(node, "Function");
        }
        if (this.xmlHasAttribute(node, "SequenceNumber")) {
            this.sequenceNumber = (this.xmlGetAttribute(node, "SequenceNumber") ? parseInt(this.xmlGetAttribute(node, "SequenceNumber")) : 0);
        }
        if (this.xmlHasAttribute(node, "ResultCode")) {
            this.resultCode = (this.xmlGetAttribute(node, "ResultCode") ? parseInt(this.xmlGetAttribute(node, "ResultCode")) : 0);
        }
        if (this.xmlHasAttribute(node, "TimeStamp")) {
            this.timeStamp = new timapi.protocol.TimeDate("yyyyMMdd'T'HHmmssZ", this.xmlGetAttribute(node, "TimeStamp"));
        }
        return;
    }
    if (arguments.length == 0) {
        this.functionGroup = "Admin";
        this.function = "Reboot";
        return;
    }
    throw new Error("Invalid argument");
};
timapi.protocol.sixml.Response_Reboot.prototype = Object.create(timapi.protocol.Message.prototype);
timapi.protocol.sixml.Response_Reboot.prototype.functionGroup = undefined;
timapi.protocol.sixml.Response_Reboot.prototype.function = undefined;
timapi.protocol.sixml.Response_Reboot.prototype.sequenceNumber = undefined;
timapi.protocol.sixml.Response_Reboot.prototype.resultCode = undefined;
timapi.protocol.sixml.Response_Reboot.prototype.timeStamp = undefined;
timapi.protocol.sixml.Response_Reboot.prototype.toXmlNode = function () {
    var node = new timapi.protocol.XmlNode("sixml:Response");
    this.xmlSetAttribute(node, "xmlns:sixml", "http://www.six-payment-services.com/");
    if (this.functionGroup != undefined) {
        this.xmlSetAttribute(node, "FunctionGroup", this.functionGroup);
    }
    if (this.function != undefined) {
        this.xmlSetAttribute(node, "Function", this.function);
    }
    if (this.sequenceNumber != undefined) {
        this.xmlSetAttribute(node, "SequenceNumber", timapi.utils.StringHelper.makeString(this.sequenceNumber));
    }
    if (this.resultCode != undefined) {
        this.xmlSetAttribute(node, "ResultCode", timapi.utils.StringHelper.makeString(this.resultCode));
    }
    if (this.timeStamp != undefined) {
        this.xmlSetAttribute(node, "TimeStamp", this.timeStamp.format("yyyyMMdd'T'HHmmssZ"));
    }
    return node;
};
timapi.protocol.sixml.Response_ReceiptRequest = function (a) {
    if (arguments.length == 1 && a instanceof timapi.protocol.sixml.Response_ReceiptRequest) {
        var value = a;
        this.functionGroup = value.functionGroup;
        this.function = value.function;
        this.sequenceNumber = value.sequenceNumber;
        this.resultCode = value.resultCode;
        this.timeStamp = value.timeStamp;
        this.printData = value.printData ? new timapi.protocol.sixml.PrintData(value.printData) : undefined;
        this.hasMoreReceipts = value.hasMoreReceipts;
        return;
    }
    if (arguments.length == 1 && a instanceof timapi.protocol.XmlNode) {
        var node = a;
        if (this.xmlHasAttribute(node, "FunctionGroup")) {
            this.functionGroup = this.xmlGetAttribute(node, "FunctionGroup");
        }
        if (this.xmlHasAttribute(node, "Function")) {
            this.function = this.xmlGetAttribute(node, "Function");
        }
        if (this.xmlHasAttribute(node, "SequenceNumber")) {
            this.sequenceNumber = (this.xmlGetAttribute(node, "SequenceNumber") ? parseInt(this.xmlGetAttribute(node, "SequenceNumber")) : 0);
        }
        if (this.xmlHasAttribute(node, "ResultCode")) {
            this.resultCode = (this.xmlGetAttribute(node, "ResultCode") ? parseInt(this.xmlGetAttribute(node, "ResultCode")) : 0);
        }
        if (this.xmlHasAttribute(node, "TimeStamp")) {
            this.timeStamp = new timapi.protocol.TimeDate("yyyyMMdd'T'HHmmssZ", this.xmlGetAttribute(node, "TimeStamp"));
        }
        if (this.xmlHasChild(node, "sixml:PrintData")) {
            this.printData = new timapi.protocol.sixml.PrintData(this.xmlGetChild(node, "sixml:PrintData"));
        }
        if (this.xmlHasChild(node, "sixml:HasMoreReceipts")) {
            this.hasMoreReceipts = this.xmlGetChild(node, "sixml:HasMoreReceipts").textContent == "1";
        }
        return;
    }
    if (arguments.length == 0) {
        this.functionGroup = "Admin";
        this.function = "ReceiptRequest";
        return;
    }
    throw new Error("Invalid argument");
};
timapi.protocol.sixml.Response_ReceiptRequest.prototype = Object.create(timapi.protocol.Message.prototype);
timapi.protocol.sixml.Response_ReceiptRequest.prototype.functionGroup = undefined;
timapi.protocol.sixml.Response_ReceiptRequest.prototype.function = undefined;
timapi.protocol.sixml.Response_ReceiptRequest.prototype.sequenceNumber = undefined;
timapi.protocol.sixml.Response_ReceiptRequest.prototype.resultCode = undefined;
timapi.protocol.sixml.Response_ReceiptRequest.prototype.timeStamp = undefined;
timapi.protocol.sixml.Response_ReceiptRequest.prototype.printData = undefined;
timapi.protocol.sixml.Response_ReceiptRequest.prototype.hasMoreReceipts = undefined;
timapi.protocol.sixml.Response_ReceiptRequest.prototype.toXmlNode = function () {
    var node = new timapi.protocol.XmlNode("sixml:Response");
    this.xmlSetAttribute(node, "xmlns:sixml", "http://www.six-payment-services.com/");
    if (this.functionGroup != undefined) {
        this.xmlSetAttribute(node, "FunctionGroup", this.functionGroup);
    }
    if (this.function != undefined) {
        this.xmlSetAttribute(node, "Function", this.function);
    }
    if (this.sequenceNumber != undefined) {
        this.xmlSetAttribute(node, "SequenceNumber", timapi.utils.StringHelper.makeString(this.sequenceNumber));
    }
    if (this.resultCode != undefined) {
        this.xmlSetAttribute(node, "ResultCode", timapi.utils.StringHelper.makeString(this.resultCode));
    }
    if (this.timeStamp != undefined) {
        this.xmlSetAttribute(node, "TimeStamp", this.timeStamp.format("yyyyMMdd'T'HHmmssZ"));
    }
    if (this.printData != undefined) {
        this.xmlAddChild(node, "sixml:PrintData", this.printData);
    }
    if (this.hasMoreReceipts != undefined) {
        this.xmlAddChild(node, "sixml:HasMoreReceipts", (this.hasMoreReceipts ? "1" : "0"));
    }
    return node;
};
timapi.protocol.sixml.Response_Reconciliation = function (a) {
    if (arguments.length == 1 && a instanceof timapi.protocol.sixml.Response_Reconciliation) {
        var value = a;
        this.functionGroup = value.functionGroup;
        this.function = value.function;
        this.sequenceNumber = value.sequenceNumber;
        this.resultCode = value.resultCode;
        this.timeStamp = value.timeStamp;
        this.counters = value.counters ? new timapi.protocol.sixml.Counters(value.counters) : undefined;
        this.printData = value.printData ? new timapi.protocol.sixml.PrintData(value.printData) : undefined;
        return;
    }
    if (arguments.length == 1 && a instanceof timapi.protocol.XmlNode) {
        var node = a;
        if (this.xmlHasAttribute(node, "FunctionGroup")) {
            this.functionGroup = this.xmlGetAttribute(node, "FunctionGroup");
        }
        if (this.xmlHasAttribute(node, "Function")) {
            this.function = this.xmlGetAttribute(node, "Function");
        }
        if (this.xmlHasAttribute(node, "SequenceNumber")) {
            this.sequenceNumber = (this.xmlGetAttribute(node, "SequenceNumber") ? parseInt(this.xmlGetAttribute(node, "SequenceNumber")) : 0);
        }
        if (this.xmlHasAttribute(node, "ResultCode")) {
            this.resultCode = (this.xmlGetAttribute(node, "ResultCode") ? parseInt(this.xmlGetAttribute(node, "ResultCode")) : 0);
        }
        if (this.xmlHasAttribute(node, "TimeStamp")) {
            this.timeStamp = new timapi.protocol.TimeDate("yyyyMMdd'T'HHmmssZ", this.xmlGetAttribute(node, "TimeStamp"));
        }
        if (this.xmlHasChild(node, "sixml:Counters")) {
            this.counters = new timapi.protocol.sixml.Counters(this.xmlGetChild(node, "sixml:Counters"));
        }
        if (this.xmlHasChild(node, "sixml:PrintData")) {
            this.printData = new timapi.protocol.sixml.PrintData(this.xmlGetChild(node, "sixml:PrintData"));
        }
        return;
    }
    if (arguments.length == 0) {
        this.functionGroup = "Admin";
        this.function = "Reconciliation";
        return;
    }
    throw new Error("Invalid argument");
};
timapi.protocol.sixml.Response_Reconciliation.prototype = Object.create(timapi.protocol.Message.prototype);
timapi.protocol.sixml.Response_Reconciliation.prototype.functionGroup = undefined;
timapi.protocol.sixml.Response_Reconciliation.prototype.function = undefined;
timapi.protocol.sixml.Response_Reconciliation.prototype.sequenceNumber = undefined;
timapi.protocol.sixml.Response_Reconciliation.prototype.resultCode = undefined;
timapi.protocol.sixml.Response_Reconciliation.prototype.timeStamp = undefined;
timapi.protocol.sixml.Response_Reconciliation.prototype.counters = undefined;
timapi.protocol.sixml.Response_Reconciliation.prototype.printData = undefined;
timapi.protocol.sixml.Response_Reconciliation.prototype.toXmlNode = function () {
    var node = new timapi.protocol.XmlNode("sixml:Response");
    this.xmlSetAttribute(node, "xmlns:sixml", "http://www.six-payment-services.com/");
    if (this.functionGroup != undefined) {
        this.xmlSetAttribute(node, "FunctionGroup", this.functionGroup);
    }
    if (this.function != undefined) {
        this.xmlSetAttribute(node, "Function", this.function);
    }
    if (this.sequenceNumber != undefined) {
        this.xmlSetAttribute(node, "SequenceNumber", timapi.utils.StringHelper.makeString(this.sequenceNumber));
    }
    if (this.resultCode != undefined) {
        this.xmlSetAttribute(node, "ResultCode", timapi.utils.StringHelper.makeString(this.resultCode));
    }
    if (this.timeStamp != undefined) {
        this.xmlSetAttribute(node, "TimeStamp", this.timeStamp.format("yyyyMMdd'T'HHmmssZ"));
    }
    if (this.counters != undefined) {
        this.xmlAddChild(node, "sixml:Counters", this.counters);
    }
    if (this.printData != undefined) {
        this.xmlAddChild(node, "sixml:PrintData", this.printData);
    }
    return node;
};
timapi.protocol.sixml.Response_Reconfig = function (a) {
    if (arguments.length == 1 && a instanceof timapi.protocol.sixml.Response_Reconfig) {
        var value = a;
        this.functionGroup = value.functionGroup;
        this.function = value.function;
        this.sequenceNumber = value.sequenceNumber;
        this.resultCode = value.resultCode;
        this.timeStamp = value.timeStamp;
        this.printData = value.printData ? new timapi.protocol.sixml.PrintData(value.printData) : undefined;
        return;
    }
    if (arguments.length == 1 && a instanceof timapi.protocol.XmlNode) {
        var node = a;
        if (this.xmlHasAttribute(node, "FunctionGroup")) {
            this.functionGroup = this.xmlGetAttribute(node, "FunctionGroup");
        }
        if (this.xmlHasAttribute(node, "Function")) {
            this.function = this.xmlGetAttribute(node, "Function");
        }
        if (this.xmlHasAttribute(node, "SequenceNumber")) {
            this.sequenceNumber = (this.xmlGetAttribute(node, "SequenceNumber") ? parseInt(this.xmlGetAttribute(node, "SequenceNumber")) : 0);
        }
        if (this.xmlHasAttribute(node, "ResultCode")) {
            this.resultCode = (this.xmlGetAttribute(node, "ResultCode") ? parseInt(this.xmlGetAttribute(node, "ResultCode")) : 0);
        }
        if (this.xmlHasAttribute(node, "TimeStamp")) {
            this.timeStamp = new timapi.protocol.TimeDate("yyyyMMdd'T'HHmmssZ", this.xmlGetAttribute(node, "TimeStamp"));
        }
        if (this.xmlHasChild(node, "sixml:PrintData")) {
            this.printData = new timapi.protocol.sixml.PrintData(this.xmlGetChild(node, "sixml:PrintData"));
        }
        return;
    }
    if (arguments.length == 0) {
        this.functionGroup = "Admin";
        this.function = "Reconfig";
        return;
    }
    throw new Error("Invalid argument");
};
timapi.protocol.sixml.Response_Reconfig.prototype = Object.create(timapi.protocol.Message.prototype);
timapi.protocol.sixml.Response_Reconfig.prototype.functionGroup = undefined;
timapi.protocol.sixml.Response_Reconfig.prototype.function = undefined;
timapi.protocol.sixml.Response_Reconfig.prototype.sequenceNumber = undefined;
timapi.protocol.sixml.Response_Reconfig.prototype.resultCode = undefined;
timapi.protocol.sixml.Response_Reconfig.prototype.timeStamp = undefined;
timapi.protocol.sixml.Response_Reconfig.prototype.printData = undefined;
timapi.protocol.sixml.Response_Reconfig.prototype.toXmlNode = function () {
    var node = new timapi.protocol.XmlNode("sixml:Response");
    this.xmlSetAttribute(node, "xmlns:sixml", "http://www.six-payment-services.com/");
    if (this.functionGroup != undefined) {
        this.xmlSetAttribute(node, "FunctionGroup", this.functionGroup);
    }
    if (this.function != undefined) {
        this.xmlSetAttribute(node, "Function", this.function);
    }
    if (this.sequenceNumber != undefined) {
        this.xmlSetAttribute(node, "SequenceNumber", timapi.utils.StringHelper.makeString(this.sequenceNumber));
    }
    if (this.resultCode != undefined) {
        this.xmlSetAttribute(node, "ResultCode", timapi.utils.StringHelper.makeString(this.resultCode));
    }
    if (this.timeStamp != undefined) {
        this.xmlSetAttribute(node, "TimeStamp", this.timeStamp.format("yyyyMMdd'T'HHmmssZ"));
    }
    if (this.printData != undefined) {
        this.xmlAddChild(node, "sixml:PrintData", this.printData);
    }
    return node;
};
timapi.protocol.sixml.Response_Reservation = function (a) {
    if (arguments.length == 1 && a instanceof timapi.protocol.sixml.Response_Reservation) {
        var value = a;
        this.functionGroup = value.functionGroup;
        this.function = value.function;
        this.sequenceNumber = value.sequenceNumber;
        this.resultCode = value.resultCode;
        this.timeStamp = value.timeStamp;
        this.amount = value.amount ? new timapi.protocol.sixml.Amount(value.amount) : undefined;
        this.amountDcc = value.amountDcc ? new timapi.protocol.sixml.AmountDcc(value.amountDcc) : undefined;
        this.amountDue = value.amountDue ? new timapi.protocol.sixml.AmountDue(value.amountDue) : undefined;
        this.transactionInformation = value.transactionInformation ? new timapi.protocol.sixml.TransactionInformation(value.transactionInformation) : undefined;
        this.dccDisclaimer = value.dccDisclaimer;
        this.disclaimer = value.disclaimer;
        this.cardData = value.cardData ? new timapi.protocol.sixml.CardData(value.cardData) : undefined;
        this.printData = value.printData ? new timapi.protocol.sixml.PrintData(value.printData) : undefined;
        return;
    }
    if (arguments.length == 1 && a instanceof timapi.protocol.XmlNode) {
        var node = a;
        if (this.xmlHasAttribute(node, "FunctionGroup")) {
            this.functionGroup = this.xmlGetAttribute(node, "FunctionGroup");
        }
        if (this.xmlHasAttribute(node, "Function")) {
            this.function = this.xmlGetAttribute(node, "Function");
        }
        if (this.xmlHasAttribute(node, "SequenceNumber")) {
            this.sequenceNumber = (this.xmlGetAttribute(node, "SequenceNumber") ? parseInt(this.xmlGetAttribute(node, "SequenceNumber")) : 0);
        }
        if (this.xmlHasAttribute(node, "ResultCode")) {
            this.resultCode = (this.xmlGetAttribute(node, "ResultCode") ? parseInt(this.xmlGetAttribute(node, "ResultCode")) : 0);
        }
        if (this.xmlHasAttribute(node, "TimeStamp")) {
            this.timeStamp = new timapi.protocol.TimeDate("yyyyMMdd'T'HHmmssZ", this.xmlGetAttribute(node, "TimeStamp"));
        }
        if (this.xmlHasChild(node, "sixml:Amount")) {
            this.amount = new timapi.protocol.sixml.Amount(this.xmlGetChild(node, "sixml:Amount"));
        }
        if (this.xmlHasChild(node, "sixml:AmountDcc")) {
            this.amountDcc = new timapi.protocol.sixml.AmountDcc(this.xmlGetChild(node, "sixml:AmountDcc"));
        }
        if (this.xmlHasChild(node, "sixml:AmountDue")) {
            this.amountDue = new timapi.protocol.sixml.AmountDue(this.xmlGetChild(node, "sixml:AmountDue"));
        }
        if (this.xmlHasChild(node, "sixml:TransactionInformation")) {
            this.transactionInformation = new timapi.protocol.sixml.TransactionInformation(this.xmlGetChild(node, "sixml:TransactionInformation"));
        }
        if (this.xmlHasChild(node, "sixml:DccDisclaimer")) {
            this.dccDisclaimer = this.xmlGetChild(node, "sixml:DccDisclaimer").textContent;
        }
        if (this.xmlHasChild(node, "sixml:Disclaimer")) {
            this.disclaimer = this.xmlGetChild(node, "sixml:Disclaimer").textContent;
        }
        if (this.xmlHasChild(node, "sixml:CardData")) {
            this.cardData = new timapi.protocol.sixml.CardData(this.xmlGetChild(node, "sixml:CardData"));
        }
        if (this.xmlHasChild(node, "sixml:PrintData")) {
            this.printData = new timapi.protocol.sixml.PrintData(this.xmlGetChild(node, "sixml:PrintData"));
        }
        return;
    }
    if (arguments.length == 0) {
        this.functionGroup = "NonFinTransaction";
        this.function = "Reservation";
        return;
    }
    throw new Error("Invalid argument");
};
timapi.protocol.sixml.Response_Reservation.prototype = Object.create(timapi.protocol.Message.prototype);
timapi.protocol.sixml.Response_Reservation.prototype.functionGroup = undefined;
timapi.protocol.sixml.Response_Reservation.prototype.function = undefined;
timapi.protocol.sixml.Response_Reservation.prototype.sequenceNumber = undefined;
timapi.protocol.sixml.Response_Reservation.prototype.resultCode = undefined;
timapi.protocol.sixml.Response_Reservation.prototype.timeStamp = undefined;
timapi.protocol.sixml.Response_Reservation.prototype.amount = undefined;
timapi.protocol.sixml.Response_Reservation.prototype.amountDcc = undefined;
timapi.protocol.sixml.Response_Reservation.prototype.amountDue = undefined;
timapi.protocol.sixml.Response_Reservation.prototype.transactionInformation = undefined;
timapi.protocol.sixml.Response_Reservation.prototype.dccDisclaimer = undefined;
timapi.protocol.sixml.Response_Reservation.prototype.disclaimer = undefined;
timapi.protocol.sixml.Response_Reservation.prototype.cardData = undefined;
timapi.protocol.sixml.Response_Reservation.prototype.printData = undefined;
timapi.protocol.sixml.Response_Reservation.prototype.toXmlNode = function () {
    var node = new timapi.protocol.XmlNode("sixml:Response");
    this.xmlSetAttribute(node, "xmlns:sixml", "http://www.six-payment-services.com/");
    if (this.functionGroup != undefined) {
        this.xmlSetAttribute(node, "FunctionGroup", this.functionGroup);
    }
    if (this.function != undefined) {
        this.xmlSetAttribute(node, "Function", this.function);
    }
    if (this.sequenceNumber != undefined) {
        this.xmlSetAttribute(node, "SequenceNumber", timapi.utils.StringHelper.makeString(this.sequenceNumber));
    }
    if (this.resultCode != undefined) {
        this.xmlSetAttribute(node, "ResultCode", timapi.utils.StringHelper.makeString(this.resultCode));
    }
    if (this.timeStamp != undefined) {
        this.xmlSetAttribute(node, "TimeStamp", this.timeStamp.format("yyyyMMdd'T'HHmmssZ"));
    }
    if (this.amount != undefined) {
        this.xmlAddChild(node, "sixml:Amount", this.amount);
    }
    if (this.amountDcc != undefined) {
        this.xmlAddChild(node, "sixml:AmountDcc", this.amountDcc);
    }
    if (this.amountDue != undefined) {
        this.xmlAddChild(node, "sixml:AmountDue", this.amountDue);
    }
    if (this.transactionInformation != undefined) {
        this.xmlAddChild(node, "sixml:TransactionInformation", this.transactionInformation);
    }
    if (this.dccDisclaimer != undefined) {
        this.xmlAddChild(node, "sixml:DccDisclaimer", this.dccDisclaimer);
    }
    if (this.disclaimer != undefined) {
        this.xmlAddChild(node, "sixml:Disclaimer", this.disclaimer);
    }
    if (this.cardData != undefined) {
        this.xmlAddChild(node, "sixml:CardData", this.cardData);
    }
    if (this.printData != undefined) {
        this.xmlAddChild(node, "sixml:PrintData", this.printData);
    }
    return node;
};
timapi.protocol.sixml.Response_Reversal = function (a) {
    if (arguments.length == 1 && a instanceof timapi.protocol.sixml.Response_Reversal) {
        var value = a;
        this.functionGroup = value.functionGroup;
        this.function = value.function;
        this.sequenceNumber = value.sequenceNumber;
        this.resultCode = value.resultCode;
        this.timeStamp = value.timeStamp;
        this.transactionInformation = value.transactionInformation ? new timapi.protocol.sixml.TransactionInformation(value.transactionInformation) : undefined;
        this.amount = value.amount ? new timapi.protocol.sixml.Amount(value.amount) : undefined;
        this.amountDcc = value.amountDcc ? new timapi.protocol.sixml.AmountDcc(value.amountDcc) : undefined;
        this.amountSaldo = value.amountSaldo ? new timapi.protocol.sixml.AmountSaldo(value.amountSaldo) : undefined;
        this.dccDisclaimer = value.dccDisclaimer;
        this.disclaimer = value.disclaimer;
        this.printData = value.printData ? new timapi.protocol.sixml.PrintData(value.printData) : undefined;
        return;
    }
    if (arguments.length == 1 && a instanceof timapi.protocol.XmlNode) {
        var node = a;
        if (this.xmlHasAttribute(node, "FunctionGroup")) {
            this.functionGroup = this.xmlGetAttribute(node, "FunctionGroup");
        }
        if (this.xmlHasAttribute(node, "Function")) {
            this.function = this.xmlGetAttribute(node, "Function");
        }
        if (this.xmlHasAttribute(node, "SequenceNumber")) {
            this.sequenceNumber = (this.xmlGetAttribute(node, "SequenceNumber") ? parseInt(this.xmlGetAttribute(node, "SequenceNumber")) : 0);
        }
        if (this.xmlHasAttribute(node, "ResultCode")) {
            this.resultCode = (this.xmlGetAttribute(node, "ResultCode") ? parseInt(this.xmlGetAttribute(node, "ResultCode")) : 0);
        }
        if (this.xmlHasAttribute(node, "TimeStamp")) {
            this.timeStamp = new timapi.protocol.TimeDate("yyyyMMdd'T'HHmmssZ", this.xmlGetAttribute(node, "TimeStamp"));
        }
        if (this.xmlHasChild(node, "sixml:TransactionInformation")) {
            this.transactionInformation = new timapi.protocol.sixml.TransactionInformation(this.xmlGetChild(node, "sixml:TransactionInformation"));
        }
        if (this.xmlHasChild(node, "sixml:Amount")) {
            this.amount = new timapi.protocol.sixml.Amount(this.xmlGetChild(node, "sixml:Amount"));
        }
        if (this.xmlHasChild(node, "sixml:AmountDcc")) {
            this.amountDcc = new timapi.protocol.sixml.AmountDcc(this.xmlGetChild(node, "sixml:AmountDcc"));
        }
        if (this.xmlHasChild(node, "sixml:AmountSaldo")) {
            this.amountSaldo = new timapi.protocol.sixml.AmountSaldo(this.xmlGetChild(node, "sixml:AmountSaldo"));
        }
        if (this.xmlHasChild(node, "sixml:DccDisclaimer")) {
            this.dccDisclaimer = this.xmlGetChild(node, "sixml:DccDisclaimer").textContent;
        }
        if (this.xmlHasChild(node, "sixml:Disclaimer")) {
            this.disclaimer = this.xmlGetChild(node, "sixml:Disclaimer").textContent;
        }
        if (this.xmlHasChild(node, "sixml:PrintData")) {
            this.printData = new timapi.protocol.sixml.PrintData(this.xmlGetChild(node, "sixml:PrintData"));
        }
        return;
    }
    if (arguments.length == 0) {
        this.functionGroup = "FinTransaction";
        this.function = "Reversal";
        return;
    }
    throw new Error("Invalid argument");
};
timapi.protocol.sixml.Response_Reversal.prototype = Object.create(timapi.protocol.Message.prototype);
timapi.protocol.sixml.Response_Reversal.prototype.functionGroup = undefined;
timapi.protocol.sixml.Response_Reversal.prototype.function = undefined;
timapi.protocol.sixml.Response_Reversal.prototype.sequenceNumber = undefined;
timapi.protocol.sixml.Response_Reversal.prototype.resultCode = undefined;
timapi.protocol.sixml.Response_Reversal.prototype.timeStamp = undefined;
timapi.protocol.sixml.Response_Reversal.prototype.transactionInformation = undefined;
timapi.protocol.sixml.Response_Reversal.prototype.amount = undefined;
timapi.protocol.sixml.Response_Reversal.prototype.amountDcc = undefined;
timapi.protocol.sixml.Response_Reversal.prototype.amountSaldo = undefined;
timapi.protocol.sixml.Response_Reversal.prototype.dccDisclaimer = undefined;
timapi.protocol.sixml.Response_Reversal.prototype.disclaimer = undefined;
timapi.protocol.sixml.Response_Reversal.prototype.printData = undefined;
timapi.protocol.sixml.Response_Reversal.prototype.toXmlNode = function () {
    var node = new timapi.protocol.XmlNode("sixml:Response");
    this.xmlSetAttribute(node, "xmlns:sixml", "http://www.six-payment-services.com/");
    if (this.functionGroup != undefined) {
        this.xmlSetAttribute(node, "FunctionGroup", this.functionGroup);
    }
    if (this.function != undefined) {
        this.xmlSetAttribute(node, "Function", this.function);
    }
    if (this.sequenceNumber != undefined) {
        this.xmlSetAttribute(node, "SequenceNumber", timapi.utils.StringHelper.makeString(this.sequenceNumber));
    }
    if (this.resultCode != undefined) {
        this.xmlSetAttribute(node, "ResultCode", timapi.utils.StringHelper.makeString(this.resultCode));
    }
    if (this.timeStamp != undefined) {
        this.xmlSetAttribute(node, "TimeStamp", this.timeStamp.format("yyyyMMdd'T'HHmmssZ"));
    }
    if (this.transactionInformation != undefined) {
        this.xmlAddChild(node, "sixml:TransactionInformation", this.transactionInformation);
    }
    if (this.amount != undefined) {
        this.xmlAddChild(node, "sixml:Amount", this.amount);
    }
    if (this.amountDcc != undefined) {
        this.xmlAddChild(node, "sixml:AmountDcc", this.amountDcc);
    }
    if (this.amountSaldo != undefined) {
        this.xmlAddChild(node, "sixml:AmountSaldo", this.amountSaldo);
    }
    if (this.dccDisclaimer != undefined) {
        this.xmlAddChild(node, "sixml:DccDisclaimer", this.dccDisclaimer);
    }
    if (this.disclaimer != undefined) {
        this.xmlAddChild(node, "sixml:Disclaimer", this.disclaimer);
    }
    if (this.printData != undefined) {
        this.xmlAddChild(node, "sixml:PrintData", this.printData);
    }
    return node;
};
timapi.protocol.sixml.Response_Rollback = function (a) {
    if (arguments.length == 1 && a instanceof timapi.protocol.sixml.Response_Rollback) {
        var value = a;
        this.functionGroup = value.functionGroup;
        this.function = value.function;
        this.sequenceNumber = value.sequenceNumber;
        this.resultCode = value.resultCode;
        this.timeStamp = value.timeStamp;
        this.repeat = value.repeat;
        this.printData = value.printData ? new timapi.protocol.sixml.PrintData(value.printData) : undefined;
        return;
    }
    if (arguments.length == 1 && a instanceof timapi.protocol.XmlNode) {
        var node = a;
        if (this.xmlHasAttribute(node, "FunctionGroup")) {
            this.functionGroup = this.xmlGetAttribute(node, "FunctionGroup");
        }
        if (this.xmlHasAttribute(node, "Function")) {
            this.function = this.xmlGetAttribute(node, "Function");
        }
        if (this.xmlHasAttribute(node, "SequenceNumber")) {
            this.sequenceNumber = (this.xmlGetAttribute(node, "SequenceNumber") ? parseInt(this.xmlGetAttribute(node, "SequenceNumber")) : 0);
        }
        if (this.xmlHasAttribute(node, "ResultCode")) {
            this.resultCode = (this.xmlGetAttribute(node, "ResultCode") ? parseInt(this.xmlGetAttribute(node, "ResultCode")) : 0);
        }
        if (this.xmlHasAttribute(node, "TimeStamp")) {
            this.timeStamp = new timapi.protocol.TimeDate("yyyyMMdd'T'HHmmssZ", this.xmlGetAttribute(node, "TimeStamp"));
        }
        if (this.xmlHasAttribute(node, "Repeat")) {
            this.repeat = (this.xmlGetAttribute(node, "Repeat") ? parseInt(this.xmlGetAttribute(node, "Repeat")) : 0);
        }
        if (this.xmlHasChild(node, "sixml:PrintData")) {
            this.printData = new timapi.protocol.sixml.PrintData(this.xmlGetChild(node, "sixml:PrintData"));
        }
        return;
    }
    if (arguments.length == 0) {
        this.functionGroup = "FinTransaction";
        this.function = "Rollback";
        return;
    }
    throw new Error("Invalid argument");
};
timapi.protocol.sixml.Response_Rollback.prototype = Object.create(timapi.protocol.Message.prototype);
timapi.protocol.sixml.Response_Rollback.prototype.functionGroup = undefined;
timapi.protocol.sixml.Response_Rollback.prototype.function = undefined;
timapi.protocol.sixml.Response_Rollback.prototype.sequenceNumber = undefined;
timapi.protocol.sixml.Response_Rollback.prototype.resultCode = undefined;
timapi.protocol.sixml.Response_Rollback.prototype.timeStamp = undefined;
timapi.protocol.sixml.Response_Rollback.prototype.repeat = undefined;
timapi.protocol.sixml.Response_Rollback.prototype.printData = undefined;
timapi.protocol.sixml.Response_Rollback.prototype.toXmlNode = function () {
    var node = new timapi.protocol.XmlNode("sixml:Response");
    this.xmlSetAttribute(node, "xmlns:sixml", "http://www.six-payment-services.com/");
    if (this.functionGroup != undefined) {
        this.xmlSetAttribute(node, "FunctionGroup", this.functionGroup);
    }
    if (this.function != undefined) {
        this.xmlSetAttribute(node, "Function", this.function);
    }
    if (this.sequenceNumber != undefined) {
        this.xmlSetAttribute(node, "SequenceNumber", timapi.utils.StringHelper.makeString(this.sequenceNumber));
    }
    if (this.resultCode != undefined) {
        this.xmlSetAttribute(node, "ResultCode", timapi.utils.StringHelper.makeString(this.resultCode));
    }
    if (this.timeStamp != undefined) {
        this.xmlSetAttribute(node, "TimeStamp", this.timeStamp.format("yyyyMMdd'T'HHmmssZ"));
    }
    if (this.repeat != undefined) {
        this.xmlSetAttribute(node, "Repeat", timapi.utils.StringHelper.makeString(this.repeat));
    }
    if (this.printData != undefined) {
        this.xmlAddChild(node, "sixml:PrintData", this.printData);
    }
    return node;
};
timapi.protocol.sixml.Response_ShowDialog = function (a) {
    if (arguments.length == 1 && a instanceof timapi.protocol.sixml.Response_ShowDialog) {
        var value = a;
        this.functionGroup = value.functionGroup;
        this.function = value.function;
        this.sequenceNumber = value.sequenceNumber;
        this.resultCode = value.resultCode;
        this.timeStamp = value.timeStamp;
        this.resourceInformation = value.resourceInformation ? new timapi.protocol.sixml.ResourceInformation(value.resourceInformation) : undefined;
        return;
    }
    if (arguments.length == 1 && a instanceof timapi.protocol.XmlNode) {
        var node = a;
        if (this.xmlHasAttribute(node, "FunctionGroup")) {
            this.functionGroup = this.xmlGetAttribute(node, "FunctionGroup");
        }
        if (this.xmlHasAttribute(node, "Function")) {
            this.function = this.xmlGetAttribute(node, "Function");
        }
        if (this.xmlHasAttribute(node, "SequenceNumber")) {
            this.sequenceNumber = (this.xmlGetAttribute(node, "SequenceNumber") ? parseInt(this.xmlGetAttribute(node, "SequenceNumber")) : 0);
        }
        if (this.xmlHasAttribute(node, "ResultCode")) {
            this.resultCode = (this.xmlGetAttribute(node, "ResultCode") ? parseInt(this.xmlGetAttribute(node, "ResultCode")) : 0);
        }
        if (this.xmlHasAttribute(node, "TimeStamp")) {
            this.timeStamp = new timapi.protocol.TimeDate("yyyyMMdd'T'HHmmssZ", this.xmlGetAttribute(node, "TimeStamp"));
        }
        if (this.xmlHasChild(node, "sixml:ResourceInformation")) {
            this.resourceInformation = new timapi.protocol.sixml.ResourceInformation(this.xmlGetChild(node, "sixml:ResourceInformation"));
        }
        return;
    }
    if (arguments.length == 0) {
        this.functionGroup = "Dialog";
        this.function = "ShowDialog";
        return;
    }
    throw new Error("Invalid argument");
};
timapi.protocol.sixml.Response_ShowDialog.prototype = Object.create(timapi.protocol.Message.prototype);
timapi.protocol.sixml.Response_ShowDialog.prototype.functionGroup = undefined;
timapi.protocol.sixml.Response_ShowDialog.prototype.function = undefined;
timapi.protocol.sixml.Response_ShowDialog.prototype.sequenceNumber = undefined;
timapi.protocol.sixml.Response_ShowDialog.prototype.resultCode = undefined;
timapi.protocol.sixml.Response_ShowDialog.prototype.timeStamp = undefined;
timapi.protocol.sixml.Response_ShowDialog.prototype.resourceInformation = undefined;
timapi.protocol.sixml.Response_ShowDialog.prototype.toXmlNode = function () {
    var node = new timapi.protocol.XmlNode("sixml:Response");
    this.xmlSetAttribute(node, "xmlns:sixml", "http://www.six-payment-services.com/");
    if (this.functionGroup != undefined) {
        this.xmlSetAttribute(node, "FunctionGroup", this.functionGroup);
    }
    if (this.function != undefined) {
        this.xmlSetAttribute(node, "Function", this.function);
    }
    if (this.sequenceNumber != undefined) {
        this.xmlSetAttribute(node, "SequenceNumber", timapi.utils.StringHelper.makeString(this.sequenceNumber));
    }
    if (this.resultCode != undefined) {
        this.xmlSetAttribute(node, "ResultCode", timapi.utils.StringHelper.makeString(this.resultCode));
    }
    if (this.timeStamp != undefined) {
        this.xmlSetAttribute(node, "TimeStamp", this.timeStamp.format("yyyyMMdd'T'HHmmssZ"));
    }
    if (this.resourceInformation != undefined) {
        this.xmlAddChild(node, "sixml:ResourceInformation", this.resourceInformation);
    }
    return node;
};
timapi.protocol.sixml.Response_ShowSignatureCapture = function (a) {
    if (arguments.length == 1 && a instanceof timapi.protocol.sixml.Response_ShowSignatureCapture) {
        var value = a;
        this.functionGroup = value.functionGroup;
        this.function = value.function;
        this.sequenceNumber = value.sequenceNumber;
        this.resultCode = value.resultCode;
        this.timeStamp = value.timeStamp;
        this.signatureInformation = value.signatureInformation ? new timapi.protocol.sixml.SignatureInformation(value.signatureInformation) : undefined;
        return;
    }
    if (arguments.length == 1 && a instanceof timapi.protocol.XmlNode) {
        var node = a;
        if (this.xmlHasAttribute(node, "FunctionGroup")) {
            this.functionGroup = this.xmlGetAttribute(node, "FunctionGroup");
        }
        if (this.xmlHasAttribute(node, "Function")) {
            this.function = this.xmlGetAttribute(node, "Function");
        }
        if (this.xmlHasAttribute(node, "SequenceNumber")) {
            this.sequenceNumber = (this.xmlGetAttribute(node, "SequenceNumber") ? parseInt(this.xmlGetAttribute(node, "SequenceNumber")) : 0);
        }
        if (this.xmlHasAttribute(node, "ResultCode")) {
            this.resultCode = (this.xmlGetAttribute(node, "ResultCode") ? parseInt(this.xmlGetAttribute(node, "ResultCode")) : 0);
        }
        if (this.xmlHasAttribute(node, "TimeStamp")) {
            this.timeStamp = new timapi.protocol.TimeDate("yyyyMMdd'T'HHmmssZ", this.xmlGetAttribute(node, "TimeStamp"));
        }
        if (this.xmlHasChild(node, "sixml:SignatureInformation")) {
            this.signatureInformation = new timapi.protocol.sixml.SignatureInformation(this.xmlGetChild(node, "sixml:SignatureInformation"));
        }
        return;
    }
    if (arguments.length == 0) {
        this.functionGroup = "Dialog";
        this.function = "ShowSignatureCapture";
        return;
    }
    throw new Error("Invalid argument");
};
timapi.protocol.sixml.Response_ShowSignatureCapture.prototype = Object.create(timapi.protocol.Message.prototype);
timapi.protocol.sixml.Response_ShowSignatureCapture.prototype.functionGroup = undefined;
timapi.protocol.sixml.Response_ShowSignatureCapture.prototype.function = undefined;
timapi.protocol.sixml.Response_ShowSignatureCapture.prototype.sequenceNumber = undefined;
timapi.protocol.sixml.Response_ShowSignatureCapture.prototype.resultCode = undefined;
timapi.protocol.sixml.Response_ShowSignatureCapture.prototype.timeStamp = undefined;
timapi.protocol.sixml.Response_ShowSignatureCapture.prototype.signatureInformation = undefined;
timapi.protocol.sixml.Response_ShowSignatureCapture.prototype.toXmlNode = function () {
    var node = new timapi.protocol.XmlNode("sixml:Response");
    this.xmlSetAttribute(node, "xmlns:sixml", "http://www.six-payment-services.com/");
    if (this.functionGroup != undefined) {
        this.xmlSetAttribute(node, "FunctionGroup", this.functionGroup);
    }
    if (this.function != undefined) {
        this.xmlSetAttribute(node, "Function", this.function);
    }
    if (this.sequenceNumber != undefined) {
        this.xmlSetAttribute(node, "SequenceNumber", timapi.utils.StringHelper.makeString(this.sequenceNumber));
    }
    if (this.resultCode != undefined) {
        this.xmlSetAttribute(node, "ResultCode", timapi.utils.StringHelper.makeString(this.resultCode));
    }
    if (this.timeStamp != undefined) {
        this.xmlSetAttribute(node, "TimeStamp", this.timeStamp.format("yyyyMMdd'T'HHmmssZ"));
    }
    if (this.signatureInformation != undefined) {
        this.xmlAddChild(node, "sixml:SignatureInformation", this.signatureInformation);
    }
    return node;
};
timapi.protocol.sixml.Response_SoftwareUpdate = function (a) {
    if (arguments.length == 1 && a instanceof timapi.protocol.sixml.Response_SoftwareUpdate) {
        var value = a;
        this.functionGroup = value.functionGroup;
        this.function = value.function;
        this.sequenceNumber = value.sequenceNumber;
        this.resultCode = value.resultCode;
        this.timeStamp = value.timeStamp;
        this.updateStatus = value.updateStatus;
        return;
    }
    if (arguments.length == 1 && a instanceof timapi.protocol.XmlNode) {
        var node = a;
        if (this.xmlHasAttribute(node, "FunctionGroup")) {
            this.functionGroup = this.xmlGetAttribute(node, "FunctionGroup");
        }
        if (this.xmlHasAttribute(node, "Function")) {
            this.function = this.xmlGetAttribute(node, "Function");
        }
        if (this.xmlHasAttribute(node, "SequenceNumber")) {
            this.sequenceNumber = (this.xmlGetAttribute(node, "SequenceNumber") ? parseInt(this.xmlGetAttribute(node, "SequenceNumber")) : 0);
        }
        if (this.xmlHasAttribute(node, "ResultCode")) {
            this.resultCode = (this.xmlGetAttribute(node, "ResultCode") ? parseInt(this.xmlGetAttribute(node, "ResultCode")) : 0);
        }
        if (this.xmlHasAttribute(node, "TimeStamp")) {
            this.timeStamp = new timapi.protocol.TimeDate("yyyyMMdd'T'HHmmssZ", this.xmlGetAttribute(node, "TimeStamp"));
        }
        if (this.xmlHasChild(node, "sixml:UpdateStatus")) {
            this.updateStatus = this.xmlGetChild(node, "sixml:UpdateStatus").textContent;
        }
        return;
    }
    if (arguments.length == 0) {
        this.functionGroup = "Admin";
        this.function = "SoftwareUpdate";
        return;
    }
    throw new Error("Invalid argument");
};
timapi.protocol.sixml.Response_SoftwareUpdate.prototype = Object.create(timapi.protocol.Message.prototype);
timapi.protocol.sixml.Response_SoftwareUpdate.prototype.functionGroup = undefined;
timapi.protocol.sixml.Response_SoftwareUpdate.prototype.function = undefined;
timapi.protocol.sixml.Response_SoftwareUpdate.prototype.sequenceNumber = undefined;
timapi.protocol.sixml.Response_SoftwareUpdate.prototype.resultCode = undefined;
timapi.protocol.sixml.Response_SoftwareUpdate.prototype.timeStamp = undefined;
timapi.protocol.sixml.Response_SoftwareUpdate.prototype.updateStatus = undefined;
timapi.protocol.sixml.Response_SoftwareUpdate.prototype.toXmlNode = function () {
    var node = new timapi.protocol.XmlNode("sixml:Response");
    this.xmlSetAttribute(node, "xmlns:sixml", "http://www.six-payment-services.com/");
    if (this.functionGroup != undefined) {
        this.xmlSetAttribute(node, "FunctionGroup", this.functionGroup);
    }
    if (this.function != undefined) {
        this.xmlSetAttribute(node, "Function", this.function);
    }
    if (this.sequenceNumber != undefined) {
        this.xmlSetAttribute(node, "SequenceNumber", timapi.utils.StringHelper.makeString(this.sequenceNumber));
    }
    if (this.resultCode != undefined) {
        this.xmlSetAttribute(node, "ResultCode", timapi.utils.StringHelper.makeString(this.resultCode));
    }
    if (this.timeStamp != undefined) {
        this.xmlSetAttribute(node, "TimeStamp", this.timeStamp.format("yyyyMMdd'T'HHmmssZ"));
    }
    if (this.updateStatus != undefined) {
        this.xmlAddChild(node, "sixml:UpdateStatus", this.updateStatus);
    }
    return node;
};
timapi.protocol.sixml.Response_SystemInformation = function (a) {
    if (arguments.length == 1 && a instanceof timapi.protocol.sixml.Response_SystemInformation) {
        var value = a;
        this.functionGroup = value.functionGroup;
        this.function = value.function;
        this.sequenceNumber = value.sequenceNumber;
        this.resultCode = value.resultCode;
        this.timeStamp = value.timeStamp;
        this.configData = value.configData ? new timapi.protocol.sixml.ConfigData(value.configData) : undefined;
        this.networkInformation = value.networkInformation ? new timapi.protocol.sixml.NetworkInformation(value.networkInformation) : undefined;
        return;
    }
    if (arguments.length == 1 && a instanceof timapi.protocol.XmlNode) {
        var node = a;
        if (this.xmlHasAttribute(node, "FunctionGroup")) {
            this.functionGroup = this.xmlGetAttribute(node, "FunctionGroup");
        }
        if (this.xmlHasAttribute(node, "Function")) {
            this.function = this.xmlGetAttribute(node, "Function");
        }
        if (this.xmlHasAttribute(node, "SequenceNumber")) {
            this.sequenceNumber = (this.xmlGetAttribute(node, "SequenceNumber") ? parseInt(this.xmlGetAttribute(node, "SequenceNumber")) : 0);
        }
        if (this.xmlHasAttribute(node, "ResultCode")) {
            this.resultCode = (this.xmlGetAttribute(node, "ResultCode") ? parseInt(this.xmlGetAttribute(node, "ResultCode")) : 0);
        }
        if (this.xmlHasAttribute(node, "TimeStamp")) {
            this.timeStamp = new timapi.protocol.TimeDate("yyyyMMdd'T'HHmmssZ", this.xmlGetAttribute(node, "TimeStamp"));
        }
        if (this.xmlHasChild(node, "sixml:ConfigData")) {
            this.configData = new timapi.protocol.sixml.ConfigData(this.xmlGetChild(node, "sixml:ConfigData"));
        }
        if (this.xmlHasChild(node, "sixml:NetworkInformation")) {
            this.networkInformation = new timapi.protocol.sixml.NetworkInformation(this.xmlGetChild(node, "sixml:NetworkInformation"));
        }
        return;
    }
    if (arguments.length == 0) {
        this.functionGroup = "Status";
        this.function = "SystemInformation";
        return;
    }
    throw new Error("Invalid argument");
};
timapi.protocol.sixml.Response_SystemInformation.prototype = Object.create(timapi.protocol.Message.prototype);
timapi.protocol.sixml.Response_SystemInformation.prototype.functionGroup = undefined;
timapi.protocol.sixml.Response_SystemInformation.prototype.function = undefined;
timapi.protocol.sixml.Response_SystemInformation.prototype.sequenceNumber = undefined;
timapi.protocol.sixml.Response_SystemInformation.prototype.resultCode = undefined;
timapi.protocol.sixml.Response_SystemInformation.prototype.timeStamp = undefined;
timapi.protocol.sixml.Response_SystemInformation.prototype.configData = undefined;
timapi.protocol.sixml.Response_SystemInformation.prototype.networkInformation = undefined;
timapi.protocol.sixml.Response_SystemInformation.prototype.toXmlNode = function () {
    var node = new timapi.protocol.XmlNode("sixml:Response");
    this.xmlSetAttribute(node, "xmlns:sixml", "http://www.six-payment-services.com/");
    if (this.functionGroup != undefined) {
        this.xmlSetAttribute(node, "FunctionGroup", this.functionGroup);
    }
    if (this.function != undefined) {
        this.xmlSetAttribute(node, "Function", this.function);
    }
    if (this.sequenceNumber != undefined) {
        this.xmlSetAttribute(node, "SequenceNumber", timapi.utils.StringHelper.makeString(this.sequenceNumber));
    }
    if (this.resultCode != undefined) {
        this.xmlSetAttribute(node, "ResultCode", timapi.utils.StringHelper.makeString(this.resultCode));
    }
    if (this.timeStamp != undefined) {
        this.xmlSetAttribute(node, "TimeStamp", this.timeStamp.format("yyyyMMdd'T'HHmmssZ"));
    }
    if (this.configData != undefined) {
        this.xmlAddChild(node, "sixml:ConfigData", this.configData);
    }
    if (this.networkInformation != undefined) {
        this.xmlAddChild(node, "sixml:NetworkInformation", this.networkInformation);
    }
    return node;
};
timapi.protocol.sixml.Response_TerminalStatus = function (a) {
    if (arguments.length == 1 && a instanceof timapi.protocol.sixml.Response_TerminalStatus) {
        var value = a;
        this.functionGroup = value.functionGroup;
        this.function = value.function;
        this.sequenceNumber = value.sequenceNumber;
        this.resultCode = value.resultCode;
        this.timeStamp = value.timeStamp;
        this.displayContent = value.displayContent ? new timapi.protocol.sixml.DisplayContent(value.displayContent) : undefined;
        this.cardReaderStatus = value.cardReaderStatus;
        this.transactionStatus = value.transactionStatus;
        this.connectionStatus = value.connectionStatus;
        this.managementStatus = value.managementStatus;
        this.sleepModeStatus = value.sleepModeStatus;
        this.receiptInformation = value.receiptInformation;
        this.cardData = value.cardData ? new timapi.protocol.sixml.CardData(value.cardData) : undefined;
        this.swUpdateAvailable = value.swUpdateAvailable;
        this.terminalId = value.terminalId;
        return;
    }
    if (arguments.length == 1 && a instanceof timapi.protocol.XmlNode) {
        var node = a;
        if (this.xmlHasAttribute(node, "FunctionGroup")) {
            this.functionGroup = this.xmlGetAttribute(node, "FunctionGroup");
        }
        if (this.xmlHasAttribute(node, "Function")) {
            this.function = this.xmlGetAttribute(node, "Function");
        }
        if (this.xmlHasAttribute(node, "SequenceNumber")) {
            this.sequenceNumber = (this.xmlGetAttribute(node, "SequenceNumber") ? parseInt(this.xmlGetAttribute(node, "SequenceNumber")) : 0);
        }
        if (this.xmlHasAttribute(node, "ResultCode")) {
            this.resultCode = (this.xmlGetAttribute(node, "ResultCode") ? parseInt(this.xmlGetAttribute(node, "ResultCode")) : 0);
        }
        if (this.xmlHasAttribute(node, "TimeStamp")) {
            this.timeStamp = new timapi.protocol.TimeDate("yyyyMMdd'T'HHmmssZ", this.xmlGetAttribute(node, "TimeStamp"));
        }
        if (this.xmlHasChild(node, "sixml:DisplayContent")) {
            this.displayContent = new timapi.protocol.sixml.DisplayContent(this.xmlGetChild(node, "sixml:DisplayContent"));
        }
        if (this.xmlHasChild(node, "sixml:CardReaderStatus")) {
            this.cardReaderStatus = this.xmlGetChild(node, "sixml:CardReaderStatus").textContent;
        }
        if (this.xmlHasChild(node, "sixml:TransactionStatus")) {
            this.transactionStatus = this.xmlGetChild(node, "sixml:TransactionStatus").textContent;
        }
        if (this.xmlHasChild(node, "sixml:ConnectionStatus")) {
            this.connectionStatus = this.xmlGetChild(node, "sixml:ConnectionStatus").textContent;
        }
        if (this.xmlHasChild(node, "sixml:ManagementStatus")) {
            this.managementStatus = this.xmlGetChild(node, "sixml:ManagementStatus").textContent;
        }
        if (this.xmlHasChild(node, "sixml:SleepModeStatus")) {
            this.sleepModeStatus = this.xmlGetChild(node, "sixml:SleepModeStatus").textContent;
        }
        if (this.xmlHasChild(node, "sixml:ReceiptInformation")) {
            this.receiptInformation = this.xmlGetChild(node, "sixml:ReceiptInformation").textContent == "1";
        }
        if (this.xmlHasChild(node, "sixml:CardData")) {
            this.cardData = new timapi.protocol.sixml.CardData(this.xmlGetChild(node, "sixml:CardData"));
        }
        if (this.xmlHasChild(node, "sixml:SwUpdateAvailable")) {
            this.swUpdateAvailable = this.xmlGetChild(node, "sixml:SwUpdateAvailable").textContent == "1";
        }
        if (this.xmlHasChild(node, "sixml:TerminalId")) {
            this.terminalId = this.xmlGetChild(node, "sixml:TerminalId").textContent;
        }
        return;
    }
    if (arguments.length == 0) {
        this.functionGroup = "Status";
        this.function = "TerminalStatus";
        return;
    }
    throw new Error("Invalid argument");
};
timapi.protocol.sixml.Response_TerminalStatus.prototype = Object.create(timapi.protocol.Message.prototype);
timapi.protocol.sixml.Response_TerminalStatus.prototype.functionGroup = undefined;
timapi.protocol.sixml.Response_TerminalStatus.prototype.function = undefined;
timapi.protocol.sixml.Response_TerminalStatus.prototype.sequenceNumber = undefined;
timapi.protocol.sixml.Response_TerminalStatus.prototype.resultCode = undefined;
timapi.protocol.sixml.Response_TerminalStatus.prototype.timeStamp = undefined;
timapi.protocol.sixml.Response_TerminalStatus.prototype.displayContent = undefined;
timapi.protocol.sixml.Response_TerminalStatus.prototype.cardReaderStatus = undefined;
timapi.protocol.sixml.Response_TerminalStatus.prototype.transactionStatus = undefined;
timapi.protocol.sixml.Response_TerminalStatus.prototype.connectionStatus = undefined;
timapi.protocol.sixml.Response_TerminalStatus.prototype.managementStatus = undefined;
timapi.protocol.sixml.Response_TerminalStatus.prototype.sleepModeStatus = undefined;
timapi.protocol.sixml.Response_TerminalStatus.prototype.receiptInformation = undefined;
timapi.protocol.sixml.Response_TerminalStatus.prototype.cardData = undefined;
timapi.protocol.sixml.Response_TerminalStatus.prototype.swUpdateAvailable = undefined;
timapi.protocol.sixml.Response_TerminalStatus.prototype.terminalId = undefined;
timapi.protocol.sixml.Response_TerminalStatus.prototype.toXmlNode = function () {
    var node = new timapi.protocol.XmlNode("sixml:Response");
    this.xmlSetAttribute(node, "xmlns:sixml", "http://www.six-payment-services.com/");
    if (this.functionGroup != undefined) {
        this.xmlSetAttribute(node, "FunctionGroup", this.functionGroup);
    }
    if (this.function != undefined) {
        this.xmlSetAttribute(node, "Function", this.function);
    }
    if (this.sequenceNumber != undefined) {
        this.xmlSetAttribute(node, "SequenceNumber", timapi.utils.StringHelper.makeString(this.sequenceNumber));
    }
    if (this.resultCode != undefined) {
        this.xmlSetAttribute(node, "ResultCode", timapi.utils.StringHelper.makeString(this.resultCode));
    }
    if (this.timeStamp != undefined) {
        this.xmlSetAttribute(node, "TimeStamp", this.timeStamp.format("yyyyMMdd'T'HHmmssZ"));
    }
    if (this.displayContent != undefined) {
        this.xmlAddChild(node, "sixml:DisplayContent", this.displayContent);
    }
    if (this.cardReaderStatus != undefined) {
        this.xmlAddChild(node, "sixml:CardReaderStatus", this.cardReaderStatus);
    }
    if (this.transactionStatus != undefined) {
        this.xmlAddChild(node, "sixml:TransactionStatus", this.transactionStatus);
    }
    if (this.connectionStatus != undefined) {
        this.xmlAddChild(node, "sixml:ConnectionStatus", this.connectionStatus);
    }
    if (this.managementStatus != undefined) {
        this.xmlAddChild(node, "sixml:ManagementStatus", this.managementStatus);
    }
    if (this.sleepModeStatus != undefined) {
        this.xmlAddChild(node, "sixml:SleepModeStatus", this.sleepModeStatus);
    }
    if (this.receiptInformation != undefined) {
        this.xmlAddChild(node, "sixml:ReceiptInformation", (this.receiptInformation ? "1" : "0"));
    }
    if (this.cardData != undefined) {
        this.xmlAddChild(node, "sixml:CardData", this.cardData);
    }
    if (this.swUpdateAvailable != undefined) {
        this.xmlAddChild(node, "sixml:SwUpdateAvailable", (this.swUpdateAvailable ? "1" : "0"));
    }
    if (this.terminalId != undefined) {
        this.xmlAddChild(node, "sixml:TerminalId", this.terminalId);
    }
    return node;
};
timapi.protocol.sixml.ScreenshotOptions = function (a) {
    if (arguments.length == 1 && a instanceof timapi.protocol.sixml.ScreenshotOptions) {
        var value = a;
        return;
    }
    if (arguments.length == 1 && a instanceof timapi.protocol.XmlNode) {
        var node = a;
        return;
    }
    if (arguments.length != 0) {
        throw new Error("Invalid argument");
    }
};
timapi.protocol.sixml.ScreenshotOptions.prototype = Object.create(timapi.protocol.Container.prototype);
timapi.protocol.sixml.ScreenshotOptions.prototype.toXmlNode = function () {
    var node = new timapi.protocol.XmlNode("sixml:ScreenshotOptions");
    return node;
};
timapi.protocol.sixml.Setting = function (a) {
    if (arguments.length == 1 && a instanceof timapi.protocol.sixml.Setting) {
        var value = a;
        this.value = value.value;
        this.settingType = value.settingType;
        return;
    }
    if (arguments.length == 1 && a instanceof timapi.protocol.XmlNode) {
        var node = a;
        this.value = node.textContent;
        if (this.xmlHasAttribute(node, "SettingType")) {
            this.settingType = this.xmlGetAttribute(node, "SettingType");
        }
        return;
    }
    if (arguments.length != 0) {
        throw new Error("Invalid argument");
    }
};
timapi.protocol.sixml.Setting.prototype = Object.create(timapi.protocol.Container.prototype);
timapi.protocol.sixml.Setting.prototype.value = "";
timapi.protocol.sixml.Setting.prototype.settingType = undefined;
timapi.protocol.sixml.Setting.prototype.toXmlNode = function () {
    var node = new timapi.protocol.XmlNode("sixml:Setting");
    node.textContent = this.value;
    if (this.settingType != undefined) {
        this.xmlSetAttribute(node, "SettingType", this.settingType);
    }
    return node;
};
timapi.protocol.sixml.SettingsList = function (a) {
    this.setting = [];
    if (arguments.length == 1 && a instanceof timapi.protocol.sixml.SettingsList) {
        var value = a;
        for (var each of value.setting) {
            this.setting.push(each ? new timapi.protocol.sixml.Setting(each) : undefined);
        }
        return;
    }
    if (arguments.length == 1 && a instanceof timapi.protocol.XmlNode) {
        var node = a;
        for (var each of this.xmlGetChildren(node, "sixml:Setting")) {
            this.setting.push(new timapi.protocol.sixml.Setting(each));
        }
        return;
    }
    if (arguments.length != 0) {
        throw new Error("Invalid argument");
    }
};
timapi.protocol.sixml.SettingsList.prototype = Object.create(timapi.protocol.Container.prototype);
timapi.protocol.sixml.SettingsList.prototype.setting = undefined;
timapi.protocol.sixml.SettingsList.prototype.toXmlNode = function () {
    var node = new timapi.protocol.XmlNode("sixml:SettingsList");
    for (var each of this.setting) {
        this.xmlAddChild(node, "sixml:Setting", each);
    }
    return node;
};
timapi.protocol.sixml.SignatureCapture = function (a) {
    if (arguments.length == 1 && a instanceof timapi.protocol.sixml.SignatureCapture) {
        var value = a;
        return;
    }
    if (arguments.length == 1 && a instanceof timapi.protocol.XmlNode) {
        var node = a;
        return;
    }
    if (arguments.length != 0) {
        throw new Error("Invalid argument");
    }
};
timapi.protocol.sixml.SignatureCapture.prototype = Object.create(timapi.protocol.Container.prototype);
timapi.protocol.sixml.SignatureCapture.prototype.toXmlNode = function () {
    var node = new timapi.protocol.XmlNode("sixml:SignatureCapture");
    return node;
};
timapi.protocol.sixml.SignatureData = function (a) {
    if (arguments.length == 1 && a instanceof timapi.protocol.sixml.SignatureData) {
        var value = a;
        this.resourceId = value.resourceId;
        this.timeout = value.timeout;
        this.theme = value.theme;
        this.imageFileFormat = value.imageFileFormat;
        this.imageHeight = value.imageHeight;
        this.imageWidth = value.imageWidth;
        this.backgroundColor = value.backgroundColor;
        this.watermarkColor = value.watermarkColor;
        this.signatureColor = value.signatureColor;
        this.language = value.language;
        this.watermarkItemList = value.watermarkItemList ? new timapi.protocol.sixml.WatermarkItemList(value.watermarkItemList) : undefined;
        return;
    }
    if (arguments.length == 1 && a instanceof timapi.protocol.XmlNode) {
        var node = a;
        if (this.xmlHasAttribute(node, "ResourceId")) {
            this.resourceId = (this.xmlGetAttribute(node, "ResourceId") ? parseInt(this.xmlGetAttribute(node, "ResourceId")) : 0);
        }
        if (this.xmlHasAttribute(node, "Timeout")) {
            this.timeout = (this.xmlGetAttribute(node, "Timeout") ? parseInt(this.xmlGetAttribute(node, "Timeout")) : 0);
        }
        if (this.xmlHasAttribute(node, "Theme")) {
            this.theme = this.xmlGetAttribute(node, "Theme");
        }
        if (this.xmlHasAttribute(node, "ImageFileFormat")) {
            this.imageFileFormat = this.xmlGetAttribute(node, "ImageFileFormat");
        }
        if (this.xmlHasAttribute(node, "ImageHeight")) {
            this.imageHeight = (this.xmlGetAttribute(node, "ImageHeight") ? parseInt(this.xmlGetAttribute(node, "ImageHeight")) : 0);
        }
        if (this.xmlHasAttribute(node, "ImageWidth")) {
            this.imageWidth = (this.xmlGetAttribute(node, "ImageWidth") ? parseInt(this.xmlGetAttribute(node, "ImageWidth")) : 0);
        }
        if (this.xmlHasAttribute(node, "BackgroundColor")) {
            this.backgroundColor = this.xmlGetAttribute(node, "BackgroundColor");
        }
        if (this.xmlHasAttribute(node, "WatermarkColor")) {
            this.watermarkColor = this.xmlGetAttribute(node, "WatermarkColor");
        }
        if (this.xmlHasAttribute(node, "SignatureColor")) {
            this.signatureColor = this.xmlGetAttribute(node, "SignatureColor");
        }
        if (this.xmlHasChild(node, "sixml:Language")) {
            this.language = this.xmlGetChild(node, "sixml:Language").textContent;
        }
        if (this.xmlHasChild(node, "sixml:WatermarkItemList")) {
            this.watermarkItemList = new timapi.protocol.sixml.WatermarkItemList(this.xmlGetChild(node, "sixml:WatermarkItemList"));
        }
        return;
    }
    if (arguments.length != 0) {
        throw new Error("Invalid argument");
    }
};
timapi.protocol.sixml.SignatureData.prototype = Object.create(timapi.protocol.Container.prototype);
timapi.protocol.sixml.SignatureData.prototype.resourceId = undefined;
timapi.protocol.sixml.SignatureData.prototype.timeout = undefined;
timapi.protocol.sixml.SignatureData.prototype.theme = undefined;
timapi.protocol.sixml.SignatureData.prototype.imageFileFormat = undefined;
timapi.protocol.sixml.SignatureData.prototype.imageHeight = undefined;
timapi.protocol.sixml.SignatureData.prototype.imageWidth = undefined;
timapi.protocol.sixml.SignatureData.prototype.backgroundColor = undefined;
timapi.protocol.sixml.SignatureData.prototype.watermarkColor = undefined;
timapi.protocol.sixml.SignatureData.prototype.signatureColor = undefined;
timapi.protocol.sixml.SignatureData.prototype.language = undefined;
timapi.protocol.sixml.SignatureData.prototype.watermarkItemList = undefined;
timapi.protocol.sixml.SignatureData.prototype.toXmlNode = function () {
    var node = new timapi.protocol.XmlNode("sixml:SignatureData");
    if (this.resourceId != undefined) {
        this.xmlSetAttribute(node, "ResourceId", timapi.utils.StringHelper.makeString(this.resourceId));
    }
    if (this.timeout != undefined) {
        this.xmlSetAttribute(node, "Timeout", timapi.utils.StringHelper.makeString(this.timeout));
    }
    if (this.theme != undefined) {
        this.xmlSetAttribute(node, "Theme", this.theme);
    }
    if (this.imageFileFormat != undefined) {
        this.xmlSetAttribute(node, "ImageFileFormat", this.imageFileFormat);
    }
    if (this.imageHeight != undefined) {
        this.xmlSetAttribute(node, "ImageHeight", timapi.utils.StringHelper.makeString(this.imageHeight));
    }
    if (this.imageWidth != undefined) {
        this.xmlSetAttribute(node, "ImageWidth", timapi.utils.StringHelper.makeString(this.imageWidth));
    }
    if (this.backgroundColor != undefined) {
        this.xmlSetAttribute(node, "BackgroundColor", this.backgroundColor);
    }
    if (this.watermarkColor != undefined) {
        this.xmlSetAttribute(node, "WatermarkColor", this.watermarkColor);
    }
    if (this.signatureColor != undefined) {
        this.xmlSetAttribute(node, "SignatureColor", this.signatureColor);
    }
    if (this.language != undefined) {
        this.xmlAddChild(node, "sixml:Language", this.language);
    }
    if (this.watermarkItemList != undefined) {
        this.xmlAddChild(node, "sixml:WatermarkItemList", this.watermarkItemList);
    }
    return node;
};
timapi.protocol.sixml.SignatureInformation = function (a) {
    if (arguments.length == 1 && a instanceof timapi.protocol.sixml.SignatureInformation) {
        var value = a;
        this.value = value.value;
        this.imageFileFormat = value.imageFileFormat;
        this.imageWidth = value.imageWidth;
        this.imageHeight = value.imageHeight;
        this.reason = value.reason;
        return;
    }
    if (arguments.length == 1 && a instanceof timapi.protocol.XmlNode) {
        var node = a;
        this.value = timapi.ConversionHelper.hexStringToByte(node.textContent);
        if (this.xmlHasAttribute(node, "ImageFileFormat")) {
            this.imageFileFormat = this.xmlGetAttribute(node, "ImageFileFormat");
        }
        if (this.xmlHasAttribute(node, "ImageWidth")) {
            this.imageWidth = (this.xmlGetAttribute(node, "ImageWidth") ? parseInt(this.xmlGetAttribute(node, "ImageWidth")) : 0);
        }
        if (this.xmlHasAttribute(node, "ImageHeight")) {
            this.imageHeight = (this.xmlGetAttribute(node, "ImageHeight") ? parseInt(this.xmlGetAttribute(node, "ImageHeight")) : 0);
        }
        if (this.xmlHasAttribute(node, "Reason")) {
            this.reason = this.xmlGetAttribute(node, "Reason");
        }
        return;
    }
    if (arguments.length != 0) {
        throw new Error("Invalid argument");
    }
};
timapi.protocol.sixml.SignatureInformation.prototype = Object.create(timapi.protocol.Container.prototype);
timapi.protocol.sixml.SignatureInformation.prototype.value = new Uint8Array(0);
timapi.protocol.sixml.SignatureInformation.prototype.imageFileFormat = undefined;
timapi.protocol.sixml.SignatureInformation.prototype.imageWidth = undefined;
timapi.protocol.sixml.SignatureInformation.prototype.imageHeight = undefined;
timapi.protocol.sixml.SignatureInformation.prototype.reason = undefined;
timapi.protocol.sixml.SignatureInformation.prototype.toXmlNode = function () {
    var node = new timapi.protocol.XmlNode("sixml:SignatureInformation");
    node.textContent = timapi.protocol.ConversionHelper.byteToHexString(this.value);
    if (this.imageFileFormat != undefined) {
        this.xmlSetAttribute(node, "ImageFileFormat", this.imageFileFormat);
    }
    if (this.imageWidth != undefined) {
        this.xmlSetAttribute(node, "ImageWidth", timapi.utils.StringHelper.makeString(this.imageWidth));
    }
    if (this.imageHeight != undefined) {
        this.xmlSetAttribute(node, "ImageHeight", timapi.utils.StringHelper.makeString(this.imageHeight));
    }
    if (this.reason != undefined) {
        this.xmlSetAttribute(node, "Reason", this.reason);
    }
    return node;
};
timapi.protocol.sixml.Statistic = function (a) {
    if (arguments.length == 1 && a instanceof timapi.protocol.sixml.Statistic) {
        var value = a;
        this.value = value.value;
        this.statisticType = value.statisticType;
        return;
    }
    if (arguments.length == 1 && a instanceof timapi.protocol.XmlNode) {
        var node = a;
        this.value = node.textContent;
        if (this.xmlHasAttribute(node, "StatisticType")) {
            this.statisticType = this.xmlGetAttribute(node, "StatisticType");
        }
        return;
    }
    if (arguments.length != 0) {
        throw new Error("Invalid argument");
    }
};
timapi.protocol.sixml.Statistic.prototype = Object.create(timapi.protocol.Container.prototype);
timapi.protocol.sixml.Statistic.prototype.value = "";
timapi.protocol.sixml.Statistic.prototype.statisticType = undefined;
timapi.protocol.sixml.Statistic.prototype.toXmlNode = function () {
    var node = new timapi.protocol.XmlNode("sixml:Statistic");
    node.textContent = this.value;
    if (this.statisticType != undefined) {
        this.xmlSetAttribute(node, "StatisticType", this.statisticType);
    }
    return node;
};
timapi.protocol.sixml.StatisticsList = function (a) {
    this.statistic = [];
    if (arguments.length == 1 && a instanceof timapi.protocol.sixml.StatisticsList) {
        var value = a;
        for (var each of value.statistic) {
            this.statistic.push(each ? new timapi.protocol.sixml.Statistic(each) : undefined);
        }
        return;
    }
    if (arguments.length == 1 && a instanceof timapi.protocol.XmlNode) {
        var node = a;
        for (var each of this.xmlGetChildren(node, "sixml:Statistic")) {
            this.statistic.push(new timapi.protocol.sixml.Statistic(each));
        }
        return;
    }
    if (arguments.length != 0) {
        throw new Error("Invalid argument");
    }
};
timapi.protocol.sixml.StatisticsList.prototype = Object.create(timapi.protocol.Container.prototype);
timapi.protocol.sixml.StatisticsList.prototype.statistic = undefined;
timapi.protocol.sixml.StatisticsList.prototype.toXmlNode = function () {
    var node = new timapi.protocol.XmlNode("sixml:StatisticsList");
    for (var each of this.statistic) {
        this.xmlAddChild(node, "sixml:Statistic", each);
    }
    return node;
};
timapi.protocol.sixml.TimeoutData = function (a) {
    if (arguments.length == 1 && a instanceof timapi.protocol.sixml.TimeoutData) {
        var value = a;
        this.timeoutType = value.timeoutType;
        this.extraTime = value.extraTime;
        return;
    }
    if (arguments.length == 1 && a instanceof timapi.protocol.XmlNode) {
        var node = a;
        if (this.xmlHasAttribute(node, "TimeoutType")) {
            this.timeoutType = this.xmlGetAttribute(node, "TimeoutType");
        }
        if (this.xmlHasAttribute(node, "ExtraTime")) {
            this.extraTime = (this.xmlGetAttribute(node, "ExtraTime") ? parseInt(this.xmlGetAttribute(node, "ExtraTime")) : 0);
        }
        return;
    }
    if (arguments.length != 0) {
        throw new Error("Invalid argument");
    }
};
timapi.protocol.sixml.TimeoutData.prototype = Object.create(timapi.protocol.Container.prototype);
timapi.protocol.sixml.TimeoutData.prototype.timeoutType = undefined;
timapi.protocol.sixml.TimeoutData.prototype.extraTime = undefined;
timapi.protocol.sixml.TimeoutData.prototype.toXmlNode = function () {
    var node = new timapi.protocol.XmlNode("sixml:TimeoutData");
    if (this.timeoutType != undefined) {
        this.xmlSetAttribute(node, "TimeoutType", this.timeoutType);
    }
    if (this.extraTime != undefined) {
        this.xmlSetAttribute(node, "ExtraTime", timapi.utils.StringHelper.makeString(this.extraTime));
    }
    return node;
};
timapi.protocol.sixml.Total = function (a) {
    this.trxDetail = [];
    if (arguments.length == 1 && a instanceof timapi.protocol.sixml.Total) {
        var value = a;
        this.currency = value.currency;
        this.exponent = value.exponent;
        this.count = value.count;
        this.amountSum = value.amountSum;
        for (var each of value.trxDetail) {
            this.trxDetail.push(each ? new timapi.protocol.sixml.TrxDetail(each) : undefined);
        }
        this.amountSumOther = value.amountSumOther;
        this.amountSumTip = value.amountSumTip;
        return;
    }
    if (arguments.length == 1 && a instanceof timapi.protocol.XmlNode) {
        var node = a;
        if (this.xmlHasAttribute(node, "Currency")) {
            this.currency = this.xmlGetAttribute(node, "Currency");
        }
        if (this.xmlHasAttribute(node, "Exponent")) {
            this.exponent = (this.xmlGetAttribute(node, "Exponent") ? parseInt(this.xmlGetAttribute(node, "Exponent")) : 0);
        }
        if (this.xmlHasAttribute(node, "Count")) {
            this.count = (this.xmlGetAttribute(node, "Count") ? parseInt(this.xmlGetAttribute(node, "Count")) : 0);
        }
        if (this.xmlHasAttribute(node, "AmountSum")) {
            this.amountSum = (this.xmlGetAttribute(node, "AmountSum") ? parseInt(this.xmlGetAttribute(node, "AmountSum")) : 0);
        }
        for (var each of this.xmlGetChildren(node, "sixml:TrxDetail")) {
            this.trxDetail.push(new timapi.protocol.sixml.TrxDetail(each));
        }
        if (this.xmlHasAttribute(node, "AmountSumOther")) {
            this.amountSumOther = (this.xmlGetAttribute(node, "AmountSumOther") ? parseInt(this.xmlGetAttribute(node, "AmountSumOther")) : 0);
        }
        if (this.xmlHasAttribute(node, "AmountSumTip")) {
            this.amountSumTip = (this.xmlGetAttribute(node, "AmountSumTip") ? parseInt(this.xmlGetAttribute(node, "AmountSumTip")) : 0);
        }
        return;
    }
    if (arguments.length != 0) {
        throw new Error("Invalid argument");
    }
};
timapi.protocol.sixml.Total.prototype = Object.create(timapi.protocol.Container.prototype);
timapi.protocol.sixml.Total.prototype.currency = undefined;
timapi.protocol.sixml.Total.prototype.exponent = undefined;
timapi.protocol.sixml.Total.prototype.count = undefined;
timapi.protocol.sixml.Total.prototype.amountSum = undefined;
timapi.protocol.sixml.Total.prototype.trxDetail = undefined;
timapi.protocol.sixml.Total.prototype.amountSumOther = undefined;
timapi.protocol.sixml.Total.prototype.amountSumTip = undefined;
timapi.protocol.sixml.Total.prototype.toXmlNode = function () {
    var node = new timapi.protocol.XmlNode("sixml:Total");
    if (this.currency != undefined) {
        this.xmlSetAttribute(node, "Currency", this.currency);
    }
    if (this.exponent != undefined) {
        this.xmlSetAttribute(node, "Exponent", timapi.utils.StringHelper.makeString(this.exponent));
    }
    if (this.count != undefined) {
        this.xmlSetAttribute(node, "Count", timapi.utils.StringHelper.makeString(this.count));
    }
    if (this.amountSum != undefined) {
        this.xmlSetAttribute(node, "AmountSum", timapi.utils.StringHelper.makeString(this.amountSum));
    }
    for (var each of this.trxDetail) {
        this.xmlAddChild(node, "sixml:TrxDetail", each);
    }
    if (this.amountSumOther != undefined) {
        this.xmlSetAttribute(node, "AmountSumOther", timapi.utils.StringHelper.makeString(this.amountSumOther));
    }
    if (this.amountSumTip != undefined) {
        this.xmlSetAttribute(node, "AmountSumTip", timapi.utils.StringHelper.makeString(this.amountSumTip));
    }
    return node;
};
timapi.protocol.sixml.TransactionData = function (a) {
    if (arguments.length == 1 && a instanceof timapi.protocol.sixml.TransactionData) {
        var value = a;
        this.dccAllowed = value.dccAllowed;
        this.partialApprovalAllowed = value.partialApprovalAllowed;
        this.trxOriginalDate = value.trxOriginalDate;
        this.ecrSeqCounter = value.ecrSeqCounter;
        this.transRef = value.transRef;
        this.transSeq = value.transSeq;
        this.cardRef = value.cardRef;
        this.trmTransRef = value.trmTransRef;
        this.acqTransRef = value.acqTransRef;
        this.acqId = value.acqId;
        this.phoneAuthCode = value.phoneAuthCode;
        this.multiCurrencyFlag = value.multiCurrencyFlag;
        this.tipAllowed = value.tipAllowed;
        this.ngvmode = value.ngvmode;
        this.ngvclearingDelay = value.ngvclearingDelay;
        return;
    }
    if (arguments.length == 1 && a instanceof timapi.protocol.XmlNode) {
        var node = a;
        if (this.xmlHasAttribute(node, "DccAllowed")) {
            this.dccAllowed = this.xmlGetAttribute(node, "DccAllowed") == "1";
        }
        if (this.xmlHasAttribute(node, "PartialApprovalAllowed")) {
            this.partialApprovalAllowed = this.xmlGetAttribute(node, "PartialApprovalAllowed") == "1";
        }
        if (this.xmlHasAttribute(node, "TrxOriginalDate")) {
            this.trxOriginalDate = new timapi.protocol.TimeDate("yyyyMMdd'T'HHmmssZ", this.xmlGetAttribute(node, "TrxOriginalDate"));
        }
        if (this.xmlHasAttribute(node, "EcrSeqCounter")) {
            this.ecrSeqCounter = (this.xmlGetAttribute(node, "EcrSeqCounter") ? parseInt(this.xmlGetAttribute(node, "EcrSeqCounter")) : 0);
        }
        if (this.xmlHasAttribute(node, "TransRef")) {
            this.transRef = (this.xmlGetAttribute(node, "TransRef") ? parseInt(this.xmlGetAttribute(node, "TransRef")) : 0);
        }
        if (this.xmlHasAttribute(node, "TransSeq")) {
            this.transSeq = (this.xmlGetAttribute(node, "TransSeq") ? parseInt(this.xmlGetAttribute(node, "TransSeq")) : 0);
        }
        if (this.xmlHasAttribute(node, "CardRef")) {
            this.cardRef = this.xmlGetAttribute(node, "CardRef");
        }
        if (this.xmlHasAttribute(node, "TrmTransRef")) {
            this.trmTransRef = this.xmlGetAttribute(node, "TrmTransRef");
        }
        if (this.xmlHasAttribute(node, "AcqTransRef")) {
            this.acqTransRef = this.xmlGetAttribute(node, "AcqTransRef");
        }
        if (this.xmlHasAttribute(node, "AcqId")) {
            this.acqId = (this.xmlGetAttribute(node, "AcqId") ? parseInt(this.xmlGetAttribute(node, "AcqId")) : 0);
        }
        if (this.xmlHasAttribute(node, "PhoneAuthCode")) {
            this.phoneAuthCode = this.xmlGetAttribute(node, "PhoneAuthCode");
        }
        if (this.xmlHasAttribute(node, "MultiCurrencyFlag")) {
            this.multiCurrencyFlag = this.xmlGetAttribute(node, "MultiCurrencyFlag") == "1";
        }
        if (this.xmlHasAttribute(node, "TipAllowed")) {
            this.tipAllowed = this.xmlGetAttribute(node, "TipAllowed") == "1";
        }
        if (this.xmlHasAttribute(node, "NGVMode")) {
            this.ngvmode = this.xmlGetAttribute(node, "NGVMode");
        }
        if (this.xmlHasAttribute(node, "NGVClearingDelay")) {
            this.ngvclearingDelay = (this.xmlGetAttribute(node, "NGVClearingDelay") ? parseInt(this.xmlGetAttribute(node, "NGVClearingDelay")) : 0);
        }
        return;
    }
    if (arguments.length != 0) {
        throw new Error("Invalid argument");
    }
};
timapi.protocol.sixml.TransactionData.prototype = Object.create(timapi.protocol.Container.prototype);
timapi.protocol.sixml.TransactionData.prototype.dccAllowed = undefined;
timapi.protocol.sixml.TransactionData.prototype.partialApprovalAllowed = undefined;
timapi.protocol.sixml.TransactionData.prototype.trxOriginalDate = undefined;
timapi.protocol.sixml.TransactionData.prototype.ecrSeqCounter = undefined;
timapi.protocol.sixml.TransactionData.prototype.transRef = undefined;
timapi.protocol.sixml.TransactionData.prototype.transSeq = undefined;
timapi.protocol.sixml.TransactionData.prototype.cardRef = undefined;
timapi.protocol.sixml.TransactionData.prototype.trmTransRef = undefined;
timapi.protocol.sixml.TransactionData.prototype.acqTransRef = undefined;
timapi.protocol.sixml.TransactionData.prototype.acqId = undefined;
timapi.protocol.sixml.TransactionData.prototype.phoneAuthCode = undefined;
timapi.protocol.sixml.TransactionData.prototype.multiCurrencyFlag = undefined;
timapi.protocol.sixml.TransactionData.prototype.tipAllowed = undefined;
timapi.protocol.sixml.TransactionData.prototype.ngvmode = undefined;
timapi.protocol.sixml.TransactionData.prototype.ngvclearingDelay = undefined;
timapi.protocol.sixml.TransactionData.prototype.toXmlNode = function () {
    var node = new timapi.protocol.XmlNode("sixml:TransactionData");
    if (this.dccAllowed != undefined) {
        this.xmlSetAttribute(node, "DccAllowed", (this.dccAllowed ? "1" : "0"));
    }
    if (this.partialApprovalAllowed != undefined) {
        this.xmlSetAttribute(node, "PartialApprovalAllowed", (this.partialApprovalAllowed ? "1" : "0"));
    }
    if (this.trxOriginalDate != undefined) {
        this.xmlSetAttribute(node, "TrxOriginalDate", this.trxOriginalDate.format("yyyyMMdd'T'HHmmssZ"));
    }
    if (this.ecrSeqCounter != undefined) {
        this.xmlSetAttribute(node, "EcrSeqCounter", timapi.utils.StringHelper.makeString(this.ecrSeqCounter));
    }
    if (this.transRef != undefined) {
        this.xmlSetAttribute(node, "TransRef", timapi.utils.StringHelper.makeString(this.transRef));
    }
    if (this.transSeq != undefined) {
        this.xmlSetAttribute(node, "TransSeq", timapi.utils.StringHelper.makeString(this.transSeq));
    }
    if (this.cardRef != undefined) {
        this.xmlSetAttribute(node, "CardRef", this.cardRef);
    }
    if (this.trmTransRef != undefined) {
        this.xmlSetAttribute(node, "TrmTransRef", this.trmTransRef);
    }
    if (this.acqTransRef != undefined) {
        this.xmlSetAttribute(node, "AcqTransRef", this.acqTransRef);
    }
    if (this.acqId != undefined) {
        this.xmlSetAttribute(node, "AcqId", timapi.utils.StringHelper.makeString(this.acqId));
    }
    if (this.phoneAuthCode != undefined) {
        this.xmlSetAttribute(node, "PhoneAuthCode", this.phoneAuthCode);
    }
    if (this.multiCurrencyFlag != undefined) {
        this.xmlSetAttribute(node, "MultiCurrencyFlag", (this.multiCurrencyFlag ? "1" : "0"));
    }
    if (this.tipAllowed != undefined) {
        this.xmlSetAttribute(node, "TipAllowed", (this.tipAllowed ? "1" : "0"));
    }
    if (this.ngvmode != undefined) {
        this.xmlSetAttribute(node, "NGVMode", this.ngvmode);
    }
    if (this.ngvclearingDelay != undefined) {
        this.xmlSetAttribute(node, "NGVClearingDelay", timapi.utils.StringHelper.makeString(this.ngvclearingDelay));
    }
    return node;
};
timapi.protocol.sixml.TransactionInformation = function (a) {
    if (arguments.length == 1 && a instanceof timapi.protocol.sixml.TransactionInformation) {
        var value = a;
        this.posEntryMode = value.posEntryMode;
        this.cvm = value.cvm;
        this.merchantAction = value.merchantAction;
        this.authCode = value.authCode;
        this.timeStamp = value.timeStamp;
        this.transRef = value.transRef;
        this.transSeq = value.transSeq;
        this.acqId = value.acqId;
        this.trmTransRef = value.trmTransRef;
        this.acqTransRef = value.acqTransRef;
        this.ecrSeqCounter = value.ecrSeqCounter;
        this.signatureInformation = value.signatureInformation ? new timapi.protocol.sixml.SignatureInformation(value.signatureInformation) : undefined;
        this.cardholderName = value.cardholderName;
        this.clientIdentifier = value.clientIdentifier;
        this.accountNumber = value.accountNumber;
        this.personOid = value.personOid;
        this.cardId = value.cardId;
        this.ngvusedFlag = value.ngvusedFlag;
        return;
    }
    if (arguments.length == 1 && a instanceof timapi.protocol.XmlNode) {
        var node = a;
        if (this.xmlHasAttribute(node, "PosEntryMode")) {
            this.posEntryMode = (this.xmlGetAttribute(node, "PosEntryMode") ? parseInt(this.xmlGetAttribute(node, "PosEntryMode")) : 0);
        }
        if (this.xmlHasAttribute(node, "Cvm")) {
            this.cvm = this.xmlGetAttribute(node, "Cvm");
        }
        if (this.xmlHasAttribute(node, "MerchantAction")) {
            this.merchantAction = this.xmlGetAttribute(node, "MerchantAction");
        }
        if (this.xmlHasAttribute(node, "AuthCode")) {
            this.authCode = this.xmlGetAttribute(node, "AuthCode");
        }
        if (this.xmlHasAttribute(node, "TimeStamp")) {
            this.timeStamp = new timapi.protocol.TimeDate("yyyyMMdd'T'HHmmssZ", this.xmlGetAttribute(node, "TimeStamp"));
        }
        if (this.xmlHasAttribute(node, "TransRef")) {
            this.transRef = (this.xmlGetAttribute(node, "TransRef") ? parseInt(this.xmlGetAttribute(node, "TransRef")) : 0);
        }
        if (this.xmlHasAttribute(node, "TransSeq")) {
            this.transSeq = (this.xmlGetAttribute(node, "TransSeq") ? parseInt(this.xmlGetAttribute(node, "TransSeq")) : 0);
        }
        if (this.xmlHasAttribute(node, "AcqId")) {
            this.acqId = (this.xmlGetAttribute(node, "AcqId") ? parseInt(this.xmlGetAttribute(node, "AcqId")) : 0);
        }
        if (this.xmlHasAttribute(node, "TrmTransRef")) {
            this.trmTransRef = this.xmlGetAttribute(node, "TrmTransRef");
        }
        if (this.xmlHasAttribute(node, "AcqTransRef")) {
            this.acqTransRef = this.xmlGetAttribute(node, "AcqTransRef");
        }
        if (this.xmlHasAttribute(node, "EcrSeqCounter")) {
            this.ecrSeqCounter = (this.xmlGetAttribute(node, "EcrSeqCounter") ? parseInt(this.xmlGetAttribute(node, "EcrSeqCounter")) : 0);
        }
        if (this.xmlHasChild(node, "sixml:SignatureInformation")) {
            this.signatureInformation = new timapi.protocol.sixml.SignatureInformation(this.xmlGetChild(node, "sixml:SignatureInformation"));
        }
        if (this.xmlHasAttribute(node, "CardholderName")) {
            this.cardholderName = this.xmlGetAttribute(node, "CardholderName");
        }
        if (this.xmlHasAttribute(node, "ClientIdentifier")) {
            this.clientIdentifier = this.xmlGetAttribute(node, "ClientIdentifier");
        }
        if (this.xmlHasAttribute(node, "AccountNumber")) {
            this.accountNumber = this.xmlGetAttribute(node, "AccountNumber");
        }
        if (this.xmlHasAttribute(node, "PersonOid")) {
            this.personOid = (this.xmlGetAttribute(node, "PersonOid") ? parseInt(this.xmlGetAttribute(node, "PersonOid")) : 0);
        }
        if (this.xmlHasAttribute(node, "CardId")) {
            this.cardId = this.xmlGetAttribute(node, "CardId");
        }
        if (this.xmlHasAttribute(node, "NGVUsedFlag")) {
            this.ngvusedFlag = this.xmlGetAttribute(node, "NGVUsedFlag") == "1";
        }
        return;
    }
    if (arguments.length != 0) {
        throw new Error("Invalid argument");
    }
};
timapi.protocol.sixml.TransactionInformation.prototype = Object.create(timapi.protocol.Container.prototype);
timapi.protocol.sixml.TransactionInformation.prototype.posEntryMode = undefined;
timapi.protocol.sixml.TransactionInformation.prototype.cvm = undefined;
timapi.protocol.sixml.TransactionInformation.prototype.merchantAction = undefined;
timapi.protocol.sixml.TransactionInformation.prototype.authCode = undefined;
timapi.protocol.sixml.TransactionInformation.prototype.timeStamp = undefined;
timapi.protocol.sixml.TransactionInformation.prototype.transRef = undefined;
timapi.protocol.sixml.TransactionInformation.prototype.transSeq = undefined;
timapi.protocol.sixml.TransactionInformation.prototype.acqId = undefined;
timapi.protocol.sixml.TransactionInformation.prototype.trmTransRef = undefined;
timapi.protocol.sixml.TransactionInformation.prototype.acqTransRef = undefined;
timapi.protocol.sixml.TransactionInformation.prototype.ecrSeqCounter = undefined;
timapi.protocol.sixml.TransactionInformation.prototype.signatureInformation = undefined;
timapi.protocol.sixml.TransactionInformation.prototype.cardholderName = undefined;
timapi.protocol.sixml.TransactionInformation.prototype.clientIdentifier = undefined;
timapi.protocol.sixml.TransactionInformation.prototype.accountNumber = undefined;
timapi.protocol.sixml.TransactionInformation.prototype.personOid = undefined;
timapi.protocol.sixml.TransactionInformation.prototype.cardId = undefined;
timapi.protocol.sixml.TransactionInformation.prototype.ngvusedFlag = undefined;
timapi.protocol.sixml.TransactionInformation.prototype.toXmlNode = function () {
    var node = new timapi.protocol.XmlNode("sixml:TransactionInformation");
    if (this.posEntryMode != undefined) {
        this.xmlSetAttribute(node, "PosEntryMode", timapi.utils.StringHelper.makeString(this.posEntryMode));
    }
    if (this.cvm != undefined) {
        this.xmlSetAttribute(node, "Cvm", this.cvm);
    }
    if (this.merchantAction != undefined) {
        this.xmlSetAttribute(node, "MerchantAction", this.merchantAction);
    }
    if (this.authCode != undefined) {
        this.xmlSetAttribute(node, "AuthCode", this.authCode);
    }
    if (this.timeStamp != undefined) {
        this.xmlSetAttribute(node, "TimeStamp", this.timeStamp.format("yyyyMMdd'T'HHmmssZ"));
    }
    if (this.transRef != undefined) {
        this.xmlSetAttribute(node, "TransRef", timapi.utils.StringHelper.makeString(this.transRef));
    }
    if (this.transSeq != undefined) {
        this.xmlSetAttribute(node, "TransSeq", timapi.utils.StringHelper.makeString(this.transSeq));
    }
    if (this.acqId != undefined) {
        this.xmlSetAttribute(node, "AcqId", timapi.utils.StringHelper.makeString(this.acqId));
    }
    if (this.trmTransRef != undefined) {
        this.xmlSetAttribute(node, "TrmTransRef", this.trmTransRef);
    }
    if (this.acqTransRef != undefined) {
        this.xmlSetAttribute(node, "AcqTransRef", this.acqTransRef);
    }
    if (this.ecrSeqCounter != undefined) {
        this.xmlSetAttribute(node, "EcrSeqCounter", timapi.utils.StringHelper.makeString(this.ecrSeqCounter));
    }
    if (this.signatureInformation != undefined) {
        this.xmlAddChild(node, "sixml:SignatureInformation", this.signatureInformation);
    }
    if (this.cardholderName != undefined) {
        this.xmlSetAttribute(node, "CardholderName", this.cardholderName);
    }
    if (this.clientIdentifier != undefined) {
        this.xmlSetAttribute(node, "ClientIdentifier", this.clientIdentifier);
    }
    if (this.accountNumber != undefined) {
        this.xmlSetAttribute(node, "AccountNumber", this.accountNumber);
    }
    if (this.personOid != undefined) {
        this.xmlSetAttribute(node, "PersonOid", timapi.utils.StringHelper.makeString(this.personOid));
    }
    if (this.cardId != undefined) {
        this.xmlSetAttribute(node, "CardId", this.cardId);
    }
    if (this.ngvusedFlag != undefined) {
        this.xmlSetAttribute(node, "NGVUsedFlag", (this.ngvusedFlag ? "1" : "0"));
    }
    return node;
};
timapi.protocol.sixml.TrxDetail = function (a) {
    if (arguments.length == 1 && a instanceof timapi.protocol.sixml.TrxDetail) {
        var value = a;
        this.aid = value.aid;
        this.dccFlag = value.dccFlag;
        this.transactionType = value.transactionType;
        this.count = value.count;
        this.markup = value.markup;
        this.markupExponent = value.markupExponent;
        this.amountSum = value.amountSum;
        this.amountSumOther = value.amountSumOther;
        this.amountSumTip = value.amountSumTip;
        return;
    }
    if (arguments.length == 1 && a instanceof timapi.protocol.XmlNode) {
        var node = a;
        if (this.xmlHasAttribute(node, "Aid")) {
            this.aid = this.xmlGetAttribute(node, "Aid");
        }
        if (this.xmlHasAttribute(node, "DccFlag")) {
            this.dccFlag = this.xmlGetAttribute(node, "DccFlag") == "1";
        }
        if (this.xmlHasAttribute(node, "TransactionType")) {
            this.transactionType = this.xmlGetAttribute(node, "TransactionType");
        }
        if (this.xmlHasAttribute(node, "Count")) {
            this.count = (this.xmlGetAttribute(node, "Count") ? parseInt(this.xmlGetAttribute(node, "Count")) : 0);
        }
        if (this.xmlHasAttribute(node, "Markup")) {
            this.markup = (this.xmlGetAttribute(node, "Markup") ? parseInt(this.xmlGetAttribute(node, "Markup")) : 0);
        }
        if (this.xmlHasAttribute(node, "MarkupExponent")) {
            this.markupExponent = (this.xmlGetAttribute(node, "MarkupExponent") ? parseInt(this.xmlGetAttribute(node, "MarkupExponent")) : 0);
        }
        if (this.xmlHasAttribute(node, "AmountSum")) {
            this.amountSum = (this.xmlGetAttribute(node, "AmountSum") ? parseInt(this.xmlGetAttribute(node, "AmountSum")) : 0);
        }
        if (this.xmlHasAttribute(node, "AmountSumOther")) {
            this.amountSumOther = (this.xmlGetAttribute(node, "AmountSumOther") ? parseInt(this.xmlGetAttribute(node, "AmountSumOther")) : 0);
        }
        if (this.xmlHasAttribute(node, "AmountSumTip")) {
            this.amountSumTip = (this.xmlGetAttribute(node, "AmountSumTip") ? parseInt(this.xmlGetAttribute(node, "AmountSumTip")) : 0);
        }
        return;
    }
    if (arguments.length != 0) {
        throw new Error("Invalid argument");
    }
};
timapi.protocol.sixml.TrxDetail.prototype = Object.create(timapi.protocol.Container.prototype);
timapi.protocol.sixml.TrxDetail.prototype.aid = undefined;
timapi.protocol.sixml.TrxDetail.prototype.dccFlag = undefined;
timapi.protocol.sixml.TrxDetail.prototype.transactionType = undefined;
timapi.protocol.sixml.TrxDetail.prototype.count = undefined;
timapi.protocol.sixml.TrxDetail.prototype.markup = undefined;
timapi.protocol.sixml.TrxDetail.prototype.markupExponent = undefined;
timapi.protocol.sixml.TrxDetail.prototype.amountSum = undefined;
timapi.protocol.sixml.TrxDetail.prototype.amountSumOther = undefined;
timapi.protocol.sixml.TrxDetail.prototype.amountSumTip = undefined;
timapi.protocol.sixml.TrxDetail.prototype.toXmlNode = function () {
    var node = new timapi.protocol.XmlNode("sixml:TrxDetail");
    if (this.aid != undefined) {
        this.xmlSetAttribute(node, "Aid", this.aid);
    }
    if (this.dccFlag != undefined) {
        this.xmlSetAttribute(node, "DccFlag", (this.dccFlag ? "1" : "0"));
    }
    if (this.transactionType != undefined) {
        this.xmlSetAttribute(node, "TransactionType", this.transactionType);
    }
    if (this.count != undefined) {
        this.xmlSetAttribute(node, "Count", timapi.utils.StringHelper.makeString(this.count));
    }
    if (this.markup != undefined) {
        this.xmlSetAttribute(node, "Markup", timapi.utils.StringHelper.makeString(this.markup));
    }
    if (this.markupExponent != undefined) {
        this.xmlSetAttribute(node, "MarkupExponent", timapi.utils.StringHelper.makeString(this.markupExponent));
    }
    if (this.amountSum != undefined) {
        this.xmlSetAttribute(node, "AmountSum", timapi.utils.StringHelper.makeString(this.amountSum));
    }
    if (this.amountSumOther != undefined) {
        this.xmlSetAttribute(node, "AmountSumOther", timapi.utils.StringHelper.makeString(this.amountSumOther));
    }
    if (this.amountSumTip != undefined) {
        this.xmlSetAttribute(node, "AmountSumTip", timapi.utils.StringHelper.makeString(this.amountSumTip));
    }
    return node;
};
timapi.protocol.sixml.WatermarkItemList = function (a) {
    this.watermarkItem = [];
    if (arguments.length == 1 && a instanceof timapi.protocol.sixml.WatermarkItemList) {
        var value = a;
        for (var each of value.watermarkItem) {
            this.watermarkItem.push(each);
        }
        return;
    }
    if (arguments.length == 1 && a instanceof timapi.protocol.XmlNode) {
        var node = a;
        for (var each of this.xmlGetChildren(node, "sixml:WatermarkItem")) {
            this.watermarkItem.push(each.textContent);
        }
        return;
    }
    if (arguments.length != 0) {
        throw new Error("Invalid argument");
    }
};
timapi.protocol.sixml.WatermarkItemList.prototype = Object.create(timapi.protocol.Container.prototype);
timapi.protocol.sixml.WatermarkItemList.prototype.watermarkItem = undefined;
timapi.protocol.sixml.WatermarkItemList.prototype.toXmlNode = function () {
    var node = new timapi.protocol.XmlNode("sixml:WatermarkItemList");
    for (var each of this.watermarkItem) {
        this.xmlAddChild(node, "sixml:WatermarkItem", each);
    }
    return node;
};
timapi.statemachine.states.ErrorState = function (context) {
    if (context == undefined) {
        throw new Error("Invalid argument. context is undefined");
    }
    this.context = context;
};
timapi.statemachine.states.ErrorState.loggerName = "timapi.statemachine.states.ErrorState";
timapi.statemachine.states.ErrorState.classname = "ErrorState";
timapi.statemachine.states.ErrorState.logger = timapi.logging.Logger.getLogger(timapi.statemachine.states.ErrorState.loggerName);
timapi.statemachine.states.ErrorState.prototype.enterState = function () {
    this.context.actionErrorConnectionLost();
    this.context.actionDisconnect();
    this.context.actionClearPendingEvent();
    if (this.context.conditionIsEnabledAutoConnect()
        && !this.context.conditionRunAwayProtection()) {
        this.context.actionRunAwayProtection();
        this.context.actionConnect();
        this.context.setState(new timapi.statemachine.states.Connecting(this.context));
        return;
    }
    this.context.actionRunAwayProtection();
    this.context.setState(new timapi.statemachine.states.Disconnected(this.context));
};
timapi.statemachine.states.ErrorState.prototype.exitState = function () {
};
timapi.statemachine.states.ErrorState.prototype.activate = Object.illegalState;
timapi.statemachine.states.ErrorState.prototype.applicationInformation = Object.illegalState;
timapi.statemachine.states.ErrorState.prototype.balance = Object.illegalState;
timapi.statemachine.states.ErrorState.prototype.cancel = Object.illegalState;
timapi.statemachine.states.ErrorState.prototype.changeSettings = Object.illegalState;
timapi.statemachine.states.ErrorState.prototype.commit = Object.illegalState;
timapi.statemachine.states.ErrorState.prototype.connect = Object.illegalState;
timapi.statemachine.states.ErrorState.prototype.counterRequest = Object.illegalState;
timapi.statemachine.states.ErrorState.prototype.deactivate = Object.illegalState;
timapi.statemachine.states.ErrorState.prototype.disconnect = Object.illegalState;
timapi.statemachine.states.ErrorState.prototype.dccRates = Object.illegalState;
timapi.statemachine.states.ErrorState.prototype.hardwareInformation = Object.illegalState;
timapi.statemachine.states.ErrorState.prototype.initTransaction = Object.illegalState;
timapi.statemachine.states.ErrorState.prototype.login = Object.illegalState;
timapi.statemachine.states.ErrorState.prototype.logout = Object.illegalState;
timapi.statemachine.states.ErrorState.prototype.reboot = Object.illegalState;
timapi.statemachine.states.ErrorState.prototype.reconciliation = Object.illegalState;
timapi.statemachine.states.ErrorState.prototype.receiptRequest = Object.illegalState;
timapi.statemachine.states.ErrorState.prototype.reconfig = Object.illegalState;
timapi.statemachine.states.ErrorState.prototype.rollback = Object.illegalState;
timapi.statemachine.states.ErrorState.prototype.softwareUpdate = Object.illegalState;
timapi.statemachine.states.ErrorState.prototype.systemInformation = Object.illegalState;
timapi.statemachine.states.ErrorState.prototype.transaction = Object.illegalState;
timapi.statemachine.states.ErrorState.prototype.connected = Object.illegalState;
timapi.statemachine.states.ErrorState.prototype.connectFailed = Object.illegalState;
timapi.statemachine.states.ErrorState.prototype.disconnected = Object.illegalState;
timapi.statemachine.states.ErrorState.prototype.responseRequest = Object.illegalState;
timapi.statemachine.states.ErrorState.prototype.responseError = Object.illegalState;
timapi.statemachine.states.ErrorState.prototype.responseInvalid = Object.illegalState;
timapi.statemachine.states.ErrorState.prototype.responseBusy = Object.illegalState;
timapi.statemachine.states.ErrorState.prototype.notificationStatusChanged = Object.illegalState;
timapi.statemachine.states.ErrorState.prototype.notificationLicenseChanged = Object.illegalState;
timapi.statemachine.states.ErrorState.prototype.notificationKeepAlive = Object.illegalState;
timapi.statemachine.states.ErrorState.prototype.timeout = Object.illegalState;
timapi.statemachine.states.ErrorState.prototype.keepAliveTimeout = Object.illegalState;
timapi.statemachine.states.ErrorState.prototype.keepAliveTimer = Object.illegalState;
timapi.statemachine.states.ErrorState.prototype.trxStateBecameIdle = Object.illegalState;
timapi.statemachine.states.ErrorState.prototype.closeReader = Object.illegalState;
timapi.statemachine.states.ErrorState.prototype.openReader = Object.illegalState;
timapi.statemachine.states.ErrorState.prototype.ejectCard = Object.illegalState;
timapi.statemachine.states.ErrorState.prototype.openMaintenanceWindow = Object.illegalState;
timapi.statemachine.states.ErrorState.prototype.closeMaintenanceWindow = Object.illegalState;
timapi.statemachine.states.ErrorState.prototype.holdCommit = Object.illegalState;
timapi.statemachine.states.ErrorState.prototype.activateServiceMenu = Object.illegalState;
timapi.statemachine.states.ErrorState.prototype.amtAdjustment = Object.illegalState;
timapi.statemachine.states.ErrorState.prototype.balanceInquiry = Object.illegalState;
timapi.statemachine.states.ErrorState.prototype.openDialogMode = Object.illegalState;
timapi.statemachine.states.ErrorState.prototype.closeDialogMode = Object.illegalState;
timapi.statemachine.states.ErrorState.prototype.showSignatureCapture = Object.illegalState;
timapi.statemachine.states.ErrorState.prototype.showDialog = Object.illegalState;
timapi.statemachine.states.ErrorState.prototype.sendCardCommand = Object.illegalState;
timapi.statemachine.states.ErrorState.prototype.toString = function () {
    return this.classname;
};
timapi.statemachine.states.ErrorState.prototype.context = undefined;
timapi.statemachine.AbstractContext = function () {
};
timapi.statemachine.AbstractContext.loggerName = "timapi.statemachine.AbstractContext";
timapi.statemachine.AbstractContext.classname = "AbstractContext";
timapi.statemachine.AbstractContext.logger = timapi.logging.Logger.getLogger(timapi.statemachine.AbstractContext.loggerName);
timapi.statemachine.AbstractContext.prototype.start = function () {
    timapi.statemachine.AbstractContext.logger.entering(timapi.statemachine.AbstractContext.classname, "start");
    this.state = undefined;
    this.setState(new timapi.statemachine.states.Initial(this));
    timapi.statemachine.AbstractContext.logger.exiting(timapi.statemachine.AbstractContext.classname, "start");
};
timapi.statemachine.AbstractContext.prototype.conditionIsEnabledAutoConnect = Object.abstractFunction;
timapi.statemachine.AbstractContext.prototype.conditionIsEnabledAutoLogin = Object.abstractFunction;
timapi.statemachine.AbstractContext.prototype.conditionIsEnabledFetchBrands = Object.abstractFunction;
timapi.statemachine.AbstractContext.prototype.conditionIsEnabledAutoActivate = Object.abstractFunction;
timapi.statemachine.AbstractContext.prototype.conditionIsEnabledAutoCommit = Object.abstractFunction;
timapi.statemachine.AbstractContext.prototype.conditionIsEnabledAutoDeactivate = Object.abstractFunction;
timapi.statemachine.AbstractContext.prototype.conditionIsEnabledAutoLogout = Object.abstractFunction;
timapi.statemachine.AbstractContext.prototype.conditionIsEnabledAutoDisconnect = Object.abstractFunction;
timapi.statemachine.AbstractContext.prototype.conditionHasPendingEvent = Object.abstractFunction;
timapi.statemachine.AbstractContext.prototype.conditionHasPendingActivate = Object.abstractFunction;
timapi.statemachine.AbstractContext.prototype.conditionHasPendingApplicationInformation = Object.abstractFunction;
timapi.statemachine.AbstractContext.prototype.conditionHasPendingBalance = Object.abstractFunction;
timapi.statemachine.AbstractContext.prototype.conditionHasPendingChangeSettings = Object.abstractFunction;
timapi.statemachine.AbstractContext.prototype.conditionHasPendingCounterRequest = Object.abstractFunction;
timapi.statemachine.AbstractContext.prototype.conditionHasPendingCommit = Object.abstractFunction;
timapi.statemachine.AbstractContext.prototype.conditionHasPendingDccRates = Object.abstractFunction;
timapi.statemachine.AbstractContext.prototype.conditionHasPendingDeactivate = Object.abstractFunction;
timapi.statemachine.AbstractContext.prototype.conditionHasPendingHardwareInformation = Object.abstractFunction;
timapi.statemachine.AbstractContext.prototype.conditionHasPendingInitTransaction = Object.abstractFunction;
timapi.statemachine.AbstractContext.prototype.conditionHasPendingLogin = Object.abstractFunction;
timapi.statemachine.AbstractContext.prototype.conditionHasPendingLogout = Object.abstractFunction;
timapi.statemachine.AbstractContext.prototype.conditionHasPendingReboot = Object.abstractFunction;
timapi.statemachine.AbstractContext.prototype.conditionHasPendingReceiptRequest = Object.abstractFunction;
timapi.statemachine.AbstractContext.prototype.conditionHasPendingReconciliation = Object.abstractFunction;
timapi.statemachine.AbstractContext.prototype.conditionHasPendingReconfig = Object.abstractFunction;
timapi.statemachine.AbstractContext.prototype.conditionHasPendingSoftwareUpdate = Object.abstractFunction;
timapi.statemachine.AbstractContext.prototype.conditionHasPendingSystemInformation = Object.abstractFunction;
timapi.statemachine.AbstractContext.prototype.conditionHasPendingTransaction = Object.abstractFunction;
timapi.statemachine.AbstractContext.prototype.conditionHasPendingCancel = Object.abstractFunction;
timapi.statemachine.AbstractContext.prototype.conditionTransactionNoCommit = Object.abstractFunction;
timapi.statemachine.AbstractContext.prototype.conditionHasTerminalFeatures = Object.abstractFunction;
timapi.statemachine.AbstractContext.prototype.conditionSupportedFeatureAutoCommit = Object.abstractFunction;
timapi.statemachine.AbstractContext.prototype.conditionMandatoryFeatureAutoCommit = Object.abstractFunction;
timapi.statemachine.AbstractContext.prototype.conditionIsApplicationInformationNotSupported = Object.abstractFunction;
timapi.statemachine.AbstractContext.prototype.conditionCanRepeatRequest = Object.abstractFunction;
timapi.statemachine.AbstractContext.prototype.conditionRunAwayProtection = Object.abstractFunction;
timapi.statemachine.AbstractContext.prototype.conditionHasGuideBanking = Object.abstractFunction;
timapi.statemachine.AbstractContext.prototype.conditionHasGuideUnattended = Object.abstractFunction;
timapi.statemachine.AbstractContext.prototype.conditionHasPendingCloseReader = Object.abstractFunction;
timapi.statemachine.AbstractContext.prototype.conditionHasPendingOpenReader = Object.abstractFunction;
timapi.statemachine.AbstractContext.prototype.conditionHasPendingEjectCard = Object.abstractFunction;
timapi.statemachine.AbstractContext.prototype.conditionHasPendingOpenMaintenanceWindow = Object.abstractFunction;
timapi.statemachine.AbstractContext.prototype.conditionHasPendingCloseMaintenanceWindow = Object.abstractFunction;
timapi.statemachine.AbstractContext.prototype.conditionHasPendingActivateServiceMenu = Object.abstractFunction;
timapi.statemachine.AbstractContext.prototype.conditionHasGuideAdvancedRetail = Object.abstractFunction;
timapi.statemachine.AbstractContext.prototype.conditionHasPendingBalanceInquiry = Object.abstractFunction;
timapi.statemachine.AbstractContext.prototype.conditionHasGuideDialog = Object.abstractFunction;
timapi.statemachine.AbstractContext.prototype.conditionHasPendingOpenDialogMode = Object.abstractFunction;
timapi.statemachine.AbstractContext.prototype.conditionHasPendingCloseDialogMode = Object.abstractFunction;
timapi.statemachine.AbstractContext.prototype.conditionHasPendingShowSignatureCapture = Object.abstractFunction;
timapi.statemachine.AbstractContext.prototype.conditionHasPendingShowDialog = Object.abstractFunction;
timapi.statemachine.AbstractContext.prototype.conditionHasPendingSendCardCommand = Object.abstractFunction;
timapi.statemachine.AbstractContext.prototype.actionActivate = Object.abstractFunction;
timapi.statemachine.AbstractContext.prototype.actionApplicationInformation = Object.abstractFunction;
timapi.statemachine.AbstractContext.prototype.actionBalance = Object.abstractFunction;
timapi.statemachine.AbstractContext.prototype.actionCancel = Object.abstractFunction;
timapi.statemachine.AbstractContext.prototype.actionChangeSettings = Object.abstractFunction;
timapi.statemachine.AbstractContext.prototype.actionCommit = Object.abstractFunction;
timapi.statemachine.AbstractContext.prototype.actionCounterRequest = Object.abstractFunction;
timapi.statemachine.AbstractContext.prototype.actionDccRates = Object.abstractFunction;
timapi.statemachine.AbstractContext.prototype.actionDeactivate = Object.abstractFunction;
timapi.statemachine.AbstractContext.prototype.actionHardwareInformation = Object.abstractFunction;
timapi.statemachine.AbstractContext.prototype.actionInitTransaction = Object.abstractFunction;
timapi.statemachine.AbstractContext.prototype.actionLogin = Object.abstractFunction;
timapi.statemachine.AbstractContext.prototype.actionLogout = Object.abstractFunction;
timapi.statemachine.AbstractContext.prototype.actionReboot = Object.abstractFunction;
timapi.statemachine.AbstractContext.prototype.actionReconciliation = Object.abstractFunction;
timapi.statemachine.AbstractContext.prototype.actionReconfig = Object.abstractFunction;
timapi.statemachine.AbstractContext.prototype.actionReceiptRequest = Object.abstractFunction;
timapi.statemachine.AbstractContext.prototype.actionRequestFeatures = Object.abstractFunction;
timapi.statemachine.AbstractContext.prototype.actionRollback = Object.abstractFunction;
timapi.statemachine.AbstractContext.prototype.actionSoftwareUpdate = Object.abstractFunction;
timapi.statemachine.AbstractContext.prototype.actionSystemInformation = Object.abstractFunction;
timapi.statemachine.AbstractContext.prototype.actionTransaction = Object.abstractFunction;
timapi.statemachine.AbstractContext.prototype.actionSetDefaultLoginRequest = Object.abstractFunction;
timapi.statemachine.AbstractContext.prototype.actionConnect = Object.abstractFunction;
timapi.statemachine.AbstractContext.prototype.actionDisconnect = Object.abstractFunction;
timapi.statemachine.AbstractContext.prototype.actionSendErrorResponseDisconnect = Object.abstractFunction;
timapi.statemachine.AbstractContext.prototype.actionSendKeepAliveNotification = Object.abstractFunction;
timapi.statemachine.AbstractContext.prototype.actionProcessResponseActivate = Object.abstractFunction;
timapi.statemachine.AbstractContext.prototype.actionProcessResponseApplicationInformation = Object.abstractFunction;
timapi.statemachine.AbstractContext.prototype.actionProcessResponseBalance = Object.abstractFunction;
timapi.statemachine.AbstractContext.prototype.actionProcessResponseChangeSettings = Object.abstractFunction;
timapi.statemachine.AbstractContext.prototype.actionProcessResponseCommit = Object.abstractFunction;
timapi.statemachine.AbstractContext.prototype.actionProcessResponseCounterRequest = Object.abstractFunction;
timapi.statemachine.AbstractContext.prototype.actionProcessResponseDeactivate = Object.abstractFunction;
timapi.statemachine.AbstractContext.prototype.actionProcessResponseDccRates = Object.abstractFunction;
timapi.statemachine.AbstractContext.prototype.actionProcessResponseError = Object.abstractFunction;
timapi.statemachine.AbstractContext.prototype.actionProcessResponseFeatureRequest = Object.abstractFunction;
timapi.statemachine.AbstractContext.prototype.actionProcessResponseHardwareInformation = Object.abstractFunction;
timapi.statemachine.AbstractContext.prototype.actionProcessResponseInitTransaction = Object.abstractFunction;
timapi.statemachine.AbstractContext.prototype.actionProcessResponseLogin = Object.abstractFunction;
timapi.statemachine.AbstractContext.prototype.actionProcessResponseLogout = Object.abstractFunction;
timapi.statemachine.AbstractContext.prototype.actionProcessResponseReboot = Object.abstractFunction;
timapi.statemachine.AbstractContext.prototype.actionProcessResponseRollback = Object.abstractFunction;
timapi.statemachine.AbstractContext.prototype.actionProcessResponseReceiptRequest = Object.abstractFunction;
timapi.statemachine.AbstractContext.prototype.actionProcessResponseReconciliation = Object.abstractFunction;
timapi.statemachine.AbstractContext.prototype.actionProcessResponseReconfig = Object.abstractFunction;
timapi.statemachine.AbstractContext.prototype.actionProcessResponseSoftwareUpdate = Object.abstractFunction;
timapi.statemachine.AbstractContext.prototype.actionProcessResponseSystemInformation = Object.abstractFunction;
timapi.statemachine.AbstractContext.prototype.actionProcessResponseTransaction = Object.abstractFunction;
timapi.statemachine.AbstractContext.prototype.actionProcessNotificationStatusChanged = Object.abstractFunction;
timapi.statemachine.AbstractContext.prototype.actionProcessNotificationLicenseChanged = Object.abstractFunction;
timapi.statemachine.AbstractContext.prototype.actionNotifyLoginCompleted = Object.abstractFunction;
timapi.statemachine.AbstractContext.prototype.actionSimulateLogoutCompleted = Object.abstractFunction;
timapi.statemachine.AbstractContext.prototype.actionSimulateCommitCompleted = Object.abstractFunction;
timapi.statemachine.AbstractContext.prototype.actionClearPendingEvent = Object.abstractFunction;
timapi.statemachine.AbstractContext.prototype.actionSetPendingActivate = Object.abstractFunction;
timapi.statemachine.AbstractContext.prototype.actionSetPendingApplicationInformation = Object.abstractFunction;
timapi.statemachine.AbstractContext.prototype.actionSetPendingBalance = Object.abstractFunction;
timapi.statemachine.AbstractContext.prototype.actionSetPendingChangeSettings = Object.abstractFunction;
timapi.statemachine.AbstractContext.prototype.actionSetPendingCounterRequest = Object.abstractFunction;
timapi.statemachine.AbstractContext.prototype.actionSetPendingCommit = Object.abstractFunction;
timapi.statemachine.AbstractContext.prototype.actionSetPendingDccRates = Object.abstractFunction;
timapi.statemachine.AbstractContext.prototype.actionSetPendingDeactivate = Object.abstractFunction;
timapi.statemachine.AbstractContext.prototype.actionSetPendingHardwareInformation = Object.abstractFunction;
timapi.statemachine.AbstractContext.prototype.actionSetPendingInitTransaction = Object.abstractFunction;
timapi.statemachine.AbstractContext.prototype.actionSetPendingLogin = Object.abstractFunction;
timapi.statemachine.AbstractContext.prototype.actionSetPendingLogout = Object.abstractFunction;
timapi.statemachine.AbstractContext.prototype.actionSetPendingReboot = Object.abstractFunction;
timapi.statemachine.AbstractContext.prototype.actionSetPendingReceiptRequest = Object.abstractFunction;
timapi.statemachine.AbstractContext.prototype.actionSetPendingReconciliation = Object.abstractFunction;
timapi.statemachine.AbstractContext.prototype.actionSetPendingReconfig = Object.abstractFunction;
timapi.statemachine.AbstractContext.prototype.actionSetPendingSoftwareUpdate = Object.abstractFunction;
timapi.statemachine.AbstractContext.prototype.actionSetPendingSystemInformation = Object.abstractFunction;
timapi.statemachine.AbstractContext.prototype.actionSetPendingTransaction = Object.abstractFunction;
timapi.statemachine.AbstractContext.prototype.actionSetPendingCancel = Object.abstractFunction;
timapi.statemachine.AbstractContext.prototype.actionClearPendingCancel = Object.abstractFunction;
timapi.statemachine.AbstractContext.prototype.actionErrorConnectionLost = Object.abstractFunction;
timapi.statemachine.AbstractContext.prototype.actionErrorInvalidResponse = Object.abstractFunction;
timapi.statemachine.AbstractContext.prototype.actionErrorRequestInProgress = Object.abstractFunction;
timapi.statemachine.AbstractContext.prototype.actionErrorWrongState = Object.abstractFunction;
timapi.statemachine.AbstractContext.prototype.actionErrorTimeout = Object.abstractFunction;
timapi.statemachine.AbstractContext.prototype.actionErrorDisabledFeature = Object.abstractFunction;
timapi.statemachine.AbstractContext.prototype.actionArmTimeoutTransaction = Object.abstractFunction;
timapi.statemachine.AbstractContext.prototype.actionArmTimeoutRequest = Object.abstractFunction;
timapi.statemachine.AbstractContext.prototype.actionArmTimeoutLongRequest = Object.abstractFunction;
timapi.statemachine.AbstractContext.prototype.actionCancelTimeout = Object.abstractFunction;
timapi.statemachine.AbstractContext.prototype.actionRepeatRequest = Object.abstractFunction;
timapi.statemachine.AbstractContext.prototype.actionRunAwayProtection = Object.abstractFunction;
timapi.statemachine.AbstractContext.prototype.actionCloseReader = Object.abstractFunction;
timapi.statemachine.AbstractContext.prototype.actionOpenReader = Object.abstractFunction;
timapi.statemachine.AbstractContext.prototype.actionEjectCard = Object.abstractFunction;
timapi.statemachine.AbstractContext.prototype.actionOpenMaintenanceWindow = Object.abstractFunction;
timapi.statemachine.AbstractContext.prototype.actionCloseMaintenanceWindow = Object.abstractFunction;
timapi.statemachine.AbstractContext.prototype.actionHoldCommit = Object.abstractFunction;
timapi.statemachine.AbstractContext.prototype.actionAmtAdjustment = Object.abstractFunction;
timapi.statemachine.AbstractContext.prototype.actionActivateServiceMenu = Object.abstractFunction;
timapi.statemachine.AbstractContext.prototype.actionProcessResponseCloseReader = Object.abstractFunction;
timapi.statemachine.AbstractContext.prototype.actionProcessResponseOpenReader = Object.abstractFunction;
timapi.statemachine.AbstractContext.prototype.actionProcessResponseEjectCard = Object.abstractFunction;
timapi.statemachine.AbstractContext.prototype.actionProcessResponseOpenMaintenanceWindow = Object.abstractFunction;
timapi.statemachine.AbstractContext.prototype.actionProcessResponseCloseMaintenanceWindow = Object.abstractFunction;
timapi.statemachine.AbstractContext.prototype.actionProcessResponseActivateServiceMenu = Object.abstractFunction;
timapi.statemachine.AbstractContext.prototype.actionSetPendingCloseReader = Object.abstractFunction;
timapi.statemachine.AbstractContext.prototype.actionSetPendingOpenReader = Object.abstractFunction;
timapi.statemachine.AbstractContext.prototype.actionSetPendingEjectCard = Object.abstractFunction;
timapi.statemachine.AbstractContext.prototype.actionSetPendingOpenMaintenanceWindow = Object.abstractFunction;
timapi.statemachine.AbstractContext.prototype.actionSetPendingCloseMaintenanceWindow = Object.abstractFunction;
timapi.statemachine.AbstractContext.prototype.actionSetPendingActivateServiceMenu = Object.abstractFunction;
timapi.statemachine.AbstractContext.prototype.actionBalanceInquiry = Object.abstractFunction;
timapi.statemachine.AbstractContext.prototype.actionProcessResponseBalanceInquiry = Object.abstractFunction;
timapi.statemachine.AbstractContext.prototype.actionSetPendingBalanceInquiry = Object.abstractFunction;
timapi.statemachine.AbstractContext.prototype.actionOpenDialogMode = Object.abstractFunction;
timapi.statemachine.AbstractContext.prototype.actionCloseDialogMode = Object.abstractFunction;
timapi.statemachine.AbstractContext.prototype.actionShowSignatureCapture = Object.abstractFunction;
timapi.statemachine.AbstractContext.prototype.actionShowDialog = Object.abstractFunction;
timapi.statemachine.AbstractContext.prototype.actionSendCardCommand = Object.abstractFunction;
timapi.statemachine.AbstractContext.prototype.actionProcessResponseOpenDialogMode = Object.abstractFunction;
timapi.statemachine.AbstractContext.prototype.actionProcessResponseCloseDialogMode = Object.abstractFunction;
timapi.statemachine.AbstractContext.prototype.actionProcessResponseShowSignatureCapture = Object.abstractFunction;
timapi.statemachine.AbstractContext.prototype.actionProcessResponseShowDialog = Object.abstractFunction;
timapi.statemachine.AbstractContext.prototype.actionProcessResponseSendCardCommand = Object.abstractFunction;
timapi.statemachine.AbstractContext.prototype.actionSetPendingOpenDialogMode = Object.abstractFunction;
timapi.statemachine.AbstractContext.prototype.actionSetPendingCloseDialogMode = Object.abstractFunction;
timapi.statemachine.AbstractContext.prototype.actionSetPendingShowSignatureCapture = Object.abstractFunction;
timapi.statemachine.AbstractContext.prototype.actionSetPendingShowDialog = Object.abstractFunction;
timapi.statemachine.AbstractContext.prototype.actionSetPendingSendCardCommand = Object.abstractFunction;
timapi.statemachine.AbstractContext.prototype.eventActivate = function () {
    timapi.statemachine.AbstractContext.logger.entering(timapi.statemachine.AbstractContext.classname, "eventActivate");
    try {
        this.state.activate();
    }
    catch (e) {
        if (e.name == "TimError" &&
            (e.resultCode == timapi.constants.ResultCode.requestPending
                || e.resultCode == timapi.constants.ResultCode.sixmlWrongState)) {
            throw e;
        }
        timapi.statemachine.AbstractContext.logger.log(timapi.logging.Level.severe, "Sending event eventActivate failed on state " +
            this.state.classname + " with no Fail-State set", e);
        this.setState(new timapi.statemachine.states.ErrorState(this));
        return;
    }
    timapi.statemachine.AbstractContext.logger.exiting(timapi.statemachine.AbstractContext.classname, "eventActivate");
};
timapi.statemachine.AbstractContext.prototype.eventApplicationInformation = function () {
    timapi.statemachine.AbstractContext.logger.entering(timapi.statemachine.AbstractContext.classname, "eventApplicationInformation");
    try {
        this.state.applicationInformation();
    }
    catch (e) {
        if (e.name == "TimError" &&
            (e.resultCode == timapi.constants.ResultCode.requestPending
                || e.resultCode == timapi.constants.ResultCode.sixmlWrongState)) {
            throw e;
        }
        timapi.statemachine.AbstractContext.logger.log(timapi.logging.Level.severe, "Sending event eventApplicationInformation failed on state " +
            this.state.classname + " with no Fail-State set", e);
        this.setState(new timapi.statemachine.states.ErrorState(this));
        return;
    }
    timapi.statemachine.AbstractContext.logger.exiting(timapi.statemachine.AbstractContext.classname, "eventApplicationInformation");
};
timapi.statemachine.AbstractContext.prototype.eventBalance = function () {
    timapi.statemachine.AbstractContext.logger.entering(timapi.statemachine.AbstractContext.classname, "eventBalance");
    try {
        this.state.balance();
    }
    catch (e) {
        if (e.name == "TimError" &&
            (e.resultCode == timapi.constants.ResultCode.requestPending
                || e.resultCode == timapi.constants.ResultCode.sixmlWrongState)) {
            throw e;
        }
        timapi.statemachine.AbstractContext.logger.log(timapi.logging.Level.severe, "Sending event eventBalance failed on state " +
            this.state.classname + " with no Fail-State set", e);
        this.setState(new timapi.statemachine.states.ErrorState(this));
        return;
    }
    timapi.statemachine.AbstractContext.logger.exiting(timapi.statemachine.AbstractContext.classname, "eventBalance");
};
timapi.statemachine.AbstractContext.prototype.eventCancel = function () {
    timapi.statemachine.AbstractContext.logger.entering(timapi.statemachine.AbstractContext.classname, "eventCancel");
    try {
        this.state.cancel();
    }
    catch (e) {
        if (e.name == "TimError" &&
            (e.resultCode == timapi.constants.ResultCode.requestPending
                || e.resultCode == timapi.constants.ResultCode.sixmlWrongState)) {
            throw e;
        }
        timapi.statemachine.AbstractContext.logger.log(timapi.logging.Level.severe, "Sending event eventCancel failed on state " +
            this.state.classname + " with no Fail-State set", e);
        this.setState(new timapi.statemachine.states.ErrorState(this));
        return;
    }
    timapi.statemachine.AbstractContext.logger.exiting(timapi.statemachine.AbstractContext.classname, "eventCancel");
};
timapi.statemachine.AbstractContext.prototype.eventChangeSettings = function () {
    timapi.statemachine.AbstractContext.logger.entering(timapi.statemachine.AbstractContext.classname, "eventChangeSettings");
    try {
        this.state.changeSettings();
    }
    catch (e) {
        if (e.name == "TimError" &&
            (e.resultCode == timapi.constants.ResultCode.requestPending
                || e.resultCode == timapi.constants.ResultCode.sixmlWrongState)) {
            throw e;
        }
        timapi.statemachine.AbstractContext.logger.log(timapi.logging.Level.severe, "Sending event eventChangeSettings failed on state " +
            this.state.classname + " with no Fail-State set", e);
        this.setState(new timapi.statemachine.states.ErrorState(this));
        return;
    }
    timapi.statemachine.AbstractContext.logger.exiting(timapi.statemachine.AbstractContext.classname, "eventChangeSettings");
};
timapi.statemachine.AbstractContext.prototype.eventCommit = function () {
    timapi.statemachine.AbstractContext.logger.entering(timapi.statemachine.AbstractContext.classname, "eventCommit");
    try {
        this.state.commit();
    }
    catch (e) {
        if (e.name == "TimError" &&
            (e.resultCode == timapi.constants.ResultCode.requestPending
                || e.resultCode == timapi.constants.ResultCode.sixmlWrongState)) {
            throw e;
        }
        timapi.statemachine.AbstractContext.logger.log(timapi.logging.Level.severe, "Sending event eventCommit failed on state " +
            this.state.classname + " with no Fail-State set", e);
        this.setState(new timapi.statemachine.states.ErrorState(this));
        return;
    }
    timapi.statemachine.AbstractContext.logger.exiting(timapi.statemachine.AbstractContext.classname, "eventCommit");
};
timapi.statemachine.AbstractContext.prototype.eventConnect = function () {
    timapi.statemachine.AbstractContext.logger.entering(timapi.statemachine.AbstractContext.classname, "eventConnect");
    try {
        this.state.connect();
    }
    catch (e) {
        if (e.name == "TimError" &&
            (e.resultCode == timapi.constants.ResultCode.requestPending
                || e.resultCode == timapi.constants.ResultCode.sixmlWrongState)) {
            throw e;
        }
        timapi.statemachine.AbstractContext.logger.log(timapi.logging.Level.severe, "Sending event eventConnect failed on state " +
            this.state.classname + " with no Fail-State set", e);
        this.setState(new timapi.statemachine.states.ErrorState(this));
        return;
    }
    timapi.statemachine.AbstractContext.logger.exiting(timapi.statemachine.AbstractContext.classname, "eventConnect");
};
timapi.statemachine.AbstractContext.prototype.eventCounterRequest = function () {
    timapi.statemachine.AbstractContext.logger.entering(timapi.statemachine.AbstractContext.classname, "eventCounterRequest");
    try {
        this.state.counterRequest();
    }
    catch (e) {
        if (e.name == "TimError" &&
            (e.resultCode == timapi.constants.ResultCode.requestPending
                || e.resultCode == timapi.constants.ResultCode.sixmlWrongState)) {
            throw e;
        }
        timapi.statemachine.AbstractContext.logger.log(timapi.logging.Level.severe, "Sending event eventCounterRequest failed on state " +
            this.state.classname + " with no Fail-State set", e);
        this.setState(new timapi.statemachine.states.ErrorState(this));
        return;
    }
    timapi.statemachine.AbstractContext.logger.exiting(timapi.statemachine.AbstractContext.classname, "eventCounterRequest");
};
timapi.statemachine.AbstractContext.prototype.eventDeactivate = function () {
    timapi.statemachine.AbstractContext.logger.entering(timapi.statemachine.AbstractContext.classname, "eventDeactivate");
    try {
        this.state.deactivate();
    }
    catch (e) {
        if (e.name == "TimError" &&
            (e.resultCode == timapi.constants.ResultCode.requestPending
                || e.resultCode == timapi.constants.ResultCode.sixmlWrongState)) {
            throw e;
        }
        timapi.statemachine.AbstractContext.logger.log(timapi.logging.Level.severe, "Sending event eventDeactivate failed on state " +
            this.state.classname + " with no Fail-State set", e);
        this.setState(new timapi.statemachine.states.ErrorState(this));
        return;
    }
    timapi.statemachine.AbstractContext.logger.exiting(timapi.statemachine.AbstractContext.classname, "eventDeactivate");
};
timapi.statemachine.AbstractContext.prototype.eventDisconnect = function () {
    timapi.statemachine.AbstractContext.logger.entering(timapi.statemachine.AbstractContext.classname, "eventDisconnect");
    try {
        this.state.disconnect();
    }
    catch (e) {
        if (e.name == "TimError" &&
            (e.resultCode == timapi.constants.ResultCode.requestPending
                || e.resultCode == timapi.constants.ResultCode.sixmlWrongState)) {
            throw e;
        }
        timapi.statemachine.AbstractContext.logger.log(timapi.logging.Level.severe, "Sending event eventDisconnect failed on state " +
            this.state.classname + " with no Fail-State set", e);
        this.setState(new timapi.statemachine.states.ErrorState(this));
        return;
    }
    timapi.statemachine.AbstractContext.logger.exiting(timapi.statemachine.AbstractContext.classname, "eventDisconnect");
};
timapi.statemachine.AbstractContext.prototype.eventDccRates = function () {
    timapi.statemachine.AbstractContext.logger.entering(timapi.statemachine.AbstractContext.classname, "eventDccRates");
    try {
        this.state.dccRates();
    }
    catch (e) {
        if (e.name == "TimError" &&
            (e.resultCode == timapi.constants.ResultCode.requestPending
                || e.resultCode == timapi.constants.ResultCode.sixmlWrongState)) {
            throw e;
        }
        timapi.statemachine.AbstractContext.logger.log(timapi.logging.Level.severe, "Sending event eventDccRates failed on state " +
            this.state.classname + " with no Fail-State set", e);
        this.setState(new timapi.statemachine.states.ErrorState(this));
        return;
    }
    timapi.statemachine.AbstractContext.logger.exiting(timapi.statemachine.AbstractContext.classname, "eventDccRates");
};
timapi.statemachine.AbstractContext.prototype.eventHardwareInformation = function () {
    timapi.statemachine.AbstractContext.logger.entering(timapi.statemachine.AbstractContext.classname, "eventHardwareInformation");
    try {
        this.state.hardwareInformation();
    }
    catch (e) {
        if (e.name == "TimError" &&
            (e.resultCode == timapi.constants.ResultCode.requestPending
                || e.resultCode == timapi.constants.ResultCode.sixmlWrongState)) {
            throw e;
        }
        timapi.statemachine.AbstractContext.logger.log(timapi.logging.Level.severe, "Sending event eventHardwareInformation failed on state " +
            this.state.classname + " with no Fail-State set", e);
        this.setState(new timapi.statemachine.states.ErrorState(this));
        return;
    }
    timapi.statemachine.AbstractContext.logger.exiting(timapi.statemachine.AbstractContext.classname, "eventHardwareInformation");
};
timapi.statemachine.AbstractContext.prototype.eventInitTransaction = function () {
    timapi.statemachine.AbstractContext.logger.entering(timapi.statemachine.AbstractContext.classname, "eventInitTransaction");
    try {
        this.state.initTransaction();
    }
    catch (e) {
        if (e.name == "TimError" &&
            (e.resultCode == timapi.constants.ResultCode.requestPending
                || e.resultCode == timapi.constants.ResultCode.sixmlWrongState)) {
            throw e;
        }
        timapi.statemachine.AbstractContext.logger.log(timapi.logging.Level.severe, "Sending event eventInitTransaction failed on state " +
            this.state.classname + " with no Fail-State set", e);
        this.setState(new timapi.statemachine.states.ErrorState(this));
        return;
    }
    timapi.statemachine.AbstractContext.logger.exiting(timapi.statemachine.AbstractContext.classname, "eventInitTransaction");
};
timapi.statemachine.AbstractContext.prototype.eventLogin = function () {
    timapi.statemachine.AbstractContext.logger.entering(timapi.statemachine.AbstractContext.classname, "eventLogin");
    try {
        this.state.login();
    }
    catch (e) {
        if (e.name == "TimError" &&
            (e.resultCode == timapi.constants.ResultCode.requestPending
                || e.resultCode == timapi.constants.ResultCode.sixmlWrongState)) {
            throw e;
        }
        timapi.statemachine.AbstractContext.logger.log(timapi.logging.Level.severe, "Sending event eventLogin failed on state " +
            this.state.classname + " with no Fail-State set", e);
        this.setState(new timapi.statemachine.states.ErrorState(this));
        return;
    }
    timapi.statemachine.AbstractContext.logger.exiting(timapi.statemachine.AbstractContext.classname, "eventLogin");
};
timapi.statemachine.AbstractContext.prototype.eventLogout = function () {
    timapi.statemachine.AbstractContext.logger.entering(timapi.statemachine.AbstractContext.classname, "eventLogout");
    try {
        this.state.logout();
    }
    catch (e) {
        if (e.name == "TimError" &&
            (e.resultCode == timapi.constants.ResultCode.requestPending
                || e.resultCode == timapi.constants.ResultCode.sixmlWrongState)) {
            throw e;
        }
        timapi.statemachine.AbstractContext.logger.log(timapi.logging.Level.severe, "Sending event eventLogout failed on state " +
            this.state.classname + " with no Fail-State set", e);
        this.setState(new timapi.statemachine.states.ErrorState(this));
        return;
    }
    timapi.statemachine.AbstractContext.logger.exiting(timapi.statemachine.AbstractContext.classname, "eventLogout");
};
timapi.statemachine.AbstractContext.prototype.eventReboot = function () {
    timapi.statemachine.AbstractContext.logger.entering(timapi.statemachine.AbstractContext.classname, "eventReboot");
    try {
        this.state.reboot();
    }
    catch (e) {
        if (e.name == "TimError" &&
            (e.resultCode == timapi.constants.ResultCode.requestPending
                || e.resultCode == timapi.constants.ResultCode.sixmlWrongState)) {
            throw e;
        }
        timapi.statemachine.AbstractContext.logger.log(timapi.logging.Level.severe, "Sending event eventReboot failed on state " +
            this.state.classname + " with no Fail-State set", e);
        this.setState(new timapi.statemachine.states.ErrorState(this));
        return;
    }
    timapi.statemachine.AbstractContext.logger.exiting(timapi.statemachine.AbstractContext.classname, "eventReboot");
};
timapi.statemachine.AbstractContext.prototype.eventReconciliation = function () {
    timapi.statemachine.AbstractContext.logger.entering(timapi.statemachine.AbstractContext.classname, "eventReconciliation");
    try {
        this.state.reconciliation();
    }
    catch (e) {
        if (e.name == "TimError" &&
            (e.resultCode == timapi.constants.ResultCode.requestPending
                || e.resultCode == timapi.constants.ResultCode.sixmlWrongState)) {
            throw e;
        }
        timapi.statemachine.AbstractContext.logger.log(timapi.logging.Level.severe, "Sending event eventReconciliation failed on state " +
            this.state.classname + " with no Fail-State set", e);
        this.setState(new timapi.statemachine.states.ErrorState(this));
        return;
    }
    timapi.statemachine.AbstractContext.logger.exiting(timapi.statemachine.AbstractContext.classname, "eventReconciliation");
};
timapi.statemachine.AbstractContext.prototype.eventReceiptRequest = function () {
    timapi.statemachine.AbstractContext.logger.entering(timapi.statemachine.AbstractContext.classname, "eventReceiptRequest");
    try {
        this.state.receiptRequest();
    }
    catch (e) {
        if (e.name == "TimError" &&
            (e.resultCode == timapi.constants.ResultCode.requestPending
                || e.resultCode == timapi.constants.ResultCode.sixmlWrongState)) {
            throw e;
        }
        timapi.statemachine.AbstractContext.logger.log(timapi.logging.Level.severe, "Sending event eventReceiptRequest failed on state " +
            this.state.classname + " with no Fail-State set", e);
        this.setState(new timapi.statemachine.states.ErrorState(this));
        return;
    }
    timapi.statemachine.AbstractContext.logger.exiting(timapi.statemachine.AbstractContext.classname, "eventReceiptRequest");
};
timapi.statemachine.AbstractContext.prototype.eventReconfig = function () {
    timapi.statemachine.AbstractContext.logger.entering(timapi.statemachine.AbstractContext.classname, "eventReconfig");
    try {
        this.state.reconfig();
    }
    catch (e) {
        if (e.name == "TimError" &&
            (e.resultCode == timapi.constants.ResultCode.requestPending
                || e.resultCode == timapi.constants.ResultCode.sixmlWrongState)) {
            throw e;
        }
        timapi.statemachine.AbstractContext.logger.log(timapi.logging.Level.severe, "Sending event eventReconfig failed on state " +
            this.state.classname + " with no Fail-State set", e);
        this.setState(new timapi.statemachine.states.ErrorState(this));
        return;
    }
    timapi.statemachine.AbstractContext.logger.exiting(timapi.statemachine.AbstractContext.classname, "eventReconfig");
};
timapi.statemachine.AbstractContext.prototype.eventRollback = function () {
    timapi.statemachine.AbstractContext.logger.entering(timapi.statemachine.AbstractContext.classname, "eventRollback");
    try {
        this.state.rollback();
    }
    catch (e) {
        if (e.name == "TimError" &&
            (e.resultCode == timapi.constants.ResultCode.requestPending
                || e.resultCode == timapi.constants.ResultCode.sixmlWrongState)) {
            throw e;
        }
        timapi.statemachine.AbstractContext.logger.log(timapi.logging.Level.severe, "Sending event eventRollback failed on state " +
            this.state.classname + " with no Fail-State set", e);
        this.setState(new timapi.statemachine.states.ErrorState(this));
        return;
    }
    timapi.statemachine.AbstractContext.logger.exiting(timapi.statemachine.AbstractContext.classname, "eventRollback");
};
timapi.statemachine.AbstractContext.prototype.eventSoftwareUpdate = function () {
    timapi.statemachine.AbstractContext.logger.entering(timapi.statemachine.AbstractContext.classname, "eventSoftwareUpdate");
    try {
        this.state.softwareUpdate();
    }
    catch (e) {
        if (e.name == "TimError" &&
            (e.resultCode == timapi.constants.ResultCode.requestPending
                || e.resultCode == timapi.constants.ResultCode.sixmlWrongState)) {
            throw e;
        }
        timapi.statemachine.AbstractContext.logger.log(timapi.logging.Level.severe, "Sending event eventSoftwareUpdate failed on state " +
            this.state.classname + " with no Fail-State set", e);
        this.setState(new timapi.statemachine.states.ErrorState(this));
        return;
    }
    timapi.statemachine.AbstractContext.logger.exiting(timapi.statemachine.AbstractContext.classname, "eventSoftwareUpdate");
};
timapi.statemachine.AbstractContext.prototype.eventSystemInformation = function () {
    timapi.statemachine.AbstractContext.logger.entering(timapi.statemachine.AbstractContext.classname, "eventSystemInformation");
    try {
        this.state.systemInformation();
    }
    catch (e) {
        if (e.name == "TimError" &&
            (e.resultCode == timapi.constants.ResultCode.requestPending
                || e.resultCode == timapi.constants.ResultCode.sixmlWrongState)) {
            throw e;
        }
        timapi.statemachine.AbstractContext.logger.log(timapi.logging.Level.severe, "Sending event eventSystemInformation failed on state " +
            this.state.classname + " with no Fail-State set", e);
        this.setState(new timapi.statemachine.states.ErrorState(this));
        return;
    }
    timapi.statemachine.AbstractContext.logger.exiting(timapi.statemachine.AbstractContext.classname, "eventSystemInformation");
};
timapi.statemachine.AbstractContext.prototype.eventTransaction = function () {
    timapi.statemachine.AbstractContext.logger.entering(timapi.statemachine.AbstractContext.classname, "eventTransaction");
    try {
        this.state.transaction();
    }
    catch (e) {
        if (e.name == "TimError" &&
            (e.resultCode == timapi.constants.ResultCode.requestPending
                || e.resultCode == timapi.constants.ResultCode.sixmlWrongState)) {
            throw e;
        }
        timapi.statemachine.AbstractContext.logger.log(timapi.logging.Level.severe, "Sending event eventTransaction failed on state " +
            this.state.classname + " with no Fail-State set", e);
        this.setState(new timapi.statemachine.states.ErrorState(this));
        return;
    }
    timapi.statemachine.AbstractContext.logger.exiting(timapi.statemachine.AbstractContext.classname, "eventTransaction");
};
timapi.statemachine.AbstractContext.prototype.eventConnected = function () {
    timapi.statemachine.AbstractContext.logger.entering(timapi.statemachine.AbstractContext.classname, "eventConnected");
    try {
        this.state.connected();
    }
    catch (e) {
        if (e.name == "TimError" &&
            (e.resultCode == timapi.constants.ResultCode.requestPending
                || e.resultCode == timapi.constants.ResultCode.sixmlWrongState)) {
            throw e;
        }
        timapi.statemachine.AbstractContext.logger.log(timapi.logging.Level.severe, "Sending event eventConnected failed on state " +
            this.state.classname + " with no Fail-State set", e);
        this.setState(new timapi.statemachine.states.ErrorState(this));
        return;
    }
    timapi.statemachine.AbstractContext.logger.exiting(timapi.statemachine.AbstractContext.classname, "eventConnected");
};
timapi.statemachine.AbstractContext.prototype.eventConnectFailed = function () {
    timapi.statemachine.AbstractContext.logger.entering(timapi.statemachine.AbstractContext.classname, "eventConnectFailed");
    try {
        this.state.connectFailed();
    }
    catch (e) {
        if (e.name == "TimError" &&
            (e.resultCode == timapi.constants.ResultCode.requestPending
                || e.resultCode == timapi.constants.ResultCode.sixmlWrongState)) {
            throw e;
        }
        timapi.statemachine.AbstractContext.logger.log(timapi.logging.Level.severe, "Sending event eventConnectFailed failed on state " +
            this.state.classname + " with no Fail-State set", e);
        this.setState(new timapi.statemachine.states.ErrorState(this));
        return;
    }
    timapi.statemachine.AbstractContext.logger.exiting(timapi.statemachine.AbstractContext.classname, "eventConnectFailed");
};
timapi.statemachine.AbstractContext.prototype.eventDisconnected = function () {
    timapi.statemachine.AbstractContext.logger.entering(timapi.statemachine.AbstractContext.classname, "eventDisconnected");
    try {
        this.state.disconnected();
    }
    catch (e) {
        if (e.name == "TimError" &&
            (e.resultCode == timapi.constants.ResultCode.requestPending
                || e.resultCode == timapi.constants.ResultCode.sixmlWrongState)) {
            throw e;
        }
        timapi.statemachine.AbstractContext.logger.log(timapi.logging.Level.severe, "Sending event eventDisconnected failed on state " +
            this.state.classname + " with no Fail-State set", e);
        this.setState(new timapi.statemachine.states.ErrorState(this));
        return;
    }
    timapi.statemachine.AbstractContext.logger.exiting(timapi.statemachine.AbstractContext.classname, "eventDisconnected");
};
timapi.statemachine.AbstractContext.prototype.eventResponseRequest = function () {
    timapi.statemachine.AbstractContext.logger.entering(timapi.statemachine.AbstractContext.classname, "eventResponseRequest");
    try {
        this.state.responseRequest();
    }
    catch (e) {
        if (e.name == "TimError" &&
            (e.resultCode == timapi.constants.ResultCode.requestPending
                || e.resultCode == timapi.constants.ResultCode.sixmlWrongState)) {
            throw e;
        }
        timapi.statemachine.AbstractContext.logger.log(timapi.logging.Level.severe, "Sending event eventResponseRequest failed on state " +
            this.state.classname + " with no Fail-State set", e);
        this.setState(new timapi.statemachine.states.ErrorState(this));
        return;
    }
    timapi.statemachine.AbstractContext.logger.exiting(timapi.statemachine.AbstractContext.classname, "eventResponseRequest");
};
timapi.statemachine.AbstractContext.prototype.eventResponseError = function () {
    timapi.statemachine.AbstractContext.logger.entering(timapi.statemachine.AbstractContext.classname, "eventResponseError");
    try {
        this.state.responseError();
    }
    catch (e) {
        if (e.name == "TimError" &&
            (e.resultCode == timapi.constants.ResultCode.requestPending
                || e.resultCode == timapi.constants.ResultCode.sixmlWrongState)) {
            throw e;
        }
        timapi.statemachine.AbstractContext.logger.log(timapi.logging.Level.severe, "Sending event eventResponseError failed on state " +
            this.state.classname + " with no Fail-State set", e);
        this.setState(new timapi.statemachine.states.ErrorState(this));
        return;
    }
    timapi.statemachine.AbstractContext.logger.exiting(timapi.statemachine.AbstractContext.classname, "eventResponseError");
};
timapi.statemachine.AbstractContext.prototype.eventResponseInvalid = function () {
    timapi.statemachine.AbstractContext.logger.entering(timapi.statemachine.AbstractContext.classname, "eventResponseInvalid");
    try {
        this.state.responseInvalid();
    }
    catch (e) {
        if (e.name == "TimError" &&
            (e.resultCode == timapi.constants.ResultCode.requestPending
                || e.resultCode == timapi.constants.ResultCode.sixmlWrongState)) {
            throw e;
        }
        timapi.statemachine.AbstractContext.logger.log(timapi.logging.Level.severe, "Sending event eventResponseInvalid failed on state " +
            this.state.classname + " with no Fail-State set", e);
        this.setState(new timapi.statemachine.states.ErrorState(this));
        return;
    }
    timapi.statemachine.AbstractContext.logger.exiting(timapi.statemachine.AbstractContext.classname, "eventResponseInvalid");
};
timapi.statemachine.AbstractContext.prototype.eventResponseBusy = function () {
    timapi.statemachine.AbstractContext.logger.entering(timapi.statemachine.AbstractContext.classname, "eventResponseBusy");
    try {
        this.state.responseBusy();
    }
    catch (e) {
        if (e.name == "TimError" &&
            (e.resultCode == timapi.constants.ResultCode.requestPending
                || e.resultCode == timapi.constants.ResultCode.sixmlWrongState)) {
            throw e;
        }
        timapi.statemachine.AbstractContext.logger.log(timapi.logging.Level.severe, "Sending event eventResponseBusy failed on state " +
            this.state.classname + " with no Fail-State set", e);
        this.setState(new timapi.statemachine.states.ErrorState(this));
        return;
    }
    timapi.statemachine.AbstractContext.logger.exiting(timapi.statemachine.AbstractContext.classname, "eventResponseBusy");
};
timapi.statemachine.AbstractContext.prototype.eventNotificationStatusChanged = function () {
    timapi.statemachine.AbstractContext.logger.entering(timapi.statemachine.AbstractContext.classname, "eventNotificationStatusChanged");
    try {
        this.state.notificationStatusChanged();
    }
    catch (e) {
        if (e.name == "TimError" &&
            (e.resultCode == timapi.constants.ResultCode.requestPending
                || e.resultCode == timapi.constants.ResultCode.sixmlWrongState)) {
            throw e;
        }
        timapi.statemachine.AbstractContext.logger.log(timapi.logging.Level.severe, "Sending event eventNotificationStatusChanged failed on state " +
            this.state.classname + " with no Fail-State set", e);
        this.setState(new timapi.statemachine.states.ErrorState(this));
        return;
    }
    timapi.statemachine.AbstractContext.logger.exiting(timapi.statemachine.AbstractContext.classname, "eventNotificationStatusChanged");
};
timapi.statemachine.AbstractContext.prototype.eventNotificationLicenseChanged = function () {
    timapi.statemachine.AbstractContext.logger.entering(timapi.statemachine.AbstractContext.classname, "eventNotificationLicenseChanged");
    try {
        this.state.notificationLicenseChanged();
    }
    catch (e) {
        if (e.name == "TimError" &&
            (e.resultCode == timapi.constants.ResultCode.requestPending
                || e.resultCode == timapi.constants.ResultCode.sixmlWrongState)) {
            throw e;
        }
        timapi.statemachine.AbstractContext.logger.log(timapi.logging.Level.severe, "Sending event eventNotificationLicenseChanged failed on state " +
            this.state.classname + " with no Fail-State set", e);
        this.setState(new timapi.statemachine.states.ErrorState(this));
        return;
    }
    timapi.statemachine.AbstractContext.logger.exiting(timapi.statemachine.AbstractContext.classname, "eventNotificationLicenseChanged");
};
timapi.statemachine.AbstractContext.prototype.eventNotificationKeepAlive = function () {
    timapi.statemachine.AbstractContext.logger.entering(timapi.statemachine.AbstractContext.classname, "eventNotificationKeepAlive");
    try {
        this.state.notificationKeepAlive();
    }
    catch (e) {
        if (e.name == "TimError" &&
            (e.resultCode == timapi.constants.ResultCode.requestPending
                || e.resultCode == timapi.constants.ResultCode.sixmlWrongState)) {
            throw e;
        }
        timapi.statemachine.AbstractContext.logger.log(timapi.logging.Level.severe, "Sending event eventNotificationKeepAlive failed on state " +
            this.state.classname + " with no Fail-State set", e);
        this.setState(new timapi.statemachine.states.ErrorState(this));
        return;
    }
    timapi.statemachine.AbstractContext.logger.exiting(timapi.statemachine.AbstractContext.classname, "eventNotificationKeepAlive");
};
timapi.statemachine.AbstractContext.prototype.eventTimeout = function () {
    timapi.statemachine.AbstractContext.logger.entering(timapi.statemachine.AbstractContext.classname, "eventTimeout");
    try {
        this.state.timeout();
    }
    catch (e) {
        if (e.name == "TimError" &&
            (e.resultCode == timapi.constants.ResultCode.requestPending
                || e.resultCode == timapi.constants.ResultCode.sixmlWrongState)) {
            throw e;
        }
        timapi.statemachine.AbstractContext.logger.log(timapi.logging.Level.severe, "Sending event eventTimeout failed on state " +
            this.state.classname + " with no Fail-State set", e);
        this.setState(new timapi.statemachine.states.ErrorState(this));
        return;
    }
    timapi.statemachine.AbstractContext.logger.exiting(timapi.statemachine.AbstractContext.classname, "eventTimeout");
};
timapi.statemachine.AbstractContext.prototype.eventKeepAliveTimeout = function () {
    timapi.statemachine.AbstractContext.logger.entering(timapi.statemachine.AbstractContext.classname, "eventKeepAliveTimeout");
    try {
        this.state.keepAliveTimeout();
    }
    catch (e) {
        if (e.name == "TimError" &&
            (e.resultCode == timapi.constants.ResultCode.requestPending
                || e.resultCode == timapi.constants.ResultCode.sixmlWrongState)) {
            throw e;
        }
        timapi.statemachine.AbstractContext.logger.log(timapi.logging.Level.severe, "Sending event eventKeepAliveTimeout failed on state " +
            this.state.classname + " with no Fail-State set", e);
        this.setState(new timapi.statemachine.states.ErrorState(this));
        return;
    }
    timapi.statemachine.AbstractContext.logger.exiting(timapi.statemachine.AbstractContext.classname, "eventKeepAliveTimeout");
};
timapi.statemachine.AbstractContext.prototype.eventKeepAliveTimer = function () {
    timapi.statemachine.AbstractContext.logger.entering(timapi.statemachine.AbstractContext.classname, "eventKeepAliveTimer");
    try {
        this.state.keepAliveTimer();
    }
    catch (e) {
        if (e.name == "TimError" &&
            (e.resultCode == timapi.constants.ResultCode.requestPending
                || e.resultCode == timapi.constants.ResultCode.sixmlWrongState)) {
            throw e;
        }
        timapi.statemachine.AbstractContext.logger.log(timapi.logging.Level.severe, "Sending event eventKeepAliveTimer failed on state " +
            this.state.classname + " with no Fail-State set", e);
        this.setState(new timapi.statemachine.states.ErrorState(this));
        return;
    }
    timapi.statemachine.AbstractContext.logger.exiting(timapi.statemachine.AbstractContext.classname, "eventKeepAliveTimer");
};
timapi.statemachine.AbstractContext.prototype.eventTrxStateBecameIdle = function () {
    timapi.statemachine.AbstractContext.logger.entering(timapi.statemachine.AbstractContext.classname, "eventTrxStateBecameIdle");
    try {
        this.state.trxStateBecameIdle();
    }
    catch (e) {
        if (e.name == "TimError" &&
            (e.resultCode == timapi.constants.ResultCode.requestPending
                || e.resultCode == timapi.constants.ResultCode.sixmlWrongState)) {
            throw e;
        }
        timapi.statemachine.AbstractContext.logger.log(timapi.logging.Level.severe, "Sending event eventTrxStateBecameIdle failed on state " +
            this.state.classname + " with no Fail-State set", e);
        this.setState(new timapi.statemachine.states.ErrorState(this));
        return;
    }
    timapi.statemachine.AbstractContext.logger.exiting(timapi.statemachine.AbstractContext.classname, "eventTrxStateBecameIdle");
};
timapi.statemachine.AbstractContext.prototype.eventCloseReader = function () {
    timapi.statemachine.AbstractContext.logger.entering(timapi.statemachine.AbstractContext.classname, "eventCloseReader");
    try {
        this.state.closeReader();
    }
    catch (e) {
        if (e.name == "TimError" &&
            (e.resultCode == timapi.constants.ResultCode.requestPending
                || e.resultCode == timapi.constants.ResultCode.sixmlWrongState)) {
            throw e;
        }
        timapi.statemachine.AbstractContext.logger.log(timapi.logging.Level.severe, "Sending event eventCloseReader failed on state " +
            this.state.classname + " with no Fail-State set", e);
        this.setState(new timapi.statemachine.states.ErrorState(this));
        return;
    }
    timapi.statemachine.AbstractContext.logger.exiting(timapi.statemachine.AbstractContext.classname, "eventCloseReader");
};
timapi.statemachine.AbstractContext.prototype.eventOpenReader = function () {
    timapi.statemachine.AbstractContext.logger.entering(timapi.statemachine.AbstractContext.classname, "eventOpenReader");
    try {
        this.state.openReader();
    }
    catch (e) {
        if (e.name == "TimError" &&
            (e.resultCode == timapi.constants.ResultCode.requestPending
                || e.resultCode == timapi.constants.ResultCode.sixmlWrongState)) {
            throw e;
        }
        timapi.statemachine.AbstractContext.logger.log(timapi.logging.Level.severe, "Sending event eventOpenReader failed on state " +
            this.state.classname + " with no Fail-State set", e);
        this.setState(new timapi.statemachine.states.ErrorState(this));
        return;
    }
    timapi.statemachine.AbstractContext.logger.exiting(timapi.statemachine.AbstractContext.classname, "eventOpenReader");
};
timapi.statemachine.AbstractContext.prototype.eventEjectCard = function () {
    timapi.statemachine.AbstractContext.logger.entering(timapi.statemachine.AbstractContext.classname, "eventEjectCard");
    try {
        this.state.ejectCard();
    }
    catch (e) {
        if (e.name == "TimError" &&
            (e.resultCode == timapi.constants.ResultCode.requestPending
                || e.resultCode == timapi.constants.ResultCode.sixmlWrongState)) {
            throw e;
        }
        timapi.statemachine.AbstractContext.logger.log(timapi.logging.Level.severe, "Sending event eventEjectCard failed on state " +
            this.state.classname + " with no Fail-State set", e);
        this.setState(new timapi.statemachine.states.ErrorState(this));
        return;
    }
    timapi.statemachine.AbstractContext.logger.exiting(timapi.statemachine.AbstractContext.classname, "eventEjectCard");
};
timapi.statemachine.AbstractContext.prototype.eventOpenMaintenanceWindow = function () {
    timapi.statemachine.AbstractContext.logger.entering(timapi.statemachine.AbstractContext.classname, "eventOpenMaintenanceWindow");
    try {
        this.state.openMaintenanceWindow();
    }
    catch (e) {
        if (e.name == "TimError" &&
            (e.resultCode == timapi.constants.ResultCode.requestPending
                || e.resultCode == timapi.constants.ResultCode.sixmlWrongState)) {
            throw e;
        }
        timapi.statemachine.AbstractContext.logger.log(timapi.logging.Level.severe, "Sending event eventOpenMaintenanceWindow failed on state " +
            this.state.classname + " with no Fail-State set", e);
        this.setState(new timapi.statemachine.states.ErrorState(this));
        return;
    }
    timapi.statemachine.AbstractContext.logger.exiting(timapi.statemachine.AbstractContext.classname, "eventOpenMaintenanceWindow");
};
timapi.statemachine.AbstractContext.prototype.eventCloseMaintenanceWindow = function () {
    timapi.statemachine.AbstractContext.logger.entering(timapi.statemachine.AbstractContext.classname, "eventCloseMaintenanceWindow");
    try {
        this.state.closeMaintenanceWindow();
    }
    catch (e) {
        if (e.name == "TimError" &&
            (e.resultCode == timapi.constants.ResultCode.requestPending
                || e.resultCode == timapi.constants.ResultCode.sixmlWrongState)) {
            throw e;
        }
        timapi.statemachine.AbstractContext.logger.log(timapi.logging.Level.severe, "Sending event eventCloseMaintenanceWindow failed on state " +
            this.state.classname + " with no Fail-State set", e);
        this.setState(new timapi.statemachine.states.ErrorState(this));
        return;
    }
    timapi.statemachine.AbstractContext.logger.exiting(timapi.statemachine.AbstractContext.classname, "eventCloseMaintenanceWindow");
};
timapi.statemachine.AbstractContext.prototype.eventHoldCommit = function () {
    timapi.statemachine.AbstractContext.logger.entering(timapi.statemachine.AbstractContext.classname, "eventHoldCommit");
    try {
        this.state.holdCommit();
    }
    catch (e) {
        if (e.name == "TimError" &&
            (e.resultCode == timapi.constants.ResultCode.requestPending
                || e.resultCode == timapi.constants.ResultCode.sixmlWrongState)) {
            throw e;
        }
        timapi.statemachine.AbstractContext.logger.log(timapi.logging.Level.severe, "Sending event eventHoldCommit failed on state " +
            this.state.classname + " with no Fail-State set", e);
        this.setState(new timapi.statemachine.states.ErrorState(this));
        return;
    }
    timapi.statemachine.AbstractContext.logger.exiting(timapi.statemachine.AbstractContext.classname, "eventHoldCommit");
};
timapi.statemachine.AbstractContext.prototype.eventActivateServiceMenu = function () {
    timapi.statemachine.AbstractContext.logger.entering(timapi.statemachine.AbstractContext.classname, "eventActivateServiceMenu");
    try {
        this.state.activateServiceMenu();
    }
    catch (e) {
        if (e.name == "TimError" &&
            (e.resultCode == timapi.constants.ResultCode.requestPending
                || e.resultCode == timapi.constants.ResultCode.sixmlWrongState)) {
            throw e;
        }
        timapi.statemachine.AbstractContext.logger.log(timapi.logging.Level.severe, "Sending event eventActivateServiceMenu failed on state " +
            this.state.classname + " with no Fail-State set", e);
        this.setState(new timapi.statemachine.states.ErrorState(this));
        return;
    }
    timapi.statemachine.AbstractContext.logger.exiting(timapi.statemachine.AbstractContext.classname, "eventActivateServiceMenu");
};
timapi.statemachine.AbstractContext.prototype.eventAmtAdjustment = function () {
    timapi.statemachine.AbstractContext.logger.entering(timapi.statemachine.AbstractContext.classname, "eventAmtAdjustment");
    try {
        this.state.amtAdjustment();
    }
    catch (e) {
        if (e.name == "TimError" &&
            (e.resultCode == timapi.constants.ResultCode.requestPending
                || e.resultCode == timapi.constants.ResultCode.sixmlWrongState)) {
            throw e;
        }
        timapi.statemachine.AbstractContext.logger.log(timapi.logging.Level.severe, "Sending event eventAmtAdjustment failed on state " +
            this.state.classname + " with no Fail-State set", e);
        this.setState(new timapi.statemachine.states.ErrorState(this));
        return;
    }
    timapi.statemachine.AbstractContext.logger.exiting(timapi.statemachine.AbstractContext.classname, "eventAmtAdjustment");
};
timapi.statemachine.AbstractContext.prototype.eventBalanceInquiry = function () {
    timapi.statemachine.AbstractContext.logger.entering(timapi.statemachine.AbstractContext.classname, "eventBalanceInquiry");
    try {
        this.state.balanceInquiry();
    }
    catch (e) {
        if (e.name == "TimError" &&
            (e.resultCode == timapi.constants.ResultCode.requestPending
                || e.resultCode == timapi.constants.ResultCode.sixmlWrongState)) {
            throw e;
        }
        timapi.statemachine.AbstractContext.logger.log(timapi.logging.Level.severe, "Sending event eventBalanceInquiry failed on state " +
            this.state.classname + " with no Fail-State set", e);
        this.setState(new timapi.statemachine.states.ErrorState(this));
        return;
    }
    timapi.statemachine.AbstractContext.logger.exiting(timapi.statemachine.AbstractContext.classname, "eventBalanceInquiry");
};
timapi.statemachine.AbstractContext.prototype.eventOpenDialogMode = function () {
    timapi.statemachine.AbstractContext.logger.entering(timapi.statemachine.AbstractContext.classname, "eventOpenDialogMode");
    try {
        this.state.openDialogMode();
    }
    catch (e) {
        if (e.name == "TimError" &&
            (e.resultCode == timapi.constants.ResultCode.requestPending
                || e.resultCode == timapi.constants.ResultCode.sixmlWrongState)) {
            throw e;
        }
        timapi.statemachine.AbstractContext.logger.log(timapi.logging.Level.severe, "Sending event eventOpenDialogMode failed on state " +
            this.state.classname + " with no Fail-State set", e);
        this.setState(new timapi.statemachine.states.ErrorState(this));
        return;
    }
    timapi.statemachine.AbstractContext.logger.exiting(timapi.statemachine.AbstractContext.classname, "eventOpenDialogMode");
};
timapi.statemachine.AbstractContext.prototype.eventCloseDialogMode = function () {
    timapi.statemachine.AbstractContext.logger.entering(timapi.statemachine.AbstractContext.classname, "eventCloseDialogMode");
    try {
        this.state.closeDialogMode();
    }
    catch (e) {
        if (e.name == "TimError" &&
            (e.resultCode == timapi.constants.ResultCode.requestPending
                || e.resultCode == timapi.constants.ResultCode.sixmlWrongState)) {
            throw e;
        }
        timapi.statemachine.AbstractContext.logger.log(timapi.logging.Level.severe, "Sending event eventCloseDialogMode failed on state " +
            this.state.classname + " with no Fail-State set", e);
        this.setState(new timapi.statemachine.states.ErrorState(this));
        return;
    }
    timapi.statemachine.AbstractContext.logger.exiting(timapi.statemachine.AbstractContext.classname, "eventCloseDialogMode");
};
timapi.statemachine.AbstractContext.prototype.eventShowSignatureCapture = function () {
    timapi.statemachine.AbstractContext.logger.entering(timapi.statemachine.AbstractContext.classname, "eventShowSignatureCapture");
    try {
        this.state.showSignatureCapture();
    }
    catch (e) {
        if (e.name == "TimError" &&
            (e.resultCode == timapi.constants.ResultCode.requestPending
                || e.resultCode == timapi.constants.ResultCode.sixmlWrongState)) {
            throw e;
        }
        timapi.statemachine.AbstractContext.logger.log(timapi.logging.Level.severe, "Sending event eventShowSignatureCapture failed on state " +
            this.state.classname + " with no Fail-State set", e);
        this.setState(new timapi.statemachine.states.ErrorState(this));
        return;
    }
    timapi.statemachine.AbstractContext.logger.exiting(timapi.statemachine.AbstractContext.classname, "eventShowSignatureCapture");
};
timapi.statemachine.AbstractContext.prototype.eventShowDialog = function () {
    timapi.statemachine.AbstractContext.logger.entering(timapi.statemachine.AbstractContext.classname, "eventShowDialog");
    try {
        this.state.showDialog();
    }
    catch (e) {
        if (e.name == "TimError" &&
            (e.resultCode == timapi.constants.ResultCode.requestPending
                || e.resultCode == timapi.constants.ResultCode.sixmlWrongState)) {
            throw e;
        }
        timapi.statemachine.AbstractContext.logger.log(timapi.logging.Level.severe, "Sending event eventShowDialog failed on state " +
            this.state.classname + " with no Fail-State set", e);
        this.setState(new timapi.statemachine.states.ErrorState(this));
        return;
    }
    timapi.statemachine.AbstractContext.logger.exiting(timapi.statemachine.AbstractContext.classname, "eventShowDialog");
};
timapi.statemachine.AbstractContext.prototype.eventSendCardCommand = function () {
    timapi.statemachine.AbstractContext.logger.entering(timapi.statemachine.AbstractContext.classname, "eventSendCardCommand");
    try {
        this.state.sendCardCommand();
    }
    catch (e) {
        if (e.name == "TimError" &&
            (e.resultCode == timapi.constants.ResultCode.requestPending
                || e.resultCode == timapi.constants.ResultCode.sixmlWrongState)) {
            throw e;
        }
        timapi.statemachine.AbstractContext.logger.log(timapi.logging.Level.severe, "Sending event eventSendCardCommand failed on state " +
            this.state.classname + " with no Fail-State set", e);
        this.setState(new timapi.statemachine.states.ErrorState(this));
        return;
    }
    timapi.statemachine.AbstractContext.logger.exiting(timapi.statemachine.AbstractContext.classname, "eventSendCardCommand");
};
timapi.statemachine.AbstractContext.prototype.setState = function (state) {
    if (timapi.statemachine.AbstractContext.logger.isLoggable(timapi.logging.Level.FINEST)) {
        timapi.statemachine.AbstractContext.logger.entering(timapi.statemachine.AbstractContext.classname, "setState", this.state);
    }
    else {
        timapi.statemachine.AbstractContext.logger.entering(timapi.statemachine.AbstractContext.classname, "setState");
    }
    if (state == undefined) {
        throw new Error("state is undefined");
    }
    if (this.state != undefined) {
        try {
            this.state.exitState();
        }
        catch (e) {
            timapi.statemachine.AbstractContext.logger.log(timapi.logging.Level.severe, "Exit state failed on state " +
                this.state.classname + " with no Fail-State set", e);
            this.setState(new timapi.statemachine.states.ErrorState(this));
            return;
        }
    }
    this.state = state;
    try {
        this.state.enterState();
    }
    catch (e) {
        timapi.statemachine.AbstractContext.logger.log(timapi.logging.Level.severe, "Enter state failed on state " +
            state.classname + " with no Fail-State set", e);
        this.setState(new timapi.statemachine.states.ErrorState(this));
    }
    timapi.statemachine.AbstractContext.logger.exiting(timapi.statemachine.AbstractContext.classname, "setState");
};
timapi.statemachine.AbstractContext.prototype.state = undefined;
var timapi;
(function (timapi) {
    var statemachine;
    (function (statemachine) {
        var sixml;
        (function (sixml) {
            class StateMachine extends timapi.statemachine.AbstractContext {
                constructor(backend) {
                    super(backend);
                    StateMachine.logger.entering(StateMachine.CLASS_NAME, "<constructor>");
                    if (backend == undefined) {
                        throw new Error();
                    }
                    this.backend = backend;
                    for (var func in this.__proto__) {
                        if (this.__proto__[func] == undefined) {
                            StateMachine.logger.log(timapi.logging.Level.INFO, func + " not implemented!");
                            this.__proto__[func] = function () {
                                StateMachine.logger.log(timapi.logging.Level.WARNING, "Called function not implemented!");
                            };
                        }
                    }
                    StateMachine.logger.exiting(StateMachine.CLASS_NAME, "<constructor>");
                }
                start() {
                    super.start();
                }
                dispose() {
                    StateMachine.logger.entering(StateMachine.CLASS_NAME, "dispose");
                    this.cancelTaskTimeout();
                    this.cancelTaskKeepAliveCheck();
                    this.cancelTaskKeepAliveDisconnect();
                    StateMachine.logger.exiting(StateMachine.CLASS_NAME, "dispose");
                }
                get $backend() {
                    return this.backend;
                }
                get $lastReceivedMessage() {
                    return this.lastReceivedMessage;
                }
                set $lastReceivedMessage(value) {
                    this.lastReceivedMessage = value;
                }
                set $requestChangeSettings(value) {
                    this.requestChangeSettings = value;
                }
                set $requestCounterRequest(value) {
                    this.requestCounterRequest = value;
                }
                set $requestLogin(value) {
                    this.requestLogin = value;
                }
                set $requestReceiptRequest(value) {
                    this.requestReceiptRequest = value;
                }
                set $requestShowSignatureCapture(value) {
                    this.requestShowSignatureCapture = value;
                }
                set $requestShowDialog(value) {
                    this.requestShowDialog = value;
                }
                set $notificationCancel(value) {
                    this.notificationCancel = value;
                }
                set $requestInitTransaction(value) {
                    this.requestInitTransaction = value;
                }
                set $requestTransaction(value) {
                    this.requestTransaction = value;
                }
                set $requestQueryLoyalty(value) {
                    this.requestQueryLoyalty = value;
                }
                conditionIsEnabledAutoConnect() {
                    return this.backend.$terminal.$settings.$autoConnect;
                }
                conditionIsEnabledAutoLogin() {
                    return this.backend.$terminal.$settings.$autoLogin;
                }
                conditionIsEnabledFetchBrands() {
                    return this.backend.$terminal.$settings.$fetchBrands;
                }
                conditionIsEnabledAutoActivate() {
                    return this.backend.$terminal.$settings.$autoActivate;
                }
                conditionIsEnabledAutoCommit() {
                    return this.backend.$terminal.$settings.$autoCommit;
                }
                conditionIsEnabledAutoDeactivate() {
                    return this.backend.$terminal.$settings.$autoDeactivate;
                }
                conditionIsEnabledAutoLogout() {
                    return this.backend.$terminal.$settings.$autoLogout;
                }
                conditionIsEnabledAutoDisconnect() {
                    return this.backend.$terminal.$settings.$autoDisconnect;
                }
                conditionHasTerminalFeatures() {
                    return this.backend.$features !== undefined;
                }
                conditionSupportedFeatureAutoCommit() {
                    return (this.backend.$features !== undefined &&
                        this.backend.$features.$sixml.$autoCommit ===
                            timapi.Support.supported);
                }
                conditionMandatoryFeatureAutoCommit() {
                    return (this.backend.$features !== undefined &&
                        this.backend.$features.$sixml.$autoCommit ===
                            timapi.Support.mandatory);
                }
                conditionIsApplicationInformationNotSupported() {
                    return (this.backend.$features !== undefined &&
                        !this.backend.$features.$sixml.$statusFunctions.has(timapi.constants.StatusFunctions.applicationInformation));
                }
                conditionHasPendingEvent() {
                    return this.pendingRequest !== undefined;
                }
                conditionHasPendingActivate() {
                    return this.pendingRequest === timapi.constants.RequestType.activate;
                }
                conditionHasPendingApplicationInformation() {
                    return (this.pendingRequest ===
                        timapi.constants.RequestType.applicationInformation);
                }
                conditionHasPendingBalance() {
                    return this.pendingRequest === timapi.constants.RequestType.balance;
                }
                conditionHasPendingChangeSettings() {
                    return (this.pendingRequest === timapi.constants.RequestType.changeSettings);
                }
                conditionHasPendingCommit() {
                    return this.pendingRequest === timapi.constants.RequestType.commit;
                }
                conditionHasPendingCounterRequest() {
                    return (this.pendingRequest === timapi.constants.RequestType.counterRequest);
                }
                conditionHasPendingDccRates() {
                    return this.pendingRequest === timapi.constants.RequestType.dccRates;
                }
                conditionHasPendingDeactivate() {
                    return this.pendingRequest === timapi.constants.RequestType.deactivate;
                }
                conditionHasPendingHardwareInformation() {
                    return (this.pendingRequest === timapi.constants.RequestType.hardwareInformation);
                }
                conditionHasPendingInitTransaction() {
                    return (this.pendingRequest === timapi.constants.RequestType.initTransaction);
                }
                conditionHasPendingLogin() {
                    return this.pendingRequest === timapi.constants.RequestType.login;
                }
                conditionHasPendingLogout() {
                    return this.pendingRequest === timapi.constants.RequestType.logout;
                }
                conditionHasPendingReboot() {
                    return this.pendingRequest === timapi.constants.RequestType.reboot;
                }
                conditionHasPendingReceiptRequest() {
                    return (this.pendingRequest === timapi.constants.RequestType.receiptRequest);
                }
                conditionHasPendingReconfig() {
                    return this.pendingRequest === timapi.constants.RequestType.reconfig;
                }
                conditionHasPendingReconciliation() {
                    return (this.pendingRequest === timapi.constants.RequestType.reconciliation);
                }
                conditionHasPendingSoftwareUpdate() {
                    return (this.pendingRequest === timapi.constants.RequestType.softwareUpdate);
                }
                conditionHasPendingSystemInformation() {
                    return (this.pendingRequest === timapi.constants.RequestType.systemInformation);
                }
                conditionHasPendingTransaction() {
                    return this.pendingRequest === timapi.constants.RequestType.transaction;
                }
                conditionHasPendingCancel() {
                    return this.hasPendingCancel;
                }
                conditionTransactionNoCommit() {
                    if (this.lastReceivedMessage == undefined) {
                        return true;
                    }
                    switch (this.lastReceivedMessage.attributes.get("Function")) {
                        case timapi.protocol.constants.Function.credit:
                        case timapi.protocol.constants.Function.combined:
                        case timapi.protocol.constants.Function.giro:
                        case timapi.protocol.constants.Function.finalizePurchase:
                        case timapi.protocol.constants.Function.purchase:
                        case timapi.protocol.constants.Function.purchaseForcedAcceptance:
                        case timapi.protocol.constants.Function.purchasePhoneAuthorized:
                        case timapi.protocol.constants.Function.purchaseReservation:
                        case timapi.protocol.constants.Function.purchaseWithCashback:
                            return false;
                        case timapi.protocol.constants.Function.adjustReservation:
                        case timapi.protocol.constants.Function.authorizeCredit:
                        case timapi.protocol.constants.Function.authorizeDeposit:
                        case timapi.protocol.constants.Function.balanceInquiry:
                        case timapi.protocol.constants.Function.bankingBalanceInquiry:
                        case timapi.protocol.constants.Function.cancelReservation:
                        case timapi.protocol.constants.Function.cashAdvance:
                        case timapi.protocol.constants.Function.collectPoints:
                        case timapi.protocol.constants.Function.loadVoucher:
                        case timapi.protocol.constants.Function.preAuthorization:
                        case timapi.protocol.constants.Function.queryLoyalty:
                        case timapi.protocol.constants.Function.reservation:
                        case timapi.protocol.constants.Function.reversal:
                        default:
                            return true;
                    }
                }
                conditionRunAwayProtection() {
                    return (this.runAwayTime !== undefined &&
                        new Date().getTime() - this.runAwayTime < 1000);
                }
                actionActivate() {
                    StateMachine.logger.entering(StateMachine.CLASS_NAME, "actionActivate");
                    let message = new timapi.protocol.sixml.Request_Activate();
                    message.sequenceNumber = this.backend.consumeNextSequenceNumber();
                    message.usrId = this.backend.$terminal.$userId;
                    this.backend.sendMessage(message);
                    this.armKeepAliveTimer();
                    StateMachine.logger.exiting(StateMachine.CLASS_NAME, "actionActivate");
                }
                actionApplicationInformation() {
                    StateMachine.logger.entering(StateMachine.CLASS_NAME, "actionApplicationInformation");
                    let message = new timapi.protocol.sixml.Request_ApplicationInformation();
                    message.sequenceNumber = this.backend.consumeNextSequenceNumber();
                    this.backend.sendMessage(message);
                    this.armKeepAliveTimer();
                    StateMachine.logger.exiting(StateMachine.CLASS_NAME, "actionApplicationInformation");
                }
                actionBalance() {
                    StateMachine.logger.entering(StateMachine.CLASS_NAME, "actionBalance");
                    let message = new timapi.protocol.sixml.Request_Balance();
                    message.sequenceNumber = this.backend.consumeNextSequenceNumber();
                    this.backend.sendMessage(message);
                    this.armKeepAliveTimer();
                    StateMachine.logger.exiting(StateMachine.CLASS_NAME, "actionBalance");
                }
                actionCancel() {
                    StateMachine.logger.entering(StateMachine.CLASS_NAME, "actionCancel");
                    let message = this.notificationCancel;
                    this.notificationCancel = undefined;
                    this.backend.sendNotification(message);
                    StateMachine.logger.exiting(StateMachine.CLASS_NAME, "actionCancel");
                }
                actionChangeSettings() {
                    StateMachine.logger.entering(StateMachine.CLASS_NAME, "actionChangeSettings");
                    let message = this.requestChangeSettings;
                    this.requestChangeSettings = undefined;
                    message.sequenceNumber = this.backend.consumeNextSequenceNumber();
                    this.backend.sendMessage(message);
                    this.armKeepAliveTimer();
                    StateMachine.logger.exiting(StateMachine.CLASS_NAME, "actionChangeSettings");
                }
                actionCommit() {
                    StateMachine.logger.entering(StateMachine.CLASS_NAME, "actionCommit");
                    let message = new timapi.protocol.sixml.Request_Commit();
                    message.sequenceNumber = this.backend.consumeNextSequenceNumber();
                    this.backend.sendMessage(message);
                    this.armKeepAliveTimer();
                    StateMachine.logger.exiting(StateMachine.CLASS_NAME, "actionCommit");
                }
                actionCounterRequest() {
                    StateMachine.logger.entering(StateMachine.CLASS_NAME, "actionCounterRequest");
                    let message = this.requestCounterRequest;
                    this.requestCounterRequest = undefined;
                    message.sequenceNumber = this.backend.consumeNextSequenceNumber();
                    this.backend.sendMessage(message);
                    this.armKeepAliveTimer();
                    StateMachine.logger.exiting(StateMachine.CLASS_NAME, "actionCounterRequest");
                }
                actionDccRates() {
                    StateMachine.logger.entering(StateMachine.CLASS_NAME, "actionDccRates");
                    let message = new timapi.protocol.sixml.Request_DccRates();
                    message.sequenceNumber = this.backend.consumeNextSequenceNumber();
                    this.backend.sendMessage(message);
                    this.armKeepAliveTimer();
                    StateMachine.logger.exiting(StateMachine.CLASS_NAME, "actionDccRates");
                }
                actionDeactivate() {
                    StateMachine.logger.entering(StateMachine.CLASS_NAME, "actionDeactivate");
                    let message = new timapi.protocol.sixml.Request_Deactivate();
                    message.sequenceNumber = this.backend.consumeNextSequenceNumber();
                    this.backend.sendMessage(message);
                    this.armKeepAliveTimer();
                    StateMachine.logger.exiting(StateMachine.CLASS_NAME, "actionDeactivate");
                }
                actionHardwareInformation() {
                    StateMachine.logger.entering(StateMachine.CLASS_NAME, "actionHardwareInformation");
                    let message = new timapi.protocol.sixml.Request_HardwareInformation();
                    message.sequenceNumber = this.backend.consumeNextSequenceNumber();
                    this.backend.sendMessage(message);
                    this.armKeepAliveTimer();
                    StateMachine.logger.exiting(StateMachine.CLASS_NAME, "actionHardwareInformation");
                }
                actionInitTransaction() {
                    StateMachine.logger.entering(StateMachine.CLASS_NAME, "actionInitTransaction");
                    let message = this.requestInitTransaction;
                    this.requestLogin = undefined;
                    message.sequenceNumber = this.backend.consumeNextSequenceNumber();
                    this.backend.sendMessage(message);
                    this.armKeepAliveTimer();
                    StateMachine.logger.exiting(StateMachine.CLASS_NAME, "actionInitTransaction");
                }
                actionLogin() {
                    StateMachine.logger.entering(StateMachine.CLASS_NAME, "actionLogin");
                    let message = this.requestLogin;
                    this.requestLogin = undefined;
                    message.sequenceNumber = this.backend.consumeNextSequenceNumber();
                    this.backend.sendMessage(message);
                    this.armKeepAliveTimer();
                    StateMachine.logger.exiting(StateMachine.CLASS_NAME, "actionLogin");
                }
                actionLogout() {
                    StateMachine.logger.entering(StateMachine.CLASS_NAME, "actionLogout");
                    let message = new timapi.protocol.sixml.Request_Logout();
                    message.sequenceNumber = this.backend.consumeNextSequenceNumber();
                    this.backend.sendMessage(message);
                    this.armKeepAliveTimer();
                    StateMachine.logger.exiting(StateMachine.CLASS_NAME, "actionLogout");
                }
                actionReboot() {
                    StateMachine.logger.entering(StateMachine.CLASS_NAME, "actionReboot");
                    let message = new timapi.protocol.sixml.Request_Reboot();
                    message.sequenceNumber = this.backend.consumeNextSequenceNumber();
                    this.backend.sendMessage(message);
                    this.armKeepAliveTimer();
                    StateMachine.logger.exiting(StateMachine.CLASS_NAME, "actionReboot");
                }
                actionReconciliation() {
                    StateMachine.logger.entering(StateMachine.CLASS_NAME, "actionReconciliation");
                    let message = new timapi.protocol.sixml.Request_Reconciliation();
                    message.sequenceNumber = this.backend.consumeNextSequenceNumber();
                    this.backend.sendMessage(message);
                    this.armKeepAliveTimer();
                    StateMachine.logger.exiting(StateMachine.CLASS_NAME, "actionReconciliation");
                }
                actionReconfig() {
                    StateMachine.logger.entering(StateMachine.CLASS_NAME, "actionReconfig");
                    let message = new timapi.protocol.sixml.Request_Reconfig();
                    message.sequenceNumber = this.backend.consumeNextSequenceNumber();
                    this.backend.sendMessage(message);
                    this.armKeepAliveTimer();
                    StateMachine.logger.exiting(StateMachine.CLASS_NAME, "actionReconfig");
                }
                actionReceiptRequest() {
                    StateMachine.logger.entering(StateMachine.CLASS_NAME, "actionReceiptRequest");
                    let message = this.requestReceiptRequest;
                    this.requestReceiptRequest = undefined;
                    message.sequenceNumber = this.backend.consumeNextSequenceNumber();
                    this.backend.sendMessage(message);
                    this.armKeepAliveTimer();
                    StateMachine.logger.exiting(StateMachine.CLASS_NAME, "actionReceiptRequest");
                }
                actionRequestFeatures() {
                    StateMachine.logger.entering(StateMachine.CLASS_NAME, "actionRequestFeatures");
                    let message = new timapi.protocol.sixml.Request_FeatureRequest();
                    message.sequenceNumber = this.backend.consumeNextSequenceNumber();
                    this.backend.sendMessage(message);
                    this.armKeepAliveTimer();
                    StateMachine.logger.exiting(StateMachine.CLASS_NAME, "actionRequestFeatures");
                }
                actionRollback() {
                    StateMachine.logger.entering(StateMachine.CLASS_NAME, "actionRollback");
                    let message = new timapi.protocol.sixml.Request_Rollback();
                    message.sequenceNumber = this.backend.consumeNextSequenceNumber();
                    this.backend.sendMessage(message);
                    this.armKeepAliveTimer();
                    StateMachine.logger.exiting(StateMachine.CLASS_NAME, "actionRollback");
                }
                actionSoftwareUpdate() {
                    StateMachine.logger.entering(StateMachine.CLASS_NAME, "actionSoftwareUpdate");
                    let message = new timapi.protocol.sixml.Request_SoftwareUpdate();
                    message.sequenceNumber = this.backend.consumeNextSequenceNumber();
                    this.backend.sendMessage(message);
                    this.armKeepAliveTimer();
                    StateMachine.logger.exiting(StateMachine.CLASS_NAME, "actionSoftwareUpdate");
                }
                actionSystemInformation() {
                    StateMachine.logger.entering(StateMachine.CLASS_NAME, "actionSystemInformation");
                    let message = new timapi.protocol.sixml.Request_SystemInformation();
                    if (this.backend.$terminal.$ecrData.length > 0) {
                        let ecrData = new timapi.protocol.sixml.EcrData();
                        for (let entry of this.backend.$terminal.$ecrData) {
                            let ecrInfo = new timapi.protocol.sixml.EcrInfo();
                            ecrInfo.ecrInfoArchitecture = entry.$architecture;
                            ecrInfo.ecrInfoManufacturerName = entry.$manufacturerName;
                            ecrInfo.ecrInfoName = entry.$name;
                            ecrInfo.ecrInfoSerialNumber = entry.$serialNumber;
                            ecrInfo.ecrInfoType = timapi.protocol.constants.EcrInfoType.timApi2Protocol(entry.$type);
                            ecrInfo.ecrInfoVers = entry.$version;
                            ecrInfo.integratorSolution = entry.$integratorSolution;
                            ecrInfo.remoteIp = entry.$remoteIp;
                            ecrData.ecrInfo.push(ecrInfo);
                        }
                        message.ecrData = ecrData;
                    }
                    message.sequenceNumber = this.backend.consumeNextSequenceNumber();
                    this.backend.sendMessage(message);
                    this.armKeepAliveTimer();
                    StateMachine.logger.exiting(StateMachine.CLASS_NAME, "actionSystemInformation");
                }
                actionTransaction() {
                    StateMachine.logger.entering(StateMachine.CLASS_NAME, "actionTransaction");
                    if (this.requestTransaction instanceof timapi.protocol.sixml.Request_Purchase) {
                        let message = this.requestTransaction;
                        this.requestTransaction = undefined;
                        message.sequenceNumber = this.backend.consumeNextSequenceNumber();
                        this.backend.sendMessage(message);
                        this.armKeepAliveTimer();
                    }
                    else if (this.requestTransaction instanceof timapi.protocol.sixml.Request_Credit) {
                        let message = this.requestTransaction;
                        this.requestTransaction = undefined;
                        message.sequenceNumber = this.backend.consumeNextSequenceNumber();
                        this.backend.sendMessage(message);
                        this.armKeepAliveTimer();
                    }
                    else if (this.requestTransaction instanceof timapi.protocol.sixml.Request_Reversal) {
                        let message = this.requestTransaction;
                        this.requestTransaction = undefined;
                        message.sequenceNumber = this.backend.consumeNextSequenceNumber();
                        this.backend.sendMessage(message);
                        this.armKeepAliveTimer();
                    }
                    else if (this.requestTransaction instanceof timapi.protocol.sixml.Request_PreAuthorization) {
                        let message = this.requestTransaction;
                        this.requestTransaction = undefined;
                        message.sequenceNumber = this.backend.consumeNextSequenceNumber();
                        this.backend.sendMessage(message);
                        this.armKeepAliveTimer();
                    }
                    else if (this.requestTransaction instanceof timapi.protocol.sixml.Request_FinalizePurchase) {
                        let message = this.requestTransaction;
                        this.requestTransaction = undefined;
                        message.sequenceNumber = this.backend.consumeNextSequenceNumber();
                        this.backend.sendMessage(message);
                        this.armKeepAliveTimer();
                    }
                    else if (this.requestTransaction instanceof timapi.protocol.sixml.Request_PurchaseForcedAcceptance) {
                        let message = this.requestTransaction;
                        this.requestTransaction = undefined;
                        message.sequenceNumber = this.backend.consumeNextSequenceNumber();
                        this.backend.sendMessage(message);
                        this.armKeepAliveTimer();
                    }
                    else if (this.requestTransaction instanceof timapi.protocol.sixml.Request_CashAdvance) {
                        let message = this.requestTransaction;
                        this.requestTransaction = undefined;
                        message.sequenceNumber = this.backend.consumeNextSequenceNumber();
                        this.backend.sendMessage(message);
                        this.armKeepAliveTimer();
                    }
                    else if (this.requestTransaction instanceof timapi.protocol.sixml.Request_PurchaseWithCashback) {
                        let message = this.requestTransaction;
                        this.requestTransaction = undefined;
                        message.equenceNumber = this.backend.consumeNextSequenceNumber();
                        this.backend.sendMessage(message);
                        this.armKeepAliveTimer();
                    }
                    else if (this.requestTransaction instanceof timapi.protocol.sixml.Request_PurchasePhoneAuthorized) {
                        let message = this.requestTransaction;
                        this.requestTransaction = undefined;
                        message.sequenceNumber = this.backend.consumeNextSequenceNumber();
                        this.backend.sendMessage(message);
                        this.armKeepAliveTimer();
                    }
                    else if (this.requestTransaction instanceof timapi.protocol.sixml.Request_Reservation) {
                        let message = this.requestTransaction;
                        this.requestTransaction = undefined;
                        message.sequenceNumber = this.backend.consumeNextSequenceNumber();
                        this.backend.sendMessage(message);
                        this.armKeepAliveTimer();
                    }
                    else if (this.requestTransaction instanceof timapi.protocol.sixml.Request_AdjustReservation) {
                        let message = this.requestTransaction;
                        this.requestTransaction = undefined;
                        message.sequenceNumber = this.backend.consumeNextSequenceNumber();
                        this.backend.sendMessage(message);
                        this.armKeepAliveTimer();
                    }
                    else if (this.requestTransaction instanceof timapi.protocol.sixml.Request_CancelReservation) {
                        let message = this.requestTransaction;
                        this.requestTransaction = undefined;
                        message.sequenceNumber = this.backend.consumeNextSequenceNumber();
                        this.backend.sendMessage(message);
                        this.armKeepAliveTimer();
                    }
                    else if (this.requestTransaction instanceof timapi.protocol.sixml.Request_PurchaseReservation) {
                        let message = this.requestTransaction;
                        this.requestTransaction = undefined;
                        message.sequenceNumber = this.backend.consumeNextSequenceNumber();
                        this.backend.sendMessage(message);
                        this.armKeepAliveTimer();
                    }
                    else {
                        throw new Error();
                    }
                    StateMachine.logger.exiting(StateMachine.CLASS_NAME, "actionTransaction");
                }
                actionSetDefaultLoginRequest() {
                    StateMachine.logger.entering(StateMachine.CLASS_NAME, "actionSetDefaultLoginRequest");
                    this.$requestLogin = timapi.statemachine.sixml.ConvertTimApi2SIXml.createLoginRequest(this.backend.$terminal);
                    StateMachine.logger.exiting(StateMachine.CLASS_NAME, "actionSetDefaultLoginRequest");
                }
                actionConnect() {
                    StateMachine.logger.entering(StateMachine.CLASS_NAME, "actionConnect");
                    this.backend.commConnect();
                    StateMachine.logger.exiting(StateMachine.CLASS_NAME, "actionConnect");
                }
                actionDisconnect() {
                    StateMachine.logger.entering(StateMachine.CLASS_NAME, "actionDisconnect");
                    this.backend.commDisconnect();
                    this.backend.setDisconnectedTerminalStatus();
                    this.backend.notifyTerminalStatusChanged();
                    this.backend.notifyDisconnected();
                    StateMachine.logger.exiting(StateMachine.CLASS_NAME, "actionDisconnect");
                }
                actionSendKeepAliveNotification() {
                    StateMachine.logger.entering(StateMachine.CLASS_NAME, "actionSendKeepAliveNotification");
                    this.backend.sendNotification(new timapi.protocol.sixml.Notification_KeepAlive());
                    StateMachine.logger.exiting(StateMachine.CLASS_NAME, "actionSendKeepAliveNotification");
                }
                actionSendErrorResponseDisconnect() {
                    StateMachine.logger.entering(StateMachine.CLASS_NAME, "actionSendErrorResponseDisconnect");
                    this.backend.failRunningRequest(new timapi.TimException(timapi.constants.ResultCode.apiConnectionLostTerminal));
                    StateMachine.logger.exiting(StateMachine.CLASS_NAME, "actionSendErrorResponseDisconnect");
                }
                actionProcessResponseActivate() {
                    StateMachine.logger.entering(StateMachine.CLASS_NAME, "actionProcessResponseActivate");
                    let timResponse;
                    try {
                        let response = new timapi.protocol.sixml.Response_Activate(this.lastReceivedMessage);
                        timResponse = new timapi.ActivateResponse(timapi.statemachine.sixml.ConvertSIXml2TimApi.convertPrintDataOrNull(response.printData), response.actSeqCounter);
                        this.backend.notifyActivateCompleted(undefined, timResponse);
                    }
                    catch (error) {
                        this.backend.failRunningRequest(new timapi.TimException(timapi.constants.ResultCode.apiInvalidAnswer));
                        StateMachine.logger.log(timapi.logging.Level.SEVERE, "actionProcessResponseActivate: exception", error);
                        throw error;
                    }
                    StateMachine.logger.exiting(StateMachine.CLASS_NAME, "actionProcessResponseActivate");
                }
                actionProcessResponseApplicationInformation() {
                    StateMachine.logger.entering(StateMachine.CLASS_NAME, "actionProcessResponseApplicationInformation");
                    let timBrands = new Array();
                    try {
                        let response = new timapi.protocol.sixml
                            .Response_ApplicationInformation(this.lastReceivedMessage);
                        for (let brand of response.brandList.brand) {
                            let timApplications = new Array();
                            for (let application of brand.application) {
                                timApplications.push(new timapi.Application(application.$aid, application.$applicationLabel));
                            }
                            let timCurrencies = new Array();
                            for (let item of brand.currencyList.currencyItem) {
                                timCurrencies.push(new timapi.CurrencyItem(timapi.constants.Currency["item.value"], timapi.protocol.constants.CurrencyType.protocol2TimApi(item.currencyType)));
                            }
                            timBrands.push(new timapi.Brands(brand.brandName, brand.dccAvailable, timapi.protocol.constants.PaymentProtocol.protocol2TimApi(brand.paymentProtocol), brand.$acqId, timapi.statemachine.sixml.ConvertSIXml2TimApi.convertTimeDateOrNull(brand.$lastInitDate), timApplications, timCurrencies));
                        }
                    }
                    catch (error) {
                        this.backend.failRunningRequest(new timapi.TimException(timapi.constants.ResultCode.apiInvalidAnswer));
                        StateMachine.logger.log(timapi.logging.Level.SEVERE, "actionProcessResponseApplicationInformation: exception", error);
                        throw error;
                    }
                    this.backend.$brands(timBrands);
                    this.backend.notifyApplicationInformationCompleted(undefined);
                    StateMachine.logger.exiting(StateMachine.CLASS_NAME, "actionProcessResponseApplicationInformation");
                }
                actionProcessResponseBalance() {
                    StateMachine.logger.entering(StateMachine.CLASS_NAME, "actionProcessResponseBalance");
                    let timResponse;
                    try {
                        let response = new timapi.protocol.sixml.Response_Balance(this.lastReceivedMessage);
                        timResponse = new timapi.BalanceResponse(timapi.statemachine.sixml.ConvertSIXml2TimApi.convertCounters(response.counters), timapi.statemachine.sixml.ConvertSIXml2TimApi.convertPrintDataOrNull(response.printData));
                    }
                    catch (error) {
                        this.backend.failRunningRequest(new timapi.TimException(timapi.constants.ResultCode.apiInvalidAnswer));
                        StateMachine.logger.log(timapi.logging.Level.SEVERE, "actionProcessResponseBalance: exception", [error]);
                        throw error;
                    }
                    this.backend.notifyBalanceCompleted(undefined, timResponse);
                    StateMachine.logger.exiting(StateMachine.CLASS_NAME, "actionProcessResponseBalance");
                }
                actionProcessResponseChangeSettings() {
                    StateMachine.logger.entering(StateMachine.CLASS_NAME, "actionProcessResponseChangeSettings");
                    this.backend.notifyChangeSettingsCompleted(undefined);
                    StateMachine.logger.exiting(StateMachine.CLASS_NAME, "actionProcessResponseChangeSettings");
                }
                actionProcessResponseCommit() {
                    StateMachine.logger.entering(StateMachine.CLASS_NAME, "actionProcessResponseCommit");
                    this.backend.notifyCommitCompleted(undefined);
                    StateMachine.logger.exiting(StateMachine.CLASS_NAME, "actionProcessResponseCommit");
                }
                actionProcessResponseCounterRequest() {
                    StateMachine.logger.entering(StateMachine.CLASS_NAME, "actionProcessResponseCounterRequest");
                    let timCounters;
                    try {
                        let response = new timapi.protocol.sixml.Response_CounterRequest(this.lastReceivedMessage);
                        timCounters = timapi.statemachine.sixml.ConvertSIXml2TimApi.convertCounters(response.counters);
                    }
                    catch (error) {
                        this.backend.failRunningRequest(new timapi.TimException(timapi.constants.ResultCode.apiInvalidAnswer));
                        StateMachine.logger.log(timapi.logging.Level.SEVERE, "actionProcessResponseCounterRequest: exception", [error]);
                        throw error;
                    }
                    this.backend.notifyCounterRequestCompleted(undefined, timCounters);
                    StateMachine.logger.exiting(StateMachine.CLASS_NAME, "actionProcessResponseCounterRequest");
                }
                actionProcessResponseDeactivate() {
                    StateMachine.logger.entering(StateMachine.CLASS_NAME, "actionProcessResponseDeactivate");
                    let timResponse;
                    try {
                        let response = new timapi.protocol.sixml.Response_Deactivate(this.lastReceivedMessage);
                        timResponse = new timapi.DeactivateResponse(timapi.statemachine.sixml.ConvertSIXml2TimApi.convertPrintDataOrNull(response.printData), timapi.statemachine.sixml.ConvertSIXml2TimApi.convertCountersOrNull(response.counters));
                    }
                    catch (error) {
                        this.backend.failRunningRequest(new timapi.TimException(timapi.constants.ResultCode.apiInvalidAnswer));
                        StateMachine.logger.log(timapi.logging.Level.SEVERE, "actionProcessResponseDeactivate: exception", [error]);
                        throw error;
                    }
                    this.backend.notifyDeactivateCompleted(undefined, timResponse);
                    StateMachine.logger.exiting(StateMachine.CLASS_NAME, "actionProcessResponseDeactivate");
                }
                actionProcessResponseDccRates() {
                    StateMachine.logger.entering(StateMachine.CLASS_NAME, "actionProcessResponseDccRates");
                    let timPrintData;
                    try {
                        let response = new timapi.protocol.sixml.Response_DccRates(this.lastReceivedMessage);
                        timPrintData = timapi.statemachine.sixml.ConvertSIXml2TimApi.convertPrintData(response.printData);
                    }
                    catch (error) {
                        this.backend.failRunningRequest(new timapi.TimException(timapi.constants.ResultCode.apiInvalidAnswer));
                        StateMachine.logger.log(timapi.logging.Level.SEVERE, "actionProcessResponseDccRates: exception", [error]);
                        throw error;
                    }
                    this.backend.notifyDccRatesCompleted(undefined, timPrintData);
                    StateMachine.logger.exiting(StateMachine.CLASS_NAME, "actionProcessResponseDccRates");
                }
                actionProcessResponseError() {
                    StateMachine.logger.entering(StateMachine.CLASS_NAME, "actionProcessResponseError");
                    let response = new timapi.protocol.sixml.Response_Error(this.lastReceivedMessage);
                    let resultCode = timapi.protocol.constants.ResultCode.protocol2TimApi(response.resultCode);
                    if (resultCode == undefined) {
                        resultCode = timapi.constants.ResultCode.sixmlGeneralError;
                    }
                    let additionalErrorInfo = new Map();
                    if (response.additionalErrorInfoList !== undefined) {
                        for (let each of response.additionalErrorInfoList.additionalErrorInfo) {
                            additionalErrorInfo.set(each.additionalErrorInfoType, each.value);
                        }
                    }
                    this.backend.failRunningRequest(new timapi.TimException(resultCode, timapi.ErrorMessages.getErrorMessage(resultCode, this.backend.$terminal), timapi.statemachine.sixml.ConvertSIXml2TimApi.convertNativeErrorOrNull(response.nativeError), timapi.statemachine.sixml.ConvertSIXml2TimApi.convertPpInfoOrNull(response.ppInfo), additionalErrorInfo, timapi.statemachine.sixml.ConvertSIXml2TimApi.convertPrintDataOrNull(response.printData)));
                    StateMachine.logger.exiting(StateMachine.CLASS_NAME, "actionProcessResponseError");
                }
                actionProcessResponseFeatureRequest() {
                    StateMachine.logger.entering(StateMachine.CLASS_NAME, "actionProcessResponseFeatureRequest");
                    let timFeatures;
                    let terminalId = "";
                    try {
                        let response = new timapi.protocol.sixml.Response_FeatureRequest(this.lastReceivedMessage);
                        terminalId = response.terminalId;
                        let mapSupport = new Map([
                            ["0", timapi.Support.disabled],
                            ["1", timapi.Support.supported],
                            ["2", timapi.Support.mandatory]
                        ]);
                        let hwCardholderDisplay = false;
                        let hwMerchantDisplay = false;
                        let hwPrinter = false;
                        let hwDisplayBrightness = false;
                        let hwDisplayContrast = false;
                        let hwAlertTones = false;
                        let hwKeypadTones = false;
                        let payDcc = false;
                        let payDeclinedReceipts = false;
                        let payPartialApproval = false;
                        let payEp2Available = false;
                        let payEp2Dcc = false;
                        let payEp2DeclinedReceipts = false;
                        let payEp2MultiAccountSelection = false;
                        let payEp2MultiContractSelection = false;
                        let sixmlAdminFunctions = new Set();
                        let sixmlAutoCommit = timapi.Support.disabled;
                        let sixmlAutoShiftManagement = timapi.Support.disabled;
                        let sixmlAutoShutterManagement = timapi.Support.disabled;
                        let sixmlFinancialFunctions = new Set();
                        let sixmlGuides = new Set();
                        let sixmlNonFinancialFunctions = new Set();
                        let sixmlProtocolLevels = new Set();
                        let sixmlSleepTimer = false;
                        let sixmlStatusFunctions = new Set();
                        let sixmlDialogFunctions = new Set();
                        for (let feature of response.features.feature) {
                            switch (feature.featureType) {
                                case timapi.protocol.constants.FeatureType
                                    .hardwareDisplayCardHolderInstalled:
                                    hwCardholderDisplay = feature.value === "1";
                                    break;
                                case timapi.protocol.constants.FeatureType
                                    .hardwareDisplayMerchantInstalled:
                                    hwMerchantDisplay = feature.value === "1";
                                    break;
                                case timapi.protocol.constants.FeatureType.hardwarePrinterInstalled:
                                    hwPrinter = feature.value === "1";
                                    break;
                                case timapi.protocol.constants.FeatureType
                                    .hardwareSettingDisplayBrightness:
                                    hwDisplayBrightness = feature.value === "1";
                                    break;
                                case timapi.protocol.constants.FeatureType
                                    .hardwareSettingDisplayContrast:
                                    hwDisplayContrast = feature.value === "1";
                                    break;
                                case timapi.protocol.constants.FeatureType
                                    .hardwareSettingTonesAlert:
                                    hwAlertTones = feature.value === "1";
                                    break;
                                case timapi.protocol.constants.FeatureType
                                    .hardwareSettingTonesKeypad:
                                    hwKeypadTones = feature.value === "1";
                                    break;
                                case timapi.protocol.constants.FeatureType.paymentDcc:
                                    payDcc = feature.value === "1";
                                    break;
                                case timapi.protocol.constants.FeatureType.paymentDeclinedReceipts:
                                    payDeclinedReceipts = feature.value === "1";
                                    break;
                                case timapi.protocol.constants.FeatureType.paymentPartialApproval:
                                    payPartialApproval = feature.value === "1";
                                    break;
                                case timapi.protocol.constants.FeatureType.paymentPartialCommit:
                                    break;
                                case timapi.protocol.constants.FeatureType.ep2Available:
                                    payEp2Available = feature.value === "1";
                                    break;
                                case timapi.protocol.constants.FeatureType.ep2Dcc:
                                    payEp2Dcc = feature.value === "1";
                                    break;
                                case timapi.protocol.constants.FeatureType.ep2DeclinedReceipts:
                                    payEp2DeclinedReceipts = feature.value === "1";
                                    break;
                                case timapi.protocol.constants.FeatureType.ep2MultiAccountSelection:
                                    payEp2MultiAccountSelection = feature.value === "1";
                                    break;
                                case timapi.protocol.constants.FeatureType
                                    .ep2MultiContractSelection:
                                    payEp2MultiContractSelection = feature.value === "1";
                                    break;
                                case timapi.protocol.constants.FeatureType.sixmlAdminFunctions:
                                    sixmlAdminFunctions = timapi.protocol.constants.AdminFunctions.protocol2TimApi(parseInt(feature.value, 16));
                                    break;
                                case timapi.protocol.constants.FeatureType.sixmlAutoCommit:
                                    sixmlAutoCommit = mapSupport.get(feature.value);
                                    break;
                                case timapi.protocol.constants.FeatureType.sixmlAutoShiftManagement:
                                    sixmlAutoShiftManagement = mapSupport.get(feature.value);
                                    break;
                                case timapi.protocol.constants.FeatureType
                                    .sixmlAutoShutterManagement:
                                    sixmlAutoShutterManagement = mapSupport.get(feature.value);
                                    break;
                                case timapi.protocol.constants.FeatureType.sixmlDialogFunctions:
                                    sixmlDialogFunctions = timapi.protocol.constants.DialogFunctions.protocol2TimApi(parseInt(feature.value, 16));
                                    break;
                                case timapi.protocol.constants.FeatureType
                                    .sixmlFinancialTransactions:
                                    sixmlFinancialFunctions = timapi.protocol.constants.FinancialTransactions.protocol2TimApi(parseInt(feature.value, 16));
                                    break;
                                case timapi.protocol.constants.FeatureType.sixmlGuides:
                                    sixmlGuides = timapi.protocol.constants.Guides.protocol2TimApi(parseInt(feature.value, 16));
                                    break;
                                case timapi.protocol.constants.FeatureType
                                    .sixmlNonFinancialTransactions:
                                    sixmlNonFinancialFunctions = timapi.protocol.constants.NonFinancialTransactions.protocol2TimApi(parseInt(feature.value, 16));
                                    break;
                                case timapi.protocol.constants.FeatureType.sixmlProtocolLevel:
                                    {
                                        let protocolValue = parseInt(feature.value, undefined);
                                        let pl = timapi.protocol.constants.ProtocolLevel.protocol2TimApiIfValid(protocolValue);
                                        if (pl !== undefined) {
                                            sixmlProtocolLevels.add(pl);
                                        }
                                    }
                                    break;
                                case timapi.protocol.constants.FeatureType.sixmlRemoteFunctions:
                                    break;
                                case timapi.protocol.constants.FeatureType.sixmlSleepTimer:
                                    sixmlSleepTimer = feature.value === "1";
                                    break;
                                case timapi.protocol.constants.FeatureType.sixmlStatusFunctions:
                                    sixmlStatusFunctions = timapi.protocol.constants.StatusFunctions.protocol2TimApi(parseInt(feature.value, 16));
                                    break;
                                case timapi.protocol.constants.FeatureType.sixmlSwUpdateInformation:
                                    break;
                                default:
                                    break;
                            }
                        }
                        timFeatures = new timapi.Features(new timapi.FeaturesHardware(hwCardholderDisplay, hwMerchantDisplay, hwPrinter, hwDisplayBrightness, hwDisplayContrast, hwAlertTones, hwKeypadTones), new timapi.FeaturesPayment(payDcc, payDeclinedReceipts, payPartialApproval, payEp2Available, payEp2Dcc, payEp2DeclinedReceipts, payEp2MultiAccountSelection, payEp2MultiContractSelection), new timapi.FeaturesSixml(sixmlAdminFunctions, sixmlAutoCommit, sixmlAutoShiftManagement, sixmlAutoShutterManagement, sixmlFinancialFunctions, sixmlGuides, sixmlNonFinancialFunctions, sixmlProtocolLevels, sixmlSleepTimer, sixmlStatusFunctions, sixmlDialogFunctions));
                    }
                    catch (error) {
                        this.backend.failRunningRequest(new timapi.TimException(timapi.constants.ResultCode.apiInvalidAnswer));
                        StateMachine.logger.log(timapi.logging.Level.SEVERE, "actionProcessResponseFeatureRequest: exception", [error]);
                        throw error;
                    }
                    this.backend.$terminalId = terminalId;
                    this.backend.$features = timFeatures;
                    if (this.requestLogin !== undefined) {
                        if (this.backend.$terminal.$settings.$autoCommit &&
                            timFeatures.$sixml.$autoCommit === timapi.Support.disabled) {
                            for (let each of this.requestLogin.protocolOptionList.protocolOption) {
                                if (each.optionType === timapi.protocol.constants.OptionType.sixmlAutoCommit) {
                                    each.value = 0;
                                }
                            }
                        }
                        let protocolLevel = timapi.statemachine.sixml.ConvertTimApi2SIXml.findMatchingProtocolLevel(this.backend.$terminal);
                        if (protocolLevel != 0) {
                            for (let each of this.requestLogin.protocolOptionList.protocolOption) {
                                if (each.optionType === timapi.protocol.constants.OptionType.sixmlProtocolLevel) {
                                    each.value = String(protocolLevel);
                                }
                            }
                        }
                        else {
                            this.backend.failRunningRequest(new timapi.TimException(timapi.constants.ResultCode.apiFunctionDisallowed));
                            throw new timapi.TimException(timapi.constants.ResultCode.apiFunctionDisallowed);
                        }
                    }
                    if (this.pendingRequest !== undefined &&
                        !this.backend.isPendingRequestAllowed()) {
                        this.backend.failRunningRequest(new timapi.TimException(timapi.constants.ResultCode.apiFunctionDisallowed));
                        throw new timapi.TimException(timapi.constants.ResultCode.apiFunctionDisallowed);
                    }
                    StateMachine.logger.exiting(StateMachine.CLASS_NAME, "actionProcessResponseFeatureRequest");
                }
                actionProcessResponseHardwareInformation() {
                    StateMachine.logger.entering(StateMachine.CLASS_NAME, "actionProcessResponseHardwareInformation");
                    let timResponse;
                    try {
                        let response = new timapi.protocol.sixml.Response_HardwareInformation(this.lastReceivedMessage);
                        let timHardwares = new Array();
                        for (let hardware of response.hardwareList.hardware) {
                            timHardwares.push(new timapi.Hardware(timapi.protocol.constants.HardwareType.protocol2TimApi(hardware.hardwareType), hardware.serialNumber, timapi.statemachine.sixml.ConvertSIXml2TimApi.convertTimeDateOrNull(hardware.productionDate), hardware.productVersion, hardware.firmwareVersion, timapi.protocol.constants.SecurityStatus.protocol2TimApi(hardware.securityStatus), timapi.statemachine.sixml.ConvertSIXml2TimApi.convertTimeDateOrNull(hardware.lastCleaningDate)));
                        }
                        let timKernelVersions = new Map();
                        for (let kernelVersion of response.kernelVersionList.kernelVersion) {
                            timKernelVersions.set(timapi.protocol.constants.KernelType.protocol2TimApi(kernelVersion.kernelType), kernelVersion.value);
                        }
                        let timSettings = new Map();
                        for (let setting of response.settingsList.setting) {
                            timSettings.set(timapi.protocol.constants.SettingType.protocol2TimApi(setting.settingType), setting.value);
                        }
                        let timStatistics = new Map();
                        if (this.backend.$terminal.$settings.$guides.has(timapi.constants.Guides.unattended)) {
                            for (let statistic of response.statisticsList.statistic) {
                                timStatistics.set(statistic.statisticType, statistic.value);
                            }
                        }
                        timResponse = new timapi.HardwareInformationResponse(timHardwares, timKernelVersions, timSettings, timStatistics);
                    }
                    catch (error) {
                        this.backend.failRunningRequest(new timapi.TimException(timapi.constants.ResultCode.apiInvalidAnswer));
                        StateMachine.logger.log(timapi.logging.Level.SEVERE, "actionProcessResponseHardwareInformation: exception", [error]);
                        throw error;
                    }
                    this.backend.notifyHardwareInformationCompleted(undefined, timResponse);
                    StateMachine.logger.exiting(StateMachine.CLASS_NAME, "actionProcessResponseHardwareInformation");
                }
                actionProcessResponseInitTransaction() {
                    StateMachine.logger.entering(StateMachine.CLASS_NAME, "actionProcessResponseInitTransaction");
                    let timResponse;
                    try {
                        let response = new timapi.protocol.sixml.Response_InitTransaction(this.lastReceivedMessage);
                        timResponse = sixml.ConvertSIXml2TimApi.convertCardDataOrNull(response.cardData);
                    }
                    catch (error) {
                        this.backend.failRunningRequest(new timapi.TimException(timapi.constants.ResultCode.apiInvalidAnswer));
                        StateMachine.logger.log(timapi.logging.Level.SEVERE, "actionProcessResponseInitTransaction: exception", [error]);
                        throw error;
                    }
                    this.backend.notifyInitTransactionCompleted(undefined, timResponse);
                    StateMachine.logger.exiting(StateMachine.CLASS_NAME, "actionProcessResponseInitTransaction", [timResponse]);
                }
                actionProcessResponseLogin() {
                    StateMachine.logger.entering(StateMachine.CLASS_NAME, "actionProcessResponseLogin");
                    StateMachine.logger.exiting(StateMachine.CLASS_NAME, "actionProcessResponseLogin");
                }
                actionProcessResponseLogout() {
                    StateMachine.logger.entering(StateMachine.CLASS_NAME, "actionProcessResponseLogout");
                    this.backend.notifyLogoutCompleted(undefined);
                    StateMachine.logger.exiting(StateMachine.CLASS_NAME, "actionProcessResponseLogout");
                }
                actionProcessResponseReboot() {
                    StateMachine.logger.entering(StateMachine.CLASS_NAME, "actionProcessResponseReboot");
                    this.backend.notifyRebootCompleted(undefined);
                    StateMachine.logger.exiting(StateMachine.CLASS_NAME, "actionProcessResponseReboot");
                }
                actionProcessResponseRollback() {
                    StateMachine.logger.entering(StateMachine.CLASS_NAME, "actionProcessResponseRollback");
                    let timPrintData;
                    try {
                        let response = new timapi.protocol.sixml.Response_Rollback(this.lastReceivedMessage);
                        timPrintData = sixml.ConvertSIXml2TimApi.convertPrintDataOrNull(response.printData);
                    }
                    catch (error) {
                        this.backend.failRunningRequest(new timapi.TimException(timapi.constants.ResultCode.apiInvalidAnswer));
                        StateMachine.logger.log(timapi.logging.Level.SEVERE, "actionProcessResponseRollback: exception", [error]);
                        throw error;
                    }
                    this.backend.notifyRollbackCompleted(undefined, timPrintData);
                    StateMachine.logger.exiting(StateMachine.CLASS_NAME, "actionProcessResponseRollback");
                }
                actionProcessResponseReceiptRequest() {
                    StateMachine.logger.entering(StateMachine.CLASS_NAME, "actionProcessResponseReceiptRequest");
                    let timResponse;
                    try {
                        let response = new timapi.protocol.sixml.Response_ReceiptRequest(this.lastReceivedMessage);
                        timResponse = new timapi.ReceiptRequestResponse(sixml.ConvertSIXml2TimApi.convertPrintDataOrNull(response.printData), response.getHasMoreReceipts());
                    }
                    catch (error) {
                        this.backend.failRunningRequest(new timapi.TimException(timapi.constants.ResultCode.apiInvalidAnswer));
                        StateMachine.logger.log(timapi.logging.Level.SEVERE, "actionProcessResponseReceiptRequest: exception", [error]);
                        throw error;
                    }
                    this.backend.notifyReceiptRequestCompleted(undefined, timResponse);
                    StateMachine.logger.exiting(StateMachine.CLASS_NAME, "actionProcessResponseReceiptRequest");
                }
                actionProcessResponseReconciliation() {
                    StateMachine.logger.entering(StateMachine.CLASS_NAME, "actionProcessResponseReconciliation");
                    let timResponse;
                    try {
                        let response = new timapi.protocol.sixml.Response_Reconciliation(this.lastReceivedMessage);
                        timResponse = new timapi.ReconciliationResponse(sixml.ConvertSIXml2TimApi.convertCounters(response.counters), sixml.ConvertSIXml2TimApi.convertPrintDataOrNull(response.printData));
                    }
                    catch (error) {
                        this.backend.failRunningRequest(new timapi.TimException(timapi.constants.ResultCode.apiInvalidAnswer));
                        StateMachine.logger.log(timapi.logging.Level.SEVERE, "actionProcessResponseReconciliation: exception", error);
                        throw error;
                    }
                    this.backend.notifyReconciliationCompleted(undefined, timResponse);
                    StateMachine.logger.exiting(StateMachine.CLASS_NAME, "actionProcessResponseReconciliation");
                }
                actionProcessResponseReconfig() {
                    StateMachine.logger.entering(StateMachine.CLASS_NAME, "actionProcessResponseReconfig");
                    let timPrintData;
                    try {
                        let response = new timapi.protocol.sixml.Response_Reconfig(this.lastReceivedMessage);
                        timPrintData = sixml.ConvertSIXml2TimApi.convertPrintDataOrNull(response.printData);
                    }
                    catch (error) {
                        this.backend.failRunningRequest(new timapi.TimException(timapi.constants.ResultCode.apiInvalidAnswer));
                        StateMachine.logger.log(timapi.logging.Level.SEVERE, "actionProcessResponseReconfig: exception", [error]);
                        throw error;
                    }
                    this.backend.notifyReconfigCompleted(undefined, timPrintData);
                    StateMachine.logger.exiting(StateMachine.CLASS_NAME, "actionProcessResponseReconfig");
                }
                actionProcessResponseSoftwareUpdate() {
                    StateMachine.logger.entering(StateMachine.CLASS_NAME, "actionProcessResponseSoftwareUpdate");
                    let timStatus;
                    try {
                        let response = new timapi.protocol.sixml.Response_SoftwareUpdate(this.lastReceivedMessage);
                        timStatus = timapi.protocol.constants.UpdateStatus.protocol2TimApi(response.getUpdateStatus());
                    }
                    catch (error) {
                        this.backend.failRunningRequest(new timapi.TimException(timapi.constants.ResultCode.apiInvalidAnswer));
                        StateMachine.logger.log(timapi.logging.Level.SEVERE, "actionProcessResponseSoftwareUpdate: exception", [error]);
                        throw error;
                    }
                    this.backend.notifySoftwareUpdateCompleted(undefined, timStatus);
                    StateMachine.logger.exiting(StateMachine.CLASS_NAME, "actionProcessResponseSoftwareUpdate");
                }
                actionProcessResponseSystemInformation() {
                    StateMachine.logger.entering(StateMachine.CLASS_NAME, "actionProcessResponseSystemInformation");
                    let timResponse;
                    try {
                        let response = new timapi.protocol.sixml.Response_SystemInformation(this.lastReceivedMessage);
                        let timReceiptHeader = new Array();
                        for (let header of response.configData.receiptHeader) {
                            while (timReceiptHeader.length < header.lineNum) {
                                timReceiptHeader.push("");
                            }
                            timReceiptHeader[header.lineNum - 1] = header.value;
                        }
                        this.backend.$configData(new timapi.ConfigData(timReceiptHeader, response.configData.language));
                        timResponse = new timapi.SystemInformationResponse(new timapi.NetworkInformation(response.networkInformation.terminalIp, response.networkInformation.terminalIpMask, response.networkInformation.terminalIpGw, response.networkInformation.terminalIpDns));
                    }
                    catch (error) {
                        this.backend.failRunningRequest(new timapi.TimException(timapi.constants.ResultCode.apiInvalidAnswer));
                        StateMachine.logger.log(timapi.logging.Level.SEVERE, "actionProcessResponseSystemInformation: exception", [error]);
                        throw error;
                    }
                    this.backend.notifySystemInformationCompleted(undefined, timResponse);
                    StateMachine.logger.exiting(StateMachine.CLASS_NAME, "actionProcessResponseSystemInformation");
                }
                actionProcessResponseTransaction() {
                    StateMachine.logger.entering(StateMachine.CLASS_NAME, "actionProcessResponseTransaction");
                    let timResponse;
                    try {
                        let guides = this.backend.$terminal.$settings.$guides;
                        switch (this.lastReceivedMessage.attributes.get("Function")) {
                            case timapi.protocol.constants.Function.purchase:
                                {
                                    let response = new timapi.protocol.sixml.Response_Purchase(this.lastReceivedMessage);
                                    let tipAmount;
                                    if (guides.has(timapi.constants.Guides.gastro)) {
                                        tipAmount = sixml.ConvertSIXml2TimApi.convertAmountTipOrNull(response.amountTip);
                                    }
                                    timResponse = new timapi.TransactionResponse(timapi.constants.TransactionType.purchase, sixml.ConvertSIXml2TimApi.convertAmount(response.amount), sixml.ConvertSIXml2TimApi.convertAmountOrNull(response.amountDue), sixml.ConvertSIXml2TimApi.convertAmountDccOrNull(response.amountDcc), sixml.ConvertSIXml2TimApi.convertAmountOrNull(response.amountSaldo), sixml.ConvertSIXml2TimApi.convertTransactionInformationOrNull(response.transactionInformation), response.dccDisclaimer, sixml.ConvertSIXml2TimApi.convertCardDataOrNull(response.cardData), sixml.ConvertSIXml2TimApi.convertPrintDataOrNull(response.printData), tipAmount, sixml.ConvertSIXml2TimApi.convertAdditionalInfoOrEmpty(response.additionalInfoList), sixml.ConvertSIXml2TimApi.convertBasketOrEmpty(response.basket));
                                }
                                break;
                            case timapi.protocol.constants.Function.credit:
                                {
                                    let response = new timapi.protocol.sixml.Response_Credit(this.lastReceivedMessage);
                                    timResponse = new timapi.TransactionResponse(timapi.constants.TransactionType.credit, sixml.ConvertSIXml2TimApi.convertAmountOrNull(response.amount), undefined, sixml.ConvertSIXml2TimApi.convertAmountDccOrNull(response.amountDcc), sixml.ConvertSIXml2TimApi.convertAmountOrNull(response.amountSaldo), sixml.ConvertSIXml2TimApi.convertTransactionInformationOrNull(response.transactionInformation), response.dccDisclaimer, sixml.ConvertSIXml2TimApi.convertCardDataOrNull(response.cardData), sixml.ConvertSIXml2TimApi.convertPrintDataOrNull(response.printData), undefined, new Map(), new Array());
                                }
                                break;
                            case timapi.protocol.constants.Function.reversal:
                                {
                                    let response = new timapi.protocol.sixml.Response_Reversal(this.lastReceivedMessage);
                                    timResponse = new timapi.TransactionResponse(timapi.constants.TransactionType.reversal, sixml.ConvertSIXml2TimApi.convertAmountOrNull(response.amount), undefined, sixml.ConvertSIXml2TimApi.convertAmountDccOrNull(response.amountDcc), sixml.ConvertSIXml2TimApi.convertAmountOrNull(response.amountSaldo), sixml.ConvertSIXml2TimApi.convertTransactionInformationOrNull(response.transactionInformation), response.dccDisclaimer, undefined, sixml.ConvertSIXml2TimApi.convertPrintDataOrNull(response.printData), undefined, new Map(), new Array());
                                }
                                break;
                            case timapi.protocol.constants.Function.preAuhtorization:
                                {
                                    let response = new timapi.protocol.sixml
                                        .Response_PreAuthorization(this.lastReceivedMessage);
                                    timResponse = new timapi.TransactionResponse(timapi.constants.TransactionType.PRE_AUTHORIZATION, sixml.ConvertSIXml2TimApi.convertAmount(response.amount), undefined, sixml.ConvertSIXml2TimApi.convertAmountDccOrNull(response.amountDcc), sixml.ConvertSIXml2TimApi.convertAmountOrNull(response.amountSaldo), sixml.ConvertSIXml2TimApi.convertTransactionInformation(response.transactionInformation), response.dccDisclaimer, sixml.ConvertSIXml2TimApi.convertCardDataOrNull(response.cardData), sixml.ConvertSIXml2TimApi.convertPrintDataOrNull(response.printData), undefined, sixml.ConvertSIXml2TimApi.convertAdditionalInfoOrEmpty(response.additionalInfoList), sixml.ConvertSIXml2TimApi.convertBasketOrEmpty(response.basket));
                                }
                                break;
                            case timapi.protocol.constants.Function.finalizePurchase:
                                {
                                    let response = new timapi.protocol.sixml
                                        .Response_FinalizePurchase(this.lastReceivedMessage);
                                    timResponse = new timapi.TransactionResponse(timapi.constants.TransactionType.finalizePurchase, sixml.ConvertSIXml2TimApi.convertAmount(response.amount), undefined, undefined, undefined, undefined, undefined, undefined, sixml.ConvertSIXml2TimApi.convertPrintDataOrNull(response.printData), undefined, new Map(), sixml.ConvertSIXml2TimApi.convertBasketOrEmpty(response.basket));
                                }
                                break;
                            case timapi.protocol.constants.Function.purchaseForcedAcceptance:
                                {
                                    let response = new timapi.protocol.sixml
                                        .Response_PurchaseForcedAcceptance(this.lastReceivedMessage);
                                    timResponse = new timapi.TransactionResponse(timapi.constants.TransactionType.purchaseForcedAcceptance, sixml.ConvertSIXml2TimApi.convertAmount(response.amount), sixml.ConvertSIXml2TimApi.convertAmountOrNull(response.amountDue), sixml.ConvertSIXml2TimApi.convertAmountDccOrNull(response.amountDcc), sixml.ConvertSIXml2TimApi.convertAmountOrNull(response.amountSaldo), sixml.ConvertSIXml2TimApi.convertTransactionInformationOrNull(response.transactionInformation), response.dccDisclaimer, sixml.ConvertSIXml2TimApi.convertCardDataOrNull(response.cardData), sixml.ConvertSIXml2TimApi.convertPrintDataOrNull(response.printData), undefined, new Map(), new Array());
                                }
                                break;
                            case timapi.protocol.constants.Function.cashAdvance:
                                {
                                    let response = new timapi.protocol.sixml.Response_CashAdvance(this.lastReceivedMessage);
                                    timResponse = new timapi.TransactionResponse(timapi.constants.TransactionType.cashAdvance, sixml.ConvertSIXml2TimApi.convertAmount(response.amount), sixml.ConvertSIXml2TimApi.convertAmountOrNull(response.amountDue), sixml.ConvertSIXml2TimApi.convertAmountDccOrNull(response.amountDcc), sixml.ConvertSIXml2TimApi.convertAmountOrNull(response.amountSaldo), sixml.ConvertSIXml2TimApi.convertTransactionInformationOrNull(response.transactionInformation), response.dccDisclaimer, sixml.ConvertSIXml2TimApi.convertCardDataOrNull(response.cardData), sixml.ConvertSIXml2TimApi.convertPrintDataOrNull(response.printData), undefined, new Map(), new Array());
                                }
                                break;
                            case timapi.protocol.constants.Function.purchaseWithCashback:
                                {
                                    let response = new timapi.protocol.sixml
                                        .Response_PurchaseWithCashback(this.lastReceivedMessage);
                                    timResponse = new timapi.TransactionResponse(timapi.constants.TransactionType.purchaseWithCashback, sixml.ConvertSIXml2TimApi.convertAmount(response.amount), sixml.ConvertSIXml2TimApi.convertAmountOrNull(response.amountDue), sixml.ConvertSIXml2TimApi.convertAmountDccOrNull(response.amountDcc), sixml.ConvertSIXml2TimApi.convertAmountOrNull(response.amountSaldo), sixml.ConvertSIXml2TimApi.convertTransactionInformationOrNull(response.transactionInformation), response.dccDisclaimer, sixml.ConvertSIXml2TimApi.convertCardDataOrNull(response.cardData), sixml.ConvertSIXml2TimApi.convertPrintDataOrNull(response.printData), undefined, new Map(), new Array());
                                }
                                break;
                            case timapi.protocol.constants.Function.purchasePhoneAuthorized:
                                {
                                    let response = new timapi.protocol.sixml.Response_PurchasePhoneAuthorized(this.lastReceivedMessage);
                                    timResponse = new timapi.TransactionResponse(timapi.constants.TransactionType.purchasePhoneAuthorized, sixml.ConvertSIXml2TimApi.convertAmount(response.amount), sixml.ConvertSIXml2TimApi.convertAmountOrNull(response.amountDue), sixml.ConvertSIXml2TimApi.convertAmountDccOrNull(response.amountDcc), sixml.ConvertSIXml2TimApi.convertAmountOrNull(response.amountSaldo), sixml.ConvertSIXml2TimApi.convertTransactionInformationOrNull(response.transactionInformation), response.dccDisclaimer, sixml.ConvertSIXml2TimApi.convertCardDataOrNull(response.cardData), sixml.ConvertSIXml2TimApi.convertPrintDataOrNull(response.printData), undefined, new Map(), new Array());
                                }
                                break;
                            case timapi.protocol.constants.Function.reservation:
                                {
                                    let response = new timapi.protocol.sixml.Response_Reservation(this.lastReceivedMessage);
                                    timResponse = new timapi.TransactionResponse(timapi.constants.TransactionType.reservation, sixml.ConvertSIXml2TimApi.convertAmount(response.amount), sixml.ConvertSIXml2TimApi.convertAmountOrNull(response.amountDue), sixml.ConvertSIXml2TimApi.convertAmountDccOrNull(response.amountDcc), undefined, sixml.ConvertSIXml2TimApi.convertTransactionInformationOrNull(response.transactionInformation), response.dccDisclaimer, sixml.ConvertSIXml2TimApi.convertCardDataOrNull(response.cardData), sixml.ConvertSIXml2TimApi.convertPrintDataOrNull(response.printData), undefined, new Map(), undefined);
                                }
                                break;
                            case timapi.protocol.constants.Function.adjustReservation:
                                {
                                    let response = new timapi.protocol.sixml.Response_AdjustReservation(this.lastReceivedMessage);
                                    timResponse = new timapi.TransactionResponse(timapi.constants.TransactionType.adjustReservation, sixml.ConvertSIXml2TimApi.convertAmount(response.amount), sixml.ConvertSIXml2TimApi.convertAmountOrNull(response.amountDue), sixml.ConvertSIXml2TimApi.convertAmountDccOrNull(response.amountDcc), undefined, sixml.ConvertSIXml2TimApi.convertTransactionInformationOrNull(response.transactionInformation, this.$backend.$terminalId), response.dccDisclaimer, sixml.ConvertSIXml2TimApi.convertCardDataOrNull(response.cardData), sixml.ConvertSIXml2TimApi.convertPrintDataOrNull(response.printData), undefined, new Map(), undefined);
                                }
                                break;
                            case timapi.protocol.constants.Function.cancelReservation:
                                {
                                    let response = new timapi.protocol.sixml.Response_CancelReservation(this.lastReceivedMessage);
                                    timResponse = new timapi.TransactionResponse(timapi.constants.TransactionType.cancelReservation, sixml.ConvertSIXml2TimApi.convertAmount(response.amount), undefined, undefined, undefined, sixml.ConvertSIXml2TimApi.convertTransactionInformationOrNull(response.transactionInformation, this.$backend.$terminalId), undefined, undefined, sixml.ConvertSIXml2TimApi.convertPrintDataOrNull(response.printData), undefined, new Map(), undefined);
                                }
                                break;
                            case timapi.protocol.constants.Function.purchaseReservation:
                                {
                                    let response = new timapi.protocol.sixml.Response_PurchaseReservation(this.lastReceivedMessage);
                                    let tipAmount = undefined;
                                    if (guides.has(timapi.constants.Guides.gastro)) {
                                        tipAmount = sixml.ConvertSIXml2TimApi.convertAmountTipOrNull(response.amountTip);
                                    }
                                    timResponse = new timapi.TransactionResponse(timapi.constants.TransactionType.purchaseReservation, sixml.ConvertSIXml2TimApi.convertAmount(response.amount), sixml.ConvertSIXml2TimApi.convertAmountOrNull(response.amountDue), sixml.ConvertSIXml2TimApi.convertAmountDccOrNull(response.amountDcc), undefined, sixml.ConvertSIXml2TimApi.convertTransactionInformationOrNull(response.transactionInformation, this.$backend.$terminalId), response.dccDisclaimer, sixml.ConvertSIXml2TimApi.convertCardDataOrNull(response.cardData), sixml.ConvertSIXml2TimApi.convertPrintDataOrNull(response.printData), tipAmount, new Map(), undefined);
                                }
                                break;
                            default:
                                throw new Error();
                        }
                    }
                    catch (error) {
                        this.backend.failRunningRequest(new timapi.TimException(timapi.constants.ResultCode.apiInvalidAnswer));
                        StateMachine.logger.log(timapi.logging.Level.SEVERE, "actionProcessResponseTransaction: exception", [error]);
                        throw error;
                    }
                    this.backend.notifyTransactionCompleted(undefined, timResponse);
                    StateMachine.logger.exiting(StateMachine.CLASS_NAME, "actionProcessResponseTransaction");
                }
                actionProcessNotificationStatusChanged() {
                    StateMachine.logger.entering(StateMachine.CLASS_NAME, "actionProcessNotificationStatusChanged");
                    let notification = new timapi.protocol.sixml.Notification_TerminalStatus(this.lastReceivedMessage);
                    let timDisplay = new Array();
                    for (let line of notification.displayContent.displayLine) {
                        let lineNum = line.lineNum;
                        while (timDisplay.length < lineNum) {
                            timDisplay.push("");
                        }
                        timDisplay[lineNum - 1] = line.value;
                    }
                    this.backend.$terminalStatus =
                        new timapi.TerminalStatus(timDisplay, timapi.protocol.constants.ConnectionStatus.protocol2TimApi(notification.connectionStatus), timapi.protocol.constants.ManagementStatus.protocol2TimApi(notification.managementStatus), timapi.protocol.constants.CardReaderStatus.protocol2TimApi(notification.cardReaderStatus), timapi.protocol.constants.TransactionStatus.protocol2TimApi(notification.transactionStatus), timapi.protocol.constants.SleepModeStatus.protocol2TimApiIfValid(notification.sleepModeStatus), notification.receiptInformation !== undefined
                            ? notification.receiptInformation
                            : false, sixml.ConvertSIXml2TimApi.convertCardDataOrNull(notification.cardData), notification.swUpdateAvailable !== undefined
                            ? notification.swUpdateAvailable
                            : false);
                    this.backend.notifyTerminalStatusChanged();
                    StateMachine.logger.exiting(StateMachine.CLASS_NAME, "actionProcessNotificationStatusChanged");
                }
                actionProcessNotificationLicenseChanged() {
                    StateMachine.logger.entering(StateMachine.CLASS_NAME, "actionProcessNotificationLicenseChanged");
                    this.backend.$license(new timapi.protocol.sixml.Notification_LicenseChanged(this.lastReceivedMessage).license);
                    StateMachine.logger.exiting(StateMachine.CLASS_NAME, "actionProcessNotificationLicenseChanged");
                }
                actionNotifyLoginCompleted() {
                    StateMachine.logger.entering(StateMachine.CLASS_NAME, "actionNotifyLoginCompleted");
                    this.backend.notifyLoginCompleted(undefined);
                    StateMachine.logger.exiting(StateMachine.CLASS_NAME, "actionNotifyLoginCompleted");
                }
                actionSimulateActivateCompleted() {
                    StateMachine.logger.entering(StateMachine.CLASS_NAME, "actionSimulateActivateCompleted");
                    this.backend.notifyActivateCompleted(undefined, undefined);
                    StateMachine.logger.exiting(StateMachine.CLASS_NAME, "actionSimulateActivateCompleted");
                }
                actionSimulateDeactivateCompleted() {
                    StateMachine.logger.entering(StateMachine.CLASS_NAME, "actionSimulateDeactivateCompleted");
                    this.backend.notifyDeactivateCompleted(undefined, undefined);
                    StateMachine.logger.exiting(StateMachine.CLASS_NAME, "actionSimulateDeactivateCompleted");
                }
                actionSimulateLogoutCompleted() {
                    StateMachine.logger.entering(StateMachine.CLASS_NAME, "actionSimulateLogoutCompleted");
                    this.backend.notifyLogoutCompleted(undefined);
                    StateMachine.logger.exiting(StateMachine.CLASS_NAME, "actionSimulateLogoutCompleted");
                }
                actionSimulateCommitCompleted() {
                    StateMachine.logger.entering(StateMachine.CLASS_NAME, "actionSimulateCommitCompleted");
                    this.backend.notifyCommitCompleted(undefined);
                    StateMachine.logger.exiting(StateMachine.CLASS_NAME, "actionSimulateCommitCompleted");
                }
                actionClearPendingEvent() {
                    StateMachine.logger.entering(StateMachine.CLASS_NAME, "actionClearPendingEvent");
                    this.pendingRequest = undefined;
                    StateMachine.logger.exiting(StateMachine.CLASS_NAME, "actionClearPendingEvent");
                }
                actionClearPendingCancel() {
                    StateMachine.logger.entering(StateMachine.CLASS_NAME, "actionClearPendingCancel");
                    this.hasPendingCancel = false;
                    StateMachine.logger.exiting(StateMachine.CLASS_NAME, "actionClearPendingCancel");
                }
                actionSetPendingActivate() {
                    StateMachine.logger.entering(StateMachine.CLASS_NAME, "actionSetPendingActivate");
                    this.pendingRequest = timapi.constants.RequestType.activate;
                    StateMachine.logger.exiting(StateMachine.CLASS_NAME, "actionSetPendingActivate");
                }
                actionSetPendingApplicationInformation() {
                    StateMachine.logger.entering(StateMachine.CLASS_NAME, "actionSetPendingApplicationInformation");
                    this.pendingRequest = timapi.constants.RequestType.applicationInformation;
                    StateMachine.logger.exiting(StateMachine.CLASS_NAME, "actionSetPendingApplicationInformation");
                }
                actionSetPendingBalance() {
                    StateMachine.logger.entering(StateMachine.CLASS_NAME, "actionSetPendingBalance");
                    this.pendingRequest = timapi.constants.RequestType.balance;
                    StateMachine.logger.exiting(StateMachine.CLASS_NAME, "actionSetPendingBalance");
                }
                actionSetPendingChangeSettings() {
                    StateMachine.logger.entering(StateMachine.CLASS_NAME, "actionSetPendingChangeSettings");
                    this.pendingRequest = timapi.constants.RequestType.changeSettings;
                    StateMachine.logger.exiting(StateMachine.CLASS_NAME, "actionSetPendingChangeSettings");
                }
                actionSetPendingCounterRequest() {
                    StateMachine.logger.entering(StateMachine.CLASS_NAME, "actionSetPendingCounterRequest");
                    this.pendingRequest = timapi.constants.RequestType.counterRequest;
                    StateMachine.logger.exiting(StateMachine.CLASS_NAME, "actionSetPendingCounterRequest");
                }
                actionSetPendingCommit() {
                    StateMachine.logger.entering(StateMachine.CLASS_NAME, "actionSetPendingCommit");
                    this.pendingRequest = timapi.constants.RequestType.commit;
                    StateMachine.logger.exiting(StateMachine.CLASS_NAME, "actionSetPendingCommit");
                }
                actionSetPendingDccRates() {
                    StateMachine.logger.entering(StateMachine.CLASS_NAME, "actionSetPendingDccRates");
                    this.pendingRequest = timapi.constants.RequestType.dccRates;
                    StateMachine.logger.exiting(StateMachine.CLASS_NAME, "actionSetPendingDccRates");
                }
                actionSetPendingDeactivate() {
                    StateMachine.logger.entering(StateMachine.CLASS_NAME, "actionSetPendingDeactivate");
                    this.pendingRequest = timapi.constants.RequestType.deactivate;
                    StateMachine.logger.exiting(StateMachine.CLASS_NAME, "actionSetPendingDeactivate");
                }
                actionSetPendingHardwareInformation() {
                    StateMachine.logger.entering(StateMachine.CLASS_NAME, "actionSetPendingHardwareInformation");
                    this.pendingRequest = timapi.constants.RequestType.hardwareInformation;
                    StateMachine.logger.exiting(StateMachine.CLASS_NAME, "actionSetPendingHardwareInformation");
                }
                actionSetPendingInitTransaction() {
                    StateMachine.logger.entering(StateMachine.CLASS_NAME, "actionSetPendingInitTransaction");
                    this.pendingRequest = timapi.constants.RequestType.initTransaction;
                    StateMachine.logger.exiting(StateMachine.CLASS_NAME, "actionSetPendingInitTransaction");
                }
                actionSetPendingLogin() {
                    StateMachine.logger.entering(StateMachine.CLASS_NAME, "actionSetPendingLogin");
                    this.pendingRequest = timapi.constants.RequestType.login;
                    StateMachine.logger.exiting(StateMachine.CLASS_NAME, "actionSetPendingLogin");
                }
                actionSetPendingLogout() {
                    StateMachine.logger.entering(StateMachine.CLASS_NAME, "actionSetPendingLogout");
                    this.pendingRequest = timapi.constants.RequestType.logout;
                    StateMachine.logger.exiting(StateMachine.CLASS_NAME, "actionSetPendingLogout");
                }
                actionSetPendingReboot() {
                    StateMachine.logger.entering(StateMachine.CLASS_NAME, "actionSetPendingReboot");
                    this.pendingRequest = timapi.constants.RequestType.reboot;
                    StateMachine.logger.exiting(StateMachine.CLASS_NAME, "actionSetPendingReboot");
                }
                actionSetPendingReconfig() {
                    StateMachine.logger.entering(StateMachine.CLASS_NAME, "actionSetPendingReconfig");
                    this.pendingRequest = timapi.constants.RequestType.reconfig;
                    StateMachine.logger.exiting(StateMachine.CLASS_NAME, "actionSetPendingReconfig");
                }
                actionSetPendingReceiptRequest() {
                    StateMachine.logger.entering(StateMachine.CLASS_NAME, "actionSetPendingReceiptRequest");
                    this.pendingRequest = timapi.constants.RequestType.receiptRequest;
                    StateMachine.logger.exiting(StateMachine.CLASS_NAME, "actionSetPendingReceiptRequest");
                }
                actionSetPendingReconciliation() {
                    StateMachine.logger.entering(StateMachine.CLASS_NAME, "actionSetPendingReconciliation");
                    this.pendingRequest = timapi.constants.RequestType.reconciliation;
                    StateMachine.logger.exiting(StateMachine.CLASS_NAME, "actionSetPendingReconciliation");
                }
                actionSetPendingSoftwareUpdate() {
                    StateMachine.logger.entering(StateMachine.CLASS_NAME, "actionSetPendingSoftwareUpdate");
                    this.pendingRequest = timapi.constants.RequestType.softwareUpdate;
                    StateMachine.logger.exiting(StateMachine.CLASS_NAME, "actionSetPendingSoftwareUpdate");
                }
                actionSetPendingSystemInformation() {
                    StateMachine.logger.entering(StateMachine.CLASS_NAME, "actionSetPendingSystemInformation");
                    this.pendingRequest = timapi.constants.RequestType.systemInformation;
                    StateMachine.logger.exiting(StateMachine.CLASS_NAME, "actionSetPendingSystemInformation");
                }
                actionSetPendingTransaction() {
                    StateMachine.logger.entering(StateMachine.CLASS_NAME, "actionSetPendingTransaction");
                    this.pendingRequest = timapi.constants.RequestType.transaction;
                    StateMachine.logger.exiting(StateMachine.CLASS_NAME, "actionSetPendingTransaction");
                }
                actionSetPendingCancel() {
                    StateMachine.logger.entering(StateMachine.CLASS_NAME, "actionSetPendingCancel");
                    this.hasPendingCancel = true;
                    StateMachine.logger.exiting(StateMachine.CLASS_NAME, "actionSetPendingCancel");
                }
                actionErrorConnectionLost() {
                    StateMachine.logger.entering(StateMachine.CLASS_NAME, "actionErrorConnectionLost");
                    this.backend.failRunningRequest(new timapi.TimException(timapi.constants.ResultCode.apiConnectionLostTerminal));
                    StateMachine.logger.exiting(StateMachine.CLASS_NAME, "actionErrorConnectionLost");
                }
                actionErrorInvalidResponse() {
                    StateMachine.logger.entering(StateMachine.CLASS_NAME, "actionErrorInvalidResponse");
                    this.backend.failRunningRequest(new timapi.TimException(timapi.constants.ResultCode.apiInvalidAnswer));
                    StateMachine.logger.exiting(StateMachine.CLASS_NAME, "actionErrorInvalidResponse");
                }
                actionErrorRequestInProgress() {
                    StateMachine.logger.entering(StateMachine.CLASS_NAME, "actionErrorRequestInProgress");
                    throw new timapi.TimException(timapi.constants.ResultCode.requestPending);
                }
                actionErrorWrongState() {
                    StateMachine.logger.entering(StateMachine.CLASS_NAME, "actionErrorWrongState");
                    throw new timapi.TimException(timapi.constants.ResultCode.sixmlWrongState);
                }
                actionErrorTimeout() {
                    StateMachine.logger.entering(StateMachine.CLASS_NAME, "actionErrorTimeout");
                    this.backend.failRunningRequest(new timapi.TimException(timapi.constants.ResultCode.timCommunicationFailure));
                    StateMachine.logger.exiting(StateMachine.CLASS_NAME, "actionErrorTimeout");
                }
                actionErrorDisabledFeature() {
                    StateMachine.logger.entering(StateMachine.CLASS_NAME, "actionErrorDisabledFeature");
                    throw new timapi.TimException(timapi.constants.ResultCode.apiDisabledFeature);
                }
                actionArmTimeoutTransaction() {
                    StateMachine.logger.entering(StateMachine.CLASS_NAME, "actionArmTimeoutTransaction");
                    this.actionCancelTimeout();
                    this.taskTimeout = new sixml.TaskTimeout(this, 30 * 1000);
                    StateMachine.logger.exiting(StateMachine.CLASS_NAME, "actionArmTimeoutTransaction");
                }
                actionArmTimeoutRequest() {
                    StateMachine.logger.entering(StateMachine.CLASS_NAME, "actionArmTimeoutRequest");
                    this.actionCancelTimeout();
                    this.taskTimeout = new sixml.TaskTimeout(this, 300 * 1000);
                    StateMachine.logger.exiting(StateMachine.CLASS_NAME, "actionArmTimeoutRequest");
                }
                actionArmTimeoutLongRequest() {
                    StateMachine.logger.entering(StateMachine.CLASS_NAME, "actionArmTimeoutLongRequest");
                    this.actionCancelTimeout();
                    this.taskTimeout = new sixml.TaskTimeout(this, 180 * 1000);
                    StateMachine.logger.exiting(StateMachine.CLASS_NAME, "actionArmTimeoutLongRequest");
                }
                actionCancelTimeout() {
                    StateMachine.logger.entering(StateMachine.CLASS_NAME, "actionCancelTimeout");
                    this.cancelTaskTimeout();
                    StateMachine.logger.exiting(StateMachine.CLASS_NAME, "actionCancelTimeout");
                }
                actionRunAwayProtection() {
                    this.runAwayTime = new Date().getTime();
                }
                conditionHasGuideUnattended() {
                    return this.backend.$terminal.$settings.$guides.has(timapi.constants.Guides.unattended);
                }
                conditionHasPendingCloseReader() {
                    return this.pendingRequest === timapi.constants.RequestType.closeReader;
                }
                conditionHasPendingOpenReader() {
                    return this.pendingRequest === timapi.constants.RequestType.openReader;
                }
                conditionHasPendingEjectCard() {
                    return this.pendingRequest === timapi.constants.RequestType.ejectCard;
                }
                conditionHasPendingOpenMaintenanceWindow() {
                    return (this.pendingRequest ===
                        timapi.constants.RequestType.openMaintenanceWindow);
                }
                conditionHasPendingCloseMaintenanceWindow() {
                    return (this.pendingRequest ===
                        timapi.constants.RequestType.closeMaintenanceWindow);
                }
                conditionHasPendingActivateServiceMenu() {
                    return (this.pendingRequest === timapi.constants.RequestType.activateServiceMenu);
                }
                conditionHasGuideAdvancedRetail() {
                    return this.backend.$terminal.$settings.$guides.has(timapi.constants.Guides.advancedRetail);
                }
                conditionHasPendingBalanceInquiry() {
                    return (this.pendingRequest === timapi.constants.RequestType.balanceInquiry);
                }
                conditionHasPendingQueryLoyalty() {
                    return this.pendingRequest === timapi.constants.RequestType.queryLoyalty;
                }
                actionCloseReader() {
                    StateMachine.logger.entering(StateMachine.CLASS_NAME, "actionCloseReader");
                    let message = new timapi.protocol.sixml.Request_CloseReader();
                    message.sequenceNumber = this.backend.consumeNextSequenceNumber();
                    this.backend.sendMessage(message);
                    this.armKeepAliveTimer();
                    StateMachine.logger.exiting(StateMachine.CLASS_NAME, "actionCloseReader");
                }
                actionOpenReader() {
                    StateMachine.logger.entering(StateMachine.CLASS_NAME, "actionOpenReader");
                    let message = new timapi.protocol.sixml.Request_OpenReader();
                    message.sequenceNumber = this.backend.consumeNextSequenceNumber();
                    this.backend.sendMessage(message);
                    this.armKeepAliveTimer();
                    StateMachine.logger.exiting(StateMachine.CLASS_NAME, "actionOpenReader");
                }
                actionEjectCard() {
                    StateMachine.logger.entering(StateMachine.CLASS_NAME, "actionEjectCard");
                    let message = new timapi.protocol.sixml.Request_EjectCard();
                    message.sequenceNumber = this.backend.consumeNextSequenceNumber();
                    this.backend.sendMessage(message);
                    this.armKeepAliveTimer();
                    StateMachine.logger.exiting(StateMachine.CLASS_NAME, "actionEjectCard");
                }
                actionOpenMaintenanceWindow() {
                    StateMachine.logger.entering(StateMachine.CLASS_NAME, "actionOpenMaintenanceWindow");
                    let message = new timapi.protocol.sixml.Request_OpenMaintenanceWindow();
                    message.sequenceNumber = this.backend.consumeNextSequenceNumber();
                    this.backend.sendMessage(message);
                    this.armKeepAliveTimer();
                    StateMachine.logger.exiting(StateMachine.CLASS_NAME, "actionOpenMaintenanceWindow");
                }
                actionCloseMaintenanceWindow() {
                    StateMachine.logger.entering(StateMachine.CLASS_NAME, "actionCloseMaintenanceWindow");
                    let message = new timapi.protocol.sixml.Request_CloseMaintenanceWindow();
                    message.sequenceNumber = this.backend.consumeNextSequenceNumber();
                    this.backend.sendMessage(message);
                    this.armKeepAliveTimer();
                    StateMachine.logger.exiting(StateMachine.CLASS_NAME, "actionCloseMaintenanceWindow");
                }
                actionHoldCommit() {
                    StateMachine.logger.entering(StateMachine.CLASS_NAME, "actionHoldCommit");
                    this.backend.sendMessage(new timapi.protocol.sixml.Notification_HoldCommit());
                    this.armKeepAliveTimer();
                    StateMachine.logger.exiting(StateMachine.CLASS_NAME, "actionHoldCommit");
                }
                actionActivateServiceMenu() {
                    StateMachine.logger.entering(StateMachine.CLASS_NAME, "actionActivateServiceMenu");
                    let message = new timapi.protocol.sixml.Request_ActivateServiceMenu();
                    message.sequenceNumber = this.backend.consumeNextSequenceNumber();
                    this.backend.sendMessage(message);
                    this.armKeepAliveTimer();
                    StateMachine.logger.exiting(StateMachine.CLASS_NAME, "actionActivateServiceMenu");
                }
                actionProcessResponseCloseReader() {
                    StateMachine.logger.entering(StateMachine.CLASS_NAME, "actionProcessResponseCloseReader");
                    this.backend.notifyCloseReaderCompleted(undefined);
                    StateMachine.logger.exiting(StateMachine.CLASS_NAME, "actionProcessResponseCloseReader");
                }
                actionProcessResponseOpenReader() {
                    StateMachine.logger.entering(StateMachine.CLASS_NAME, "actionProcessResponseOpenReader");
                    this.backend.notifyOpenReaderCompleted(undefined);
                    StateMachine.logger.exiting(StateMachine.CLASS_NAME, "actionProcessResponseOpenReader");
                }
                actionProcessResponseEjectCard() {
                    StateMachine.logger.entering(StateMachine.CLASS_NAME, "actionProcessResponseEjectCard");
                    this.backend.notifyEjectCardCompleted(undefined);
                    StateMachine.logger.exiting(StateMachine.CLASS_NAME, "actionProcessResponseEjectCard");
                }
                actionProcessResponseOpenMaintenanceWindow() {
                    StateMachine.logger.entering(StateMachine.CLASS_NAME, "actionProcessResponseOpenMaintenanceWindow");
                    this.backend.notifyOpenMaintenanceWindowCompleted(undefined);
                    StateMachine.logger.exiting(StateMachine.CLASS_NAME, "actionProcessResponseOpenMaintenanceWindow");
                }
                actionProcessResponseCloseMaintenanceWindow() {
                    StateMachine.logger.entering(StateMachine.CLASS_NAME, "actionProcessResponseCloseMaintenanceWindow");
                    this.backend.notifyCloseMaintenanceWindowCompleted(undefined);
                    StateMachine.logger.exiting(StateMachine.CLASS_NAME, "actionProcessResponseCloseMaintenanceWindow");
                }
                actionProcessResponseActivateServiceMenu() {
                    StateMachine.logger.entering(StateMachine.CLASS_NAME, "actionProcessResponseActivateServiceMenu");
                    this.backend.notifyActivateServiceMenuCompleted(undefined);
                    StateMachine.logger.exiting(StateMachine.CLASS_NAME, "actionProcessResponseActivateServiceMenu");
                }
                actionSetPendingCloseReader() {
                    StateMachine.logger.entering(StateMachine.CLASS_NAME, "actionSetPendingCloseReader");
                    this.pendingRequest = timapi.constants.RequestType.closeReader;
                    StateMachine.logger.exiting(StateMachine.CLASS_NAME, "actionSetPendingCloseReader");
                }
                actionSetPendingOpenReader() {
                    StateMachine.logger.entering(StateMachine.CLASS_NAME, "actionSetPendingOpenReader");
                    this.pendingRequest = timapi.constants.RequestType.openReader;
                    StateMachine.logger.exiting(StateMachine.CLASS_NAME, "actionSetPendingOpenReader");
                }
                actionSetPendingEjectCard() {
                    StateMachine.logger.entering(StateMachine.CLASS_NAME, "actionSetPendingEjectCard");
                    this.pendingRequest = timapi.constants.RequestType.ejectCard;
                    StateMachine.logger.exiting(StateMachine.CLASS_NAME, "actionSetPendingEjectCard");
                }
                actionSetPendingOpenMaintenanceWindow() {
                    StateMachine.logger.entering(StateMachine.CLASS_NAME, "actionSetPendingOpenMaintenanceWindow");
                    this.pendingRequest = timapi.constants.RequestType.openMaintenanceWindow;
                    StateMachine.logger.exiting(StateMachine.CLASS_NAME, "actionSetPendingOpenMaintenanceWindow");
                }
                actionSetPendingCloseMaintenanceWindow() {
                    StateMachine.logger.entering(StateMachine.CLASS_NAME, "actionSetPendingCloseMaintenanceWindow");
                    this.pendingRequest = timapi.constants.RequestType.closeMaintenanceWindow;
                    StateMachine.logger.exiting(StateMachine.CLASS_NAME, "actionSetPendingCloseMaintenanceWindow");
                }
                actionSetPendingActivateServiceMenu() {
                    StateMachine.logger.entering(StateMachine.CLASS_NAME, "actionSetPendingActivateServiceMenu");
                    this.pendingRequest = timapi.constants.RequestType.activateServiceMenu;
                    StateMachine.logger.exiting(StateMachine.CLASS_NAME, "actionSetPendingActivateServiceMenu");
                }
                actionBalanceInquiry() {
                    StateMachine.logger.entering(StateMachine.CLASS_NAME, "actionBalanceInquiry");
                    let message = new timapi.protocol.sixml.Request_BalanceInquiry();
                    message.sequenceNumber = this.backend.consumeNextSequenceNumber();
                    this.backend.sendMessage(message);
                    this.armKeepAliveTimer();
                    StateMachine.logger.exiting(StateMachine.CLASS_NAME, "actionBalanceInquiry");
                }
                actionQueryLoyalty() {
                    StateMachine.logger.entering(StateMachine.CLASS_NAME, "actionQueryLoyalty");
                    let message = this.requestQueryLoyalty;
                    this.requestQueryLoyalty = undefined;
                    message.sequenceNumber = this.backend.consumeNextSequenceNumber();
                    this.backend.sendMessage(message);
                    this.armKeepAliveTimer();
                    StateMachine.logger.exiting(StateMachine.CLASS_NAME, "actionQueryLoyalty");
                }
                actionProcessResponseBalanceInquiry() {
                    StateMachine.logger.entering(StateMachine.CLASS_NAME, "actionProcessResponseBalanceInquiry");
                    let response = new timapi.protocol.sixml.Response_BalanceInquiry(this.lastReceivedMessage);
                    this.backend.notifyBalanceInquiryCompleted(undefined, new timapi.BalanceInquiryResponse(sixml.ConvertSIXml2TimApi.convertAmount(response.amountSaldo), sixml.ConvertSIXml2TimApi.convertPrintDataOrNull(response.printData)));
                    StateMachine.logger.exiting(StateMachine.CLASS_NAME, "actionProcessResponseBalanceInquiry");
                }
                actionProcessResponseQueryLoyalty() {
                    StateMachine.logger.entering(StateMachine.CLASS_NAME, "actionProcessResponseQueryLoyalty");
                    let response = new timapi.protocol.sixml.Response_QueryLoyalty(this.lastReceivedMessage);
                    this.backend.notifyQueryLoyaltyCompleted(undefined, sixml.ConvertSIXml2TimApi.convertCardData(response.cardData));
                    StateMachine.logger.exiting(StateMachine.CLASS_NAME, "actionProcessResponseQueryLoyalty");
                }
                actionSetPendingBalanceInquiry() {
                    StateMachine.logger.entering(StateMachine.CLASS_NAME, "actionSetPendingBalanceInquiry");
                    this.pendingRequest = timapi.constants.RequestType.balanceInquiry;
                    StateMachine.logger.exiting(StateMachine.CLASS_NAME, "actionSetPendingBalanceInquiry");
                }
                actionSetPendingQueryLoyalty() {
                    StateMachine.logger.entering(StateMachine.CLASS_NAME, "actionSetPendingQueryLoyalty");
                    this.pendingRequest = timapi.constants.RequestType.queryLoyalty;
                    StateMachine.logger.exiting(StateMachine.CLASS_NAME, "actionSetPendingQueryLoyalty");
                }
                conditionHasGuideDialog() {
                    return this.backend.$terminal.$settings.$guides.has(timapi.constants.Guides.DIALOG);
                }
                conditionHasPendingOpenDialogMode() {
                    return (this.pendingRequest === timapi.constants.RequestType.openDialogMode);
                }
                conditionHasPendingCloseDialogMode() {
                    return (this.pendingRequest === timapi.constants.RequestType.closeDialogMode);
                }
                conditionHasPendingShowSignatureCapture() {
                    return (this.pendingRequest ===
                        timapi.constants.RequestType.showSignatureCapture);
                }
                conditionHasPendingShowDialog() {
                    return this.pendingRequest === timapi.constants.RequestType.showDialog;
                }
                conditionHasPendingSendCardCommand() {
                    return false;
                }
                actionOpenDialogMode() {
                    StateMachine.logger.entering(StateMachine.CLASS_NAME, "actionOpenDialogMode");
                    let message = new timapi.protocol.sixml.Request_OpenDialogMode();
                    message.sequenceNumber = this.backend.consumeNextSequenceNumber();
                    this.backend.sendMessage(message);
                    this.armKeepAliveTimer();
                    StateMachine.logger.exiting(StateMachine.CLASS_NAME, "actionOpenDialogMode");
                }
                actionCloseDialogMode() {
                    StateMachine.logger.entering(StateMachine.CLASS_NAME, "actionCloseDialogMode");
                    let message = new timapi.protocol.sixml.Request_CloseDialogMode();
                    message.sequenceNumber = this.backend.consumeNextSequenceNumber();
                    this.backend.sendMessage(message);
                    this.armKeepAliveTimer();
                    StateMachine.logger.exiting(StateMachine.CLASS_NAME, "actionCloseDialogMode");
                }
                actionShowSignatureCapture() {
                    StateMachine.logger.entering(StateMachine.CLASS_NAME, "actionShowSignatureCapture");
                    let message = this.requestShowSignatureCapture;
                    this.requestShowSignatureCapture = undefined;
                    message.sequenceNumber = this.backend.consumeNextSequenceNumber();
                    this.backend.sendMessage(message);
                    this.armKeepAliveTimer();
                    StateMachine.logger.exiting(StateMachine.CLASS_NAME, "actionShowSignatureCapture");
                }
                actionShowDialog() {
                    StateMachine.logger.entering(StateMachine.CLASS_NAME, "actionShowDialog");
                    let message = this.requestShowDialog;
                    this.requestShowDialog = undefined;
                    message.sequenceNumber = this.backend.consumeNextSequenceNumber();
                    this.backend.sendMessage(message);
                    this.armKeepAliveTimer();
                    StateMachine.logger.exiting(StateMachine.CLASS_NAME, "actionShowDialog");
                }
                actionProcessResponseOpenDialogMode() {
                    StateMachine.logger.entering(StateMachine.CLASS_NAME, "actionProcessResponseOpenDialogMode");
                    this.backend.notifyOpenDialogModeCompleted(undefined);
                    StateMachine.logger.exiting(StateMachine.CLASS_NAME, "actionProcessResponseOpenDialogMode");
                }
                actionProcessResponseCloseDialogMode() {
                    StateMachine.logger.entering(StateMachine.CLASS_NAME, "actionProcessResponseCloseDialogMode");
                    this.backend.notifyCloseDialogModeCompleted(undefined);
                    StateMachine.logger.exiting(StateMachine.CLASS_NAME, "actionProcessResponseCloseDialogMode");
                }
                actionProcessResponseShowSignatureCapture() {
                    StateMachine.logger.entering(StateMachine.CLASS_NAME, "actionProcessResponseShowSignatureCapture");
                    let response = new timapi.protocol.sixml.Response_ShowSignatureCapture(this.lastReceivedMessage);
                    let siginfo = response.signatureInformation;
                    this.backend.notifyShowSignatureCaptureCompleted(undefined, new timapi.ShowSignatureCaptureResponse(timapi.protocol.constants.Reason.protocol2TimApi(siginfo.reason), timapi.protocol.constants.ImageFileFormat.protocol2TimApi(siginfo.imageFileFormat), siginfo.imageWidth, siginfo.imageHeight, siginfo.value));
                    StateMachine.logger.exiting(StateMachine.CLASS_NAME, "actionProcessResponseShowSignatureCapture");
                }
                actionProcessResponseShowDialog() {
                    StateMachine.logger.entering(StateMachine.CLASS_NAME, "actionProcessResponseShowDialog");
                    let response = new timapi.protocol.sixml.Response_ShowDialog(this.lastReceivedMessage);
                    let resinfo = response.resourceInformation;
                    this.backend.notifyShowDialogCompleted(undefined, new timapi.ShowDialogResponse(timapi.protocol.constants.Reason.protocol2TimApi(resinfo.reason), resinfo.inputValue, sixml.ConvertSIXml2TimApi.convertCardDataOrNull(resinfo.cardData)));
                    StateMachine.logger.exiting(StateMachine.CLASS_NAME, "actionProcessResponseShowDialog");
                }
                actionSetPendingOpenDialogMode() {
                    StateMachine.logger.entering(StateMachine.CLASS_NAME, "actionSetPendingOpenDialogMode");
                    this.pendingRequest = timapi.constants.RequestType.openDialogMode;
                    StateMachine.logger.exiting(StateMachine.CLASS_NAME, "actionSetPendingOpenDialogMode");
                }
                actionSetPendingCloseDialogMode() {
                    StateMachine.logger.entering(StateMachine.CLASS_NAME, "actionSetPendingCloseDialogMode");
                    this.pendingRequest = timapi.constants.RequestType.closeDialogMode;
                    StateMachine.logger.exiting(StateMachine.CLASS_NAME, "actionSetPendingCloseDialogMode");
                }
                actionSetPendingShowSignatureCapture() {
                    StateMachine.logger.entering(StateMachine.CLASS_NAME, "actionSetPendingShowSignatureCapture");
                    this.pendingRequest = timapi.constants.RequestType.showSignatureCapture;
                    StateMachine.logger.exiting(StateMachine.CLASS_NAME, "actionSetPendingShowSignatureCapture");
                }
                actionSetPendingShowDialog() {
                    StateMachine.logger.entering(StateMachine.CLASS_NAME, "actionSetPendingShowDialog");
                    this.pendingRequest = timapi.constants.RequestType.showDialog;
                    StateMachine.logger.exiting(StateMachine.CLASS_NAME, "actionSetPendingShowDialog");
                }
                cancelTaskTimeout() {
                    if (this.taskTimeout !== undefined) {
                        this.taskTimeout.cancel();
                        this.taskTimeout = undefined;
                    }
                }
                cancelTaskKeepAliveDisconnect() {
                    if (this.taskKeepAliveDisconnect !== undefined) {
                        this.taskKeepAliveDisconnect.cancel();
                        this.taskKeepAliveDisconnect = undefined;
                    }
                }
                cancelTaskKeepAliveCheck() {
                    if (this.taskKeepAliveCheck !== undefined) {
                        this.taskKeepAliveCheck.cancel();
                        this.taskKeepAliveCheck = undefined;
                    }
                }
                armKeepAliveTimeout() {
                    if (this.backend.$terminal.$settings.$enableKeepAlive == true) {
                        this.cancelTaskKeepAliveDisconnect();
                        this.taskKeepAliveDisconnect = new sixml.TaskKeepAliveDisconnect(this, 22 * 1000);
                    }
                }
                armKeepAliveTimer() {
                    if (this.backend.$terminal.$settings.$enableKeepAlive == true) {
                        this.cancelTaskKeepAliveCheck();
                        this.taskKeepAliveCheck = new sixml.TaskKeepAliveCheck(this, 10 * 1000);
                    }
                }
                get $pendingRequest() {
                    return this.pendingRequest;
                }
            }
            StateMachine.LOGGER_NAME = "StateMachineLogger";
            StateMachine.CLASS_NAME = "StateMachine";
            StateMachine.logger = timapi.logging.Logger.getLogger(StateMachine.LOGGER_NAME);
            sixml.StateMachine = StateMachine;
        })(sixml = statemachine.sixml || (statemachine.sixml = {}));
    })(statemachine = timapi.statemachine || (timapi.statemachine = {}));
})(timapi || (timapi = {}));
timapi.statemachine.states.DefaultState = function (context) {
    if (context == undefined) {
        throw new Error("Invalid argument. context is undefined");
    }
    this.context = context;
};
timapi.statemachine.states.DefaultState.loggerName = "timapi.statemachine.states.DefaultState";
timapi.statemachine.states.DefaultState.classname = "DefaultState";
timapi.statemachine.states.DefaultState.logger = timapi.logging.Logger.getLogger(timapi.statemachine.states.DefaultState.loggerName);
timapi.statemachine.states.DefaultState.prototype.enterState = function () {
};
timapi.statemachine.states.DefaultState.prototype.exitState = function () {
};
timapi.statemachine.states.DefaultState.prototype.activate = function () {
    this.context.actionErrorWrongState();
};
timapi.statemachine.states.DefaultState.prototype.applicationInformation = function () {
    this.context.actionErrorWrongState();
};
timapi.statemachine.states.DefaultState.prototype.balance = function () {
    this.context.actionErrorWrongState();
};
timapi.statemachine.states.DefaultState.prototype.cancel = function () {
    this.context.actionErrorWrongState();
};
timapi.statemachine.states.DefaultState.prototype.changeSettings = function () {
    this.context.actionErrorWrongState();
};
timapi.statemachine.states.DefaultState.prototype.commit = function () {
    this.context.actionErrorWrongState();
};
timapi.statemachine.states.DefaultState.prototype.connect = Object.illegalState;
timapi.statemachine.states.DefaultState.prototype.counterRequest = function () {
    this.context.actionErrorWrongState();
};
timapi.statemachine.states.DefaultState.prototype.deactivate = function () {
    this.context.actionErrorWrongState();
};
timapi.statemachine.states.DefaultState.prototype.disconnect = function () {
    this.context.actionDisconnect();
    this.context.setState(new timapi.statemachine.states.Disconnected(this.context));
};
timapi.statemachine.states.DefaultState.prototype.dccRates = function () {
    this.context.actionErrorWrongState();
};
timapi.statemachine.states.DefaultState.prototype.hardwareInformation = function () {
    this.context.actionErrorWrongState();
};
timapi.statemachine.states.DefaultState.prototype.initTransaction = function () {
    this.context.actionErrorWrongState();
};
timapi.statemachine.states.DefaultState.prototype.login = function () {
    this.context.actionErrorWrongState();
};
timapi.statemachine.states.DefaultState.prototype.logout = function () {
    this.context.actionErrorWrongState();
};
timapi.statemachine.states.DefaultState.prototype.reboot = function () {
    this.context.actionErrorWrongState();
};
timapi.statemachine.states.DefaultState.prototype.reconciliation = function () {
    this.context.actionErrorWrongState();
};
timapi.statemachine.states.DefaultState.prototype.receiptRequest = function () {
    this.context.actionErrorWrongState();
};
timapi.statemachine.states.DefaultState.prototype.reconfig = function () {
    this.context.actionErrorWrongState();
};
timapi.statemachine.states.DefaultState.prototype.rollback = function () {
    this.context.actionErrorWrongState();
};
timapi.statemachine.states.DefaultState.prototype.softwareUpdate = function () {
    this.context.actionErrorWrongState();
};
timapi.statemachine.states.DefaultState.prototype.systemInformation = function () {
    this.context.actionErrorWrongState();
};
timapi.statemachine.states.DefaultState.prototype.transaction = function () {
    this.context.actionErrorWrongState();
};
timapi.statemachine.states.DefaultState.prototype.connected = Object.illegalState;
timapi.statemachine.states.DefaultState.prototype.connectFailed = function () {
    this.context.actionClearPendingEvent();
    this.context.setState(new timapi.statemachine.states.ErrorState(this.context));
};
timapi.statemachine.states.DefaultState.prototype.disconnected = function () {
    if (this.context.conditionIsEnabledAutoConnect()
        && !this.context.conditionRunAwayProtection()) {
        this.context.actionErrorConnectionLost();
        this.context.actionConnect();
        this.context.setState(new timapi.statemachine.states.Connecting(this.context));
        return;
    }
    this.context.actionErrorConnectionLost();
    this.context.setState(new timapi.statemachine.states.Disconnected(this.context));
};
timapi.statemachine.states.DefaultState.prototype.responseRequest = function () {
    this.context.actionDisconnect();
    this.context.actionErrorInvalidResponse();
    this.context.setState(new timapi.statemachine.states.Disconnected(this.context));
};
timapi.statemachine.states.DefaultState.prototype.responseError = function () {
    this.context.actionDisconnect();
    this.context.actionErrorInvalidResponse();
    this.context.setState(new timapi.statemachine.states.Disconnected(this.context));
};
timapi.statemachine.states.DefaultState.prototype.responseInvalid = function () {
    this.context.actionDisconnect();
    this.context.actionErrorInvalidResponse();
    this.context.setState(new timapi.statemachine.states.Disconnected(this.context));
};
timapi.statemachine.states.DefaultState.prototype.responseBusy = function () {
    this.context.actionDisconnect();
    this.context.actionErrorInvalidResponse();
    this.context.setState(new timapi.statemachine.states.Disconnected(this.context));
};
timapi.statemachine.states.DefaultState.prototype.notificationStatusChanged = function () {
    this.context.actionProcessNotificationStatusChanged();
};
timapi.statemachine.states.DefaultState.prototype.notificationLicenseChanged = function () {
    this.context.actionProcessNotificationLicenseChanged();
};
timapi.statemachine.states.DefaultState.prototype.notificationKeepAlive = function () {
};
timapi.statemachine.states.DefaultState.prototype.timeout = Object.illegalState;
timapi.statemachine.states.DefaultState.prototype.keepAliveTimeout = function () {
    try {
        this.context.actionErrorConnectionLost();
        this.context.actionDisconnect();
        this.context.setState(new timapi.statemachine.states.Disconnected(this.context));
    }
    catch (e) {
        timapi.statemachine.states.DefaultState.logger.log(timapi.logging.Level.severe, "Exception", e);
        this.context.setState(new timapi.statemachine.states.Disconnected(this.context));
    }
};
timapi.statemachine.states.DefaultState.prototype.keepAliveTimer = function () {
    this.context.actionSendKeepAliveNotification();
};
timapi.statemachine.states.DefaultState.prototype.trxStateBecameIdle = function () {
};
timapi.statemachine.states.DefaultState.prototype.closeReader = function () {
    this.context.actionErrorWrongState();
};
timapi.statemachine.states.DefaultState.prototype.openReader = function () {
    this.context.actionErrorWrongState();
};
timapi.statemachine.states.DefaultState.prototype.ejectCard = function () {
    this.context.actionErrorWrongState();
};
timapi.statemachine.states.DefaultState.prototype.openMaintenanceWindow = function () {
    this.context.actionErrorWrongState();
};
timapi.statemachine.states.DefaultState.prototype.closeMaintenanceWindow = function () {
    this.context.actionErrorWrongState();
};
timapi.statemachine.states.DefaultState.prototype.holdCommit = function () {
    if (!this.context.conditionHasGuideUnattended()) {
        this.context.actionErrorDisabledFeature();
        return;
    }
    this.context.actionErrorWrongState();
};
timapi.statemachine.states.DefaultState.prototype.activateServiceMenu = function () {
    this.context.actionErrorWrongState();
};
timapi.statemachine.states.DefaultState.prototype.amtAdjustment = function () {
    if (!this.context.conditionHasGuideUnattended()) {
        this.context.actionErrorDisabledFeature();
        return;
    }
    this.context.actionErrorWrongState();
};
timapi.statemachine.states.DefaultState.prototype.balanceInquiry = function () {
    this.context.actionErrorWrongState();
};
timapi.statemachine.states.DefaultState.prototype.openDialogMode = function () {
    this.context.actionErrorWrongState();
};
timapi.statemachine.states.DefaultState.prototype.closeDialogMode = function () {
    this.context.actionErrorWrongState();
};
timapi.statemachine.states.DefaultState.prototype.showSignatureCapture = function () {
    this.context.actionErrorWrongState();
};
timapi.statemachine.states.DefaultState.prototype.showDialog = function () {
    this.context.actionErrorWrongState();
};
timapi.statemachine.states.DefaultState.prototype.sendCardCommand = function () {
    this.context.actionErrorWrongState();
};
timapi.statemachine.states.DefaultState.prototype.toString = function () {
    return this.classname;
};
timapi.statemachine.states.DefaultState.prototype.context = undefined;
timapi.statemachine.states.Activating = function (context) {
    timapi.statemachine.states.DefaultState.call(this, context);
};
timapi.statemachine.states.Activating.prototype = Object.create(timapi.statemachine.states.DefaultState.prototype);
timapi.statemachine.states.Activating.loggerName = "timapi.statemachine.states.Activating";
timapi.statemachine.states.Activating.classname = "Activating";
timapi.statemachine.states.Activating.logger = timapi.logging.Logger.getLogger(timapi.statemachine.states.Activating.loggerName);
timapi.statemachine.states.Activating.prototype.enterState = function () {
    timapi.statemachine.states.DefaultState.prototype.enterState.call(this);
};
timapi.statemachine.states.Activating.prototype.activate = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.Activating.prototype.applicationInformation = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.Activating.prototype.balance = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.Activating.prototype.cancel = function () {
    this.context.actionClearPendingCancel();
    this.context.actionCancel();
};
timapi.statemachine.states.Activating.prototype.changeSettings = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.Activating.prototype.commit = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.Activating.prototype.connect = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.Activating.prototype.counterRequest = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.Activating.prototype.deactivate = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.Activating.prototype.disconnect = function () {
    this.context.actionSendErrorResponseDisconnect();
    this.context.actionClearPendingEvent();
    this.context.actionDisconnect();
    this.context.setState(new timapi.statemachine.states.Disconnected(this.context));
};
timapi.statemachine.states.Activating.prototype.dccRates = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.Activating.prototype.hardwareInformation = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.Activating.prototype.initTransaction = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.Activating.prototype.login = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.Activating.prototype.logout = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.Activating.prototype.reboot = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.Activating.prototype.reconciliation = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.Activating.prototype.receiptRequest = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.Activating.prototype.reconfig = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.Activating.prototype.rollback = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.Activating.prototype.softwareUpdate = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.Activating.prototype.systemInformation = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.Activating.prototype.transaction = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.Activating.prototype.connected = function () {
};
timapi.statemachine.states.Activating.prototype.connectFailed = function () {
    this.context.actionClearPendingEvent();
    this.context.setState(new timapi.statemachine.states.ErrorState(this.context));
};
timapi.statemachine.states.Activating.prototype.responseRequest = function () {
    this.context.actionProcessResponseActivate();
    this.context.setState(new timapi.statemachine.states.Open(this.context));
};
timapi.statemachine.states.Activating.prototype.responseError = function () {
    this.context.actionClearPendingEvent();
    this.context.actionProcessResponseError();
    this.context.setState(new timapi.statemachine.states.LoggedIn(this.context));
};
timapi.statemachine.states.Activating.prototype.responseBusy = function () {
    if (!this.context.conditionHasPendingEvent()) {
        this.context.actionClearPendingEvent();
        this.context.actionProcessResponseError();
        this.context.setState(new timapi.statemachine.states.LoggedIn(this.context));
        return;
    }
};
timapi.statemachine.states.Activating.prototype.timeout = function () {
    this.context.actionErrorTimeout();
    this.context.setState(new timapi.statemachine.states.LoggedIn(this.context));
};
timapi.statemachine.states.Activating.prototype.keepAliveTimeout = function () {
    try {
        this.context.actionErrorConnectionLost();
        this.context.actionDisconnect();
        this.context.setState(new timapi.statemachine.states.Disconnected(this.context));
    }
    catch (e) {
        timapi.statemachine.states.Activating.logger.log(timapi.logging.Level.severe, "Exception", e);
        this.context.setState(new timapi.statemachine.states.Disconnected(this.context));
    }
};
timapi.statemachine.states.Activating.prototype.trxStateBecameIdle = function () {
    if (this.context.conditionHasPendingEvent()) {
        this.context.actionActivate();
        return;
    }
};
timapi.statemachine.states.Activating.prototype.closeReader = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.Activating.prototype.openReader = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.Activating.prototype.ejectCard = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.Activating.prototype.openMaintenanceWindow = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.Activating.prototype.closeMaintenanceWindow = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.Activating.prototype.activateServiceMenu = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.Activating.prototype.balanceInquiry = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.Activating.prototype.openDialogMode = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.Activating.prototype.closeDialogMode = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.Activating.prototype.showSignatureCapture = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.Activating.prototype.showDialog = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.Activating.prototype.sendCardCommand = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.Connecting = function (context) {
    timapi.statemachine.states.DefaultState.call(this, context);
};
timapi.statemachine.states.Connecting.prototype = Object.create(timapi.statemachine.states.DefaultState.prototype);
timapi.statemachine.states.Connecting.loggerName = "timapi.statemachine.states.Connecting";
timapi.statemachine.states.Connecting.classname = "Connecting";
timapi.statemachine.states.Connecting.logger = timapi.logging.Logger.getLogger(timapi.statemachine.states.Connecting.loggerName);
timapi.statemachine.states.Connecting.prototype.activate = function () {
    if (this.context.conditionHasPendingEvent()) {
        this.context.actionErrorRequestInProgress();
        return;
    }
    this.context.actionSetPendingActivate();
};
timapi.statemachine.states.Connecting.prototype.applicationInformation = function () {
    if (this.context.conditionHasPendingEvent()) {
        this.context.actionErrorRequestInProgress();
        return;
    }
    this.context.actionSetPendingApplicationInformation();
};
timapi.statemachine.states.Connecting.prototype.cancel = function () {
    this.context.actionSetPendingCancel();
};
timapi.statemachine.states.Connecting.prototype.changeSettings = function () {
    if (this.context.conditionHasPendingEvent()) {
        this.context.actionErrorRequestInProgress();
        return;
    }
    this.context.actionSetPendingChangeSettings();
};
timapi.statemachine.states.Connecting.prototype.commit = function () {
    if (this.context.conditionHasPendingEvent()) {
        this.context.actionErrorRequestInProgress();
        return;
    }
    this.context.actionSetPendingCommit();
};
timapi.statemachine.states.Connecting.prototype.connect = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.Connecting.prototype.counterRequest = function () {
    if (this.context.conditionHasPendingEvent()) {
        this.context.actionErrorRequestInProgress();
        return;
    }
    this.context.actionSetPendingCounterRequest();
};
timapi.statemachine.states.Connecting.prototype.deactivate = function () {
    if (this.context.conditionHasPendingEvent()) {
        this.context.actionErrorRequestInProgress();
        return;
    }
    this.context.actionSetPendingDeactivate();
};
timapi.statemachine.states.Connecting.prototype.dccRates = function () {
    if (this.context.conditionHasPendingEvent()) {
        this.context.actionErrorRequestInProgress();
        return;
    }
    this.context.actionSetPendingDccRates();
};
timapi.statemachine.states.Connecting.prototype.hardwareInformation = function () {
    if (this.context.conditionHasPendingEvent()) {
        this.context.actionErrorRequestInProgress();
        return;
    }
    this.context.actionSetPendingHardwareInformation();
};
timapi.statemachine.states.Connecting.prototype.initTransaction = function () {
    if (this.context.conditionHasPendingEvent()) {
        this.context.actionErrorRequestInProgress();
        return;
    }
    this.context.actionSetPendingInitTransaction();
};
timapi.statemachine.states.Connecting.prototype.login = function () {
    if (this.context.conditionHasPendingEvent()) {
        this.context.actionErrorRequestInProgress();
        return;
    }
    this.context.actionSetPendingLogin();
};
timapi.statemachine.states.Connecting.prototype.logout = function () {
    if (this.context.conditionHasPendingEvent()) {
        this.context.actionErrorRequestInProgress();
        return;
    }
    this.context.actionSetPendingLogout();
};
timapi.statemachine.states.Connecting.prototype.reboot = function () {
    if (this.context.conditionHasPendingEvent()) {
        this.context.actionErrorRequestInProgress();
        return;
    }
    this.context.actionSetPendingReboot();
};
timapi.statemachine.states.Connecting.prototype.reconciliation = function () {
    if (this.context.conditionHasPendingEvent()) {
        this.context.actionErrorRequestInProgress();
        return;
    }
    this.context.actionSetPendingReconciliation();
};
timapi.statemachine.states.Connecting.prototype.receiptRequest = function () {
    if (this.context.conditionHasPendingEvent()) {
        this.context.actionErrorRequestInProgress();
        return;
    }
    this.context.actionSetPendingReceiptRequest();
};
timapi.statemachine.states.Connecting.prototype.reconfig = function () {
    if (this.context.conditionHasPendingEvent()) {
        this.context.actionErrorRequestInProgress();
        return;
    }
    this.context.actionSetPendingReconfig();
};
timapi.statemachine.states.Connecting.prototype.softwareUpdate = function () {
    if (this.context.conditionHasPendingEvent()) {
        this.context.actionErrorRequestInProgress();
        return;
    }
    this.context.actionSetPendingSoftwareUpdate();
};
timapi.statemachine.states.Connecting.prototype.systemInformation = function () {
    if (this.context.conditionHasPendingEvent()) {
        this.context.actionErrorRequestInProgress();
        return;
    }
    this.context.actionSetPendingSystemInformation();
};
timapi.statemachine.states.Connecting.prototype.transaction = function () {
    if (this.context.conditionHasPendingEvent()) {
        this.context.actionErrorRequestInProgress();
        return;
    }
    this.context.actionSetPendingTransaction();
};
timapi.statemachine.states.Connecting.prototype.connected = function () {
    if (this.context.conditionIsEnabledAutoLogin()) {
        this.context.actionSetDefaultLoginRequest();
        this.context.setState(new timapi.statemachine.states.LoginRequest(this.context));
        return;
    }
    this.context.setState(new timapi.statemachine.states.LoggedOut(this.context));
};
timapi.statemachine.states.Connecting.prototype.connectFailed = function () {
    if (this.context.conditionIsEnabledAutoConnect()
        && !this.context.conditionRunAwayProtection()) {
        this.context.actionRunAwayProtection();
        this.context.actionClearPendingEvent();
        this.context.actionConnect();
        this.context.setState(new timapi.statemachine.states.Connecting(this.context));
        return;
    }
    this.context.actionClearPendingEvent();
    this.context.setState(new timapi.statemachine.states.Disconnected(this.context));
};
timapi.statemachine.states.Connecting.prototype.notificationKeepAlive = function () {
};
timapi.statemachine.states.Connecting.prototype.keepAliveTimeout = function () {
};
timapi.statemachine.states.Connecting.prototype.keepAliveTimer = function () {
};
timapi.statemachine.states.Connecting.prototype.closeReader = function () {
    if (!this.context.conditionHasGuideUnattended()) {
        this.context.actionErrorDisabledFeature();
        return;
    }
    if (this.context.conditionHasPendingEvent()) {
        this.context.actionErrorRequestInProgress();
        return;
    }
    this.context.actionSetPendingCloseReader();
};
timapi.statemachine.states.Connecting.prototype.openReader = function () {
    if (!this.context.conditionHasGuideUnattended()) {
        this.context.actionErrorDisabledFeature();
        return;
    }
    if (this.context.conditionHasPendingEvent()) {
        this.context.actionErrorRequestInProgress();
        return;
    }
    this.context.actionSetPendingOpenReader();
};
timapi.statemachine.states.Connecting.prototype.ejectCard = function () {
    if (!this.context.conditionHasGuideUnattended()
        && !this.context.conditionHasGuideAdvancedRetail()) {
        this.context.actionErrorDisabledFeature();
        return;
    }
    if (this.context.conditionHasPendingEvent()) {
        this.context.actionErrorRequestInProgress();
        return;
    }
    this.context.actionSetPendingEjectCard();
};
timapi.statemachine.states.Connecting.prototype.openMaintenanceWindow = function () {
    if (!this.context.conditionHasGuideUnattended()) {
        this.context.actionErrorDisabledFeature();
        return;
    }
    if (this.context.conditionHasPendingEvent()) {
        this.context.actionErrorRequestInProgress();
        return;
    }
    this.context.actionSetPendingOpenMaintenanceWindow();
};
timapi.statemachine.states.Connecting.prototype.closeMaintenanceWindow = function () {
    if (!this.context.conditionHasGuideUnattended()) {
        this.context.actionErrorDisabledFeature();
        return;
    }
    if (this.context.conditionHasPendingEvent()) {
        this.context.actionErrorRequestInProgress();
        return;
    }
    this.context.actionSetPendingCloseMaintenanceWindow();
};
timapi.statemachine.states.Connecting.prototype.activateServiceMenu = function () {
    if (!this.context.conditionHasGuideUnattended()) {
        this.context.actionErrorDisabledFeature();
        return;
    }
    if (this.context.conditionHasPendingEvent()) {
        this.context.actionErrorRequestInProgress();
        return;
    }
    this.context.actionSetPendingActivateServiceMenu();
};
timapi.statemachine.states.Connecting.prototype.balanceInquiry = function () {
    if (!this.context.conditionHasGuideAdvancedRetail()
        && !this.context.conditionHasGuideBanking()) {
        this.context.actionErrorDisabledFeature();
        return;
    }
    if (this.context.conditionHasPendingEvent()) {
        this.context.actionErrorRequestInProgress();
        return;
    }
    this.context.actionSetPendingBalanceInquiry();
};
timapi.statemachine.states.Connecting.prototype.openDialogMode = function () {
    if (!this.context.conditionHasGuideDialog()) {
        this.context.actionErrorDisabledFeature();
        return;
    }
    if (this.context.conditionHasPendingEvent()) {
        this.context.actionErrorRequestInProgress();
        return;
    }
    this.context.actionSetPendingOpenDialogMode();
};
timapi.statemachine.states.Connecting.prototype.closeDialogMode = function () {
    if (!this.context.conditionHasGuideDialog()) {
        this.context.actionErrorDisabledFeature();
        return;
    }
    if (this.context.conditionHasPendingEvent()) {
        this.context.actionErrorRequestInProgress();
        return;
    }
    this.context.actionSetPendingCloseDialogMode();
};
timapi.statemachine.states.Connecting.prototype.showSignatureCapture = function () {
    if (!this.context.conditionHasGuideDialog()) {
        this.context.actionErrorDisabledFeature();
        return;
    }
    if (this.context.conditionHasPendingEvent()) {
        this.context.actionErrorRequestInProgress();
        return;
    }
    this.context.actionSetPendingShowSignatureCapture();
};
timapi.statemachine.states.Connecting.prototype.showDialog = function () {
    if (!this.context.conditionHasGuideDialog()) {
        this.context.actionErrorDisabledFeature();
        return;
    }
    if (this.context.conditionHasPendingEvent()) {
        this.context.actionErrorRequestInProgress();
        return;
    }
    this.context.actionSetPendingShowDialog();
};
timapi.statemachine.states.Connecting.prototype.sendCardCommand = function () {
    if (!this.context.conditionHasGuideDialog()) {
        this.context.actionErrorDisabledFeature();
        return;
    }
    if (this.context.conditionHasPendingEvent()) {
        this.context.actionErrorRequestInProgress();
        return;
    }
    this.context.actionSetPendingSendCardCommand();
};
timapi.statemachine.states.Deactivating = function (context) {
    timapi.statemachine.states.DefaultState.call(this, context);
};
timapi.statemachine.states.Deactivating.prototype = Object.create(timapi.statemachine.states.DefaultState.prototype);
timapi.statemachine.states.Deactivating.loggerName = "timapi.statemachine.states.Deactivating";
timapi.statemachine.states.Deactivating.classname = "Deactivating";
timapi.statemachine.states.Deactivating.logger = timapi.logging.Logger.getLogger(timapi.statemachine.states.Deactivating.loggerName);
timapi.statemachine.states.Deactivating.prototype.enterState = function () {
    timapi.statemachine.states.DefaultState.prototype.enterState.call(this);
};
timapi.statemachine.states.Deactivating.prototype.activate = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.Deactivating.prototype.applicationInformation = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.Deactivating.prototype.balance = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.Deactivating.prototype.cancel = function () {
    this.context.actionClearPendingCancel();
    this.context.actionCancel();
};
timapi.statemachine.states.Deactivating.prototype.changeSettings = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.Deactivating.prototype.commit = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.Deactivating.prototype.connect = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.Deactivating.prototype.counterRequest = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.Deactivating.prototype.deactivate = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.Deactivating.prototype.disconnect = function () {
    this.context.actionSendErrorResponseDisconnect();
    this.context.actionClearPendingEvent();
    this.context.actionDisconnect();
    this.context.setState(new timapi.statemachine.states.Disconnected(this.context));
};
timapi.statemachine.states.Deactivating.prototype.dccRates = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.Deactivating.prototype.hardwareInformation = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.Deactivating.prototype.initTransaction = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.Deactivating.prototype.login = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.Deactivating.prototype.logout = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.Deactivating.prototype.reboot = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.Deactivating.prototype.reconciliation = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.Deactivating.prototype.receiptRequest = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.Deactivating.prototype.reconfig = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.Deactivating.prototype.rollback = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.Deactivating.prototype.softwareUpdate = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.Deactivating.prototype.systemInformation = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.Deactivating.prototype.transaction = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.Deactivating.prototype.connected = function () {
};
timapi.statemachine.states.Deactivating.prototype.connectFailed = function () {
    this.context.actionClearPendingEvent();
    this.context.setState(new timapi.statemachine.states.ErrorState(this.context));
};
timapi.statemachine.states.Deactivating.prototype.responseRequest = function () {
    if (this.context.conditionIsEnabledAutoLogout()
        && !this.context.conditionHasPendingEvent()) {
        this.context.actionProcessResponseDeactivate();
        this.context.actionLogout();
        this.context.setState(new timapi.statemachine.states.LoggingOut(this.context));
        return;
    }
    this.context.actionProcessResponseDeactivate();
    this.context.setState(new timapi.statemachine.states.LoggedIn(this.context));
};
timapi.statemachine.states.Deactivating.prototype.responseError = function () {
    this.context.actionClearPendingEvent();
    this.context.actionProcessResponseError();
    this.context.setState(new timapi.statemachine.states.Open(this.context));
};
timapi.statemachine.states.Deactivating.prototype.responseBusy = function () {
    if (!this.context.conditionHasPendingEvent()) {
        this.context.actionClearPendingEvent();
        this.context.actionProcessResponseError();
        this.context.setState(new timapi.statemachine.states.Open(this.context));
        return;
    }
};
timapi.statemachine.states.Deactivating.prototype.timeout = function () {
    this.context.actionErrorTimeout();
    this.context.setState(new timapi.statemachine.states.Open(this.context));
};
timapi.statemachine.states.Deactivating.prototype.keepAliveTimeout = function () {
    try {
        this.context.actionErrorConnectionLost();
        this.context.actionDisconnect();
        this.context.setState(new timapi.statemachine.states.Disconnected(this.context));
    }
    catch (e) {
        timapi.statemachine.states.Deactivating.logger.log(timapi.logging.Level.severe, "Exception", e);
        this.context.setState(new timapi.statemachine.states.Disconnected(this.context));
    }
};
timapi.statemachine.states.Deactivating.prototype.trxStateBecameIdle = function () {
    if (this.context.conditionHasPendingEvent()) {
        this.context.actionDeactivate();
        return;
    }
};
timapi.statemachine.states.Deactivating.prototype.closeReader = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.Deactivating.prototype.openReader = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.Deactivating.prototype.ejectCard = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.Deactivating.prototype.openMaintenanceWindow = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.Deactivating.prototype.closeMaintenanceWindow = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.Deactivating.prototype.activateServiceMenu = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.Deactivating.prototype.balanceInquiry = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.Deactivating.prototype.openDialogMode = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.Deactivating.prototype.closeDialogMode = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.Deactivating.prototype.showSignatureCapture = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.Deactivating.prototype.showDialog = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.Deactivating.prototype.sendCardCommand = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.DialogMode = function (context) {
    timapi.statemachine.states.DefaultState.call(this, context);
};
timapi.statemachine.states.DialogMode.prototype = Object.create(timapi.statemachine.states.DefaultState.prototype);
timapi.statemachine.states.DialogMode.loggerName = "timapi.statemachine.states.DialogMode";
timapi.statemachine.states.DialogMode.classname = "DialogMode";
timapi.statemachine.states.DialogMode.logger = timapi.logging.Logger.getLogger(timapi.statemachine.states.DialogMode.loggerName);
timapi.statemachine.states.DialogMode.prototype.enterState = function () {
    timapi.statemachine.states.DefaultState.prototype.enterState.call(this);
    this.context.actionCancelTimeout();
    if (this.context.conditionHasPendingOpenDialogMode()) {
        this.context.actionClearPendingEvent();
    }
    if (this.context.conditionHasPendingCloseDialogMode()) {
        this.context.actionClearPendingEvent();
        this.context.actionCloseDialogMode();
        this.context.setState(new timapi.statemachine.states.WaitCloseDialogMode(this.context));
        return;
    }
    if (this.context.conditionHasPendingShowSignatureCapture()) {
        this.context.actionShowSignatureCapture();
        this.context.setState(new timapi.statemachine.states.WaitShowSignatureCapture(this.context));
        return;
    }
    if (this.context.conditionHasPendingShowDialog()) {
        this.context.actionShowDialog();
        this.context.setState(new timapi.statemachine.states.WaitShowDialog(this.context));
        return;
    }
    if (this.context.conditionHasPendingSendCardCommand()) {
        this.context.actionSendCardCommand();
        this.context.setState(new timapi.statemachine.states.WaitSendCardCommand(this.context));
        return;
    }
};
timapi.statemachine.states.DialogMode.prototype.applicationInformation = function () {
    this.context.actionSetPendingApplicationInformation();
    this.context.actionCloseDialogMode();
    this.context.setState(new timapi.statemachine.states.WaitCloseDialogMode(this.context));
};
timapi.statemachine.states.DialogMode.prototype.balance = function () {
    this.context.actionSetPendingBalance();
    this.context.actionCloseDialogMode();
    this.context.setState(new timapi.statemachine.states.WaitCloseDialogMode(this.context));
};
timapi.statemachine.states.DialogMode.prototype.cancel = function () {
    this.context.actionClearPendingCancel();
    this.context.actionCancel();
};
timapi.statemachine.states.DialogMode.prototype.changeSettings = function () {
    this.context.actionSetPendingChangeSettings();
    this.context.actionCloseDialogMode();
    this.context.setState(new timapi.statemachine.states.WaitCloseDialogMode(this.context));
};
timapi.statemachine.states.DialogMode.prototype.counterRequest = function () {
    this.context.actionSetPendingCounterRequest();
    this.context.actionCloseDialogMode();
    this.context.setState(new timapi.statemachine.states.WaitCloseDialogMode(this.context));
};
timapi.statemachine.states.DialogMode.prototype.deactivate = function () {
    this.context.actionSetPendingDeactivate();
    this.context.actionCloseDialogMode();
    this.context.setState(new timapi.statemachine.states.WaitCloseDialogMode(this.context));
};
timapi.statemachine.states.DialogMode.prototype.dccRates = function () {
    this.context.actionSetPendingDccRates();
    this.context.actionCloseDialogMode();
    this.context.setState(new timapi.statemachine.states.WaitCloseDialogMode(this.context));
};
timapi.statemachine.states.DialogMode.prototype.hardwareInformation = function () {
    this.context.actionSetPendingHardwareInformation();
    this.context.actionCloseDialogMode();
    this.context.setState(new timapi.statemachine.states.WaitCloseDialogMode(this.context));
};
timapi.statemachine.states.DialogMode.prototype.initTransaction = function () {
    this.context.actionSetPendingInitTransaction();
    this.context.actionCloseDialogMode();
    this.context.setState(new timapi.statemachine.states.WaitCloseDialogMode(this.context));
};
timapi.statemachine.states.DialogMode.prototype.login = function () {
    this.context.actionSetPendingLogin();
    this.context.actionCloseDialogMode();
    this.context.setState(new timapi.statemachine.states.WaitCloseDialogMode(this.context));
};
timapi.statemachine.states.DialogMode.prototype.logout = function () {
    this.context.actionSetPendingLogout();
    this.context.actionCloseDialogMode();
    this.context.setState(new timapi.statemachine.states.WaitCloseDialogMode(this.context));
};
timapi.statemachine.states.DialogMode.prototype.reboot = function () {
    this.context.actionSetPendingReboot();
    this.context.actionCloseDialogMode();
    this.context.setState(new timapi.statemachine.states.WaitCloseDialogMode(this.context));
};
timapi.statemachine.states.DialogMode.prototype.receiptRequest = function () {
    this.context.actionSetPendingReceiptRequest();
    this.context.actionCloseDialogMode();
    this.context.setState(new timapi.statemachine.states.WaitCloseDialogMode(this.context));
};
timapi.statemachine.states.DialogMode.prototype.reconfig = function () {
    this.context.actionSetPendingReconfig();
    this.context.actionCloseDialogMode();
    this.context.setState(new timapi.statemachine.states.WaitCloseDialogMode(this.context));
};
timapi.statemachine.states.DialogMode.prototype.softwareUpdate = function () {
    this.context.actionSetPendingSoftwareUpdate();
    this.context.actionCloseDialogMode();
    this.context.setState(new timapi.statemachine.states.WaitCloseDialogMode(this.context));
};
timapi.statemachine.states.DialogMode.prototype.systemInformation = function () {
    this.context.actionSetPendingSystemInformation();
    this.context.actionCloseDialogMode();
    this.context.setState(new timapi.statemachine.states.WaitCloseDialogMode(this.context));
};
timapi.statemachine.states.DialogMode.prototype.transaction = function () {
    this.context.actionSetPendingTransaction();
    this.context.actionCloseDialogMode();
    this.context.setState(new timapi.statemachine.states.WaitCloseDialogMode(this.context));
};
timapi.statemachine.states.DialogMode.prototype.closeReader = function () {
    if (!this.context.conditionHasGuideUnattended()) {
        this.context.actionErrorDisabledFeature();
        return;
    }
    this.context.actionSetPendingCloseReader();
    this.context.actionCloseDialogMode();
    this.context.setState(new timapi.statemachine.states.WaitCloseDialogMode(this.context));
};
timapi.statemachine.states.DialogMode.prototype.openReader = function () {
    if (!this.context.conditionHasGuideUnattended()) {
        this.context.actionErrorDisabledFeature();
        return;
    }
    this.context.actionSetPendingOpenReader();
    this.context.actionCloseDialogMode();
    this.context.setState(new timapi.statemachine.states.WaitCloseDialogMode(this.context));
};
timapi.statemachine.states.DialogMode.prototype.ejectCard = function () {
    if (!this.context.conditionHasGuideUnattended()
        && !this.context.conditionHasGuideAdvancedRetail()) {
        this.context.actionErrorDisabledFeature();
        return;
    }
    this.context.actionSetPendingEjectCard();
    this.context.actionCloseDialogMode();
    this.context.setState(new timapi.statemachine.states.WaitCloseDialogMode(this.context));
};
timapi.statemachine.states.DialogMode.prototype.openMaintenanceWindow = function () {
    this.context.actionSetPendingOpenMaintenanceWindow();
    this.context.actionCloseDialogMode();
    this.context.setState(new timapi.statemachine.states.WaitCloseDialogMode(this.context));
};
timapi.statemachine.states.DialogMode.prototype.closeMaintenanceWindow = function () {
    this.context.actionSetPendingCloseMaintenanceWindow();
    this.context.actionCloseDialogMode();
    this.context.setState(new timapi.statemachine.states.WaitCloseDialogMode(this.context));
};
timapi.statemachine.states.DialogMode.prototype.activateServiceMenu = function () {
    this.context.actionSetPendingActivateServiceMenu();
    this.context.actionCloseDialogMode();
    this.context.setState(new timapi.statemachine.states.WaitCloseDialogMode(this.context));
};
timapi.statemachine.states.DialogMode.prototype.balanceInquiry = function () {
    if (!this.context.conditionHasGuideAdvancedRetail()
        && !this.context.conditionHasGuideBanking()) {
        this.context.actionErrorDisabledFeature();
        return;
    }
    this.context.actionSetPendingBalanceInquiry();
    this.context.actionCloseDialogMode();
    this.context.setState(new timapi.statemachine.states.WaitCloseDialogMode(this.context));
};
timapi.statemachine.states.DialogMode.prototype.closeDialogMode = function () {
    this.context.actionCloseDialogMode();
    this.context.setState(new timapi.statemachine.states.WaitCloseDialogMode(this.context));
};
timapi.statemachine.states.DialogMode.prototype.showSignatureCapture = function () {
    this.context.actionShowSignatureCapture();
    this.context.setState(new timapi.statemachine.states.WaitShowSignatureCapture(this.context));
};
timapi.statemachine.states.DialogMode.prototype.showDialog = function () {
    this.context.actionShowDialog();
    this.context.setState(new timapi.statemachine.states.WaitShowDialog(this.context));
};
timapi.statemachine.states.DialogMode.prototype.sendCardCommand = function () {
    this.context.actionSendCardCommand();
    this.context.setState(new timapi.statemachine.states.WaitSendCardCommand(this.context));
};
timapi.statemachine.states.Disconnected = function (context) {
    timapi.statemachine.states.DefaultState.call(this, context);
};
timapi.statemachine.states.Disconnected.prototype = Object.create(timapi.statemachine.states.DefaultState.prototype);
timapi.statemachine.states.Disconnected.loggerName = "timapi.statemachine.states.Disconnected";
timapi.statemachine.states.Disconnected.classname = "Disconnected";
timapi.statemachine.states.Disconnected.logger = timapi.logging.Logger.getLogger(timapi.statemachine.states.Disconnected.loggerName);
timapi.statemachine.states.Disconnected.prototype.enterState = function () {
    timapi.statemachine.states.DefaultState.prototype.enterState.call(this);
    this.context.actionCancelTimeout();
    if (this.context.conditionHasPendingEvent()) {
        this.context.actionConnect();
        this.context.setState(new timapi.statemachine.states.Connecting(this.context));
        return;
    }
};
timapi.statemachine.states.Disconnected.prototype.activate = function () {
    this.context.actionSetPendingActivate();
    this.context.actionConnect();
    this.context.setState(new timapi.statemachine.states.Connecting(this.context));
};
timapi.statemachine.states.Disconnected.prototype.applicationInformation = function () {
    this.context.actionSetPendingApplicationInformation();
    this.context.actionConnect();
    this.context.setState(new timapi.statemachine.states.Connecting(this.context));
};
timapi.statemachine.states.Disconnected.prototype.balance = function () {
    this.context.actionSetPendingBalance();
    this.context.actionConnect();
    this.context.setState(new timapi.statemachine.states.Connecting(this.context));
};
timapi.statemachine.states.Disconnected.prototype.cancel = function () {
    this.context.actionSetPendingCancel();
    this.context.actionConnect();
    this.context.setState(new timapi.statemachine.states.Connecting(this.context));
};
timapi.statemachine.states.Disconnected.prototype.changeSettings = function () {
    this.context.actionSetPendingChangeSettings();
    this.context.actionConnect();
    this.context.setState(new timapi.statemachine.states.Connecting(this.context));
};
timapi.statemachine.states.Disconnected.prototype.commit = function () {
    this.context.actionSetPendingCommit();
    this.context.actionConnect();
    this.context.setState(new timapi.statemachine.states.Connecting(this.context));
};
timapi.statemachine.states.Disconnected.prototype.connect = function () {
    this.context.actionConnect();
    this.context.setState(new timapi.statemachine.states.Connecting(this.context));
};
timapi.statemachine.states.Disconnected.prototype.counterRequest = function () {
    this.context.actionSetPendingCounterRequest();
    this.context.actionConnect();
    this.context.setState(new timapi.statemachine.states.Connecting(this.context));
};
timapi.statemachine.states.Disconnected.prototype.deactivate = function () {
    this.context.actionSetPendingDeactivate();
    this.context.actionConnect();
    this.context.setState(new timapi.statemachine.states.Connecting(this.context));
};
timapi.statemachine.states.Disconnected.prototype.disconnect = function () {
    this.context.actionErrorWrongState();
};
timapi.statemachine.states.Disconnected.prototype.dccRates = function () {
    this.context.actionSetPendingDccRates();
    this.context.actionConnect();
    this.context.setState(new timapi.statemachine.states.Connecting(this.context));
};
timapi.statemachine.states.Disconnected.prototype.hardwareInformation = function () {
    this.context.actionSetPendingHardwareInformation();
    this.context.actionConnect();
    this.context.setState(new timapi.statemachine.states.Connecting(this.context));
};
timapi.statemachine.states.Disconnected.prototype.initTransaction = function () {
    this.context.actionSetPendingInitTransaction();
    this.context.actionConnect();
    this.context.setState(new timapi.statemachine.states.Connecting(this.context));
};
timapi.statemachine.states.Disconnected.prototype.login = function () {
    this.context.actionSetPendingLogin();
    this.context.actionConnect();
    this.context.setState(new timapi.statemachine.states.Connecting(this.context));
};
timapi.statemachine.states.Disconnected.prototype.logout = function () {
    this.context.actionSetPendingLogout();
    this.context.actionConnect();
    this.context.setState(new timapi.statemachine.states.Connecting(this.context));
};
timapi.statemachine.states.Disconnected.prototype.reboot = function () {
    this.context.actionSetPendingReboot();
    this.context.actionConnect();
    this.context.setState(new timapi.statemachine.states.Connecting(this.context));
};
timapi.statemachine.states.Disconnected.prototype.reconciliation = function () {
    this.context.actionSetPendingReconciliation();
    this.context.actionConnect();
    this.context.setState(new timapi.statemachine.states.Connecting(this.context));
};
timapi.statemachine.states.Disconnected.prototype.receiptRequest = function () {
    this.context.actionSetPendingReceiptRequest();
    this.context.actionConnect();
    this.context.setState(new timapi.statemachine.states.Connecting(this.context));
};
timapi.statemachine.states.Disconnected.prototype.reconfig = function () {
    this.context.actionSetPendingReconfig();
    this.context.actionConnect();
    this.context.setState(new timapi.statemachine.states.Connecting(this.context));
};
timapi.statemachine.states.Disconnected.prototype.softwareUpdate = function () {
    this.context.actionSetPendingSoftwareUpdate();
    this.context.actionConnect();
    this.context.setState(new timapi.statemachine.states.Connecting(this.context));
};
timapi.statemachine.states.Disconnected.prototype.systemInformation = function () {
    this.context.actionSetPendingSystemInformation();
    this.context.actionConnect();
    this.context.setState(new timapi.statemachine.states.Connecting(this.context));
};
timapi.statemachine.states.Disconnected.prototype.transaction = function () {
    this.context.actionSetPendingTransaction();
    this.context.actionConnect();
    this.context.setState(new timapi.statemachine.states.Connecting(this.context));
};
timapi.statemachine.states.Disconnected.prototype.connected = function () {
    this.context.setState(new timapi.statemachine.states.LoggedOut(this.context));
};
timapi.statemachine.states.Disconnected.prototype.connectFailed = function () {
    if (this.context.conditionIsEnabledAutoConnect()
        && !this.context.conditionRunAwayProtection()) {
        this.context.actionRunAwayProtection();
        this.context.actionConnect();
        this.context.setState(new timapi.statemachine.states.Connecting(this.context));
        return;
    }
};
timapi.statemachine.states.Disconnected.prototype.disconnected = function () {
};
timapi.statemachine.states.Disconnected.prototype.notificationKeepAlive = function () {
};
timapi.statemachine.states.Disconnected.prototype.keepAliveTimeout = function () {
};
timapi.statemachine.states.Disconnected.prototype.keepAliveTimer = function () {
};
timapi.statemachine.states.Disconnected.prototype.closeReader = function () {
    if (!this.context.conditionHasGuideUnattended()) {
        this.context.actionErrorDisabledFeature();
        return;
    }
    this.context.actionSetPendingCloseReader();
    this.context.actionConnect();
    this.context.setState(new timapi.statemachine.states.Connecting(this.context));
};
timapi.statemachine.states.Disconnected.prototype.openReader = function () {
    if (!this.context.conditionHasGuideUnattended()) {
        this.context.actionErrorDisabledFeature();
        return;
    }
    this.context.actionSetPendingOpenReader();
    this.context.actionConnect();
    this.context.setState(new timapi.statemachine.states.Connecting(this.context));
};
timapi.statemachine.states.Disconnected.prototype.ejectCard = function () {
    if (!this.context.conditionHasGuideUnattended()
        && !this.context.conditionHasGuideAdvancedRetail()) {
        this.context.actionErrorDisabledFeature();
        return;
    }
    this.context.actionSetPendingEjectCard();
    this.context.actionConnect();
    this.context.setState(new timapi.statemachine.states.Connecting(this.context));
};
timapi.statemachine.states.Disconnected.prototype.openMaintenanceWindow = function () {
    if (!this.context.conditionHasGuideUnattended()) {
        this.context.actionErrorDisabledFeature();
        return;
    }
    this.context.actionSetPendingOpenMaintenanceWindow();
    this.context.actionConnect();
    this.context.setState(new timapi.statemachine.states.Connecting(this.context));
};
timapi.statemachine.states.Disconnected.prototype.closeMaintenanceWindow = function () {
    if (!this.context.conditionHasGuideUnattended()) {
        this.context.actionErrorDisabledFeature();
        return;
    }
    this.context.actionSetPendingCloseMaintenanceWindow();
    this.context.actionConnect();
    this.context.setState(new timapi.statemachine.states.Connecting(this.context));
};
timapi.statemachine.states.Disconnected.prototype.activateServiceMenu = function () {
    if (!this.context.conditionHasGuideUnattended()) {
        this.context.actionErrorDisabledFeature();
        return;
    }
    this.context.actionSetPendingActivateServiceMenu();
    this.context.actionConnect();
    this.context.setState(new timapi.statemachine.states.Connecting(this.context));
};
timapi.statemachine.states.Disconnected.prototype.balanceInquiry = function () {
    if (!this.context.conditionHasGuideAdvancedRetail()
        && !this.context.conditionHasGuideBanking()) {
        this.context.actionErrorDisabledFeature();
        return;
    }
    this.context.actionSetPendingBalanceInquiry();
    this.context.actionConnect();
    this.context.setState(new timapi.statemachine.states.Connecting(this.context));
};
timapi.statemachine.states.Disconnected.prototype.openDialogMode = function () {
    if (!this.context.conditionHasGuideDialog()) {
        this.context.actionErrorDisabledFeature();
        return;
    }
    this.context.actionSetPendingOpenDialogMode();
    this.context.actionConnect();
    this.context.setState(new timapi.statemachine.states.Connecting(this.context));
};
timapi.statemachine.states.Disconnected.prototype.closeDialogMode = function () {
    if (!this.context.conditionHasGuideDialog()) {
        this.context.actionErrorDisabledFeature();
        return;
    }
    this.context.actionSetPendingCloseDialogMode();
    this.context.actionConnect();
    this.context.setState(new timapi.statemachine.states.Connecting(this.context));
};
timapi.statemachine.states.Disconnected.prototype.showSignatureCapture = function () {
    if (!this.context.conditionHasGuideDialog()) {
        this.context.actionErrorDisabledFeature();
        return;
    }
    this.context.actionSetPendingShowSignatureCapture();
    this.context.actionConnect();
    this.context.setState(new timapi.statemachine.states.Connecting(this.context));
};
timapi.statemachine.states.Disconnected.prototype.showDialog = function () {
    if (!this.context.conditionHasGuideDialog()) {
        this.context.actionErrorDisabledFeature();
        return;
    }
    this.context.actionSetPendingShowDialog();
    this.context.actionConnect();
    this.context.setState(new timapi.statemachine.states.Connecting(this.context));
};
timapi.statemachine.states.Disconnected.prototype.sendCardCommand = function () {
    if (!this.context.conditionHasGuideDialog()) {
        this.context.actionErrorDisabledFeature();
        return;
    }
    this.context.actionSetPendingSendCardCommand();
    this.context.actionConnect();
    this.context.setState(new timapi.statemachine.states.Connecting(this.context));
};
timapi.statemachine.states.Initial = function (context) {
    timapi.statemachine.states.DefaultState.call(this, context);
};
timapi.statemachine.states.Initial.prototype = Object.create(timapi.statemachine.states.DefaultState.prototype);
timapi.statemachine.states.Initial.loggerName = "timapi.statemachine.states.Initial";
timapi.statemachine.states.Initial.classname = "Initial";
timapi.statemachine.states.Initial.logger = timapi.logging.Logger.getLogger(timapi.statemachine.states.Initial.loggerName);
timapi.statemachine.states.Initial.prototype.enterState = function () {
    timapi.statemachine.states.DefaultState.prototype.enterState.call(this);
    if (this.context.conditionIsEnabledAutoConnect()) {
        this.context.actionConnect();
        this.context.setState(new timapi.statemachine.states.Connecting(this.context));
        return;
    }
    if (!this.context.conditionIsEnabledAutoConnect()) {
        this.context.setState(new timapi.statemachine.states.Disconnected(this.context));
        return;
    }
};
timapi.statemachine.states.LoggedIn = function (context) {
    timapi.statemachine.states.DefaultState.call(this, context);
};
timapi.statemachine.states.LoggedIn.prototype = Object.create(timapi.statemachine.states.DefaultState.prototype);
timapi.statemachine.states.LoggedIn.loggerName = "timapi.statemachine.states.LoggedIn";
timapi.statemachine.states.LoggedIn.classname = "LoggedIn";
timapi.statemachine.states.LoggedIn.logger = timapi.logging.Logger.getLogger(timapi.statemachine.states.LoggedIn.loggerName);
timapi.statemachine.states.LoggedIn.prototype.enterState = function () {
    timapi.statemachine.states.DefaultState.prototype.enterState.call(this);
    this.context.actionCancelTimeout();
    if (this.context.conditionHasPendingLogin()) {
        this.context.actionClearPendingEvent();
        this.context.actionLogin();
        this.context.setState(new timapi.statemachine.states.LoggingIn(this.context));
        return;
    }
    if (this.context.conditionHasPendingDeactivate()) {
        this.context.actionClearPendingEvent();
        this.context.actionDeactivate();
        this.context.setState(new timapi.statemachine.states.Deactivating(this.context));
        return;
    }
    if (this.context.conditionHasPendingApplicationInformation()) {
        this.context.actionApplicationInformation();
        this.context.setState(new timapi.statemachine.states.WaitApplicationInformation(this.context));
        return;
    }
    if (this.context.conditionHasPendingBalance()) {
        this.context.actionBalance();
        this.context.setState(new timapi.statemachine.states.WaitBalance(this.context));
        return;
    }
    if (this.context.conditionHasPendingCancel()) {
        this.context.actionClearPendingCancel();
        this.context.actionCancel();
    }
    if (this.context.conditionHasPendingChangeSettings()) {
        this.context.actionChangeSettings();
        this.context.setState(new timapi.statemachine.states.WaitChangeSettings(this.context));
        return;
    }
    if (this.context.conditionHasPendingDccRates()) {
        this.context.actionDccRates();
        this.context.setState(new timapi.statemachine.states.WaitDccRates(this.context));
        return;
    }
    if (this.context.conditionHasPendingHardwareInformation()) {
        this.context.actionHardwareInformation();
        this.context.setState(new timapi.statemachine.states.WaitHardwareInformation(this.context));
        return;
    }
    if (this.context.conditionHasPendingLogout()) {
        this.context.actionLogout();
        this.context.setState(new timapi.statemachine.states.LoggingOut(this.context));
        return;
    }
    if (this.context.conditionHasPendingReboot()) {
        this.context.actionReboot();
        this.context.setState(new timapi.statemachine.states.WaitReboot(this.context));
        return;
    }
    if (this.context.conditionHasPendingReconfig()) {
        this.context.actionReconfig();
        this.context.setState(new timapi.statemachine.states.WaitReconfig(this.context));
        return;
    }
    if (this.context.conditionHasPendingReconciliation()) {
        this.context.actionReconciliation();
        this.context.setState(new timapi.statemachine.states.WaitReconciliation(this.context));
        return;
    }
    if (this.context.conditionHasPendingReceiptRequest()) {
        this.context.actionReceiptRequest();
        this.context.setState(new timapi.statemachine.states.WaitReceiptRequestClosed(this.context));
        return;
    }
    if (this.context.conditionHasPendingSoftwareUpdate()) {
        this.context.actionSoftwareUpdate();
        this.context.setState(new timapi.statemachine.states.WaitSoftwareUpdate(this.context));
        return;
    }
    if (this.context.conditionHasPendingSystemInformation()) {
        this.context.actionSystemInformation();
        this.context.setState(new timapi.statemachine.states.WaitSystemInformation(this.context));
        return;
    }
    if (this.context.conditionHasPendingOpenMaintenanceWindow()) {
        this.context.actionOpenMaintenanceWindow();
        this.context.setState(new timapi.statemachine.states.WaitOpenMaintenanceWindow(this.context));
        return;
    }
    if (this.context.conditionHasPendingCloseMaintenanceWindow()) {
        this.context.actionCloseMaintenanceWindow();
        this.context.setState(new timapi.statemachine.states.WaitCloseMaintenanceWindow(this.context));
        return;
    }
    if (this.context.conditionHasPendingActivateServiceMenu()) {
        this.context.actionActivateServiceMenu();
        this.context.setState(new timapi.statemachine.states.WaitActivateServiceMenu(this.context));
        return;
    }
    if (this.context.conditionHasPendingActivate()
        || this.context.conditionHasPendingCommit()
        || this.context.conditionHasPendingCounterRequest()
        || this.context.conditionHasPendingInitTransaction()
        || this.context.conditionHasPendingTransaction()
        || this.context.conditionHasPendingCloseReader()
        || this.context.conditionHasPendingOpenReader()
        || this.context.conditionHasPendingEjectCard()
        || this.context.conditionHasPendingBalanceInquiry()
        || this.context.conditionHasPendingOpenDialogMode()
        || this.context.conditionHasPendingCloseDialogMode()
        || this.context.conditionHasPendingShowSignatureCapture()
        || this.context.conditionHasPendingShowDialog()
        || this.context.conditionHasPendingSendCardCommand()) {
        this.context.actionActivate();
        this.context.setState(new timapi.statemachine.states.Activating(this.context));
        return;
    }
};
timapi.statemachine.states.LoggedIn.prototype.activate = function () {
    this.context.actionActivate();
    this.context.setState(new timapi.statemachine.states.Activating(this.context));
};
timapi.statemachine.states.LoggedIn.prototype.applicationInformation = function () {
    this.context.actionApplicationInformation();
    this.context.setState(new timapi.statemachine.states.WaitApplicationInformation(this.context));
};
timapi.statemachine.states.LoggedIn.prototype.balance = function () {
    this.context.actionBalance();
    this.context.setState(new timapi.statemachine.states.WaitBalance(this.context));
};
timapi.statemachine.states.LoggedIn.prototype.cancel = function () {
    this.context.actionClearPendingCancel();
    this.context.actionCancel();
};
timapi.statemachine.states.LoggedIn.prototype.changeSettings = function () {
    this.context.actionChangeSettings();
    this.context.setState(new timapi.statemachine.states.WaitChangeSettings(this.context));
};
timapi.statemachine.states.LoggedIn.prototype.commit = function () {
    this.context.actionSetPendingCommit();
    this.context.actionActivate();
    this.context.setState(new timapi.statemachine.states.Activating(this.context));
};
timapi.statemachine.states.LoggedIn.prototype.counterRequest = function () {
    this.context.actionSetPendingCounterRequest();
    this.context.actionActivate();
    this.context.setState(new timapi.statemachine.states.Activating(this.context));
};
timapi.statemachine.states.LoggedIn.prototype.deactivate = function () {
    this.context.actionDeactivate();
    this.context.setState(new timapi.statemachine.states.Deactivating(this.context));
};
timapi.statemachine.states.LoggedIn.prototype.dccRates = function () {
    this.context.actionDccRates();
    this.context.setState(new timapi.statemachine.states.WaitDccRates(this.context));
};
timapi.statemachine.states.LoggedIn.prototype.hardwareInformation = function () {
    this.context.actionHardwareInformation();
    this.context.setState(new timapi.statemachine.states.WaitHardwareInformation(this.context));
};
timapi.statemachine.states.LoggedIn.prototype.initTransaction = function () {
    this.context.actionSetPendingInitTransaction();
    this.context.actionActivate();
    this.context.setState(new timapi.statemachine.states.Activating(this.context));
};
timapi.statemachine.states.LoggedIn.prototype.login = function () {
    this.context.actionLogin();
    this.context.setState(new timapi.statemachine.states.LoggingIn(this.context));
};
timapi.statemachine.states.LoggedIn.prototype.logout = function () {
    this.context.actionLogout();
    this.context.setState(new timapi.statemachine.states.LoggingOut(this.context));
};
timapi.statemachine.states.LoggedIn.prototype.reboot = function () {
    this.context.actionReboot();
    this.context.setState(new timapi.statemachine.states.WaitReboot(this.context));
};
timapi.statemachine.states.LoggedIn.prototype.reconciliation = function () {
    this.context.actionReconciliation();
    this.context.setState(new timapi.statemachine.states.WaitReconciliation(this.context));
};
timapi.statemachine.states.LoggedIn.prototype.receiptRequest = function () {
    this.context.actionReceiptRequest();
    this.context.setState(new timapi.statemachine.states.WaitReceiptRequestClosed(this.context));
};
timapi.statemachine.states.LoggedIn.prototype.reconfig = function () {
    this.context.actionReconfig();
    this.context.setState(new timapi.statemachine.states.WaitReconfig(this.context));
};
timapi.statemachine.states.LoggedIn.prototype.softwareUpdate = function () {
    this.context.actionSoftwareUpdate();
    this.context.setState(new timapi.statemachine.states.WaitSoftwareUpdate(this.context));
};
timapi.statemachine.states.LoggedIn.prototype.systemInformation = function () {
    this.context.actionSystemInformation();
    this.context.setState(new timapi.statemachine.states.WaitSystemInformation(this.context));
};
timapi.statemachine.states.LoggedIn.prototype.transaction = function () {
    this.context.actionSetPendingTransaction();
    this.context.actionActivate();
    this.context.setState(new timapi.statemachine.states.Activating(this.context));
};
timapi.statemachine.states.LoggedIn.prototype.closeReader = function () {
    if (!this.context.conditionHasGuideUnattended()) {
        this.context.actionErrorDisabledFeature();
        return;
    }
    this.context.actionSetPendingCloseReader();
    this.context.actionActivate();
    this.context.setState(new timapi.statemachine.states.Activating(this.context));
};
timapi.statemachine.states.LoggedIn.prototype.openReader = function () {
    if (!this.context.conditionHasGuideUnattended()) {
        this.context.actionErrorDisabledFeature();
        return;
    }
    this.context.actionSetPendingOpenReader();
    this.context.actionActivate();
    this.context.setState(new timapi.statemachine.states.Activating(this.context));
};
timapi.statemachine.states.LoggedIn.prototype.ejectCard = function () {
    if (!this.context.conditionHasGuideUnattended()
        && !this.context.conditionHasGuideAdvancedRetail()) {
        this.context.actionErrorDisabledFeature();
        return;
    }
    this.context.actionSetPendingEjectCard();
    this.context.actionActivate();
    this.context.setState(new timapi.statemachine.states.Activating(this.context));
};
timapi.statemachine.states.LoggedIn.prototype.openMaintenanceWindow = function () {
    if (!this.context.conditionHasGuideUnattended()) {
        this.context.actionErrorDisabledFeature();
        return;
    }
    this.context.actionOpenMaintenanceWindow();
    this.context.setState(new timapi.statemachine.states.WaitOpenMaintenanceWindow(this.context));
};
timapi.statemachine.states.LoggedIn.prototype.closeMaintenanceWindow = function () {
    if (!this.context.conditionHasGuideUnattended()) {
        this.context.actionErrorDisabledFeature();
        return;
    }
    this.context.actionCloseMaintenanceWindow();
    this.context.setState(new timapi.statemachine.states.WaitCloseMaintenanceWindow(this.context));
};
timapi.statemachine.states.LoggedIn.prototype.activateServiceMenu = function () {
    if (!this.context.conditionHasGuideUnattended()) {
        this.context.actionErrorDisabledFeature();
        return;
    }
    this.context.actionActivateServiceMenu();
    this.context.setState(new timapi.statemachine.states.WaitActivateServiceMenu(this.context));
};
timapi.statemachine.states.LoggedIn.prototype.balanceInquiry = function () {
    if (!this.context.conditionHasGuideAdvancedRetail()
        && !this.context.conditionHasGuideBanking()) {
        this.context.actionErrorDisabledFeature();
        return;
    }
    this.context.actionSetPendingBalanceInquiry();
    this.context.actionActivate();
    this.context.setState(new timapi.statemachine.states.Activating(this.context));
};
timapi.statemachine.states.LoggedIn.prototype.openDialogMode = function () {
    if (!this.context.conditionHasGuideDialog()) {
        this.context.actionErrorDisabledFeature();
        return;
    }
    this.context.actionSetPendingOpenDialogMode();
    this.context.actionActivate();
    this.context.setState(new timapi.statemachine.states.Activating(this.context));
};
timapi.statemachine.states.LoggedIn.prototype.closeDialogMode = function () {
    if (!this.context.conditionHasGuideDialog()) {
        this.context.actionErrorDisabledFeature();
        return;
    }
    this.context.actionSetPendingCloseDialogMode();
    this.context.actionActivate();
    this.context.setState(new timapi.statemachine.states.Activating(this.context));
};
timapi.statemachine.states.LoggedIn.prototype.showSignatureCapture = function () {
    if (!this.context.conditionHasGuideDialog()) {
        this.context.actionErrorDisabledFeature();
        return;
    }
    this.context.actionSetPendingShowSignatureCapture();
    this.context.actionActivate();
    this.context.setState(new timapi.statemachine.states.Activating(this.context));
};
timapi.statemachine.states.LoggedIn.prototype.showDialog = function () {
    if (!this.context.conditionHasGuideDialog()) {
        this.context.actionErrorDisabledFeature();
        return;
    }
    this.context.actionSetPendingShowDialog();
    this.context.actionActivate();
    this.context.setState(new timapi.statemachine.states.Activating(this.context));
};
timapi.statemachine.states.LoggedIn.prototype.sendCardCommand = function () {
    if (!this.context.conditionHasGuideDialog()) {
        this.context.actionErrorDisabledFeature();
        return;
    }
    this.context.actionSetPendingSendCardCommand();
    this.context.actionActivate();
    this.context.setState(new timapi.statemachine.states.Activating(this.context));
};
timapi.statemachine.states.LoggedOut = function (context) {
    timapi.statemachine.states.DefaultState.call(this, context);
};
timapi.statemachine.states.LoggedOut.prototype = Object.create(timapi.statemachine.states.DefaultState.prototype);
timapi.statemachine.states.LoggedOut.loggerName = "timapi.statemachine.states.LoggedOut";
timapi.statemachine.states.LoggedOut.classname = "LoggedOut";
timapi.statemachine.states.LoggedOut.logger = timapi.logging.Logger.getLogger(timapi.statemachine.states.LoggedOut.loggerName);
timapi.statemachine.states.LoggedOut.prototype.enterState = function () {
    timapi.statemachine.states.DefaultState.prototype.enterState.call(this);
    this.context.actionCancelTimeout();
    if (this.context.conditionHasPendingLogout()) {
        this.context.actionClearPendingEvent();
        this.context.actionSimulateLogoutCompleted();
    }
    if (this.context.conditionHasPendingCancel()) {
        this.context.actionClearPendingCancel();
        this.context.actionCancel();
    }
    if (this.context.conditionHasPendingActivate()
        || this.context.conditionHasPendingApplicationInformation()
        || this.context.conditionHasPendingBalance()
        || this.context.conditionHasPendingChangeSettings()
        || this.context.conditionHasPendingCommit()
        || this.context.conditionHasPendingCounterRequest()
        || this.context.conditionHasPendingDccRates()
        || this.context.conditionHasPendingDeactivate()
        || this.context.conditionHasPendingHardwareInformation()
        || this.context.conditionHasPendingInitTransaction()
        || this.context.conditionHasPendingLogin()
        || this.context.conditionHasPendingReboot()
        || this.context.conditionHasPendingReconfig()
        || this.context.conditionHasPendingReceiptRequest()
        || this.context.conditionHasPendingReconciliation()
        || this.context.conditionHasPendingSoftwareUpdate()
        || this.context.conditionHasPendingSystemInformation()
        || this.context.conditionHasPendingTransaction()
        || this.context.conditionHasPendingCloseReader()
        || this.context.conditionHasPendingOpenReader()
        || this.context.conditionHasPendingEjectCard()
        || this.context.conditionHasPendingOpenMaintenanceWindow()
        || this.context.conditionHasPendingCloseMaintenanceWindow()
        || this.context.conditionHasPendingActivateServiceMenu()
        || this.context.conditionHasPendingBalanceInquiry()
        || this.context.conditionHasPendingOpenDialogMode()
        || this.context.conditionHasPendingCloseDialogMode()
        || this.context.conditionHasPendingShowSignatureCapture()
        || this.context.conditionHasPendingShowDialog()
        || this.context.conditionHasPendingSendCardCommand()) {
        this.context.actionSetDefaultLoginRequest();
        this.context.setState(new timapi.statemachine.states.LoginRequest(this.context));
        return;
    }
};
timapi.statemachine.states.LoggedOut.prototype.activate = function () {
    this.context.actionSetPendingActivate();
    this.context.actionSetDefaultLoginRequest();
    this.context.setState(new timapi.statemachine.states.LoginRequest(this.context));
};
timapi.statemachine.states.LoggedOut.prototype.applicationInformation = function () {
    this.context.actionSetPendingApplicationInformation();
    this.context.actionSetDefaultLoginRequest();
    this.context.setState(new timapi.statemachine.states.LoginRequest(this.context));
};
timapi.statemachine.states.LoggedOut.prototype.balance = function () {
    this.context.actionSetPendingBalance();
    this.context.actionSetDefaultLoginRequest();
    this.context.setState(new timapi.statemachine.states.LoginRequest(this.context));
};
timapi.statemachine.states.LoggedOut.prototype.cancel = function () {
    this.context.actionClearPendingCancel();
    this.context.actionCancel();
};
timapi.statemachine.states.LoggedOut.prototype.changeSettings = function () {
    this.context.actionSetPendingChangeSettings();
    this.context.actionSetDefaultLoginRequest();
    this.context.setState(new timapi.statemachine.states.LoginRequest(this.context));
};
timapi.statemachine.states.LoggedOut.prototype.commit = function () {
    this.context.actionSetPendingCommit();
    this.context.actionSetDefaultLoginRequest();
    this.context.setState(new timapi.statemachine.states.LoginRequest(this.context));
};
timapi.statemachine.states.LoggedOut.prototype.connect = function () {
    this.context.actionErrorWrongState();
};
timapi.statemachine.states.LoggedOut.prototype.counterRequest = function () {
    this.context.actionSetPendingCounterRequest();
    this.context.actionSetDefaultLoginRequest();
    this.context.setState(new timapi.statemachine.states.LoginRequest(this.context));
};
timapi.statemachine.states.LoggedOut.prototype.deactivate = function () {
    this.context.actionSetPendingDeactivate();
    this.context.actionSetDefaultLoginRequest();
    this.context.setState(new timapi.statemachine.states.LoginRequest(this.context));
};
timapi.statemachine.states.LoggedOut.prototype.dccRates = function () {
    this.context.actionSetPendingDccRates();
    this.context.actionSetDefaultLoginRequest();
    this.context.setState(new timapi.statemachine.states.LoginRequest(this.context));
};
timapi.statemachine.states.LoggedOut.prototype.hardwareInformation = function () {
    this.context.actionSetPendingHardwareInformation();
    this.context.actionSetDefaultLoginRequest();
    this.context.setState(new timapi.statemachine.states.LoginRequest(this.context));
};
timapi.statemachine.states.LoggedOut.prototype.initTransaction = function () {
    this.context.actionSetPendingInitTransaction();
    this.context.actionSetDefaultLoginRequest();
    this.context.setState(new timapi.statemachine.states.LoginRequest(this.context));
};
timapi.statemachine.states.LoggedOut.prototype.login = function () {
    this.context.actionSetDefaultLoginRequest();
    this.context.setState(new timapi.statemachine.states.LoginRequest(this.context));
};
timapi.statemachine.states.LoggedOut.prototype.logout = function () {
    this.context.actionSimulateLogoutCompleted();
};
timapi.statemachine.states.LoggedOut.prototype.reboot = function () {
    this.context.actionSetPendingReboot();
    this.context.actionSetDefaultLoginRequest();
    this.context.setState(new timapi.statemachine.states.LoginRequest(this.context));
};
timapi.statemachine.states.LoggedOut.prototype.reconciliation = function () {
    this.context.actionSetPendingReconciliation();
    this.context.actionSetDefaultLoginRequest();
    this.context.setState(new timapi.statemachine.states.LoginRequest(this.context));
};
timapi.statemachine.states.LoggedOut.prototype.receiptRequest = function () {
    this.context.actionSetPendingReceiptRequest();
    this.context.actionSetDefaultLoginRequest();
    this.context.setState(new timapi.statemachine.states.LoginRequest(this.context));
};
timapi.statemachine.states.LoggedOut.prototype.reconfig = function () {
    this.context.actionSetPendingReconfig();
    this.context.actionSetDefaultLoginRequest();
    this.context.setState(new timapi.statemachine.states.LoginRequest(this.context));
};
timapi.statemachine.states.LoggedOut.prototype.softwareUpdate = function () {
    this.context.actionSetPendingSoftwareUpdate();
    this.context.actionSetDefaultLoginRequest();
    this.context.setState(new timapi.statemachine.states.LoginRequest(this.context));
};
timapi.statemachine.states.LoggedOut.prototype.systemInformation = function () {
    this.context.actionSetPendingSystemInformation();
    this.context.actionSetDefaultLoginRequest();
    this.context.setState(new timapi.statemachine.states.LoginRequest(this.context));
};
timapi.statemachine.states.LoggedOut.prototype.transaction = function () {
    this.context.actionSetPendingTransaction();
    this.context.actionSetDefaultLoginRequest();
    this.context.setState(new timapi.statemachine.states.LoginRequest(this.context));
};
timapi.statemachine.states.LoggedOut.prototype.notificationKeepAlive = function () {
};
timapi.statemachine.states.LoggedOut.prototype.keepAliveTimeout = function () {
};
timapi.statemachine.states.LoggedOut.prototype.keepAliveTimer = function () {
};
timapi.statemachine.states.LoggedOut.prototype.closeReader = function () {
    if (!this.context.conditionHasGuideUnattended()) {
        this.context.actionErrorDisabledFeature();
        return;
    }
    this.context.actionSetPendingCloseReader();
    this.context.actionSetDefaultLoginRequest();
    this.context.setState(new timapi.statemachine.states.LoginRequest(this.context));
};
timapi.statemachine.states.LoggedOut.prototype.openReader = function () {
    if (!this.context.conditionHasGuideUnattended()) {
        this.context.actionErrorDisabledFeature();
        return;
    }
    this.context.actionSetPendingOpenReader();
    this.context.actionSetDefaultLoginRequest();
    this.context.setState(new timapi.statemachine.states.LoginRequest(this.context));
};
timapi.statemachine.states.LoggedOut.prototype.ejectCard = function () {
    if (!this.context.conditionHasGuideUnattended()
        && !this.context.conditionHasGuideAdvancedRetail()) {
        this.context.actionErrorDisabledFeature();
        return;
    }
    this.context.actionSetPendingEjectCard();
    this.context.actionSetDefaultLoginRequest();
    this.context.setState(new timapi.statemachine.states.LoginRequest(this.context));
};
timapi.statemachine.states.LoggedOut.prototype.openMaintenanceWindow = function () {
    if (!this.context.conditionHasGuideUnattended()) {
        this.context.actionErrorDisabledFeature();
        return;
    }
    this.context.actionSetPendingOpenMaintenanceWindow();
    this.context.actionSetDefaultLoginRequest();
    this.context.setState(new timapi.statemachine.states.LoginRequest(this.context));
};
timapi.statemachine.states.LoggedOut.prototype.closeMaintenanceWindow = function () {
    if (!this.context.conditionHasGuideUnattended()) {
        this.context.actionErrorDisabledFeature();
        return;
    }
    this.context.actionSetPendingCloseMaintenanceWindow();
    this.context.actionSetDefaultLoginRequest();
    this.context.setState(new timapi.statemachine.states.LoginRequest(this.context));
};
timapi.statemachine.states.LoggedOut.prototype.activateServiceMenu = function () {
    if (!this.context.conditionHasGuideUnattended()) {
        this.context.actionErrorDisabledFeature();
        return;
    }
    this.context.actionSetPendingActivateServiceMenu();
    this.context.actionSetDefaultLoginRequest();
    this.context.setState(new timapi.statemachine.states.LoginRequest(this.context));
};
timapi.statemachine.states.LoggedOut.prototype.balanceInquiry = function () {
    if (!this.context.conditionHasGuideAdvancedRetail()
        && !this.context.conditionHasGuideBanking()) {
        this.context.actionErrorDisabledFeature();
        return;
    }
    this.context.actionSetPendingBalanceInquiry();
    this.context.actionSetDefaultLoginRequest();
    this.context.setState(new timapi.statemachine.states.LoginRequest(this.context));
};
timapi.statemachine.states.LoggedOut.prototype.openDialogMode = function () {
    if (!this.context.conditionHasGuideDialog()) {
        this.context.actionErrorDisabledFeature();
        return;
    }
    this.context.actionSetPendingOpenDialogMode();
    this.context.actionSetDefaultLoginRequest();
    this.context.setState(new timapi.statemachine.states.LoginRequest(this.context));
};
timapi.statemachine.states.LoggedOut.prototype.closeDialogMode = function () {
    if (!this.context.conditionHasGuideDialog()) {
        this.context.actionErrorDisabledFeature();
        return;
    }
    this.context.actionSetPendingCloseDialogMode();
    this.context.actionSetDefaultLoginRequest();
    this.context.setState(new timapi.statemachine.states.LoginRequest(this.context));
};
timapi.statemachine.states.LoggedOut.prototype.showSignatureCapture = function () {
    if (!this.context.conditionHasGuideDialog()) {
        this.context.actionErrorDisabledFeature();
        return;
    }
    this.context.actionSetPendingShowSignatureCapture();
    this.context.actionSetDefaultLoginRequest();
    this.context.setState(new timapi.statemachine.states.LoginRequest(this.context));
};
timapi.statemachine.states.LoggedOut.prototype.showDialog = function () {
    if (!this.context.conditionHasGuideDialog()) {
        this.context.actionErrorDisabledFeature();
        return;
    }
    this.context.actionSetPendingShowDialog();
    this.context.actionSetDefaultLoginRequest();
    this.context.setState(new timapi.statemachine.states.LoginRequest(this.context));
};
timapi.statemachine.states.LoggedOut.prototype.sendCardCommand = function () {
    if (!this.context.conditionHasGuideDialog()) {
        this.context.actionErrorDisabledFeature();
        return;
    }
    this.context.actionSetPendingSendCardCommand();
    this.context.actionSetDefaultLoginRequest();
    this.context.setState(new timapi.statemachine.states.LoginRequest(this.context));
};
timapi.statemachine.states.LoggingIn = function (context) {
    timapi.statemachine.states.DefaultState.call(this, context);
};
timapi.statemachine.states.LoggingIn.prototype = Object.create(timapi.statemachine.states.DefaultState.prototype);
timapi.statemachine.states.LoggingIn.loggerName = "timapi.statemachine.states.LoggingIn";
timapi.statemachine.states.LoggingIn.classname = "LoggingIn";
timapi.statemachine.states.LoggingIn.logger = timapi.logging.Logger.getLogger(timapi.statemachine.states.LoggingIn.loggerName);
timapi.statemachine.states.LoggingIn.prototype.enterState = function () {
    timapi.statemachine.states.DefaultState.prototype.enterState.call(this);
    if (this.context.conditionHasPendingLogin()) {
        this.context.actionClearPendingEvent();
    }
    this.context.actionArmTimeoutRequest();
};
timapi.statemachine.states.LoggingIn.prototype.activate = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.LoggingIn.prototype.applicationInformation = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.LoggingIn.prototype.balance = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.LoggingIn.prototype.cancel = function () {
    this.context.actionClearPendingCancel();
    this.context.actionCancel();
};
timapi.statemachine.states.LoggingIn.prototype.changeSettings = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.LoggingIn.prototype.commit = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.LoggingIn.prototype.connect = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.LoggingIn.prototype.counterRequest = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.LoggingIn.prototype.deactivate = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.LoggingIn.prototype.disconnect = function () {
    this.context.actionSendErrorResponseDisconnect();
    this.context.actionClearPendingEvent();
    this.context.actionDisconnect();
    this.context.setState(new timapi.statemachine.states.Disconnected(this.context));
};
timapi.statemachine.states.LoggingIn.prototype.dccRates = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.LoggingIn.prototype.hardwareInformation = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.LoggingIn.prototype.initTransaction = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.LoggingIn.prototype.login = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.LoggingIn.prototype.logout = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.LoggingIn.prototype.reboot = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.LoggingIn.prototype.reconciliation = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.LoggingIn.prototype.receiptRequest = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.LoggingIn.prototype.reconfig = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.LoggingIn.prototype.rollback = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.LoggingIn.prototype.softwareUpdate = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.LoggingIn.prototype.systemInformation = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.LoggingIn.prototype.transaction = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.LoggingIn.prototype.connected = function () {
};
timapi.statemachine.states.LoggingIn.prototype.connectFailed = function () {
    this.context.actionClearPendingEvent();
    this.context.setState(new timapi.statemachine.states.ErrorState(this.context));
};
timapi.statemachine.states.LoggingIn.prototype.responseRequest = function () {
    try {
        if (this.context.conditionIsEnabledFetchBrands()
            && !this.context.conditionIsApplicationInformationNotSupported()) {
            try {
                this.context.actionProcessResponseLogin();
                this.context.actionApplicationInformation();
            }
            catch (e) {
                timapi.statemachine.states.LoggingIn.logger.log(timapi.logging.Level.severe, "Exception", e);
                this.context.setState(new timapi.statemachine.states.LoggingInFailedLogout(this.context));
                return;
            }
            this.context.setState(new timapi.statemachine.states.LoggingInBrands(this.context));
            return;
        }
        if (this.context.conditionIsEnabledAutoActivate()
            && !this.context.conditionHasPendingEvent()) {
            try {
                this.context.actionProcessResponseLogin();
                this.context.actionNotifyLoginCompleted();
                this.context.actionActivate();
            }
            catch (e) {
                timapi.statemachine.states.LoggingIn.logger.log(timapi.logging.Level.severe, "Exception", e);
                this.context.setState(new timapi.statemachine.states.LoggingInFailedLogout(this.context));
                return;
            }
            this.context.setState(new timapi.statemachine.states.Activating(this.context));
            return;
        }
        this.context.actionProcessResponseLogin();
        this.context.actionNotifyLoginCompleted();
        this.context.setState(new timapi.statemachine.states.LoggedIn(this.context));
    }
    catch (e) {
        timapi.statemachine.states.LoggingIn.logger.log(timapi.logging.Level.severe, "Exception", e);
        this.context.setState(new timapi.statemachine.states.LoggingInFailed(this.context));
    }
};
timapi.statemachine.states.LoggingIn.prototype.responseError = function () {
    this.context.actionClearPendingEvent();
    this.context.actionProcessResponseError();
    this.context.setState(new timapi.statemachine.states.LoggingInFailed(this.context));
};
timapi.statemachine.states.LoggingIn.prototype.responseBusy = function () {
    if (!this.context.conditionHasPendingEvent()) {
        this.context.actionClearPendingEvent();
        this.context.actionProcessResponseError();
        this.context.setState(new timapi.statemachine.states.LoggingInFailed(this.context));
        return;
    }
};
timapi.statemachine.states.LoggingIn.prototype.notificationKeepAlive = function () {
};
timapi.statemachine.states.LoggingIn.prototype.timeout = function () {
    this.context.actionErrorConnectionLost();
    this.context.actionDisconnect();
    this.context.setState(new timapi.statemachine.states.Disconnected(this.context));
};
timapi.statemachine.states.LoggingIn.prototype.keepAliveTimeout = function () {
};
timapi.statemachine.states.LoggingIn.prototype.keepAliveTimer = function () {
};
timapi.statemachine.states.LoggingIn.prototype.trxStateBecameIdle = function () {
    if (this.context.conditionHasPendingEvent()) {
        this.context.actionLogin();
        this.context.actionArmTimeoutRequest();
        return;
    }
};
timapi.statemachine.states.LoggingIn.prototype.closeReader = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.LoggingIn.prototype.openReader = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.LoggingIn.prototype.ejectCard = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.LoggingIn.prototype.openMaintenanceWindow = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.LoggingIn.prototype.closeMaintenanceWindow = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.LoggingIn.prototype.activateServiceMenu = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.LoggingIn.prototype.balanceInquiry = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.LoggingIn.prototype.openDialogMode = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.LoggingIn.prototype.closeDialogMode = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.LoggingIn.prototype.showSignatureCapture = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.LoggingIn.prototype.showDialog = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.LoggingIn.prototype.sendCardCommand = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.LoggingInBrands = function (context) {
    timapi.statemachine.states.DefaultState.call(this, context);
};
timapi.statemachine.states.LoggingInBrands.prototype = Object.create(timapi.statemachine.states.DefaultState.prototype);
timapi.statemachine.states.LoggingInBrands.loggerName = "timapi.statemachine.states.LoggingInBrands";
timapi.statemachine.states.LoggingInBrands.classname = "LoggingInBrands";
timapi.statemachine.states.LoggingInBrands.logger = timapi.logging.Logger.getLogger(timapi.statemachine.states.LoggingInBrands.loggerName);
timapi.statemachine.states.LoggingInBrands.prototype.enterState = function () {
    timapi.statemachine.states.DefaultState.prototype.enterState.call(this);
};
timapi.statemachine.states.LoggingInBrands.prototype.activate = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.LoggingInBrands.prototype.applicationInformation = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.LoggingInBrands.prototype.balance = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.LoggingInBrands.prototype.cancel = function () {
    this.context.actionClearPendingCancel();
    this.context.actionCancel();
};
timapi.statemachine.states.LoggingInBrands.prototype.changeSettings = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.LoggingInBrands.prototype.commit = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.LoggingInBrands.prototype.connect = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.LoggingInBrands.prototype.counterRequest = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.LoggingInBrands.prototype.deactivate = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.LoggingInBrands.prototype.disconnect = function () {
    this.context.actionSendErrorResponseDisconnect();
    this.context.actionClearPendingEvent();
    this.context.actionDisconnect();
    this.context.setState(new timapi.statemachine.states.Disconnected(this.context));
};
timapi.statemachine.states.LoggingInBrands.prototype.dccRates = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.LoggingInBrands.prototype.hardwareInformation = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.LoggingInBrands.prototype.initTransaction = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.LoggingInBrands.prototype.login = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.LoggingInBrands.prototype.logout = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.LoggingInBrands.prototype.reboot = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.LoggingInBrands.prototype.reconciliation = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.LoggingInBrands.prototype.receiptRequest = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.LoggingInBrands.prototype.reconfig = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.LoggingInBrands.prototype.rollback = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.LoggingInBrands.prototype.softwareUpdate = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.LoggingInBrands.prototype.systemInformation = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.LoggingInBrands.prototype.transaction = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.LoggingInBrands.prototype.connected = function () {
};
timapi.statemachine.states.LoggingInBrands.prototype.connectFailed = function () {
    this.context.actionClearPendingEvent();
    this.context.setState(new timapi.statemachine.states.ErrorState(this.context));
};
timapi.statemachine.states.LoggingInBrands.prototype.responseRequest = function () {
    try {
        if (this.context.conditionIsEnabledAutoActivate()
            && !this.context.conditionHasPendingEvent()) {
            try {
                this.context.actionProcessResponseApplicationInformation();
                this.context.actionActivate();
            }
            catch (e) {
                timapi.statemachine.states.LoggingInBrands.logger.log(timapi.logging.Level.severe, "Exception", e);
                this.context.setState(new timapi.statemachine.states.LoggingInFailedLogout(this.context));
                return;
            }
            this.context.setState(new timapi.statemachine.states.Activating(this.context));
            return;
        }
        this.context.actionProcessResponseApplicationInformation();
        this.context.actionNotifyLoginCompleted();
        this.context.setState(new timapi.statemachine.states.LoggedIn(this.context));
    }
    catch (e) {
        timapi.statemachine.states.LoggingInBrands.logger.log(timapi.logging.Level.severe, "Exception", e);
        this.context.setState(new timapi.statemachine.states.LoggingInFailedLogout(this.context));
    }
};
timapi.statemachine.states.LoggingInBrands.prototype.responseError = function () {
    this.context.actionClearPendingEvent();
    this.context.actionProcessResponseError();
    this.context.setState(new timapi.statemachine.states.LoggingInFailedLogout(this.context));
};
timapi.statemachine.states.LoggingInBrands.prototype.responseBusy = function () {
    if (!this.context.conditionHasPendingEvent()) {
        this.context.actionClearPendingEvent();
        this.context.actionProcessResponseError();
        this.context.setState(new timapi.statemachine.states.LoggingInFailedLogout(this.context));
        return;
    }
};
timapi.statemachine.states.LoggingInBrands.prototype.timeout = function () {
    this.context.actionErrorTimeout();
    this.context.setState(new timapi.statemachine.states.LoggingInFailedLogout(this.context));
};
timapi.statemachine.states.LoggingInBrands.prototype.keepAliveTimeout = function () {
    try {
        this.context.actionErrorConnectionLost();
        this.context.actionDisconnect();
        this.context.setState(new timapi.statemachine.states.Disconnected(this.context));
    }
    catch (e) {
        timapi.statemachine.states.LoggingInBrands.logger.log(timapi.logging.Level.severe, "Exception", e);
        this.context.setState(new timapi.statemachine.states.Disconnected(this.context));
    }
};
timapi.statemachine.states.LoggingInBrands.prototype.trxStateBecameIdle = function () {
    if (this.context.conditionHasPendingEvent()) {
        this.context.actionApplicationInformation();
        return;
    }
};
timapi.statemachine.states.LoggingInBrands.prototype.closeReader = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.LoggingInBrands.prototype.openReader = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.LoggingInBrands.prototype.ejectCard = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.LoggingInBrands.prototype.openMaintenanceWindow = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.LoggingInBrands.prototype.closeMaintenanceWindow = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.LoggingInBrands.prototype.activateServiceMenu = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.LoggingInBrands.prototype.balanceInquiry = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.LoggingInBrands.prototype.openDialogMode = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.LoggingInBrands.prototype.closeDialogMode = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.LoggingInBrands.prototype.showSignatureCapture = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.LoggingInBrands.prototype.showDialog = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.LoggingInBrands.prototype.sendCardCommand = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.LoggingInFailed = function (context) {
    timapi.statemachine.states.DefaultState.call(this, context);
};
timapi.statemachine.states.LoggingInFailed.prototype = Object.create(timapi.statemachine.states.DefaultState.prototype);
timapi.statemachine.states.LoggingInFailed.loggerName = "timapi.statemachine.states.LoggingInFailed";
timapi.statemachine.states.LoggingInFailed.classname = "LoggingInFailed";
timapi.statemachine.states.LoggingInFailed.logger = timapi.logging.Logger.getLogger(timapi.statemachine.states.LoggingInFailed.loggerName);
timapi.statemachine.states.LoggingInFailed.prototype.enterState = function () {
    timapi.statemachine.states.DefaultState.prototype.enterState.call(this);
    if (this.context.conditionIsEnabledAutoDisconnect()) {
        try {
            this.context.actionClearPendingEvent();
            this.context.actionDisconnect();
        }
        catch (e) {
            timapi.statemachine.states.LoggingInFailed.logger.log(timapi.logging.Level.severe, "Exception", e);
            this.context.setState(new timapi.statemachine.states.Disconnected(this.context));
            return;
        }
        this.context.setState(new timapi.statemachine.states.Disconnected(this.context));
        return;
    }
    try {
        this.context.actionClearPendingEvent();
    }
    catch (e) {
        timapi.statemachine.states.LoggingInFailed.logger.log(timapi.logging.Level.severe, "Exception", e);
        this.context.setState(new timapi.statemachine.states.ErrorState(this.context));
        return;
    }
    this.context.setState(new timapi.statemachine.states.LoggedOut(this.context));
    return;
};
timapi.statemachine.states.LoggingInFailedLogout = function (context) {
    timapi.statemachine.states.DefaultState.call(this, context);
};
timapi.statemachine.states.LoggingInFailedLogout.prototype = Object.create(timapi.statemachine.states.DefaultState.prototype);
timapi.statemachine.states.LoggingInFailedLogout.loggerName = "timapi.statemachine.states.LoggingInFailedLogout";
timapi.statemachine.states.LoggingInFailedLogout.classname = "LoggingInFailedLogout";
timapi.statemachine.states.LoggingInFailedLogout.logger = timapi.logging.Logger.getLogger(timapi.statemachine.states.LoggingInFailedLogout.loggerName);
timapi.statemachine.states.LoggingInFailedLogout.prototype.enterState = function () {
    timapi.statemachine.states.DefaultState.prototype.enterState.call(this);
    this.context.actionClearPendingEvent();
    this.context.actionLogout();
};
timapi.statemachine.states.LoggingInFailedLogout.prototype.responseRequest = function () {
    if (this.context.conditionIsEnabledAutoDisconnect()) {
        this.context.actionProcessResponseLogout();
        this.context.actionDisconnect();
        this.context.setState(new timapi.statemachine.states.Disconnected(this.context));
        return;
    }
    this.context.actionProcessResponseLogout();
    this.context.setState(new timapi.statemachine.states.LoggedOut(this.context));
};
timapi.statemachine.states.LoggingInFailedLogout.prototype.responseError = function () {
    this.context.actionClearPendingEvent();
    this.context.actionProcessResponseError();
    this.context.setState(new timapi.statemachine.states.ErrorState(this.context));
};
timapi.statemachine.states.LoggingInFailedLogout.prototype.responseBusy = function () {
    this.context.actionClearPendingEvent();
    this.context.actionProcessResponseError();
    this.context.setState(new timapi.statemachine.states.ErrorState(this.context));
};
timapi.statemachine.states.LoggingInFailedLogout.prototype.timeout = function () {
    this.context.actionErrorTimeout();
    this.context.setState(new timapi.statemachine.states.ErrorState(this.context));
};
timapi.statemachine.states.LoggingOut = function (context) {
    timapi.statemachine.states.DefaultState.call(this, context);
};
timapi.statemachine.states.LoggingOut.prototype = Object.create(timapi.statemachine.states.DefaultState.prototype);
timapi.statemachine.states.LoggingOut.loggerName = "timapi.statemachine.states.LoggingOut";
timapi.statemachine.states.LoggingOut.classname = "LoggingOut";
timapi.statemachine.states.LoggingOut.logger = timapi.logging.Logger.getLogger(timapi.statemachine.states.LoggingOut.loggerName);
timapi.statemachine.states.LoggingOut.prototype.enterState = function () {
    timapi.statemachine.states.DefaultState.prototype.enterState.call(this);
    if (this.context.conditionHasPendingLogout()) {
        this.context.actionClearPendingEvent();
    }
};
timapi.statemachine.states.LoggingOut.prototype.activate = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.LoggingOut.prototype.applicationInformation = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.LoggingOut.prototype.balance = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.LoggingOut.prototype.cancel = function () {
    this.context.actionClearPendingCancel();
    this.context.actionCancel();
};
timapi.statemachine.states.LoggingOut.prototype.changeSettings = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.LoggingOut.prototype.commit = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.LoggingOut.prototype.connect = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.LoggingOut.prototype.counterRequest = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.LoggingOut.prototype.deactivate = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.LoggingOut.prototype.disconnect = function () {
    this.context.actionSendErrorResponseDisconnect();
    this.context.actionClearPendingEvent();
    this.context.actionDisconnect();
    this.context.setState(new timapi.statemachine.states.Disconnected(this.context));
};
timapi.statemachine.states.LoggingOut.prototype.dccRates = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.LoggingOut.prototype.hardwareInformation = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.LoggingOut.prototype.initTransaction = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.LoggingOut.prototype.login = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.LoggingOut.prototype.logout = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.LoggingOut.prototype.reboot = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.LoggingOut.prototype.reconciliation = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.LoggingOut.prototype.receiptRequest = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.LoggingOut.prototype.reconfig = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.LoggingOut.prototype.rollback = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.LoggingOut.prototype.softwareUpdate = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.LoggingOut.prototype.systemInformation = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.LoggingOut.prototype.transaction = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.LoggingOut.prototype.connected = function () {
};
timapi.statemachine.states.LoggingOut.prototype.connectFailed = function () {
    this.context.actionClearPendingEvent();
    this.context.setState(new timapi.statemachine.states.ErrorState(this.context));
};
timapi.statemachine.states.LoggingOut.prototype.responseRequest = function () {
    if (this.context.conditionIsEnabledAutoDisconnect()) {
        try {
            this.context.actionProcessResponseLogout();
            this.context.actionDisconnect();
        }
        catch (e) {
            timapi.statemachine.states.LoggingOut.logger.log(timapi.logging.Level.severe, "Exception", e);
            this.context.setState(new timapi.statemachine.states.LoggedOut(this.context));
            return;
        }
        this.context.setState(new timapi.statemachine.states.Disconnected(this.context));
        return;
    }
    this.context.actionProcessResponseLogout();
    this.context.setState(new timapi.statemachine.states.LoggedOut(this.context));
};
timapi.statemachine.states.LoggingOut.prototype.responseError = function () {
    if (this.context.conditionIsEnabledAutoDisconnect()) {
        try {
            this.context.actionClearPendingEvent();
            this.context.actionProcessResponseError();
            this.context.actionDisconnect();
        }
        catch (e) {
            timapi.statemachine.states.LoggingOut.logger.log(timapi.logging.Level.severe, "Exception", e);
            this.context.setState(new timapi.statemachine.states.LoggedOut(this.context));
            return;
        }
        this.context.setState(new timapi.statemachine.states.Disconnected(this.context));
        return;
    }
    this.context.actionClearPendingEvent();
    this.context.actionProcessResponseError();
    this.context.setState(new timapi.statemachine.states.LoggedIn(this.context));
};
timapi.statemachine.states.LoggingOut.prototype.responseBusy = function () {
    if (this.context.conditionIsEnabledAutoDisconnect()) {
        try {
            this.context.actionClearPendingEvent();
            this.context.actionProcessResponseError();
            this.context.actionDisconnect();
        }
        catch (e) {
            timapi.statemachine.states.LoggingOut.logger.log(timapi.logging.Level.severe, "Exception", e);
            this.context.setState(new timapi.statemachine.states.LoggedOut(this.context));
            return;
        }
        this.context.setState(new timapi.statemachine.states.Disconnected(this.context));
        return;
    }
    this.context.actionClearPendingEvent();
    this.context.actionProcessResponseError();
    this.context.setState(new timapi.statemachine.states.LoggedIn(this.context));
};
timapi.statemachine.states.LoggingOut.prototype.timeout = function () {
    if (this.context.conditionIsEnabledAutoDisconnect()) {
        try {
            this.context.actionErrorTimeout();
            this.context.actionDisconnect();
        }
        catch (e) {
            timapi.statemachine.states.LoggingOut.logger.log(timapi.logging.Level.severe, "Exception", e);
            this.context.setState(new timapi.statemachine.states.LoggedOut(this.context));
            return;
        }
        this.context.setState(new timapi.statemachine.states.Disconnected(this.context));
        return;
    }
    this.context.actionErrorTimeout();
    this.context.setState(new timapi.statemachine.states.LoggedIn(this.context));
};
timapi.statemachine.states.LoggingOut.prototype.keepAliveTimeout = function () {
    try {
        this.context.actionErrorConnectionLost();
        this.context.actionDisconnect();
        this.context.setState(new timapi.statemachine.states.Disconnected(this.context));
    }
    catch (e) {
        timapi.statemachine.states.LoggingOut.logger.log(timapi.logging.Level.severe, "Exception", e);
        this.context.setState(new timapi.statemachine.states.Disconnected(this.context));
    }
};
timapi.statemachine.states.LoggingOut.prototype.closeReader = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.LoggingOut.prototype.openReader = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.LoggingOut.prototype.ejectCard = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.LoggingOut.prototype.openMaintenanceWindow = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.LoggingOut.prototype.closeMaintenanceWindow = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.LoggingOut.prototype.activateServiceMenu = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.LoggingOut.prototype.balanceInquiry = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.LoggingOut.prototype.openDialogMode = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.LoggingOut.prototype.closeDialogMode = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.LoggingOut.prototype.showSignatureCapture = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.LoggingOut.prototype.showDialog = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.LoggingOut.prototype.sendCardCommand = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.LoginRequest = function (context) {
    timapi.statemachine.states.DefaultState.call(this, context);
};
timapi.statemachine.states.LoginRequest.prototype = Object.create(timapi.statemachine.states.DefaultState.prototype);
timapi.statemachine.states.LoginRequest.loggerName = "timapi.statemachine.states.LoginRequest";
timapi.statemachine.states.LoginRequest.classname = "LoginRequest";
timapi.statemachine.states.LoginRequest.logger = timapi.logging.Logger.getLogger(timapi.statemachine.states.LoginRequest.loggerName);
timapi.statemachine.states.LoginRequest.prototype.enterState = function () {
    timapi.statemachine.states.DefaultState.prototype.enterState.call(this);
    if (this.context.conditionHasTerminalFeatures()) {
        try {
            this.context.actionLogin();
        }
        catch (e) {
            timapi.statemachine.states.LoginRequest.logger.log(timapi.logging.Level.severe, "Exception", e);
            this.context.setState(new timapi.statemachine.states.LoggingInFailed(this.context));
            return;
        }
        this.context.setState(new timapi.statemachine.states.LoggingIn(this.context));
        return;
    }
    try {
        this.context.actionRequestFeatures();
    }
    catch (e) {
        timapi.statemachine.states.LoginRequest.logger.log(timapi.logging.Level.severe, "Exception", e);
        this.context.setState(new timapi.statemachine.states.LoggingInFailed(this.context));
        return;
    }
    this.context.setState(new timapi.statemachine.states.LoginRequestFeatures(this.context));
    return;
};
timapi.statemachine.states.LoginRequestFeatures = function (context) {
    timapi.statemachine.states.DefaultState.call(this, context);
};
timapi.statemachine.states.LoginRequestFeatures.prototype = Object.create(timapi.statemachine.states.DefaultState.prototype);
timapi.statemachine.states.LoginRequestFeatures.loggerName = "timapi.statemachine.states.LoginRequestFeatures";
timapi.statemachine.states.LoginRequestFeatures.classname = "LoginRequestFeatures";
timapi.statemachine.states.LoginRequestFeatures.logger = timapi.logging.Logger.getLogger(timapi.statemachine.states.LoginRequestFeatures.loggerName);
timapi.statemachine.states.LoginRequestFeatures.prototype.enterState = function () {
    timapi.statemachine.states.DefaultState.prototype.enterState.call(this);
    this.context.actionArmTimeoutRequest();
};
timapi.statemachine.states.LoginRequestFeatures.prototype.activate = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.LoginRequestFeatures.prototype.applicationInformation = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.LoginRequestFeatures.prototype.balance = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.LoginRequestFeatures.prototype.cancel = function () {
    this.context.actionClearPendingCancel();
    this.context.actionCancel();
};
timapi.statemachine.states.LoginRequestFeatures.prototype.changeSettings = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.LoginRequestFeatures.prototype.commit = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.LoginRequestFeatures.prototype.connect = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.LoginRequestFeatures.prototype.counterRequest = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.LoginRequestFeatures.prototype.deactivate = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.LoginRequestFeatures.prototype.disconnect = function () {
    this.context.actionSendErrorResponseDisconnect();
    this.context.actionClearPendingEvent();
    this.context.actionDisconnect();
    this.context.setState(new timapi.statemachine.states.Disconnected(this.context));
};
timapi.statemachine.states.LoginRequestFeatures.prototype.dccRates = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.LoginRequestFeatures.prototype.hardwareInformation = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.LoginRequestFeatures.prototype.initTransaction = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.LoginRequestFeatures.prototype.login = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.LoginRequestFeatures.prototype.logout = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.LoginRequestFeatures.prototype.reboot = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.LoginRequestFeatures.prototype.reconciliation = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.LoginRequestFeatures.prototype.receiptRequest = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.LoginRequestFeatures.prototype.reconfig = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.LoginRequestFeatures.prototype.rollback = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.LoginRequestFeatures.prototype.softwareUpdate = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.LoginRequestFeatures.prototype.systemInformation = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.LoginRequestFeatures.prototype.transaction = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.LoginRequestFeatures.prototype.connected = function () {
};
timapi.statemachine.states.LoginRequestFeatures.prototype.connectFailed = function () {
    this.context.actionClearPendingEvent();
    this.context.setState(new timapi.statemachine.states.ErrorState(this.context));
};
timapi.statemachine.states.LoginRequestFeatures.prototype.responseRequest = function () {
    try {
        this.context.actionProcessResponseFeatureRequest();
        this.context.actionLogin();
        this.context.setState(new timapi.statemachine.states.LoggingIn(this.context));
    }
    catch (e) {
        timapi.statemachine.states.LoginRequestFeatures.logger.log(timapi.logging.Level.severe, "Exception", e);
        this.context.setState(new timapi.statemachine.states.LoggingInFailed(this.context));
    }
};
timapi.statemachine.states.LoginRequestFeatures.prototype.responseError = function () {
    this.context.actionClearPendingEvent();
    this.context.actionProcessResponseError();
    this.context.setState(new timapi.statemachine.states.LoggingInFailed(this.context));
};
timapi.statemachine.states.LoginRequestFeatures.prototype.responseBusy = function () {
    if (!this.context.conditionHasPendingEvent()) {
        this.context.actionClearPendingEvent();
        this.context.actionProcessResponseError();
        this.context.setState(new timapi.statemachine.states.LoggingInFailed(this.context));
        return;
    }
};
timapi.statemachine.states.LoginRequestFeatures.prototype.notificationKeepAlive = function () {
};
timapi.statemachine.states.LoginRequestFeatures.prototype.timeout = function () {
    this.context.actionErrorConnectionLost();
    this.context.actionDisconnect();
    this.context.setState(new timapi.statemachine.states.Disconnected(this.context));
};
timapi.statemachine.states.LoginRequestFeatures.prototype.keepAliveTimeout = function () {
};
timapi.statemachine.states.LoginRequestFeatures.prototype.keepAliveTimer = function () {
};
timapi.statemachine.states.LoginRequestFeatures.prototype.trxStateBecameIdle = function () {
    if (this.context.conditionHasPendingEvent()) {
        this.context.actionRequestFeatures();
        this.context.actionArmTimeoutRequest();
        return;
    }
};
timapi.statemachine.states.LoginRequestFeatures.prototype.closeReader = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.LoginRequestFeatures.prototype.openReader = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.LoginRequestFeatures.prototype.ejectCard = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.LoginRequestFeatures.prototype.openMaintenanceWindow = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.LoginRequestFeatures.prototype.closeMaintenanceWindow = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.LoginRequestFeatures.prototype.activateServiceMenu = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.LoginRequestFeatures.prototype.balanceInquiry = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.LoginRequestFeatures.prototype.openDialogMode = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.LoginRequestFeatures.prototype.closeDialogMode = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.LoginRequestFeatures.prototype.showSignatureCapture = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.LoginRequestFeatures.prototype.showDialog = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.LoginRequestFeatures.prototype.sendCardCommand = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.Open = function (context) {
    timapi.statemachine.states.DefaultState.call(this, context);
};
timapi.statemachine.states.Open.prototype = Object.create(timapi.statemachine.states.DefaultState.prototype);
timapi.statemachine.states.Open.loggerName = "timapi.statemachine.states.Open";
timapi.statemachine.states.Open.classname = "Open";
timapi.statemachine.states.Open.logger = timapi.logging.Logger.getLogger(timapi.statemachine.states.Open.loggerName);
timapi.statemachine.states.Open.prototype.enterState = function () {
    timapi.statemachine.states.DefaultState.prototype.enterState.call(this);
    this.context.actionCancelTimeout();
    if (this.context.conditionHasPendingActivate()) {
        this.context.actionClearPendingEvent();
    }
    if (this.context.conditionHasPendingCancel()) {
        this.context.actionClearPendingCancel();
        this.context.actionCancel();
    }
    if (this.context.conditionHasPendingCommit()) {
        this.context.actionCommit();
        this.context.setState(new timapi.statemachine.states.WaitCommit(this.context));
        return;
    }
    if (this.context.conditionHasPendingCounterRequest()) {
        this.context.actionCounterRequest();
        this.context.setState(new timapi.statemachine.states.WaitCounterRequest(this.context));
        return;
    }
    if (this.context.conditionHasPendingInitTransaction()) {
        this.context.actionInitTransaction();
        this.context.setState(new timapi.statemachine.states.WaitInitTransaction(this.context));
        return;
    }
    if (this.context.conditionHasPendingReceiptRequest()) {
        this.context.actionReceiptRequest();
        this.context.setState(new timapi.statemachine.states.WaitReceiptRequestOpen(this.context));
        return;
    }
    if (this.context.conditionHasPendingTransaction()) {
        this.context.actionTransaction();
        this.context.setState(new timapi.statemachine.states.WaitTransaction(this.context));
        return;
    }
    if (this.context.conditionHasPendingDeactivate()) {
        this.context.actionClearPendingEvent();
        this.context.actionDeactivate();
        this.context.setState(new timapi.statemachine.states.Deactivating(this.context));
        return;
    }
    if (this.context.conditionHasPendingCloseReader()) {
        this.context.actionCloseReader();
        this.context.setState(new timapi.statemachine.states.WaitCloseReader(this.context));
        return;
    }
    if (this.context.conditionHasPendingOpenReader()) {
        this.context.actionOpenReader();
        this.context.setState(new timapi.statemachine.states.WaitOpenReader(this.context));
        return;
    }
    if (this.context.conditionHasPendingEjectCard()) {
        this.context.actionEjectCard();
        this.context.setState(new timapi.statemachine.states.WaitEjectCard(this.context));
        return;
    }
    if (this.context.conditionHasPendingBalanceInquiry()) {
        this.context.actionBalanceInquiry();
        this.context.setState(new timapi.statemachine.states.WaitBalanceInquiry(this.context));
        return;
    }
    if (this.context.conditionHasPendingOpenDialogMode()) {
        this.context.actionClearPendingEvent();
        this.context.actionOpenDialogMode();
        this.context.setState(new timapi.statemachine.states.WaitOpenDialogMode(this.context));
        return;
    }
    if (this.context.conditionHasPendingShowSignatureCapture()
        || this.context.conditionHasPendingShowDialog()
        || this.context.conditionHasPendingSendCardCommand()) {
        this.context.actionOpenDialogMode();
        this.context.setState(new timapi.statemachine.states.WaitOpenDialogMode(this.context));
        return;
    }
    if (this.context.conditionHasPendingApplicationInformation()
        || this.context.conditionHasPendingBalance()
        || this.context.conditionHasPendingChangeSettings()
        || this.context.conditionHasPendingDccRates()
        || this.context.conditionHasPendingHardwareInformation()
        || this.context.conditionHasPendingLogin()
        || this.context.conditionHasPendingLogout()
        || this.context.conditionHasPendingReboot()
        || this.context.conditionHasPendingReconfig()
        || this.context.conditionHasPendingSoftwareUpdate()
        || this.context.conditionHasPendingSystemInformation()
        || this.context.conditionHasPendingOpenMaintenanceWindow()
        || this.context.conditionHasPendingCloseMaintenanceWindow()
        || this.context.conditionHasPendingActivateServiceMenu()
        || this.context.conditionHasPendingOpenDialogMode()
        || this.context.conditionHasPendingCloseDialogMode()
        || this.context.conditionHasPendingShowSignatureCapture()
        || this.context.conditionHasPendingShowDialog()
        || this.context.conditionHasPendingSendCardCommand()) {
        this.context.actionDeactivate();
        this.context.setState(new timapi.statemachine.states.Deactivating(this.context));
        return;
    }
};
timapi.statemachine.states.Open.prototype.activate = function () {
    this.context.actionActivate();
    this.context.setState(new timapi.statemachine.states.Activating(this.context));
};
timapi.statemachine.states.Open.prototype.applicationInformation = function () {
    this.context.actionSetPendingApplicationInformation();
    this.context.actionDeactivate();
    this.context.setState(new timapi.statemachine.states.Deactivating(this.context));
};
timapi.statemachine.states.Open.prototype.balance = function () {
    this.context.actionSetPendingBalance();
    this.context.actionDeactivate();
    this.context.setState(new timapi.statemachine.states.Deactivating(this.context));
};
timapi.statemachine.states.Open.prototype.cancel = function () {
    this.context.actionClearPendingCancel();
    this.context.actionCancel();
};
timapi.statemachine.states.Open.prototype.changeSettings = function () {
    this.context.actionSetPendingChangeSettings();
    this.context.actionDeactivate();
    this.context.setState(new timapi.statemachine.states.Deactivating(this.context));
};
timapi.statemachine.states.Open.prototype.counterRequest = function () {
    this.context.actionCounterRequest();
    this.context.setState(new timapi.statemachine.states.WaitCounterRequest(this.context));
};
timapi.statemachine.states.Open.prototype.deactivate = function () {
    this.context.actionDeactivate();
    this.context.setState(new timapi.statemachine.states.Deactivating(this.context));
};
timapi.statemachine.states.Open.prototype.dccRates = function () {
    this.context.actionSetPendingDccRates();
    this.context.actionDeactivate();
    this.context.setState(new timapi.statemachine.states.Deactivating(this.context));
};
timapi.statemachine.states.Open.prototype.hardwareInformation = function () {
    this.context.actionSetPendingHardwareInformation();
    this.context.actionDeactivate();
    this.context.setState(new timapi.statemachine.states.Deactivating(this.context));
};
timapi.statemachine.states.Open.prototype.initTransaction = function () {
    this.context.actionInitTransaction();
    this.context.setState(new timapi.statemachine.states.WaitInitTransaction(this.context));
};
timapi.statemachine.states.Open.prototype.login = function () {
    this.context.actionSetPendingLogin();
    this.context.actionDeactivate();
    this.context.setState(new timapi.statemachine.states.Deactivating(this.context));
};
timapi.statemachine.states.Open.prototype.logout = function () {
    this.context.actionSetPendingLogout();
    this.context.actionDeactivate();
    this.context.setState(new timapi.statemachine.states.Deactivating(this.context));
};
timapi.statemachine.states.Open.prototype.reboot = function () {
    this.context.actionSetPendingReboot();
    this.context.actionDeactivate();
    this.context.setState(new timapi.statemachine.states.Deactivating(this.context));
};
timapi.statemachine.states.Open.prototype.reconciliation = function () {
    this.context.actionSetPendingReconciliation();
    this.context.actionDeactivate();
    this.context.setState(new timapi.statemachine.states.Deactivating(this.context));
};
timapi.statemachine.states.Open.prototype.receiptRequest = function () {
    this.context.actionReceiptRequest();
    this.context.setState(new timapi.statemachine.states.WaitReceiptRequestOpen(this.context));
};
timapi.statemachine.states.Open.prototype.reconfig = function () {
    this.context.actionSetPendingReconfig();
    this.context.actionDeactivate();
    this.context.setState(new timapi.statemachine.states.Deactivating(this.context));
};
timapi.statemachine.states.Open.prototype.softwareUpdate = function () {
    this.context.actionSetPendingSoftwareUpdate();
    this.context.actionDeactivate();
    this.context.setState(new timapi.statemachine.states.Deactivating(this.context));
};
timapi.statemachine.states.Open.prototype.systemInformation = function () {
    this.context.actionSetPendingSystemInformation();
    this.context.actionDeactivate();
    this.context.setState(new timapi.statemachine.states.Deactivating(this.context));
};
timapi.statemachine.states.Open.prototype.transaction = function () {
    this.context.actionTransaction();
    this.context.setState(new timapi.statemachine.states.WaitTransaction(this.context));
};
timapi.statemachine.states.Open.prototype.closeReader = function () {
    if (!this.context.conditionHasGuideUnattended()) {
        this.context.actionErrorDisabledFeature();
        return;
    }
    this.context.actionCloseReader();
    this.context.setState(new timapi.statemachine.states.WaitCloseReader(this.context));
};
timapi.statemachine.states.Open.prototype.openReader = function () {
    if (!this.context.conditionHasGuideUnattended()) {
        this.context.actionErrorDisabledFeature();
        return;
    }
    this.context.actionOpenReader();
    this.context.setState(new timapi.statemachine.states.WaitOpenReader(this.context));
};
timapi.statemachine.states.Open.prototype.ejectCard = function () {
    if (!this.context.conditionHasGuideUnattended()
        && !this.context.conditionHasGuideAdvancedRetail()) {
        this.context.actionErrorDisabledFeature();
        return;
    }
    this.context.actionEjectCard();
    this.context.setState(new timapi.statemachine.states.WaitEjectCard(this.context));
};
timapi.statemachine.states.Open.prototype.openMaintenanceWindow = function () {
    this.context.actionSetPendingOpenMaintenanceWindow();
    this.context.actionDeactivate();
    this.context.setState(new timapi.statemachine.states.Deactivating(this.context));
};
timapi.statemachine.states.Open.prototype.closeMaintenanceWindow = function () {
    this.context.actionSetPendingCloseMaintenanceWindow();
    this.context.actionDeactivate();
    this.context.setState(new timapi.statemachine.states.Deactivating(this.context));
};
timapi.statemachine.states.Open.prototype.activateServiceMenu = function () {
    this.context.actionSetPendingActivateServiceMenu();
    this.context.actionDeactivate();
    this.context.setState(new timapi.statemachine.states.Deactivating(this.context));
};
timapi.statemachine.states.Open.prototype.balanceInquiry = function () {
    if (!this.context.conditionHasGuideAdvancedRetail()
        && !this.context.conditionHasGuideBanking()) {
        this.context.actionErrorDisabledFeature();
        return;
    }
    this.context.actionBalanceInquiry();
    this.context.setState(new timapi.statemachine.states.WaitBalanceInquiry(this.context));
};
timapi.statemachine.states.Open.prototype.openDialogMode = function () {
    if (!this.context.conditionHasGuideDialog()) {
        this.context.actionErrorDisabledFeature();
        return;
    }
    this.context.actionOpenDialogMode();
    this.context.setState(new timapi.statemachine.states.WaitOpenDialogMode(this.context));
};
timapi.statemachine.states.Open.prototype.showSignatureCapture = function () {
    if (!this.context.conditionHasGuideDialog()) {
        this.context.actionErrorDisabledFeature();
        return;
    }
    this.context.actionSetPendingShowSignatureCapture();
    this.context.actionOpenDialogMode();
    this.context.setState(new timapi.statemachine.states.WaitOpenDialogMode(this.context));
};
timapi.statemachine.states.Open.prototype.showDialog = function () {
    if (!this.context.conditionHasGuideDialog()) {
        this.context.actionErrorDisabledFeature();
        return;
    }
    this.context.actionSetPendingShowDialog();
    this.context.actionOpenDialogMode();
    this.context.setState(new timapi.statemachine.states.WaitOpenDialogMode(this.context));
};
timapi.statemachine.states.Open.prototype.sendCardCommand = function () {
    if (!this.context.conditionHasGuideDialog()) {
        this.context.actionErrorDisabledFeature();
        return;
    }
    this.context.actionSetPendingSendCardCommand();
    this.context.actionOpenDialogMode();
    this.context.setState(new timapi.statemachine.states.WaitOpenDialogMode(this.context));
};
timapi.statemachine.states.WaitActivateServiceMenu = function (context) {
    timapi.statemachine.states.DefaultState.call(this, context);
};
timapi.statemachine.states.WaitActivateServiceMenu.prototype = Object.create(timapi.statemachine.states.DefaultState.prototype);
timapi.statemachine.states.WaitActivateServiceMenu.loggerName = "timapi.statemachine.states.WaitActivateServiceMenu";
timapi.statemachine.states.WaitActivateServiceMenu.classname = "WaitActivateServiceMenu";
timapi.statemachine.states.WaitActivateServiceMenu.logger = timapi.logging.Logger.getLogger(timapi.statemachine.states.WaitActivateServiceMenu.loggerName);
timapi.statemachine.states.WaitActivateServiceMenu.prototype.enterState = function () {
    timapi.statemachine.states.DefaultState.prototype.enterState.call(this);
    this.context.actionClearPendingEvent();
};
timapi.statemachine.states.WaitActivateServiceMenu.prototype.activate = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitActivateServiceMenu.prototype.applicationInformation = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitActivateServiceMenu.prototype.balance = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitActivateServiceMenu.prototype.cancel = function () {
    this.context.actionClearPendingCancel();
    this.context.actionCancel();
};
timapi.statemachine.states.WaitActivateServiceMenu.prototype.changeSettings = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitActivateServiceMenu.prototype.commit = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitActivateServiceMenu.prototype.connect = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitActivateServiceMenu.prototype.counterRequest = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitActivateServiceMenu.prototype.deactivate = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitActivateServiceMenu.prototype.disconnect = function () {
    this.context.actionSendErrorResponseDisconnect();
    this.context.actionClearPendingEvent();
    this.context.actionDisconnect();
    this.context.setState(new timapi.statemachine.states.Disconnected(this.context));
};
timapi.statemachine.states.WaitActivateServiceMenu.prototype.dccRates = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitActivateServiceMenu.prototype.hardwareInformation = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitActivateServiceMenu.prototype.initTransaction = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitActivateServiceMenu.prototype.login = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitActivateServiceMenu.prototype.logout = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitActivateServiceMenu.prototype.reboot = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitActivateServiceMenu.prototype.reconciliation = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitActivateServiceMenu.prototype.receiptRequest = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitActivateServiceMenu.prototype.reconfig = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitActivateServiceMenu.prototype.rollback = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitActivateServiceMenu.prototype.softwareUpdate = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitActivateServiceMenu.prototype.systemInformation = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitActivateServiceMenu.prototype.transaction = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitActivateServiceMenu.prototype.connected = function () {
};
timapi.statemachine.states.WaitActivateServiceMenu.prototype.connectFailed = function () {
    this.context.actionClearPendingEvent();
    this.context.setState(new timapi.statemachine.states.ErrorState(this.context));
};
timapi.statemachine.states.WaitActivateServiceMenu.prototype.responseRequest = function () {
    this.context.actionProcessResponseActivateServiceMenu();
    this.context.setState(new timapi.statemachine.states.CommandFinishedInClosed(this.context));
};
timapi.statemachine.states.WaitActivateServiceMenu.prototype.responseError = function () {
    this.context.actionClearPendingEvent();
    this.context.actionProcessResponseError();
    this.context.setState(new timapi.statemachine.states.CommandFinishedInClosed(this.context));
};
timapi.statemachine.states.WaitActivateServiceMenu.prototype.responseBusy = function () {
    this.context.actionClearPendingEvent();
    this.context.actionProcessResponseError();
    this.context.setState(new timapi.statemachine.states.CommandFinishedInClosed(this.context));
};
timapi.statemachine.states.WaitActivateServiceMenu.prototype.timeout = function () {
    this.context.actionErrorTimeout();
    this.context.setState(new timapi.statemachine.states.CommandFinishedInClosed(this.context));
};
timapi.statemachine.states.WaitActivateServiceMenu.prototype.keepAliveTimeout = function () {
    try {
        this.context.actionErrorConnectionLost();
        this.context.actionDisconnect();
        this.context.setState(new timapi.statemachine.states.Disconnected(this.context));
    }
    catch (e) {
        timapi.statemachine.states.WaitActivateServiceMenu.logger.log(timapi.logging.Level.severe, "Exception", e);
        this.context.setState(new timapi.statemachine.states.Disconnected(this.context));
    }
};
timapi.statemachine.states.WaitActivateServiceMenu.prototype.closeReader = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitActivateServiceMenu.prototype.openReader = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitActivateServiceMenu.prototype.ejectCard = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitActivateServiceMenu.prototype.openMaintenanceWindow = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitActivateServiceMenu.prototype.closeMaintenanceWindow = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitActivateServiceMenu.prototype.activateServiceMenu = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitActivateServiceMenu.prototype.balanceInquiry = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitActivateServiceMenu.prototype.openDialogMode = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitActivateServiceMenu.prototype.closeDialogMode = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitActivateServiceMenu.prototype.showSignatureCapture = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitActivateServiceMenu.prototype.showDialog = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitActivateServiceMenu.prototype.sendCardCommand = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitApplicationInformation = function (context) {
    timapi.statemachine.states.DefaultState.call(this, context);
};
timapi.statemachine.states.WaitApplicationInformation.prototype = Object.create(timapi.statemachine.states.DefaultState.prototype);
timapi.statemachine.states.WaitApplicationInformation.loggerName = "timapi.statemachine.states.WaitApplicationInformation";
timapi.statemachine.states.WaitApplicationInformation.classname = "WaitApplicationInformation";
timapi.statemachine.states.WaitApplicationInformation.logger = timapi.logging.Logger.getLogger(timapi.statemachine.states.WaitApplicationInformation.loggerName);
timapi.statemachine.states.WaitApplicationInformation.prototype.enterState = function () {
    timapi.statemachine.states.DefaultState.prototype.enterState.call(this);
    this.context.actionClearPendingEvent();
};
timapi.statemachine.states.WaitApplicationInformation.prototype.activate = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitApplicationInformation.prototype.applicationInformation = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitApplicationInformation.prototype.balance = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitApplicationInformation.prototype.cancel = function () {
    this.context.actionClearPendingCancel();
    this.context.actionCancel();
};
timapi.statemachine.states.WaitApplicationInformation.prototype.changeSettings = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitApplicationInformation.prototype.commit = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitApplicationInformation.prototype.connect = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitApplicationInformation.prototype.counterRequest = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitApplicationInformation.prototype.deactivate = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitApplicationInformation.prototype.disconnect = function () {
    this.context.actionSendErrorResponseDisconnect();
    this.context.actionClearPendingEvent();
    this.context.actionDisconnect();
    this.context.setState(new timapi.statemachine.states.Disconnected(this.context));
};
timapi.statemachine.states.WaitApplicationInformation.prototype.dccRates = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitApplicationInformation.prototype.hardwareInformation = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitApplicationInformation.prototype.initTransaction = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitApplicationInformation.prototype.login = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitApplicationInformation.prototype.logout = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitApplicationInformation.prototype.reboot = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitApplicationInformation.prototype.reconciliation = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitApplicationInformation.prototype.receiptRequest = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitApplicationInformation.prototype.reconfig = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitApplicationInformation.prototype.rollback = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitApplicationInformation.prototype.softwareUpdate = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitApplicationInformation.prototype.systemInformation = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitApplicationInformation.prototype.transaction = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitApplicationInformation.prototype.connected = function () {
};
timapi.statemachine.states.WaitApplicationInformation.prototype.connectFailed = function () {
    this.context.actionClearPendingEvent();
    this.context.setState(new timapi.statemachine.states.ErrorState(this.context));
};
timapi.statemachine.states.WaitApplicationInformation.prototype.responseRequest = function () {
    this.context.actionProcessResponseApplicationInformation();
    this.context.setState(new timapi.statemachine.states.CommandFinishedInClosed(this.context));
};
timapi.statemachine.states.WaitApplicationInformation.prototype.responseError = function () {
    this.context.actionClearPendingEvent();
    this.context.actionProcessResponseError();
    this.context.setState(new timapi.statemachine.states.CommandFinishedInClosed(this.context));
};
timapi.statemachine.states.WaitApplicationInformation.prototype.responseBusy = function () {
    this.context.actionClearPendingEvent();
    this.context.actionProcessResponseError();
    this.context.setState(new timapi.statemachine.states.CommandFinishedInClosed(this.context));
};
timapi.statemachine.states.WaitApplicationInformation.prototype.timeout = function () {
    this.context.actionErrorTimeout();
    this.context.setState(new timapi.statemachine.states.CommandFinishedInClosed(this.context));
};
timapi.statemachine.states.WaitApplicationInformation.prototype.keepAliveTimeout = function () {
    try {
        this.context.actionErrorConnectionLost();
        this.context.actionDisconnect();
        this.context.setState(new timapi.statemachine.states.Disconnected(this.context));
    }
    catch (e) {
        timapi.statemachine.states.WaitApplicationInformation.logger.log(timapi.logging.Level.severe, "Exception", e);
        this.context.setState(new timapi.statemachine.states.Disconnected(this.context));
    }
};
timapi.statemachine.states.WaitApplicationInformation.prototype.closeReader = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitApplicationInformation.prototype.openReader = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitApplicationInformation.prototype.ejectCard = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitApplicationInformation.prototype.openMaintenanceWindow = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitApplicationInformation.prototype.closeMaintenanceWindow = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitApplicationInformation.prototype.activateServiceMenu = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitApplicationInformation.prototype.balanceInquiry = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitApplicationInformation.prototype.openDialogMode = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitApplicationInformation.prototype.closeDialogMode = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitApplicationInformation.prototype.showSignatureCapture = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitApplicationInformation.prototype.showDialog = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitApplicationInformation.prototype.sendCardCommand = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitBalance = function (context) {
    timapi.statemachine.states.DefaultState.call(this, context);
};
timapi.statemachine.states.WaitBalance.prototype = Object.create(timapi.statemachine.states.DefaultState.prototype);
timapi.statemachine.states.WaitBalance.loggerName = "timapi.statemachine.states.WaitBalance";
timapi.statemachine.states.WaitBalance.classname = "WaitBalance";
timapi.statemachine.states.WaitBalance.logger = timapi.logging.Logger.getLogger(timapi.statemachine.states.WaitBalance.loggerName);
timapi.statemachine.states.WaitBalance.prototype.enterState = function () {
    timapi.statemachine.states.DefaultState.prototype.enterState.call(this);
    this.context.actionClearPendingEvent();
};
timapi.statemachine.states.WaitBalance.prototype.activate = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitBalance.prototype.applicationInformation = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitBalance.prototype.balance = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitBalance.prototype.cancel = function () {
    this.context.actionClearPendingCancel();
    this.context.actionCancel();
};
timapi.statemachine.states.WaitBalance.prototype.changeSettings = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitBalance.prototype.commit = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitBalance.prototype.connect = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitBalance.prototype.counterRequest = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitBalance.prototype.deactivate = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitBalance.prototype.disconnect = function () {
    this.context.actionSendErrorResponseDisconnect();
    this.context.actionClearPendingEvent();
    this.context.actionDisconnect();
    this.context.setState(new timapi.statemachine.states.Disconnected(this.context));
};
timapi.statemachine.states.WaitBalance.prototype.dccRates = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitBalance.prototype.hardwareInformation = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitBalance.prototype.initTransaction = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitBalance.prototype.login = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitBalance.prototype.logout = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitBalance.prototype.reboot = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitBalance.prototype.reconciliation = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitBalance.prototype.receiptRequest = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitBalance.prototype.reconfig = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitBalance.prototype.rollback = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitBalance.prototype.softwareUpdate = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitBalance.prototype.systemInformation = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitBalance.prototype.transaction = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitBalance.prototype.connected = function () {
};
timapi.statemachine.states.WaitBalance.prototype.connectFailed = function () {
    this.context.actionClearPendingEvent();
    this.context.setState(new timapi.statemachine.states.ErrorState(this.context));
};
timapi.statemachine.states.WaitBalance.prototype.responseRequest = function () {
    this.context.actionProcessResponseBalance();
    this.context.setState(new timapi.statemachine.states.CommandFinishedInClosed(this.context));
};
timapi.statemachine.states.WaitBalance.prototype.responseError = function () {
    this.context.actionClearPendingEvent();
    this.context.actionProcessResponseError();
    this.context.setState(new timapi.statemachine.states.CommandFinishedInClosed(this.context));
};
timapi.statemachine.states.WaitBalance.prototype.responseBusy = function () {
    this.context.actionClearPendingEvent();
    this.context.actionProcessResponseError();
    this.context.setState(new timapi.statemachine.states.CommandFinishedInClosed(this.context));
};
timapi.statemachine.states.WaitBalance.prototype.timeout = function () {
    this.context.actionErrorTimeout();
    this.context.setState(new timapi.statemachine.states.CommandFinishedInClosed(this.context));
};
timapi.statemachine.states.WaitBalance.prototype.keepAliveTimeout = function () {
    try {
        this.context.actionErrorConnectionLost();
        this.context.actionDisconnect();
        this.context.setState(new timapi.statemachine.states.Disconnected(this.context));
    }
    catch (e) {
        timapi.statemachine.states.WaitBalance.logger.log(timapi.logging.Level.severe, "Exception", e);
        this.context.setState(new timapi.statemachine.states.Disconnected(this.context));
    }
};
timapi.statemachine.states.WaitBalance.prototype.closeReader = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitBalance.prototype.openReader = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitBalance.prototype.ejectCard = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitBalance.prototype.openMaintenanceWindow = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitBalance.prototype.closeMaintenanceWindow = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitBalance.prototype.activateServiceMenu = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitBalance.prototype.balanceInquiry = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitBalance.prototype.openDialogMode = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitBalance.prototype.closeDialogMode = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitBalance.prototype.showSignatureCapture = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitBalance.prototype.showDialog = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitBalance.prototype.sendCardCommand = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitChangeSettings = function (context) {
    timapi.statemachine.states.DefaultState.call(this, context);
};
timapi.statemachine.states.WaitChangeSettings.prototype = Object.create(timapi.statemachine.states.DefaultState.prototype);
timapi.statemachine.states.WaitChangeSettings.loggerName = "timapi.statemachine.states.WaitChangeSettings";
timapi.statemachine.states.WaitChangeSettings.classname = "WaitChangeSettings";
timapi.statemachine.states.WaitChangeSettings.logger = timapi.logging.Logger.getLogger(timapi.statemachine.states.WaitChangeSettings.loggerName);
timapi.statemachine.states.WaitChangeSettings.prototype.enterState = function () {
    timapi.statemachine.states.DefaultState.prototype.enterState.call(this);
    this.context.actionClearPendingEvent();
};
timapi.statemachine.states.WaitChangeSettings.prototype.activate = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitChangeSettings.prototype.applicationInformation = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitChangeSettings.prototype.balance = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitChangeSettings.prototype.cancel = function () {
    this.context.actionClearPendingCancel();
    this.context.actionCancel();
};
timapi.statemachine.states.WaitChangeSettings.prototype.changeSettings = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitChangeSettings.prototype.commit = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitChangeSettings.prototype.connect = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitChangeSettings.prototype.counterRequest = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitChangeSettings.prototype.deactivate = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitChangeSettings.prototype.disconnect = function () {
    this.context.actionSendErrorResponseDisconnect();
    this.context.actionClearPendingEvent();
    this.context.actionDisconnect();
    this.context.setState(new timapi.statemachine.states.Disconnected(this.context));
};
timapi.statemachine.states.WaitChangeSettings.prototype.dccRates = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitChangeSettings.prototype.hardwareInformation = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitChangeSettings.prototype.initTransaction = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitChangeSettings.prototype.login = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitChangeSettings.prototype.logout = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitChangeSettings.prototype.reboot = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitChangeSettings.prototype.reconciliation = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitChangeSettings.prototype.receiptRequest = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitChangeSettings.prototype.reconfig = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitChangeSettings.prototype.rollback = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitChangeSettings.prototype.softwareUpdate = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitChangeSettings.prototype.systemInformation = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitChangeSettings.prototype.transaction = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitChangeSettings.prototype.connected = function () {
};
timapi.statemachine.states.WaitChangeSettings.prototype.connectFailed = function () {
    this.context.actionClearPendingEvent();
    this.context.setState(new timapi.statemachine.states.ErrorState(this.context));
};
timapi.statemachine.states.WaitChangeSettings.prototype.responseRequest = function () {
    this.context.actionProcessResponseChangeSettings();
    this.context.setState(new timapi.statemachine.states.CommandFinishedInClosed(this.context));
};
timapi.statemachine.states.WaitChangeSettings.prototype.responseError = function () {
    this.context.actionClearPendingEvent();
    this.context.actionProcessResponseError();
    this.context.setState(new timapi.statemachine.states.CommandFinishedInClosed(this.context));
};
timapi.statemachine.states.WaitChangeSettings.prototype.responseBusy = function () {
    this.context.actionClearPendingEvent();
    this.context.actionProcessResponseError();
    this.context.setState(new timapi.statemachine.states.CommandFinishedInClosed(this.context));
};
timapi.statemachine.states.WaitChangeSettings.prototype.timeout = function () {
    this.context.actionErrorTimeout();
    this.context.setState(new timapi.statemachine.states.CommandFinishedInClosed(this.context));
};
timapi.statemachine.states.WaitChangeSettings.prototype.keepAliveTimeout = function () {
    try {
        this.context.actionErrorConnectionLost();
        this.context.actionDisconnect();
        this.context.setState(new timapi.statemachine.states.Disconnected(this.context));
    }
    catch (e) {
        timapi.statemachine.states.WaitChangeSettings.logger.log(timapi.logging.Level.severe, "Exception", e);
        this.context.setState(new timapi.statemachine.states.Disconnected(this.context));
    }
};
timapi.statemachine.states.WaitChangeSettings.prototype.closeReader = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitChangeSettings.prototype.openReader = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitChangeSettings.prototype.ejectCard = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitChangeSettings.prototype.openMaintenanceWindow = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitChangeSettings.prototype.closeMaintenanceWindow = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitChangeSettings.prototype.activateServiceMenu = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitChangeSettings.prototype.balanceInquiry = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitChangeSettings.prototype.openDialogMode = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitChangeSettings.prototype.closeDialogMode = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitChangeSettings.prototype.showSignatureCapture = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitChangeSettings.prototype.showDialog = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitChangeSettings.prototype.sendCardCommand = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitCloseDialogMode = function (context) {
    timapi.statemachine.states.DefaultState.call(this, context);
};
timapi.statemachine.states.WaitCloseDialogMode.prototype = Object.create(timapi.statemachine.states.DefaultState.prototype);
timapi.statemachine.states.WaitCloseDialogMode.loggerName = "timapi.statemachine.states.WaitCloseDialogMode";
timapi.statemachine.states.WaitCloseDialogMode.classname = "WaitCloseDialogMode";
timapi.statemachine.states.WaitCloseDialogMode.logger = timapi.logging.Logger.getLogger(timapi.statemachine.states.WaitCloseDialogMode.loggerName);
timapi.statemachine.states.WaitCloseDialogMode.prototype.enterState = function () {
    timapi.statemachine.states.DefaultState.prototype.enterState.call(this);
};
timapi.statemachine.states.WaitCloseDialogMode.prototype.activate = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitCloseDialogMode.prototype.applicationInformation = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitCloseDialogMode.prototype.balance = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitCloseDialogMode.prototype.cancel = function () {
    this.context.actionClearPendingCancel();
    this.context.actionCancel();
};
timapi.statemachine.states.WaitCloseDialogMode.prototype.changeSettings = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitCloseDialogMode.prototype.commit = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitCloseDialogMode.prototype.connect = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitCloseDialogMode.prototype.counterRequest = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitCloseDialogMode.prototype.deactivate = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitCloseDialogMode.prototype.disconnect = function () {
    this.context.actionSendErrorResponseDisconnect();
    this.context.actionClearPendingEvent();
    this.context.actionDisconnect();
    this.context.setState(new timapi.statemachine.states.Disconnected(this.context));
};
timapi.statemachine.states.WaitCloseDialogMode.prototype.dccRates = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitCloseDialogMode.prototype.hardwareInformation = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitCloseDialogMode.prototype.initTransaction = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitCloseDialogMode.prototype.login = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitCloseDialogMode.prototype.logout = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitCloseDialogMode.prototype.reboot = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitCloseDialogMode.prototype.reconciliation = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitCloseDialogMode.prototype.receiptRequest = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitCloseDialogMode.prototype.reconfig = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitCloseDialogMode.prototype.rollback = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitCloseDialogMode.prototype.softwareUpdate = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitCloseDialogMode.prototype.systemInformation = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitCloseDialogMode.prototype.transaction = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitCloseDialogMode.prototype.connected = function () {
};
timapi.statemachine.states.WaitCloseDialogMode.prototype.connectFailed = function () {
    this.context.actionClearPendingEvent();
    this.context.setState(new timapi.statemachine.states.ErrorState(this.context));
};
timapi.statemachine.states.WaitCloseDialogMode.prototype.responseRequest = function () {
    if (this.context.conditionIsEnabledAutoDeactivate()
        && !this.context.conditionHasPendingEvent()) {
        this.context.actionProcessResponseCloseDialogMode();
        this.context.actionDeactivate();
        this.context.setState(new timapi.statemachine.states.Deactivating(this.context));
        return;
    }
    this.context.actionProcessResponseCloseDialogMode();
    this.context.setState(new timapi.statemachine.states.Open(this.context));
};
timapi.statemachine.states.WaitCloseDialogMode.prototype.responseError = function () {
    this.context.actionClearPendingEvent();
    this.context.actionProcessResponseError();
    this.context.setState(new timapi.statemachine.states.DialogMode(this.context));
};
timapi.statemachine.states.WaitCloseDialogMode.prototype.responseBusy = function () {
    this.context.actionClearPendingEvent();
    this.context.actionProcessResponseError();
    this.context.setState(new timapi.statemachine.states.DialogMode(this.context));
};
timapi.statemachine.states.WaitCloseDialogMode.prototype.timeout = function () {
    this.context.actionErrorTimeout();
    this.context.setState(new timapi.statemachine.states.DialogMode(this.context));
};
timapi.statemachine.states.WaitCloseDialogMode.prototype.keepAliveTimeout = function () {
    try {
        this.context.actionErrorConnectionLost();
        this.context.actionDisconnect();
        this.context.setState(new timapi.statemachine.states.Disconnected(this.context));
    }
    catch (e) {
        timapi.statemachine.states.WaitCloseDialogMode.logger.log(timapi.logging.Level.severe, "Exception", e);
        this.context.setState(new timapi.statemachine.states.Disconnected(this.context));
    }
};
timapi.statemachine.states.WaitCloseDialogMode.prototype.closeReader = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitCloseDialogMode.prototype.openReader = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitCloseDialogMode.prototype.ejectCard = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitCloseDialogMode.prototype.openMaintenanceWindow = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitCloseDialogMode.prototype.closeMaintenanceWindow = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitCloseDialogMode.prototype.activateServiceMenu = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitCloseDialogMode.prototype.balanceInquiry = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitCloseDialogMode.prototype.openDialogMode = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitCloseDialogMode.prototype.closeDialogMode = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitCloseDialogMode.prototype.showSignatureCapture = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitCloseDialogMode.prototype.showDialog = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitCloseDialogMode.prototype.sendCardCommand = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitCloseMaintenanceWindow = function (context) {
    timapi.statemachine.states.DefaultState.call(this, context);
};
timapi.statemachine.states.WaitCloseMaintenanceWindow.prototype = Object.create(timapi.statemachine.states.DefaultState.prototype);
timapi.statemachine.states.WaitCloseMaintenanceWindow.loggerName = "timapi.statemachine.states.WaitCloseMaintenanceWindow";
timapi.statemachine.states.WaitCloseMaintenanceWindow.classname = "WaitCloseMaintenanceWindow";
timapi.statemachine.states.WaitCloseMaintenanceWindow.logger = timapi.logging.Logger.getLogger(timapi.statemachine.states.WaitCloseMaintenanceWindow.loggerName);
timapi.statemachine.states.WaitCloseMaintenanceWindow.prototype.enterState = function () {
    timapi.statemachine.states.DefaultState.prototype.enterState.call(this);
    this.context.actionClearPendingEvent();
};
timapi.statemachine.states.WaitCloseMaintenanceWindow.prototype.activate = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitCloseMaintenanceWindow.prototype.applicationInformation = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitCloseMaintenanceWindow.prototype.balance = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitCloseMaintenanceWindow.prototype.cancel = function () {
    this.context.actionClearPendingCancel();
    this.context.actionCancel();
};
timapi.statemachine.states.WaitCloseMaintenanceWindow.prototype.changeSettings = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitCloseMaintenanceWindow.prototype.commit = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitCloseMaintenanceWindow.prototype.connect = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitCloseMaintenanceWindow.prototype.counterRequest = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitCloseMaintenanceWindow.prototype.deactivate = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitCloseMaintenanceWindow.prototype.disconnect = function () {
    this.context.actionSendErrorResponseDisconnect();
    this.context.actionClearPendingEvent();
    this.context.actionDisconnect();
    this.context.setState(new timapi.statemachine.states.Disconnected(this.context));
};
timapi.statemachine.states.WaitCloseMaintenanceWindow.prototype.dccRates = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitCloseMaintenanceWindow.prototype.hardwareInformation = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitCloseMaintenanceWindow.prototype.initTransaction = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitCloseMaintenanceWindow.prototype.login = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitCloseMaintenanceWindow.prototype.logout = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitCloseMaintenanceWindow.prototype.reboot = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitCloseMaintenanceWindow.prototype.reconciliation = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitCloseMaintenanceWindow.prototype.receiptRequest = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitCloseMaintenanceWindow.prototype.reconfig = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitCloseMaintenanceWindow.prototype.rollback = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitCloseMaintenanceWindow.prototype.softwareUpdate = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitCloseMaintenanceWindow.prototype.systemInformation = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitCloseMaintenanceWindow.prototype.transaction = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitCloseMaintenanceWindow.prototype.connected = function () {
};
timapi.statemachine.states.WaitCloseMaintenanceWindow.prototype.connectFailed = function () {
    this.context.actionClearPendingEvent();
    this.context.setState(new timapi.statemachine.states.ErrorState(this.context));
};
timapi.statemachine.states.WaitCloseMaintenanceWindow.prototype.responseRequest = function () {
    this.context.actionProcessResponseCloseMaintenanceWindow();
    this.context.setState(new timapi.statemachine.states.CommandFinishedInClosed(this.context));
};
timapi.statemachine.states.WaitCloseMaintenanceWindow.prototype.responseError = function () {
    this.context.actionClearPendingEvent();
    this.context.actionProcessResponseError();
    this.context.setState(new timapi.statemachine.states.CommandFinishedInClosed(this.context));
};
timapi.statemachine.states.WaitCloseMaintenanceWindow.prototype.responseBusy = function () {
    this.context.actionClearPendingEvent();
    this.context.actionProcessResponseError();
    this.context.setState(new timapi.statemachine.states.CommandFinishedInClosed(this.context));
};
timapi.statemachine.states.WaitCloseMaintenanceWindow.prototype.timeout = function () {
    this.context.actionErrorTimeout();
    this.context.setState(new timapi.statemachine.states.CommandFinishedInClosed(this.context));
};
timapi.statemachine.states.WaitCloseMaintenanceWindow.prototype.keepAliveTimeout = function () {
    try {
        this.context.actionErrorConnectionLost();
        this.context.actionDisconnect();
        this.context.setState(new timapi.statemachine.states.Disconnected(this.context));
    }
    catch (e) {
        timapi.statemachine.states.WaitCloseMaintenanceWindow.logger.log(timapi.logging.Level.severe, "Exception", e);
        this.context.setState(new timapi.statemachine.states.Disconnected(this.context));
    }
};
timapi.statemachine.states.WaitCloseMaintenanceWindow.prototype.closeReader = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitCloseMaintenanceWindow.prototype.openReader = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitCloseMaintenanceWindow.prototype.ejectCard = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitCloseMaintenanceWindow.prototype.openMaintenanceWindow = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitCloseMaintenanceWindow.prototype.closeMaintenanceWindow = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitCloseMaintenanceWindow.prototype.activateServiceMenu = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitCloseMaintenanceWindow.prototype.balanceInquiry = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitCloseMaintenanceWindow.prototype.openDialogMode = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitCloseMaintenanceWindow.prototype.closeDialogMode = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitCloseMaintenanceWindow.prototype.showSignatureCapture = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitCloseMaintenanceWindow.prototype.showDialog = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitCloseMaintenanceWindow.prototype.sendCardCommand = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitCloseReader = function (context) {
    timapi.statemachine.states.DefaultState.call(this, context);
};
timapi.statemachine.states.WaitCloseReader.prototype = Object.create(timapi.statemachine.states.DefaultState.prototype);
timapi.statemachine.states.WaitCloseReader.loggerName = "timapi.statemachine.states.WaitCloseReader";
timapi.statemachine.states.WaitCloseReader.classname = "WaitCloseReader";
timapi.statemachine.states.WaitCloseReader.logger = timapi.logging.Logger.getLogger(timapi.statemachine.states.WaitCloseReader.loggerName);
timapi.statemachine.states.WaitCloseReader.prototype.enterState = function () {
    timapi.statemachine.states.DefaultState.prototype.enterState.call(this);
    this.context.actionClearPendingEvent();
};
timapi.statemachine.states.WaitCloseReader.prototype.activate = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitCloseReader.prototype.applicationInformation = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitCloseReader.prototype.balance = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitCloseReader.prototype.cancel = function () {
    this.context.actionClearPendingCancel();
    this.context.actionCancel();
};
timapi.statemachine.states.WaitCloseReader.prototype.changeSettings = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitCloseReader.prototype.commit = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitCloseReader.prototype.connect = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitCloseReader.prototype.counterRequest = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitCloseReader.prototype.deactivate = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitCloseReader.prototype.disconnect = function () {
    this.context.actionSendErrorResponseDisconnect();
    this.context.actionClearPendingEvent();
    this.context.actionDisconnect();
    this.context.setState(new timapi.statemachine.states.Disconnected(this.context));
};
timapi.statemachine.states.WaitCloseReader.prototype.dccRates = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitCloseReader.prototype.hardwareInformation = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitCloseReader.prototype.initTransaction = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitCloseReader.prototype.login = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitCloseReader.prototype.logout = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitCloseReader.prototype.reboot = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitCloseReader.prototype.reconciliation = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitCloseReader.prototype.receiptRequest = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitCloseReader.prototype.reconfig = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitCloseReader.prototype.rollback = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitCloseReader.prototype.softwareUpdate = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitCloseReader.prototype.systemInformation = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitCloseReader.prototype.transaction = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitCloseReader.prototype.connected = function () {
};
timapi.statemachine.states.WaitCloseReader.prototype.connectFailed = function () {
    this.context.actionClearPendingEvent();
    this.context.setState(new timapi.statemachine.states.ErrorState(this.context));
};
timapi.statemachine.states.WaitCloseReader.prototype.responseRequest = function () {
    this.context.actionProcessResponseCloseReader();
    this.context.setState(new timapi.statemachine.states.CommandFinishedInOpen(this.context));
};
timapi.statemachine.states.WaitCloseReader.prototype.responseError = function () {
    this.context.actionClearPendingEvent();
    this.context.actionProcessResponseError();
    this.context.setState(new timapi.statemachine.states.CommandFinishedInOpen(this.context));
};
timapi.statemachine.states.WaitCloseReader.prototype.responseBusy = function () {
    this.context.actionClearPendingEvent();
    this.context.actionProcessResponseError();
    this.context.setState(new timapi.statemachine.states.CommandFinishedInOpen(this.context));
};
timapi.statemachine.states.WaitCloseReader.prototype.timeout = function () {
    this.context.actionErrorTimeout();
    this.context.setState(new timapi.statemachine.states.CommandFinishedInOpen(this.context));
};
timapi.statemachine.states.WaitCloseReader.prototype.keepAliveTimeout = function () {
    try {
        this.context.actionErrorConnectionLost();
        this.context.actionDisconnect();
        this.context.setState(new timapi.statemachine.states.Disconnected(this.context));
    }
    catch (e) {
        timapi.statemachine.states.WaitCloseReader.logger.log(timapi.logging.Level.severe, "Exception", e);
        this.context.setState(new timapi.statemachine.states.Disconnected(this.context));
    }
};
timapi.statemachine.states.WaitCloseReader.prototype.closeReader = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitCloseReader.prototype.openReader = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitCloseReader.prototype.ejectCard = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitCloseReader.prototype.openMaintenanceWindow = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitCloseReader.prototype.closeMaintenanceWindow = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitCloseReader.prototype.activateServiceMenu = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitCloseReader.prototype.balanceInquiry = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitCloseReader.prototype.openDialogMode = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitCloseReader.prototype.closeDialogMode = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitCloseReader.prototype.showSignatureCapture = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitCloseReader.prototype.showDialog = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitCloseReader.prototype.sendCardCommand = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitCommit = function (context) {
    timapi.statemachine.states.DefaultState.call(this, context);
};
timapi.statemachine.states.WaitCommit.prototype = Object.create(timapi.statemachine.states.DefaultState.prototype);
timapi.statemachine.states.WaitCommit.loggerName = "timapi.statemachine.states.WaitCommit";
timapi.statemachine.states.WaitCommit.classname = "WaitCommit";
timapi.statemachine.states.WaitCommit.logger = timapi.logging.Logger.getLogger(timapi.statemachine.states.WaitCommit.loggerName);
timapi.statemachine.states.WaitCommit.prototype.enterState = function () {
    timapi.statemachine.states.DefaultState.prototype.enterState.call(this);
    this.context.actionClearPendingEvent();
    this.context.actionArmTimeoutRequest();
};
timapi.statemachine.states.WaitCommit.prototype.activate = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitCommit.prototype.applicationInformation = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitCommit.prototype.balance = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitCommit.prototype.cancel = function () {
    this.context.actionClearPendingCancel();
    this.context.actionCancel();
};
timapi.statemachine.states.WaitCommit.prototype.changeSettings = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitCommit.prototype.commit = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitCommit.prototype.connect = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitCommit.prototype.counterRequest = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitCommit.prototype.deactivate = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitCommit.prototype.disconnect = function () {
    this.context.actionSendErrorResponseDisconnect();
    this.context.actionClearPendingEvent();
    this.context.actionDisconnect();
    this.context.setState(new timapi.statemachine.states.Disconnected(this.context));
};
timapi.statemachine.states.WaitCommit.prototype.dccRates = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitCommit.prototype.hardwareInformation = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitCommit.prototype.initTransaction = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitCommit.prototype.login = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitCommit.prototype.logout = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitCommit.prototype.reboot = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitCommit.prototype.reconciliation = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitCommit.prototype.receiptRequest = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitCommit.prototype.reconfig = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitCommit.prototype.rollback = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitCommit.prototype.softwareUpdate = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitCommit.prototype.systemInformation = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitCommit.prototype.transaction = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitCommit.prototype.connected = function () {
};
timapi.statemachine.states.WaitCommit.prototype.connectFailed = function () {
    this.context.actionClearPendingEvent();
    this.context.setState(new timapi.statemachine.states.ErrorState(this.context));
};
timapi.statemachine.states.WaitCommit.prototype.responseRequest = function () {
    this.context.actionProcessResponseCommit();
    this.context.setState(new timapi.statemachine.states.CommandFinishedInOpen(this.context));
};
timapi.statemachine.states.WaitCommit.prototype.responseError = function () {
    this.context.actionClearPendingEvent();
    this.context.actionProcessResponseError();
    this.context.setState(new timapi.statemachine.states.CommandFinishedInOpen(this.context));
};
timapi.statemachine.states.WaitCommit.prototype.responseBusy = function () {
    this.context.actionClearPendingEvent();
    this.context.actionProcessResponseError();
    this.context.setState(new timapi.statemachine.states.CommandFinishedInOpen(this.context));
};
timapi.statemachine.states.WaitCommit.prototype.timeout = function () {
    if (this.context.conditionCanRepeatRequest()) {
        this.context.actionRepeatRequest();
        this.context.setState(new timapi.statemachine.states.WaitCommit(this.context));
        return;
    }
    this.context.actionErrorTimeout();
    this.context.setState(new timapi.statemachine.states.CommandFinishedInOpen(this.context));
};
timapi.statemachine.states.WaitCommit.prototype.keepAliveTimeout = function () {
    try {
        this.context.actionErrorConnectionLost();
        this.context.actionDisconnect();
        this.context.setState(new timapi.statemachine.states.Disconnected(this.context));
    }
    catch (e) {
        timapi.statemachine.states.WaitCommit.logger.log(timapi.logging.Level.severe, "Exception", e);
        this.context.setState(new timapi.statemachine.states.Disconnected(this.context));
    }
};
timapi.statemachine.states.WaitCommit.prototype.closeReader = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitCommit.prototype.openReader = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitCommit.prototype.ejectCard = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitCommit.prototype.openMaintenanceWindow = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitCommit.prototype.closeMaintenanceWindow = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitCommit.prototype.activateServiceMenu = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitCommit.prototype.balanceInquiry = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitCommit.prototype.openDialogMode = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitCommit.prototype.closeDialogMode = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitCommit.prototype.showSignatureCapture = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitCommit.prototype.showDialog = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitCommit.prototype.sendCardCommand = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitCounterRequest = function (context) {
    timapi.statemachine.states.DefaultState.call(this, context);
};
timapi.statemachine.states.WaitCounterRequest.prototype = Object.create(timapi.statemachine.states.DefaultState.prototype);
timapi.statemachine.states.WaitCounterRequest.loggerName = "timapi.statemachine.states.WaitCounterRequest";
timapi.statemachine.states.WaitCounterRequest.classname = "WaitCounterRequest";
timapi.statemachine.states.WaitCounterRequest.logger = timapi.logging.Logger.getLogger(timapi.statemachine.states.WaitCounterRequest.loggerName);
timapi.statemachine.states.WaitCounterRequest.prototype.enterState = function () {
    timapi.statemachine.states.DefaultState.prototype.enterState.call(this);
    this.context.actionClearPendingEvent();
};
timapi.statemachine.states.WaitCounterRequest.prototype.activate = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitCounterRequest.prototype.applicationInformation = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitCounterRequest.prototype.balance = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitCounterRequest.prototype.cancel = function () {
    this.context.actionClearPendingCancel();
    this.context.actionCancel();
};
timapi.statemachine.states.WaitCounterRequest.prototype.changeSettings = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitCounterRequest.prototype.commit = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitCounterRequest.prototype.connect = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitCounterRequest.prototype.counterRequest = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitCounterRequest.prototype.deactivate = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitCounterRequest.prototype.disconnect = function () {
    this.context.actionSendErrorResponseDisconnect();
    this.context.actionClearPendingEvent();
    this.context.actionDisconnect();
    this.context.setState(new timapi.statemachine.states.Disconnected(this.context));
};
timapi.statemachine.states.WaitCounterRequest.prototype.dccRates = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitCounterRequest.prototype.hardwareInformation = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitCounterRequest.prototype.initTransaction = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitCounterRequest.prototype.login = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitCounterRequest.prototype.logout = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitCounterRequest.prototype.reboot = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitCounterRequest.prototype.reconciliation = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitCounterRequest.prototype.receiptRequest = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitCounterRequest.prototype.reconfig = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitCounterRequest.prototype.rollback = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitCounterRequest.prototype.softwareUpdate = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitCounterRequest.prototype.systemInformation = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitCounterRequest.prototype.transaction = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitCounterRequest.prototype.connected = function () {
};
timapi.statemachine.states.WaitCounterRequest.prototype.connectFailed = function () {
    this.context.actionClearPendingEvent();
    this.context.setState(new timapi.statemachine.states.ErrorState(this.context));
};
timapi.statemachine.states.WaitCounterRequest.prototype.responseRequest = function () {
    this.context.actionProcessResponseCounterRequest();
    this.context.setState(new timapi.statemachine.states.CommandFinishedInOpen(this.context));
};
timapi.statemachine.states.WaitCounterRequest.prototype.responseError = function () {
    this.context.actionClearPendingEvent();
    this.context.actionProcessResponseError();
    this.context.setState(new timapi.statemachine.states.CommandFinishedInOpen(this.context));
};
timapi.statemachine.states.WaitCounterRequest.prototype.responseBusy = function () {
    this.context.actionClearPendingEvent();
    this.context.actionProcessResponseError();
    this.context.setState(new timapi.statemachine.states.CommandFinishedInOpen(this.context));
};
timapi.statemachine.states.WaitCounterRequest.prototype.timeout = function () {
    this.context.actionErrorTimeout();
    this.context.setState(new timapi.statemachine.states.CommandFinishedInOpen(this.context));
};
timapi.statemachine.states.WaitCounterRequest.prototype.keepAliveTimeout = function () {
    try {
        this.context.actionErrorConnectionLost();
        this.context.actionDisconnect();
        this.context.setState(new timapi.statemachine.states.Disconnected(this.context));
    }
    catch (e) {
        timapi.statemachine.states.WaitCounterRequest.logger.log(timapi.logging.Level.severe, "Exception", e);
        this.context.setState(new timapi.statemachine.states.Disconnected(this.context));
    }
};
timapi.statemachine.states.WaitCounterRequest.prototype.closeReader = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitCounterRequest.prototype.openReader = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitCounterRequest.prototype.ejectCard = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitCounterRequest.prototype.openMaintenanceWindow = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitCounterRequest.prototype.closeMaintenanceWindow = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitCounterRequest.prototype.activateServiceMenu = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitCounterRequest.prototype.balanceInquiry = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitCounterRequest.prototype.openDialogMode = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitCounterRequest.prototype.closeDialogMode = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitCounterRequest.prototype.showSignatureCapture = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitCounterRequest.prototype.showDialog = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitCounterRequest.prototype.sendCardCommand = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitDccRates = function (context) {
    timapi.statemachine.states.DefaultState.call(this, context);
};
timapi.statemachine.states.WaitDccRates.prototype = Object.create(timapi.statemachine.states.DefaultState.prototype);
timapi.statemachine.states.WaitDccRates.loggerName = "timapi.statemachine.states.WaitDccRates";
timapi.statemachine.states.WaitDccRates.classname = "WaitDccRates";
timapi.statemachine.states.WaitDccRates.logger = timapi.logging.Logger.getLogger(timapi.statemachine.states.WaitDccRates.loggerName);
timapi.statemachine.states.WaitDccRates.prototype.enterState = function () {
    timapi.statemachine.states.DefaultState.prototype.enterState.call(this);
    this.context.actionClearPendingEvent();
};
timapi.statemachine.states.WaitDccRates.prototype.activate = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitDccRates.prototype.applicationInformation = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitDccRates.prototype.balance = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitDccRates.prototype.cancel = function () {
    this.context.actionClearPendingCancel();
    this.context.actionCancel();
};
timapi.statemachine.states.WaitDccRates.prototype.changeSettings = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitDccRates.prototype.commit = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitDccRates.prototype.connect = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitDccRates.prototype.counterRequest = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitDccRates.prototype.deactivate = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitDccRates.prototype.disconnect = function () {
    this.context.actionSendErrorResponseDisconnect();
    this.context.actionClearPendingEvent();
    this.context.actionDisconnect();
    this.context.setState(new timapi.statemachine.states.Disconnected(this.context));
};
timapi.statemachine.states.WaitDccRates.prototype.dccRates = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitDccRates.prototype.hardwareInformation = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitDccRates.prototype.initTransaction = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitDccRates.prototype.login = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitDccRates.prototype.logout = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitDccRates.prototype.reboot = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitDccRates.prototype.reconciliation = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitDccRates.prototype.receiptRequest = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitDccRates.prototype.reconfig = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitDccRates.prototype.rollback = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitDccRates.prototype.softwareUpdate = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitDccRates.prototype.systemInformation = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitDccRates.prototype.transaction = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitDccRates.prototype.connected = function () {
};
timapi.statemachine.states.WaitDccRates.prototype.connectFailed = function () {
    this.context.actionClearPendingEvent();
    this.context.setState(new timapi.statemachine.states.ErrorState(this.context));
};
timapi.statemachine.states.WaitDccRates.prototype.responseRequest = function () {
    this.context.actionProcessResponseDccRates();
    this.context.setState(new timapi.statemachine.states.CommandFinishedInClosed(this.context));
};
timapi.statemachine.states.WaitDccRates.prototype.responseError = function () {
    this.context.actionClearPendingEvent();
    this.context.actionProcessResponseError();
    this.context.setState(new timapi.statemachine.states.CommandFinishedInClosed(this.context));
};
timapi.statemachine.states.WaitDccRates.prototype.responseBusy = function () {
    this.context.actionClearPendingEvent();
    this.context.actionProcessResponseError();
    this.context.setState(new timapi.statemachine.states.CommandFinishedInClosed(this.context));
};
timapi.statemachine.states.WaitDccRates.prototype.timeout = function () {
    this.context.actionErrorTimeout();
    this.context.setState(new timapi.statemachine.states.CommandFinishedInClosed(this.context));
};
timapi.statemachine.states.WaitDccRates.prototype.keepAliveTimeout = function () {
    try {
        this.context.actionErrorConnectionLost();
        this.context.actionDisconnect();
        this.context.setState(new timapi.statemachine.states.Disconnected(this.context));
    }
    catch (e) {
        timapi.statemachine.states.WaitDccRates.logger.log(timapi.logging.Level.severe, "Exception", e);
        this.context.setState(new timapi.statemachine.states.Disconnected(this.context));
    }
};
timapi.statemachine.states.WaitDccRates.prototype.closeReader = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitDccRates.prototype.openReader = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitDccRates.prototype.ejectCard = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitDccRates.prototype.openMaintenanceWindow = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitDccRates.prototype.closeMaintenanceWindow = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitDccRates.prototype.activateServiceMenu = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitDccRates.prototype.balanceInquiry = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitDccRates.prototype.openDialogMode = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitDccRates.prototype.closeDialogMode = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitDccRates.prototype.showSignatureCapture = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitDccRates.prototype.showDialog = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitDccRates.prototype.sendCardCommand = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitEjectCard = function (context) {
    timapi.statemachine.states.DefaultState.call(this, context);
};
timapi.statemachine.states.WaitEjectCard.prototype = Object.create(timapi.statemachine.states.DefaultState.prototype);
timapi.statemachine.states.WaitEjectCard.loggerName = "timapi.statemachine.states.WaitEjectCard";
timapi.statemachine.states.WaitEjectCard.classname = "WaitEjectCard";
timapi.statemachine.states.WaitEjectCard.logger = timapi.logging.Logger.getLogger(timapi.statemachine.states.WaitEjectCard.loggerName);
timapi.statemachine.states.WaitEjectCard.prototype.enterState = function () {
    timapi.statemachine.states.DefaultState.prototype.enterState.call(this);
    this.context.actionClearPendingEvent();
};
timapi.statemachine.states.WaitEjectCard.prototype.activate = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitEjectCard.prototype.applicationInformation = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitEjectCard.prototype.balance = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitEjectCard.prototype.cancel = function () {
    this.context.actionClearPendingCancel();
    this.context.actionCancel();
};
timapi.statemachine.states.WaitEjectCard.prototype.changeSettings = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitEjectCard.prototype.commit = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitEjectCard.prototype.connect = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitEjectCard.prototype.counterRequest = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitEjectCard.prototype.deactivate = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitEjectCard.prototype.disconnect = function () {
    this.context.actionSendErrorResponseDisconnect();
    this.context.actionClearPendingEvent();
    this.context.actionDisconnect();
    this.context.setState(new timapi.statemachine.states.Disconnected(this.context));
};
timapi.statemachine.states.WaitEjectCard.prototype.dccRates = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitEjectCard.prototype.hardwareInformation = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitEjectCard.prototype.initTransaction = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitEjectCard.prototype.login = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitEjectCard.prototype.logout = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitEjectCard.prototype.reboot = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitEjectCard.prototype.reconciliation = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitEjectCard.prototype.receiptRequest = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitEjectCard.prototype.reconfig = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitEjectCard.prototype.rollback = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitEjectCard.prototype.softwareUpdate = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitEjectCard.prototype.systemInformation = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitEjectCard.prototype.transaction = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitEjectCard.prototype.connected = function () {
};
timapi.statemachine.states.WaitEjectCard.prototype.connectFailed = function () {
    this.context.actionClearPendingEvent();
    this.context.setState(new timapi.statemachine.states.ErrorState(this.context));
};
timapi.statemachine.states.WaitEjectCard.prototype.responseRequest = function () {
    this.context.actionProcessResponseEjectCard();
    this.context.setState(new timapi.statemachine.states.CommandFinishedInOpen(this.context));
};
timapi.statemachine.states.WaitEjectCard.prototype.responseError = function () {
    this.context.actionClearPendingEvent();
    this.context.actionProcessResponseError();
    this.context.setState(new timapi.statemachine.states.CommandFinishedInOpen(this.context));
};
timapi.statemachine.states.WaitEjectCard.prototype.responseBusy = function () {
    this.context.actionClearPendingEvent();
    this.context.actionProcessResponseError();
    this.context.setState(new timapi.statemachine.states.CommandFinishedInOpen(this.context));
};
timapi.statemachine.states.WaitEjectCard.prototype.timeout = function () {
    this.context.actionErrorTimeout();
    this.context.setState(new timapi.statemachine.states.CommandFinishedInOpen(this.context));
};
timapi.statemachine.states.WaitEjectCard.prototype.keepAliveTimeout = function () {
    try {
        this.context.actionErrorConnectionLost();
        this.context.actionDisconnect();
        this.context.setState(new timapi.statemachine.states.Disconnected(this.context));
    }
    catch (e) {
        timapi.statemachine.states.WaitEjectCard.logger.log(timapi.logging.Level.severe, "Exception", e);
        this.context.setState(new timapi.statemachine.states.Disconnected(this.context));
    }
};
timapi.statemachine.states.WaitEjectCard.prototype.closeReader = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitEjectCard.prototype.openReader = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitEjectCard.prototype.ejectCard = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitEjectCard.prototype.openMaintenanceWindow = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitEjectCard.prototype.closeMaintenanceWindow = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitEjectCard.prototype.activateServiceMenu = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitEjectCard.prototype.balanceInquiry = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitEjectCard.prototype.openDialogMode = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitEjectCard.prototype.closeDialogMode = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitEjectCard.prototype.showSignatureCapture = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitEjectCard.prototype.showDialog = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitEjectCard.prototype.sendCardCommand = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitForCommit = function (context) {
    timapi.statemachine.states.DefaultState.call(this, context);
};
timapi.statemachine.states.WaitForCommit.prototype = Object.create(timapi.statemachine.states.DefaultState.prototype);
timapi.statemachine.states.WaitForCommit.loggerName = "timapi.statemachine.states.WaitForCommit";
timapi.statemachine.states.WaitForCommit.classname = "WaitForCommit";
timapi.statemachine.states.WaitForCommit.logger = timapi.logging.Logger.getLogger(timapi.statemachine.states.WaitForCommit.loggerName);
timapi.statemachine.states.WaitForCommit.prototype.enterState = function () {
    timapi.statemachine.states.DefaultState.prototype.enterState.call(this);
    this.context.actionCancelTimeout();
    if (this.context.conditionIsEnabledAutoCommit()
        && !this.context.conditionMandatoryFeatureAutoCommit()
        && !this.context.conditionSupportedFeatureAutoCommit()) {
        this.context.actionCommit();
        this.context.setState(new timapi.statemachine.states.WaitCommit(this.context));
        return;
    }
    if (this.context.conditionIsEnabledAutoCommit()) {
        this.context.setState(new timapi.statemachine.states.CommandFinishedInOpen(this.context));
        return;
    }
};
timapi.statemachine.states.WaitForCommit.prototype.activate = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitForCommit.prototype.applicationInformation = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitForCommit.prototype.balance = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitForCommit.prototype.cancel = function () {
    this.context.actionClearPendingCancel();
    this.context.actionCancel();
};
timapi.statemachine.states.WaitForCommit.prototype.changeSettings = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitForCommit.prototype.commit = function () {
    if (this.context.conditionMandatoryFeatureAutoCommit()) {
        this.context.actionSimulateCommitCompleted();
        this.context.setState(new timapi.statemachine.states.CommandFinishedInOpen(this.context));
        return;
    }
    this.context.actionCommit();
    this.context.setState(new timapi.statemachine.states.WaitCommit(this.context));
};
timapi.statemachine.states.WaitForCommit.prototype.connect = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitForCommit.prototype.counterRequest = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitForCommit.prototype.deactivate = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitForCommit.prototype.disconnect = function () {
    this.context.actionSendErrorResponseDisconnect();
    this.context.actionClearPendingEvent();
    this.context.actionDisconnect();
    this.context.setState(new timapi.statemachine.states.Disconnected(this.context));
};
timapi.statemachine.states.WaitForCommit.prototype.dccRates = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitForCommit.prototype.hardwareInformation = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitForCommit.prototype.initTransaction = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitForCommit.prototype.login = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitForCommit.prototype.logout = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitForCommit.prototype.reboot = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitForCommit.prototype.reconciliation = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitForCommit.prototype.receiptRequest = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitForCommit.prototype.reconfig = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitForCommit.prototype.rollback = function () {
    this.context.actionRollback();
    this.context.setState(new timapi.statemachine.states.WaitRollback(this.context));
};
timapi.statemachine.states.WaitForCommit.prototype.softwareUpdate = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitForCommit.prototype.systemInformation = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitForCommit.prototype.transaction = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitForCommit.prototype.connected = function () {
};
timapi.statemachine.states.WaitForCommit.prototype.connectFailed = function () {
    this.context.actionClearPendingEvent();
    this.context.setState(new timapi.statemachine.states.ErrorState(this.context));
};
timapi.statemachine.states.WaitForCommit.prototype.responseError = function () {
    this.context.actionClearPendingEvent();
    this.context.actionProcessResponseError();
    this.context.setState(new timapi.statemachine.states.CommandFinishedInOpen(this.context));
};
timapi.statemachine.states.WaitForCommit.prototype.responseBusy = function () {
    this.context.actionClearPendingEvent();
    this.context.actionProcessResponseError();
    this.context.setState(new timapi.statemachine.states.CommandFinishedInOpen(this.context));
};
timapi.statemachine.states.WaitForCommit.prototype.timeout = function () {
    this.context.actionErrorTimeout();
    this.context.setState(new timapi.statemachine.states.CommandFinishedInOpen(this.context));
};
timapi.statemachine.states.WaitForCommit.prototype.keepAliveTimeout = function () {
    try {
        this.context.actionErrorConnectionLost();
        this.context.actionDisconnect();
        this.context.setState(new timapi.statemachine.states.Disconnected(this.context));
    }
    catch (e) {
        timapi.statemachine.states.WaitForCommit.logger.log(timapi.logging.Level.severe, "Exception", e);
        this.context.setState(new timapi.statemachine.states.Disconnected(this.context));
    }
};
timapi.statemachine.states.WaitForCommit.prototype.closeReader = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitForCommit.prototype.openReader = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitForCommit.prototype.ejectCard = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitForCommit.prototype.openMaintenanceWindow = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitForCommit.prototype.closeMaintenanceWindow = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitForCommit.prototype.holdCommit = function () {
    if (!this.context.conditionHasGuideUnattended()) {
        this.context.actionErrorDisabledFeature();
        return;
    }
    this.context.actionHoldCommit();
};
timapi.statemachine.states.WaitForCommit.prototype.activateServiceMenu = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitForCommit.prototype.balanceInquiry = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitForCommit.prototype.openDialogMode = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitForCommit.prototype.closeDialogMode = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitForCommit.prototype.showSignatureCapture = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitForCommit.prototype.showDialog = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitForCommit.prototype.sendCardCommand = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitHardwareInformation = function (context) {
    timapi.statemachine.states.DefaultState.call(this, context);
};
timapi.statemachine.states.WaitHardwareInformation.prototype = Object.create(timapi.statemachine.states.DefaultState.prototype);
timapi.statemachine.states.WaitHardwareInformation.loggerName = "timapi.statemachine.states.WaitHardwareInformation";
timapi.statemachine.states.WaitHardwareInformation.classname = "WaitHardwareInformation";
timapi.statemachine.states.WaitHardwareInformation.logger = timapi.logging.Logger.getLogger(timapi.statemachine.states.WaitHardwareInformation.loggerName);
timapi.statemachine.states.WaitHardwareInformation.prototype.enterState = function () {
    timapi.statemachine.states.DefaultState.prototype.enterState.call(this);
    this.context.actionClearPendingEvent();
};
timapi.statemachine.states.WaitHardwareInformation.prototype.activate = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitHardwareInformation.prototype.applicationInformation = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitHardwareInformation.prototype.balance = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitHardwareInformation.prototype.cancel = function () {
    this.context.actionClearPendingCancel();
    this.context.actionCancel();
};
timapi.statemachine.states.WaitHardwareInformation.prototype.changeSettings = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitHardwareInformation.prototype.commit = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitHardwareInformation.prototype.connect = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitHardwareInformation.prototype.counterRequest = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitHardwareInformation.prototype.deactivate = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitHardwareInformation.prototype.disconnect = function () {
    this.context.actionSendErrorResponseDisconnect();
    this.context.actionClearPendingEvent();
    this.context.actionDisconnect();
    this.context.setState(new timapi.statemachine.states.Disconnected(this.context));
};
timapi.statemachine.states.WaitHardwareInformation.prototype.dccRates = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitHardwareInformation.prototype.hardwareInformation = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitHardwareInformation.prototype.initTransaction = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitHardwareInformation.prototype.login = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitHardwareInformation.prototype.logout = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitHardwareInformation.prototype.reboot = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitHardwareInformation.prototype.reconciliation = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitHardwareInformation.prototype.receiptRequest = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitHardwareInformation.prototype.reconfig = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitHardwareInformation.prototype.rollback = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitHardwareInformation.prototype.softwareUpdate = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitHardwareInformation.prototype.systemInformation = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitHardwareInformation.prototype.transaction = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitHardwareInformation.prototype.connected = function () {
};
timapi.statemachine.states.WaitHardwareInformation.prototype.connectFailed = function () {
    this.context.actionClearPendingEvent();
    this.context.setState(new timapi.statemachine.states.ErrorState(this.context));
};
timapi.statemachine.states.WaitHardwareInformation.prototype.responseRequest = function () {
    this.context.actionProcessResponseHardwareInformation();
    this.context.setState(new timapi.statemachine.states.CommandFinishedInClosed(this.context));
};
timapi.statemachine.states.WaitHardwareInformation.prototype.responseError = function () {
    this.context.actionClearPendingEvent();
    this.context.actionProcessResponseError();
    this.context.setState(new timapi.statemachine.states.CommandFinishedInClosed(this.context));
};
timapi.statemachine.states.WaitHardwareInformation.prototype.responseBusy = function () {
    this.context.actionClearPendingEvent();
    this.context.actionProcessResponseError();
    this.context.setState(new timapi.statemachine.states.CommandFinishedInClosed(this.context));
};
timapi.statemachine.states.WaitHardwareInformation.prototype.timeout = function () {
    this.context.actionErrorTimeout();
    this.context.setState(new timapi.statemachine.states.CommandFinishedInClosed(this.context));
};
timapi.statemachine.states.WaitHardwareInformation.prototype.keepAliveTimeout = function () {
    try {
        this.context.actionErrorConnectionLost();
        this.context.actionDisconnect();
        this.context.setState(new timapi.statemachine.states.Disconnected(this.context));
    }
    catch (e) {
        timapi.statemachine.states.WaitHardwareInformation.logger.log(timapi.logging.Level.severe, "Exception", e);
        this.context.setState(new timapi.statemachine.states.Disconnected(this.context));
    }
};
timapi.statemachine.states.WaitHardwareInformation.prototype.closeReader = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitHardwareInformation.prototype.openReader = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitHardwareInformation.prototype.ejectCard = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitHardwareInformation.prototype.openMaintenanceWindow = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitHardwareInformation.prototype.closeMaintenanceWindow = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitHardwareInformation.prototype.activateServiceMenu = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitHardwareInformation.prototype.balanceInquiry = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitHardwareInformation.prototype.openDialogMode = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitHardwareInformation.prototype.closeDialogMode = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitHardwareInformation.prototype.showSignatureCapture = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitHardwareInformation.prototype.showDialog = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitHardwareInformation.prototype.sendCardCommand = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitInitTransaction = function (context) {
    timapi.statemachine.states.DefaultState.call(this, context);
};
timapi.statemachine.states.WaitInitTransaction.prototype = Object.create(timapi.statemachine.states.DefaultState.prototype);
timapi.statemachine.states.WaitInitTransaction.loggerName = "timapi.statemachine.states.WaitInitTransaction";
timapi.statemachine.states.WaitInitTransaction.classname = "WaitInitTransaction";
timapi.statemachine.states.WaitInitTransaction.logger = timapi.logging.Logger.getLogger(timapi.statemachine.states.WaitInitTransaction.loggerName);
timapi.statemachine.states.WaitInitTransaction.prototype.enterState = function () {
    timapi.statemachine.states.DefaultState.prototype.enterState.call(this);
    this.context.actionClearPendingEvent();
};
timapi.statemachine.states.WaitInitTransaction.prototype.activate = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitInitTransaction.prototype.applicationInformation = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitInitTransaction.prototype.balance = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitInitTransaction.prototype.cancel = function () {
    this.context.actionClearPendingCancel();
    this.context.actionCancel();
};
timapi.statemachine.states.WaitInitTransaction.prototype.changeSettings = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitInitTransaction.prototype.commit = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitInitTransaction.prototype.connect = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitInitTransaction.prototype.counterRequest = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitInitTransaction.prototype.deactivate = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitInitTransaction.prototype.disconnect = function () {
    this.context.actionSendErrorResponseDisconnect();
    this.context.actionClearPendingEvent();
    this.context.actionDisconnect();
    this.context.setState(new timapi.statemachine.states.Disconnected(this.context));
};
timapi.statemachine.states.WaitInitTransaction.prototype.dccRates = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitInitTransaction.prototype.hardwareInformation = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitInitTransaction.prototype.initTransaction = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitInitTransaction.prototype.login = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitInitTransaction.prototype.logout = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitInitTransaction.prototype.reboot = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitInitTransaction.prototype.reconciliation = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitInitTransaction.prototype.receiptRequest = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitInitTransaction.prototype.reconfig = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitInitTransaction.prototype.rollback = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitInitTransaction.prototype.softwareUpdate = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitInitTransaction.prototype.systemInformation = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitInitTransaction.prototype.transaction = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitInitTransaction.prototype.connected = function () {
};
timapi.statemachine.states.WaitInitTransaction.prototype.connectFailed = function () {
    this.context.actionClearPendingEvent();
    this.context.setState(new timapi.statemachine.states.ErrorState(this.context));
};
timapi.statemachine.states.WaitInitTransaction.prototype.responseRequest = function () {
    this.context.actionProcessResponseInitTransaction();
    this.context.setState(new timapi.statemachine.states.CommandFinishedInOpen(this.context));
};
timapi.statemachine.states.WaitInitTransaction.prototype.responseError = function () {
    this.context.actionClearPendingEvent();
    this.context.actionProcessResponseError();
    this.context.setState(new timapi.statemachine.states.CommandFinishedInOpen(this.context));
};
timapi.statemachine.states.WaitInitTransaction.prototype.responseBusy = function () {
    this.context.actionClearPendingEvent();
    this.context.actionProcessResponseError();
    this.context.setState(new timapi.statemachine.states.CommandFinishedInOpen(this.context));
};
timapi.statemachine.states.WaitInitTransaction.prototype.timeout = function () {
    this.context.actionErrorTimeout();
    this.context.setState(new timapi.statemachine.states.CommandFinishedInOpen(this.context));
};
timapi.statemachine.states.WaitInitTransaction.prototype.keepAliveTimeout = function () {
    try {
        this.context.actionErrorConnectionLost();
        this.context.actionDisconnect();
        this.context.setState(new timapi.statemachine.states.Disconnected(this.context));
    }
    catch (e) {
        timapi.statemachine.states.WaitInitTransaction.logger.log(timapi.logging.Level.severe, "Exception", e);
        this.context.setState(new timapi.statemachine.states.Disconnected(this.context));
    }
};
timapi.statemachine.states.WaitInitTransaction.prototype.closeReader = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitInitTransaction.prototype.openReader = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitInitTransaction.prototype.ejectCard = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitInitTransaction.prototype.openMaintenanceWindow = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitInitTransaction.prototype.closeMaintenanceWindow = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitInitTransaction.prototype.activateServiceMenu = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitInitTransaction.prototype.balanceInquiry = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitInitTransaction.prototype.openDialogMode = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitInitTransaction.prototype.closeDialogMode = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitInitTransaction.prototype.showSignatureCapture = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitInitTransaction.prototype.showDialog = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitInitTransaction.prototype.sendCardCommand = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitOpenDialogMode = function (context) {
    timapi.statemachine.states.DefaultState.call(this, context);
};
timapi.statemachine.states.WaitOpenDialogMode.prototype = Object.create(timapi.statemachine.states.DefaultState.prototype);
timapi.statemachine.states.WaitOpenDialogMode.loggerName = "timapi.statemachine.states.WaitOpenDialogMode";
timapi.statemachine.states.WaitOpenDialogMode.classname = "WaitOpenDialogMode";
timapi.statemachine.states.WaitOpenDialogMode.logger = timapi.logging.Logger.getLogger(timapi.statemachine.states.WaitOpenDialogMode.loggerName);
timapi.statemachine.states.WaitOpenDialogMode.prototype.enterState = function () {
    timapi.statemachine.states.DefaultState.prototype.enterState.call(this);
};
timapi.statemachine.states.WaitOpenDialogMode.prototype.activate = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitOpenDialogMode.prototype.applicationInformation = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitOpenDialogMode.prototype.balance = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitOpenDialogMode.prototype.cancel = function () {
    this.context.actionClearPendingCancel();
    this.context.actionCancel();
};
timapi.statemachine.states.WaitOpenDialogMode.prototype.changeSettings = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitOpenDialogMode.prototype.commit = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitOpenDialogMode.prototype.connect = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitOpenDialogMode.prototype.counterRequest = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitOpenDialogMode.prototype.deactivate = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitOpenDialogMode.prototype.disconnect = function () {
    this.context.actionSendErrorResponseDisconnect();
    this.context.actionClearPendingEvent();
    this.context.actionDisconnect();
    this.context.setState(new timapi.statemachine.states.Disconnected(this.context));
};
timapi.statemachine.states.WaitOpenDialogMode.prototype.dccRates = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitOpenDialogMode.prototype.hardwareInformation = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitOpenDialogMode.prototype.initTransaction = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitOpenDialogMode.prototype.login = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitOpenDialogMode.prototype.logout = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitOpenDialogMode.prototype.reboot = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitOpenDialogMode.prototype.reconciliation = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitOpenDialogMode.prototype.receiptRequest = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitOpenDialogMode.prototype.reconfig = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitOpenDialogMode.prototype.rollback = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitOpenDialogMode.prototype.softwareUpdate = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitOpenDialogMode.prototype.systemInformation = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitOpenDialogMode.prototype.transaction = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitOpenDialogMode.prototype.connected = function () {
};
timapi.statemachine.states.WaitOpenDialogMode.prototype.connectFailed = function () {
    this.context.actionClearPendingEvent();
    this.context.setState(new timapi.statemachine.states.ErrorState(this.context));
};
timapi.statemachine.states.WaitOpenDialogMode.prototype.responseRequest = function () {
    this.context.actionProcessResponseOpenDialogMode();
    this.context.setState(new timapi.statemachine.states.DialogMode(this.context));
};
timapi.statemachine.states.WaitOpenDialogMode.prototype.responseError = function () {
    this.context.actionClearPendingEvent();
    this.context.actionProcessResponseError();
    this.context.setState(new timapi.statemachine.states.Open(this.context));
};
timapi.statemachine.states.WaitOpenDialogMode.prototype.responseBusy = function () {
    this.context.actionClearPendingEvent();
    this.context.actionProcessResponseError();
    this.context.setState(new timapi.statemachine.states.Open(this.context));
};
timapi.statemachine.states.WaitOpenDialogMode.prototype.timeout = function () {
    this.context.actionErrorTimeout();
    this.context.setState(new timapi.statemachine.states.Open(this.context));
};
timapi.statemachine.states.WaitOpenDialogMode.prototype.keepAliveTimeout = function () {
    try {
        this.context.actionErrorConnectionLost();
        this.context.actionDisconnect();
        this.context.setState(new timapi.statemachine.states.Disconnected(this.context));
    }
    catch (e) {
        timapi.statemachine.states.WaitOpenDialogMode.logger.log(timapi.logging.Level.severe, "Exception", e);
        this.context.setState(new timapi.statemachine.states.Disconnected(this.context));
    }
};
timapi.statemachine.states.WaitOpenDialogMode.prototype.closeReader = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitOpenDialogMode.prototype.openReader = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitOpenDialogMode.prototype.ejectCard = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitOpenDialogMode.prototype.openMaintenanceWindow = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitOpenDialogMode.prototype.closeMaintenanceWindow = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitOpenDialogMode.prototype.activateServiceMenu = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitOpenDialogMode.prototype.balanceInquiry = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitOpenDialogMode.prototype.openDialogMode = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitOpenDialogMode.prototype.closeDialogMode = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitOpenDialogMode.prototype.showSignatureCapture = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitOpenDialogMode.prototype.showDialog = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitOpenDialogMode.prototype.sendCardCommand = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitOpenMaintenanceWindow = function (context) {
    timapi.statemachine.states.DefaultState.call(this, context);
};
timapi.statemachine.states.WaitOpenMaintenanceWindow.prototype = Object.create(timapi.statemachine.states.DefaultState.prototype);
timapi.statemachine.states.WaitOpenMaintenanceWindow.loggerName = "timapi.statemachine.states.WaitOpenMaintenanceWindow";
timapi.statemachine.states.WaitOpenMaintenanceWindow.classname = "WaitOpenMaintenanceWindow";
timapi.statemachine.states.WaitOpenMaintenanceWindow.logger = timapi.logging.Logger.getLogger(timapi.statemachine.states.WaitOpenMaintenanceWindow.loggerName);
timapi.statemachine.states.WaitOpenMaintenanceWindow.prototype.enterState = function () {
    timapi.statemachine.states.DefaultState.prototype.enterState.call(this);
    this.context.actionClearPendingEvent();
};
timapi.statemachine.states.WaitOpenMaintenanceWindow.prototype.activate = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitOpenMaintenanceWindow.prototype.applicationInformation = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitOpenMaintenanceWindow.prototype.balance = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitOpenMaintenanceWindow.prototype.cancel = function () {
    this.context.actionClearPendingCancel();
    this.context.actionCancel();
};
timapi.statemachine.states.WaitOpenMaintenanceWindow.prototype.changeSettings = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitOpenMaintenanceWindow.prototype.commit = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitOpenMaintenanceWindow.prototype.connect = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitOpenMaintenanceWindow.prototype.counterRequest = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitOpenMaintenanceWindow.prototype.deactivate = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitOpenMaintenanceWindow.prototype.disconnect = function () {
    this.context.actionSendErrorResponseDisconnect();
    this.context.actionClearPendingEvent();
    this.context.actionDisconnect();
    this.context.setState(new timapi.statemachine.states.Disconnected(this.context));
};
timapi.statemachine.states.WaitOpenMaintenanceWindow.prototype.dccRates = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitOpenMaintenanceWindow.prototype.hardwareInformation = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitOpenMaintenanceWindow.prototype.initTransaction = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitOpenMaintenanceWindow.prototype.login = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitOpenMaintenanceWindow.prototype.logout = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitOpenMaintenanceWindow.prototype.reboot = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitOpenMaintenanceWindow.prototype.reconciliation = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitOpenMaintenanceWindow.prototype.receiptRequest = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitOpenMaintenanceWindow.prototype.reconfig = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitOpenMaintenanceWindow.prototype.rollback = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitOpenMaintenanceWindow.prototype.softwareUpdate = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitOpenMaintenanceWindow.prototype.systemInformation = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitOpenMaintenanceWindow.prototype.transaction = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitOpenMaintenanceWindow.prototype.connected = function () {
};
timapi.statemachine.states.WaitOpenMaintenanceWindow.prototype.connectFailed = function () {
    this.context.actionClearPendingEvent();
    this.context.setState(new timapi.statemachine.states.ErrorState(this.context));
};
timapi.statemachine.states.WaitOpenMaintenanceWindow.prototype.responseRequest = function () {
    this.context.actionProcessResponseOpenMaintenanceWindow();
    this.context.setState(new timapi.statemachine.states.CommandFinishedInClosed(this.context));
};
timapi.statemachine.states.WaitOpenMaintenanceWindow.prototype.responseError = function () {
    this.context.actionClearPendingEvent();
    this.context.actionProcessResponseError();
    this.context.setState(new timapi.statemachine.states.CommandFinishedInClosed(this.context));
};
timapi.statemachine.states.WaitOpenMaintenanceWindow.prototype.responseBusy = function () {
    this.context.actionClearPendingEvent();
    this.context.actionProcessResponseError();
    this.context.setState(new timapi.statemachine.states.CommandFinishedInClosed(this.context));
};
timapi.statemachine.states.WaitOpenMaintenanceWindow.prototype.timeout = function () {
    this.context.actionErrorTimeout();
    this.context.setState(new timapi.statemachine.states.CommandFinishedInClosed(this.context));
};
timapi.statemachine.states.WaitOpenMaintenanceWindow.prototype.keepAliveTimeout = function () {
    try {
        this.context.actionErrorConnectionLost();
        this.context.actionDisconnect();
        this.context.setState(new timapi.statemachine.states.Disconnected(this.context));
    }
    catch (e) {
        timapi.statemachine.states.WaitOpenMaintenanceWindow.logger.log(timapi.logging.Level.severe, "Exception", e);
        this.context.setState(new timapi.statemachine.states.Disconnected(this.context));
    }
};
timapi.statemachine.states.WaitOpenMaintenanceWindow.prototype.closeReader = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitOpenMaintenanceWindow.prototype.openReader = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitOpenMaintenanceWindow.prototype.ejectCard = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitOpenMaintenanceWindow.prototype.openMaintenanceWindow = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitOpenMaintenanceWindow.prototype.closeMaintenanceWindow = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitOpenMaintenanceWindow.prototype.activateServiceMenu = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitOpenMaintenanceWindow.prototype.balanceInquiry = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitOpenMaintenanceWindow.prototype.openDialogMode = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitOpenMaintenanceWindow.prototype.closeDialogMode = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitOpenMaintenanceWindow.prototype.showSignatureCapture = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitOpenMaintenanceWindow.prototype.showDialog = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitOpenMaintenanceWindow.prototype.sendCardCommand = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitOpenReader = function (context) {
    timapi.statemachine.states.DefaultState.call(this, context);
};
timapi.statemachine.states.WaitOpenReader.prototype = Object.create(timapi.statemachine.states.DefaultState.prototype);
timapi.statemachine.states.WaitOpenReader.loggerName = "timapi.statemachine.states.WaitOpenReader";
timapi.statemachine.states.WaitOpenReader.classname = "WaitOpenReader";
timapi.statemachine.states.WaitOpenReader.logger = timapi.logging.Logger.getLogger(timapi.statemachine.states.WaitOpenReader.loggerName);
timapi.statemachine.states.WaitOpenReader.prototype.enterState = function () {
    timapi.statemachine.states.DefaultState.prototype.enterState.call(this);
    this.context.actionClearPendingEvent();
};
timapi.statemachine.states.WaitOpenReader.prototype.activate = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitOpenReader.prototype.applicationInformation = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitOpenReader.prototype.balance = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitOpenReader.prototype.cancel = function () {
    this.context.actionClearPendingCancel();
    this.context.actionCancel();
};
timapi.statemachine.states.WaitOpenReader.prototype.changeSettings = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitOpenReader.prototype.commit = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitOpenReader.prototype.connect = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitOpenReader.prototype.counterRequest = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitOpenReader.prototype.deactivate = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitOpenReader.prototype.disconnect = function () {
    this.context.actionSendErrorResponseDisconnect();
    this.context.actionClearPendingEvent();
    this.context.actionDisconnect();
    this.context.setState(new timapi.statemachine.states.Disconnected(this.context));
};
timapi.statemachine.states.WaitOpenReader.prototype.dccRates = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitOpenReader.prototype.hardwareInformation = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitOpenReader.prototype.initTransaction = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitOpenReader.prototype.login = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitOpenReader.prototype.logout = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitOpenReader.prototype.reboot = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitOpenReader.prototype.reconciliation = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitOpenReader.prototype.receiptRequest = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitOpenReader.prototype.reconfig = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitOpenReader.prototype.rollback = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitOpenReader.prototype.softwareUpdate = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitOpenReader.prototype.systemInformation = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitOpenReader.prototype.transaction = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitOpenReader.prototype.connected = function () {
};
timapi.statemachine.states.WaitOpenReader.prototype.connectFailed = function () {
    this.context.actionClearPendingEvent();
    this.context.setState(new timapi.statemachine.states.ErrorState(this.context));
};
timapi.statemachine.states.WaitOpenReader.prototype.responseRequest = function () {
    this.context.actionProcessResponseOpenReader();
    this.context.setState(new timapi.statemachine.states.CommandFinishedInOpen(this.context));
};
timapi.statemachine.states.WaitOpenReader.prototype.responseError = function () {
    this.context.actionClearPendingEvent();
    this.context.actionProcessResponseError();
    this.context.setState(new timapi.statemachine.states.CommandFinishedInOpen(this.context));
};
timapi.statemachine.states.WaitOpenReader.prototype.responseBusy = function () {
    this.context.actionClearPendingEvent();
    this.context.actionProcessResponseError();
    this.context.setState(new timapi.statemachine.states.CommandFinishedInOpen(this.context));
};
timapi.statemachine.states.WaitOpenReader.prototype.timeout = function () {
    this.context.actionErrorTimeout();
    this.context.setState(new timapi.statemachine.states.CommandFinishedInOpen(this.context));
};
timapi.statemachine.states.WaitOpenReader.prototype.keepAliveTimeout = function () {
    try {
        this.context.actionErrorConnectionLost();
        this.context.actionDisconnect();
        this.context.setState(new timapi.statemachine.states.Disconnected(this.context));
    }
    catch (e) {
        timapi.statemachine.states.WaitOpenReader.logger.log(timapi.logging.Level.severe, "Exception", e);
        this.context.setState(new timapi.statemachine.states.Disconnected(this.context));
    }
};
timapi.statemachine.states.WaitOpenReader.prototype.closeReader = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitOpenReader.prototype.openReader = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitOpenReader.prototype.ejectCard = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitOpenReader.prototype.openMaintenanceWindow = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitOpenReader.prototype.closeMaintenanceWindow = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitOpenReader.prototype.activateServiceMenu = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitOpenReader.prototype.balanceInquiry = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitOpenReader.prototype.openDialogMode = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitOpenReader.prototype.closeDialogMode = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitOpenReader.prototype.showSignatureCapture = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitOpenReader.prototype.showDialog = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitOpenReader.prototype.sendCardCommand = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitReboot = function (context) {
    timapi.statemachine.states.DefaultState.call(this, context);
};
timapi.statemachine.states.WaitReboot.prototype = Object.create(timapi.statemachine.states.DefaultState.prototype);
timapi.statemachine.states.WaitReboot.loggerName = "timapi.statemachine.states.WaitReboot";
timapi.statemachine.states.WaitReboot.classname = "WaitReboot";
timapi.statemachine.states.WaitReboot.logger = timapi.logging.Logger.getLogger(timapi.statemachine.states.WaitReboot.loggerName);
timapi.statemachine.states.WaitReboot.prototype.enterState = function () {
    timapi.statemachine.states.DefaultState.prototype.enterState.call(this);
    this.context.actionClearPendingEvent();
};
timapi.statemachine.states.WaitReboot.prototype.activate = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitReboot.prototype.applicationInformation = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitReboot.prototype.balance = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitReboot.prototype.cancel = function () {
    this.context.actionClearPendingCancel();
    this.context.actionCancel();
};
timapi.statemachine.states.WaitReboot.prototype.changeSettings = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitReboot.prototype.commit = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitReboot.prototype.connect = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitReboot.prototype.counterRequest = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitReboot.prototype.deactivate = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitReboot.prototype.disconnect = function () {
    this.context.actionSendErrorResponseDisconnect();
    this.context.actionClearPendingEvent();
    this.context.actionDisconnect();
    this.context.setState(new timapi.statemachine.states.Disconnected(this.context));
};
timapi.statemachine.states.WaitReboot.prototype.dccRates = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitReboot.prototype.hardwareInformation = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitReboot.prototype.initTransaction = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitReboot.prototype.login = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitReboot.prototype.logout = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitReboot.prototype.reboot = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitReboot.prototype.reconciliation = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitReboot.prototype.receiptRequest = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitReboot.prototype.reconfig = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitReboot.prototype.rollback = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitReboot.prototype.softwareUpdate = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitReboot.prototype.systemInformation = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitReboot.prototype.transaction = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitReboot.prototype.connected = function () {
};
timapi.statemachine.states.WaitReboot.prototype.connectFailed = function () {
    this.context.actionClearPendingEvent();
    this.context.setState(new timapi.statemachine.states.ErrorState(this.context));
};
timapi.statemachine.states.WaitReboot.prototype.responseRequest = function () {
    this.context.actionProcessResponseReboot();
    this.context.actionDisconnect();
    this.context.setState(new timapi.statemachine.states.Disconnected(this.context));
};
timapi.statemachine.states.WaitReboot.prototype.responseError = function () {
    this.context.actionClearPendingEvent();
    this.context.actionProcessResponseError();
    this.context.setState(new timapi.statemachine.states.CommandFinishedInClosed(this.context));
};
timapi.statemachine.states.WaitReboot.prototype.responseBusy = function () {
    this.context.actionClearPendingEvent();
    this.context.actionProcessResponseError();
    this.context.setState(new timapi.statemachine.states.CommandFinishedInClosed(this.context));
};
timapi.statemachine.states.WaitReboot.prototype.timeout = function () {
    this.context.actionErrorTimeout();
    this.context.setState(new timapi.statemachine.states.CommandFinishedInClosed(this.context));
};
timapi.statemachine.states.WaitReboot.prototype.keepAliveTimeout = function () {
    try {
        this.context.actionErrorConnectionLost();
        this.context.actionDisconnect();
        this.context.setState(new timapi.statemachine.states.Disconnected(this.context));
    }
    catch (e) {
        timapi.statemachine.states.WaitReboot.logger.log(timapi.logging.Level.severe, "Exception", e);
        this.context.setState(new timapi.statemachine.states.Disconnected(this.context));
    }
};
timapi.statemachine.states.WaitReboot.prototype.closeReader = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitReboot.prototype.openReader = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitReboot.prototype.ejectCard = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitReboot.prototype.openMaintenanceWindow = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitReboot.prototype.closeMaintenanceWindow = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitReboot.prototype.activateServiceMenu = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitReboot.prototype.balanceInquiry = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitReboot.prototype.openDialogMode = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitReboot.prototype.closeDialogMode = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitReboot.prototype.showSignatureCapture = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitReboot.prototype.showDialog = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitReboot.prototype.sendCardCommand = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitReconciliation = function (context) {
    timapi.statemachine.states.DefaultState.call(this, context);
};
timapi.statemachine.states.WaitReconciliation.prototype = Object.create(timapi.statemachine.states.DefaultState.prototype);
timapi.statemachine.states.WaitReconciliation.loggerName = "timapi.statemachine.states.WaitReconciliation";
timapi.statemachine.states.WaitReconciliation.classname = "WaitReconciliation";
timapi.statemachine.states.WaitReconciliation.logger = timapi.logging.Logger.getLogger(timapi.statemachine.states.WaitReconciliation.loggerName);
timapi.statemachine.states.WaitReconciliation.prototype.enterState = function () {
    timapi.statemachine.states.DefaultState.prototype.enterState.call(this);
    this.context.actionClearPendingEvent();
};
timapi.statemachine.states.WaitReconciliation.prototype.activate = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitReconciliation.prototype.applicationInformation = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitReconciliation.prototype.balance = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitReconciliation.prototype.cancel = function () {
    this.context.actionClearPendingCancel();
    this.context.actionCancel();
};
timapi.statemachine.states.WaitReconciliation.prototype.changeSettings = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitReconciliation.prototype.commit = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitReconciliation.prototype.connect = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitReconciliation.prototype.counterRequest = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitReconciliation.prototype.deactivate = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitReconciliation.prototype.disconnect = function () {
    this.context.actionSendErrorResponseDisconnect();
    this.context.actionClearPendingEvent();
    this.context.actionDisconnect();
    this.context.setState(new timapi.statemachine.states.Disconnected(this.context));
};
timapi.statemachine.states.WaitReconciliation.prototype.dccRates = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitReconciliation.prototype.hardwareInformation = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitReconciliation.prototype.initTransaction = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitReconciliation.prototype.login = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitReconciliation.prototype.logout = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitReconciliation.prototype.reboot = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitReconciliation.prototype.reconciliation = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitReconciliation.prototype.receiptRequest = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitReconciliation.prototype.reconfig = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitReconciliation.prototype.rollback = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitReconciliation.prototype.softwareUpdate = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitReconciliation.prototype.systemInformation = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitReconciliation.prototype.transaction = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitReconciliation.prototype.connected = function () {
};
timapi.statemachine.states.WaitReconciliation.prototype.connectFailed = function () {
    this.context.actionClearPendingEvent();
    this.context.setState(new timapi.statemachine.states.ErrorState(this.context));
};
timapi.statemachine.states.WaitReconciliation.prototype.responseRequest = function () {
    this.context.actionProcessResponseReconciliation();
    this.context.setState(new timapi.statemachine.states.CommandFinishedInClosed(this.context));
};
timapi.statemachine.states.WaitReconciliation.prototype.responseError = function () {
    this.context.actionClearPendingEvent();
    this.context.actionProcessResponseError();
    this.context.setState(new timapi.statemachine.states.CommandFinishedInClosed(this.context));
};
timapi.statemachine.states.WaitReconciliation.prototype.responseBusy = function () {
    this.context.actionClearPendingEvent();
    this.context.actionProcessResponseError();
    this.context.setState(new timapi.statemachine.states.CommandFinishedInClosed(this.context));
};
timapi.statemachine.states.WaitReconciliation.prototype.timeout = function () {
    this.context.actionErrorTimeout();
    this.context.setState(new timapi.statemachine.states.CommandFinishedInClosed(this.context));
};
timapi.statemachine.states.WaitReconciliation.prototype.keepAliveTimeout = function () {
    try {
        this.context.actionErrorConnectionLost();
        this.context.actionDisconnect();
        this.context.setState(new timapi.statemachine.states.Disconnected(this.context));
    }
    catch (e) {
        timapi.statemachine.states.WaitReconciliation.logger.log(timapi.logging.Level.severe, "Exception", e);
        this.context.setState(new timapi.statemachine.states.Disconnected(this.context));
    }
};
timapi.statemachine.states.WaitReconciliation.prototype.closeReader = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitReconciliation.prototype.openReader = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitReconciliation.prototype.ejectCard = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitReconciliation.prototype.openMaintenanceWindow = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitReconciliation.prototype.closeMaintenanceWindow = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitReconciliation.prototype.activateServiceMenu = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitReconciliation.prototype.balanceInquiry = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitReconciliation.prototype.openDialogMode = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitReconciliation.prototype.closeDialogMode = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitReconciliation.prototype.showSignatureCapture = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitReconciliation.prototype.showDialog = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitReconciliation.prototype.sendCardCommand = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitReconfig = function (context) {
    timapi.statemachine.states.DefaultState.call(this, context);
};
timapi.statemachine.states.WaitReconfig.prototype = Object.create(timapi.statemachine.states.DefaultState.prototype);
timapi.statemachine.states.WaitReconfig.loggerName = "timapi.statemachine.states.WaitReconfig";
timapi.statemachine.states.WaitReconfig.classname = "WaitReconfig";
timapi.statemachine.states.WaitReconfig.logger = timapi.logging.Logger.getLogger(timapi.statemachine.states.WaitReconfig.loggerName);
timapi.statemachine.states.WaitReconfig.prototype.enterState = function () {
    timapi.statemachine.states.DefaultState.prototype.enterState.call(this);
    this.context.actionClearPendingEvent();
};
timapi.statemachine.states.WaitReconfig.prototype.activate = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitReconfig.prototype.applicationInformation = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitReconfig.prototype.balance = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitReconfig.prototype.cancel = function () {
    this.context.actionClearPendingCancel();
    this.context.actionCancel();
};
timapi.statemachine.states.WaitReconfig.prototype.changeSettings = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitReconfig.prototype.commit = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitReconfig.prototype.connect = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitReconfig.prototype.counterRequest = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitReconfig.prototype.deactivate = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitReconfig.prototype.disconnect = function () {
    this.context.actionSendErrorResponseDisconnect();
    this.context.actionClearPendingEvent();
    this.context.actionDisconnect();
    this.context.setState(new timapi.statemachine.states.Disconnected(this.context));
};
timapi.statemachine.states.WaitReconfig.prototype.dccRates = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitReconfig.prototype.hardwareInformation = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitReconfig.prototype.initTransaction = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitReconfig.prototype.login = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitReconfig.prototype.logout = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitReconfig.prototype.reboot = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitReconfig.prototype.reconciliation = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitReconfig.prototype.receiptRequest = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitReconfig.prototype.reconfig = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitReconfig.prototype.rollback = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitReconfig.prototype.softwareUpdate = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitReconfig.prototype.systemInformation = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitReconfig.prototype.transaction = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitReconfig.prototype.connected = function () {
};
timapi.statemachine.states.WaitReconfig.prototype.connectFailed = function () {
    this.context.actionClearPendingEvent();
    this.context.setState(new timapi.statemachine.states.ErrorState(this.context));
};
timapi.statemachine.states.WaitReconfig.prototype.responseRequest = function () {
    this.context.actionProcessResponseReconfig();
    this.context.setState(new timapi.statemachine.states.CommandFinishedInClosed(this.context));
};
timapi.statemachine.states.WaitReconfig.prototype.responseError = function () {
    this.context.actionClearPendingEvent();
    this.context.actionProcessResponseError();
    this.context.setState(new timapi.statemachine.states.CommandFinishedInClosed(this.context));
};
timapi.statemachine.states.WaitReconfig.prototype.responseBusy = function () {
    this.context.actionClearPendingEvent();
    this.context.actionProcessResponseError();
    this.context.setState(new timapi.statemachine.states.CommandFinishedInClosed(this.context));
};
timapi.statemachine.states.WaitReconfig.prototype.timeout = function () {
    this.context.actionErrorTimeout();
    this.context.setState(new timapi.statemachine.states.CommandFinishedInClosed(this.context));
};
timapi.statemachine.states.WaitReconfig.prototype.keepAliveTimeout = function () {
    try {
        this.context.actionErrorConnectionLost();
        this.context.actionDisconnect();
        this.context.setState(new timapi.statemachine.states.Disconnected(this.context));
    }
    catch (e) {
        timapi.statemachine.states.WaitReconfig.logger.log(timapi.logging.Level.severe, "Exception", e);
        this.context.setState(new timapi.statemachine.states.Disconnected(this.context));
    }
};
timapi.statemachine.states.WaitReconfig.prototype.closeReader = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitReconfig.prototype.openReader = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitReconfig.prototype.ejectCard = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitReconfig.prototype.openMaintenanceWindow = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitReconfig.prototype.closeMaintenanceWindow = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitReconfig.prototype.activateServiceMenu = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitReconfig.prototype.balanceInquiry = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitReconfig.prototype.openDialogMode = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitReconfig.prototype.closeDialogMode = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitReconfig.prototype.showSignatureCapture = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitReconfig.prototype.showDialog = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitReconfig.prototype.sendCardCommand = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitRollback = function (context) {
    timapi.statemachine.states.DefaultState.call(this, context);
};
timapi.statemachine.states.WaitRollback.prototype = Object.create(timapi.statemachine.states.DefaultState.prototype);
timapi.statemachine.states.WaitRollback.loggerName = "timapi.statemachine.states.WaitRollback";
timapi.statemachine.states.WaitRollback.classname = "WaitRollback";
timapi.statemachine.states.WaitRollback.logger = timapi.logging.Logger.getLogger(timapi.statemachine.states.WaitRollback.loggerName);
timapi.statemachine.states.WaitRollback.prototype.enterState = function () {
    timapi.statemachine.states.DefaultState.prototype.enterState.call(this);
    this.context.actionClearPendingEvent();
};
timapi.statemachine.states.WaitRollback.prototype.activate = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitRollback.prototype.applicationInformation = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitRollback.prototype.balance = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitRollback.prototype.cancel = function () {
    this.context.actionClearPendingCancel();
    this.context.actionCancel();
};
timapi.statemachine.states.WaitRollback.prototype.changeSettings = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitRollback.prototype.commit = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitRollback.prototype.connect = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitRollback.prototype.counterRequest = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitRollback.prototype.deactivate = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitRollback.prototype.disconnect = function () {
    this.context.actionSendErrorResponseDisconnect();
    this.context.actionClearPendingEvent();
    this.context.actionDisconnect();
    this.context.setState(new timapi.statemachine.states.Disconnected(this.context));
};
timapi.statemachine.states.WaitRollback.prototype.dccRates = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitRollback.prototype.hardwareInformation = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitRollback.prototype.initTransaction = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitRollback.prototype.login = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitRollback.prototype.logout = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitRollback.prototype.reboot = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitRollback.prototype.reconciliation = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitRollback.prototype.receiptRequest = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitRollback.prototype.reconfig = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitRollback.prototype.rollback = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitRollback.prototype.softwareUpdate = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitRollback.prototype.systemInformation = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitRollback.prototype.transaction = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitRollback.prototype.connected = function () {
};
timapi.statemachine.states.WaitRollback.prototype.connectFailed = function () {
    this.context.actionClearPendingEvent();
    this.context.setState(new timapi.statemachine.states.ErrorState(this.context));
};
timapi.statemachine.states.WaitRollback.prototype.responseRequest = function () {
    this.context.actionProcessResponseRollback();
    this.context.setState(new timapi.statemachine.states.CommandFinishedInOpen(this.context));
};
timapi.statemachine.states.WaitRollback.prototype.responseError = function () {
    this.context.actionClearPendingEvent();
    this.context.actionProcessResponseError();
    this.context.setState(new timapi.statemachine.states.CommandFinishedInOpen(this.context));
};
timapi.statemachine.states.WaitRollback.prototype.responseBusy = function () {
    this.context.actionClearPendingEvent();
    this.context.actionProcessResponseError();
    this.context.setState(new timapi.statemachine.states.CommandFinishedInOpen(this.context));
};
timapi.statemachine.states.WaitRollback.prototype.timeout = function () {
    if (this.context.conditionCanRepeatRequest()) {
        this.context.actionRepeatRequest();
        this.context.setState(new timapi.statemachine.states.WaitRollback(this.context));
        return;
    }
    this.context.actionErrorTimeout();
    this.context.setState(new timapi.statemachine.states.CommandFinishedInOpen(this.context));
};
timapi.statemachine.states.WaitRollback.prototype.keepAliveTimeout = function () {
    try {
        this.context.actionErrorConnectionLost();
        this.context.actionDisconnect();
        this.context.setState(new timapi.statemachine.states.Disconnected(this.context));
    }
    catch (e) {
        timapi.statemachine.states.WaitRollback.logger.log(timapi.logging.Level.severe, "Exception", e);
        this.context.setState(new timapi.statemachine.states.Disconnected(this.context));
    }
};
timapi.statemachine.states.WaitRollback.prototype.closeReader = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitRollback.prototype.openReader = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitRollback.prototype.ejectCard = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitRollback.prototype.openMaintenanceWindow = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitRollback.prototype.closeMaintenanceWindow = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitRollback.prototype.activateServiceMenu = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitRollback.prototype.balanceInquiry = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitRollback.prototype.openDialogMode = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitRollback.prototype.closeDialogMode = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitRollback.prototype.showSignatureCapture = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitRollback.prototype.showDialog = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitRollback.prototype.sendCardCommand = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitShowDialog = function (context) {
    timapi.statemachine.states.DefaultState.call(this, context);
};
timapi.statemachine.states.WaitShowDialog.prototype = Object.create(timapi.statemachine.states.DefaultState.prototype);
timapi.statemachine.states.WaitShowDialog.loggerName = "timapi.statemachine.states.WaitShowDialog";
timapi.statemachine.states.WaitShowDialog.classname = "WaitShowDialog";
timapi.statemachine.states.WaitShowDialog.logger = timapi.logging.Logger.getLogger(timapi.statemachine.states.WaitShowDialog.loggerName);
timapi.statemachine.states.WaitShowDialog.prototype.enterState = function () {
    timapi.statemachine.states.DefaultState.prototype.enterState.call(this);
    this.context.actionClearPendingEvent();
};
timapi.statemachine.states.WaitShowDialog.prototype.activate = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitShowDialog.prototype.applicationInformation = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitShowDialog.prototype.balance = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitShowDialog.prototype.cancel = function () {
    this.context.actionClearPendingCancel();
    this.context.actionCancel();
};
timapi.statemachine.states.WaitShowDialog.prototype.changeSettings = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitShowDialog.prototype.commit = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitShowDialog.prototype.connect = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitShowDialog.prototype.counterRequest = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitShowDialog.prototype.deactivate = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitShowDialog.prototype.disconnect = function () {
    this.context.actionSendErrorResponseDisconnect();
    this.context.actionClearPendingEvent();
    this.context.actionDisconnect();
    this.context.setState(new timapi.statemachine.states.Disconnected(this.context));
};
timapi.statemachine.states.WaitShowDialog.prototype.dccRates = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitShowDialog.prototype.hardwareInformation = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitShowDialog.prototype.initTransaction = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitShowDialog.prototype.login = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitShowDialog.prototype.logout = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitShowDialog.prototype.reboot = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitShowDialog.prototype.reconciliation = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitShowDialog.prototype.receiptRequest = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitShowDialog.prototype.reconfig = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitShowDialog.prototype.rollback = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitShowDialog.prototype.softwareUpdate = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitShowDialog.prototype.systemInformation = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitShowDialog.prototype.transaction = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitShowDialog.prototype.connected = function () {
};
timapi.statemachine.states.WaitShowDialog.prototype.connectFailed = function () {
    this.context.actionClearPendingEvent();
    this.context.setState(new timapi.statemachine.states.ErrorState(this.context));
};
timapi.statemachine.states.WaitShowDialog.prototype.responseRequest = function () {
    this.context.actionProcessResponseShowDialog();
    this.context.setState(new timapi.statemachine.states.DialogMode(this.context));
};
timapi.statemachine.states.WaitShowDialog.prototype.responseError = function () {
    this.context.actionClearPendingEvent();
    this.context.actionProcessResponseError();
    this.context.setState(new timapi.statemachine.states.DialogMode(this.context));
};
timapi.statemachine.states.WaitShowDialog.prototype.responseBusy = function () {
    this.context.actionClearPendingEvent();
    this.context.actionProcessResponseError();
    this.context.setState(new timapi.statemachine.states.DialogMode(this.context));
};
timapi.statemachine.states.WaitShowDialog.prototype.timeout = function () {
    this.context.actionErrorTimeout();
    this.context.setState(new timapi.statemachine.states.DialogMode(this.context));
};
timapi.statemachine.states.WaitShowDialog.prototype.keepAliveTimeout = function () {
    try {
        this.context.actionErrorConnectionLost();
        this.context.actionDisconnect();
        this.context.setState(new timapi.statemachine.states.Disconnected(this.context));
    }
    catch (e) {
        timapi.statemachine.states.WaitShowDialog.logger.log(timapi.logging.Level.severe, "Exception", e);
        this.context.setState(new timapi.statemachine.states.Disconnected(this.context));
    }
};
timapi.statemachine.states.WaitShowDialog.prototype.closeReader = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitShowDialog.prototype.openReader = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitShowDialog.prototype.ejectCard = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitShowDialog.prototype.openMaintenanceWindow = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitShowDialog.prototype.closeMaintenanceWindow = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitShowDialog.prototype.activateServiceMenu = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitShowDialog.prototype.balanceInquiry = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitShowDialog.prototype.openDialogMode = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitShowDialog.prototype.closeDialogMode = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitShowDialog.prototype.showSignatureCapture = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitShowDialog.prototype.showDialog = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitShowDialog.prototype.sendCardCommand = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitShowSignatureCapture = function (context) {
    timapi.statemachine.states.DefaultState.call(this, context);
};
timapi.statemachine.states.WaitShowSignatureCapture.prototype = Object.create(timapi.statemachine.states.DefaultState.prototype);
timapi.statemachine.states.WaitShowSignatureCapture.loggerName = "timapi.statemachine.states.WaitShowSignatureCapture";
timapi.statemachine.states.WaitShowSignatureCapture.classname = "WaitShowSignatureCapture";
timapi.statemachine.states.WaitShowSignatureCapture.logger = timapi.logging.Logger.getLogger(timapi.statemachine.states.WaitShowSignatureCapture.loggerName);
timapi.statemachine.states.WaitShowSignatureCapture.prototype.enterState = function () {
    timapi.statemachine.states.DefaultState.prototype.enterState.call(this);
    this.context.actionClearPendingEvent();
};
timapi.statemachine.states.WaitShowSignatureCapture.prototype.activate = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitShowSignatureCapture.prototype.applicationInformation = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitShowSignatureCapture.prototype.balance = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitShowSignatureCapture.prototype.cancel = function () {
    this.context.actionClearPendingCancel();
    this.context.actionCancel();
};
timapi.statemachine.states.WaitShowSignatureCapture.prototype.changeSettings = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitShowSignatureCapture.prototype.commit = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitShowSignatureCapture.prototype.connect = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitShowSignatureCapture.prototype.counterRequest = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitShowSignatureCapture.prototype.deactivate = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitShowSignatureCapture.prototype.disconnect = function () {
    this.context.actionSendErrorResponseDisconnect();
    this.context.actionClearPendingEvent();
    this.context.actionDisconnect();
    this.context.setState(new timapi.statemachine.states.Disconnected(this.context));
};
timapi.statemachine.states.WaitShowSignatureCapture.prototype.dccRates = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitShowSignatureCapture.prototype.hardwareInformation = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitShowSignatureCapture.prototype.initTransaction = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitShowSignatureCapture.prototype.login = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitShowSignatureCapture.prototype.logout = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitShowSignatureCapture.prototype.reboot = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitShowSignatureCapture.prototype.reconciliation = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitShowSignatureCapture.prototype.receiptRequest = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitShowSignatureCapture.prototype.reconfig = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitShowSignatureCapture.prototype.rollback = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitShowSignatureCapture.prototype.softwareUpdate = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitShowSignatureCapture.prototype.systemInformation = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitShowSignatureCapture.prototype.transaction = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitShowSignatureCapture.prototype.connected = function () {
};
timapi.statemachine.states.WaitShowSignatureCapture.prototype.connectFailed = function () {
    this.context.actionClearPendingEvent();
    this.context.setState(new timapi.statemachine.states.ErrorState(this.context));
};
timapi.statemachine.states.WaitShowSignatureCapture.prototype.responseRequest = function () {
    this.context.actionProcessResponseShowSignatureCapture();
    this.context.setState(new timapi.statemachine.states.DialogMode(this.context));
};
timapi.statemachine.states.WaitShowSignatureCapture.prototype.responseError = function () {
    this.context.actionClearPendingEvent();
    this.context.actionProcessResponseError();
    this.context.setState(new timapi.statemachine.states.DialogMode(this.context));
};
timapi.statemachine.states.WaitShowSignatureCapture.prototype.responseBusy = function () {
    this.context.actionClearPendingEvent();
    this.context.actionProcessResponseError();
    this.context.setState(new timapi.statemachine.states.DialogMode(this.context));
};
timapi.statemachine.states.WaitShowSignatureCapture.prototype.timeout = function () {
    this.context.actionErrorTimeout();
    this.context.setState(new timapi.statemachine.states.DialogMode(this.context));
};
timapi.statemachine.states.WaitShowSignatureCapture.prototype.keepAliveTimeout = function () {
    try {
        this.context.actionErrorConnectionLost();
        this.context.actionDisconnect();
        this.context.setState(new timapi.statemachine.states.Disconnected(this.context));
    }
    catch (e) {
        timapi.statemachine.states.WaitShowSignatureCapture.logger.log(timapi.logging.Level.severe, "Exception", e);
        this.context.setState(new timapi.statemachine.states.Disconnected(this.context));
    }
};
timapi.statemachine.states.WaitShowSignatureCapture.prototype.closeReader = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitShowSignatureCapture.prototype.openReader = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitShowSignatureCapture.prototype.ejectCard = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitShowSignatureCapture.prototype.openMaintenanceWindow = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitShowSignatureCapture.prototype.closeMaintenanceWindow = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitShowSignatureCapture.prototype.activateServiceMenu = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitShowSignatureCapture.prototype.balanceInquiry = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitShowSignatureCapture.prototype.openDialogMode = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitShowSignatureCapture.prototype.closeDialogMode = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitShowSignatureCapture.prototype.showSignatureCapture = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitShowSignatureCapture.prototype.showDialog = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitShowSignatureCapture.prototype.sendCardCommand = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitSoftwareUpdate = function (context) {
    timapi.statemachine.states.DefaultState.call(this, context);
};
timapi.statemachine.states.WaitSoftwareUpdate.prototype = Object.create(timapi.statemachine.states.DefaultState.prototype);
timapi.statemachine.states.WaitSoftwareUpdate.loggerName = "timapi.statemachine.states.WaitSoftwareUpdate";
timapi.statemachine.states.WaitSoftwareUpdate.classname = "WaitSoftwareUpdate";
timapi.statemachine.states.WaitSoftwareUpdate.logger = timapi.logging.Logger.getLogger(timapi.statemachine.states.WaitSoftwareUpdate.loggerName);
timapi.statemachine.states.WaitSoftwareUpdate.prototype.enterState = function () {
    timapi.statemachine.states.DefaultState.prototype.enterState.call(this);
    this.context.actionClearPendingEvent();
};
timapi.statemachine.states.WaitSoftwareUpdate.prototype.activate = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitSoftwareUpdate.prototype.applicationInformation = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitSoftwareUpdate.prototype.balance = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitSoftwareUpdate.prototype.cancel = function () {
    this.context.actionClearPendingCancel();
    this.context.actionCancel();
};
timapi.statemachine.states.WaitSoftwareUpdate.prototype.changeSettings = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitSoftwareUpdate.prototype.commit = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitSoftwareUpdate.prototype.connect = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitSoftwareUpdate.prototype.counterRequest = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitSoftwareUpdate.prototype.deactivate = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitSoftwareUpdate.prototype.disconnect = function () {
    this.context.actionSendErrorResponseDisconnect();
    this.context.actionClearPendingEvent();
    this.context.actionDisconnect();
    this.context.setState(new timapi.statemachine.states.Disconnected(this.context));
};
timapi.statemachine.states.WaitSoftwareUpdate.prototype.dccRates = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitSoftwareUpdate.prototype.hardwareInformation = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitSoftwareUpdate.prototype.initTransaction = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitSoftwareUpdate.prototype.login = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitSoftwareUpdate.prototype.logout = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitSoftwareUpdate.prototype.reboot = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitSoftwareUpdate.prototype.reconciliation = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitSoftwareUpdate.prototype.receiptRequest = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitSoftwareUpdate.prototype.reconfig = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitSoftwareUpdate.prototype.rollback = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitSoftwareUpdate.prototype.softwareUpdate = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitSoftwareUpdate.prototype.systemInformation = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitSoftwareUpdate.prototype.transaction = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitSoftwareUpdate.prototype.connected = function () {
};
timapi.statemachine.states.WaitSoftwareUpdate.prototype.connectFailed = function () {
    this.context.actionClearPendingEvent();
    this.context.setState(new timapi.statemachine.states.ErrorState(this.context));
};
timapi.statemachine.states.WaitSoftwareUpdate.prototype.responseRequest = function () {
    this.context.actionProcessResponseSoftwareUpdate();
    this.context.setState(new timapi.statemachine.states.CommandFinishedInClosed(this.context));
};
timapi.statemachine.states.WaitSoftwareUpdate.prototype.responseError = function () {
    this.context.actionClearPendingEvent();
    this.context.actionProcessResponseError();
    this.context.setState(new timapi.statemachine.states.CommandFinishedInClosed(this.context));
};
timapi.statemachine.states.WaitSoftwareUpdate.prototype.responseBusy = function () {
    this.context.actionClearPendingEvent();
    this.context.actionProcessResponseError();
    this.context.setState(new timapi.statemachine.states.CommandFinishedInClosed(this.context));
};
timapi.statemachine.states.WaitSoftwareUpdate.prototype.timeout = function () {
    this.context.actionErrorTimeout();
    this.context.setState(new timapi.statemachine.states.CommandFinishedInClosed(this.context));
};
timapi.statemachine.states.WaitSoftwareUpdate.prototype.keepAliveTimeout = function () {
    try {
        this.context.actionErrorConnectionLost();
        this.context.actionDisconnect();
        this.context.setState(new timapi.statemachine.states.Disconnected(this.context));
    }
    catch (e) {
        timapi.statemachine.states.WaitSoftwareUpdate.logger.log(timapi.logging.Level.severe, "Exception", e);
        this.context.setState(new timapi.statemachine.states.Disconnected(this.context));
    }
};
timapi.statemachine.states.WaitSoftwareUpdate.prototype.closeReader = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitSoftwareUpdate.prototype.openReader = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitSoftwareUpdate.prototype.ejectCard = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitSoftwareUpdate.prototype.openMaintenanceWindow = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitSoftwareUpdate.prototype.closeMaintenanceWindow = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitSoftwareUpdate.prototype.activateServiceMenu = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitSoftwareUpdate.prototype.balanceInquiry = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitSoftwareUpdate.prototype.openDialogMode = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitSoftwareUpdate.prototype.closeDialogMode = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitSoftwareUpdate.prototype.showSignatureCapture = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitSoftwareUpdate.prototype.showDialog = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitSoftwareUpdate.prototype.sendCardCommand = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitSystemInformation = function (context) {
    timapi.statemachine.states.DefaultState.call(this, context);
};
timapi.statemachine.states.WaitSystemInformation.prototype = Object.create(timapi.statemachine.states.DefaultState.prototype);
timapi.statemachine.states.WaitSystemInformation.loggerName = "timapi.statemachine.states.WaitSystemInformation";
timapi.statemachine.states.WaitSystemInformation.classname = "WaitSystemInformation";
timapi.statemachine.states.WaitSystemInformation.logger = timapi.logging.Logger.getLogger(timapi.statemachine.states.WaitSystemInformation.loggerName);
timapi.statemachine.states.WaitSystemInformation.prototype.enterState = function () {
    timapi.statemachine.states.DefaultState.prototype.enterState.call(this);
    this.context.actionClearPendingEvent();
};
timapi.statemachine.states.WaitSystemInformation.prototype.activate = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitSystemInformation.prototype.applicationInformation = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitSystemInformation.prototype.balance = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitSystemInformation.prototype.cancel = function () {
    this.context.actionClearPendingCancel();
    this.context.actionCancel();
};
timapi.statemachine.states.WaitSystemInformation.prototype.changeSettings = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitSystemInformation.prototype.commit = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitSystemInformation.prototype.connect = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitSystemInformation.prototype.counterRequest = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitSystemInformation.prototype.deactivate = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitSystemInformation.prototype.disconnect = function () {
    this.context.actionSendErrorResponseDisconnect();
    this.context.actionClearPendingEvent();
    this.context.actionDisconnect();
    this.context.setState(new timapi.statemachine.states.Disconnected(this.context));
};
timapi.statemachine.states.WaitSystemInformation.prototype.dccRates = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitSystemInformation.prototype.hardwareInformation = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitSystemInformation.prototype.initTransaction = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitSystemInformation.prototype.login = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitSystemInformation.prototype.logout = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitSystemInformation.prototype.reboot = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitSystemInformation.prototype.reconciliation = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitSystemInformation.prototype.receiptRequest = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitSystemInformation.prototype.reconfig = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitSystemInformation.prototype.rollback = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitSystemInformation.prototype.softwareUpdate = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitSystemInformation.prototype.systemInformation = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitSystemInformation.prototype.transaction = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitSystemInformation.prototype.connected = function () {
};
timapi.statemachine.states.WaitSystemInformation.prototype.connectFailed = function () {
    this.context.actionClearPendingEvent();
    this.context.setState(new timapi.statemachine.states.ErrorState(this.context));
};
timapi.statemachine.states.WaitSystemInformation.prototype.responseRequest = function () {
    this.context.actionProcessResponseSystemInformation();
    this.context.setState(new timapi.statemachine.states.CommandFinishedInClosed(this.context));
};
timapi.statemachine.states.WaitSystemInformation.prototype.responseError = function () {
    this.context.actionClearPendingEvent();
    this.context.actionProcessResponseError();
    this.context.setState(new timapi.statemachine.states.CommandFinishedInClosed(this.context));
};
timapi.statemachine.states.WaitSystemInformation.prototype.responseBusy = function () {
    this.context.actionClearPendingEvent();
    this.context.actionProcessResponseError();
    this.context.setState(new timapi.statemachine.states.CommandFinishedInClosed(this.context));
};
timapi.statemachine.states.WaitSystemInformation.prototype.timeout = function () {
    this.context.actionErrorTimeout();
    this.context.setState(new timapi.statemachine.states.CommandFinishedInClosed(this.context));
};
timapi.statemachine.states.WaitSystemInformation.prototype.keepAliveTimeout = function () {
    try {
        this.context.actionErrorConnectionLost();
        this.context.actionDisconnect();
        this.context.setState(new timapi.statemachine.states.Disconnected(this.context));
    }
    catch (e) {
        timapi.statemachine.states.WaitSystemInformation.logger.log(timapi.logging.Level.severe, "Exception", e);
        this.context.setState(new timapi.statemachine.states.Disconnected(this.context));
    }
};
timapi.statemachine.states.WaitSystemInformation.prototype.closeReader = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitSystemInformation.prototype.openReader = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitSystemInformation.prototype.ejectCard = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitSystemInformation.prototype.openMaintenanceWindow = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitSystemInformation.prototype.closeMaintenanceWindow = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitSystemInformation.prototype.activateServiceMenu = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitSystemInformation.prototype.balanceInquiry = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitSystemInformation.prototype.openDialogMode = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitSystemInformation.prototype.closeDialogMode = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitSystemInformation.prototype.showSignatureCapture = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitSystemInformation.prototype.showDialog = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitSystemInformation.prototype.sendCardCommand = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitTransaction = function (context) {
    timapi.statemachine.states.DefaultState.call(this, context);
};
timapi.statemachine.states.WaitTransaction.prototype = Object.create(timapi.statemachine.states.DefaultState.prototype);
timapi.statemachine.states.WaitTransaction.loggerName = "timapi.statemachine.states.WaitTransaction";
timapi.statemachine.states.WaitTransaction.classname = "WaitTransaction";
timapi.statemachine.states.WaitTransaction.logger = timapi.logging.Logger.getLogger(timapi.statemachine.states.WaitTransaction.loggerName);
timapi.statemachine.states.WaitTransaction.prototype.enterState = function () {
    timapi.statemachine.states.DefaultState.prototype.enterState.call(this);
    this.context.actionClearPendingEvent();
    this.context.actionArmTimeoutLongRequest();
};
timapi.statemachine.states.WaitTransaction.prototype.activate = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitTransaction.prototype.applicationInformation = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitTransaction.prototype.balance = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitTransaction.prototype.cancel = function () {
    this.context.actionClearPendingCancel();
    this.context.actionCancel();
};
timapi.statemachine.states.WaitTransaction.prototype.changeSettings = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitTransaction.prototype.commit = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitTransaction.prototype.connect = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitTransaction.prototype.counterRequest = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitTransaction.prototype.deactivate = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitTransaction.prototype.disconnect = function () {
    this.context.actionSendErrorResponseDisconnect();
    this.context.actionClearPendingEvent();
    this.context.actionDisconnect();
    this.context.setState(new timapi.statemachine.states.Disconnected(this.context));
};
timapi.statemachine.states.WaitTransaction.prototype.dccRates = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitTransaction.prototype.hardwareInformation = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitTransaction.prototype.initTransaction = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitTransaction.prototype.login = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitTransaction.prototype.logout = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitTransaction.prototype.reboot = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitTransaction.prototype.reconciliation = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitTransaction.prototype.receiptRequest = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitTransaction.prototype.reconfig = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitTransaction.prototype.rollback = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitTransaction.prototype.softwareUpdate = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitTransaction.prototype.systemInformation = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitTransaction.prototype.transaction = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitTransaction.prototype.connected = function () {
};
timapi.statemachine.states.WaitTransaction.prototype.connectFailed = function () {
    this.context.actionClearPendingEvent();
    this.context.setState(new timapi.statemachine.states.ErrorState(this.context));
};
timapi.statemachine.states.WaitTransaction.prototype.responseRequest = function () {
    if (this.context.conditionTransactionNoCommit()) {
        this.context.actionProcessResponseTransaction();
        this.context.setState(new timapi.statemachine.states.CommandFinishedInOpen(this.context));
        return;
    }
    this.context.actionProcessResponseTransaction();
    this.context.setState(new timapi.statemachine.states.WaitForCommit(this.context));
};
timapi.statemachine.states.WaitTransaction.prototype.responseError = function () {
    this.context.actionClearPendingEvent();
    this.context.actionProcessResponseError();
    this.context.setState(new timapi.statemachine.states.CommandFinishedInOpen(this.context));
};
timapi.statemachine.states.WaitTransaction.prototype.responseBusy = function () {
    this.context.actionClearPendingEvent();
    this.context.actionProcessResponseError();
    this.context.setState(new timapi.statemachine.states.CommandFinishedInOpen(this.context));
};
timapi.statemachine.states.WaitTransaction.prototype.timeout = function () {
    this.context.actionErrorTimeout();
    this.context.setState(new timapi.statemachine.states.CommandFinishedInOpen(this.context));
};
timapi.statemachine.states.WaitTransaction.prototype.keepAliveTimeout = function () {
    try {
        this.context.actionErrorConnectionLost();
        this.context.actionDisconnect();
        this.context.setState(new timapi.statemachine.states.Disconnected(this.context));
    }
    catch (e) {
        timapi.statemachine.states.WaitTransaction.logger.log(timapi.logging.Level.severe, "Exception", e);
        this.context.setState(new timapi.statemachine.states.Disconnected(this.context));
    }
};
timapi.statemachine.states.WaitTransaction.prototype.closeReader = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitTransaction.prototype.openReader = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitTransaction.prototype.ejectCard = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitTransaction.prototype.openMaintenanceWindow = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitTransaction.prototype.closeMaintenanceWindow = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitTransaction.prototype.activateServiceMenu = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitTransaction.prototype.amtAdjustment = function () {
    if (!this.context.conditionHasGuideUnattended()) {
        this.context.actionErrorDisabledFeature();
        return;
    }
    this.context.actionAmtAdjustment();
};
timapi.statemachine.states.WaitTransaction.prototype.balanceInquiry = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitTransaction.prototype.openDialogMode = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitTransaction.prototype.closeDialogMode = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitTransaction.prototype.showSignatureCapture = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitTransaction.prototype.showDialog = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitTransaction.prototype.sendCardCommand = function () {
    this.context.actionErrorRequestInProgress();
};
var timapi;
(function (timapi) {
    class ActivateResponse {
        constructor(printData, actSeqCounter) {
            this.printData = printData;
            this.actSeqCounter = actSeqCounter;
        }
        get $printData() {
            return this.printData;
        }
        get $actSeqCounter() {
            return this.actSeqCounter;
        }
    }
    timapi.ActivateResponse = ActivateResponse;
})(timapi || (timapi = {}));
var timapi;
(function (timapi) {
    class Amount {
        constructor($amount, $currency) {
            if (this.isFloating($amount)) {
                this.amount = this.integerRepresentation($amount, $currency.exponent);
            }
            else {
                this.amount = $amount;
            }
            this.currency = $currency;
        }
        getIntAmount() {
            return this.integerRepresentation(this.amount, this.currency.exponent);
        }
        get $amount() {
            return this.amount;
        }
        set $amount(value) {
            this.amount = value;
        }
        getDecimalValue() {
            return 0;
        }
        setDecimalValue(double) {
        }
        get $currency() {
            return this.currency;
        }
        set $currency(value) {
            this.currency = value;
        }
        isFloating(value) {
            const numberValue = Number(value);
            const stringValue = String(value);
            return String(numberValue).length !== stringValue.length || value % 1 !== 0;
        }
        integerRepresentation(value, exponent) {
            let result = Math.pow(10, exponent) * value;
            return result;
        }
    }
    timapi.Amount = Amount;
})(timapi || (timapi = {}));
var timapi;
(function (timapi) {
    class AmountDcc {
        constructor($amount, $currency, $rate, $rateExponent, $markup, $markupExponent) {
            if (this.isFloating($amount)) {
                this.amount = this.integerRepresentation($amount, $currency.exponent);
            }
            else {
                this.amount = $amount;
            }
            this.currency = $currency;
            this.rate = $rate;
            this.rateExponent = $rateExponent;
            this.markup = $markup;
            this.markupExponent = $markupExponent;
        }
        get $amount() {
            return this.amount;
        }
        getIntamount() {
            return this.integerRepresentation(this.amount, 0);
        }
        getDecimalValue() {
            return 0;
        }
        get $currency() {
            return this.currency;
        }
        get $rate() {
            return this.rate;
        }
        get $rateExponent() {
            return this.rateExponent;
        }
        getRateDecimal() {
            return 0;
        }
        get $markup() {
            return this.markup;
        }
        get $markupExponent() {
            return this.markupExponent;
        }
        getMarkupDecimal() {
            if (this.markup == undefined || this.markupExponent == undefined) {
                throw new EvalError("markup and/or markupExponent are undefined");
            }
            return 0;
        }
        isFloating(value) {
            return value % 1 !== 0;
        }
        integerRepresentation(value, exponent) {
            let result = Math.pow(10, exponent) * value;
            return result;
        }
    }
    timapi.AmountDcc = AmountDcc;
})(timapi || (timapi = {}));
var timapi;
(function (timapi) {
    class AmountDiscount {
        constructor($amount, $currency, $discountId) {
            if (this.isFloating($amount)) {
                this.amount = this.integerRepresentation($amount, $currency.exponent);
            }
            else {
                this.amount = $amount;
            }
            this.currency = $currency;
            this.discountId = $discountId;
        }
        get $amount() {
            return this.amount;
        }
        getIntamount() {
            return this.integerRepresentation(this.amount, 0);
        }
        getDecimalValue() {
            return 0;
        }
        set $amount(value) {
            this.amount = value;
        }
        setIntAmount(value) {
            this.amount = value;
        }
        setDecimalValue(value) {
        }
        get $currency() {
            return this.currency;
        }
        set $currency(value) {
            this.currency = value;
        }
        get $discountId() {
            return this.discountId;
        }
        set $discountId(value) {
            this.discountId = value;
        }
        isFloating(value) {
            return value % 1 !== 0;
        }
        integerRepresentation(value, exponent) {
            let result = Math.pow(10, exponent) * value;
            return result;
        }
    }
    timapi.AmountDiscount = AmountDiscount;
})(timapi || (timapi = {}));
var timapi;
(function (timapi) {
    class Application {
        constructor($aid, $label) {
            this.aid = $aid;
            this.label = $label;
        }
        get $aid() {
            return this.aid;
        }
        get $label() {
            return this.label;
        }
    }
    timapi.Application = Application;
})(timapi || (timapi = {}));
var timapi;
(function (timapi) {
    class BalanceInquiryResponse {
        constructor($amount, $printData) {
            this.amount = $amount;
            this.printData = $printData;
        }
        get $amount() {
            return this.amount;
        }
        get $printData() {
            return this.printData;
        }
    }
    timapi.BalanceInquiryResponse = BalanceInquiryResponse;
})(timapi || (timapi = {}));
var timapi;
(function (timapi) {
    class BalanceResponse {
        constructor($counters, $printData) {
            this.counters = $counters;
            this.printData = $printData;
        }
        get $printData() {
            return this.printData;
        }
        get $counters() {
            return this.counters;
        }
    }
    timapi.BalanceResponse = BalanceResponse;
})(timapi || (timapi = {}));
var timapi;
(function (timapi) {
    class BasketItem {
        constructor(copy) {
            if (copy !== undefined && copy !== undefined) {
                this.authResult = copy.authResult;
                this.itemId = copy.itemId;
                this.loyaltyId = copy.loyaltyId;
                this.amount = copy.amount;
                this.amountTotal = copy.amountTotal;
                this.amountDiscount = copy.amountDiscount;
                this.amountTax = copy.amountTax;
                this.itemQuantity = copy.itemQuantity;
                this.loyaltyAuthResult = copy.loyaltyAuthResult;
                this.prodDescription = copy.prodDescription;
            }
        }
        get $authResult() {
            return this.authResult;
        }
        set $authResult(value) {
            this.authResult = value;
        }
        get $itemId() {
            return this.itemId;
        }
        set $itemId(value) {
            this.itemId = value;
        }
        get $loyaltyId() {
            return this.loyaltyId;
        }
        set $loyaltyId(value) {
            this.loyaltyId = value;
        }
        get $amount() {
            return this.amount;
        }
        set $amount(value) {
            this.amount = value;
        }
        get $amountTotal() {
            return this.amountTotal;
        }
        set $amountTotal(value) {
            this.amountTotal = value;
        }
        get $amountDiscount() {
            return this.amountDiscount;
        }
        set $amountDiscount(value) {
            this.amountDiscount = value;
        }
        get $amountTax() {
            return this.amountTax;
        }
        set $amountTax(value) {
            this.amountTax = value;
        }
        get $itemQuantity() {
            return this.itemQuantity;
        }
        set $itemQuantity(value) {
            this.itemQuantity = value;
        }
        get $loyaltyAuthResult() {
            return this.loyaltyAuthResult;
        }
        set $loyaltyAuthResult(value) {
            this.loyaltyAuthResult = value;
        }
        get $prodDescription() {
            return this.prodDescription;
        }
        set $prodDescription(value) {
            this.prodDescription = value;
        }
    }
    timapi.BasketItem = BasketItem;
})(timapi || (timapi = {}));
var timapi;
(function (timapi) {
    class Brands {
        constructor($name, $dccAvailable, $paymentProtocol, $acqId, $lastInitDate, $applications, $currencies) {
            this.name = $name;
            this.dccAvailable = $dccAvailable;
            this.paymentProtocol = $paymentProtocol;
            this.acqId = $acqId;
            this.lastInitDate = $lastInitDate;
            this.applications = $applications;
            this.currencies = $currencies;
        }
        get $name() {
            return this.name;
        }
        get $dccAvailable() {
            return this.dccAvailable;
        }
        get $paymentProtocol() {
            return this.paymentProtocol;
        }
        get $acqId() {
            return this.acqId;
        }
        get $lastInitDate() {
            return this.lastInitDate;
        }
        get $applications() {
            return this.applications;
        }
        get $currencies() {
            return this.currencies;
        }
    }
    timapi.Brands = Brands;
})(timapi || (timapi = {}));
var timapi;
(function (timapi) {
    class CardData {
        constructor($posEntryMode, $aid, $acc, $cardNumber, $cardNumberPrintable, $cardNumberPrintableCardholder, cardNumberEnc, $cardNumberEncKeyIndex, $cardExpiryDate, $brandName, $tenderName, $cardTrackDatas, $loyaltyInformations, $cardRef, $processingDisposition, $language) {
            this.posEntryMode = $posEntryMode;
            this.aid = $aid;
            this.acc = $acc;
            this.cardNumber = $cardNumber;
            this.cardNumberPrintable = $cardNumberPrintable;
            this.cardNumberPrintableCardholder = $cardNumberPrintableCardholder;
            this.cardNumberEnc = cardNumberEnc;
            this.cardNumberEncKeyIndex = $cardNumberEncKeyIndex;
            this.cardExpiryDate = $cardExpiryDate;
            this.brandName = $brandName;
            this.tenderName = $tenderName;
            this.cardTrackDatas = $cardTrackDatas;
            this.loyaltyInformations = $loyaltyInformations;
            this.cardRef = $cardRef;
            this.processingDisposition = $processingDisposition;
            this.language = $language;
        }
        get $posEntryMode() {
            return this.posEntryMode;
        }
        get $aid() {
            return this.aid;
        }
        get $acc() {
            return this.acc;
        }
        get $cardNumber() {
            return this.cardNumber;
        }
        get $cardNumberPrintable() {
            return this.cardNumberPrintable;
        }
        get $cardNumberPrintableCardholder() {
            return this.cardNumberPrintableCardholder;
        }
        get $cardNumberEnc() {
            return this.cardNumberEnc;
        }
        get $cardNumberEncKeyIndex() {
            return this.cardNumberEncKeyIndex;
        }
        get $cardExpiryDate() {
            return this.cardExpiryDate;
        }
        get $brandName() {
            return this.brandName;
        }
        get $tenderName() {
            return this.tenderName;
        }
        get $cardTrackDatas() {
            return this.cardTrackDatas;
        }
        get $loyaltyInformations() {
            return this.loyaltyInformations;
        }
        get $cardRef() {
            return this.cardRef;
        }
        get $processingDisposition() {
            return this.processingDisposition;
        }
        get $language() {
            return this.language;
        }
    }
    timapi.CardData = CardData;
})(timapi || (timapi = {}));
var timapi;
(function (timapi) {
    class CardTrackData {
        constructor($trackNum, $data) {
            this.trackNum = $trackNum;
            this.data = $data.slice();
        }
        get $trackNum() {
            return this.trackNum;
        }
        get $data() {
            return this.data;
        }
    }
    timapi.CardTrackData = CardTrackData;
})(timapi || (timapi = {}));
var timapi;
(function (timapi) {
    class ConfigData {
        constructor($receiptHeader, $language) {
            this.receiptHeader = $receiptHeader.slice();
            this.language = $language;
        }
        get $receiptHeader() {
            return this.receiptHeader.slice();
        }
        get $language() {
            return this.language;
        }
    }
    timapi.ConfigData = ConfigData;
})(timapi || (timapi = {}));
var timapi;
(function (timapi) {
    class Convenience {
        static needsSignature(cvm) {
            switch (cvm) {
                case timapi.constants.Cvm.signature:
                case timapi.constants.Cvm.pinSignature:
                    return true;
                default:
                    return false;
            }
        }
        static processPrintReceipts(terminal, printData) {
            if (printData == undefined || printData == undefined) {
                return undefined;
            }
            if (printData.$receiptItems.length > 0) {
                return printData;
            }
            let receipts = new Array();
            if (terminal !== undefined) {
                const formatter = terminal.$receiptFormatter;
                if (formatter == undefined) {
                    return printData;
                }
                if (printData !== undefined && printData !== undefined) {
                    for (let items of printData.$receiptItems) {
                        receipts = receipts.concat(formatter.formatReceipt(terminal, items));
                    }
                }
            }
            return new timapi.PrintData(receipts, new Array());
        }
    }
    timapi.Convenience = Convenience;
})(timapi || (timapi = {}));
timapi.ConversionHelper = {};
timapi.ConversionHelper.byteToHexString = function (bytes) {
    var builder = [];
    for (each of bytes) {
        var nibble = (each & 0xf0) >> 4;
        if (nibble < 10) {
            builder.push(48 + nibble);
        }
        else {
            builder.push(65 + nibble - 10);
        }
        nibble = each & 0x0f;
        if (nibble < 10) {
            builder.push(48 + nibble);
        }
        else {
            builder.push(65 + nibble - 10);
        }
    }
    return String.fromCharCode.apply(undefined, builder);
};
timapi.ConversionHelper.byteOrUndefineToHexString = function (bytes) {
    if (bytes == undefined) {
        return "";
    }
    else {
        return this.byteToHexString(bytes);
    }
};
timapi.ConversionHelper.hexStringToByte = function (string) {
    var bytes = new Uint8Array(string.length / 2);
    var offset = 0;
    var shift = 4;
    var i;
    for (each of string) {
        var value = each.charCodeAt(0);
        if (value >= 48 && value <= 57) {
            bytes[offset] |= ((value - 48) & 0xff) << shift;
        }
        else if (value >= 97 && value <= 102) {
            bytes[offset] |= ((value - 97 + 10) & 0xff) << shift;
        }
        else if (value >= 65 && value <= 70) {
            bytes[offset] |= ((value - 65 + 10) & 0xff) << shift;
        }
        if (shift == 4) {
            shift = 0;
        }
        else {
            offset++;
            shift = 4;
        }
    }
    return bytes;
};
var timapi;
(function (timapi) {
    class Counter {
        constructor($brandName, $paymentProtocol, $acqId, $count, $countDcc, $countForeign, $totals) {
            this.brandName = $brandName;
            this.paymentProtocol = $paymentProtocol;
            this.acqId = $acqId;
            this.count = $count;
            this.countDcc = $countDcc;
            this.countForeign = $countForeign;
            this.totals = $totals;
        }
        get $brandName() {
            return this.brandName;
        }
        get $paymentProtocol() {
            return this.paymentProtocol;
        }
        get $acqId() {
            return this.acqId;
        }
        get $count() {
            return this.count;
        }
        get $countDcc() {
            return this.countDcc;
        }
        get $countForeign() {
            return this.countForeign;
        }
        get $totals() {
            return this.totals;
        }
    }
    timapi.Counter = Counter;
})(timapi || (timapi = {}));
var timapi;
(function (timapi) {
    class Counters {
        constructor($counterType, $seqCounter, $counters) {
            this.counterType = $counterType;
            this.seqCounter = $seqCounter;
            this.counters = $counters;
        }
        get $counterType() {
            return this.counterType;
        }
        get $seqCounter() {
            return this.seqCounter;
        }
        get $counters() {
            return this.counters;
        }
    }
    timapi.Counters = Counters;
})(timapi || (timapi = {}));
var timapi;
(function (timapi) {
    class CurrencyItem {
        constructor($currency, $type) {
            this.currency = $currency;
            this.type = $type;
        }
        get $currency() {
            return this.currency;
        }
        get $type() {
            return this.type;
        }
    }
    timapi.CurrencyItem = CurrencyItem;
})(timapi || (timapi = {}));
var timapi;
(function (timapi) {
    class DeactivateResponse {
        constructor($printData, $counters) {
            this.printData = $printData;
            this.counters = $counters;
        }
        get $printData() {
            return this.printData;
        }
        get $counters() {
            return this.counters;
        }
    }
    timapi.DeactivateResponse = DeactivateResponse;
})(timapi || (timapi = {}));
var timapi;
(function (timapi) {
    class DefaultTerminalListener {
        connectCompleted(event) {
            this.requestCompleted(event, undefined);
        }
        activateCompleted(event, data) {
            if (data !== undefined &&
                data !== undefined &&
                data.$printData !== undefined &&
                data.$printData !== undefined &&
                data.$printData.$receipts.length > 0) {
                this.printReceipts(event.$terminal, data.$printData);
            }
            this.requestCompleted(event, data);
        }
        applicationInformationCompleted(event) {
            this.requestCompleted(event, undefined);
        }
        balanceCompleted(event, data) {
            if (data !== undefined &&
                data !== undefined &&
                data.$printData !== undefined &&
                data.$printData.$receipts !== undefined &&
                data.$printData.$receipts.length > 0) {
                this.printReceipts(event.$terminal, data.$printData);
            }
            this.requestCompleted(event, data);
        }
        changeSettingsCompleted(event) {
            this.requestCompleted(event, undefined);
        }
        commitCompleted(event) {
            this.requestCompleted(event, undefined);
        }
        counterRequestCompleted(event, data) {
            this.requestCompleted(event, undefined);
        }
        deactivateCompleted(event, data) {
            if (data !== undefined &&
                data !== undefined &&
                data.$printData !== undefined &&
                data.$printData !== undefined &&
                data.$printData.$receipts.length > 0) {
                this.printReceipts(event.$terminal, data.$printData);
            }
            this.requestCompleted(event, data);
        }
        dccRatesCompleted(event, data) {
            if (data !== undefined && data !== undefined && data.$receipts.length > 0) {
                this.printReceipts(event.$terminal, data);
            }
            this.requestCompleted(event, data);
        }
        hardwareInformationCompleted(event, data) {
            this.requestCompleted(event, data);
        }
        initTransactionCompleted(event, data) {
            this.requestCompleted(event, data);
        }
        loginCompleted(event) {
            this.requestCompleted(event, undefined);
        }
        logoutCompleted(event) {
            this.requestCompleted(event, undefined);
        }
        rebootCompleted(event) {
            this.requestCompleted(event, undefined);
        }
        reconciliationCompleted(event, data) {
            if (data !== undefined &&
                data !== undefined &&
                data.$printData !== undefined &&
                data.$printData !== undefined &&
                data.$printData.$receipts.length > 0) {
                this.printReceipts(event.$terminal, data.$printData);
            }
            this.requestCompleted(event, data);
        }
        receiptRequestCompleted(event, data) {
            if (data !== undefined &&
                data !== undefined &&
                data.$printData !== undefined &&
                data.$printData !== undefined &&
                data.$printData.$receipts.length > 0) {
                this.printReceipts(event.$terminal, data.$printData);
            }
            this.requestCompleted(event, data);
        }
        reconfigCompleted(event, data) {
            if (data !== undefined && data !== undefined && data.$receipts.length > 0) {
                this.printReceipts(event.$terminal, data);
            }
            this.requestCompleted(event, data);
        }
        rollbackCompleted(event, data) {
            if (data !== undefined &&
                data !== undefined &&
                data.$receipts !== undefined &&
                data.$receipts !== undefined &&
                data.$receipts.length > 0) {
                this.printReceipts(event.$terminal, data);
            }
            this.requestCompleted(event, data);
        }
        softwareUpdateCompleted(event, data) {
            this.requestCompleted(event, data);
        }
        systemInformationCompleted(event, data) {
            this.requestCompleted(event, data);
        }
        transactionCompleted(event, data) {
            if (data !== undefined && data !== undefined) {
                this.processPrintReceipts(event.$terminal, data.$printData);
            }
            if (event.$exception !== undefined && event.$exception !== undefined) {
                this.processPrintReceipts(event.$terminal, event.$exception.$printData);
            }
            this.requestCompleted(event, data);
        }
        terminalStatusChanged(terminal) {
        }
        disconnected(terminal, exception) {
        }
        printReceipts(terminal, printData) {
        }
        requestCompleted(event, data) {
        }
        processPrintReceipts(terminal, printData) {
            printData = timapi.Convenience.processPrintReceipts(terminal, printData);
            if (printData == undefined || printData == undefined) {
                return;
            }
            if (printData.$receipts.length > 0) {
                this.printReceipts(terminal, printData);
            }
        }
        closeReaderCompleted(event) {
            this.requestCompleted(event, undefined);
        }
        openReaderCompleted(event) {
            this.requestCompleted(event, undefined);
        }
        ejectCardCompleted(event) {
            this.requestCompleted(event, undefined);
        }
        openMaintenanceWindowCompleted(event) {
            this.requestCompleted(event, undefined);
        }
        closeMaintenanceWindowCompleted(event) {
            this.requestCompleted(event, undefined);
        }
        activateServiceMenuCompleted(event) {
            this.requestCompleted(event, undefined);
        }
        openDialogModeCompleted(event) {
            this.requestCompleted(event, undefined);
        }
        closeDialogModeCompleted(event) {
            this.requestCompleted(event, undefined);
        }
        showSignatureCaptureCompleted(event, data) {
            this.requestCompleted(event, data);
        }
        showDialogCompleted(event, data) {
            this.requestCompleted(event, data);
        }
        balanceInquiryCompleted(event, data) {
            if (data !== undefined &&
                data !== undefined &&
                data.$printData !== undefined &&
                data !== undefined &&
                data.$printData.$receipts.length > 0) {
                this.printReceipts(event.$terminal, data.$printData);
            }
            this.requestCompleted(event, data);
        }
        queryLoyaltyCompleted(event, data) {
            this.requestCompleted(event, data);
        }
    }
    timapi.DefaultTerminalListener = DefaultTerminalListener;
})(timapi || (timapi = {}));
var timapi;
(function (timapi) {
    class EcrInfo {
        get $type() {
            return this.type;
        }
        set $type(value) {
            this.type = value;
        }
        get $name() {
            return this.name;
        }
        set $name(value) {
            this.name = value;
        }
        get $manufacturerName() {
            return this.manufacturerName;
        }
        set $manufacturerName(value) {
            this.manufacturerName = value;
        }
        get $version() {
            return this.version;
        }
        set $version(value) {
            this.version = value;
        }
        get $serialNumber() {
            return this.serialNumber;
        }
        set $serialNumber(value) {
            this.serialNumber = value;
        }
        get $architecture() {
            return this.architecture;
        }
        set $architecture(value) {
            this.architecture = value;
        }
        get $integratorSolution() {
            return this.integratorSolution;
        }
        set $integratorSolution(value) {
            this.integratorSolution = value;
        }
        get $remoteIp() {
            return this.remoteIp;
        }
        set $remoteIp(value) {
            this.remoteIp = value;
        }
    }
    timapi.EcrInfo = EcrInfo;
})(timapi || (timapi = {}));
var timapi;
(function (timapi) {
    class ErrorMessages {
        static getErrorMessage(resultCode, terminalOrLanguage) {
            if (terminalOrLanguage instanceof timapi.Terminal) {
                this.getErrorMessageWithTerminal(resultCode, terminalOrLanguage);
            }
            else if (typeof terminalOrLanguage === "string") {
                this.getErrorMessageWithLanguage(resultCode, terminalOrLanguage);
            }
        }
        static getErrorMessageWithTerminal(resultCode, terminal) {
            return "";
        }
        static getErrorMessageWithLanguage(resultCode, language) {
            return "";
        }
        static loadMessageMap() {
        }
        static convertField(field) {
            return "";
        }
    }
    ErrorMessages.DEFAULT_LANGUAGE = "default";
    timapi.ErrorMessages = ErrorMessages;
})(timapi || (timapi = {}));
var timapi;
(function (timapi) {
    class Features {
        constructor($hardware, $payment, $sixml) {
            this.hardware = $hardware;
            this.payment = $payment;
            this.sixml = $sixml;
        }
        get $hardware() {
            return this.hardware;
        }
        get $payment() {
            return this.payment;
        }
        get $sixml() {
            return this.sixml;
        }
    }
    timapi.Features = Features;
})(timapi || (timapi = {}));
var timapi;
(function (timapi) {
    class FeaturesHardware {
        constructor($cardholderDisplay, $merchantDisplay, $printer, $displayBrightness, $displayContrast, $alertTones, $keypadTones) {
            this.cardholderDisplay = $cardholderDisplay;
            this.merchantDisplay = $merchantDisplay;
            this.printer = $printer;
            this.displayBrightness = $displayBrightness;
            this.displayContrast = $displayContrast;
            this.alertTones = $alertTones;
            this.keypadTones = $keypadTones;
        }
        get $CardholderDisplay() {
            return this.cardholderDisplay;
        }
        get $merchantDisplay() {
            return this.merchantDisplay;
        }
        get $printer() {
            return this.printer;
        }
        get $displayBrightness() {
            return this.displayBrightness;
        }
        get $displayContrast() {
            return this.displayContrast;
        }
        get $alertTones() {
            return this.alertTones;
        }
        get $keypadTones() {
            return this.keypadTones;
        }
    }
    timapi.FeaturesHardware = FeaturesHardware;
})(timapi || (timapi = {}));
var timapi;
(function (timapi) {
    class FeaturesPayment {
        constructor($dcc, $declinedReceipts, $partialApproval, $ep2Available, $ep2Dcc, $ep2DeclinedReceipts, $ep2MultiAccountSelection, $ep2MultiContractSelection) {
            this.dcc = $dcc;
            this.declinedReceipts = $declinedReceipts;
            this.partialApproval = $partialApproval;
            this.ep2Available = $ep2Available;
            this.ep2Dcc = $ep2Dcc;
            this.ep2DeclinedReceipts = $ep2DeclinedReceipts;
            this.ep2MultiAccountSelection = $ep2MultiAccountSelection;
            this.ep2MultiContractSelection = $ep2MultiContractSelection;
        }
        get $dcc() {
            return this.dcc;
        }
        get $declinedReceipts() {
            return this.declinedReceipts;
        }
        get $partialApproval() {
            return this.partialApproval;
        }
        get $ep2Available() {
            return this.ep2Available;
        }
        get $ep2Dcc() {
            return this.ep2Dcc;
        }
        get $ep2DeclinedReceipts() {
            return this.ep2DeclinedReceipts;
        }
        get $ep2MultiAccountSelection() {
            return this.ep2MultiAccountSelection;
        }
        get $ep2MultiContractSelection() {
            return this.ep2MultiContractSelection;
        }
    }
    timapi.FeaturesPayment = FeaturesPayment;
})(timapi || (timapi = {}));
var timapi;
(function (timapi) {
    let Support;
    (function (Support) {
        Support[Support["disabled"] = 0] = "disabled";
        Support[Support["supported"] = 1] = "supported";
        Support[Support["mandatory"] = 2] = "mandatory";
    })(Support = timapi.Support || (timapi.Support = {}));
    class FeaturesSixml {
        constructor($adminFunctions, $autoCommit, $autoShiftManagement, $autoShutterManagement, $financialFunctions, $guides, $nonFinancialFunctions, $protocolLevels, $sleepTimer, $statusFunctions, $dialogFunctions) {
            this.adminFunctions = $adminFunctions;
            this.autoCommit = $autoCommit;
            this.autoShiftManagement = $autoShiftManagement;
            this.autoShutterManagement = $autoShutterManagement;
            this.financialFunctions = $financialFunctions;
            this.guides = $guides;
            this.nonFinancialFunctions = $nonFinancialFunctions;
            this.protocolLevels = $protocolLevels;
            this.sleepTimer = $sleepTimer;
            this.statusFunctions = $statusFunctions;
            this.dialogFunctions = $dialogFunctions;
        }
        get $adminFunctions() {
            return this.adminFunctions;
        }
        get $autoCommit() {
            return this.autoCommit;
        }
        get $autoShiftManagement() {
            return this.autoShiftManagement;
        }
        get $autoShutterManagement() {
            return this.autoShutterManagement;
        }
        get $financialFunctions() {
            return this.financialFunctions;
        }
        get $guides() {
            return this.guides;
        }
        get $nonFinancialFunctions() {
            return this.nonFinancialFunctions;
        }
        get $protocolLevels() {
            return this.protocolLevels;
        }
        get $sleepTimer() {
            return this.sleepTimer;
        }
        get $statusFunctions() {
            return this.statusFunctions;
        }
        get $dialogFunctions() {
            return this.dialogFunctions;
        }
    }
    timapi.FeaturesSixml = FeaturesSixml;
})(timapi || (timapi = {}));
var timapi;
(function (timapi) {
    class Hardware {
        constructor($hardwareType, $serialNumber, $productionDate, $productVersion, $firmwareVersion, $securityStatus, $lastCleaningDate) {
            this.hardwareType = $hardwareType;
            this.serialNumber = $serialNumber;
            this.productionDate = $productionDate;
            this.productVersion = $productVersion;
            this.firmwareVersion = $firmwareVersion;
            this.securityStatus = $securityStatus;
            this.lastCleaningDate = $lastCleaningDate;
        }
        get $hardwareType() {
            return this.hardwareType;
        }
        get $serialNumber() {
            return this.serialNumber;
        }
        get $productionDate() {
            return this.productionDate;
        }
        get $productVersion() {
            return this.productVersion;
        }
        get $firmwareVersion() {
            return this.firmwareVersion;
        }
        get $securityStatus() {
            return this.securityStatus;
        }
        get $lastCleaningDate() {
            return this.lastCleaningDate;
        }
    }
    timapi.Hardware = Hardware;
})(timapi || (timapi = {}));
var timapi;
(function (timapi) {
    class HardwareInformationResponse {
        constructor($hardwares, $kernelVersions, $settings, $statistics) {
            this.hardwares = $hardwares;
            this.kernelVersions = $kernelVersions;
            this.settings = $settings;
            this.statistics = $statistics;
        }
        get $hardwares() {
            return this.hardwares;
        }
        get $kernelVersions() {
            return this.kernelVersions;
        }
        get $settings() {
            return this.settings;
        }
        get $statistics() {
            return this.statistics;
        }
    }
    timapi.HardwareInformationResponse = HardwareInformationResponse;
})(timapi || (timapi = {}));
var timapi;
(function (timapi) {
    class InternalBuildInfo {
    }
    InternalBuildInfo.VERSION = "3.8.1-97";
    InternalBuildInfo.DATE = "2018-08-31";
    timapi.InternalBuildInfo = InternalBuildInfo;
})(timapi || (timapi = {}));
var timapi;
(function (timapi) {
    class ItemQuantity {
        constructor($quantity, $exponent, $quantityType) {
            this.quantity = $quantity;
            this.exponent = $exponent;
            this.quantityType = $quantityType;
        }
        get $quantity() {
            return this.quantity;
        }
        get $exponent() {
            return this.exponent;
        }
        get $quantityType() {
            return this.quantityType;
        }
    }
    timapi.ItemQuantity = ItemQuantity;
})(timapi || (timapi = {}));
var timapi;
(function (timapi) {
    class MerchantOption {
        constructor($type, $value) {
            this.type = $type;
            this.value = $value;
        }
        get $type() {
            return this.type;
        }
        get $value() {
            return this.value;
        }
    }
    timapi.MerchantOption = MerchantOption;
})(timapi || (timapi = {}));
var timapi;
(function (timapi) {
    class NativeError {
        constructor($code, $message, $source) {
            this.code = $code;
            this.message = $message;
            this.source = $source;
        }
        get $code() {
            return this.code;
        }
        get $message() {
            return this.message;
        }
        get $source() {
            return this.source;
        }
    }
    timapi.NativeError = NativeError;
})(timapi || (timapi = {}));
var timapi;
(function (timapi) {
    class NetworkInformation {
        constructor($terminalIp, $terminalIpMask, $terminalIpGw, $terminalIpDns) {
            this.terminalIp = $terminalIp;
            this.terminalIpMask = $terminalIpMask;
            this.terminalIpGw = $terminalIpGw;
            this.terminalIpDns = $terminalIpDns;
        }
        get $terminalIp() {
            return this.terminalIp;
        }
        get $terminalIpMask() {
            return this.terminalIpMask;
        }
        get $terminalIpGw() {
            return this.terminalIpGw;
        }
        get $terminalIpDns() {
            return this.terminalIpDns;
        }
    }
    timapi.NetworkInformation = NetworkInformation;
})(timapi || (timapi = {}));
var timapi;
(function (timapi) {
    class PpInfo {
        constructor($paymentProtocol, $ppEp2TransSeqCntOrig, $ppEp2AuthReslt, $ppEp2AuthRespC) {
            this.paymentProtocol = $paymentProtocol;
            this.ppEp2TransSeqCntOrig = $ppEp2TransSeqCntOrig;
            this.ppEp2AuthReslt = $ppEp2AuthReslt;
            this.ppEp2AuthRespC = $ppEp2AuthRespC;
        }
        get $paymentProtocol() {
            return this.paymentProtocol;
        }
        get $ppEp2TransSeqCntOrig() {
            return this.ppEp2TransSeqCntOrig;
        }
        get $ppEp2AuthReslt() {
            return this.ppEp2AuthReslt;
        }
        get $ppEp2AuthRespC() {
            return this.ppEp2AuthRespC;
        }
    }
    timapi.PpInfo = PpInfo;
})(timapi || (timapi = {}));
var timapi;
(function (timapi) {
    class PrintData {
        constructor($receipts, $receiptItems) {
            this.receipts = $receipts.slice();
            this.receiptItems = $receiptItems.slice();
        }
        get $receipts() {
            return this.receipts;
        }
        get $receiptItems() {
            return this.receiptItems;
        }
    }
    timapi.PrintData = PrintData;
})(timapi || (timapi = {}));
var timapi;
(function (timapi) {
    class PrintOption {
        constructor($recipient, $printFormat, $printWidth, $printFlags) {
            this.recipient = $recipient;
            this.printFormat = $printFormat;
            this.printWidth = $printWidth;
            this.printFlags = $printFlags;
        }
        get $recipient() {
            return this.recipient;
        }
        get $printFormat() {
            return this.printFormat;
        }
        get $printWidth() {
            return this.printWidth;
        }
        get $printFlags() {
            return this.printFlags;
        }
    }
    timapi.PrintOption = PrintOption;
})(timapi || (timapi = {}));
var timapi;
(function (timapi) {
    class Receipt {
        constructor($recipient, $value) {
            this.recipient = $recipient;
            this.value = $value;
        }
        get $recipient() {
            return this.recipient;
        }
        get $value() {
            return this.value;
        }
    }
    timapi.Receipt = Receipt;
})(timapi || (timapi = {}));
var timapi;
(function (timapi) {
    class ReceiptItem {
        constructor($receiptItemType, $recipient, $value) {
            this.receiptItemType = $receiptItemType;
            this.recipient = $recipient;
            this.value = $value;
        }
        get $receiptItemType() {
            return this.receiptItemType;
        }
        get $recipient() {
            return this.recipient;
        }
        get $value() {
            return this.value;
        }
    }
    timapi.ReceiptItem = ReceiptItem;
})(timapi || (timapi = {}));
var timapi;
(function (timapi) {
    class ReceiptItems {
        constructor($receiptType, $receiptItem) {
            this.receiptType = $receiptType;
            this.receiptItem = $receiptItem;
        }
        get $receiptType() {
            return this.receiptType;
        }
        get $receiptItem() {
            return this.receiptItem;
        }
    }
    timapi.ReceiptItems = ReceiptItems;
})(timapi || (timapi = {}));
var timapi;
(function (timapi) {
    class ReceiptRequestResponse {
        constructor($printData, $hasMoreReceiptsL) {
            this.printData = $printData;
            this.hasMoreReceiptsL = $hasMoreReceiptsL;
        }
        get $printData() {
            return this.printData;
        }
        get $hasMoreReceiptsL() {
            return this.hasMoreReceiptsL;
        }
    }
    timapi.ReceiptRequestResponse = ReceiptRequestResponse;
})(timapi || (timapi = {}));
var timapi;
(function (timapi) {
    class ReconciliationResponse {
        constructor($counters, $printData) {
            this.counters = $counters;
            this.printData = $printData;
        }
        get $counters() {
            return this.counters;
        }
        get $printData() {
            return this.printData;
        }
    }
    timapi.ReconciliationResponse = ReconciliationResponse;
})(timapi || (timapi = {}));
var timapi;
(function (timapi) {
    class ShowDialogRequest {
        constructor($brandBar, $brandMode, $resourceId, $theme, $timeout, $language, $placeholderItems) {
            if ($brandBar !== undefined) {
                this.brandBar = $brandBar.slice();
            }
            else {
                this.brandBar = new Array();
            }
            if ($brandMode !== undefined) {
                this.brandMode = $brandMode;
            }
            else {
                this.$brandMode = timapi.constants.BrandMode.all;
            }
            if ($resourceId !== undefined) {
                this.resourceId = $resourceId;
            }
            else {
                this.resourceId = timapi.constants.ResourceId.welcomeCard;
            }
            if ($theme !== undefined) {
                this.theme = $theme;
            }
            else {
                this.theme = timapi.constants.Theme.six;
            }
            if ($timeout !== undefined) {
                this.timeout = $timeout;
            }
            else {
                this.timeout = 60;
            }
            if ($language !== undefined) {
                this.language = $language;
            }
            if ($placeholderItems !== undefined) {
                this.placeholderItems = $placeholderItems;
            }
            else {
                this.placeholderItems = new Map();
            }
        }
        get $brandBar() {
            return this.brandBar;
        }
        set $brandBar(value) {
            this.brandBar = value;
        }
        get $brandMode() {
            return this.brandMode;
        }
        set $brandMode(value) {
            this.brandMode = value;
        }
        get $resourceId() {
            return this.resourceId;
        }
        set $resourceId(value) {
            this.resourceId = value;
        }
        get $theme() {
            return this.theme;
        }
        set $theme(value) {
            this.theme = value;
        }
        get $timeout() {
            return this.timeout;
        }
        set $timeout(value) {
            this.timeout = value;
        }
        get $language() {
            return this.language;
        }
        set $language(value) {
            this.language = value;
        }
        get $placeholderItems() {
            return this.placeholderItems;
        }
        set $placeholderItems(value) {
            this.placeholderItems = value;
        }
    }
    timapi.ShowDialogRequest = ShowDialogRequest;
})(timapi || (timapi = {}));
var timapi;
(function (timapi) {
    class ShowDialogResponse {
        constructor($reason, $userInput, $cardData) {
            this.reason = $reason;
            this.userInput = $userInput;
            this.cardData = $cardData;
        }
        get $reason() {
            return this.reason;
        }
        get $userInput() {
            return this.userInput;
        }
        get $cardData() {
            return this.cardData;
        }
    }
    timapi.ShowDialogResponse = ShowDialogResponse;
})(timapi || (timapi = {}));
var timapi;
(function (timapi) {
    class ShowSignatureCaptureRequest {
        constructor(request) {
            if (arguments.length === 0) {
                this.brandBar = new Array();
                this.brandMode = timapi.constants.BrandMode.all;
                this.backgroundColor = timapi.utils.Color.Color.white;
                this.imageFileFormat = timapi.constants.ImageFileFormat.png;
                this.imageFileWidth = 200;
                this.imageFileHeight = 150;
                this.resourceId = timapi.constants.ResourceId.EMPTY_DIALOG;
                this.signatureColor = timapi.utils.Color.Color.black;
                this.theme = timapi.constants.Theme.six;
                this.timeout = 60;
                this.language = undefined;
                this.watermarkColor = timapi.utils.Color.Color.black;
                this.watermarkItems = new Array();
            }
            else {
                this.brandBar = request.brandBar.slice();
                this.brandMode = request.brandMode;
                this.backgroundColor = request.backgroundColor;
                this.imageFileFormat = request.imageFileFormat;
                this.imageFileWidth = request.imageFileWidth;
                this.imageFileHeight = request.imageFileHeight;
                this.resourceId = request.resourceId;
                this.signatureColor = request.signatureColor;
                this.theme = request.theme;
                this.timeout = request.timeout;
                this.language = request.language;
                this.watermarkColor = request.watermarkColor;
                this.watermarkItems = request.watermarkItems.slice();
            }
        }
        get $brandBar() {
            return this.brandBar;
        }
        set $brandBar(value) {
            this.brandBar = value.slice();
        }
        get $brandMode() {
            return this.brandMode;
        }
        set $brandMode(value) {
            this.brandMode = value;
        }
        get $backgroundColor() {
            return this.backgroundColor;
        }
        set $backgroundColor(value) {
            this.backgroundColor = value;
        }
        get $imageFileFormat() {
            return this.imageFileFormat;
        }
        set $imageFileFormat(value) {
            this.imageFileFormat = value;
        }
        get $imageFileWidth() {
            return this.imageFileWidth;
        }
        set $imageFileWidth(value) {
            this.imageFileWidth = value;
        }
        get $imageFileHeight() {
            return this.imageFileHeight;
        }
        set $imageFileHeight(value) {
            this.imageFileHeight = value;
        }
        get $resourceId() {
            return this.resourceId;
        }
        set $resourceId(value) {
            this.resourceId = value;
        }
        get $signatureColor() {
            return this.signatureColor;
        }
        set $signatureColor(value) {
            this.signatureColor = value;
        }
        get $theme() {
            return this.theme;
        }
        set $theme(value) {
            this.theme = value;
        }
        get $timeout() {
            return this.timeout;
        }
        set $timeout(value) {
            this.timeout = value;
        }
        get $language() {
            return this.language;
        }
        set $language(value) {
            this.language = value;
        }
        get $watermarkColor() {
            return this.watermarkColor;
        }
        set $watermarkColor(value) {
            this.watermarkColor = value;
        }
        get $watermarkItems() {
            return this.watermarkItems;
        }
        set $watermarkItems(value) {
            this.watermarkItems = value.slice();
        }
    }
    timapi.ShowSignatureCaptureRequest = ShowSignatureCaptureRequest;
})(timapi || (timapi = {}));
var timapi;
(function (timapi) {
    class ShowSignatureCaptureResponse {
        constructor($reason, $imageFileFormat, $imageWidth, $imageHeight, $imageData) {
            this.reason = $reason;
            this.imageFileFormat = $imageFileFormat;
            this.imageWidth = $imageWidth;
            this.imageHeight = $imageHeight;
            this.imageData = $imageData.slice();
            this.image = this.createImageFromData();
        }
        get $reason() {
            return this.reason;
        }
        get $imageFileFormat() {
            return this.imageFileFormat;
        }
        get $imageWidth() {
            return this.imageWidth;
        }
        get $imageHeight() {
            return this.imageHeight;
        }
        get $imageData() {
            return this.imageData;
        }
        get $image() {
            return this.image;
        }
        createImageFromData() {
            let image = undefined;
            return image;
        }
    }
    timapi.ShowSignatureCaptureResponse = ShowSignatureCaptureResponse;
})(timapi || (timapi = {}));
var timapi;
(function (timapi) {
    class SignatureInformation {
        constructor($imageFileFormat, $imageWidth, $imageHeight, $imageData) {
            this.imageFileFormat = $imageFileFormat;
            this.imageWidth = $imageWidth;
            this.imageHeight = $imageHeight;
            this.imageData = $imageData.slice();
        }
        get $imageFileFormat() {
            return this.imageFileFormat;
        }
        get $imageWidth() {
            return this.imageWidth;
        }
        get $imageHeight() {
            return this.imageHeight;
        }
        get $imageData() {
            return this.imageData;
        }
    }
    timapi.SignatureInformation = SignatureInformation;
})(timapi || (timapi = {}));
var timapi;
(function (timapi) {
    class SixmlReceivedMessageHacks {
        constructor(settings) {
            this.settings = settings;
            this.enableDpsenbi240 = settings.$enabledHacks.has(240);
            this.enableDpsenbi257 = settings.$enabledHacks.has(257);
        }
        processXmlMessage(message) {
            if (this.enableDpsenbi240) {
                this.dpsenbi240(message);
            }
            if (this.enableDpsenbi257) {
                this.dpsenbi257(message);
            }
            return message;
        }
        dpsenbi240(node) {
            for (let [entryKey, entryValue] of node.attributes.entries()) {
                if (entryKey === "CardExpiryDate" && entryValue.length === 0) {
                    entryValue = "0418";
                }
            }
            for (let each of node.children) {
                this.dpsenbi240(each);
            }
        }
        dpsenbi257(node) {
            if (node.name !== "sixml:Response") {
                return;
            }
            if (node.attributes.get("ResultCode") === "0") {
                return;
            }
            if (node.attributes.get("Function") !==
                timapi.protocol.constants.Function.featureRequest) {
                return;
            }
            node.attributes.put("ResultCode", "0");
            node.children = new Array();
            let features = new timapi.protocol.XmlNode("sixml:Features");
            this.addContentNode(features, "sixml:Feature", "3", "FeatureType", timapi.protocol.constants.FeatureType.sixmlProtocolLevel);
            this.addContentNode(features, "sixml:Feature", "1", "FeatureType", timapi.protocol.constants.FeatureType.sixmlGuides);
            this.addContentNode(features, "sixml:Feature", "1", "FeatureType", timapi.protocol.constants.FeatureType.sixmlStatusFunctions);
            this.addContentNode(features, "sixml:Feature", "263", "FeatureType", timapi.protocol.constants.FeatureType.sixmlAdminFunctions);
            this.addContentNode(features, "sixml:Feature", "7", "FeatureType", timapi.protocol.constants.FeatureType.sixmlFinancialTransactions);
            this.addContentNode(features, "sixml:Feature", "1", "FeatureType", timapi.protocol.constants.FeatureType.sixmlNonFinancialTransactions);
            this.addContentNode(features, "sixml:Feature", "1", "FeatureType", timapi.protocol.constants.FeatureType.ep2Available);
            this.addContentNode(features, "sixml:Feature", "1", "FeatureType", timapi.protocol.constants.FeatureType.hardwareDisplayCardholderInstalled);
            node.children.add(features);
            this.addContentNode(node, "sixml:TerminalId", this.settings.$terminalId);
        }
        addContentNode(node, name, value, attrName, attrValue) {
            let child = new timapi.protocol.XmlNode(name);
            child.textContent = value;
            child.attributes.put(attrName, attrValue);
            node.children.add(child);
        }
    }
    timapi.SixmlReceivedMessageHacks = SixmlReceivedMessageHacks;
})(timapi || (timapi = {}));
var timapi;
(function (timapi) {
    class SynchronousTerminalListener {
        prepareWait(requestType) {
            this.lastActivateResponse = undefined;
            this.lastBalanceResponse = undefined;
            this.lastCountersRequestResponse = undefined;
            this.lastDccRatesResponse = undefined;
            this.lastDeactivateResponse = undefined;
            this.lastException = undefined;
            this.lastHardwareInformationResponse = undefined;
            this.lastReconciliationResponse = undefined;
            this.lastReceiptRequestResponse = undefined;
            this.lastReconfigResponse = undefined;
            this.lastRollbackResponse = undefined;
            this.lastSoftwareUpdateResponse = undefined;
            this.lastSystemInformationResponse = undefined;
            this.lastTransactionResponse = undefined;
            this.lastShowSignatureCaptureResponse = undefined;
            this.lastShowDialogResponse = undefined;
            this.lastBalanceInquiryResponse = undefined;
            this.lastQueryLoyaltyResponse = undefined;
            this.lastInitTransactionResponse = undefined;
            this.notifyRequestType = requestType;
            this.notifyRequestCompleted = false;
        }
        waitForRequestCompleted() {
            while (!this.notifyRequestCompleted) {
                waits();
            }
        }
        get $lastException() {
            return this.lastException;
        }
        get $lastActivateResponse() {
            return this.lastActivateResponse;
        }
        get $lastBalanceResponse() {
            return this.lastBalanceResponse;
        }
        get $lastCountersRequestResponse() {
            return this.lastCountersRequestResponse;
        }
        get $lastDeactivateResponse() {
            return this.lastDeactivateResponse;
        }
        get $lastDccRatesResponse() {
            return this.lastDccRatesResponse;
        }
        get $lastHardwareInformationResponse() {
            return this.lastHardwareInformationResponse;
        }
        get $lastReconciliationResponse() {
            return this.lastReconciliationResponse;
        }
        get $lastReceiptRequestResponse() {
            return this.lastReceiptRequestResponse;
        }
        get $lastReconfigResponse() {
            return this.lastReconfigResponse;
        }
        get $lastRollbackResponse() {
            return this.lastRollbackResponse;
        }
        get $lastSoftwareUpdateResponse() {
            return this.lastSoftwareUpdateResponse;
        }
        get $lastSystemInformationResponse() {
            return this.lastSystemInformationResponse;
        }
        get $lastTransactionResponse() {
            return this.lastTransactionResponse;
        }
        get $lastShowSignatureCaptureResponse() {
            return this.lastShowSignatureCaptureResponse;
        }
        get $lastShowDialogResponse() {
            return this.lastShowDialogResponse;
        }
        get $lastBalanceInquiryResponse() {
            return this.lastBalanceInquiryResponse;
        }
        get $lastQueryLoyaltyResponse() {
            return this.lastQueryLoyaltyResponse;
        }
        get $lastInitTransactionResponse() {
            return this.lastInitTransactionResponse;
        }
        connectCompleted(event) {
            this.datalessRequestCompleted(event, timapi.constants.RequestType.connect);
        }
        activateCompleted(event, data) {
            if (this.notifyRequestType == undefined || this.notifyRequestCompleted) {
                return;
            }
            if (event.$exception == undefined) {
                this.lastActivateResponse = data;
                if (this.notifyRequestType === timapi.constants.RequestType.activate) {
                    this.notifyRequestCompleted = true;
                }
            }
            else {
                this.lastException = event.$exception;
                this.notifyRequestCompleted = true;
            }
        }
        applicationInformationCompleted(event) {
            this.datalessRequestCompleted(event, timapi.constants.RequestType.applicationInformation);
        }
        balanceCompleted(event, data) {
            if (this.notifyRequestType == undefined || this.notifyRequestCompleted) {
                return;
            }
            if (event.$exception == undefined) {
                this.lastBalanceResponse = data;
                if (this.notifyRequestType === timapi.constants.RequestType.balance) {
                    this.notifyRequestCompleted = true;
                }
            }
            else {
                this.lastException = event.$exception;
                this.notifyRequestCompleted = true;
            }
        }
        changeSettingsCompleted(event) {
            this.datalessRequestCompleted(event, timapi.constants.RequestType.changeSettings);
        }
        commitCompleted(event) {
            this.datalessRequestCompleted(event, timapi.constants.RequestType.commit);
        }
        counterRequestCompleted(event, data) {
            if (this.notifyRequestType == undefined || this.notifyRequestCompleted) {
                return;
            }
            if (event.$exception == undefined) {
                this.lastCountersRequestResponse = data;
                if (this.notifyRequestType === timapi.constants.RequestType.counterRequest) {
                    this.notifyRequestCompleted = true;
                }
            }
            else {
                this.lastException = event.$exception;
                this.notifyRequestCompleted = true;
            }
        }
        deactivateCompleted(event, data) {
            if (this.notifyRequestType == undefined || this.notifyRequestCompleted) {
                return;
            }
            if (event.$exception == undefined) {
                this.lastDeactivateResponse = data;
                if (this.notifyRequestType === timapi.constants.RequestType.deactivate) {
                    this.notifyRequestCompleted = true;
                }
            }
            else {
                this.lastException = event.$exception;
                this.notifyRequestCompleted = true;
            }
        }
        dccRatesCompleted(event, data) {
            if (this.notifyRequestType == undefined || this.notifyRequestCompleted) {
                return;
            }
            if (event.$exception == undefined) {
                this.lastDccRatesResponse = data;
                if (this.notifyRequestType === timapi.constants.RequestType.dccRates) {
                    this.notifyRequestCompleted = true;
                }
            }
            else {
                this.lastException = event.$exception;
                this.notifyRequestCompleted = true;
            }
        }
        hardwareInformationCompleted(event, data) {
            if (this.notifyRequestType == undefined || this.notifyRequestCompleted) {
                return;
            }
            if (event.$exception == undefined) {
                this.lastHardwareInformationResponse = data;
                if (this.notifyRequestType ===
                    timapi.constants.RequestType.hardwareInformation) {
                    this.notifyRequestCompleted = true;
                }
            }
            else {
                this.lastException = event.$exception;
                this.notifyRequestCompleted = true;
            }
        }
        initTransactionCompleted(event, data) {
            if (this.notifyRequestType == undefined || this.notifyRequestCompleted) {
                return;
            }
            if (event.$exception == undefined) {
                this.lastInitTransactionResponse = data;
                if (this.notifyRequestType ===
                    timapi.constants.RequestType.initTransaction) {
                    this.notifyRequestCompleted = true;
                }
            }
            else {
                this.lastException = event.$exception;
                this.notifyRequestCompleted = true;
            }
        }
        loginCompleted(event) {
            this.datalessRequestCompleted(event, timapi.constants.RequestType.login);
        }
        logoutCompleted(event) {
            this.datalessRequestCompleted(event, timapi.constants.RequestType.logout);
        }
        rebootCompleted(event) {
            this.datalessRequestCompleted(event, timapi.constants.RequestType.reboot);
        }
        reconciliationCompleted(event, data) {
            if (this.notifyRequestType == undefined || this.notifyRequestCompleted) {
                return;
            }
            if (event.$exception == undefined) {
                this.lastReconciliationResponse = data;
                if (this.notifyRequestType === timapi.constants.RequestType.reconciliation) {
                    this.notifyRequestCompleted = true;
                }
            }
            else {
                this.lastException = event.$exception;
                this.notifyRequestCompleted = true;
            }
        }
        receiptRequestCompleted(event, data) {
            if (this.notifyRequestType == undefined || this.notifyRequestCompleted) {
                return;
            }
            if (event.$exception == undefined) {
                this.lastReceiptRequestResponse = data;
                if (this.notifyRequestType === timapi.constants.RequestType.receiptRequest) {
                    this.notifyRequestCompleted = true;
                }
            }
            else {
                this.lastException = event.$exception;
                this.notifyRequestCompleted = true;
            }
        }
        reconfigCompleted(event, data) {
            if (this.notifyRequestType == undefined || this.notifyRequestCompleted) {
                return;
            }
            if (event.$exception == undefined) {
                this.lastReconfigResponse = data;
                if (this.notifyRequestType === timapi.constants.RequestType.reconfig) {
                    this.notifyRequestCompleted = true;
                }
            }
            else {
                this.lastException = event.$exception;
                this.notifyRequestCompleted = true;
            }
        }
        rollbackCompleted(event, data) {
            if (this.notifyRequestType == undefined || this.notifyRequestCompleted) {
                return;
            }
            if (event.$exception == undefined) {
                this.lastRollbackResponse = data;
                if (this.notifyRequestType === timapi.constants.RequestType.rollback) {
                    this.notifyRequestCompleted = true;
                }
            }
            else {
                this.lastException = event.$exception;
                this.notifyRequestCompleted = true;
            }
        }
        softwareUpdateCompleted(event, data) {
            if (this.notifyRequestType == undefined || this.notifyRequestCompleted) {
                return;
            }
            if (event.$exception == undefined) {
                this.lastSoftwareUpdateResponse = data;
                if (this.notifyRequestType === timapi.constants.RequestType.softwareUpdate) {
                    this.notifyRequestCompleted = true;
                }
            }
            else {
                this.lastException = event.$exception;
                this.notifyRequestCompleted = true;
            }
        }
        systemInformationCompleted(event, data) {
            if (this.notifyRequestType == undefined || this.notifyRequestCompleted) {
                return;
            }
            if (event.$exception == undefined) {
                this.lastSystemInformationResponse = data;
                if (this.notifyRequestType ===
                    timapi.constants.RequestType.systemInformation) {
                    this.notifyRequestCompleted = true;
                }
            }
            else {
                this.lastException = event.$exception;
                this.notifyRequestCompleted = true;
            }
        }
        transactionCompleted(event, data) {
            if (this.notifyRequestType == undefined || this.notifyRequestCompleted) {
                return;
            }
            if (event.$exception == undefined) {
                this.lastTransactionResponse = data;
                if (this.notifyRequestType === timapi.constants.RequestType.transaction) {
                    this.notifyRequestCompleted = true;
                }
            }
            else {
                this.lastException = event.$exception;
                this.notifyRequestCompleted = true;
            }
        }
        terminalStatusChanged(terminal) {
        }
        disconnected(terminal, exception) {
            if (this.notifyRequestType == undefined || this.notifyRequestCompleted) {
                return;
            }
            this.lastException = exception;
            this.notifyRequestCompleted = true;
        }
        datalessRequestCompleted(event, matchesType) {
            if (this.notifyRequestType == undefined || this.notifyRequestCompleted) {
                return;
            }
            if (event.$exception == undefined) {
                if (this.notifyRequestType === matchesType) {
                    this.notifyRequestCompleted = true;
                }
            }
            else {
                this.lastException = event.$exception;
                this.notifyRequestCompleted = true;
            }
        }
        closeReaderCompleted(event) {
            this.datalessRequestCompleted(event, timapi.constants.RequestType.closeReader);
        }
        openReaderCompleted(event) {
            this.datalessRequestCompleted(event, timapi.constants.RequestType.openReader);
        }
        ejectCardCompleted(event) {
            this.datalessRequestCompleted(event, timapi.constants.RequestType.ejectCard);
        }
        openMaintenanceWindowCompleted(event) {
            this.datalessRequestCompleted(event, timapi.constants.RequestType.openMaintenanceWindow);
        }
        closeMaintenanceWindowCompleted(event) {
            this.datalessRequestCompleted(event, timapi.constants.RequestType.closeMaintenanceWindow);
        }
        activateServiceMenuCompleted(event) {
            this.datalessRequestCompleted(event, timapi.constants.RequestType.activateServiceMenu);
        }
        openDialogModeCompleted(event) {
            this.datalessRequestCompleted(event, timapi.constants.RequestType.openDialogMode);
        }
        closeDialogModeCompleted(event) {
            this.datalessRequestCompleted(event, timapi.constants.RequestType.closeDialogMode);
        }
        showSignatureCaptureCompleted(event, data) {
            if (this.notifyRequestType == undefined || this.notifyRequestCompleted) {
                return;
            }
            if (event.$exception == undefined) {
                this.lastShowSignatureCaptureResponse = data;
                if (this.notifyRequestType ===
                    timapi.constants.RequestType.showSignatureCapture) {
                    this.notifyRequestCompleted = true;
                }
            }
            else {
                this.lastException = event.$exception;
                this.notifyRequestCompleted = true;
            }
        }
        showDialogCompleted(event, data) {
            if (this.notifyRequestType == undefined || this.notifyRequestCompleted) {
                return;
            }
            if (event.$exception == undefined) {
                this.lastShowDialogResponse = data;
                if (this.notifyRequestType === timapi.constants.RequestType.showDialog) {
                    this.notifyRequestCompleted = true;
                }
            }
            else {
                this.lastException = event.$exception;
                this.notifyRequestCompleted = true;
            }
        }
        balanceInquiryCompleted(event, data) {
            if (this.notifyRequestType == undefined || this.notifyRequestCompleted) {
                return;
            }
            if (event.$exception == undefined) {
                this.lastBalanceInquiryResponse = data;
                if (this.notifyRequestType === timapi.constants.RequestType.balanceInquiry) {
                    this.notifyRequestCompleted = true;
                }
            }
            else {
                this.lastException = event.$exception;
                this.notifyRequestCompleted = true;
            }
        }
        queryLoyaltyCompleted(event, data) {
            if (this.notifyRequestType == undefined || this.notifyRequestCompleted) {
                return;
            }
            if (event.$exception == undefined) {
                this.lastQueryLoyaltyResponse = data;
                if (this.notifyRequestType === timapi.constants.RequestType.queryLoyalty) {
                    this.notifyRequestCompleted = true;
                }
            }
            else {
                this.lastException = event.$exception;
                this.notifyRequestCompleted = true;
            }
        }
    }
    timapi.SynchronousTerminalListener = SynchronousTerminalListener;
})(timapi || (timapi = {}));
var timapi;
(function (timapi) {
    class SystemInformationResponse {
        constructor($networkInformation) {
            this.networkInformation = $networkInformation;
        }
        get $networkInformation() {
            return this.networkInformation;
        }
    }
    timapi.SystemInformationResponse = SystemInformationResponse;
})(timapi || (timapi = {}));
var timapi;
(function (timapi) {
    class Terminal {
        constructor(settings) {
            this.initLogging(settings);
            Terminal.logger.log(timapi.logging.Level.INFO, "TimApiBuildInfo: Version=" + timapi.InternalBuildInfo.VERSION
                + " Date=" + timapi.InternalBuildInfo.DATE);
            if (Terminal.logger.isLoggable(timapi.logging.Level.FINEST)) {
                Terminal.logger.entering(Terminal.CLASS_NAME, "<constructor>", [settings]);
            }
            else {
                Terminal.logger.entering(Terminal.CLASS_NAME, "<constructor>");
            }
            if (settings.$connectionMode ===
                timapi.constants.ConnectionMode.broadcast &&
                settings.$terminalId.length === 0) {
                throw new Error("Terminal ID can not be empty if broadcast connection mode is used");
            }
            if (settings.$connectionMode === timapi.constants.ConnectionMode.onFixIp &&
                settings.$connectionIPString.length === 0) {
                throw new Error("Connection IP can not be empty if IP connection mode is used");
            }
            this.settings = new timapi.TerminalSettingsImmutable(settings);
            this.transactionData = new timapi.TransactionData();
            this.initEcrData();
            this.initPrintOptions();
            this.backend = new timapi.TerminalBackendSixml(this);
            Terminal.logger.exiting(Terminal.CLASS_NAME, "<constructor>");
        }
        dispose() {
            Terminal.logger.entering(Terminal.CLASS_NAME, "dispose");
            this.backend.dispose();
            Terminal.logger.exiting(Terminal.CLASS_NAME, "dispose");
        }
        get $settings() {
            return this.settings;
        }
        terminalId() {
            return this.backend.$terminalId;
        }
        get $posId() {
            return this.posId;
        }
        set $posId(value) {
            if (Terminal.logger.isLoggable(timapi.logging.Level.FINEST)) {
                Terminal.logger.entering(Terminal.CLASS_NAME, "setPosId", [this.posId]);
            }
            else {
                Terminal.logger.entering(Terminal.CLASS_NAME, "setPosId");
            }
            this.posId = value;
            Terminal.logger.exiting(Terminal.CLASS_NAME, "setPosId");
        }
        get $userId() {
            return this.userId;
        }
        set $userId(value) {
            if (Terminal.logger.isLoggable(timapi.logging.Level.FINEST)) {
                Terminal.logger.entering(Terminal.CLASS_NAME, "setUserId", [this.userId]);
            }
            else {
                Terminal.logger.entering(Terminal.CLASS_NAME, "setUserId");
            }
            this.userId = value;
            Terminal.logger.exiting(Terminal.CLASS_NAME, "setUserId");
        }
        get $ecrData() {
            return this.ecrData;
        }
        set $ecrData(value) {
            if (Terminal.logger.isLoggable(timapi.logging.Level.FINEST)) {
                Terminal.logger.entering(Terminal.CLASS_NAME, "setEcrData", [this.ecrData]);
            }
            else {
                Terminal.logger.entering(Terminal.CLASS_NAME, "setEcrData");
            }
            this.ecrData = value;
            Terminal.logger.exiting(Terminal.CLASS_NAME, "setEcrData");
        }
        get $printOptions() {
            return this.printOptions;
        }
        set $printOptions(value) {
            if (Terminal.logger.isLoggable(timapi.logging.Level.FINEST)) {
                Terminal.logger.entering(Terminal.CLASS_NAME, "setPrintOptions", [
                    this.printOptions
                ]);
            }
            else {
                Terminal.logger.entering(Terminal.CLASS_NAME, "setPrintOptions");
            }
            this.printOptions = value;
            Terminal.logger.exiting(Terminal.CLASS_NAME, "setPrintOptions");
        }
        get $merchantOptions() {
            return this.merchantOptions;
        }
        set $merchantOptions(value) {
            if (Terminal.logger.isLoggable(timapi.logging.Level.FINEST)) {
                Terminal.logger.entering(Terminal.CLASS_NAME, "setMerchantOptions", [
                    this.merchantOptions
                ]);
            }
            else {
                Terminal.logger.entering(Terminal.CLASS_NAME, "setMerchantOptions");
            }
            this.merchantOptions = value;
            Terminal.logger.exiting(Terminal.CLASS_NAME, "setMerchantOptions");
        }
        get $transactionData() {
            return this.transactionData;
        }
        set $transactionData(value) {
            if (Terminal.logger.isLoggable(timapi.logging.Level.FINEST)) {
                Terminal.logger.entering(Terminal.CLASS_NAME, "setTransactionData", [
                    this.transactionData
                ]);
            }
            else {
                Terminal.logger.entering(Terminal.CLASS_NAME, "setTransactionData");
            }
            this.transactionData = value;
            Terminal.logger.exiting(Terminal.CLASS_NAME, "setTransactionData");
        }
        get $receiptFormatter() {
            return this.receiptFormatter;
        }
        set $receiptFormatter(value) {
            this.receiptFormatter = value;
        }
        getTerminalStatus() {
            return this.backend.$terminalStatus;
        }
        getBrands() {
            return this.backend.$brands;
        }
        getFeatures() {
            return this.backend.$features;
        }
        getActSeqCounter() {
            return this.backend.$actSeqCounter;
        }
        getConfigData() {
            return this.backend.$configData;
        }
        activate() {
            Terminal.logger.entering(Terminal.CLASS_NAME, "activate");
            let result = this.backend.activate();
            if (Terminal.logger.isLoggable(timapi.logging.Level.FINEST)) {
                Terminal.logger.exiting(Terminal.CLASS_NAME, "activate", [result]);
            }
            else {
                Terminal.logger.exiting(Terminal.CLASS_NAME, "activate");
            }
            return result;
        }
        activateAsync() {
            Terminal.logger.entering(Terminal.CLASS_NAME, "activateAsync");
            this.backend.activateAsync();
            Terminal.logger.exiting(Terminal.CLASS_NAME, "activateAsync");
        }
        applicationInformation() {
            Terminal.logger.entering(Terminal.CLASS_NAME, "applicationInformation");
            this.backend.applicationInformation();
            Terminal.logger.exiting(Terminal.CLASS_NAME, "applicationInformation");
        }
        applicationInformationAsync() {
            Terminal.logger.entering(Terminal.CLASS_NAME, "applicationInformationAsync");
            this.backend.applicationInformationAsync();
            Terminal.logger.exiting(Terminal.CLASS_NAME, "applicationInformationAsync");
        }
        balance() {
            Terminal.logger.entering(Terminal.CLASS_NAME, "balance");
            let result = this.backend.balance();
            if (Terminal.logger.isLoggable(timapi.logging.Level.FINEST)) {
                Terminal.logger.exiting(Terminal.CLASS_NAME, "balance", [result]);
            }
            else {
                Terminal.logger.exiting(Terminal.CLASS_NAME, "balance");
            }
            return result;
        }
        balanceAsync() {
            Terminal.logger.entering(Terminal.CLASS_NAME, "balanceAsync");
            this.backend.balanceAsync();
            Terminal.logger.exiting(Terminal.CLASS_NAME, "balanceAsync");
        }
        cancel(silent, retainCard) {
            if (silent == undefined && retainCard == undefined) {
                Terminal.logger.entering(Terminal.CLASS_NAME, "cancel");
                this.backend.cancel();
                Terminal.logger.exiting(Terminal.CLASS_NAME, "cancel");
            }
            else if (Terminal.logger.isLoggable(timapi.logging.Level.FINEST)) {
                Terminal.logger.entering(Terminal.CLASS_NAME, "cancel(silent,retainCard)", [silent, retainCard]);
            }
            else {
                Terminal.logger.entering(Terminal.CLASS_NAME, "cancel(silent,retainCard)");
            }
            if (silent !== undefined &&
                silent !== undefined &&
                retainCard !== undefined &&
                retainCard !== undefined) {
                this.backend.cancel(silent, retainCard);
                Terminal.logger.exiting(Terminal.CLASS_NAME, "cancel(silent,retainCard)");
            }
        }
        changeSettings(settings) {
            if (Terminal.logger.isLoggable(timapi.logging.Level.FINEST)) {
                Terminal.logger.entering(Terminal.CLASS_NAME, "changeSettings", [
                    settings
                ]);
            }
            else {
                Terminal.logger.entering(Terminal.CLASS_NAME, "changeSettings");
            }
            this.backend.changeSettings(settings);
            Terminal.logger.exiting(Terminal.CLASS_NAME, "changeSettings");
        }
        changeSettingsAsync(settings) {
            if (Terminal.logger.isLoggable(timapi.logging.Level.FINEST)) {
                Terminal.logger.entering(Terminal.CLASS_NAME, "changeSettingsAsync", [
                    settings
                ]);
            }
            else {
                Terminal.logger.entering(Terminal.CLASS_NAME, "changeSettingsAsync");
            }
            this.backend.changeSettingsAsync(settings);
            Terminal.logger.exiting(Terminal.CLASS_NAME, "changeSettingsAsync");
        }
        commit() {
            Terminal.logger.entering(Terminal.CLASS_NAME, "commit");
            this.backend.commit();
            Terminal.logger.exiting(Terminal.CLASS_NAME, "commit");
        }
        commitAsync() {
            Terminal.logger.entering(Terminal.CLASS_NAME, "commitAsync");
            this.backend.commitAsync();
            Terminal.logger.exiting(Terminal.CLASS_NAME, "commitAsync");
        }
        connect() {
            Terminal.logger.entering(Terminal.CLASS_NAME, "connect");
            this.backend.connect();
            Terminal.logger.exiting(Terminal.CLASS_NAME, "connect");
        }
        counterRequest(type) {
            if (Terminal.logger.isLoggable(timapi.logging.Level.FINEST)) {
                Terminal.logger.entering(Terminal.CLASS_NAME, "counterRequest", [type]);
            }
            else {
                Terminal.logger.entering(Terminal.CLASS_NAME, "counterRequest");
            }
            let result = this.backend.counterRequest(type);
            if (Terminal.logger.isLoggable(timapi.logging.Level.FINEST)) {
                Terminal.logger.exiting(Terminal.CLASS_NAME, "counterRequest", [
                    result
                ]);
            }
            else {
                Terminal.logger.exiting(Terminal.CLASS_NAME, "counterRequest");
            }
            return result;
        }
        counterRequestAsync(type) {
            if (Terminal.logger.isLoggable(timapi.logging.Level.FINEST)) {
                Terminal.logger.entering(Terminal.CLASS_NAME, "counterRequestAsync", [type]);
            }
            else {
                Terminal.logger.entering(Terminal.CLASS_NAME, "counterRequestAsync");
            }
            this.backend.counterRequestAsync(type);
            Terminal.logger.exiting(Terminal.CLASS_NAME, "counterRequestAsync");
        }
        deactivate() {
            Terminal.logger.entering(Terminal.CLASS_NAME, "deactivate");
            let result = this.backend.deactivate();
            if (Terminal.logger.isLoggable(timapi.logging.Level.FINEST)) {
                Terminal.logger.exiting(Terminal.CLASS_NAME, "deactivate", [result]);
            }
            else {
                Terminal.logger.exiting(Terminal.CLASS_NAME, "deactivate");
            }
            return result;
        }
        deactivateAsync() {
            Terminal.logger.entering(Terminal.CLASS_NAME, "deactivateAsync");
            this.backend.deactivateAsync();
            Terminal.logger.exiting(Terminal.CLASS_NAME, "deactivateAsync");
        }
        disconnect() {
            Terminal.logger.entering(Terminal.CLASS_NAME, "disconnect");
            this.backend.disconnect();
            Terminal.logger.exiting(Terminal.CLASS_NAME, "disconnect");
        }
        dccRates() {
            Terminal.logger.entering(Terminal.CLASS_NAME, "dccRates");
            let result = this.backend.dccRates();
            if (Terminal.logger.isLoggable(timapi.logging.Level.FINEST)) {
                Terminal.logger.exiting(Terminal.CLASS_NAME, "dccRates", [result]);
            }
            else {
                Terminal.logger.exiting(Terminal.CLASS_NAME, "dccRates");
            }
            return result;
        }
        dccRatesAsync() {
            Terminal.logger.entering(Terminal.CLASS_NAME, "dccRatesAsync");
            this.backend.dccRatesAsync();
            Terminal.logger.exiting(Terminal.CLASS_NAME, "dccRatesAsync");
        }
        hardwareInformation() {
            Terminal.logger.entering(Terminal.CLASS_NAME, "hardwareInformation");
            this.backend.hardwareInformation();
            Terminal.logger.exiting(Terminal.CLASS_NAME, "hardwareInformation");
        }
        hardwareInformationAsync() {
            Terminal.logger.entering(Terminal.CLASS_NAME, "hardwareInformationAsync");
            this.backend.hardwareInformationAsync();
            Terminal.logger.exiting(Terminal.CLASS_NAME, "hardwareInformationAsync");
        }
        initTransaction(displayAmount, amount) {
            Terminal.logger.entering(Terminal.CLASS_NAME, "initTransaction", [
                displayAmount
            ]);
            let result = this.backend.initTransaction(displayAmount, amount);
            Terminal.logger.exiting(Terminal.CLASS_NAME, "initTransaction", [result]);
            return result;
        }
        initTransactionAsync(displayAmount, amount) {
            Terminal.logger.entering(Terminal.CLASS_NAME, "initTransactionAsync", [
                displayAmount
            ]);
            this.backend.initTransactionAsync(displayAmount, amount);
            Terminal.logger.exiting(Terminal.CLASS_NAME, "initTransactionAsync");
        }
        login() {
            Terminal.logger.entering(Terminal.CLASS_NAME, "login");
            this.backend.login();
            Terminal.logger.exiting(Terminal.CLASS_NAME, "login");
        }
        loginAsync() {
            Terminal.logger.entering(Terminal.CLASS_NAME, "loginAsync");
            this.backend.loginAsync();
            Terminal.logger.exiting(Terminal.CLASS_NAME, "loginAsync");
        }
        logout() {
            Terminal.logger.entering(Terminal.CLASS_NAME, "logout");
            this.backend.logout();
            Terminal.logger.exiting(Terminal.CLASS_NAME, "logout");
        }
        logoutAsync() {
            Terminal.logger.entering(Terminal.CLASS_NAME, "logoutAsync");
            this.backend.logoutAsync();
            Terminal.logger.exiting(Terminal.CLASS_NAME, "logoutAsync");
        }
        reboot() {
            Terminal.logger.entering(Terminal.CLASS_NAME, "reboot");
            this.backend.reboot();
            Terminal.logger.exiting(Terminal.CLASS_NAME, "reboot");
        }
        rebootAsync() {
            Terminal.logger.entering(Terminal.CLASS_NAME, "rebootAsync");
            this.backend.rebootAsync();
            Terminal.logger.exiting(Terminal.CLASS_NAME, "rebootAsync");
        }
        reconciliation() {
            Terminal.logger.entering(Terminal.CLASS_NAME, "reconciliation");
            let result = this.backend.reconciliation();
            if (Terminal.logger.isLoggable(timapi.logging.Level.FINEST)) {
                Terminal.logger.exiting(Terminal.CLASS_NAME, "reconciliation", [
                    result
                ]);
            }
            else {
                Terminal.logger.exiting(Terminal.CLASS_NAME, "reconciliation");
            }
            return result;
        }
        reconciliationAsync() {
            Terminal.logger.entering(Terminal.CLASS_NAME, "reconciliationAsync");
            this.backend.reconciliationAsync();
            Terminal.logger.exiting(Terminal.CLASS_NAME, "reconciliationAsync");
        }
        receiptRequest(type) {
            if (Terminal.logger.isLoggable(timapi.logging.Level.FINEST)) {
                Terminal.logger.entering(Terminal.CLASS_NAME, "receiptRequest", [type]);
            }
            else {
                Terminal.logger.entering(Terminal.CLASS_NAME, "receiptRequest");
            }
            let result = this.backend.receiptRequest(type);
            if (Terminal.logger.isLoggable(timapi.logging.Level.FINEST)) {
                Terminal.logger.exiting(Terminal.CLASS_NAME, "receiptRequest", [
                    result
                ]);
            }
            else {
                Terminal.logger.exiting(Terminal.CLASS_NAME, "receiptRequest");
            }
            return result;
        }
        receiptRequestAsync(type) {
            if (Terminal.logger.isLoggable(timapi.logging.Level.FINEST)) {
                Terminal.logger.entering(Terminal.CLASS_NAME, "receiptRequestAsync", [type]);
            }
            else {
                Terminal.logger.entering(Terminal.CLASS_NAME, "receiptRequestAsync");
            }
            this.backend.receiptRequestAsync(type);
            Terminal.logger.exiting(Terminal.CLASS_NAME, "receiptRequestAsync");
        }
        reconfig() {
            Terminal.logger.entering(Terminal.CLASS_NAME, "reconfig");
            let result = this.backend.reconfig();
            if (Terminal.logger.isLoggable(timapi.logging.Level.FINEST)) {
                Terminal.logger.exiting(Terminal.CLASS_NAME, "reconfig", [result]);
            }
            else {
                Terminal.logger.exiting(Terminal.CLASS_NAME, "reconfig");
            }
            return result;
        }
        reconfigAsync() {
            Terminal.logger.entering(Terminal.CLASS_NAME, "reconfigAsync");
            this.backend.reconfigAsync();
            Terminal.logger.exiting(Terminal.CLASS_NAME, "reconfigAsync");
        }
        rollback() {
            Terminal.logger.entering(Terminal.CLASS_NAME, "rollback");
            let result = this.backend.rollback();
            if (Terminal.logger.isLoggable(timapi.logging.Level.FINEST)) {
                Terminal.logger.exiting(Terminal.CLASS_NAME, "rollback", [result]);
            }
            else {
                Terminal.logger.exiting(Terminal.CLASS_NAME, "rollback");
            }
            return result;
        }
        rollbackAsync() {
            Terminal.logger.entering(Terminal.CLASS_NAME, "rollbackAsync");
            this.backend.rollbackAsync();
            Terminal.logger.exiting(Terminal.CLASS_NAME, "rollbackAsync");
        }
        softwareUpdate() {
            Terminal.logger.entering(Terminal.CLASS_NAME, "softwareUpdate");
            let result = this.backend.softwareUpdate();
            if (Terminal.logger.isLoggable(timapi.logging.Level.FINEST)) {
                Terminal.logger.exiting(Terminal.CLASS_NAME, "softwareUpdate", [
                    result
                ]);
            }
            else {
                Terminal.logger.exiting(Terminal.CLASS_NAME, "softwareUpdate");
            }
            return result;
        }
        softwareUpdateAsync() {
            Terminal.logger.entering(Terminal.CLASS_NAME, "softwareUpdateAsync");
            this.backend.softwareUpdateAsync();
            Terminal.logger.exiting(Terminal.CLASS_NAME, "softwareUpdateAsync");
        }
        systemInformation() {
            Terminal.logger.entering(Terminal.CLASS_NAME, "systemInformation");
            let result = this.backend.systemInformation();
            if (Terminal.logger.isLoggable(timapi.logging.Level.FINEST)) {
                Terminal.logger.exiting(Terminal.CLASS_NAME, "systemInformation", [
                    result
                ]);
            }
            else {
                Terminal.logger.exiting(Terminal.CLASS_NAME, "systemInformation");
            }
            return result;
        }
        systemInformationAsync() {
            Terminal.logger.entering(Terminal.CLASS_NAME, "systemInformationAsync");
            this.backend.systemInformationAsync();
            Terminal.logger.exiting(Terminal.CLASS_NAME, "systemInformationAsync");
        }
        transaction(type, amountOrTransactionRequest) {
            if (amountOrTransactionRequest instanceof timapi.Amount) {
                return this.transactionWithAmount(type, amountOrTransactionRequest);
            }
            else if (amountOrTransactionRequest instanceof timapi.TransactionRequest) {
                return this.transactionWithTransactionRequest(type, amountOrTransactionRequest);
            }
            return undefined;
        }
        transactionWithAmount(type, amount) {
            if (Terminal.logger.isLoggable(timapi.logging.Level.FINEST)) {
                Terminal.logger.entering(Terminal.CLASS_NAME, "transaction", new Array({ type, amount }));
            }
            else {
                Terminal.logger.entering(Terminal.CLASS_NAME, "transaction");
            }
            let result = this.backend.transaction(type, amount);
            result = new timapi.TransactionResponse(result.$transactionType, result.$amount, result.$amount, result.$amountDcc, result.$amountSaldo, result.$transactionInformation, result.$dccDisclaimer, result.$cardData, timapi.Convenience.processPrintReceipts(this, result.$printData), result.$tipAmount, result.$additionalInfo, result.$basket);
            if (Terminal.logger.isLoggable(timapi.logging.Level.FINEST)) {
                Terminal.logger.exiting(Terminal.CLASS_NAME, "transaction", [result]);
            }
            else {
                Terminal.logger.exiting(Terminal.CLASS_NAME, "transaction");
            }
            return result;
        }
        transactionWithTransactionRequest(type, request) {
            if (Terminal.logger.isLoggable(timapi.logging.Level.FINEST)) {
                Terminal.logger.entering(Terminal.CLASS_NAME, "transaction", new Array({ type, request }));
            }
            else {
                Terminal.logger.entering(Terminal.CLASS_NAME, "transaction");
            }
            let result = this.backend.transaction(type, request);
            result = new timapi.TransactionResponse(result.$transactionType, result.$amount, result.$amount, result.$amountDcc, result.$amountSaldo, result.$transactionInformation, result.$dccDisclaimer, result.$cardData, timapi.Convenience.processPrintReceipts(this, result.$printData), result.$tipAmount, result.$additionalInfo, result.$basket);
            if (Terminal.logger.isLoggable(timapi.logging.Level.FINEST)) {
                Terminal.logger.exiting(Terminal.CLASS_NAME, "transaction", [result]);
            }
            else {
                Terminal.logger.exiting(Terminal.CLASS_NAME, "transaction");
            }
            return result;
        }
        transactionAsync(type, amountOrRequest) {
            if (amountOrRequest instanceof timapi.Amount) {
                this.transactionAsyncWithAmount(type, amountOrRequest);
            }
            else if (amountOrRequest instanceof timapi.TransactionRequest) {
                this.transactionAsyncWithRequest(type, amountOrRequest);
            }
        }
        transactionAsyncWithAmount(type, amount) {
            if (Terminal.logger.isLoggable(timapi.logging.Level.FINEST)) {
                Terminal.logger.entering(Terminal.CLASS_NAME, "transactionAsync", new Array({ type, amount }));
            }
            else {
                Terminal.logger.entering(Terminal.CLASS_NAME, "transactionAsync");
            }
            this.backend.transactionAsync(type, amount);
            Terminal.logger.exiting(Terminal.CLASS_NAME, "transactionAsync");
        }
        transactionAsyncWithRequest(type, request) {
            if (Terminal.logger.isLoggable(timapi.logging.Level.FINEST)) {
                Terminal.logger.entering(Terminal.CLASS_NAME, "transactionAsync", new Array({ type, request }));
            }
            else {
                Terminal.logger.entering(Terminal.CLASS_NAME, "transactionAsync");
            }
            this.backend.transactionAsync(type, request);
            Terminal.logger.exiting(Terminal.CLASS_NAME, "transactionAsync");
        }
        transactionTip(type, amount, tipAmount) {
            if (Terminal.logger.isLoggable(timapi.logging.Level.FINEST)) {
                Terminal.logger.entering(Terminal.CLASS_NAME, "transactionTip", new Array({ type, amount }));
            }
            else {
                Terminal.logger.entering(Terminal.CLASS_NAME, "transactionTip");
            }
            let result = this.backend.transactionTip(type, amount, tipAmount);
            if (Terminal.logger.isLoggable(timapi.logging.Level.FINEST)) {
                Terminal.logger.exiting(Terminal.CLASS_NAME, "transactionTip", [
                    result
                ]);
            }
            else {
                Terminal.logger.exiting(Terminal.CLASS_NAME, "transactionTip");
            }
            return result;
        }
        transactionTipAsync(type, amount, tipAmount) {
            if (Terminal.logger.isLoggable(timapi.logging.Level.FINEST)) {
                Terminal.logger.entering(Terminal.CLASS_NAME, "transactionTipAsync", new Array({ type, amount, tipAmount }));
            }
            else {
                Terminal.logger.entering(Terminal.CLASS_NAME, "transactionTipAsync");
            }
            this.backend.transactionTipAsync(type, amount, tipAmount);
            Terminal.logger.exiting(Terminal.CLASS_NAME, "transactionTipAsync");
        }
        transactionCashback(type, amount, amountOther) {
            Terminal.logger.entering(Terminal.CLASS_NAME, "transactionCashback(TransactionType,Amount,Amount)", [type, amount, amountOther]);
            let result = this.backend.transactionCashback(type, amount, amountOther);
            Terminal.logger.exiting(Terminal.CLASS_NAME, "transactionCashback(TransactionType,Amount,Amount)", [result]);
            return result;
        }
        transactionCashbackAsync(type, amount, amountOther) {
            Terminal.logger.entering(Terminal.CLASS_NAME, "transactionCashbackAsync(TransactionType,Amount,Amount)", [type, amount, amountOther]);
            this.backend.transactionCashbackAsync(type, amount, amountOther);
            Terminal.logger.exiting(Terminal.CLASS_NAME, "transactionCashbackAsync(TransactionType,Amount,Amount)");
        }
        closeReader() {
            Terminal.logger.entering(Terminal.CLASS_NAME, "closeReader");
            this.backend.closeReader();
            Terminal.logger.exiting(Terminal.CLASS_NAME, "closeReader");
        }
        closeReaderAsync() {
            Terminal.logger.entering(Terminal.CLASS_NAME, "closeReaderAsync");
            this.backend.closeReaderAsync();
            Terminal.logger.exiting(Terminal.CLASS_NAME, "closeReaderAsync");
        }
        openReader() {
            Terminal.logger.entering(Terminal.CLASS_NAME, "openReader");
            this.backend.openReader();
            Terminal.logger.exiting(Terminal.CLASS_NAME, "openReader");
        }
        openReaderAsync() {
            Terminal.logger.entering(Terminal.CLASS_NAME, "openReaderAsync");
            this.backend.openReaderAsync();
            Terminal.logger.exiting(Terminal.CLASS_NAME, "openReaderAsync");
        }
        ejectCard() {
            Terminal.logger.entering(Terminal.CLASS_NAME, "ejectCard");
            this.backend.ejectCard();
            Terminal.logger.exiting(Terminal.CLASS_NAME, "ejectCard");
        }
        ejectCardAsync() {
            Terminal.logger.entering(Terminal.CLASS_NAME, "ejectCardAsync");
            this.backend.ejectCardAsync();
            Terminal.logger.exiting(Terminal.CLASS_NAME, "ejectCardAsync");
        }
        openMaintenanceWindow() {
            Terminal.logger.entering(Terminal.CLASS_NAME, "openMaintenanceWindow");
            this.backend.openMaintenanceWindow();
            Terminal.logger.exiting(Terminal.CLASS_NAME, "openMaintenanceWindow");
        }
        openMaintenanceWindowAsync() {
            Terminal.logger.entering(Terminal.CLASS_NAME, "openMaintenanceWindowAsync");
            this.backend.openMaintenanceWindowAsync();
            Terminal.logger.exiting(Terminal.CLASS_NAME, "openMaintenanceWindowAsync");
        }
        closeMaintenanceWindow() {
            Terminal.logger.entering(Terminal.CLASS_NAME, "closeMaintenanceWindow");
            this.backend.closeMaintenanceWindow();
            Terminal.logger.exiting(Terminal.CLASS_NAME, "closeMaintenanceWindow");
        }
        closeMaintenanceWindowAsync() {
            Terminal.logger.entering(Terminal.CLASS_NAME, "closeMaintenanceWindowAsync");
            this.backend.closeMaintenanceWindowAsync();
            Terminal.logger.exiting(Terminal.CLASS_NAME, "closeMaintenanceWindowAsync");
        }
        holdCommit() {
            Terminal.logger.entering(Terminal.CLASS_NAME, "holdCommit");
            this.backend.holdCommit();
            Terminal.logger.exiting(Terminal.CLASS_NAME, "holdCommit");
        }
        activateServiceMenu() {
            Terminal.logger.entering(Terminal.CLASS_NAME, "activateServiceMenu");
            this.backend.activateServiceMenu();
            Terminal.logger.exiting(Terminal.CLASS_NAME, "activateServiceMenu");
        }
        activateServiceMenuAsync() {
            Terminal.logger.entering(Terminal.CLASS_NAME, "activateServiceMenuAsync");
            this.backend.activateServiceMenuAsync();
            Terminal.logger.exiting(Terminal.CLASS_NAME, "activateServiceMenuAsync");
        }
        openDialogMode() {
            Terminal.logger.entering(Terminal.CLASS_NAME, "openDialogMode");
            this.backend.openDialogMode();
            Terminal.logger.exiting(Terminal.CLASS_NAME, "openDialogMode");
        }
        openDialogModeAsync() {
            Terminal.logger.entering(Terminal.CLASS_NAME, "openDialogModeAsync");
            this.backend.openDialogModeAsync();
            Terminal.logger.exiting(Terminal.CLASS_NAME, "openDialogModeAsync");
        }
        closeDialogMode() {
            Terminal.logger.entering(Terminal.CLASS_NAME, "closeDialogMode");
            this.backend.closeDialogMode();
            Terminal.logger.exiting(Terminal.CLASS_NAME, "closeDialogMode");
        }
        closeDialogModeAsync() {
            Terminal.logger.entering(Terminal.CLASS_NAME, "closeDialogModeAsync");
            this.backend.closeDialogModeAsync();
            Terminal.logger.exiting(Terminal.CLASS_NAME, "closeDialogModeAsync");
        }
        showSignatureCapture(request) {
            Terminal.logger.entering(Terminal.CLASS_NAME, "showSignatureCapture", [
                request
            ]);
            let result = this.backend.showSignatureCapture(request);
            Terminal.logger.exiting(Terminal.CLASS_NAME, "showSignatureCapture", [
                result
            ]);
            return result;
        }
        showSignatureCaptureAsync(request) {
            Terminal.logger.entering(Terminal.CLASS_NAME, "showSignatureCaptureAsync", [request]);
            this.backend.showSignatureCaptureAsync(request);
            Terminal.logger.exiting(Terminal.CLASS_NAME, "showSignatureCaptureAsync");
        }
        showDialog(request) {
            Terminal.logger.entering(Terminal.CLASS_NAME, "showDialog", [request]);
            let result = this.backend.showDialog(request);
            Terminal.logger.exiting(Terminal.CLASS_NAME, "showDialog", [result]);
            return result;
        }
        showDialogAsync(request) {
            Terminal.logger.entering(Terminal.CLASS_NAME, "showDialogAsync", [
                request
            ]);
            this.backend.showDialogAsync(request);
            Terminal.logger.exiting(Terminal.CLASS_NAME, "showDialogAsync");
        }
        balanceInquiry() {
            Terminal.logger.entering(Terminal.CLASS_NAME, "balanceInquiry");
            let response = this.backend.balanceInquiry();
            Terminal.logger.exiting(Terminal.CLASS_NAME, "balanceInquiry", [
                response
            ]);
            return response;
        }
        balanceInquiryAsync() {
            Terminal.logger.entering(Terminal.CLASS_NAME, "balanceInquiryAsync");
            this.backend.balanceInquiryAsync();
            Terminal.logger.exiting(Terminal.CLASS_NAME, "balanceInquiryAsync");
        }
        queryLoyalty(retainCard, loyaltyInfoType) {
            Terminal.logger.entering(Terminal.CLASS_NAME, "queryLoyalty", [
                retainCard,
                loyaltyInfoType
            ]);
            let response = this.backend.queryLoyalty(retainCard, loyaltyInfoType);
            Terminal.logger.exiting(Terminal.CLASS_NAME, "queryLoyalty", [response]);
            return response;
        }
        queryLoyaltyAsync(retainCard, loyaltyInfoType) {
            Terminal.logger.entering(Terminal.CLASS_NAME, "queryLoyaltyAsync", [retainCard, loyaltyInfoType]);
            this.backend.queryLoyaltyAsync(retainCard, loyaltyInfoType);
            Terminal.logger.exiting(Terminal.CLASS_NAME, "queryLoyaltyAsync");
        }
        addListener(listener) {
            if (Terminal.logger.isLoggable(timapi.logging.Level.FINEST)) {
                Terminal.logger.entering(Terminal.CLASS_NAME, "addListener", [
                    listener
                ]);
            }
            else {
                Terminal.logger.entering(Terminal.CLASS_NAME, "addListener");
            }
            this.backend.addListener(listener);
            Terminal.logger.exiting(Terminal.CLASS_NAME, "addListener");
        }
        removeListener(listener) {
            if (Terminal.logger.isLoggable(timapi.logging.Level.FINEST)) {
                Terminal.logger.entering(Terminal.CLASS_NAME, "removeListener", [
                    listener
                ]);
            }
            else {
                Terminal.logger.entering(Terminal.CLASS_NAME, "removeListener");
            }
            this.backend.removeListener(listener);
            Terminal.logger.exiting(Terminal.CLASS_NAME, "removeListener");
        }
        initLogging(settings) {
            let retainFileCount = settings.$logRetainFileCount;
            try {
                let prefix = "api-";
                switch (settings.$connectionMode) {
                    case timapi.constants.ConnectionMode.broadcast:
                        prefix = prefix + settings.$terminalId + "-";
                        break;
                    case timapi.constants.ConnectionMode.onFixIp:
                        prefix =
                            prefix +
                                "-";
                        break;
                    default:
                        break;
                }
            }
            catch (error) {
            }
        }
        initEcrData() {
            this.ecrData = new Array();
            let ecrInfo = new timapi.EcrInfo();
            ecrInfo.$name = window.navigator.platform;
            ecrInfo.$version = window.navigator.appVersion;
            ecrInfo.$integratorSolution = "Developer";
            this.ecrData.push(ecrInfo);
        }
        initPrintOptions() {
            this.printOptions = new Array();
            this.printOptions.push(new timapi.PrintOption(timapi.constants.Recipient.merchant, timapi.constants.PrintFormat.normal, 40, new Set()));
            this.printOptions.push(new timapi.PrintOption(timapi.constants.Recipient.cardholder, timapi.constants.PrintFormat.normal, 40, new Set()));
        }
    }
    Terminal.CLASS_NAME = "Terminal.ts";
    Terminal.logger = timapi.logging.Logger.getLogger(Terminal.logger_NAME);
    timapi.Terminal = Terminal;
})(timapi || (timapi = {}));
var timapi;
(function (timapi) {
    class TerminalBackend {
        constructor(terminal) {
            TerminalBackend.logger.entering(TerminalBackend.CLASS_NAME, "<constructor>");
            if (terminal == undefined) {
                throw new Error("terminal is undefined or null");
            }
            this.terminal = terminal;
            this.listeners = new Array();
            this.lockCountListeners = 0;
            TerminalBackend.logger.exiting(TerminalBackend.CLASS_NAME, "<constructor>");
        }
        get $terminal() {
            return this.terminal;
        }
        get $terminalStatus() {
            return this.terminalStatus;
        }
        set $terminalStatus(value) {
            TerminalBackend.logger.entering(TerminalBackend.CLASS_NAME, "setTerminalStatus", [this.terminalStatus]);
            this.terminalStatus = value;
            TerminalBackend.logger.exiting(TerminalBackend.CLASS_NAME, "setTerminalStatus");
        }
        get $brands() {
            return this.brands;
        }
        set $brands(value) {
            TerminalBackend.logger.entering(TerminalBackend.CLASS_NAME, "setBrands", [this.brands]);
            this.brands = value;
            TerminalBackend.logger.exiting(TerminalBackend.CLASS_NAME, "setBrands");
        }
        get $features() {
            return this.features;
        }
        set $features(value) {
            TerminalBackend.logger.entering(TerminalBackend.CLASS_NAME, "setFeatures", [this.$features]);
            this.features = value;
            TerminalBackend.logger.exiting(TerminalBackend.CLASS_NAME, "setFeatures");
        }
        get $actSeqCounter() {
            return this.actSeqCounter;
        }
        set $actSeqCounter(value) {
            TerminalBackend.logger.entering(TerminalBackend.CLASS_NAME, "setActSeqCounter", [this.actSeqCounter]);
            this.actSeqCounter = value;
            TerminalBackend.logger.exiting(TerminalBackend.CLASS_NAME, "setActSeqCounter");
        }
        get $configData() {
            return this.configData;
        }
        set $configData(value) {
            TerminalBackend.logger.entering(TerminalBackend.CLASS_NAME, "setConfigData", [this.configData]);
            this.configData = value;
            TerminalBackend.logger.exiting(TerminalBackend.CLASS_NAME, "setConfigData");
        }
        get $terminalId() {
            return this.terminalId;
        }
        set $terminalId(value) {
            TerminalBackend.logger.entering(TerminalBackend.CLASS_NAME, "setTerminalId", [this.terminalId]);
            this.terminalId = value;
            TerminalBackend.logger.exiting(TerminalBackend.CLASS_NAME, "setTerminalId");
        }
        get $runningRequest() {
            return this.runningRequest;
        }
        hasRunningRequest() {
            return this.runningRequest != undefined;
        }
        set $runningRequest(value) {
            this.runningRequest = value;
        }
        clearRunningRequestIf(runningRequest) {
            if (this.runningRequest === runningRequest) {
                this.runningRequest = undefined;
            }
        }
        dispose() {
            TerminalBackend.logger.entering(TerminalBackend.CLASS_NAME, "dispose");
            this.commDisconnect();
            this.listeners = new Array();
            this.lockCountListeners = 0;
            this.lockedListeners = undefined;
            TerminalBackend.logger.exiting(TerminalBackend.CLASS_NAME, "dispose");
        }
        addListener(listener) {
            if (TerminalBackend.logger.isLoggable(timapi.logging.Level.FINEST)) {
                TerminalBackend.logger.entering(TerminalBackend.CLASS_NAME, "addListener", [listener]);
            }
            else {
                TerminalBackend.logger.entering(TerminalBackend.CLASS_NAME, "addListener");
            }
            if (listener == undefined) {
                throw new Error("listener is undefined");
            }
            if (this.lockCountListeners === 0) {
                if (this.listeners !== undefined) {
                    this.listeners.push(listener);
                }
            }
            else {
                if (this.lockedListeners == undefined) {
                    this.lockedListeners = this.listeners.slice();
                }
                if (this.lockedListeners !== undefined) {
                    this.lockedListeners.push(listener);
                }
            }
            TerminalBackend.logger.entering(TerminalBackend.CLASS_NAME, "addListener");
        }
        removeListener(listener) {
            if (TerminalBackend.logger.isLoggable(timapi.logging.Level.FINEST)) {
                TerminalBackend.logger.entering(TerminalBackend.CLASS_NAME, "removeListener", [listener]);
            }
            else {
                TerminalBackend.logger.entering(TerminalBackend.CLASS_NAME, "removeListener");
            }
            if (listener == undefined) {
                throw new Error("listener is undefined");
            }
            if (this.lockCountListeners === 0) {
                if (this.listeners !== undefined) {
                    this.listeners = timapi.utils.ArrayAdditions.ArrayAdditions.remove(listener, this.listeners);
                }
            }
            else {
                if (this.lockedListeners == undefined) {
                    if (this.listeners !== undefined) {
                        this.lockedListeners = this.listeners.slice();
                    }
                    else {
                        this.lockedListeners = new Array();
                    }
                }
                this.lockedListeners = timapi.utils.ArrayAdditions.ArrayAdditions.remove(listener, this.lockedListeners);
            }
            TerminalBackend.logger.entering(TerminalBackend.CLASS_NAME, "removeListener");
        }
        notifyConnectCompleted(exception) {
            TerminalBackend.logger.entering(TerminalBackend.CLASS_NAME, "notifyConnectCompleted");
            let event = new timapi.TimEvent(this.terminal, exception, timapi.constants.RequestType.connect);
            this.lockListeners();
            try {
                if (this.listeners !== undefined) {
                    for (let listener of this.listeners) {
                        listener.connectCompleted(event);
                    }
                }
            }
            finally {
                this.unlockListeners();
            }
            TerminalBackend.logger.entering(TerminalBackend.CLASS_NAME, "notifyConnectCompleted");
        }
        notifyDisconnected(exception) {
            TerminalBackend.logger.entering(TerminalBackend.CLASS_NAME, "notifyDisconnected");
            this.lockListeners();
            try {
                if (this.listeners !== undefined) {
                    for (let listener of this.listeners) {
                        listener.disconnected(this.terminal, exception);
                    }
                }
            }
            finally {
                this.unlockListeners();
            }
            TerminalBackend.logger.entering(TerminalBackend.CLASS_NAME, "notifyDisconnected");
        }
        notifyActivateCompleted(exception, data) {
            if (TerminalBackend.logger.isLoggable(timapi.logging.Level.FINEST)) {
                TerminalBackend.logger.entering(TerminalBackend.CLASS_NAME, "notifyActivateCompleted", [exception, data]);
            }
            else {
                TerminalBackend.logger.entering(TerminalBackend.CLASS_NAME, "notifyActivateCompleted");
            }
            this.clearRunningRequestIf(timapi.constants.RequestType.activate);
            let event = new timapi.TimEvent(this.terminal, exception, timapi.constants.RequestType.activate);
            this.lockListeners();
            try {
                if (this.listeners !== undefined) {
                    for (let listener of this.listeners) {
                        listener.activateCompleted(event, data);
                    }
                }
            }
            finally {
                this.unlockListeners();
            }
            TerminalBackend.logger.entering(TerminalBackend.CLASS_NAME, "notifyActivateCompleted");
        }
        notifyApplicationInformationCompleted(exception) {
            TerminalBackend.logger.entering(TerminalBackend.CLASS_NAME, "notifyApplicationInformationCompleted", [exception]);
            this.clearRunningRequestIf(timapi.constants.RequestType.applicationInformation);
            let event = new timapi.TimEvent(this.terminal, exception, timapi.constants.RequestType.applicationInformation);
            this.lockListeners();
            try {
                if (this.listeners !== undefined) {
                    for (let listener of this.listeners) {
                        listener.applicationInformationCompleted(event);
                    }
                }
            }
            finally {
                this.unlockListeners();
            }
            TerminalBackend.logger.entering(TerminalBackend.CLASS_NAME, "notifyApplicationInformationCompleted");
        }
        notifyBalanceCompleted(exception, data) {
            if (TerminalBackend.logger.isLoggable(timapi.logging.Level.FINEST)) {
                TerminalBackend.logger.entering(TerminalBackend.CLASS_NAME, "notifyBalanceCompleted", [exception, data]);
            }
            else {
                TerminalBackend.logger.entering(TerminalBackend.CLASS_NAME, "notifyBalanceCompleted");
            }
            this.clearRunningRequestIf(timapi.constants.RequestType.balance);
            let event = new timapi.TimEvent(this.terminal, exception, timapi.constants.RequestType.balance);
            this.lockListeners();
            try {
                if (this.listeners !== undefined) {
                    for (let listener of this.listeners) {
                        listener.balanceCompleted(event, data);
                    }
                }
            }
            finally {
                this.unlockListeners();
            }
            TerminalBackend.logger.entering(TerminalBackend.CLASS_NAME, "notifyBalanceCompleted");
        }
        notifyChangeSettingsCompleted(exception) {
            TerminalBackend.logger.entering(TerminalBackend.CLASS_NAME, "notifyBalanceCompleted", [exception]);
            this.clearRunningRequestIf(timapi.constants.RequestType.changeSettings);
            let event = new timapi.TimEvent(this.terminal, exception, timapi.constants.RequestType.changeSettings);
            this.lockListeners();
            try {
                if (this.listeners !== undefined) {
                    for (let listener of this.listeners) {
                        listener.changeSettingsCompleted(event);
                    }
                }
            }
            finally {
                this.unlockListeners();
            }
            TerminalBackend.logger.entering(TerminalBackend.CLASS_NAME, "notifyChangeSettingsCompleted");
        }
        notifyCommitCompleted(exception) {
            TerminalBackend.logger.entering(TerminalBackend.CLASS_NAME, "notifyCommitCompleted", [exception]);
            this.clearRunningRequestIf(timapi.constants.RequestType.commit);
            let event = new timapi.TimEvent(this.terminal, exception, timapi.constants.RequestType.commit);
            this.lockListeners();
            try {
                if (this.listeners !== undefined) {
                    for (let listener of this.listeners) {
                        listener.commitCompleted(event);
                    }
                }
            }
            finally {
                this.unlockListeners();
            }
            TerminalBackend.logger.entering(TerminalBackend.CLASS_NAME, "notifyCommitCompleted");
        }
        notifyCounterRequestCompleted(exception, data) {
            if (TerminalBackend.logger.isLoggable(timapi.logging.Level.FINEST)) {
                TerminalBackend.logger.entering(TerminalBackend.CLASS_NAME, "notifyCounterRequestCompleted", [exception, data]);
            }
            else {
                TerminalBackend.logger.entering(TerminalBackend.CLASS_NAME, "notifyCounterRequestCompleted");
            }
            this.clearRunningRequestIf(timapi.constants.RequestType.counterRequest);
            let event = new timapi.TimEvent(this.terminal, exception, timapi.constants.RequestType.counterRequest);
            this.lockListeners();
            try {
                if (this.listeners !== undefined) {
                    for (let listener of this.listeners) {
                        listener.counterRequestCompleted(event, data);
                    }
                }
            }
            finally {
                this.unlockListeners();
            }
            TerminalBackend.logger.entering(TerminalBackend.CLASS_NAME, "notifyCounterRequestCompleted");
        }
        notifyDeactivateCompleted(exception, data) {
            if (TerminalBackend.logger.isLoggable(timapi.logging.Level.FINEST)) {
                TerminalBackend.logger.entering(TerminalBackend.CLASS_NAME, "notifyDeactivateCompleted", [exception, data]);
            }
            else {
                TerminalBackend.logger.entering(TerminalBackend.CLASS_NAME, "notifyDeactivateCompleted");
            }
            this.clearRunningRequestIf(timapi.constants.RequestType.deactivate);
            let event = new timapi.TimEvent(this.terminal, exception, timapi.constants.RequestType.deactivate);
            this.lockListeners();
            try {
                if (this.listeners !== undefined) {
                    for (let listener of this.listeners) {
                        listener.deactivateCompleted(event, data);
                    }
                }
            }
            finally {
                this.unlockListeners();
            }
            TerminalBackend.logger.entering(TerminalBackend.CLASS_NAME, "notifyDeactivateCompleted");
        }
        notifyDccRatesCompleted(exception, data) {
            if (TerminalBackend.logger.isLoggable(timapi.logging.Level.FINEST)) {
                TerminalBackend.logger.entering(TerminalBackend.CLASS_NAME, "notifyDccRatesCompleted", [exception, data]);
            }
            else {
                TerminalBackend.logger.entering(TerminalBackend.CLASS_NAME, "notifyDccRatesCompleted");
            }
            this.clearRunningRequestIf(timapi.constants.RequestType.dccRates);
            let event = new timapi.TimEvent(this.terminal, exception, timapi.constants.RequestType.dccRates);
            this.lockListeners();
            try {
                if (this.listeners !== undefined) {
                    for (let listener of this.listeners) {
                        listener.dccRatesCompleted(event, data);
                    }
                }
            }
            finally {
                this.unlockListeners();
            }
            TerminalBackend.logger.entering(TerminalBackend.CLASS_NAME, "notifyDeactivateCompleted");
        }
        notifyHardwareInformationCompleted(exception, data) {
            if (TerminalBackend.logger.isLoggable(timapi.logging.Level.FINEST)) {
                TerminalBackend.logger.entering(TerminalBackend.CLASS_NAME, "notifyHardwareInformationCompleted", [exception, data]);
            }
            else {
                TerminalBackend.logger.entering(TerminalBackend.CLASS_NAME, "notifyHardwareInformationCompleted");
            }
            this.clearRunningRequestIf(timapi.constants.RequestType.hardwareInformation);
            let event = new timapi.TimEvent(this.terminal, exception, timapi.constants.RequestType.hardwareInformation);
            this.lockListeners();
            try {
                if (this.listeners !== undefined) {
                    for (let listener of this.listeners) {
                        listener.hardwareInformationCompleted(event, data);
                    }
                }
            }
            finally {
                this.unlockListeners();
            }
            TerminalBackend.logger.entering(TerminalBackend.CLASS_NAME, "notifyHardwareInformationCompleted");
        }
        notifyInitTransactionCompleted(exception, data) {
            TerminalBackend.logger.entering(TerminalBackend.CLASS_NAME, "notifyInitTransactionCompleted", [exception]);
            this.clearRunningRequestIf(timapi.constants.RequestType.initTransaction);
            let event = new timapi.TimEvent(this.terminal, exception, timapi.constants.RequestType.initTransaction);
            this.lockListeners();
            try {
                if (this.listeners !== undefined) {
                    for (let listener of this.listeners) {
                        listener.initTransactionCompleted(event, data);
                    }
                }
            }
            finally {
                this.unlockListeners();
            }
            TerminalBackend.logger.entering(TerminalBackend.CLASS_NAME, "notifyInitTransactionCompleted");
        }
        notifyLoginCompleted(exception) {
            TerminalBackend.logger.entering(TerminalBackend.CLASS_NAME, "notifyLoginCompleted", [exception]);
            this.clearRunningRequestIf(timapi.constants.RequestType.login);
            let event = new timapi.TimEvent(this.terminal, exception, timapi.constants.RequestType.login);
            this.lockListeners();
            try {
                if (this.listeners !== undefined) {
                    for (let listener of this.listeners) {
                        listener.loginCompleted(event);
                    }
                }
            }
            finally {
                this.unlockListeners();
            }
            TerminalBackend.logger.entering(TerminalBackend.CLASS_NAME, "notifyLoginCompleted");
        }
        notifyLogoutCompleted(exception) {
            TerminalBackend.logger.entering(TerminalBackend.CLASS_NAME, "notifyLogoutCompleted", [exception]);
            this.clearRunningRequestIf(timapi.constants.RequestType.logout);
            let event = new timapi.TimEvent(this.terminal, exception, timapi.constants.RequestType.logout);
            this.lockListeners();
            try {
                if (this.listeners !== undefined) {
                    for (let listener of this.listeners) {
                        listener.logoutCompleted(event);
                    }
                }
            }
            finally {
                this.unlockListeners();
            }
            TerminalBackend.logger.entering(TerminalBackend.CLASS_NAME, "notifyLogoutCompleted");
        }
        notifyRebootCompleted(exception) {
            TerminalBackend.logger.entering(TerminalBackend.CLASS_NAME, "notifyRebootCompleted", [exception]);
            this.clearRunningRequestIf(timapi.constants.RequestType.reboot);
            let event = new timapi.TimEvent(this.terminal, exception, timapi.constants.RequestType.reboot);
            this.lockListeners();
            try {
                if (this.listeners !== undefined) {
                    for (let listener of this.listeners) {
                        listener.rebootCompleted(event);
                    }
                }
            }
            finally {
                this.unlockListeners();
            }
            TerminalBackend.logger.entering(TerminalBackend.CLASS_NAME, "notifyRebootCompleted");
        }
        notifyReconciliationCompleted(exception, data) {
            if (TerminalBackend.logger.isLoggable(timapi.logging.Level.FINEST)) {
                TerminalBackend.logger.entering(TerminalBackend.CLASS_NAME, "notifyReconciliationCompleted", [exception, data]);
            }
            else {
                TerminalBackend.logger.entering(TerminalBackend.CLASS_NAME, "notifyReconciliationCompleted");
            }
            this.clearRunningRequestIf(timapi.constants.RequestType.reconciliation);
            let event = new timapi.TimEvent(this.terminal, exception, timapi.constants.RequestType.reconciliation);
            this.lockListeners();
            try {
                if (this.listeners !== undefined) {
                    for (let listener of this.listeners) {
                        listener.reconciliationCompleted(event, data);
                    }
                }
            }
            finally {
                this.unlockListeners();
            }
            TerminalBackend.logger.entering(TerminalBackend.CLASS_NAME, "notifyReconciliationCompleted");
        }
        notifyReceiptRequestCompleted(exception, data) {
            if (TerminalBackend.logger.isLoggable(timapi.logging.Level.FINEST)) {
                TerminalBackend.logger.entering(TerminalBackend.CLASS_NAME, "notifyReceiptRequestCompleted", [exception, data]);
            }
            else {
                TerminalBackend.logger.entering(TerminalBackend.CLASS_NAME, "notifyReceiptRequestCompleted");
            }
            this.clearRunningRequestIf(timapi.constants.RequestType.receiptRequest);
            let event = new timapi.TimEvent(this.terminal, exception, timapi.constants.RequestType.receiptRequest);
            this.lockListeners();
            try {
                if (this.listeners !== undefined) {
                    for (let listener of this.listeners) {
                        listener.receiptRequestCompleted(event, data);
                    }
                }
            }
            finally {
                this.unlockListeners();
            }
            TerminalBackend.logger.entering(TerminalBackend.CLASS_NAME, "notifyReceiptRequestCompleted");
        }
        notifyReconfigCompleted(exception, data) {
            if (TerminalBackend.logger.isLoggable(timapi.logging.Level.FINEST)) {
                TerminalBackend.logger.entering(TerminalBackend.CLASS_NAME, "notifyReconfigCompleted", [exception, data]);
            }
            else {
                TerminalBackend.logger.entering(TerminalBackend.CLASS_NAME, "notifyReconfigCompleted");
            }
            this.clearRunningRequestIf(timapi.constants.RequestType.reconfig);
            let event = new timapi.TimEvent(this.terminal, exception, timapi.constants.RequestType.reconfig);
            this.lockListeners();
            try {
                if (this.listeners !== undefined) {
                    for (let listener of this.listeners) {
                        listener.reconfigCompleted(event, data);
                    }
                }
            }
            finally {
                this.unlockListeners();
            }
            TerminalBackend.logger.entering(TerminalBackend.CLASS_NAME, "notifyReconfigCompleted");
        }
        notifyRollbackCompleted(exception, data) {
            if (TerminalBackend.logger.isLoggable(timapi.logging.Level.FINEST)) {
                TerminalBackend.logger.entering(TerminalBackend.CLASS_NAME, "notifyRollbackCompleted", [exception, data]);
            }
            else {
                TerminalBackend.logger.entering(TerminalBackend.CLASS_NAME, "notifyRollbackCompleted");
            }
            this.clearRunningRequestIf(timapi.constants.RequestType.rollback);
            let event = new timapi.TimEvent(this.terminal, exception, timapi.constants.RequestType.rollback);
            this.lockListeners();
            try {
                if (this.listeners !== undefined) {
                    for (let listener of this.listeners) {
                        listener.rollbackCompleted(event, data);
                    }
                }
            }
            finally {
                this.unlockListeners();
            }
            TerminalBackend.logger.entering(TerminalBackend.CLASS_NAME, "notifyRollbackCompleted");
        }
        notifySoftwareUpdateCompleted(exception, data) {
            if (TerminalBackend.logger.isLoggable(timapi.logging.Level.FINEST)) {
                TerminalBackend.logger.entering(TerminalBackend.CLASS_NAME, "notifySoftwareUpdateCompleted", [exception, data]);
            }
            else {
                TerminalBackend.logger.entering(TerminalBackend.CLASS_NAME, "notifySoftwareUpdateCompleted");
            }
            this.clearRunningRequestIf(timapi.constants.RequestType.softwareUpdate);
            let event = new timapi.TimEvent(this.terminal, exception, timapi.constants.RequestType.softwareUpdate);
            this.lockListeners();
            try {
                if (this.listeners !== undefined) {
                    for (let listener of this.listeners) {
                        listener.softwareUpdateCompleted(event, data);
                    }
                }
            }
            finally {
                this.unlockListeners();
            }
            TerminalBackend.logger.entering(TerminalBackend.CLASS_NAME, "notifySoftwareUpdateCompleted");
        }
        notifySystemInformationCompleted(exception, data) {
            if (TerminalBackend.logger.isLoggable(timapi.logging.Level.FINEST)) {
                TerminalBackend.logger.entering(TerminalBackend.CLASS_NAME, "notifySystemInformationCompleted", [exception, data]);
            }
            else {
                TerminalBackend.logger.entering(TerminalBackend.CLASS_NAME, "notifySystemInformationCompleted");
            }
            this.clearRunningRequestIf(timapi.constants.RequestType.systemInformation);
            let event = new timapi.TimEvent(this.terminal, exception, timapi.constants.RequestType.systemInformation);
            this.lockListeners();
            try {
                if (this.listeners !== undefined) {
                    for (let listener of this.listeners) {
                        listener.systemInformationCompleted(event, data);
                    }
                }
            }
            finally {
                this.unlockListeners();
            }
            TerminalBackend.logger.entering(TerminalBackend.CLASS_NAME, "notifySystemInformationCompleted");
        }
        notifyTransactionCompleted(exception, data) {
            if (TerminalBackend.logger.isLoggable(timapi.logging.Level.FINEST)) {
                TerminalBackend.logger.entering(TerminalBackend.CLASS_NAME, "notifyTransactionCompleted", [exception, data]);
            }
            else {
                TerminalBackend.logger.entering(TerminalBackend.CLASS_NAME, "notifyTransactionCompleted");
            }
            this.clearRunningRequestIf(timapi.constants.RequestType.transaction);
            let event = new timapi.TimEvent(this.terminal, exception, timapi.constants.RequestType.transaction);
            this.lockListeners();
            try {
                if (this.listeners !== undefined) {
                    for (let listener of this.listeners) {
                        listener.transactionCompleted(event, data);
                    }
                }
            }
            finally {
                this.unlockListeners();
            }
            TerminalBackend.logger.entering(TerminalBackend.CLASS_NAME, "notifyTransactionCompleted");
        }
        notifyTerminalStatusChanged() {
            TerminalBackend.logger.entering(TerminalBackend.CLASS_NAME, "notifyTerminalStatusChanged");
            this.lockListeners();
            try {
                if (this.listeners !== undefined) {
                    for (let listener of this.listeners) {
                        listener.terminalStatusChanged(this.terminal);
                    }
                }
            }
            finally {
                this.unlockListeners();
            }
            TerminalBackend.logger.exiting(TerminalBackend.CLASS_NAME, "notifyTerminalStatusChanged");
        }
        notifyCloseReaderCompleted(exception) {
            TerminalBackend.logger.entering(TerminalBackend.CLASS_NAME, "notifyCloseReaderCompleted");
            this.clearRunningRequestIf(timapi.constants.RequestType.closeReader);
            let event = new timapi.TimEvent(this.terminal, exception, timapi.constants.RequestType.closeReader);
            this.lockListeners();
            try {
                if (this.listeners !== undefined) {
                    for (let listener of this.listeners) {
                        listener.closeReaderCompleted(event);
                    }
                }
            }
            finally {
                this.unlockListeners();
            }
            TerminalBackend.logger.entering(TerminalBackend.CLASS_NAME, "notifyCloseReaderCompleted");
        }
        notifyOpenReaderCompleted(exception) {
            TerminalBackend.logger.entering(TerminalBackend.CLASS_NAME, "notifyOpenReaderCompleted");
            this.clearRunningRequestIf(timapi.constants.RequestType.openReader);
            let event = new timapi.TimEvent(this.terminal, exception, timapi.constants.RequestType.openReader);
            this.lockListeners();
            try {
                if (this.listeners !== undefined) {
                    for (let listener of this.listeners) {
                        listener.openReaderCompleted(event);
                    }
                }
            }
            finally {
                this.unlockListeners();
            }
            TerminalBackend.logger.entering(TerminalBackend.CLASS_NAME, "notifyOpenReaderCompleted");
        }
        notifyEjectCardCompleted(exception) {
            TerminalBackend.logger.entering(TerminalBackend.CLASS_NAME, "notifyEjectCardCompleted");
            this.clearRunningRequestIf(timapi.constants.RequestType.ejectCard);
            let event = new timapi.TimEvent(this.terminal, exception, timapi.constants.RequestType.ejectCard);
            this.lockListeners();
            try {
                if (this.listeners !== undefined) {
                    for (let listener of this.listeners) {
                        listener.ejectCardCompleted(event);
                    }
                }
            }
            finally {
                this.unlockListeners();
            }
            TerminalBackend.logger.entering(TerminalBackend.CLASS_NAME, "notifyEjectCardCompleted");
        }
        notifyOpenMaintenanceWindowCompleted(exception) {
            TerminalBackend.logger.entering(TerminalBackend.CLASS_NAME, "notifyOpenMaintenanceWindowCompleted");
            this.clearRunningRequestIf(timapi.constants.RequestType.openMaintenanceWindow);
            let event = new timapi.TimEvent(this.terminal, exception, timapi.constants.RequestType.openMaintenanceWindow);
            this.lockListeners();
            try {
                if (this.listeners !== undefined) {
                    for (let listener of this.listeners) {
                        listener.openMaintenanceWindowCompleted(event);
                    }
                }
            }
            finally {
                this.unlockListeners();
            }
            TerminalBackend.logger.entering(TerminalBackend.CLASS_NAME, "notifyOpenMaintenanceWindowCompleted");
        }
        notifyCloseMaintenanceWindowCompleted(exception) {
            TerminalBackend.logger.entering(TerminalBackend.CLASS_NAME, "notifyCloseMaintenanceWindowCompleted");
            this.clearRunningRequestIf(timapi.constants.RequestType.closeMaintenanceWindow);
            let event = new timapi.TimEvent(this.terminal, exception, timapi.constants.RequestType.closeMaintenanceWindow);
            this.lockListeners();
            try {
                if (this.listeners !== undefined) {
                    for (let listener of this.listeners) {
                        listener.closeMaintenanceWindowCompleted(event);
                    }
                }
            }
            finally {
                this.unlockListeners();
            }
            TerminalBackend.logger.entering(TerminalBackend.CLASS_NAME, "notifyCloseMaintenanceWindowCompleted");
        }
        notifyActivateServiceMenuCompleted(exception) {
            TerminalBackend.logger.entering(TerminalBackend.CLASS_NAME, "notifyActivateServiceMenuCompleted");
            this.clearRunningRequestIf(timapi.constants.RequestType.activateServiceMenu);
            let event = new timapi.TimEvent(this.terminal, exception, timapi.constants.RequestType.activateServiceMenu);
            this.lockListeners();
            try {
                if (this.listeners !== undefined) {
                    for (let listener of this.listeners) {
                        listener.activateServiceMenuCompleted(event);
                    }
                }
            }
            finally {
                this.unlockListeners();
            }
            TerminalBackend.logger.entering(TerminalBackend.CLASS_NAME, "notifyActivateServiceMenuCompleted");
        }
        notifyOpenDialogModeCompleted(exception) {
            TerminalBackend.logger.entering(TerminalBackend.CLASS_NAME, "notifyOpenDialogModeCompleted");
            this.clearRunningRequestIf(timapi.constants.RequestType.openDialogMode);
            let event = new timapi.TimEvent(this.terminal, exception, timapi.constants.RequestType.openDialogMode);
            this.lockListeners();
            try {
                if (this.listeners !== undefined) {
                    for (let listener of this.listeners) {
                        listener.openDialogModeCompleted(event);
                    }
                }
            }
            finally {
                this.unlockListeners();
            }
            TerminalBackend.logger.entering(TerminalBackend.CLASS_NAME, "notifyOpenDialogModeCompleted");
        }
        notifyCloseDialogModeCompleted(exception) {
            TerminalBackend.logger.entering(TerminalBackend.CLASS_NAME, "notifyCloseDialogModeCompleted");
            this.clearRunningRequestIf(timapi.constants.RequestType.closeDialogMode);
            let event = new timapi.TimEvent(this.terminal, exception, timapi.constants.RequestType.closeDialogMode);
            this.lockListeners();
            try {
                if (this.listeners !== undefined) {
                    for (let listener of this.listeners) {
                        listener.closeDialogModeCompleted(event);
                    }
                }
            }
            finally {
                this.unlockListeners();
            }
            TerminalBackend.logger.entering(TerminalBackend.CLASS_NAME, "notifyCloseDialogModeCompleted");
        }
        notifyShowSignatureCaptureCompleted(exception, data) {
            TerminalBackend.logger.entering(TerminalBackend.CLASS_NAME, "notifyShowSignatureCaptureCompleted");
            this.clearRunningRequestIf(timapi.constants.RequestType.showSignatureCapture);
            let event = new timapi.TimEvent(this.terminal, exception, timapi.constants.RequestType.showSignatureCapture);
            this.lockListeners();
            try {
                if (this.listeners !== undefined) {
                    for (let listener of this.listeners) {
                        listener.showSignatureCaptureCompleted(event, data);
                    }
                }
            }
            finally {
                this.unlockListeners();
            }
            TerminalBackend.logger.entering(TerminalBackend.CLASS_NAME, "notifyShowSignatureCaptureCompleted");
        }
        notifyShowDialogCompleted(exception, data) {
            TerminalBackend.logger.entering(TerminalBackend.CLASS_NAME, "notifyShowDialogCompleted");
            this.clearRunningRequestIf(timapi.constants.RequestType.showDialog);
            let event = new timapi.TimEvent(this.terminal, exception, timapi.constants.RequestType.showDialog);
            this.lockListeners();
            try {
                if (this.listeners !== undefined) {
                    for (let listener of this.listeners) {
                        listener.showDialogCompleted(event, data);
                    }
                }
            }
            finally {
                this.unlockListeners();
            }
            TerminalBackend.logger.entering(TerminalBackend.CLASS_NAME, "notifyShowDialogCompleted");
        }
        notifyBalanceInquiryCompleted(exception, data) {
            TerminalBackend.logger.entering(TerminalBackend.CLASS_NAME, "notifyBalanceInquiryCompleted", [data]);
            this.clearRunningRequestIf(timapi.constants.RequestType.balanceInquiry);
            let event = new timapi.TimEvent(this.terminal, exception, timapi.constants.RequestType.balanceInquiry);
            this.lockListeners();
            try {
                if (this.listeners !== undefined) {
                    for (let listener of this.listeners) {
                        listener.balanceInquiryCompleted(event, data);
                    }
                }
            }
            finally {
                this.unlockListeners();
            }
            TerminalBackend.logger.entering(TerminalBackend.CLASS_NAME, "notifyBalanceInquiryCompleted");
        }
        notifyQueryLoyaltyCompleted(exception, data) {
            TerminalBackend.logger.entering(TerminalBackend.CLASS_NAME, "notifyQueryLoyaltyCompleted", [data]);
            this.clearRunningRequestIf(timapi.constants.RequestType.queryLoyalty);
            let event = new timapi.TimEvent(this.terminal, exception, timapi.constants.RequestType.queryLoyalty);
            this.lockListeners();
            try {
                if (this.listeners !== undefined) {
                    for (let listener of this.listeners) {
                        listener.queryLoyaltyCompleted(event, data);
                    }
                }
            }
            finally {
                this.unlockListeners();
            }
            TerminalBackend.logger.entering(TerminalBackend.CLASS_NAME, "notifyQueryLoyaltyCompleted");
        }
        get $commEndpoint() {
            return this.commEndpoint;
        }
        isCommConnected() {
            return this.commEndpoint !== undefined;
        }
        commConnect() {
            TerminalBackend.logger.entering(TerminalBackend.CLASS_NAME, "commConnect");
            if (this.commEndpoint !== undefined) {
                throw new Error("Already connected to this.terminal");
            }
            TerminalBackend.logger.log(timapi.logging.Level.INFO, "Connecting to this.terminal " + this.terminal.$settings.$terminalId);
            this.commEndpoint = new timapi.SocketCommEndpoint(this, this.terminal.$settings);
            this.commEndpoint.connect();
            TerminalBackend.logger.exiting(TerminalBackend.CLASS_NAME, "commConnect");
        }
        commDisconnect() {
            TerminalBackend.logger.entering(TerminalBackend.CLASS_NAME, "commDisconnect");
            if (this.commEndpoint !== undefined) {
                this.commEndpoint.disconnect();
                this.commEndpoint = undefined;
            }
            TerminalBackend.logger.exiting(TerminalBackend.CLASS_NAME, "commDisconnect");
        }
        hasGuide(guide) {
            return this.terminal.$settings.$guides.has(guide);
        }
        hasAdminFunction(fnct) {
            return (this.terminal.getFeatures() == undefined ||
                this.terminal.getFeatures().$sixml.$adminFunctions.has(fnct));
        }
        hasStatusFunction(fnct) {
            return (this.terminal.getFeatures() == undefined ||
                this.terminal.getFeatures().$sixml.$statusFunctions.has(fnct));
        }
        hasFinancialFunction(fnct) {
            return (this.terminal.getFeatures() == undefined ||
                this.terminal.getFeatures().$sixml.$financialFunctions.has(fnct));
        }
        hasNonFinancialFunction(fnct) {
            return (this.terminal.getFeatures() == undefined ||
                this.terminal.getFeatures().$sixml.$nonFinancialFunctions.has(fnct));
        }
        hasDialogFunction(fnct) {
            return (this.terminal.getFeatures() == undefined ||
                this.terminal.getFeatures().$sixml.$dialogFunctions.has(fnct));
        }
        lockListeners() {
            this.lockCountListeners++;
        }
        unlockListeners() {
            this.lockCountListeners--;
            if (this.lockCountListeners > 0) {
                return;
            }
            if (this.lockedListeners !== undefined) {
                this.listeners = this.lockedListeners;
                this.lockedListeners = undefined;
            }
        }
        connected() { }
        disconnected() { }
        messageReceived(message) { }
        connectionFailed(error) { }
    }
    TerminalBackend.LOGGER_NAME = "TerminalBackend";
    TerminalBackend.CLASS_NAME = "TerminalBackend";
    TerminalBackend.logger = timapi.logging.Logger.getLogger(TerminalBackend.LOGGER_NAME);
    timapi.TerminalBackend = TerminalBackend;
})(timapi || (timapi = {}));
var timapi;
(function (timapi) {
    class TerminalBackendSixml extends timapi.TerminalBackend {
        constructor(terminal) {
            super(terminal);
            this.synchronousRequest = new timapi.SynchronousTerminalListener();
            this.stateMachine = new timapi.statemachine.sixml.StateMachine(this);
            this.nextSequenceNumber = 0;
            this.m_xmlWriter = new timapi.protocol.XmlWriter(true, false);
            TerminalBackendSixml.logger.entering(TerminalBackendSixml.CLASS_NAME, "<constructor>");
            this.sixmlReceivedMessageHacks = new timapi.SixmlReceivedMessageHacks(terminal.$settings);
            this.setDisconnectedTerminalStatus();
            this.stateMachine.start();
            if (this.synchronousRequest !== undefined) {
                this.addListener(this.synchronousRequest);
            }
            TerminalBackendSixml.logger.exiting(TerminalBackendSixml.CLASS_NAME, "<constructor>");
        }
        get $pendingAction() {
            return this.pendingAction;
        }
        set $pendingAction(value) {
            this.pendingAction = value;
        }
        dispose() {
            TerminalBackendSixml.logger.entering(TerminalBackendSixml.CLASS_NAME, "dispose");
            this.stateMachine.dispose();
            this.synchronousRequest = undefined;
            TerminalBackendSixml.logger.exiting(TerminalBackendSixml.CLASS_NAME, "dispose");
            super.dispose();
        }
        get $license() {
            return this.license;
        }
        set $license(value) {
            TerminalBackendSixml.logger.entering(TerminalBackendSixml.CLASS_NAME, "setLicense", [this.license]);
            this.license = value;
            TerminalBackendSixml.logger.entering(TerminalBackendSixml.CLASS_NAME, "setLicense");
        }
        isPendingRequestAllowed() {
            switch (this.stateMachine.$pendingRequest) {
                case timapi.constants.RequestType.activate:
                    return this.hasAdminFunction(timapi.constants.AdminFunctions.activate);
                case timapi.constants.RequestType.applicationInformation:
                    return this.hasStatusFunction(timapi.constants.StatusFunctions.applicationInformation);
                case timapi.constants.RequestType.balance:
                    return this.hasAdminFunction(timapi.constants.AdminFunctions.balance);
                case timapi.constants.RequestType.commit:
                    return this.hasFinancialFunction(timapi.constants.FinancialTransactions.commit);
                case timapi.constants.RequestType.counterRequest:
                    return this.hasAdminFunction(timapi.constants.AdminFunctions.counterRequest);
                case timapi.constants.RequestType.dccRates:
                    return this.hasAdminFunction(timapi.constants.AdminFunctions.dccRates);
                case timapi.constants.RequestType.deactivate:
                    return this.hasAdminFunction(timapi.constants.AdminFunctions.deactivate);
                case timapi.constants.RequestType.hardwareInformation:
                    return this.hasStatusFunction(timapi.constants.StatusFunctions.hardwareInformation);
                case timapi.constants.RequestType.changeSettings:
                    return this.hasAdminFunction(timapi.constants.AdminFunctions.changeSettings);
                case timapi.constants.RequestType.initTransaction:
                    return this.hasNonFinancialFunction(timapi.constants.NonFinancialTransactions.initTransaction);
                case timapi.constants.RequestType.login:
                    return this.hasAdminFunction(timapi.constants.AdminFunctions.login);
                case timapi.constants.RequestType.logout:
                    return this.hasAdminFunction(timapi.constants.AdminFunctions.logout);
                case timapi.constants.RequestType.reboot:
                    return this.hasAdminFunction(timapi.constants.AdminFunctions.reboot);
                case timapi.constants.RequestType.receiptRequest:
                    return this.hasAdminFunction(timapi.constants.AdminFunctions.receiptRequest);
                case timapi.constants.RequestType.reconciliation:
                    return this.hasAdminFunction(timapi.constants.AdminFunctions.reconciliation);
                case timapi.constants.RequestType.reconfig:
                    return this.hasAdminFunction(timapi.constants.AdminFunctions.reconfig);
                case timapi.constants.RequestType.rollback:
                    return this.hasFinancialFunction(timapi.constants.FinancialTransactions.rollback);
                case timapi.constants.RequestType.softwareUpdate:
                    return this.hasAdminFunction(timapi.constants.AdminFunctions.softwareUpdate);
                case timapi.constants.RequestType.systemInformation:
                    return this.hasStatusFunction(timapi.constants.StatusFunctions.systemInformation);
                case timapi.constants.RequestType.transaction:
                    switch (this.failTransactionType) {
                        case timapi.constants.TransactionType.purchase:
                            return this.hasFinancialFunction(timapi.constants.FinancialTransactions.purchase);
                        case timapi.constants.TransactionType.credit:
                            return this.hasFinancialFunction(timapi.constants.FinancialTransactions.credit);
                        case timapi.constants.TransactionType.reversal:
                            return this.hasFinancialFunction(timapi.constants.FinancialTransactions.reversal);
                        case timapi.constants.TransactionType.preAuthorization:
                            return (this.hasGuide(timapi.constants.Guides.petrol) &&
                                this.hasFinancialFunction(timapi.constants.FinancialTransactions.preAuthorization));
                        case timapi.constants.TransactionType.finalizePurchase:
                            return (this.hasGuide(timapi.constants.Guides.petrol) &&
                                this.hasFinancialFunction(timapi.constants.FinancialTransactions.finalizePurchase));
                        case timapi.constants.TransactionType.purchaseForcedAcceptance:
                            return (this.hasGuide(timapi.constants.Guides.advancedRetail) &&
                                this.hasFinancialFunction(timapi.constants.FinancialTransactions
                                    .purchaseForcedAcceptance));
                        case timapi.constants.TransactionType.cashAdvance:
                            return (this.hasGuide(timapi.constants.Guides.advancedRetail) &&
                                this.hasFinancialFunction(timapi.constants.FinancialTransactions.cashAdvance));
                        case timapi.constants.TransactionType.purchaseWithCashback:
                            return (this.hasGuide(timapi.constants.Guides.advancedRetail) &&
                                this.hasFinancialFunction(timapi.constants.FinancialTransactions.purchaseWithCashback));
                        case timapi.constants.TransactionType.purchasePhoneAuthorized:
                            return (this.hasGuide(timapi.constants.Guides.advancedRetail) &&
                                this.hasFinancialFunction(timapi.constants.FinancialTransactions.purchasePhoneAuthorized));
                        default:
                            return true;
                    }
                case timapi.constants.RequestType.openReader:
                    return (this.hasGuide(timapi.constants.Guides.unattended) &&
                        this.hasAdminFunction(timapi.constants.AdminFunctions.openReader));
                case timapi.constants.RequestType.closeReader:
                    return (this.hasGuide(timapi.constants.Guides.unattended) &&
                        this.hasAdminFunction(timapi.constants.AdminFunctions.closeReader));
                case timapi.constants.RequestType.ejectCard:
                    return (this.hasGuide(timapi.constants.Guides.unattended) &&
                        this.hasAdminFunction(timapi.constants.AdminFunctions.ejectCard));
                case timapi.constants.RequestType.openMaintenanceWindow:
                    return (this.hasGuide(timapi.constants.Guides.unattended) &&
                        this.hasAdminFunction(timapi.constants.AdminFunctions.openMaintenanceWindow));
                case timapi.constants.RequestType.closeMaintenanceWindow:
                    return (this.hasGuide(timapi.constants.Guides.unattended) &&
                        this.hasAdminFunction(timapi.constants.AdminFunctions.closeMaintenanceWindow));
                case timapi.constants.RequestType.activateServiceMenu:
                    return (this.hasGuide(timapi.constants.Guides.unattended) &&
                        this.hasAdminFunction(timapi.constants.AdminFunctions.activateServiceMenu));
                case timapi.constants.RequestType.openDialogMode:
                    return (this.hasGuide(timapi.constants.Guides.dialog) &&
                        this.hasAdminFunction(timapi.constants.AdminFunctions.openDialogMode));
                case timapi.constants.RequestType.closeDialogMode:
                    return (this.hasGuide(timapi.constants.Guides.dialog) &&
                        this.hasAdminFunction(timapi.constants.AdminFunctions.closeDialogMode));
                case timapi.constants.RequestType.showSignatureCapture:
                    return (this.hasGuide(timapi.constants.Guides.DIALOG) &&
                        this.hasDialogFunction(timapi.constants.DialogFunctions.showSignatureCapture));
                case timapi.constants.RequestType.showDialog:
                    return (this.hasGuide(timapi.constants.Guides.DIALOG) &&
                        this.hasDialogFunction(timapi.constants.DialogFunctions.showDialog));
                default:
                    return true;
            }
        }
        activate() {
            TerminalBackendSixml.logger.entering(TerminalBackendSixml.CLASS_NAME, "activate");
            if (!this.hasAdminFunction(timapi.constants.AdminFunctions.activate)) {
                throw new timapi.TimException(timapi.constants.ResultCode.apiFunctionDisallowed);
            }
            if (this.hasRunningRequest()) {
                throw new timapi.TimException(timapi.constants.ResultCode.requestPending);
            }
            if (this.synchronousRequest == undefined) {
                throw new Error("synchronousRequest == undefined");
            }
            this.synchronousRequest.prepareWait(timapi.constants.RequestType.activate);
            this.$runningRequest = timapi.constants.RequestType.activate;
            this.stateMachine.eventActivate();
            this.synchronousRequest.waitForRequestCompleted();
            if (this.synchronousRequest.$lastException !== undefined) {
                throw this.synchronousRequest.$lastException;
            }
            TerminalBackendSixml.logger.exiting(TerminalBackendSixml.CLASS_NAME, "activate");
            if (this.synchronousRequest.$lastActivateResponse == undefined) {
                throw new Error("this.synchronousRequest.$lastActivateResponse == undefined");
            }
            return this.synchronousRequest.$lastActivateResponse;
        }
        activateAsync() {
            TerminalBackendSixml.logger.entering(TerminalBackendSixml.CLASS_NAME, "activateAsync");
            if (!this.hasAdminFunction(timapi.constants.AdminFunctions.activate)) {
                throw new timapi.TimException(timapi.constants.ResultCode.apiFunctionDisallowed);
            }
            if (this.hasRunningRequest()) {
                throw new timapi.TimException(timapi.constants.ResultCode.requestPending);
            }
            this.$runningRequest = timapi.constants.RequestType.activate;
            this.stateMachine.eventActivate();
            TerminalBackendSixml.logger.exiting(TerminalBackendSixml.CLASS_NAME, "activateAsync");
        }
        applicationInformation() {
            TerminalBackendSixml.logger.entering(TerminalBackendSixml.CLASS_NAME, "applicationInformation");
            if (!this.hasStatusFunction(timapi.constants.StatusFunctions.applicationInformation)) {
                throw new timapi.TimException(timapi.constants.ResultCode.apiFunctionDisallowed);
            }
            if (this.hasRunningRequest()) {
                throw new timapi.TimException(timapi.constants.ResultCode.requestPending);
            }
            if (this.synchronousRequest == undefined) {
                throw new Error("this.synchronousRequest == undefined");
            }
            this.synchronousRequest.prepareWait(timapi.constants.RequestType.applicationInformation);
            this.$runningRequest = timapi.constants.RequestType.applicationInformation;
            this.stateMachine.eventApplicationInformation();
            this.synchronousRequest.waitForRequestCompleted();
            if (this.synchronousRequest.$lastException !== undefined) {
                throw this.synchronousRequest.$lastException;
            }
            TerminalBackendSixml.logger.exiting(TerminalBackendSixml.CLASS_NAME, "applicationInformation");
        }
        applicationInformationAsync() {
            TerminalBackendSixml.logger.entering(TerminalBackendSixml.CLASS_NAME, "applicationInformationAsync");
            if (!this.hasStatusFunction(timapi.constants.StatusFunctions.applicationInformation)) {
                throw new timapi.TimException(timapi.constants.ResultCode.apiFunctionDisallowed);
            }
            if (this.hasRunningRequest()) {
                throw new timapi.TimException(timapi.constants.ResultCode.requestPending);
            }
            this.$runningRequest = timapi.constants.RequestType.applicationInformation;
            this.stateMachine.eventApplicationInformation();
            TerminalBackendSixml.logger.exiting(TerminalBackendSixml.CLASS_NAME, "applicationInformationAsync");
        }
        balance() {
            TerminalBackendSixml.logger.entering(TerminalBackendSixml.CLASS_NAME, "balance");
            if (!this.hasAdminFunction(timapi.constants.AdminFunctions.balance)) {
                throw new timapi.TimException(timapi.constants.ResultCode.apiFunctionDisallowed);
            }
            if (this.hasRunningRequest()) {
                throw new timapi.TimException(timapi.constants.ResultCode.requestPending);
            }
            if (this.synchronousRequest == undefined) {
                throw new Error("this.synchronousRequest == undefined");
            }
            this.synchronousRequest.prepareWait(timapi.constants.RequestType.balance);
            this.$runningRequest = timapi.constants.RequestType.balance;
            this.stateMachine.eventBalance();
            this.synchronousRequest.waitForRequestCompleted();
            if (this.synchronousRequest.$lastException !== undefined) {
                throw this.synchronousRequest.$lastException;
            }
            TerminalBackendSixml.logger.exiting(TerminalBackendSixml.CLASS_NAME, "balance");
            if (this.synchronousRequest.$lastBalanceResponse == undefined) {
                throw new Error("this.synchronousRequest.$lastBalanceResponse == undefined");
            }
            return this.synchronousRequest.$lastBalanceResponse;
        }
        balanceAsync() {
            TerminalBackendSixml.logger.entering(TerminalBackendSixml.CLASS_NAME, "balanceAsync");
            if (!this.hasAdminFunction(timapi.constants.AdminFunctions.balance)) {
                throw new timapi.TimException(timapi.constants.ResultCode.apiFunctionDisallowed);
            }
            if (this.hasRunningRequest()) {
                throw new timapi.TimException(timapi.constants.ResultCode.requestPending);
            }
            this.$runningRequest = timapi.constants.RequestType.balance;
            this.stateMachine.eventBalance();
            TerminalBackendSixml.logger.exiting(TerminalBackendSixml.CLASS_NAME, "balanceAsync");
        }
        cancel(silent, retainCard) {
            if (arguments.length === 0) {
                TerminalBackendSixml.logger.entering(TerminalBackendSixml.CLASS_NAME, "cancel");
                if (!this.hasNonFinancialFunction(timapi.constants.NonFinancialTransactions.cancel)) {
                    throw new timapi.TimException(timapi.constants.ResultCode.apiFunctionDisallowed);
                }
                this.stateMachine.$notificationCancel = new timapi.protocol.sixml.Notification_Cancel();
                this.stateMachine.eventCancel();
                TerminalBackendSixml.logger.exiting(TerminalBackendSixml.CLASS_NAME, "cancel");
            }
            else {
                if (TerminalBackendSixml.logger.isLoggable(timapi.logging.Level.FINEST)) {
                    TerminalBackendSixml.logger.entering(TerminalBackendSixml.CLASS_NAME, "cancel(silent,retainCard)", [silent, retainCard]);
                }
                else {
                    TerminalBackendSixml.logger.entering(TerminalBackendSixml.CLASS_NAME, "cancel(silent,retainCard)");
                }
                if (!(this.hasGuide(timapi.constants.Guides.petrol) ||
                    this.hasGuide(timapi.constants.Guides.unattended))) {
                    throw new timapi.TimException(timapi.constants.ResultCode.apiFunctionDisallowed);
                }
                if (!this.hasNonFinancialFunction(timapi.constants.NonFinancialTransactions.cancel)) {
                    throw new timapi.TimException(timapi.constants.ResultCode.apiFunctionDisallowed);
                }
                let notification = new timapi.protocol.sixml.Notification_Cancel();
                notification.silentFlag = silent;
                notification.retainCardFlag = retainCard;
                this.stateMachine.$notificationCancel = notification;
                this.stateMachine.eventCancel();
                TerminalBackendSixml.logger.exiting(TerminalBackendSixml.CLASS_NAME, "cancel(silnet,retainCard)");
            }
        }
        changeSettings(settings) {
            TerminalBackendSixml.logger.entering(TerminalBackendSixml.CLASS_NAME, "changeSettings", [settings]);
            if (!this.hasAdminFunction(timapi.constants.AdminFunctions.changeSettings)) {
                throw new timapi.TimException(timapi.constants.ResultCode.apiFunctionDisallowed);
            }
            if (this.hasRunningRequest()) {
                throw new timapi.TimException(timapi.constants.ResultCode.requestPending);
            }
            if (this.synchronousRequest !== undefined) {
                this.synchronousRequest.prepareWait(timapi.constants.RequestType.changeSettings);
                let request = new timapi.protocol.sixml.Request_ChangeSettings();
                request.settingsList = timapi.statemachine.sixml.ConvertTimApi2SIXml.convertSettings(settings);
                this.stateMachine.$requestChangeSettings(request);
                this.$runningRequest = timapi.constants.RequestType.changeSettings;
                this.stateMachine.eventChangeSettings();
                this.synchronousRequest.waitForRequestCompleted();
                if (this.synchronousRequest.$lastException !== undefined) {
                    throw this.synchronousRequest.$lastException;
                }
                TerminalBackendSixml.logger.exiting(TerminalBackendSixml.CLASS_NAME, "changeSettings");
            }
        }
        changeSettingsAsync(settings) {
            TerminalBackendSixml.logger.entering(TerminalBackendSixml.CLASS_NAME, "changeSettingsAsync", [settings]);
            if (!this.hasAdminFunction(timapi.constants.AdminFunctions.changeSettings)) {
                throw new timapi.TimException(timapi.constants.ResultCode.apiFunctionDisallowed);
            }
            if (this.hasRunningRequest()) {
                throw new timapi.TimException(timapi.constants.ResultCode.requestPending);
            }
            let request = new timapi.protocol.sixml.Request_ChangeSettings();
            request.settingsList = timapi.statemachine.sixml.ConvertTimApi2SIXml.convertSettings(settings);
            this.stateMachine.$requestChangeSettings(request);
            this.$runningRequest = timapi.constants.RequestType.changeSettings;
            this.stateMachine.eventChangeSettings();
            TerminalBackendSixml.logger.exiting(TerminalBackendSixml.CLASS_NAME, "changeSettingsAsync");
        }
        commit() {
            TerminalBackendSixml.logger.entering(TerminalBackendSixml.CLASS_NAME, "commit");
            if (!this.hasFinancialFunction(timapi.constants.FinancialTransactions.commit)) {
                throw new timapi.TimException(timapi.constants.ResultCode.apiFunctionDisallowed);
            }
            if (this.hasRunningRequest()) {
                throw new timapi.TimException(timapi.constants.ResultCode.requestPending);
            }
            if (this.synchronousRequest !== undefined) {
                this.synchronousRequest.prepareWait(timapi.constants.RequestType.commit);
                this.$runningRequest = timapi.constants.RequestType.commit;
                this.stateMachine.eventCommit();
                this.synchronousRequest.waitForRequestCompleted();
                if (this.synchronousRequest.$lastException !== undefined) {
                    throw this.synchronousRequest.$lastException;
                }
            }
            TerminalBackendSixml.logger.exiting(TerminalBackendSixml.CLASS_NAME, "commit");
        }
        commitAsync() {
            TerminalBackendSixml.logger.entering(TerminalBackendSixml.CLASS_NAME, "commitAsync");
            if (!this.hasFinancialFunction(timapi.constants.FinancialTransactions.commit)) {
                throw new timapi.TimException(timapi.constants.ResultCode.apiFunctionDisallowed);
            }
            if (this.hasRunningRequest()) {
                throw new timapi.TimException(timapi.constants.ResultCode.requestPending);
            }
            this.$runningRequest = timapi.constants.RequestType.commit;
            this.stateMachine.eventCommit();
            TerminalBackendSixml.logger.exiting(TerminalBackendSixml.CLASS_NAME, "commitAsync");
        }
        connect() {
            TerminalBackendSixml.logger.entering(TerminalBackendSixml.CLASS_NAME, "connect");
            this.stateMachine.eventConnect();
            TerminalBackendSixml.logger.exiting(TerminalBackendSixml.CLASS_NAME, "connect");
        }
        disconnect() {
            TerminalBackendSixml.logger.entering(TerminalBackendSixml.CLASS_NAME, "disconnect");
            try {
                this.stateMachine.eventDisconnect();
            }
            catch (ignore) {
                console.log("exception ignore: $ignore");
            }
            TerminalBackendSixml.logger.exiting(TerminalBackendSixml.CLASS_NAME, "disconnect");
        }
        counterRequest(type) {
            TerminalBackendSixml.logger.entering(TerminalBackendSixml.CLASS_NAME, "counterRequest", type);
            if (!this.hasAdminFunction(timapi.constants.AdminFunctions.counterRequest)) {
                throw new timapi.TimException(timapi.constants.ResultCode.apiFunctionDisallowed);
            }
            if (this.hasRunningRequest()) {
                throw new timapi.TimException(timapi.constants.ResultCode.requestPending);
            }
            if (this.synchronousRequest == undefined) {
                throw new Error("this.synchronousRequest == undefined");
            }
            this.synchronousRequest.prepareWait(timapi.constants.RequestType.counterRequest);
            let request = new timapi.protocol.sixml.Request_CounterRequest();
            request.counterType = timapi.constants.CounterType.timApi2Protocol(type);
            this.stateMachine.$requestCounterRequest(request);
            this.$runningRequest = timapi.constants.RequestType.counterRequest;
            this.stateMachine.eventCounterRequest();
            this.synchronousRequest.waitForRequestCompleted();
            if (this.synchronousRequest.$lastException !== undefined) {
                throw this.synchronousRequest.$lastException;
            }
            TerminalBackendSixml.logger.exiting(TerminalBackendSixml.CLASS_NAME, "counterRequest");
            if (this.synchronousRequest.$lastCountersRequestResponse == undefined) {
                throw new Error("this.synchronousRequest.$lastCountersRequestResponse == undefined");
            }
            return this.synchronousRequest.$lastCountersRequestResponse;
        }
        counterRequestAsync(type) {
            TerminalBackendSixml.logger.entering(TerminalBackendSixml.CLASS_NAME, "counterRequestAsync", type);
            if (!this.hasAdminFunction(timapi.constants.AdminFunctions.counterRequest)) {
                throw new timapi.TimException(timapi.constants.ResultCode.apiFunctionDisallowed);
            }
            if (this.hasRunningRequest()) {
                throw new timapi.TimException(timapi.constants.ResultCode.requestPending);
            }
            let request = new timapi.protocol.sixml.Request_CounterRequest();
            request.counterType = timapi.constants.CounterType.timApi2Protocol(type);
            this.stateMachine.$requestCounterRequest(request);
            this.$runningRequest = timapi.constants.RequestType.counterRequest;
            this.stateMachine.eventCounterRequest();
            TerminalBackendSixml.logger.exiting(TerminalBackendSixml.CLASS_NAME, "counterRequestAsync");
        }
        deactivate() {
            TerminalBackendSixml.logger.entering(TerminalBackendSixml.CLASS_NAME, "deactivate");
            if (!this.hasAdminFunction(timapi.constants.AdminFunctions.deactivate)) {
                throw new timapi.TimException(timapi.constants.ResultCode.apiFunctionDisallowed);
            }
            if (this.hasRunningRequest()) {
                throw new timapi.TimException(timapi.constants.ResultCode.requestPending);
            }
            if (this.synchronousRequest !== undefined) {
                this.synchronousRequest.prepareWait(timapi.constants.RequestType.deactivate);
                this.$runningRequest = timapi.constants.RequestType.deactivate;
                this.stateMachine.eventDeactivate();
                this.synchronousRequest.waitForRequestCompleted();
                if (this.synchronousRequest.$lastException !== undefined) {
                    throw this.synchronousRequest.$lastException;
                }
                TerminalBackendSixml.logger.exiting(TerminalBackendSixml.CLASS_NAME, "deactivate");
                if (this.synchronousRequest.$lastDeactivateResponse == undefined) {
                    throw new Error("this.synchronousRequest.$lastDeactivateResponse == undefined");
                }
                return this.synchronousRequest.$lastDeactivateResponse;
            }
        }
        deactivateAsync() {
            TerminalBackendSixml.logger.entering(TerminalBackendSixml.CLASS_NAME, "deactivateAsync");
            if (!this.hasAdminFunction(timapi.constants.AdminFunctions.deactivate)) {
                throw new timapi.TimException(timapi.constants.ResultCode.apiFunctionDisallowed);
            }
            if (this.hasRunningRequest()) {
                throw new timapi.TimException(timapi.constants.ResultCode.requestPending);
            }
            this.$runningRequest = timapi.constants.RequestType.deactivate;
            this.stateMachine.eventDeactivate();
            TerminalBackendSixml.logger.exiting(TerminalBackendSixml.CLASS_NAME, "deactivateAsync");
        }
        dccRates() {
            TerminalBackendSixml.logger.entering(TerminalBackendSixml.CLASS_NAME, "dccRates");
            if (!this.hasAdminFunction(timapi.constants.AdminFunctions.dccRates)) {
                throw new timapi.TimException(timapi.constants.ResultCode.apiFunctionDisallowed);
            }
            if (this.hasRunningRequest()) {
                throw new timapi.TimException(timapi.constants.ResultCode.requestPending);
            }
            if (this.synchronousRequest == undefined) {
                throw new Error("this.synchronousRequest == undefined");
            }
            this.synchronousRequest.prepareWait(timapi.constants.RequestType.dccRates);
            this.$runningRequest = timapi.constants.RequestType.dccRates;
            this.stateMachine.eventDccRates();
            this.synchronousRequest.waitForRequestCompleted();
            if (this.synchronousRequest.$lastException !== undefined) {
                throw this.synchronousRequest.$lastException;
            }
            TerminalBackendSixml.logger.exiting(TerminalBackendSixml.CLASS_NAME, "dccRates");
            if (this.synchronousRequest.$lastDccRatesResponse == undefined) {
                throw new Error("this.synchronousRequest.$lastDccRatesResponse == undefined");
            }
            return this.synchronousRequest.$lastDccRatesResponse;
        }
        dccRatesAsync() {
            TerminalBackendSixml.logger.entering(TerminalBackendSixml.CLASS_NAME, "dccRatesAsync");
            if (!this.hasAdminFunction(timapi.constants.AdminFunctions.dccRates)) {
                throw new timapi.TimException(timapi.constants.ResultCode.apiFunctionDisallowed);
            }
            if (this.hasRunningRequest()) {
                throw new timapi.TimException(timapi.constants.ResultCode.requestPending);
            }
            this.$runningRequest = timapi.constants.RequestType.dccRates;
            this.stateMachine.eventDccRates();
            TerminalBackendSixml.logger.exiting(TerminalBackendSixml.CLASS_NAME, "dccRatesAsync");
        }
        hardwareInformation() {
            TerminalBackendSixml.logger.entering(TerminalBackendSixml.CLASS_NAME, "hardwareInformation");
            if (!this.hasStatusFunction(timapi.constants.StatusFunctions.hardwareInformation)) {
                throw new timapi.TimException(timapi.constants.ResultCode.apiFunctionDisallowed);
            }
            if (this.hasRunningRequest()) {
                throw new timapi.TimException(timapi.constants.ResultCode.requestPending);
            }
            if (this.synchronousRequest == undefined) {
                throw new Error("this.synchronousRequest == undefined");
            }
            this.synchronousRequest.prepareWait(timapi.constants.RequestType.hardwareInformation);
            this.$runningRequest = timapi.constants.RequestType.hardwareInformation;
            this.stateMachine.eventHardwareInformation();
            this.synchronousRequest.waitForRequestCompleted();
            if (this.synchronousRequest.$lastException !== undefined) {
                throw this.synchronousRequest.$lastException;
            }
            TerminalBackendSixml.logger.exiting(TerminalBackendSixml.CLASS_NAME, "hardwareInformation");
        }
        hardwareInformationAsync() {
            TerminalBackendSixml.logger.entering(TerminalBackendSixml.CLASS_NAME, "hardwareInformationAsync");
            if (!this.hasStatusFunction(timapi.constants.StatusFunctions.hardwareInformation)) {
                throw new timapi.TimException(timapi.constants.ResultCode.apiFunctionDisallowed);
            }
            if (this.hasRunningRequest()) {
                throw new timapi.TimException(timapi.constants.ResultCode.requestPending);
            }
            this.$runningRequest = timapi.constants.RequestType.hardwareInformation;
            this.stateMachine.eventHardwareInformation();
            TerminalBackendSixml.logger.exiting(TerminalBackendSixml.CLASS_NAME, "hardwareInformationAsync");
        }
        initTransaction(displayAmount, amount) {
            TerminalBackendSixml.logger.entering(TerminalBackendSixml.CLASS_NAME, "initTransaction", [displayAmount, amount]);
            if (!this.hasNonFinancialFunction(timapi.constants.NonFinancialTransactions.initTransaction)) {
                throw new timapi.TimException(timapi.constants.ResultCode.apiFunctionDisallowed);
            }
            if (this.hasRunningRequest()) {
                throw new timapi.TimException(timapi.constants.ResultCode.requestPending);
            }
            if (this.synchronousRequest == undefined) {
                throw new Error("this.synchronousRequest == undefined");
            }
            this.synchronousRequest.prepareWait(timapi.constants.RequestType.initTransaction);
            let request = new timapi.protocol.sixml.Request_InitTransaction();
            request.displayAmountFlag = displayAmount;
            request.amount = timapi.statemachine.sixml.ConvertSIXml2TimApi.convertAmountOrNull(amount);
            this.stateMachine.$requestInitTransaction(request);
            this.$runningRequest = timapi.constants.RequestType.initTransaction;
            this.stateMachine.eventInitTransaction();
            this.synchronousRequest.waitForRequestCompleted();
            if (this.synchronousRequest.$lastException !== undefined) {
                throw this.synchronousRequest.$lastException;
            }
            let result = this.synchronousRequest.$lastInitTransactionResponse;
            TerminalBackendSixml.logger.exiting(TerminalBackendSixml.CLASS_NAME, "initTransaction", [result]);
            if (result == undefined) {
                throw new Error("result == undefined");
            }
            return result;
        }
        initTransactionAsync(displayAmount, amount) {
            TerminalBackendSixml.logger.entering(TerminalBackendSixml.CLASS_NAME, "initTransactionAsync");
            if (!this.hasNonFinancialFunction(timapi.constants.NonFinancialTransactions.initTransaction)) {
                throw new timapi.TimException(timapi.constants.ResultCode.apiFunctionDisallowed);
            }
            if (this.hasRunningRequest()) {
                throw new timapi.TimException(timapi.constants.ResultCode.requestPending);
            }
            let request = new timapi.protocol.sixml.Request_InitTransaction();
            request.displayAmountFlag = displayAmount;
            request.amount = timapi.statemachine.sixml.ConvertSIXml2TimApi.convertAmountOrNull(amount);
            this.stateMachine.$requestInitTransaction(request);
            this.$runningRequest = timapi.constants.RequestType.initTransaction;
            this.stateMachine.eventInitTransaction();
            TerminalBackendSixml.logger.exiting(TerminalBackendSixml.CLASS_NAME, "initTransactionAsync");
        }
        login() {
            TerminalBackendSixml.logger.entering(TerminalBackendSixml.CLASS_NAME, "login");
            if (!this.hasAdminFunction(timapi.constants.AdminFunctions.login)) {
                throw new timapi.TimException(timapi.constants.ResultCode.apiFunctionDisallowed);
            }
            if (this.hasRunningRequest()) {
                throw new timapi.TimException(timapi.constants.ResultCode.requestPending);
            }
            if (this.synchronousRequest == undefined) {
                throw new Error("this.synchronousRequest == undefined");
            }
            this.synchronousRequest.prepareWait(timapi.constants.RequestType.login);
            this.stateMachine.$requestLogin = timapi.statemachine.sixml.ConvertTimApi2SIXml.createLoginRequest(this.$terminal);
            this.$runningRequest = timapi.constants.RequestType.login;
            this.stateMachine.eventLogin();
            this.synchronousRequest.waitForRequestCompleted();
            if (this.synchronousRequest.$lastException !== undefined) {
                throw this.synchronousRequest.$lastException;
            }
            TerminalBackendSixml.logger.exiting(TerminalBackendSixml.CLASS_NAME, "login");
        }
        loginAsync() {
            TerminalBackendSixml.logger.entering(TerminalBackendSixml.CLASS_NAME, "loginAsync");
            if (!this.hasAdminFunction(timapi.constants.AdminFunctions.login)) {
                throw new timapi.TimException(timapi.constants.ResultCode.apiFunctionDisallowed);
            }
            if (this.hasRunningRequest()) {
                throw new timapi.TimException(timapi.constants.ResultCode.requestPending);
            }
            this.stateMachine.$requestLogin =
                timapi.statemachine.sixml.ConvertTimApi2SIXml.createLoginRequest(this.$terminal);
            this.$runningRequest = timapi.constants.RequestType.login;
            this.stateMachine.eventLogin();
            TerminalBackendSixml.logger.exiting(TerminalBackendSixml.CLASS_NAME, "loginAsync");
        }
        logout() {
            TerminalBackendSixml.logger.entering(TerminalBackendSixml.CLASS_NAME, "logout");
            if (!this.hasAdminFunction(timapi.constants.AdminFunctions.logout)) {
                throw new timapi.TimException(timapi.constants.ResultCode.apiFunctionDisallowed);
            }
            if (this.hasRunningRequest()) {
                throw new timapi.TimException(timapi.constants.ResultCode.requestPending);
            }
            if (this.synchronousRequest == undefined) {
                throw new Error("this.synchronousRequest == undefined");
            }
            this.synchronousRequest.prepareWait(timapi.constants.RequestType.logout);
            this.$runningRequest = timapi.constants.RequestType.logout;
            this.stateMachine.eventLogout();
            this.synchronousRequest.waitForRequestCompleted();
            if (this.synchronousRequest.$lastException !== undefined) {
                throw this.synchronousRequest.$lastException;
            }
            TerminalBackendSixml.logger.exiting(TerminalBackendSixml.CLASS_NAME, "logout");
        }
        logoutAsync() {
            TerminalBackendSixml.logger.entering(TerminalBackendSixml.CLASS_NAME, "logoutAsync");
            if (!this.hasAdminFunction(timapi.constants.AdminFunctions.logout)) {
                throw new timapi.TimException(timapi.constants.ResultCode.apiFunctionDisallowed);
            }
            if (this.hasRunningRequest()) {
                throw new timapi.TimException(timapi.constants.ResultCode.requestPending);
            }
            this.$runningRequest = timapi.constants.RequestType.logout;
            this.stateMachine.eventLogout();
            TerminalBackendSixml.logger.exiting(TerminalBackendSixml.CLASS_NAME, "logoutAsync");
        }
        reboot() {
            TerminalBackendSixml.logger.entering(TerminalBackendSixml.CLASS_NAME, "reboot");
            if (!this.hasAdminFunction(timapi.constants.AdminFunctions.reboot)) {
                throw new timapi.TimException(timapi.constants.ResultCode.apiFunctionDisallowed);
            }
            if (this.hasRunningRequest()) {
                throw new timapi.TimException(timapi.constants.ResultCode.requestPending);
            }
            if (this.synchronousRequest == undefined) {
                throw new Error("this.synchronousRequest == undefined");
            }
            this.synchronousRequest.prepareWait(timapi.constants.RequestType.reboot);
            this.$runningRequest = timapi.constants.RequestType.reboot;
            this.stateMachine.eventReboot();
            this.synchronousRequest.waitForRequestCompleted();
            if (this.synchronousRequest.$lastException !== undefined) {
                throw this.synchronousRequest.$lastException;
            }
            TerminalBackendSixml.logger.exiting(TerminalBackendSixml.CLASS_NAME, "reboot");
        }
        rebootAsync() {
            TerminalBackendSixml.logger.entering(TerminalBackendSixml.CLASS_NAME, "rebootAsync");
            if (!this.hasAdminFunction(timapi.constants.AdminFunctions.reboot)) {
                throw new timapi.TimException(timapi.constants.ResultCode.apiFunctionDisallowed);
            }
            if (this.hasRunningRequest()) {
                throw new timapi.TimException(timapi.constants.ResultCode.requestPending);
            }
            this.$runningRequest = timapi.constants.RequestType.reboot;
            this.stateMachine.eventReboot();
            TerminalBackendSixml.logger.exiting(TerminalBackendSixml.CLASS_NAME, "rebootAsync");
        }
        reconciliation() {
            TerminalBackendSixml.logger.entering(TerminalBackendSixml.CLASS_NAME, "reconciliation");
            if (!this.hasAdminFunction(timapi.constants.AdminFunctions.reconciliation)) {
                throw new timapi.TimException(timapi.constants.ResultCode.apiFunctionDisallowed);
            }
            if (this.hasRunningRequest()) {
                throw new timapi.TimException(timapi.constants.ResultCode.requestPending);
            }
            if (this.synchronousRequest == undefined ||
                this.synchronousRequest == undefined) {
                throw new Error("this.synchronousRequest == undefined || this.synchronousRequest == undefined");
            }
            this.synchronousRequest.prepareWait(timapi.constants.RequestType.reconciliation);
            this.$runningRequest = timapi.constants.RequestType.reconciliation;
            this.stateMachine.eventReconciliation();
            this.synchronousRequest.waitForRequestCompleted();
            if (this.synchronousRequest.$lastException !== undefined) {
                throw this.synchronousRequest.$lastException;
            }
            TerminalBackendSixml.logger.exiting(TerminalBackendSixml.CLASS_NAME, "reconciliation");
            if (this.synchronousRequest.$lastReconciliationResponse == undefined ||
                this.synchronousRequest.$lastReconciliationResponse == undefined) {
                throw new Error("this.synchronousRequest.$lastReconciliationResponse == undefined || this.synchronousRequest.$lastReconciliationResponse == undefined");
            }
            return this.synchronousRequest.$lastReconciliationResponse;
        }
        reconciliationAsync() {
            TerminalBackendSixml.logger.entering(TerminalBackendSixml.CLASS_NAME, "reconciliationAsync");
            if (!this.hasAdminFunction(timapi.constants.AdminFunctions.reconciliation)) {
                throw new timapi.TimException(timapi.constants.ResultCode.apiFunctionDisallowed);
            }
            if (this.hasRunningRequest()) {
                throw new timapi.TimException(timapi.constants.ResultCode.requestPending);
            }
            this.$runningRequest = timapi.constants.RequestType.reconciliation;
            this.stateMachine.eventReconciliation();
            TerminalBackendSixml.logger.exiting(TerminalBackendSixml.CLASS_NAME, "reconciliationAsync");
        }
        receiptRequest(receiptType) {
            TerminalBackendSixml.logger.entering(TerminalBackendSixml.CLASS_NAME, "receiptRequest", [receiptType]);
            if (!this.hasAdminFunction(timapi.constants.AdminFunctions.receiptRequest)) {
                throw new timapi.TimException(timapi.constants.ResultCode.apiFunctionDisallowed);
            }
            if (this.hasRunningRequest()) {
                throw new timapi.TimException(timapi.constants.ResultCode.requestPending);
            }
            if (this.synchronousRequest == undefined) {
                TerminalBackendSixml.logger.log(timapi.logging.Level.INFO, "synchronousRequest is undefined or null");
                return undefined;
            }
            this.synchronousRequest.prepareWait(timapi.constants.RequestType.receiptRequest);
            let request = new timapi.protocol.sixml.Request_ReceiptRequest();
            request.receiptRequestType = timapi.constants.ReceiptRequestType.timApi2Protocol(receiptType);
            this.stateMachine.$requestReceiptRequest = request;
            this.$runningRequest = timapi.constants.RequestType.receiptRequest;
            this.stateMachine.eventReceiptRequest();
            this.synchronousRequest.waitForRequestCompleted();
            if (this.synchronousRequest.$lastException !== undefined) {
                throw this.synchronousRequest.$lastException;
            }
            TerminalBackendSixml.logger.exiting(TerminalBackendSixml.CLASS_NAME, "receiptRequest");
            return this.synchronousRequest.$lastReceiptRequestResponse;
        }
        receiptRequestAsync(receiptType) {
            TerminalBackendSixml.logger.entering(TerminalBackendSixml.CLASS_NAME, "receiptRequestAsync", [receiptType]);
            if (!this.hasAdminFunction(timapi.constants.AdminFunctions.receiptRequest)) {
                throw new timapi.TimException(timapi.constants.ResultCode.apiFunctionDisallowed);
            }
            if (this.hasRunningRequest()) {
                throw new timapi.TimException(timapi.constants.ResultCode.requestPending);
            }
            let request = new timapi.protocol.sixml.Request_ReceiptRequest();
            request.receiptRequestType = timapi.constants.ReceiptRequestType.timApi2Protocol(receiptType);
            this.stateMachine.$requestReceiptRequest = request;
            this.$runningRequest = timapi.constants.RequestType.receiptRequest;
            this.stateMachine.eventReceiptRequest();
            TerminalBackendSixml.logger.exiting(TerminalBackendSixml.CLASS_NAME, "receiptRequestAsync");
        }
        reconfig() {
            TerminalBackendSixml.logger.entering(TerminalBackendSixml.CLASS_NAME, "reconfig");
            if (!this.hasAdminFunction(timapi.constants.AdminFunctions.reconfig)) {
                throw new timapi.TimException(timapi.constants.ResultCode.apiFunctionDisallowed);
            }
            if (this.hasRunningRequest()) {
                throw new timapi.TimException(timapi.constants.ResultCode.requestPending);
            }
            if (this.synchronousRequest == undefined) {
                TerminalBackendSixml.logger.log(timapi.logging.Level.INFO, "synchronousRequest is undefined or null");
                return undefined;
            }
            this.synchronousRequest.prepareWait(timapi.constants.RequestType.reconfig);
            this.$runningRequest = timapi.constants.RequestType.reconfig;
            this.stateMachine.eventReconfig();
            this.synchronousRequest.waitForRequestCompleted();
            if (this.synchronousRequest.$lastException !== undefined) {
                throw this.synchronousRequest.$lastException;
            }
            TerminalBackendSixml.logger.exiting(TerminalBackendSixml.CLASS_NAME, "reconfig");
            return this.synchronousRequest.$lastReconfigResponse;
        }
        reconfigAsync() {
            TerminalBackendSixml.logger.entering(TerminalBackendSixml.CLASS_NAME, "reconfigAsync");
            if (!this.hasAdminFunction(timapi.constants.AdminFunctions.reconfig)) {
                throw new timapi.TimException(timapi.constants.ResultCode.apiFunctionDisallowed);
            }
            if (this.hasRunningRequest()) {
                throw new timapi.TimException(timapi.constants.ResultCode.requestPending);
            }
            this.$runningRequest = timapi.constants.RequestType.reconfig;
            this.stateMachine.eventReconfig();
            TerminalBackendSixml.logger.exiting(TerminalBackendSixml.CLASS_NAME, "reconfigAsync");
        }
        rollback() {
            TerminalBackendSixml.logger.entering(TerminalBackendSixml.CLASS_NAME, "rollback");
            if (!this.hasFinancialFunction(timapi.constants.FinancialTransactions.rollback)) {
                throw new timapi.TimException(timapi.constants.ResultCode.apiFunctionDisallowed);
            }
            if (this.hasRunningRequest()) {
                throw new timapi.TimException(timapi.constants.ResultCode.requestPending);
            }
            if (this.synchronousRequest == undefined) {
                TerminalBackendSixml.logger.log(timapi.logging.Level.INFO, "synchronousRequest is undefined or null");
                return undefined;
            }
            this.synchronousRequest.prepareWait(timapi.constants.RequestType.rollback);
            this.$runningRequest = timapi.constants.RequestType.rollback;
            this.stateMachine.eventRollback();
            this.synchronousRequest.waitForRequestCompleted();
            if (this.synchronousRequest.$lastException !== undefined) {
                throw this.synchronousRequest.$lastException;
            }
            TerminalBackendSixml.logger.exiting(TerminalBackendSixml.CLASS_NAME, "rollback");
            return this.synchronousRequest.$lastRollbackResponse;
        }
        rollbackAsync() {
            TerminalBackendSixml.logger.entering(TerminalBackendSixml.CLASS_NAME, "rollbackAsync");
            if (!this.hasFinancialFunction(timapi.constants.FinancialTransactions.rollback)) {
                throw new timapi.TimException(timapi.constants.ResultCode.apiFunctionDisallowed);
            }
            if (this.hasRunningRequest()) {
                throw new timapi.TimException(timapi.constants.ResultCode.requestPending);
            }
            this.$runningRequest = timapi.constants.RequestType.rollback;
            this.stateMachine.eventRollback();
            TerminalBackendSixml.logger.exiting(TerminalBackendSixml.CLASS_NAME, "rollbackAsync");
        }
        softwareUpdate() {
            TerminalBackendSixml.logger.entering(TerminalBackendSixml.CLASS_NAME, "softwareUpdate");
            if (!this.hasAdminFunction(timapi.constants.AdminFunctions.softwareUpdate)) {
                throw new timapi.TimException(timapi.constants.ResultCode.apiFunctionDisallowed);
            }
            if (this.hasRunningRequest()) {
                throw new timapi.TimException(timapi.constants.ResultCode.requestPending);
            }
            if (this.synchronousRequest == undefined) {
                TerminalBackendSixml.logger.log(timapi.logging.Level.INFO, "synchronousRequest is undefined or null");
                return undefined;
            }
            this.synchronousRequest.prepareWait(timapi.constants.RequestType.softwareInformation);
            this.$runningRequest = timapi.constants.RequestType.softwareUpdate;
            this.stateMachine.eventSoftwareUpdate();
            this.synchronousRequest.waitForRequestCompleted();
            if (this.synchronousRequest.$lastException !== undefined) {
                throw this.synchronousRequest.$lastException;
            }
            TerminalBackendSixml.logger.exiting(TerminalBackendSixml.CLASS_NAME, "softwareUpdate");
            return this.synchronousRequest.$lastSoftwareUpdateResponse;
        }
        softwareUpdateAsync() {
            TerminalBackendSixml.logger.entering(TerminalBackendSixml.CLASS_NAME, "softwareUpdateAsync");
            if (!this.hasAdminFunction(timapi.constants.AdminFunctions.softwareUpdate)) {
                throw new timapi.TimException(timapi.constants.ResultCode.apiFunctionDisallowed);
            }
            if (this.hasRunningRequest()) {
                throw new timapi.TimException(timapi.constants.ResultCode.requestPending);
            }
            this.$runningRequest = timapi.constants.RequestType.softwareUpdate;
            this.stateMachine.eventSoftwareUpdate();
            TerminalBackendSixml.logger.exiting(TerminalBackendSixml.CLASS_NAME, "softwareUpdateAsync");
        }
        systemInformation() {
            TerminalBackendSixml.logger.entering(TerminalBackendSixml.CLASS_NAME, "systemInformation");
            if (!this.hasStatusFunction(timapi.constants.StatusFunctions.systemInformation)) {
                throw new timapi.TimException(timapi.constants.ResultCode.apiFunctionDisallowed);
            }
            if (this.hasRunningRequest()) {
                throw new timapi.TimException(timapi.constants.ResultCode.requestPending);
            }
            if (this.synchronousRequest == undefined) {
                TerminalBackendSixml.logger.log(timapi.logging.Level.INFO, "synchronousRequest is undefined or null");
                return undefined;
            }
            this.synchronousRequest.prepareWait(timapi.constants.RequestType.systemInformation);
            this.$runningRequest = timapi.constants.RequestType.systemInformation;
            this.stateMachine.eventSystemInformation();
            this.synchronousRequest.waitForRequestCompleted();
            if (this.synchronousRequest.$lastException !== undefined) {
                throw this.synchronousRequest.$lastException;
            }
            TerminalBackendSixml.logger.exiting(TerminalBackendSixml.CLASS_NAME, "systemInformation");
            return this.synchronousRequest.$lastSystemInformationResponse;
        }
        systemInformationAsync() {
            TerminalBackendSixml.logger.entering(TerminalBackendSixml.CLASS_NAME, "systemInformationAsync");
            if (!this.hasStatusFunction(timapi.constants.StatusFunctions.systemInformation)) {
                throw new timapi.TimException(timapi.constants.ResultCode.apiFunctionDisallowed);
            }
            if (this.hasRunningRequest()) {
                throw new timapi.TimException(timapi.constants.ResultCode.requestPending);
            }
            this.$runningRequest = timapi.constants.RequestType.systemInformation;
            this.stateMachine.eventSystemInformation();
            TerminalBackendSixml.logger.exiting(TerminalBackendSixml.CLASS_NAME, "systemInformationAsync");
        }
        transaction(type, amountOrTransactionRequest) {
            if (amountOrTransactionRequest instanceof timapi.Amount) {
                return this.transactionWithAmount(type, amountOrTransactionRequest);
            }
            else {
                return this.transactionWithTransactionRequest(type.amountOrTransactionRequest);
            }
        }
        transactionWithAmount(type, amount) {
            if (TerminalBackendSixml.logger.isLoggable(timapi.logging.Level.FINEST)) {
                TerminalBackendSixml.logger.entering(TerminalBackendSixml.CLASS_NAME, "transaction(TransactionType,Amount)", [type, amount]);
            }
            else {
                TerminalBackendSixml.logger.entering(TerminalBackendSixml.CLASS_NAME, "transaction(TransactionType,Amount)");
            }
            if (this.hasRunningRequest()) {
                throw new timapi.TimException(timapi.constants.ResultCode.requestPending);
            }
            this.failTransactionType = type;
            this.checkTransactionTypeAllowed(type);
            this.synchronousRequest.prepareWait(timapi.constants.RequestType.transaction);
            let terminal = this.$terminal;
            let request = new timapi.TransactionRequest();
            request.$amount = amount;
            if (terminal.$merchantOptions != undefined && terminal.$merchantOptions.length > 0) {
                request.$merchantOptions = new Array(terminal.$merchantOptions);
            }
            request.$userId = terminal.$userId;
            request.$transactionData = terminal.$transactionData;
            this.stateMachine.$requestTransaction =
                timapi.statemachine.sixml.ConvertTimApi2SIXml.convertTransactionRequest(this.$terminal, request, type, this.$terminal.$settings.$guides);
            this.$runningRequest = timapi.constants.RequestType.transaction;
            this.stateMachine.eventTransaction();
            if (this.synchronousRequest == undefined) {
                TerminalBackendSixml.logger.log(timapi.logging.Level.INFO, "synchronousRequest is undefined or null");
                return undefined;
            }
            this.synchronousRequest.waitForRequestCompleted();
            if (this.synchronousRequest.$lastException !== undefined) {
                throw this.synchronousRequest.$lastException;
            }
            TerminalBackendSixml.logger.exiting(TerminalBackendSixml.CLASS_NAME, "transaction(TransactionType,Amount)");
            return this.synchronousRequest.$lastTransactionResponse;
        }
        transactionWithTransactionRequest(type, request) {
            if (TerminalBackendSixml.logger.isLoggable(timapi.logging.Level.FINEST)) {
                TerminalBackendSixml.logger.entering(TerminalBackendSixml.CLASS_NAME, "transaction(TransactionType,TransactionRequest)", [type, request]);
            }
            else {
                TerminalBackendSixml.logger.entering(TerminalBackendSixml.CLASS_NAME, "transaction(TransactionType,TransactionRequest)");
            }
            if (this.hasRunningRequest()) {
                throw new timapi.TimException(timapi.constants.ResultCode.requestPending);
            }
            this.failTransactionType = type;
            this.checkTransactionTypeAllowed(type);
            if (this.synchronousRequest == undefined) {
                TerminalBackendSixml.logger.log(timapi.logging.Level.INFO, "synchronousRequest is undefined or null");
                return undefined;
            }
            this.synchronousRequest.prepareWait(timapi.constants.RequestType.transaction);
            this.stateMachine.$requestTransaction =
                timapi.statemachine.sixml.ConvertTimApi2SIXml.convertTransactionRequest(this.$terminal, request, type, this.$terminal.$settings.$guides);
            this.$runningRequest = timapi.constants.RequestType.transaction;
            this.stateMachine.eventTransaction();
            if (this.synchronousRequest == undefined) {
                TerminalBackendSixml.logger.log(timapi.logging.Level.INFO, "synchronousRequest is undefined or null");
                return undefined;
            }
            this.synchronousRequest.waitForRequestCompleted();
            if (this.synchronousRequest.$lastException !== undefined) {
                throw this.synchronousRequest.$lastException;
            }
            TerminalBackendSixml.logger.exiting(TerminalBackendSixml.CLASS_NAME, "transaction(TransactionType,TransactionRequest)");
            return this.synchronousRequest.$lastTransactionResponse;
        }
        transactionAsync(type, amountOrTransactionRequest) {
            if (amountOrTransactionRequest instanceof timapi.Amount) {
                this.transactionAsyncWithAmount(type, amountOrTransactionRequest);
            }
            else if (amountOrTransactionRequest instanceof timapi.TransactionRequest) {
                this.transactionWithTransactionRequest(type, amountOrTransactionRequest);
            }
        }
        transactionAsyncWithAmount(type, amount) {
            if (TerminalBackendSixml.logger.isLoggable(timapi.logging.Level.FINEST)) {
                TerminalBackendSixml.logger.entering(TerminalBackendSixml.CLASS_NAME, "transactionAsync(TransactionType,Amount)", [type, amount]);
            }
            else {
                TerminalBackendSixml.logger.entering(TerminalBackendSixml.CLASS_NAME, "transactionAsync(TransactionType,Amount)");
            }
            if (this.hasRunningRequest()) {
                throw new timapi.TimException(timapi.constants.ResultCode.requestPending);
            }
            this.failTransactionType = type;
            this.checkTransactionTypeAllowed(type);
            let terminal = this.$terminal;
            let request = new timapi.TransactionRequest();
            request.$amount = amount;
            if (terminal.$merchantOptions != undefined && terminal.$merchantOptions.length > 0) {
                request.$merchantOptions = new Array(terminal.$merchantOptions);
            }
            request.$userId = terminal.$userId;
            request.$transactionData = terminal.$transactionData;
            this.stateMachine.$requestTransaction =
                timapi.statemachine.sixml.ConvertTimApi2SIXml.convertTransactionRequest(this.$terminal, request, type, this.$terminal.$settings.$guides);
            this.$runningRequest = timapi.constants.RequestType.transaction;
            this.stateMachine.eventTransaction();
            TerminalBackendSixml.logger.exiting(TerminalBackendSixml.CLASS_NAME, "transactionAsync(TransactionType,Amount)");
        }
        transactionAsyncWithTransactionRequest(type, request) {
            if (TerminalBackendSixml.logger.isLoggable(timapi.logging.Level.FINEST)) {
                TerminalBackendSixml.logger.entering(TerminalBackendSixml.CLASS_NAME, "transactionAsync(TransactionType,TransactionRequest)", [type, request]);
            }
            else {
                TerminalBackendSixml.logger.entering(TerminalBackendSixml.CLASS_NAME, "transactionAsync(TransactionType,TransactionRequest)");
            }
            if (this.hasRunningRequest()) {
                throw new timapi.TimException(timapi.constants.ResultCode.requestPending);
            }
            this.failTransactionType = type;
            this.checkTransactionTypeAllowed(type);
            this.stateMachine.$requestTransaction =
                timapi.statemachine.sixml.ConvertTimApi2SIXml.convertTransactionRequest(this.$terminal, request, type, this.$terminal.$settings.$guides);
            this.$runningRequest = timapi.constants.RequestType.transaction;
            this.stateMachine.eventTransaction();
            TerminalBackendSixml.logger.exiting(TerminalBackendSixml.CLASS_NAME, "transactionAsync(TransactionType,TransactionRequest)");
        }
        transactionTip(type, amount, tipAmount) {
            if (TerminalBackendSixml.logger.isLoggable(timapi.logging.Level.FINEST)) {
                TerminalBackendSixml.logger.entering(TerminalBackendSixml.CLASS_NAME, "transactionTip(TransactionType,Amount,Amount)", [type, amount, tipAmount]);
            }
            else {
                TerminalBackendSixml.logger.entering(TerminalBackendSixml.CLASS_NAME, "transactionTip(TransactionType,Amount,Amount)");
            }
            if (!this.hasGuide(timapi.constants.Guides.gastro)) {
                throw new timapi.TimException(timapi.constants.ResultCode.apiFunctionDisallowed);
            }
            if (this.hasRunningRequest()) {
                throw new timapi.TimException(timapi.constants.ResultCode.requestPending);
            }
            this.failTransactionType = type;
            this.checkTransactionTypeAllowed(type);
            if (this.synchronousRequest == undefined) {
                TerminalBackendSixml.logger.log(timapi.logging.Level.INFO, "synchronousRequest is undefined or null");
                return undefined;
            }
            this.synchronousRequest.prepareWait(timapi.constants.RequestType.transaction);
            let terminal = this.$terminal;
            let request = new timapi.TransactionRequest();
            request.$amount = amount;
            request.$tipAmount = tipAmount;
            if (terminal.$merchantOptions != undefined && terminal.$merchantOptions.length > 0) {
                request.$merchantOptions = new Array(terminal.$merchantOptions);
            }
            request.$userId = terminal.$userId;
            request.$transactionData = terminal.$transactionData;
            this.stateMachine.$requestTransaction =
                timapi.statemachine.sixml.ConvertTimApi2SIXml.convertTransactionRequest(this.$terminal, request, type, this.$terminal.$settings.$guides);
            this.$runningRequest = timapi.constants.RequestType.transaction;
            this.stateMachine.eventTransaction();
            this.synchronousRequest.waitForRequestCompleted();
            if (this.synchronousRequest.$lastException !== undefined) {
                throw this.synchronousRequest.$lastException;
            }
            TerminalBackendSixml.logger.exiting(TerminalBackendSixml.CLASS_NAME, "transactionTip(TransactionType,Amount,Amount)");
            return this.synchronousRequest.$lastTransactionResponse;
        }
        transactionTipAsync(type, amount, tipAmount) {
            if (TerminalBackendSixml.logger.isLoggable(timapi.logging.Level.FINEST)) {
                TerminalBackendSixml.logger.entering(TerminalBackendSixml.CLASS_NAME, "transactionTipAsync(TransactionType,Amount,Amount)", [type, amount]);
            }
            else {
                TerminalBackendSixml.logger.entering(TerminalBackendSixml.CLASS_NAME, "transactionTipAsync(TransactionType,Amount,Amount)");
            }
            if (!this.hasGuide(timapi.constants.Guides.gastro)) {
                throw new timapi.TimException(timapi.constants.ResultCode.apiFunctionDisallowed);
            }
            if (this.hasRunningRequest()) {
                throw new timapi.TimException(timapi.constants.ResultCode.requestPending);
            }
            this.failTransactionType = type;
            this.checkTransactionTypeAllowed(type);
            let terminal = this.$terminal;
            let request = new timapi.TransactionRequest();
            request.$amount = amount;
            request.$tipAmount = tipAmount;
            if (terminal.$merchantOptions != undefined && terminal.$merchantOptions.length > 0) {
                request.$merchantOptions = new Array(terminal.$merchantOptions);
            }
            request.$userId = terminal.$userId;
            request.$transactionData = terminal.$transactionData;
            this.stateMachine.$requestTransaction =
                timapi.statemachine.sixml.ConvertTimApi2SIXml.convertTransactionRequest(this.$terminal, request, type, this.$terminal.$settings.$guides);
            this.$runningRequest = timapi.constants.RequestType.transaction;
            this.stateMachine.eventTransaction();
            TerminalBackendSixml.logger.exiting(TerminalBackendSixml.CLASS_NAME, "transactionTipAsync(TransactionType,Amount,Amount)");
        }
        transactionCashback(type, amount, amountOther) {
            TerminalBackendSixml.logger.entering(TerminalBackendSixml.CLASS_NAME, "transactionCashback(TransactionType,Amount,Amount)", [type, amount, amountOther]);
            if (!this.hasGuide(timapi.constants.Guides.advancedRetail)) {
                throw new timapi.TimException(timapi.constants.ResultCode.apiFunctionDisallowed);
            }
            if (this.hasRunningRequest()) {
                throw new timapi.TimException(timapi.constants.ResultCode.requestPending);
            }
            this.failTransactionType = type;
            this.checkTransactionTypeAllowed(type);
            if (this.synchronousRequest == undefined) {
                TerminalBackendSixml.logger.log(timapi.logging.Level.INFO, "synchronousRequest is undefined or null");
                return undefined;
            }
            this.synchronousRequest.prepareWait(timapi.constants.RequestType.transaction);
            let terminal = this.$terminal;
            let request = new timapi.TransactionRequest();
            request.$amount = amount;
            request.$amountOther = amountOther;
            if (terminal.$merchantOptions.lenngth > 0) {
                request.$merchantOptions = new Array(terminal.$merchantOptions);
            }
            request.$userId = terminal.$userId;
            request.$transactionData = terminal.$transactionData;
            this.stateMachine.$requestTransaction =
                timapi.statemachine.sixml.ConvertTimApi2SIXml.convertTransactionRequest(this.$terminal, request, type, this.$terminal.$settings.$guides);
            this.$runningRequest = timapi.constants.RequestType.transaction;
            this.stateMachine.eventTransaction();
            if (this.synchronousRequest == undefined) {
                TerminalBackendSixml.logger.log(timapi.logging.Level.INFO, "synchronousRequest is undefined or null");
                return undefined;
            }
            this.synchronousRequest.waitForRequestCompleted();
            if (this.synchronousRequest.$lastException !== undefined) {
                throw this.synchronousRequest.$lastException;
            }
            TerminalBackendSixml.logger.exiting(TerminalBackendSixml.CLASS_NAME, "transactionCashback(TransactionType,Amount,Amount)");
            return this.synchronousRequest.$lastTransactionResponse;
        }
        transactionCashbackAsync(type, amount, amountOther) {
            TerminalBackendSixml.logger.entering(TerminalBackendSixml.CLASS_NAME, "transactionCashbackAsync(TransactionType,Amount,Amount)", [type, amount, amountOther]);
            if (!this.hasGuide(timapi.constants.Guides.advancedRetail)) {
                throw new timapi.TimException(timapi.constants.ResultCode.apiFunctionDisallowed);
            }
            if (this.hasRunningRequest()) {
                throw new timapi.TimException(timapi.constants.ResultCode.requestPending);
            }
            this.failTransactionType = type;
            this.checkTransactionTypeAllowed(type);
            let terminal = this.$terminal;
            let request = new timapi.TransactionRequest();
            request.$amount = amount;
            request.$amountOther = amountOther;
            if (terminal.$merchantOptions != undefined && terminal.$merchantOptions.length > 0) {
                request.$merchantOptions = new Array(terminal.$merchantOptions);
            }
            request.$userId = terminal.$userId;
            request.$transactionData = terminal.$transactionData;
            this.stateMachine.$requestTransaction =
                timapi.statemachine.sixml.ConvertTimApi2SIXml.convertTransactionRequest(this.$terminal, request, type, this.$terminal.$settings.$guides);
            this.$runningRequest = timapi.constants.RequestType.transaction;
            this.stateMachine.eventTransaction();
            TerminalBackendSixml.logger.exiting(TerminalBackendSixml.CLASS_NAME, "transactionCashbackAsync(TransactionType,Amount,Amount)");
        }
        closeReader() {
            TerminalBackendSixml.logger.entering(TerminalBackendSixml.CLASS_NAME, "closeReader");
            if (!this.hasGuide(timapi.constants.Guides.unattended)) {
                throw new timapi.TimException(timapi.constants.ResultCode.apiFunctionDisallowed);
            }
            if (!this.hasAdminFunction(timapi.constants.AdminFunctions.closeReader)) {
                throw new timapi.TimException(timapi.constants.ResultCode.apiFunctionDisallowed);
            }
            if (this.hasRunningRequest()) {
                throw new timapi.TimException(timapi.constants.ResultCode.requestPending);
            }
            if (this.synchronousRequest == undefined) {
                TerminalBackendSixml.logger.log(timapi.logging.Level.INFO, "synchronousRequest is undefined or null");
                return;
            }
            this.synchronousRequest.prepareWait(timapi.constants.RequestType.closeReader);
            this.$runningRequest = timapi.constants.RequestType.closeReader;
            this.stateMachine.eventCloseReader();
            this.synchronousRequest.waitForRequestCompleted();
            if (this.synchronousRequest.$lastException !== undefined) {
                throw this.synchronousRequest.$lastException;
            }
            TerminalBackendSixml.logger.exiting(TerminalBackendSixml.CLASS_NAME, "closeReader");
        }
        closeReaderAsync() {
            TerminalBackendSixml.logger.entering(TerminalBackendSixml.CLASS_NAME, "closeReaderAsync");
            if (!this.hasGuide(timapi.constants.Guides.unattended)) {
                throw new timapi.TimException(timapi.constants.ResultCode.apiFunctionDisallowed);
            }
            if (!this.hasAdminFunction(timapi.constants.AdminFunctions.closeReader)) {
                throw new timapi.TimException(timapi.constants.ResultCode.apiFunctionDisallowed);
            }
            if (this.hasRunningRequest()) {
                throw new timapi.TimException(timapi.constants.ResultCode.requestPending);
            }
            this.$runningRequest = timapi.constants.RequestType.closeReader;
            this.stateMachine.eventCloseReader();
            TerminalBackendSixml.logger.exiting(TerminalBackendSixml.CLASS_NAME, "closeReaderAsync");
        }
        openReader() {
            TerminalBackendSixml.logger.entering(TerminalBackendSixml.CLASS_NAME, "openReader");
            if (!this.hasGuide(timapi.constants.Guides.unattended)) {
                throw new timapi.TimException(timapi.constants.ResultCode.apiFunctionDisallowed);
            }
            if (!this.hasAdminFunction(timapi.constants.AdminFunctions.openReader)) {
                throw new timapi.TimException(timapi.constants.ResultCode.apiFunctionDisallowed);
            }
            if (this.hasRunningRequest()) {
                throw new timapi.TimException(timapi.constants.ResultCode.requestPending);
            }
            this.synchronousRequest.prepareWait(timapi.constants.RequestType.openReader);
            this.$runningRequest = timapi.constants.RequestType.openReader;
            this.stateMachine.eventOpenReader();
            this.synchronousRequest.waitForRequestCompleted();
            if (this.synchronousRequest.$lastException !== undefined) {
                throw this.synchronousRequest.$lastException;
            }
            TerminalBackendSixml.logger.exiting(TerminalBackendSixml.CLASS_NAME, "openReader");
        }
        openReaderAsync() {
            TerminalBackendSixml.logger.entering(TerminalBackendSixml.CLASS_NAME, "openReaderAsync");
            if (!this.hasGuide(timapi.constants.Guides.unattended)) {
                throw new timapi.TimException(timapi.constants.ResultCode.apiFunctionDisallowed);
            }
            if (!this.hasAdminFunction(timapi.constants.AdminFunctions.openReader)) {
                throw new timapi.TimException(timapi.constants.ResultCode.apiFunctionDisallowed);
            }
            if (this.hasRunningRequest()) {
                throw new timapi.TimException(timapi.constants.ResultCode.requestPending);
            }
            this.$runningRequest = timapi.constants.RequestType.openReader;
            this.stateMachine.eventOpenReader();
            TerminalBackendSixml.logger.exiting(TerminalBackendSixml.CLASS_NAME, "openReaderAsync");
        }
        ejectCard() {
            TerminalBackendSixml.logger.entering(TerminalBackendSixml.CLASS_NAME, "ejectCard");
            if (!this.hasGuide(timapi.constants.Guides.unattended)) {
                throw new timapi.TimException(timapi.constants.ResultCode.apiFunctionDisallowed);
            }
            if (!this.hasAdminFunction(timapi.constants.AdminFunctions.ejectCard)) {
                throw new timapi.TimException(timapi.constants.ResultCode.apiFunctionDisallowed);
            }
            if (this.hasRunningRequest()) {
                throw new timapi.TimException(timapi.constants.ResultCode.requestPending);
            }
            if (this.synchronousRequest == undefined) {
                TerminalBackendSixml.logger.log(timapi.logging.Level.INFO, "synchronousRequest is undefined or null");
                return;
            }
            this.synchronousRequest.prepareWait(timapi.constants.RequestType.ejectCard);
            this.$runningRequest = timapi.constants.RequestType.ejectCard;
            this.stateMachine.eventEjectCard();
            this.synchronousRequest.waitForRequestCompleted();
            if (this.synchronousRequest.$lastException !== undefined) {
                throw this.synchronousRequest.$lastException;
            }
            TerminalBackendSixml.logger.exiting(TerminalBackendSixml.CLASS_NAME, "ejectCard");
        }
        ejectCardAsync() {
            TerminalBackendSixml.logger.entering(TerminalBackendSixml.CLASS_NAME, "ejectCardAsync");
            if (!this.hasGuide(timapi.constants.Guides.unattended)) {
                throw new timapi.TimException(timapi.constants.ResultCode.apiFunctionDisallowed);
            }
            if (!this.hasAdminFunction(timapi.constants.AdminFunctions.ejectCard)) {
                throw new timapi.TimException(timapi.constants.ResultCode.apiFunctionDisallowed);
            }
            if (this.hasRunningRequest()) {
                throw new timapi.TimException(timapi.constants.ResultCode.requestPending);
            }
            this.$runningRequest = timapi.constants.RequestType.ejectCard;
            this.stateMachine.eventEjectCard();
            TerminalBackendSixml.logger.exiting(TerminalBackendSixml.CLASS_NAME, "ejectCardAsync");
        }
        openMaintenanceWindow() {
            TerminalBackendSixml.logger.entering(TerminalBackendSixml.CLASS_NAME, "openMaintenanceWindow");
            if (!this.hasGuide(timapi.constants.Guides.unattended)) {
                throw new timapi.TimException(timapi.constants.ResultCode.apiFunctionDisallowed);
            }
            if (!this.hasAdminFunction(timapi.constants.AdminFunctions.openMaintenanceWindow)) {
                throw new timapi.TimException(timapi.constants.ResultCode.apiFunctionDisallowed);
            }
            if (this.hasRunningRequest()) {
                throw new timapi.TimException(timapi.constants.ResultCode.requestPending);
            }
            if (this.synchronousRequest == undefined) {
                TerminalBackendSixml.logger.log(timapi.logging.Level.INFO, "synchronousRequest is undefined or null");
                return;
            }
            this.synchronousRequest.prepareWait(timapi.constants.RequestType.openMaintenanceWindow);
            this.$runningRequest = timapi.constants.RequestType.openMaintenanceWindow;
            this.stateMachine.eventOpenMaintenanceWindow();
            this.synchronousRequest.waitForRequestCompleted();
            if (this.synchronousRequest.$lastException !== undefined) {
                throw this.synchronousRequest.$lastException;
            }
            TerminalBackendSixml.logger.exiting(TerminalBackendSixml.CLASS_NAME, "openMaintenanceWindow");
        }
        openMaintenanceWindowAsync() {
            TerminalBackendSixml.logger.entering(TerminalBackendSixml.CLASS_NAME, "openMaintenanceWindowAsync");
            if (!this.hasGuide(timapi.constants.Guides.unattended)) {
                throw new timapi.TimException(timapi.constants.ResultCode.apiFunctionDisallowed);
            }
            if (!this.hasAdminFunction(timapi.constants.AdminFunctions.openMaintenanceWindow)) {
                throw new timapi.TimException(timapi.constants.ResultCode.apiFunctionDisallowed);
            }
            if (this.hasRunningRequest()) {
                throw new timapi.TimException(timapi.constants.ResultCode.requestPending);
            }
            this.$runningRequest = timapi.constants.RequestType.openMaintenanceWindow;
            this.stateMachine.eventOpenMaintenanceWindow();
            TerminalBackendSixml.logger.exiting(TerminalBackendSixml.CLASS_NAME, "openMaintenanceWindowAsync");
        }
        closeMaintenanceWindow() {
            TerminalBackendSixml.logger.entering(TerminalBackendSixml.CLASS_NAME, "closeMaintenanceWindow");
            if (!this.hasGuide(timapi.constants.Guides.unattended)) {
                throw new timapi.TimException(timapi.constants.ResultCode.apiFunctionDisallowed);
            }
            if (!this.hasAdminFunction(timapi.constants.AdminFunctions.closeMaintenanceWindow)) {
                throw new timapi.TimException(timapi.constants.ResultCode.apiFunctionDisallowed);
            }
            if (this.hasRunningRequest()) {
                throw new timapi.TimException(timapi.constants.ResultCode.requestPending);
            }
            if (this.synchronousRequest == undefined) {
                TerminalBackendSixml.logger.log(timapi.logging.Level.INFO, "synchronousRequest is undefined or null");
                throw new Error("synchronousRequest is undefined or null");
            }
            this.synchronousRequest.prepareWait(timapi.constants.RequestType.closeMaintenanceWindow);
            this.$runningRequest = timapi.constants.RequestType.closeMaintenanceWindow;
            this.stateMachine.eventCloseMaintenanceWindow();
            this.synchronousRequest.waitForRequestCompleted();
            if (this.synchronousRequest.$lastException !== undefined) {
                throw this.synchronousRequest.$lastException;
            }
            TerminalBackendSixml.logger.exiting(TerminalBackendSixml.CLASS_NAME, "closeMaintenanceWindow");
        }
        closeMaintenanceWindowAsync() {
            TerminalBackendSixml.logger.entering(TerminalBackendSixml.CLASS_NAME, "closeMaintenanceWindowAsync");
            if (!this.hasGuide(timapi.constants.Guides.unattended)) {
                throw new timapi.TimException(timapi.constants.ResultCode.apiFunctionDisallowed);
            }
            if (!this.hasAdminFunction(timapi.constants.AdminFunctions.closeMaintenanceWindow)) {
                throw new timapi.TimException(timapi.constants.ResultCode.apiFunctionDisallowed);
            }
            if (this.hasRunningRequest()) {
                throw new timapi.TimException(timapi.constants.ResultCode.requestPending);
            }
            this.$runningRequest = timapi.constants.RequestType.closeMaintenanceWindow;
            this.stateMachine.eventCloseMaintenanceWindow();
            TerminalBackendSixml.logger.exiting(TerminalBackendSixml.CLASS_NAME, "closeMaintenanceWindowAsync");
        }
        holdCommit() {
            TerminalBackendSixml.logger.entering(TerminalBackendSixml.CLASS_NAME, "holdCommit");
            if (!this.hasGuide(timapi.constants.Guides.unattended)) {
                throw new timapi.TimException(timapi.constants.ResultCode.apiFunctionDisallowed);
            }
            if (!this.hasNonFinancialFunction(timapi.constants.NonFinancialTransactions.holdCommit)) {
                throw new timapi.TimException(timapi.constants.ResultCode.apiFunctionDisallowed);
            }
            this.stateMachine.eventHoldCommit();
            TerminalBackendSixml.logger.exiting(TerminalBackendSixml.CLASS_NAME, "holdCommit");
        }
        activateServiceMenu() {
            TerminalBackendSixml.logger.entering(TerminalBackendSixml.CLASS_NAME, "activateServiceMenu");
            if (!this.hasGuide(timapi.constants.Guides.unattended)) {
                throw new timapi.TimException(timapi.constants.ResultCode.apiFunctionDisallowed);
            }
            if (!this.hasAdminFunction(timapi.constants.AdminFunctions.activateServiceMenu)) {
                throw new timapi.TimException(timapi.constants.ResultCode.apiFunctionDisallowed);
            }
            if (this.hasRunningRequest()) {
                throw new timapi.TimException(timapi.constants.ResultCode.requestPending);
            }
            if (this.synchronousRequest == undefined) {
                TerminalBackendSixml.logger.log(timapi.logging.Level.INFO, "synchronousRequest is undefined or null");
                throw new Error("synchronousRequest is undefined or null");
            }
            this.synchronousRequest.prepareWait(timapi.constants.RequestType.activateServiceMenu);
            this.$runningRequest = timapi.constants.RequestType.activateServiceMenu;
            this.stateMachine.eventActivateServiceMenu();
            this.synchronousRequest.waitForRequestCompleted();
            if (this.synchronousRequest.$lastException !== undefined) {
                throw this.synchronousRequest.$lastException;
            }
            TerminalBackendSixml.logger.exiting(TerminalBackendSixml.CLASS_NAME, "activateServiceMenu");
        }
        activateServiceMenuAsync() {
            TerminalBackendSixml.logger.entering(TerminalBackendSixml.CLASS_NAME, "activateServiceMenuAsync");
            if (!this.hasGuide(timapi.constants.Guides.unattended)) {
                throw new timapi.TimException(timapi.constants.ResultCode.apiFunctionDisallowed);
            }
            if (!this.hasAdminFunction(timapi.constants.AdminFunctions.activateServiceMenu)) {
                throw new timapi.TimException(timapi.constants.ResultCode.apiFunctionDisallowed);
            }
            if (this.hasRunningRequest()) {
                throw new timapi.TimException(timapi.constants.ResultCode.requestPending);
            }
            this.$runningRequest = timapi.constants.RequestType.activateServiceMenu;
            this.stateMachine.eventActivateServiceMenu();
            TerminalBackendSixml.logger.exiting(TerminalBackendSixml.CLASS_NAME, "activateServiceMenuAsync");
        }
        openDialogMode() {
            TerminalBackendSixml.logger.entering(TerminalBackendSixml.CLASS_NAME, "openDialogMode");
            if (!this.hasGuide(timapi.constants.Guides.DIALOG)) {
                throw new timapi.TimException(timapi.constants.ResultCode.apiFunctionDisallowed);
            }
            if (!this.hasAdminFunction(timapi.constants.AdminFunctions.openDialogMode)) {
                throw new timapi.TimException(timapi.constants.ResultCode.apiFunctionDisallowed);
            }
            if (this.hasRunningRequest()) {
                throw new timapi.TimException(timapi.constants.ResultCode.requestPending);
            }
            if (this.synchronousRequest == undefined) {
                TerminalBackendSixml.logger.log(timapi.logging.Level.INFO, "synchronousRequest is undefined or null");
                throw new Error("synchronousRequest is undefined or null");
            }
            this.synchronousRequest.prepareWait(timapi.constants.RequestType.openDialogMode);
            this.$runningRequest = timapi.constants.RequestType.openDialogMode;
            this.stateMachine.eventOpenDialogMode();
            this.synchronousRequest.waitForRequestCompleted();
            if (this.synchronousRequest.$lastException !== undefined) {
                throw this.synchronousRequest.$lastException;
            }
            TerminalBackendSixml.logger.exiting(TerminalBackendSixml.CLASS_NAME, "openDialogMode");
        }
        openDialogModeAsync() {
            TerminalBackendSixml.logger.entering(TerminalBackendSixml.CLASS_NAME, "openDialogModeAsync");
            if (!this.hasGuide(timapi.constants.Guides.DIALOG)) {
                throw new timapi.TimException(timapi.constants.ResultCode.apiFunctionDisallowed);
            }
            if (!this.hasAdminFunction(timapi.constants.AdminFunctions.openDialogMode)) {
                throw new timapi.TimException(timapi.constants.ResultCode.apiFunctionDisallowed);
            }
            if (this.hasRunningRequest()) {
                throw new timapi.TimException(timapi.constants.ResultCode.requestPending);
            }
            this.$runningRequest = timapi.constants.RequestType.openDialogMode;
            this.stateMachine.eventOpenDialogMode();
            TerminalBackendSixml.logger.exiting(TerminalBackendSixml.CLASS_NAME, "openDialogModeAsync");
        }
        closeDialogMode() {
            TerminalBackendSixml.logger.entering(TerminalBackendSixml.CLASS_NAME, "closeDialogMode");
            if (!this.hasGuide(timapi.constants.Guides.DIALOG)) {
                throw new timapi.TimException(timapi.constants.ResultCode.apiFunctionDisallowed);
            }
            if (!this.hasAdminFunction(timapi.constants.AdminFunctions.closeDialogMode)) {
                throw new timapi.TimException(timapi.constants.ResultCode.apiFunctionDisallowed);
            }
            if (this.hasRunningRequest()) {
                throw new timapi.TimException(timapi.constants.ResultCode.requestPending);
            }
            if (this.synchronousRequest == undefined) {
                TerminalBackendSixml.logger.log(timapi.logging.Level.INFO, "synchronousRequest is undefined or null");
                throw new Error("synchronousRequest is undefined or null");
            }
            this.synchronousRequest.prepareWait(timapi.constants.RequestType.closeDialogMode);
            this.$runningRequest = timapi.constants.RequestType.closeDialogMode;
            this.stateMachine.eventCloseDialogMode();
            this.synchronousRequest.waitForRequestCompleted();
            if (this.synchronousRequest.$lastException !== undefined) {
                throw this.synchronousRequest.$lastException;
            }
            TerminalBackendSixml.logger.exiting(TerminalBackendSixml.CLASS_NAME, "closeDialogMode");
        }
        closeDialogModeAsync() {
            TerminalBackendSixml.logger.entering(TerminalBackendSixml.CLASS_NAME, "closeDialogModeAsync");
            if (!this.hasGuide(timapi.constants.Guides.DIALOG)) {
                throw new timapi.TimException(timapi.constants.ResultCode.apiFunctionDisallowed);
            }
            if (!this.hasAdminFunction(timapi.constants.AdminFunctions.closeDialogMode)) {
                throw new timapi.TimException(timapi.constants.ResultCode.apiFunctionDisallowed);
            }
            if (this.hasRunningRequest()) {
                throw new timapi.TimException(timapi.constants.ResultCode.requestPending);
            }
            this.$runningRequest = timapi.constants.RequestType.closeDialogMode;
            this.stateMachine.eventCloseDialogMode();
            TerminalBackendSixml.logger.exiting(TerminalBackendSixml.CLASS_NAME, "closeDialogModeAsync");
        }
        showSignatureCapture(request) {
            TerminalBackendSixml.logger.entering(TerminalBackendSixml.CLASS_NAME, "showSignatureCapture", [request]);
            if (!this.hasGuide(timapi.constants.Guides.DIALOG)) {
                throw new timapi.TimException(timapi.constants.ResultCode.apiFunctionDisallowed);
            }
            if (!this.hasDialogFunction(timapi.constants.DialogFunctions.showSignatureCapture)) {
                throw new timapi.TimException(timapi.constants.ResultCode.apiFunctionDisallowed);
            }
            if (this.hasRunningRequest()) {
                throw new timapi.TimException(timapi.constants.ResultCode.requestPending);
            }
            this.synchronousRequest.prepareWait(timapi.constants.RequestType.showSignatureCapture);
            this.stateMachine.$requestShowSignatureCapture(timapi.statemachine.sixml.ConvertSIXml2TimApi.convertRequestShowSignatureCapture(request));
            this.$runningRequest = timapi.constants.RequestType.showSignatureCapture;
            this.stateMachine.eventShowSignatureCapture();
            if (this.synchronousRequest == undefined) {
                TerminalBackendSixml.logger.log(timapi.logging.Level.INFO, "synchronousRequest is undefined or null");
                throw new Error("synchronousRequest is undefined or null");
            }
            this.synchronousRequest.waitForRequestCompleted();
            if (this.synchronousRequest.$lastException !== undefined) {
                throw this.synchronousRequest.$lastException;
            }
            TerminalBackendSixml.logger.exiting(TerminalBackendSixml.CLASS_NAME, "showSignatureCapture");
            return this.synchronousRequest.$lastShowSignatureCaptureResponse;
        }
        showSignatureCaptureAsync(request) {
            TerminalBackendSixml.logger.entering(TerminalBackendSixml.CLASS_NAME, "showSignatureCaptureAsync", [request]);
            if (!this.hasGuide(timapi.constants.Guides.DIALOG)) {
                throw new timapi.TimException(timapi.constants.ResultCode.apiFunctionDisallowed);
            }
            if (!this.hasDialogFunction(timapi.constants.DialogFunctions.showSignatureCapture)) {
                throw new timapi.TimException(timapi.constants.ResultCode.apiFunctionDisallowed);
            }
            if (this.hasRunningRequest()) {
                throw new timapi.TimException(timapi.constants.ResultCode.requestPending);
            }
            this.stateMachine.$requestShowSignatureCapture(timapi.statemachine.sixml.ConvertSIXml2TimApi.convertRequestShowSignatureCapture(request));
            this.$runningRequest = timapi.constants.RequestType.showSignatureCapture;
            this.stateMachine.eventShowSignatureCapture();
            TerminalBackendSixml.logger.exiting(TerminalBackendSixml.CLASS_NAME, "showSignatureCaptureAsync");
        }
        showDialog(request) {
            TerminalBackendSixml.logger.entering(TerminalBackendSixml.CLASS_NAME, "showDialog", [request]);
            if (!this.hasGuide(timapi.constants.Guides.DIALOG)) {
                throw new timapi.TimException(timapi.constants.ResultCode.apiFunctionDisallowed);
            }
            if (!this.hasDialogFunction(timapi.constants.DialogFunctions.showDialog)) {
                throw new timapi.TimException(timapi.constants.ResultCode.apiFunctionDisallowed);
            }
            if (this.hasRunningRequest()) {
                throw new timapi.TimException(timapi.constants.ResultCode.requestPending);
            }
            this.synchronousRequest.prepareWait(timapi.constants.RequestType.showDialog);
            this.stateMachine.$requestShowDialog(timapi.statemachine.sixml.ConvertTimApi2SIXml.convertRequestShowDialog(request));
            this.$runningRequest = timapi.constants.RequestType.showDialog;
            this.stateMachine.eventShowDialog();
            if (this.synchronousRequest == undefined) {
                TerminalBackendSixml.logger.log(timapi.logging.Level.INFO, "synchronousRequest is undefined or null");
                return undefined;
            }
            this.synchronousRequest.waitForRequestCompleted();
            if (this.synchronousRequest.$lastException !== undefined) {
                throw this.synchronousRequest.$lastException;
            }
            TerminalBackendSixml.logger.exiting(TerminalBackendSixml.CLASS_NAME, "showDialog");
            return this.synchronousRequest.$lastShowDialogResponse;
        }
        showDialogAsync(request) {
            TerminalBackendSixml.logger.entering(TerminalBackendSixml.CLASS_NAME, "showDialogAsync", [request]);
            if (!this.hasGuide(timapi.constants.Guides.dialog)) {
                throw new timapi.TimException(timapi.constants.ResultCode.apiFunctionDisallowed);
            }
            if (!this.hasDialogFunction(timapi.constants.DialogFunctions.showDialog)) {
                throw new timapi.TimException(timapi.constants.ResultCode.apiFunctionDisallowed);
            }
            if (this.hasRunningRequest()) {
                throw new timapi.TimException(timapi.constants.ResultCode.requestPending);
            }
            this.stateMachine.$requestShowDialog(timapi.statemachine.sixml.ConvertTimApi2SIXml.convertRequestShowDialog(request));
            this.$runningRequest = timapi.constants.RequestType.showDialog;
            this.stateMachine.eventShowDialog();
            TerminalBackendSixml.logger.exiting(TerminalBackendSixml.CLASS_NAME, "showDialogAsync");
        }
        balanceInquiry() {
            TerminalBackendSixml.logger.entering(TerminalBackendSixml.CLASS_NAME, "balanceInquiry");
            if (!this.hasGuide(timapi.constants.Guides.advancedRetail)) {
                throw new timapi.TimException(timapi.constants.ResultCode.apiFunctionDisallowed);
            }
            if (!this.hasNonFinancialFunction(timapi.constants.NonFinancialTransactions.balanceInquiry)) {
                throw new timapi.TimException(timapi.constants.ResultCode.apiFunctionDisallowed);
            }
            if (this.hasRunningRequest()) {
                throw new timapi.TimException(timapi.constants.ResultCode.requestPending);
            }
            this.synchronousRequest.prepareWait(timapi.constants.RequestType.balanceInquiry);
            this.$runningRequest = timapi.constants.RequestType.balanceInquiry;
            this.stateMachine.eventBalanceInquiry();
            this.synchronousRequest.waitForRequestCompleted();
            if (this.synchronousRequest.$lastException !== undefined) {
                throw this.synchronousRequest.$lastException;
            }
            let response = this.synchronousRequest.$lastBalanceInquiryResponse;
            TerminalBackendSixml.logger.exiting(TerminalBackendSixml.CLASS_NAME, "balanceInquiry", [response]);
            return response;
        }
        balanceInquiryAsync() {
            TerminalBackendSixml.logger.entering(TerminalBackendSixml.CLASS_NAME, "balanceInquiryAsync");
            if (!this.hasGuide(timapi.constants.Guides.advancedRetail)) {
                throw new timapi.TimException(timapi.constants.ResultCode.apiFunctionDisallowed);
            }
            if (!this.hasNonFinancialFunction(timapi.constants.NonFinancialTransactions.balanceInquiry)) {
                throw new timapi.TimException(timapi.constants.ResultCode.apiFunctionDisallowed);
            }
            if (this.hasRunningRequest()) {
                throw new timapi.TimException(timapi.constants.ResultCode.requestPending);
            }
            this.$runningRequest = timapi.constants.RequestType.balanceInquiry;
            this.stateMachine.eventBalanceInquiry();
            TerminalBackendSixml.logger.exiting(TerminalBackendSixml.CLASS_NAME, "balanceInquiryAsync");
        }
        queryLoyalty(retainCard, loyaltyInfoType) {
            TerminalBackendSixml.logger.entering(TerminalBackendSixml.CLASS_NAME, "queryLoyalty", [retainCard, loyaltyInfoType]);
            if (!this.hasGuide(timapi.constants.Guides.advancedRetail)) {
                throw new timapi.TimException(timapi.constants.ResultCode.apiFunctionDisallowed);
            }
            if (!this.hasNonFinancialFunction(timapi.constants.NonFinancialTransactions.queryLoyalty)) {
                throw new timapi.TimException(timapi.constants.ResultCode.apiFunctionDisallowed);
            }
            if (this.hasRunningRequest()) {
                throw new timapi.TimException(timapi.constants.ResultCode.requestPending);
            }
            this.synchronousRequest.prepareWait(timapi.constants.RequestType.queryLoyalty);
            let request = new timapi.protocol.sixml.Request_QueryLoyalty();
            request.retainCardFlag = retainCard;
            request.loyaltyInfoType = loyaltyInfoType;
            this.stateMachine.$requestQueryLoyalty(request);
            this.$runningRequest = timapi.constants.RequestType.queryLoyalty;
            this.stateMachine.eventQueryLoyalty();
            this.synchronousRequest.waitForRequestCompleted();
            if (this.synchronousRequest.$lastException !== undefined) {
                throw this.synchronousRequest.$lastException;
            }
            let response = this.synchronousRequest.$lastQueryLoyaltyResponse;
            TerminalBackendSixml.logger.exiting(TerminalBackendSixml.CLASS_NAME, "queryLoyalty", [response]);
            return response;
        }
        queryLoyaltyAsync(retainCard, loyaltyInfoType) {
            TerminalBackendSixml.logger.entering(TerminalBackendSixml.CLASS_NAME, "queryLoyaltyAsync", [retainCard, loyaltyInfoType]);
            if (!this.hasGuide(timapi.constants.Guides.advancedRetail)) {
                throw new timapi.TimException(timapi.constants.ResultCode.apiFunctionDisallowed);
            }
            if (!this.hasNonFinancialFunction(timapi.constants.NonFinancialTransactions.queryLoyalty)) {
                throw new timapi.TimException(timapi.constants.ResultCode.apiFunctionDisallowed);
            }
            if (this.hasRunningRequest()) {
                throw new timapi.TimException(timapi.constants.ResultCode.requestPending);
            }
            let request = new timapi.protocol.sixml.Request_QueryLoyalty();
            request.retainCardFlag = retainCard;
            request.loyaltyInfoType = loyaltyInfoType;
            this.stateMachine.$requestQueryLoyalty(request);
            this.$runningRequest = timapi.constants.RequestType.queryLoyalty;
            this.stateMachine.eventQueryLoyalty();
            TerminalBackendSixml.logger.exiting(TerminalBackendSixml.CLASS_NAME, "queryLoyaltyAsync");
        }
        failRunningRequest(exception) {
            if (TerminalBackendSixml.logger.isLoggable(timapi.logging.Level.FINEST)) {
                TerminalBackendSixml.logger.entering(TerminalBackendSixml.CLASS_NAME, "failRunningRequest", [exception, timapi.constants.RequestType[this.$runningRequest]]);
            }
            else {
                TerminalBackendSixml.logger.entering(TerminalBackendSixml.CLASS_NAME, "failRunningRequest");
            }
            if (this.hasRunningRequest()) {
                this.failRequest(this.$runningRequest, exception);
            }
            this.failPendingRequest(exception);
            TerminalBackendSixml.logger.exiting(TerminalBackendSixml.CLASS_NAME, "failRunningRequest");
        }
        failPendingRequest(exception) {
            TerminalBackendSixml.logger.entering(TerminalBackendSixml.CLASS_NAME, "failPendingRequest", [exception]);
            let pendingRequest = this.stateMachine.$pendingRequest;
            if (pendingRequest == undefined) {
                return;
            }
            try {
                this.stateMachine.actionClearPendingEvent();
            }
            catch (ignore) {
                console.log(ignore);
            }
            this.failRequest(pendingRequest, exception);
            TerminalBackendSixml.logger.exiting(TerminalBackendSixml.CLASS_NAME, "failPendingRequest");
        }
        failRequest(requestType, exception) {
            if (TerminalBackendSixml.logger.isLoggable(timapi.logging.Level.FINEST)) {
                TerminalBackendSixml.logger.entering(TerminalBackendSixml.CLASS_NAME, "failRequest", [timapi.constants.RequestType[requestType], exception]);
            }
            else {
                TerminalBackendSixml.logger.entering(TerminalBackendSixml.CLASS_NAME, "failRequest");
            }
            TerminalBackendSixml.logger.log(timapi.logging.Level.INFO, "Fail request ", [timapi.constants.RequestType[requestType]]);
            switch (requestType) {
                case timapi.constants.RequestType.activate:
                    this.notifyActivateCompleted(exception, undefined);
                    break;
                case timapi.constants.RequestType.applicationInformation:
                    this.notifyApplicationInformationCompleted(exception);
                    break;
                case timapi.constants.RequestType.balance:
                    this.notifyBalanceCompleted(exception, undefined);
                    break;
                case timapi.constants.RequestType.commit:
                    this.notifyCommitCompleted(exception);
                    break;
                case timapi.constants.RequestType.counterRequest:
                    this.notifyCounterRequestCompleted(exception, undefined);
                    break;
                case timapi.constants.RequestType.dccRates:
                    this.notifyDccRatesCompleted(exception, undefined);
                    break;
                case timapi.constants.RequestType.deactivate:
                    this.notifyDeactivateCompleted(exception, undefined);
                    break;
                case timapi.constants.RequestType.hardwareInformation:
                    this.notifyHardwareInformationCompleted(exception, undefined);
                    break;
                case timapi.constants.RequestType.changeSettings:
                    this.notifyChangeSettingsCompleted(exception);
                    break;
                case timapi.constants.RequestType.initTransaction:
                    this.notifyInitTransactionCompleted(exception, undefined);
                    break;
                case timapi.constants.RequestType.login:
                    this.notifyLoginCompleted(exception);
                    break;
                case timapi.constants.RequestType.logout:
                    this.notifyLogoutCompleted(exception);
                    break;
                case timapi.constants.RequestType.reboot:
                    this.notifyRebootCompleted(exception);
                    break;
                case timapi.constants.RequestType.receiptRequest:
                    this.notifyReceiptRequestCompleted(exception, undefined);
                    break;
                case timapi.constants.RequestType.reconciliation:
                    this.notifyReconciliationCompleted(exception, undefined);
                    break;
                case timapi.constants.RequestType.reconfig:
                    this.notifyReconfigCompleted(exception, undefined);
                    break;
                case timapi.constants.RequestType.rollback:
                    this.notifyRollbackCompleted(exception, undefined);
                    break;
                case timapi.constants.RequestType.softwareUpdate:
                    this.notifySoftwareUpdateCompleted(exception, undefined);
                    break;
                case timapi.constants.RequestType.systemInformation:
                    this.notifySystemInformationCompleted(exception, undefined);
                    break;
                case timapi.constants.RequestType.transaction:
                    this.notifyTransactionCompleted(exception, new timapi.TransactionResponse(this.failTransactionType, undefined, undefined, undefined, undefined, undefined, undefined, undefined, undefined, undefined, new Map(), new Array()));
                    break;
                case timapi.constants.RequestType.openReader:
                    this.notifyOpenReaderCompleted(exception);
                    break;
                case timapi.constants.RequestType.closeReader:
                    this.notifyCloseReaderCompleted(exception);
                    break;
                case timapi.constants.RequestType.ejectCard:
                    this.notifyEjectCardCompleted(exception);
                    break;
                case timapi.constants.RequestType.openMaintenanceWindow:
                    this.notifyOpenMaintenanceWindowCompleted(exception);
                    break;
                case timapi.constants.RequestType.closeMaintenanceWindow:
                    this.notifyCloseMaintenanceWindowCompleted(exception);
                    break;
                case timapi.constants.RequestType.activateServiceMenu:
                    this.notifyActivateServiceMenuCompleted(exception);
                    break;
                case timapi.constants.RequestType.openDialogMode:
                    this.notifyOpenDialogModeCompleted(exception);
                    break;
                case timapi.constants.RequestType.closeDialogMode:
                    this.notifyCloseDialogModeCompleted(exception);
                    break;
                case timapi.constants.RequestType.showSignatureCapture:
                    this.notifyShowSignatureCaptureCompleted(exception, undefined);
                    break;
                case timapi.constants.RequestType.showDialog:
                    this.notifyShowDialogCompleted(exception, undefined);
                    break;
                case timapi.constants.RequestType.balanceInquiry:
                    this.notifyBalanceInquiryCompleted(exception, undefined);
                    break;
                case timapi.constants.RequestType.queryLoyalty:
                    this.notifyQueryLoyaltyCompleted(exception, undefined);
                    break;
                case timapi.constants.RequestType.connect:
                    this.notifyConnectCompleted(exception);
                    break;
                case timapi.constants.RequestType.softwareInformation:
                    this.notifySoftwareUpdateCompleted(exception, undefined);
                    break;
            }
            TerminalBackendSixml.logger.exiting(TerminalBackendSixml.CLASS_NAME, "failRequest");
        }
        consumeNextSequenceNumber() {
            TerminalBackendSixml.logger.entering(TerminalBackendSixml.CLASS_NAME, "consumeNextSequenceNumber");
            if (this.nextSequenceNumber === Number.MAX_VALUE) {
                this.nextSequenceNumber = 1;
                return Number.MAX_VALUE;
            }
            if (TerminalBackendSixml.logger.isLoggable(timapi.logging.Level.FINEST)) {
                TerminalBackendSixml.logger.exiting(TerminalBackendSixml.CLASS_NAME, "consumeNextSequenceNumber", [this.nextSequenceNumber + 1]);
            }
            else {
                TerminalBackendSixml.logger.exiting(TerminalBackendSixml.CLASS_NAME, "consumeNextSequenceNumber");
            }
            this.nextSequenceNumber += 1;
            return this.nextSequenceNumber;
        }
        hasPendingMessage() {
            return this.pendingMessage !== undefined;
        }
        sendMessage(message) {
            if (TerminalBackendSixml.logger.isLoggable(timapi.logging.Level.FINEST)) {
                TerminalBackendSixml.logger.entering(TerminalBackendSixml.CLASS_NAME, "sendMessage");
            }
            else {
                TerminalBackendSixml.logger.entering(TerminalBackendSixml.CLASS_NAME, "sendMessage");
            }
            if (!this.isCommConnected()) {
                throw new timapi.TimException(timapi.constants.ResultCode.TIM_COMMUNICATION_FAILURE);
            }
            let channel = 1;
            let node = this.m_xmlWriter.writeXml(message.toXmlNode());
            TerminalBackendSixml.logger.log(timapi.logging.Level.FINE, "Sending message: ", node);
            let data = timapi.utils.StringEncoder.toArrayBuffer(node);
            try {
                this.$commEndpoint.sendMessage(new Uint8Array(data));
                this.pendingMessage = message;
            }
            catch (e) {
                throw new timapi.TimException(timapi.constants.ResultCode.TIM_COMMUNICATION_FAILURE);
            }
            TerminalBackendSixml.logger.exiting(TerminalBackendSixml.CLASS_NAME, "sendMessage");
        }
        sendNotification(message) {
            if (TerminalBackendSixml.logger.isLoggable(timapi.logging.Level.FINEST)) {
                TerminalBackendSixml.logger.entering(TerminalBackendSixml.CLASS_NAME, "sendNotification");
            }
            else {
                TerminalBackendSixml.logger.entering(TerminalBackendSixml.CLASS_NAME, "sendNotification");
            }
            if (!this.isCommConnected()) {
                throw new Error("Not connected to terminal");
            }
            let channel = 1;
            let node = this.m_xmlWriter.writeXml(message.toXmlNode());
            let data = timapi.utils.StringEncoder.toArrayBuffer(node);
            this.$commEndpoint.sendMessage(new Uint8Array(data));
            TerminalBackendSixml.logger.exiting(TerminalBackendSixml.CLASS_NAME, "sendNotification");
        }
        setDisconnectedTerminalStatus() {
            this.terminalStatus = new timapi.TerminalStatus(new Array(), timapi.constants.ConnectionStatus.disconnected, timapi.constants.ManagementStatus.closed, timapi.constants.CardReaderStatus.cardReaderEmpty, timapi.constants.TransactionStatus.idle, undefined, false, undefined, false);
        }
        connected() {
            TerminalBackendSixml.logger.entering(TerminalBackendSixml.CLASS_NAME, "connected");
            try {
                this.notifyConnectCompleted(undefined);
                this.stateMachine.eventConnected();
            }
            catch (ignore) {
                console.log(ignore);
            }
            TerminalBackendSixml.logger.exiting(TerminalBackendSixml.CLASS_NAME, "connected");
        }
        connectionFailed(error) {
            TerminalBackendSixml.logger.entering(TerminalBackendSixml.CLASS_NAME, "connectionFailed");
            try {
                this.notifyConnectCompleted(new timapi.TimException(error));
                this.stateMachine.eventConnectFailed();
            }
            catch (ignore) {
            }
            TerminalBackendSixml.logger.exiting(TerminalBackendSixml.CLASS_NAME, "connectionFailed");
        }
        disconnected() {
            TerminalBackendSixml.logger.entering(TerminalBackendSixml.CLASS_NAME, "disconnected");
            let exception = new timapi.TimException(timapi.constants.ResultCode.TIM_COMMUNICATION_FAILURE);
            try {
                this.failRunningRequest(exception);
                this.setDisconnectedTerminalStatus();
                this.notifyDisconnected(exception);
                this.stateMachine.eventDisconnect();
            }
            catch (ignore) {
            }
            TerminalBackendSixml.logger.exiting(TerminalBackendSixml.CLASS_NAME, "disconnected");
        }
        checkTransactionTypeAllowed(type) {
            switch (type) {
                case timapi.constants.TransactionType.purchase:
                    if (!this.hasFinancialFunction(timapi.constants.FinancialTransactions.purchase)) {
                        throw new timapi.TimException(timapi.constants.ResultCode.apiFunctionDisallowed);
                    }
                    break;
                case timapi.constants.TransactionType.credit:
                    if (!this.hasFinancialFunction(timapi.constants.FinancialTransactions.credit)) {
                        throw new timapi.TimException(timapi.constants.ResultCode.apiFunctionDisallowed);
                    }
                    break;
                case timapi.constants.TransactionType.reversal:
                    if (!this.hasFinancialFunction(timapi.constants.FinancialTransactions.reversal)) {
                        throw new timapi.TimException(timapi.constants.ResultCode.apiFunctionDisallowed);
                    }
                    break;
                case timapi.constants.TransactionType.preAuthorization:
                    if (!this.hasGuide(timapi.constants.Guides.petrol)) {
                        throw new timapi.TimException(timapi.constants.ResultCode.apiFunctionDisallowed);
                    }
                    if (!this.hasFinancialFunction(timapi.constants.FinancialTransactions.preAuthorization)) {
                        throw new timapi.TimException(timapi.constants.ResultCode.apiFunctionDisallowed);
                    }
                    break;
                case timapi.constants.TransactionType.finalizePurchase:
                    if (!this.hasGuide(timapi.constants.Guides.petrol)) {
                        throw new timapi.TimException(timapi.constants.ResultCode.apiFunctionDisallowed);
                    }
                    if (!this.hasFinancialFunction(timapi.constants.FinancialTransactions.finalizePurchase)) {
                        throw new timapi.TimException(timapi.constants.ResultCode.apiFunctionDisallowed);
                    }
                    break;
                case timapi.constants.TransactionType.purchaseForcedAcceptance:
                    if (!this.hasGuide(timapi.constants.Guides.advancedRetail)) {
                        throw new timapi.TimException(timapi.constants.ResultCode.apiFunctionDisallowed);
                    }
                    if (!this.hasFinancialFunction(timapi.constants.FinancialTransactions.purchaseForcedAcceptance)) {
                        throw new timapi.TimException(timapi.constants.ResultCode.apiFunctionDisallowed);
                    }
                    break;
                case timapi.constants.TransactionType.cashAdvance:
                    if (!this.hasGuide(timapi.constants.Guides.advancedRetail)) {
                        throw new timapi.TimException(timapi.constants.ResultCode.apiFunctionDisallowed);
                    }
                    if (!this.hasFinancialFunction(timapi.constants.FinancialTransactions.cashAdvance)) {
                        throw new timapi.TimException(timapi.constants.ResultCode.apiFunctionDisallowed);
                    }
                    break;
                case timapi.constants.TransactionType.purchaseWithCashback:
                    if (!this.hasGuide(timapi.constants.Guides.advancedRetail)) {
                        throw new timapi.TimException(timapi.constants.ResultCode.apiFunctionDisallowed);
                    }
                    if (!this.hasFinancialFunction(timapi.constants.FinancialTransactions.purchaseWithCashback)) {
                        throw new timapi.TimException(timapi.constants.ResultCode.apiFunctionDisallowed);
                    }
                    break;
                case timapi.constants.TransactionType.purchasePhoneAuthorized:
                    if (!this.hasGuide(timapi.constants.Guides.advancedRetail)) {
                        throw new timapi.TimException(timapi.constants.ResultCode.apiFunctionDisallowed);
                    }
                    if (!this.hasFinancialFunction(timapi.constants.FinancialTransactions.purchasePhoneAuthorized)) {
                        throw new timapi.TimException(timapi.constants.ResultCode.apiFunctionDisallowed);
                    }
                    break;
            }
        }
        connectionFailed(error) {
            TerminalBackendSixml.logger.entering(TerminalBackendSixml.CLASS_NAME, "connectionFailed");
            try {
                this.notifyConnectCompleted(new timapi.TimException(error));
                this.stateMachine.eventConnectFailed();
            }
            catch (_a) {
                console.log("error occured");
            }
            TerminalBackendSixml.logger.exiting(TerminalBackendSixml.CLASS_NAME, "connectionFailed");
        }
        disconnected() {
            TerminalBackendSixml.logger.exiting(TerminalBackendSixml.CLASS_NAME, "disconnected");
            let exception = new timapi.TimException(timapi.constants.ResultCode.timCommunicationFailure);
            try {
                this.failRunningRequest(exception);
                this.setDisconnectedTerminalStatus();
                this.notifyDisconnected(exception);
                this.stateMachine.eventDisconnect();
            }
            catch (_a) {
                console.log("error occured");
            }
            TerminalBackendSixml.logger.exiting(TerminalBackendSixml.CLASS_NAME, "disconnected");
        }
        messageReceived(data) {
            let channel = data[0];
            try {
                switch (channel) {
                    case 1:
                        let node = timapi.utils.SixmlParser.parseSIXMLFromUint8Array(data.subarray(1));
                        let messageType = node.name;
                        if (messageType === "sixml:Notification") {
                            let notification = new timapi.protocol.sixml.Notification(node);
                            if (notification.function === timapi.protocol.constants.Function.keepAlive) {
                                TerminalBackendSixml.logger.log(timapi.logging.Level.FINEST, "Received keep alive:", node);
                            }
                            else {
                                TerminalBackendSixml.logger.log(timapi.logging.Level.FINER, "Received notification: " + timapi.utils.StringHelper.fromUInt8Array(data), node);
                            }
                        }
                        else {
                            TerminalBackendSixml.logger.log(timapi.logging.Level.FINE, "Received message: " + timapi.utils.StringHelper.fromUInt8Array(data), node);
                        }
                        this.stateMachine.$lastReceivedMessage = node;
                        this.stateMachine.armKeepAliveTimeout();
                        if (messageType === "sixml:Notification") {
                            let notification = new timapi.protocol.sixml.Notification(node);
                            if (notification.functionGroup === timapi.protocol.constants.FunctionGroup.status) {
                                if (notification.function === timapi.protocol.constants.Function.terminalStatus) {
                                    this.stateMachine.eventNotificationStatusChanged();
                                }
                                else if (notification.function === timapi.protocol.constants.Function.licenseChanged) {
                                    this.stateMachine.eventNotificationLicenseChanged();
                                }
                                else if (notification.function === timapi.protocol.constants.Function.keepAlive) {
                                    this.stateMachine.eventNotificationKeepAlive();
                                }
                                else {
                                    this.stateMachine.eventResponseInvalid();
                                }
                            }
                            else {
                                this.stateMachine.eventResponseInvalid();
                            }
                        }
                        else if (messageType === "sixml:Response") {
                            if (this.pendingMessage == undefined) {
                                this.stateMachine.eventResponseInvalid();
                            }
                            else {
                                let response = new timapi.protocol.sixml.Response(node);
                                if (response.sequenceNumber === this.pendingMessage.sequenceNumber
                                    && response.functionGroup === this.pendingMessage.functionGroup
                                    && response.function === this.pendingMessage.function) {
                                    this.pendingMessage = null;
                                    if (response.resultCode == 0) {
                                        this.stateMachine.eventResponseRequest();
                                    }
                                    else {
                                        this.stateMachine.eventResponseError();
                                    }
                                }
                            }
                        }
                        break;
                    case 2:
                        break;
                    case 3:
                        break;
                    case 4:
                        break;
                    default:
                        break;
                }
            }
            catch (e) {
                TerminalBackendSixml.logger.log(timapi.logging.Level.SEVERE, "Failed to parse received message", e);
                if (channel == 1) {
                    TerminalBackendSixml.logger.log(timapi.logging.Level.SEVERE, String.fromCharCode(data.subarray(1)));
                }
                try {
                    stateMachine.eventResponseInvalid();
                }
                catch (ignore) {
                    console.log(ignore);
                }
            }
        }
        checkPendingAction() {
            if (this.pendingAction !== timapi.SocketAction.none) {
                TerminalBackendSixml.logger.log(timapi.logging.Level.INFO, "Pending request present, waiting");
                return;
            }
            switch (this.pendingAction) {
                case timapi.SocketAction.transaction:
                    switch (this.state) {
                        case SocketState.disconnected:
                            this.connect();
                            break;
                        case SocketState.loggedOut:
                            this.login();
                            break;
                        case SocketState.loggedIn:
                            this.activate();
                            break;
                        case SocketState.open:
                            this.pendingAction = timapi.SocketAction.none;
                            this.purchase();
                            break;
                    }
                    break;
                case timapi.SocketAction.disconnect:
                    switch (this.state) {
                        case SocketState.open:
                            this.deactivate();
                            break;
                        case SocketState.loggedIn:
                            this.logout();
                            break;
                        case SocketState.loggedOut:
                            this.pendingAction = timapi.SocketAction.none;
                            this.disconnect();
                            break;
                    }
            }
        }
        activate() {
            if (this.state !== SocketState.loggedIn) {
                return;
            }
            let sequenceNumber = this.nextSeqNum;
            this.nextSeqNum += 1;
            let messageBuilder = new Array();
            messageBuilder.push("<?xml version=\"1.0\" ?>");
            messageBuilder.push("<sixml:Request Function=\"Activate\" FunctionGroup=\"Admin\" SequenceNumber=\"" + sequenceNumber + "\" xmlns:sixml=\"http://www.six-payment-services.com/\">");
            messageBuilder.push("<sixml:UsrId>" + this.userId + "</sixml:UsrId>");
            messageBuilder.push("</sixml:Request>");
            TerminalBackendSixml.logger.log(timapi.logging.Level.INFO, "Send message Admin/Activate " + messageBuilder.join("").length + " bytes");
            this.state = SocketState.activating;
            this.runningRequest = timapi.constants.RequestType.activate;
            this.sendMessage(messageBuilder.join(""));
        }
        purchase() {
            if (this.state !== SocketState.open) {
                return;
            }
            let sequenceNumber = this.nextSeqNum;
            this.nextSeqNum += 1;
            let messageBuilder = new Array();
            messageBuilder.push("<?xml version=\"1.0\" ?>");
            messageBuilder.push("<sixml:Request Function=\"Purchase\" FunctionGroup=\"FinTransaction\" SequenceNumber=\"" + sequenceNumber + "\" xmlns:sixml=\"http://www.six-payment-services.com/\">");
            messageBuilder.push("<sixml:UsrId>" + this.userId + "</sixml:UsrId>");
            messageBuilder.push("<sixml:Amount Currency=\"CHF\" Exponent=\"2\">" + this.transactionAmount + "</sixml:Amount>");
            messageBuilder.push("<sixml:TransactionData EcrSeqCounter=\"1\"/>");
            messageBuilder.push("</sixml:Request>");
            TerminalBackendSixml.logger.log(timapi.logging.Level.INFO, "Send message FinTransaction/Purchase " + messageBuilder.join("").length + " bytes");
            this.state = SocketState.transaction;
            this.runningRequest = { funcGroup: "FinTransaction", func: "Purchase", seqNum: sequenceNumber };
            this.sendMessage(messageBuilder.join(""));
        }
        deactivate() {
            if (this.state !== SocketState.open) {
                return;
            }
            let sequenceNumber = this.nextSeqNum;
            this.nextSeqNum += 1;
            let messageBuilder = new Array();
            messageBuilder.push("<?xml version=\"1.0\" ?>");
            messageBuilder.push("<sixml:Request Function=\"Deactivate\" FunctionGroup=\"Admin\" SequenceNumber=\"" + sequenceNumber + "\" xmlns:sixml=\"http://www.six-payment-services.com/\">");
            messageBuilder.push("</sixml:Request>");
            TerminalBackendSixml.logger.log(timapi.logging.Level.INFO, "Send message Admin/Deactivate " + messageBuilder.join("").length + " bytes");
            this.state = SocketState.deactivating;
            this.runningRequest = { funcGroup: "Admin", func: "Deactivate", seqNum: sequenceNumber };
            this.sendMessage(messageBuilder.join(""));
        }
        logout() {
            if (this.state !== SocketState.loggedIn) {
                return;
            }
            let sequenceNumber = this.nextSeqNum;
            this.nextSeqNum += 1;
            let messageBuilder = new Array();
            messageBuilder.push("<?xml version=\"1.0\" ?>");
            messageBuilder.push("<sixml:Request Function=\"Logout\" FunctionGroup=\"Admin\" SequenceNumber=\"" + sequenceNumber + "\" xmlns:sixml=\"http://www.six-payment-services.com/\">");
            messageBuilder.push("</sixml:Request>");
            TerminalBackendSixml.logger.log(timapi.logging.Level.INFO, "Send message Admin/Logout " + messageBuilder.join("").length + " bytes");
            this.state = SocketState.loggedOut;
            this.runningRequest = { funcGroup: "Admin", func: "Logout", seqNum: sequenceNumber };
            this.sendMessage(messageBuilder.join(""));
        }
    }
    TerminalBackendSixml.LOGGER_NAME = "TerminalBackendSixml";
    TerminalBackendSixml.CLASS_NAME = "TerminalBackendSixml";
    TerminalBackendSixml.logger = timapi.logging.Logger.getLogger(TerminalBackendSixml.LOGGER_NAME);
    timapi.TerminalBackendSixml = TerminalBackendSixml;
})(timapi || (timapi = {}));
var timapi;
(function (timapi) {
    class TerminalSettings {
        constructor() {
            this.$logDir = "";
            this.logRetainFileCount = 7;
            this.logFileCountPerArchive = 30;
            this.logRetainArchiveCount = 3;
            this.terminalId = "";
            this.$connectionMode = timapi.constants.ConnectionMode.broadcast;
            this.connectionIPString = "";
            this.connectionIPPort = 7784;
            this.broadcastInterface = "";
            this.$protocolType = timapi.constants.ProtocolType.sixml;
            this.integratorId = "0";
            this.guides = new Set();
            this.guides.add(timapi.constants.Guides.retail);
            this.manufacturerFlags = 0;
            this.autoConnect = false;
            this.autoLogin = false;
            this.fetchBrands = false;
            this.autoActivate = false;
            this.autoCommit = true;
            this.autoDeactivate = false;
            this.autoLogout = false;
            this.autoDisconnect = false;
            this.autoShiftManagement = true;
            this.autoShutterManagement = true;
            this.cardInsertionTimeout = 60;
            this.cardRemovalTimeout = 60;
            this.commitTimeout = 60;
            this.dcc = true;
            this.partialApproval = false;
            this.proceedTimeout = 60;
            this.tipAllowed = false;
            this.enableKeepAlive = true;
            this.useSaferPay = false;
            this.enabledHacks = new Set();
        }
        TerminalSettings(settings) {
            this.logDir = settings.logDir;
            this.logRetainFileCount = settings.logRetainFileCount;
            this.logFileCountPerArchive = settings.logFileCountPerArchive;
            this.logRetainArchiveCount = settings.logRetainArchiveCount;
            this.terminalId = settings.terminalId;
            this.connectionMode = settings.connectionMode;
            this.connectionIPString = settings.connectionIPString;
            this.connectionIPPort = settings.connectionIPPort;
            this.broadcastInterface = settings.broadcastInterface;
            this.protocolType = settings.protocolType;
            this.integratorId = settings.integratorId;
            this.guides = settings.guides;
            this.manufacturerFlags = settings.manufacturerFlags;
            this.autoConnect = settings.autoConnect;
            this.autoLogin = settings.autoLogin;
            this.fetchBrands = settings.fetchBrands;
            this.autoActivate = settings.autoActivate;
            this.autoCommit = settings.autoCommit;
            this.autoDeactivate = settings.autoDeactivate;
            this.autoLogout = settings.autoLogout;
            this.autoDisconnect = settings.autoDisconnect;
            this.autoShiftManagement = settings.autoShiftManagement;
            this.autoShutterManagement = settings.autoShutterManagement;
            this.cardInsertionTimeout = settings.cardInsertionTimeout;
            this.cardRemovalTimeout = settings.cardRemovalTimeout;
            this.commitTimeout = settings.commitTimeout;
            this.dcc = settings.dcc;
            this.partialApproval = settings.partialApproval;
            this.proceedTimeout = settings.proceedTimeout;
            this.tipAllowed = settings.tipAllowed;
            this.enableKeepAlive = settings.enableKeepAlive;
            this.enabledHacks = new Set(settings.enabledHacks);
        }
        get $logDir() {
            return this.logDir;
        }
        set $logDir(value) {
            this.logDir = value;
        }
        get $logRetainFileCount() {
            return this.logRetainFileCount;
        }
        set $logRetainFileCount(value) {
            this.logRetainFileCount = value;
        }
        get $logFileCountPerArchive() {
            return this.logFileCountPerArchive;
        }
        set $logFileCountPerArchive(value) {
            if (value < 0) {
                throw new Error("value must be >= 0");
            }
            this.logFileCountPerArchive = value;
        }
        get $logRetainArchiveCount() {
            return this.logRetainArchiveCount;
        }
        set $logRetainArchiveCount(value) {
            if (value < 0) {
                throw new Error("value must be >= 0");
            }
            this.logRetainArchiveCount = value;
        }
        get $terminalId() {
            return this.terminalId;
        }
        set $terminalId(value) {
            this.terminalId = value;
        }
        get $connectionMode() {
            return this.connectionMode;
        }
        set $connectionMode(value) {
            this.connectionMode = value;
        }
        get $connectionIPString() {
            return this.connectionIPString;
        }
        set $connectionIPString(value) {
            this.connectionIPString = value;
        }
        get $connectionIPPort() {
            return this.connectionIPPort;
        }
        set $connectionIPPort(value) {
            this.connectionIPPort = value;
        }
        get $broadcastInterface() {
            return this.broadcastInterface;
        }
        set $broadcastInterface(value) {
            this.broadcastInterface = value;
        }
        get $protocolType() {
            return this.protocolType;
        }
        set $protocolType(value) {
            this.protocolType = value;
        }
        get $integratorId() {
            return this.integratorId;
        }
        set $integratorId(value) {
            this.integratorId = value;
        }
        get $guides() {
            return this.guides;
        }
        set $guides(value) {
            if (!value.has(timapi.constants.Guides.retail)) {
                throw new Error("value should include retail");
            }
            this.guides = value;
        }
        get $manufacturerFlags() {
            return this.manufacturerFlags;
        }
        set $manufacturerFlags(value) {
            this.manufacturerFlags = value;
        }
        get $autoConnect() {
            return this.autoConnect;
        }
        set $autoConnect(value) {
            this.autoConnect = value;
        }
        get $autoLogin() {
            return this.autoLogin;
        }
        set $autoLogin(value) {
            this.autoLogin = value;
        }
        get $fetchBrands() {
            return this.fetchBrands;
        }
        set $fetchBrands(value) {
            this.fetchBrands = value;
        }
        get $autoActivate() {
            return this.autoActivate;
        }
        set $autoActivate(value) {
            this.autoActivate = value;
        }
        get $autoCommit() {
            return this.autoCommit;
        }
        set $autoCommit(value) {
            this.autoCommit = value;
        }
        get $autoDeactivate() {
            return this.autoDeactivate;
        }
        set $autoDeactivate(value) {
            this.autoDeactivate = value;
        }
        get $autoLogout() {
            return this.autoLogout;
        }
        set $autoLogout(value) {
            this.autoLogout = value;
        }
        get $autoDisconnect() {
            return this.autoDisconnect;
        }
        set $autoDisconnect(value) {
            this.autoDisconnect = value;
        }
        get $autoShiftManagement() {
            return this.autoShiftManagement;
        }
        set $autoShiftManagement(value) {
            this.autoShiftManagement = value;
        }
        get $autoShutterManagement() {
            return this.autoShutterManagement;
        }
        set $autoShutterManagement(value) {
            this.autoShutterManagement = value;
        }
        get $cardInsertionTimeout() {
            return this.cardInsertionTimeout;
        }
        set $cardInsertionTimeout(value) {
            if (value < 1) {
                throw new Error("value must be >= 1");
            }
            this.cardInsertionTimeout = value;
        }
        get $cardRemovalTimeout() {
            return this.cardRemovalTimeout;
        }
        set $cardRemovalTimeout(value) {
            if (value < 1) {
                throw new Error("value must be >= 1");
            }
            this.cardRemovalTimeout = value;
        }
        get $commitTimeout() {
            return this.commitTimeout;
        }
        set $commitTimeout(value) {
            if (value < 1) {
                throw new Error("value must be >= 1");
            }
            this.commitTimeout = value;
        }
        get $dcc() {
            return this.dcc;
        }
        set $dcc(value) {
            this.dcc = value;
        }
        get $partialApproval() {
            return this.partialApproval;
        }
        set $partialApproval(value) {
            this.partialApproval = value;
        }
        get $proceedTimeout() {
            return this.proceedTimeout;
        }
        set $proceedTimeout(value) {
            if (value < 1) {
                throw new Error("value must be >= 1");
            }
            this.proceedTimeout = value;
        }
        get $tipAllowed() {
            return this.tipAllowed;
        }
        set $tipAllowed(value) {
            this.tipAllowed = value;
        }
        get $enableKeepAlive() {
            return this.enableKeepAlive;
        }
        set $enableKeepAlive(value) {
            this.enableKeepAlive = value;
        }
        get $enabledHacks() {
            return this.enabledHacks;
        }
        loadConfigFile(filename) {
            return new Map();
        }
    }
    timapi.TerminalSettings = TerminalSettings;
})(timapi || (timapi = {}));
var timapi;
(function (timapi) {
    class TerminalSettingsImmutable {
        constructor(settings) {
            if (settings == undefined) {
                throw new Error("settings cannot be undefined or null");
            }
            this.logDir = settings.$logDir;
            this.logRetainFileCount = settings.$logRetainFileCount;
            this.logFileCountPerArchive = settings.$logFileCountPerArchive;
            this.logRetainArchiveCount = settings.$logRetainArchiveCount;
            this.terminalId = settings.$terminalId;
            this.connectionMode = settings.$connectionMode;
            this.connectionIPString = settings.$connectionIPString;
            this.connectionIPPort = settings.$connectionIPPort;
            this.broadcastInterface = settings.$broadcastInterface;
            this.protocolType = settings.$protocolType;
            this.integratorId = settings.$integratorId;
            this.guides = settings.$guides;
            this.manufacturerFlags = settings.$manufacturerFlags;
            this.autoConnect = settings.$autoConnect;
            this.autoLogin = settings.$autoLogin;
            this.fetchBrands = settings.$fetchBrands;
            this.autoActivate = settings.$autoActivate;
            this.autoCommit = settings.$autoCommit;
            this.autoDeactivate = settings.$autoDeactivate;
            this.autoLogout = settings.$autoLogout;
            this.autoDisconnect = settings.$autoDisconnect;
            this.autoShiftManagement = settings.$autoShiftManagement;
            this.autoShutterManagement = settings.$autoShutterManagement;
            this.cardInsertionTimeout = settings.$cardInsertionTimeout;
            this.cardRemovalTimeout = settings.$cardRemovalTimeout;
            this.commitTimeout = settings.$commitTimeout;
            this.dcc = settings.$dcc;
            this.partialApproval = settings.$partialApproval;
            this.proceedTimeout = settings.$proceedTimeout;
            this.tipAllowed = settings.$tipAllowed;
            this.enableKeepAlive = settings.$enableKeepAlive;
            this.enabledHacks = new Set(settings.$enabledHacks);
        }
        get $logDir() {
            return this.logDir;
        }
        get $logRetainFileCount() {
            return this.logRetainFileCount;
        }
        get $logFileCountPerArchive() {
            return this.logFileCountPerArchive;
        }
        get $logRetainArchiveCount() {
            return this.logRetainArchiveCount;
        }
        get $terminalId() {
            return this.terminalId;
        }
        get $connectionMode() {
            return this.connectionMode;
        }
        get $connectionIPString() {
            return this.connectionIPString;
        }
        get $connectionIPPort() {
            return this.connectionIPPort;
        }
        get $broadcastInterface() {
            return this.broadcastInterface;
        }
        get $protocolType() {
            return this.protocolType;
        }
        get $integratorId() {
            return this.integratorId;
        }
        get $guides() {
            return this.guides;
        }
        get $manufacturerFlags() {
            return this.manufacturerFlags;
        }
        get $autoConnect() {
            return this.autoConnect;
        }
        get $autoLogin() {
            return this.autoLogin;
        }
        get $fetchBrands() {
            return this.fetchBrands;
        }
        get $autoActivate() {
            return this.autoActivate;
        }
        get $autoCommit() {
            return this.autoCommit;
        }
        get $autoDeactivate() {
            return this.autoDeactivate;
        }
        get $autoLogout() {
            return this.autoLogout;
        }
        get $autoDisconnect() {
            return this.autoDisconnect;
        }
        get $autoShiftManagement() {
            return this.autoShiftManagement;
        }
        get $autoShutterManagement() {
            return this.autoShutterManagement;
        }
        get $cardInsertionTimeout() {
            return this.cardInsertionTimeout;
        }
        get $cardRemovalTimeout() {
            return this.cardRemovalTimeout;
        }
        get $commitTimeout() {
            return this.commitTimeout;
        }
        get $dcc() {
            return this.dcc;
        }
        get $partialApproval() {
            return this.partialApproval;
        }
        get $proceedTimeout() {
            return this.proceedTimeout;
        }
        get $tipAllowed() {
            return this.tipAllowed;
        }
        get $enableKeepAlive() {
            return this.enableKeepAlive;
        }
        get $enabledHacks() {
            return this.enabledHacks;
        }
    }
    timapi.TerminalSettingsImmutable = TerminalSettingsImmutable;
})(timapi || (timapi = {}));
var timapi;
(function (timapi) {
    class TerminalStatus {
        constructor($displayContent = new Array(), $connectionStatus, $managementStatus, $cardReaderStatus, $transactionStatus, $sleepModeStatus, $receiptInformation, $cardData, $swUpdateAvailable) {
            this.displayContent = $displayContent.slice();
            this.connectionStatus = $connectionStatus;
            this.managementStatus = $managementStatus;
            this.cardReaderStatus = $cardReaderStatus;
            this.transactionStatus = $transactionStatus;
            this.sleepModeStatus = $sleepModeStatus;
            this.receiptInformation = $receiptInformation;
            this.cardData = $cardData;
            this.swUpdateAvailable = $swUpdateAvailable;
        }
        get $displayContent() {
            return this.displayContent;
        }
        set $displayContent(value) {
            this.displayContent = value;
        }
        get $connectionStatus() {
            return this.connectionStatus;
        }
        get $managementStatus() {
            return this.managementStatus;
        }
        get $cardReaderStatus() {
            return this.cardReaderStatus;
        }
        get $transactionStatus() {
            return this.transactionStatus;
        }
        get $sleepModeStatus() {
            return this.sleepModeStatus;
        }
        get $receiptInformation() {
            return this.receiptInformation;
        }
        get $cardData() {
            return this.cardData;
        }
        get $swUpdateAvailable() {
            return this.swUpdateAvailable;
        }
    }
    timapi.TerminalStatus = TerminalStatus;
})(timapi || (timapi = {}));
var timapi;
(function (timapi) {
    class TimEvent {
        constructor($terminal, $exception, $requestType) {
            this.terminal = $terminal;
            this.exception = $exception;
            this.requestType = $requestType;
        }
        get $terminal() {
            return this.terminal;
        }
        get $exception() {
            return this.exception;
        }
        get $requestType() {
            return this.requestType;
        }
    }
    timapi.TimEvent = TimEvent;
})(timapi || (timapi = {}));
var timapi;
(function (timapi) {
    class TimException extends Error {
        constructor($resultCode, $errorMessage, $nativeError, $ppInfo, $additionalErrorInfo = new Map(), $printData) {
            super();
            this.resultCode = $resultCode;
            this.additionalErrorInfo = new Map();
            this.errorMessage = $errorMessage;
            this.nativeError = $nativeError;
            this.ppInfo = $ppInfo;
            this.additionalErrorInfo = $additionalErrorInfo;
            this.printData = $printData;
        }
        getLocalizedMessage() {
            return this.errorMessage;
        }
        get $errorMessage() {
            return this.errorMessage;
        }
        get $resultCode() {
            return this.resultCode;
        }
        getErrorMessage() {
            return this.errorMessage;
        }
        get $nativeError() {
            return this.nativeError;
        }
        get $ppInfo() {
            return this.ppInfo;
        }
        get $additionalErrorInfo() {
            return this.additionalErrorInfo;
        }
        get $printData() {
            return this.printData;
        }
    }
    timapi.TimException = TimException;
})(timapi || (timapi = {}));
var timapi;
(function (timapi) {
    class Total {
        constructor($count, $amountSum, $trxDetails) {
            this.count = $count;
            this.amountSum = $amountSum;
            this.trxDetails = $trxDetails.slice();
        }
        get $count() {
            return this.count;
        }
        get $amountSum() {
            return this.amountSum;
        }
        get $trxDetails() {
            return this.trxDetails;
        }
    }
    timapi.Total = Total;
})(timapi || (timapi = {}));
var timapi;
(function (timapi) {
    class TransactionData {
        constructor(data) {
            if (data == undefined) {
                this.dccAllowed = undefined;
                this.trxOriginalDate = undefined;
                this.ecrSeqCounter = undefined;
                this.partialApprovalAllowed = undefined;
                this.transRef = undefined;
                this.transSeq = undefined;
                this.cardRef = undefined;
                this.acqId = undefined;
                this.acqTransRef = undefined;
                this.trmTransRef = undefined;
                this.tipAllowed = undefined;
                this.phoneAuthCode = undefined;
            }
            else {
                this.dccAllowed = data.dccAllowed;
                this.trxOriginalDate = data.trxOriginalDate;
                this.ecrSeqCounter = data.ecrSeqCounter;
                this.transRef = data.transRef;
                this.transSeq = data.transSeq;
                this.cardRef = data.cardRef;
                this.acqId = data.acqId;
                this.acqTransRef = data.acqTransRef;
                this.trmTransRef = data.trmTransRef;
                this.tipAllowed = data.tipAllowed;
                this.phoneAuthCode = data.phoneAuthCode;
            }
        }
        get $dccAllowed() {
            return this.dccAllowed;
        }
        set $dccAllowed(value) {
            this.dccAllowed = value;
        }
        get $trxOriginalDate() {
            return this.trxOriginalDate;
        }
        set $trxOriginalDate(value) {
            this.trxOriginalDate = value;
        }
        get $ecrSeqCounter() {
            return this.ecrSeqCounter;
        }
        set $ecrSeqCounter(value) {
            this.ecrSeqCounter = value;
        }
        get $partialApprovalAllowed() {
            return this.partialApprovalAllowed;
        }
        set $partialApprovalAllowed(value) {
            this.partialApprovalAllowed = value;
        }
        get $transRef() {
            return this.transRef;
        }
        set $transRef(value) {
            this.transRef = value;
        }
        get $transSeq() {
            return this.transSeq;
        }
        set $transSeq(value) {
            this.transSeq = value;
        }
        get $cardRef() {
            return this.cardRef;
        }
        set $cardRef(value) {
            this.cardRef = value;
        }
        get $acqId() {
            return this.acqId;
        }
        set $acqId(value) {
            this.acqId = value;
        }
        get $acqTransRef() {
            return this.acqTransRef;
        }
        set $acqTransRef(value) {
            this.acqTransRef = value;
        }
        get $trmTransRef() {
            return this.trmTransRef;
        }
        set $trmTransRef(value) {
            this.trmTransRef = value;
        }
        get $tipAllowed() {
            return this.tipAllowed;
        }
        set $tipAllowed(value) {
            this.tipAllowed = value;
        }
        get $phoneAuthCode() {
            return this.phoneAuthCode;
        }
        set $phoneAuthCode(value) {
            this.phoneAuthCode = value;
        }
        get $language() {
            return this.language;
        }
        set $language(value) {
            this.language = value;
        }
    }
    timapi.TransactionData = TransactionData;
})(timapi || (timapi = {}));
var timapi;
(function (timapi) {
    class TransactionInformation {
        constructor($posEntryMode, $cvm, $merchantAction, $authCode, $timeStamp, $transRef, $transSeq, $acqId, $signatureInformation, $trmTransRef, $acqTransRef) {
            this.posEntryMode = $posEntryMode;
            this.cvm = $cvm;
            this.merchantAction = $merchantAction;
            this.authCode = $authCode;
            this.timeStamp = $timeStamp;
            this.transRef = $transRef;
            this.transSeq = $transSeq;
            this.acqId = $acqId;
            this.signatureInformation = $signatureInformation;
            this.trmTransRef = $trmTransRef;
            this.acqTransRef = $acqTransRef;
        }
        get $posEntryMode() {
            return this.posEntryMode;
        }
        get $cvm() {
            return this.cvm;
        }
        get $merchantAction() {
            return this.merchantAction;
        }
        get $authCode() {
            return this.authCode;
        }
        get $timeStamp() {
            return this.timeStamp;
        }
        get $transRef() {
            return this.transRef;
        }
        get $transSeq() {
            return this.transSeq;
        }
        get $acqId() {
            return this.acqId;
        }
        get $signatureInformation() {
            return this.signatureInformation;
        }
        get $trmTransRef() {
            return this.trmTransRef;
        }
        get $acqTransRef() {
            return this.acqTransRef;
        }
    }
    timapi.TransactionInformation = TransactionInformation;
})(timapi || (timapi = {}));
var timapi;
(function (timapi) {
    class TransactionRequest {
        constructor(request) {
            if (request !== undefined) {
                this.userId = request.userId;
                this.amount = request.amount;
                this.transactionData = new timapi.TransactionData(request.transactionData);
                this.merchantOptions = request.merchantOptions.slice();
                this.tipAmount = request.tipAmount;
                if (request.basket != undefined) {
                    this.basket = request.basket.slice();
                }
                this.additionalInfo = request.additionalInfo;
                this.amountOther = request.amountOther;
            }
            else {
                this.merchantOptions = new Array();
                this.additionalInfo = new Map();
                this.basket = undefined;
            }
        }
        get $userId() {
            return this.userId;
        }
        set $userId(value) {
            this.userId = value;
        }
        get $amount() {
            return this.amount;
        }
        set $amount(value) {
            this.amount = value;
        }
        get $transactionData() {
            return this.transactionData;
        }
        set $transactionData(value) {
            this.transactionData = value;
        }
        get $merchantOptions() {
            return this.merchantOptions;
        }
        set $merchantOptions(value) {
            this.merchantOptions = value;
        }
        get $additionalInfo() {
            return this.additionalInfo;
        }
        set $additionalInfo(value) {
            this.additionalInfo = value;
        }
        set $basket(value) {
            this.basket = value;
        }
        get $basket() {
            return this.basket;
        }
        get $tipAmount() {
            return this.tipAmount;
        }
        set $tipAmount(value) {
            this.tipAmount = value;
        }
        get $amountOther() {
            return this.amountOther;
        }
        set $amountOther(value) {
            this.amountOther = value;
        }
    }
    timapi.TransactionRequest = TransactionRequest;
})(timapi || (timapi = {}));
var timapi;
(function (timapi) {
    class TransactionResponse {
        constructor($transactionType, $amount, $amountDue, $amountDcc, $amountSaldo, $transactionInformation, $dccDisclaimer, $cardData, $printData, $tipAmount, $additionalInfo, $basket) {
            this.transactionType = $transactionType;
            this.amount = $amount;
            this.amountDue = $amountDue;
            this.amountDcc = $amountDcc;
            this.amountSaldo = $amountSaldo;
            this.transactionInformation = $transactionInformation;
            this.dccDisclaimer = $dccDisclaimer;
            this.cardData = $cardData;
            this.printData = $printData;
            this.tipAmount = $tipAmount;
            this.additionalInfo = $additionalInfo;
            if ($basket != undefined) {
                this.basket = $basket.slice();
            }
        }
        get $transactionType() {
            return this.transactionType;
        }
        get $amount() {
            return this.amount;
        }
        set $amount(value) {
            this.amount = value;
        }
        get $amountDue() {
            return this.amountDue;
        }
        get $amountDcc() {
            return this.amountDcc;
        }
        get $amountSaldo() {
            return this.amountSaldo;
        }
        get $transactionInformation() {
            return this.transactionInformation;
        }
        get $dccDisclaimer() {
            return this.dccDisclaimer;
        }
        get $cardData() {
            return this.cardData;
        }
        get $printData() {
            return this.printData;
        }
        get $tipAmount() {
            return this.tipAmount;
        }
        get $additionalInfo() {
            return this.additionalInfo;
        }
        get $basket() {
            if (this.basket != undefined) {
                return this.basket.slice();
            }
            return undefined;
        }
    }
    timapi.TransactionResponse = TransactionResponse;
})(timapi || (timapi = {}));
var timapi;
(function (timapi) {
    class TrxDetail {
        constructor($dccFlag, $transactionType, $count, $amountSum) {
            this.dccFlag = $dccFlag;
            this.transactionType = $transactionType;
            this.count = $count;
            this.amountSum = $amountSum;
        }
        get $dccFlag() {
            return this.dccFlag;
        }
        get $transactionType() {
            return this.transactionType;
        }
        get $count() {
            return this.count;
        }
        get $amountSum() {
            return this.amountSum;
        }
    }
    timapi.TrxDetail = TrxDetail;
})(timapi || (timapi = {}));
timapi.constants.AdjustmentResult = {
    ok: 0,
    failRequestToLate: 1,
    failAmountToHigh: 2
};
timapi.constants.CardReader = {
    icc: 0,
    cl: 1,
    ms: 2
};
timapi.constants.CouponRejectionReason = {
    alreadyRedeemed: 0,
    articleDelisted: 1,
    campaignExpired: 2,
    campaignCancelled: 3,
    other: 4
};
timapi.constants.NgvMode = {
    mandatory: 0,
    allowedWithFallback: 1,
    notAllowed: 2
};
timapi.constants.ResourceParameterType = {
    codeCheckType: 0,
    codeCheckKeyId: 1,
    codeCheckData: 2,
    regularDataQueryType: 3,
    regularData: 4,
    petrolCardData1: 5,
    petrolCardData2: 6,
    petrolCardData3: 7
};
timapi.constants.ResponseType = {
    positive: 0,
    negative: 1,
    cardRemoval: 2,
    timeout: 3
};
var timapi;
(function (timapi) {
    var utils;
    (function (utils) {
        var Color;
        (function (Color_1) {
            class Color {
                constructor($colorCode) {
                    this.colorCode = $colorCode;
                }
                get $blue() {
                    return this.blue;
                }
                get $green() {
                    return this.green;
                }
                get $red() {
                    return this.red;
                }
                get $colorCode() {
                    return this.colorCode;
                }
            }
            Color.black = new Color("ffffff");
            Color.white = new Color("000000");
            Color_1.Color = Color;
        })(Color = utils.Color || (utils.Color = {}));
    })(utils = timapi.utils || (timapi.utils = {}));
})(timapi || (timapi = {}));
var timapi;
(function (timapi) {
    var utils;
    (function (utils) {
        class SixmlParser {
            static parseSIXMLFromUint8Array(data) {
                let message = utils.StringHelper.fromUInt8Array(data);
                let parser = new DOMParser();
                let xmlNode = parser.parseFromString(message, "application/xml");
                if (xmlNode == undefined) {
                    throw Error("invalid xml");
                }
                let rootNode = xmlNode.children[0];
                let node = SixmlParser.constructSixmlNode(rootNode);
                return node;
            }
            static constructSixmlNode(basicNode) {
                let node = new timapi.protocol.XmlNode(basicNode.nodeName);
                if (basicNode.attributes != undefined) {
                    let attrLentgh = basicNode.attributes.length;
                    if (attrLentgh != undefined) {
                        for (let i = 0; i < attrLentgh; i++) {
                            let entry = basicNode.attributes.item(i);
                            let value = entry.value;
                            let key = entry.name;
                            node.attributes.set(key, value);
                        }
                    }
                }
                if (basicNode.parentNode != undefined && basicNode.parentNode.parentNode != undefined) {
                    node.textContent = basicNode.textContent;
                }
                basicNode.childNodes.forEach(function (child) {
                    if (child.hasChildNodes) {
                        let sixmlChild = SixmlParser.constructSixmlNode(child);
                        node.children.push(sixmlChild);
                        return sixmlChild;
                    }
                });
                return node;
            }
        }
        utils.SixmlParser = SixmlParser;
    })(utils = timapi.utils || (timapi.utils = {}));
})(timapi || (timapi = {}));
var timapi;
(function (timapi) {
    var utils;
    (function (utils) {
        class StringEncoder {
            static toArrayBuffer(input) {
                let buffer = new ArrayBuffer(input.length);
                let bufView = new Uint8Array(buffer);
                for (let i = 0, strLen = input.length; i < strLen; i++) {
                    bufView[i] = input.charCodeAt(i);
                }
                return buffer;
            }
        }
        utils.StringEncoder = StringEncoder;
    })(utils = timapi.utils || (timapi.utils = {}));
})(timapi || (timapi = {}));
var timapi;
(function (timapi) {
    var utils;
    (function (utils) {
        class StringHelper {
            static fromUInt8Array(input) {
                let out = "";
                let i = 0;
                let len = input.length;
                let c;
                let char2;
                let char3;
                while (i < len) {
                    c = input[i++];
                    switch (c >> 4) {
                        case 0:
                        case 1:
                        case 2:
                        case 3:
                        case 4:
                        case 5:
                        case 6:
                        case 7:
                            out += String.fromCharCode(c);
                            break;
                        case 12:
                        case 13:
                            char2 = input[i++];
                            out += String.fromCharCode(((c & 0x1F) << 6) | (char2 & 0x3F));
                            break;
                        case 14:
                            char2 = input[i++];
                            char3 = input[i++];
                            out += String.fromCharCode(((c & 0x0F) << 12) |
                                ((char2 & 0x3F) << 6) |
                                ((char3 & 0x3F) << 0));
                            break;
                    }
                }
                return out;
            }
            static makeString(input) {
                let strRepresentation = "";
                if (Array.isArray(input)) {
                    strRepresentation = "[ ";
                    for (var i = 0; i < input.length; i++) {
                        strRepresentation += this.makeString(input[i]);
                    }
                    strRepresentation += " ]";
                }
                else if (input.toString() === "[object Object]") {
                    let keys = Object.getOwnPropertyNames(input);
                    if (keys.length == 0) {
                        return "0";
                    }
                    strRepresentation = "{ ";
                    let lastIndex = keys.length - 1;
                    for (let idx = 0; idx < keys.length; idx++) {
                        let key = keys[idx];
                        strRepresentation += key + ":" + this.makeString(input[key]);
                        if (idx != lastIndex) {
                            strRepresentation += ", ";
                        }
                    }
                    strRepresentation += " }";
                }
                else if (input.toString() === "[object Map]") {
                    strRepresentation = "{ ";
                    for (let [key, value] of input) {
                        strRepresentation += key + "=\"" + this.makeString(value) + "\" ";
                    }
                    strRepresentation += " }";
                }
                else {
                    strRepresentation = input.toString();
                }
                return strRepresentation;
            }
        }
        utils.StringHelper = StringHelper;
    })(utils = timapi.utils || (timapi.utils = {}));
})(timapi || (timapi = {}));
var timapi;
(function (timapi) {
    var constants;
    (function (constants) {
        let ConnectionMode;
        (function (ConnectionMode) {
            ConnectionMode[ConnectionMode["broadcast"] = 0] = "broadcast";
            ConnectionMode[ConnectionMode["onFixIp"] = 1] = "onFixIp";
        })(ConnectionMode = constants.ConnectionMode || (constants.ConnectionMode = {}));
    })(constants = timapi.constants || (timapi.constants = {}));
})(timapi || (timapi = {}));
var timapi;
(function (timapi) {
    class CustomReceiptFormatter {
        setLineFormatsCardholder(lines) {
            this.lineFormatsCardholder = [];
            for (let line of lines) {
                this.lineFormatsCardholder.push(line);
            }
        }
        setLineFormatsMerchant(lines) {
            this.lineFormatsMerchant = [];
            for (let line of lines) {
                this.lineFormatsMerchant.push(line);
            }
        }
        setLineFormatsSaldo(lines) {
            this.lineFormatsSaldo = [];
            for (let line of lines) {
                this.lineFormatsSaldo.push(line);
            }
        }
        formatReceipt(terminal, receiptItems) {
            let itemsCardholder = this.filterRecipient(receiptItems, timapi.constants.Recipient.cardholder);
            let itemsMerchant = this.filterRecipient(receiptItems, timapi.constants.Recipient.merchant);
            let itemsBoth = this.filterRecipient(receiptItems, timapi.constants.Recipient.both);
            let receipts = new Array();
            let receiptType = receiptItems.$receiptType();
            if (itemsBoth.length > 0) {
                if (itemsCardholder.length > 0) {
                    let builder = new timapi.utils.StringBuilder();
                    this.formatReceiptText(builder, terminal, this.getPrintOption(terminal, timapi.constants.Recipient.cardholder)
                        .$printWidth, this.getPrintOption(terminal, timapi.constants.Recipient.cardholder)
                        .$printFlags, itemsCardholder, receiptType, this.lineFormatsCardholder);
                    let text = timapi.utils.StringHelper.makeString(builder);
                    if (text.length > 0) {
                        receipts.push(new timapi.Receipt(timapi.constants.Recipient.cardholder, text));
                    }
                }
                if (itemsMerchant.length > 0) {
                    let builder = new timapi.utils.StringBuilder();
                    this.formatReceiptText(builder, terminal, this.getPrintOption(terminal, timapi.constants.Recipient.merchant)
                        .$printWidth, this.getPrintOption(terminal, timapi.constants.Recipient.merchant)
                        .$printFlags, itemsMerchant, receiptType, this.lineFormatsMerchant);
                    let text = timapi.utils.StringHelper.makeString(builder);
                    if (text.length > 0) {
                        receipts.push(new timapi.Receipt(timapi.constants.Recipient.merchant, text));
                    }
                }
            }
            else {
                let builderC = new timapi.utils.StringBuilder();
                this.formatReceiptText(builderC, terminal, this.getPrintOption(terminal, timapi.constants.Recipient.cardholder)
                    .$printWidth, this.getPrintOption(terminal, timapi.constants.Recipient.cardholder)
                    .$printFlags, itemsCardholder, receiptType, this.lineFormatsCardholder);
                let textC = timapi.utils.StringHelper.makeString(builderC);
                if (textC.length > 0) {
                    receipts.push(new timapi.Receipt(timapi.constants.Recipient.cardholder, textC));
                }
                let builderM = new timapi.utils.StringBuilder();
                this.formatReceiptText(builderM, terminal, this.getPrintOption(terminal, timapi.constants.Recipient.merchant)
                    .$printWidth, this.getPrintOption(terminal, timapi.constants.Recipient.merchant)
                    .$printFlags, itemsMerchant, receiptType, this.lineFormatsMerchant);
                let textM = timapi.utils.StringHelper.makeString(builderM);
                if (textM.length > 0) {
                    receipts.push(new timapi.Receipt(timapi.constants.Recipient.merchant, textM));
                }
            }
            return receipts;
        }
        formatReceiptText(builder, terminal, width, flags, receiptItems, receiptType, lineFormats) {
            let configData = terminal.getConfigData();
            if (configData !== undefined &&
                !flags.has(timapi.constants.PrintFlag.suppressHeader)) {
                for (let headerLine of configData.$receiptHeader) {
                    this.formatReceiptAddLine(builder, width, headerLine, "", "", " ");
                }
            }
            for (let lineFormat of lineFormats) {
                this.formatReceiptAddLineWithTerminal(builder, terminal, width, flags, lineFormat, receiptItems, receiptType);
            }
            if (this.hasReceiptItemType(receiptItems, timapi.constants.ReceiptItemType.amountSaldo)) {
                for (let lineFormat of this.lineFormatsSaldo) {
                    this.formatReceiptAddLineWithTerminal(builder, terminal, width, flags, lineFormat, receiptItems, receiptType);
                }
            }
        }
        hasReceiptItemType(receiptItems, type) {
            for (let receiptItem of receiptItems) {
                if (receiptItem.$receiptItemType === type) {
                    return true;
                }
            }
            return false;
        }
        filterRecipient(receiptItems, recipient) {
            let filtered = new Array();
            for (let receiptItem of receiptItems.$receiptItem) {
                if (receiptItem.$recipient === recipient) {
                    filtered.push(receiptItem);
                }
            }
            return filtered;
        }
        getPrintOption(terminal, recipient) {
            for (let printOption of terminal.$printOptions) {
                if (printOption.$recipient === recipient) {
                    return printOption;
                }
            }
            return undefined;
        }
        formatReceiptAddLineWithTerminal(builder, terminal, width, flags, lineFormat, receiptItems, receiptType) {
            let left = "";
            let center = "";
            let right = "";
            for (let element of lineFormat.$elements) {
                let text = "";
                switch (element.$type) {
                    case timapi.TextType.fieldAccPer:
                        text = this.resolveField(receiptItems, timapi.constants.ReceiptItemType.accPer);
                        break;
                    case timapi.TextType.fieldAcqId:
                        text = this.resolveField(receiptItems, timapi.constants.ReceiptItemType.acqId);
                        break;
                    case timapi.TextType.fieldActId:
                        text = this.resolveField(receiptItems, timapi.constants.ReceiptItemType.actId);
                        break;
                    case timapi.TextType.fieldAid:
                        text = this.resolveField(receiptItems, timapi.constants.ReceiptItemType.aid);
                        break;
                    case timapi.TextType.fieldAmount:
                        text = this.resolveField(receiptItems, timapi.constants.ReceiptItemType.amount);
                        break;
                    case timapi.TextType.fieldAmountDcc:
                        text = this.resolveField(receiptItems, timapi.constants.ReceiptItemType.amountDcc);
                        break;
                    case timapi.TextType.fieldAmountOther:
                        text = this.resolveField(receiptItems, timapi.constants.ReceiptItemType.amountOther);
                        break;
                    case timapi.TextType.fieldAmountSaldo:
                        text = this.resolveField(receiptItems, timapi.constants.ReceiptItemType.amountSaldo);
                        break;
                    case timapi.TextType.fieldAuthCode:
                        text = this.resolveField(receiptItems, timapi.constants.ReceiptItemType.authCode);
                        break;
                    case timapi.TextType.fieldBrandName:
                        text = this.resolveField(receiptItems, timapi.constants.ReceiptItemType.brandName);
                        break;
                    case timapi.TextType.fieldCardExpiryDate:
                        text = this.resolveField(receiptItems, timapi.constants.ReceiptItemType.cardExpiryDate);
                        break;
                    case timapi.TextType.fieldCardNumberEnc:
                        text = this.resolveField(receiptItems, timapi.constants.ReceiptItemType.cardNumberEnc);
                        break;
                    case timapi.TextType.fieldCardNumberPrintableCardholder:
                        text = this.resolveField(receiptItems, timapi.constants.ReceiptItemType.cardNumberPrintableCardholder);
                        break;
                    case timapi.TextType.fieldCardNumberPrintableMerchant:
                        text = this.resolveField(receiptItems, timapi.constants.ReceiptItemType.cardNumberPrintableMerchant);
                        break;
                    case timapi.TextType.fieldCurrency:
                        text = this.resolveField(receiptItems, timapi.constants.ReceiptItemType.currency);
                        break;
                    case timapi.TextType.fieldCurrencyDcc:
                        text = this.resolveField(receiptItems, timapi.constants.ReceiptItemType.currencyDcc);
                        break;
                    case timapi.TextType.fieldDccDisclaimer:
                        text = this.resolveField(receiptItems, timapi.constants.ReceiptItemType.dccDisclaimer);
                        break;
                    case timapi.TextType.fieldDisclaimer:
                        text = this.resolveField(receiptItems, timapi.constants.ReceiptItemType.disclaimer);
                        break;
                    case timapi.TextType.fieldExponent:
                        text = this.resolveField(receiptItems, timapi.constants.ReceiptItemType.exponent);
                        break;
                    case timapi.TextType.fieldExponentDcc:
                        text = this.resolveField(receiptItems, timapi.constants.ReceiptItemType.exponentDcc);
                        break;
                    case timapi.TextType.fieldMarkupDcc:
                        text = this.resolveField(receiptItems, timapi.constants.ReceiptItemType.markupDcc);
                        break;
                    case timapi.TextType.fieldMarkupExponentDcc:
                        text = this.resolveField(receiptItems, timapi.constants.ReceiptItemType.markupExponentDcc);
                        break;
                    case timapi.TextType.fieldPosEntryMode:
                        text = this.resolveField(receiptItems, timapi.constants.ReceiptItemType.posEntryMode);
                        break;
                    case timapi.TextType.fieldRateDcc:
                        text = this.resolveField(receiptItems, timapi.constants.ReceiptItemType.rateDcc);
                        break;
                    case timapi.TextType.fieldRateExponentDcc:
                        text = this.resolveField(receiptItems, timapi.constants.ReceiptItemType.rateExponentDcc);
                        break;
                    case timapi.TextType.fieldTimeStampDate:
                        text = this.resolveField(receiptItems, timapi.constants.ReceiptItemType.timeStampDate);
                        break;
                    case timapi.TextType.fieldTimeStampTime:
                        text = this.resolveField(receiptItems, timapi.constants.ReceiptItemType.timeStampTime);
                        break;
                    case timapi.TextType.fieldTrmId:
                        text = this.resolveField(receiptItems, timapi.constants.ReceiptItemType.trmId);
                        break;
                    case timapi.TextType.fieldTrxRefNum:
                        text = this.resolveField(receiptItems, timapi.constants.ReceiptItemType.trxRefNum);
                        break;
                    case timapi.TextType.fieldTrxSeqCnt:
                        text = this.resolveField(receiptItems, timapi.constants.ReceiptItemType.trxSeqCnt);
                        break;
                    case timapi.TextType.fieldEctSeqCnt:
                        text = this.resolveField(receiptItems, timapi.constants.ReceiptItemType.ecrSeqCounter);
                        break;
                    case timapi.TextType.posId:
                        text = terminal.$posId;
                        break;
                    case timapi.TextType.text:
                        text = element.$text;
                        break;
                    case timapi.TextType.transactionType:
                        switch (receiptType) {
                            case timapi.constants.ReceiptType.credit:
                                text = "Gutschrift";
                                break;
                            case timapi.constants.ReceiptType.purchase:
                                text = "Buchung";
                                break;
                            case timapi.constants.ReceiptType.reversal:
                                text = "Storno";
                                break;
                            default:
                                break;
                        }
                        break;
                    case timapi.TextType.userId:
                        text = "" + terminal.$userId;
                        break;
                    default:
                        break;
                }
                if (text == undefined) {
                    continue;
                }
                switch (element.$alignment) {
                    case timapi.TextAlignment.center:
                        center = center + text;
                        break;
                    case timapi.TextAlignment.left:
                        left = left + text;
                        break;
                    case timapi.TextAlignment.right:
                        right = right + text;
                        break;
                    default:
                        break;
                }
            }
            switch (lineFormat.$condition) {
                case timapi.Condition.ECR_INFO:
                    if (flags.has(timapi.constants.PrintFlag.suppressEcrInfo)) {
                        return;
                    }
                    break;
                case timapi.Condition.EFT_INFO:
                    if (flags.has(timapi.constants.PrintFlag.suppressEftInfo)) {
                        return;
                    }
                    break;
                case timapi.Condition.SIGNATURE:
                    if (flags.has(timapi.constants.PrintFlag.suppressSignature)) {
                        return;
                    }
                    break;
                default:
                    break;
            }
            this.formatReceiptAddLine(builder, width, left, center, right, lineFormat.$padding);
        }
        resolveField(receiptItems, field) {
            for (let receiptItem of receiptItems) {
                if (receiptItem.$receiptItemType === field) {
                    if (receiptItem.$value == undefined || receiptItem.$value.length === 0) {
                        return "NA";
                    }
                    else {
                        return receiptItem.$value;
                    }
                }
            }
            return "NA";
        }
        formatReceiptAddLine(builder, width, left, center, right, paddingChar) {
            let lenLeft = left.length;
            let lenCenter = center.length;
            let lenRight = right.length;
            let paddingLeft = 0;
            let paddingRight = 0;
            if (lenLeft > 0 && lenCenter > 0) {
                paddingLeft = 1;
            }
            if (lenCenter > 0 && lenRight > 0) {
                paddingRight = 1;
            }
            if (lenLeft > 0 && lenCenter === 0 && lenRight > 0) {
                paddingLeft = 1;
            }
            let padding = width - lenLeft - lenCenter - lenRight - paddingLeft - paddingRight;
            if (padding > 0) {
                let split = padding / 2;
                paddingLeft += split;
                paddingRight += padding - split;
            }
            if (lenLeft > width && lenCenter === 0 && lenRight === 0) {
                while (left.length > width) {
                    builder.append(left.substring(0, width));
                    builder.append("\n");
                    left = left.substring(width);
                }
                builder.append(left);
                builder.append("\n");
                return;
            }
            builder.append(left);
            if (paddingLeft > 0) {
            }
            builder.append(center);
            if (paddingRight > 0) {
            }
            builder.append(right);
            builder.append("\n");
        }
    }
    timapi.CustomReceiptFormatter = CustomReceiptFormatter;
})(timapi || (timapi = {}));
var timapi;
(function (timapi) {
    class CompactReceiptFormatter extends timapi.CustomReceiptFormatter {
        CompactReceiptFormatter() {
            this.lines = new Array();
            this.lines.push(new timapi.LineFormat());
            this.elements = new Array();
            this.elements.push(new timapi.TextElement("Att-/ECR-Id/-Seq:", timapi.TextAlignment.left));
            this.elements.push(new timapi.TextElement(timapi.TextType.userId, timapi.TextAlignment.right));
            this.elements.push(new timapi.TextElement("/", timapi.TextAlignment.right));
            this.elements.push(new timapi.TextElement(timapi.TextType.posId, timapi.TextAlignment.right));
            this.elements.push(new timapi.TextElement("/", timapi.TextAlignment.right));
            this.elements.push(new timapi.TextElement(timapi.TextType.fieldEctSeqCnt, timapi.TextAlignment.right));
            this.lines.push(new timapi.LineFormat(this.elements));
            this.elements = new Array();
            this.elements.push(new timapi.TextElement("EFT Ref-No: ", timapi.TextAlignment.left));
            this.elements.push(new timapi.TextElement(timapi.TextType.fieldTrxSeqCnt, timapi.TextAlignment.right));
            this.lines.push(new timapi.LineFormat(this.elements));
            this.lines.push(new timapi.LineFormat());
            this.elements = new Array();
            this.elements.push(new timapi.TextElement(timapi.TextType.transactionType, timapi.TextAlignment.left));
            this.elements.push(new timapi.TextElement(timapi.TextType.fieldBrandName, timapi.TextAlignment.right));
            this.lines.push(new timapi.LineFormat(this.elements));
            this.elements = new Array();
            this.elements.push(new timapi.TextElement(timapi.TextType.fieldCardNumberPrintableMerchant, timapi.TextAlignment.left));
            this.elements.push(new timapi.TextElement(" ", timapi.TextAlignment.left));
            this.elements.push(new timapi.TextElement(timapi.TextType.fieldPosEntryMode, timapi.TextAlignment.left));
            this.elements.push(new timapi.TextElement("EXP:", timapi.TextAlignment.right));
            this.elements.push(new timapi.TextElement(timapi.TextType.fieldCardExpiryDate, timapi.TextAlignment.right));
            this.lines.push(new timapi.LineFormat(this.elements));
            this.lines.push(new timapi.LineFormat());
            this.elements = new Array();
            this.elements.push(new timapi.TextElement(timapi.TextType.fieldTimeStampDate, timapi.TextAlignment.left));
            this.elements.push(new timapi.TextElement(timapi.TextType.fieldTimeStampTime, timapi.TextAlignment.right));
            this.lines.push(new timapi.LineFormat(this.elements));
            this.elements = new Array();
            this.elements.push(new timapi.TextElement("Trm-/Act-Id:", timapi.TextAlignment.left));
            this.elements.push(new timapi.TextElement(timapi.TextType.fieldTrmId, timapi.TextAlignment.right));
            this.elements.push(new timapi.TextElement("/", timapi.TextAlignment.right));
            this.elements.push(new timapi.TextElement(timapi.TextType.fieldActId, timapi.TextAlignment.right));
            this.lines.push(new timapi.LineFormat(this.elements));
            this.elements = new Array();
            this.elements.push(new timapi.TextElement("AID: ", timapi.TextAlignment.left));
            this.elements.push(new timapi.TextElement(timapi.TextType.fieldAid, timapi.TextAlignment.right));
            this.lines.push(new timapi.LineFormat(this.elements));
            this.elements = new Array();
            this.elements.push(new timapi.TextElement("Seq/Ref/Aut:", timapi.TextAlignment.left));
            this.elements.push(new timapi.TextElement(timapi.TextType.fieldTrxSeqCnt, timapi.TextAlignment.right));
            this.elements.push(new timapi.TextElement("/", timapi.TextAlignment.right));
            this.elements.push(new timapi.TextElement(timapi.TextType.fieldTrxRefNum, timapi.TextAlignment.right));
            this.elements.push(new timapi.TextElement("/", timapi.TextAlignment.right));
            this.elements.push(new timapi.TextElement(timapi.TextType.fieldAuthCode, timapi.TextAlignment.right));
            this.lines.push(new timapi.LineFormat(this.elements));
            this.elements = new Array();
            this.elements.push(new timapi.TextElement("EPF: ", timapi.TextAlignment.left));
            this.elements.push(new timapi.TextElement(timapi.TextType.fieldCardNumberEnc, timapi.TextAlignment.right));
            this.lines.push(new timapi.LineFormat(this.elements));
            this.lines.push(new timapi.LineFormat());
            this.elements = new Array();
            this.elements.push(new timapi.TextElement("Total-EFT ", timapi.TextAlignment.left));
            this.elements.push(new timapi.TextElement(timapi.TextType.fieldCurrency, timapi.TextAlignment.left));
            this.elements.push(new timapi.TextElement(timapi.TextType.fieldAmount, timapi.TextAlignment.right));
            this.lines.push(new timapi.LineFormat(this.elements));
            this.lines.push(new timapi.LineFormat());
            this.lines.push(new timapi.LineFormat());
            this.setLineFormatsMerchant(this.lines);
            this.lines = new Array();
            this.lines.push(new timapi.LineFormat());
            this.elements = new Array();
            this.elements.push(new timapi.TextElement("Att-/ECR-Id/-Seq:", timapi.TextAlignment.left));
            this.elements.push(new timapi.TextElement(timapi.TextType.userId, timapi.TextAlignment.right));
            this.elements.push(new timapi.TextElement("/", timapi.TextAlignment.right));
            this.elements.push(new timapi.TextElement(timapi.TextType.posId, timapi.TextAlignment.right));
            this.elements.push(new timapi.TextElement("/", timapi.TextAlignment.right));
            this.elements.push(new timapi.TextElement(timapi.TextType.fieldEctSeqCnt, timapi.TextAlignment.right));
            this.lines.push(new timapi.LineFormat(this.elements));
            this.elements = new Array();
            this.elements.push(new timapi.TextElement("EFT Ref-No: ", timapi.TextAlignment.left));
            this.elements.push(new timapi.TextElement(timapi.TextType.fieldTrxSeqCnt, timapi.TextAlignment.right));
            this.lines.push(new timapi.LineFormat(this.elements));
            this.lines.push(new timapi.LineFormat());
            this.elements = new Array();
            this.elements.push(new timapi.TextElement(timapi.TextType.transactionType, timapi.TextAlignment.left));
            this.elements.push(new timapi.TextElement(timapi.TextType.fieldBrandName, timapi.TextAlignment.right));
            this.lines.push(new timapi.LineFormat(this.elements));
            this.elements = new Array();
            this.elements.push(new timapi.TextElement(timapi.TextType.fieldCardNumberPrintableCardholder, timapi.TextAlignment.left));
            this.lines.push(new timapi.LineFormat(this.elements));
            this.lines.push(new timapi.LineFormat());
            this.elements = new Array();
            this.elements.push(new timapi.TextElement(timapi.TextType.fieldTimeStampDate, timapi.TextAlignment.left));
            this.elements.push(new timapi.TextElement(timapi.TextType.fieldTimeStampTime, timapi.TextAlignment.right));
            this.lines.push(new timapi.LineFormat(this.elements));
            this.elements = new Array();
            this.elements.push(new timapi.TextElement("Trm-Id: ", timapi.TextAlignment.left));
            this.elements.push(new timapi.TextElement(timapi.TextType.fieldTrmId, timapi.TextAlignment.right));
            this.lines.push(new timapi.LineFormat(this.elements));
            this.elements = new Array();
            this.elements.push(new timapi.TextElement("Seq/Aut:", timapi.TextAlignment.left));
            this.elements.push(new timapi.TextElement(timapi.TextType.fieldTrxSeqCnt, timapi.TextAlignment.right));
            this.elements.push(new timapi.TextElement("/", timapi.TextAlignment.right));
            this.elements.push(new timapi.TextElement(timapi.TextType.fieldAuthCode, timapi.TextAlignment.right));
            this.lines.push(new timapi.LineFormat(this.elements));
            this.lines.push(new timapi.LineFormat());
            this.elements = new Array();
            this.elements.push(new timapi.TextElement("Total-EFT ", timapi.TextAlignment.left));
            this.elements.push(new timapi.TextElement(timapi.TextType.fieldCurrency, timapi.TextAlignment.left));
            this.elements.push(new timapi.TextElement(timapi.TextType.fieldAmount, timapi.TextAlignment.right));
            this.lines.push(new timapi.LineFormat(this.elements));
            this.lines.push(new timapi.LineFormat());
            this.lines.push(new timapi.LineFormat());
            this.setLineFormatsCardholder(this.lines);
            this.lines = new Array();
            this.lines.push(new timapi.LineFormat());
            this.elements = new Array();
            this.elements.push(new timapi.TextElement("Saldo ", timapi.TextAlignment.left));
            this.elements.push(new timapi.TextElement(timapi.TextType.fieldCurrency, timapi.TextAlignment.left));
            this.elements.push(new timapi.TextElement(timapi.TextType.fieldAmountSaldo, timapi.TextAlignment.right));
            this.lines.push(new timapi.LineFormat(this.elements));
            this.setLineFormatsSaldo(this.lines);
        }
    }
    timapi.CompactReceiptFormatter = CompactReceiptFormatter;
})(timapi || (timapi = {}));
var timapi;
(function (timapi) {
    class NormalReceiptFormatter extends timapi.CustomReceiptFormatter {
        constructor() {
            super();
            this.lines = new Array();
            this.lines.push(new timapi.LineFormat());
            this.elements = new Array();
            this.elements.push(new timapi.TextElement("Attendant-Id: ", timapi.TextAlignment.left));
            this.elements.push(new timapi.TextElement(timapi.TextType.userId, timapi.TextAlignment.right));
            this.lines.push(new timapi.LineFormat(this.elements));
            this.elements = new Array();
            this.elements.push(new timapi.TextElement("ECR-Id: ", timapi.TextAlignment.left));
            this.elements.push(new timapi.TextElement(timapi.TextType.posId, timapi.TextAlignment.right));
            this.lines.push(new timapi.LineFormat(timapi.Condition.ECR_INFO, this.elements));
            this.elements = new Array();
            this.elements.push(new timapi.TextElement("ECR-Seq: ", timapi.TextAlignment.left));
            this.elements.push(new timapi.TextElement(timapi.TextType.fieldEctSeqCnt, timapi.TextAlignment.right));
            this.lines.push(new timapi.LineFormat(timapi.Condition.ECR_INFO, this.elements));
            this.elements = new Array();
            this.elements.push(new timapi.TextElement("EFT Ref-No: ", timapi.TextAlignment.left));
            this.elements.push(new timapi.TextElement(timapi.TextType.fieldTrxSeqCnt, timapi.TextAlignment.right));
            this.lines.push(new timapi.LineFormat(timapi.Condition.EFT_INFO, this.elements));
            this.lines.push(new timapi.LineFormat());
            this.elements = new Array();
            this.elements.push(new timapi.TextElement(timapi.TextType.transactionType, timapi.TextAlignment.left));
            this.elements.push(new timapi.TextElement(timapi.TextType.fieldBrandName, timapi.TextAlignment.right));
            this.lines.push(new timapi.LineFormat(this.elements));
            this.elements = new Array();
            this.elements.push(new timapi.TextElement(timapi.TextType.fieldCardNumberPrintableMerchant, timapi.TextAlignment.left));
            this.elements.push(new timapi.TextElement(timapi.TextType.fieldPosEntryMode, timapi.TextAlignment.right));
            this.lines.push(new timapi.LineFormat(this.elements));
            this.elements = new Array();
            this.elements.push(new timapi.TextElement("Expiration Date: ", timapi.TextAlignment.left));
            this.elements.push(new timapi.TextElement(timapi.TextType.fieldCardExpiryDate, timapi.TextAlignment.right));
            this.lines.push(new timapi.LineFormat(this.elements));
            this.lines.push(new timapi.LineFormat());
            this.elements = new Array();
            this.elements.push(new timapi.TextElement(timapi.TextType.fieldTimeStampDate, timapi.TextAlignment.left));
            this.elements.push(new timapi.TextElement(timapi.TextType.fieldTimeStampTime, timapi.TextAlignment.right));
            this.lines.push(new timapi.LineFormat(this.elements));
            this.elements = new Array();
            this.elements.push(new timapi.TextElement("Trm-Id: ", timapi.TextAlignment.left));
            this.elements.push(new timapi.TextElement(timapi.TextType.fieldTrmId, timapi.TextAlignment.right));
            this.lines.push(new timapi.LineFormat(this.elements));
            this.elements = new Array();
            this.elements.push(new timapi.TextElement("Act-Id: ", timapi.TextAlignment.left));
            this.elements.push(new timapi.TextElement(timapi.TextType.fieldActId, timapi.TextAlignment.right));
            this.lines.push(new timapi.LineFormat(this.elements));
            this.elements = new Array();
            this.elements.push(new timapi.TextElement("AID: ", timapi.TextAlignment.left));
            this.elements.push(new timapi.TextElement(timapi.TextType.fieldAid, timapi.TextAlignment.right));
            this.lines.push(new timapi.LineFormat(this.elements));
            this.elements = new Array();
            this.elements.push(new timapi.TextElement("Trx. Seq-Cnt: ", timapi.TextAlignment.left));
            this.elements.push(new timapi.TextElement(timapi.TextType.fieldTrxSeqCnt, timapi.TextAlignment.right));
            this.lines.push(new timapi.LineFormat(this.elements));
            this.elements = new Array();
            this.elements.push(new timapi.TextElement("Trx. Ref-No: ", timapi.TextAlignment.left));
            this.elements.push(new timapi.TextElement(timapi.TextType.fieldTrxRefNum, timapi.TextAlignment.right));
            this.lines.push(new timapi.LineFormat(this.elements));
            this.elements = new Array();
            this.elements.push(new timapi.TextElement("Auth. Code: ", timapi.TextAlignment.left));
            this.elements.push(new timapi.TextElement(timapi.TextType.fieldAuthCode, timapi.TextAlignment.right));
            this.lines.push(new timapi.LineFormat(this.elements));
            this.elements = new Array();
            this.elements.push(new timapi.TextElement("EPF: ", timapi.TextAlignment.left));
            this.elements.push(new timapi.TextElement(timapi.TextType.fieldCardNumberEnc, timapi.TextAlignment.right));
            this.lines.push(new timapi.LineFormat(this.elements));
            this.lines.push(new timapi.LineFormat());
            this.elements = new Array();
            this.elements.push(new timapi.TextElement("Total-EFT ", timapi.TextAlignment.left));
            this.elements.push(new timapi.TextElement(timapi.TextType.fieldCurrency, timapi.TextAlignment.left));
            this.elements.push(new timapi.TextElement(timapi.TextType.fieldAmount, timapi.TextAlignment.right));
            this.lines.push(new timapi.LineFormat(this.elements));
            this.lines.push(new timapi.LineFormat());
            this.lines.push(new timapi.LineFormat());
            this.setLineFormatsMerchant(this.lines);
            this.lines = new Array();
            this.lines.push(new timapi.LineFormat());
            this.elements = new Array();
            this.elements.push(new timapi.TextElement("Attendant-Id: ", timapi.TextAlignment.left));
            this.elements.push(new timapi.TextElement(timapi.TextType.userId, timapi.TextAlignment.right));
            this.lines.push(new timapi.LineFormat(this.elements));
            this.elements = new Array();
            this.elements.push(new timapi.TextElement("ECR-Id: ", timapi.TextAlignment.left));
            this.elements.push(new timapi.TextElement(timapi.TextType.posId, timapi.TextAlignment.right));
            this.lines.push(new timapi.LineFormat(timapi.Condition.ECR_INFO, this.elements));
            this.elements = new Array();
            this.elements.push(new timapi.TextElement("ECR-Seq: ", timapi.TextAlignment.left));
            this.elements.push(new timapi.TextElement(timapi.TextType.fieldEctSeqCnt, timapi.TextAlignment.right));
            this.lines.push(new timapi.LineFormat(timapi.Condition.ECR_INFO, this.elements));
            this.elements = new Array();
            this.elements.push(new timapi.TextElement("EFT Ref-No: ", timapi.TextAlignment.left));
            this.elements.push(new timapi.TextElement(timapi.TextType.fieldTrxSeqCnt, timapi.TextAlignment.right));
            this.lines.push(new timapi.LineFormat(timapi.Condition.EFT_INFO, this.elements));
            this.lines.push(new timapi.LineFormat());
            this.elements = new Array();
            this.elements.push(new timapi.TextElement(timapi.TextType.transactionType, timapi.TextAlignment.left));
            this.elements.push(new timapi.TextElement(timapi.TextType.fieldBrandName, timapi.TextAlignment.right));
            this.lines.push(new timapi.LineFormat(this.elements));
            this.elements = new Array();
            this.elements.push(new timapi.TextElement(timapi.TextType.fieldCardNumberPrintableCardholder, timapi.TextAlignment.left));
            this.lines.push(new timapi.LineFormat(this.elements));
            this.lines.push(new timapi.LineFormat());
            this.elements = new Array();
            this.elements.push(new timapi.TextElement(timapi.TextType.fieldTimeStampDate, timapi.TextAlignment.left));
            this.elements.push(new timapi.TextElement(timapi.TextType.fieldTimeStampTime, timapi.TextAlignment.right));
            this.lines.push(new timapi.LineFormat(this.elements));
            this.elements = new Array();
            this.elements.push(new timapi.TextElement("Trm-Id: ", timapi.TextAlignment.left));
            this.elements.push(new timapi.TextElement(timapi.TextType.fieldTrmId, timapi.TextAlignment.right));
            this.lines.push(new timapi.LineFormat(this.elements));
            this.elements = new Array();
            this.elements.push(new timapi.TextElement("Act-Id: ", timapi.TextAlignment.left));
            this.elements.push(new timapi.TextElement(timapi.TextType.fieldActId, timapi.TextAlignment.right));
            this.lines.push(new timapi.LineFormat(this.elements));
            this.elements = new Array();
            this.elements.push(new timapi.TextElement("AID: ", timapi.TextAlignment.left));
            this.elements.push(new timapi.TextElement(timapi.TextType.fieldAid, timapi.TextAlignment.right));
            this.lines.push(new timapi.LineFormat(this.elements));
            this.elements = new Array();
            this.elements.push(new timapi.TextElement("Trx. Seq-Cnt: ", timapi.TextAlignment.left));
            this.elements.push(new timapi.TextElement(timapi.TextType.fieldTrxSeqCnt, timapi.TextAlignment.right));
            this.lines.push(new timapi.LineFormat(this.elements));
            this.elements = new Array();
            this.elements.push(new timapi.TextElement("Auth. Code: ", timapi.TextAlignment.left));
            this.elements.push(new timapi.TextElement(timapi.TextType.fieldAuthCode, timapi.TextAlignment.right));
            this.lines.push(new timapi.LineFormat(this.elements));
            this.lines.push(new timapi.LineFormat());
            this.elements = new Array();
            this.elements.push(new timapi.TextElement("Total-EFT ", timapi.TextAlignment.left));
            this.elements.push(new timapi.TextElement(timapi.TextType.fieldCurrency, timapi.TextAlignment.left));
            this.elements.push(new timapi.TextElement(timapi.TextType.fieldAmount, timapi.TextAlignment.right));
            this.lines.push(new timapi.LineFormat(this.elements));
            this.lines.push(new timapi.LineFormat());
            this.lines.push(new timapi.LineFormat());
            this.setLineFormatsCardholder(this.lines);
            this.lines = new Array();
            this.lines.push(new timapi.LineFormat());
            this.elements = new Array();
            this.elements.push(new timapi.TextElement("Saldo ", timapi.TextAlignment.left));
            this.elements.push(new timapi.TextElement(timapi.TextType.fieldCurrency, timapi.TextAlignment.left));
            this.elements.push(new timapi.TextElement(timapi.TextType.fieldAmountSaldo, timapi.TextAlignment.right));
            this.lines.push(new timapi.LineFormat(this.elements));
            this.setLineFormatsSaldo(this.lines);
        }
    }
    timapi.NormalReceiptFormatter = NormalReceiptFormatter;
})(timapi || (timapi = {}));
var timapi;
(function (timapi) {
    class SuperCompactReceiptFormatter extends timapi.CustomReceiptFormatter {
        SuperCompactReceiptFormatter() {
            this.lines = new Array();
            this.lines.push(new timapi.LineFormat());
            this.elements = new Array();
            this.elements.push(new timapi.TextElement(timapi.TextType.userId, timapi.TextAlignment.left));
            this.elements.push(new timapi.TextElement("/", timapi.TextAlignment.left));
            this.elements.push(new timapi.TextElement(timapi.TextType.posId, timapi.TextAlignment.left));
            this.elements.push(new timapi.TextElement("/", timapi.TextAlignment.left));
            this.elements.push(new timapi.TextElement(timapi.TextType.fieldEctSeqCnt, timapi.TextAlignment.left));
            this.elements.push(new timapi.TextElement(timapi.TextType.fieldTrxSeqCnt, timapi.TextAlignment.right));
            this.lines.push(new timapi.LineFormat(this.elements, "*"));
            this.lines.push(new timapi.LineFormat());
            this.elements = new Array();
            this.elements.push(new timapi.TextElement(timapi.TextType.transactionType, timapi.TextAlignment.left));
            this.elements.push(new timapi.TextElement(timapi.TextType.fieldBrandName, timapi.TextAlignment.right));
            this.lines.push(new timapi.LineFormat(this.elements));
            this.elements = new Array();
            this.elements.push(new timapi.TextElement(timapi.TextType.fieldCardNumberPrintableMerchant, timapi.TextAlignment.left));
            this.elements.push(new timapi.TextElement(" ", timapi.TextAlignment.left));
            this.elements.push(new timapi.TextElement(timapi.TextType.fieldPosEntryMode, timapi.TextAlignment.left));
            this.elements.push(new timapi.TextElement("EXP:", timapi.TextAlignment.right));
            this.elements.push(new timapi.TextElement(timapi.TextType.fieldCardExpiryDate, timapi.TextAlignment.right));
            this.lines.push(new timapi.LineFormat(this.elements));
            this.elements = new Array();
            this.elements.push(new timapi.TextElement(timapi.TextType.fieldTimeStampDate, timapi.TextAlignment.left));
            this.elements.push(new timapi.TextElement(timapi.TextType.fieldTimeStampTime, timapi.TextAlignment.right));
            this.lines.push(new timapi.LineFormat(this.elements));
            this.elements = new Array();
            this.elements.push(new timapi.TextElement("#", timapi.TextAlignment.left));
            this.elements.push(new timapi.TextElement(timapi.TextType.fieldTrmId, timapi.TextAlignment.left));
            this.elements.push(new timapi.TextElement("/", timapi.TextAlignment.left));
            this.elements.push(new timapi.TextElement(timapi.TextType.fieldActId, timapi.TextAlignment.left));
            this.elements.push(new timapi.TextElement("/", timapi.TextAlignment.left));
            this.elements.push(new timapi.TextElement(timapi.TextType.fieldAid, timapi.TextAlignment.left));
            this.elements.push(new timapi.TextElement("*", timapi.TextAlignment.left));
            this.elements.push(new timapi.TextElement(timapi.TextType.fieldTrxSeqCnt, timapi.TextAlignment.left));
            this.elements.push(new timapi.TextElement("*", timapi.TextAlignment.left));
            this.elements.push(new timapi.TextElement(timapi.TextType.fieldTrxRefNum, timapi.TextAlignment.left));
            this.elements.push(new timapi.TextElement("/", timapi.TextAlignment.left));
            this.elements.push(new timapi.TextElement(timapi.TextType.fieldAuthCode, timapi.TextAlignment.left));
            this.elements.push(new timapi.TextElement("/", timapi.TextAlignment.left));
            this.elements.push(new timapi.TextElement(timapi.TextType.fieldCardNumberEnc, timapi.TextAlignment.left));
            this.elements.push(new timapi.TextElement("#", timapi.TextAlignment.left));
            this.lines.push(new timapi.LineFormat(this.elements));
            this.lines.push(new timapi.LineFormat());
            this.elements = new Array();
            this.elements.push(new timapi.TextElement("Total-EFT ", timapi.TextAlignment.left));
            this.elements.push(new timapi.TextElement(timapi.TextType.fieldCurrency, timapi.TextAlignment.left));
            this.elements.push(new timapi.TextElement(timapi.TextType.fieldAmount, timapi.TextAlignment.right));
            this.lines.push(new timapi.LineFormat(this.elements));
            this.lines.push(new timapi.LineFormat());
            this.lines.push(new timapi.LineFormat());
            super.setLineFormatsMerchant(this.lines);
            this.lines = new Array();
            this.lines.push(new timapi.LineFormat());
            this.elements = new Array();
            this.elements.push(new timapi.TextElement(timapi.TextType.userId, timapi.TextAlignment.left));
            this.elements.push(new timapi.TextElement("/", timapi.TextAlignment.left));
            this.elements.push(new timapi.TextElement(timapi.TextType.posId, timapi.TextAlignment.left));
            this.elements.push(new timapi.TextElement("/", timapi.TextAlignment.left));
            this.elements.push(new timapi.TextElement(timapi.TextType.fieldEctSeqCnt, timapi.TextAlignment.left));
            this.elements.push(new timapi.TextElement(timapi.TextType.fieldTrxSeqCnt, timapi.TextAlignment.right));
            this.lines.push(new timapi.LineFormat(this.elements, "*"));
            this.lines.push(new timapi.LineFormat());
            this.elements = new Array();
            this.elements.push(new timapi.TextElement(timapi.TextType.transactionType, timapi.TextAlignment.left));
            this.elements.push(new timapi.TextElement(timapi.TextType.fieldBrandName, timapi.TextAlignment.right));
            this.lines.push(new timapi.LineFormat(this.elements));
            this.elements = new Array();
            this.elements.push(new timapi.TextElement(timapi.TextType.fieldCardNumberPrintableCardholder, timapi.TextAlignment.left));
            this.lines.push(new timapi.LineFormat(this.elements));
            this.elements = new Array();
            this.elements.push(new timapi.TextElement(timapi.TextType.fieldTimeStampDate, timapi.TextAlignment.left));
            this.elements.push(new timapi.TextElement(timapi.TextType.fieldTimeStampTime, timapi.TextAlignment.right));
            this.lines.push(new timapi.LineFormat(this.elements));
            this.elements = new Array();
            this.elements.push(new timapi.TextElement("#", timapi.TextAlignment.left));
            this.elements.push(new timapi.TextElement(timapi.TextType.fieldTrmId, timapi.TextAlignment.left));
            this.elements.push(new timapi.TextElement("/", timapi.TextAlignment.left));
            this.elements.push(new timapi.TextElement(timapi.TextType.fieldActId, timapi.TextAlignment.left));
            this.elements.push(new timapi.TextElement("*", timapi.TextAlignment.left));
            this.elements.push(new timapi.TextElement(timapi.TextType.fieldTrxSeqCnt, timapi.TextAlignment.left));
            this.elements.push(new timapi.TextElement("*", timapi.TextAlignment.left));
            this.elements.push(new timapi.TextElement(timapi.TextType.fieldAuthCode, timapi.TextAlignment.right));
            this.elements.push(new timapi.TextElement("#", timapi.TextAlignment.left));
            this.lines.push(new timapi.LineFormat(this.elements));
            this.elements = new Array();
            this.elements.push(new timapi.TextElement("Total-EFT ", timapi.TextAlignment.left));
            this.elements.push(new timapi.TextElement(timapi.TextType.fieldCurrency, timapi.TextAlignment.left));
            this.elements.push(new timapi.TextElement(timapi.TextType.fieldAmount, timapi.TextAlignment.right));
            this.lines.push(new timapi.LineFormat(this.elements));
            this.lines.push(new timapi.LineFormat());
            this.lines.push(new timapi.LineFormat());
            super.setLineFormatsCardholder(this.lines);
            this.lines = new Array();
            this.lines.push(new timapi.LineFormat());
            this.elements = new Array();
            this.elements.push(new timapi.TextElement("Saldo ", timapi.TextAlignment.left));
            this.elements.push(new timapi.TextElement(timapi.TextType.fieldCurrency, timapi.TextAlignment.left));
            this.elements.push(new timapi.TextElement(timapi.TextType.fieldAmountSaldo, timapi.TextAlignment.right));
            this.lines.push(new timapi.LineFormat(this.elements));
            super.setLineFormatsSaldo(this.lines);
        }
    }
    timapi.SuperCompactReceiptFormatter = SuperCompactReceiptFormatter;
})(timapi || (timapi = {}));
var timapi;
(function (timapi) {
    class UltraCompactReceiptFormatter extends timapi.CustomReceiptFormatter {
        constructor() {
            super();
            this.lines = new Array();
            this.lines.push(new timapi.LineFormat());
            this.elements = new Array();
            this.elements.push(new timapi.TextElement(timapi.TextType.userId, timapi.TextAlignment.left));
            this.elements.push(new timapi.TextElement("/", timapi.TextAlignment.left));
            this.elements.push(new timapi.TextElement(timapi.TextType.posId, timapi.TextAlignment.left));
            this.elements.push(new timapi.TextElement("/", timapi.TextAlignment.left));
            this.elements.push(new timapi.TextElement(timapi.TextType.fieldEctSeqCnt, timapi.TextAlignment.left));
            this.elements.push(new timapi.TextElement(timapi.TextType.fieldTrxSeqCnt, timapi.TextAlignment.right));
            this.lines.push(new timapi.LineFormat(this.elements, "*"));
            this.elements = new Array();
            this.elements.push(new timapi.TextElement(timapi.TextType.transactionType, timapi.TextAlignment.left));
            this.elements.push(new timapi.TextElement(timapi.TextType.fieldBrandName, timapi.TextAlignment.right));
            this.lines.push(new timapi.LineFormat(this.elements));
            this.elements = new Array();
            this.elements.push(new timapi.TextElement("#", timapi.TextAlignment.left));
            this.elements.push(new timapi.TextElement(timapi.TextType.fieldCardNumberPrintableMerchant, timapi.TextAlignment.left));
            this.elements.push(new timapi.TextElement("/", timapi.TextAlignment.left));
            this.elements.push(new timapi.TextElement(timapi.TextType.fieldPosEntryMode, timapi.TextAlignment.left));
            this.elements.push(new timapi.TextElement("/", timapi.TextAlignment.left));
            this.elements.push(new timapi.TextElement(timapi.TextType.fieldCardExpiryDate, timapi.TextAlignment.left));
            this.elements.push(new timapi.TextElement("/", timapi.TextAlignment.left));
            this.elements.push(new timapi.TextElement(timapi.TextType.fieldTimeStampDate, timapi.TextAlignment.left));
            this.elements.push(new timapi.TextElement("/", timapi.TextAlignment.left));
            this.elements.push(new timapi.TextElement(timapi.TextType.fieldTimeStampTime, timapi.TextAlignment.left));
            this.elements.push(new timapi.TextElement("/", timapi.TextAlignment.left));
            this.elements.push(new timapi.TextElement(timapi.TextType.fieldTrmId, timapi.TextAlignment.left));
            this.elements.push(new timapi.TextElement("/", timapi.TextAlignment.left));
            this.elements.push(new timapi.TextElement(timapi.TextType.fieldActId, timapi.TextAlignment.left));
            this.elements.push(new timapi.TextElement("/", timapi.TextAlignment.left));
            this.elements.push(new timapi.TextElement(timapi.TextType.fieldAid, timapi.TextAlignment.left));
            this.elements.push(new timapi.TextElement("*", timapi.TextAlignment.left));
            this.elements.push(new timapi.TextElement(timapi.TextType.fieldTrxSeqCnt, timapi.TextAlignment.left));
            this.elements.push(new timapi.TextElement("*", timapi.TextAlignment.left));
            this.elements.push(new timapi.TextElement(timapi.TextType.fieldTrxRefNum, timapi.TextAlignment.left));
            this.elements.push(new timapi.TextElement("/", timapi.TextAlignment.left));
            this.elements.push(new timapi.TextElement(timapi.TextType.fieldAuthCode, timapi.TextAlignment.left));
            this.elements.push(new timapi.TextElement("/", timapi.TextAlignment.left));
            this.elements.push(new timapi.TextElement(timapi.TextType.fieldCardNumberEnc, timapi.TextAlignment.left));
            this.elements.push(new timapi.TextElement("#", timapi.TextAlignment.left));
            this.lines.push(new timapi.LineFormat(this.elements));
            this.elements = new Array();
            this.elements.push(new timapi.TextElement("Total-EFT ", timapi.TextAlignment.left));
            this.elements.push(new timapi.TextElement(timapi.TextType.fieldCurrency, timapi.TextAlignment.left));
            this.elements.push(new timapi.TextElement(timapi.TextType.fieldAmount, timapi.TextAlignment.right));
            this.lines.push(new timapi.LineFormat(this.elements));
            this.lines.push(new timapi.LineFormat());
            this.lines.push(new timapi.LineFormat());
            super.setLineFormatsMerchant(this.lines);
            this.lines = new Array();
            this.lines.push(new timapi.LineFormat());
            this.elements = new Array();
            this.elements.push(new timapi.TextElement(timapi.TextType.userId, timapi.TextAlignment.left));
            this.elements.push(new timapi.TextElement("/", timapi.TextAlignment.left));
            this.elements.push(new timapi.TextElement(timapi.TextType.posId, timapi.TextAlignment.left));
            this.elements.push(new timapi.TextElement("/", timapi.TextAlignment.left));
            this.elements.push(new timapi.TextElement(timapi.TextType.fieldEctSeqCnt, timapi.TextAlignment.left));
            this.elements.push(new timapi.TextElement(timapi.TextType.fieldTrxSeqCnt, timapi.TextAlignment.right));
            this.lines.push(new timapi.LineFormat(this.elements, "*"));
            this.elements = new Array();
            this.elements.push(new timapi.TextElement(timapi.TextType.transactionType, timapi.TextAlignment.left));
            this.elements.push(new timapi.TextElement(timapi.TextType.fieldBrandName, timapi.TextAlignment.right));
            this.lines.push(new timapi.LineFormat(this.elements));
            this.elements = new Array();
            this.elements.push(new timapi.TextElement("#", timapi.TextAlignment.left));
            this.elements.push(new timapi.TextElement(timapi.TextType.fieldCardNumberPrintableCardholder, timapi.TextAlignment.left));
            this.elements.push(new timapi.TextElement("/", timapi.TextAlignment.left));
            this.elements.push(new timapi.TextElement(timapi.TextType.fieldTimeStampDate, timapi.TextAlignment.left));
            this.elements.push(new timapi.TextElement("/", timapi.TextAlignment.left));
            this.elements.push(new timapi.TextElement(timapi.TextType.fieldTimeStampTime, timapi.TextAlignment.left));
            this.elements.push(new timapi.TextElement("/", timapi.TextAlignment.left));
            this.elements.push(new timapi.TextElement(timapi.TextType.fieldTrmId, timapi.TextAlignment.left));
            this.elements.push(new timapi.TextElement("/", timapi.TextAlignment.left));
            this.elements.push(new timapi.TextElement(timapi.TextType.fieldActId, timapi.TextAlignment.left));
            this.elements.push(new timapi.TextElement("*", timapi.TextAlignment.left));
            this.elements.push(new timapi.TextElement(timapi.TextType.fieldTrxSeqCnt, timapi.TextAlignment.left));
            this.elements.push(new timapi.TextElement("*", timapi.TextAlignment.left));
            this.elements.push(new timapi.TextElement(timapi.TextType.fieldAuthCode, timapi.TextAlignment.left));
            this.elements.push(new timapi.TextElement("#", timapi.TextAlignment.left));
            this.lines.push(new timapi.LineFormat(this.elements));
            this.elements = new Array();
            this.elements.push(new timapi.TextElement("Total-EFT ", timapi.TextAlignment.left));
            this.elements.push(new timapi.TextElement(timapi.TextType.fieldCurrency, timapi.TextAlignment.left));
            this.elements.push(new timapi.TextElement(timapi.TextType.fieldAmount, timapi.TextAlignment.right));
            this.lines.push(new timapi.LineFormat(this.elements));
            this.lines.push(new timapi.LineFormat());
            this.lines.push(new timapi.LineFormat());
            super.setLineFormatsCardholder(this.lines);
            this.lines = new Array();
            this.lines.push(new timapi.LineFormat());
            this.elements = new Array();
            this.elements.push(new timapi.TextElement("Saldo ", timapi.TextAlignment.left));
            this.elements.push(new timapi.TextElement(timapi.TextType.fieldCurrency, timapi.TextAlignment.left));
            this.elements.push(new timapi.TextElement(timapi.TextType.fieldAmountSaldo, timapi.TextAlignment.right));
            this.lines.push(new timapi.LineFormat(this.elements));
            super.setLineFormatsSaldo(this.lines);
        }
    }
    timapi.UltraCompactReceiptFormatter = UltraCompactReceiptFormatter;
})(timapi || (timapi = {}));
var timapi;
(function (timapi) {
    class DefaultCommListener {
        disconnected() {
        }
        connected() {
        }
        connectionFailed(error) {
        }
        messageReceived(message) {
        }
    }
    timapi.DefaultCommListener = DefaultCommListener;
})(timapi || (timapi = {}));
var timapi;
(function (timapi) {
    let SocketState;
    (function (SocketState) {
        SocketState[SocketState["disconnected"] = 0] = "disconnected";
        SocketState[SocketState["connecting"] = 1] = "connecting";
        SocketState[SocketState["loggedOut"] = 2] = "loggedOut";
        SocketState[SocketState["logingIn"] = 3] = "logingIn";
        SocketState[SocketState["loggedIn"] = 4] = "loggedIn";
        SocketState[SocketState["activating"] = 5] = "activating";
        SocketState[SocketState["open"] = 6] = "open";
        SocketState[SocketState["transaction"] = 7] = "transaction";
        SocketState[SocketState["deactivating"] = 8] = "deactivating";
        SocketState[SocketState["logingOut"] = 9] = "logingOut";
    })(SocketState || (SocketState = {}));
    let SocketAction;
    (function (SocketAction) {
        SocketAction[SocketAction["none"] = 0] = "none";
        SocketAction[SocketAction["transaction"] = 1] = "transaction";
        SocketAction[SocketAction["disconnect"] = 2] = "disconnect";
    })(SocketAction = timapi.SocketAction || (timapi.SocketAction = {}));
    class SocketCommEndpoint {
        constructor($backend, $settings) {
            this.keepThreadRunning = false;
            this.backend = $backend;
            this.settings = $settings;
            this.state = SocketState.disconnected;
            this.backend.$pendingAction = SocketAction.none;
            this.posId = this.backend.$terminal.$posId;
            this.userId = timapi.utils.StringHelper.makeString(this.backend.$terminal.$userId);
            this.nextSeqNum = 1;
        }
        transaction(amount) {
            if (isNaN(amount.$amount) || amount.$amount < 0.01) {
                throw new Error("Amount has to be a positive decimal number.");
            }
            if (this.backend.$pendingAction !== SocketAction.none) {
                throw new Error("Action pending");
            }
            this.transactionAmount = Math.floor(amount.$amount * 100.0);
            this.backend.$pendingAction = SocketAction.transaction;
            this.backend.checkPendingAction();
        }
        connect() {
            if (this.state !== SocketState.disconnected) {
                return;
            }
            SocketCommEndpoint.logger.log(timapi.logging.Level.INFO, "Connecting to terminal " + this.settings.$connectionIPString);
            this.state = SocketState.connecting;
            this.keepThreadRunning = true;
            this.socket = new WebSocket("ws://" + this.settings.$connectionIPString + ":" + this.settings.$connectionIPPort + "/SIXml");
            this.socket.binaryType = "arraybuffer";
            this.socket.onopen = this.onSocketOpen.bind(this);
            this.socket.onmessage = this.onSocketMessage.bind(this);
            this.socket.onclose = this.onSocketClosed.bind(this);
            this.socket.onerror = this.onSocketError.bind(this);
        }
        disconnect() {
            this.backend.$pendingAction = SocketAction.none;
            this.disconnectWithReason(4001, "Normal disconnecting");
        }
        disconnectWithReason(reason, reasonText) {
            if (this.socket == undefined) {
                return;
            }
            this.socket.close(reason, reasonText);
            this.socket = undefined;
            this.displayContent = new Array();
            this.state = SocketState.disconnected;
            SocketCommEndpoint.logger.log(timapi.logging.Level.INFO, "Disconnected from terminal " + this.settings.$connectionIPString);
        }
        sendMessage(message) {
            if (this.socket == undefined) {
                throw new Error("Socket was not initialized");
            }
            let len = message.length + 1;
            let buffer = new Uint8Array(8 + len);
            let i;
            for (i = 0; i < 6; i++) {
                buffer[i] = SocketCommEndpoint.sixmlChannelHeader[i];
            }
            buffer[6] = (len >> 8) & 0xff;
            buffer[7] = len & 0xff;
            buffer[8] = 0x1;
            for (i = 0; i < len - 1; i++) {
                buffer[9 + i] = message[i];
            }
            this.socket.send(buffer.buffer);
        }
        onSocketOpen() {
            this.backend.connected();
            if (this.state !== SocketState.connecting) {
                return;
            }
            SocketCommEndpoint.logger.log(timapi.logging.Level.INFO, "Connection established to " + this.settings.$connectionIPString + ":" + this.settings.$connectionIPPort);
            this.state = SocketState.loggedOut;
            this.backend.checkPendingAction();
        }
        onSocketError(error) {
            SocketCommEndpoint.logger.log(timapi.logging.Level.SEVERE, "WebSocket Error ", error);
            this.backend.connectionFailed(timapi.constants.ResultCode.apiConnectFailTerminal);
        }
        onSocketMessage(event) {
            switch (this.state) {
                case SocketState.disconnected:
                    return;
            }
            if (this.keepThreadRunning) {
                let data = new Uint8Array(event.data);
                let header = data.subarray(0, 8);
                if (SocketCommEndpoint.sixmlChannelHeader === header) {
                    throw new Error("SixmlMessage has incorrect header");
                }
                let messageData = data.subarray(8);
                this.backend.messageReceived(messageData);
            }
        }
        onSocketClosed(closeEvent) {
            if (this.socket == undefined) {
                return;
            }
            this.socket = undefined;
            this.keepThreadRunning = false;
            this.displayContent = new Array();
            this.state = SocketState.disconnected;
            SocketCommEndpoint.logger.log(timapi.logging.Level.INFO, "Connection closed to terminal " + this.settings.$connectionIPString);
            this.backend.checkPendingAction();
            this.backend.disconnected();
        }
    }
    SocketCommEndpoint.loggername = "timapi.comm.SocketCommEndpoint";
    SocketCommEndpoint.classname = "timapi.comm.SocketCommEndpoint";
    SocketCommEndpoint.logger = timapi.logging.Logger.getLogger(SocketCommEndpoint.loggername);
    SocketCommEndpoint.sixmlChannelHeader = new Uint8Array([0x53, 0x49, 0x58, 0x6D, 0x6C, 0x02]);
    timapi.SocketCommEndpoint = SocketCommEndpoint;
})(timapi || (timapi = {}));
timapi.protocol.constants.AdjustmentResult = {};
timapi.protocol.constants.AdjustmentResult.timApi2Protocol = function (value) {
    if (!this._timApi2Protocol.has(value)) {
        throw new Error("Invalid argument '" + value + "' (AdjustmentResult)");
    }
    return this._timApi2Protocol.get(value);
};
timapi.protocol.constants.AdjustmentResult.protocol2TimApi = function (value) {
    if (!this._protocol2TimApi.has(value)) {
        throw new Error("Invalid argument '" + value + "' (AdjustmentResult)");
    }
    return this._protocol2TimApi.get(value);
};
timapi.protocol.constants.AdjustmentResult.protocol2TimApiIfValid = function (value) {
    return this._protocol2TimApi.get(value);
};
timapi.protocol.constants.AdjustmentResult._timApi2Protocol =
    new Map([[timapi.constants.AdjustmentResult.ok, 0],
        [timapi.constants.AdjustmentResult.failRequestToLate, 1],
        [timapi.constants.AdjustmentResult.failAmountToHigh, 2]]);
timapi.protocol.constants.AdjustmentResult._protocol2TimApi =
    new Map([[0, timapi.constants.AdjustmentResult.ok],
        [1, timapi.constants.AdjustmentResult.failRequestToLate],
        [2, timapi.constants.AdjustmentResult.failAmountToHigh]]);
timapi.protocol.constants.CardReader = {};
timapi.protocol.constants.CardReader.timApi2Protocol = function (value) {
    if (!this._timApi2Protocol.has(value)) {
        throw new Error("Invalid argument '" + value + "' (CardReader)");
    }
    return this._timApi2Protocol.get(value);
};
timapi.protocol.constants.CardReader.protocol2TimApi = function (value) {
    if (!this._protocol2TimApi.has(value)) {
        throw new Error("Invalid argument '" + value + "' (CardReader)");
    }
    return this._protocol2TimApi.get(value);
};
timapi.protocol.constants.CardReader.protocol2TimApiIfValid = function (value) {
    return this._protocol2TimApi.get(value);
};
timapi.protocol.constants.CardReader._timApi2Protocol =
    new Map([[timapi.constants.CardReader.icc, "ICC"],
        [timapi.constants.CardReader.cl, "CL"],
        [timapi.constants.CardReader.ms, "MS"]]);
timapi.protocol.constants.CardReader._protocol2TimApi =
    new Map([["ICC", timapi.constants.CardReader.icc],
        ["CL", timapi.constants.CardReader.cl],
        ["MS", timapi.constants.CardReader.ms]]);
timapi.protocol.constants.CouponRejectionReason = {};
timapi.protocol.constants.CouponRejectionReason.timApi2Protocol = function (value) {
    if (!this._timApi2Protocol.has(value)) {
        throw new Error("Invalid argument '" + value + "' (CouponRejectionReason)");
    }
    return this._timApi2Protocol.get(value);
};
timapi.protocol.constants.CouponRejectionReason.protocol2TimApi = function (value) {
    if (!this._protocol2TimApi.has(value)) {
        throw new Error("Invalid argument '" + value + "' (CouponRejectionReason)");
    }
    return this._protocol2TimApi.get(value);
};
timapi.protocol.constants.CouponRejectionReason.protocol2TimApiIfValid = function (value) {
    return this._protocol2TimApi.get(value);
};
timapi.protocol.constants.CouponRejectionReason._timApi2Protocol =
    new Map([[timapi.constants.CouponRejectionReason.alreadyRedeemed, "AlreadyRedeemed"],
        [timapi.constants.CouponRejectionReason.articleDelisted, "ArticleDelisted"],
        [timapi.constants.CouponRejectionReason.campaignExpired, "CampaignExpired"],
        [timapi.constants.CouponRejectionReason.campaignCancelled, "CampaignCancelled"],
        [timapi.constants.CouponRejectionReason.other, "Other"]]);
timapi.protocol.constants.CouponRejectionReason._protocol2TimApi =
    new Map([["AlreadyRedeemed", timapi.constants.CouponRejectionReason.alreadyRedeemed],
        ["ArticleDelisted", timapi.constants.CouponRejectionReason.articleDelisted],
        ["CampaignExpired", timapi.constants.CouponRejectionReason.campaignExpired],
        ["CampaignCancelled", timapi.constants.CouponRejectionReason.campaignCancelled],
        ["Other", timapi.constants.CouponRejectionReason.other]]);
timapi.protocol.constants.NgvMode = {};
timapi.protocol.constants.NgvMode.timApi2Protocol = function (value) {
    if (!this._timApi2Protocol.has(value)) {
        throw new Error("Invalid argument '" + value + "' (NgvMode)");
    }
    return this._timApi2Protocol.get(value);
};
timapi.protocol.constants.NgvMode.protocol2TimApi = function (value) {
    if (!this._protocol2TimApi.has(value)) {
        throw new Error("Invalid argument '" + value + "' (NgvMode)");
    }
    return this._protocol2TimApi.get(value);
};
timapi.protocol.constants.NgvMode.protocol2TimApiIfValid = function (value) {
    return this._protocol2TimApi.get(value);
};
timapi.protocol.constants.NgvMode._timApi2Protocol =
    new Map([[timapi.constants.NgvMode.mandatory, "Mandatory"],
        [timapi.constants.NgvMode.allowedWithFallback, "AllowedWithFallback"],
        [timapi.constants.NgvMode.notAllowed, "NotAllowed"]]);
timapi.protocol.constants.NgvMode._protocol2TimApi =
    new Map([["Mandatory", timapi.constants.NgvMode.mandatory],
        ["AllowedWithFallback", timapi.constants.NgvMode.allowedWithFallback],
        ["NotAllowed", timapi.constants.NgvMode.notAllowed]]);
timapi.protocol.constants.ResourceParameterType = {};
timapi.protocol.constants.ResourceParameterType.timApi2Protocol = function (value) {
    if (!this._timApi2Protocol.has(value)) {
        throw new Error("Invalid argument '" + value + "' (ResourceParameterType)");
    }
    return this._timApi2Protocol.get(value);
};
timapi.protocol.constants.ResourceParameterType.protocol2TimApi = function (value) {
    if (!this._protocol2TimApi.has(value)) {
        throw new Error("Invalid argument '" + value + "' (ResourceParameterType)");
    }
    return this._protocol2TimApi.get(value);
};
timapi.protocol.constants.ResourceParameterType.protocol2TimApiIfValid = function (value) {
    return this._protocol2TimApi.get(value);
};
timapi.protocol.constants.ResourceParameterType._timApi2Protocol =
    new Map([[timapi.constants.ResourceParameterType.codeCheckType, "CodeCheckType"],
        [timapi.constants.ResourceParameterType.codeCheckKeyId, "CodeCheckKeyId"],
        [timapi.constants.ResourceParameterType.codeCheckData, "CodeCheckData"],
        [timapi.constants.ResourceParameterType.regularDataQueryType, "RegularDataQueryType"],
        [timapi.constants.ResourceParameterType.regularData, "RegularData"],
        [timapi.constants.ResourceParameterType.petrolCardData1, "PetrolCardData1"],
        [timapi.constants.ResourceParameterType.petrolCardData2, "PetrolCardData2"],
        [timapi.constants.ResourceParameterType.petrolCardData3, "PetrolCardData3"]]);
timapi.protocol.constants.ResourceParameterType._protocol2TimApi =
    new Map([["CodeCheckType", timapi.constants.ResourceParameterType.codeCheckType],
        ["CodeCheckKeyId", timapi.constants.ResourceParameterType.codeCheckKeyId],
        ["CodeCheckData", timapi.constants.ResourceParameterType.codeCheckData],
        ["RegularDataQueryType", timapi.constants.ResourceParameterType.regularDataQueryType],
        ["RegularData", timapi.constants.ResourceParameterType.regularData],
        ["PetrolCardData1", timapi.constants.ResourceParameterType.petrolCardData1],
        ["PetrolCardData2", timapi.constants.ResourceParameterType.petrolCardData2],
        ["PetrolCardData3", timapi.constants.ResourceParameterType.petrolCardData3]]);
timapi.protocol.constants.ResponseType = {};
timapi.protocol.constants.ResponseType.timApi2Protocol = function (value) {
    if (!this._timApi2Protocol.has(value)) {
        throw new Error("Invalid argument '" + value + "' (ResponseType)");
    }
    return this._timApi2Protocol.get(value);
};
timapi.protocol.constants.ResponseType.protocol2TimApi = function (value) {
    if (!this._protocol2TimApi.has(value)) {
        throw new Error("Invalid argument '" + value + "' (ResponseType)");
    }
    return this._protocol2TimApi.get(value);
};
timapi.protocol.constants.ResponseType.protocol2TimApiIfValid = function (value) {
    return this._protocol2TimApi.get(value);
};
timapi.protocol.constants.ResponseType._timApi2Protocol =
    new Map([[timapi.constants.ResponseType.positive, "Positive"],
        [timapi.constants.ResponseType.negative, "Negative"],
        [timapi.constants.ResponseType.cardRemoval, "CardRemoval"],
        [timapi.constants.ResponseType.timeout, "Timeout"]]);
timapi.protocol.constants.ResponseType._protocol2TimApi =
    new Map([["Positive", timapi.constants.ResponseType.positive],
        ["Negative", timapi.constants.ResponseType.negative],
        ["CardRemoval", timapi.constants.ResponseType.cardRemoval],
        ["Timeout", timapi.constants.ResponseType.timeout]]);
timapi.protocol.sixml.AmountGross = function (a) {
    if (arguments.length == 1 && a instanceof timapi.protocol.sixml.AmountGross) {
        var value = a;
        this.value = value.value;
        this.currency = value.currency;
        this.exponent = value.exponent;
        return;
    }
    if (arguments.length == 1 && a instanceof timapi.protocol.XmlNode) {
        var node = a;
        this.value = (node.textContent ? parseInt(node.textContent) : 0);
        if (this.xmlHasAttribute(node, "Currency")) {
            this.currency = this.xmlGetAttribute(node, "Currency");
        }
        if (this.xmlHasAttribute(node, "Exponent")) {
            this.exponent = (this.xmlGetAttribute(node, "Exponent") ? parseInt(this.xmlGetAttribute(node, "Exponent")) : 0);
        }
        return;
    }
    if (arguments.length != 0) {
        throw new Error("Invalid argument");
    }
};
timapi.protocol.sixml.AmountGross.prototype = Object.create(timapi.protocol.Container.prototype);
timapi.protocol.sixml.AmountGross.prototype.value = 0;
timapi.protocol.sixml.AmountGross.prototype.currency = undefined;
timapi.protocol.sixml.AmountGross.prototype.exponent = undefined;
timapi.protocol.sixml.AmountGross.prototype.toXmlNode = function () {
    var node = new timapi.protocol.XmlNode("sixml:AmountGross");
    node.textContent = timapi.utils.StringHelper.makeString(this.value);
    if (this.currency != undefined) {
        this.xmlSetAttribute(node, "Currency", this.currency);
    }
    if (this.exponent != undefined) {
        this.xmlSetAttribute(node, "Exponent", timapi.utils.StringHelper.makeString(this.exponent));
    }
    return node;
};
timapi.protocol.sixml.CommandRequest = function (a) {
    if (arguments.length == 1 && a instanceof timapi.protocol.sixml.CommandRequest) {
        var value = a;
        this.orderNumber = value.orderNumber;
        this.cardReader = value.cardReader;
        this.cardCommand = value.cardCommand;
        this.positiveAnswerList = value.positiveAnswerList ? new timapi.protocol.sixml.PositiveAnswerList(value.positiveAnswerList) : undefined;
        this.commandResources = value.commandResources ? new timapi.protocol.sixml.CommandResources(value.commandResources) : undefined;
        return;
    }
    if (arguments.length == 1 && a instanceof timapi.protocol.XmlNode) {
        var node = a;
        if (this.xmlHasAttribute(node, "OrderNumber")) {
            this.orderNumber = (this.xmlGetAttribute(node, "OrderNumber") ? parseInt(this.xmlGetAttribute(node, "OrderNumber")) : 0);
        }
        if (this.xmlHasAttribute(node, "CardReader")) {
            this.cardReader = this.xmlGetAttribute(node, "CardReader");
        }
        if (this.xmlHasChild(node, "sixml:CardCommand")) {
            this.cardCommand = this.xmlGetChild(node, "sixml:CardCommand").textContent;
        }
        if (this.xmlHasChild(node, "sixml:PositiveAnswerList")) {
            this.positiveAnswerList = new timapi.protocol.sixml.PositiveAnswerList(this.xmlGetChild(node, "sixml:PositiveAnswerList"));
        }
        if (this.xmlHasChild(node, "sixml:CommandResources")) {
            this.commandResources = new timapi.protocol.sixml.CommandResources(this.xmlGetChild(node, "sixml:CommandResources"));
        }
        return;
    }
    if (arguments.length != 0) {
        throw new Error("Invalid argument");
    }
};
timapi.protocol.sixml.CommandRequest.prototype = Object.create(timapi.protocol.Container.prototype);
timapi.protocol.sixml.CommandRequest.prototype.orderNumber = undefined;
timapi.protocol.sixml.CommandRequest.prototype.cardReader = undefined;
timapi.protocol.sixml.CommandRequest.prototype.cardCommand = undefined;
timapi.protocol.sixml.CommandRequest.prototype.positiveAnswerList = undefined;
timapi.protocol.sixml.CommandRequest.prototype.commandResources = undefined;
timapi.protocol.sixml.CommandRequest.prototype.toXmlNode = function () {
    var node = new timapi.protocol.XmlNode("sixml:CommandRequest");
    if (this.orderNumber != undefined) {
        this.xmlSetAttribute(node, "OrderNumber", timapi.utils.StringHelper.makeString(this.orderNumber));
    }
    if (this.cardReader != undefined) {
        this.xmlSetAttribute(node, "CardReader", this.cardReader);
    }
    if (this.cardCommand != undefined) {
        this.xmlAddChild(node, "sixml:CardCommand", this.cardCommand);
    }
    if (this.positiveAnswerList != undefined) {
        this.xmlAddChild(node, "sixml:PositiveAnswerList", this.positiveAnswerList);
    }
    if (this.commandResources != undefined) {
        this.xmlAddChild(node, "sixml:CommandResources", this.commandResources);
    }
    return node;
};
timapi.protocol.sixml.CommandRequestList = function (a) {
    this.commandRequest = [];
    if (arguments.length == 1 && a instanceof timapi.protocol.sixml.CommandRequestList) {
        var value = a;
        for (var each of value.commandRequest) {
            this.commandRequest.push(each ? new timapi.protocol.sixml.CommandRequest(each) : undefined);
        }
        return;
    }
    if (arguments.length == 1 && a instanceof timapi.protocol.XmlNode) {
        var node = a;
        for (var each of this.xmlGetChildren(node, "sixml:CommandRequest")) {
            this.commandRequest.push(new timapi.protocol.sixml.CommandRequest(each));
        }
        return;
    }
    if (arguments.length != 0) {
        throw new Error("Invalid argument");
    }
};
timapi.protocol.sixml.CommandRequestList.prototype = Object.create(timapi.protocol.Container.prototype);
timapi.protocol.sixml.CommandRequestList.prototype.commandRequest = undefined;
timapi.protocol.sixml.CommandRequestList.prototype.toXmlNode = function () {
    var node = new timapi.protocol.XmlNode("sixml:CommandRequestList");
    for (var each of this.commandRequest) {
        this.xmlAddChild(node, "sixml:CommandRequest", each);
    }
    return node;
};
timapi.protocol.sixml.CommandResources = function (a) {
    if (arguments.length == 1 && a instanceof timapi.protocol.sixml.CommandResources) {
        var value = a;
        this.positiveResource = value.positiveResource;
        this.negativeResource = value.negativeResource;
        this.executionResource = value.executionResource;
        this.preResource = value.preResource;
        return;
    }
    if (arguments.length == 1 && a instanceof timapi.protocol.XmlNode) {
        var node = a;
        if (this.xmlHasAttribute(node, "PositiveResource")) {
            this.positiveResource = (this.xmlGetAttribute(node, "PositiveResource") ? parseInt(this.xmlGetAttribute(node, "PositiveResource")) : 0);
        }
        if (this.xmlHasAttribute(node, "NegativeResource")) {
            this.negativeResource = (this.xmlGetAttribute(node, "NegativeResource") ? parseInt(this.xmlGetAttribute(node, "NegativeResource")) : 0);
        }
        if (this.xmlHasAttribute(node, "ExecutionResource")) {
            this.executionResource = (this.xmlGetAttribute(node, "ExecutionResource") ? parseInt(this.xmlGetAttribute(node, "ExecutionResource")) : 0);
        }
        if (this.xmlHasAttribute(node, "PreResource")) {
            this.preResource = (this.xmlGetAttribute(node, "PreResource") ? parseInt(this.xmlGetAttribute(node, "PreResource")) : 0);
        }
        return;
    }
    if (arguments.length != 0) {
        throw new Error("Invalid argument");
    }
};
timapi.protocol.sixml.CommandResources.prototype = Object.create(timapi.protocol.Container.prototype);
timapi.protocol.sixml.CommandResources.prototype.positiveResource = undefined;
timapi.protocol.sixml.CommandResources.prototype.negativeResource = undefined;
timapi.protocol.sixml.CommandResources.prototype.executionResource = undefined;
timapi.protocol.sixml.CommandResources.prototype.preResource = undefined;
timapi.protocol.sixml.CommandResources.prototype.toXmlNode = function () {
    var node = new timapi.protocol.XmlNode("sixml:CommandResources");
    if (this.positiveResource != undefined) {
        this.xmlSetAttribute(node, "PositiveResource", timapi.utils.StringHelper.makeString(this.positiveResource));
    }
    if (this.negativeResource != undefined) {
        this.xmlSetAttribute(node, "NegativeResource", timapi.utils.StringHelper.makeString(this.negativeResource));
    }
    if (this.executionResource != undefined) {
        this.xmlSetAttribute(node, "ExecutionResource", timapi.utils.StringHelper.makeString(this.executionResource));
    }
    if (this.preResource != undefined) {
        this.xmlSetAttribute(node, "PreResource", timapi.utils.StringHelper.makeString(this.preResource));
    }
    return node;
};
timapi.protocol.sixml.CommandResponse = function (a) {
    if (arguments.length == 1 && a instanceof timapi.protocol.sixml.CommandResponse) {
        var value = a;
        this.orderNumber = value.orderNumber;
        this.responseType = value.responseType;
        this.cardResponse = value.cardResponse;
        this.uid = value.uid;
        this.atr = value.atr;
        return;
    }
    if (arguments.length == 1 && a instanceof timapi.protocol.XmlNode) {
        var node = a;
        if (this.xmlHasAttribute(node, "OrderNumber")) {
            this.orderNumber = (this.xmlGetAttribute(node, "OrderNumber") ? parseInt(this.xmlGetAttribute(node, "OrderNumber")) : 0);
        }
        if (this.xmlHasAttribute(node, "ResponseType")) {
            this.responseType = this.xmlGetAttribute(node, "ResponseType");
        }
        if (this.xmlHasChild(node, "sixml:CardResponse")) {
            this.cardResponse = this.xmlGetChild(node, "sixml:CardResponse").textContent;
        }
        if (this.xmlHasChild(node, "sixml:Uid")) {
            this.uid = this.xmlGetChild(node, "sixml:Uid").textContent;
        }
        if (this.xmlHasChild(node, "sixml:ATR")) {
            this.atr = this.xmlGetChild(node, "sixml:ATR").textContent;
        }
        return;
    }
    if (arguments.length != 0) {
        throw new Error("Invalid argument");
    }
};
timapi.protocol.sixml.CommandResponse.prototype = Object.create(timapi.protocol.Container.prototype);
timapi.protocol.sixml.CommandResponse.prototype.orderNumber = undefined;
timapi.protocol.sixml.CommandResponse.prototype.responseType = undefined;
timapi.protocol.sixml.CommandResponse.prototype.cardResponse = undefined;
timapi.protocol.sixml.CommandResponse.prototype.uid = undefined;
timapi.protocol.sixml.CommandResponse.prototype.atr = undefined;
timapi.protocol.sixml.CommandResponse.prototype.toXmlNode = function () {
    var node = new timapi.protocol.XmlNode("sixml:CommandResponse");
    if (this.orderNumber != undefined) {
        this.xmlSetAttribute(node, "OrderNumber", timapi.utils.StringHelper.makeString(this.orderNumber));
    }
    if (this.responseType != undefined) {
        this.xmlSetAttribute(node, "ResponseType", this.responseType);
    }
    if (this.cardResponse != undefined) {
        this.xmlAddChild(node, "sixml:CardResponse", this.cardResponse);
    }
    if (this.uid != undefined) {
        this.xmlAddChild(node, "sixml:Uid", this.uid);
    }
    if (this.atr != undefined) {
        this.xmlAddChild(node, "sixml:ATR", this.atr);
    }
    return node;
};
timapi.protocol.sixml.CommandResponseList = function (a) {
    this.commandResponse = [];
    if (arguments.length == 1 && a instanceof timapi.protocol.sixml.CommandResponseList) {
        var value = a;
        for (var each of value.commandResponse) {
            this.commandResponse.push(each ? new timapi.protocol.sixml.CommandResponse(each) : undefined);
        }
        return;
    }
    if (arguments.length == 1 && a instanceof timapi.protocol.XmlNode) {
        var node = a;
        for (var each of this.xmlGetChildren(node, "sixml:CommandResponse")) {
            this.commandResponse.push(new timapi.protocol.sixml.CommandResponse(each));
        }
        return;
    }
    if (arguments.length != 0) {
        throw new Error("Invalid argument");
    }
};
timapi.protocol.sixml.CommandResponseList.prototype = Object.create(timapi.protocol.Container.prototype);
timapi.protocol.sixml.CommandResponseList.prototype.commandResponse = undefined;
timapi.protocol.sixml.CommandResponseList.prototype.toXmlNode = function () {
    var node = new timapi.protocol.XmlNode("sixml:CommandResponseList");
    for (var each of this.commandResponse) {
        this.xmlAddChild(node, "sixml:CommandResponse", each);
    }
    return node;
};
timapi.protocol.sixml.FinalAmount = function (a) {
    if (arguments.length == 1 && a instanceof timapi.protocol.sixml.FinalAmount) {
        var value = a;
        this.value = value.value;
        this.currency = value.currency;
        this.exponent = value.exponent;
        this.adjustmentResult = value.adjustmentResult;
        return;
    }
    if (arguments.length == 1 && a instanceof timapi.protocol.XmlNode) {
        var node = a;
        this.value = (node.textContent ? parseInt(node.textContent) : 0);
        if (this.xmlHasAttribute(node, "Currency")) {
            this.currency = this.xmlGetAttribute(node, "Currency");
        }
        if (this.xmlHasAttribute(node, "Exponent")) {
            this.exponent = (this.xmlGetAttribute(node, "Exponent") ? parseInt(this.xmlGetAttribute(node, "Exponent")) : 0);
        }
        if (this.xmlHasAttribute(node, "AdjustmentResult")) {
            this.adjustmentResult = (this.xmlGetAttribute(node, "AdjustmentResult") ? parseInt(this.xmlGetAttribute(node, "AdjustmentResult")) : 0);
        }
        return;
    }
    if (arguments.length != 0) {
        throw new Error("Invalid argument");
    }
};
timapi.protocol.sixml.FinalAmount.prototype = Object.create(timapi.protocol.Container.prototype);
timapi.protocol.sixml.FinalAmount.prototype.value = 0;
timapi.protocol.sixml.FinalAmount.prototype.currency = undefined;
timapi.protocol.sixml.FinalAmount.prototype.exponent = undefined;
timapi.protocol.sixml.FinalAmount.prototype.adjustmentResult = undefined;
timapi.protocol.sixml.FinalAmount.prototype.toXmlNode = function () {
    var node = new timapi.protocol.XmlNode("sixml:FinalAmount");
    node.textContent = timapi.utils.StringHelper.makeString(this.value);
    if (this.currency != undefined) {
        this.xmlSetAttribute(node, "Currency", this.currency);
    }
    if (this.exponent != undefined) {
        this.xmlSetAttribute(node, "Exponent", timapi.utils.StringHelper.makeString(this.exponent));
    }
    if (this.adjustmentResult != undefined) {
        this.xmlSetAttribute(node, "AdjustmentResult", timapi.utils.StringHelper.makeString(this.adjustmentResult));
    }
    return node;
};
timapi.protocol.sixml.LoyaltyBasket = function (a) {
    this.loyaltyItem = [];
    if (arguments.length == 1 && a instanceof timapi.protocol.sixml.LoyaltyBasket) {
        var value = a;
        for (var each of value.loyaltyItem) {
            this.loyaltyItem.push(each ? new timapi.protocol.sixml.LoyaltyItem(each) : undefined);
        }
        return;
    }
    if (arguments.length == 1 && a instanceof timapi.protocol.XmlNode) {
        var node = a;
        for (var each of this.xmlGetChildren(node, "sixml:LoyaltyItem")) {
            this.loyaltyItem.push(new timapi.protocol.sixml.LoyaltyItem(each));
        }
        return;
    }
    if (arguments.length != 0) {
        throw new Error("Invalid argument");
    }
};
timapi.protocol.sixml.LoyaltyBasket.prototype = Object.create(timapi.protocol.Container.prototype);
timapi.protocol.sixml.LoyaltyBasket.prototype.loyaltyItem = undefined;
timapi.protocol.sixml.LoyaltyBasket.prototype.toXmlNode = function () {
    var node = new timapi.protocol.XmlNode("sixml:LoyaltyBasket");
    for (var each of this.loyaltyItem) {
        this.xmlAddChild(node, "sixml:LoyaltyItem", each);
    }
    return node;
};
timapi.protocol.sixml.LoyaltyCashbackAmount = function (a) {
    if (arguments.length == 1 && a instanceof timapi.protocol.sixml.LoyaltyCashbackAmount) {
        var value = a;
        this.value = value.value;
        this.currency = value.currency;
        this.exponent = value.exponent;
        return;
    }
    if (arguments.length == 1 && a instanceof timapi.protocol.XmlNode) {
        var node = a;
        this.value = (node.textContent ? parseInt(node.textContent) : 0);
        if (this.xmlHasAttribute(node, "Currency")) {
            this.currency = this.xmlGetAttribute(node, "Currency");
        }
        if (this.xmlHasAttribute(node, "Exponent")) {
            this.exponent = (this.xmlGetAttribute(node, "Exponent") ? parseInt(this.xmlGetAttribute(node, "Exponent")) : 0);
        }
        return;
    }
    if (arguments.length != 0) {
        throw new Error("Invalid argument");
    }
};
timapi.protocol.sixml.LoyaltyCashbackAmount.prototype = Object.create(timapi.protocol.Container.prototype);
timapi.protocol.sixml.LoyaltyCashbackAmount.prototype.value = 0;
timapi.protocol.sixml.LoyaltyCashbackAmount.prototype.currency = undefined;
timapi.protocol.sixml.LoyaltyCashbackAmount.prototype.exponent = undefined;
timapi.protocol.sixml.LoyaltyCashbackAmount.prototype.toXmlNode = function () {
    var node = new timapi.protocol.XmlNode("sixml:LoyaltyCashbackAmount");
    node.textContent = timapi.utils.StringHelper.makeString(this.value);
    if (this.currency != undefined) {
        this.xmlSetAttribute(node, "Currency", this.currency);
    }
    if (this.exponent != undefined) {
        this.xmlSetAttribute(node, "Exponent", timapi.utils.StringHelper.makeString(this.exponent));
    }
    return node;
};
timapi.protocol.sixml.LoyaltyCheckoutInformation = function (a) {
    if (arguments.length == 1 && a instanceof timapi.protocol.sixml.LoyaltyCheckoutInformation) {
        var value = a;
        this.provideBasketFlag = value.provideBasketFlag;
        this.loyaltyInformationList = value.loyaltyInformationList ? new timapi.protocol.sixml.LoyaltyInformationList(value.loyaltyInformationList) : undefined;
        this.loyaltyCouponList = value.loyaltyCouponList ? new timapi.protocol.sixml.LoyaltyCouponList(value.loyaltyCouponList) : undefined;
        return;
    }
    if (arguments.length == 1 && a instanceof timapi.protocol.XmlNode) {
        var node = a;
        if (this.xmlHasChild(node, "sixml:ProvideBasketFlag")) {
            this.provideBasketFlag = this.xmlGetChild(node, "sixml:ProvideBasketFlag").textContent == "1";
        }
        if (this.xmlHasChild(node, "sixml:LoyaltyInformationList")) {
            this.loyaltyInformationList = new timapi.protocol.sixml.LoyaltyInformationList(this.xmlGetChild(node, "sixml:LoyaltyInformationList"));
        }
        if (this.xmlHasChild(node, "sixml:LoyaltyCouponList")) {
            this.loyaltyCouponList = new timapi.protocol.sixml.LoyaltyCouponList(this.xmlGetChild(node, "sixml:LoyaltyCouponList"));
        }
        return;
    }
    if (arguments.length != 0) {
        throw new Error("Invalid argument");
    }
};
timapi.protocol.sixml.LoyaltyCheckoutInformation.prototype = Object.create(timapi.protocol.Container.prototype);
timapi.protocol.sixml.LoyaltyCheckoutInformation.prototype.provideBasketFlag = undefined;
timapi.protocol.sixml.LoyaltyCheckoutInformation.prototype.loyaltyInformationList = undefined;
timapi.protocol.sixml.LoyaltyCheckoutInformation.prototype.loyaltyCouponList = undefined;
timapi.protocol.sixml.LoyaltyCheckoutInformation.prototype.toXmlNode = function () {
    var node = new timapi.protocol.XmlNode("sixml:LoyaltyCheckoutInformation");
    if (this.provideBasketFlag != undefined) {
        this.xmlAddChild(node, "sixml:ProvideBasketFlag", (this.provideBasketFlag ? "1" : "0"));
    }
    if (this.loyaltyInformationList != undefined) {
        this.xmlAddChild(node, "sixml:LoyaltyInformationList", this.loyaltyInformationList);
    }
    if (this.loyaltyCouponList != undefined) {
        this.xmlAddChild(node, "sixml:LoyaltyCouponList", this.loyaltyCouponList);
    }
    return node;
};
timapi.protocol.sixml.LoyaltyCoupon = function (a) {
    if (arguments.length == 1 && a instanceof timapi.protocol.sixml.LoyaltyCoupon) {
        var value = a;
        this.value = value.value;
        this.couponId = value.couponId;
        this.currency = value.currency;
        this.exponent = value.exponent;
        this.couponRejectionReason = value.couponRejectionReason;
        return;
    }
    if (arguments.length == 1 && a instanceof timapi.protocol.XmlNode) {
        var node = a;
        this.value = (node.textContent ? parseInt(node.textContent) : 0);
        if (this.xmlHasAttribute(node, "CouponId")) {
            this.couponId = this.xmlGetAttribute(node, "CouponId");
        }
        if (this.xmlHasAttribute(node, "Currency")) {
            this.currency = this.xmlGetAttribute(node, "Currency");
        }
        if (this.xmlHasAttribute(node, "Exponent")) {
            this.exponent = (this.xmlGetAttribute(node, "Exponent") ? parseInt(this.xmlGetAttribute(node, "Exponent")) : 0);
        }
        if (this.xmlHasAttribute(node, "CouponRejectionReason")) {
            this.couponRejectionReason = this.xmlGetAttribute(node, "CouponRejectionReason");
        }
        return;
    }
    if (arguments.length != 0) {
        throw new Error("Invalid argument");
    }
};
timapi.protocol.sixml.LoyaltyCoupon.prototype = Object.create(timapi.protocol.Container.prototype);
timapi.protocol.sixml.LoyaltyCoupon.prototype.value = 0;
timapi.protocol.sixml.LoyaltyCoupon.prototype.couponId = undefined;
timapi.protocol.sixml.LoyaltyCoupon.prototype.currency = undefined;
timapi.protocol.sixml.LoyaltyCoupon.prototype.exponent = undefined;
timapi.protocol.sixml.LoyaltyCoupon.prototype.couponRejectionReason = undefined;
timapi.protocol.sixml.LoyaltyCoupon.prototype.toXmlNode = function () {
    var node = new timapi.protocol.XmlNode("sixml:LoyaltyCoupon");
    node.textContent = timapi.utils.StringHelper.makeString(this.value);
    if (this.couponId != undefined) {
        this.xmlSetAttribute(node, "CouponId", this.couponId);
    }
    if (this.currency != undefined) {
        this.xmlSetAttribute(node, "Currency", this.currency);
    }
    if (this.exponent != undefined) {
        this.xmlSetAttribute(node, "Exponent", timapi.utils.StringHelper.makeString(this.exponent));
    }
    if (this.couponRejectionReason != undefined) {
        this.xmlSetAttribute(node, "CouponRejectionReason", this.couponRejectionReason);
    }
    return node;
};
timapi.protocol.sixml.LoyaltyCouponList = function (a) {
    this.loyaltyCoupon = [];
    if (arguments.length == 1 && a instanceof timapi.protocol.sixml.LoyaltyCouponList) {
        var value = a;
        for (var each of value.loyaltyCoupon) {
            this.loyaltyCoupon.push(each ? new timapi.protocol.sixml.LoyaltyCoupon(each) : undefined);
        }
        return;
    }
    if (arguments.length == 1 && a instanceof timapi.protocol.XmlNode) {
        var node = a;
        for (var each of this.xmlGetChildren(node, "sixml:LoyaltyCoupon")) {
            this.loyaltyCoupon.push(new timapi.protocol.sixml.LoyaltyCoupon(each));
        }
        return;
    }
    if (arguments.length != 0) {
        throw new Error("Invalid argument");
    }
};
timapi.protocol.sixml.LoyaltyCouponList.prototype = Object.create(timapi.protocol.Container.prototype);
timapi.protocol.sixml.LoyaltyCouponList.prototype.loyaltyCoupon = undefined;
timapi.protocol.sixml.LoyaltyCouponList.prototype.toXmlNode = function () {
    var node = new timapi.protocol.XmlNode("sixml:LoyaltyCouponList");
    for (var each of this.loyaltyCoupon) {
        this.xmlAddChild(node, "sixml:LoyaltyCoupon", each);
    }
    return node;
};
timapi.protocol.sixml.LoyaltyData = function (a) {
    if (arguments.length == 1 && a instanceof timapi.protocol.sixml.LoyaltyData) {
        var value = a;
        this.value = value.value;
        this.loyaltyDataType = value.loyaltyDataType;
        this.loyaltyFunctionType = value.loyaltyFunctionType;
        return;
    }
    if (arguments.length == 1 && a instanceof timapi.protocol.XmlNode) {
        var node = a;
        this.value = timapi.ConversionHelper.hexStringToByte(node.textContent);
        if (this.xmlHasAttribute(node, "LoyaltyDataType")) {
            this.loyaltyDataType = this.xmlGetAttribute(node, "LoyaltyDataType");
        }
        if (this.xmlHasAttribute(node, "LoyaltyFunctionType")) {
            this.loyaltyFunctionType = this.xmlGetAttribute(node, "LoyaltyFunctionType");
        }
        return;
    }
    if (arguments.length != 0) {
        throw new Error("Invalid argument");
    }
};
timapi.protocol.sixml.LoyaltyData.prototype = Object.create(timapi.protocol.Container.prototype);
timapi.protocol.sixml.LoyaltyData.prototype.value = new Uint8Array(0);
timapi.protocol.sixml.LoyaltyData.prototype.loyaltyDataType = undefined;
timapi.protocol.sixml.LoyaltyData.prototype.loyaltyFunctionType = undefined;
timapi.protocol.sixml.LoyaltyData.prototype.toXmlNode = function () {
    var node = new timapi.protocol.XmlNode("sixml:LoyaltyData");
    node.textContent = timapi.protocol.ConversionHelper.byteToHexString(this.value);
    if (this.loyaltyDataType != undefined) {
        this.xmlSetAttribute(node, "LoyaltyDataType", this.loyaltyDataType);
    }
    if (this.loyaltyFunctionType != undefined) {
        this.xmlSetAttribute(node, "LoyaltyFunctionType", this.loyaltyFunctionType);
    }
    return node;
};
timapi.protocol.sixml.LoyaltyDiscount = function (a) {
    if (arguments.length == 1 && a instanceof timapi.protocol.sixml.LoyaltyDiscount) {
        var value = a;
        this.value = value.value;
        this.discountDescription = value.discountDescription;
        this.currency = value.currency;
        this.exponent = value.exponent;
        return;
    }
    if (arguments.length == 1 && a instanceof timapi.protocol.XmlNode) {
        var node = a;
        this.value = (node.textContent ? parseInt(node.textContent) : 0);
        if (this.xmlHasAttribute(node, "DiscountDescription")) {
            this.discountDescription = this.xmlGetAttribute(node, "DiscountDescription");
        }
        if (this.xmlHasAttribute(node, "Currency")) {
            this.currency = this.xmlGetAttribute(node, "Currency");
        }
        if (this.xmlHasAttribute(node, "Exponent")) {
            this.exponent = (this.xmlGetAttribute(node, "Exponent") ? parseInt(this.xmlGetAttribute(node, "Exponent")) : 0);
        }
        return;
    }
    if (arguments.length != 0) {
        throw new Error("Invalid argument");
    }
};
timapi.protocol.sixml.LoyaltyDiscount.prototype = Object.create(timapi.protocol.Container.prototype);
timapi.protocol.sixml.LoyaltyDiscount.prototype.value = 0;
timapi.protocol.sixml.LoyaltyDiscount.prototype.discountDescription = undefined;
timapi.protocol.sixml.LoyaltyDiscount.prototype.currency = undefined;
timapi.protocol.sixml.LoyaltyDiscount.prototype.exponent = undefined;
timapi.protocol.sixml.LoyaltyDiscount.prototype.toXmlNode = function () {
    var node = new timapi.protocol.XmlNode("sixml:LoyaltyDiscount");
    node.textContent = timapi.utils.StringHelper.makeString(this.value);
    if (this.discountDescription != undefined) {
        this.xmlSetAttribute(node, "DiscountDescription", this.discountDescription);
    }
    if (this.currency != undefined) {
        this.xmlSetAttribute(node, "Currency", this.currency);
    }
    if (this.exponent != undefined) {
        this.xmlSetAttribute(node, "Exponent", timapi.utils.StringHelper.makeString(this.exponent));
    }
    return node;
};
timapi.protocol.sixml.LoyaltyDiscountList = function (a) {
    this.loyaltyDiscount = [];
    if (arguments.length == 1 && a instanceof timapi.protocol.sixml.LoyaltyDiscountList) {
        var value = a;
        for (var each of value.loyaltyDiscount) {
            this.loyaltyDiscount.push(each ? new timapi.protocol.sixml.LoyaltyDiscount(each) : undefined);
        }
        return;
    }
    if (arguments.length == 1 && a instanceof timapi.protocol.XmlNode) {
        var node = a;
        for (var each of this.xmlGetChildren(node, "sixml:LoyaltyDiscount")) {
            this.loyaltyDiscount.push(new timapi.protocol.sixml.LoyaltyDiscount(each));
        }
        return;
    }
    if (arguments.length != 0) {
        throw new Error("Invalid argument");
    }
};
timapi.protocol.sixml.LoyaltyDiscountList.prototype = Object.create(timapi.protocol.Container.prototype);
timapi.protocol.sixml.LoyaltyDiscountList.prototype.loyaltyDiscount = undefined;
timapi.protocol.sixml.LoyaltyDiscountList.prototype.toXmlNode = function () {
    var node = new timapi.protocol.XmlNode("sixml:LoyaltyDiscountList");
    for (var each of this.loyaltyDiscount) {
        this.xmlAddChild(node, "sixml:LoyaltyDiscount", each);
    }
    return node;
};
timapi.protocol.sixml.LoyaltyItem = function (a) {
    if (arguments.length == 1 && a instanceof timapi.protocol.sixml.LoyaltyItem) {
        var value = a;
        this.itemId = value.itemId;
        this.prodDescription = value.prodDescription;
        this.amount = value.amount ? new timapi.protocol.sixml.Amount(value.amount) : undefined;
        this.itemQuantity = value.itemQuantity ? new timapi.protocol.sixml.ItemQuantity(value.itemQuantity) : undefined;
        this.amountTotal = value.amountTotal ? new timapi.protocol.sixml.AmountTotal(value.amountTotal) : undefined;
        this.loyaltyDiscountList = value.loyaltyDiscountList ? new timapi.protocol.sixml.LoyaltyDiscountList(value.loyaltyDiscountList) : undefined;
        this.loyaltyCouponList = value.loyaltyCouponList ? new timapi.protocol.sixml.LoyaltyCouponList(value.loyaltyCouponList) : undefined;
        return;
    }
    if (arguments.length == 1 && a instanceof timapi.protocol.XmlNode) {
        var node = a;
        if (this.xmlHasAttribute(node, "ItemId")) {
            this.itemId = this.xmlGetAttribute(node, "ItemId");
        }
        if (this.xmlHasAttribute(node, "ProdDescription")) {
            this.prodDescription = this.xmlGetAttribute(node, "ProdDescription");
        }
        if (this.xmlHasChild(node, "sixml:Amount")) {
            this.amount = new timapi.protocol.sixml.Amount(this.xmlGetChild(node, "sixml:Amount"));
        }
        if (this.xmlHasChild(node, "sixml:ItemQuantity")) {
            this.itemQuantity = new timapi.protocol.sixml.ItemQuantity(this.xmlGetChild(node, "sixml:ItemQuantity"));
        }
        if (this.xmlHasChild(node, "sixml:AmountTotal")) {
            this.amountTotal = new timapi.protocol.sixml.AmountTotal(this.xmlGetChild(node, "sixml:AmountTotal"));
        }
        if (this.xmlHasChild(node, "sixml:LoyaltyDiscountList")) {
            this.loyaltyDiscountList = new timapi.protocol.sixml.LoyaltyDiscountList(this.xmlGetChild(node, "sixml:LoyaltyDiscountList"));
        }
        if (this.xmlHasChild(node, "sixml:LoyaltyCouponList")) {
            this.loyaltyCouponList = new timapi.protocol.sixml.LoyaltyCouponList(this.xmlGetChild(node, "sixml:LoyaltyCouponList"));
        }
        return;
    }
    if (arguments.length != 0) {
        throw new Error("Invalid argument");
    }
};
timapi.protocol.sixml.LoyaltyItem.prototype = Object.create(timapi.protocol.Container.prototype);
timapi.protocol.sixml.LoyaltyItem.prototype.itemId = undefined;
timapi.protocol.sixml.LoyaltyItem.prototype.prodDescription = undefined;
timapi.protocol.sixml.LoyaltyItem.prototype.amount = undefined;
timapi.protocol.sixml.LoyaltyItem.prototype.itemQuantity = undefined;
timapi.protocol.sixml.LoyaltyItem.prototype.amountTotal = undefined;
timapi.protocol.sixml.LoyaltyItem.prototype.loyaltyDiscountList = undefined;
timapi.protocol.sixml.LoyaltyItem.prototype.loyaltyCouponList = undefined;
timapi.protocol.sixml.LoyaltyItem.prototype.toXmlNode = function () {
    var node = new timapi.protocol.XmlNode("sixml:LoyaltyItem");
    if (this.itemId != undefined) {
        this.xmlSetAttribute(node, "ItemId", this.itemId);
    }
    if (this.prodDescription != undefined) {
        this.xmlSetAttribute(node, "ProdDescription", this.prodDescription);
    }
    if (this.amount != undefined) {
        this.xmlAddChild(node, "sixml:Amount", this.amount);
    }
    if (this.itemQuantity != undefined) {
        this.xmlAddChild(node, "sixml:ItemQuantity", this.itemQuantity);
    }
    if (this.amountTotal != undefined) {
        this.xmlAddChild(node, "sixml:AmountTotal", this.amountTotal);
    }
    if (this.loyaltyDiscountList != undefined) {
        this.xmlAddChild(node, "sixml:LoyaltyDiscountList", this.loyaltyDiscountList);
    }
    if (this.loyaltyCouponList != undefined) {
        this.xmlAddChild(node, "sixml:LoyaltyCouponList", this.loyaltyCouponList);
    }
    return node;
};
timapi.protocol.sixml.Notification_AmtAdjustment = function (a) {
    if (arguments.length == 1 && a instanceof timapi.protocol.sixml.Notification_AmtAdjustment) {
        var value = a;
        this.functionGroup = value.functionGroup;
        this.function = value.function;
        this.amount = value.amount ? new timapi.protocol.sixml.Amount(value.amount) : undefined;
        this.loyaltyCouponList = value.loyaltyCouponList ? new timapi.protocol.sixml.LoyaltyCouponList(value.loyaltyCouponList) : undefined;
        this.amountDiscount = value.amountDiscount ? new timapi.protocol.sixml.AmountDiscount(value.amountDiscount) : undefined;
        this.loyaltyInformationList = value.loyaltyInformationList ? new timapi.protocol.sixml.LoyaltyInformationList(value.loyaltyInformationList) : undefined;
        return;
    }
    if (arguments.length == 1 && a instanceof timapi.protocol.XmlNode) {
        var node = a;
        if (this.xmlHasAttribute(node, "FunctionGroup")) {
            this.functionGroup = this.xmlGetAttribute(node, "FunctionGroup");
        }
        if (this.xmlHasAttribute(node, "Function")) {
            this.function = this.xmlGetAttribute(node, "Function");
        }
        if (this.xmlHasChild(node, "sixml:Amount")) {
            this.amount = new timapi.protocol.sixml.Amount(this.xmlGetChild(node, "sixml:Amount"));
        }
        if (this.xmlHasChild(node, "sixml:LoyaltyCouponList")) {
            this.loyaltyCouponList = new timapi.protocol.sixml.LoyaltyCouponList(this.xmlGetChild(node, "sixml:LoyaltyCouponList"));
        }
        if (this.xmlHasChild(node, "sixml:AmountDiscount")) {
            this.amountDiscount = new timapi.protocol.sixml.AmountDiscount(this.xmlGetChild(node, "sixml:AmountDiscount"));
        }
        if (this.xmlHasChild(node, "sixml:LoyaltyInformationList")) {
            this.loyaltyInformationList = new timapi.protocol.sixml.LoyaltyInformationList(this.xmlGetChild(node, "sixml:LoyaltyInformationList"));
        }
        return;
    }
    if (arguments.length == 0) {
        this.functionGroup = "FinTransaction";
        this.function = "AmtAdjustment";
        return;
    }
    throw new Error("Invalid argument");
};
timapi.protocol.sixml.Notification_AmtAdjustment.prototype = Object.create(timapi.protocol.Message.prototype);
timapi.protocol.sixml.Notification_AmtAdjustment.prototype.functionGroup = undefined;
timapi.protocol.sixml.Notification_AmtAdjustment.prototype.function = undefined;
timapi.protocol.sixml.Notification_AmtAdjustment.prototype.amount = undefined;
timapi.protocol.sixml.Notification_AmtAdjustment.prototype.loyaltyCouponList = undefined;
timapi.protocol.sixml.Notification_AmtAdjustment.prototype.amountDiscount = undefined;
timapi.protocol.sixml.Notification_AmtAdjustment.prototype.loyaltyInformationList = undefined;
timapi.protocol.sixml.Notification_AmtAdjustment.prototype.toXmlNode = function () {
    var node = new timapi.protocol.XmlNode("sixml:Notification");
    this.xmlSetAttribute(node, "xmlns:sixml", "http://www.six-payment-services.com/");
    if (this.functionGroup != undefined) {
        this.xmlSetAttribute(node, "FunctionGroup", this.functionGroup);
    }
    if (this.function != undefined) {
        this.xmlSetAttribute(node, "Function", this.function);
    }
    if (this.amount != undefined) {
        this.xmlAddChild(node, "sixml:Amount", this.amount);
    }
    if (this.loyaltyCouponList != undefined) {
        this.xmlAddChild(node, "sixml:LoyaltyCouponList", this.loyaltyCouponList);
    }
    if (this.amountDiscount != undefined) {
        this.xmlAddChild(node, "sixml:AmountDiscount", this.amountDiscount);
    }
    if (this.loyaltyInformationList != undefined) {
        this.xmlAddChild(node, "sixml:LoyaltyInformationList", this.loyaltyInformationList);
    }
    return node;
};
timapi.protocol.sixml.Notification_LoyaltyInfo = function (a) {
    if (arguments.length == 1 && a instanceof timapi.protocol.sixml.Notification_LoyaltyInfo) {
        var value = a;
        this.functionGroup = value.functionGroup;
        this.function = value.function;
        this.loyaltyCheckoutInformation = value.loyaltyCheckoutInformation ? new timapi.protocol.sixml.LoyaltyCheckoutInformation(value.loyaltyCheckoutInformation) : undefined;
        return;
    }
    if (arguments.length == 1 && a instanceof timapi.protocol.XmlNode) {
        var node = a;
        if (this.xmlHasAttribute(node, "FunctionGroup")) {
            this.functionGroup = this.xmlGetAttribute(node, "FunctionGroup");
        }
        if (this.xmlHasAttribute(node, "Function")) {
            this.function = this.xmlGetAttribute(node, "Function");
        }
        if (this.xmlHasChild(node, "sixml:LoyaltyCheckoutInformation")) {
            this.loyaltyCheckoutInformation = new timapi.protocol.sixml.LoyaltyCheckoutInformation(this.xmlGetChild(node, "sixml:LoyaltyCheckoutInformation"));
        }
        return;
    }
    if (arguments.length == 0) {
        this.functionGroup = "Status";
        this.function = "LoyaltyInfo";
        return;
    }
    throw new Error("Invalid argument");
};
timapi.protocol.sixml.Notification_LoyaltyInfo.prototype = Object.create(timapi.protocol.Message.prototype);
timapi.protocol.sixml.Notification_LoyaltyInfo.prototype.functionGroup = undefined;
timapi.protocol.sixml.Notification_LoyaltyInfo.prototype.function = undefined;
timapi.protocol.sixml.Notification_LoyaltyInfo.prototype.loyaltyCheckoutInformation = undefined;
timapi.protocol.sixml.Notification_LoyaltyInfo.prototype.toXmlNode = function () {
    var node = new timapi.protocol.XmlNode("sixml:Notification");
    this.xmlSetAttribute(node, "xmlns:sixml", "http://www.six-payment-services.com/");
    if (this.functionGroup != undefined) {
        this.xmlSetAttribute(node, "FunctionGroup", this.functionGroup);
    }
    if (this.function != undefined) {
        this.xmlSetAttribute(node, "Function", this.function);
    }
    if (this.loyaltyCheckoutInformation != undefined) {
        this.xmlAddChild(node, "sixml:LoyaltyCheckoutInformation", this.loyaltyCheckoutInformation);
    }
    return node;
};
timapi.protocol.sixml.PositiveAnswerList = function (a) {
    this.positiveAnswer = [];
    if (arguments.length == 1 && a instanceof timapi.protocol.sixml.PositiveAnswerList) {
        var value = a;
        for (var each of value.positiveAnswer) {
            this.positiveAnswer.push(each);
        }
        return;
    }
    if (arguments.length == 1 && a instanceof timapi.protocol.XmlNode) {
        var node = a;
        for (var each of this.xmlGetChildren(node, "sixml:PositiveAnswer")) {
            this.positiveAnswer.push(each.textContent);
        }
        return;
    }
    if (arguments.length != 0) {
        throw new Error("Invalid argument");
    }
};
timapi.protocol.sixml.PositiveAnswerList.prototype = Object.create(timapi.protocol.Container.prototype);
timapi.protocol.sixml.PositiveAnswerList.prototype.positiveAnswer = undefined;
timapi.protocol.sixml.PositiveAnswerList.prototype.toXmlNode = function () {
    var node = new timapi.protocol.XmlNode("sixml:PositiveAnswerList");
    for (var each of this.positiveAnswer) {
        this.xmlAddChild(node, "sixml:PositiveAnswer", each);
    }
    return node;
};
timapi.protocol.sixml.Request_FinishCheckout = function (a) {
    if (arguments.length == 1 && a instanceof timapi.protocol.sixml.Request_FinishCheckout) {
        var value = a;
        this.functionGroup = value.functionGroup;
        this.function = value.function;
        this.sequenceNumber = value.sequenceNumber;
        return;
    }
    if (arguments.length == 1 && a instanceof timapi.protocol.XmlNode) {
        var node = a;
        if (this.xmlHasAttribute(node, "FunctionGroup")) {
            this.functionGroup = this.xmlGetAttribute(node, "FunctionGroup");
        }
        if (this.xmlHasAttribute(node, "Function")) {
            this.function = this.xmlGetAttribute(node, "Function");
        }
        if (this.xmlHasAttribute(node, "SequenceNumber")) {
            this.sequenceNumber = (this.xmlGetAttribute(node, "SequenceNumber") ? parseInt(this.xmlGetAttribute(node, "SequenceNumber")) : 0);
        }
        return;
    }
    if (arguments.length == 0) {
        this.functionGroup = "NonFinTransaction";
        this.function = "FinishCheckout";
        return;
    }
    throw new Error("Invalid argument");
};
timapi.protocol.sixml.Request_FinishCheckout.prototype = Object.create(timapi.protocol.Message.prototype);
timapi.protocol.sixml.Request_FinishCheckout.prototype.functionGroup = undefined;
timapi.protocol.sixml.Request_FinishCheckout.prototype.function = undefined;
timapi.protocol.sixml.Request_FinishCheckout.prototype.sequenceNumber = undefined;
timapi.protocol.sixml.Request_FinishCheckout.prototype.toXmlNode = function () {
    var node = new timapi.protocol.XmlNode("sixml:Request");
    this.xmlSetAttribute(node, "xmlns:sixml", "http://www.six-payment-services.com/");
    if (this.functionGroup != undefined) {
        this.xmlSetAttribute(node, "FunctionGroup", this.functionGroup);
    }
    if (this.function != undefined) {
        this.xmlSetAttribute(node, "Function", this.function);
    }
    if (this.sequenceNumber != undefined) {
        this.xmlSetAttribute(node, "SequenceNumber", timapi.utils.StringHelper.makeString(this.sequenceNumber));
    }
    return node;
};
timapi.protocol.sixml.Request_LoyaltyData = function (a) {
    if (arguments.length == 1 && a instanceof timapi.protocol.sixml.Request_LoyaltyData) {
        var value = a;
        this.functionGroup = value.functionGroup;
        this.function = value.function;
        this.sequenceNumber = value.sequenceNumber;
        this.loyaltyData = value.loyaltyData ? new timapi.protocol.sixml.LoyaltyData(value.loyaltyData) : undefined;
        this.retainCardFlag = value.retainCardFlag;
        return;
    }
    if (arguments.length == 1 && a instanceof timapi.protocol.XmlNode) {
        var node = a;
        if (this.xmlHasAttribute(node, "FunctionGroup")) {
            this.functionGroup = this.xmlGetAttribute(node, "FunctionGroup");
        }
        if (this.xmlHasAttribute(node, "Function")) {
            this.function = this.xmlGetAttribute(node, "Function");
        }
        if (this.xmlHasAttribute(node, "SequenceNumber")) {
            this.sequenceNumber = (this.xmlGetAttribute(node, "SequenceNumber") ? parseInt(this.xmlGetAttribute(node, "SequenceNumber")) : 0);
        }
        if (this.xmlHasChild(node, "sixml:LoyaltyData")) {
            this.loyaltyData = new timapi.protocol.sixml.LoyaltyData(this.xmlGetChild(node, "sixml:LoyaltyData"));
        }
        if (this.xmlHasChild(node, "sixml:RetainCardFlag")) {
            this.retainCardFlag = this.xmlGetChild(node, "sixml:RetainCardFlag").textContent == "1";
        }
        return;
    }
    if (arguments.length == 0) {
        this.functionGroup = "NonFinTransaction";
        this.function = "LoyaltyData";
        return;
    }
    throw new Error("Invalid argument");
};
timapi.protocol.sixml.Request_LoyaltyData.prototype = Object.create(timapi.protocol.Message.prototype);
timapi.protocol.sixml.Request_LoyaltyData.prototype.functionGroup = undefined;
timapi.protocol.sixml.Request_LoyaltyData.prototype.function = undefined;
timapi.protocol.sixml.Request_LoyaltyData.prototype.sequenceNumber = undefined;
timapi.protocol.sixml.Request_LoyaltyData.prototype.loyaltyData = undefined;
timapi.protocol.sixml.Request_LoyaltyData.prototype.retainCardFlag = undefined;
timapi.protocol.sixml.Request_LoyaltyData.prototype.toXmlNode = function () {
    var node = new timapi.protocol.XmlNode("sixml:Request");
    this.xmlSetAttribute(node, "xmlns:sixml", "http://www.six-payment-services.com/");
    if (this.functionGroup != undefined) {
        this.xmlSetAttribute(node, "FunctionGroup", this.functionGroup);
    }
    if (this.function != undefined) {
        this.xmlSetAttribute(node, "Function", this.function);
    }
    if (this.sequenceNumber != undefined) {
        this.xmlSetAttribute(node, "SequenceNumber", timapi.utils.StringHelper.makeString(this.sequenceNumber));
    }
    if (this.loyaltyData != undefined) {
        this.xmlAddChild(node, "sixml:LoyaltyData", this.loyaltyData);
    }
    if (this.retainCardFlag != undefined) {
        this.xmlAddChild(node, "sixml:RetainCardFlag", (this.retainCardFlag ? "1" : "0"));
    }
    return node;
};
timapi.protocol.sixml.Request_ProvideLoyaltyBasket = function (a) {
    if (arguments.length == 1 && a instanceof timapi.protocol.sixml.Request_ProvideLoyaltyBasket) {
        var value = a;
        this.functionGroup = value.functionGroup;
        this.function = value.function;
        this.sequenceNumber = value.sequenceNumber;
        this.loyaltyBasket = value.loyaltyBasket ? new timapi.protocol.sixml.LoyaltyBasket(value.loyaltyBasket) : undefined;
        return;
    }
    if (arguments.length == 1 && a instanceof timapi.protocol.XmlNode) {
        var node = a;
        if (this.xmlHasAttribute(node, "FunctionGroup")) {
            this.functionGroup = this.xmlGetAttribute(node, "FunctionGroup");
        }
        if (this.xmlHasAttribute(node, "Function")) {
            this.function = this.xmlGetAttribute(node, "Function");
        }
        if (this.xmlHasAttribute(node, "SequenceNumber")) {
            this.sequenceNumber = (this.xmlGetAttribute(node, "SequenceNumber") ? parseInt(this.xmlGetAttribute(node, "SequenceNumber")) : 0);
        }
        if (this.xmlHasChild(node, "sixml:LoyaltyBasket")) {
            this.loyaltyBasket = new timapi.protocol.sixml.LoyaltyBasket(this.xmlGetChild(node, "sixml:LoyaltyBasket"));
        }
        return;
    }
    if (arguments.length == 0) {
        this.functionGroup = "NonFinTransaction";
        this.function = "ProvideLoyaltyBasket";
        return;
    }
    throw new Error("Invalid argument");
};
timapi.protocol.sixml.Request_ProvideLoyaltyBasket.prototype = Object.create(timapi.protocol.Message.prototype);
timapi.protocol.sixml.Request_ProvideLoyaltyBasket.prototype.functionGroup = undefined;
timapi.protocol.sixml.Request_ProvideLoyaltyBasket.prototype.function = undefined;
timapi.protocol.sixml.Request_ProvideLoyaltyBasket.prototype.sequenceNumber = undefined;
timapi.protocol.sixml.Request_ProvideLoyaltyBasket.prototype.loyaltyBasket = undefined;
timapi.protocol.sixml.Request_ProvideLoyaltyBasket.prototype.toXmlNode = function () {
    var node = new timapi.protocol.XmlNode("sixml:Request");
    this.xmlSetAttribute(node, "xmlns:sixml", "http://www.six-payment-services.com/");
    if (this.functionGroup != undefined) {
        this.xmlSetAttribute(node, "FunctionGroup", this.functionGroup);
    }
    if (this.function != undefined) {
        this.xmlSetAttribute(node, "Function", this.function);
    }
    if (this.sequenceNumber != undefined) {
        this.xmlSetAttribute(node, "SequenceNumber", timapi.utils.StringHelper.makeString(this.sequenceNumber));
    }
    if (this.loyaltyBasket != undefined) {
        this.xmlAddChild(node, "sixml:LoyaltyBasket", this.loyaltyBasket);
    }
    return node;
};
timapi.protocol.sixml.Request_PurchaseMailOrdered = function (a) {
    if (arguments.length == 1 && a instanceof timapi.protocol.sixml.Request_PurchaseMailOrdered) {
        var value = a;
        this.functionGroup = value.functionGroup;
        this.function = value.function;
        this.sequenceNumber = value.sequenceNumber;
        this.usrId = value.usrId;
        this.amount = value.amount ? new timapi.protocol.sixml.Amount(value.amount) : undefined;
        this.transactionData = value.transactionData ? new timapi.protocol.sixml.TransactionData(value.transactionData) : undefined;
        this.merchantOptionList = value.merchantOptionList ? new timapi.protocol.sixml.MerchantOptionList(value.merchantOptionList) : undefined;
        return;
    }
    if (arguments.length == 1 && a instanceof timapi.protocol.XmlNode) {
        var node = a;
        if (this.xmlHasAttribute(node, "FunctionGroup")) {
            this.functionGroup = this.xmlGetAttribute(node, "FunctionGroup");
        }
        if (this.xmlHasAttribute(node, "Function")) {
            this.function = this.xmlGetAttribute(node, "Function");
        }
        if (this.xmlHasAttribute(node, "SequenceNumber")) {
            this.sequenceNumber = (this.xmlGetAttribute(node, "SequenceNumber") ? parseInt(this.xmlGetAttribute(node, "SequenceNumber")) : 0);
        }
        if (this.xmlHasChild(node, "sixml:UsrId")) {
            this.usrId = (this.xmlGetChild(node, "sixml:UsrId").textContent ? parseInt(this.xmlGetChild(node, "sixml:UsrId").textContent) : 0);
        }
        if (this.xmlHasChild(node, "sixml:Amount")) {
            this.amount = new timapi.protocol.sixml.Amount(this.xmlGetChild(node, "sixml:Amount"));
        }
        if (this.xmlHasChild(node, "sixml:TransactionData")) {
            this.transactionData = new timapi.protocol.sixml.TransactionData(this.xmlGetChild(node, "sixml:TransactionData"));
        }
        if (this.xmlHasChild(node, "sixml:MerchantOptionList")) {
            this.merchantOptionList = new timapi.protocol.sixml.MerchantOptionList(this.xmlGetChild(node, "sixml:MerchantOptionList"));
        }
        return;
    }
    if (arguments.length == 0) {
        this.functionGroup = "FinTransaction";
        this.function = "PurchaseMailOrdered";
        return;
    }
    throw new Error("Invalid argument");
};
timapi.protocol.sixml.Request_PurchaseMailOrdered.prototype = Object.create(timapi.protocol.Message.prototype);
timapi.protocol.sixml.Request_PurchaseMailOrdered.prototype.functionGroup = undefined;
timapi.protocol.sixml.Request_PurchaseMailOrdered.prototype.function = undefined;
timapi.protocol.sixml.Request_PurchaseMailOrdered.prototype.sequenceNumber = undefined;
timapi.protocol.sixml.Request_PurchaseMailOrdered.prototype.usrId = undefined;
timapi.protocol.sixml.Request_PurchaseMailOrdered.prototype.amount = undefined;
timapi.protocol.sixml.Request_PurchaseMailOrdered.prototype.transactionData = undefined;
timapi.protocol.sixml.Request_PurchaseMailOrdered.prototype.merchantOptionList = undefined;
timapi.protocol.sixml.Request_PurchaseMailOrdered.prototype.toXmlNode = function () {
    var node = new timapi.protocol.XmlNode("sixml:Request");
    this.xmlSetAttribute(node, "xmlns:sixml", "http://www.six-payment-services.com/");
    if (this.functionGroup != undefined) {
        this.xmlSetAttribute(node, "FunctionGroup", this.functionGroup);
    }
    if (this.function != undefined) {
        this.xmlSetAttribute(node, "Function", this.function);
    }
    if (this.sequenceNumber != undefined) {
        this.xmlSetAttribute(node, "SequenceNumber", timapi.utils.StringHelper.makeString(this.sequenceNumber));
    }
    if (this.usrId != undefined) {
        this.xmlAddChild(node, "sixml:UsrId", timapi.utils.StringHelper.makeString(this.usrId));
    }
    if (this.amount != undefined) {
        this.xmlAddChild(node, "sixml:Amount", this.amount);
    }
    if (this.transactionData != undefined) {
        this.xmlAddChild(node, "sixml:TransactionData", this.transactionData);
    }
    if (this.merchantOptionList != undefined) {
        this.xmlAddChild(node, "sixml:MerchantOptionList", this.merchantOptionList);
    }
    return node;
};
timapi.protocol.sixml.Request_PurchasePhoneOrdered = function (a) {
    if (arguments.length == 1 && a instanceof timapi.protocol.sixml.Request_PurchasePhoneOrdered) {
        var value = a;
        this.functionGroup = value.functionGroup;
        this.function = value.function;
        this.sequenceNumber = value.sequenceNumber;
        this.usrId = value.usrId;
        this.amount = value.amount ? new timapi.protocol.sixml.Amount(value.amount) : undefined;
        this.transactionData = value.transactionData ? new timapi.protocol.sixml.TransactionData(value.transactionData) : undefined;
        this.merchantOptionList = value.merchantOptionList ? new timapi.protocol.sixml.MerchantOptionList(value.merchantOptionList) : undefined;
        return;
    }
    if (arguments.length == 1 && a instanceof timapi.protocol.XmlNode) {
        var node = a;
        if (this.xmlHasAttribute(node, "FunctionGroup")) {
            this.functionGroup = this.xmlGetAttribute(node, "FunctionGroup");
        }
        if (this.xmlHasAttribute(node, "Function")) {
            this.function = this.xmlGetAttribute(node, "Function");
        }
        if (this.xmlHasAttribute(node, "SequenceNumber")) {
            this.sequenceNumber = (this.xmlGetAttribute(node, "SequenceNumber") ? parseInt(this.xmlGetAttribute(node, "SequenceNumber")) : 0);
        }
        if (this.xmlHasChild(node, "sixml:UsrId")) {
            this.usrId = (this.xmlGetChild(node, "sixml:UsrId").textContent ? parseInt(this.xmlGetChild(node, "sixml:UsrId").textContent) : 0);
        }
        if (this.xmlHasChild(node, "sixml:Amount")) {
            this.amount = new timapi.protocol.sixml.Amount(this.xmlGetChild(node, "sixml:Amount"));
        }
        if (this.xmlHasChild(node, "sixml:TransactionData")) {
            this.transactionData = new timapi.protocol.sixml.TransactionData(this.xmlGetChild(node, "sixml:TransactionData"));
        }
        if (this.xmlHasChild(node, "sixml:MerchantOptionList")) {
            this.merchantOptionList = new timapi.protocol.sixml.MerchantOptionList(this.xmlGetChild(node, "sixml:MerchantOptionList"));
        }
        return;
    }
    if (arguments.length == 0) {
        this.functionGroup = "FinTransaction";
        this.function = "PurchasePhoneOrdered";
        return;
    }
    throw new Error("Invalid argument");
};
timapi.protocol.sixml.Request_PurchasePhoneOrdered.prototype = Object.create(timapi.protocol.Message.prototype);
timapi.protocol.sixml.Request_PurchasePhoneOrdered.prototype.functionGroup = undefined;
timapi.protocol.sixml.Request_PurchasePhoneOrdered.prototype.function = undefined;
timapi.protocol.sixml.Request_PurchasePhoneOrdered.prototype.sequenceNumber = undefined;
timapi.protocol.sixml.Request_PurchasePhoneOrdered.prototype.usrId = undefined;
timapi.protocol.sixml.Request_PurchasePhoneOrdered.prototype.amount = undefined;
timapi.protocol.sixml.Request_PurchasePhoneOrdered.prototype.transactionData = undefined;
timapi.protocol.sixml.Request_PurchasePhoneOrdered.prototype.merchantOptionList = undefined;
timapi.protocol.sixml.Request_PurchasePhoneOrdered.prototype.toXmlNode = function () {
    var node = new timapi.protocol.XmlNode("sixml:Request");
    this.xmlSetAttribute(node, "xmlns:sixml", "http://www.six-payment-services.com/");
    if (this.functionGroup != undefined) {
        this.xmlSetAttribute(node, "FunctionGroup", this.functionGroup);
    }
    if (this.function != undefined) {
        this.xmlSetAttribute(node, "Function", this.function);
    }
    if (this.sequenceNumber != undefined) {
        this.xmlSetAttribute(node, "SequenceNumber", timapi.utils.StringHelper.makeString(this.sequenceNumber));
    }
    if (this.usrId != undefined) {
        this.xmlAddChild(node, "sixml:UsrId", timapi.utils.StringHelper.makeString(this.usrId));
    }
    if (this.amount != undefined) {
        this.xmlAddChild(node, "sixml:Amount", this.amount);
    }
    if (this.transactionData != undefined) {
        this.xmlAddChild(node, "sixml:TransactionData", this.transactionData);
    }
    if (this.merchantOptionList != undefined) {
        this.xmlAddChild(node, "sixml:MerchantOptionList", this.merchantOptionList);
    }
    return node;
};
timapi.protocol.sixml.Request_PurchaseReservationPhoneAuthorized = function (a) {
    if (arguments.length == 1 && a instanceof timapi.protocol.sixml.Request_PurchaseReservationPhoneAuthorized) {
        var value = a;
        this.functionGroup = value.functionGroup;
        this.function = value.function;
        this.sequenceNumber = value.sequenceNumber;
        this.transactionData = value.transactionData ? new timapi.protocol.sixml.TransactionData(value.transactionData) : undefined;
        this.amount = value.amount ? new timapi.protocol.sixml.Amount(value.amount) : undefined;
        this.merchantOptionList = value.merchantOptionList ? new timapi.protocol.sixml.MerchantOptionList(value.merchantOptionList) : undefined;
        return;
    }
    if (arguments.length == 1 && a instanceof timapi.protocol.XmlNode) {
        var node = a;
        if (this.xmlHasAttribute(node, "FunctionGroup")) {
            this.functionGroup = this.xmlGetAttribute(node, "FunctionGroup");
        }
        if (this.xmlHasAttribute(node, "Function")) {
            this.function = this.xmlGetAttribute(node, "Function");
        }
        if (this.xmlHasAttribute(node, "SequenceNumber")) {
            this.sequenceNumber = (this.xmlGetAttribute(node, "SequenceNumber") ? parseInt(this.xmlGetAttribute(node, "SequenceNumber")) : 0);
        }
        if (this.xmlHasChild(node, "sixml:TransactionData")) {
            this.transactionData = new timapi.protocol.sixml.TransactionData(this.xmlGetChild(node, "sixml:TransactionData"));
        }
        if (this.xmlHasChild(node, "sixml:Amount")) {
            this.amount = new timapi.protocol.sixml.Amount(this.xmlGetChild(node, "sixml:Amount"));
        }
        if (this.xmlHasChild(node, "sixml:MerchantOptionList")) {
            this.merchantOptionList = new timapi.protocol.sixml.MerchantOptionList(this.xmlGetChild(node, "sixml:MerchantOptionList"));
        }
        return;
    }
    if (arguments.length == 0) {
        this.functionGroup = "FinTransaction";
        this.function = "PurchaseReservationPhoneAuthorized";
        return;
    }
    throw new Error("Invalid argument");
};
timapi.protocol.sixml.Request_PurchaseReservationPhoneAuthorized.prototype = Object.create(timapi.protocol.Message.prototype);
timapi.protocol.sixml.Request_PurchaseReservationPhoneAuthorized.prototype.functionGroup = undefined;
timapi.protocol.sixml.Request_PurchaseReservationPhoneAuthorized.prototype.function = undefined;
timapi.protocol.sixml.Request_PurchaseReservationPhoneAuthorized.prototype.sequenceNumber = undefined;
timapi.protocol.sixml.Request_PurchaseReservationPhoneAuthorized.prototype.transactionData = undefined;
timapi.protocol.sixml.Request_PurchaseReservationPhoneAuthorized.prototype.amount = undefined;
timapi.protocol.sixml.Request_PurchaseReservationPhoneAuthorized.prototype.merchantOptionList = undefined;
timapi.protocol.sixml.Request_PurchaseReservationPhoneAuthorized.prototype.toXmlNode = function () {
    var node = new timapi.protocol.XmlNode("sixml:Request");
    this.xmlSetAttribute(node, "xmlns:sixml", "http://www.six-payment-services.com/");
    if (this.functionGroup != undefined) {
        this.xmlSetAttribute(node, "FunctionGroup", this.functionGroup);
    }
    if (this.function != undefined) {
        this.xmlSetAttribute(node, "Function", this.function);
    }
    if (this.sequenceNumber != undefined) {
        this.xmlSetAttribute(node, "SequenceNumber", timapi.utils.StringHelper.makeString(this.sequenceNumber));
    }
    if (this.transactionData != undefined) {
        this.xmlAddChild(node, "sixml:TransactionData", this.transactionData);
    }
    if (this.amount != undefined) {
        this.xmlAddChild(node, "sixml:Amount", this.amount);
    }
    if (this.merchantOptionList != undefined) {
        this.xmlAddChild(node, "sixml:MerchantOptionList", this.merchantOptionList);
    }
    return node;
};
timapi.protocol.sixml.Request_SendCardCommand = function (a) {
    if (arguments.length == 1 && a instanceof timapi.protocol.sixml.Request_SendCardCommand) {
        var value = a;
        this.functionGroup = value.functionGroup;
        this.function = value.function;
        this.sequenceNumber = value.sequenceNumber;
        this.commandRequestList = value.commandRequestList ? new timapi.protocol.sixml.CommandRequestList(value.commandRequestList) : undefined;
        return;
    }
    if (arguments.length == 1 && a instanceof timapi.protocol.XmlNode) {
        var node = a;
        if (this.xmlHasAttribute(node, "FunctionGroup")) {
            this.functionGroup = this.xmlGetAttribute(node, "FunctionGroup");
        }
        if (this.xmlHasAttribute(node, "Function")) {
            this.function = this.xmlGetAttribute(node, "Function");
        }
        if (this.xmlHasAttribute(node, "SequenceNumber")) {
            this.sequenceNumber = (this.xmlGetAttribute(node, "SequenceNumber") ? parseInt(this.xmlGetAttribute(node, "SequenceNumber")) : 0);
        }
        if (this.xmlHasChild(node, "sixml:CommandRequestList")) {
            this.commandRequestList = new timapi.protocol.sixml.CommandRequestList(this.xmlGetChild(node, "sixml:CommandRequestList"));
        }
        return;
    }
    if (arguments.length == 0) {
        this.functionGroup = "Dialog";
        this.function = "SendCardCommand";
        return;
    }
    throw new Error("Invalid argument");
};
timapi.protocol.sixml.Request_SendCardCommand.prototype = Object.create(timapi.protocol.Message.prototype);
timapi.protocol.sixml.Request_SendCardCommand.prototype.functionGroup = undefined;
timapi.protocol.sixml.Request_SendCardCommand.prototype.function = undefined;
timapi.protocol.sixml.Request_SendCardCommand.prototype.sequenceNumber = undefined;
timapi.protocol.sixml.Request_SendCardCommand.prototype.commandRequestList = undefined;
timapi.protocol.sixml.Request_SendCardCommand.prototype.toXmlNode = function () {
    var node = new timapi.protocol.XmlNode("sixml:Request");
    this.xmlSetAttribute(node, "xmlns:sixml", "http://www.six-payment-services.com/");
    if (this.functionGroup != undefined) {
        this.xmlSetAttribute(node, "FunctionGroup", this.functionGroup);
    }
    if (this.function != undefined) {
        this.xmlSetAttribute(node, "Function", this.function);
    }
    if (this.sequenceNumber != undefined) {
        this.xmlSetAttribute(node, "SequenceNumber", timapi.utils.StringHelper.makeString(this.sequenceNumber));
    }
    if (this.commandRequestList != undefined) {
        this.xmlAddChild(node, "sixml:CommandRequestList", this.commandRequestList);
    }
    return node;
};
timapi.protocol.sixml.Request_StartCheckout = function (a) {
    if (arguments.length == 1 && a instanceof timapi.protocol.sixml.Request_StartCheckout) {
        var value = a;
        this.functionGroup = value.functionGroup;
        this.function = value.function;
        this.sequenceNumber = value.sequenceNumber;
        return;
    }
    if (arguments.length == 1 && a instanceof timapi.protocol.XmlNode) {
        var node = a;
        if (this.xmlHasAttribute(node, "FunctionGroup")) {
            this.functionGroup = this.xmlGetAttribute(node, "FunctionGroup");
        }
        if (this.xmlHasAttribute(node, "Function")) {
            this.function = this.xmlGetAttribute(node, "Function");
        }
        if (this.xmlHasAttribute(node, "SequenceNumber")) {
            this.sequenceNumber = (this.xmlGetAttribute(node, "SequenceNumber") ? parseInt(this.xmlGetAttribute(node, "SequenceNumber")) : 0);
        }
        return;
    }
    if (arguments.length == 0) {
        this.functionGroup = "NonFinTransaction";
        this.function = "StartCheckout";
        return;
    }
    throw new Error("Invalid argument");
};
timapi.protocol.sixml.Request_StartCheckout.prototype = Object.create(timapi.protocol.Message.prototype);
timapi.protocol.sixml.Request_StartCheckout.prototype.functionGroup = undefined;
timapi.protocol.sixml.Request_StartCheckout.prototype.function = undefined;
timapi.protocol.sixml.Request_StartCheckout.prototype.sequenceNumber = undefined;
timapi.protocol.sixml.Request_StartCheckout.prototype.toXmlNode = function () {
    var node = new timapi.protocol.XmlNode("sixml:Request");
    this.xmlSetAttribute(node, "xmlns:sixml", "http://www.six-payment-services.com/");
    if (this.functionGroup != undefined) {
        this.xmlSetAttribute(node, "FunctionGroup", this.functionGroup);
    }
    if (this.function != undefined) {
        this.xmlSetAttribute(node, "Function", this.function);
    }
    if (this.sequenceNumber != undefined) {
        this.xmlSetAttribute(node, "SequenceNumber", timapi.utils.StringHelper.makeString(this.sequenceNumber));
    }
    return node;
};
timapi.protocol.sixml.ResourceParameter = function (a) {
    if (arguments.length == 1 && a instanceof timapi.protocol.sixml.ResourceParameter) {
        var value = a;
        this.value = value.value;
        this.resourceParameterType = value.resourceParameterType;
        return;
    }
    if (arguments.length == 1 && a instanceof timapi.protocol.XmlNode) {
        var node = a;
        this.value = node.textContent;
        if (this.xmlHasAttribute(node, "ResourceParameterType")) {
            this.resourceParameterType = this.xmlGetAttribute(node, "ResourceParameterType");
        }
        return;
    }
    if (arguments.length != 0) {
        throw new Error("Invalid argument");
    }
};
timapi.protocol.sixml.ResourceParameter.prototype = Object.create(timapi.protocol.Container.prototype);
timapi.protocol.sixml.ResourceParameter.prototype.value = "";
timapi.protocol.sixml.ResourceParameter.prototype.resourceParameterType = undefined;
timapi.protocol.sixml.ResourceParameter.prototype.toXmlNode = function () {
    var node = new timapi.protocol.XmlNode("sixml:ResourceParameter");
    node.textContent = this.value;
    if (this.resourceParameterType != undefined) {
        this.xmlSetAttribute(node, "ResourceParameterType", this.resourceParameterType);
    }
    return node;
};
timapi.protocol.sixml.ResourceParameterList = function (a) {
    this.resourceParameter = [];
    if (arguments.length == 1 && a instanceof timapi.protocol.sixml.ResourceParameterList) {
        var value = a;
        for (var each of value.resourceParameter) {
            this.resourceParameter.push(each ? new timapi.protocol.sixml.ResourceParameter(each) : undefined);
        }
        return;
    }
    if (arguments.length == 1 && a instanceof timapi.protocol.XmlNode) {
        var node = a;
        for (var each of this.xmlGetChildren(node, "sixml:ResourceParameter")) {
            this.resourceParameter.push(new timapi.protocol.sixml.ResourceParameter(each));
        }
        return;
    }
    if (arguments.length != 0) {
        throw new Error("Invalid argument");
    }
};
timapi.protocol.sixml.ResourceParameterList.prototype = Object.create(timapi.protocol.Container.prototype);
timapi.protocol.sixml.ResourceParameterList.prototype.resourceParameter = undefined;
timapi.protocol.sixml.ResourceParameterList.prototype.toXmlNode = function () {
    var node = new timapi.protocol.XmlNode("sixml:ResourceParameterList");
    for (var each of this.resourceParameter) {
        this.xmlAddChild(node, "sixml:ResourceParameter", each);
    }
    return node;
};
timapi.protocol.sixml.Response_FinishCheckout = function (a) {
    if (arguments.length == 1 && a instanceof timapi.protocol.sixml.Response_FinishCheckout) {
        var value = a;
        this.functionGroup = value.functionGroup;
        this.function = value.function;
        this.sequenceNumber = value.sequenceNumber;
        this.resultCode = value.resultCode;
        this.timeStamp = value.timeStamp;
        this.loyaltyCheckoutInformation = value.loyaltyCheckoutInformation ? new timapi.protocol.sixml.LoyaltyCheckoutInformation(value.loyaltyCheckoutInformation) : undefined;
        return;
    }
    if (arguments.length == 1 && a instanceof timapi.protocol.XmlNode) {
        var node = a;
        if (this.xmlHasAttribute(node, "FunctionGroup")) {
            this.functionGroup = this.xmlGetAttribute(node, "FunctionGroup");
        }
        if (this.xmlHasAttribute(node, "Function")) {
            this.function = this.xmlGetAttribute(node, "Function");
        }
        if (this.xmlHasAttribute(node, "SequenceNumber")) {
            this.sequenceNumber = (this.xmlGetAttribute(node, "SequenceNumber") ? parseInt(this.xmlGetAttribute(node, "SequenceNumber")) : 0);
        }
        if (this.xmlHasAttribute(node, "ResultCode")) {
            this.resultCode = (this.xmlGetAttribute(node, "ResultCode") ? parseInt(this.xmlGetAttribute(node, "ResultCode")) : 0);
        }
        if (this.xmlHasAttribute(node, "TimeStamp")) {
            this.timeStamp = new timapi.protocol.TimeDate("yyyyMMdd'T'HHmmssZ", this.xmlGetAttribute(node, "TimeStamp"));
        }
        if (this.xmlHasChild(node, "sixml:LoyaltyCheckoutInformation")) {
            this.loyaltyCheckoutInformation = new timapi.protocol.sixml.LoyaltyCheckoutInformation(this.xmlGetChild(node, "sixml:LoyaltyCheckoutInformation"));
        }
        return;
    }
    if (arguments.length == 0) {
        this.functionGroup = "NonFinTransaction";
        this.function = "FinishCheckout";
        return;
    }
    throw new Error("Invalid argument");
};
timapi.protocol.sixml.Response_FinishCheckout.prototype = Object.create(timapi.protocol.Message.prototype);
timapi.protocol.sixml.Response_FinishCheckout.prototype.functionGroup = undefined;
timapi.protocol.sixml.Response_FinishCheckout.prototype.function = undefined;
timapi.protocol.sixml.Response_FinishCheckout.prototype.sequenceNumber = undefined;
timapi.protocol.sixml.Response_FinishCheckout.prototype.resultCode = undefined;
timapi.protocol.sixml.Response_FinishCheckout.prototype.timeStamp = undefined;
timapi.protocol.sixml.Response_FinishCheckout.prototype.loyaltyCheckoutInformation = undefined;
timapi.protocol.sixml.Response_FinishCheckout.prototype.toXmlNode = function () {
    var node = new timapi.protocol.XmlNode("sixml:Response");
    this.xmlSetAttribute(node, "xmlns:sixml", "http://www.six-payment-services.com/");
    if (this.functionGroup != undefined) {
        this.xmlSetAttribute(node, "FunctionGroup", this.functionGroup);
    }
    if (this.function != undefined) {
        this.xmlSetAttribute(node, "Function", this.function);
    }
    if (this.sequenceNumber != undefined) {
        this.xmlSetAttribute(node, "SequenceNumber", timapi.utils.StringHelper.makeString(this.sequenceNumber));
    }
    if (this.resultCode != undefined) {
        this.xmlSetAttribute(node, "ResultCode", timapi.utils.StringHelper.makeString(this.resultCode));
    }
    if (this.timeStamp != undefined) {
        this.xmlSetAttribute(node, "TimeStamp", this.timeStamp.format("yyyyMMdd'T'HHmmssZ"));
    }
    if (this.loyaltyCheckoutInformation != undefined) {
        this.xmlAddChild(node, "sixml:LoyaltyCheckoutInformation", this.loyaltyCheckoutInformation);
    }
    return node;
};
timapi.protocol.sixml.Response_LoyaltyData = function (a) {
    if (arguments.length == 1 && a instanceof timapi.protocol.sixml.Response_LoyaltyData) {
        var value = a;
        this.functionGroup = value.functionGroup;
        this.function = value.function;
        this.sequenceNumber = value.sequenceNumber;
        this.resultCode = value.resultCode;
        this.timeStamp = value.timeStamp;
        this.cardData = value.cardData ? new timapi.protocol.sixml.CardData(value.cardData) : undefined;
        return;
    }
    if (arguments.length == 1 && a instanceof timapi.protocol.XmlNode) {
        var node = a;
        if (this.xmlHasAttribute(node, "FunctionGroup")) {
            this.functionGroup = this.xmlGetAttribute(node, "FunctionGroup");
        }
        if (this.xmlHasAttribute(node, "Function")) {
            this.function = this.xmlGetAttribute(node, "Function");
        }
        if (this.xmlHasAttribute(node, "SequenceNumber")) {
            this.sequenceNumber = (this.xmlGetAttribute(node, "SequenceNumber") ? parseInt(this.xmlGetAttribute(node, "SequenceNumber")) : 0);
        }
        if (this.xmlHasAttribute(node, "ResultCode")) {
            this.resultCode = (this.xmlGetAttribute(node, "ResultCode") ? parseInt(this.xmlGetAttribute(node, "ResultCode")) : 0);
        }
        if (this.xmlHasAttribute(node, "TimeStamp")) {
            this.timeStamp = new timapi.protocol.TimeDate("yyyyMMdd'T'HHmmssZ", this.xmlGetAttribute(node, "TimeStamp"));
        }
        if (this.xmlHasChild(node, "sixml:CardData")) {
            this.cardData = new timapi.protocol.sixml.CardData(this.xmlGetChild(node, "sixml:CardData"));
        }
        return;
    }
    if (arguments.length == 0) {
        this.functionGroup = "NonFinTransaction";
        this.function = "LoyaltyData";
        return;
    }
    throw new Error("Invalid argument");
};
timapi.protocol.sixml.Response_LoyaltyData.prototype = Object.create(timapi.protocol.Message.prototype);
timapi.protocol.sixml.Response_LoyaltyData.prototype.functionGroup = undefined;
timapi.protocol.sixml.Response_LoyaltyData.prototype.function = undefined;
timapi.protocol.sixml.Response_LoyaltyData.prototype.sequenceNumber = undefined;
timapi.protocol.sixml.Response_LoyaltyData.prototype.resultCode = undefined;
timapi.protocol.sixml.Response_LoyaltyData.prototype.timeStamp = undefined;
timapi.protocol.sixml.Response_LoyaltyData.prototype.cardData = undefined;
timapi.protocol.sixml.Response_LoyaltyData.prototype.toXmlNode = function () {
    var node = new timapi.protocol.XmlNode("sixml:Response");
    this.xmlSetAttribute(node, "xmlns:sixml", "http://www.six-payment-services.com/");
    if (this.functionGroup != undefined) {
        this.xmlSetAttribute(node, "FunctionGroup", this.functionGroup);
    }
    if (this.function != undefined) {
        this.xmlSetAttribute(node, "Function", this.function);
    }
    if (this.sequenceNumber != undefined) {
        this.xmlSetAttribute(node, "SequenceNumber", timapi.utils.StringHelper.makeString(this.sequenceNumber));
    }
    if (this.resultCode != undefined) {
        this.xmlSetAttribute(node, "ResultCode", timapi.utils.StringHelper.makeString(this.resultCode));
    }
    if (this.timeStamp != undefined) {
        this.xmlSetAttribute(node, "TimeStamp", this.timeStamp.format("yyyyMMdd'T'HHmmssZ"));
    }
    if (this.cardData != undefined) {
        this.xmlAddChild(node, "sixml:CardData", this.cardData);
    }
    return node;
};
timapi.protocol.sixml.Response_ProvideLoyaltyBasket = function (a) {
    if (arguments.length == 1 && a instanceof timapi.protocol.sixml.Response_ProvideLoyaltyBasket) {
        var value = a;
        this.functionGroup = value.functionGroup;
        this.function = value.function;
        this.sequenceNumber = value.sequenceNumber;
        this.resultCode = value.resultCode;
        this.timeStamp = value.timeStamp;
        this.loyaltyBasket = value.loyaltyBasket ? new timapi.protocol.sixml.LoyaltyBasket(value.loyaltyBasket) : undefined;
        return;
    }
    if (arguments.length == 1 && a instanceof timapi.protocol.XmlNode) {
        var node = a;
        if (this.xmlHasAttribute(node, "FunctionGroup")) {
            this.functionGroup = this.xmlGetAttribute(node, "FunctionGroup");
        }
        if (this.xmlHasAttribute(node, "Function")) {
            this.function = this.xmlGetAttribute(node, "Function");
        }
        if (this.xmlHasAttribute(node, "SequenceNumber")) {
            this.sequenceNumber = (this.xmlGetAttribute(node, "SequenceNumber") ? parseInt(this.xmlGetAttribute(node, "SequenceNumber")) : 0);
        }
        if (this.xmlHasAttribute(node, "ResultCode")) {
            this.resultCode = (this.xmlGetAttribute(node, "ResultCode") ? parseInt(this.xmlGetAttribute(node, "ResultCode")) : 0);
        }
        if (this.xmlHasAttribute(node, "TimeStamp")) {
            this.timeStamp = new timapi.protocol.TimeDate("yyyyMMdd'T'HHmmssZ", this.xmlGetAttribute(node, "TimeStamp"));
        }
        if (this.xmlHasChild(node, "sixml:LoyaltyBasket")) {
            this.loyaltyBasket = new timapi.protocol.sixml.LoyaltyBasket(this.xmlGetChild(node, "sixml:LoyaltyBasket"));
        }
        return;
    }
    if (arguments.length == 0) {
        this.functionGroup = "NonFinTransaction";
        this.function = "ProvideLoyaltyBasket";
        return;
    }
    throw new Error("Invalid argument");
};
timapi.protocol.sixml.Response_ProvideLoyaltyBasket.prototype = Object.create(timapi.protocol.Message.prototype);
timapi.protocol.sixml.Response_ProvideLoyaltyBasket.prototype.functionGroup = undefined;
timapi.protocol.sixml.Response_ProvideLoyaltyBasket.prototype.function = undefined;
timapi.protocol.sixml.Response_ProvideLoyaltyBasket.prototype.sequenceNumber = undefined;
timapi.protocol.sixml.Response_ProvideLoyaltyBasket.prototype.resultCode = undefined;
timapi.protocol.sixml.Response_ProvideLoyaltyBasket.prototype.timeStamp = undefined;
timapi.protocol.sixml.Response_ProvideLoyaltyBasket.prototype.loyaltyBasket = undefined;
timapi.protocol.sixml.Response_ProvideLoyaltyBasket.prototype.toXmlNode = function () {
    var node = new timapi.protocol.XmlNode("sixml:Response");
    this.xmlSetAttribute(node, "xmlns:sixml", "http://www.six-payment-services.com/");
    if (this.functionGroup != undefined) {
        this.xmlSetAttribute(node, "FunctionGroup", this.functionGroup);
    }
    if (this.function != undefined) {
        this.xmlSetAttribute(node, "Function", this.function);
    }
    if (this.sequenceNumber != undefined) {
        this.xmlSetAttribute(node, "SequenceNumber", timapi.utils.StringHelper.makeString(this.sequenceNumber));
    }
    if (this.resultCode != undefined) {
        this.xmlSetAttribute(node, "ResultCode", timapi.utils.StringHelper.makeString(this.resultCode));
    }
    if (this.timeStamp != undefined) {
        this.xmlSetAttribute(node, "TimeStamp", this.timeStamp.format("yyyyMMdd'T'HHmmssZ"));
    }
    if (this.loyaltyBasket != undefined) {
        this.xmlAddChild(node, "sixml:LoyaltyBasket", this.loyaltyBasket);
    }
    return node;
};
timapi.protocol.sixml.Response_PurchaseMailOrdered = function (a) {
    if (arguments.length == 1 && a instanceof timapi.protocol.sixml.Response_PurchaseMailOrdered) {
        var value = a;
        this.functionGroup = value.functionGroup;
        this.function = value.function;
        this.sequenceNumber = value.sequenceNumber;
        this.resultCode = value.resultCode;
        this.timeStamp = value.timeStamp;
        this.transactionInformation = value.transactionInformation ? new timapi.protocol.sixml.TransactionInformation(value.transactionInformation) : undefined;
        this.amount = value.amount ? new timapi.protocol.sixml.Amount(value.amount) : undefined;
        this.amountDue = value.amountDue ? new timapi.protocol.sixml.AmountDue(value.amountDue) : undefined;
        this.amountDcc = value.amountDcc ? new timapi.protocol.sixml.AmountDcc(value.amountDcc) : undefined;
        this.amountSaldo = value.amountSaldo ? new timapi.protocol.sixml.AmountSaldo(value.amountSaldo) : undefined;
        this.dccDisclaimer = value.dccDisclaimer;
        this.disclaimer = value.disclaimer;
        this.cardData = value.cardData ? new timapi.protocol.sixml.CardData(value.cardData) : undefined;
        this.printData = value.printData ? new timapi.protocol.sixml.PrintData(value.printData) : undefined;
        return;
    }
    if (arguments.length == 1 && a instanceof timapi.protocol.XmlNode) {
        var node = a;
        if (this.xmlHasAttribute(node, "FunctionGroup")) {
            this.functionGroup = this.xmlGetAttribute(node, "FunctionGroup");
        }
        if (this.xmlHasAttribute(node, "Function")) {
            this.function = this.xmlGetAttribute(node, "Function");
        }
        if (this.xmlHasAttribute(node, "SequenceNumber")) {
            this.sequenceNumber = (this.xmlGetAttribute(node, "SequenceNumber") ? parseInt(this.xmlGetAttribute(node, "SequenceNumber")) : 0);
        }
        if (this.xmlHasAttribute(node, "ResultCode")) {
            this.resultCode = (this.xmlGetAttribute(node, "ResultCode") ? parseInt(this.xmlGetAttribute(node, "ResultCode")) : 0);
        }
        if (this.xmlHasAttribute(node, "TimeStamp")) {
            this.timeStamp = new timapi.protocol.TimeDate("yyyyMMdd'T'HHmmssZ", this.xmlGetAttribute(node, "TimeStamp"));
        }
        if (this.xmlHasChild(node, "sixml:TransactionInformation")) {
            this.transactionInformation = new timapi.protocol.sixml.TransactionInformation(this.xmlGetChild(node, "sixml:TransactionInformation"));
        }
        if (this.xmlHasChild(node, "sixml:Amount")) {
            this.amount = new timapi.protocol.sixml.Amount(this.xmlGetChild(node, "sixml:Amount"));
        }
        if (this.xmlHasChild(node, "sixml:AmountDue")) {
            this.amountDue = new timapi.protocol.sixml.AmountDue(this.xmlGetChild(node, "sixml:AmountDue"));
        }
        if (this.xmlHasChild(node, "sixml:AmountDcc")) {
            this.amountDcc = new timapi.protocol.sixml.AmountDcc(this.xmlGetChild(node, "sixml:AmountDcc"));
        }
        if (this.xmlHasChild(node, "sixml:AmountSaldo")) {
            this.amountSaldo = new timapi.protocol.sixml.AmountSaldo(this.xmlGetChild(node, "sixml:AmountSaldo"));
        }
        if (this.xmlHasChild(node, "sixml:DccDisclaimer")) {
            this.dccDisclaimer = this.xmlGetChild(node, "sixml:DccDisclaimer").textContent;
        }
        if (this.xmlHasChild(node, "sixml:Disclaimer")) {
            this.disclaimer = this.xmlGetChild(node, "sixml:Disclaimer").textContent;
        }
        if (this.xmlHasChild(node, "sixml:CardData")) {
            this.cardData = new timapi.protocol.sixml.CardData(this.xmlGetChild(node, "sixml:CardData"));
        }
        if (this.xmlHasChild(node, "sixml:PrintData")) {
            this.printData = new timapi.protocol.sixml.PrintData(this.xmlGetChild(node, "sixml:PrintData"));
        }
        return;
    }
    if (arguments.length == 0) {
        this.functionGroup = "FinTransaction";
        this.function = "PurchaseMailOrdered";
        return;
    }
    throw new Error("Invalid argument");
};
timapi.protocol.sixml.Response_PurchaseMailOrdered.prototype = Object.create(timapi.protocol.Message.prototype);
timapi.protocol.sixml.Response_PurchaseMailOrdered.prototype.functionGroup = undefined;
timapi.protocol.sixml.Response_PurchaseMailOrdered.prototype.function = undefined;
timapi.protocol.sixml.Response_PurchaseMailOrdered.prototype.sequenceNumber = undefined;
timapi.protocol.sixml.Response_PurchaseMailOrdered.prototype.resultCode = undefined;
timapi.protocol.sixml.Response_PurchaseMailOrdered.prototype.timeStamp = undefined;
timapi.protocol.sixml.Response_PurchaseMailOrdered.prototype.transactionInformation = undefined;
timapi.protocol.sixml.Response_PurchaseMailOrdered.prototype.amount = undefined;
timapi.protocol.sixml.Response_PurchaseMailOrdered.prototype.amountDue = undefined;
timapi.protocol.sixml.Response_PurchaseMailOrdered.prototype.amountDcc = undefined;
timapi.protocol.sixml.Response_PurchaseMailOrdered.prototype.amountSaldo = undefined;
timapi.protocol.sixml.Response_PurchaseMailOrdered.prototype.dccDisclaimer = undefined;
timapi.protocol.sixml.Response_PurchaseMailOrdered.prototype.disclaimer = undefined;
timapi.protocol.sixml.Response_PurchaseMailOrdered.prototype.cardData = undefined;
timapi.protocol.sixml.Response_PurchaseMailOrdered.prototype.printData = undefined;
timapi.protocol.sixml.Response_PurchaseMailOrdered.prototype.toXmlNode = function () {
    var node = new timapi.protocol.XmlNode("sixml:Response");
    this.xmlSetAttribute(node, "xmlns:sixml", "http://www.six-payment-services.com/");
    if (this.functionGroup != undefined) {
        this.xmlSetAttribute(node, "FunctionGroup", this.functionGroup);
    }
    if (this.function != undefined) {
        this.xmlSetAttribute(node, "Function", this.function);
    }
    if (this.sequenceNumber != undefined) {
        this.xmlSetAttribute(node, "SequenceNumber", timapi.utils.StringHelper.makeString(this.sequenceNumber));
    }
    if (this.resultCode != undefined) {
        this.xmlSetAttribute(node, "ResultCode", timapi.utils.StringHelper.makeString(this.resultCode));
    }
    if (this.timeStamp != undefined) {
        this.xmlSetAttribute(node, "TimeStamp", this.timeStamp.format("yyyyMMdd'T'HHmmssZ"));
    }
    if (this.transactionInformation != undefined) {
        this.xmlAddChild(node, "sixml:TransactionInformation", this.transactionInformation);
    }
    if (this.amount != undefined) {
        this.xmlAddChild(node, "sixml:Amount", this.amount);
    }
    if (this.amountDue != undefined) {
        this.xmlAddChild(node, "sixml:AmountDue", this.amountDue);
    }
    if (this.amountDcc != undefined) {
        this.xmlAddChild(node, "sixml:AmountDcc", this.amountDcc);
    }
    if (this.amountSaldo != undefined) {
        this.xmlAddChild(node, "sixml:AmountSaldo", this.amountSaldo);
    }
    if (this.dccDisclaimer != undefined) {
        this.xmlAddChild(node, "sixml:DccDisclaimer", this.dccDisclaimer);
    }
    if (this.disclaimer != undefined) {
        this.xmlAddChild(node, "sixml:Disclaimer", this.disclaimer);
    }
    if (this.cardData != undefined) {
        this.xmlAddChild(node, "sixml:CardData", this.cardData);
    }
    if (this.printData != undefined) {
        this.xmlAddChild(node, "sixml:PrintData", this.printData);
    }
    return node;
};
timapi.protocol.sixml.Response_PurchasePhoneOrdered = function (a) {
    if (arguments.length == 1 && a instanceof timapi.protocol.sixml.Response_PurchasePhoneOrdered) {
        var value = a;
        this.functionGroup = value.functionGroup;
        this.function = value.function;
        this.sequenceNumber = value.sequenceNumber;
        this.resultCode = value.resultCode;
        this.timeStamp = value.timeStamp;
        this.transactionInformation = value.transactionInformation ? new timapi.protocol.sixml.TransactionInformation(value.transactionInformation) : undefined;
        this.amount = value.amount ? new timapi.protocol.sixml.Amount(value.amount) : undefined;
        this.amountDue = value.amountDue ? new timapi.protocol.sixml.AmountDue(value.amountDue) : undefined;
        this.amountDcc = value.amountDcc ? new timapi.protocol.sixml.AmountDcc(value.amountDcc) : undefined;
        this.amountSaldo = value.amountSaldo ? new timapi.protocol.sixml.AmountSaldo(value.amountSaldo) : undefined;
        this.dccDisclaimer = value.dccDisclaimer;
        this.disclaimer = value.disclaimer;
        this.cardData = value.cardData ? new timapi.protocol.sixml.CardData(value.cardData) : undefined;
        this.printData = value.printData ? new timapi.protocol.sixml.PrintData(value.printData) : undefined;
        return;
    }
    if (arguments.length == 1 && a instanceof timapi.protocol.XmlNode) {
        var node = a;
        if (this.xmlHasAttribute(node, "FunctionGroup")) {
            this.functionGroup = this.xmlGetAttribute(node, "FunctionGroup");
        }
        if (this.xmlHasAttribute(node, "Function")) {
            this.function = this.xmlGetAttribute(node, "Function");
        }
        if (this.xmlHasAttribute(node, "SequenceNumber")) {
            this.sequenceNumber = (this.xmlGetAttribute(node, "SequenceNumber") ? parseInt(this.xmlGetAttribute(node, "SequenceNumber")) : 0);
        }
        if (this.xmlHasAttribute(node, "ResultCode")) {
            this.resultCode = (this.xmlGetAttribute(node, "ResultCode") ? parseInt(this.xmlGetAttribute(node, "ResultCode")) : 0);
        }
        if (this.xmlHasAttribute(node, "TimeStamp")) {
            this.timeStamp = new timapi.protocol.TimeDate("yyyyMMdd'T'HHmmssZ", this.xmlGetAttribute(node, "TimeStamp"));
        }
        if (this.xmlHasChild(node, "sixml:TransactionInformation")) {
            this.transactionInformation = new timapi.protocol.sixml.TransactionInformation(this.xmlGetChild(node, "sixml:TransactionInformation"));
        }
        if (this.xmlHasChild(node, "sixml:Amount")) {
            this.amount = new timapi.protocol.sixml.Amount(this.xmlGetChild(node, "sixml:Amount"));
        }
        if (this.xmlHasChild(node, "sixml:AmountDue")) {
            this.amountDue = new timapi.protocol.sixml.AmountDue(this.xmlGetChild(node, "sixml:AmountDue"));
        }
        if (this.xmlHasChild(node, "sixml:AmountDcc")) {
            this.amountDcc = new timapi.protocol.sixml.AmountDcc(this.xmlGetChild(node, "sixml:AmountDcc"));
        }
        if (this.xmlHasChild(node, "sixml:AmountSaldo")) {
            this.amountSaldo = new timapi.protocol.sixml.AmountSaldo(this.xmlGetChild(node, "sixml:AmountSaldo"));
        }
        if (this.xmlHasChild(node, "sixml:DccDisclaimer")) {
            this.dccDisclaimer = this.xmlGetChild(node, "sixml:DccDisclaimer").textContent;
        }
        if (this.xmlHasChild(node, "sixml:Disclaimer")) {
            this.disclaimer = this.xmlGetChild(node, "sixml:Disclaimer").textContent;
        }
        if (this.xmlHasChild(node, "sixml:CardData")) {
            this.cardData = new timapi.protocol.sixml.CardData(this.xmlGetChild(node, "sixml:CardData"));
        }
        if (this.xmlHasChild(node, "sixml:PrintData")) {
            this.printData = new timapi.protocol.sixml.PrintData(this.xmlGetChild(node, "sixml:PrintData"));
        }
        return;
    }
    if (arguments.length == 0) {
        this.functionGroup = "FinTransaction";
        this.function = "PurchasePhoneOrdered";
        return;
    }
    throw new Error("Invalid argument");
};
timapi.protocol.sixml.Response_PurchasePhoneOrdered.prototype = Object.create(timapi.protocol.Message.prototype);
timapi.protocol.sixml.Response_PurchasePhoneOrdered.prototype.functionGroup = undefined;
timapi.protocol.sixml.Response_PurchasePhoneOrdered.prototype.function = undefined;
timapi.protocol.sixml.Response_PurchasePhoneOrdered.prototype.sequenceNumber = undefined;
timapi.protocol.sixml.Response_PurchasePhoneOrdered.prototype.resultCode = undefined;
timapi.protocol.sixml.Response_PurchasePhoneOrdered.prototype.timeStamp = undefined;
timapi.protocol.sixml.Response_PurchasePhoneOrdered.prototype.transactionInformation = undefined;
timapi.protocol.sixml.Response_PurchasePhoneOrdered.prototype.amount = undefined;
timapi.protocol.sixml.Response_PurchasePhoneOrdered.prototype.amountDue = undefined;
timapi.protocol.sixml.Response_PurchasePhoneOrdered.prototype.amountDcc = undefined;
timapi.protocol.sixml.Response_PurchasePhoneOrdered.prototype.amountSaldo = undefined;
timapi.protocol.sixml.Response_PurchasePhoneOrdered.prototype.dccDisclaimer = undefined;
timapi.protocol.sixml.Response_PurchasePhoneOrdered.prototype.disclaimer = undefined;
timapi.protocol.sixml.Response_PurchasePhoneOrdered.prototype.cardData = undefined;
timapi.protocol.sixml.Response_PurchasePhoneOrdered.prototype.printData = undefined;
timapi.protocol.sixml.Response_PurchasePhoneOrdered.prototype.toXmlNode = function () {
    var node = new timapi.protocol.XmlNode("sixml:Response");
    this.xmlSetAttribute(node, "xmlns:sixml", "http://www.six-payment-services.com/");
    if (this.functionGroup != undefined) {
        this.xmlSetAttribute(node, "FunctionGroup", this.functionGroup);
    }
    if (this.function != undefined) {
        this.xmlSetAttribute(node, "Function", this.function);
    }
    if (this.sequenceNumber != undefined) {
        this.xmlSetAttribute(node, "SequenceNumber", timapi.utils.StringHelper.makeString(this.sequenceNumber));
    }
    if (this.resultCode != undefined) {
        this.xmlSetAttribute(node, "ResultCode", timapi.utils.StringHelper.makeString(this.resultCode));
    }
    if (this.timeStamp != undefined) {
        this.xmlSetAttribute(node, "TimeStamp", this.timeStamp.format("yyyyMMdd'T'HHmmssZ"));
    }
    if (this.transactionInformation != undefined) {
        this.xmlAddChild(node, "sixml:TransactionInformation", this.transactionInformation);
    }
    if (this.amount != undefined) {
        this.xmlAddChild(node, "sixml:Amount", this.amount);
    }
    if (this.amountDue != undefined) {
        this.xmlAddChild(node, "sixml:AmountDue", this.amountDue);
    }
    if (this.amountDcc != undefined) {
        this.xmlAddChild(node, "sixml:AmountDcc", this.amountDcc);
    }
    if (this.amountSaldo != undefined) {
        this.xmlAddChild(node, "sixml:AmountSaldo", this.amountSaldo);
    }
    if (this.dccDisclaimer != undefined) {
        this.xmlAddChild(node, "sixml:DccDisclaimer", this.dccDisclaimer);
    }
    if (this.disclaimer != undefined) {
        this.xmlAddChild(node, "sixml:Disclaimer", this.disclaimer);
    }
    if (this.cardData != undefined) {
        this.xmlAddChild(node, "sixml:CardData", this.cardData);
    }
    if (this.printData != undefined) {
        this.xmlAddChild(node, "sixml:PrintData", this.printData);
    }
    return node;
};
timapi.protocol.sixml.Response_PurchaseReservationPhoneAuthorized = function (a) {
    if (arguments.length == 1 && a instanceof timapi.protocol.sixml.Response_PurchaseReservationPhoneAuthorized) {
        var value = a;
        this.functionGroup = value.functionGroup;
        this.function = value.function;
        this.sequenceNumber = value.sequenceNumber;
        this.resultCode = value.resultCode;
        this.timeStamp = value.timeStamp;
        this.amount = value.amount ? new timapi.protocol.sixml.Amount(value.amount) : undefined;
        this.amountDcc = value.amountDcc ? new timapi.protocol.sixml.AmountDcc(value.amountDcc) : undefined;
        this.amountTip = value.amountTip ? new timapi.protocol.sixml.AmountTip(value.amountTip) : undefined;
        this.amountDue = value.amountDue ? new timapi.protocol.sixml.AmountDue(value.amountDue) : undefined;
        this.transactionInformation = value.transactionInformation ? new timapi.protocol.sixml.TransactionInformation(value.transactionInformation) : undefined;
        this.dccDisclaimer = value.dccDisclaimer;
        this.disclaimer = value.disclaimer;
        this.cardData = value.cardData ? new timapi.protocol.sixml.CardData(value.cardData) : undefined;
        this.printData = value.printData ? new timapi.protocol.sixml.PrintData(value.printData) : undefined;
        return;
    }
    if (arguments.length == 1 && a instanceof timapi.protocol.XmlNode) {
        var node = a;
        if (this.xmlHasAttribute(node, "FunctionGroup")) {
            this.functionGroup = this.xmlGetAttribute(node, "FunctionGroup");
        }
        if (this.xmlHasAttribute(node, "Function")) {
            this.function = this.xmlGetAttribute(node, "Function");
        }
        if (this.xmlHasAttribute(node, "SequenceNumber")) {
            this.sequenceNumber = (this.xmlGetAttribute(node, "SequenceNumber") ? parseInt(this.xmlGetAttribute(node, "SequenceNumber")) : 0);
        }
        if (this.xmlHasAttribute(node, "ResultCode")) {
            this.resultCode = (this.xmlGetAttribute(node, "ResultCode") ? parseInt(this.xmlGetAttribute(node, "ResultCode")) : 0);
        }
        if (this.xmlHasAttribute(node, "TimeStamp")) {
            this.timeStamp = new timapi.protocol.TimeDate("yyyyMMdd'T'HHmmssZ", this.xmlGetAttribute(node, "TimeStamp"));
        }
        if (this.xmlHasChild(node, "sixml:Amount")) {
            this.amount = new timapi.protocol.sixml.Amount(this.xmlGetChild(node, "sixml:Amount"));
        }
        if (this.xmlHasChild(node, "sixml:AmountDcc")) {
            this.amountDcc = new timapi.protocol.sixml.AmountDcc(this.xmlGetChild(node, "sixml:AmountDcc"));
        }
        if (this.xmlHasChild(node, "sixml:AmountTip")) {
            this.amountTip = new timapi.protocol.sixml.AmountTip(this.xmlGetChild(node, "sixml:AmountTip"));
        }
        if (this.xmlHasChild(node, "sixml:AmountDue")) {
            this.amountDue = new timapi.protocol.sixml.AmountDue(this.xmlGetChild(node, "sixml:AmountDue"));
        }
        if (this.xmlHasChild(node, "sixml:TransactionInformation")) {
            this.transactionInformation = new timapi.protocol.sixml.TransactionInformation(this.xmlGetChild(node, "sixml:TransactionInformation"));
        }
        if (this.xmlHasChild(node, "sixml:DccDisclaimer")) {
            this.dccDisclaimer = this.xmlGetChild(node, "sixml:DccDisclaimer").textContent;
        }
        if (this.xmlHasChild(node, "sixml:Disclaimer")) {
            this.disclaimer = this.xmlGetChild(node, "sixml:Disclaimer").textContent;
        }
        if (this.xmlHasChild(node, "sixml:CardData")) {
            this.cardData = new timapi.protocol.sixml.CardData(this.xmlGetChild(node, "sixml:CardData"));
        }
        if (this.xmlHasChild(node, "sixml:PrintData")) {
            this.printData = new timapi.protocol.sixml.PrintData(this.xmlGetChild(node, "sixml:PrintData"));
        }
        return;
    }
    if (arguments.length == 0) {
        this.functionGroup = "FinTransaction";
        this.function = "PurchaseReservationPhoneAuthorized";
        return;
    }
    throw new Error("Invalid argument");
};
timapi.protocol.sixml.Response_PurchaseReservationPhoneAuthorized.prototype = Object.create(timapi.protocol.Message.prototype);
timapi.protocol.sixml.Response_PurchaseReservationPhoneAuthorized.prototype.functionGroup = undefined;
timapi.protocol.sixml.Response_PurchaseReservationPhoneAuthorized.prototype.function = undefined;
timapi.protocol.sixml.Response_PurchaseReservationPhoneAuthorized.prototype.sequenceNumber = undefined;
timapi.protocol.sixml.Response_PurchaseReservationPhoneAuthorized.prototype.resultCode = undefined;
timapi.protocol.sixml.Response_PurchaseReservationPhoneAuthorized.prototype.timeStamp = undefined;
timapi.protocol.sixml.Response_PurchaseReservationPhoneAuthorized.prototype.amount = undefined;
timapi.protocol.sixml.Response_PurchaseReservationPhoneAuthorized.prototype.amountDcc = undefined;
timapi.protocol.sixml.Response_PurchaseReservationPhoneAuthorized.prototype.amountTip = undefined;
timapi.protocol.sixml.Response_PurchaseReservationPhoneAuthorized.prototype.amountDue = undefined;
timapi.protocol.sixml.Response_PurchaseReservationPhoneAuthorized.prototype.transactionInformation = undefined;
timapi.protocol.sixml.Response_PurchaseReservationPhoneAuthorized.prototype.dccDisclaimer = undefined;
timapi.protocol.sixml.Response_PurchaseReservationPhoneAuthorized.prototype.disclaimer = undefined;
timapi.protocol.sixml.Response_PurchaseReservationPhoneAuthorized.prototype.cardData = undefined;
timapi.protocol.sixml.Response_PurchaseReservationPhoneAuthorized.prototype.printData = undefined;
timapi.protocol.sixml.Response_PurchaseReservationPhoneAuthorized.prototype.toXmlNode = function () {
    var node = new timapi.protocol.XmlNode("sixml:Response");
    this.xmlSetAttribute(node, "xmlns:sixml", "http://www.six-payment-services.com/");
    if (this.functionGroup != undefined) {
        this.xmlSetAttribute(node, "FunctionGroup", this.functionGroup);
    }
    if (this.function != undefined) {
        this.xmlSetAttribute(node, "Function", this.function);
    }
    if (this.sequenceNumber != undefined) {
        this.xmlSetAttribute(node, "SequenceNumber", timapi.utils.StringHelper.makeString(this.sequenceNumber));
    }
    if (this.resultCode != undefined) {
        this.xmlSetAttribute(node, "ResultCode", timapi.utils.StringHelper.makeString(this.resultCode));
    }
    if (this.timeStamp != undefined) {
        this.xmlSetAttribute(node, "TimeStamp", this.timeStamp.format("yyyyMMdd'T'HHmmssZ"));
    }
    if (this.amount != undefined) {
        this.xmlAddChild(node, "sixml:Amount", this.amount);
    }
    if (this.amountDcc != undefined) {
        this.xmlAddChild(node, "sixml:AmountDcc", this.amountDcc);
    }
    if (this.amountTip != undefined) {
        this.xmlAddChild(node, "sixml:AmountTip", this.amountTip);
    }
    if (this.amountDue != undefined) {
        this.xmlAddChild(node, "sixml:AmountDue", this.amountDue);
    }
    if (this.transactionInformation != undefined) {
        this.xmlAddChild(node, "sixml:TransactionInformation", this.transactionInformation);
    }
    if (this.dccDisclaimer != undefined) {
        this.xmlAddChild(node, "sixml:DccDisclaimer", this.dccDisclaimer);
    }
    if (this.disclaimer != undefined) {
        this.xmlAddChild(node, "sixml:Disclaimer", this.disclaimer);
    }
    if (this.cardData != undefined) {
        this.xmlAddChild(node, "sixml:CardData", this.cardData);
    }
    if (this.printData != undefined) {
        this.xmlAddChild(node, "sixml:PrintData", this.printData);
    }
    return node;
};
timapi.protocol.sixml.Response_SendCardCommand = function (a) {
    if (arguments.length == 1 && a instanceof timapi.protocol.sixml.Response_SendCardCommand) {
        var value = a;
        this.functionGroup = value.functionGroup;
        this.function = value.function;
        this.sequenceNumber = value.sequenceNumber;
        this.resultCode = value.resultCode;
        this.timeStamp = value.timeStamp;
        this.commandResponseList = value.commandResponseList ? new timapi.protocol.sixml.CommandResponseList(value.commandResponseList) : undefined;
        return;
    }
    if (arguments.length == 1 && a instanceof timapi.protocol.XmlNode) {
        var node = a;
        if (this.xmlHasAttribute(node, "FunctionGroup")) {
            this.functionGroup = this.xmlGetAttribute(node, "FunctionGroup");
        }
        if (this.xmlHasAttribute(node, "Function")) {
            this.function = this.xmlGetAttribute(node, "Function");
        }
        if (this.xmlHasAttribute(node, "SequenceNumber")) {
            this.sequenceNumber = (this.xmlGetAttribute(node, "SequenceNumber") ? parseInt(this.xmlGetAttribute(node, "SequenceNumber")) : 0);
        }
        if (this.xmlHasAttribute(node, "ResultCode")) {
            this.resultCode = (this.xmlGetAttribute(node, "ResultCode") ? parseInt(this.xmlGetAttribute(node, "ResultCode")) : 0);
        }
        if (this.xmlHasAttribute(node, "TimeStamp")) {
            this.timeStamp = new timapi.protocol.TimeDate("yyyyMMdd'T'HHmmssZ", this.xmlGetAttribute(node, "TimeStamp"));
        }
        if (this.xmlHasChild(node, "sixml:CommandResponseList")) {
            this.commandResponseList = new timapi.protocol.sixml.CommandResponseList(this.xmlGetChild(node, "sixml:CommandResponseList"));
        }
        return;
    }
    if (arguments.length == 0) {
        this.functionGroup = "Dialog";
        this.function = "SendCardCommand";
        return;
    }
    throw new Error("Invalid argument");
};
timapi.protocol.sixml.Response_SendCardCommand.prototype = Object.create(timapi.protocol.Message.prototype);
timapi.protocol.sixml.Response_SendCardCommand.prototype.functionGroup = undefined;
timapi.protocol.sixml.Response_SendCardCommand.prototype.function = undefined;
timapi.protocol.sixml.Response_SendCardCommand.prototype.sequenceNumber = undefined;
timapi.protocol.sixml.Response_SendCardCommand.prototype.resultCode = undefined;
timapi.protocol.sixml.Response_SendCardCommand.prototype.timeStamp = undefined;
timapi.protocol.sixml.Response_SendCardCommand.prototype.commandResponseList = undefined;
timapi.protocol.sixml.Response_SendCardCommand.prototype.toXmlNode = function () {
    var node = new timapi.protocol.XmlNode("sixml:Response");
    this.xmlSetAttribute(node, "xmlns:sixml", "http://www.six-payment-services.com/");
    if (this.functionGroup != undefined) {
        this.xmlSetAttribute(node, "FunctionGroup", this.functionGroup);
    }
    if (this.function != undefined) {
        this.xmlSetAttribute(node, "Function", this.function);
    }
    if (this.sequenceNumber != undefined) {
        this.xmlSetAttribute(node, "SequenceNumber", timapi.utils.StringHelper.makeString(this.sequenceNumber));
    }
    if (this.resultCode != undefined) {
        this.xmlSetAttribute(node, "ResultCode", timapi.utils.StringHelper.makeString(this.resultCode));
    }
    if (this.timeStamp != undefined) {
        this.xmlSetAttribute(node, "TimeStamp", this.timeStamp.format("yyyyMMdd'T'HHmmssZ"));
    }
    if (this.commandResponseList != undefined) {
        this.xmlAddChild(node, "sixml:CommandResponseList", this.commandResponseList);
    }
    return node;
};
timapi.protocol.sixml.Response_StartCheckout = function (a) {
    if (arguments.length == 1 && a instanceof timapi.protocol.sixml.Response_StartCheckout) {
        var value = a;
        this.functionGroup = value.functionGroup;
        this.function = value.function;
        this.sequenceNumber = value.sequenceNumber;
        this.resultCode = value.resultCode;
        this.timeStamp = value.timeStamp;
        return;
    }
    if (arguments.length == 1 && a instanceof timapi.protocol.XmlNode) {
        var node = a;
        if (this.xmlHasAttribute(node, "FunctionGroup")) {
            this.functionGroup = this.xmlGetAttribute(node, "FunctionGroup");
        }
        if (this.xmlHasAttribute(node, "Function")) {
            this.function = this.xmlGetAttribute(node, "Function");
        }
        if (this.xmlHasAttribute(node, "SequenceNumber")) {
            this.sequenceNumber = (this.xmlGetAttribute(node, "SequenceNumber") ? parseInt(this.xmlGetAttribute(node, "SequenceNumber")) : 0);
        }
        if (this.xmlHasAttribute(node, "ResultCode")) {
            this.resultCode = (this.xmlGetAttribute(node, "ResultCode") ? parseInt(this.xmlGetAttribute(node, "ResultCode")) : 0);
        }
        if (this.xmlHasAttribute(node, "TimeStamp")) {
            this.timeStamp = new timapi.protocol.TimeDate("yyyyMMdd'T'HHmmssZ", this.xmlGetAttribute(node, "TimeStamp"));
        }
        return;
    }
    if (arguments.length == 0) {
        this.functionGroup = "NonFinTransaction";
        this.function = "StartCheckout";
        return;
    }
    throw new Error("Invalid argument");
};
timapi.protocol.sixml.Response_StartCheckout.prototype = Object.create(timapi.protocol.Message.prototype);
timapi.protocol.sixml.Response_StartCheckout.prototype.functionGroup = undefined;
timapi.protocol.sixml.Response_StartCheckout.prototype.function = undefined;
timapi.protocol.sixml.Response_StartCheckout.prototype.sequenceNumber = undefined;
timapi.protocol.sixml.Response_StartCheckout.prototype.resultCode = undefined;
timapi.protocol.sixml.Response_StartCheckout.prototype.timeStamp = undefined;
timapi.protocol.sixml.Response_StartCheckout.prototype.toXmlNode = function () {
    var node = new timapi.protocol.XmlNode("sixml:Response");
    this.xmlSetAttribute(node, "xmlns:sixml", "http://www.six-payment-services.com/");
    if (this.functionGroup != undefined) {
        this.xmlSetAttribute(node, "FunctionGroup", this.functionGroup);
    }
    if (this.function != undefined) {
        this.xmlSetAttribute(node, "Function", this.function);
    }
    if (this.sequenceNumber != undefined) {
        this.xmlSetAttribute(node, "SequenceNumber", timapi.utils.StringHelper.makeString(this.sequenceNumber));
    }
    if (this.resultCode != undefined) {
        this.xmlSetAttribute(node, "ResultCode", timapi.utils.StringHelper.makeString(this.resultCode));
    }
    if (this.timeStamp != undefined) {
        this.xmlSetAttribute(node, "TimeStamp", this.timeStamp.format("yyyyMMdd'T'HHmmssZ"));
    }
    return node;
};
timapi.protocol.sixml.UnitAmountDiscount = function (a) {
    if (arguments.length == 1 && a instanceof timapi.protocol.sixml.UnitAmountDiscount) {
        var value = a;
        this.value = value.value;
        this.currency = value.currency;
        this.exponent = value.exponent;
        return;
    }
    if (arguments.length == 1 && a instanceof timapi.protocol.XmlNode) {
        var node = a;
        this.value = (node.textContent ? parseInt(node.textContent) : 0);
        if (this.xmlHasAttribute(node, "Currency")) {
            this.currency = this.xmlGetAttribute(node, "Currency");
        }
        if (this.xmlHasAttribute(node, "Exponent")) {
            this.exponent = (this.xmlGetAttribute(node, "Exponent") ? parseInt(this.xmlGetAttribute(node, "Exponent")) : 0);
        }
        return;
    }
    if (arguments.length != 0) {
        throw new Error("Invalid argument");
    }
};
timapi.protocol.sixml.UnitAmountDiscount.prototype = Object.create(timapi.protocol.Container.prototype);
timapi.protocol.sixml.UnitAmountDiscount.prototype.value = 0;
timapi.protocol.sixml.UnitAmountDiscount.prototype.currency = undefined;
timapi.protocol.sixml.UnitAmountDiscount.prototype.exponent = undefined;
timapi.protocol.sixml.UnitAmountDiscount.prototype.toXmlNode = function () {
    var node = new timapi.protocol.XmlNode("sixml:UnitAmountDiscount");
    node.textContent = timapi.utils.StringHelper.makeString(this.value);
    if (this.currency != undefined) {
        this.xmlSetAttribute(node, "Currency", this.currency);
    }
    if (this.exponent != undefined) {
        this.xmlSetAttribute(node, "Exponent", timapi.utils.StringHelper.makeString(this.exponent));
    }
    return node;
};
timapi.protocol.sixml.UnitAmountGross = function (a) {
    if (arguments.length == 1 && a instanceof timapi.protocol.sixml.UnitAmountGross) {
        var value = a;
        this.value = value.value;
        this.currency = value.currency;
        this.exponent = value.exponent;
        return;
    }
    if (arguments.length == 1 && a instanceof timapi.protocol.XmlNode) {
        var node = a;
        this.value = (node.textContent ? parseInt(node.textContent) : 0);
        if (this.xmlHasAttribute(node, "Currency")) {
            this.currency = this.xmlGetAttribute(node, "Currency");
        }
        if (this.xmlHasAttribute(node, "Exponent")) {
            this.exponent = (this.xmlGetAttribute(node, "Exponent") ? parseInt(this.xmlGetAttribute(node, "Exponent")) : 0);
        }
        return;
    }
    if (arguments.length != 0) {
        throw new Error("Invalid argument");
    }
};
timapi.protocol.sixml.UnitAmountGross.prototype = Object.create(timapi.protocol.Container.prototype);
timapi.protocol.sixml.UnitAmountGross.prototype.value = 0;
timapi.protocol.sixml.UnitAmountGross.prototype.currency = undefined;
timapi.protocol.sixml.UnitAmountGross.prototype.exponent = undefined;
timapi.protocol.sixml.UnitAmountGross.prototype.toXmlNode = function () {
    var node = new timapi.protocol.XmlNode("sixml:UnitAmountGross");
    node.textContent = timapi.utils.StringHelper.makeString(this.value);
    if (this.currency != undefined) {
        this.xmlSetAttribute(node, "Currency", this.currency);
    }
    if (this.exponent != undefined) {
        this.xmlSetAttribute(node, "Exponent", timapi.utils.StringHelper.makeString(this.exponent));
    }
    return node;
};
timapi.statemachine.states.CommandFinishedInClosed = function (context) {
    timapi.statemachine.states.DefaultState.call(this, context);
};
timapi.statemachine.states.CommandFinishedInClosed.prototype = Object.create(timapi.statemachine.states.DefaultState.prototype);
timapi.statemachine.states.CommandFinishedInClosed.loggerName = "timapi.statemachine.states.CommandFinishedInClosed";
timapi.statemachine.states.CommandFinishedInClosed.classname = "CommandFinishedInClosed";
timapi.statemachine.states.CommandFinishedInClosed.logger = timapi.logging.Logger.getLogger(timapi.statemachine.states.CommandFinishedInClosed.loggerName);
timapi.statemachine.states.CommandFinishedInClosed.prototype.enterState = function () {
    timapi.statemachine.states.DefaultState.prototype.enterState.call(this);
    if (this.context.conditionIsEnabledAutoActivate()) {
        try {
            this.context.actionActivate();
        }
        catch (e) {
            timapi.statemachine.states.CommandFinishedInClosed.logger.log(timapi.logging.Level.severe, "Exception", e);
            this.context.setState(new timapi.statemachine.states.LoggedIn(this.context));
            return;
        }
        this.context.setState(new timapi.statemachine.states.Activating(this.context));
        return;
    }
    this.context.setState(new timapi.statemachine.states.LoggedIn(this.context));
};
timapi.statemachine.states.CommandFinishedInOpen = function (context) {
    timapi.statemachine.states.DefaultState.call(this, context);
};
timapi.statemachine.states.CommandFinishedInOpen.prototype = Object.create(timapi.statemachine.states.DefaultState.prototype);
timapi.statemachine.states.CommandFinishedInOpen.loggerName = "timapi.statemachine.states.CommandFinishedInOpen";
timapi.statemachine.states.CommandFinishedInOpen.classname = "CommandFinishedInOpen";
timapi.statemachine.states.CommandFinishedInOpen.logger = timapi.logging.Logger.getLogger(timapi.statemachine.states.CommandFinishedInOpen.loggerName);
timapi.statemachine.states.CommandFinishedInOpen.prototype.enterState = function () {
    timapi.statemachine.states.DefaultState.prototype.enterState.call(this);
    if (this.context.conditionIsEnabledAutoDeactivate()) {
        try {
            this.context.actionDeactivate();
        }
        catch (e) {
            timapi.statemachine.states.CommandFinishedInOpen.logger.log(timapi.logging.Level.severe, "Exception", e);
            this.context.setState(new timapi.statemachine.states.Open(this.context));
            return;
        }
        this.context.setState(new timapi.statemachine.states.Deactivating(this.context));
        return;
    }
    this.context.setState(new timapi.statemachine.states.Open(this.context));
};
timapi.statemachine.states.WaitBalanceInquiry = function (context) {
    timapi.statemachine.states.DefaultState.call(this, context);
};
timapi.statemachine.states.WaitBalanceInquiry.prototype = Object.create(timapi.statemachine.states.DefaultState.prototype);
timapi.statemachine.states.WaitBalanceInquiry.loggerName = "timapi.statemachine.states.WaitBalanceInquiry";
timapi.statemachine.states.WaitBalanceInquiry.classname = "WaitBalanceInquiry";
timapi.statemachine.states.WaitBalanceInquiry.logger = timapi.logging.Logger.getLogger(timapi.statemachine.states.WaitBalanceInquiry.loggerName);
timapi.statemachine.states.WaitBalanceInquiry.prototype.enterState = function () {
    timapi.statemachine.states.DefaultState.prototype.enterState.call(this);
    this.context.actionClearPendingEvent();
};
timapi.statemachine.states.WaitBalanceInquiry.prototype.activate = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitBalanceInquiry.prototype.applicationInformation = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitBalanceInquiry.prototype.balance = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitBalanceInquiry.prototype.cancel = function () {
    this.context.actionClearPendingCancel();
    this.context.actionCancel();
};
timapi.statemachine.states.WaitBalanceInquiry.prototype.changeSettings = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitBalanceInquiry.prototype.commit = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitBalanceInquiry.prototype.connect = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitBalanceInquiry.prototype.counterRequest = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitBalanceInquiry.prototype.deactivate = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitBalanceInquiry.prototype.disconnect = function () {
    this.context.actionSendErrorResponseDisconnect();
    this.context.actionClearPendingEvent();
    this.context.actionDisconnect();
    this.context.setState(new timapi.statemachine.states.Disconnected(this.context));
};
timapi.statemachine.states.WaitBalanceInquiry.prototype.dccRates = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitBalanceInquiry.prototype.hardwareInformation = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitBalanceInquiry.prototype.initTransaction = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitBalanceInquiry.prototype.login = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitBalanceInquiry.prototype.logout = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitBalanceInquiry.prototype.reboot = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitBalanceInquiry.prototype.reconciliation = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitBalanceInquiry.prototype.receiptRequest = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitBalanceInquiry.prototype.reconfig = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitBalanceInquiry.prototype.rollback = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitBalanceInquiry.prototype.softwareUpdate = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitBalanceInquiry.prototype.systemInformation = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitBalanceInquiry.prototype.transaction = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitBalanceInquiry.prototype.connected = function () {
};
timapi.statemachine.states.WaitBalanceInquiry.prototype.connectFailed = function () {
    this.context.actionClearPendingEvent();
    this.context.setState(new timapi.statemachine.states.ErrorState(this.context));
};
timapi.statemachine.states.WaitBalanceInquiry.prototype.responseRequest = function () {
    this.context.actionProcessResponseBalanceInquiry();
    this.context.setState(new timapi.statemachine.states.CommandFinishedInOpen(this.context));
};
timapi.statemachine.states.WaitBalanceInquiry.prototype.responseError = function () {
    this.context.actionClearPendingEvent();
    this.context.actionProcessResponseError();
    this.context.setState(new timapi.statemachine.states.CommandFinishedInOpen(this.context));
};
timapi.statemachine.states.WaitBalanceInquiry.prototype.responseBusy = function () {
    this.context.actionClearPendingEvent();
    this.context.actionProcessResponseError();
    this.context.setState(new timapi.statemachine.states.CommandFinishedInOpen(this.context));
};
timapi.statemachine.states.WaitBalanceInquiry.prototype.timeout = function () {
    this.context.actionErrorTimeout();
    this.context.setState(new timapi.statemachine.states.CommandFinishedInOpen(this.context));
};
timapi.statemachine.states.WaitBalanceInquiry.prototype.keepAliveTimeout = function () {
    try {
        this.context.actionErrorConnectionLost();
        this.context.actionDisconnect();
        this.context.setState(new timapi.statemachine.states.Disconnected(this.context));
    }
    catch (e) {
        timapi.statemachine.states.WaitBalanceInquiry.logger.log(timapi.logging.Level.severe, "Exception", e);
        this.context.setState(new timapi.statemachine.states.Disconnected(this.context));
    }
};
timapi.statemachine.states.WaitBalanceInquiry.prototype.closeReader = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitBalanceInquiry.prototype.openReader = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitBalanceInquiry.prototype.ejectCard = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitBalanceInquiry.prototype.openMaintenanceWindow = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitBalanceInquiry.prototype.closeMaintenanceWindow = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitBalanceInquiry.prototype.activateServiceMenu = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitBalanceInquiry.prototype.balanceInquiry = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitBalanceInquiry.prototype.openDialogMode = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitBalanceInquiry.prototype.closeDialogMode = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitBalanceInquiry.prototype.showSignatureCapture = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitBalanceInquiry.prototype.showDialog = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitBalanceInquiry.prototype.sendCardCommand = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitReceiptRequestClosed = function (context) {
    timapi.statemachine.states.DefaultState.call(this, context);
};
timapi.statemachine.states.WaitReceiptRequestClosed.prototype = Object.create(timapi.statemachine.states.DefaultState.prototype);
timapi.statemachine.states.WaitReceiptRequestClosed.loggerName = "timapi.statemachine.states.WaitReceiptRequestClosed";
timapi.statemachine.states.WaitReceiptRequestClosed.classname = "WaitReceiptRequestClosed";
timapi.statemachine.states.WaitReceiptRequestClosed.logger = timapi.logging.Logger.getLogger(timapi.statemachine.states.WaitReceiptRequestClosed.loggerName);
timapi.statemachine.states.WaitReceiptRequestClosed.prototype.enterState = function () {
    timapi.statemachine.states.DefaultState.prototype.enterState.call(this);
    this.context.actionClearPendingEvent();
};
timapi.statemachine.states.WaitReceiptRequestClosed.prototype.activate = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitReceiptRequestClosed.prototype.applicationInformation = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitReceiptRequestClosed.prototype.balance = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitReceiptRequestClosed.prototype.cancel = function () {
    this.context.actionClearPendingCancel();
    this.context.actionCancel();
};
timapi.statemachine.states.WaitReceiptRequestClosed.prototype.changeSettings = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitReceiptRequestClosed.prototype.commit = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitReceiptRequestClosed.prototype.connect = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitReceiptRequestClosed.prototype.counterRequest = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitReceiptRequestClosed.prototype.deactivate = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitReceiptRequestClosed.prototype.disconnect = function () {
    this.context.actionSendErrorResponseDisconnect();
    this.context.actionClearPendingEvent();
    this.context.actionDisconnect();
    this.context.setState(new timapi.statemachine.states.Disconnected(this.context));
};
timapi.statemachine.states.WaitReceiptRequestClosed.prototype.dccRates = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitReceiptRequestClosed.prototype.hardwareInformation = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitReceiptRequestClosed.prototype.initTransaction = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitReceiptRequestClosed.prototype.login = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitReceiptRequestClosed.prototype.logout = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitReceiptRequestClosed.prototype.reboot = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitReceiptRequestClosed.prototype.reconciliation = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitReceiptRequestClosed.prototype.receiptRequest = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitReceiptRequestClosed.prototype.reconfig = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitReceiptRequestClosed.prototype.rollback = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitReceiptRequestClosed.prototype.softwareUpdate = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitReceiptRequestClosed.prototype.systemInformation = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitReceiptRequestClosed.prototype.transaction = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitReceiptRequestClosed.prototype.connected = function () {
};
timapi.statemachine.states.WaitReceiptRequestClosed.prototype.connectFailed = function () {
    this.context.actionClearPendingEvent();
    this.context.setState(new timapi.statemachine.states.ErrorState(this.context));
};
timapi.statemachine.states.WaitReceiptRequestClosed.prototype.responseRequest = function () {
    this.context.actionProcessResponseReceiptRequest();
    this.context.setState(new timapi.statemachine.states.CommandFinishedInClosed(this.context));
};
timapi.statemachine.states.WaitReceiptRequestClosed.prototype.responseError = function () {
    this.context.actionClearPendingEvent();
    this.context.actionProcessResponseError();
    this.context.setState(new timapi.statemachine.states.CommandFinishedInClosed(this.context));
};
timapi.statemachine.states.WaitReceiptRequestClosed.prototype.responseBusy = function () {
    this.context.actionClearPendingEvent();
    this.context.actionProcessResponseError();
    this.context.setState(new timapi.statemachine.states.CommandFinishedInClosed(this.context));
};
timapi.statemachine.states.WaitReceiptRequestClosed.prototype.timeout = function () {
    this.context.actionErrorTimeout();
    this.context.setState(new timapi.statemachine.states.CommandFinishedInClosed(this.context));
};
timapi.statemachine.states.WaitReceiptRequestClosed.prototype.keepAliveTimeout = function () {
    try {
        this.context.actionErrorConnectionLost();
        this.context.actionDisconnect();
        this.context.setState(new timapi.statemachine.states.Disconnected(this.context));
    }
    catch (e) {
        timapi.statemachine.states.WaitReceiptRequestClosed.logger.log(timapi.logging.Level.severe, "Exception", e);
        this.context.setState(new timapi.statemachine.states.Disconnected(this.context));
    }
};
timapi.statemachine.states.WaitReceiptRequestClosed.prototype.closeReader = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitReceiptRequestClosed.prototype.openReader = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitReceiptRequestClosed.prototype.ejectCard = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitReceiptRequestClosed.prototype.openMaintenanceWindow = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitReceiptRequestClosed.prototype.closeMaintenanceWindow = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitReceiptRequestClosed.prototype.activateServiceMenu = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitReceiptRequestClosed.prototype.balanceInquiry = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitReceiptRequestClosed.prototype.openDialogMode = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitReceiptRequestClosed.prototype.closeDialogMode = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitReceiptRequestClosed.prototype.showSignatureCapture = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitReceiptRequestClosed.prototype.showDialog = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitReceiptRequestClosed.prototype.sendCardCommand = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitReceiptRequestOpen = function (context) {
    timapi.statemachine.states.DefaultState.call(this, context);
};
timapi.statemachine.states.WaitReceiptRequestOpen.prototype = Object.create(timapi.statemachine.states.DefaultState.prototype);
timapi.statemachine.states.WaitReceiptRequestOpen.loggerName = "timapi.statemachine.states.WaitReceiptRequestOpen";
timapi.statemachine.states.WaitReceiptRequestOpen.classname = "WaitReceiptRequestOpen";
timapi.statemachine.states.WaitReceiptRequestOpen.logger = timapi.logging.Logger.getLogger(timapi.statemachine.states.WaitReceiptRequestOpen.loggerName);
timapi.statemachine.states.WaitReceiptRequestOpen.prototype.enterState = function () {
    timapi.statemachine.states.DefaultState.prototype.enterState.call(this);
    this.context.actionClearPendingEvent();
};
timapi.statemachine.states.WaitReceiptRequestOpen.prototype.activate = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitReceiptRequestOpen.prototype.applicationInformation = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitReceiptRequestOpen.prototype.balance = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitReceiptRequestOpen.prototype.cancel = function () {
    this.context.actionClearPendingCancel();
    this.context.actionCancel();
};
timapi.statemachine.states.WaitReceiptRequestOpen.prototype.changeSettings = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitReceiptRequestOpen.prototype.commit = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitReceiptRequestOpen.prototype.connect = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitReceiptRequestOpen.prototype.counterRequest = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitReceiptRequestOpen.prototype.deactivate = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitReceiptRequestOpen.prototype.disconnect = function () {
    this.context.actionSendErrorResponseDisconnect();
    this.context.actionClearPendingEvent();
    this.context.actionDisconnect();
    this.context.setState(new timapi.statemachine.states.Disconnected(this.context));
};
timapi.statemachine.states.WaitReceiptRequestOpen.prototype.dccRates = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitReceiptRequestOpen.prototype.hardwareInformation = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitReceiptRequestOpen.prototype.initTransaction = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitReceiptRequestOpen.prototype.login = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitReceiptRequestOpen.prototype.logout = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitReceiptRequestOpen.prototype.reboot = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitReceiptRequestOpen.prototype.reconciliation = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitReceiptRequestOpen.prototype.receiptRequest = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitReceiptRequestOpen.prototype.reconfig = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitReceiptRequestOpen.prototype.rollback = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitReceiptRequestOpen.prototype.softwareUpdate = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitReceiptRequestOpen.prototype.systemInformation = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitReceiptRequestOpen.prototype.transaction = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitReceiptRequestOpen.prototype.connected = function () {
};
timapi.statemachine.states.WaitReceiptRequestOpen.prototype.connectFailed = function () {
    this.context.actionClearPendingEvent();
    this.context.setState(new timapi.statemachine.states.ErrorState(this.context));
};
timapi.statemachine.states.WaitReceiptRequestOpen.prototype.responseRequest = function () {
    this.context.actionProcessResponseReceiptRequest();
    this.context.setState(new timapi.statemachine.states.CommandFinishedInOpen(this.context));
};
timapi.statemachine.states.WaitReceiptRequestOpen.prototype.responseError = function () {
    this.context.actionClearPendingEvent();
    this.context.actionProcessResponseError();
    this.context.setState(new timapi.statemachine.states.CommandFinishedInOpen(this.context));
};
timapi.statemachine.states.WaitReceiptRequestOpen.prototype.responseBusy = function () {
    this.context.actionClearPendingEvent();
    this.context.actionProcessResponseError();
    this.context.setState(new timapi.statemachine.states.CommandFinishedInOpen(this.context));
};
timapi.statemachine.states.WaitReceiptRequestOpen.prototype.timeout = function () {
    this.context.actionErrorTimeout();
    this.context.setState(new timapi.statemachine.states.CommandFinishedInOpen(this.context));
};
timapi.statemachine.states.WaitReceiptRequestOpen.prototype.keepAliveTimeout = function () {
    try {
        this.context.actionErrorConnectionLost();
        this.context.actionDisconnect();
        this.context.setState(new timapi.statemachine.states.Disconnected(this.context));
    }
    catch (e) {
        timapi.statemachine.states.WaitReceiptRequestOpen.logger.log(timapi.logging.Level.severe, "Exception", e);
        this.context.setState(new timapi.statemachine.states.Disconnected(this.context));
    }
};
timapi.statemachine.states.WaitReceiptRequestOpen.prototype.closeReader = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitReceiptRequestOpen.prototype.openReader = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitReceiptRequestOpen.prototype.ejectCard = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitReceiptRequestOpen.prototype.openMaintenanceWindow = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitReceiptRequestOpen.prototype.closeMaintenanceWindow = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitReceiptRequestOpen.prototype.activateServiceMenu = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitReceiptRequestOpen.prototype.balanceInquiry = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitReceiptRequestOpen.prototype.openDialogMode = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitReceiptRequestOpen.prototype.closeDialogMode = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitReceiptRequestOpen.prototype.showSignatureCapture = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitReceiptRequestOpen.prototype.showDialog = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitReceiptRequestOpen.prototype.sendCardCommand = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitSendCardCommand = function (context) {
    timapi.statemachine.states.DefaultState.call(this, context);
};
timapi.statemachine.states.WaitSendCardCommand.prototype = Object.create(timapi.statemachine.states.DefaultState.prototype);
timapi.statemachine.states.WaitSendCardCommand.loggerName = "timapi.statemachine.states.WaitSendCardCommand";
timapi.statemachine.states.WaitSendCardCommand.classname = "WaitSendCardCommand";
timapi.statemachine.states.WaitSendCardCommand.logger = timapi.logging.Logger.getLogger(timapi.statemachine.states.WaitSendCardCommand.loggerName);
timapi.statemachine.states.WaitSendCardCommand.prototype.enterState = function () {
    timapi.statemachine.states.DefaultState.prototype.enterState.call(this);
    this.context.actionClearPendingEvent();
};
timapi.statemachine.states.WaitSendCardCommand.prototype.activate = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitSendCardCommand.prototype.applicationInformation = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitSendCardCommand.prototype.balance = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitSendCardCommand.prototype.cancel = function () {
    this.context.actionClearPendingCancel();
    this.context.actionCancel();
};
timapi.statemachine.states.WaitSendCardCommand.prototype.changeSettings = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitSendCardCommand.prototype.commit = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitSendCardCommand.prototype.connect = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitSendCardCommand.prototype.counterRequest = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitSendCardCommand.prototype.deactivate = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitSendCardCommand.prototype.disconnect = function () {
    this.context.actionSendErrorResponseDisconnect();
    this.context.actionClearPendingEvent();
    this.context.actionDisconnect();
    this.context.setState(new timapi.statemachine.states.Disconnected(this.context));
};
timapi.statemachine.states.WaitSendCardCommand.prototype.dccRates = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitSendCardCommand.prototype.hardwareInformation = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitSendCardCommand.prototype.initTransaction = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitSendCardCommand.prototype.login = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitSendCardCommand.prototype.logout = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitSendCardCommand.prototype.reboot = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitSendCardCommand.prototype.reconciliation = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitSendCardCommand.prototype.receiptRequest = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitSendCardCommand.prototype.reconfig = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitSendCardCommand.prototype.rollback = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitSendCardCommand.prototype.softwareUpdate = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitSendCardCommand.prototype.systemInformation = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitSendCardCommand.prototype.transaction = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitSendCardCommand.prototype.connected = function () {
};
timapi.statemachine.states.WaitSendCardCommand.prototype.connectFailed = function () {
    this.context.actionClearPendingEvent();
    this.context.setState(new timapi.statemachine.states.ErrorState(this.context));
};
timapi.statemachine.states.WaitSendCardCommand.prototype.responseRequest = function () {
    this.context.actionProcessResponseSendCardCommand();
    this.context.setState(new timapi.statemachine.states.DialogMode(this.context));
};
timapi.statemachine.states.WaitSendCardCommand.prototype.responseError = function () {
    this.context.actionClearPendingEvent();
    this.context.actionProcessResponseError();
    this.context.setState(new timapi.statemachine.states.DialogMode(this.context));
};
timapi.statemachine.states.WaitSendCardCommand.prototype.responseBusy = function () {
    this.context.actionClearPendingEvent();
    this.context.actionProcessResponseError();
    this.context.setState(new timapi.statemachine.states.DialogMode(this.context));
};
timapi.statemachine.states.WaitSendCardCommand.prototype.timeout = function () {
    this.context.actionErrorTimeout();
    this.context.setState(new timapi.statemachine.states.DialogMode(this.context));
};
timapi.statemachine.states.WaitSendCardCommand.prototype.keepAliveTimeout = function () {
    try {
        this.context.actionErrorConnectionLost();
        this.context.actionDisconnect();
        this.context.setState(new timapi.statemachine.states.Disconnected(this.context));
    }
    catch (e) {
        timapi.statemachine.states.WaitSendCardCommand.logger.log(timapi.logging.Level.severe, "Exception", e);
        this.context.setState(new timapi.statemachine.states.Disconnected(this.context));
    }
};
timapi.statemachine.states.WaitSendCardCommand.prototype.closeReader = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitSendCardCommand.prototype.openReader = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitSendCardCommand.prototype.ejectCard = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitSendCardCommand.prototype.openMaintenanceWindow = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitSendCardCommand.prototype.closeMaintenanceWindow = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitSendCardCommand.prototype.activateServiceMenu = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitSendCardCommand.prototype.balanceInquiry = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitSendCardCommand.prototype.openDialogMode = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitSendCardCommand.prototype.closeDialogMode = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitSendCardCommand.prototype.showSignatureCapture = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitSendCardCommand.prototype.showDialog = function () {
    this.context.actionErrorRequestInProgress();
};
timapi.statemachine.states.WaitSendCardCommand.prototype.sendCardCommand = function () {
    this.context.actionErrorRequestInProgress();
};
var timapi;
(function (timapi) {
    let Condition;
    (function (Condition) {
        Condition[Condition["NONE"] = 0] = "NONE";
        Condition[Condition["ECR_INFO"] = 1] = "ECR_INFO";
        Condition[Condition["EFT_INFO"] = 2] = "EFT_INFO";
        Condition[Condition["SIGNATURE"] = 3] = "SIGNATURE";
    })(Condition = timapi.Condition || (timapi.Condition = {}));
})(timapi || (timapi = {}));
var timapi;
(function (timapi) {
    class LineFormat {
        constructor(conditionOrElements, elementsOrPadding, padding) {
            this.padding = " ";
            this.condition = timapi.Condition.NONE;
            this.elements = new Array();
            if (padding !== undefined && padding !== undefined) {
                this.padding = padding;
            }
            else {
                this.padding = " ";
            }
            if (elementsOrPadding !== undefined && elementsOrPadding !== undefined) {
                if (elementsOrPadding instanceof Array) {
                    this.elements = elementsOrPadding.slice();
                }
                else if (typeof elementsOrPadding === "string") {
                    this.padding = elementsOrPadding;
                }
            }
            if (conditionOrElements !== undefined && conditionOrElements !== undefined) {
                if (conditionOrElements instanceof Array) {
                    this.elements = conditionOrElements.slice();
                }
                else {
                    this.condition = conditionOrElements;
                }
            }
        }
        get $elements() {
            return this.elements;
        }
        get $padding() {
            return this.padding;
        }
        get $condition() {
            return this.condition;
        }
    }
    timapi.LineFormat = LineFormat;
})(timapi || (timapi = {}));
var timapi;
(function (timapi) {
    let TextAlignment;
    (function (TextAlignment) {
        TextAlignment[TextAlignment["left"] = 0] = "left";
        TextAlignment[TextAlignment["right"] = 1] = "right";
        TextAlignment[TextAlignment["center"] = 2] = "center";
    })(TextAlignment = timapi.TextAlignment || (timapi.TextAlignment = {}));
})(timapi || (timapi = {}));
var timapi;
(function (timapi) {
    class TextElement {
        constructor(textOrType, alignment) {
            if (typeof textOrType === "string") {
                this.type = timapi.TextType.text;
                this.text = textOrType;
            }
            else {
                this.alignment = alignment;
                this.type = textOrType;
                this.text = "";
            }
        }
        get $type() {
            return this.type;
        }
        get $alignment() {
            return this.alignment;
        }
        get $text() {
            return this.text;
        }
    }
    timapi.TextElement = TextElement;
})(timapi || (timapi = {}));
var timapi;
(function (timapi) {
    let TextType;
    (function (TextType) {
        TextType[TextType["text"] = 0] = "text";
        TextType[TextType["userId"] = 1] = "userId";
        TextType[TextType["posId"] = 2] = "posId";
        TextType[TextType["transactionType"] = 3] = "transactionType";
        TextType[TextType["fieldActId"] = 4] = "fieldActId";
        TextType[TextType["fieldAccPer"] = 5] = "fieldAccPer";
        TextType[TextType["fieldAcqId"] = 6] = "fieldAcqId";
        TextType[TextType["fieldAid"] = 7] = "fieldAid";
        TextType[TextType["fieldAmount"] = 8] = "fieldAmount";
        TextType[TextType["fieldAmountDcc"] = 9] = "fieldAmountDcc";
        TextType[TextType["fieldAmountOther"] = 10] = "fieldAmountOther";
        TextType[TextType["fieldAuthCode"] = 11] = "fieldAuthCode";
        TextType[TextType["fieldBrandName"] = 12] = "fieldBrandName";
        TextType[TextType["fieldCurrency"] = 13] = "fieldCurrency";
        TextType[TextType["fieldCurrencyDcc"] = 14] = "fieldCurrencyDcc";
        TextType[TextType["fieldDccDisclaimer"] = 15] = "fieldDccDisclaimer";
        TextType[TextType["fieldDisclaimer"] = 16] = "fieldDisclaimer";
        TextType[TextType["fieldExponent"] = 17] = "fieldExponent";
        TextType[TextType["fieldExponentDcc"] = 18] = "fieldExponentDcc";
        TextType[TextType["fieldMarkupDcc"] = 19] = "fieldMarkupDcc";
        TextType[TextType["fieldMarkupExponentDcc"] = 20] = "fieldMarkupExponentDcc";
        TextType[TextType["fieldCardNumberPrintableMerchant"] = 21] = "fieldCardNumberPrintableMerchant";
        TextType[TextType["fieldCardNumberPrintableCardholder"] = 22] = "fieldCardNumberPrintableCardholder";
        TextType[TextType["fieldRateDcc"] = 23] = "fieldRateDcc";
        TextType[TextType["fieldRateExponentDcc"] = 24] = "fieldRateExponentDcc";
        TextType[TextType["fieldTimeStampDate"] = 25] = "fieldTimeStampDate";
        TextType[TextType["fieldTimeStampTime"] = 26] = "fieldTimeStampTime";
        TextType[TextType["fieldTrmId"] = 27] = "fieldTrmId";
        TextType[TextType["fieldTrxRefNum"] = 28] = "fieldTrxRefNum";
        TextType[TextType["fieldTrxSeqCnt"] = 29] = "fieldTrxSeqCnt";
        TextType[TextType["fieldPosEntryMode"] = 30] = "fieldPosEntryMode";
        TextType[TextType["fieldCardExpiryDate"] = 31] = "fieldCardExpiryDate";
        TextType[TextType["fieldCardNumberEnc"] = 32] = "fieldCardNumberEnc";
        TextType[TextType["fieldAmountSaldo"] = 33] = "fieldAmountSaldo";
        TextType[TextType["fieldEctSeqCnt"] = 34] = "fieldEctSeqCnt";
    })(TextType = timapi.TextType || (timapi.TextType = {}));
})(timapi || (timapi = {}));
var timapi;
(function (timapi) {
    var statemachine;
    (function (statemachine) {
        var sixml;
        (function (sixml) {
            class ConvertSIXml2TimApi {
                static convertPrintData(printData) {
                    let timReceipts = new Array();
                    let timItemsItems = new Array();
                    for (let receipt of printData.receipt) {
                        timReceipts.push(new timapi.Receipt(timapi.protocol.constants.Recipient.protocol2TimApi(receipt.recipient), receipt.value));
                    }
                    for (let items of printData.receiptItems) {
                        let timItems = new Array();
                        for (let item of items.receiptItem) {
                            timItems.push(new timapi.ReceiptItem(timapi.protocol.constants.ReceiptItemType.protocol2TimApi(item.receiptItemType), timapi.protocol.constants.Recipient.protocol2TimApi(item.recipient), item.value));
                        }
                        timItemsItems.push(new timapi.ReceiptItems(timapi.protocol.constants.ReceiptType.protocol2TimApi(items.receiptType), timItems));
                    }
                    return new timapi.PrintData(timReceipts, timItemsItems);
                }
                static convertPrintDataOrNull(printData) {
                    if (printData == undefined) {
                        return undefined;
                    }
                    else {
                        return this.convertPrintData(printData);
                    }
                }
                static convertAdditionalInfo(list) {
                    let timList = new Map();
                    for (let item of list.AdditionalInfoItem) {
                        timList.set(item.iItemTextcode, item.value);
                    }
                    return timList;
                }
                static convertAdditionalInfoOrEmpty(list) {
                    if (list == undefined) {
                        return new Map();
                    }
                    else {
                        return this.convertAdditionalInfo(list);
                    }
                }
                static convertBasket(basket) {
                    let timList = new Array();
                    for (let item of basket.item) {
                        let timItem = new timapi.BasketItem();
                        timItem.$amountDiscount(this.convertAmountDiscountOrNull(item.amountDiscount));
                        timItem.$amountTax(this.convertAmount(item.amountTax));
                        timItem.$amountTotal(this.convertAmount(item.amountTotal));
                        timItem.$authResult(item.itemAuthResult);
                        timItem.$itemId(item.itemId);
                        timItem.$itemQuantity(this.convertItemQuantity(item.itemQuantity));
                        timItem.$loyaltyAuthResult(item.loyaltyAuthResult);
                        timItem.$loyaltyId(item.loyaltyId);
                        timItem.$prodDescription(item.prodDescription);
                        timList.push(timItem);
                    }
                    return timList;
                }
                static convertBasketOrEmpty(basket) {
                    if (basket == undefined) {
                        return new Array();
                    }
                    else {
                        return this.convertBasket(basket);
                    }
                }
                static convertItemQuantity(itemQuantity) {
                    return new timapi.ItemQuantity(itemQuantity.value, itemQuantity.exponent, itemQuantity.itemQuantityType);
                }
                static convertItemQuantityOrNull(itemQuantity) {
                    if (itemQuantity == undefined) {
                        return undefined;
                    }
                    else {
                        return this.convertItemQuantity(itemQuantity);
                    }
                }
                static convertCounters(counters) {
                    let timCounters = new Array();
                    for (let counter of counters.counter) {
                        let timTotals = new Array();
                        for (let total of counter.total) {
                            let currency = timapi.constants.Currency[total.currency];
                            let timDetails = new Array();
                            for (let detail of total.trxDetail) {
                                timDetails.push(new timapi.TrxDetail(detail.dccFlag, timapi.protocol.constants.TransactionType.protocol2TimApi(detail.transactionType), detail.count, new timapi.Amount(detail.amountSum, currency)));
                            }
                            timTotals.push(new timapi.Total(total.count, new timapi.Amount(total.amountSum, currency), timDetails));
                        }
                        timCounters.push(new timapi.Counter(counter.brandName, timapi.constants.PaymentProtocol.ep2, counter.acqId, counter.count, counter.countDcc, counter.countForeign, timTotals));
                    }
                    return new timapi.Counters(timapi.protocol.constants.CounterType.protocol2TimApi(counters.counterType), counters.actSeqCounter !== undefined ? counters.actSeqCounter : counters.periodSeqCounter, timCounters);
                }
                static convertCountersOrNull(counters) {
                    if (counters == undefined) {
                        return undefined;
                    }
                    else {
                        return this.convertCounters(counters);
                    }
                }
                static convertTimeDate(timeDate) {
                    return new timapi.TimeDate(timeDate.$year, timeDate.$month, timeDate.$day, timeDate.$hour, timeDate.$minute, timeDate.$second);
                }
                static convertTimeDateOrNull(timeDate) {
                    if (timeDate == undefined) {
                        return undefined;
                    }
                    else {
                        return this.convertTimeDate(timeDate);
                    }
                }
                static convertAmount(amount) {
                    return new timapi.Amount(amount.value, timapi.constants.Currency[amount.currency]);
                }
                static convertAmountDue(amount) {
                    return new timapi.Amount(amount.value, timapi.constants.Currency[amount.currency]);
                }
                static convertAmountTax(amount) {
                    return new timapi.Amount(amount.value, timapi.constants.Currency[amount.currency]);
                }
                static convertAmountTotal(amount) {
                    return new timapi.Amount(amount.value, timapi.constants.Currency[amount.currency]);
                }
                static convertAmountSaldo(amount) {
                    return new timapi.Amount(amount.value, timapi.constants.Currency[amount.currency]);
                }
                static convertAmountOrNull(amount) {
                    if (amount == undefined) {
                        return undefined;
                    }
                    else {
                        return this.convertAmount(amount);
                    }
                }
                static convertAmountDueOrNull(amount) {
                    if (amount == undefined) {
                        return undefined;
                    }
                    else {
                        return this.convertAmount(amount);
                    }
                }
                static convertAmountSaldoOrNull(amount) {
                    if (amount == undefined) {
                        return undefined;
                    }
                    else {
                        return this.convertAmount(amount);
                    }
                }
                static convertAmountDcc(amount) {
                    return new timapi.AmountDcc(amount.value, timapi.constants.Currency[amount.currency], amount.rate, amount.rateExponent, amount.markup, amount.markupExponent);
                }
                static convertAmountDccOrNull(amount) {
                    if (amount == undefined) {
                        return undefined;
                    }
                    else {
                        return this.convertAmountDcc(amount);
                    }
                }
                static convertAmountTip(amount) {
                    return new timapi.Amount(amount.value, timapi.constants.Currency[amount.currency]);
                }
                static convertAmountTipOrNull(amount) {
                    if (amount == undefined) {
                        return undefined;
                    }
                    else {
                        return this.convertAmountTip(amount);
                    }
                }
                static convertTransactionInformation(info, terminalId) {
                    return new timapi.TransactionInformation(info.posEntryMode ? timapi.protocol.constants.PosEntryMode.protocol2TimApi(info.posEntryMode) : undefined, info.cvm ? timapi.protocol.constants.Cvm.protocol2TimApi(info.cvm) : undefined, info.merchantAction ? timapi.protocol.constants.MerchantAction.protocol2TimApi(info.merchantAction) : undefined, info.authCode, this.convertTimeDateOrNull(info.timeStamp), info.transRef !== undefined ? info.transRef : undefined, info.transSeq !== undefined ? info.transSeq : undefined, info.acqId !== undefined ? info.acqId : 0, this.convertSignatureInformationOrNull(info.signatureInformation), info.trmTransRef, info.acqTransRef);
                }
                static convertTransactionInformationOrNull(info, terminaleId) {
                    if (info == undefined) {
                        return undefined;
                    }
                    else {
                        return this.convertTransactionInformation(info);
                    }
                }
                static convertAmountDiscount(amount) {
                    return new timapi.AmountDiscount(amount.value, timapi.constants.Currency[amount.currency], amount.discountId);
                }
                static convertAmountDiscountOrNull(amount) {
                    if (amount == undefined) {
                        return undefined;
                    }
                    else {
                        return this.convertAmountDiscount(amount);
                    }
                }
                static convertSignatureInformation(info) {
                    return new timapi.SignatureInformation(timapi.protocol.constants.ImageFileFormat.protocol2TimApi(info.imageFileFormat), info.imageWidth, info.imageHeight, info.value);
                }
                static convertSignatureInformationOrNull(info) {
                    if (info == undefined) {
                        return undefined;
                    }
                    else {
                        return this.convertSignatureInformation(info);
                    }
                }
                static convertCardData(cardData) {
                    let timTrackDatas = new Array();
                    for (let trackData of cardData.cardTrackData) {
                        timTrackDatas.push(new timapi.CardTrackData(trackData.trackNum, trackData.value));
                    }
                    let timLoyalityInfos = new Map();
                    if (cardData.loyaltyInformationList !== undefined) {
                        for (let info of cardData.loyaltyInformationList.loyaltyInformation) {
                            timLoyalityInfos.set(info.loyaltyInfoType, info.value);
                        }
                    }
                    return new timapi.CardData(timapi.protocol.constants.PosEntryMode.protocol2TimApiIfValid(cardData.posEntryMode), cardData.aid, cardData.acc, cardData.cardNumber, cardData.cardNumberPrintable, cardData.cardNumberPrintableCardholder, cardData.cardNumberEnc, cardData.cardNumberEncKeyIndex !== undefined
                        ? cardData.cardNumberEncKeyIndex
                        : 0, this.convertTimeDateOrNull(cardData.cardExpiryDate), cardData.brandName, cardData.tenderName, timTrackDatas, timLoyalityInfos, cardData.cardRef, timapi.protocol.constants.ProcessingDisposition.protocol2TimApiIfValid(cardData.processingDisposition), cardData.language);
                }
                static convertCardDataOrNull(cardData) {
                    if (cardData == undefined) {
                        return undefined;
                    }
                    else {
                        return this.convertCardData(cardData);
                    }
                }
                static convertNativeErrorOrNull(nativeError) {
                    if (nativeError == undefined) {
                        return undefined;
                    }
                    else {
                        return this.convertNativeError(nativeError);
                    }
                }
                static convertNativeError(nativeError) {
                    return new timapi.NativeError(nativeError.errorMessage, nativeError.getErrorSource, nativeError.errorCode);
                }
                static convertPpInfoOrNull(ppInfo) {
                    if (ppInfo == undefined) {
                        return undefined;
                    }
                    else {
                        return this.convertPpInfo(ppInfo);
                    }
                }
                static convertPpInfo(ppInfo) {
                    return new timapi.PpInfo(timapi.protocol.constants.PaymentProtocol.protocol2TimApi(ppInfo.paymentProtocol), ppInfo.ppEp2TransSeqCntOrig, ppInfo.ppEp2AuthReslt, ppInfo.ppEp2AuthRespC);
                }
                static convertRequestShowSignatureCapture(request) {
                    let sixmlRequest = new timapi.protocol.sixml.Request_ShowSignatureCapture();
                    sixmlRequest.setBrandBar(this.convertBrandBar(request.$brandMode, request.$brandBar));
                    let sixmlSigData = new timapi.protocol.sixml.SignatureData();
                    sixmlSigData.setBackgroundColor(this.convertColor(request.$backgroundColor));
                    sixmlSigData.setImageFileFormat(timapi.protocol.constants.ImageFileFormat.protocol2TimApi(request.$imageFileFormat));
                    sixmlSigData.setImageHeight(request.$imageFileHeight);
                    sixmlSigData.setImageWidth(request.$imageFileWidth);
                    if (request.$language != undefined) {
                        sixmlSigData.setLanguage(request.$language);
                    }
                    sixmlSigData.setResourceId(timapi.protocol.constants.ResourceId.protocol2TimApi(request.$resourceId));
                    sixmlSigData.setSignatureColor(this.convertColor(request.$signatureColor));
                    sixmlSigData.setTheme(timapi.protocol.constants.Theme.protocol2TimApi(request.$theme));
                    sixmlSigData.setTimeout(request.$timeout);
                    if (request.$watermarkColor != undefined) {
                        sixmlSigData.setWatermarkColor(this.convertColor(request.$watermarkColor));
                    }
                    if (request.$watermarkItems.length > 0) {
                        let sixmlWatermarkList = new timapi.protocol.sixml.WatermarkItemList();
                        for (let each of request.$watermarkItems) {
                            sixmlWatermarkList.getWatermarkItem().push(each);
                        }
                        sixmlSigData.setWatermarkItemList(sixmlWatermarkList);
                    }
                    sixmlRequest.setSignatureData(sixmlSigData);
                    return sixmlRequest;
                }
                static convertBrandBar(mode, brands) {
                    let sixmlBrandBar = new timapi.protocol.sixml.BrandBar();
                    sixmlBrandBar.setBrandMode(timapi.protocol.constants.BrandMode.protocol2TimApi(mode));
                    if (mode === timapi.constants.BrandMode.selected) {
                        let string = new timapi.utils.StringBuilder();
                        let addSeparator = false;
                        for (let each of brands) {
                            if (addSeparator) {
                                string.append(",");
                            }
                            addSeparator = true;
                            string.append(timapi.protocol.constants.BrandBarBrand.protocol2TimApi(each));
                        }
                        sixmlBrandBar.setValue(timapi.utils.StringHelper.makeString(string));
                    }
                    return sixmlBrandBar;
                }
                static convertColor(color) {
                    return color.$colorCode;
                }
            }
            sixml.ConvertSIXml2TimApi = ConvertSIXml2TimApi;
        })(sixml = statemachine.sixml || (statemachine.sixml = {}));
    })(statemachine = timapi.statemachine || (timapi.statemachine = {}));
})(timapi || (timapi = {}));
var timapi;
(function (timapi) {
    var statemachine;
    (function (statemachine) {
        var sixml;
        (function (sixml) {
            class ConvertTimApi2SIXml {
                static convertSettings(settings) {
                    let sixmlSettingList = new timapi.protocol.sixml.SettingsList();
                    for (let [key, value] of settings.entries()) {
                        let sixmlSetting = new timapi.protocol.sixml.Setting();
                        sixmlSetting.settingType = timapi.protocol.constants.SettingType.timApi2Protocol(key);
                        sixmlSetting.value = value;
                        sixmlSettingList.setting.push(sixmlSetting);
                    }
                    return sixmlSettingList;
                }
                static convertTransactionRequest(terminal, request, type, guides) {
                    let data = request.$transactionData;
                    let hasGastro = guides.has(timapi.constants.Guides.gastro);
                    let hasPetrol = guides.has(timapi.constants.Guides.petrol);
                    let hasUnattendd = guides.has(timapi.constants.Guides.unattended);
                    switch (type) {
                        case timapi.constants.TransactionType.purchase: {
                            let sixmlRequest = new timapi.protocol.sixml.Request_Purchase();
                            sixmlRequest.amount = this.convertAmount(request.$amount);
                            if (hasGastro && request.$tipAmount !== undefined) {
                                sixmlRequest.amountTip = this.convertAmountTip(request.$tipAmount);
                            }
                            if (request.$merchantOptions.length > 0) {
                                sixmlRequest.merchantOptionList = this.convertMerchantOptions(request.$merchantOptions);
                            }
                            if (data !== undefined) {
                                let sixmlData = new timapi.protocol.sixml.TransactionData();
                                sixmlData.dccAllowed = data.$dccAllowed;
                                sixmlData.ecrSeqCounter = data.$ecrSeqCounter;
                                sixmlData.partialApprovalAllowed = data.$partialApprovalAllowed;
                                if (hasGastro) {
                                    sixmlData.tipAllowed = data.$tipAllowed;
                                }
                                sixmlData.acqId = data.$acqId;
                                sixmlData.acqTransRef = data.$acqTransRef;
                                sixmlData.cardRef = data.$cardRef;
                                sixmlData.trmTransRef = data.$trmTransRef;
                                sixmlRequest.transactionData = sixmlData;
                                if (hasPetrol || hasUnattendd) {
                                    sixmlRequest.language = data.$language;
                                }
                            }
                            sixmlRequest.usrId = request.$userId;
                            return sixmlRequest;
                        }
                        case timapi.constants.TransactionType.credit: {
                            let sixmlRequest = new timapi.protocol.sixml.Request_Credit();
                            sixmlRequest.amount = this.convertAmount(request.$amount);
                            if (request.$merchantOptions.length > 0) {
                                sixmlRequest.merchantOptionList = this.convertMerchantOptions(request.$merchantOptions);
                            }
                            if (data !== undefined) {
                                let sixmlData = new timapi.protocol.sixml.TransactionData();
                                sixmlData.ecrSeqCounter = data.$ecrSeqCounter;
                                sixmlData.transRef = data.$transRef;
                                if (data.$trxOriginalDate !== undefined) {
                                    sixmlData.setTrxOriginalDate(this.convertTimeDate(data.$trxOriginalDate));
                                }
                                sixmlData.acqId = data.$acqId;
                                sixmlData.acqTransRef = data.$acqTransRef;
                                sixmlData.cardRef = data.$cardRef;
                                sixmlData.trmTransRef = data.$trmTransRef;
                                sixmlRequest.transactionData = sixmlData;
                            }
                            sixmlRequest.usrId = request.$userId;
                            return sixmlRequest;
                        }
                        case timapi.constants.TransactionType.reversal: {
                            let sixmlRequest = new timapi.protocol.sixml.Request_Reversal();
                            if (request.$merchantOptions.length > 0) {
                                sixmlRequest.merchantOptionList = this.convertMerchantOptions(request.$merchantOptions);
                            }
                            let sixmlData = new timapi.protocol.sixml.TransactionData();
                            sixmlData.ecrSeqCounter = data.$ecrSeqCounter;
                            sixmlData.transSeq = data.$transSeq;
                            sixmlData.acqId = data.$acqId;
                            sixmlData.acqTransRef = data.$acqTransRef;
                            sixmlData.cardRef = data.$cardRef;
                            sixmlData.trmTransRef = data.$trmTransRef;
                            sixmlRequest.transactionData = sixmlData;
                            sixmlRequest.usrId = request.$userId;
                            return sixmlRequest;
                        }
                        case timapi.constants.TransactionType.preAuthorization: {
                            let sixmlRequest = new timapi.protocol.sixml
                                .Request_PreAuthorization();
                            sixmlRequest.amount = this.convertAmount(request.$amount);
                            if (request.$merchantOptions.length > 0) {
                                sixmlRequest.merchantOptionList = this.convertMerchantOptions(request.$merchantOptions);
                            }
                            if (data !== undefined) {
                                let sixmlData = new timapi.protocol.sixml.TransactionData();
                                sixmlData.dccAllowed = data.$dccAllowed;
                                sixmlData.ecrSeqCounter = data.$ecrSeqCounter;
                                sixmlData.partialApprovalAllowed = data.$partialApprovalAllowed;
                                sixmlData.acqId = data.$acqId;
                                sixmlData.acqTransRef = data.$acqTransRef;
                                sixmlData.cardRef = data.$cardRef;
                                sixmlData.trmTransRef = data.$trmTransRef;
                                sixmlRequest.transactionData = sixmlData;
                                if (hasPetrol || hasUnattendd) {
                                    sixmlRequest.language = data.$language;
                                }
                            }
                            sixmlRequest.usrId = request.$userId;
                            return sixmlRequest;
                        }
                        case timapi.constants.TransactionType.finalizePurchase: {
                            let sixmlRequest = new timapi.protocol.sixml
                                .Request_FinalizePurchase();
                            sixmlRequest.amount = this.convertAmount(request.$amount);
                            if (request.$additionalInfo.size > 0) {
                                sixmlRequest.additionalInfoList = this.convertAdditionalInfoList(request.$additionalInfo);
                            }
                            if (request.$basket.length > 0) {
                                sixmlRequest.basket = this.convertBasket(request.$basket);
                            }
                            if (data !== undefined) {
                                let sixmlData = new timapi.protocol.sixml.TransactionData();
                                sixmlData.ecrSeqCounter = data.$ecrSeqCounter;
                                sixmlData.acqId = data.$acqId;
                                sixmlData.acqTransRef = data.$acqTransRef;
                                sixmlData.cardRef = data.$cardRef;
                                sixmlData.transRef = data.$transRef;
                                sixmlData.transSeq = data.$transSeq;
                                sixmlData.trmTransRef = data.$trmTransRef;
                                sixmlRequest.transactionData = sixmlData;
                            }
                            return sixmlRequest;
                        }
                        case timapi.constants.TransactionType.purchaseForcedAcceptance: {
                            let sixmlRequest = new timapi.protocol.sixml
                                .Request_PurchaseForcedAcceptance();
                            sixmlRequest.amount = this.convertAmount(request.$amount);
                            if (request.$merchantOptions.length > 0) {
                                sixmlRequest.merchantOptionList = this.convertMerchantOptions(request.$merchantOptions);
                            }
                            if (data !== undefined) {
                                let sixmlData = new timapi.protocol.sixml.TransactionData();
                                sixmlData.dccAllowed = data.$dccAllowed;
                                sixmlData.ecrSeqCounter = data.$ecrSeqCounter;
                                sixmlData.partialApprovalAllowed = data.$partialApprovalAllowed;
                                if (hasGastro) {
                                    sixmlData.tipAllowed = data.$tipAllowed;
                                }
                                sixmlData.acqId = data.$acqId;
                                sixmlData.acqTransRef = data.$acqTransRef;
                                sixmlData.cardRef = data.$cardRef;
                                sixmlData.trmTransRef = data.$trmTransRef;
                                sixmlRequest.transactionData = sixmlData;
                            }
                            sixmlRequest.usrId = request.$userId;
                            return sixmlRequest;
                        }
                        case timapi.constants.TransactionType.cashAdvance: {
                            let sixmlRequest = new timapi.protocol.sixml.Request_CashAdvance();
                            sixmlRequest.amount = this.convertAmount(request.$amount);
                            if (request.$merchantOptions.length > 0) {
                                sixmlRequest.merchantOptionList = this.convertMerchantOptions(request.$merchantOptions);
                            }
                            sixmlRequest.usrId = terminal.$userId;
                            if (data !== undefined) {
                                let sixmlData = new timapi.protocol.sixml.TransactionData();
                                sixmlData.ecrSeqCounter = data.$ecrSeqCounter;
                                sixmlData.acqId = data.$acqId;
                                sixmlData.acqTransRef = data.$acqTransRef;
                                sixmlData.cardRef = data.$cardRef;
                                sixmlData.transRef = data.$transRef;
                                sixmlData.transSeq = data.$transSeq;
                                sixmlData.trmTransRef = data.$trmTransRef;
                                sixmlRequest.transactionData = sixmlData;
                            }
                            return sixmlRequest;
                        }
                        case timapi.constants.TransactionType.purchaseWithCashback: {
                            let sixmlRequest = new timapi.protocol.sixml
                                .Request_PurchaseWithCashback();
                            sixmlRequest.amount = this.convertAmount(request.$amount);
                            sixmlRequest.amountOther = this.convertAmountOther(request.$amountOther);
                            if (request.$merchantOptions.length > 0) {
                                sixmlRequest.merchantOptionList = this.convertMerchantOptions(request.$merchantOptions);
                            }
                            if (data !== undefined) {
                                let sixmlData = new timapi.protocol.sixml.TransactionData();
                                sixmlData.dccAllowed = data.$dccAllowed;
                                sixmlData.ecrSeqCounter = data.$ecrSeqCounter;
                                sixmlData.partialApprovalAllowed = data.$partialApprovalAllowed;
                                if (hasGastro) {
                                    sixmlData.tipAllowed = data.$tipAllowed;
                                }
                                sixmlData.acqId = data.$acqId;
                                sixmlData.acqTransRef = data.$acqTransRef;
                                sixmlData.cardRef = data.$cardRef;
                                sixmlData.trmTransRef = data.$trmTransRef;
                                sixmlRequest.transactionData = sixmlData;
                            }
                            sixmlRequest.usrId = request.$userId;
                            return sixmlRequest;
                        }
                        case timapi.constants.TransactionType.purchasePhoneAuthorized: {
                            let sixmlRequest = new timapi.protocol.sixml
                                .Request_PurchasePhoneAuthorized();
                            sixmlRequest.amount = this.convertAmount(request.$amount);
                            if (request.$merchantOptions.length > 0) {
                                sixmlRequest.merchantOptionList = this.convertMerchantOptions(request.$merchantOptions);
                            }
                            sixmlRequest.usrId = terminal.$userId;
                            if (data !== undefined) {
                                let sixmlData = new timapi.protocol.sixml.TransactionData();
                                sixmlData.dccAllowed = data.$dccAllowed;
                                sixmlData.ecrSeqCounter = data.$ecrSeqCounter;
                                sixmlData.partialApprovalAllowed = data.$partialApprovalAllowed;
                                if (hasGastro) {
                                    sixmlData.tipAllowed = data.$tipAllowed;
                                }
                                sixmlData.acqId = data.$acqId;
                                sixmlData.acqTransRef = data.$acqTransRef;
                                sixmlData.cardRef = data.$cardRef;
                                sixmlData.phoneAuthCode = data.$phoneAuthCode;
                                sixmlData.trmTransRef = data.$trmTransRef;
                                sixmlRequest.transactionData = sixmlData;
                            }
                            return sixmlRequest;
                        }
                        case timapi.constants.TransactionType.reservation: {
                            let sixmlRequest = new timapi.protocol.sixml.Request_Reservation();
                            sixmlRequest.amount = this.convertAmount(request.$amount);
                            if (data != undefined) {
                                let sixmlData = new timapi.protocol.sixml.TransactionData();
                                sixmlData.dccAllowed = data.$dccAllowed;
                                sixmlData.ecrSeqCounter = data.$ecrSeqCounter;
                                sixmlData.partialApprovalAllowed = data.$partialApprovalAllowed;
                                sixmlData.acqTransRef = data.$acqTransRef;
                                sixmlData.cardRef = data.$cardRef;
                                sixmlData.trmTransRef = data.$trmTransRef;
                                sixmlRequest.transactionData = sixmlData;
                            }
                            return sixmlRequest;
                        }
                        case timapi.constants.TransactionType.adjustReservation: {
                            let sixmlRequest = new timapi.protocol.sixml.Request_AdjustReservation();
                            sixmlRequest.amount = this.convertAmount(request.$amount);
                            if (data != undefined) {
                                let sixmlData = new timapi.protocol.sixml.TransactionData();
                                sixmlData.dccAllowed = data.$dccAllowed;
                                sixmlData.ecrSeqCounter = data.$ecrSeqCounter;
                                sixmlData.partialApprovalAllowed = data.$partialApprovalAllowed;
                                sixmlData.acqTransRef = data.$acqTransRef;
                                sixmlRequest.transactionData = sixmlData;
                            }
                            return sixmlRequest;
                        }
                        case timapi.constants.TransactionType.cancelReservation: {
                            let sixmlRequest = new timapi.protocol.sixml.Request_CancelReservation();
                            if (data != undefined) {
                                let sixmlData = new timapi.protocol.sixml.TransactionData();
                                sixmlData.ecrSeqCounter = data.$ecrSeqCounter;
                                sixmlData.acqTransRef = data.$acqTransRef;
                                sixmlRequest.transactionData = sixmlData;
                            }
                            return sixmlRequest;
                        }
                        case timapi.constants.TransactionType.purchaseReservation: {
                            let sixmlRequest = new timapi.protocol.sixml.Request_PurchaseReservation();
                            sixmlRequest.amount = this.convertAmount(request.$amount);
                            if (data != undefined) {
                                let sixmlData = new timapi.protocol.sixml.TransactionData();
                                sixmlData.dccAllowed = data.$dccAllowed;
                                sixmlData.$ecrSeqCounter = data.$ecrSeqCounter;
                                if (hasGastro) {
                                    sixmlData.tipAllowed = data.$tipAllowed;
                                }
                                sixmlData.acqTransRef = data.$acqTransRef;
                                sixmlData.cardRef = data.$cardRef;
                                sixmlRequest.transactionData = sixmlData;
                            }
                            return sixmlRequest;
                        }
                        default:
                            throw new Error("unexpected transactiont type");
                    }
                }
                static convertAmount(amount) {
                    let sixmlAmount = new timapi.protocol.sixml.Amount();
                    sixmlAmount.currency = amount.$currency.code;
                    sixmlAmount.exponent = amount.$currency.exponent;
                    sixmlAmount.value = Math.round(amount.$amount);
                    return sixmlAmount;
                }
                static convertAmountOrNull(amount) {
                    if (amount == undefined) {
                        return undefined;
                    }
                    else {
                        return this.convertAmount(amount);
                    }
                }
                static convertAmountTip(amount) {
                    let sixmlAmountTip = new timapi.protocol.sixml.AmountTip();
                    sixmlAmountTip.currency = amount.$currency.code;
                    sixmlAmountTip.exponent = amount.$currency.exponent;
                    sixmlAmountTip.value = amount.$amount;
                    return sixmlAmountTip;
                }
                static convertAmountOther(amount) {
                    let sixmlAmountOther = new timapi.protocol.sixml.AmountOther();
                    sixmlAmountOther.currency = amount.$currency.code;
                    sixmlAmountOther.exponent = amount.$currency.exponent;
                    sixmlAmountOther.value = amount.$amount;
                    return sixmlAmountOther;
                }
                static convertAmountDiscount(amount) {
                    let sixmlAmount = new timapi.protocol.sixml.AmountDiscount();
                    sixmlAmount.currency = amount.$currency.code;
                    sixmlAmount.exponent = amount.$currency.exponent;
                    sixmlAmount.value = amount.$amount;
                    sixmlAmount.discountId = amount.$discountId;
                    return sixmlAmount;
                }
                static convertAmountTax(amount) {
                    let sixmlAmount = new timapi.protocol.sixml.AmountTax();
                    sixmlAmount.currency = amount.$currency.code;
                    sixmlAmount.exponent = amount.$currency.exponent;
                    sixmlAmount.value = amount.$amount;
                    return sixmlAmount;
                }
                static convertAmountTotal(amount) {
                    let sixmlAmount = new timapi.protocol.sixml.AmountTotal();
                    sixmlAmount.currency = amount.$currency.code;
                    sixmlAmount.exponent = amount.$currency.exponent;
                    sixmlAmount.value = amount.$amount;
                    return sixmlAmount;
                }
                static convertMerchantOptions(options) {
                    let sixmlList = new timapi.protocol.sixml.MerchantOptionList();
                    for (let option of options) {
                        let sixmlOption = new timapi.protocol.sixml.MerchantOption();
                        sixmlOption.setMerchantOptionType(timapi.protocol.constants.MerchantOptionType.timApi2Protocol(option.$type));
                        sixmlOption.value = option.$value;
                        sixmlList.merchantOption.push(sixmlOption);
                    }
                    return sixmlList;
                }
                static convertAdditionalInfoList(list) {
                    let sixmlList = new timapi.protocol.sixml.AdditionalInfoList();
                    for (let [key, value] of list.entries()) {
                        let sixmlItem = new timapi.protocol.sixml.AdditionalInfoItem();
                        sixmlItem.itemTextcode = key;
                        sixmlItem.value = value;
                        sixmlList.additionalInfoItem.push(sixmlItem);
                    }
                    return sixmlList;
                }
                static convertBasket(basket) {
                    let sixmlBasket = new timapi.protocol.sixml.Basket();
                    for (let item of basket) {
                        let sixmlItem = new timapi.protocol.sixml.Item();
                        sixmlItem.amount = this.convertAmount(item.$amount);
                        if (item.$amountDiscount !== undefined) {
                            sixmlItem.amountDiscount = this.convertAmountDiscount(item.$amountDiscount);
                        }
                        sixmlItem.amountTax = this.convertAmountTax(item.$amountTax);
                        sixmlItem.amountTotal = this.convertAmountTotal(item.$amountTotal);
                        sixmlItem.itemAuthResult = item.$authResult;
                        sixmlItem.itemId = item.$itemId;
                        sixmlItem.itemQuantity = this.convertItemQuantity(item.$itemQuantity);
                        sixmlItem.loyaltyAuthResult = item.$loyaltyAuthResult;
                        sixmlItem.loyaltyId = item.$loyaltyId;
                        sixmlItem.prodDescription = item.$prodDescription;
                        sixmlBasket.item.push(sixmlItem);
                    }
                    return sixmlBasket;
                }
                static convertItemQuantity(itemQuantity) {
                    let sixmlItemQuantity = new timapi.protocol.sixml.ItemQuantity();
                    sixmlItemQuantity.value = itemQuantity.$quantity;
                    sixmlItemQuantity.exponent = itemQuantity.$exponent;
                    sixmlItemQuantity.itemQuantityType = itemQuantity.$quantityType;
                    return sixmlItemQuantity;
                }
                static convertTimeDate(timeDate) {
                    return new timapi.protocol.TimeDate(timeDate.$year, timeDate.$month, timeDate.$day, timeDate.$hour, timeDate.$minute, timeDate.$second);
                }
                static findMatchingProtocolLevel(terminal) {
                    let protocolLevel = 0;
                    if (terminal.getFeatures() == undefined) {
                        for (let pl of Object.values(timapi.constants.ProtocolLevel)) {
                            protocolLevel = Math.max(protocolLevel, timapi.protocol.constants.ProtocolLevel.timApi2Protocol(pl));
                        }
                    }
                    else {
                        if (terminal.getFeatures().$sixml.$protocolLevels.size === 0) {
                            return 0;
                        }
                        for (let pl of terminal.getFeatures().$sixml.$protocolLevels) {
                            protocolLevel = Math.max(protocolLevel, timapi.protocol.constants.ProtocolLevel.timApi2Protocol(pl));
                        }
                    }
                    return protocolLevel;
                }
                static createLoginRequest(terminal) {
                    let settings = terminal.$settings;
                    let guides = settings.$guides;
                    let request = new timapi.protocol.sixml.Request_Login();
                    request.integratorId = settings.$integratorId;
                    request.manufacturerFlags = settings.$manufacturerFlags;
                    request.posId = terminal.$posId;
                    if (terminal.$printOptions.length > 0) {
                        let printOptionList = new timapi.protocol.sixml.PrintOptionList();
                        for (let option of terminal.$printOptions) {
                            let printOption = new timapi.protocol.sixml.PrintOptions();
                            printOption.printFlags = timapi.protocol.constants.PrintFlag.timApi2Protocol(option.$printFlags);
                            printOption.printFormat = timapi.protocol.constants.PrintFormat.timApi2Protocol(option.$printFormat);
                            printOption.printWidth = option.$printWidth;
                            printOption.recipient = timapi.protocol.constants.Recipient.timApi2Protocol(option.$recipient);
                            printOptionList.printOptions.push(printOption);
                        }
                        request.printOptionList = printOptionList;
                    }
                    let requestAutoCommit = settings.$autoCommit;
                    if (terminal.getFeatures() !== undefined) {
                        if (terminal.getFeatures().$sixml.$autoCommit === timapi.Support.disabled) {
                            requestAutoCommit = false;
                        }
                    }
                    let protocolOptionList = new timapi.protocol.sixml.ProtocolOptionList();
                    let protocolOption = new timapi.protocol.sixml.ProtocolOption();
                    protocolOption.optionType =
                        timapi.protocol.constants.OptionType.sixmlProtocolLevel;
                    let protocolLevel = this.findMatchingProtocolLevel(terminal);
                    if (protocolLevel == 0) {
                        throw new timapi.TimException(timapi.constants.ResultCode.apiFunctionDisallowed);
                    }
                    protocolOption.value = protocolLevel;
                    protocolOptionList.protocolOption.push(protocolOption);
                    protocolOption = new timapi.protocol.sixml.ProtocolOption();
                    protocolOption.optionType =
                        timapi.protocol.constants.OptionType.sixmlGuides;
                    protocolOption.value = timapi.protocol.constants.Guides.timApi2Protocol(guides).toString(16);
                    protocolOptionList.protocolOption.push(protocolOption);
                    protocolOption = new timapi.protocol.sixml.ProtocolOption();
                    protocolOption.optionType =
                        timapi.protocol.constants.OptionType.sixmlAutoCommit;
                    protocolOption.value = requestAutoCommit ? 1 : 0;
                    protocolOptionList.protocolOption.push(protocolOption);
                    if (guides.has(timapi.constants.Guides.unattended)) {
                        protocolOption = new timapi.protocol.sixml.ProtocolOption();
                        protocolOption.optionType =
                            timapi.protocol.constants.OptionType.sixmlAutoShiftManagement;
                        protocolOption.value = settings.$autoShiftManagement ? 1 : 0;
                        protocolOptionList.protocolOption.push(protocolOption);
                        protocolOption = new timapi.protocol.sixml.ProtocolOption();
                        protocolOption.optionType =
                            timapi.protocol.constants.OptionType.sixmlAutoShutterManagement;
                        protocolOption.value = settings.$autoShutterManagement ? 1 : 0;
                        protocolOptionList.protocolOption.push(protocolOption);
                    }
                    protocolOption = new timapi.protocol.sixml.ProtocolOption();
                    protocolOption.optionType =
                        timapi.protocol.constants.OptionType.sixmlCardInsertionTimeout;
                    protocolOption.value = settings.$cardInsertionTimeout;
                    protocolOptionList.protocolOption.push(protocolOption);
                    protocolOption = new timapi.protocol.sixml.ProtocolOption();
                    protocolOption.optionType =
                        timapi.protocol.constants.OptionType.sixmlCardRemovalTimeout;
                    protocolOption.value = settings.$cardRemovalTimeout;
                    protocolOptionList.protocolOption.push(protocolOption);
                    protocolOption = new timapi.protocol.sixml.ProtocolOption();
                    protocolOption.optionType =
                        timapi.protocol.constants.OptionType.sixmlCommitTimeout;
                    protocolOption.value = settings.$commitTimeout;
                    protocolOptionList.protocolOption.push(protocolOption);
                    protocolOption = new timapi.protocol.sixml.ProtocolOption();
                    protocolOption.optionType =
                        timapi.protocol.constants.OptionType.sixmlPartialApproval;
                    protocolOption.value = settings.$partialApproval ? 1 : 0;
                    protocolOptionList.protocolOption.push(protocolOption);
                    if (guides.has(timapi.constants.Guides.petrol)) {
                        protocolOption = new timapi.protocol.sixml.ProtocolOption();
                        protocolOption.optionType =
                            timapi.protocol.constants.OptionType.sixmlProceedTimeout;
                        protocolOption.value = settings.$proceedTimeout;
                        protocolOptionList.protocolOption.push(protocolOption);
                    }
                    if (guides.has(timapi.constants.Guides.gastro)) {
                        protocolOption = new timapi.protocol.sixml.ProtocolOption();
                        protocolOption.optionType =
                            timapi.protocol.constants.OptionType.sixmlTip;
                        protocolOption.value = settings.$tipAllowed ? 1 : 0;
                        protocolOptionList.protocolOption.push(protocolOption);
                    }
                    request.protocolOptionList = protocolOptionList;
                    return request;
                }
                static convertRequestShowSignatureCapture(request) {
                    let sixmlRequest = new timapi.protocol.sixml
                        .Request_ShowSignatureCapture();
                    sixmlRequest.setBrandBar(this.convertBrandBar(request.$brandMode, request.$brandBar));
                    let sixmlSigData = new timapi.protocol.sixml.SignatureData();
                    sixmlSigData.vackgroundColor = this.convertColor(request.$backgroundColor);
                    sixmlSigData.setImageFileFormat(timapi.protocol.constants.ImageFileFormat.timApi2Protocol(request.$imageFileFormat));
                    sixmlSigData.setImageHeight(request.$imageFileHeight);
                    sixmlSigData.setImageWidth(request.$imageFileWidth);
                    if (request.$language !== undefined) {
                        sixmlSigData.setLanguage(request.$language);
                    }
                    sixmlSigData.setResourceId(timapi.protocol.constants.ResourceId.timApi2Protocol(request.$resourceId));
                    sixmlSigData.setSignatureColor(this.convertColor(request.$signatureColor));
                    sixmlSigData.setTheme(timapi.protocol.constants.Theme.timApi2Protocol(request.$theme));
                    sixmlSigData.setTimeout(request.$timeout);
                    if (request.$watermarkColor !== undefined) {
                        sixmlSigData.setWatermarkColor(this.convertColor(request.$watermarkColor));
                    }
                    if (request.$watermarkItems.length > 0) {
                        let sixmlWatermarkList = new timapi.protocol.sixml.WatermarkItemList();
                        for (let each of request.$watermarkItems) {
                            sixmlWatermarkList.getWatermarkItem().push(each);
                        }
                        sixmlSigData.setWatermarkItemList(sixmlWatermarkList);
                    }
                    sixmlRequest.setSignatureData(sixmlSigData);
                    return sixmlRequest;
                }
                static convertBrandBar(mode, brands) {
                    let sixmlBrandBar = new timapi.protocol.sixml.BrandBar();
                    sixmlBrandBar.setBrandMode(timapi.protocol.constants.BrandMode.timApi2Protocol(mode));
                    if (mode === timapi.constants.BrandMode.selected) {
                        let string = new timapi.utils.StringBuilder();
                        let addSeparator = false;
                        for (let each of brands) {
                            if (addSeparator) {
                                string.append(",");
                            }
                            addSeparator = true;
                            string.append(timapi.protocol.constants.BrandBarBrand.timApi2Protocol(each));
                        }
                        sixmlBrandBar.value = timapi.utils.StringHelper.makeString(string);
                    }
                    return sixmlBrandBar;
                }
                static convertRequestShowDialog(request) {
                    let sixmlRequest = new timapi.protocol.sixml.Request_ShowDialog();
                    sixmlRequest.setBrandBar(this.convertBrandBar(request.$brandMode, request.$brandBar));
                    let sixmlResData = new timapi.protocol.sixml.ResourceData();
                    sixmlResData.setResourceId(timapi.protocol.constants.ResourceId.timApi2Protocol(request.$resourceId));
                    sixmlResData.setTheme(timapi.protocol.constants.Theme.timApi2Protocol(request.$theme));
                    sixmlResData.setTimeout(request.$timeout);
                    if (request.$language !== undefined) {
                        sixmlResData.setLanguage(request.$language);
                    }
                    if (request.$placeholderItems.size > 0) {
                        let sixmlList = new timapi.protocol.sixml.PlaceholderItemList();
                        for (let [key, value] of request.$placeholderItems.entries()) {
                            let sixmlItem = new timapi.protocol.sixml.PlaceholderItem();
                            sixmlItem.placeholderNumber = key;
                            sixmlItem.value = value;
                            sixmlList.placeholderItem.push(sixmlItem);
                        }
                        sixmlResData.setPlaceholderItemList(sixmlList);
                    }
                    sixmlRequest.setResourceData(sixmlResData);
                    return sixmlRequest;
                }
                static convertColor(color) {
                    return color.$colorCode;
                }
            }
            sixml.ConvertTimApi2SIXml = ConvertTimApi2SIXml;
        })(sixml = statemachine.sixml || (statemachine.sixml = {}));
    })(statemachine = timapi.statemachine || (timapi.statemachine = {}));
})(timapi || (timapi = {}));
var timapi;
(function (timapi) {
    var statemachine;
    (function (statemachine) {
        var sixml;
        (function (sixml) {
            class TaskKeepAliveCheck {
                constructor($delegate, $sleepInSeconds) {
                    this.delegate = $delegate;
                    let _this = this;
                    this.id = setTimeout(function () {
                        _this.run();
                    }, $sleepInSeconds);
                }
                run() {
                    this.delegate.armKeepAliveTimer();
                    try {
                        this.delegate.eventKeepAliveTimer();
                    }
                    catch (error) {
                        this.delegate.onError(error);
                    }
                }
                cancel() {
                    try {
                        clearTimeout(this.id);
                    }
                    catch (error) {
                    }
                }
            }
            sixml.TaskKeepAliveCheck = TaskKeepAliveCheck;
        })(sixml = statemachine.sixml || (statemachine.sixml = {}));
    })(statemachine = timapi.statemachine || (timapi.statemachine = {}));
})(timapi || (timapi = {}));
var timapi;
(function (timapi) {
    var statemachine;
    (function (statemachine) {
        var sixml;
        (function (sixml) {
            class TaskKeepAliveDisconnect {
                constructor($delegate, $sleepInSeconds) {
                    this.delegate = $delegate;
                    let _this = this;
                    this.id = setTimeout(function () {
                        _this.run();
                    }, $sleepInSeconds);
                }
                run() {
                    this.delegate.cancelTaskKeepAliveDisconnect();
                    try {
                        this.delegate.eventKeepAliveTimeout();
                    }
                    catch (error) {
                        this.delegate.onError(error);
                    }
                }
                cancel() {
                    try {
                        clearTimeout(this.id);
                    }
                    catch (error) {
                    }
                }
            }
            sixml.TaskKeepAliveDisconnect = TaskKeepAliveDisconnect;
        })(sixml = statemachine.sixml || (statemachine.sixml = {}));
    })(statemachine = timapi.statemachine || (timapi.statemachine = {}));
})(timapi || (timapi = {}));
var timapi;
(function (timapi) {
    var statemachine;
    (function (statemachine) {
        var sixml;
        (function (sixml) {
            class TaskTimeout {
                constructor($delegate, $sleepInSeconds) {
                    this.delegate = $delegate;
                    let _this = this;
                    this.id = setTimeout(function () {
                        _this.run();
                    }, $sleepInSeconds);
                }
                run() {
                    this.delegate.cancelTaskTimeout();
                    try {
                        this.delegate.eventTimeout();
                    }
                    catch (error) {
                        this.delegate.onError(error);
                    }
                }
                cancel() {
                    try {
                        clearTimeout(this.id);
                    }
                    catch (error) {
                    }
                }
            }
            sixml.TaskTimeout = TaskTimeout;
        })(sixml = statemachine.sixml || (statemachine.sixml = {}));
    })(statemachine = timapi.statemachine || (timapi.statemachine = {}));
})(timapi || (timapi = {}));
