paytm / Paytm_iOS_All_in_One_SDK

https://developer.paytm.com/docs/all-in-one-sdk/#ios
6 stars 5 forks source link

Client app paytm webflow not working correct. #28

Open IrfanKhatik opened 2 years ago

IrfanKhatik commented 2 years ago

Preconditions: 1] Paytm App not installed on device. 2] Not providing any callback url.

Usecase: 1] Fetch transaction token from backend and startPaytmPayment() 2] APIHandler's openPaymentWebVC() invoked and presented from MyPaytmViewController 3] Paytm web view loaded on presented vc. 4] Payment done by user successfully and weird success transaction html response shown by Paytm. (Screenshot) There is no back button, so user only option have to pull-down to dismiss 5] If user pull-down shown web view vc from Paytm 6] APIHandler's didFinish() api invoked from Paytm with "cancel" AIPaymentStatus.

Problem: It should be success AIPaymentStatus and valid response provided in didFinish() as payment done by user. Please test from QA all use cases.

Codesnippet: 1. class MyPaytmViewController: UIViewController { private func startPaytmPayment() { appInvoke.openPaytm(merchantId: merchantId, orderId: orderId, txnToken: transactionToken, amount: transactionAmount, callbackUrl: nil, delegate: self, environment: paymentEnvironment, urlScheme: "paytm(AppConfig.domain)(AppConfig.storeId)") } }

  1. extension MyPaytmViewController: AIDelegate {

    func openPaymentWebVC(_ controller: UIViewController?) { // if let vc = controller { DispatchQueue.main.async { [weak self] in guard let strongSelf = self else { return } strongSelf.present(vc, animated: false, completion: nil) } }

    func didFinish(with status: AIPaymentStatus, response: [String : Any]) {
    //
    switch status {
    case .success:
        // Sending response to backend for validation
        validateTransaction(status: status, response: response) 
        break
    case .failed:
        print("Failed")
        break
    case .pending:
        print("Pending")
        break
    case .cancel:
        print("Cancelled")
        break
    default:
        print("Paytm unknown payment status")
        break
    }

    } }

Screenshot_2022_03_01T15_21_16_860Z

Prakash128-lab commented 2 years ago

Hi, Please try with given sample code .Let us know if any issue .

https://github.com/paytm/paytm-all-in-one-sample-app https://github.com/paytm/Paytm_iOS_All_in_One_SDK