//  SDK

#import <Foundation/Foundation.h>
#if TARGET_OS_IPHONE
#import <MessageUI/MessageUI.h>
#endif

#define AMEX @"AMEX";
#define UNIONPAY @"UNIONPAY";
#define DINERS @"DINERS";
#define DISCOVER @"DISCOVER";
#define JCB @"JCB";
#define LASER @"LASER";
#define MAESTRO @"MAESTRO";
#define MASTERCARD @"MASTERCARD";
#define SOLO @"SOLO";
#define SWITCH @"SWITCH";
#define VISA @"VISA";
#define LINX @"LINX";
#define NCB_DEBIT @"NCB DEBIT";
#define JETS_DEBIT @"JETS DEBIT";

/*!
 * @typedef TransactionState
 * @constant OPEN open transactions.
 * @constant CLOSED closed transactions.
 * @constant ALL all transactions.
 */
typedef enum {
    OPEN,
    CLOSED,
    ALL
} TransactionState;

/*!
 * @typedef DownGradeType
 * @constant SWIPED swipe transactions.
 * @constant KEYED keyed transactions.
 */
typedef enum {
    NONE,
    DOWN_GRADE_TYPE_SWIPED,
    DOWN_GRADE_TYPE_KEYED
} DownGradeType;

/*!
 * @typedef LogLevel
 * @constant LEVEL_FULL Full logging
 * @constant LEVEL_INFO Info logging
 * @constant LEVEL_ERROR ERROR logging
 * @constant LEVEL_NONE No logging
 */
typedef enum {
    LEVEL_FULL,
    LEVEL_INFO,
    LEVEL_ERROR,
    LEVEL_NONE
} LogLevel;

/*!
 * @typedef CoreEmvType
 * @constant STANDARD Standard EMV transaction
 * @constant QUICK_CHIP Quick chip transaction
 */
typedef enum {
    STANDARD,
    QUICK_CHIP
} CoreEmvType;

/*!
 * @typedef CardAccount
 * @constant CASH - EBT cash
 */
typedef enum {
    CardAccount_Default,
    CASH,
    FOOD_STAMP
} CardAccount;
#define cardAccountToString(enum)      [@[@"",@"CASH",@"FOOD_STAMP"] objectAtIndex:enum]
/*!
 * @typedef SignatureCollection
 * @constant AUTOMATIC Signature will be collected automatically by the sdk, onSignatureRequired method will be triggered.
 * @constant MANUAL Signature won't be collected automatically, it should be collected on the paper receipt.
 */
typedef enum {
    AUTOMATIC,
    MANUAL
} SignatureCollection;

/*!
 * @typedef FallbackReason
 * @constant TECHNICAL Regular fallback when a terminal fails to read the card's chip. (Default Value).
 * @constant EMPTY_CANDIDATE_LIST Empty candidate list fallbacks happen when, for example,there is no common application (AID) supported by both the chip and the terminal..
 */
typedef enum {
    TECHNICAL,
    EMPTY_CANDIDATE_LIST
} FallbackReason;

/*!
 * @typedef CoreResponseInputMethod
 * @constant INPUT_METHOD_KEYED - Keyed was the transaction input method.
 * @constant INPUT_METHOD_MSR_SIGNATURE - Magstripe with signature was the transaction input method.
 * @constant INPUT_METHOD_ICC  - EMV was the transaction input method.
 * @constant INPUT_METHOD_MSR_FALLBACK - Swipe Fallback was the transaction input method.
 * @constant INPUT_METHOD_CONTACTLESS_MSR - Contactless MSR was the transaction input method.
 * @constant INPUT_METHOD_CONTACTLESS_ICC - Contactless ICC was the transaction input method.
 */
typedef enum {
    INPUT_METHOD_KEYED,
    INPUT_METHOD_MSR_SIGNATURE,
    INPUT_METHOD_ICC,
    INPUT_METHOD_MSR_FALLBACK,
    INPUT_METHOD_CONTACTLESS_MSR,
    INPUT_METHOD_CONTACTLESS_ICC
    
} CoreResponseInputMethod;

#define getInputTypeName(enum)[@{ [@(INPUT_METHOD_KEYED) stringValue]:@"keyed", [@(INPUT_METHOD_MSR_SIGNATURE) stringValue]:@"swipeSig", [@(INPUT_METHOD_ICC) stringValue]:@"emv", [@(INPUT_METHOD_MSR_FALLBACK) stringValue]:@"swipeFallback", [@(INPUT_METHOD_CONTACTLESS_MSR) stringValue]:@"contactlessMsr", [@(INPUT_METHOD_CONTACTLESS_ICC) stringValue]:@"contactlessEmv"} objectForKey:[@(enum) stringValue]]

/*!
 * @typedef DeviceConnectionType
 * @constant BLUETOOTH connection type.
 * @constant USB connection type.
 * @constant AUDIO connection type.
 */
typedef enum  {
    BLUETOOTH,
    USB,
    AUDIO
}DeviceConnectionType;

/*!
 * @typedef TerminalType
 * @constant CHP - Card holder present.
 * @constant INTERNET - Internet.
 */
typedef enum  {
    CHP,
    INTERNET
}TerminalType;

/*!
 * @typedef TerminalCategory
 * @constant ATTENDED_TERMINAL - Attended terminal.
 * @constant UNATTENDED_TERMINAL - Unattended terminal.
 */
typedef enum  {
    ATTENDED_TERMINAL,
    UNATTENDED_TERMINAL
}TerminalCategory;

/*!
 * @typedef SaleRequestType
 * @constant SALE - sale type.
 * @constant PURCHASE - purchase type.
 * @constant CASH_WITHDRAWAL - cash withdrawal type.
 * @constant FOOD_RETURN - food return type.
 */
typedef enum  {
    SaleRequestType_Default,
    PURCHASE,
    SALE_REQUEST,
    CASH_WITHDRAWAL,
    FOOD_RETURN
}SaleRequestType;

#define saleRequestTypeToString(enum)      [@[@"",@"PURCHASE",@"SALE_REQUEST",@"CASH_WITHDRAWAL",@"FOOD_RETURN"] objectAtIndex:enum]
/*!
 * @typedef CoreTransactionInputMethod
 * @constant SWIPE Indicates Swipe mode.
 * @constant INSERT Indicates insert mode.
 * @constant TAP Indicates tap mode.
 * @constant SWIPE_OR_INSERT Indicates Swipe or insert mode.
 * @constant SWIPE_OR_TAP Indicates Swipe or tap mode.
 * @constant INSERT_OR_TAP Indicates insert or tap mode.
 * @constant SWIPE_OR_INSERT_OR_TAP Indicates Swipe or insert or tap mode.
 */
typedef enum  {
    CoreTransactionInputMethod_Default,
    SWIPE,
    INSERT,
    TAP,
    SWIPE_OR_INSERT,
    SWIPE_OR_TAP,
    INSERT_OR_TAP,
    SWIPE_OR_INSERT_OR_TAP,
    MANUAL_PAN_ENTRY
}CoreTransactionInputMethod;


/*!
 * @typedef DeviceEnum
 * @constant NODEVICE no device.
 * @constant BLUEPAD device.
 * @constant BBPOSDEVICE device.
 */
typedef enum {
    NODEVICE = 0,
    BLUEPAD,
    BBPOSDEVICE,
    
    LASTDEVICEENUM
} DeviceEnum;

#define deviceEnumToString(enum)      [@[@"Nodevice",@"Bluepad",@"BBPosDevice"] objectAtIndex:enum]
#define deviceEnumToDisplayName(enum) [@[@""        ,@""       ,@"Walker/Nomad"] objectAtIndex:enum]

/*!
 * @typedef CoreMode
 * @constant LIVE - used with live devices to process real transactions.
 * @constant TEST - used for development.
 * @constant DEV - used for development. New version of the server.
 * @constant SELFTEST - test technical intergration based on device used for testing.
 */
typedef enum {
    LIVE,
    TEST,
    DEV
} CoreMode;

/*!
 * @typedef CoreTransactionType
 * @constant SALE_TRANSACTION .
 * @constant PRE_AUTH .
 * @constant OFFLINE_DECLINE - offline decline .
 */
typedef enum {
    SALE_TRANSACTION,
    PRE_AUTH,
    OFFLINE_DECLINE
} CoreTransactionType;

/*!
 * @typedef CoreMessage
 * @constant DEVICE_CONNECTED  - Device connected through headphone jack.
 * @constant DEVICE_NOT_CONNECTED - No device connected through headphone jack.
 * @constant WALKER_DISCONNECTED - Walker disconnected.
 * @constant GOING_ONLINE - Going online to do the transaction.
 * @constant WALKER_CONNECTED - Walker is connected.
 * @constant WRONG_DEVICE - Expects another device to be connected.
 * @constant CARD_SWIPE_DETECTED - Swipe has been detected.
 * @constant SIGNATURE_IS_REQUIRED - Signature is required.
 * @constant SWIPE_FAILED - Swipe has failed.
 * @constant TRANSACTION_ERROR - Error when processing transaction.
 * @constant TIMEOUT_ERROR - Timeout limit error.
 * @constant CARD_SWIPE - Swipe the card.
 * @constant CARD_INSERT_SWIPE - Swipe or insert the card.
 * @constant CARD_DETECTED - Card detected.
 * @constant CARD_ACCEPTED - Card accepted.
 * @constant PINPAD_CONNECTED - Pinpad connected.
 * @constant REINSERT_OR_SWIPE - Reinsert or swipe.
 * @constant TRANSACTION_CANCELLED - Transaction cancelled.
 * @constant UNKNOWN_ERROR - Unknown error.
 * @constant CARD_REQUIRES_CHIP_READ - Card requires chip read.
 * @constant PIN_ENTRY_SUCCESSFUL - PIN entry successful.
 * @constant INVALID_PIN_ENTERED - Invalid PIN entered.
 * @constant INVALID_PIN_ENTERED_LAST_ATTEMPT - Invalid PIN entered, last attempt.
 * @constant SENDING_TRANSACTION - Sending transaction.
 * @constant CANCELLED - Canceled.
 * @constant CONNECTION_ERROR - Pinpad connection error.
 * @constant INSERT_OR_SWIPE - Insert or swipe the card.
 * @constant PIN_TIMEOUT - Pin timeout.
 * @constant SMART_CARD_INSERTED - Smart card inserted.
 * @constant SETTINGS_HERE - Settings here.
 * @constant SETTINGS_UPDATE_SUCCESSFUL - Settings update successful.
 * @constant TRANSACTION_UPDATE_SUCCESSFUL - transaction has been updated succesfully.
 * @constant PIN_REQUIRED - Pin is required.
 * @constant REVERSAL_ATTEMPTING - Attempting to reverse transaction.
 * @constant SCAN_STARTED - Indicates that bluetooth scan has started.
 * @constant SCAN_STOPPED - Indicates that bluetooth scan has stopped.
 * @constant SWIPE_AGAIN_PLEASE - Swipe the card again please.
 * @constant TRANSACTION_CANCELLED_BY_USER - transaction canceleld by the user.
 * @constant INVALID_CARD_PLEASE_TRY_AGAIN - the card is invalid. Please try again.
 * @constant BATTERY_LOW - Battery is too low.
 * @constant TAP_CARD_AGAIN - Tap card again.
 */
typedef enum {
    DEVICE_INITIALISING,
    DEVICE_NOT_CONNECTED,
    DEVICE_DISCONNECTED,
    GOING_ONLINE,
    CARD_SWIPE_DETECTED,
    SIGNATURE_IS_REQUIRED,
    CARD_SWIPE,
    CARD_INSERT_SWIPE,
    CARD_DETECTED,
    CARD_ACCEPTED,
    REINSERT_OR_SWIPE,
    CARD_REQUIRES_CHIP_READ,
    PIN_ENTRY_SUCCESSFUL,
    INVALID_PIN_ENTERED,
    INVALID_PIN_ENTERED_LAST_ATTEMPT,
    SENDING_TRANSACTION,
    INSERT_OR_SWIPE,
    SMART_CARD_INSERTED,
    SETTINGS_HERE,
    SETTINGS_UPDATE_SUCCESSFUL,
    TRANSACTION_UPDATE_SUCCESSFUL,
    
    /** BBPosDevice enums fo walker and nomad*/
    
    AMOUNT, AMOUNT_OK_OR_NOT, APPROVED, CALL_YOUR_BANK, CANCEL_OR_ENTER,
    CARD_ERROR, DECLINED, ENTER_AMOUNT, ENTER_PIN, INCORRECT_PIN, INSERT_CARD,
    NOT_ACCEPTED, PIN_OK, PLEASE_WAIT, PROCESSING_ERROR, REMOVE_CARD, USE_CHIP_READER,
    USE_MAG_STRIPE, TRY_AGAIN, REFER_TO_YOUR_PAYMENT_DEVICE, TRANSACTION_TERMINATED,
    TRY_ANOTHER_INTERFACE, ONLINE_REQUIRED, PROCESSING, WELCOME, PRESENT_ONLY_ONE_CARD,
    CAPK_LOADING_FAILED, LAST_PIN_TRY,SELECT_ACCOUNT,  INSERT_OR_TAP_CARD,PRESENT_CARD,
    APPROVED_PLEASE_SIGN,PRESENT_CARD_AGAIN,FINAL_CONFIRM,SHOW_THANK_YOU,PIN_TRY_LIMIT_EXCEEDED,
    TAP_CARD_AGAIN,TIMEOUT,APPLICATION_EXPIRED,NOT_ICC_CARD,
    AUTHORISING,CARD_REMOVED,
    INSERT_OR_SWIPE_CARD_OR_TAP_ANOTHER_CARD,
    INSERT_OR_SWIPE_CARD,
    MULTIPLE_CARDS_DETECTED,
    CLEAR_DISPLAY_MSG,INPUT_PIN_ING,MAG_TO_ICC_TRADE,
    BATTERY_LOW,
    INVALID_CARD_PLEASE_TRY_AGAIN,
    TRANSACTION_CANCELLED_BY_USER,
    INSERT_SWIPE_OR_TRY_ANOTHER_CARD,
    
    SELF_TEST_BLUEPAD,
    SELF_TEST_WALKER,
    SELF_TEST_NOMAD,
    SWIPE_AGAIN_PLEASE,
    SCAN_STOPPED,
    SCAN_STARTED,
    REVERSAL_ATTEMPTING,
    PIN_REQUIRED,
    CARD_INSERT, CARD_TAP, CARD_INSERT_OR_TAP, CARD_SWIPE_OR_TAP, INSERT_OR_SWIPE_OR_TAP_CARD, DEVICE_ALREADY_CONNECTED,
    ENTERED, BYPASS, CANCEL, KEY_ERROR, NO_PIN, WRONG_PIN_LENGTH,
    BLUETOOTH_OFF,
    LEVEL_FULL_NOT_SUPPORTED_IN_LIVE_MODE
} CoreMessage;

