我正在使用 Payfort Start IOS SDK,现在我知道 Payfort 已关闭其启动 SDK。有什么办法可以克服这种情况?
任何人都知道在新的 Payfort SDK 中进行了哪些更改,以便我可以轻松实施。这是我在启动 SDK 中用来创建令牌的代码。
var card: StartCard? {
var card: StartCard?
var errorString: String?
do {
let cardholder = textFieldName?.text ?? ""
let number = textFieldCardNumber?.text ?? ""
let cvc = textFieldCVV?.text ?? ""
let month = Int(self.month ) ??
let year = Int("20\(self.year )") ??
card = try StartCard(cardholder: cardholder, number: number, cvc: cvc, expirationMonth: month, expirationYear: year)
}
catch let error as NSError {
if let errors = error.userInfo[StartCardErrorKeyValues] as? [String] {
errorString = "The following fields are invalid:"
errors.forEach { errorString = "\(errorString ?? "")\n\($0)" }
}
else {
errorString = "Unknown error occured"
}
}
catch {
errorString = "Unknown error occured"
}
if errorString != "" && errorString != nil{
delegate?.error(messgae: errorString ?? "")
}
return card
}
func createToken(cell:NewCardTableViewCell){
let replacedString = cell.textFieldExpiryOn.text?.replace("/", replacement: "")
cell.month = (replacedString?.substr(, length: 2)) ?? ""
cell.year = (replacedString?.substr(2, length: 2)) ?? ""
guard let card = cell.card else {
return
}
self.showLoader()
self.perform(#selector(self.hideLoader), with: nil, afterDelay: 60)
start.createToken(for: card, amount: Int(paidAmount), currency: currency, successBlock: { token in
self.makePayment(token:token.tokenId)
}, errorBlock: { error in
self.showAlert(message: "Error occured:\n\(error.localizedDescription)")
self.hideLoader()
}, cancel: {
self.showAlert(message: "Cancelled")
self.hideLoader()
})
}
}