我正在尝试使用方法通道在颤振应用程序中设置支付集成,并且它在 android 平台上运行良好。但在 iOS 平台上,我无法将响应部分发送到颤振。付款成功后,我在“qpResponse”功能中收到响应,我该如何将其传递给颤振?
extension AppDelegate {
func linkNativeCode(controller: FlutterViewController,args: [String: Any?]) {
return SetQpaymentDetails(controller: controller,args: args)
}
func SetQpaymentDetails(controller: FlutterViewController,args: [String: Any?]) {
self.qpRequestParams?.gatewayId = ""
self.qpRequestParams?.secretKey = ""
self.qpRequestParams?.name = args["name"] as? String
self.qpRequestParams?.address = args["address"] as? String
self.qpRequestParams?.city = args["city"] as? String
self.qpRequestParams?.state = args["state"] as? String
self.qpRequestParams?.country = args["country"] as? String
self.qpRequestParams?.email = args["email"] as? String
self.qpRequestParams?.currency = args["currency"] as? String
self.qpRequestParams?.referenceId = args["referenceId"] as? String
self.qpRequestParams?.phone = args["phone"] as? String
self.qpRequestParams?.amount = Double(args["amount"] as! String)!
self.qpRequestParams?.mode = args["mode"] as? String
self.qpRequestParams?.productDescription = args["description"] as? String
self.qpRequestParams?.sendRequest()
}
func qpResponse(_ response: NSDictionary) {
print("Response Inside customer app:",response)
//Perform your actions with the response
}
}
qPayChannel.setMethodCallHandler({
(call: FlutterMethodCall, result: @escaping FlutterResult) -> Void in
if call.method == "payment" {
guard let args = call.arguments else {
return
}
if let myArgs = args as? [String: Any] {
self.linkNativeCode(controller: controller,args: myArgs)
} else {
result(FlutterError(code: "-1", message: "iOS could not extract " +
"flutter arguments in method: (sendParams)", details: nil))
}
} else if call.method == "getPlatformVersion" {
result("Running on: iOS " + UIDevice.current.systemVersion)
} else {
result(FlutterMethodNotImplemented)
}
})