/*!
 * @typedef CoreDeviceError
 * @constant UNSUPPORTED_CARD_TYPE  - Card type is not supported.
 * @constant ERROR_DEVICE_NOT_SUPPORTED - SDK doesn’t support selected device.
 * @constant WRONG_DEVICE - Expects another device to be connected.
 * @constant SWIPE_FAILED - Swipe has failed.
 * @constant TRANSACTION_ERROR - Transaction error.
 * @constant INTERRUPTED - Transaction was interrupted.
 * @constant TIMEOUT_ERROR - Timeout has occured.
 * @constant TRANSACTION_CANCELLED - Transaction cancelled.
 * @constant UNKNOWN_ERROR - Unknown error has occurred.
 * @constant PIN_TIMEOUT - Pin timeout.
 * @constant INVALID_CARD - Card is invalid.
 * @constant InvalidInput - Input is invalid.
 * @constant InvalidInput_NotNumeric - Input is not numeric.
 * @constant InvalidInput_InputValueOutOfRange - Input is out of range.
 * @constant DeviceReset - Device will reset.
 * @constant CommandNotAvailable - Command is not available.
 * @constant CommError - Communication error.
 * @constant IllegalStateException - Illegal state exception.
 * @constant BTv2FailToStart - Bluetooth 2 failed to start.
 * @constant BTv4FailToStart - Bluetooth 4 failed to start.
 * @constant InvalidFunctionInBTv2Mode - Invalid function in Bluetooth 2 mode.
 * @constant InvalidFunctionInBTv4Mode - Invalid function in Bluetooth 4 mode.
 * @constant CommLinkUninitialized - Communication link is uninitialized.
 * @constant BTv4Unsupported - Bluetooth 4 is not supported.
 * @constant DeviceError - Device error.
 * @constant BTv4AlreadyConnected - Bluetooth 4 already connected.
 * @constant NETWORK_NOT_AVAILABLE - Bluetooth 4 already connected.
 * @constant PIN_FAILED - Pin has failed.
 * @constant TEST_NOT_SUPPORTED_BY_DEVICE - Currenty test is not supported by device.
 * @constant DECLINED_ERROR - Transaction Decline error.
 * @constant VALIDATION_FAILED_TESTS_NOT_COMPLETED - SelfTests not completed.
 */
typedef enum {
    UNSUPPORTED_CARD_TYPE,
    ERROR_DEVICE_NOT_SUPPORTED,
    WRONG_DEVICE,
    SWIPE_FAILED,
    TRANSACTION_ERROR,
    INTERRUPTED,
    TIMEOUT_ERROR,
    TRANSACTION_CANCELLED,
    UNKNOWN_ERROR,
    PIN_TIMEOUT,
    INVALID_CARD,
    
    /**
     * Error Enums for Nomad
     */
    InvalidInput,
    InvalidInput_NotNumeric,
    InvalidInput_InputValueOutOfRange,
    InvalidInput_InvalidDataFormat,
    InvalidInput_NoAcceptAmountForThisTransactionType,
    InvalidInput_NotAcceptCashbackForThisTransactionType,
    DeviceReset,
    CommandNotAvailable,
    CommError,
    IllegalStateException,
    BTv2FailToStart,
    BTv4FailToStart,
    InvalidFunctionInBTv2Mode,
    InvalidFunctionInBTv4Mode,
    CommLinkUninitialized,
    BTv4Unsupported,
    DeviceError,
    InvalidFunctionInAudioMode,
    BTv4AlreadyConnected,
    AudioFailToStart,
    AudioNotYetStarted,
    AudioRecordingPermissionDenied,
    BackgroundTimeout,
    DeviceBusy,
    AudioFailToStart_OtherAudioIsPlaying,
    // TRANSACTION RESULTS
    Result_Approved,
    Result_Terminated,
    Result_Declined,
    Result_SetAmountCancelOrTimeout,
    Result_CapkFail,
    Result_NotIcc,
    Result_CardBlocked,                  //Updated in 1.7.2
    Result_DeviceError,                  //Updated in 1.7.2
    Result_CardNotSupported,             //Added in 1.5.0
    Result_MissingMandatoryData,         //Added in 1.5.0, Fixed a typo in 1.6.1
    Result_NoEmvApps,                    //Added in 1.5.0, Updated in 1.7.2
    Result_InvalidIccData,               //Added in 1.5.0, Fixed a typo in 1.6.1
    Result_ConditionsOfUseNotSatisfied,  //Added in 1.6.4
    Result_ApplicationBlocked,           //Added in 1.7.2
    Result_IccCardRemoved,
    Result_SelectApplicationFail,
    Result_TdkError,
    NETWORK_NOT_AVAILABLE,
    PIN_FAILED,
    TEST_NOT_SUPPORTED_BY_DEVICE,
    DECLINED_ERROR,
    VALIDATION_FAILED_TESTS_NOT_COMPLETED,
    TRANSACTION_ABORTED,
    INPUT_METHOD_NOT_SUPPORTED_FOR_DELAYED_AUTH,
    INPUT_METHOD_NOT_SUPPORTED,
    SETTINGS_MISSING_DEVICE,
    PLUGIN_CANNOT_BE_INITIALIZED_EMV_SETTINGS_MISSING,
    TIPS_NOT_ENABLED_ON_THE_SERVER
} CoreDeviceError;

/*!
 * @typedef CoreErrorType
 * @constant ERROR_UNKNOWN  - Unknown error has occurred.
 * @constant ERROR_AUTHENTICATION_TOKEN - Authentication error, token is invalid.
 * @constant ERROR_CURRENCY_NOT_SUPPORTED - Currency is not supported by terminal.
 * @constant ERROR_TRANSACTION - Transaction has failed.
 * @constant ERROR_SERVER - Unknown server error.
 * @constant ERROR_TIMEOUT - Timeout limit.
 * @constant ERROR_NETWORK - Network error.
 * @constant VALIDATION_ERROR - Object Validation Error.
 * @constant ERROR_JSON - JSON error, cannot process json.
 * @constant INCORRECT_SETTINGS_TERMINAL - Terminal ID is incorrect.
 * @constant INCORRECT_SETTINGS_SECRET - Secret is incorrect.
 * @constant INCORRECT_SETTINGS - Settings are incorrect.
 * @constant ERROR_SIGNATURE_NULL - Signature is empty.
 * @constant ERROR_DEVICE_NOT_SUPPORTED - Device is not supported.
 * @constant ERROR_ORDER_ALREADY_PROCESSED - Error already processed.
 * @constant ERROR_CONNECTION - Occurs when the SDK cannot connect to the host
 * @constant DECRYPTION_FAILED_DEVICE_NOT_REGISTERED - Occurs when terminal does not allow cardholder present transactions
 * @constant CANT_REFUND_TRANSACTION - Transaction can’t be refunded. (usually occurs when transaction was already voided)
 * @constant SELFTEST_MODE_NOT_SET - SelfTest mode is not set in Terminal.
 * @constant RESOURCE_FILE_WITH_COREPAY_URL_NOT_FOUND - corePayConfig.xml file doesn’t exists
 * @constant TERMINAL_DOES_NOT_ALLOW_CHP - Occurs when terminal does not allow cardholder present transactions
 * @constant INVALID_REFUND_AMOUNT - This error occurs when Refund amount is too low or negative.
 * @constant UNREFERENCED_REFUND_SHOULD_BE_ENABLED - Unreferenced Refunds are not enabled on the terminal in Selfcare system.
 * @constant VALIDATION_LIMIT_REACHED - Validation limit reached. Lots of requests to the server are performed in small amount of time.
 * @constant TAX_AMOUNT_MUST_BE_GREATER_THAN_ZERO - This error occurs when Tax amount is too low.
 * @constant TIP_AMOUNT_MUST_BE_GREATER_THAN_ZERO - This error occurs when Tip amount is too low.
 * @constant USER_DOESNT_HAVE_ASSOCIATED_PRIVILEGE - User doesn’t have privilege to view Open/ Closed batch transactions. This option needs to be enabled in SelfCare system.
 * @constant ORDER_ID_WRONG_LENGTH - Order ID has wrong length.
 */
typedef enum {
    ERROR_UNKNOWN,
    ERROR_AUTHENTICATION_TOKEN,
    ERROR_CURRENCY_NOT_SUPPORTED,
    ERROR_TRANSACTION,
    ERROR_SERVER,
    ERROR_TIMEOUT,
    ERROR_NETWORK,
    VALIDATION_ERROR,
    ERROR_JSON,
    INCORRECT_SETTINGS_TERMINAL,
    INCORRECT_SETTINGS_SECRET,
    INCORRECT_SETTINGS,
    INVALID_URL,
    INCORRECT_PAYCONFIG_SETTINGS,
    ERROR_SIGNATURE_NULL,
    ERROR_ORDER_ALREADY_PROCESSED,
    SETTINGS_MISSING,
    ERROR_CONNECTION,
    DECRYPTION_FAILED_DEVICE_NOT_REGISTERED,
    CANT_REFUND_TRANSACTION,
    SELFTEST_MODE_NOT_SET,
    RESOURCE_FILE_WITH_COREPAY_URL_NOT_FOUND,
    TERMINAL_DOES_NOT_ALLOW_CHP,
    INVALID_REFUND_AMOUNT,
    UNREFERENCED_REFUND_SHOULD_BE_ENABLED,
    VALIDATION_LIMIT_REACHED,
    TAX_AMOUNT_MUST_BE_GREATER_THAN_ZERO,
    TIP_AMOUNT_MUST_BE_GREATER_THAN_ZERO,
    ORDER_ID_WRONG_LENGTH,
    USER_DOESNT_HAVE_ASSOCIATED_PRIVILEGE,
    ERROR_GENERAL_COUNTRY_UNKNOWN,
    ERROR_DIGEST_MISMATCH,
    ERROR_INVALID_API_KEY,
    ERROR_INVALID_AUTHENTICATION_TOKEN,
    ERROR_INVALID_USER_ACCESS,
    ERROR_METHOD_NOT_SUPPORTED,
    ERROR_VALIDATION_LIMIT_HIT,
    ERROR_SWIPE_WITHOUT_FALLBACK_NOT_ALLOWED,
    ERROR_INVALID_EMV_TAGS,
    ERROR_INVALID_TRACK_DATA,
    ERROR_INVALID_APPLE_PAYLOAD,
    ERROR_INVALID_AMOUNT,
    ERROR_INVALID_CURRENCY,
    ERROR_GENERAL,
    ERROR_INVALID_ARGUMENT,
    INVALID_MERCHANT_REFERENCE,
    DEVICE_IS_NOT_CONNECTED,
    DELAYED_AUTH_NOT_SUPPORTED,
    THIS_CALL_IS_NOT_SUPPORTED_FOR_PAYCONEX_SDK,
    INVALID_ACCOUNT_ID,
    ERROR_DECLINED,
    CARD_CVV_WRONG_FORMAT_OR_LENGTH,
    CARRIAGE_RETURN_FOUND,
    ERROR_INVALID_INTEGRATION,
    ERROR_INVALID_ANDROID_PAYLOAD,
    INCORRECT_CHECKER_TIMEOUT_OR_INTERVAL,
    CHECKER_NOT_STARTED_OR_TERMINAL_MANUALLY_SET_TO_OFFLINE,
    TERMINAL_OFFLINE_INPUT_METHOD_NOT_SUPPORTED,
    MANUAL_ENTRY_CURRENTLY_NOT_SUPPORTED,
    ERROR_INVALID_KSN_RANGE,
    ERROR_DEVICE_NOT_FOUND,
    ERROR_DEVICE_NOT_ACTIVATED,
    TERMINALID_OR_SECRET_NOT_DEFINED_IN_PAYCONFIG,
    ERROR_ORDER_ALREADY_IN_PROGRESS,
    ERROR_FEATURE_NOT_SUPPORTED,
    SECURE_CARD_NOT_FOUND
} CoreError;

/*!
 * @typedef Card Entry Mode
 *
 */
typedef enum {
    UNKNOWN = -1,
    UNSPECIFIED = 0,
    KEYED = 1,
    SWIPED = 2,
    BARCODE = 3,
    OCR = 4,
    ICC = 5,
    TRACK_ONE = 6,
    CONTACTLESS_ICC = 7,
    KEYED_FALLBACK = 79,
    SWIPED_FALLBACK = 80,
    E_COMMERCE = 81,
    CONTACTLESS_MOTO = 82,
    TRACK_ANY = 90,
    CONTACTLESS_MSR = 91,
    ICC_NO_CVV = 95,
    STORED = 96
} CoreCardEntryMode;

#define getCardEntryModeByName(name)                 [@{ @"UNKNOWN":@(UNKNOWN), @"UNSPECIFIED":@(UNSPECIFIED), @"KEYED":@(KEYED), @"SWIPED":@(SWIPED), @"BARCODE":@(BARCODE), @"OCR":@(OCR), @"ICC":@(ICC), @"TRACK_ONE":@(TRACK_ONE), @"CONTACTLESS_ICC":@(CONTACTLESS_ICC), @"KEYED_FALLBACK":@(KEYED_FALLBACK), @"SWIPED_FALLBACK":@(SWIPED_FALLBACK), @"E_COMMERCE":@(E_COMMERCE), @"CONTACTLESS_MOTO":@(CONTACTLESS_MOTO), @"TRACK_ANY":@(TRACK_ANY), @"CONTACTLESS_MSR":@(CONTACTLESS_MSR), @"ICC_NO_CVV":@(ICC_NO_CVV), @"STORED":@(STORED)} objectForKey:name]

#define getCardEntryModeName(enum)          [@{ [@(UNKNOWN) stringValue]:@"UNKNOWN", [@(UNSPECIFIED) stringValue]:@"UNSPECIFIED", [@(KEYED) stringValue]:@"KEYED", [@(SWIPED) stringValue]:@"SWIPED", [@(BARCODE) stringValue]:@"BARCODE", [@(OCR) stringValue]:@"OCR", [@(ICC) stringValue]:@"ICC", [@(TRACK_ONE) stringValue]:@"TRACK_ONE", [@(CONTACTLESS_ICC) stringValue]:@"CONTACTLESS_ICC", [@(KEYED_FALLBACK) stringValue]:@"KEYED_FALLBACK", [@(SWIPED_FALLBACK) stringValue]:@"SWIPED_FALLBACK", [@(E_COMMERCE) stringValue]:@"E_COMMERCE", [@(CONTACTLESS_MOTO) stringValue]:@"CONTACTLESS_MOTO", [@(TRACK_ANY) stringValue]:@"TRACK_ANY", [@(CONTACTLESS_MSR) stringValue]:@"CONTACTLESS_MSR", [@(ICC_NO_CVV) stringValue]:@"ICC_NO_CVV", [@(STORED) stringValue]:@"STORED"} objectForKey:[@(enum) stringValue]]

/*!
 * @typedef Currency
 *
 */
typedef enum {
    AED = 1,
    ANG = 2,
    ARS = 3,
    AUD = 4,
    AWG = 5,
    BBD = 6,
    BDT = 7,
    BHD = 8,
    BMD = 9,
    BRL = 10,
    BSD_ = 11,
    CAD = 12,
    CHF = 13,
    CNY = 14,
    COP = 15,
    CZK = 16,
    DKK = 17,
    EUR = 18,
    GBP = 19,
    HKD = 20,
    HUF = 21,
    ILS = 22,
    INR = 23,
    ISK = 24,
    JMD = 25,
    JPY = 26,
    KES = 27,
    KRW = 28,
    KWD = 29,
    KYD = 30,
    LVL = 31,
    MAD = 32,
    MXN = 33,
    MYR = 34,
    NOK = 35,
    NZD = 36,
    OMR = 37,
    PAB = 38,
    PLN = 39,
    QAR = 40,
    RON = 41,
    RUB = 42,
    SAR = 43,
    SEK = 44,
    SGD = 45,
    THB = 46,
    TRY = 47,
    TTD = 48,
    TWD = 49,
    UAH = 50,
    USD = 51,
    VEF = 52,
    XCD = 53,
    ZAR = 54
} Currency;

#define getCurrencyData(enum)[@{                [@(AED) stringValue]:@[@"784", @2, @"AED"], [@(ANG) stringValue]:@[@"532", @2, @"ANG"], [@(ARS) stringValue]:@[@"032", @2, @"ARS"], [@(AUD) stringValue]:@[@"036", @2, @"AUD"], [@(AWG) stringValue]:@[@"533", @2, @"AWG"], [@(BBD) stringValue]:@[@"052", @2, @"BBD"], [@(BDT) stringValue]:@[@"050", @2, @"BDT"], [@(BHD) stringValue]:@[@"048", @3, @"BHD"], [@(BMD) stringValue]:@[@"060", @2, @"BMD"], [@(BRL) stringValue]:@[@"986", @2, @"BRL"], [@(BSD_) stringValue]:@[@"044", @2, @"BSD"], [@(CAD) stringValue]:@[@"124", @2, @"CAD"], [@(CHF) stringValue]:@[@"756", @2, @"CHF"], [@(CNY) stringValue]:@[@"156", @2, @"CNY"], [@(COP) stringValue]:@[@"170", @2, @"COP"], [@(CZK) stringValue]:@[@"203", @2, @"CZK"], [@(DKK) stringValue]:@[@"208", @2, @"DKK"], [@(EUR) stringValue]:@[@"978", @2, @"EUR"], [@(GBP) stringValue]:@[@"826", @2, @"GBP"], [@(HKD) stringValue]:@[@"344", @2, @"HKD"], [@(HUF) stringValue]:@[@"348", @2, @"HUF"], [@(ILS) stringValue]:@[@"376", @2, @"ILS"], [@(INR) stringValue]:@[@"356", @2, @"INR"], [@(ISK) stringValue]:@[@"352", @0, @"ISK"], [@(JMD) stringValue]:@[@"388", @2, @"JMD"], [@(JPY) stringValue]:@[@"392", @0, @"JPY"], [@(KES) stringValue]:@[@"404", @2, @"KES"], [@(KRW) stringValue]:@[@"410", @0, @"KRW"], [@(KWD) stringValue]:@[@"414", @3, @"KWD"], [@(KYD) stringValue]:@[@"136", @2, @"KYD"], [@(LVL) stringValue]:@[@"428", @2, @"LVL"], [@(MAD) stringValue]:@[@"504", @2, @"MAD"], [@(MXN) stringValue]:@[@"484", @2, @"MXN"], [@(MYR) stringValue]:@[@"458", @2, @"MYR"], [@(NOK) stringValue]:@[@"578", @2, @"NOK"], [@(NZD) stringValue]:@[@"554", @2, @"NZD"], [@(OMR) stringValue]:@[@"512", @3, @"OMR"], [@(PAB) stringValue]:@[@"590", @2, @"PAB"], [@(PLN) stringValue]:@[@"985", @2, @"PLN"], [@(QAR) stringValue]:@[@"634", @2, @"QAR"], [@(RON) stringValue]:@[@"946", @2, @"RON"], [@(RUB) stringValue]:@[@"643", @2, @"RUB"], [@(SAR) stringValue]:@[@"682", @2, @"SAR"], [@(SEK) stringValue]:@[@"752", @2, @"SEK"], [@(SGD) stringValue]:@[@"702", @2, @"SGD"], [@(THB) stringValue]:@[@"764", @2, @"THB"], [@(TRY) stringValue]:@[@"949", @2, @"TRY"], [@(TTD) stringValue]:@[@"780", @2, @"TTD"], [@(TWD) stringValue]:@[@"901", @2, @"TWD"], [@(UAH) stringValue]:@[@"980", @2, @"UAH"], [@(USD) stringValue]:@[@"840", @2, @"USD"], [@(VEF) stringValue]:@[@"937", @2, @"VEF"], [@(XCD) stringValue]:@[@"951", @2, @"XCD"], [@(ZAR) stringValue]:@[@"710", @2, @"ZAR"]} objectForKey:[@(enum) stringValue]]

#define getCurrencyByName(name)                 [@{ @"AED":@(AED), @"ANG":@(ANG), @"ARS":@(ARS), @"AUD":@(AUD), @"AWG":@(AWG), @"BBD":@(BBD), @"BDT":@(BDT), @"BHD":@(BHD), @"BMD":@(BMD), @"BRL":@(BRL), @"BSD":@(BSD_), @"CAD":@(CAD), @"CHF":@(CHF), @"CNY":@(CNY), @"COP":@(COP), @"CZK":@(CZK), @"DKK":@(DKK), @"EUR":@(EUR), @"GBP":@(GBP), @"HKD":@(HKD), @"HUF":@(HUF), @"ILS":@(ILS), @"INR":@(INR), @"ISK":@(ISK), @"JMD":@(JMD), @"JPY":@(JPY), @"KES":@(KES), @"KRW":@(KRW), @"KWD":@(KWD), @"KYD":@(KYD), @"LVL":@(LVL), @"MAD":@(MAD), @"MXN":@(MXN), @"MYR":@(MYR), @"NOK":@(NOK), @"NZD":@(NZD), @"OMR":@(OMR), @"PAB":@(PAB), @"PLN":@(PLN), @"QAR":@(QAR), @"RON":@(RON), @"RUB":@(RUB), @"SAR":@(SAR), @"SEK":@(SEK), @"SGD":@(SGD), @"THB":@(THB), @"TRY":@(TRY), @"TTD":@(TTD), @"TWD":@(TWD), @"UAH":@(UAH), @"USD":@(USD), @"VEF":@(VEF), @"XCD":@(XCD), @"ZAR":@(ZAR)} objectForKey:name]

#define getCurrencyNameByValue(value)      [@[ @"AED", @"ANG",@"ARS", @"AUD", @"AWG", @"BBD", @"BDT", @"BHD", @"BMD", @"BRL", @"BSD", @"CAD", @"CHF", @"CNY", @"COP", @"CZK", @"DKK", @"EUR", @"GBP", @"HKD", @"HUF", @"ILS", @"INR", @"ISK", @"JMD", @"JPY", @"KES", @"KRW", @"KWD", @"KYD", @"LVL", @"MAD", @"MXN", @"MYR", @"NOK", @"NZD", @"OMR", @"PAB", @"PLN", @"QAR", @"RON", @"RUB", @"SAR", @"SEK", @"SGD", @"THB" @"TRY", @"TTD", @"TWD", @"UAH", @"USD", @"VEF", @"XCD", @"ZAR"] objectAtIndex:value]


@interface CoreVoucher : NSObject

@property NSString* cardNumber;
@property NSString* cardType;
@property NSString* voucherApprovalCode;
@property NSString* voucherNumber;
@property CardAccount cardAccount;

@end

/*!
 * @brief This class represents the filter for Transactions.
 * <p>
 * Example to create a transaction filter object.
 * </p>
 *
 * \code
 *    CoreTransactionFilter filter = [[CoreTransactionFilter alloc] init];
 *    filter.resultsPerPage = [NSNumber numberWithInteger: 25];
 *    filter.state = TransactionState.OPEN;
 *    filter.startDate = @"30-12-2015:13:45:30:123"; (pattern: dd-MM-yyyy:HH:mm:ss:SSS
 *    filter.endDate = @"30-04-2016:13:45:30:123"; (pattern: dd-MM-yyyy:HH:mm:ss:SSS
 * \endcode
 *
 */
@interface CoreTransactionFilter : NSObject
/*! @brief This property represents the number of transactions to retrieve. */
@property NSNumber *resultsPerPage;
/*! @brief This property represents state (OPEN, CLOSED, ALL). */
@property TransactionState state;
/*! @brief This property represents start date. */
@property NSString *startDate;
/*! @brief This property represents end date. */
@property NSString *endDate;
/*! @brief This property represents the transaction order id. */
@property NSString *orderId;

@end

/*!
 * @brief This class represents the unreferenced refund object.
 * <p>
 * Example to create a unreferenced refund object.
 * </p>
 *
 * \code
 *    CoreUnreferencedRefund *refund =[[CoreUnreferencedRefund alloc] init];
 *    refund.amount = [NSNumber numberWithDouble: 12];
 *    refund.cardCvv = @"111";
 *    refund.cardHolderName = @"Test user";
 *    refund.cardNumber = @"4111111111111111";
 *    refund.cardType= @"VISA";
 *    refund.expiryDate = @"1215";
 *    refund.reason=@"reason";
 *    [[WTPSTerminal singeton] processUnreferencedRefund:refund];
 * \endcode
 *
 */
@interface CoreUnreferencedRefund : NSObject

/*! @brief This property represents amount. */
@property NSNumber* amount;
/*! @brief This property represents order ID. */
@property NSString* orderId;
/*! @brief This property represents card holder name. */
@property NSString* cardHolderName;
/*! @brief This property represents card number. */
@property NSString* cardNumber;
/*! @brief This property represents card CVV. */
@property NSString* cardCvv;
/*! @brief This property represents card type. */
@property NSString* cardType;
/*! @brief This property represents expiry date. */
@property NSString* expiryDate;
/*! @brief This property represents reason. */
@property NSString* reason;
/*! @brief This property represents auto ready. */
@property NSNumber* autoReady;
/*! @brief This property represents operator. */
@property NSString* _operator;
/*! @brief This property represents encrypted track data. */
@property NSString* encryptedTrackData;
/*! @brief This property represents ksn. */
@property NSString* ksn;
/*! @brief This property represents serial number of the device */
@property NSString* serial;
/*! @brief This property represents the category of the terminal. */
@property TerminalCategory terminalCategory;
/*! Sets the value of the transactionInputMethod property. Start the transaction in different mode.(Swipe, Insert, Tap)  */
@property CoreTransactionInputMethod transactionInputMethod;
/*! @brief This property represents device type. */
@property NSString* deviceType;
/*! @brief This property represents device type. */
@property NSString* firstDigitOfPan;
/*! @brief This property represents device type. */
@property NSString* tlvString;
/*! @brief This property represents masked PAN. */
@property NSString* maskedPAN;
/*! @brief This property represents encrypted PAN. */
@property NSString* encryptedPAN;

@end


@interface CoreUnreferencedRefundEbt : CoreUnreferencedRefund

/*! @brief This property represents card account used for EBT. */
@property CardAccount cardAccount;
/*! @brief This property represents encrypted pin block. */
@property NSString* encryptedPinBlock;
/*! @brief This property represents pin block KSN. */
@property NSString* pinBlockKsn;
/*! @brief This property represents device ID */
@property NSString* deviceId;
/*! @brief This property represents voucher used for EBT. */
@property CoreVoucher* voucher;

@end

/*!
 * @brief This class represents referenced refund object.
 * <p>
 * Example to create a referenced refund object.
 * </p>
 *
 * \code
 *    CoreRefund *refund =[[CoreRefund alloc] init];
 *    refund.amount = [NSNumber numberWithDouble:12];
 *    refund.uniqueRef = @"FYG0UCFLRA";
 *    refund.reason = @"reason";
 *    [[WTPSTerminal singleton] processRefund:refund];
 * \endcode
 *
 */
@interface CoreRefund : NSObject
/*! @brief This property represents amount. */
@property NSNumber* amount;
/*! @brief This property represents order Identifier. */
@property NSString* orderId;
/*! @brief This property represents reason of therefund. */
@property NSString* reason;
/*! @brief This property represents unique reference assigned to each transaction. */
@property NSString* uniqueRef;
/*! @brief This property represents auto ready indicating weather the transaction is set automatically to READY in the open batch. */
@property NSNumber* autoReady;
/*! @brief This property represents operator type. */
@property NSString* _operator;
/*! @brief This property represents previous transaction date and time. */
@property NSString* previousTxnDateTime;

@end

/*!
 * @brief CoreCustomField object used for secure card registration.
 *
 * \code
 *    CoreCustomField customField = [[CoreCustomField alloc] init];
 *    customField.name = @"Name";
 *    customField.value = @"Value";
 * \endcode
 *
 */
@interface CoreCustomField : NSObject
/*! @brief This property represents the field name. */
@property NSString* name;
/*! @brief This property represents the field value. */
@property NSString* value;

@end

/*!
 * @brief CoreOCRSecureCard object used for card keyed data.
 *
 * \code
 *    CoreOCRSecureCard ocrMethod = [[CoreOCRSecureCard alloc] init];
 *    ocrMethod.cardType = @"VISA";
 *    ocrMethod.cardNumber = @"123456789123";
 *    ocrMethod.cardHolderName = @"Card Holder Name";
 *    ocrMethod.expiryDate = @"1218";
 * \endcode
 *
 */
@interface CoreOCRSecureCard : NSObject
/*! @brief This property represents the card type. */
@property NSString* cardType;
/*! @brief This property represents the card number. */
@property NSString* cardNumber;
//*! @brief This property represents card holder name. */
@property NSString* cardHolderName;
/*! @brief This property represents the card expiry date. */
@property NSString* expiryDate;

@end

/*!
 * @brief CoreKeyedSecureCard object used for card keyed data.
 *
 * \code
 *    CoreKeyedSecureCard keyedMethod = [[CoreKeyedSecureCard alloc] init];
 *    keyedMethod.cardType = @"VISA";
 *    keyedMethod.cardNumber = @"123456789123";
 *    keyedMethod.cardHolderName = @"Card Holder Name";
 *    keyedMethod.expiryDate = @"1218";
 *    keyedMethod.cvv = @"123";
 * \endcode
 *
 */
@interface CoreKeyedSecureCard : CoreOCRSecureCard
/*! @brief This property represents the card cvv. */
@property NSString* cvv;

@end


/*!
 * @brief CoreTrackSecureCard object used for card track data.
 *
 * \code
 *    CoreTrackSecureCard trackMethod = [[CoreTrackSecureCard alloc] init];
 *    trackMethod.cardType = @"VISA";
 *    trackMethod.encryptedData = @"12345678901234567890";
 *    trackMethod.cardHolderName = @"Card Holder Name";
 *    trackMethod.ksn = @"123456";
 * \endcode
 *
 */
@interface CoreTrackSecureCard : NSObject
/*! @brief This property represents the card type. */
@property NSString* cardType;
/*! @brief This property represents the card excrypted data. */
@property NSString* encryptedData;
//*! @brief This property represents card holder name. */
@property NSString* cardHolderName;
/*! @brief This property represents the card key serial number. */
@property NSString* ksn;

@end

/*!
 * @brief CoreEmvSecureCard object used for card track data.
 *
 * \code
 *    CoreEmvSecureCard emvMethod = [[CoreEmvSecureCard alloc] init];
 *    emvMethod.cardType = @"VISA";
 *    emvMethod.emvTags = [[NSMutableArray alloc] init];
 *    emvMethod.cardHolderName = @"Card Holder Name";
 *    emvMethod.ksn = @"123456";
 *  emvMethod.tlvString = @"sdfgahje827e7289dj25267849284ygbd";
 * \endcode
 *
 */
@interface CoreEmvSecureCard : NSObject
/*! @brief This property represents the card type. */
@property NSString* cardType;
/*! @brief This property represents the list of emv tags retrieved from the card. */
@property NSMutableDictionary* emvTags;
//*! @brief This property represents card holder name. */
@property NSString* cardHolderName;
/*! @brief This property represents the card key serial number. */
@property NSString* ksn;
/*! @brief This property represents the card tlv. */
@property NSString* tlvString;

@end

/*!
 * @brief CoreTokenMethod object used for secure card register/edit.
 *
 * \code
 *    CoreTokenMethod tokenMethod = [[CoreTokenMethod alloc] init];
 *    tokenMethod.keyedSecureCard = [[CoreKeyedSecureCard alloc] init];
 *    tokenMethod.trackSecureCard = [[CoreTrackSecureCard alloc] init];
 *    tokenMethod.emvSecureCard = [[CoreEmvSecureCard alloc] init];
 *  tokenMethod.ocrSecureCard = [[CoreOCRSecureCard alloc] init];
 * \endcode
 *
 */
@interface CoreTokenMethod : NSObject
/*! @brief This property represents the keyed payment method. */
@property CoreKeyedSecureCard *keyedSecureCard;
/*! @brief This property represents the track payment method. */
@property CoreTrackSecureCard* trackSecureCard;
/*! @brief This property represents the EMV payment method. */
@property CoreEmvSecureCard* emvSecureCard;
/*! @brief This property represents the OCR payment method. */
@property CoreOCRSecureCard* ocrSecureCard;

@end

/*!
 * @brief This class represents the card to be registered/edited/deleted as a secure card.
 *
 * \code
 *    CoreSecureCard secureCard = [[CoreSecureCard alloc] init];
 *    secureCard.merchantReference = @"MR01";
 *    ...
 * \endcode
 *
 */
@interface CoreSecureCard : NSObject
/*! @brief This property represents the reference for the new secure card. */
@property NSString* merchantReference;
/*! @brief This property represents the reference of the secure card previously saved. */
@property NSString* cardReference;
/*! @brief This property represents the mode the card data was entered. */
@property CoreCardEntryMode cardEntryMode;
/*! @brief This property represents the device id. */
@property NSString* deviceId;
/*! @brief This property represents the device is being used */
@property NSString* deviceType;
/*! @brief This property represents the operator name. */
@property NSString* operatorName;
/*! @brief This property represents the card holder email. */
@property NSString* email;
/*! @brief This property represents the card holder mobile number. */
@property NSString* mobileNumber;
/*! @brief This property represents the card holder city. */
@property NSString* city;
/*! @brief This property represents the card holder region. */
@property NSString* region;
/*! @brief This property represents the card holder country. */
@property NSString* country;
/*! @brief This property represents the ip address. */
@property NSString* ipAddress;
/*! @brief This property represents the list of permitted terminals. */
@property NSString* permittedTerminals;
/*! @brief This property represents the list of custom fields. */
@property NSMutableArray* customFields;
/*! @brief This property represents the method used to retrieve the card data. */
@property CoreTokenMethod* tokenMethod;
/*! @brief This property represents serial number of the device */
@property NSString* serial;

@end

/*!
 * @brief This class represents reversal object.
 * <p>
 * Example to create reversal object.
 * </p>
 *
 * \code
 *    CoreReversal *reversal =[[CoreReversal alloc] init];
 *    reversal.deviceType = @"NOMAD";
 *    reversal.uniqueRef = @"FYG0UCFLRA";
 *    [[WTPSTerminal singleton] processReversal:refund];
 * \endcode
 *
 */
@interface CoreReversal : NSObject

/*! @brief This property represents device type. */
@property NSString* deviceType;
/*! @brief This property represents unique reference. */
@property NSString* uniqueRef;
/*! @brief This property represents the reason for the reversal. */
@property NSString* reason;
/*! @brief This property represents the tlvString */
@property NSString* tlvString;
/*! @brief This property represents the orderId */
@property NSString* orderId;
/*! @brief This property represents previous transaction date and time. */
@property NSString* previousTxnDateTime;

@end

@interface CoreReversalEbt : CoreReversal

/*! @brief This property represents device type. */
@property NSString* _operator;
/*! @brief This property represents unique reference. */
@property NSString* deviceId;

@end

/*!
 * @brief This class represents the surcharge object which is retrieved from the server.
 */
@interface CoreSurcharge : NSObject

/*! @brief This property represents amount. */
@property NSNumber* amount;
/*! @brief This property represents percentage. */
@property Currency currency;
/*! @brief This property represents percentage. */
@property NSNumber* percentage;

@end

/*!
 * @brief This class represents the CoreResponse object.
 */
@class CoreTip; // CoreTip will be declared later in this file, this line prevents the "Unknown Class" error
@interface CoreResponse : NSObject
/*! @brief This property represents approval Code. */
@property NSString* approvalCode;
/*! @brief This property represents amount. */
@property NSString* authorizedAmount;
/*! @brief This property represents cvv response code. */
@property NSString* cvvResponseCode;
/*! @brief This property represents currency. */
@property Currency currency;
/*! @brief This property represents unique reference. */
@property NSString* uniqueRef;
/*! @brief This property represents AVS response code. */
@property NSString* avsResponseCode;
/*! @brief This property represents date and time. */
@property NSString* dateTime;
/*! @brief This property represents description code. */
@property NSString* descriptionCode;
/*! @brief This property represents code. */
@property NSString* code;
/*! @brief This property represents card holder name. */
@property NSString* cardHolderName;
/*! @brief This property represents card number. */
@property NSString* cardNumber;
/*! @brief This property represents card type. */
@property NSString* cardType;
/*! @brief This property represents expiry date. */
@property NSString* expiryDate;
/*! @brief This property indicates if a reversal occurred or not. */
@property BOOL didPerformReversal;
/*! @brief This property represents the reference for the secure card. */
@property NSString *secureCardReference;
/*! @brief This property represents the merchant reference for the secure card. */
@property NSString *secureCardMerchantRef;
/*! @brief This property represents the order number. */
@property NSString *orderNumber;
/*! @brief This property represents the bank response code. */
@property NSString *bankResponseCode;
/*! @brief This property represents the sale request type. */
@property SaleRequestType saleRequestType;
/*! @brief This property represents amount of the balance. Used for EBT */
@property NSMutableArray* balances;
/*! @brief This property represents tips. */
@property CoreTip *tip;
/*! @brief This property represents surcharge. */
@property CoreSurcharge *surcharge;

@end

/*!
 * @brief This class represents the sale response object
 */
@interface CoreSaleResponse : CoreResponse
/*! @brief This property represents transaction type. */
@property CoreResponseInputMethod inputMethod;
/*! @brief This property represents aid. */
@property NSMutableArray *emvTagListArray;
/*! @brief Converts object to NSDictionary. */
-(NSMutableDictionary*)getAsJsonObject:(CoreSaleResponse *) response;
/*! @brief This property represents cash back amount. */
@property NSString* cashBackAmount;

@end


@interface CoreAvailableBalance: NSObject

@property NSNumber* balanceAmount;
@property NSString* cardAccount;
@property NSString* currency;

@end

/*!
 * @brief This class represents the secure card response object
 */
@interface CoreSecureCardResponse : CoreResponse
/*! @brief This property represents the description for the secure card operation. */
@property NSString *secureCardDescription;
/*! @brief This property represents the secure card retrieved. */
@property CoreSecureCard *coreSecureCard;
/*! @brief Converts object to NSDictionary. */
-(NSMutableDictionary*)getAsJsonObject:(CoreSecureCardResponse *) response;

@end

/*!
 * @brief This class represents refund response object.
 */
@interface CoreRefundResponse : CoreResponse
/*! @brief Converts object to NSDictionary. */
-(NSMutableDictionary*)getAsJsonObject:(CoreRefundResponse *) response;

@end

/*!
 * @brief This class represents the response object for a close transactions batch request
 */
@interface CoreCloseBatchResponse : NSObject
/*! @brief This property represents batch time. */
@property NSString *batchTime;
/*! @brief This property represents time zone. */
@property NSString *timeZone;
/*! @brief This property represents time time offset. */
@property NSString *timeZoneOffset;
/*! @brief Converts object to NSDictionary. */
-(NSMutableDictionary*)getAsJsonObject:(CoreCloseBatchResponse *) response;

@end

/*!
 * @brief This class parse the URL to easily get the query parameter from the URL. Use this to get the token and valid token date.
 *
 * \code
 *    URLParser *parser = [[URLParser alloc] initWithURLString:url];
 *    if([parser valueForVariable:@"authenticationToken"] != nil){ // check for errors
 *        NSString *token = [parser valueForVariable:@"authenticationToken"];
 * \endcode
 *
 */
@interface URLParser : NSObject {
    NSArray *variables;
}
/*! @brief This property represents variables. */
@property (nonatomic, retain) NSArray *variables;

- (id)initWithURLString:(NSString *)url;
- (NSString *)valueForVariable:(NSString *)varName;

@end

/*!
 * @brief This class is used to hold list of transaction summaries retrieved from the server.
 */
@interface CoreTransactions : NSObject
/*! @brief This property represents transaction summary. */
@property NSMutableArray* transactionSummary;
/*! @brief Converts object to NSDictionary. */
-(NSMutableDictionary*)getAsJsonObject:(CoreTransactions *) response;

@end

/*!
 * @brief This class represents transaction summary object
 */
