diff --git a/TestApp.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved b/TestApp.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved index 923ed8f..4497c31 100644 --- a/TestApp.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved +++ b/TestApp.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved @@ -1,4 +1,5 @@ { + "originHash" : "c9dfe6e688e58963468db0990bbe60b63e80a2c1f83770e1e863675f5f3d8daa", "pins" : [ { "identity" : "core-sdk-ios", @@ -6,7 +7,7 @@ "location" : "https://github.com/brankas/core-sdk-ios", "state" : { "branch" : "master", - "revision" : "62d3a86f5cdb231d9c6d060edfb369ca2d9f2b0f" + "revision" : "934e9ad62088ad61c36905bc1a1654c2ce17763f" } }, { @@ -46,5 +47,5 @@ } } ], - "version" : 2 + "version" : 3 } diff --git a/TestApp/ViewController.swift b/TestApp/ViewController.swift index f4acefe..d956e93 100644 --- a/TestApp/ViewController.swift +++ b/TestApp/ViewController.swift @@ -165,7 +165,7 @@ class ViewController: UIViewController, CheckDelegate { do { try DirectTapSF.shared.checkoutWithinSameScreen(tapRequest: request, vc: self, closure: { transaction, err in - self.onResult(data: transaction, error: err) + self.onResultCheckout(data: transaction, error: err) }, showWithinSameScreen: true, showBackButton: swBackButton.isOn) } catch { vProgressing.isHidden = true @@ -295,6 +295,26 @@ class ViewController: UIViewController, CheckDelegate { } } + private func onResultCheckout(data: Transaction?, error: DirectTapError?) { + if let transaction = data { + let date = DateFormatter() + date.dateFormat = "MMMM dd YYYY" + + let bankFee = Float(transaction.bankFee.numInCents) ?? 0 / 100 + let amount = Float(transaction.amount.numInCents) ?? 0 / 100 + let finishedDate = date.string(from: transaction.finishedDate) + + let fee = "\(transaction.bankFee.currency) \(bankFee)" + let payment = "\(transaction.amount.currency) \(amount)" + + showAlert(message: "TRANSACTION (\(transaction.id))\nReference ID: \(transaction.referenceId)\nStatus: \(transaction.status)\nStatus Code: \(transaction.statusMessage ?? "") (\(transaction.statusCode))\nBank: \(transaction.bankCode) (\(transaction.country))\nAmount: \(payment)\nBank Fee:\(fee)\nDate: \(finishedDate)") + } + + if let directTapError = error { + showAlert(message: "Error: \(directTapError.errorCode) - \(directTapError.errorMessage)") + } + } + func hasCheckError() { print("HAS ERROR GOTTEN") }