Use in an app

The library initialization method must be called in the main thread.

import LBFraudSDKiOS

// Replace apikey with the desired generated api key.
// By default our SDK target to the production environment.
// In case you desire to target a diferent enviroment:
// let ironchipLBFraud = LBFraudSDKiOS.init(apikey: "XXXXXX.XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", environment: Environment.Testing)

//public enum Environment: String {
//    case Production
//    case Testing
//    case Development

//Call Ironchip Location Based Antifraud to Analyze transaction

let data: [String: Any] = [
    "concept": "Book august",
    "amount": 60,
    "operation": "booking"

//TransactionID (required,unique): transaction identifier request for fraud results
//UserID (required): User identifier
//ExtraData (optional): extra information for analysis

// The sendTransaction can be provided with 2 callbacks, one is executed when the transaction is finished
// and the other one is called in case an error did occure during the transaction process.

ironchipLBFraud.sendTransaction(transactionId: "random_identifier_generated", userId: "", extraData: extraData, finish: {
    // Add here any code you want to be executed after the transaction has finished.
    }, onError: { err in

    // Add here any code you want to perform in case of an error
    // during the transaction.

    // example:
        //if(err is TransactionError) {

            // let transactionError = err as! TransactionError

            // print(transactionError.traceability_id)
            // print(transactionError.message)
            // print(transactionError.http_code)
            // print(transactionError.code)
        //} else {
            // print("NetworkError: ", err)