@interface CoreTransactionSummary : NSObject
/*! @brief This property represents amount. */
@property NSNumber* amount;
/*! @brief This property represents surcharge. */
@property CoreSurcharge* surcharge;
/*! @brief This property represents order id. */
@property NSString* orderId;
/*! @brief This property represents transaction date. */
@property NSString* transactionDate;
/*! @brief This property represents transaction state. */
@property NSString* transactionState;
/*! @brief This property represents transaction status. */
@property NSString* transactionStatus;
/*! @brief This property represents transaction type. */
@property NSString* transactionType;
/*! @brief This property represents unique reference. */
@property NSString* uniqueRef;
/*! @brief This property represents card holder name. */
@property NSString* cardHolderName;
/*! @brief This property represents card number. */
@property NSString* cardNumber;
/*! @brief This property represents card type. */
@property NSString* cardType;
/*! @brief This property represents currency. */
@property Currency currency;
/*! @brief This property represents expiry date. */
@property NSString* expiryDate;
/*! @brief This property represents response code. */
@property NSString* code;
/*! @brief This property represents description . */
@property NSString* descriptionCode;
/*! @brief This property represents approval code. */
@property NSString* approvalCode;
/*! @brief This property represents tip. */
@property NSString* tip;

@end

/*!
 * @brief This class represents transaction summary object
 */
@interface CoreTransactionReportSummary : NSObject
/*! @brief This property represents purchase count. */
@property NSNumber* altPurchaseCount;
/*! @brief This property represents purchase total. */
@property NSNumber* altPurchaseTotal;
/*! @brief This property represents refund count. */
@property NSNumber* altRefundCount;
/*! @brief This property represents refund total. */
@property NSNumber* altRefundTotal;
/*! @brief This property represents card account. */
@property NSString* cardAccount;
/*! @brief This property represents currency. */
@property NSString* currency;
/*! @brief This property represents purchase count. */
@property NSNumber* purchaseCount;
/*! @brief This property represents purchase reversal count. */
@property NSNumber* purchaseReversalCount;
/*! @brief This property represents purchase reversal total */
@property NSNumber* purchaseReversalTotal;
/*! @brief This property represents purchase total. */
@property NSNumber* purchaseTotal;
/*! @brief This property represents refund count. */
@property NSNumber* refundCount;
/*! @brief This property represents refund reversal count. */
@property NSNumber* refundReversalCount;
/*! @brief This property represents refund reversal total. */
@property NSNumber* refundReversalTotal;
/*! @brief This property represents refund total . */
@property NSNumber* refundTotal;
/*! @brief This property represents sub total amount. */
@property NSNumber* subTotalAmount;
/*! @brief This property represents withdrawal count. */
@property NSNumber* withdrawalCount;
/*! @brief This property represents withdrawal total. */
@property NSNumber* withdrawalTotal;

@end

/*!
 * @brief This class represents transaction summary object
 */
@interface CoreTransactionReports : NSObject
/*! @brief This property represents transaction summary. */
@property NSMutableArray* transactionSummary;
/*! @brief This property represents balance inquiry type. */
@property NSNumber* balanceInquiryCount;
/*! @brief This property represents criterion type. */
@property NSString* criterionType;
/*! @brief This property represents criterio value. */
@property NSString* criterionValue;
/*! @brief This property represents settlement date. */
@property NSString* settlementDate;

@end


/*!
 * @brief This class is used to hold the signature request object which is send to a server.
 */
@interface CoreSignature : NSObject

/*!
 * @brief Clears the signature.
 *
 * \code
 *    [_signature clearSignature];
 * \endcode
 *
 */
- (void) clearSignature;

/*!
 * @brief Touch has started. The initial starting location stored in the x,y values.
 * @param x coordinate point
 * @param y coordinate point
 *
 * \code
 *    [_signature startTouch:p.x andY:p.y];
 * \endcode
 *
 */
- (void) startTouch:(float)x andY:(float)y;

/*!
 * @brief Change has happened. The location stored in the x,y values.
 * @param x coordinate point
 * @param y coordinate point
 *
 * \code
 *    [_signature moveTouch:p.x andY:p.y];
 * \endcode
 *
 */
- (void) moveTouch:(float)x andY:(float)y;

/*!
 * @brief Touch has finished. The final release location stored in the x,y values.
 *
 * \code
 *    [_signature upTouch:0 andY:0];
 * \endcode
 *
 */
- (void) upTouch;

/*!
 * @brief Check if the signature is ready to be sent.
 *
 * \code
 *    [_signature isReady];
 * \endcode
 *
 */
- (bool)isReady;

/*!
 * @brief Check if the signature is empty or not.
 *
 * \code
 *    if([_signature checkSignature] == true){
 *        return true;
 *    }else{
 *        return false;
 *    }
 * \endcode
 *
 */
- (bool) checkSignature;

- (void) signatureText;

@property NSString* signature;

@end

/*!
 * @brief This class is used to hold the tax or tip objects used for updating terminal settings.
 */
@interface CoreSetting : NSObject

@end


/*!
 * @brief This class represents the tax object which is retrieved from the server.
 */
@interface CoreTax : CoreSetting
/*! @brief This property represents name. */
@property NSString* name;
/*! @brief This property represents percentage. */
@property NSNumber* percentage;
/*! @brief This property represents unique id. */
@property NSString* uid;

@end


/*!
 * @brief This class represents the tip object which is retrieved from the server.
 */
@interface CoreTip : CoreSetting
/*! @brief This property represents amount. */
@property NSNumber* amount;
/*! @brief This property represents percentage. */
@property NSNumber* percentage;
/*! @brief This property represents tip type. */
@property NSString* tipType;
/*! @brief This property represents unique id. */
@property NSString* uid;
/*! @brief This property tells whether the transaction update is for amount adjustment or not. */
@property BOOL isAmountAdjustment;

@end

/*!
 * @brief This class represents the application object which is retrieved from the terminal settings.
 */
@interface CoreApplication : CoreSetting
/*! @brief This property represents the type of the application. */
@property NSNumber *applicationMatchType;
/*! @brief This property represents the card type. */
@property NSString *card;
/*! @brief This property represents the card identifier. */
@property NSString *identifier;
/*! @brief This property represents the version number. */
@property NSString *version;
@end

/*!
 * @brief This class represents the CaCertificates object which is retrieved from the terminal settings.
 */
@interface CoreCaCertificate : CoreSetting
/*! @brief This property represents the certificate. */
@property NSString *certificate;
/*! @brief This property represents the exponent. */
@property NSString *exponent;
/*! @brief This property represents the provider identifier. */
@property NSString *rid;

@end

/*!
 * @brief This class represents the EmvTag object which is retrieved from the terminal settings.
 */
@interface CoreEmvTag : CoreSetting
/*! @brief This property represents decimal format. */
@property NSNumber *decimal;
/*! @brief This property represents emv description. */
@property NSString *emvDescription;
/*! @brief This property represents hex format. */
@property NSString *hex;
/*! @brief This property represents value of the emv tag. */
@property NSString *value;
@end

/*!
 * @brief This class represents the CoreMerchantDetails object which is retrieved from the server.
 */
@interface CoreMerchantDetails : NSObject
/*! @brief This property represents merchant's name. */
@property NSString* name;
/*! @brief This property represents merchant's city. */
@property NSString* city;
/*! @brief This property represents merchant's address1. */
@property NSString* address1;
/*! @brief This property represents merchant's address2. */
@property NSString* address2;
/*! @brief This property represents merchant's address3. */
@property NSString* address3;
/*! @brief This property represents merchant's country. */
@property NSString* country;
/*! @brief This property represents merchant's phone. */
@property NSString* phone;

- (id) initWithName:name city:city address1:address1 address2:address2 address3:address3 country:country andPhone:phone;

@end

/*!
 * @brief This class holds configuration settings retrieved from the server
 */
@interface CoreSettings : NSObject
/*! @brief This property represents array of tips. */
@property NSMutableArray* tipListArray;
/*! @brief This property represents array of taxes. */
@property NSMutableArray* taxListArray;
/*! @brief This property represents currency. */
@property Currency currency;
/*! @brief This property represents array of features. */
@property NSMutableDictionary* features;
/*! @brief This property represents array of emvTags. */
@property NSMutableArray *emvTagListArray;
/*! @brief This property represents array of applications. */
@property NSMutableArray *applicationListArray;
/*! @brief This property represents array of CaCertificates. */
@property NSMutableArray *caCertificateListArray;
/*! @brief Converts object to NSDictionary. */
-(NSMutableDictionary*)getAsJsonObject:(CoreSettings *) response;
/*! @brief This property represents merchant details. */
@property CoreMerchantDetails *merchantDetails;
/*! @brief This property represents array of revoked CaCertificates. */
@property NSMutableArray *revokedCaCertificateListArray;
/*! @brief This property represents the surchargePercentage. */
@property NSNumber* surchargePercentage;


@end


/*!
 * @brief This class represents the sale request object which is send to a server to be processed. Used with the device.
 *
 * \code
 *    CoreSale *sale =[[CoreSale alloc] init];
 *    sale.amount = [NSNumber numberWithDouble: 12];
 *    [[WTPSTerminal singleton] processSale:sale];
 * \endcode
 *
 */
@interface CoreSale : NSObject
/*! @brief This property represents amount. */
@property NSNumber* amount;
/*! @brief This property represents order id. */
@property NSString* orderId;
/*! @brief This property represents auto ready. */
@property NSNumber* autoReady;
/*! @brief This property represents tax. */
@property CoreTax* tax;
/*! @brief This property represents tip. */
@property CoreTip* tip;
/*! @brief This property represents tip amount. */
@property NSNumber* tipAmount;
/*! @brief This property represents signature. */
@property CoreSignature* signature;
/*! @brief This property represents card type. */
@property NSString* cardType;
/*! @brief This property represents fallback. */
@property NSNumber* fallback;
//*! @brief This property represents card holder name. */
@property NSString* cardHolderName;
/*! @brief This property represents transaction type. */
@property CoreTransactionType transactionType;
/*! @brief This property represents device type. */
@property NSString* deviceType;
/*! @brief This property represents encrypted pin block. */
@property NSString* encryptedPinBlock;
/*! @brief This property represents pin block KSN. */
@property NSString* pinBlockKsn;
/*! @brief This property represents debit account. */
@property NSString* debitAccountType;
/*! Sets the value of the transactionInputMethod property. Start the transaction in different mode.(Swipe, Insert, Tap)  */
@property CoreTransactionInputMethod transactionInputMethod;
/*! @brief This property signature represents AUTOMATIC (onSignatureRequired will be triggered) or MANUAL (signature is captured on the paper receipt) signature capture. */
@property SignatureCollection signatureCollection;
/*! @brief This property represents the secure card. */
@property CoreSecureCard *coreSecureCard;
/*! @brief This property represents the category of the terminal. */
@property TerminalCategory terminalCategory;
/*! @brief This property represents the sale request type. */
@property SaleRequestType saleRequestType;
/*! @brief This property represents if sale is being processed as delayed auth. */
@property BOOL isDelayedAuthEnabled;
/*! @brief This property represents if sale needs to ask for signature in delayed auth mode. */
@property BOOL isSignatureRequired;
/*! @brief This property represents if contctless transaction is MSR. */
@property BOOL isContactlessMsr;
/*! @brief This property represents serial number of the device */
@property NSString* serial;
/*! @brief This property represents reason for fallback. */
@property FallbackReason fallbackReason;
/*! @brief This property represents device firmware version. */
@property NSString* deviceFirmwareVersion;
/*! @brief This property represents emv type (Standard or quickchip). */
@property CoreEmvType emvType;
/*! @brief This property represents date time */
@property NSString* dateTime;
/*! @brief This property represents masked PAN */
@property NSString* maskedPAN;
/*! @brief This property represents custom fields */
@property NSMutableArray* customFields;
/*! @brief This property represents down grade transaction type */
@property DownGradeType downGradeType;
/*! @brief This property represents the option to bypass a surcharge */
@property NSNumber* bypassSurcharge;
/*!
 * @brief This method can be used to create tip object with amount.
 *
 * \code
 *    [sale addTipWithAmount:[NSNumber numberWithInt:2]];
 * \endcode
 *
 */
- (void) addTipWithAmount:(NSNumber*)tipAmount;
/*!
 * @brief This method can be used to create a surcharge object with percentage.
 *
 * \code
 *    [sale addSurchargeWithPercentage:[NSNumber numberWithInt:2]];
 * \endcode
 *
 */
- (void) addSurchargeWithPercentage:(NSNumber*)percentage;
- (NSDictionary*)convertToDictionary;
- (instancetype)initWithDictionary:(NSDictionary*)dictionary;

@end


/*!
 * @brief This class is used to listen for events which are coming back to the integrator.
 * When the integrator makes a request, response is processed here and sent back to him.
 * integrator must implement this delegate to listen for the responses.
 */
@protocol CoreAPIErrorListener <NSObject>
/*!
 * This method is triggered after error has occurred in the SDK.
 * @param error contains typedef enum of an error.
 */
-(void)onError:(CoreError) error withDescription:(NSString*) message;
@end

/*!
 * @brief Listener used for device events
 */
@protocol CoreAPIDeviceListener <CoreAPIErrorListener>
/*!
 * This method is triggered when there is an error coming from the device.
 * @param deviceError contains typedef enum of an error.
 */
-(void)onDeviceError:(CoreDeviceError) deviceError withDescription:(NSString*) message;
/*!
 * Fires when device gets connected.
 * @param type represents connected device
 */
-(void)onDeviceConnected:(DeviceEnum)type withDeviceInfo:(NSDictionary*) deviceInfo;
/*!
 * Fires when device gets disconnected.
 * @param type represents disconnected device
 */
-(void)onDeviceDisconnected:(DeviceEnum)type;
/*!
 * This method is called when the application selection is required.
 * @param applications represents the array of applications to choose from
 */
-(void)onSelectApplication:(NSArray*)applications;
/*!
 * This method is called when the bluetooth device selection is required.
 * @param devices represents the array of devices to choose from
 */
-(void)onSelectBTDevice:(NSArray*)devices;
/*!
 * This method is called when there is a problem connecting to a device.
 */
