Commit 8718c474 authored by Alex朱枝文's avatar Alex朱枝文

跨境支付相关功能调整

1、重定向时,进内置safari浏览器必须判断是http(s)://链接
2、支付成功后,回到支付结果页
parent 04073955
...@@ -74,7 +74,6 @@ ...@@ -74,7 +74,6 @@
savedToolIdentifier = "" savedToolIdentifier = ""
useCustomWorkingDirectory = "NO" useCustomWorkingDirectory = "NO"
debugDocumentVersioning = "YES" debugDocumentVersioning = "YES"
askForAppToLaunch = "Yes"
launchAutomaticallySubstyle = "2"> launchAutomaticallySubstyle = "2">
<BuildableProductRunnable <BuildableProductRunnable
runnableDebuggingMode = "0"> runnableDebuggingMode = "0">
......
...@@ -341,6 +341,9 @@ class AppDelegate: UIResponder, UIApplicationDelegate, WXApiDelegate { ...@@ -341,6 +341,9 @@ class AppDelegate: UIResponder, UIApplicationDelegate, WXApiDelegate {
} }
func application(_ application: UIApplication, handleOpen url: URL) -> Bool { func application(_ application: UIApplication, handleOpen url: URL) -> Bool {
if handleAntomPayWithString(from: url.absoluteString) {
return true
}
return WXApi.handleOpen(url, delegate: self) return WXApi.handleOpen(url, delegate: self)
} }
...@@ -353,12 +356,55 @@ class AppDelegate: UIResponder, UIApplicationDelegate, WXApiDelegate { ...@@ -353,12 +356,55 @@ class AppDelegate: UIResponder, UIApplicationDelegate, WXApiDelegate {
// return isAppLinking // return isAppLinking
// } // }
func handleAntomPayWithString(from url: String) -> Bool {
if url.hasPrefix(YhConstant.AntomPay.universalLink + YhConstant.AntomPay.returnPath), let recordId = getAntomPayRecordIdWithString(from: url) {
if !YHLoginManager.shared.isLogin() {
return true
}
var tempUrl = ""
let baseUrl = YHBaseUrlManager.shared.curH5URL()
// baseUrl = "http://192.168.34.113:10301/"
tempUrl = baseUrl + YhConstant.AntomPay.gotoPath + "?\(YhConstant.AntomPay.recordId)=\(recordId)"
if YHLoginManager.shared.isLogin() {
let token = YHLoginManager.shared.h5Token
tempUrl = tempUrl + "&param=" + token
}
var tUrl = tempUrl
if !tempUrl.contains("navigationH=") {
tUrl = tempUrl + "?navigationH=\(k_Height_NavigationtBarAndStatuBar)"
if tempUrl.contains("?") {
tUrl = tempUrl + "&navigationH=\(k_Height_NavigationtBarAndStatuBar)"
}
}
let vc = YHH5WebViewVC()
vc.url = tUrl
UIViewController.current?.navigationController?.pushViewController(vc, animated: true)
return true
}
return false
}
func getAntomPayRecordIdWithString(from urlString: String) -> String? {
guard let url = URL(string: urlString),
let components = URLComponents(url: url, resolvingAgainstBaseURL: false) else {
return nil
}
return components.queryItems?.first { $0.name == YhConstant.AntomPay.recordId }?.value
}
func application(_ application: UIApplication, continue userActivity: NSUserActivity, restorationHandler: @escaping ([UIUserActivityRestoring]?) -> Void) -> Bool { func application(_ application: UIApplication, continue userActivity: NSUserActivity, restorationHandler: @escaping ([UIUserActivityRestoring]?) -> Void) -> Bool {
if handleAntomPayWithString(from: userActivity.webpageURL?.absoluteString ?? "") {
return true
}
let isAppLinking = AGCAppLinking.instance().continueUserActivity(userActivity) let isAppLinking = AGCAppLinking.instance().continueUserActivity(userActivity)
return isAppLinking == false ? WXApi.handleOpenUniversalLink(userActivity, delegate: self) : true return isAppLinking == false ? WXApi.handleOpenUniversalLink(userActivity, delegate: self) : true
} }
func application(_ application: UIApplication, continue userActivity: NSUserActivity, restorationHandler: @escaping ([Any]?) -> Void) -> Bool { func application(_ application: UIApplication, continue userActivity: NSUserActivity, restorationHandler: @escaping ([Any]?) -> Void) -> Bool {
if handleAntomPayWithString(from: userActivity.webpageURL?.absoluteString ?? "") {
return true
}
let isAppLinking = AGCAppLinking.instance().continueUserActivity(userActivity) let isAppLinking = AGCAppLinking.instance().continueUserActivity(userActivity)
return isAppLinking == false ? WXApi.handleOpenUniversalLink(userActivity, delegate: self) : true return isAppLinking == false ? WXApi.handleOpenUniversalLink(userActivity, delegate: self) : true
} }
......
...@@ -568,13 +568,13 @@ extension YHH5WebViewVC { ...@@ -568,13 +568,13 @@ extension YHH5WebViewVC {
} }
if !(absoluteString.hasPrefix("https://") || absoluteString.hasPrefix("http://")) { if !(absoluteString.hasPrefix("https://") || absoluteString.hasPrefix("http://")) {
if absoluteString.hasPrefix("alipayconnect://") || absoluteString.hasPrefix("alipayhk://") { if absoluteString.hasPrefix("alipayconnect://") || absoluteString.hasPrefix("alipayhk://") {
self.openApp(with: url) self.openApp(with: url)
decisionHandler(.allow) decisionHandler(.allow)
return return
} else if absoluteString.hasPrefix("alipay://") { } else if absoluteString.hasPrefix("alipay://") {
self.openApp(with: url) self.openApp(with: url)
decisionHandler(.allow) //fort test hjl 需要测试 decisionHandler(.allow) // fort test hjl 需要测试
return return
} }
} }
...@@ -607,16 +607,11 @@ extension YHH5WebViewVC { ...@@ -607,16 +607,11 @@ extension YHH5WebViewVC {
if UIApplication.shared.canOpenURL(url) { if UIApplication.shared.canOpenURL(url) {
UIApplication.shared.open(url, options: [:], completionHandler: nil) UIApplication.shared.open(url, options: [:], completionHandler: nil)
} else { } else if url.absoluteString.hasPrefix("https://") || url.absoluteString.hasPrefix("http://") {
// let safariViewController = SFSafariViewController(url: url)
// if let tmpUrl = URL(string: "https://global.alipay.com/281002040090chyp7RdGg5AHvg49BXCv4Igh&pspName=ALIPAY_CN") { safariViewController.dismissButtonStyle = .close
let safariViewController = SFSafariViewController(url: url) safariViewController.modalPresentationStyle = .fullScreen
safariViewController.dismissButtonStyle = .close UIViewController.current?.present(safariViewController, animated: true, completion: nil)
safariViewController.modalPresentationStyle = .fullScreen
UIViewController.current?.present(safariViewController, animated: true, completion: nil)
// }
} }
} }
} }
......
...@@ -305,6 +305,7 @@ class YHMyNewViewController: YHBaseViewController { ...@@ -305,6 +305,7 @@ class YHMyNewViewController: YHBaseViewController {
self.navigationController?.pushViewController(vc) self.navigationController?.pushViewController(vc)
// let vc = YHH5WebViewVC() // let vc = YHH5WebViewVC()
// vc.isFullScreenFlag = false
// vc.url = "http://192.168.34.113:10301/superAppBridge.html#/order/antom-pay?id=1864&param=eyJhbGbolyFeciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJleHAiOjE3NTc0NzI5MzAsImkiOjQyMzgxNzEzODcwNzAyMSwidSI6IumTtuays-mbhuWboiIsInIiOiJzdXBlcl9hcHAifQ.Phsg13OfN5XJ0cLe759U2W0hH1iTZeneimgTlnouPcg" // vc.url = "http://192.168.34.113:10301/superAppBridge.html#/order/antom-pay?id=1864&param=eyJhbGbolyFeciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJleHAiOjE3NTc0NzI5MzAsImkiOjQyMzgxNzEzODcwNzAyMSwidSI6IumTtuays-mbhuWboiIsInIiOiJzdXBlcl9hcHAifQ.Phsg13OfN5XJ0cLe759U2W0hH1iTZeneimgTlnouPcg"
// self.navigationController?.pushViewController(vc) // self.navigationController?.pushViewController(vc)
} }
......
...@@ -274,6 +274,14 @@ extension YhConstant { ...@@ -274,6 +274,14 @@ extension YhConstant {
} }
// MARK: - 跨境支付
struct AntomPay {
static let universalLink = "https://www.galaxy-immi.com/yinheApp/"
static let returnPath = "antomPayReturnUrl"
static let gotoPath = "superAppBridge.html#/order/antom-pay-result"
static let recordId = "record_id"
}
// MARK: - 七鱼客服系统SDK // MARK: - 七鱼客服系统SDK
struct QiYuSDK { struct QiYuSDK {
static let appKey = "7922dbeb48141b15d2ae2e91cc156af5" static let appKey = "7922dbeb48141b15d2ae2e91cc156af5"
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment