Skip to content

Commit

Permalink
Direct Tap 4.4.0 Update
Browse files Browse the repository at this point in the history
  • Loading branch information
torresejay102 committed Mar 11, 2024
1 parent 0b621a3 commit 3bcb1d9
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 3 deletions.
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
{
"originHash" : "c9dfe6e688e58963468db0990bbe60b63e80a2c1f83770e1e863675f5f3d8daa",
"pins" : [
{
"identity" : "core-sdk-ios",
"kind" : "remoteSourceControl",
"location" : "https://github.com/brankas/core-sdk-ios",
"state" : {
"branch" : "master",
"revision" : "62d3a86f5cdb231d9c6d060edfb369ca2d9f2b0f"
"revision" : "934e9ad62088ad61c36905bc1a1654c2ce17763f"
}
},
{
Expand Down Expand Up @@ -46,5 +47,5 @@
}
}
],
"version" : 2
"version" : 3
}
22 changes: 21 additions & 1 deletion TestApp/ViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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")
}
Expand Down

0 comments on commit 3bcb1d9

Please sign in to comment.