-(void) onDeviceConnectionError;
/*!
 * Information about the device.
 * @param deviceInfo returned
 */
- (void) onDeviceInfoReturned:(NSDictionary*)deviceInfo;

@end



/*!
 * @brief Listener used for refund events
 */
@protocol CoreAPIRefundListener <CoreAPIErrorListener>
/*!
 * This method is called after refund has been processed in response to processRefund method.
 * @param refund contains CoreRefundResponse object retrieved from the server
 */
-(void)onRefundResponse:(CoreRefundResponse*)refund;
@end


/*!
 * @brief Listener used for reporting events
 */
@protocol CoreAPIReportingListener <CoreAPIErrorListener>
/*!
 * Returns URL which needs to be used to sign in into SelfCare System in response to requestSecuredUrl method.
 * @param url
 */
-(void)onLoginUrlRetrieved:(NSString *)url;
/*!
 * Returns CoreTransactions object which consists of the list with the last 10 transactions in response to getTransactions method.
 * @param transaction contains CoreTransactions object retrieved from the server
 */
-(void)onTransactionListResponse:(CoreTransactions*)transaction;
/**
 * This method is called after requesting host to close current transactions batch.
 *
 * @param response contains response object
 */
- (void) onRequestCloseBatchResponse:(CoreCloseBatchResponse*) response;
/*!
 * This method is called after reversal has been processed.
 * @param reversalResponse contains reversal object retrieved from the server
 */
-(void) onTransactionReportRetrieved:(CoreTransactionReports*)respose;
@end


/*!
 * @brief Listener used for reversal events
 */
@protocol CoreAPIReversalListener <CoreAPIErrorListener>
/*!
 * This method is called after reversal has been processed.
 * @param reversalResponse contains reversal object retrieved from the server
 */
-(void) onReversalRetrieved:(CoreResponse*)reversalResponse;
@end



/*!
 * @brief Listener used for sale events
 */
@protocol CoreAPISaleListener <CoreAPIErrorListener>
/*!
 * Fires when signature is required for the transaction to be processed.
 * @param signature holds the signature.
 */
-(void)onSignatureRequired:(CoreSignature*)signature;
/*!
 * Fires after transaction has been processed successfully in response to processSale method. Contains transaction response object from the server.
 * @param sale contains CoreSaleResponse object retrieved from the server
 */
-(void)onSaleResponse:(CoreSaleResponse*)sale;
/**
 * Fires when delayed auth is enabled and the amount need to be set here before calling confirmAmount.
 *
 * @param coreSale contains coreSale object
 */
- (void) onRequestSetAmount:(CoreSale*)coreSale;
/**
 * Fires after offline transaction has been processed in response to ProcessSale method. Contains a coreSale request.
 *
 * @param saleRequest contains sale object
 */
- (void) onOfflineSaleRequest:(CoreSale*) saleRequest;
/*!
 * Fires after balance inquiry response has been returned from the server. Used for EBT
 * @param response contains CoreResponse object retrieved from the server
 */
- (void)onBalanceInquiryRetrieved:(CoreResponse*)response;

@end


/*!
 * @brief Listener used for secure card events
 */
@protocol CoreAPISecureCardListener <CoreAPIErrorListener>
/*!
 * Fires after the secure card has been registered/edited/deleted successfully.
 * @param secureCardResponse contains CoreSecureCardResponse object retrieved from the server
 */
-(void)onSecureCardResponse:(CoreSecureCardResponse*)secureCardResponse;
@end


/*!
 * @brief Listener used for settings events
 */
@protocol CoreAPISettingsListener <CoreAPIErrorListener>
/*!
 * Sends back terminal settings object in response to init method.
 * @param settings holds the settings
 */
-(void)onSettingsRetrieved:(CoreSettings*)settings;
@end


/*!
 * @brief Listener used for update events
 */
@protocol CoreAPIUpdateListener <CoreAPIErrorListener>
/**
 * This method is called after updating transaction in response to updateTransaction method.
 *
 * @param response contains response object
 */
- (void) onRequestUpdateResponse:(CoreResponse*) response;
@end

/*!
 * @brief Listener used for message events
 */
@protocol CoreAPIMessageListener <CoreAPIErrorListener>
/*!
 * Contains message coming from the SDK while processing the transaction.
 * @param message enum value of a message
 */
-(void)onMessage:(CoreMessage)message;
@end

/*!
 * @brief Listener for logs
 */
@protocol CoreAPILogsListener <NSObject>
/*!
 * @brief Contains log message coming from the SDK.
 * @param message log.
 */
-(void)onLogMessage:(NSString*) message;

@end

/*!
 * @brief This class is used to listen for events which are coming back to the integrator.
 * When the integrator makes a request, response is processed here and sent back to him.
 * integrator must implement this delegate to listen for the responses.
 */
@protocol CoreAPIListener <CoreAPIUpdateListener, CoreAPISettingsListener, CoreAPISecureCardListener,CoreAPISaleListener,CoreAPIReversalListener,CoreAPIReportingListener,CoreAPIRefundListener,CoreAPIErrorListener, CoreAPIDeviceListener, CoreAPIMessageListener,CoreAPIErrorListener, CoreAPILogsListener, CoreAPILogsListener>
@end



/*!
 * @brief CoreSaleKeyed object used for keyed transactions.
 *
 * \code
 *    CoreSaleKeyed *sale = [[CoreSaleKeyed alloc] init];
 *    sale.amount = [NSNumber numberWithDouble: 12];
 *    sale.cardHolderName = @"Name";
 *    sale.cardNumber = @"4111111111111111";
 *    sale.cardCvv = @"123";
 *    sale.expiryDate = @"1218";
 *    [[WTPSTerminal singleton] processSale:sale];
 * \endcode
 *
 */
@interface CoreSaleKeyed : CoreSale
/*! @brief This property represents card number. */
@property NSString* cardNumber;
/*! @brief This property represents card cvv. */
@property NSString* cardCvv;
/*! @brief This property represents expiry date. */
@property NSString* expiryDate;
/*! @brief This property represents address line 1. */
@property NSString* avsAddress1;
/*! @brief This property represents post Code. */
@property NSString* avsPostCode;
/*! @brief This property represents encrypted card number. */
@property NSString* encryptedData;
/*! @brief This property represents ksn. */
@property NSString* ksn;
@end

/*!
 * @brief CoreSaleEmv object used for EMV transactions.
 *
 * \code
 *    CoreSaleEmv *sale =[[CoreSaleEmv alloc] init];
 *    sale.emvTags = ...;
 *    sale.ksn = @"123456789";
 *    sale.cardHolderName = @"Test user";
 *    sale.cardType= @"VISA";
 *    [[WTPSTerminal singleton] processSale:sale];
 * \endcode
 *
 */
@interface CoreSaleEmv : CoreSale
/*! @brief This property represents tip emv tags. */
@property NSMutableDictionary* emvTags;
/*! @brief This property represents tlv string from the device. */
@property NSString* tlvString;
/*! @brief This property represents KSN. */
@property NSString* ksn;
/*! @brief set card type based on AID provided */
- (void)setCardTypeBasedOnAid:(NSString*) aid;
/*! @brief This property represents encrypted C2 tag. */
@property NSString* encryptedC2;
@end

@interface CoreSaleAppleWallet : CoreSale
/*! @brief This property represents apple payload. */
@property NSString* payload;

@end

/*!
 * @brief CoreSaleTrack object used for MSR transactions.
 *
 * \code
 *    CoreSaleTrack *sale =[[CoreSaleTrack alloc] init];
 *    sale.encryptedTrackData = ...;
 *    sale.ksn = @"123456789";
 *    sale.cardHolderName = @"Test user";
 *    sale.cardType= @"VISA";
 *    [[WTPSTerminal singleton] processSale:sale];
 * \endcode
 *
 */
@interface CoreSaleTrack : CoreSale
/*! @brief This property represents KSN. */
@property NSString* ksn;
/*! @brief This property represents encrypted track data. */
@property NSString* encryptedTrackData;
/*! @brief set card type based on bin provided */
- (void)setCardTypeBasedOnBin:(NSString*) maskedPan;
@end


@interface CoreSaleEbt : CoreSale

/*! @brief This property represents KSN. */
@property NSString* ksn;
/*! @brief This property represents encrypted track data. */
@property NSString* encryptedTrackData;
/*! @brief This property represents card number. */
@property NSString* cardNumber;
/*! @brief This property represents expiry date. */
@property NSString* expiryDate;
/*! @brief This property represents device ID */
@property NSString* deviceId;
/*! @brief This property represents operator */
@property NSString* operatorName;
/*! @brief This property represents card account */
@property CardAccount cardAccount;
/*! @brief This property represents cashBackAmount. */
@property NSNumber* cashBackAmount;
/*! @brief This property represents voucher used for EBT. */
@property CoreVoucher* voucher;
/*! @brief This property represents encrypted PAN. */
@property NSString* encryptedPAN;

@end

@interface CoreBalanceInquiryEbt : CoreSaleEbt

@end

/*!
 * @brief CoreSaleTrackContactless object used for Contactless MSR transactions.
 *
 * \code
 *    CoreSaleTrackContactless *sale =[[CoreSaleTrackContactless alloc] init];
 *    sale.encryptedTrackData = ...;
 *    sale.ksn = @"123456789";
 *    sale.cardHolderName = @"Test user";
 *    sale.cardType= @"VISA";
 *    sale.additionalTags = @"9F09020096";
 *    [[WTPSTerminal singleton] processSale:sale];
 * \endcode
 *
 */
@interface CoreSaleTrackContactless : CoreSaleTrack
/*! @brief This property represents additional tags needed for this transaction. */
@property NSString* additionalTags;
@end

/*!
 * @brief This class is used to hold the CoreTerminalUpdate object.
 *
 * \code
 *    CoreTerminalUpdate *terminalUpdate = [[CoreTerminalUpdate alloc] init];
 *    CoreTax* tax = [[CoreTax alloc] init];
 *    tax.percentage = [NSNumber numberWithDouble: 12.4];
 *    tax.name = @"Test IOS CREATE TEST";
 *    [terminalUpdate.settingsCreate tax];
 *    [[WTPSTerminal singleton] updateSettings:terminalUpdate];
 * \endcode
 *
 */
@interface CoreTerminalUpdate : NSObject
/*! @brief This property represents settings create. */
@property NSMutableArray* settingsCreate;
/*! @brief This property represents settings update. */
@property NSMutableArray* settingsUpdate;
/*! @brief This property represents settings delete. */
@property NSMutableArray* settingsDelete;

@end


/*!
 * @brief This class represents core update object.
 *
 * \code
 *    CoreUpdate* update = [[CoreUpdate alloc] init];
 *    update.email = @"test@gmail.com";
 *    update.mobile = @"948348348";
 *    update.uniqueRef = @"DSSAAGG";
 *    [[WTPSTerminal singleton] updateTransaction:update];
 * \endcode
 *
 */
@interface CoreUpdate : NSObject
/*! @brief This property represents mobile number. */
@property NSString* mobile;
/*! @brief This property represents email. */
@property NSString* email;
/*! @brief This property represents unique reference. */
@property NSString* uniqueRef;
/*! @brief This property represents the tip adjustment for the update. */
@property CoreTip* tipAdjustment;
/*! @brief This property represents signature. */
@property CoreSignature* signature;

@end

/*!
 * @brief This class represents CoreTerminal object which is used to hold terminal settings (terminal ID, secret).
 *
 */
@interface CoreTerminal : NSObject
/*! @brief This property represents terminal ID. */
@property NSString *terminalId;
/*! @brief This property represents secret. */
@property NSString *secret;
/*! @brief This property represents currency. */
@property Currency currency;
/*! @brief This property represents terminal type. */
@property NSString *terminalType;
/*! @brief This property represents token. */
@property NSString *token;
/*! @brief This property represents url. */
@property NSString *url;
/*! @brief This property represents flag for token requirement for refunds. */
@property NSNumber *requiresTokenForRefunds;
/*! @brief This property represents flag for token requirement for reporting. */
@property NSNumber *requiresTokenForReporting;
/*! @brief This property represents flag for token requirement for updating terminal settings. */
@property NSNumber *requiresTokenForTerminalUpdate;
/*! @brief This property represents the isv token. */
@property NSString *isvToken;
/*! @brief This property represents the device type. */
@property NSString *deviceType;
/*! @brief This property represents offline mode. */
@property BOOL offlineSdkMode;
/*! @brief Allow processing in offline in case communication with the server fails. */
@property BOOL processOfflineWhenCommsDown;
/*! @brief This property represents SDK mode. */
@property (nonatomic, getter = getMode, setter = setMode:) CoreMode mode;
- (id) initWithTerminalId: (NSString *)terminalId secret:(NSString *)secret terminalType:(NSString *)terminalType;
- (id) initWithTerminalId: (NSString *)terminalId secret:(NSString *)secret currency:(Currency)currency terminalType:(NSString *)terminalType;
- (id) initWithTerminalId: (NSString *)terminalId secret:(NSString *)secret currency:(Currency)currency terminalType:(NSString *)terminalType token:(NSString *)token;
- (NSString *) getTerminalURL;
- (NSString *) getAuthorizationURL;
- (NSString *)getPayconexSaleUrl;
- (NSString *)getPayconexReportingUrl;
- (NSString *)getPayconexTransactionStatusUrl;

@end

typedef void (^PluginCompletionBlock)(BOOL success);


/*!
 * @brief Used internally by plugins
 */
@protocol PluginListener <NSObject>

- (void) onRequestCard:(CoreSale *)coreSale;
- (void) onRequestSecureCard:(CoreSecureCard *)coreSecureCard;
- (void) onSignatureCompleted:(CoreSignature *)signature;
- (void) onSelectApplicationCompleted:(NSInteger)application;
- (void) onSaleRetrieved:(CoreSaleResponse *)response;
- (void) onSelectBluetoothCompleted:(NSInteger)device;
- (void) onReversalCompleted:(CoreResponse*)reversal;
- (void) onRequestUnreferencedRefund:(CoreUnreferencedRefund*)unreferencedRefund;
- (void) onErrorPerm;
- (void) cancelTransaction;
- (void) stop:(PluginCompletionBlock) completion;
- (void) deviceInfo;
- (void) transactionWentOffline;

