它没有带我到payUmoney
付款页面屏幕。我在添加PayUmoney
支付网关时在控制台中获取此信息。 PayUmoney
Integration[8923:268037] -[NSURL init]
致电;这会导致NSURL
实例具有空URL字符串。请使用其中一个记录的NSURL
初始化方法,而不是(initWithString:, initFileURLWithPath:, etc.)
。此消息仅显示一次。这是我的代码。我已经检查了这个How to integrate PayUMoney iOS SDK in swift project提前致谢。
import UIKit
class ViewController: UIViewController {
let paymentParam: PayUModelPaymentParams = PayUModelPaymentParams()
var hashes :PayUModelHashes = PayUModelHashes()
let PUSAhelper:PUSAHelperClass = PUSAHelperClass()
var PayUBaseUrl = "https://secure.payu.in"
override func viewDidLoad() {
super.viewDidLoad()
}
@IBAction func showPass(_ sender: UIButton) {
self.continueWithCardPayment()
}
func continueWithCardPayment() {
paymentParam.key = "gtKFFx"
paymentParam.transactionID = "txnID20170220"
paymentParam.amount = "10.0"
paymentParam.productInfo = "Nokia"
paymentParam.surl = "https://payu.herokuapp.com/success"
paymentParam.furl = "https://payu.herokuapp.com/failure"
paymentParam.firstName = "Baalak"
paymentParam.email = "Baalak@gmail.com"
paymentParam.environment = ENVIRONMENT_TEST
paymentParam.udf1 = "udf1"
paymentParam.udf2 = "udf2"
paymentParam.udf3 = "udf3"
paymentParam.udf4 = "udf4"
paymentParam.udf5 = "udf5"
paymentParam.offerKey = "" // Set this property if you want to give offer:
paymentParam.userCredentials = ""
PUSAHelperClass.generateHash(fromServer: self.paymentParam) { (hashes, errorString) in
self.hashes = hashes!
self.paymentParam.hashes = hashes
self.paymentParam.userCredentials = "gtKFFx:Baalak@gmail.com"
self.paymentParam.environment = ENVIRONMENT_TEST
self.callPaymentGateway()
}
}
func callPaymentGateway() {
let webServiceResponse :PayUWebServiceResponse = PayUWebServiceResponse()
webServiceResponse.getPayUPaymentRelatedDetail(forMobileSDK: paymentParam) { (paymentDetail, errString, extraParam) in
if errString == nil {
let stryBrd: UIStoryboard = UIStoryboard(name: "PUUIMainStoryBoard", bundle: nil)
let payOptionVC : PUUIPaymentOptionVC = stryBrd.instantiateViewController(withIdentifier: VC_IDENTIFIER_PAYMENT_OPTION) as! PUUIPaymentOptionVC
payOptionVC.paymentParam = self.paymentParam
payOptionVC.paymentRelatedDetail = paymentDetail
DispatchQueue.main.async {
NotificationCenter.default.addObserver(self, selector: #selector(self.paymentResponseReceived(notify:)), name: NSNotification.Name(rawValue: kPUUINotiPaymentResponse), object: nil)
self.navigationController?.pushViewController(payOptionVC, animated: true)
}
}
else{
print("Failed to proceed for payment : \(String(describing: errString))")
}
}
}
@objc func paymentResponseReceived(notify:NSNotification) {
print(notify)
}
}
答案 0 :(得分:0)
我通过将导航控制器添加到我的View Controller中来解决了这个问题