Commit e3d59db6 authored by 王雪伟's avatar 王雪伟

[提交人]:王雪伟

[提交简述] :加入google支付某个环节断开连接重连机制
[实现方案] :
parent c4b96a04
PACKAGE_NAME=com.zhangxin.magicbox PACKAGE_NAME=com.zhangxin.magicbox
VERSION_CODE=12 VERSION_CODE=13
VERSION_NAME=1.0.3.4 VERSION_NAME=1.0.3.5
\ No newline at end of file \ No newline at end of file
...@@ -60,7 +60,18 @@ class GooglePayActivity : BaseActivity() { ...@@ -60,7 +60,18 @@ class GooglePayActivity : BaseActivity() {
} }
// startConnection() // startConnection()
googlePay = GooglePayHelper(this) googlePay = GooglePayHelper(this)
googlePay?.init() googlePay?.init(object :GooglePayCallBack{
override fun onPaySuccess(purchase: GooglePayResult, googleJson: String) {
}
override fun onCancel() {
}
override fun onError(error: String) {
}
})
} }
override fun onDestroy() { override fun onDestroy() {
......
...@@ -35,8 +35,10 @@ import io.reactivex.Observable ...@@ -35,8 +35,10 @@ import io.reactivex.Observable
import io.reactivex.android.schedulers.AndroidSchedulers import io.reactivex.android.schedulers.AndroidSchedulers
import io.reactivex.functions.Consumer import io.reactivex.functions.Consumer
import kotlinx.android.synthetic.main.activity_member.* import kotlinx.android.synthetic.main.activity_member.*
import org.json.JSONObject
import java.util.* import java.util.*
/** /**
* Created by gaoleichao on 2021/8/30 * Created by gaoleichao on 2021/8/30
*/ */
...@@ -83,9 +85,25 @@ class PayActivity : BaseActivity(), PayContract.View, ...@@ -83,9 +85,25 @@ class PayActivity : BaseActivity(), PayContract.View,
false, false,
false false
) )
mPresenter = PayPresenter(this)
googlePay = GooglePayHelper(this) googlePay = GooglePayHelper(this)
googlePay?.init() googlePay?.init(object : GooglePayCallBack {
override fun onPaySuccess(purchase: GooglePayResult, googleJson: String) {
mPresenter?.verifyPay(googleJson, GOOGLE_PAY)
//mLoading?.setResult(true, "Pay for success", 1000)
EventUtils.onEvent("GooglePaySuccess_bd")
}
override fun onCancel() {
EventUtils.onEvent("GooglePayCancel_bd")
}
override fun onError(error: String) {
Log.d("wxw", "补单PayError:$error")
EventUtils.onEvent("GooglePayError_bd", error)
}
})
id_img_back?.setOnClickListener { id_img_back?.setOnClickListener {
finish() finish()
...@@ -139,7 +157,6 @@ class PayActivity : BaseActivity(), PayContract.View, ...@@ -139,7 +157,6 @@ class PayActivity : BaseActivity(), PayContract.View,
// setBootmPrice() // setBootmPrice()
id_tv_my_yu_e?.text = SettingPreference.getUserCoinNum() id_tv_my_yu_e?.text = SettingPreference.getUserCoinNum()
mPresenter = PayPresenter(this)
// mAdapter = PayAdapter(this,itemlayout) // mAdapter = PayAdapter(this,itemlayout)
// val data = VideoEntity() // val data = VideoEntity()
...@@ -156,70 +173,13 @@ class PayActivity : BaseActivity(), PayContract.View, ...@@ -156,70 +173,13 @@ class PayActivity : BaseActivity(), PayContract.View,
} }
mLoading?.setLoading("Loading") mLoading?.setLoading("Loading")
mLoading?.show() mLoading?.show()
EventUtils.onEvent("pay_page_pay_btn", product?.cash + "") onEvent("pay_page_pay_btn", product?.cash + "")
if (ifChooseNeedPrice!!) { if (pay_type == GOOGLE_PAY) {
if (pay_type == 1) { googlePay(product?.goodsId ?: "")
mPresenter?.requestAliPay( } else if (pay_type == PAY_PAL_PAY) {
this, onEvent("pay_type_error", "暂不支持paypal")
id_tv_need_price.text.toString(),
pay_type.toString(),
"6"
)
} else {
if (pay_type == 2) {
Log.e("MXL", "微信原生支付")
mPresenter?.requestWechatPayOrder("", pay_type.toString())
} else if (pay_type == 11) {
Log.e("MXL", "微信连连支付")
mPresenter?.requestWechatPayOrder("", pay_type.toString())
} else {
Log.e("MXL", "微信敏支付")
mPresenter?.requestMiniProgrom(
id_tv_need_price.text.toString(),
pay_type.toString(),
"6"
)
}
}
} else { } else {
if (pay_type == ALI_PAY) { onEvent("pay_type_error", "pay_type$pay_type")
mPresenter?.requestAliPay(
this,
product?.goodsId ?: "",
pay_type.toString(),
"6"
)
} else if (pay_type == GOOGLE_PAY) {
googlePay(product?.goodsId ?: "")
} else if (pay_type == PAY_PAL_PAY) {
} else {
if (pay_type == 2) {
Log.e("MXL", "2微信原生支付")
mPresenter?.requestWechatPayOrder(
product?.goodsId ?: "",
pay_type.toString()
)
} else if (pay_type == 11) {
Log.e("MXL", "2微信连连支付")
mPresenter?.requestWechatPayOrder(
product?.goodsId ?: "",
pay_type.toString()
)
} else {
Log.e("MXL", "2微信敏支付")
mPresenter?.requestMiniProgrom(
product?.goodsId ?: "",
pay_type.toString(),
"6"
)
}
}
} }
} }
...@@ -560,7 +520,7 @@ class PayActivity : BaseActivity(), PayContract.View, ...@@ -560,7 +520,7 @@ class PayActivity : BaseActivity(), PayContract.View,
} }
mLoading?.setLoading(getString(R.string.wait_ing2)) mLoading?.setLoading(getString(R.string.wait_ing2))
mLoading?.show() mLoading?.show()
googlePay?.googlePay(goodsId,"6", object : GooglePayCallBack { googlePay?.googlePay(goodsId, "6", object : GooglePayCallBack {
override fun onPaySuccess(purchase: GooglePayResult, googleJson: String) { override fun onPaySuccess(purchase: GooglePayResult, googleJson: String) {
mPresenter?.verifyPay(googleJson, GOOGLE_PAY) mPresenter?.verifyPay(googleJson, GOOGLE_PAY)
//mLoading?.setResult(true, "Pay for success", 1000) //mLoading?.setResult(true, "Pay for success", 1000)
...@@ -579,7 +539,7 @@ class PayActivity : BaseActivity(), PayContract.View, ...@@ -579,7 +539,7 @@ class PayActivity : BaseActivity(), PayContract.View,
runOnUiThread { runOnUiThread {
mLoading?.setResult(false, "pay error", 1000) mLoading?.setResult(false, "pay error", 1000)
} }
EventUtils.onEvent("GooglePayError",error) EventUtils.onEvent("GooglePayError", error)
} }
}) })
} }
......
...@@ -269,7 +269,19 @@ class OrderDetailActivity : BaseActivity(), OrderDetailContract.View, PayContrac ...@@ -269,7 +269,19 @@ class OrderDetailActivity : BaseActivity(), OrderDetailContract.View, PayContrac
fun initPayConfig() { fun initPayConfig() {
googlePay = GooglePayHelper(this) googlePay = GooglePayHelper(this)
googlePay?.init() googlePay?.init(object :GooglePayCallBack{
override fun onPaySuccess(purchase: GooglePayResult, googleJson: String) {
}
override fun onCancel() {
}
override fun onError(error: String) {
}
})
mPayresenter = PayPresenter(this) mPayresenter = PayPresenter(this)
mPayresenter?.appInfo() mPayresenter?.appInfo()
......
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