@end

/*!
 * @brief Used internally
 */
@protocol CoreTerminalConnector <NSObject>

- (id <PluginListener>)getPluginCallBack;
- (CoreMode)getMode;
- (DeviceEnum)getDevice;
- (void) setPluginCallBack:(id <PluginListener>)pluginCallBack;
- (void) setSettings:(CoreSettings *)settings;
- (void) sendSignatureRequired:(CoreSale *)coreSale;
- (void) sendSelectApplicationRequired:(NSArray *)applications;
- (void) sendSelectBluetoothRequired:(NSArray *)pairedDevices;
- (void) sendUpdateRequest:(NSMutableDictionary *)data;
- (void) sendSaleOnline:(CoreSale *)coreSale;
- (void) onCompleteReadSecureCard:(CoreSecureCard *)coreSecureCard;
- (void) sendUnreferencedRefundByPlugin:(CoreUnreferencedRefund *)unreferencedRefund;
- (void) sendUserMessages:(CoreMessage)message;
- (void) sendDeviceConnected:(NSMutableDictionary *)data;
- (void) sendDeviceDisconnected:(DeviceEnum)device;
- (void) sendDeviceNotSupportedError:(NSMutableDictionary *)data;
- (void) sendDeviceError:(CoreDeviceError)error;
- (void) sendTransactionFinished:(CoreSaleResponse*)transaction;
- (void) sendTransactionReversal:(CoreReversal*)reversal;
- (void) sendConnectionError;
- (void) sendDeviceInfo:(NSDictionary*)deviceInfo;
- (void) sendOnRequestAmount:(CoreSale*)coreSale;
- (NSMutableArray *)getApplications;
- (NSMutableArray *)getCertificates;
- (NSMutableArray *)getEmvTags;
- (CoreSettings *)getSettings;
- (Currency) getCurrency;
- (void)log:(NSString *)message withMessageLogLevel:(LogLevel)messageLogLevel;
- (void)cancelTransaction;

@end

/*!
 * @brief This class represents the custom tips, both amount and percentages which can be set. These
 * custom tips will override tips set on the server.
 */
@interface CoreCustomTips : NSObject

@property NSMutableArray *percentages;
@property NSMutableArray *amounts;

@end

/*!
 * @brief Used internally by plugins
 */
@protocol Plugin <PluginListener>

@property DeviceEnum type;
@property NSString* bluetoothDeviceName;
@property DeviceConnectionType connectionType;
@property BOOL enableTips;
@property BOOL enableSurcharges;
@property CoreCustomTips* customTips;
@property NSNumber* tipPreDefinedAmount;
- (void) init:(id <CoreTerminalConnector>) configuration;
- (void) requestPrint:(NSMutableDictionary*) data;
- (BOOL)enableDelayedAuth:(NSNumber*)initialAmount enable:(BOOL)enable;
- (BOOL)isDelayedAuthEnabled;
- (NSNumber*) getDelayedAuthInitialAmount;
- (void) submitAmount:(CoreSale*)coreSale;
- (NSMutableArray*)listSupportedInputMethods;
- (void) terminalWasSetToOffline;

@end

/*!
 * @brief This class represents public terminal which allows the integrator to perform actions.
 *
 * \code
 *  [terminal init:self];
 *    [[WTPSTerminal singleton] initWithConfiguration:@"1007" withSecret:@"secretpass" withCurrency:EUR];
 * \endcode
 *
 */
@interface WTPSTerminal <CoreTerminalConnector> : CoreTerminal

+ (id)singleton;

/*!
 * @brief Constructor to Initialize listener
 * @param listener activity listener handles the callbacks
 * <p>
 * Example:
 * </p>
 *
 * \code
 * [[WTPSTerminal singleton] init:self];
 * \endcode
 *
 */
-(void)init:(id) listener;

/*!
 * @brief Constructor to Initialize Terminal
 * <p>
 * Example:
 * </p>
 *
 * \code
 * [[WTPSTerminal singleton] initialize];
 * \endcode
 *
 */
-(void) initialize;

/*!
 * @brief Initialize listener and store configuration in memory.  Use this method only when terimnal ID and secret are stored in payconfig file
 */
-(void)initWithConfiguration;

/*!
 * @brief Initialize listener and store configuration in memory.
 *
 * @param terminalId holds terminal ID.
 * @param secret     holds the secret name.
 */
-(void)initWithConfiguration:(NSString*) terminalId withSecret: (NSString*) secret;

/*!
 * @brief Initialize listener and store configuration in memory.
 *
 * @param terminalId holds terminal ID.
 * @param secret     holds the secret name.
 * @param configuration - payconfig configuration with custom urls.
 */
-(void)initWithConfiguration:(NSString*) terminalId withSecret: (NSString*) secret withPayconfigConfiguration: (NSMutableDictionary *) configuration;

/*!
 * @brief Used only when the terminal is offline.
 *
 * @param terminalId holds terminal ID.
 * @param secret     holds the secret name.
 * @param settings settings .
 */
-(BOOL)initWithConfiguration:(NSString*) terminalId withSecret: (NSString*) secret withSettings:(CoreSettings*)settings;

/*!
 * @brief Process the sale object.
 * @param request represents CoreSale object to be processed.
 * <p>
 * Example:
 * </p>
 *
 * \code
 *  CoreSale *sale =[[CoreSale alloc] init];
 *  sale.amount = [NSNumber numberWithDouble: [self.amountField.text doubleValue]];
 *  sale.cardCvv = @"111";
 *  sale.cardHolderName = @"Test user";
 *  sale.cardNumber = @"4111111111111111";
 *  sale.cardType= @"VISA";
 *  sale.expiryDate = @"1215";
 *  [[WTPSTerminal singleton] processSale:sale];
 * \endcode
 *
 *
 */
-(void)processSale:(CoreSale *)request;

/*!
 * @brief Process the referenced refund object.
 * @param request represents CoreRefund object to be processed.
 * <p>
 * Example:
 * </p>
 *
 * \code
 *  CoreRefund *refund =[[CoreRefund alloc] init];
 *  refund.amount = [NSNumber numberWithDouble: [self.amountField.text doubleValue]];
 *  refund.uniqueRef = @"FYG0UCFLRA";
 *  refund.reason = @"reason";
 *  [[WTPSTerminal singleton] processRefund:refund];
 * \endcode
 *
 *
 */
-(void)processRefund:(CoreRefund *)request;

/*!
 * @brief Process the unreferenced refund object.
 * @param request represents CoreUnreferencedRefund object to be processed.
 * <p>
 * Example:
 * </p>
 *
 * \code
 *  CoreUnreferencedRefund *refund =[[CoreUnreferencedRefund alloc] init];
 *  refund.amount = [NSNumber numberWithDouble: [self.amountField.text doubleValue]];
 *  refund.cardCvv = @"111";
 *  refund.cardHolderName = @"Test user";
 *  refund.cardNumber = @"4111111111111111";
 *  refund.cardType= @"VISA";
 *  refund.expiryDate = @"1215";
 *  refund.reason=@"reason";
 *  [[WTPSTerminal singleton] processUnreferencedRefund:refund];
 * \endcode
 *
 *
 */
-(void)processUnreferencedRefund:(CoreUnreferencedRefund *)request;

/*!
 * @brief Update tip and tax settings.
 * @param terminal represents CoreTerminalUpdate object to be updated.
 * <p>
 * Example:
 * </p>
 *
 * \code
 *  CoreTerminalUpdate *terminalUpdate = [[CoreTerminalUpdate alloc] init];
 *  CoreTaxOrTip* taxOrTip = [[CoreTaxOrTip alloc] init];
 *  CoreTax* tax = [[CoreTax alloc] init];
 *  tax.percentage = [NSNumber numberWithDouble: 12.4];
 *  tax.name = @"Test IOS CREATE TEST";
 *  taxOrTip.tax= tax;
 *  [terminalUpdate.settingsCreate addObject:taxOrTip];
 *  [[WTPSTerminal singleton] updateTipAndTax:terminalUpdate];
 * \endcode
 *
 *
 */
-(void)updateSettings:(CoreTerminalUpdate*) terminal;

/*!
 * @brief Get back the Secured URL which is used to get the token after signing in.
 * @param schema represents application scheme to be started after successful authentication, schema will need to be defined in info.plist
 * <p>
 * Example:
 *
 * \code
 *  [[WTPSTerminal singleton] requestSecuredUrl:@"corepayment://com.payments.core"];
 * \endcode
 *
 *
 */
-(void)requestSecuredUrl:(NSString *)schema;

/*!
 * @brief Get the transactions from the server. Requires token.
 * <p>
 * Example:
 * </p>
 *
 * \code
 *  [[WTPSTerminal singleton] getTransactions];
 * \endcode
 *
 */
-(void)getTransactions;

/*!
 * @brief Get the transactions from the server using filter. Requires token.
 * <p>
 * Example:
 * </p>
 *
 * \code
 *    CoreTransactionFilter filter = [[CoreTransactionFilter alloc] init];
 *    filter.resultsPerPage = [NSNumber numberWithInteger: 25];
 *    filter.state = TransactionState.OPEN;
 *    filter.startDate = @"30-12-2015:13:45:30:123"; (pattern: dd-MM-yyyy:HH:mm:ss:SSS
 *    filter.endDate = @"30-04-2016:13:45:30:123"; (pattern: dd-MM-yyyy:HH:mm:ss:SSS
 *  [[WTPSTerminal singleton] getTransactions:1 usingFilter:filter];
 * \endcode
 *
 */

-(void)getTransactions:(NSNumber *)page usingFilter:(CoreTransactionFilter *)filter;

/*!
 * @brief Retrieve configuration settings from the server.
 * \code
*  [[WTPSTerminal singleton] retrieveSettings];
 * \endcode
 */
-(void)retrieveSettings;

/*!
 * @brief Update the transaction, send receipt to a user by an email or number.
 * @param update represents coreUpdate object
 * <p>
 * Example to create an update object.
 * </p>
 *
 * \code
 *  CoreUpdate* update = [[CoreUpdate alloc] init];
 *  update.email = @"test@gmail.com";
 *  update.mobile = @"948348348";
 *  update.uniqueRef = @"DSSAAGG";
 *  [[WTPSTerminal singleton] updateTransaction:update];
 * \endcode
 *
 *
 */
-(void)updateTransaction:(CoreUpdate*) update;

/*!
 * @brief Update amount of authorized transactions before being settled
 * @param uniqueRef represents the unique reference of the transaction to be updated
 * @param additionalAmount represents the amount to be added to the authorized amount
 * <p>
 * Example:
 * </p>
 *
 * \code
 *  [[WTPSTerminal singleton] adjustAmount:uniqueRef withAdditionalAmount:additionalAmount];
 * \endcode
 *
 *
 */
-(void)adjustAmount:(NSString*) uniqueRef withAdditionalAmount: (NSNumber *) additionalAmount;

/*!
 * @brief Used to send the user signature.
 * @param signature represents coreSignature object
 */
-(void)submitSignature:(CoreSignature *) signature;


/*!
 * @brief Used to send the user signature.
 * <p>
 * Example to create reversal object.
 * </p>
 *
 * \code
 *    CoreReversal *reversal =[[CoreReversal alloc] init];
 *    reversal.deviceType = @"NOMAD";
 *    reversal.uniqueRef = @"FYG0UCFLRA";
 *    [[WTPSTerminal singleton] processReversal:refund];
 * \endcode
 *
 */
-(void)processReversal:(CoreReversal*) reversal;

/*!
 * @brief Release terminal resources
 */
-(void)releaseResources;;

/*!
 * @brief Initalise device with bluetooth address.
 * @param device to be initialised
 * @param address - bluetooth address
 * <p>
 * Example:
 * </p>
 *
 * \code
 *    [[WTPSTerminal singleton] initDevice:NOMAD withConnectionType:BLUETOOTH withBluetoothAddress:@"abcdefgh"];
 * \endcode
 *
 */
-(void)initDevice:(DeviceEnum)device withConnectionType:(DeviceConnectionType)connectionType withBluetoothAddress:(NSString*) address;

/*!
 * @brief Initalise device with bluetooth address.
 * @param device to be initialised
 * @param address - bluetooth address
 * @param deviceData - device related data
 * <p>
 * Example:
 * </p>
 *
 * \code
 *    [[WTPSTerminal singleton] initDevice:NOMAD withConnectionType:BLUETOOTH withBluetoothAddress:@"abcdefgh" withDeviceData: deviceDictionaryData];
 * \endcode
 *
 */
-(void)initDevice:(DeviceEnum)device withConnectionType:(DeviceConnectionType)connectionType withBluetoothAddress:(NSString*) address withDeviceData:(NSDictionary*) deviceData;


/*!
 * @brief Initalise device with bluetooth address.
 * @param device to be initialised
 * @param address - bluetooth address
 * @param deviceData - device related data
 * <p>
 * Example:
 * </p>
 *
 * \code
 *    [[WTPSTerminal singleton] initDevice:BBPOSDEVICE withConnectionType:BLUETOOTH withDeviceData: deviceDictionaryData];
 * \endcode
 *
 */
-(void)initDevice:(DeviceEnum)device withConnectionType:(DeviceConnectionType)connectionType withDeviceData:(NSDictionary*) deviceData;

/*!
 * @brief Returns currently initalised device.
 */
-(DeviceEnum)getDevice;

/*!
 * @brief Submits application. This must be called after on onSelectApplication has been fired.
 * @app to be selected
 * <p>
 * Example:
 * </p>
 *
 * \code
 *    [[WTPSTerminal singleton] submitApplication:0];
 * \endcode
 *
 */
