Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Sign in / Register
Toggle navigation
X
xxsq
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Packages
Packages
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
王雪伟
xxsq
Commits
ecb74737
Commit
ecb74737
authored
Sep 01, 2022
by
maxiaoliang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
添加微信支付
parent
2a7d209e
Hide whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
186 additions
and
46 deletions
+186
-46
version.properties
app/version.properties
+2
-2
Constant.java
cms/src/main/java/com/zxhl/cms/common/Constant.java
+2
-2
IUserInfoApi.java
cms/src/main/java/com/zxhl/cms/net/api/IUserInfoApi.java
+15
-0
WeChatPayEntity.kt
...rc/main/java/com/zxhl/cms/net/model/uc/WeChatPayEntity.kt
+1
-0
WeChatPay.kt
cms/src/main/java/com/zxhl/cms/utils/WeChatPay.kt
+2
-1
RechargeActivity.kt
...ain/java/com/zxbw/modulemain/activity/RechargeActivity.kt
+44
-13
RightsDetailActivity.kt
...java/com/zxbw/modulemain/activity/RightsDetailActivity.kt
+6
-1
RechargeContract.kt
...ain/java/com/zxbw/modulemain/contract/RechargeContract.kt
+14
-1
RightsPayContract.kt
...in/java/com/zxbw/modulemain/contract/RightsPayContract.kt
+4
-2
RechargePresenter.kt
...n/java/com/zxbw/modulemain/presenter/RechargePresenter.kt
+55
-5
RightsPayPresenter.kt
.../java/com/zxbw/modulemain/presenter/RightsPayPresenter.kt
+41
-19
No files found.
app/version.properties
View file @
ecb74737
PACKAGE_NAME
=
com.zxhl.shop
VERSION_CODE
=
22
VERSION_NAME
=
1.2.1
\ No newline at end of file
VERSION_CODE
=
23
VERSION_NAME
=
1.2.2
\ No newline at end of file
cms/src/main/java/com/zxhl/cms/common/Constant.java
View file @
ecb74737
...
...
@@ -21,8 +21,8 @@ public class Constant {
public
static
String
a
=
"D0EV7FZL45A5DVKD"
;
public
static
String
b
=
"E2Y1YREK2BYDAC5B"
;
public
static
String
WX_APPID
=
"wx
de96f02f43d3fbe1
"
;
public
static
String
WX_APPKEY
=
"
72528ed77036e5ff7e2de846f6fa492c
"
;
public
static
String
WX_APPID
=
"wx
38900bc915900f5c
"
;
public
static
String
WX_APPKEY
=
"
c15ac03e5797aee76cac1da3336276f8
"
;
public
static
String
PAY_RESULT
=
"pay_result"
;
public
static
String
CHOSSEE_ADDRESS_RESULT
=
"chosse_address_result"
;
...
...
cms/src/main/java/com/zxhl/cms/net/api/IUserInfoApi.java
View file @
ecb74737
...
...
@@ -178,6 +178,13 @@ public interface IUserInfoApi {
@POST
(
NetConfig
.
User
.
URL_PAY_RIGHTS_ORDER
)
Observable
<
Response
<
AliPayEntity
>>
aliPayRights
(
@Query
(
"returnUrl"
)
String
returnUrl
,
@Query
(
"goodsId"
)
String
goodsId
,
@Query
(
"payType"
)
String
payType
,
@Query
(
"phone"
)
String
phone
,
@Query
(
"rechargeType"
)
String
rechargeType
,
@Query
(
"skill"
)
Boolean
skill
,
@Query
(
"outTradeNo"
)
String
outTradeNo
);
/**
* 权益微信支付
*
* @return
*/
@POST
(
NetConfig
.
User
.
URL_PAY_RIGHTS_ORDER
)
Observable
<
Response
<
WeChatPayEntity
>>
wechatRights
(
@Query
(
"returnUrl"
)
String
returnUrl
,
@Query
(
"goodsId"
)
String
goodsId
,
@Query
(
"payType"
)
String
payType
,
@Query
(
"phone"
)
String
phone
,
@Query
(
"rechargeType"
)
String
rechargeType
,
@Query
(
"skill"
)
Boolean
skill
,
@Query
(
"outTradeNo"
)
String
outTradeNo
);
/**
* 权益支付宝支付
...
...
@@ -187,4 +194,12 @@ public interface IUserInfoApi {
@POST
(
NetConfig
.
User
.
URL_PAY_RIGHTS_ORDER
)
Observable
<
Response
<
AliPayEntity
>>
aliPayRights
(
@Query
(
"returnUrl"
)
String
returnUrl
,
@Query
(
"goodsId"
)
String
goodsId
,
@Query
(
"payType"
)
String
payType
,
@Query
(
"phone"
)
String
phone
,
@Query
(
"rechargeType"
)
String
rechargeType
,
@Query
(
"skill"
)
Boolean
skill
,
@Query
(
"outTradeNo"
)
String
outTradeNo
,
@Query
(
"couponId"
)
String
couponId
,
@Query
(
"mobileOp"
)
String
mobileOp
);
/**
* 微信支付
*
* @return
*/
@POST
(
NetConfig
.
User
.
URL_PAY_RIGHTS_ORDER
)
Observable
<
Response
<
WeChatPayEntity
>>
wechatPayRights
(
@Query
(
"returnUrl"
)
String
returnUrl
,
@Query
(
"goodsId"
)
String
goodsId
,
@Query
(
"payType"
)
String
payType
,
@Query
(
"phone"
)
String
phone
,
@Query
(
"rechargeType"
)
String
rechargeType
,
@Query
(
"skill"
)
Boolean
skill
,
@Query
(
"outTradeNo"
)
String
outTradeNo
,
@Query
(
"couponId"
)
String
couponId
,
@Query
(
"mobileOp"
)
String
mobileOp
);
}
cms/src/main/java/com/zxhl/cms/net/model/uc/WeChatPayEntity.kt
View file @
ecb74737
package
com.zxhl.cms.net.model.uc
class
WeChatPayEntity
{
var
payType
:
String
?=
""
var
wakeup
:
WechatWakeup
?
=
null
//{"timeStamp":"1563196959","packageValue":"Sign=WXPay","appId":"wx08a4fadca0a039bb",
...
...
cms/src/main/java/com/zxhl/cms/utils/WeChatPay.kt
View file @
ecb74737
...
...
@@ -41,7 +41,7 @@ object WeChatPay {
/**
* 微信原生支付和连连支付走这个方法
*/
fun
startWeChatPay
(
result
:
WeChatPayEntity
,
paytype
:
String
)
{
fun
startWeChatPay
(
result
:
WeChatPayEntity
?
,
paytype
:
String
)
{
if
(
TextUtils
.
isEmpty
(
Constant
.
WX_APPID
)){
EventUtils
.
onEvent
(
"member_page_pay_fail"
,
"WX_APPID is null"
)
Utils
.
showToast
(
AppContext
.
get
(),
"暂不支持微信支付"
)
...
...
@@ -60,6 +60,7 @@ object WeChatPay {
}
private
fun
wx2
(
result
:
WeChatPayEntity
?,
paytype
:
String
)
{
Log
.
e
(
"MXL"
,
"Paytype:"
+
paytype
)
if
(
TextUtils
.
equals
(
paytype
,
"2"
)){
try
{
if
(
result
!=
null
)
{
...
...
moduleMain/src/main/java/com/zxbw/modulemain/activity/RechargeActivity.kt
View file @
ecb74737
...
...
@@ -26,6 +26,7 @@ import com.zxhl.cms.net.model.box.MobileOpEntity
import
com.zxhl.cms.net.model.qy.CouponsEntity
import
com.zxhl.cms.net.model.uc.AliPayEntity
import
com.zxhl.cms.net.model.uc.PayResultEntity
import
com.zxhl.cms.net.model.uc.WeChatPayEntity
import
com.zxhl.cms.net.model.video.MemberEntity
import
com.zxhl.cms.pay.H5PayUtil
import
com.zxhl.cms.pay.PaymentConfig
...
...
@@ -229,17 +230,32 @@ class RechargeActivity : BaseActivity(), OnRecycleItemClickListener<MemberEntity
isClickPayBtn
=
true
mLoading
?.
setLoading
(
"请稍后..."
)
mLoading
?.
show
()
mPresenter
?.
requestRightsAliPay
(
"xxsqshop://recharge"
,
goodsID
.
toString
(),
pay_type
.
toString
(),
phoneNumber
,
"8080"
,
false
,
""
,
couponsentity
?.
id
,
mobileOp
)
Log
.
e
(
"MXL"
,
"s"
+
pay_type
)
if
(
pay_type
==
2
){
mPresenter
?.
requestWechatPayOrder
(
"xxsqshop://recharge"
,
goodsID
.
toString
(),
pay_type
.
toString
(),
phoneNumber
,
"8080"
,
false
,
""
,
couponsentity
?.
id
,
mobileOp
)
}
else
{
mPresenter
?.
requestRightsAliPay
(
"xxsqshop://recharge"
,
goodsID
.
toString
(),
pay_type
.
toString
(),
phoneNumber
,
"8080"
,
false
,
""
,
couponsentity
?.
id
,
mobileOp
)
}
}
}
...
...
@@ -254,6 +270,7 @@ class RechargeActivity : BaseActivity(), OnRecycleItemClickListener<MemberEntity
}
override
fun
requestOrderSuc
(
result
:
AliPayEntity
)
{
Log
.
e
(
"MXL"
,
"pay_type"
+
pay_type
)
if
(
pay_type
==
PaymentConfig
.
MIN_PAY_PROGRAM
)
{
SettingPreference
.
setOutTradeNo
(
result
?.
outTradeNo
)
JumpUtils
.
h5Jump
(
"https://api.minpayment.com/pay.do?sendMsg="
+
result
.
wakeup
)
...
...
@@ -325,12 +342,24 @@ class RechargeActivity : BaseActivity(), OnRecycleItemClickListener<MemberEntity
}
})
}
}
else
{
}
else
if
(
pay_type
==
PaymentConfig
.
WECHAT_PAY
)
{
if
(
result
.
outTradeNo
.
isNullOrEmpty
())
{
EventUtils
.
onEvent
(
"wechat_pay_error"
)
showResultLoading
(
false
)
}
else
{
}
}
else
{
showToast
(
"暂不支持"
)
EventUtils
.
onEvent
(
"payment_error"
,
"$pay_type"
)
}
}
override
fun
requestOrderSuc
(
result
:
WeChatPayEntity
)
{
mLoading
?.
setLoading
(
"正在支付"
)
}
override
fun
onNewIntent
(
intent
:
Intent
?)
{
super
.
onNewIntent
(
intent
)
val
data
=
intent
?.
data
...
...
@@ -529,9 +558,11 @@ class RechargeActivity : BaseActivity(), OnRecycleItemClickListener<MemberEntity
private
var
isClickPayBtn
=
false
override
fun
onResume
()
{
super
.
onResume
()
Log
.
e
(
"MXL"
,
"onResume"
+
isPause
+
isClickPayBtn
+
pay_type
)
if
(
isPause
&&
isClickPayBtn
)
{
if
(
pay_type
==
PaymentConfig
.
MIN_PAY_PROGRAM
||
pay_type
==
PaymentConfig
.
H5_PAY
||
pay_type
==
PaymentConfig
.
ZFB_H5_PAY
||
pay_type
==
PaymentConfig
.
WX_H5_PAY
||
pay_type
==
PaymentConfig
.
HUI_FU_H5_PAY1
||
pay_type
==
PaymentConfig
.
HUI_FU_H5_PAY2
)
{
if
(
pay_type
==
PaymentConfig
.
MIN_PAY_PROGRAM
||
pay_type
==
PaymentConfig
.
H5_PAY
||
pay_type
==
PaymentConfig
.
ZFB_H5_PAY
||
pay_type
==
PaymentConfig
.
WX_H5_PAY
||
pay_type
==
PaymentConfig
.
HUI_FU_H5_PAY1
||
pay_type
==
PaymentConfig
.
HUI_FU_H5_PAY2
||
pay_type
==
PaymentConfig
.
WECHAT_PAY
)
{
//如果是敏支付或者H5支付
Log
.
e
(
"MXL"
,
"支付完调用"
)
mPresenter
?.
verifyPay
(
SettingPreference
.
getOutTradeNo
(),
pay_type
!!
)
}
else
{
mHandler
?.
sendEmptyMessageDelayed
(
0
,
2000
)
...
...
moduleMain/src/main/java/com/zxbw/modulemain/activity/RightsDetailActivity.kt
View file @
ecb74737
...
...
@@ -25,6 +25,7 @@ import com.zxhl.cms.net.SettingPreference
import
com.zxhl.cms.net.model.qy.RightsDetailEntity
import
com.zxhl.cms.net.model.uc.AliPayEntity
import
com.zxhl.cms.net.model.uc.PayResultEntity
import
com.zxhl.cms.net.model.uc.WeChatPayEntity
import
com.zxhl.cms.pay.H5PayUtil
import
com.zxhl.cms.pay.PaymentConfig
import
com.zxhl.cms.pay.alipay.AlipayServer
...
...
@@ -320,6 +321,10 @@ class RightsDetailActivity : BaseActivity(), RightsDetailContract.View, RightsPa
}
}
override
fun
requestOrderSuc
(
result
:
WeChatPayEntity
)
{
mLoading
?.
setLoading
(
"正在支付"
)
}
override
fun
onNewIntent
(
intent
:
Intent
?)
{
super
.
onNewIntent
(
intent
)
val
data
=
intent
?.
data
...
...
@@ -373,7 +378,7 @@ class RightsDetailActivity : BaseActivity(), RightsDetailContract.View, RightsPa
super
.
onResume
()
Log
.
d
(
"wxw"
,
"OnResume"
)
if
(
isPause
&&
isClickPayBtn
)
{
if
(
pay_type
==
PaymentConfig
.
MIN_PAY_PROGRAM
||
pay_type
==
PaymentConfig
.
H5_PAY
||
pay_type
==
PaymentConfig
.
ZFB_H5_PAY
||
pay_type
==
PaymentConfig
.
WX_H5_PAY
||
pay_type
==
PaymentConfig
.
HUI_FU_H5_PAY1
||
pay_type
==
PaymentConfig
.
HUI_FU_H5_PAY2
)
{
if
(
pay_type
==
PaymentConfig
.
MIN_PAY_PROGRAM
||
pay_type
==
PaymentConfig
.
H5_PAY
||
pay_type
==
PaymentConfig
.
ZFB_H5_PAY
||
pay_type
==
PaymentConfig
.
WX_H5_PAY
||
pay_type
==
PaymentConfig
.
HUI_FU_H5_PAY1
||
pay_type
==
PaymentConfig
.
HUI_FU_H5_PAY2
||
pay_type
==
PaymentConfig
.
WECHAT_PAY
)
{
//如果是敏支付或者H5支付
mPayPresenter
?.
verifyPay
(
SettingPreference
.
getOutTradeNo
(),
pay_type
!!
)
}
else
{
...
...
moduleMain/src/main/java/com/zxbw/modulemain/contract/RechargeContract.kt
View file @
ecb74737
...
...
@@ -3,6 +3,7 @@ package com.zxbw.modulemain.contract
import
com.zxhl.cms.net.model.box.AppInEntity
import
com.zxhl.cms.net.model.qy.CouponsEntity
import
com.zxhl.cms.net.model.uc.AliPayEntity
import
com.zxhl.cms.net.model.uc.WeChatPayEntity
import
com.zxhl.cms.net.model.video.MemberEntity
...
...
@@ -11,13 +12,14 @@ class RechargeContract {
fun
setPayList
(
result
:
MemberEntity
)
fun
setCouponsList
(
result
:
List
<
CouponsEntity
>?)
fun
requestOrderSuc
(
result
:
AliPayEntity
)
fun
requestOrderSuc
(
result
:
WeChatPayEntity
)
fun
requestOrderFail
(
errorMsg
:
String
)
fun
verifyOrderSuc
(
order
:
String
)
fun
verifyOrderFail
(
errorMsg
:
String
)
fun
setAppInfo
(
result
:
AppInEntity
?)
}
interface
Presenter
{
...
...
@@ -37,5 +39,16 @@ class RechargeContract {
fun
verifyPay
(
order
:
String
?,
payType
:
Int
)
fun
appInfo
()
fun
requestWechatPayOrder
(
jumpScheme
:
String
,
goodsId
:
String
,
payType
:
String
,
phone
:
String
,
type
:
String
,
skill
:
Boolean
?,
outTradeNo
:
String
?,
couponId
:
String
?,
mobileOp
:
String
?
)
}
}
\ No newline at end of file
moduleMain/src/main/java/com/zxbw/modulemain/contract/RightsPayContract.kt
View file @
ecb74737
...
...
@@ -3,6 +3,7 @@ package com.zxbw.modulemain.contract
import
android.app.Activity
import
com.zxhl.cms.net.model.box.AppInEntity
import
com.zxhl.cms.net.model.uc.AliPayEntity
import
com.zxhl.cms.net.model.uc.WeChatPayEntity
import
com.zxhl.cms.net.model.video.MemberEntity
/**
...
...
@@ -14,16 +15,17 @@ class RightsPayContract {
interface
View
{
fun
requestOrderSuc
(
result
:
AliPayEntity
)
fun
requestOrderSuc
(
result
:
WeChatPayEntity
)
fun
requestOrderFail
(
errorMsg
:
String
)
fun
verifyOrderSuc
(
order
:
String
)
fun
verifyOrderFail
(
errorMsg
:
String
)
}
interface
Presenter
{
fun
requestRightsAliPay
(
jumpScheme
:
String
,
goodsId
:
String
,
payType
:
String
,
phone
:
String
)
fun
requestRightsAliPay
(
jumpScheme
:
String
,
goodsId
:
String
,
payType
:
String
,
phone
:
String
)
fun
verifyPay
(
order
:
String
?,
payType
:
Int
)
}
...
...
moduleMain/src/main/java/com/zxbw/modulemain/presenter/RechargePresenter.kt
View file @
ecb74737
package
com.zxbw.modulemain.presenter
import
android.text.TextUtils
import
android.util.Log
import
com.zxbw.modulemain.contract.RechargeContract
import
com.zxhl.cms.net.ApiClient
import
com.zxhl.cms.net.RxSchedulers
import
com.zxhl.cms.net.SettingPreference
import
com.zxhl.cms.net.callback.BaseObserver
import
com.zxhl.cms.net.model.box.AppInEntity
import
com.zxhl.cms.net.model.qy.CouponsEntity
import
com.zxhl.cms.net.model.uc.AliPayEntity
import
com.zxhl.cms.net.model.uc.PayVerifyEntity
import
com.zxhl.cms.net.model.uc.WeChatPayEntity
import
com.zxhl.cms.net.model.video.MemberEntity
import
com.zxhl.cms.pay.PaymentConfig
import
com.zxhl.cms.utils.UserDataUtils
import
com.zxhl.cms.utils.WeChatPay
import
org.json.JSONObject
class
RechargePresenter
:
RechargeContract
.
Presenter
{
...
...
@@ -92,6 +96,7 @@ class RechargePresenter : RechargeContract.Presenter {
}
override
fun
verifyPay
(
order
:
String
?,
payType
:
Int
)
{
Log
.
e
(
"MXL"
,
"payType:"
+
order
+
"type:"
+
payType
)
try
{
if
(
payType
==
1
)
{
val
json
=
JSONObject
(
order
)
...
...
@@ -100,10 +105,11 @@ class RechargePresenter : RechargeContract.Presenter {
val
outTradeOrder
=
obj
.
getString
(
"out_trade_no"
)
requestVerify
(
outTradeOrder
,
tradeOrder
,
payType
)
}
else
if
(
payType
==
2
)
{
val
json
=
JSONObject
(
order
)
val
tradeOrder
=
""
val
outTradeOrder
=
json
.
getString
(
"extData"
)
requestVerify
(
outTradeOrder
,
tradeOrder
,
payType
)
// val json = JSONObject(order)
// val tradeOrder = ""
// val outTradeOrder = json.getString("extData")
// Log.e("MXL","2outTradeOrder:"+outTradeOrder+"")
requestVerify
(
order
,
""
,
payType
)
}
else
if
(
payType
==
11
)
{
if
(!
TextUtils
.
isEmpty
(
order
))
{
requestVerify
(
order
?:
""
,
""
,
payType
)
...
...
@@ -154,7 +160,51 @@ class RechargePresenter : RechargeContract.Presenter {
})
}
private
fun
requestVerify
(
outTradeOrder
:
String
,
tradeOrder
:
String
,
payType
:
Int
)
{
override
fun
requestWechatPayOrder
(
jumpScheme
:
String
,
goodsId
:
String
,
payType
:
String
,
phone
:
String
,
type
:
String
,
skill
:
Boolean
?,
outTradeNo
:
String
?,
couponId
:
String
?,
mobileOp
:
String
?
)
{
ApiClient
.
userInfoAPi
.
wechatPayRights
(
jumpScheme
,
goodsId
,
payType
,
phone
,
type
,
skill
,
outTradeNo
,
couponId
,
mobileOp
)
.
compose
(
RxSchedulers
.
observableIO2Main
())
.
subscribe
(
object
:
BaseObserver
<
WeChatPayEntity
>()
{
override
fun
onSuccess
(
result
:
WeChatPayEntity
?)
{
if
(
result
!=
null
)
{
WeChatPay
.
startWeChatPay
(
result
,
payType
)
SettingPreference
.
setOutTradeNo
(
result
?.
outTradeNo
)
mView
?.
requestOrderSuc
(
result
)
}
// if (result != null) {
// mView?.requestOrderSuc(result)
// } else {
// mView?.requestOrderFail("zfb订单支付请求成功 数据为空")
// }
}
override
fun
onFailure
(
e
:
Throwable
?,
code
:
String
?,
errorMsg
:
String
?)
{
mView
?.
verifyOrderFail
(
"zfb订单支付请求失败 code:${code} msg:${errorMsg}"
)
}
})
}
private
fun
requestVerify
(
outTradeOrder
:
String
?,
tradeOrder
:
String
,
payType
:
Int
)
{
ApiClient
.
userInfoAPi
.
verifyPay
(
outTradeOrder
,
tradeOrder
,
payType
)
.
compose
(
RxSchedulers
.
observableIO2Main
())
.
subscribe
(
object
:
BaseObserver
<
PayVerifyEntity
>()
{
...
...
moduleMain/src/main/java/com/zxbw/modulemain/presenter/RightsPayPresenter.kt
View file @
ecb74737
...
...
@@ -4,11 +4,14 @@ import android.text.TextUtils
import
com.zxbw.modulemain.contract.RightsPayContract
import
com.zxhl.cms.net.ApiClient
import
com.zxhl.cms.net.RxSchedulers
import
com.zxhl.cms.net.SettingPreference
import
com.zxhl.cms.net.callback.BaseObserver
import
com.zxhl.cms.net.model.uc.AliPayEntity
import
com.zxhl.cms.net.model.uc.PayVerifyEntity
import
com.zxhl.cms.net.model.uc.WeChatPayEntity
import
com.zxhl.cms.pay.PaymentConfig
import
com.zxhl.cms.utils.UserDataUtils
import
com.zxhl.cms.utils.WeChatPay
import
org.json.JSONObject
/**
...
...
@@ -30,21 +33,40 @@ class RightsPayPresenter : RightsPayContract.Presenter {
payType
:
String
,
phone
:
String
)
{
ApiClient
.
userInfoAPi
.
aliPayRights
(
jumpScheme
,
goodsId
,
payType
,
phone
,
"50"
,
false
,
""
)
.
compose
(
RxSchedulers
.
observableIO2Main
())
.
subscribe
(
object
:
BaseObserver
<
AliPayEntity
>()
{
override
fun
onSuccess
(
result
:
AliPayEntity
?)
{
if
(
result
!=
null
)
{
mView
?.
requestOrderSuc
(
result
)
}
else
{
mView
?.
requestOrderFail
(
"zfb订单支付请求成功 数据为空"
)
if
(
TextUtils
.
equals
(
payType
,
"2"
))
{
ApiClient
.
userInfoAPi
.
wechatRights
(
jumpScheme
,
goodsId
,
payType
,
phone
,
"50"
,
false
,
""
)
.
compose
(
RxSchedulers
.
observableIO2Main
())
.
subscribe
(
object
:
BaseObserver
<
WeChatPayEntity
>()
{
override
fun
onSuccess
(
result
:
WeChatPayEntity
?)
{
if
(
result
!=
null
)
{
WeChatPay
.
startWeChatPay
(
result
,
payType
)
SettingPreference
.
setOutTradeNo
(
result
?.
outTradeNo
)
mView
?.
requestOrderSuc
(
result
)
}
}
}
override
fun
onFailure
(
e
:
Throwable
?,
code
:
String
?,
errorMsg
:
String
?)
{
mView
?.
verifyOrderFail
(
"zfb订单支付请求失败 code:${code} msg:${errorMsg}"
)
}
})
override
fun
onFailure
(
e
:
Throwable
?,
code
:
String
?,
errorMsg
:
String
?)
{
mView
?.
verifyOrderFail
(
"zfb订单支付请求失败 code:${code} msg:${errorMsg}"
)
}
})
}
else
{
ApiClient
.
userInfoAPi
.
aliPayRights
(
jumpScheme
,
goodsId
,
payType
,
phone
,
"50"
,
false
,
""
)
.
compose
(
RxSchedulers
.
observableIO2Main
())
.
subscribe
(
object
:
BaseObserver
<
AliPayEntity
>()
{
override
fun
onSuccess
(
result
:
AliPayEntity
?)
{
if
(
result
!=
null
)
{
mView
?.
requestOrderSuc
(
result
)
}
else
{
mView
?.
requestOrderFail
(
"zfb订单支付请求成功 数据为空"
)
}
}
override
fun
onFailure
(
e
:
Throwable
?,
code
:
String
?,
errorMsg
:
String
?)
{
mView
?.
verifyOrderFail
(
"zfb订单支付请求失败 code:${code} msg:${errorMsg}"
)
}
})
}
}
override
fun
verifyPay
(
order
:
String
?,
payType
:
Int
)
{
...
...
@@ -56,10 +78,10 @@ class RightsPayPresenter : RightsPayContract.Presenter {
val
outTradeOrder
=
obj
.
getString
(
"out_trade_no"
)
requestVerify
(
outTradeOrder
,
tradeOrder
,
payType
)
}
else
if
(
payType
==
PaymentConfig
.
WECHAT_PAY
)
{
val
json
=
JSONObject
(
order
)
val
tradeOrder
=
""
val
outTradeOrder
=
json
.
getString
(
"extData"
)
requestVerify
(
o
utTradeOrder
,
tradeOrder
,
payType
)
//
val json = JSONObject(order)
//
val tradeOrder = ""
//
val outTradeOrder = json.getString("extData")
requestVerify
(
o
rder
,
""
,
payType
)
}
else
if
(
payType
==
PaymentConfig
.
MINI_PROGRAM
)
{
if
(!
TextUtils
.
isEmpty
(
order
))
{
requestVerify
(
order
?:
""
,
""
,
payType
)
...
...
@@ -82,7 +104,7 @@ class RightsPayPresenter : RightsPayContract.Presenter {
if
(!
TextUtils
.
isEmpty
(
order
))
{
requestVerify
(
order
?:
""
,
""
,
payType
)
}
}
else
if
(
payType
==
PaymentConfig
.
ZFB_H5_PAY
||
payType
==
PaymentConfig
.
WX_H5_PAY
||
payType
==
PaymentConfig
.
HUI_FU_H5_PAY1
||
payType
==
PaymentConfig
.
HUI_FU_H5_PAY2
)
{
}
else
if
(
payType
==
PaymentConfig
.
ZFB_H5_PAY
||
payType
==
PaymentConfig
.
WX_H5_PAY
||
payType
==
PaymentConfig
.
HUI_FU_H5_PAY1
||
payType
==
PaymentConfig
.
HUI_FU_H5_PAY2
)
{
if
(!
TextUtils
.
isEmpty
(
order
))
{
requestVerify
(
order
?:
""
,
""
,
payType
)
}
...
...
@@ -94,7 +116,7 @@ class RightsPayPresenter : RightsPayContract.Presenter {
}
}
private
fun
requestVerify
(
outTradeOrder
:
String
,
tradeOrder
:
String
,
payType
:
Int
)
{
private
fun
requestVerify
(
outTradeOrder
:
String
?
,
tradeOrder
:
String
,
payType
:
Int
)
{
ApiClient
.
userInfoAPi
.
verifyPay
(
outTradeOrder
,
tradeOrder
,
payType
)
.
compose
(
RxSchedulers
.
observableIO2Main
())
.
subscribe
(
object
:
BaseObserver
<
PayVerifyEntity
>()
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment