Commit 4f723dc8 authored by 王雪伟's avatar 王雪伟

[提交人]:王雪伟

[提交简述] :测试环境
[实现方案] :完整的Google支付流程
parent 499bc8e1
...@@ -4,8 +4,13 @@ import android.annotation.SuppressLint; ...@@ -4,8 +4,13 @@ import android.annotation.SuppressLint;
import android.app.Dialog; import android.app.Dialog;
import android.content.Context; import android.content.Context;
import android.content.Intent; import android.content.Intent;
import android.content.pm.PackageInfo;
import android.content.pm.PackageManager;
import android.content.pm.Signature;
import android.os.Bundle; import android.os.Bundle;
import android.text.TextUtils; import android.text.TextUtils;
import android.util.Base64;
import android.util.Log;
import android.view.View; import android.view.View;
import androidx.annotation.NonNull; import androidx.annotation.NonNull;
...@@ -40,6 +45,8 @@ import com.zxhl.main.page.view.DiscountDialog; ...@@ -40,6 +45,8 @@ import com.zxhl.main.page.view.DiscountDialog;
import com.zxhl.main.page.view.NavigationBottomView; import com.zxhl.main.page.view.NavigationBottomView;
import com.zxhl.uc.page.fragment.UserCenterFragment; import com.zxhl.uc.page.fragment.UserCenterFragment;
import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.HashMap; import java.util.HashMap;
import java.util.List; import java.util.List;
...@@ -121,7 +128,6 @@ public class MainActivity extends BaseActivity implements NavigationBottomView.N ...@@ -121,7 +128,6 @@ public class MainActivity extends BaseActivity implements NavigationBottomView.N
} }
}); });
} }
private void initListener() { private void initListener() {
......
PACKAGE_NAME=com.zhangxin.magicbox PACKAGE_NAME=com.zhangxin.magicbox
VERSION_CODE=2 VERSION_CODE=3
VERSION_NAME=1.0.0 VERSION_NAME=1.0.1
...@@ -17,6 +17,9 @@ buildscript { ...@@ -17,6 +17,9 @@ buildscript {
classpath "com.mob.sdk:MobSDK:2018.0319.1724" classpath "com.mob.sdk:MobSDK:2018.0319.1724"
// NOTE: Do not place your application dependencies here; they belong // NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files // in the individual module build.gradle files
configurations.all {
resolutionStrategy.cacheDynamicVersionsFor 0, 'seconds'
}
} }
} }
......
...@@ -28,6 +28,7 @@ public class NetConfig { ...@@ -28,6 +28,7 @@ public class NetConfig {
public static String BASE_FEED_URL = ""; public static String BASE_FEED_URL = "";
public static final String URL_REPORT_BASE = "http://report.zhangxinhulian.com/"; public static final String URL_REPORT_BASE = "http://report.zhangxinhulian.com/";
public static final String HOME_BANNER_BASE_URL = "https://bs.zhangxinhulian.com/"; public static final String HOME_BANNER_BASE_URL = "https://bs.zhangxinhulian.com/";
public static final String URL_PAY_BASE = "http://paytest.zhangxinhulian.com/";
public static void setBase_Url(Environment s) { public static void setBase_Url(Environment s) {
sEnvironment = s; sEnvironment = s;
...@@ -146,7 +147,6 @@ public class NetConfig { ...@@ -146,7 +147,6 @@ public class NetConfig {
public static final String URL_AUTH_GOOGLE_LOGIN = "app/v1/auth/googleLogin";//绑定谷歌登录 public static final String URL_AUTH_GOOGLE_LOGIN = "app/v1/auth/googleLogin";//绑定谷歌登录
public static final String URL_PAY_BASE = "http://pay.linking100.com/";
///unifiedpay/gateway/google/替换包名/notify/order ///unifiedpay/gateway/google/替换包名/notify/order
public static final String URL_GOOGLE_NOTIFY = URL_PAY_BASE +"unifiedpay/gateway/google/com.zhangxin.magicbox/notify/order"; public static final String URL_GOOGLE_NOTIFY = URL_PAY_BASE +"unifiedpay/gateway/google/com.zhangxin.magicbox/notify/order";
......
package com.zxhl.cms.googlepay package com.zxhl.cms.googlepay
import android.util.Log
import android.view.View import android.view.View
import com.android.billingclient.api.*
import com.android.billingclient.api.BillingClient.SkuType
import com.ishin.google.bean.GooglePayResult
import com.zxhl.cms.AppContext
import com.zxhl.cms.R import com.zxhl.cms.R
import com.zxhl.cms.common.base.BaseActivity import com.zxhl.cms.common.base.BaseActivity
import com.zxhl.cms.widget.LoadingDialog import com.zxhl.cms.widget.LoadingDialog
...@@ -34,6 +29,7 @@ class GooglePayActivity : BaseActivity() { ...@@ -34,6 +29,7 @@ class GooglePayActivity : BaseActivity() {
override fun layoutID(): Int { override fun layoutID(): Int {
return R.layout.activity_google_pay return R.layout.activity_google_pay
} }
private var mLoading: LoadingDialog? = null private var mLoading: LoadingDialog? = null
override fun init() { override fun init() {
mLoading = LoadingDialog.getLoadingDialog( mLoading = LoadingDialog.getLoadingDialog(
...@@ -43,11 +39,12 @@ class GooglePayActivity : BaseActivity() { ...@@ -43,11 +39,12 @@ class GooglePayActivity : BaseActivity() {
false false
) )
id_btn_google_pay.setOnClickListener { id_btn_google_pay.setOnClickListener {
mLoading?.setLoading(getString(R.string.wait_ing2))
mLoading?.show() mLoading?.show()
googlePay?.googlePay("0.1", object : GooglePayCallBack { googlePay?.googlePay("box_text_0001_1cent", "6", object : GooglePayCallBack {
override fun onPaySuccess(purchase: GooglePayResult) { override fun onPaySuccess(purchase: GooglePayResult, googleJson: String) {
showToast("success" + purchase.orderId) showToast("success" + purchase.orderId)
mLoading?.setResult(true, "pay success", 1000) mLoading?.setResult(true, "Pay for success", 1000)
} }
override fun onCancel() { override fun onCancel() {
...@@ -62,7 +59,7 @@ class GooglePayActivity : BaseActivity() { ...@@ -62,7 +59,7 @@ class GooglePayActivity : BaseActivity() {
}) })
} }
// startConnection() // startConnection()
googlePay= GooglePayHelper(this) googlePay = GooglePayHelper(this)
googlePay?.init() googlePay?.init()
} }
......
package com.zxhl.cms.googlepay package com.zxhl.cms.googlepay
import com.ishin.google.bean.GooglePayResult
/** /**
* @author (wangXuewei) * @author (wangXuewei)
* @datetime 2022-03-14 16:49 GMT+8 * @datetime 2022-03-14 16:49 GMT+8
...@@ -9,7 +7,7 @@ import com.ishin.google.bean.GooglePayResult ...@@ -9,7 +7,7 @@ import com.ishin.google.bean.GooglePayResult
*/ */
interface GooglePayCallBack { interface GooglePayCallBack {
fun onPaySuccess(purchase: GooglePayResult) fun onPaySuccess(purchase: GooglePayResult,googleJson:String)
fun onCancel() fun onCancel()
......
...@@ -5,15 +5,12 @@ import android.util.Log ...@@ -5,15 +5,12 @@ import android.util.Log
import com.android.billingclient.api.* import com.android.billingclient.api.*
import com.android.billingclient.api.BillingClient.BillingResponseCode import com.android.billingclient.api.BillingClient.BillingResponseCode
import com.android.billingclient.api.BillingClient.SkuType import com.android.billingclient.api.BillingClient.SkuType
import com.ishin.google.bean.GooglePayResult
import com.zxhl.cms.AppContext import com.zxhl.cms.AppContext
import com.zxhl.cms.net.ApiClient import com.zxhl.cms.net.ApiClient
import com.zxhl.cms.net.RxSchedulers import com.zxhl.cms.net.RxSchedulers
import com.zxhl.cms.net.callback.BaseObserver import com.zxhl.cms.net.callback.BaseObserver
import com.zxhl.cms.net.model.other.AnyEntity import com.zxhl.cms.net.model.other.AnyEntity
import com.zxhl.cms.net.model.uc.AliPayEntity
import com.zxhl.cms.net.model.uc.GooglePayEntity import com.zxhl.cms.net.model.uc.GooglePayEntity
import com.zxhl.cms.pay.alipay.AlipayServer
import com.zxhl.cms.utils.EventUtils import com.zxhl.cms.utils.EventUtils
...@@ -48,6 +45,8 @@ class GooglePayHelper { ...@@ -48,6 +45,8 @@ class GooglePayHelper {
if (!purchases.isNullOrEmpty()) { if (!purchases.isNullOrEmpty()) {
for (i in 0 until purchases.size) { for (i in 0 until purchases.size) {
var purchase = purchases[i]; var purchase = purchases[i];
Log.d(TAG, "detail ${purchase.originalJson}")
Log.d(TAG, "obfuscatedAccountid $obfuscatedAccountid")
var googlePayResult = GooglePayResult() var googlePayResult = GooglePayResult()
googlePayResult.packageName = purchase.packageName googlePayResult.packageName = purchase.packageName
googlePayResult.orderId = purchase.orderId googlePayResult.orderId = purchase.orderId
...@@ -57,8 +56,8 @@ class GooglePayHelper { ...@@ -57,8 +56,8 @@ class GooglePayHelper {
googlePayResult.purchaseTime = purchase.purchaseTime.toString() googlePayResult.purchaseTime = purchase.purchaseTime.toString()
googlePayResult.purchaseState = purchase.purchaseState.toString() googlePayResult.purchaseState = purchase.purchaseState.toString()
googlePayResult.purchaseToken = purchase.purchaseToken googlePayResult.purchaseToken = purchase.purchaseToken
//同步后台 消耗掉 //购买成功 消耗掉
updateToService(googlePayResult) consume(googlePayResult, purchase)
} }
} }
} else if (billingResult.responseCode == BillingResponseCode.ITEM_ALREADY_OWNED) { } else if (billingResult.responseCode == BillingResponseCode.ITEM_ALREADY_OWNED) {
...@@ -198,7 +197,7 @@ class GooglePayHelper { ...@@ -198,7 +197,7 @@ class GooglePayHelper {
* *
* @param purchaseToken 商品token * @param purchaseToken 商品token
*/ */
private fun consume(googlePayResult: GooglePayResult) { private fun consume(googlePayResult: GooglePayResult, purchase: Purchase) {
if (billingClient.isReady) { if (billingClient.isReady) {
val consumeParams = val consumeParams =
ConsumeParams.newBuilder() ConsumeParams.newBuilder()
...@@ -210,7 +209,8 @@ class GooglePayHelper { ...@@ -210,7 +209,8 @@ class GooglePayHelper {
if (billingResult.responseCode == BillingResponseCode.OK) { if (billingResult.responseCode == BillingResponseCode.OK) {
// Handle the success of the consume operation. // Handle the success of the consume operation.
Log.d(TAG, "consume 消耗成功${googlePayResult.purchaseToken}") Log.d(TAG, "consume 消耗成功${googlePayResult.purchaseToken}")
mPayCallBack?.onPaySuccess(googlePayResult)//支付成功 //同步后台 消耗掉
updateToService(googlePayResult, purchase)
productId = "" productId = ""
obfuscatedAccountid = "" obfuscatedAccountid = ""
} else { } else {
...@@ -233,7 +233,10 @@ class GooglePayHelper { ...@@ -233,7 +233,10 @@ class GooglePayHelper {
if (billingResult.responseCode == BillingResponseCode.OK) { if (billingResult.responseCode == BillingResponseCode.OK) {
// Handle the success of the consume operation. // Handle the success of the consume operation.
Log.d(TAG, "consume 消耗成功${googlePayResult.purchaseToken}") Log.d(TAG, "consume 消耗成功${googlePayResult.purchaseToken}")
mPayCallBack?.onPaySuccess(googlePayResult)//支付成功 //同步后台 消耗掉
updateToService(googlePayResult, purchase)
productId = ""
obfuscatedAccountid = ""
} else { } else {
Log.d(TAG, "consume 消耗失败 code:" + billingResult.responseCode) Log.d(TAG, "consume 消耗失败 code:" + billingResult.responseCode)
mPayCallBack?.onError("consume 消耗失败 code:" + billingResult.responseCode + " msg:" + billingResult.debugMessage) mPayCallBack?.onError("consume 消耗失败 code:" + billingResult.responseCode + " msg:" + billingResult.debugMessage)
...@@ -248,7 +251,7 @@ class GooglePayHelper { ...@@ -248,7 +251,7 @@ class GooglePayHelper {
override fun onBillingServiceDisconnected() { override fun onBillingServiceDisconnected() {
// Try to restart the connection on the next request to // Try to restart the connection on the next request to
// Google Play by calling the startConnection() method. // Google Play by calling the startConnection() method.
mPayCallBack?.onError("consume onBillingServiceDisconnected" ) mPayCallBack?.onError("consume onBillingServiceDisconnected")
} }
}) })
} }
...@@ -356,16 +359,17 @@ class GooglePayHelper { ...@@ -356,16 +359,17 @@ class GooglePayHelper {
/** /**
* google支付 * google支付
*/ */
fun googlePay(goodsId: String, payCallBack: GooglePayCallBack) { fun googlePay(goodsId: String,payMode: String, payCallBack: GooglePayCallBack) {
mPayCallBack = payCallBack mPayCallBack = payCallBack
//向服务端获取订单ID //向服务端获取订单ID
ApiClient.userInfoAPi.googlePay(goodsId, "4", "", "", "6") ApiClient.userInfoAPi.googlePay(goodsId, "4", "", "", payMode)
.compose(RxSchedulers.observableIO2Main()) .compose(RxSchedulers.observableIO2Main())
.subscribe(object : BaseObserver<GooglePayEntity>() { .subscribe(object : BaseObserver<GooglePayEntity>() {
override fun onSuccess(result: GooglePayEntity?) { override fun onSuccess(result: GooglePayEntity?) {
if (result != null) { if (result != null) {
Log.d(TAG, "请求支付") var sku = goodsId.replace("-", "_")
purchase("box_text_0001_1cent", result.outTradeNo ?: "") Log.d(TAG, "请求支付${sku}")
purchase("xymh_$sku", result.outTradeNo ?: "")
} else { } else {
Log.d(TAG, "未获取到订单") Log.d(TAG, "未获取到订单")
mPayCallBack?.onError("GooglePay 未获取到订单数据") mPayCallBack?.onError("GooglePay 未获取到订单数据")
...@@ -379,29 +383,26 @@ class GooglePayHelper { ...@@ -379,29 +383,26 @@ class GooglePayHelper {
}) })
} }
fun updateToService(purchase: GooglePayResult) { /**
* google支付 成功后 同步给服务器
*/
private fun updateToService(googlePayResult: GooglePayResult, purchase: Purchase) {
//支付成功 向后端同步 网络问题再次重试 //支付成功 向后端同步 网络问题再次重试
ApiClient.userInfoAPi.googlePaySuccess( ApiClient.shopApi.googlePaySuccess(googlePayResult)
purchase.packageName, .compose(RxSchedulers.observableIO2Main())
purchase.orderId, .subscribe(object : BaseObserver<Any>() {
purchase.productId, override fun onSuccess(result: Any?) {
purchase.developerPayload,
purchase.obfuscatedAccountid,
purchase.purchaseTime,
purchase.purchaseState,
purchase.purchaseToken
).compose(RxSchedulers.observableIO2Main())
.subscribe(object : BaseObserver<AnyEntity?>() {
override fun onSuccess(result: AnyEntity?) {
EventUtils.onEvent("googlepaysuccess_onsuccess") EventUtils.onEvent("googlepaysuccess_onsuccess")
mPayCallBack?.onPaySuccess(googlePayResult, purchase.originalJson)//支付成功
if (result != null) {
}
} }
override fun onFailure(e: Throwable?, code: String?, errorMsg: String?) { override fun onFailure(e: Throwable?, code: String?, errorMsg: String?) {
EventUtils.onEvent("googlepaysuccess_onfailure", "${errorMsg}") EventUtils.onEvent("googlepaysuccess_onfailure", "${errorMsg}")
mPayCallBack?.onError("服务器同步失败 code:$code msg:$errorMsg")
} }
}) })
//同步成功 消耗掉
consume(purchase)
} }
......
package com.ishin.google.bean package com.zxhl.cms.googlepay
class GooglePayResult { class GooglePayResult {
......
...@@ -2,6 +2,8 @@ package com.zxhl.cms.net.api ...@@ -2,6 +2,8 @@ package com.zxhl.cms.net.api
import com.zxhl.cms.ad.upload.model.Response import com.zxhl.cms.ad.upload.model.Response
import com.zxhl.cms.common.NetConfig import com.zxhl.cms.common.NetConfig
import com.zxhl.cms.googlepay.GooglePayResult
import com.zxhl.cms.net.model.box.AddressEntity
import com.zxhl.cms.net.model.shop.ShopEntity import com.zxhl.cms.net.model.shop.ShopEntity
import io.reactivex.Observable import io.reactivex.Observable
import retrofit2.http.* import retrofit2.http.*
...@@ -16,5 +18,12 @@ interface IShopApi { ...@@ -16,5 +18,12 @@ interface IShopApi {
@Query("category") category: String @Query("category") category: String
): Observable<Response<ShopEntity>> ): Observable<Response<ShopEntity>>
/**
* google支付成功后 通知后台
*/
@POST(NetConfig.User.URL_GOOGLE_NOTIFY)
fun googlePaySuccess(
@Body entity: GooglePayResult?
): Observable<Response<Any>>
} }
\ No newline at end of file
...@@ -2,6 +2,8 @@ package com.zxhl.cms.net.api; ...@@ -2,6 +2,8 @@ package com.zxhl.cms.net.api;
import com.zxhl.cms.ad.upload.model.Response; import com.zxhl.cms.ad.upload.model.Response;
import com.zxhl.cms.common.NetConfig; import com.zxhl.cms.common.NetConfig;
import com.zxhl.cms.googlepay.GooglePayResult;
import com.zxhl.cms.net.model.box.AddressEntity;
import com.zxhl.cms.net.model.other.AnyEntity; import com.zxhl.cms.net.model.other.AnyEntity;
import com.zxhl.cms.net.model.uc.AliPayEntity; import com.zxhl.cms.net.model.uc.AliPayEntity;
import com.zxhl.cms.net.model.uc.GooglePayEntity; import com.zxhl.cms.net.model.uc.GooglePayEntity;
...@@ -14,6 +16,7 @@ import com.zxhl.cms.net.model.uc.WeChatPayEntity; ...@@ -14,6 +16,7 @@ import com.zxhl.cms.net.model.uc.WeChatPayEntity;
import com.zxhl.cms.net.model.video.MemberEntity; import com.zxhl.cms.net.model.video.MemberEntity;
import io.reactivex.Observable; import io.reactivex.Observable;
import retrofit2.http.Body;
import retrofit2.http.GET; import retrofit2.http.GET;
import retrofit2.http.POST; import retrofit2.http.POST;
import retrofit2.http.Query; import retrofit2.http.Query;
...@@ -90,19 +93,6 @@ public interface IUserInfoApi { ...@@ -90,19 +93,6 @@ public interface IUserInfoApi {
@POST(NetConfig.User.URL_PAY_ORDER) @POST(NetConfig.User.URL_PAY_ORDER)
Observable<Response<GooglePayEntity>> googlePay(@Query("goodsId") String goodsId, @Query("payType") String payType, @Query("voucherId") String voucherId, @Query("appId") String appId, @Query("payMode") String payMode); Observable<Response<GooglePayEntity>> googlePay(@Query("goodsId") String goodsId, @Query("payType") String payType, @Query("voucherId") String voucherId, @Query("appId") String appId, @Query("payMode") String payMode);
/**
* google支付成功后 通知后台
*/
@POST(NetConfig.User.URL_GOOGLE_NOTIFY)
Observable<Response<AnyEntity>> googlePaySuccess(
@Query("packageName") String packageName,
@Query("orderId") String orderId,
@Query("productId") String productId,
@Query("developerPayload") String developerPayload,
@Query("obfuscatedAccountid") String obfuscatedAccountid,
@Query("purchaseTime") String purchaseTime,
@Query("purchaseState") String purchaseState,
@Query("purchaseToken") String purchaseToken);
/** /**
* 商城商品支付宝支付 * 商城商品支付宝支付
......
package com.zxhl.cms.net.model.box package com.zxhl.cms.net.model.box
import com.umeng.commonsdk.debug.I
class AppInEntity { class AppInEntity {
var pay_ali: String? = "" var pay_ali: String? = ""
var pay_wx: String? = "" var pay_wx: String? = ""
var pay_google: String = "0"
var pay_paypal: String = "0"
var pay_wx_type: Int? = 0 var pay_wx_type: Int? = 0
var feedback_open: String? = "" var feedback_open: String? = ""
var depots_text: String? = "" var depots_text: String? = ""
......
...@@ -81,14 +81,22 @@ class PayPresenter : PayContract.Presenter { ...@@ -81,14 +81,22 @@ class PayPresenter : PayContract.Presenter {
goodIds: String, goodIds: String,
orderNotes: String orderNotes: String
) { ) {
ApiClient.userInfoAPi.shopwechatPay(goodsId, payType, payMode, addressId, discount,goodIds,orderNotes) ApiClient.userInfoAPi.shopwechatPay(
goodsId,
payType,
payMode,
addressId,
discount,
goodIds,
orderNotes
)
.compose(RxSchedulers.observableIO2Main()) .compose(RxSchedulers.observableIO2Main())
.subscribe(object : BaseObserver<WeChatPayEntity>() { .subscribe(object : BaseObserver<WeChatPayEntity>() {
override fun onSuccess(result: WeChatPayEntity?) { override fun onSuccess(result: WeChatPayEntity?) {
if (result != null) { if (result != null) {
EventUtils.onEvent("member_page_pay_get_order_suc") EventUtils.onEvent("member_page_pay_get_order_suc")
mView?.setOrderNo(result?.outTradeNo) mView?.setOrderNo(result?.outTradeNo)
WeChatPay.startWeChatPay(result,payType) WeChatPay.startWeChatPay(result, payType)
mView?.requestOrderSuc() mView?.requestOrderSuc()
} else { } else {
EventUtils.onEvent("member_page_pay_get_order_fail") EventUtils.onEvent("member_page_pay_get_order_fail")
...@@ -113,7 +121,15 @@ class PayPresenter : PayContract.Presenter { ...@@ -113,7 +121,15 @@ class PayPresenter : PayContract.Presenter {
goodIds: String, goodIds: String,
orderNotes: String orderNotes: String
) { ) {
ApiClient.userInfoAPi.shopaliPay(goodsId, payType, payMode, addressId, discount,goodIds,orderNotes) ApiClient.userInfoAPi.shopaliPay(
goodsId,
payType,
payMode,
addressId,
discount,
goodIds,
orderNotes
)
.compose(RxSchedulers.observableIO2Main()) .compose(RxSchedulers.observableIO2Main())
.subscribe(object : BaseObserver<AliPayEntity>() { .subscribe(object : BaseObserver<AliPayEntity>() {
override fun onSuccess(result: AliPayEntity?) { override fun onSuccess(result: AliPayEntity?) {
...@@ -143,7 +159,7 @@ class PayPresenter : PayContract.Presenter { ...@@ -143,7 +159,7 @@ class PayPresenter : PayContract.Presenter {
EventUtils.onEvent("member_page_pay_get_order_suc") EventUtils.onEvent("member_page_pay_get_order_suc")
mView?.setOrderNo(result?.outTradeNo) mView?.setOrderNo(result?.outTradeNo)
SettingPreference.setOutTradeNo(result?.outTradeNo) SettingPreference.setOutTradeNo(result?.outTradeNo)
WeChatPay.startWeChatProgromPay(result,payType) WeChatPay.startWeChatProgromPay(result, payType)
mView?.requestOrderSuc() mView?.requestOrderSuc()
} else { } else {
EventUtils.onEvent("member_page_pay_get_order_fail") EventUtils.onEvent("member_page_pay_get_order_fail")
...@@ -167,7 +183,7 @@ class PayPresenter : PayContract.Presenter { ...@@ -167,7 +183,7 @@ class PayPresenter : PayContract.Presenter {
if (result != null) { if (result != null) {
EventUtils.onEvent("member_page_pay_get_order_suc") EventUtils.onEvent("member_page_pay_get_order_suc")
mView?.setOrderNo(result?.outTradeNo) mView?.setOrderNo(result?.outTradeNo)
WeChatPay.startWeChatPay(result,payType) WeChatPay.startWeChatPay(result, payType)
mView?.requestOrderSuc() mView?.requestOrderSuc()
} else { } else {
EventUtils.onEvent("member_page_pay_get_order_fail") EventUtils.onEvent("member_page_pay_get_order_fail")
...@@ -227,10 +243,15 @@ class PayPresenter : PayContract.Presenter { ...@@ -227,10 +243,15 @@ class PayPresenter : PayContract.Presenter {
if (!TextUtils.isEmpty(order)) { if (!TextUtils.isEmpty(order)) {
requestVerify(order ?: "", "", payType) requestVerify(order ?: "", "", payType)
} }
}else if(payType==12){ } else if (payType == 12) {
if (!TextUtils.isEmpty(order)) { if (!TextUtils.isEmpty(order)) {
requestVerify(order ?: "", "", payType) requestVerify(order ?: "", "", payType)
} }
} else if (payType == 4) {
val googleJson = JSONObject(order)
val tradeOrder = googleJson.optString("orderId") ?: ""
val outTradeOrder = googleJson.optString("obfuscatedAccountId") ?: ""
requestVerify(outTradeOrder, tradeOrder, payType)
} }
} catch (e: Exception) { } catch (e: Exception) {
mView?.verifyOrderFail() mView?.verifyOrderFail()
...@@ -250,7 +271,6 @@ class PayPresenter : PayContract.Presenter { ...@@ -250,7 +271,6 @@ class PayPresenter : PayContract.Presenter {
} else { } else {
EventUtils.onEvent("member_page_pay_query_order_fail", result.toString()) EventUtils.onEvent("member_page_pay_query_order_fail", result.toString())
mView?.verifyOrderFail() mView?.verifyOrderFail()
} }
} }
......
...@@ -83,7 +83,7 @@ ...@@ -83,7 +83,7 @@
android:background="@drawable/shape_need_price_bg" android:background="@drawable/shape_need_price_bg"
android:gravity="center_vertical" android:gravity="center_vertical"
android:orientation="horizontal" android:orientation="horizontal"
android:visibility="visible"> android:visibility="gone">
<TextView <TextView
android:id="@+id/id_tv_need" android:id="@+id/id_tv_need"
...@@ -130,7 +130,7 @@ ...@@ -130,7 +130,7 @@
android:layout_below="@+id/id_ll_content" android:layout_below="@+id/id_ll_content"
android:background="@drawable/shape_white_r5" android:background="@drawable/shape_white_r5"
android:orientation="vertical"> android:orientation="vertical">
<!--微信-->
<RelativeLayout <RelativeLayout
android:id="@+id/id_rl_wechat_pay" android:id="@+id/id_rl_wechat_pay"
android:layout_width="match_parent" android:layout_width="match_parent"
...@@ -159,7 +159,7 @@ ...@@ -159,7 +159,7 @@
android:layout_marginRight="15dp" android:layout_marginRight="15dp"
android:src="@drawable/icon_xuanzhong_default" /> android:src="@drawable/icon_xuanzhong_default" />
</RelativeLayout> </RelativeLayout>
<!--支付宝-->
<RelativeLayout <RelativeLayout
android:id="@+id/id_rl_zfb_pay" android:id="@+id/id_rl_zfb_pay"
android:layout_width="match_parent" android:layout_width="match_parent"
...@@ -187,6 +187,63 @@ ...@@ -187,6 +187,63 @@
android:layout_marginRight="15dp" android:layout_marginRight="15dp"
android:src="@drawable/icon_xuanzhong_default" /> android:src="@drawable/icon_xuanzhong_default" />
</RelativeLayout> </RelativeLayout>
<!--Google-->
<RelativeLayout
android:id="@+id/id_rl_google_pay"
android:layout_width="match_parent"
android:layout_height="50dp"
android:background="@color/white"
android:visibility="gone">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:layout_marginLeft="15dp"
android:drawableLeft="@drawable/icon_google"
android:drawablePadding="5dp"
android:gravity="center_vertical"
android:text="@string/pay_google"
android:textColor="@color/color_333333"
android:textSize="14sp" />
<ImageView
android:id="@+id/id_img_google"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_centerVertical="true"
android:layout_marginRight="15dp"
android:src="@drawable/icon_xuanzhong_default" />
</RelativeLayout>
<!--PayPal-->
<RelativeLayout
android:id="@+id/id_rl_paypal_pay"
android:layout_width="match_parent"
android:layout_height="50dp"
android:background="@color/white"
android:visibility="gone">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:layout_marginLeft="15dp"
android:drawableLeft="@drawable/zhifub"
android:drawablePadding="5dp"
android:text="@string/pay_paypal"
android:textColor="@color/color_333333"
android:textSize="14sp" />
<ImageView
android:id="@+id/id_img_paypal"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_centerVertical="true"
android:layout_marginRight="15dp"
android:src="@drawable/icon_xuanzhong_default" />
</RelativeLayout>
</LinearLayout> </LinearLayout>
<!-- 支付按钮--> <!-- 支付按钮-->
...@@ -244,7 +301,7 @@ ...@@ -244,7 +301,7 @@
android:layout_marginTop="10dp" android:layout_marginTop="10dp"
android:layout_marginBottom="30dp" android:layout_marginBottom="30dp"
android:gravity="center" android:gravity="center"
android:visibility="visible"> android:visibility="invisible">
<TextView <TextView
android:layout_width="wrap_content" android:layout_width="wrap_content"
...@@ -302,8 +359,9 @@ ...@@ -302,8 +359,9 @@
<com.paypal.checkout.paymentbutton.PayPalButton <com.paypal.checkout.paymentbutton.PayPalButton
android:id="@+id/id_PayPal_btn" android:id="@+id/id_PayPal_btn"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerInParent="true" android:layout_alignParentBottom="true"
android:layout_height="wrap_content"/> android:layout_marginBottom="-100dp"
android:visibility="gone" />
</RelativeLayout> </RelativeLayout>
\ No newline at end of file
...@@ -44,7 +44,7 @@ ...@@ -44,7 +44,7 @@
<string name="recycle_desc2">You can exchange high-value goods</string> <string name="recycle_desc2">You can exchange high-value goods</string>
<string name="empty_trip">Empty,go open some boxes</string> <string name="empty_trip">Empty,go open some boxes</string>
//请选择要发货的商品 //请选择要发货的商品
<string name="select_deliver">Please select the goods you want to deliver</string> <string name="select_deliver">please select the goods to be shipped</string>
//请选择要回收的商品 //请选择要回收的商品
<string name="select_reclaim">Please select the goods you want to reclaim</string> <string name="select_reclaim">Please select the goods you want to reclaim</string>
<string name="recycle_suc">Reclaim successful</string> <string name="recycle_suc">Reclaim successful</string>
...@@ -120,6 +120,8 @@ ...@@ -120,6 +120,8 @@
<string name="pay_button">Top-up</string> <string name="pay_button">Top-up</string>
<string name="pay_wechat">微信支付</string> <string name="pay_wechat">微信支付</string>
<string name="pay_zfb">支付宝支付</string> <string name="pay_zfb">支付宝支付</string>
<string name="pay_google">GooglePay</string>
<string name="pay_paypal">PayPal</string>
<string name="pay_need_desc">Needed:</string> <string name="pay_need_desc">Needed:</string>
<!-- 填写地址--> <!-- 填写地址-->
......
...@@ -40,6 +40,7 @@ ...@@ -40,6 +40,7 @@
android:textColor="@color/color_333333" android:textColor="@color/color_333333"
android:textSize="14sp" /> android:textSize="14sp" />
</RelativeLayout> </RelativeLayout>
<androidx.core.widget.NestedScrollView <androidx.core.widget.NestedScrollView
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
...@@ -186,9 +187,11 @@ ...@@ -186,9 +187,11 @@
android:text="0" android:text="0"
android:textColor="@color/color_333333" /> android:textColor="@color/color_333333" />
</RelativeLayout> </RelativeLayout>
<RelativeLayout <RelativeLayout
android:id="@+id/id_rl_dabaofei" android:id="@+id/id_rl_dabaofei"
android:layout_width="match_parent" android:layout_width="match_parent"
android:visibility="gone"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginTop="10dp"> android:layout_marginTop="10dp">
...@@ -208,7 +211,7 @@ ...@@ -208,7 +211,7 @@
android:textColor="@color/color_333333" /> android:textColor="@color/color_333333" />
</RelativeLayout> </RelativeLayout>
</LinearLayout> </LinearLayout>
<!--微信支付-->
<RelativeLayout <RelativeLayout
android:id="@+id/id_rl_wechat_pay" android:id="@+id/id_rl_wechat_pay"
android:layout_width="match_parent" android:layout_width="match_parent"
...@@ -239,6 +242,7 @@ ...@@ -239,6 +242,7 @@
android:layout_marginRight="15dp" android:layout_marginRight="15dp"
android:src="@drawable/icon_xuanzhong_default" /> android:src="@drawable/icon_xuanzhong_default" />
</RelativeLayout> </RelativeLayout>
<!--支付宝支付-->
<RelativeLayout <RelativeLayout
android:id="@+id/id_rl_zfb_pay" android:id="@+id/id_rl_zfb_pay"
android:layout_width="match_parent" android:layout_width="match_parent"
...@@ -268,6 +272,63 @@ ...@@ -268,6 +272,63 @@
android:layout_marginRight="15dp" android:layout_marginRight="15dp"
android:src="@drawable/icon_xuanzhong_default" /> android:src="@drawable/icon_xuanzhong_default" />
</RelativeLayout> </RelativeLayout>
<!--Google-->
<RelativeLayout
android:id="@+id/id_rl_google_pay"
android:layout_width="match_parent"
android:layout_height="50dp"
android:background="@color/white"
android:visibility="gone">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:layout_marginLeft="15dp"
android:drawableLeft="@drawable/icon_google"
android:drawablePadding="5dp"
android:gravity="center_vertical"
android:text="@string/pay_google"
android:textColor="@color/color_333333"
android:textSize="14sp" />
<ImageView
android:id="@+id/id_img_google"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_centerVertical="true"
android:layout_marginRight="15dp"
android:src="@drawable/icon_xuanzhong_default" />
</RelativeLayout>
<!--PayPal-->
<RelativeLayout
android:id="@+id/id_rl_paypal_pay"
android:layout_width="match_parent"
android:layout_height="50dp"
android:background="@color/white"
android:visibility="gone">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:layout_marginLeft="15dp"
android:drawableLeft="@drawable/zhifub"
android:drawablePadding="5dp"
android:text="@string/pay_paypal"
android:textColor="@color/color_333333"
android:textSize="14sp" />
<ImageView
android:id="@+id/id_img_pay_pal"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_centerVertical="true"
android:layout_marginRight="15dp"
android:src="@drawable/icon_xuanzhong_default" />
</RelativeLayout>
<LinearLayout <LinearLayout
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="104dp" android:layout_height="104dp"
...@@ -299,6 +360,7 @@ ...@@ -299,6 +360,7 @@
</LinearLayout> </LinearLayout>
</androidx.core.widget.NestedScrollView> </androidx.core.widget.NestedScrollView>
<RelativeLayout <RelativeLayout
android:id="@+id/id_rl_order_bottom" android:id="@+id/id_rl_order_bottom"
android:layout_width="match_parent" android:layout_width="match_parent"
...@@ -370,8 +432,8 @@ ...@@ -370,8 +432,8 @@
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_centerInParent="true" android:layout_centerInParent="true"
android:text=""
android:includeFontPadding="false" android:includeFontPadding="false"
android:text=""
android:textColor="@color/color_333333" android:textColor="@color/color_333333"
android:textSize="15sp" /> android:textSize="15sp" />
......
...@@ -99,6 +99,7 @@ ...@@ -99,6 +99,7 @@
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginLeft="20dp" android:layout_marginLeft="20dp"
android:layout_marginRight="20dp" android:layout_marginRight="20dp"
android:gravity="center"
android:text="" android:text=""
android:textColor="@color/color_333333" android:textColor="@color/color_333333"
android:textSize="14sp" /> android:textSize="14sp" />
...@@ -109,6 +110,7 @@ ...@@ -109,6 +110,7 @@
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginLeft="20dp" android:layout_marginLeft="20dp"
android:layout_marginRight="20dp" android:layout_marginRight="20dp"
android:gravity="center"
android:text="" android:text=""
android:textColor="@color/color_666666" android:textColor="@color/color_666666"
android:textSize="14sp" /> android:textSize="14sp" />
...@@ -119,6 +121,9 @@ ...@@ -119,6 +121,9 @@
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginTop="5dp" android:layout_marginTop="5dp"
android:layout_marginBottom="8dp" android:layout_marginBottom="8dp"
android:gravity="center"
android:layout_marginLeft="20dp"
android:layout_marginRight="20dp"
android:text="@string/box_detail_open_box_result_re_pumping_desc" android:text="@string/box_detail_open_box_result_re_pumping_desc"
android:textColor="@color/color_4C84FF" android:textColor="@color/color_4C84FF"
android:textSize="14sp" android:textSize="14sp"
......
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