- (void)submitApplication:(int)app;

/*!
* @brief Process the balance inquiry request. Used for EBT.
*/
-(void)processBalanceInquiry:(CoreBalanceInquiryEbt *)request;

/*!
 * @brief Select bluetooth address of the device to be initaliesed. This must be called after on onSelectBTDevice has been fired.
 * @device to be selected
 * <p>
 * Example:
 * </p>
 *
 * \code
 *    [[WTPSTerminal singleton] selectBTDevice:0];
 * \endcode
 *
 */
- (void)selectBTDevice:(int)device;

/*!
 * @brief Retrieve a secure card from the system.
 * @merchantReference of the previously registered secure card
 * <p>
 * Example:
 * </p>
 *
 * \code
 *    [[WTPSTerminal singleton] retrieveSecureCard:@"MR01"];
 * \endcode
 *
 */
- (void)retrieveSecureCard:(NSString *)merchantReference;

/*!
 * @brief Register a new secure card into the system.
 * @coreSecureCard to be registered
 * <p>
 * Example:
 * </p>
 *
 * \code
 *  CoreSecureCard secureCard = [[CoreSecureCard alloc] init];
 *  secureCard.merchantReference = @"MR01";
 *    [[WTPSTerminal singleton] registerSecureCard:secureCard];
 * \endcode
 *
 */
- (void)registerSecureCard:(CoreSecureCard *)coreSecureCard;

/*!
 * @brief Edit a previous registered secure card into the system.
 * @coreSecureCard to be edited
 * <p>
 * Example:
 * </p>
 *
 * \code
 *  CoreSecureCard secureCard = [[CoreSecureCard alloc] init];
 *  secureCard.merchantReference = @"MR01";
 *  secureCard.secureCardReferenceNumber = @"1234t56789";
 *    [[WTPSTerminal singleton] editSecureCard:secureCard];
 * \endcode
 *
 */
- (void)editSecureCard:(CoreSecureCard *)coreSecureCard;

/*!
 * @brief Delete a previous registered secure card into the system.
 * @coreSecureCard to be deleted
 * <p>
 * Example:
 * </p>
 *
 * \code
 *  CoreSecureCard secureCard = [[CoreSecureCard alloc] init];
 *  secureCard.merchantReference = @"MR01";
 *  secureCard.secureCardReferenceNumber = @"1234t56789";
 *    [[WTPSTerminal singleton] deleteSecureCard:secureCard];
 * \endcode
 *
 */
- (void)deleteSecureCard:(CoreSecureCard *)coreSecureCard;

/*!
 * @brief request host to close the current transactions batch.
 * <p>
 * Example:
 * </p>
 *
 * \code
 *    [[WTPSTerminal singleton] closeTransactionsBatch];
 * \endcode
 *
 */
- (void)closeTransactionsBatch;
    
/*!
 * @brief Returns SDK version.
 */
- (NSString*)getSdkVersion;

/*!
 * @brief Cancel currently running transaction.
 */
- (void)cancelTransaction;

/*!
 * @brief Used to set Terminal to Demo mode.
 */
- (void)setDebug:(bool)debug;

/*!
 * @brief Set Live, Demo or SelfTest mode.
 */
- (void)setMode:(CoreMode)mode;

#if TARGET_OS_IPHONE
- (void)printReceipt:(NSString*)receipt withLogo:(UIImage*) logo;
#endif
/*!
 * @brief Returns SDK mode.
 */
- (CoreMode) getMode;

/*!
 * @brief Returns information about the connected device.
 */
- (void)getDeviceInfo;

- (void)disconnectDevice;

/*!
 * @brief Returns if device is connected.
 */
- (bool) isConnectedDevice;

/*!
 * @brief List the devices which are supported by the SDK.
 */
- (NSDictionary*)listSupportedDevices;

/*! @brief This property represents device. */
@property DeviceEnum device;

/*! @brief This property represents SDK mode. */
//@property (nonatomic, getter = getMode, setter = setMode:) CoreMode mode;

@property CoreSettings *settings;

/*! @brief List input methods supported by device. */
- (NSMutableArray*)listSupportedInputMethods;

/*! @brief Disable delayed auth. */
-(void)disableDelayedAuth;

/*! @brief Enable delayed auth with initial amount*/
-(void)enableDelayedAuth:(NSNumber*)initialAmount;

/*! @brief Gets delayed auth initial amount*/
-(NSNumber*) getDelayedAuthInitialAmount;

/*! @brief Returns if delayed auth is enabled*/
-(BOOL) isDelayedAuthEnabled;

-(void)getTransactionReports:(NSString *)settlementDate withType:(NSString *)criterionType withValue:(NSString *)criterionValue;

/*! @brief Submit amount is the last call for delayed auth transactions*/
- (void) submitAmount:(CoreSale*)coreSale;

- (BOOL) setOfflineMode:(BOOL)offline;
- (BOOL) setConnectionTimeout:(int) connectTimeout;
- (void) setLogLevel:(LogLevel)logLevel;
- (void) registerLogListener:(id<CoreAPILogsListener>)logsListener;

- (void) registerCoreAPIDeviceListener:(id<CoreAPIDeviceListener>) listener;
- (void) unRegisterCoreAPIDeviceListener:(id<CoreAPIDeviceListener>) listener;
- (void) registerCoreAPIReportingListener:(id<CoreAPIReportingListener>) listener;
- (void) unRegisterCoreAPIReportingListener:(id<CoreAPIReportingListener>) listener;
- (void) registerCoreAPISaleListener:(id<CoreAPISaleListener>) listener;
- (void) unRegisterCoreAPISaleListener:(id<CoreAPISaleListener>) listener;
- (void) registerCoreAPISecureCardListener:(id<CoreAPISecureCardListener>) listener;
- (void) unRegisterCoreAPISecureCardListener:(id<CoreAPISecureCardListener>) listener;
- (void) registerCoreAPISettingsListener:(id<CoreAPISettingsListener>) listener;
- (void) unRegisterCoreAPISettingsListener:(id<CoreAPISettingsListener>) listener;
- (void) registerCoreAPIRefundListener:(id<CoreAPIRefundListener>) listener;
- (void) unRegisterCoreAPIRefundListener:(id<CoreAPIRefundListener>) listener;
- (void) registerCoreAPIReversalListener:(id<CoreAPIReversalListener>) listener;
- (void) unRegisterCoreAPIReversalListener:(id<CoreAPIReversalListener>) listener;
- (void) registerCoreAPIUpdateListener:(id<CoreAPIUpdateListener>) listener;
- (void) unRegisterCoreAPIUpdateListener:(id<CoreAPIUpdateListener>) listener;
- (void) registerCoreAPIMessageListener:(id<CoreAPIMessageListener>) listener;
- (void) unRegisterCoreAPIMessageListener:(id<CoreAPIMessageListener>) listener;
- (void) unRegisterCoreAPIListener:(id<CoreAPIListener>) listener;

@end

@interface HeaderParameters : NSObject

@property NSString *token;
@property NSString *isvToken;
@property NSString *deviceName;
@property NSString *deviceFirmware;

@end

@interface RestConnectorBase : NSObject

+ (BOOL) validateTerminal:(CoreTerminal *)terminal ignoreCurrency:(BOOL)ignoreCurrency withError:(NSError**)error;
+ (BOOL) validateTerminal:(CoreTerminal *)terminal withError:(NSError**)error;

@end

/*!
 * @brief This class is used to connect to the server.
 *
 */
@interface RestConnector : RestConnectorBase

+ (CoreSaleResponse *) sendSaleAsDictionary:(NSDictionary *)saleDictionary withTerminal:(CoreTerminal *)coreTerminal error:(NSError **)error;
+ (CoreSaleResponse *) sendSale:(CoreSale *)coreSale withTerminal:(CoreTerminal *)coreTerminal error:(NSError **)error;
+ (CoreRefundResponse *) requestUnreferencedRefund:(CoreUnreferencedRefund *)coreUnreferencedRefund withTerminal:(CoreTerminal *)coreTerminal error:(NSError **)error;
+ (CoreRefundResponse *) requestReferencedRefund:(CoreRefund *)coreRefund withTerminal:(CoreTerminal *)coreTerminal error:(NSError **)error;
+ (CoreSecureCardResponse *) requestSecureCard:(CoreSecureCard *)coreSecureCard withTerminal:(CoreTerminal *)coreTerminal operation:(NSString *)operation error:(NSError **)error;
+ (CoreResponse *) requestReversal:(CoreReversal *)reversalRequest withTerminal:(CoreTerminal *)coreTerminal error:(NSError **)error;
+ (NSString *) login:(NSString *)schema withTerminal:(CoreTerminal *)coreTerminal error:(NSError **)error;
+ (CoreSettings *) requestSettings:(CoreTerminal *)coreTerminal error:(NSError **)error;
+ (CoreTransactions *) requestTransactionList:(CoreTransactionFilter *)filter page:(NSInteger)page withTerminal:(CoreTerminal *)coreTerminal error:(NSError **)error;
+ (BOOL) updateTerminal:(CoreTerminalUpdate *)coreTerminalUpdate withTerminal:(CoreTerminal *)coreTerminal error:(NSError **)error;
+ (CoreResponse*) updateTransaction:(CoreUpdate *)coreUpdate withTerminal:(CoreTerminal *)coreTerminal andData:(NSMutableDictionary *)data error:(NSError **)error;
+ (CoreCloseBatchResponse*) closeTransactionBatch:(CoreTerminal *)coreTerminal error:(NSError **)error;
+ (BOOL)healthCheck:(CoreTerminal*)coreTerminal withTimeout:(int) timeout completion:(void (^)(BOOL success))completionBlock;
+ (BOOL) isPayconexSDK;
+ (CoreResponse *) requestBalanceInquiry:(CoreBalanceInquiryEbt *)balanceInquiryEbt withTerminal:(CoreTerminal *)coreTerminal error:(NSError **)error;
+ (CoreTransactionReports*)getTransactionReports:(CoreTerminal*)coreTerminal withSettlementDate:(NSString *)settlementDate withType:(NSString *)criterionType withValue:(NSString *)criterionValue error:(NSError **)error;

@end

@interface Validator : NSObject

@property NSString* missingField;
@property BOOL isError;
@property CoreError errorType;

@end

/*!
 * @brief This class represents the TLV result that will be send for the device
 */
@interface TlvResult : NSObject
/*! @brief This property represents tlv string. */
@property NSString* tlv;
/*! @brief This property represents if this result is single tap retry. */
@property BOOL singleTapRetry;

@end

/*!
 * @brief This class contains util methods.
 *
 */
@interface CoreUtil : NSObject

@property NSMutableArray* customBinRanges;

+ (id)singleton;
- (CoreSaleTrack *)retrieveTrackFromCoreSale:(CoreSale *)coreSale;
- (CoreSaleEmv *)retrieveEmvFromCoreSale:(CoreSale *)coreSale;
- (CoreSaleKeyed *)retrieveKeyedFromCoreSale:(CoreSale *)coreSale;
- (NSString*) cardTypeBasedOnBin:(NSString*) maskedPan;
- (bool)isInternetAvailable;
- (NSString*) cardTypeBasedOnAid:(NSString*) aid;
- (NSDictionary*)parseTLV:(NSString*)tlv;
- (NSNumber*) roundDouble: (double) number withCurrency: (Currency) currency;
- (NSNumber*) calcTax:(NSNumber*)percent withAmount: (NSNumber*) amount withCurrency:(Currency) currency;
- (NSNumber*) calcTip:(NSNumber*) tipNumber withTip: (NSNumber*) originalAmount withTipType: (NSString*) tipType andCurrency:(Currency) currency;
- (NSString*) addUpAllAmounts:(CoreSale*) coreSale withCurrency:(Currency) currency;
- (TlvResult *)convertToTLV:(CoreSaleResponse *)coreSaleResponse withTap:(bool) tapCard replacementDict:(NSDictionary *) replacements;
- (NSMutableString *)hexFromInt:(NSInteger)val;
- (NSMutableString *) getTlv:(NSMutableString *)aidsString withAID:(NSString *) aid andVersion: (NSString *) version;
- (NSString *)hexStringToAscii:(NSString *)hexString;
- (NSString *)asciiToHexString:(NSString *)asciiString;
- (NSString *)getVersionBasedOnBrand:(NSString *)cardType;
- (NSData *) hexStringToBytes:(NSString *)hexString;
- (NSMutableArray*) retrieveBinRangesFromResourceFile;
- (Validator*) validateFields:(CoreSale*) sale;
- (NSString*) maskCardNumber:(NSString*)cardNumber mask:(NSString*)mask;
- (NSString*) parseDate:(NSString*) date;
- (NSString*) generateSha256:(NSString*)hashString;
- (NSString*)getFormattedDateTime;

@end

@protocol TerminalHealthListener <NSObject>

-(void)onHealthCheckStarted;
-(void)onHealthCheckStopped;
-(void)onError:(CoreError)error;

@end

@interface TerminalHealth : NSObject

+ (BOOL) terminalOfflineModeManuallyChanged:(WTPSTerminal*) terminal withOffline:(BOOL)offline;
+ (BOOL) configureTerminalHealthChecker:(int)timeout withInterval:(int) interval;
+ (void) startTerminalHealthCheck:(WTPSTerminal*)terminal withListener:(id<TerminalHealthListener>)terminalListener;
+ (void) stopTerminalHealthCheck:(WTPSTerminal*)terminal withListener:(id<TerminalHealthListener>)terminalListener;
+ (BOOL) isTerminalBeingChecked:(WTPSTerminal*)terminal;

@end

@interface TerminalHealthChecker : NSObject

@property BOOL isChecking;
-(id)init:(WTPSTerminal*) currentTerminal;
-(void) startTerminalHealthCheck:(int)timeout withInterval:(int) interval withAttempts:(int) attempts;
-(void) stopTerminalHealthCheck;

@end
