gpt4 book ai didi

paytm - 在paytm付款成功后重定向回应用程序(ios和android)

转载 作者:行者123 更新时间:2023-12-01 06:01:02 26 4
gpt4 key购买 nike

付款成功后 Paytm 将用户重定向到 mysite 上的回调 URL。如何将用户从回调 url 返回的 View 重定向回应用程序。

最佳答案

添加这些功能

    func showController(controller: PGTransactionViewController) {

if self.navigationController != nil {
self.navigationController!.pushViewController(controller, animated: true)

}
else {
self.present(controller, animated: true, completion: {() -> Void in
})
}
}

func removeController(controller: PGTransactionViewController) {
if self.navigationController != nil {
self.navigationController!.popViewController(animated: true)
}
else {
controller.dismiss(animated: true, completion: {() -> Void in
})
}
}
func showError(title:String, message:String, controller: PGTransactionViewController) {
let alertController = UIAlertController(title: title, message: message, preferredStyle: UIAlertControllerStyle.alert);

let ok = UIAlertAction(title: "No", style: UIAlertActionStyle.default) { (alert) in

alertController.dismiss(animated: true, completion: nil);
};

let goBack = UIAlertAction(title: attributedYesString.string, style: UIAlertActionStyle.default) { (alert) in
self.removeController(controller: controller)
};

alertController.addAction(ok);
alertController.addAction(goBack)
self.parent?.present(alertController, animated: true, completion: nil)

}

在 Paytm 中,相应地调用这些功能。我会给你一个例子,我是如何做到的。
func didFinishedResponse(_ controller: PGTransactionViewController!, response responseString: String!) {
print(responseString)
print("didfinish")
self.removeController(controller: controller)
}

func didCancelTrasaction(_ controller: PGTransactionViewController!) {
print("cancelled", "didcancel")
self.showError(title: "Your transaction will be cancelled", message: "Are you sure?", controller: controller)

}

func errorMisssingParameter(_ controller: PGTransactionViewController!, error: Error!) {
print(error, "missing")
}

func didSucceedTransaction(_ controller: PGTransactionViewController!, response: [AnyHashable : Any]!) {
print(response,"Transaction Successfull")
self.removeController(controller: controller)

}


func didFailTransaction(_ controller: PGTransactionViewController!, error: Error!, response: [AnyHashable : Any]!) {

self.removeController(controller: controller)
}
func didCancelTransaction(_ controller: PGTransactionViewController!, error: Error!, response: [AnyHashable : Any]!) {
print(error, response , "Transaction Cancelled")
self.removeController(controller: controller)

}

func didFinishCASTransaction(_ controller: PGTransactionViewController!, response: [AnyHashable : Any]!) {
print(response , "Transaction")
}

关于paytm - 在paytm付款成功后重定向回应用程序(ios和android),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/45431419/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com