移除了一些不需要的SDK
This commit is contained in:
@@ -1,70 +0,0 @@
|
||||
{
|
||||
"agcgw":{
|
||||
"backurl":"connect-drcn.dbankcloud.cn",
|
||||
"url":"connect-drcn.hispace.hicloud.com",
|
||||
"websocketbackurl":"connect-ws-drcn.hispace.dbankcloud.cn",
|
||||
"websocketurl":"connect-ws-drcn.hispace.dbankcloud.com"
|
||||
},
|
||||
"agcgw_all":{
|
||||
"CN":"connect-drcn.hispace.hicloud.com",
|
||||
"CN_back":"connect-drcn.dbankcloud.cn",
|
||||
"DE":"connect-dre.hispace.hicloud.com",
|
||||
"DE_back":"connect-dre.dbankcloud.cn",
|
||||
"RU":"connect-drru.hispace.hicloud.com",
|
||||
"RU_back":"connect-drru.dbankcloud.cn",
|
||||
"SG":"connect-dra.hispace.hicloud.com",
|
||||
"SG_back":"connect-dra.dbankcloud.cn"
|
||||
},
|
||||
"client":{
|
||||
"cp_id":"890086000300337421",
|
||||
"product_id":"736430079245711652",
|
||||
"client_id":"625842227532282816",
|
||||
"client_secret":"B23D0CD85C92ADC6676AF6CC8671628F0F155D29A527E7BDF2A53E26F0B5A720",
|
||||
"project_id":"736430079245711652",
|
||||
"app_id":"104321113",
|
||||
"api_key":"CwEAAAAAZgS4/Nw1+/PybMG5CZXzJmlHHHnj0Tp2FOXQG3RtKUdpAsiQiXttqCXlHWA8GdUzGjtnq6oQh2Ogfe8JOs8ihePgJLg=",
|
||||
"package_name":"com.mango.yinyou"
|
||||
},
|
||||
"oauth_client":{
|
||||
"client_id":"104321113",
|
||||
"client_type":1
|
||||
},
|
||||
"app_info":{
|
||||
"app_id":"104321113",
|
||||
"package_name":"com.mango.yinyou"
|
||||
},
|
||||
"service":{
|
||||
"analytics":{
|
||||
"collector_url":"datacollector-drcn.dt.hicloud.com,datacollector-drcn.dt.dbankcloud.cn",
|
||||
"resource_id":"p1",
|
||||
"channel_id":""
|
||||
},
|
||||
"search":{
|
||||
"url":"https://search-drcn.cloud.huawei.com"
|
||||
},
|
||||
"cloudstorage":{
|
||||
"storage_url":"https://agc-storage-drcn.platform.dbankcloud.cn"
|
||||
},
|
||||
"ml":{
|
||||
"mlservice_url":"ml-api-drcn.ai.dbankcloud.com,ml-api-drcn.ai.dbankcloud.cn"
|
||||
}
|
||||
},
|
||||
"region":"CN",
|
||||
"configuration_version":"3.0",
|
||||
"appInfos":[
|
||||
{
|
||||
"package_name":"com.mango.yinyou",
|
||||
"client":{
|
||||
"app_id":"104321113"
|
||||
},
|
||||
"app_info":{
|
||||
"package_name":"com.mango.yinyou",
|
||||
"app_id":"104321113"
|
||||
},
|
||||
"oauth_client":{
|
||||
"client_type":1,
|
||||
"client_id":"104321113"
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -1,9 +1,6 @@
|
||||
apply plugin: 'com.android.application'
|
||||
|
||||
apply plugin: 'com.android.application'
|
||||
apply plugin: 'kotlin-android'
|
||||
apply plugin: 'kotlin-android-extensions'
|
||||
apply plugin: 'com.huawei.agconnect'
|
||||
apply plugin: 'com.tencent.vasdolly'
|
||||
apply from: '../mob.gradle'
|
||||
|
||||
@@ -234,16 +231,7 @@ dependencies {
|
||||
|
||||
implementation 'it.sephiroth.android.library.imagezoom:library:1.0.4'
|
||||
|
||||
// 易盾一键登录
|
||||
implementation 'io.github.yidun:quicklogin:3.1.8'
|
||||
|
||||
implementation 'com.github.fodroid:XRadioGroup:v1.5'
|
||||
//华为推送
|
||||
implementation 'com.huawei.hms:push:6.5.0.300'
|
||||
//魅族推送
|
||||
implementation 'com.meizu.flyme.internet:push-internal:4.1.0'
|
||||
//oppo推送需要
|
||||
implementation 'commons-codec:commons-codec:1.6'
|
||||
|
||||
api 'com.tencent.vasdolly:helper:3.0.3'
|
||||
implementation "io.github.tencent:vap:2.0.24"
|
||||
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -172,173 +172,12 @@
|
||||
</receiver>
|
||||
<receiver android:name=".reciever.NotificationClickReceiver" /> <!-- 云信进程间通信provider -->
|
||||
|
||||
<!-- 云信集成oppo推送 start -->
|
||||
<service
|
||||
android:name="com.netease.nimlib.mixpush.oppo.OppoPushService"
|
||||
android:exported="true"
|
||||
android:permission="com.coloros.mcs.permission.SEND_MCS_MESSAGE">
|
||||
<intent-filter>
|
||||
<action android:name="com.coloros.mcs.action.RECEIVE_MCS_MESSAGE" />
|
||||
</intent-filter>
|
||||
</service>
|
||||
<service
|
||||
android:name="com.netease.nimlib.mixpush.oppo.OppoAppPushService"
|
||||
android:exported="true"
|
||||
android:permission="com.heytap.mcs.permission.SEND_MCS_MESSAGE">
|
||||
<intent-filter>
|
||||
<action android:name="com.heytap.mcs.action.RECEIVE_MCS_MESSAGE" />
|
||||
</intent-filter>
|
||||
</service>
|
||||
|
||||
<service
|
||||
android:name=".push.OppoPushService"
|
||||
android:exported="true"
|
||||
android:permission="com.coloros.mcs.permission.SEND_MCS_MESSAGE">
|
||||
<intent-filter>
|
||||
<action android:name="com.coloros.mcs.action.RECEIVE_MCS_MESSAGE" />
|
||||
</intent-filter>
|
||||
</service>
|
||||
<!-- 云信集成oppo推送 end -->
|
||||
|
||||
<!-- 云信集成华为推送 start -->
|
||||
<service
|
||||
android:name="com.netease.nimlib.mixpush.hw.HWPushService"
|
||||
android:exported="false">
|
||||
<intent-filter>
|
||||
<action android:name="com.huawei.push.action.MESSAGING_EVENT" />
|
||||
</intent-filter>
|
||||
</service>
|
||||
<!-- 云信集成华为推送 end -->
|
||||
|
||||
<!-- 云信集成小米推送 start -->
|
||||
<!-- 配置的service和receiver -->
|
||||
|
||||
<provider
|
||||
android:name="com.netease.nimlib.ipc.NIMContentProvider"
|
||||
android:authorities="${applicationId}.ipc.provider"
|
||||
android:process=":core" /> <!-- 配置的service和receiver -->
|
||||
<service
|
||||
android:name="com.xiaomi.push.service.XMPushService"
|
||||
android:enabled="true"
|
||||
android:process=":mixpush" />
|
||||
<service
|
||||
android:name="com.xiaomi.push.service.XMJobService"
|
||||
android:enabled="true"
|
||||
android:permission="android.permission.BIND_JOB_SERVICE"
|
||||
android:process=":mixpush" /> <!-- 注:此service必须在3.0.1版本以后(包括3.0.1版本)加入 -->
|
||||
<service android:name="com.xiaomi.mipush.sdk.PushMessageHandler" />
|
||||
<service
|
||||
android:name="com.xiaomi.mipush.sdk.MessageHandleService"
|
||||
android:enabled="true" /> <!-- 注:此service必须在2.2.5版本以后(包括2.2.5版本)加入 -->
|
||||
<receiver
|
||||
android:name="com.xiaomi.push.service.receivers.NetworkStatusReceiver"
|
||||
android:exported="true">
|
||||
<intent-filter>
|
||||
<action android:name="android.net.conn.CONNECTIVITY_CHANGE" />
|
||||
|
||||
<category android:name="android.intent.category.DEFAULT" />
|
||||
</intent-filter>
|
||||
</receiver>
|
||||
<receiver
|
||||
android:name="com.xiaomi.push.service.receivers.PingReceiver"
|
||||
android:exported="false"
|
||||
android:process=":mixpush">
|
||||
<intent-filter>
|
||||
<action android:name="com.xiaomi.push.PING_TIMER" />
|
||||
</intent-filter>
|
||||
</receiver>
|
||||
<receiver
|
||||
android:name="com.netease.nimlib.mixpush.mi.MiPushReceiver"
|
||||
android:exported="false">
|
||||
<intent-filter android:priority="0x7fffffff">
|
||||
<action android:name="com.xiaomi.mipush.RECEIVE_MESSAGE" />
|
||||
<action android:name="com.xiaomi.mipush.MESSAGE_ARRIVED" />
|
||||
<action android:name="com.xiaomi.mipush.ERROR" />
|
||||
</intent-filter>
|
||||
</receiver>
|
||||
<receiver
|
||||
android:name=".push.MiPushReceiver"
|
||||
android:exported="false">
|
||||
<intent-filter>
|
||||
<action android:name="com.xiaomi.mipush.RECEIVE_MESSAGE" />
|
||||
<action android:name="com.xiaomi.mipush.MESSAGE_ARRIVED" />
|
||||
<action android:name="com.xiaomi.mipush.ERROR" />
|
||||
</intent-filter>
|
||||
</receiver> <!-- 云信集成小米推送 end -->
|
||||
|
||||
|
||||
<!-- 云信继承vivo推送 start-->
|
||||
<activity
|
||||
android:name="com.vivo.push.sdk.LinkProxyClientActivity"
|
||||
android:screenOrientation="portrait"
|
||||
android:theme="@android:style/Theme.Translucent.NoTitleBar" />
|
||||
<receiver
|
||||
android:name="com.netease.nimlib.mixpush.vivo.VivoPushReceiver"
|
||||
android:exported="false">
|
||||
<intent-filter>
|
||||
<!-- 接收 push 消息 -->
|
||||
<action android:name="com.vivo.pushclient.action.RECEIVE" />
|
||||
</intent-filter>
|
||||
</receiver>
|
||||
|
||||
<meta-data
|
||||
android:name="com.vivo.push.api_key"
|
||||
android:value="e9f2d1e70ff06164d4269381e1a90ca0" />
|
||||
<meta-data
|
||||
android:name="com.vivo.push.app_id"
|
||||
android:value="105482750" />
|
||||
<!-- 云信集成vivo推送 end -->
|
||||
|
||||
|
||||
<!-- 云信集成魅族推送 start -->
|
||||
<!-- 配置的service和receiver -->
|
||||
<receiver
|
||||
android:name="com.netease.nimlib.mixpush.mz.MZPushReceiver"
|
||||
android:exported="false">
|
||||
<intent-filter android:priority="0x7fffffff">
|
||||
|
||||
<!-- 接收push消息 -->
|
||||
<action android:name="com.meizu.flyme.push.intent.MESSAGE" />
|
||||
<!-- 接收register消息 -->
|
||||
<action android:name="com.meizu.flyme.push.intent.REGISTER.FEEDBACK" />
|
||||
<!-- 接收unregister消息 -->
|
||||
<action android:name="com.meizu.flyme.push.intent.UNREGISTER.FEEDBACK" />
|
||||
<!-- 兼容低版本Flyme3推送服务配置 -->
|
||||
<action android:name="com.meizu.c2dm.intent.REGISTRATION" />
|
||||
<action android:name="com.meizu.c2dm.intent.RECEIVE" />
|
||||
|
||||
<category android:name="${applicationId}" />
|
||||
</intent-filter>
|
||||
</receiver>
|
||||
<receiver
|
||||
android:name=".push.MeizuPushReceiver"
|
||||
android:exported="false">
|
||||
<intent-filter>
|
||||
<action android:name="com.meizu.flyme.push.intent.MESSAGE" />
|
||||
<action android:name="com.meizu.flyme.push.intent.REGISTER.FEEDBACK" />
|
||||
<action android:name="com.meizu.flyme.push.intent.UNREGISTER.FEEDBACK" />
|
||||
</intent-filter>
|
||||
</receiver>
|
||||
<!-- 云信集成魅族推送 end -->
|
||||
|
||||
<!-- 云信配置 end ##################################################### -->
|
||||
<!-- <!– 安卓保活配置 –> -->
|
||||
<!-- <service -->
|
||||
<!-- android:name="com.netease.cosine.core.CosineService" -->
|
||||
<!-- android:process=":cosine" /> -->
|
||||
<!-- <receiver -->
|
||||
<!-- android:name="com.netease.cosine.target.CosineReceiver" -->
|
||||
<!-- android:exported="true" -->
|
||||
<!-- android:process=":cosine" /> -->
|
||||
<!-- <meta-data -->
|
||||
<!-- android:name="com.netease.cosine.target" -->
|
||||
<!-- android:value="" /> -->
|
||||
<!-- <meta-data -->
|
||||
<!-- android:name="com.netease.cosine.target.receiver" -->
|
||||
<!-- android:value="com.netease.nimlib.service.NimReceiver" /> -->
|
||||
<!-- 云信#####################################################配置 -->
|
||||
<!-- autolayout####################################################配置 -->
|
||||
<!--Vivo Push需要配置的service、activity-->
|
||||
<!--配置的service, activity, receiver-->
|
||||
|
||||
<meta-data
|
||||
android:name="design_width"
|
||||
@@ -348,11 +187,6 @@
|
||||
android:value="1280" />
|
||||
<!-- Autolayout####################################################配置 -->
|
||||
|
||||
<!-- LinkedMe ####################################################配置 -->
|
||||
<!-- <meta-data-->
|
||||
<!-- android:name="linkedme.sdk.key"-->
|
||||
<!-- android:value="978cd79c98264f836450afda1228762e" /> <!– LinkedMe####################################################配置 –>-->
|
||||
<!-- TakePhoto申明 -->
|
||||
<activity
|
||||
android:name="com.soundcloud.android.crop.CropImageActivity"
|
||||
android:screenOrientation="portrait" /> <!-- tinker配置 begin ########################################################## -->
|
||||
@@ -364,39 +198,7 @@
|
||||
android:name="android.support.FILE_PROVIDER_PATHS"
|
||||
android:resource="@xml/provider_paths" />
|
||||
</provider> <!-- 支付宝支付需要注册 -->
|
||||
<!-- 注释这个声明,禁用支付宝h5支付 -->
|
||||
<activity
|
||||
android:name="com.alipay.sdk.app.H5PayActivity"
|
||||
android:configChanges="orientation|keyboardHidden|navigation|screenSize"
|
||||
android:screenOrientation="behind"
|
||||
android:windowSoftInputMode="adjustResize|stateHidden" />
|
||||
|
||||
<activity
|
||||
android:name=".push.HWPushMiddleActivity"
|
||||
android:exported="true">
|
||||
<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="com.huawei.codelabpush"
|
||||
android:path="/deeplink"
|
||||
android:scheme="yinyoupushscheme" />
|
||||
</intent-filter>
|
||||
</activity>
|
||||
|
||||
<activity
|
||||
android:name="com.tencent.bugly.beta.ui.BetaActivity"
|
||||
android:configChanges="keyboardHidden|orientation|screenSize|locale"
|
||||
android:theme="@android:style/Theme.Translucent" />
|
||||
|
||||
<activity
|
||||
android:name="com.alipay.sdk.auth.AuthActivity"
|
||||
android:configChanges="orientation|keyboardHidden|navigation"
|
||||
android:screenOrientation="behind"
|
||||
android:windowSoftInputMode="adjustResize|stateHidden" />
|
||||
<activity
|
||||
android:name="com.yizhuan.xchat_android_core.pay.PaymentActivity"
|
||||
android:launchMode="singleTask"
|
||||
@@ -527,14 +329,6 @@
|
||||
android:name=".ui.keepalive.OnePiexlActivity"
|
||||
android:screenOrientation="portrait"
|
||||
android:theme="@style/OnePixelActivity" />
|
||||
<activity
|
||||
android:name=".MiddleActivity"
|
||||
android:noHistory="true"
|
||||
android:screenOrientation="portrait">
|
||||
<meta-data
|
||||
android:name="linkedme.sdk.auto_link_keys"
|
||||
android:value="linkedme" />
|
||||
</activity>
|
||||
<activity
|
||||
android:name=".NimMiddleActivity"
|
||||
android:noHistory="true"
|
||||
@@ -1160,11 +954,6 @@
|
||||
<activity
|
||||
android:name=".ui.webview.TarotPayWebViewActivity"
|
||||
android:theme="@style/dialog_web_view_activity" />
|
||||
<!-- Fix bug Only fullscreen opaque activities can request orientation -->
|
||||
<activity
|
||||
android:name="com.sdk.base.module.permission.PermissionActivity"
|
||||
android:theme="@android:style/Theme.Translucent.NoTitleBar"
|
||||
tools:remove="android:screenOrientation" />
|
||||
<activity
|
||||
android:name=".ui.login.LoginPasswordActivity"
|
||||
android:screenOrientation="portrait" />
|
||||
|
@@ -1,77 +0,0 @@
|
||||
package com.yizhuan.erban;
|
||||
|
||||
import android.os.Bundle;
|
||||
import android.util.Log;
|
||||
|
||||
import com.microquation.linkedme.android.LinkedME;
|
||||
import com.microquation.linkedme.android.util.LinkProperties;
|
||||
import com.netease.nim.uikit.common.util.log.LogUtil;
|
||||
import com.yizhuan.erban.base.BaseActivity;
|
||||
import com.yizhuan.xchat_android_core.linked.LinkedModel;
|
||||
import com.yizhuan.xchat_android_core.linked.bean.LinkedInfo;
|
||||
|
||||
import java.util.HashMap;
|
||||
|
||||
/**
|
||||
* Created by chenran on 2017/8/5.
|
||||
*/
|
||||
|
||||
public class MiddleActivity extends BaseActivity {
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
if (getIntent() != null) {
|
||||
//获取与深度链接相关的值
|
||||
LinkProperties linkProperties = getIntent().getParcelableExtra(LinkedME.LM_LINKPROPERTIES);
|
||||
if (linkProperties != null) {
|
||||
Log.i("LinkedME-Demo", "Channel " + linkProperties.getChannel());
|
||||
Log.i("LinkedME-Demo", "control params " + linkProperties.getControlParams());
|
||||
Log.i("LinkedME-Demo", "link(深度链接) " + linkProperties.getLMLink());
|
||||
Log.i("LinkedME-Demo", "是否为新安装 " + linkProperties.isLMNewUser());
|
||||
//获取自定义参数封装成的hashmap对象,参数键值对由集成方定义
|
||||
|
||||
HashMap<String, String> hashMap = linkProperties.getControlParams();
|
||||
LogUtil.print("linkedme", hashMap);
|
||||
//根据key获取传入的参数的值,该key关键字View可为任意值,由集成方规定,请与web端商议,一致即可
|
||||
LinkedInfo linkedInfo = new LinkedInfo();
|
||||
linkedInfo.setNewUser(linkProperties.isLMNewUser());
|
||||
String roomuid = hashMap.get("roomuid");
|
||||
String uid = hashMap.get("uid");
|
||||
String channel = hashMap.get("linkedmeChannel");
|
||||
String type = hashMap.get("type");
|
||||
String familyId = hashMap.get("familyId");
|
||||
String url = hashMap.get("url");
|
||||
String worldId = hashMap.get("worldId");
|
||||
String dynamicId = hashMap.get("dynamicId");
|
||||
String inviteCode = hashMap.get("inviteCode");
|
||||
if (roomuid != null) {
|
||||
linkedInfo.setRoomUid(roomuid);
|
||||
}
|
||||
if (uid != null) {
|
||||
linkedInfo.setUid(uid);
|
||||
}
|
||||
if (type != null) {
|
||||
linkedInfo.setType(type);
|
||||
}
|
||||
if (familyId != null) {
|
||||
linkedInfo.setFamilyId(familyId);
|
||||
}
|
||||
if (url != null) {
|
||||
linkedInfo.setUrl(url);
|
||||
}
|
||||
if (worldId != null) {
|
||||
linkedInfo.setWorldId(worldId);
|
||||
}
|
||||
if (dynamicId != null) {
|
||||
linkedInfo.setDynamicId(dynamicId);
|
||||
}
|
||||
|
||||
linkedInfo.setInviteCode(inviteCode);
|
||||
|
||||
LinkedModel.get().setLinkedInfo(linkedInfo);
|
||||
}
|
||||
}
|
||||
finish();
|
||||
}
|
||||
}
|
@@ -13,7 +13,6 @@ import com.yizhuan.xchat_android_core.activity.bean.LotteryInfo;
|
||||
import com.yizhuan.xchat_android_core.level.event.CharmLevelUpEvent;
|
||||
import com.yizhuan.xchat_android_core.level.event.LevelUpEvent;
|
||||
import com.yizhuan.xchat_android_core.manager.AvRoomDataManager;
|
||||
import com.yizhuan.xchat_android_core.pay.bean.ShowCommonWebEvent;
|
||||
import com.yizhuan.xchat_android_core.pay.event.NewUserChargeEvent;
|
||||
import com.yizhuan.xchat_android_core.recall.bean.CheckLostUserInfo;
|
||||
import com.yizhuan.xchat_android_core.recall.event.CheckLostUserEvent;
|
||||
@@ -94,11 +93,6 @@ public class GlobalHandleManager {
|
||||
new NewUserChargePrizeDialog(activity, event.getChargeProdTitle(), event.getFirstChargeRewardList()).openDialog();
|
||||
}
|
||||
|
||||
@Subscribe(threadMode = ThreadMode.MAIN)
|
||||
public void onShowCommonWebEvent(ShowCommonWebEvent event) {
|
||||
CommonWebViewActivity.start(event.getContext(), event.getUrl());
|
||||
}
|
||||
|
||||
@Subscribe(threadMode = ThreadMode.MAIN)
|
||||
public void onReceiveRecallStatus(CheckLostUserEvent event) {
|
||||
Activity activity = getActivity();
|
||||
|
@@ -1,18 +1,5 @@
|
||||
package com.yizhuan.erban.application;
|
||||
|
||||
import static com.yizhuan.xchat_android_constants.XChatConstants.HW_APP_ID;
|
||||
import static com.yizhuan.xchat_android_constants.XChatConstants.HW_CERTIFICATE_NAME;
|
||||
import static com.yizhuan.xchat_android_constants.XChatConstants.MZ_APP_ID;
|
||||
import static com.yizhuan.xchat_android_constants.XChatConstants.MZ_APP_KEY;
|
||||
import static com.yizhuan.xchat_android_constants.XChatConstants.MZ_CERTIFICATE_NAME;
|
||||
import static com.yizhuan.xchat_android_constants.XChatConstants.OPPO_APP_ID;
|
||||
import static com.yizhuan.xchat_android_constants.XChatConstants.OPPO_APP_KEY;
|
||||
import static com.yizhuan.xchat_android_constants.XChatConstants.OPPO_CERTIFICATE_NAME;
|
||||
import static com.yizhuan.xchat_android_constants.XChatConstants.OPPO_SECRET;
|
||||
import static com.yizhuan.xchat_android_constants.XChatConstants.VIVO_CERTIFICATE_NAME;
|
||||
import static com.yizhuan.xchat_android_constants.XChatConstants.XM_APP_ID;
|
||||
import static com.yizhuan.xchat_android_constants.XChatConstants.XM_APP_KEY;
|
||||
import static com.yizhuan.xchat_android_constants.XChatConstants.XM_CERTIFICATE_NAME;
|
||||
import static com.yizhuan.xchat_android_core.im.custom.bean.CustomAttachment.CUSTOM_MSG_HEADER_TYPE_OPEN_ROOM_NOTI;
|
||||
|
||||
import android.annotation.SuppressLint;
|
||||
@@ -30,13 +17,9 @@ import android.util.Log;
|
||||
import androidx.multidex.MultiDex;
|
||||
|
||||
import com.bumptech.glide.request.target.ViewTarget;
|
||||
import com.bytedance.hume.readapk.HumeSDK;
|
||||
import com.coorchice.library.utils.LogUtils;
|
||||
import com.heytap.msp.push.HeytapPushManager;
|
||||
import com.hjq.toast.ToastUtils;
|
||||
import com.huawei.hms.support.common.ActivityMgr;
|
||||
import com.llew.huawei.verifier.LoadedApkHuaWei;
|
||||
import com.microquation.linkedme.android.LinkedME;
|
||||
import com.mob.MobSDK;
|
||||
import com.netease.nim.uikit.api.NimUIKit;
|
||||
import com.netease.nim.uikit.common.util.log.LogUtil;
|
||||
@@ -61,7 +44,6 @@ import com.tencent.vasdolly.helper.ChannelReaderUtil;
|
||||
import com.umeng.analytics.MobclickAgent;
|
||||
import com.umeng.commonsdk.UMConfigure;
|
||||
import com.yizhuan.erban.BuildConfig;
|
||||
import com.yizhuan.erban.MiddleActivity;
|
||||
import com.yizhuan.erban.NimMiddleActivity;
|
||||
import com.yizhuan.erban.R;
|
||||
import com.yizhuan.erban.module_hall.HallDataManager;
|
||||
@@ -204,7 +186,6 @@ public class XChatApplication extends Application {
|
||||
isInitOtherSDK = true;
|
||||
Context context = BasicConfig.INSTANCE.getAppContext();
|
||||
Application application = (Application) context.getApplicationContext();
|
||||
HeytapPushManager.init(context, false);
|
||||
// 初始化 sp
|
||||
long startTime = System.currentTimeMillis();
|
||||
|
||||
@@ -216,18 +197,10 @@ public class XChatApplication extends Application {
|
||||
|
||||
BasicConfig.INSTANCE.setOriginalChannel(channel);
|
||||
|
||||
//头条分包渠道
|
||||
if (BasicConfig.INSTANCE.isByteDanceChannel()) {
|
||||
String byteDanceChannel = HumeSDK.getChannel(context);
|
||||
if (!TextUtils.isEmpty(byteDanceChannel)) {
|
||||
channel = byteDanceChannel;
|
||||
}
|
||||
}
|
||||
BasicConfig.INSTANCE.setChannel(channel);
|
||||
|
||||
initEnv();
|
||||
|
||||
ActivityMgr.INST.init((Application) context);
|
||||
//延迟初始化云信
|
||||
NIMClient.init(context, null, options());
|
||||
|
||||
@@ -282,7 +255,6 @@ public class XChatApplication extends Application {
|
||||
registerActivityLifecycleCallback(lifeManager);
|
||||
dealHuaWeiCrash();
|
||||
initLinkedMe();
|
||||
LinkedME.getInstance().setImmediate(true);
|
||||
MobSDK.init(context);
|
||||
MobSDK.submitPolicyGrantResult(true);
|
||||
// 友盟统计初始化
|
||||
@@ -307,15 +279,7 @@ public class XChatApplication extends Application {
|
||||
* 初始化linkedMe
|
||||
*/
|
||||
private static void initLinkedMe() {
|
||||
LinkedME.getInstance(BasicConfig.INSTANCE.getAppContext(), XChatConstants.LINKED_ME_KEY);
|
||||
if (isDebug()) {
|
||||
//设置debug模式下打印LinkedME日志
|
||||
LinkedME.getInstance().setDebug();
|
||||
}
|
||||
//初始时请设置为false
|
||||
LinkedME.getInstance().setImmediate(false);
|
||||
//设置处理跳转逻辑的中转页,MiddleActivity详见后续配置
|
||||
LinkedME.getInstance().setHandleActivity(MiddleActivity.class.getName());
|
||||
|
||||
}
|
||||
|
||||
private static void initEnv() {
|
||||
@@ -402,24 +366,8 @@ public class XChatApplication extends Application {
|
||||
DemoCache.setNotificationConfig(config);
|
||||
|
||||
MixPushConfig mixPushConfig = new MixPushConfig();
|
||||
//华为推送
|
||||
mixPushConfig.hwAppId = HW_APP_ID;
|
||||
mixPushConfig.hwCertificateName = HW_CERTIFICATE_NAME;
|
||||
//小米推送
|
||||
mixPushConfig.xmAppId = XM_APP_ID;
|
||||
mixPushConfig.xmAppKey = XM_APP_KEY;
|
||||
mixPushConfig.xmCertificateName = XM_CERTIFICATE_NAME;
|
||||
//魅族推送
|
||||
mixPushConfig.mzAppId = MZ_APP_ID;
|
||||
mixPushConfig.mzAppKey = MZ_APP_KEY;
|
||||
mixPushConfig.mzCertificateName = MZ_CERTIFICATE_NAME;
|
||||
//vivo推送
|
||||
mixPushConfig.vivoCertificateName = VIVO_CERTIFICATE_NAME;
|
||||
//oppo推送
|
||||
mixPushConfig.oppoAppId = OPPO_APP_ID;
|
||||
mixPushConfig.oppoAppKey = OPPO_APP_KEY;
|
||||
mixPushConfig.oppoAppSercet = OPPO_SECRET;
|
||||
mixPushConfig.oppoCertificateName = OPPO_CERTIFICATE_NAME;
|
||||
|
||||
|
||||
options.mixPushConfig = mixPushConfig;
|
||||
|
||||
return options;
|
||||
|
@@ -29,12 +29,9 @@ import com.yizhuan.erban.ui.webview.CommonWebViewActivity
|
||||
import com.yizhuan.xchat_android_core.UriProvider
|
||||
import com.yizhuan.xchat_android_core.auth.AuthModel
|
||||
import com.yizhuan.xchat_android_core.pay.PayModel
|
||||
import com.yizhuan.xchat_android_core.pay.PaymentActivity
|
||||
import com.yizhuan.xchat_android_core.pay.bean.FirstChargeGoods
|
||||
import com.yizhuan.xchat_android_core.pay.bean.FirstChargeReward
|
||||
import com.yizhuan.xchat_android_core.pay.bean.PaymentResult
|
||||
import com.yizhuan.xchat_android_core.pay.event.FirstChargeEvent
|
||||
import com.yizhuan.xchat_android_core.pay.model.unionpay.UnionPayModel
|
||||
import com.yizhuan.xchat_android_core.utils.toast
|
||||
import com.yizhuan.xchat_android_library.annatation.ActLayoutRes
|
||||
import com.yizhuan.xchat_android_library.utils.JavaUtil
|
||||
@@ -206,43 +203,6 @@ class FirstChargeDialog : BaseViewBindingActivity<DialogFirstChargeBinding>() {
|
||||
if (resultCode != RESULT_OK) {
|
||||
return
|
||||
}
|
||||
//支付页面返回处理
|
||||
if (requestCode == PaymentActivity.REQUEST_CODE_PAY) {
|
||||
if (data != null && data.extras != null) {
|
||||
val paymentResult: PaymentResult? =
|
||||
data.getParcelableExtra(PaymentActivity.KEY_PAY_RESULT)
|
||||
if (paymentResult != null) {
|
||||
// 充值金额超过限定时,就必须先实名认证
|
||||
when (JavaUtil.str2int(paymentResult.code)) {
|
||||
PayModel.NOT_REAL_NAME_BEFORE_CHARGING -> dialogManager.showTipsDialog(
|
||||
getString(R.string.tips_need_to_certification),
|
||||
getString(R.string.go_to_certification),
|
||||
object : AbsOkDialogListener() {
|
||||
override fun onOk() {
|
||||
// 跳去实名认证页面
|
||||
CommonWebViewActivity.start(
|
||||
this@FirstChargeDialog,
|
||||
UriProvider.getTutuRealNamePage()
|
||||
)
|
||||
}
|
||||
})
|
||||
UnionPayModel.CODE_NEED_BIND_BANK_CARD_FIRST -> dialogManager.showTipsDialog(
|
||||
getString(R.string.tips_need_bind_bank_card_first),
|
||||
object : AbsOkDialogListener() {
|
||||
override fun onOk() {
|
||||
// 跳去添加银行卡页面
|
||||
AddBankCardAgreementActivity.start(this@FirstChargeDialog)
|
||||
}
|
||||
})
|
||||
else -> {
|
||||
toast(paymentResult.msg)
|
||||
//重新获取钱包信息
|
||||
PayModel.get().getWalletInfo(AuthModel.get().currentUid).subscribe()
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (requestCode == BIND_CODE_GOLD) {
|
||||
ModifyPwdActivity.start(this, ModifyPwdActivity.FOGERT_PAY_PWD)
|
||||
}
|
||||
|
@@ -11,7 +11,6 @@ import com.yizhuan.erban.databinding.DialogSelectPayTypeBinding
|
||||
import com.yizhuan.erban.ui.pay.ChargeActivity
|
||||
import com.yizhuan.xchat_android_core.Constants
|
||||
import com.yizhuan.xchat_android_core.pay.PayModel
|
||||
import com.yizhuan.xchat_android_core.pay.PaymentActivity
|
||||
import com.yizhuan.xchat_android_core.pay.bean.WalletInfo
|
||||
import com.yizhuan.xchat_android_library.annatation.ActLayoutRes
|
||||
import com.yizhuan.xchat_android_library.utils.SingleToastUtil
|
||||
@@ -64,11 +63,6 @@ class SelectPayTypeDialog : BaseDialog<DialogSelectPayTypeBinding>() {
|
||||
SingleToastUtil.showToast("数据初始化中,请稍后~")
|
||||
return@setOnClickListener
|
||||
}
|
||||
if (binding.rbAlipay.isChecked) {
|
||||
PaymentActivity.start(requireActivity(), Constants.CHARGE_ALIPAY, chargeProdId)
|
||||
} else {
|
||||
PaymentActivity.start(requireActivity(), Constants.CHARGE_WX, chargeProdId)
|
||||
}
|
||||
dismissAllowingStateLoss()
|
||||
}
|
||||
|
||||
|
@@ -21,7 +21,6 @@ import com.yizhuan.erban.R
|
||||
import com.yizhuan.erban.avroom.firstcharge.SelectPayTypeDialog
|
||||
import com.yizhuan.erban.bank_card.activity.AddBankCardAgreementActivity
|
||||
import com.yizhuan.erban.base.BaseViewBindingActivity
|
||||
import com.yizhuan.erban.common.widget.dialog.DialogManager
|
||||
import com.yizhuan.erban.common.widget.dialog.DialogManager.AbsOkDialogListener
|
||||
import com.yizhuan.erban.databinding.DialogNewUserChargeGiftBinding
|
||||
import com.yizhuan.erban.ui.setting.ModifyPwdActivity
|
||||
@@ -30,12 +29,9 @@ import com.yizhuan.erban.ui.webview.CommonWebViewActivity
|
||||
import com.yizhuan.xchat_android_core.UriProvider
|
||||
import com.yizhuan.xchat_android_core.auth.AuthModel
|
||||
import com.yizhuan.xchat_android_core.pay.PayModel
|
||||
import com.yizhuan.xchat_android_core.pay.PaymentActivity
|
||||
import com.yizhuan.xchat_android_core.pay.bean.FirstChargeGoods
|
||||
import com.yizhuan.xchat_android_core.pay.bean.FirstChargeReward
|
||||
import com.yizhuan.xchat_android_core.pay.bean.PaymentResult
|
||||
import com.yizhuan.xchat_android_core.pay.event.NewUserChargeEvent
|
||||
import com.yizhuan.xchat_android_core.pay.model.unionpay.UnionPayModel
|
||||
import com.yizhuan.xchat_android_core.statistic.StatisticManager
|
||||
import com.yizhuan.xchat_android_core.statistic.protocol.StatisticsProtocol
|
||||
import com.yizhuan.xchat_android_core.user.UserModel
|
||||
@@ -192,43 +188,6 @@ class NewUserChargeGiftDialog : BaseViewBindingActivity<DialogNewUserChargeGiftB
|
||||
if (resultCode != RESULT_OK) {
|
||||
return
|
||||
}
|
||||
//支付页面返回处理
|
||||
if (requestCode == PaymentActivity.REQUEST_CODE_PAY) {
|
||||
if (data != null && data.extras != null) {
|
||||
val paymentResult: PaymentResult? =
|
||||
data.getParcelableExtra(PaymentActivity.KEY_PAY_RESULT)
|
||||
if (paymentResult != null) {
|
||||
// 充值金额超过限定时,就必须先实名认证
|
||||
when (JavaUtil.str2int(paymentResult.code)) {
|
||||
PayModel.NOT_REAL_NAME_BEFORE_CHARGING -> dialogManager.showTipsDialog(
|
||||
getString(R.string.tips_need_to_certification),
|
||||
getString(R.string.go_to_certification),
|
||||
object : AbsOkDialogListener() {
|
||||
override fun onOk() {
|
||||
// 跳去实名认证页面
|
||||
CommonWebViewActivity.start(
|
||||
this@NewUserChargeGiftDialog,
|
||||
UriProvider.getTutuRealNamePage()
|
||||
)
|
||||
}
|
||||
})
|
||||
UnionPayModel.CODE_NEED_BIND_BANK_CARD_FIRST -> dialogManager.showTipsDialog(
|
||||
getString(R.string.tips_need_bind_bank_card_first),
|
||||
object : AbsOkDialogListener() {
|
||||
override fun onOk() {
|
||||
// 跳去添加银行卡页面
|
||||
AddBankCardAgreementActivity.start(this@NewUserChargeGiftDialog)
|
||||
}
|
||||
})
|
||||
else -> {
|
||||
toast(paymentResult.msg)
|
||||
//重新获取钱包信息
|
||||
PayModel.get().getWalletInfo(AuthModel.get().currentUid).subscribe()
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (requestCode == BIND_CODE_GOLD) {
|
||||
ModifyPwdActivity.start(this, ModifyPwdActivity.FOGERT_PAY_PWD)
|
||||
}
|
||||
|
@@ -48,7 +48,6 @@ import com.readystatesoftware.systembartint.SystemBarTintManager;
|
||||
import com.tbruyelle.rxpermissions2.RxPermissions;
|
||||
import com.trello.rxlifecycle3.android.ActivityEvent;
|
||||
import com.trello.rxlifecycle3.components.support.RxAppCompatActivity;
|
||||
import com.yizhuan.erban.MiddleActivity;
|
||||
import com.yizhuan.erban.NimMiddleActivity;
|
||||
import com.yizhuan.erban.R;
|
||||
import com.yizhuan.erban.application.XChatApplication;
|
||||
@@ -974,7 +973,6 @@ public abstract class BaseActivity extends RxAppCompatActivity
|
||||
acts.add(LoginCodeActivity.class);
|
||||
acts.add(ResetPasswordActivity.class);
|
||||
acts.add(AddUserInfoActivity.class);
|
||||
acts.add(MiddleActivity.class);
|
||||
acts.add(NimMiddleActivity.class);
|
||||
|
||||
for (Class act : acts) {
|
||||
|
@@ -1,43 +0,0 @@
|
||||
package com.yizhuan.erban.push;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.content.Intent;
|
||||
import android.os.Bundle;
|
||||
import android.os.Handler;
|
||||
import android.util.Log;
|
||||
|
||||
import com.yizhuan.erban.MainActivity;
|
||||
import com.yizhuan.erban.avroom.activity.AVRoomActivity;
|
||||
import com.yizhuan.erban.ui.im.avtivity.NimP2PMessageActivity;
|
||||
import com.yizhuan.erban.ui.webview.CommonWebViewActivity;
|
||||
import com.yizhuan.erban.utils.PushMessageHandler;
|
||||
|
||||
public class HWPushMiddleActivity extends Activity {
|
||||
@Override
|
||||
public void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
Intent intent = getIntent();
|
||||
if (null != intent) {
|
||||
// 方法2设置的数据通过如下方式获取
|
||||
Log.d("HWPush", intent.toString());
|
||||
MainActivity.start(this);
|
||||
new Handler().postDelayed(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
int skiptype = intent.getIntExtra("skiptype", 0);
|
||||
if (skiptype == PushMessageHandler.PAYLOAD_SKIPTYPE_INVITE_FANS) {
|
||||
String roomUid = intent.getStringExtra("roomUid");
|
||||
AVRoomActivity.start(HWPushMiddleActivity.this, Long.parseLong(roomUid));
|
||||
} else if (skiptype == PushMessageHandler.PAYLOAD_SKIPTYPE_PRIVATE_MSG) {
|
||||
String uid = intent.getStringExtra("uid");
|
||||
NimP2PMessageActivity.start(HWPushMiddleActivity.this, uid);
|
||||
} else if (skiptype == PushMessageHandler.PAYLOAD_SKIPTYPE_H5) {
|
||||
String roomUid = intent.getStringExtra("roomUid");
|
||||
CommonWebViewActivity.start(HWPushMiddleActivity.this, roomUid);
|
||||
}
|
||||
}
|
||||
}, 2000);
|
||||
}
|
||||
finish();
|
||||
}
|
||||
}
|
@@ -1,26 +0,0 @@
|
||||
package com.yizhuan.erban.push;
|
||||
|
||||
import android.content.Context;
|
||||
|
||||
import com.meizu.cloud.pushsdk.platform.message.RegisterStatus;
|
||||
import com.netease.nimlib.sdk.mixpush.MeiZuPushReceiver;
|
||||
import com.orhanobut.logger.Logger;
|
||||
|
||||
/**
|
||||
* Created by lvzebiao on 2019/1/18.
|
||||
*/
|
||||
|
||||
public class MeizuPushReceiver extends MeiZuPushReceiver {
|
||||
|
||||
@Override
|
||||
public void onRegister(Context context, String pushId) {
|
||||
super.onRegister(context, pushId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onRegisterStatus(Context context, RegisterStatus registerStatus) {
|
||||
super.onRegisterStatus(context, registerStatus);
|
||||
Logger.i("魅族推送ID:" + registerStatus.getPushId());
|
||||
}
|
||||
|
||||
}
|
@@ -1,35 +0,0 @@
|
||||
package com.yizhuan.erban.push;
|
||||
|
||||
import android.content.Context;
|
||||
|
||||
import com.netease.nimlib.sdk.mixpush.MiPushMessageReceiver;
|
||||
import com.orhanobut.logger.Logger;
|
||||
import com.xiaomi.mipush.sdk.ErrorCode;
|
||||
import com.xiaomi.mipush.sdk.MiPushClient;
|
||||
import com.xiaomi.mipush.sdk.MiPushCommandMessage;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Created by lvzebiao on 2019/1/18.
|
||||
*/
|
||||
|
||||
public class MiPushReceiver extends MiPushMessageReceiver {
|
||||
|
||||
|
||||
@Override
|
||||
public void onCommandResult(Context context, MiPushCommandMessage message) {
|
||||
super.onCommandResult(context, message);
|
||||
|
||||
Logger.i("小米推送....");
|
||||
String command = message.getCommand();
|
||||
List<String> arguments = message.getCommandArguments();
|
||||
if (MiPushClient.COMMAND_REGISTER.equals(command)) {
|
||||
if (message.getResultCode() == ErrorCode.SUCCESS) {
|
||||
String mRegID = arguments.get(0);
|
||||
Logger.i("小米推送mRegID:" + mRegID);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
@@ -1,6 +0,0 @@
|
||||
package com.yizhuan.erban.push;
|
||||
|
||||
import com.netease.nimlib.sdk.mixpush.OppoAppPushMessageService;
|
||||
|
||||
public class OppoAppPushService extends OppoAppPushMessageService {
|
||||
}
|
@@ -1,6 +0,0 @@
|
||||
package com.yizhuan.erban.push;
|
||||
|
||||
import com.netease.nimlib.sdk.mixpush.OppoPushMessageService;
|
||||
|
||||
public class OppoPushService extends OppoPushMessageService {
|
||||
}
|
@@ -14,34 +14,25 @@ import androidx.recyclerview.widget.RecyclerView;
|
||||
|
||||
import com.netease.nim.uikit.StatusBarUtil;
|
||||
import com.yizhuan.erban.R;
|
||||
import com.yizhuan.erban.bank_card.activity.AddBankCardAgreementActivity;
|
||||
import com.yizhuan.erban.base.BaseActivity;
|
||||
import com.yizhuan.erban.base.TitleBar;
|
||||
import com.yizhuan.erban.common.widget.dialog.DialogManager;
|
||||
import com.yizhuan.erban.ui.setting.ModifyPwdActivity;
|
||||
import com.yizhuan.erban.ui.webview.CommonWebViewActivity;
|
||||
import com.yizhuan.erban.ui.widget.password.PassWordFragment;
|
||||
import com.yizhuan.erban.ui.widget.password.PasswordEvent;
|
||||
import com.yizhuan.xchat_android_core.Constants;
|
||||
import com.yizhuan.xchat_android_core.UriProvider;
|
||||
import com.yizhuan.xchat_android_core.auth.AuthModel;
|
||||
import com.yizhuan.xchat_android_core.bean.response.ServiceResult;
|
||||
import com.yizhuan.xchat_android_core.bean.response.result.ChargeListResult;
|
||||
import com.yizhuan.xchat_android_core.pay.PayModel;
|
||||
import com.yizhuan.xchat_android_core.pay.PaymentActivity;
|
||||
import com.yizhuan.xchat_android_core.pay.bean.ChargeBean;
|
||||
import com.yizhuan.xchat_android_core.pay.bean.PaymentResult;
|
||||
import com.yizhuan.xchat_android_core.pay.bean.WalletInfo;
|
||||
import com.yizhuan.xchat_android_core.pay.bean.unionpay.UnionPayOrder;
|
||||
import com.yizhuan.xchat_android_core.pay.event.GetWalletInfoEvent;
|
||||
import com.yizhuan.xchat_android_core.pay.event.UpdateWalletInfoEvent;
|
||||
import com.yizhuan.xchat_android_core.pay.model.unionpay.UnionPayModel;
|
||||
import com.yizhuan.xchat_android_core.user.UserModel;
|
||||
import com.yizhuan.xchat_android_core.user.bean.UserInfo;
|
||||
import com.yizhuan.xchat_android_core.utils.CheckUtils;
|
||||
import com.yizhuan.xchat_android_core.utils.net.BeanObserver;
|
||||
import com.yizhuan.xchat_android_core.web.event.WebViewRefreshEvent;
|
||||
import com.yizhuan.xchat_android_library.utils.JavaUtil;
|
||||
import com.yizhuan.xchat_android_library.utils.ListUtils;
|
||||
|
||||
import org.greenrobot.eventbus.EventBus;
|
||||
@@ -50,14 +41,10 @@ import org.greenrobot.eventbus.ThreadMode;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
import io.reactivex.Observable;
|
||||
import io.reactivex.SingleObserver;
|
||||
import io.reactivex.android.schedulers.AndroidSchedulers;
|
||||
import io.reactivex.disposables.CompositeDisposable;
|
||||
import io.reactivex.disposables.Disposable;
|
||||
import io.reactivex.schedulers.Schedulers;
|
||||
|
||||
/**
|
||||
* 充值界面
|
||||
@@ -147,7 +134,6 @@ public class ChargeActivity extends BaseActivity {
|
||||
tvCharge.setOnClickListener(v -> {
|
||||
if (mSelectChargeBean == null) return;
|
||||
getDialogManager().showProgressDialog(this, false);
|
||||
PaymentActivity.start(this, payChannel, mSelectChargeBean.chargeProdId);
|
||||
});
|
||||
tvAgreement.setOnClickListener(v -> {
|
||||
CommonWebViewActivity.start(this, UriProvider.getRechargeAgreementUrl());
|
||||
@@ -373,125 +359,11 @@ public class ChargeActivity extends BaseActivity {
|
||||
if (resultCode != RESULT_OK) {
|
||||
return;
|
||||
}
|
||||
//支付页面返回处理
|
||||
if (requestCode == PaymentActivity.REQUEST_CODE_PAY) {
|
||||
if (data != null && data.getExtras() != null) {
|
||||
PaymentResult paymentResult = data.getParcelableExtra(PaymentActivity.KEY_PAY_RESULT);
|
||||
if (paymentResult != null) {
|
||||
// 充值金额超过限定时,就必须先实名认证
|
||||
int payResultCode = JavaUtil.str2int(paymentResult.getCode());
|
||||
switch (payResultCode) {
|
||||
case PayModel.NOT_REAL_NAME_BEFORE_CHARGING:
|
||||
getDialogManager().showTipsDialog(getString(R.string.tips_need_to_certification),
|
||||
getString(R.string.go_to_certification),
|
||||
new DialogManager.AbsOkDialogListener() {
|
||||
@Override
|
||||
public void onOk() {
|
||||
// 跳去实名认证页面
|
||||
CommonWebViewActivity.start(ChargeActivity.this,
|
||||
UriProvider.getTutuRealNamePage());
|
||||
}
|
||||
});
|
||||
break;
|
||||
|
||||
case UnionPayModel.CODE_NEED_BIND_BANK_CARD_FIRST:
|
||||
getDialogManager().showTipsDialog(
|
||||
getString(R.string.tips_need_bind_bank_card_first),
|
||||
new DialogManager.AbsOkDialogListener() {
|
||||
@Override
|
||||
public void onOk() {
|
||||
// 跳去添加银行卡页面
|
||||
AddBankCardAgreementActivity.start(ChargeActivity.this);
|
||||
}
|
||||
});
|
||||
break;
|
||||
|
||||
case PaymentResult.CODE_SHOW_PAYMENT_PSW:
|
||||
showPaymentConfirmDialog();
|
||||
break;
|
||||
|
||||
case PaymentResult.CODE_UNION_PAY_WAITING_FOR_RESULT:
|
||||
queryingPaymentResult();
|
||||
break;
|
||||
|
||||
default:
|
||||
toast(paymentResult.getMsg());
|
||||
//重新获取钱包信息
|
||||
PayModel.get().getWalletInfo(AuthModel.get().getCurrentUid()).subscribe();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (requestCode == BINDCODE_GOLD) {
|
||||
ModifyPwdActivity.start(this, ModifyPwdActivity.FOGERT_PAY_PWD);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 银联支付下,弹出确认弹窗,方便用户查看支付金额和支付使用的银行卡,还能切换银行卡
|
||||
*/
|
||||
private void showPaymentConfirmDialog() {
|
||||
if (mSelectChargeBean == null) {
|
||||
return;
|
||||
}
|
||||
ConfirmPaymentDialog.newInstance(mSelectChargeBean.getMoney(),
|
||||
selectedBankInfo -> {
|
||||
UnionPayModel.getInstance().setSelectedBankInfo(selectedBankInfo);
|
||||
PassWordFragment.newInstance().show(getSupportFragmentManager());
|
||||
})
|
||||
.show(getSupportFragmentManager(), ConfirmPaymentDialog.class.getName());
|
||||
}
|
||||
|
||||
/**
|
||||
* 银联支付存在一定的延时,所以这里加一个五秒的 loading 动画在前台,
|
||||
* 后台在每秒轮询服务器获取订单状态
|
||||
* 当获取到订单状态为成功或者失败的时候,loading 结束,
|
||||
* 否则一直 loading,直到五秒结束后 toast 提示用户自行查账单
|
||||
*/
|
||||
private void queryingPaymentResult() {
|
||||
UnionPayOrder unionPayOrder = UnionPayModel.getInstance().getUnionPayOrder();
|
||||
if (unionPayOrder == null) {
|
||||
getDialogManager().dismissDialog();
|
||||
return;
|
||||
}
|
||||
// 前台 loading
|
||||
getDialogManager().showProgressDialog(ChargeActivity.this,
|
||||
getString(R.string.tips_querying_payment_result), false);
|
||||
// 轮询订单支付结果
|
||||
Observable<ServiceResult<String>> stringObservable =
|
||||
Observable.interval(0, 1, TimeUnit.SECONDS)
|
||||
.take(5)
|
||||
.subscribeOn(Schedulers.io())
|
||||
.concatMap(aLong -> UnionPayModel.getInstance()
|
||||
.unionPayResult(unionPayOrder.getOrderNo())
|
||||
.toObservable())
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.filter(pollingJsonResult ->
|
||||
pollingJsonResult.getCode() == ServiceResult.SC_SUCCESS ||
|
||||
pollingJsonResult.getCode() == UnionPayModel.CODE_UNION_PAY_FAILED)
|
||||
.timeout(5, TimeUnit.SECONDS);
|
||||
compositeDisposable.add(
|
||||
stringObservable.subscribe(stringServiceResult -> {
|
||||
getDialogManager().dismissDialog();
|
||||
disposeCompositeDisposable();
|
||||
if (stringServiceResult != null) {
|
||||
toast(stringServiceResult.getMessage());
|
||||
if (stringServiceResult.getCode() == ServiceResult.SC_SUCCESS) {
|
||||
PayModel.get().setFirstChargeSuccess(false);
|
||||
onRefreshing();
|
||||
}
|
||||
}
|
||||
}, throwable -> {
|
||||
throwable.printStackTrace();
|
||||
getDialogManager().dismissDialog();
|
||||
toast(throwable.getMessage());
|
||||
}, () -> {
|
||||
getDialogManager().dismissDialog();
|
||||
toast(R.string.toast_payment_result_delayed);
|
||||
})
|
||||
);
|
||||
}
|
||||
|
||||
private void disposeCompositeDisposable() {
|
||||
if (compositeDisposable != null && !compositeDisposable.isDisposed()) {
|
||||
compositeDisposable.dispose();
|
||||
@@ -605,7 +477,6 @@ public class ChargeActivity extends BaseActivity {
|
||||
@Subscribe(threadMode = ThreadMode.MAIN)
|
||||
public void onGetPassword(PasswordEvent event) {
|
||||
getDialogManager().showProgressDialog(this);
|
||||
PaymentActivity.startToPay(this, Constants.CHARGE_UNION_PAY, event.getPassword());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@@ -1,597 +0,0 @@
|
||||
package com.yizhuan.erban.ui.pay;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.os.Bundle;
|
||||
import android.text.TextUtils;
|
||||
import android.view.Gravity;
|
||||
import android.view.View;
|
||||
import android.view.WindowManager;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.LinearLayout;
|
||||
import android.widget.TextView;
|
||||
|
||||
import androidx.recyclerview.widget.GridLayoutManager;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
|
||||
import com.netease.nim.uikit.StatusBarUtil;
|
||||
import com.netease.nim.uikit.common.util.sys.ScreenUtil;
|
||||
import com.yizhuan.erban.R;
|
||||
import com.yizhuan.erban.bank_card.activity.AddBankCardAgreementActivity;
|
||||
import com.yizhuan.erban.base.BaseActivity;
|
||||
import com.yizhuan.erban.base.TitleBar;
|
||||
import com.yizhuan.erban.common.widget.dialog.DialogManager;
|
||||
import com.yizhuan.erban.ui.setting.ModifyPwdActivity;
|
||||
import com.yizhuan.erban.ui.webview.CommonWebViewActivity;
|
||||
import com.yizhuan.erban.ui.widget.password.PassWordFragment;
|
||||
import com.yizhuan.erban.ui.widget.password.PasswordEvent;
|
||||
import com.yizhuan.xchat_android_core.Constants;
|
||||
import com.yizhuan.xchat_android_core.UriProvider;
|
||||
import com.yizhuan.xchat_android_core.auth.AuthModel;
|
||||
import com.yizhuan.xchat_android_core.bean.response.ServiceResult;
|
||||
import com.yizhuan.xchat_android_core.bean.response.result.ChargeListResult;
|
||||
import com.yizhuan.xchat_android_core.pay.PayModel;
|
||||
import com.yizhuan.xchat_android_core.pay.PaymentActivity;
|
||||
import com.yizhuan.xchat_android_core.pay.bean.ChargeBean;
|
||||
import com.yizhuan.xchat_android_core.pay.bean.PaymentResult;
|
||||
import com.yizhuan.xchat_android_core.pay.bean.WalletInfo;
|
||||
import com.yizhuan.xchat_android_core.pay.bean.unionpay.UnionPayOrder;
|
||||
import com.yizhuan.xchat_android_core.pay.event.GetWalletInfoEvent;
|
||||
import com.yizhuan.xchat_android_core.pay.event.UpdateWalletInfoEvent;
|
||||
import com.yizhuan.xchat_android_core.pay.model.unionpay.UnionPayModel;
|
||||
import com.yizhuan.xchat_android_core.user.UserModel;
|
||||
import com.yizhuan.xchat_android_core.user.bean.UserInfo;
|
||||
import com.yizhuan.xchat_android_core.utils.CheckUtils;
|
||||
import com.yizhuan.xchat_android_core.utils.net.BeanObserver;
|
||||
import com.yizhuan.xchat_android_core.web.event.WebViewRefreshEvent;
|
||||
import com.yizhuan.xchat_android_library.utils.JavaUtil;
|
||||
import com.yizhuan.xchat_android_library.utils.ListUtils;
|
||||
|
||||
import org.greenrobot.eventbus.EventBus;
|
||||
import org.greenrobot.eventbus.Subscribe;
|
||||
import org.greenrobot.eventbus.ThreadMode;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
import io.reactivex.Observable;
|
||||
import io.reactivex.SingleObserver;
|
||||
import io.reactivex.android.schedulers.AndroidSchedulers;
|
||||
import io.reactivex.disposables.CompositeDisposable;
|
||||
import io.reactivex.disposables.Disposable;
|
||||
import io.reactivex.schedulers.Schedulers;
|
||||
|
||||
/**
|
||||
* 充值界面
|
||||
*
|
||||
* @author zhouxiangfeng
|
||||
* @date 2017/6/19
|
||||
*/
|
||||
public class ChargeDialog extends BaseActivity {
|
||||
|
||||
public static final int ALI_PAY_CLOSE = 1;
|
||||
public static final int WX_PAY_CLOSE = 2;
|
||||
public static final int ALI_PAY_OPEN = 3;
|
||||
public static final int WX_PAY_OPEN = 4;
|
||||
private static final String TAG = "ChargeDialog";
|
||||
private final int BINDCODE_GOLD = 200;
|
||||
List<ChargeBean> mBigList;
|
||||
List<ChargeBean> mList;
|
||||
private TextView mTv_gold;
|
||||
private LinearLayout ll_type_first;
|
||||
private ImageView iv_type_first;
|
||||
private TextView tv_type_first;
|
||||
private LinearLayout ll_type_second;
|
||||
private ImageView iv_type_second;
|
||||
private TextView tv_type_second;
|
||||
private TextView tvCharge;
|
||||
private RecyclerView mRecyclerView;
|
||||
private ChargeAdapter mChargeAdapter;
|
||||
private TextView tvAgreement;
|
||||
private LinearLayout ll_more;
|
||||
private ChargeBean mSelectChargeBean;
|
||||
private int mListSize;
|
||||
private volatile String payChannel = Constants.CHARGE_WX;
|
||||
private boolean mIsFromH5;
|
||||
private CompositeDisposable compositeDisposable = new CompositeDisposable();
|
||||
|
||||
public static void start(Context context) {
|
||||
UserInfo userInfo = UserModel.get().getCacheLoginUserInfo();
|
||||
if (context == null || userInfo == null) return;
|
||||
Intent intent = new Intent(context, ChargeDialog.class);
|
||||
context.startActivity(intent);
|
||||
}
|
||||
|
||||
public static void start(Context context, boolean isFromH5) {
|
||||
UserInfo userInfo = UserModel.get().getCacheLoginUserInfo();
|
||||
if (context == null || userInfo == null) return;
|
||||
Intent intent = new Intent(context, ChargeDialog.class);
|
||||
intent.putExtra("isFromH5", isFromH5);
|
||||
context.startActivity(intent);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
setContentView(R.layout.dialog_charge);
|
||||
//这里的height用MATCH_PARENT状态栏会被顶上去,不知道什么鬼
|
||||
int height = ScreenUtil.screenHeight - ScreenUtil.getStatusBarHeight(context);
|
||||
getWindow().setLayout(WindowManager.LayoutParams.MATCH_PARENT, height);
|
||||
getWindow().setGravity(Gravity.BOTTOM);
|
||||
initTitleBar("充值");
|
||||
mTitleBar.setLeftClickListener(v -> finishPage());
|
||||
bindViews();
|
||||
setListener();
|
||||
initiate();
|
||||
}
|
||||
|
||||
private void setListener() {
|
||||
ll_more.setOnClickListener(v -> hideMoreButton());
|
||||
tvCharge.setOnClickListener(v -> {
|
||||
if (mSelectChargeBean == null) return;
|
||||
getDialogManager().showProgressDialog(this, false);
|
||||
PaymentActivity.start(this, payChannel, mSelectChargeBean.chargeProdId);
|
||||
});
|
||||
tvAgreement.setOnClickListener(v -> {
|
||||
CommonWebViewActivity.start(this, UriProvider.getRechargeAgreementUrl());
|
||||
});
|
||||
}
|
||||
|
||||
private void hideMoreButton() {
|
||||
ll_more.setVisibility(View.GONE);
|
||||
ll_type_second.setVisibility(View.VISIBLE);
|
||||
}
|
||||
|
||||
private void showMoreButton() {
|
||||
ll_more.setVisibility(View.VISIBLE);
|
||||
ll_type_second.setVisibility(View.GONE);
|
||||
}
|
||||
|
||||
private void bindViews() {
|
||||
mTv_gold = findViewById(R.id.tv_gold);
|
||||
ll_type_first = findViewById(R.id.ll_type_first);
|
||||
iv_type_first = findViewById(R.id.iv_type_first);
|
||||
ll_type_second = findViewById(R.id.ll_type_second);
|
||||
ll_more = findViewById(R.id.ll_more);
|
||||
tvCharge = findViewById(R.id.tv_charge);
|
||||
tvAgreement = findViewById(R.id.tv_agreement);
|
||||
iv_type_second = findViewById(R.id.iv_type_second);
|
||||
tv_type_first = findViewById(R.id.tv_type_first);
|
||||
tv_type_second = findViewById(R.id.tv_type_second);
|
||||
}
|
||||
|
||||
public void selectPayChannelDisplay(String payChannel, int defaultPay) {
|
||||
this.payChannel = payChannel;
|
||||
boolean selectWeChatPay = (Objects.equals(this.payChannel, Constants.CHARGE_WX));
|
||||
boolean selectAliPay = (Objects.equals(this.payChannel, Constants.CHARGE_ALIPAY));
|
||||
if (!ListUtils.isListEmpty(mBigList)) {
|
||||
if (selectAliPay) {
|
||||
if (mList.size() == mListSize) {
|
||||
for (ChargeBean bigList : mBigList) {
|
||||
mList.add(bigList);
|
||||
}
|
||||
mChargeAdapter.setNewData(mList);
|
||||
mChargeAdapter.notifyDataSetChanged();
|
||||
}
|
||||
} else {
|
||||
if (mList.size() > mListSize) {
|
||||
setItemSelect(0);
|
||||
}
|
||||
for (ChargeBean bigList : mBigList) {
|
||||
mList.remove(bigList);
|
||||
}
|
||||
mChargeAdapter.setNewData(mList);
|
||||
mChargeAdapter.notifyDataSetChanged();
|
||||
}
|
||||
}
|
||||
|
||||
switch (defaultPay) {
|
||||
case ALI_PAY_CLOSE:
|
||||
case ALI_PAY_OPEN:
|
||||
ll_type_first.setSelected(selectAliPay);
|
||||
ll_type_second.setSelected(selectWeChatPay);
|
||||
break;
|
||||
|
||||
case WX_PAY_CLOSE:
|
||||
case WX_PAY_OPEN:
|
||||
ll_type_first.setSelected(selectWeChatPay);
|
||||
ll_type_second.setSelected(selectAliPay);
|
||||
break;
|
||||
default:
|
||||
defaultSetPay(selectWeChatPay, selectAliPay);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 默认选择的支付方式
|
||||
*
|
||||
* @param selectWeChatPay
|
||||
* @param selectAliPay
|
||||
*/
|
||||
private void defaultSetPay(boolean selectWeChatPay, boolean selectAliPay) {
|
||||
ll_type_first.setSelected(selectWeChatPay);
|
||||
ll_type_second.setSelected(selectAliPay);
|
||||
}
|
||||
|
||||
private void initiate() {
|
||||
mIsFromH5 = getIntent().getBooleanExtra("isFromH5", false);
|
||||
mRecyclerView = findViewById(R.id.recyclerView);
|
||||
mRecyclerView.setNestedScrollingEnabled(false);
|
||||
mRecyclerView.setLayoutManager(new GridLayoutManager(this, 3));
|
||||
mChargeAdapter = new ChargeAdapter(true);
|
||||
mRecyclerView.setAdapter(mChargeAdapter);
|
||||
mChargeAdapter.setOnItemClickListener((baseQuickAdapter, view, position) -> {
|
||||
setItemSelect(position);
|
||||
});
|
||||
onRefreshing();
|
||||
onLoadingData();
|
||||
}
|
||||
|
||||
private void setItemSelect(int position) {
|
||||
List<ChargeBean> list = mChargeAdapter.getData();
|
||||
if (ListUtils.isListEmpty(list)) return;
|
||||
|
||||
// 空对象,不让蒙板遮挡最后一个item;
|
||||
ChargeBean temp = list.get(position);
|
||||
if (TextUtils.isEmpty(temp.getProdName()))
|
||||
return;
|
||||
|
||||
mSelectChargeBean = list.get(position);
|
||||
int size = list.size();
|
||||
for (int i = 0; i < size; i++) {
|
||||
list.get(i).isSelected = position == i;
|
||||
}
|
||||
mChargeAdapter.notifyDataSetChanged();
|
||||
}
|
||||
|
||||
public void onLoadingData() {
|
||||
UserInfo userInfos = UserModel.get().getCacheLoginUserInfo();
|
||||
if (userInfos != null) {
|
||||
PayModel.get().getWalletInfo(userInfos.getUid()).subscribe(new SingleObserver<WalletInfo>() {
|
||||
@Override
|
||||
public void onSubscribe(Disposable d) {
|
||||
mCompositeDisposable.add(d);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onSuccess(WalletInfo walletInfo) {
|
||||
setWalletData(walletInfo);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(Throwable e) {
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
public void onRefreshing() {
|
||||
PayModel.get().getChargeList(1, AuthModel.get().getCurrentUid()).subscribe(new BeanObserver<ChargeListResult>() {
|
||||
@Override
|
||||
public void onSuccess(ChargeListResult chargeBeans) {
|
||||
if (chargeBeans == null) return;
|
||||
mBigList = chargeBeans.getBigList();
|
||||
mList = chargeBeans.getList();
|
||||
mListSize = chargeBeans.getList().size();
|
||||
onGetChargeList(chargeBeans.getList());
|
||||
//默认选中
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onErrorMsg(String error) {
|
||||
onGetChargeListFail(error);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onResume() {
|
||||
super.onResume();
|
||||
EventBus.getDefault().register(this);
|
||||
if (PayModel.get().isFirstChargeSuccess()) {
|
||||
PayModel.get().setFirstChargeSuccess(false);
|
||||
onRefreshing();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onPause() {
|
||||
super.onPause();
|
||||
EventBus.getDefault().unregister(this);
|
||||
}
|
||||
|
||||
public void onGetChargeList(List<ChargeBean> chargeBeanList) {
|
||||
if (chargeBeanList != null && chargeBeanList.size() > 0) {
|
||||
//先判断存不存在1元档位
|
||||
boolean isExistOneYuan = false;
|
||||
for (int i = 0; i < chargeBeanList.size(); i++) {
|
||||
ChargeBean chargeBean = chargeBeanList.get(i);
|
||||
if (chargeBean.getMoney() == 1) {
|
||||
isExistOneYuan = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
int selectedMoney = isExistOneYuan ? 1 : 6;
|
||||
for (int i = 0; i < chargeBeanList.size(); i++) {
|
||||
ChargeBean chargeBean = chargeBeanList.get(i);
|
||||
chargeBean.isSelected = chargeBean.getMoney() == selectedMoney;
|
||||
if (selectedMoney == chargeBean.getMoney()) {
|
||||
mSelectChargeBean = chargeBean;
|
||||
}
|
||||
}
|
||||
mChargeAdapter.setNewData(chargeBeanList);
|
||||
}
|
||||
}
|
||||
|
||||
public void onGetChargeListFail(String error) {
|
||||
toast(error);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
|
||||
super.onActivityResult(requestCode, resultCode, data);
|
||||
getDialogManager().dismissDialog();
|
||||
if (resultCode != RESULT_OK) {
|
||||
return;
|
||||
}
|
||||
//支付页面返回处理
|
||||
if (requestCode == PaymentActivity.REQUEST_CODE_PAY) {
|
||||
if (data != null && data.getExtras() != null) {
|
||||
PaymentResult paymentResult = data.getParcelableExtra(PaymentActivity.KEY_PAY_RESULT);
|
||||
if (paymentResult != null) {
|
||||
// 充值金额超过限定时,就必须先实名认证
|
||||
int payResultCode = JavaUtil.str2int(paymentResult.getCode());
|
||||
switch (payResultCode) {
|
||||
case PayModel.NOT_REAL_NAME_BEFORE_CHARGING:
|
||||
getDialogManager().showTipsDialog(getString(R.string.tips_need_to_certification),
|
||||
getString(R.string.go_to_certification),
|
||||
new DialogManager.AbsOkDialogListener() {
|
||||
@Override
|
||||
public void onOk() {
|
||||
// 跳去实名认证页面
|
||||
CommonWebViewActivity.start(ChargeDialog.this,
|
||||
UriProvider.getTutuRealNamePage());
|
||||
}
|
||||
});
|
||||
break;
|
||||
|
||||
case UnionPayModel.CODE_NEED_BIND_BANK_CARD_FIRST:
|
||||
getDialogManager().showTipsDialog(
|
||||
getString(R.string.tips_need_bind_bank_card_first),
|
||||
new DialogManager.AbsOkDialogListener() {
|
||||
@Override
|
||||
public void onOk() {
|
||||
// 跳去添加银行卡页面
|
||||
AddBankCardAgreementActivity.start(ChargeDialog.this);
|
||||
}
|
||||
});
|
||||
break;
|
||||
|
||||
case PaymentResult.CODE_SHOW_PAYMENT_PSW:
|
||||
showPaymentConfirmDialog();
|
||||
break;
|
||||
|
||||
case PaymentResult.CODE_UNION_PAY_WAITING_FOR_RESULT:
|
||||
queryingPaymentResult();
|
||||
break;
|
||||
|
||||
default:
|
||||
toast(paymentResult.getMsg());
|
||||
//重新获取钱包信息
|
||||
PayModel.get().getWalletInfo(AuthModel.get().getCurrentUid()).subscribe();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (requestCode == BINDCODE_GOLD) {
|
||||
ModifyPwdActivity.start(this, ModifyPwdActivity.FOGERT_PAY_PWD);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 银联支付下,弹出确认弹窗,方便用户查看支付金额和支付使用的银行卡,还能切换银行卡
|
||||
*/
|
||||
private void showPaymentConfirmDialog() {
|
||||
if (mSelectChargeBean == null) {
|
||||
return;
|
||||
}
|
||||
ConfirmPaymentDialog.newInstance(mSelectChargeBean.getMoney(),
|
||||
selectedBankInfo -> {
|
||||
UnionPayModel.getInstance().setSelectedBankInfo(selectedBankInfo);
|
||||
PassWordFragment.newInstance().show(getSupportFragmentManager());
|
||||
})
|
||||
.show(getSupportFragmentManager(), ConfirmPaymentDialog.class.getName());
|
||||
}
|
||||
|
||||
/**
|
||||
* 银联支付存在一定的延时,所以这里加一个五秒的 loading 动画在前台,
|
||||
* 后台在每秒轮询服务器获取订单状态
|
||||
* 当获取到订单状态为成功或者失败的时候,loading 结束,
|
||||
* 否则一直 loading,直到五秒结束后 toast 提示用户自行查账单
|
||||
*/
|
||||
private void queryingPaymentResult() {
|
||||
UnionPayOrder unionPayOrder = UnionPayModel.getInstance().getUnionPayOrder();
|
||||
if (unionPayOrder == null) {
|
||||
getDialogManager().dismissDialog();
|
||||
return;
|
||||
}
|
||||
// 前台 loading
|
||||
getDialogManager().showProgressDialog(ChargeDialog.this,
|
||||
getString(R.string.tips_querying_payment_result), false);
|
||||
// 轮询订单支付结果
|
||||
Observable<ServiceResult<String>> stringObservable =
|
||||
Observable.interval(0, 1, TimeUnit.SECONDS)
|
||||
.take(5)
|
||||
.subscribeOn(Schedulers.io())
|
||||
.concatMap(aLong -> UnionPayModel.getInstance()
|
||||
.unionPayResult(unionPayOrder.getOrderNo())
|
||||
.toObservable())
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.filter(pollingJsonResult ->
|
||||
pollingJsonResult.getCode() == ServiceResult.SC_SUCCESS ||
|
||||
pollingJsonResult.getCode() == UnionPayModel.CODE_UNION_PAY_FAILED)
|
||||
.timeout(5, TimeUnit.SECONDS);
|
||||
compositeDisposable.add(
|
||||
stringObservable.subscribe(stringServiceResult -> {
|
||||
getDialogManager().dismissDialog();
|
||||
disposeCompositeDisposable();
|
||||
if (stringServiceResult != null) {
|
||||
toast(stringServiceResult.getMessage());
|
||||
if (stringServiceResult.getCode() == ServiceResult.SC_SUCCESS) {
|
||||
PayModel.get().setFirstChargeSuccess(false);
|
||||
onRefreshing();
|
||||
}
|
||||
}
|
||||
}, throwable -> {
|
||||
throwable.printStackTrace();
|
||||
getDialogManager().dismissDialog();
|
||||
toast(throwable.getMessage());
|
||||
}, () -> {
|
||||
getDialogManager().dismissDialog();
|
||||
toast(R.string.toast_payment_result_delayed);
|
||||
})
|
||||
);
|
||||
}
|
||||
|
||||
private void disposeCompositeDisposable() {
|
||||
if (compositeDisposable != null && !compositeDisposable.isDisposed()) {
|
||||
compositeDisposable.dispose();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onDestroy() {
|
||||
super.onDestroy();
|
||||
disposeCompositeDisposable();
|
||||
}
|
||||
|
||||
@Subscribe(threadMode = ThreadMode.MAIN)
|
||||
public void onWalletInfoUpdate(UpdateWalletInfoEvent event) {
|
||||
WalletInfo walletInfo = PayModel.get().getCurrentWalletInfo();
|
||||
if (walletInfo != null) {
|
||||
setWalletData(walletInfo);
|
||||
}
|
||||
}
|
||||
|
||||
@Subscribe(threadMode = ThreadMode.MAIN)
|
||||
public void onGetWalletInfo(GetWalletInfoEvent event) {
|
||||
WalletInfo walletInfo = PayModel.get().getCurrentWalletInfo();
|
||||
if (walletInfo != null) {
|
||||
setWalletData(walletInfo);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* defaultPay 1:默认支付宝,2:默认微信
|
||||
*/
|
||||
private void setWalletData(WalletInfo walletInfo) {
|
||||
if (walletInfo == null) return;
|
||||
mTv_gold.setText(getString(R.string.charge_gold, walletInfo.getDiamondNum()));
|
||||
int defaultPay = walletInfo.getDefaultPay();
|
||||
switch (defaultPay) {
|
||||
case ALI_PAY_CLOSE:
|
||||
payChannel = Constants.CHARGE_ALIPAY;
|
||||
showMoreButton();
|
||||
setAliPayFirst(defaultPay);
|
||||
break;
|
||||
|
||||
case WX_PAY_CLOSE:
|
||||
payChannel = Constants.CHARGE_WX;
|
||||
showMoreButton();
|
||||
setWxPayFirst(defaultPay);
|
||||
break;
|
||||
|
||||
case ALI_PAY_OPEN:
|
||||
payChannel = Constants.CHARGE_ALIPAY;
|
||||
hideMoreButton();
|
||||
setAliPayFirst(defaultPay);
|
||||
break;
|
||||
|
||||
case WX_PAY_OPEN:
|
||||
payChannel = Constants.CHARGE_WX;
|
||||
hideMoreButton();
|
||||
setWxPayFirst(defaultPay);
|
||||
break;
|
||||
default:
|
||||
defaultPay(defaultPay);
|
||||
break;
|
||||
}
|
||||
if (CheckUtils.isCheckUser()) {
|
||||
selectPayChannelDisplay(Constants.CHARGE_ALIPAY, defaultPay);
|
||||
} else {
|
||||
selectPayChannelDisplay(payChannel, defaultPay);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 默认支付方式
|
||||
*
|
||||
* @param defaultPay
|
||||
*/
|
||||
private void defaultPay(int defaultPay) {
|
||||
payChannel = Constants.CHARGE_WX;
|
||||
hideMoreButton();
|
||||
setWxPayFirst(defaultPay);
|
||||
}
|
||||
|
||||
private void setAliPayFirst(int defaultType) {
|
||||
iv_type_first.setImageDrawable(getResources().getDrawable(R.drawable.dialog_charge_ic_alipay));
|
||||
iv_type_second.setImageDrawable(getResources().getDrawable(R.drawable.dialog_charge_ic_wechat));
|
||||
tv_type_first.setText("支付宝");
|
||||
tv_type_second.setText("微信");
|
||||
ll_type_first.setOnClickListener(v -> selectPayChannelDisplay(Constants.CHARGE_ALIPAY, defaultType));
|
||||
ll_type_second.setOnClickListener(v -> selectPayChannelDisplay(Constants.CHARGE_WX, defaultType));
|
||||
if (CheckUtils.isCheckUser()) {
|
||||
ll_type_first.setVisibility(View.VISIBLE);
|
||||
ll_type_second.setVisibility(View.GONE);
|
||||
ll_more.setVisibility(View.GONE);
|
||||
}
|
||||
}
|
||||
|
||||
private void setWxPayFirst(int defaultType) {
|
||||
iv_type_first.setImageDrawable(getResources().getDrawable(R.drawable.dialog_charge_ic_wechat));
|
||||
iv_type_second.setImageDrawable(getResources().getDrawable(R.drawable.dialog_charge_ic_alipay));
|
||||
tv_type_first.setText("微信");
|
||||
tv_type_second.setText("支付宝");
|
||||
ll_type_first.setOnClickListener(v -> selectPayChannelDisplay(Constants.CHARGE_WX, defaultType));
|
||||
ll_type_second.setOnClickListener(v -> selectPayChannelDisplay(Constants.CHARGE_ALIPAY, defaultType));
|
||||
if (CheckUtils.isCheckUser()) {
|
||||
ll_type_first.setVisibility(View.GONE);
|
||||
ll_type_second.setVisibility(View.VISIBLE);
|
||||
ll_more.setVisibility(View.GONE);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Subscribe(threadMode = ThreadMode.MAIN)
|
||||
public void onGetPassword(PasswordEvent event) {
|
||||
getDialogManager().showProgressDialog(this);
|
||||
PaymentActivity.startToPay(this, Constants.CHARGE_UNION_PAY, event.getPassword());
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean needSteepStateBar() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void setStatusBar() {
|
||||
super.setStatusBar();
|
||||
StatusBarUtil.transparencyBar(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBackPressed() {
|
||||
super.onBackPressed();
|
||||
finishPage();
|
||||
}
|
||||
|
||||
private void finishPage() {
|
||||
finish();
|
||||
if (!mIsFromH5) return;
|
||||
EventBus.getDefault().post(new WebViewRefreshEvent());
|
||||
}
|
||||
}
|
@@ -1,294 +0,0 @@
|
||||
package com.yizhuan.erban.ui.pay;
|
||||
|
||||
import android.animation.ObjectAnimator;
|
||||
import android.app.Dialog;
|
||||
import android.content.Context;
|
||||
import android.graphics.drawable.ColorDrawable;
|
||||
import android.os.Bundle;
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.fragment.app.DialogFragment;
|
||||
import androidx.fragment.app.FragmentManager;
|
||||
import androidx.recyclerview.widget.LinearLayoutManager;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
import android.text.TextUtils;
|
||||
import android.util.DisplayMetrics;
|
||||
import android.view.Display;
|
||||
import android.view.Gravity;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.view.Window;
|
||||
import android.view.WindowManager;
|
||||
import android.widget.Button;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.LinearLayout;
|
||||
import android.widget.TextView;
|
||||
|
||||
import com.netease.nim.uikit.common.util.sys.ScreenUtil;
|
||||
import com.yizhuan.erban.R;
|
||||
import com.yizhuan.erban.ui.pay.adapter.ConfirmPaymentSelectBankAdapter;
|
||||
import com.yizhuan.erban.ui.utils.ImageLoadUtils;
|
||||
import com.yizhuan.erban.ui.widget.magicindicator.buildins.UIUtil;
|
||||
import com.yizhuan.xchat_android_core.bank_card.bean.BankCardBean;
|
||||
import com.yizhuan.xchat_android_core.pay.model.unionpay.UnionPayModel;
|
||||
import com.yizhuan.xchat_android_library.utils.ListUtils;
|
||||
import com.zyyoona7.lib.EasyPopup;
|
||||
import com.zyyoona7.lib.HorizontalGravity;
|
||||
import com.zyyoona7.lib.VerticalGravity;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import butterknife.BindView;
|
||||
import butterknife.ButterKnife;
|
||||
import butterknife.Unbinder;
|
||||
|
||||
public class ConfirmPaymentDialog extends DialogFragment implements View.OnClickListener {
|
||||
|
||||
public static final String CONFIRM_PAYMENT_AMOUNT = "confirm_payment_amount";
|
||||
@BindView(R.id.iv_close)
|
||||
ImageView ivClose;
|
||||
@BindView(R.id.tv_amount)
|
||||
TextView tvAmount;
|
||||
@BindView(R.id.iv_selected_bank_img)
|
||||
ImageView ivSelectedBankImg;
|
||||
@BindView(R.id.tv_selected_bank_name)
|
||||
TextView tvSelectedBankName;
|
||||
@BindView(R.id.iv_select)
|
||||
ImageView ivSelect;
|
||||
@BindView(R.id.layout_select_way)
|
||||
LinearLayout layoutSelectWay;
|
||||
@BindView(R.id.btn_pay)
|
||||
Button btnPay;
|
||||
|
||||
Unbinder unbinder;
|
||||
private Context context;
|
||||
|
||||
private EasyPopup easyPopup;
|
||||
private ObjectAnimator objectAnimatorUp, objectAnimatorDown;
|
||||
|
||||
// 参数
|
||||
private double amount;
|
||||
private OnConfirmPaymentSelectBankListener onConfirmPaymentSelectBankListener;
|
||||
|
||||
// 选中的银行卡信息
|
||||
private BankCardBean selectedBankInfo;
|
||||
|
||||
public static ConfirmPaymentDialog newInstance(double amount, OnConfirmPaymentSelectBankListener listener) {
|
||||
|
||||
Bundle args = new Bundle();
|
||||
args.putDouble(CONFIRM_PAYMENT_AMOUNT, amount);
|
||||
ConfirmPaymentDialog fragment = new ConfirmPaymentDialog();
|
||||
fragment.setArguments(args);
|
||||
if (listener != null) {
|
||||
fragment.setOnConfirmPaymentSelectBankListener(listener);
|
||||
}
|
||||
return fragment;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onAttach(Context context) {
|
||||
super.onAttach(context);
|
||||
this.context = context;
|
||||
if (getArguments() != null) {
|
||||
amount = getArguments().getDouble(CONFIRM_PAYMENT_AMOUNT);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onCreate(@Nullable Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
setStyle(DialogFragment.STYLE_NO_TITLE, R.style.ErbanBottomSheetDialog);
|
||||
}
|
||||
|
||||
@NonNull
|
||||
@Override
|
||||
public Dialog onCreateDialog(Bundle savedInstanceState) {
|
||||
Dialog dialog = super.onCreateDialog(savedInstanceState);
|
||||
dialog.setCanceledOnTouchOutside(true);
|
||||
dialog.setCancelable(true);
|
||||
return dialog;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onStart() {
|
||||
super.onStart();
|
||||
Window window = getDialog().getWindow();
|
||||
if (window != null) {
|
||||
window.setBackgroundDrawable(new ColorDrawable(getResources().getColor(R.color.transparent)));
|
||||
WindowManager.LayoutParams layoutParams = getDialog().getWindow().getAttributes();
|
||||
DisplayMetrics dm = new DisplayMetrics();
|
||||
Display display = window.getWindowManager().getDefaultDisplay();
|
||||
display.getRealMetrics(dm);
|
||||
if (getActivity() != null && getActivity().getWindowManager() != null) {
|
||||
getActivity().getWindowManager().getDefaultDisplay().getMetrics(dm);
|
||||
}
|
||||
layoutParams.width = dm.widthPixels;
|
||||
layoutParams.height = ScreenUtil.dip2px(400);
|
||||
layoutParams.gravity = Gravity.BOTTOM;
|
||||
window.setAttributes(layoutParams);
|
||||
}
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
|
||||
View view = inflater.inflate(R.layout.dialog_confirm_payment, container);
|
||||
unbinder = ButterKnife.bind(this, view);
|
||||
|
||||
initAnim();
|
||||
setListeners();
|
||||
setAmountInfo();
|
||||
initBankListData();
|
||||
return view;
|
||||
}
|
||||
|
||||
private void initAnim() {
|
||||
objectAnimatorUp = ObjectAnimator.ofFloat(ivSelect, "rotation", 180f);
|
||||
objectAnimatorUp.setDuration(600);
|
||||
objectAnimatorDown = ObjectAnimator.ofFloat(ivSelect, "rotation", 360f);
|
||||
objectAnimatorDown.setDuration(600);
|
||||
}
|
||||
|
||||
private void setListeners() {
|
||||
ivClose.setOnClickListener(this);
|
||||
btnPay.setOnClickListener(this);
|
||||
layoutSelectWay.setOnClickListener(this);
|
||||
}
|
||||
|
||||
private void setAmountInfo() {
|
||||
tvAmount.setText(String.format("%s", amount));
|
||||
changeButtonState();// 金额赋值
|
||||
}
|
||||
|
||||
private void initBankListData() {
|
||||
if (UnionPayModel.getInstance().getUnionPayOrder() != null && !ListUtils.isListEmpty(UnionPayModel.getInstance().getUnionPayOrder().getCardInfos())) {
|
||||
List<BankCardBean> bankCardList = UnionPayModel.getInstance().getUnionPayOrder().getCardInfos();
|
||||
// 选择银行卡弹出框
|
||||
initEasyPop(bankCardList);
|
||||
// 默认选中银行卡
|
||||
for (BankCardBean bankCardBean : bankCardList) {
|
||||
if (bankCardBean != null && bankCardBean.isDefaultPaymentCard()) {
|
||||
selectedBankInfo = bankCardBean;
|
||||
}
|
||||
}
|
||||
if (selectedBankInfo == null) {
|
||||
BankCardBean defaultBankCardBean = bankCardList.get(0);
|
||||
if (defaultBankCardBean != null) {
|
||||
selectedBankInfo = defaultBankCardBean;
|
||||
}
|
||||
}
|
||||
setBankInfo();
|
||||
}
|
||||
}
|
||||
|
||||
private void initEasyPop(List<BankCardBean> list) {
|
||||
easyPopup = new EasyPopup(context)
|
||||
.setContentView(R.layout.dialog_confirm_payment_select)
|
||||
.setFocusAndOutsideEnable(true)
|
||||
.setBackgroundDimEnable(false)
|
||||
.setWidth(UIUtil.dip2px(context, 280))
|
||||
.setHeight(UIUtil.dip2px(context, 200))
|
||||
.createPopup();
|
||||
RecyclerView bankRecyclerView = easyPopup.getView(R.id.recycler_bank_list);
|
||||
bankRecyclerView.setLayoutManager(new LinearLayoutManager(context));
|
||||
ConfirmPaymentSelectBankAdapter adapter = new ConfirmPaymentSelectBankAdapter(R.layout.item_confirm_payment_select_bank, list);
|
||||
bankRecyclerView.setAdapter(adapter);
|
||||
adapter.setOnItemClickListener((adapter1, view, position) -> {
|
||||
Object item = adapter1.getItem(position);
|
||||
if (item instanceof BankCardBean) {
|
||||
selectedBankInfo = (BankCardBean) item;
|
||||
setBankInfo();
|
||||
}
|
||||
dismissPopup();
|
||||
});
|
||||
|
||||
easyPopup.setOnDismissListener(() -> {
|
||||
if (objectAnimatorDown != null) {
|
||||
objectAnimatorDown.start();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private void setBankInfo() {
|
||||
if (selectedBankInfo == null) {
|
||||
return;
|
||||
}
|
||||
String bankCardNo = selectedBankInfo.getBankCardNo();
|
||||
if (TextUtils.isEmpty(bankCardNo) && bankCardNo.length() < 4) {
|
||||
bankCardNo = "";
|
||||
} else {
|
||||
bankCardNo = bankCardNo.substring(bankCardNo.length() - 4);
|
||||
}
|
||||
String bankName = TextUtils.isEmpty(selectedBankInfo.getBankName()) ? "" : selectedBankInfo.getBankName();
|
||||
tvSelectedBankName.setText(String.format("%s(%s)", bankName, bankCardNo));
|
||||
ImageLoadUtils.loadImage(context, selectedBankInfo.getBankLogo(), ivSelectedBankImg);
|
||||
|
||||
changeButtonState();// 银行卡信息赋值
|
||||
}
|
||||
|
||||
private void changeButtonState() {
|
||||
if (amount > 0 && selectedBankInfo != null) {
|
||||
btnPay.setEnabled(true);
|
||||
} else {
|
||||
btnPay.setEnabled(false);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onClick(View view) {
|
||||
int id = view.getId();
|
||||
if (id == R.id.iv_close) {// 关闭
|
||||
dismiss();
|
||||
} else if (id == R.id.btn_pay) {// 支付
|
||||
if (onConfirmPaymentSelectBankListener != null && selectedBankInfo != null) {
|
||||
onConfirmPaymentSelectBankListener.onSelectFinish(selectedBankInfo);
|
||||
}
|
||||
dismiss();
|
||||
} else if (id == R.id.layout_select_way) {// 选择支付方式
|
||||
showPopup();
|
||||
}
|
||||
}
|
||||
|
||||
private void showPopup() {
|
||||
if (easyPopup != null) {
|
||||
easyPopup.showAtAnchorView(layoutSelectWay,
|
||||
VerticalGravity.BELOW,
|
||||
HorizontalGravity.ALIGN_RIGHT,
|
||||
UIUtil.dip2px(context, -15),
|
||||
UIUtil.dip2px(context, 15));
|
||||
if (objectAnimatorUp != null) {
|
||||
objectAnimatorUp.start();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void dismissPopup() {
|
||||
if (easyPopup != null) {
|
||||
easyPopup.dismiss();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDestroyView() {
|
||||
super.onDestroyView();
|
||||
unbinder.unbind();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void show(FragmentManager manager, String tag) {
|
||||
if (manager.findFragmentByTag(tag) == null) {
|
||||
manager.beginTransaction()
|
||||
.add(this, tag)
|
||||
.commitAllowingStateLoss();
|
||||
}
|
||||
}
|
||||
|
||||
public interface OnConfirmPaymentSelectBankListener {
|
||||
void onSelectFinish(BankCardBean selectedBankInfo);
|
||||
}
|
||||
|
||||
public void setOnConfirmPaymentSelectBankListener(OnConfirmPaymentSelectBankListener onConfirmPaymentSelectBankListener) {
|
||||
this.onConfirmPaymentSelectBankListener = onConfirmPaymentSelectBankListener;
|
||||
}
|
||||
}
|
@@ -1,40 +0,0 @@
|
||||
package com.yizhuan.erban.ui.pay.adapter;
|
||||
|
||||
import androidx.annotation.Nullable;
|
||||
import android.text.TextUtils;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.TextView;
|
||||
|
||||
import com.chad.library.adapter.base.BaseQuickAdapter;
|
||||
import com.chad.library.adapter.base.BaseViewHolder;
|
||||
import com.yizhuan.erban.R;
|
||||
import com.yizhuan.erban.ui.utils.ImageLoadUtils;
|
||||
import com.yizhuan.xchat_android_core.bank_card.bean.BankCardBean;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class ConfirmPaymentSelectBankAdapter extends BaseQuickAdapter<BankCardBean, BaseViewHolder> {
|
||||
|
||||
public ConfirmPaymentSelectBankAdapter(int layoutResId, @Nullable List<BankCardBean> data) {
|
||||
super(layoutResId, data);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void convert(BaseViewHolder helper, BankCardBean item) {
|
||||
if (item == null) {
|
||||
return;
|
||||
}
|
||||
ImageView bankImage = helper.getView(R.id.iv_bank_image);
|
||||
ImageLoadUtils.loadImage(mContext, item.getBankLogo(), bankImage);
|
||||
|
||||
TextView tvBankName = helper.getView(R.id.tv_bank_name);
|
||||
String bankCardNo = item.getBankCardNo();
|
||||
if (TextUtils.isEmpty(bankCardNo) && bankCardNo.length() < 4) {
|
||||
bankCardNo = "";
|
||||
} else {
|
||||
bankCardNo = bankCardNo.substring(bankCardNo.length() - 4);
|
||||
}
|
||||
String bankName = TextUtils.isEmpty(item.getBankName()) ? "" : item.getBankName();
|
||||
tvBankName.setText(String.format("%s(%s)", bankName, bankCardNo));
|
||||
}
|
||||
}
|
@@ -14,9 +14,6 @@ import android.webkit.WebView;
|
||||
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.alibaba.security.realidentity.RPEventListener;
|
||||
import com.alibaba.security.realidentity.RPResult;
|
||||
import com.alibaba.security.realidentity.RPVerify;
|
||||
import com.netease.nim.uikit.common.util.log.LogUtil;
|
||||
import com.orhanobut.logger.Logger;
|
||||
import com.umeng.commonsdk.statistics.common.DeviceConfig;
|
||||
@@ -458,36 +455,7 @@ public class JSInterface {
|
||||
*/
|
||||
@JavascriptInterface
|
||||
public void openFaceLiveness(String verifyToken) {
|
||||
Log.d(TAG, "openFaceLiveness() called with: verifyToken = [" + verifyToken + "]");
|
||||
RPVerify.start(mActivity, verifyToken, new RPEventListener() {
|
||||
@Override
|
||||
public void onFinish(RPResult rpResult, String s, String s1) {
|
||||
Log.d(TAG, String.format(Locale.getDefault(), "openFaceLiveness: auit: %s, s: %s",
|
||||
rpResult, s));
|
||||
int result = -3;
|
||||
if (rpResult == RPResult.AUDIT_PASS) {
|
||||
// 认证通过
|
||||
result = 2;
|
||||
// 更新本地缓存
|
||||
UserInfo userInfo = UserModel.get().getCacheLoginUserInfo();
|
||||
if (userInfo != null) {
|
||||
userInfo.setCertified(true);
|
||||
}
|
||||
// 认证通过的时候刷新用户信息
|
||||
UserModel.get().updateCurrentUserInfo().subscribe();
|
||||
} else if (rpResult == RPResult.AUDIT_FAIL) {
|
||||
// 认证不通过
|
||||
result = 1;
|
||||
} else if (rpResult == RPResult.AUDIT_NOT) {
|
||||
// 未认证,用户取消
|
||||
result = -1;
|
||||
} else if (rpResult == RPResult.AUDIT_EXCEPTION) {
|
||||
// 系统异常
|
||||
result = -2;
|
||||
}
|
||||
EventBus.getDefault().post(new CertificationResultEvent().setStatus(result));
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
|
@@ -47,7 +47,7 @@ import com.yizhuan.erban.common.widget.CircleImageView;
|
||||
import com.yizhuan.erban.radish.task.activity.TaskCenterActivity;
|
||||
import com.yizhuan.erban.ui.gift.dialog.GiftInfoVm;
|
||||
import com.yizhuan.erban.ui.gift.dialog.PageIndicatorView;
|
||||
import com.yizhuan.erban.ui.pay.ChargeDialog;
|
||||
import com.yizhuan.erban.ui.pay.ChargeActivity;
|
||||
import com.yizhuan.erban.ui.utils.ImageLoadUtils;
|
||||
import com.yizhuan.erban.ui.webview.DialogWebViewActivity;
|
||||
import com.yizhuan.erban.ui.widget.dialog.GiftManualQuantityDialog;
|
||||
@@ -1040,7 +1040,7 @@ public class GiftDialog extends BottomSheetDialog implements View.OnClickListene
|
||||
if (itemType == ITEM_TYPE_GOLD) {
|
||||
StatisticManager.Instance().onEvent(StatisticsProtocol.EVENT_GIFT_PANEL_TO_RECHARGE, "礼物面板_去充值:" + GIFT_DIALOG_FROM);
|
||||
|
||||
ChargeDialog.start(getContext());
|
||||
ChargeActivity.start(getContext());
|
||||
} else if (itemType == ITEM_TYPE_RADISH) {
|
||||
TaskCenterActivity.start(context, TaskCenterActivity.FromPage.GIFT);
|
||||
}
|
||||
|
@@ -32,7 +32,6 @@ import com.yizhuan.erban.utils.SpannableBuilder;
|
||||
import com.yizhuan.xchat_android_core.UriProvider;
|
||||
import com.yizhuan.xchat_android_core.auth.AuthModel;
|
||||
import com.yizhuan.xchat_android_core.initial.bean.TaxInfo;
|
||||
import com.yizhuan.xchat_android_core.pay.bean.NotRealNameYetException;
|
||||
import com.yizhuan.xchat_android_core.user.UserModel;
|
||||
import com.yizhuan.xchat_android_core.user.bean.UserInfo;
|
||||
import com.yizhuan.xchat_android_core.utils.net.BeanObserver;
|
||||
@@ -60,6 +59,7 @@ import io.reactivex.disposables.Disposable;
|
||||
*/
|
||||
public class WithdrawActivity extends BaseActivity {
|
||||
|
||||
public WithdrwaListInfo checkedPosition;
|
||||
@BindView(R.id.tv_withdraw_type)
|
||||
TextView tvWithdrawType;
|
||||
@BindView(R.id.zhifubao)
|
||||
@@ -68,7 +68,6 @@ public class WithdrawActivity extends BaseActivity {
|
||||
TextView tvTaxMoney;
|
||||
@BindView(R.id.tv_income_money)
|
||||
TextView tvIncomeMoney;
|
||||
|
||||
private TitleBar mTitleBar;
|
||||
private TextView zxcAccount;
|
||||
private TextView alipayName;
|
||||
@@ -79,7 +78,6 @@ public class WithdrawActivity extends BaseActivity {
|
||||
private Button btnWithdraw;
|
||||
private Button unBtnWithdraw;
|
||||
private WithdrawJewelAdapter mJewelAdapter;
|
||||
public WithdrwaListInfo checkedPosition;
|
||||
private WithdrawInfo withdrawInfos = new WithdrawInfo();
|
||||
private TextView tvTip;
|
||||
private TextView tvWithdrawRule;
|
||||
@@ -207,30 +205,16 @@ public class WithdrawActivity extends BaseActivity {
|
||||
if (throwable == null) {
|
||||
onRequestExchange(exchangerInfo);
|
||||
} else {
|
||||
if (throwable instanceof NotRealNameYetException) {
|
||||
NotRealNameYetException exception = (NotRealNameYetException) throwable;
|
||||
getDialogManager().showTipsDialog(getString(R.string.tips_need_to_certification),
|
||||
getString(R.string.go_to_certification),
|
||||
new DialogManager.AbsOkDialogListener() {
|
||||
@Override
|
||||
public void onOk() {
|
||||
// 跳去实名认证页面
|
||||
CommonWebViewActivity.start(WithdrawActivity.this,
|
||||
UriProvider.getTutuRealNamePage());
|
||||
}
|
||||
});
|
||||
} else {
|
||||
throwable.printStackTrace();
|
||||
toast(throwable.getMessage());
|
||||
}
|
||||
throwable.printStackTrace();
|
||||
toast(throwable.getMessage());
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private void loadAlipayInfo() {
|
||||
WithdrawModel.get().getWithdrawUserInfo(
|
||||
AuthModel.get().getCurrentUid()
|
||||
)
|
||||
AuthModel.get().getCurrentUid()
|
||||
)
|
||||
.compose(bindUntilEvent(ActivityEvent.DESTROY))
|
||||
.subscribe(new SingleObserver<WithdrawInfo>() {
|
||||
@Override
|
||||
|
@@ -3,10 +3,8 @@ package com.yizhuan.erban.utils;
|
||||
import android.content.Context;
|
||||
|
||||
import com.netease.nim.uikit.common.util.log.LogUtil;
|
||||
import com.yizhuan.erban.MiddleActivity;
|
||||
import com.yizhuan.erban.NimMiddleActivity;
|
||||
import com.yizhuan.erban.other.activity.SplashActivity;
|
||||
import com.yizhuan.xchat_android_core.pay.PaymentActivity;
|
||||
import com.yizhuan.xchat_android_core.utils.ActivityUtil;
|
||||
|
||||
import java.util.ArrayList;
|
||||
@@ -26,9 +24,7 @@ public class ActWhiteListMrg {
|
||||
return true;
|
||||
}
|
||||
List<Class> acts = new ArrayList<>();
|
||||
acts.add(MiddleActivity.class);
|
||||
acts.add(NimMiddleActivity.class);
|
||||
acts.add(PaymentActivity.class);
|
||||
acts.add(SplashActivity.class);
|
||||
|
||||
for (Class act : acts) {
|
||||
|
@@ -6,7 +6,7 @@ import android.content.Intent
|
||||
import android.content.pm.PackageManager
|
||||
import android.net.Uri
|
||||
import android.os.Build
|
||||
import com.microquation.linkedme.android.v4.ContextCompatLKMe
|
||||
import androidx.core.content.ContextCompat
|
||||
import com.yizhuan.erban.BuildConfig
|
||||
import com.yizhuan.erban.ui.setting.bean.PermissionEntity
|
||||
import java.lang.Exception
|
||||
@@ -27,7 +27,7 @@ class PermissionUtil {
|
||||
it
|
||||
} else {
|
||||
it.filter { s ->
|
||||
ContextCompatLKMe.checkSelfPermission(context, s) ==
|
||||
ContextCompat.checkSelfPermission(context, s) ==
|
||||
PackageManager.PERMISSION_GRANTED
|
||||
}
|
||||
}
|
||||
|
@@ -19,11 +19,9 @@ import com.opensource.svgaplayer.SVGAParser
|
||||
import com.opensource.svgaplayer.SVGAVideoEntity
|
||||
import com.yizhuan.erban.R
|
||||
import com.yizhuan.erban.avroom.firstcharge.SelectPayTypeDialog
|
||||
import com.yizhuan.erban.bank_card.activity.AddBankCardAgreementActivity
|
||||
import com.yizhuan.erban.base.BaseViewBindingActivity
|
||||
import com.yizhuan.erban.base.TitleBar
|
||||
import com.yizhuan.erban.common.EmptyViewHelper
|
||||
import com.yizhuan.erban.common.widget.dialog.DialogManager
|
||||
import com.yizhuan.erban.databinding.ActivityVipMainBinding
|
||||
import com.yizhuan.erban.ui.setting.ModifyPwdActivity
|
||||
import com.yizhuan.erban.ui.utils.RVDelegate
|
||||
@@ -32,16 +30,12 @@ import com.yizhuan.erban.ui.widget.magicindicator.buildins.commonnavigator.Commo
|
||||
import com.yizhuan.xchat_android_core.UriProvider
|
||||
import com.yizhuan.xchat_android_core.auth.AuthModel
|
||||
import com.yizhuan.xchat_android_core.pay.PayModel
|
||||
import com.yizhuan.xchat_android_core.pay.PaymentActivity
|
||||
import com.yizhuan.xchat_android_core.pay.bean.PaymentResult
|
||||
import com.yizhuan.xchat_android_core.pay.model.unionpay.UnionPayModel
|
||||
import com.yizhuan.xchat_android_core.statistic.StatisticManager
|
||||
import com.yizhuan.xchat_android_core.statistic.protocol.StatisticsProtocol
|
||||
import com.yizhuan.xchat_android_core.utils.toast
|
||||
import com.yizhuan.xchat_android_core.vip.VipAuthInfo
|
||||
import com.yizhuan.xchat_android_core.vip.VipInfo
|
||||
import com.yizhuan.xchat_android_core.vip.VipOpenEvent
|
||||
import com.yizhuan.xchat_android_library.utils.JavaUtil
|
||||
import org.greenrobot.eventbus.EventBus
|
||||
import org.greenrobot.eventbus.Subscribe
|
||||
import org.greenrobot.eventbus.ThreadMode
|
||||
@@ -287,43 +281,6 @@ class VipMainActivity : BaseViewBindingActivity<ActivityVipMainBinding>(),
|
||||
if (resultCode != RESULT_OK) {
|
||||
return
|
||||
}
|
||||
//支付页面返回处理
|
||||
if (requestCode == PaymentActivity.REQUEST_CODE_PAY) {
|
||||
if (data != null && data.extras != null) {
|
||||
val paymentResult: PaymentResult? =
|
||||
data.getParcelableExtra(PaymentActivity.KEY_PAY_RESULT)
|
||||
if (paymentResult != null) {
|
||||
// 充值金额超过限定时,就必须先实名认证
|
||||
when (JavaUtil.str2int(paymentResult.code)) {
|
||||
PayModel.NOT_REAL_NAME_BEFORE_CHARGING -> dialogManager.showTipsDialog(
|
||||
getString(R.string.tips_need_to_certification),
|
||||
getString(R.string.go_to_certification),
|
||||
object : DialogManager.AbsOkDialogListener() {
|
||||
override fun onOk() {
|
||||
// 跳去实名认证页面
|
||||
CommonWebViewActivity.start(
|
||||
this@VipMainActivity,
|
||||
UriProvider.getTutuRealNamePage()
|
||||
)
|
||||
}
|
||||
})
|
||||
UnionPayModel.CODE_NEED_BIND_BANK_CARD_FIRST -> dialogManager.showTipsDialog(
|
||||
getString(R.string.tips_need_bind_bank_card_first),
|
||||
object : DialogManager.AbsOkDialogListener() {
|
||||
override fun onOk() {
|
||||
// 跳去添加银行卡页面
|
||||
AddBankCardAgreementActivity.start(this@VipMainActivity)
|
||||
}
|
||||
})
|
||||
else -> {
|
||||
toast(paymentResult.msg)
|
||||
//重新获取钱包信息
|
||||
PayModel.get().getWalletInfo(AuthModel.get().currentUid).subscribe()
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (requestCode == BIND_CODE_GOLD) {
|
||||
ModifyPwdActivity.start(this, ModifyPwdActivity.FOGERT_PAY_PWD)
|
||||
}
|
||||
@@ -335,7 +292,6 @@ class VipMainActivity : BaseViewBindingActivity<ActivityVipMainBinding>(),
|
||||
vipViewModel.getVipPageInfo()
|
||||
}
|
||||
|
||||
|
||||
override fun onDestroy() {
|
||||
super.onDestroy()
|
||||
EventBus.getDefault().unregister(this)
|
||||
|
@@ -1,124 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="400dp"
|
||||
android:id="@+id/layout_container"
|
||||
android:layout_gravity="bottom"
|
||||
android:background="@drawable/bg_confirm_payment"
|
||||
android:minHeight="400dp">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/iv_close"
|
||||
android:layout_width="14dp"
|
||||
android:layout_height="14dp"
|
||||
android:layout_marginStart="20dp"
|
||||
android:layout_marginTop="15dp"
|
||||
android:src="@drawable/ic_confirm_payment_close"
|
||||
app:layout_constraintLeft_toLeftOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
tools:ignore="ContentDescription" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_title"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="28dp"
|
||||
android:text="@string/confirm_payment"
|
||||
android:textColor="#333333"
|
||||
android:textSize="18sp"
|
||||
android:textStyle="bold"
|
||||
app:layout_constraintLeft_toLeftOf="parent"
|
||||
app:layout_constraintRight_toRightOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_amount"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="50dp"
|
||||
android:textColor="#333333"
|
||||
android:textSize="52sp"
|
||||
android:textStyle="bold"
|
||||
app:layout_constraintLeft_toLeftOf="parent"
|
||||
app:layout_constraintRight_toRightOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/tv_title"
|
||||
tools:text="998" />
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginEnd="10dp"
|
||||
android:layout_marginBottom="10dp"
|
||||
android:text="@string/confirm_payment_unit"
|
||||
android:textColor="#333333"
|
||||
android:textSize="23sp"
|
||||
android:textStyle="bold"
|
||||
app:layout_constraintBottom_toBottomOf="@id/tv_amount"
|
||||
app:layout_constraintRight_toLeftOf="@id/tv_amount" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_payment_way_title"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="24dp"
|
||||
android:layout_marginTop="56dp"
|
||||
android:text="@string/confirm_payment_way"
|
||||
android:textColor="#999999"
|
||||
android:textSize="15sp"
|
||||
app:layout_constraintLeft_toLeftOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/tv_amount" />
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/layout_select_way"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginEnd="24dp"
|
||||
android:gravity="center_vertical"
|
||||
android:orientation="horizontal"
|
||||
app:layout_constraintBottom_toBottomOf="@id/tv_payment_way_title"
|
||||
app:layout_constraintRight_toRightOf="parent"
|
||||
app:layout_constraintTop_toTopOf="@id/tv_payment_way_title">
|
||||
|
||||
<com.yizhuan.erban.common.widget.CircleImageView
|
||||
android:id="@+id/iv_selected_bank_img"
|
||||
android:layout_width="15dp"
|
||||
android:layout_height="15dp"
|
||||
android:layout_marginEnd="8dp"
|
||||
tools:ignore="ContentDescription" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_selected_bank_name"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginEnd="14dp"
|
||||
android:textColor="#333333"
|
||||
android:textSize="15sp"
|
||||
tools:text="中国农业银行(1234)" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/iv_select"
|
||||
android:layout_width="12dp"
|
||||
android:layout_height="12dp"
|
||||
android:src="@drawable/ic_confirm_payment_select_way_down"
|
||||
tools:ignore="ContentDescription" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<Button
|
||||
android:id="@+id/btn_pay"
|
||||
android:background="@drawable/shape_semi_round_gray_solid"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="43dp"
|
||||
android:layout_marginStart="38dp"
|
||||
android:layout_marginEnd="38dp"
|
||||
android:textColor="#333333"
|
||||
android:textSize="16sp"
|
||||
android:layout_marginBottom="35dp"
|
||||
android:text="@string/confirm_payment_button"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintLeft_toLeftOf="parent"
|
||||
app:layout_constraintRight_toRightOf="parent" />
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
@@ -1,107 +0,0 @@
|
||||
package com.yizhuan.erban.quick_pass;
|
||||
|
||||
import android.content.Context;
|
||||
import android.graphics.Color;
|
||||
|
||||
import androidx.core.content.ContextCompat;
|
||||
|
||||
import com.netease.nis.quicklogin.helper.UnifyUiConfig;
|
||||
import com.yizhuan.erban.R;
|
||||
import com.yizhuan.xchat_android_core.PreferencesUtils;
|
||||
|
||||
/**
|
||||
* Created by hzhuqi on 2019/12/31
|
||||
*/
|
||||
public class QuickLoginUiConfig {
|
||||
public static UnifyUiConfig getUiConfig(final Context context) {
|
||||
|
||||
int logoToTop = 60;
|
||||
int logoWidth = 100;
|
||||
int logoHeight = 100;
|
||||
int maskNumToTop = logoToTop + logoHeight + 170;
|
||||
int maskNumSize = 20;
|
||||
int sloganToTop = maskNumToTop + maskNumSize + 10;
|
||||
int sloganSize = 14;
|
||||
int loginBtnToTop = sloganToTop + sloganSize + 30;
|
||||
int loginBtnHeight = 45;
|
||||
|
||||
int X_OFFSET = 0;
|
||||
int BOTTOM_OFFSET = 0;
|
||||
final boolean privacyState = PreferencesUtils.readPrivacyState();
|
||||
UnifyUiConfig uiConfig = new UnifyUiConfig.Builder()
|
||||
// 状态栏
|
||||
.setStatusBarDarkColor(true)
|
||||
.setStatusBarColor(ContextCompat.getColor(context, R.color.bg_normal_1c1b22))
|
||||
.setBackgroundImage("bg_normal")
|
||||
// 设置导航栏
|
||||
.setHideNavigation(false)
|
||||
.setHideNavigationBackIcon(false)
|
||||
.setNavigationIcon("quick_pass_back")
|
||||
.setNavigationHeight(50)
|
||||
.setNavigationBackIconWidth(25)
|
||||
.setNavigationBackIconHeight(25)
|
||||
.setNavigationTitle("一键登录")
|
||||
.setNavigationTitleColor(ContextCompat.getColor(context, R.color.text_normal_c6c6e9))
|
||||
// 设置logo
|
||||
.setLogoIconName("quick_pass_logo")
|
||||
.setLogoWidth(logoWidth)
|
||||
.setLogoHeight(logoHeight)
|
||||
.setLogoXOffset(X_OFFSET)
|
||||
.setLogoTopYOffset(logoToTop)
|
||||
.setHideLogo(false)
|
||||
//手机掩码
|
||||
.setMaskNumberColor(ContextCompat.getColor(context, R.color.text_normal_c6c6e9))
|
||||
.setMaskNumberSize(maskNumSize)
|
||||
.setMaskNumberXOffset(X_OFFSET)
|
||||
.setMaskNumberTopYOffset(maskNumToTop)
|
||||
.setMaskNumberBottomYOffset(BOTTOM_OFFSET)
|
||||
// 认证品牌
|
||||
.setSloganSize(sloganSize)
|
||||
.setSloganColor(ContextCompat.getColor(context, R.color.text_secondary_4f516a))
|
||||
.setSloganXOffset(X_OFFSET)
|
||||
.setSloganTopYOffset(sloganToTop)
|
||||
.setSloganBottomYOffset(BOTTOM_OFFSET)
|
||||
// 登录按钮
|
||||
.setLoginBtnTextColor(ContextCompat.getColor(context, R.color.white))
|
||||
.setLoginBtnText("本机号码一键登录")
|
||||
.setLoginBtnBackgroundRes("bg_common_confirm")
|
||||
.setLoginBtnWidth(280)
|
||||
.setLoginBtnHeight(loginBtnHeight)
|
||||
.setLoginBtnTextSize(15)
|
||||
.setLoginBtnXOffset(X_OFFSET)
|
||||
.setLoginBtnTopYOffset(loginBtnToTop)
|
||||
.setLoginBtnBottomYOffset(BOTTOM_OFFSET)
|
||||
// 隐私栏
|
||||
.setPrivacyTextStart("登录即代表同意")
|
||||
.setPrivacyTextEnd(context.getString(R.string.authorization_text))
|
||||
.setPrivacyTextColor(ContextCompat.getColor(context, R.color.text_secondary_4f516a))
|
||||
.setPrivacyProtocolColor(ContextCompat.getColor(context, R.color.app_248cfe))
|
||||
.setHidePrivacyCheckBox(false)
|
||||
|
||||
/**
|
||||
* offset只是设置左侧的间距,无法左右居中,易盾并没有提供左右居中的api;
|
||||
* 通过更改yd_quick_login_privacy.xml实现(文件在quicklogin_libary-external-release.aar)
|
||||
*/
|
||||
// .setPrivacyXOffset(43)
|
||||
|
||||
.setPrivacyState(privacyState)
|
||||
.setPrivacySize(12)
|
||||
// .setPrivacyTopYOffset(510)
|
||||
.setPrivacyBottomYOffset(20)
|
||||
.setPrivacyMarginLeft(20)
|
||||
.setPrivacyMarginRight(20)
|
||||
.setCheckedImageName("quick_pass_checked")
|
||||
.setUnCheckedImageName("quick_pass_uncheck")
|
||||
// 协议详情页导航栏
|
||||
.setProtocolPageNavTitle("服务条款")
|
||||
.setProtocolPageNavBackIcon("quick_pass_back")
|
||||
.setProtocolPageNavColor(Color.WHITE)
|
||||
.setClickEventListener((viewType, code) -> {
|
||||
if (viewType == 2) {
|
||||
PreferencesUtils.savePrivacyState(code == 1);
|
||||
}
|
||||
})
|
||||
.build(context);
|
||||
return uiConfig;
|
||||
}
|
||||
}
|
@@ -14,12 +14,8 @@ import android.widget.TextView;
|
||||
import androidx.core.content.ContextCompat;
|
||||
|
||||
import com.netease.nim.uikit.StatusBarUtil;
|
||||
import com.netease.nis.quicklogin.QuickLogin;
|
||||
import com.netease.nis.quicklogin.listener.QuickLoginPreMobileListener;
|
||||
import com.netease.nis.quicklogin.listener.QuickLoginTokenListener;
|
||||
import com.yizhuan.erban.R;
|
||||
import com.yizhuan.erban.base.BaseLoginAct;
|
||||
import com.yizhuan.erban.common.widget.dialog.DialogManager;
|
||||
import com.yizhuan.erban.ui.login.LoginPhoneActivity;
|
||||
import com.yizhuan.xchat_android_constants.XChatConstants;
|
||||
import com.yizhuan.xchat_android_core.DemoCache;
|
||||
@@ -51,7 +47,6 @@ public class QuickPassLoginAct extends BaseLoginAct implements View.OnClickListe
|
||||
private static final int quickPassRequestCode = 1000;
|
||||
|
||||
private TextView tvLoginQuickPass;
|
||||
private QuickLogin login;// BUSINESS_ID为从易盾官网申请的业务id
|
||||
|
||||
private TextView phoneLogin;
|
||||
|
||||
@@ -67,14 +62,10 @@ public class QuickPassLoginAct extends BaseLoginAct implements View.OnClickListe
|
||||
super.onCreate(savedInstanceState);
|
||||
setContentView(R.layout.act_quick_pass);
|
||||
EventBus.getDefault().register(this);
|
||||
login = QuickLogin.getInstance(getApplicationContext(), XChatConstants.QUICK_PASS_BUSINESS_ID);// BUSINESS_ID为从易盾官网申请的业务id
|
||||
login.setUnifyUiConfig(QuickLoginUiConfig.getUiConfig(getApplicationContext()));
|
||||
|
||||
onFindViews();
|
||||
onSetListener();
|
||||
showLoginTip();
|
||||
AuthModel.get().isFromLogin = true;
|
||||
// AppUpgradeHelper.checkAppUpgrade(this);
|
||||
}
|
||||
|
||||
private void onFindViews() {
|
||||
@@ -128,7 +119,6 @@ public class QuickPassLoginAct extends BaseLoginAct implements View.OnClickListe
|
||||
case R.id.tv_login_quick_pass:
|
||||
StatisticManager.Instance().onEvent(
|
||||
StatisticsProtocol.EVENT_ONE_CLICK_LOGIN, "一键登录");
|
||||
preFetchMobileNum();
|
||||
break;
|
||||
case R.id.img_phone_login:
|
||||
StatisticManager.Instance().onEvent(
|
||||
@@ -151,81 +141,6 @@ public class QuickPassLoginAct extends BaseLoginAct implements View.OnClickListe
|
||||
return true;
|
||||
}
|
||||
|
||||
private void preFetchMobileNum() {
|
||||
getDialogManager().showProgressDialog(this, "");
|
||||
login.prefetchMobileNumber(new QuickLoginPreMobileListener() {
|
||||
@Override
|
||||
public void onGetMobileNumberSuccess(String YDToken, final String mobileNumber) {
|
||||
// 注:对于3网UI统一版本SDK,即2.0.0及以后版本,直接在该回调中调用取号接口onePass即可
|
||||
getDialogManager().dismissDialog();
|
||||
onePass();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onGetMobileNumberError(String YDToken, final String msg) {
|
||||
|
||||
toast("一键登录失败,请使用其他方式登录");
|
||||
getDialogManager().dismissDialog();
|
||||
//跳转到手机登录页
|
||||
LoginPhoneActivity.startForResult(QuickPassLoginAct.this, quickPassRequestCode);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private void onePass() {
|
||||
// 易盾保护 token 登录
|
||||
// String yiDunLoginToken = watchman.getToken(XChatConstants.YI_DUN_LOGIN_BUSINESS_ID);
|
||||
// 数美天网 deviceId
|
||||
// String shuMeiDeviceId = SmAntiFraud.getDeviceId();
|
||||
login.onePass(new QuickLoginTokenListener() {
|
||||
@Override
|
||||
public void onGetTokenSuccess(String s, String s1) {
|
||||
setClickEnable(false);
|
||||
AuthModel.get().quickPassLogin(s, s1, "", "")
|
||||
.compose(bindToLifecycle())
|
||||
.subscribe(new SingleObserver<String>() {
|
||||
@Override
|
||||
public void onSubscribe(Disposable d) {
|
||||
if (mCompositeDisposable != null) {
|
||||
mCompositeDisposable.add(d);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onSuccess(String s) {
|
||||
setClickEnable(false);
|
||||
login.quitActivity();
|
||||
StatisticManager.Instance().onEvent(
|
||||
StatisticsProtocol.EVENT_ONE_CLICK_LOGIN_SUCCEED, "一键登录成功");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(Throwable e) {
|
||||
dealWithLoginError(e);
|
||||
setClickEnable(true);
|
||||
StatisticManager.Instance().onEvent(
|
||||
StatisticsProtocol.EVENT_ONE_CLICK_LOGIN_FAILED, "一键登录失败");
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onGetTokenError(String s, String s1) {
|
||||
toast("一键登录失败,请使用其他登录方式");
|
||||
LoginPhoneActivity.startForResult(QuickPassLoginAct.this, quickPassRequestCode);
|
||||
setClickEnable(true);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onCancelGetToken() {
|
||||
super.onCancelGetToken();
|
||||
setClickEnable(true);
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void dealWithLoginError(Throwable e) {
|
||||
if (!(e instanceof IsSuperAdminException)) {
|
||||
|
@@ -13,7 +13,6 @@ buildscript {
|
||||
maven { url 'https://jitpack.io' }
|
||||
google()
|
||||
mavenCentral()
|
||||
maven {url 'https://developer.huawei.com/repo/'}
|
||||
maven { url "https://mvn.mob.com/android" }
|
||||
maven { url 'https://repo1.maven.org/maven2/' }
|
||||
}
|
||||
@@ -24,7 +23,6 @@ buildscript {
|
||||
classpath "io.realm:realm-gradle-plugin:5.3.0"
|
||||
// android 资源混淆插件
|
||||
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
|
||||
classpath 'com.huawei.agconnect:agcp:1.6.0.300'
|
||||
classpath 'com.tencent.vasdolly:plugin:3.0.3'
|
||||
classpath "com.mob.sdk:MobSDK:2018.0319.1724"
|
||||
}
|
||||
@@ -38,7 +36,6 @@ allprojects {
|
||||
maven { url 'https://jitpack.io' }
|
||||
maven { url "https://mvn.mob.com/android" }
|
||||
maven { url 'https://repo1.maven.org/maven2/' }
|
||||
maven { url 'https://developer.huawei.com/repo/' }
|
||||
}
|
||||
//网络慢的话就去 https://maven.aliyun.com/mvn/view 里面找个代理的仓库。
|
||||
}
|
||||
|
Binary file not shown.
@@ -74,10 +74,6 @@ dependencies {
|
||||
|
||||
api fileTree(dir: 'share-sdk-libs', include: ['*.jar'])
|
||||
|
||||
// 支付
|
||||
api fileTree(dir: 'alipay-libs', include: ['*.jar'])
|
||||
api 'com.tencent.mm.opensdk:wechat-sdk-android-with-mta:5.4.0'
|
||||
|
||||
// 声网
|
||||
api 'io.agora.rtc:full-sdk:3.6.2'
|
||||
|
||||
|
Binary file not shown.
@@ -239,35 +239,6 @@ public class XChatConstants {
|
||||
public static final String REPORT_TYPE_DYNAMIC_SQUARE = "DYNAMIC_SQUARE";//广场动态
|
||||
|
||||
|
||||
/**
|
||||
* 小米推送
|
||||
*/
|
||||
public static final String XM_APP_ID = "2882303761519916917";
|
||||
public static final String XM_APP_KEY = "5181991688917";
|
||||
public static final String XM_CERTIFICATE_NAME = "yinyouxiaomi";
|
||||
/**
|
||||
* 魅族推送
|
||||
*/
|
||||
public static final String MZ_APP_ID = "133017";
|
||||
public static final String MZ_APP_KEY = "402fef6295cc493fbd6d7b9b179df7b5";
|
||||
public static final String MZ_CERTIFICATE_NAME = "accompanyMeizu";
|
||||
/**
|
||||
* 华为推送
|
||||
*/
|
||||
public static final String HW_APP_ID = "104321113";
|
||||
public static final String HW_CERTIFICATE_NAME = "yinyouhuawei";
|
||||
/**
|
||||
* vivo推送
|
||||
*/
|
||||
public static final String VIVO_CERTIFICATE_NAME = "yinyouvivo";
|
||||
/**
|
||||
* oppo推送
|
||||
*/
|
||||
public static final String OPPO_CERTIFICATE_NAME = "yinyouoppo";
|
||||
public static final String OPPO_APP_ID = "30517179";
|
||||
public static final String OPPO_APP_KEY = "8323a62958a34ac682096712566f5329";
|
||||
public static final String OPPO_SECRET = "4b65e2f7f7c8419fbbe7b920367814a9";
|
||||
|
||||
/**
|
||||
* Referer (DEBUG)
|
||||
*/
|
||||
|
@@ -8,7 +8,6 @@ import com.yizhuan.xchat_android_core.bean.response.result.ExchangeInfoResult;
|
||||
import com.yizhuan.xchat_android_core.bean.response.result.WithdrawListResult;
|
||||
import com.yizhuan.xchat_android_core.bean.response.result.WithdrawUserInfoResult;
|
||||
import com.yizhuan.xchat_android_core.initial.bean.TaxInfo;
|
||||
import com.yizhuan.xchat_android_core.pay.bean.NotRealNameYetException;
|
||||
import com.yizhuan.xchat_android_core.user.UserModel;
|
||||
import com.yizhuan.xchat_android_core.utils.APIEncryptUtil;
|
||||
import com.yizhuan.xchat_android_core.utils.net.RxHelper;
|
||||
@@ -95,12 +94,7 @@ public class WithdrawModel extends BaseModel implements IWithdrawModel {
|
||||
if (exchangeInfoResult.isSuccess()) {
|
||||
return Single.just(exchangeInfoResult.getData());
|
||||
} else {
|
||||
if (exchangeInfoResult.getCode() == NOT_REAL_NAME_BEFORE_WITHDRAW) {
|
||||
return Single.error(new NotRealNameYetException(
|
||||
exchangeInfoResult.getMessage(), exchangeInfoResult.getCode()));
|
||||
} else {
|
||||
return Single.error(new Throwable(exchangeInfoResult.getMessage()));
|
||||
}
|
||||
return Single.error(new Throwable(exchangeInfoResult.getMessage()));
|
||||
}
|
||||
})
|
||||
.subscribeOn(Schedulers.io())
|
||||
|
@@ -1,22 +1,16 @@
|
||||
package com.yizhuan.xchat_android_core.community.dynamic;
|
||||
|
||||
import com.google.gson.JsonElement;
|
||||
import com.tencent.wxop.stat.event.EventType;
|
||||
import com.yizhuan.xchat_android_core.auth.AuthModel;
|
||||
import com.yizhuan.xchat_android_core.base.BaseModel;
|
||||
import com.yizhuan.xchat_android_core.bean.response.ServiceResult;
|
||||
import com.yizhuan.xchat_android_core.community.CommunityConstant;
|
||||
import com.yizhuan.xchat_android_core.community.bean.WorldDynamicBean;
|
||||
import com.yizhuan.xchat_android_core.community.bean.WorldDynamicListResult;
|
||||
import com.yizhuan.xchat_android_core.statistic.StatisticManager;
|
||||
import com.yizhuan.xchat_android_core.statistic.protocol.StatisticsProtocol;
|
||||
import com.yizhuan.xchat_android_core.utils.net.RxHelper;
|
||||
import com.yizhuan.xchat_android_library.net.rxnet.RxNet;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import cn.sharesdk.framework.Platform;
|
||||
import io.reactivex.Single;
|
||||
import retrofit2.http.POST;
|
||||
import retrofit2.http.Query;
|
||||
|
@@ -1,58 +0,0 @@
|
||||
package com.kuaixiang.haha.wxapi;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.content.Intent;
|
||||
import android.os.Bundle;
|
||||
import android.util.Log;
|
||||
|
||||
import com.tencent.mm.opensdk.constants.ConstantsAPI;
|
||||
import com.tencent.mm.opensdk.modelbase.BaseReq;
|
||||
import com.tencent.mm.opensdk.modelbase.BaseResp;
|
||||
import com.tencent.mm.opensdk.openapi.IWXAPI;
|
||||
import com.tencent.mm.opensdk.openapi.IWXAPIEventHandler;
|
||||
import com.tencent.mm.opensdk.openapi.WXAPIFactory;
|
||||
import com.yizhuan.xchat_android_constants.XChatConstants;
|
||||
import com.yizhuan.xchat_android_core.pay.PaymentActivity;
|
||||
|
||||
public class WXPayEntryActivity extends Activity implements IWXAPIEventHandler {
|
||||
|
||||
private static final String TAG = "WXPayEntryActivity";
|
||||
|
||||
private IWXAPI api;
|
||||
|
||||
@Override
|
||||
public void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
|
||||
api = WXAPIFactory.createWXAPI(this, XChatConstants.WX_APP_ID);
|
||||
api.handleIntent(getIntent(), this);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onNewIntent(Intent intent) {
|
||||
super.onNewIntent(intent);
|
||||
setIntent(intent);
|
||||
api.handleIntent(intent, this);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onResume() {
|
||||
super.onResume();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onReq(BaseReq req) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onResp(BaseResp baseResp) {
|
||||
|
||||
Log.d(TAG, "onPayFinish, errCode = " + baseResp.errCode + ", errorStr = " + baseResp.errStr);
|
||||
|
||||
if (baseResp.getType() == ConstantsAPI.COMMAND_PAY_BY_WX) {
|
||||
Intent intent = new Intent(this, PaymentActivity.class);
|
||||
startActivity(intent);
|
||||
finish();
|
||||
}
|
||||
}
|
||||
}
|
@@ -1,25 +0,0 @@
|
||||
package com.mango.yinyou.wxapi;
|
||||
|
||||
import android.content.Intent;
|
||||
|
||||
import cn.sharesdk.wechat.utils.WXMediaMessage;
|
||||
import cn.sharesdk.wechat.utils.WechatHandlerActivity;
|
||||
|
||||
/**
|
||||
* create by lvzebiao @2019/11/8
|
||||
*/
|
||||
public class WXEntryActivity extends WechatHandlerActivity {
|
||||
|
||||
@Override
|
||||
public void onShowMessageFromWXReq(WXMediaMessage msg) {
|
||||
super.onShowMessageFromWXReq(msg);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onGetMessageFromWXReq(WXMediaMessage msg) {
|
||||
super.onGetMessageFromWXReq(msg);
|
||||
//从小程序返回APP
|
||||
Intent iLaunchMyself = getPackageManager().getLaunchIntentForPackage(getPackageName());
|
||||
startActivity(iLaunchMyself);
|
||||
}
|
||||
}
|
@@ -1,58 +0,0 @@
|
||||
package com.tongdaxing.tutu.wxapi;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.content.Intent;
|
||||
import android.os.Bundle;
|
||||
import android.util.Log;
|
||||
|
||||
import com.tencent.mm.opensdk.constants.ConstantsAPI;
|
||||
import com.tencent.mm.opensdk.modelbase.BaseReq;
|
||||
import com.tencent.mm.opensdk.modelbase.BaseResp;
|
||||
import com.tencent.mm.opensdk.openapi.IWXAPI;
|
||||
import com.tencent.mm.opensdk.openapi.IWXAPIEventHandler;
|
||||
import com.tencent.mm.opensdk.openapi.WXAPIFactory;
|
||||
import com.yizhuan.xchat_android_constants.XChatConstants;
|
||||
import com.yizhuan.xchat_android_core.pay.PaymentActivity;
|
||||
|
||||
public class WXPayEntryActivity extends Activity implements IWXAPIEventHandler {
|
||||
|
||||
private static final String TAG = "WXPayEntryActivity";
|
||||
|
||||
private IWXAPI api;
|
||||
|
||||
@Override
|
||||
public void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
|
||||
api = WXAPIFactory.createWXAPI(this, XChatConstants.WX_APP_ID);
|
||||
api.handleIntent(getIntent(), this);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onNewIntent(Intent intent) {
|
||||
super.onNewIntent(intent);
|
||||
setIntent(intent);
|
||||
api.handleIntent(intent, this);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onResume() {
|
||||
super.onResume();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onReq(BaseReq req) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onResp(BaseResp baseResp) {
|
||||
|
||||
Log.e(TAG, "onPayFinish, errCode = " + baseResp.errCode + ", errorStr = " + baseResp.errStr);
|
||||
|
||||
if (baseResp.getType() == ConstantsAPI.COMMAND_PAY_BY_WX) {
|
||||
Intent intent = new Intent(this, PaymentActivity.class);
|
||||
startActivity(intent);
|
||||
finish();
|
||||
}
|
||||
}
|
||||
}
|
@@ -1,58 +0,0 @@
|
||||
package com.xuanyi.accompany.wxapi;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.content.Intent;
|
||||
import android.os.Bundle;
|
||||
import android.util.Log;
|
||||
|
||||
import com.tencent.mm.opensdk.constants.ConstantsAPI;
|
||||
import com.tencent.mm.opensdk.modelbase.BaseReq;
|
||||
import com.tencent.mm.opensdk.modelbase.BaseResp;
|
||||
import com.tencent.mm.opensdk.openapi.IWXAPI;
|
||||
import com.tencent.mm.opensdk.openapi.IWXAPIEventHandler;
|
||||
import com.tencent.mm.opensdk.openapi.WXAPIFactory;
|
||||
import com.yizhuan.xchat_android_constants.XChatConstants;
|
||||
import com.yizhuan.xchat_android_core.pay.PaymentActivity;
|
||||
|
||||
public class WXPayEntryActivity extends Activity implements IWXAPIEventHandler {
|
||||
|
||||
private static final String TAG = "WXPayEntryActivity";
|
||||
|
||||
private IWXAPI api;
|
||||
|
||||
@Override
|
||||
public void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
|
||||
api = WXAPIFactory.createWXAPI(this, XChatConstants.WX_APP_ID);
|
||||
api.handleIntent(getIntent(), this);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onNewIntent(Intent intent) {
|
||||
super.onNewIntent(intent);
|
||||
setIntent(intent);
|
||||
api.handleIntent(intent, this);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onResume() {
|
||||
super.onResume();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onReq(BaseReq req) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onResp(BaseResp baseResp) {
|
||||
|
||||
Log.e(TAG, "onPayFinish, errCode = " + baseResp.errCode + ", errorStr = " + baseResp.errStr);
|
||||
|
||||
if (baseResp.getType() == ConstantsAPI.COMMAND_PAY_BY_WX) {
|
||||
Intent intent = new Intent(this, PaymentActivity.class);
|
||||
startActivity(intent);
|
||||
finish();
|
||||
}
|
||||
}
|
||||
}
|
@@ -1,446 +0,0 @@
|
||||
package com.yizhuan.xchat_android_core.pay;
|
||||
|
||||
import android.annotation.SuppressLint;
|
||||
import android.app.Activity;
|
||||
import android.content.Intent;
|
||||
import android.os.Bundle;
|
||||
|
||||
import androidx.annotation.Nullable;
|
||||
|
||||
import com.alipay.sdk.app.PayTask;
|
||||
import com.tencent.mm.opensdk.constants.Build;
|
||||
import com.tencent.mm.opensdk.constants.ConstantsAPI;
|
||||
import com.tencent.mm.opensdk.modelbase.BaseReq;
|
||||
import com.tencent.mm.opensdk.modelbase.BaseResp;
|
||||
import com.tencent.mm.opensdk.modelbiz.WXLaunchMiniProgram;
|
||||
import com.tencent.mm.opensdk.modelpay.PayReq;
|
||||
import com.tencent.mm.opensdk.openapi.IWXAPI;
|
||||
import com.tencent.mm.opensdk.openapi.IWXAPIEventHandler;
|
||||
import com.tencent.mm.opensdk.openapi.WXAPIFactory;
|
||||
import com.yizhuan.xchat_android_constants.XChatConstants;
|
||||
import com.yizhuan.xchat_android_core.BuildConfig;
|
||||
import com.yizhuan.xchat_android_core.Constants;
|
||||
import com.yizhuan.xchat_android_core.auth.AuthModel;
|
||||
import com.yizhuan.xchat_android_core.bank_card.bean.BankCardBean;
|
||||
import com.yizhuan.xchat_android_core.exception.FailReasonException;
|
||||
import com.yizhuan.xchat_android_core.exception.NullDataException;
|
||||
import com.yizhuan.xchat_android_core.pay.bean.NotRealNameYetException;
|
||||
import com.yizhuan.xchat_android_core.pay.bean.PaymentResult;
|
||||
import com.yizhuan.xchat_android_core.pay.bean.PmChargeLimitException;
|
||||
import com.yizhuan.xchat_android_core.pay.bean.ShowCommonWebEvent;
|
||||
import com.yizhuan.xchat_android_core.pay.bean.WxPayType;
|
||||
import com.yizhuan.xchat_android_core.pay.bean.alipay.AliPayResponseResult;
|
||||
import com.yizhuan.xchat_android_core.pay.bean.alipay.AliPayResult;
|
||||
import com.yizhuan.xchat_android_core.pay.bean.alipay.AlipayInfo;
|
||||
import com.yizhuan.xchat_android_core.pay.bean.unionpay.UnionPayOrder;
|
||||
import com.yizhuan.xchat_android_core.pay.bean.wechatpay.WeChatAppParam;
|
||||
import com.yizhuan.xchat_android_core.pay.model.alipay.AliPayModel;
|
||||
import com.yizhuan.xchat_android_core.pay.model.unionpay.UnionPayModel;
|
||||
import com.yizhuan.xchat_android_core.pay.model.wechatpay.WeChatPayModel;
|
||||
import com.yizhuan.xchat_android_core.pay.view.IPaymentView;
|
||||
import com.yizhuan.xchat_android_core.utils.net.RxHelper;
|
||||
import com.yizhuan.xchat_android_library.utils.ListUtils;
|
||||
import com.yizhuan.xchat_android_library.utils.SingleToastUtil;
|
||||
|
||||
import org.greenrobot.eventbus.EventBus;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Objects;
|
||||
import java.util.TimeZone;
|
||||
|
||||
import io.reactivex.Single;
|
||||
|
||||
/**
|
||||
* Created by MadisonRong on 24/10/2018.
|
||||
*/
|
||||
public class PaymentActivity extends Activity
|
||||
implements IPaymentView, IWXAPIEventHandler {
|
||||
|
||||
private static final String TAG = "PaymentActivity";
|
||||
|
||||
public static final int REQUEST_CODE_PAY = 1000;
|
||||
public static final String KEY_CHANNEL = "key_channel";
|
||||
public static final String KEY_CHARGE_PRODUCT_ID = "key_charge_product_id";
|
||||
public static final String KEY_PAY_RESULT = "key_pay_result";
|
||||
public static final String KEY_WANNA_GET_ORDER = "key_wanna_get_order";
|
||||
public static final String KEY_PAYMENT_PASSWORD = "key_payment_passowrd";
|
||||
|
||||
private String channel;
|
||||
private String chargeProdId;
|
||||
private boolean wannaGetOrder;
|
||||
private String paymentPassword;
|
||||
private volatile IWXAPI api;
|
||||
|
||||
public static void startToPay(Activity context, String channel, String paymentPassword) {
|
||||
Intent intent = new Intent(context, PaymentActivity.class);
|
||||
intent.putExtra(KEY_CHANNEL, channel);
|
||||
intent.putExtra(KEY_WANNA_GET_ORDER, false);
|
||||
intent.putExtra(KEY_PAYMENT_PASSWORD, paymentPassword);
|
||||
context.startActivityForResult(intent, REQUEST_CODE_PAY);
|
||||
context.overridePendingTransition(0, 0);
|
||||
}
|
||||
|
||||
public static void start(Activity context, String channel, String chargeProdId) {
|
||||
Intent intent = new Intent(context, PaymentActivity.class);
|
||||
intent.putExtra(KEY_CHANNEL, channel);
|
||||
intent.putExtra(KEY_CHARGE_PRODUCT_ID, chargeProdId);
|
||||
intent.putExtra(KEY_WANNA_GET_ORDER, true);
|
||||
context.startActivityForResult(intent, REQUEST_CODE_PAY);
|
||||
context.overridePendingTransition(0, 0);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onCreate(@Nullable Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
if (getIntent() != null) {
|
||||
this.channel = getIntent().getStringExtra(KEY_CHANNEL);
|
||||
this.chargeProdId = getIntent().getStringExtra(KEY_CHARGE_PRODUCT_ID);
|
||||
this.wannaGetOrder = getIntent().getBooleanExtra(KEY_WANNA_GET_ORDER, true);
|
||||
this.paymentPassword = getIntent().getStringExtra(KEY_PAYMENT_PASSWORD);
|
||||
}
|
||||
|
||||
if (channel == null) {
|
||||
return;
|
||||
}
|
||||
switch (channel) {
|
||||
case Constants.CHARGE_ALIPAY:
|
||||
requestAliPay(this, chargeProdId);
|
||||
break;
|
||||
|
||||
case Constants.CHARGE_WX:
|
||||
PayModel.get().getWxpayType()
|
||||
.subscribe(wxPayType -> {
|
||||
if ("APP".equalsIgnoreCase(wxPayType.getWxPayType())) {
|
||||
requestWeChatPay(this, chargeProdId);
|
||||
} else {
|
||||
requestWeChatMiniPay(wxPayType);
|
||||
}
|
||||
}
|
||||
);
|
||||
|
||||
break;
|
||||
|
||||
case Constants.CHARGE_UNION_PAY:
|
||||
if (wannaGetOrder) {
|
||||
requestUnionPayOrder(this, chargeProdId);
|
||||
} else {
|
||||
requestUnionPay(this, paymentPassword);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onNewIntent(Intent intent) {
|
||||
super.onNewIntent(intent);
|
||||
setIntent(intent);
|
||||
if (api != null) {
|
||||
boolean result = api.handleIntent(getIntent(), this);
|
||||
if (!result) {
|
||||
// 返回结果为 false,表示微信 SDK 校验不通过,直接把页面关掉
|
||||
normalBack();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onResume() {
|
||||
super.onResume();
|
||||
if (api != null) {
|
||||
boolean result = api.handleIntent(getIntent(), this);
|
||||
if (!result) {
|
||||
// 返回结果为 false,表示微信 SDK 校验不通过,直接把页面关掉
|
||||
normalBack();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 发起充值(银联支付), 下单
|
||||
*
|
||||
* @param context
|
||||
* @param chargeProdId 充值产品 ID
|
||||
*/
|
||||
@SuppressLint("CheckResult")
|
||||
public void requestUnionPayOrder(Activity context, String chargeProdId) {
|
||||
UnionPayModel.getInstance()
|
||||
.requestUnionPay(chargeProdId)
|
||||
.compose(RxHelper.bindContext(context))
|
||||
.flatMap(unionPayOrder -> {
|
||||
if (unionPayOrder == null) return Single.error(new Throwable("data is null"));
|
||||
List<BankCardBean> cardInfos = unionPayOrder.getCardInfos();
|
||||
if (cardInfos == null || cardInfos.size() <= 0)
|
||||
return Single.error(new Throwable("card info is null"));
|
||||
// 下单成功,调另一个接口进行支付
|
||||
return Single.just(unionPayOrder);
|
||||
})
|
||||
.subscribe((unionPayOrder, throwable) -> {
|
||||
if (throwable == null) {
|
||||
UnionPayModel.getInstance().setUnionPayOrder(unionPayOrder);
|
||||
if (!ListUtils.isListEmpty(unionPayOrder.getCardInfos())) {
|
||||
for (BankCardBean bankCardBean : unionPayOrder.getCardInfos()) {
|
||||
if (bankCardBean.isDefaultPaymentCard()) {
|
||||
UnionPayModel.getInstance().setSelectedBankInfo(bankCardBean);
|
||||
}
|
||||
}
|
||||
if (UnionPayModel.getInstance().getSelectedBankInfo() == null) {
|
||||
UnionPayModel.getInstance().setSelectedBankInfo(unionPayOrder.getCardInfos().get(0));
|
||||
}
|
||||
}
|
||||
back(String.valueOf(PaymentResult.CODE_SHOW_PAYMENT_PSW), "");
|
||||
} else {
|
||||
if (throwable instanceof FailReasonException) {
|
||||
FailReasonException failReasonException = (FailReasonException) throwable;
|
||||
back(String.valueOf(failReasonException.getCode()), failReasonException.getMessage());
|
||||
} else {
|
||||
getChargeOrOrderInfoFail(throwable.getMessage());
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 发起充值(银联支付), 支付
|
||||
*
|
||||
* @param context
|
||||
*/
|
||||
@SuppressLint("CheckResult")
|
||||
public void requestUnionPay(Activity context, String paymentPassword) {
|
||||
UnionPayOrder payOrder = UnionPayModel.getInstance().getUnionPayOrder();
|
||||
if (payOrder == null) return;
|
||||
BankCardBean cardInfo = UnionPayModel.getInstance().getSelectedBankInfo();
|
||||
if (cardInfo == null) return;
|
||||
UnionPayModel.getInstance()
|
||||
.unionPay(payOrder.getOrderNo(), String.valueOf(cardInfo.getRecordId()), paymentPassword)
|
||||
.compose(RxHelper.bindContext(context))
|
||||
.subscribe((s, throwable) -> {
|
||||
if (throwable == null) {
|
||||
back(String.valueOf(PaymentResult.CODE_UNION_PAY_WAITING_FOR_RESULT), "");
|
||||
} else {
|
||||
getChargeOrOrderInfoFail(throwable.getMessage());
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 发起充值(微信支付)
|
||||
*
|
||||
* @param context context
|
||||
* @param chargeProdId 充值产品 ID
|
||||
*/
|
||||
@SuppressLint("CheckResult")
|
||||
public void requestWeChatPay(Activity context, String chargeProdId) {
|
||||
WeChatPayModel.get()
|
||||
.requestWeChatPay(context, chargeProdId)
|
||||
.flatMap(weChatAppParamServiceResult -> {
|
||||
if (weChatAppParamServiceResult == null) return Single.error(new Throwable());
|
||||
if (weChatAppParamServiceResult.isSuccess()) {
|
||||
WeChatAppParam data = weChatAppParamServiceResult.getData();
|
||||
if (data == null) return Single.error(new NullDataException());
|
||||
TimeZone.setDefault(TimeZone.getTimeZone("GMT+8"));
|
||||
|
||||
api = WXAPIFactory.createWXAPI(context, data.getAppId());
|
||||
api.registerApp(data.getAppId());
|
||||
api.handleIntent(getIntent(), PaymentActivity.this);
|
||||
|
||||
if (!api.isWXAppInstalled()) {
|
||||
return Single.error(new Throwable("未安装微信"));
|
||||
}
|
||||
boolean isPaySupported = api.getWXAppSupportAPI() >= Build.PAY_SUPPORTED_SDK_INT;
|
||||
if (!isPaySupported) {
|
||||
return Single.error(new Throwable("不支持的微信版本"));
|
||||
}
|
||||
if (Objects.equals(data.getChannel(), Constants.CHARGE_WX_MP)) {
|
||||
// 调起小程序,用户到小程序那边进行支付
|
||||
WXLaunchMiniProgram.Req req = new WXLaunchMiniProgram.Req();
|
||||
req.userName = data.getOriginalId(); // 填小程序原始id
|
||||
//拉起小程序页面的可带参路径,不填默认拉起小程序首页
|
||||
String path = data.getChargePage();
|
||||
String params = "ticket=" + AuthModel.get().getTicket() + "&chargeProductId=" +
|
||||
chargeProdId + "&uid=" + AuthModel.get().getCurrentUid();
|
||||
if (path.endsWith(Constants.QUESTION_MARK)) {
|
||||
path += params;
|
||||
} else {
|
||||
path += Constants.QUESTION_MARK + params;
|
||||
}
|
||||
req.path = path;
|
||||
req.miniprogramType = data.getProgramType();// 可选打开 开发版,体验版和正式版
|
||||
return Single.just(api.sendReq(req));
|
||||
} else {
|
||||
// 拉起微信,直接支付
|
||||
PayReq req = new PayReq();
|
||||
req.appId = data.getAppId();
|
||||
req.partnerId = data.getPartnerId();
|
||||
req.prepayId = data.getPrepayId();
|
||||
req.packageValue = data.getPackageValue();
|
||||
req.nonceStr = data.getNonceStr();
|
||||
req.timeStamp = data.getTimestamp();
|
||||
req.sign = data.getSign();
|
||||
return Single.just(api.sendReq(req));
|
||||
}
|
||||
} else {
|
||||
if (weChatAppParamServiceResult.getCode() == PayModel.NOT_REAL_NAME_BEFORE_CHARGING) {
|
||||
return Single.error(new NotRealNameYetException(
|
||||
weChatAppParamServiceResult.getMessage(),
|
||||
weChatAppParamServiceResult.getCode()));
|
||||
} else if (weChatAppParamServiceResult.getCode() == PmChargeLimitException.ERROR_CODE) {
|
||||
return Single.error(new PmChargeLimitException(
|
||||
RxHelper.getValidMessage(weChatAppParamServiceResult),
|
||||
weChatAppParamServiceResult.getCode()));
|
||||
} else {
|
||||
return Single.error(new Throwable(weChatAppParamServiceResult.getMessage()));
|
||||
}
|
||||
}
|
||||
})
|
||||
.subscribe((result, throwable) -> {
|
||||
if ((result != null && !result) || throwable != null) {
|
||||
if (throwable instanceof NotRealNameYetException) {
|
||||
NotRealNameYetException exception = (NotRealNameYetException) throwable;
|
||||
back(String.valueOf(exception.getCode()), exception.getMessage());
|
||||
} else if (throwable instanceof PmChargeLimitException) {
|
||||
back(String.valueOf(((PmChargeLimitException) throwable).getCode()), throwable.getMessage());
|
||||
} else {
|
||||
throwable.printStackTrace();
|
||||
PaymentActivity.this.getChargeOrOrderInfoFail(throwable.getMessage());
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 发起充值(微信小程序支付)
|
||||
*/
|
||||
@SuppressLint("CheckResult")
|
||||
public void requestWeChatMiniPay(WxPayType wxPayType) {
|
||||
//微信小程序支付的微信appid和微信登录&支付的appid是不同的...
|
||||
IWXAPI api = WXAPIFactory.createWXAPI(this, wxPayType.getWxminiAppid());
|
||||
api.handleIntent(getIntent(), this);
|
||||
WXLaunchMiniProgram.Req req = new WXLaunchMiniProgram.Req();
|
||||
req.userName = wxPayType.getWxminiId(); // 填小程序原始id
|
||||
//拉起小程序页面的可带参路径,不填默认拉起小程序首页,对于小游戏,可以只传入 query 部分,来实现传参效果,如:传入 "?foo=bar"。
|
||||
req.path = "pages/index/index?ticket=" + AuthModel.get().getTicket() +
|
||||
"&chargeProductId=" + chargeProdId +
|
||||
"&uid=" + AuthModel.get().getCurrentUid() +
|
||||
"&app=" + XChatConstants.APP_MARK;
|
||||
req.miniprogramType = BuildConfig.DEBUG ? WXLaunchMiniProgram.Req.MINIPROGRAM_TYPE_TEST : WXLaunchMiniProgram.Req.MINIPTOGRAM_TYPE_RELEASE;// 可选打开 开发版,体验版和正式版
|
||||
api.sendReq(req);
|
||||
finish();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 发起充值(支付宝支付)
|
||||
*
|
||||
* @param context context
|
||||
* @param chargeProdId 充值产品 ID
|
||||
*/
|
||||
@SuppressLint("CheckResult")
|
||||
public void requestAliPay(Activity context, String chargeProdId) {
|
||||
AliPayModel.get()
|
||||
.requestAliPay(context, chargeProdId)
|
||||
.flatMap(jsonObjectServiceResult -> {
|
||||
if (jsonObjectServiceResult == null) return Single.error(new Throwable());
|
||||
if (jsonObjectServiceResult.isSuccess()) {
|
||||
AlipayInfo alipayInfo = jsonObjectServiceResult.getData();
|
||||
if ("native".equals(alipayInfo.getPayType())) {
|
||||
// 收到订单号之后,发起支付
|
||||
PayTask alipay = new PayTask(context);
|
||||
Map<String, String> result = alipay.payV2(alipayInfo.getOrderData(), true);
|
||||
return Single.just(result);
|
||||
} else if ("h5".equals(alipayInfo.getPayType())) {
|
||||
EventBus.getDefault().post(new ShowCommonWebEvent(this, alipayInfo.getOrderData()));
|
||||
return Single.error(new Throwable());
|
||||
} else {
|
||||
return Single.error(new Throwable());
|
||||
}
|
||||
} else {
|
||||
if (jsonObjectServiceResult.getCode() == PayModel.NOT_REAL_NAME_BEFORE_CHARGING) {
|
||||
return Single.error(new NotRealNameYetException(
|
||||
jsonObjectServiceResult.getMessage(),
|
||||
jsonObjectServiceResult.getCode()));
|
||||
} else if (jsonObjectServiceResult.getCode() == PmChargeLimitException.ERROR_CODE) {
|
||||
return Single.error(new PmChargeLimitException(
|
||||
RxHelper.getValidMessage(jsonObjectServiceResult),
|
||||
jsonObjectServiceResult.getCode()));
|
||||
} else {
|
||||
return Single.error(new Throwable(jsonObjectServiceResult.getMessage()));
|
||||
}
|
||||
}
|
||||
})
|
||||
.compose(RxHelper.handleSchedulers())
|
||||
.subscribe((stringStringMap, throwable) -> {
|
||||
if (throwable == null) {
|
||||
AliPayResult aliPayResult = new AliPayResult(stringStringMap);
|
||||
requestAliPaySuccess(aliPayResult);
|
||||
} else {
|
||||
if (throwable instanceof NotRealNameYetException) {
|
||||
NotRealNameYetException exception = (NotRealNameYetException) throwable;
|
||||
back(String.valueOf(exception.getCode()), exception.getMessage());
|
||||
} else if (throwable instanceof PmChargeLimitException) {
|
||||
back(String.valueOf(((PmChargeLimitException) throwable).getCode()), throwable.getMessage());
|
||||
} else {
|
||||
throwable.printStackTrace();
|
||||
getChargeOrOrderInfoFail(throwable.getMessage());
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public void getChargeOrOrderInfoFail(String error) {
|
||||
back(PaymentResult.CODE_FAIL, error);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void requestAliPaySuccess(AliPayResult aliPayResult) {
|
||||
/**
|
||||
对于支付结果,请商户依赖服务端的异步通知结果。同步通知结果,仅作为支付结束的通知。
|
||||
*/
|
||||
AliPayResponseResult resultInfo = aliPayResult.getResult();// 同步返回需要验证的信息
|
||||
String resultStatus = aliPayResult.getResultStatus();
|
||||
String statusMsg = AliPayResult.resultStatusMap.get(resultStatus);
|
||||
switch (resultStatus) {
|
||||
case AliPayResult.ALI_PAY_SUCCESS:
|
||||
SingleToastUtil.showToast(statusMsg);
|
||||
break;
|
||||
|
||||
default:
|
||||
if (statusMsg != null) {
|
||||
SingleToastUtil.showToast(statusMsg);
|
||||
} else {
|
||||
SingleToastUtil.showToast("充值失败~");
|
||||
}
|
||||
break;
|
||||
}
|
||||
back(resultStatus, statusMsg);
|
||||
}
|
||||
|
||||
private void back(String code, String statusMsg) {
|
||||
getIntent().putExtra(KEY_PAY_RESULT, new PaymentResult(code, statusMsg));
|
||||
normalBack();
|
||||
}
|
||||
|
||||
private void normalBack() {
|
||||
setResult(RESULT_OK, getIntent());
|
||||
finish();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onReq(BaseReq baseReq) {
|
||||
// do nothing
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onResp(BaseResp baseResp) {
|
||||
if (baseResp.getType() == ConstantsAPI.COMMAND_PAY_BY_WX) {
|
||||
back(String.valueOf(baseResp.errCode), baseResp.errStr);
|
||||
} else if (baseResp.getType() == ConstantsAPI.COMMAND_LAUNCH_WX_MINIPROGRAM) {
|
||||
back(String.valueOf(baseResp.errCode), baseResp.errStr);
|
||||
} else {
|
||||
finish();
|
||||
}
|
||||
}
|
||||
}
|
@@ -1,7 +0,0 @@
|
||||
package com.yizhuan.xchat_android_core.pay;
|
||||
|
||||
/**
|
||||
* Created by MadisonRong on 2019-08-28
|
||||
*/
|
||||
public class PaymentSuccessException extends Exception {
|
||||
}
|
@@ -1,19 +0,0 @@
|
||||
package com.yizhuan.xchat_android_core.pay.bean;
|
||||
|
||||
public class NotRealNameYetException extends Exception {
|
||||
|
||||
private int code;
|
||||
|
||||
public NotRealNameYetException(String message, int code) {
|
||||
super(message);
|
||||
this.code = code;
|
||||
}
|
||||
|
||||
public int getCode() {
|
||||
return code;
|
||||
}
|
||||
|
||||
public void setCode(int code) {
|
||||
this.code = code;
|
||||
}
|
||||
}
|
@@ -1,54 +0,0 @@
|
||||
package com.yizhuan.xchat_android_core.pay.bean;
|
||||
|
||||
import android.os.Parcel;
|
||||
import android.os.Parcelable;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class PaymentResult implements Parcelable {
|
||||
|
||||
public static final String CODE_SUCCESS = "0";
|
||||
public static final String CODE_FAIL = "-1";
|
||||
public static final int CODE_SHOW_PAYMENT_PSW = -100;
|
||||
public static final int CODE_UNION_PAY_WAITING_FOR_RESULT = -101;
|
||||
|
||||
private String code;
|
||||
private String msg;
|
||||
|
||||
public PaymentResult() {
|
||||
}
|
||||
|
||||
public PaymentResult(String code, String msg) {
|
||||
this.code = code;
|
||||
this.msg = msg;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int describeContents() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeToParcel(Parcel dest, int flags) {
|
||||
dest.writeString(this.code);
|
||||
dest.writeString(this.msg);
|
||||
}
|
||||
|
||||
protected PaymentResult(Parcel in) {
|
||||
this.code = in.readString();
|
||||
this.msg = in.readString();
|
||||
}
|
||||
|
||||
public static final Parcelable.Creator<PaymentResult> CREATOR = new Parcelable.Creator<PaymentResult>() {
|
||||
@Override
|
||||
public PaymentResult createFromParcel(Parcel source) {
|
||||
return new PaymentResult(source);
|
||||
}
|
||||
|
||||
@Override
|
||||
public PaymentResult[] newArray(int size) {
|
||||
return new PaymentResult[size];
|
||||
}
|
||||
};
|
||||
}
|
@@ -1,24 +0,0 @@
|
||||
package com.yizhuan.xchat_android_core.pay.bean;
|
||||
|
||||
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
|
||||
/**
|
||||
* 青少年模式充值限制
|
||||
* create by lvzebiao @2019/8/6
|
||||
*/
|
||||
@Setter
|
||||
@Getter
|
||||
public class PmChargeLimitException extends Exception {
|
||||
|
||||
public final static int ERROR_CODE = 25000;
|
||||
|
||||
private int code;
|
||||
|
||||
public PmChargeLimitException(String message, int code) {
|
||||
super(message);
|
||||
this.code = code;
|
||||
}
|
||||
|
||||
}
|
@@ -1,17 +0,0 @@
|
||||
package com.yizhuan.xchat_android_core.pay.bean;
|
||||
|
||||
import android.content.Context;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class ShowCommonWebEvent {
|
||||
|
||||
public ShowCommonWebEvent(Context context, String url) {
|
||||
this.context = context;
|
||||
this.url = url;
|
||||
}
|
||||
|
||||
private Context context;
|
||||
private String url;
|
||||
}
|
@@ -1,24 +0,0 @@
|
||||
package com.yizhuan.xchat_android_core.pay.bean.alipay;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class AliPayResponseResult {
|
||||
|
||||
/**
|
||||
* alipay_trade_app_pay_response : {"code":"10000","msg":"Success","app_id":"xxxxxx","auth_app_id":"xxxxxxx","charset":"UTF-8","timestamp":"xxxxxx","out_trade_no":"xxxxxx","total_amount":"xxxxx","trade_no":"xxxxxxx","seller_id":"xxxxxx"}
|
||||
* sign : xxxxxxxx
|
||||
* sign_type : RSA2
|
||||
*/
|
||||
private AlipayTradeAppPayResponseBean alipay_trade_app_pay_response;
|
||||
private String sign;
|
||||
private String sign_type;
|
||||
|
||||
public AlipayTradeAppPayResponseBean getAlipay_trade_app_pay_response() {
|
||||
return alipay_trade_app_pay_response;
|
||||
}
|
||||
|
||||
public void setAlipay_trade_app_pay_response(AlipayTradeAppPayResponseBean alipay_trade_app_pay_response) {
|
||||
this.alipay_trade_app_pay_response = alipay_trade_app_pay_response;
|
||||
}
|
||||
}
|
@@ -1,104 +0,0 @@
|
||||
package com.yizhuan.xchat_android_core.pay.bean.alipay;
|
||||
|
||||
import android.text.TextUtils;
|
||||
|
||||
import com.alibaba.fastjson.JSON;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
public class AliPayResult {
|
||||
|
||||
/**
|
||||
* 订单支付成功
|
||||
*/
|
||||
public static final String ALI_PAY_SUCCESS = "9000";
|
||||
|
||||
/**
|
||||
* 正在处理中,支付结果未知(有可能已经支付成功),请查询商户订单列表中订单的支付状态
|
||||
*/
|
||||
public static final String ALI_PAY_ONGOING = "8000";
|
||||
|
||||
/**
|
||||
* 订单支付失败
|
||||
*/
|
||||
public static final String ALI_PAY_FAIL = "4000";
|
||||
|
||||
/**
|
||||
* 重复请求
|
||||
*/
|
||||
public static final String ALI_PAY_REPEAT_REQUEST = "5000";
|
||||
|
||||
/**
|
||||
* 用户中途取消
|
||||
*/
|
||||
public static final String ALI_PAY_CANCEL = "6001";
|
||||
|
||||
/**
|
||||
* 网络连接出错
|
||||
*/
|
||||
public static final String ALI_PAY_NETWORK_ERROR = "6002";
|
||||
|
||||
/**
|
||||
* 支付结果未知(有可能已经支付成功),请查询商户订单列表中订单的支付状态
|
||||
*/
|
||||
public static final String ALI_PAY_RESULT_UNKNOWN = "6004";
|
||||
|
||||
private String resultStatus;
|
||||
private AliPayResponseResult result;
|
||||
private String memo;
|
||||
public static Map<String, String> resultStatusMap = new HashMap<>();
|
||||
|
||||
static {
|
||||
resultStatusMap.put(ALI_PAY_SUCCESS, "充值成功");
|
||||
resultStatusMap.put(ALI_PAY_ONGOING, "正在处理中,充值结果未知(有可能已经成功),请联系客服");
|
||||
resultStatusMap.put(ALI_PAY_FAIL, "充值失败");
|
||||
resultStatusMap.put(ALI_PAY_REPEAT_REQUEST, "重复请求");
|
||||
resultStatusMap.put(ALI_PAY_CANCEL, "充值取消");
|
||||
resultStatusMap.put(ALI_PAY_NETWORK_ERROR, "网络连接出错");
|
||||
resultStatusMap.put(ALI_PAY_RESULT_UNKNOWN, "充值结果未知(有可能已经成功),请联系客服");
|
||||
}
|
||||
|
||||
public AliPayResult(Map<String, String> rawResult) {
|
||||
if (rawResult == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
for (String key : rawResult.keySet()) {
|
||||
if (TextUtils.equals(key, "resultStatus")) {
|
||||
resultStatus = rawResult.get(key);
|
||||
} else if (TextUtils.equals(key, "result")) {
|
||||
result = JSON.parseObject(rawResult.get(key), AliPayResponseResult.class);
|
||||
} else if (TextUtils.equals(key, "memo")) {
|
||||
memo = rawResult.get(key);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "resultStatus={" + resultStatus + "};memo={" + memo
|
||||
+ "};result={" + result + "}";
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the resultStatus
|
||||
*/
|
||||
public String getResultStatus() {
|
||||
return resultStatus;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the memo
|
||||
*/
|
||||
public String getMemo() {
|
||||
return memo;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the result
|
||||
*/
|
||||
public AliPayResponseResult getResult() {
|
||||
return result;
|
||||
}
|
||||
}
|
@@ -1,10 +0,0 @@
|
||||
package com.yizhuan.xchat_android_core.pay.bean.alipay;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class AlipayInfo {
|
||||
|
||||
private String payType;
|
||||
private String orderData;
|
||||
}
|
@@ -1,30 +0,0 @@
|
||||
package com.yizhuan.xchat_android_core.pay.bean.alipay;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class AlipayTradeAppPayResponseBean {
|
||||
|
||||
/**
|
||||
* code : 10000
|
||||
* msg : Success
|
||||
* app_id : xxxxxx
|
||||
* auth_app_id : xxxxx
|
||||
* charset : UTF-8
|
||||
* timestamp : 2018-10-23 12:02:45
|
||||
* out_trade_no : xxxxx
|
||||
* total_amount : xxxxx
|
||||
* trade_no : xxxx
|
||||
* seller_id : xxxx
|
||||
*/
|
||||
private String code;
|
||||
private String msg;
|
||||
private String app_id;
|
||||
private String auth_app_id;
|
||||
private String charset;
|
||||
private String timestamp;
|
||||
private String out_trade_no;
|
||||
private String total_amount;
|
||||
private String trade_no;
|
||||
private String seller_id;
|
||||
}
|
@@ -1,22 +0,0 @@
|
||||
package com.yizhuan.xchat_android_core.pay.bean.unionpay;
|
||||
|
||||
import com.yizhuan.xchat_android_core.bank_card.bean.BankCardBean;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* Created by MadisonRong on 2019-08-16
|
||||
*/
|
||||
@Data
|
||||
public class UnionPayOrder {
|
||||
|
||||
/**
|
||||
* orderNo : 4341a7c88f8d43dca592f6f95edc90ab
|
||||
* cardInfo : {"recordId":12,"uid":909768,"bankCardNo":"**** **** **** 0148","defaultFlag":0,"bankName":"中国光大银行","bankLogo":"http://img.erbanyy.com/CEB.jpg","cardType":"储蓄卡"}
|
||||
*/
|
||||
private String orderNo;
|
||||
private List<BankCardBean> cardInfos;
|
||||
|
||||
}
|
@@ -1,61 +0,0 @@
|
||||
package com.yizhuan.xchat_android_core.pay.bean.wechatpay;
|
||||
|
||||
import com.alibaba.fastjson.annotation.JSONField;
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* @author yangming
|
||||
* @date 2018-10-24
|
||||
* @description 返回给APP的实体类
|
||||
*/
|
||||
@Data
|
||||
public class WeChatAppParam {
|
||||
|
||||
@SerializedName(value = "appid")
|
||||
@JSONField(name = "appid")
|
||||
private String appId;
|
||||
|
||||
@SerializedName(value = "partnerid")
|
||||
@JSONField(name = "partnerid")
|
||||
private String partnerId;
|
||||
|
||||
@SerializedName(value = "prepayid")
|
||||
@JSONField(name = "prepayid")
|
||||
private String prepayId;
|
||||
|
||||
@SerializedName(value = "package")
|
||||
@JSONField(name = "package")
|
||||
private String packageValue;
|
||||
|
||||
@SerializedName(value = "noncestr")
|
||||
@JSONField(name = "noncestr")
|
||||
private String nonceStr;
|
||||
|
||||
private String timestamp;
|
||||
|
||||
private String sign;
|
||||
|
||||
/**
|
||||
* 使用的支付渠道,小程序返回wx_mp,微信app支付则直接返回支付所需参数
|
||||
*/
|
||||
private String channel;
|
||||
|
||||
/**
|
||||
* 0-RELEASE, 1-TEST, 2-PREVIEW
|
||||
* 对应微信支付 SDK 里的 miniProgramType
|
||||
*/
|
||||
private int programType;
|
||||
|
||||
/**
|
||||
* 小程序原始id
|
||||
*/
|
||||
private String originalId;
|
||||
|
||||
/**
|
||||
* 小程序充值页
|
||||
* 拉起小程序后想要跳转的路径
|
||||
*/
|
||||
private String chargePage;
|
||||
}
|
@@ -1,73 +0,0 @@
|
||||
package com.yizhuan.xchat_android_core.pay.model.alipay;
|
||||
|
||||
import android.app.Activity;
|
||||
|
||||
import com.yizhuan.xchat_android_core.Constants;
|
||||
import com.yizhuan.xchat_android_core.auth.AuthModel;
|
||||
import com.yizhuan.xchat_android_core.base.BaseModel;
|
||||
import com.yizhuan.xchat_android_core.bean.response.ServiceResult;
|
||||
import com.yizhuan.xchat_android_core.manager.AvRoomDataManager;
|
||||
import com.yizhuan.xchat_android_core.pay.bean.alipay.AlipayInfo;
|
||||
import com.yizhuan.xchat_android_library.net.rxnet.RxNet;
|
||||
import com.yizhuan.xchat_android_library.utils.NetworkUtils;
|
||||
|
||||
import io.reactivex.Single;
|
||||
import retrofit2.http.POST;
|
||||
import retrofit2.http.Query;
|
||||
|
||||
public class AliPayModel extends BaseModel implements IAliPayModel {
|
||||
|
||||
private Api api = RxNet.create(Api.class);
|
||||
|
||||
private AliPayModel() {
|
||||
super();
|
||||
}
|
||||
|
||||
private static final class Helper {
|
||||
public static final AliPayModel INSTANCE = new AliPayModel();
|
||||
}
|
||||
|
||||
public static AliPayModel get() {
|
||||
return AliPayModel.Helper.INSTANCE;
|
||||
}
|
||||
|
||||
/**
|
||||
* 支付宝充值,通过此接口获取订单号并发起支付
|
||||
*
|
||||
* @param context
|
||||
* @param chargeProdId
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public Single<ServiceResult<AlipayInfo>> requestAliPay(Activity context, String chargeProdId) {
|
||||
return api.requestAilPayOrder(
|
||||
String.valueOf(AuthModel.get().getCurrentUid()),
|
||||
AvRoomDataManager.get().getRoomUid() == 0 ? null : String.valueOf(AvRoomDataManager.get().getRoomUid()),
|
||||
chargeProdId,
|
||||
Constants.CHARGE_ALIPAY,
|
||||
NetworkUtils.getIPAddress(context),
|
||||
AuthModel.get().getTicket());
|
||||
|
||||
}
|
||||
|
||||
interface Api {
|
||||
|
||||
/**
|
||||
* 发起充值,支付宝支付,通过此接口获取订单号
|
||||
*
|
||||
* @param uid
|
||||
* @param chargeProdId
|
||||
* @param payChannel
|
||||
* @param clientIp
|
||||
* @return
|
||||
*/
|
||||
@POST("/charge/pay/apply")
|
||||
Single<ServiceResult<AlipayInfo>> requestAilPayOrder(@Query("uid") String uid,
|
||||
@Query("roomUid") String roomUid,
|
||||
@Query("chargeProdId") String chargeProdId,
|
||||
@Query("payChannel") String payChannel,
|
||||
@Query("clientIp") String clientIp,
|
||||
@Query("ticket") String ticket);
|
||||
|
||||
}
|
||||
}
|
@@ -1,23 +0,0 @@
|
||||
package com.yizhuan.xchat_android_core.pay.model.alipay;
|
||||
|
||||
import android.app.Activity;
|
||||
|
||||
import com.yizhuan.xchat_android_core.base.IModel;
|
||||
import com.yizhuan.xchat_android_core.bean.response.ServiceResult;
|
||||
import com.yizhuan.xchat_android_core.pay.bean.alipay.AlipayInfo;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
import io.reactivex.Single;
|
||||
|
||||
public interface IAliPayModel extends IModel {
|
||||
|
||||
/**
|
||||
* 支付宝充值,通过此接口获取订单号
|
||||
*
|
||||
* @param context
|
||||
* @param chargeProdId
|
||||
* @return
|
||||
*/
|
||||
public Single<ServiceResult<AlipayInfo>> requestAliPay(Activity context, String chargeProdId);
|
||||
}
|
@@ -1,33 +0,0 @@
|
||||
package com.yizhuan.xchat_android_core.pay.model.unionpay;
|
||||
|
||||
import com.yizhuan.xchat_android_core.base.IModel;
|
||||
import com.yizhuan.xchat_android_core.bean.response.ServiceResult;
|
||||
import com.yizhuan.xchat_android_core.pay.bean.unionpay.UnionPayOrder;
|
||||
|
||||
import io.reactivex.Single;
|
||||
|
||||
/**
|
||||
* Created by MadisonRong on 2019-08-15
|
||||
*/
|
||||
public interface IUnionPayModel extends IModel {
|
||||
|
||||
/**
|
||||
* 银联快捷支付充值,通过此接口获取订单号
|
||||
*
|
||||
* @param chargeProdId
|
||||
* @return
|
||||
*/
|
||||
public Single<UnionPayOrder> requestUnionPay(String chargeProdId);
|
||||
|
||||
/**
|
||||
* 银联快捷支付,发起支付
|
||||
*
|
||||
* @param orderNo 订单号
|
||||
* @param recordId 签约记录
|
||||
* @param paymentPassword 支付密码
|
||||
* @return
|
||||
*/
|
||||
public Single<String> unionPay(String orderNo, String recordId, String paymentPassword);
|
||||
|
||||
Single<ServiceResult<String>> unionPayResult(String orderNo);
|
||||
}
|
@@ -1,147 +0,0 @@
|
||||
package com.yizhuan.xchat_android_core.pay.model.unionpay;
|
||||
|
||||
import com.yizhuan.xchat_android_core.Constants;
|
||||
import com.yizhuan.xchat_android_core.auth.AuthModel;
|
||||
import com.yizhuan.xchat_android_core.bank_card.bean.BankCardBean;
|
||||
import com.yizhuan.xchat_android_core.bank_card.exception.NeedBindBankCardException;
|
||||
import com.yizhuan.xchat_android_core.bean.response.ServiceResult;
|
||||
import com.yizhuan.xchat_android_core.exception.FailReasonException;
|
||||
import com.yizhuan.xchat_android_core.exception.NullDataException;
|
||||
import com.yizhuan.xchat_android_core.pay.PayModel;
|
||||
import com.yizhuan.xchat_android_core.pay.bean.unionpay.UnionPayOrder;
|
||||
import com.yizhuan.xchat_android_core.utils.net.RxHelper;
|
||||
import com.yizhuan.xchat_android_library.net.rxnet.RxNet;
|
||||
|
||||
import io.reactivex.Single;
|
||||
import retrofit2.http.Field;
|
||||
import retrofit2.http.FormUrlEncoded;
|
||||
import retrofit2.http.POST;
|
||||
|
||||
/**
|
||||
* Created by MadisonRong on 2019-08-16
|
||||
*/
|
||||
public class UnionPayModel extends PayModel implements IUnionPayModel {
|
||||
|
||||
public static final int CODE_NEED_BIND_BANK_CARD_FIRST = 30006;
|
||||
public static final int CODE_UNION_PAY_HANDLING = 30013;
|
||||
public static final int CODE_UNION_PAY_FAILED = 30014;
|
||||
|
||||
private Api api;
|
||||
private UnionPayOrder unionPayOrder;
|
||||
private BankCardBean selectedBankInfo;
|
||||
|
||||
private UnionPayModel() {
|
||||
api = RxNet.create(Api.class);
|
||||
}
|
||||
|
||||
public static UnionPayModel getInstance() {
|
||||
return SingletonHolder.INSTANCE;
|
||||
}
|
||||
|
||||
public UnionPayOrder getUnionPayOrder() {
|
||||
return unionPayOrder;
|
||||
}
|
||||
|
||||
public void setUnionPayOrder(UnionPayOrder unionPayOrder) {
|
||||
this.unionPayOrder = unionPayOrder;
|
||||
}
|
||||
|
||||
public BankCardBean getSelectedBankInfo() {
|
||||
return selectedBankInfo;
|
||||
}
|
||||
|
||||
public void setSelectedBankInfo(BankCardBean selectedBankInfo) {
|
||||
this.selectedBankInfo = selectedBankInfo;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Single<UnionPayOrder> requestUnionPay(String chargeProdId) {
|
||||
return api.requestUnionPayOrder(String.valueOf(AuthModel.get().getCurrentUid()),
|
||||
chargeProdId, Constants.CHARGE_UNION_PAY)
|
||||
.compose(RxHelper.handleSchedulers())
|
||||
.flatMap(unionPayOrderServiceResult -> {
|
||||
if (unionPayOrderServiceResult == null) return Single.error(new Throwable());
|
||||
if (unionPayOrderServiceResult.isSuccess()) {
|
||||
UnionPayOrder data = unionPayOrderServiceResult.getData();
|
||||
if (data == null) return Single.error(new NullDataException());
|
||||
return Single.just(unionPayOrderServiceResult);
|
||||
}
|
||||
int code = unionPayOrderServiceResult.getCode();
|
||||
String message = unionPayOrderServiceResult.getMessage();
|
||||
switch (code) {
|
||||
case CODE_NEED_BIND_BANK_CARD_FIRST:
|
||||
return Single.error(new NeedBindBankCardException(message, code));
|
||||
|
||||
default:
|
||||
return Single.error(new FailReasonException(message, code));
|
||||
}
|
||||
})
|
||||
.compose(RxHelper.handleCommon(UnionPayOrder::new));
|
||||
}
|
||||
|
||||
@Override
|
||||
public Single<String> unionPay(String orderNo, String recordId, String paymentPassword) {
|
||||
return api.unionPay(String.valueOf(AuthModel.get().getCurrentUid()), orderNo,
|
||||
Constants.CHARGE_UNION_PAY, recordId, paymentPassword)
|
||||
.compose(RxHelper.handleStringData());
|
||||
}
|
||||
|
||||
@Override
|
||||
public Single<ServiceResult<String>> unionPayResult(String orderNo) {
|
||||
return api.unionPayResult(String.valueOf(AuthModel.get().getCurrentUid()), orderNo)
|
||||
.compose(RxHelper.handleSchAndExce());
|
||||
}
|
||||
|
||||
private static class SingletonHolder {
|
||||
private static final UnionPayModel INSTANCE = new UnionPayModel();
|
||||
}
|
||||
|
||||
interface Api {
|
||||
|
||||
/**
|
||||
* 银联快捷支付,通过此接口获取订单号
|
||||
*
|
||||
* @param uid
|
||||
* @param chargeProdId 充值产品 id
|
||||
* @param payChannel 支付渠道
|
||||
* {@link Constants#CHARGE_UNION_PAY}
|
||||
* @return
|
||||
*/
|
||||
@FormUrlEncoded
|
||||
@POST("charge/pay/apply")
|
||||
Single<ServiceResult<UnionPayOrder>> requestUnionPayOrder(@Field("uid") String uid,
|
||||
@Field("chargeProdId") String chargeProdId,
|
||||
@Field("payChannel") String payChannel);
|
||||
|
||||
/**
|
||||
* 发起充值,银联快捷支付
|
||||
*
|
||||
* @param uid
|
||||
* @param orderNo 订单号
|
||||
* @param payChannel 支付渠道
|
||||
* {@link Constants#CHARGE_UNION_PAY}
|
||||
* @param recordId 签约记录id
|
||||
* @param paymentPassword 支付密码
|
||||
* @return
|
||||
*/
|
||||
@FormUrlEncoded
|
||||
@POST("payment/bankCardSign/signPay")
|
||||
Single<ServiceResult<String>> unionPay(@Field("uid") String uid,
|
||||
@Field("orderNo") String orderNo,
|
||||
@Field("payChannel") String payChannel,
|
||||
@Field("recordId") String recordId,
|
||||
@Field("paymentPwd") String paymentPassword);
|
||||
|
||||
/**
|
||||
* 查询银联支付结果
|
||||
*
|
||||
* @param uid
|
||||
* @param orderNo 订单号
|
||||
* @return
|
||||
*/
|
||||
@FormUrlEncoded
|
||||
@POST("chargeRecord/query")
|
||||
Single<ServiceResult<String>> unionPayResult(@Field("uid") String uid,
|
||||
@Field("orderNo") String orderNo);
|
||||
}
|
||||
}
|
@@ -1,21 +0,0 @@
|
||||
package com.yizhuan.xchat_android_core.pay.model.wechatpay;
|
||||
|
||||
import android.app.Activity;
|
||||
|
||||
import com.yizhuan.xchat_android_core.base.IModel;
|
||||
import com.yizhuan.xchat_android_core.bean.response.ServiceResult;
|
||||
import com.yizhuan.xchat_android_core.pay.bean.wechatpay.WeChatAppParam;
|
||||
|
||||
import io.reactivex.Single;
|
||||
|
||||
public interface IWeChatPayModel extends IModel {
|
||||
|
||||
/**
|
||||
* 微信充值,通过此接口获取订单号并发起支付
|
||||
*
|
||||
* @param context
|
||||
* @param chargeProdId
|
||||
* @return
|
||||
*/
|
||||
public Single<ServiceResult<WeChatAppParam>> requestWeChatPay(Activity context, String chargeProdId);
|
||||
}
|
@@ -1,100 +0,0 @@
|
||||
package com.yizhuan.xchat_android_core.pay.model.wechatpay;
|
||||
|
||||
import android.app.Activity;
|
||||
|
||||
import com.yizhuan.xchat_android_core.Constants;
|
||||
import com.yizhuan.xchat_android_core.auth.AuthModel;
|
||||
import com.yizhuan.xchat_android_core.base.BaseModel;
|
||||
import com.yizhuan.xchat_android_core.bean.response.ServiceResult;
|
||||
import com.yizhuan.xchat_android_core.manager.AvRoomDataManager;
|
||||
import com.yizhuan.xchat_android_core.pay.bean.wechatpay.WeChatAppParam;
|
||||
import com.yizhuan.xchat_android_core.utils.net.RxHelper;
|
||||
import com.yizhuan.xchat_android_library.net.rxnet.RxNet;
|
||||
import com.yizhuan.xchat_android_library.utils.NetworkUtils;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
import io.reactivex.Single;
|
||||
import retrofit2.http.POST;
|
||||
import retrofit2.http.Query;
|
||||
|
||||
public class WeChatPayModel extends BaseModel implements IWeChatPayModel {
|
||||
|
||||
/**
|
||||
* 支付成功
|
||||
*/
|
||||
public static final int CODE_SUCCESS = 0;
|
||||
|
||||
/**
|
||||
* 支付失败
|
||||
*/
|
||||
public static final int CODE_ERROR = -1;
|
||||
|
||||
/**
|
||||
* 支付取消
|
||||
*/
|
||||
public static final int CODE_CANCEL = -2;
|
||||
|
||||
public static Map<Integer, String> statusMap = new HashMap<>();
|
||||
|
||||
static {
|
||||
statusMap.put(CODE_SUCCESS, "充值成功");
|
||||
statusMap.put(CODE_ERROR, "~充值失败~");
|
||||
statusMap.put(CODE_CANCEL, "充值取消");
|
||||
}
|
||||
|
||||
private Api api = RxNet.create(Api.class);
|
||||
|
||||
private WeChatPayModel() {
|
||||
super();
|
||||
}
|
||||
|
||||
public static WeChatPayModel get() {
|
||||
return WeChatPayModel.Helper.INSTANCE;
|
||||
}
|
||||
|
||||
/**
|
||||
* 微信充值,通过此接口获取订单号并发起支付
|
||||
*
|
||||
* @param context
|
||||
* @param chargeProdId
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public Single<ServiceResult<WeChatAppParam>> requestWeChatPay(Activity context, String chargeProdId) {
|
||||
return api.requestWeChatPayOrder(
|
||||
String.valueOf(AuthModel.get().getCurrentUid()),
|
||||
AvRoomDataManager.get().getRoomUid() == 0 ? null : String.valueOf(AvRoomDataManager.get().getRoomUid()),
|
||||
chargeProdId,
|
||||
Constants.CHARGE_WX,
|
||||
NetworkUtils.getIPAddress(context),
|
||||
AuthModel.get().getTicket()
|
||||
)
|
||||
.compose(RxHelper.handleSchedulers());
|
||||
}
|
||||
|
||||
interface Api {
|
||||
|
||||
/**
|
||||
* 发起充值,微信支付,通过此接口获取订单号
|
||||
*
|
||||
* @param uid
|
||||
* @param chargeProdId
|
||||
* @param payChannel
|
||||
* @param clientIp
|
||||
* @return
|
||||
*/
|
||||
@POST("/charge/pay/apply")
|
||||
Single<ServiceResult<WeChatAppParam>> requestWeChatPayOrder(@Query("uid") String uid,
|
||||
@Query("roomUid") String roomUid,
|
||||
@Query("chargeProdId") String chargeProdId,
|
||||
@Query("payChannel") String payChannel,
|
||||
@Query("clientIp") String clientIp,
|
||||
@Query("ticket") String ticket);
|
||||
}
|
||||
|
||||
private static final class Helper {
|
||||
public static final WeChatPayModel INSTANCE = new WeChatPayModel();
|
||||
}
|
||||
}
|
@@ -1,11 +0,0 @@
|
||||
package com.yizhuan.xchat_android_core.pay.view;
|
||||
|
||||
import com.yizhuan.xchat_android_core.pay.bean.alipay.AliPayResult;
|
||||
import com.yizhuan.xchat_android_library.base.IMvpBaseView;
|
||||
|
||||
public interface IPaymentView extends IMvpBaseView {
|
||||
|
||||
public void getChargeOrOrderInfoFail(String error);
|
||||
|
||||
public void requestAliPaySuccess(AliPayResult result);
|
||||
}
|
@@ -3,7 +3,7 @@ apply plugin: 'kotlin-android'
|
||||
apply plugin: 'kotlin-android-extensions'
|
||||
|
||||
android {
|
||||
compileSdkVersion 29
|
||||
compileSdkVersion 32
|
||||
|
||||
defaultConfig {
|
||||
minSdkVersion 21
|
||||
|
Reference in New Issue
Block a user