CrediMax:该操作无法完成。 (MPGSDK.GatewayError错误0。)

时间:2018-11-25 07:33:06

标签: swift credit-card credimax

我正在尝试将CrediMax SDK: https://github.com/Mastercard-Gateway/gateway-ios-sdk集成到iOS移动应用中。

  1. 我创建了一个用于付款的会话,并且成功,下面将对此进行答复
  

{“成功”:true,“状态代码”:“ 200”,“数据”:{“ sessionId”:“ SESSION0002791451838N2104331F28”,“商家”:“ E13043 ***”,“结果”:“ SUCCESS”, “ sessionVersion”:“ fb828aee01”}}

但是当我尝试更新会话时,它总是显示错误

  

错误==操作无法完成。 (MPGSDK.GatewayError错误0。)

这是我的努力

func updateSession() {

        print("session id == \(transaction?.sessionId ?? "")\napiVersion == \(transaction?.apiVersion ?? "")")

        guard let sessionId = transaction?.sessionId, let apiVersion = transaction?.apiVersion else { return }

        var request = GatewayMap()
        request[at: "sourceOfFunds.provided.card.nameOnCard"] = "Museer Ahamad Ansari"
        request[at: "sourceOfFunds.provided.card.number"] = "6071235068******"
        request[at: "sourceOfFunds.provided.card.securityCode"] = "123"
        request[at: "sourceOfFunds.provided.card.expiry.month"] = "02"
        request[at: "sourceOfFunds.provided.card.expiry.year"] = "23"

        gateway.updateSession(sessionId, apiVersion: apiVersion, payload: request, completion: updateSessionHandler(_:))
    }

// MARK: - Handle the Update Response
// Call the gateway to update the session.
fileprivate func updateSessionHandler(_ result: GatewayResult<GatewayMap>) {
    DispatchQueue.main.async {
        self.loadingViewController.dismiss(animated: true) {
            switch result {
            case .success(_):
                self.performSegue(withIdentifier: "showConfirmation", sender: nil)
            case .error(let error):
                print("error == \(error.localizedDescription)")
                self.showError(error)
            }
        }
    }
}

0 个答案:

没有答案