Commit 2af9a5aa authored by Seatel's avatar Seatel

enhance mpay and acleda service(without commend)

parent 5df2c27c
......@@ -140,8 +140,8 @@
android:screenOrientation="portrait" />
<activity
android:name=".ui.home.activity.TopUpActivity"
android:windowSoftInputMode="stateHidden|adjustResize"
android:screenOrientation="portrait" />
android:screenOrientation="portrait"
android:windowSoftInputMode="stateHidden|adjustResize" />
<activity
android:name=".ui.home.activity.PaymentActivity"
......@@ -151,6 +151,7 @@
<tools:validation testUrl="https://api.yes.com.kh/.well-known/assetlinks.json" />
<intent-filter android:autoVerify="true">
<action android:name="android.intent.action.VIEW" />
......@@ -162,6 +163,18 @@
android:pathPattern="/.well-known/assetlinks.json"
android:scheme="https" />
</intent-filter>
<intent-filter>
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
<data
android:host="yesapp.com.kh"
android:pathPattern="/callback"
android:scheme="appyesmobile" />
</intent-filter>
</activity>
......@@ -420,6 +433,9 @@
<activity
android:name=".ui.yes_member.activity.SuccessRedeemActivity"
android:screenOrientation="portrait" />
<activity android:name=".ui.home.activity.AcledaActivity"
android:screenOrientation="portrait" />
</application>
</manifest>
\ No newline at end of file
......@@ -5,11 +5,14 @@ import android.content.Context
import android.content.Intent
import android.graphics.Bitmap
import android.net.Uri
import android.net.http.SslError
import android.os.Bundle
import android.util.Log
import android.view.View
import android.webkit.SslErrorHandler
import android.webkit.WebResourceError
import android.webkit.WebResourceRequest
import android.webkit.WebSettings
import android.webkit.WebView
import android.webkit.WebViewClient
import com.seatel.mobilehall.R
......@@ -32,62 +35,119 @@ open class AliPayPaymentActivity : BaseActivity<ActivityAliPayMpayPaymentBinding
fun getWebClient(): WebViewClient {
return mWebViewClient
}
private val mWebViewClient = object : WebViewClient() {
override fun onPageStarted(view: WebView?, url: String?, favicon: Bitmap?) {
super.onPageStarted(view, url, favicon)
if (url != null && view != null) {
Log.d("---PageStarted", "onPageStarted: $url")
onPageFinish(view, url)
}
Log.d("---PageStarted", "onPageStarted: $url")
showProgress()
}
override fun onPageFinished(view: WebView, url: String) {
super.onPageFinished(view, url)
Log.d("---PageFinished", "onPageFinished: $url")
hideProgress()
}
override fun onReceivedError(
view: WebView,
request: WebResourceRequest,
error: WebResourceError
override fun onReceivedSslError(
view: WebView?,
handler: SslErrorHandler?,
error: SslError?
) {
super.onReceivedError(view, request, error)
// closeWingPaymentWithError()
hideProgress()
Log.e("SSL", "SSL ERROR: ${error?.primaryError}")
handler?.proceed()
}
override fun shouldOverrideUrlLoading(
view: WebView?,
request: WebResourceRequest?
): Boolean {
val url = request?.url.toString()
val host = request?.url?.host.toString()
val scheme = request?.url?.scheme.toString()
Log.d("TAG::>>>", "shouldOverrideUrlLoading: $url $host $scheme")
if (isPaywayDeeplink(host, scheme)) {
val scheme = request?.url?.scheme
val host = request?.url?.host
Log.d("TAG::REQ>>>", "shouldOverrideUrlLoading: $url")
if (isPaywayDeeplink(host!!, scheme!!)) {
openDeeplink(url)
return false
return true // ✅ STOP WebView from loading deeplink
}
return isOverrideUrlLoading(view, request)
return false // Allow WebView to load normally
}
override fun shouldOverrideUrlLoading(view: WebView?, url: String?): Boolean {
val uri = Uri.parse(url)
val host = uri.host
val scheme = uri.scheme
Log.d("TAG::>>>", "shouldOverrideUrlLoading: $uri $host $scheme")
val host = uri.host
Log.d("TAG::URL>>>", "shouldOverrideUrlLoading: $url")
if (isPaywayDeeplink(host!!, scheme!!)) {
if (url != null) {
openDeeplink(url)
}
return false
if (url != null) openDeeplink(url)
return true // ✅ STOP WebView
}
return isOverrideUrlLoading(view, url)
return false
}
}
// private val mWebViewClient = object : WebViewClient() {
//
// override fun onPageStarted(view: WebView?, url: String?, favicon: Bitmap?) {
// super.onPageStarted(view, url, favicon)
// if (url != null && view != null) {
// Log.d("---PageStarted", "onPageStarted: $url")
// onPageFinish(view, url)
// }
// }
//
// override fun onPageFinished(view: WebView, url: String) {
// super.onPageFinished(view, url)
// hideProgress()
// }
//
// override fun onReceivedError(
// view: WebView,
// request: WebResourceRequest,
// error: WebResourceError
// ) {
// super.onReceivedError(view, request, error)
// // closeWingPaymentWithError()
// hideProgress()
// }
//
// override fun shouldOverrideUrlLoading(
// view: WebView?,
// request: WebResourceRequest?
// ): Boolean {
// val url = request?.url.toString()
// val host = request?.url?.host.toString()
// val scheme = request?.url?.scheme.toString()
// Log.d("TAG::>>>", "shouldOverrideUrlLoading: $url $host $scheme")
// if (isPaywayDeeplink(host, scheme)) {
// openDeeplink(url)
// return false
// }
// return isOverrideUrlLoading(view, request)
// }
//
// override fun shouldOverrideUrlLoading(view: WebView?, url: String?): Boolean {
// val uri = Uri.parse(url)
// val host = uri.host
// val scheme = uri.scheme
// Log.d("TAG::>>>", "shouldOverrideUrlLoading: $uri $host $scheme")
// if (isPaywayDeeplink(host!!, scheme!!)) {
// if (url != null) {
// openDeeplink(url)
// }
// return false
// }
// return isOverrideUrlLoading(view, url)
// }
// }
open fun isOverrideUrlLoading(view: WebView?, request: WebResourceRequest?): Boolean {
return false
}
......@@ -193,6 +253,7 @@ open class AliPayPaymentActivity : BaseActivity<ActivityAliPayMpayPaymentBinding
binding.webViewWing.isVerticalScrollBarEnabled = true
binding.webViewWing.settings.javaScriptEnabled = true
binding.webViewWing.webViewClient = mWebViewClient
binding.webViewWing.settings.mixedContentMode = WebSettings.MIXED_CONTENT_ALWAYS_ALLOW
mUrlPay = intent.getStringExtra("payment_url").toString()
binding.webViewWing.loadUrl(mUrlPay)
Log.d("---alipayment", "init: $mUrlPay")
......
......@@ -210,12 +210,14 @@ class PaymentActivity : BaseActivity<ActivityPaymentBinding>(), TopupTransaction
)
) {
checkCallBack = false
AliPayPaymentActivity.lunch(
this,
"${BuildConfig.BASE_URL}${paymentType.lowercase(Locale.getDefault())}/form?amount=$mAmountTopup&remark=$remark",
mAmountTopup,
paymentType
)
if (remark.isNotEmpty()){
AliPayPaymentActivity.lunch(
this,
"${BuildConfig.BASE_URL}${paymentType.lowercase(Locale.getDefault())}/form?amount=$mAmountTopup&remark=$remark",
mAmountTopup,
paymentType
)
}
}
else if (paymentType.equals("acleda", ignoreCase = true)) {
val myRemark = remark
......
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