Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed ios app startup crash and removed print #24

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 17 additions & 16 deletions ios/Classes/SwiftPaytmPlugin.swift
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,12 @@ import AppInvokeSDK

public class SwiftPaytmPlugin: NSObject, FlutterPlugin, AIDelegate{
public func didFinish(with status: AIPaymentStatus, response: [String : Any]) {
print("Response")
print(type(of: response))
print(response)
// print("Response")
// print(type(of: response))
// print(response)

var paramMap = [String: Any]()

if(status==AIPaymentStatus.failed){
paramMap["error"]=true
paramMap["errorMessage"]=response["RESPMSG"]
Expand All @@ -18,7 +18,7 @@ public class SwiftPaytmPlugin: NSObject, FlutterPlugin, AIDelegate{
paramMap["error"]=false
paramMap["response"]=response
}


self.flutterResult!(paramMap)
}
Expand All @@ -27,7 +27,7 @@ public class SwiftPaytmPlugin: NSObject, FlutterPlugin, AIDelegate{
private var appInvoke : AIHandler = AIHandler()

public func openPaymentWebVC(_ controller: UIViewController?) {
print("Response2")
// print("Response2")

if let vc = controller {

Expand Down Expand Up @@ -55,8 +55,8 @@ public class SwiftPaytmPlugin: NSObject, FlutterPlugin, AIDelegate{
self.flutterResult=result

let arguments = call.arguments as? NSDictionary
print(arguments)
print(call.method)
// print(arguments)
// print(call.method)

if(call.method.elementsEqual("payWithPaytm")){
let mId = arguments!["mId"] as! String
Expand All @@ -74,7 +74,7 @@ public class SwiftPaytmPlugin: NSObject, FlutterPlugin, AIDelegate{
environment=AIEnvironment.production
}

print(callBackUrl);
// print(callBackUrl);


appInvoke.openPaytm(merchantId: mId, orderId: orderId, txnToken: txnToken, amount: amount, callbackUrl: callBackUrl , delegate: self, environment: environment,urlScheme: "paytm"+mId)
Expand All @@ -87,8 +87,8 @@ public class SwiftPaytmPlugin: NSObject, FlutterPlugin, AIDelegate{


public func application(_ application: UIApplication, open url: URL, options: [UIApplication.OpenURLOptionsKey : Any] = [:]) -> Bool {
print("Response in Plugin")
print(url.absoluteString)
// print("Response in Plugin")
// print(url.absoluteString)

var dict = [String:String]()

Expand All @@ -99,22 +99,23 @@ public class SwiftPaytmPlugin: NSObject, FlutterPlugin, AIDelegate{
dict[item.name] = item.value!
}
}
print(dict)
// print(dict)

var paramMap = [String: Any]()

if dict["response"] != nil && dict["response"]!.count > 0{
paramMap["error"]=false
paramMap["response"]=dict["response"]

}else{
paramMap["error"]=true
paramMap["errorMessage"]="Transaction Cancelled"
paramMap["status"]=dict["status"]
}


self.flutterResult!(paramMap)
if( self.flutterResult != nil){
self.flutterResult!(paramMap)
}

return true
}
Expand Down