Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
Y
YDL-Component-Medical
Overview
Overview
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
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
杨凯
YDL-Component-Medical
Commits
8b9a99be
Commit
8b9a99be
authored
Mar 31, 2021
by
刘鹏
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat: 支付日志埋点完成
parent
3d6e551e
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
79 additions
and
14 deletions
+79
-14
config.gradle
config.gradle
+4
-4
CommonPayDialog.kt
ydl-pay/src/main/java/com/yidianling/ydl_pay/common/CommonPayDialog.kt
+0
-0
PayActivity.kt
ydl-pay/src/main/java/com/yidianling/ydl_pay/pay/PayActivity.kt
+50
-6
RxPay.kt
ydl-pay/src/main/java/com/yidianling/ydl_pay/pay/RxPay.kt
+16
-4
PayDialog.kt
ydl-pay/src/main/java/com/yidianling/ydl_pay/pay/payDialog/PayDialog.kt
+9
-0
No files found.
config.gradle
View file @
8b9a99be
...
...
@@ -38,8 +38,8 @@ ext {
//第二步 若干
"ydl-webview"
:
"0.0.38.36"
,
"ydl-media"
:
"0.0.21.6"
,
"ydl-pay"
:
"0.0.18.1
3
"
,
"m-audioim"
:
"0.0.49.29.3
0
"
,
"ydl-pay"
:
"0.0.18.1
5
"
,
"m-audioim"
:
"0.0.49.29.3
2
"
,
"ydl-flutter-base"
:
"0.0.14.20"
,
//以下 几乎不会动
...
...
@@ -120,8 +120,8 @@ ext {
//第二步 若干
"ydl-webview"
:
"0.0.38.36"
,
"ydl-media"
:
"0.0.21.6"
,
"ydl-pay"
:
"0.0.18.1
1
"
,
"m-audioim"
:
"0.0.49.29.3
0
"
,
"ydl-pay"
:
"0.0.18.1
5
"
,
"m-audioim"
:
"0.0.49.29.3
2
"
,
"ydl-flutter-base"
:
"0.0.14.20"
,
//以下 几乎不会动
...
...
ydl-pay/src/main/java/com/yidianling/ydl_pay/common/CommonPayDialog.kt
View file @
8b9a99be
This diff is collapsed.
Click to expand it.
ydl-pay/src/main/java/com/yidianling/ydl_pay/pay/PayActivity.kt
View file @
8b9a99be
...
...
@@ -18,6 +18,8 @@ import com.ydl.ydlcommon.data.PlatformDataManager
import
com.ydl.ydlcommon.data.http.RxUtils
import
com.ydl.ydlcommon.data.http.ThrowableConsumer
import
com.ydl.ydlcommon.modular.ModularServiceManager
import
com.ydl.ydlcommon.utils.log.AliYunLogConfig
import
com.ydl.ydlcommon.utils.log.AliYunLogHelper
import
com.ydl.ydlcommon.utils.log.LogHelper
import
com.yidianling.common.tools.LogUtil
import
com.yidianling.common.tools.ToastUtil
...
...
@@ -65,6 +67,7 @@ class PayActivity : BaseActivity() {
*/
private
const
val
PARAMS
=
"params"
private
const
val
PARAMS_RED
=
"params_redPacket"
/**
* 支付类型
* 1.微信支付 2.支付宝支付
...
...
@@ -91,29 +94,41 @@ class PayActivity : BaseActivity() {
//订单信息数据
private
var
payParams
:
PayParams
?
=
null
//红包列表数据+支付金额
private
var
redPacketPayBean
:
RedPacketPayBean
?
=
null
//入口
private
var
inlet
=
PayParams
.
INLET_NORMAL
//红包列表弹窗
private
var
redPacketPopWindow
:
RedPacketPopWindow
?
=
null
//加载中弹窗
private
var
dialog
:
AlertDialog
?
=
null
private
var
dialogContentView
:
View
?
=
null
//红包id 默认为0
private
var
redPacketId
:
String
?
=
"0"
//使用红包金额
private
var
redPacketMoney
:
Float
=
0f
//使用红包文案
private
var
redPacketMoneyContent
:
String
=
""
//账户余额
private
var
balanceMoney
:
Float
=
0f
//支付金额
private
var
payMoney
:
Float
=
0F
//可使用余额
private
var
canBalanceMoney
=
0F
//支付类型
private
var
payType
=
PAY_ALI
//测评下单数据bean
private
var
testAddOrderBean
:
TestAddOrderBean
?
=
null
...
...
@@ -538,6 +553,7 @@ class PayActivity : BaseActivity() {
* 点击支付
*/
private
fun
onClickPay
()
{
AliYunLogHelper
.
getInstance
().
sendLog
(
AliYunLogConfig
.
PAY
,
"点击支付"
)
when
(
inlet
)
{
INLET_NORMAL
->
{
//正常入口
...
...
@@ -603,6 +619,7 @@ class PayActivity : BaseActivity() {
if
(
null
==
payParams
)
{
return
}
AliYunLogHelper
.
getInstance
().
sendLog
(
AliYunLogConfig
.
PAY
,
"进入充值, 0微信充值,其他支付宝充值:$select"
)
HttpUtils
.
recharge
(
RechargeParam
(
payParams
!!
.
needPay
.
toInt
().
toString
()))
.
subscribeOn
(
Schedulers
.
io
())
...
...
@@ -622,6 +639,8 @@ class PayActivity : BaseActivity() {
.
doOnSubscribe
{
showProgressDialog
(
""
)
}
.
doAfterTerminate
{
dismissProgressDialog
()
}
.
subscribe
(
Consumer
{
AliYunLogHelper
.
getInstance
().
sendLog
(
AliYunLogConfig
.
PAY
,
"支付成功"
)
LogHelper
.
getInstance
().
writeLogSync
(
"支付成功"
)
ToastUtil
.
toastShort
(
"支付成功"
)
var
intent
=
Intent
()
...
...
@@ -633,6 +652,8 @@ class PayActivity : BaseActivity() {
override
fun
accept
(
msg
:
String
)
{
ToastUtil
.
toastShort
(
msg
)
LogHelper
.
getInstance
().
writeLogSync
(
"支付失败$msg"
)
AliYunLogHelper
.
getInstance
().
sendLog
(
AliYunLogConfig
.
PAY
,
"支付失败$msg"
)
}
})
...
...
@@ -644,13 +665,19 @@ class PayActivity : BaseActivity() {
when
(
inlet
)
{
INLET_NORMAL
->
{
//正常入口
AliYunLogHelper
.
getInstance
().
sendLog
(
AliYunLogConfig
.
PAY
,
"余额支付 正常入口"
)
balancePayById
(
payParams
!!
.
payId
)
}
INLET_TEST
->
{
//测评入口
AliYunLogHelper
.
getInstance
().
sendLog
(
AliYunLogConfig
.
PAY
,
"余额支付 测评入口"
)
balancePayById
(
testAddOrderBean
!!
.
payId
!!
)
}
else
->
{
AliYunLogHelper
.
getInstance
().
sendLog
(
AliYunLogConfig
.
PAY
,
"余额支付"
)
balancePayById
(
payParams
!!
.
payId
)
}
}
...
...
@@ -673,6 +700,7 @@ class PayActivity : BaseActivity() {
.
doAfterTerminate
{
dismissProgressDialog
()
}
.
subscribe
(
Consumer
{
LogHelper
.
getInstance
().
writeLogSync
(
"支付成功"
)
AliYunLogHelper
.
getInstance
().
sendLog
(
AliYunLogConfig
.
PAY
,
"余额支付:支付成功"
)
ToastUtil
.
toastShort
(
"支付成功"
)
setResult
(
Activity
.
RESULT_OK
)
finish
()
...
...
@@ -680,6 +708,8 @@ class PayActivity : BaseActivity() {
override
fun
accept
(
msg
:
String
)
{
ToastUtil
.
toastShort
(
msg
)
LogHelper
.
getInstance
().
writeLogSync
(
"支付失败:$msg"
)
AliYunLogHelper
.
getInstance
().
sendLog
(
AliYunLogConfig
.
PAY
,
"余额支付:支付失败:$msg"
)
}
})
}
...
...
@@ -689,6 +719,7 @@ class PayActivity : BaseActivity() {
*/
@SuppressLint
(
"CheckResult"
)
private
fun
appPay
()
{
AliYunLogHelper
.
getInstance
().
sendLog
(
AliYunLogConfig
.
PAY
,
"微信支付 0 其他支付宝支付 select:${select}"
)
Observable
.
just
(
select
)
.
subscribeOn
(
Schedulers
.
io
())
...
...
@@ -706,6 +737,7 @@ class PayActivity : BaseActivity() {
.
doOnSubscribe
{
showProgressDialog
(
""
)
}
.
doAfterTerminate
{
dismissProgressDialog
()
}
.
subscribe
(
Consumer
{
AliYunLogHelper
.
getInstance
().
sendLog
(
AliYunLogConfig
.
PAY
,
"支付成功"
)
LogHelper
.
getInstance
().
writeLogSync
(
"支付成功"
)
setResult
(
Activity
.
RESULT_OK
)
finish
()
...
...
@@ -713,6 +745,8 @@ class PayActivity : BaseActivity() {
override
fun
accept
(
msg
:
String
)
{
ToastUtil
.
toastShort
(
msg
)
LogHelper
.
getInstance
().
writeLogSync
(
"支付失败:$msg"
)
AliYunLogHelper
.
getInstance
().
sendLog
(
AliYunLogConfig
.
PAY
,
"支付失败:$msg"
)
}
})
}
...
...
@@ -724,18 +758,21 @@ class PayActivity : BaseActivity() {
return
when
(
inlet
)
{
INLET_NORMAL
->
{
//正常入口
wxPayById
(
payParams
!!
.
payId
,
payParams
?.
merchantType
.
toString
())
AliYunLogHelper
.
getInstance
().
sendLog
(
AliYunLogConfig
.
PAY
,
"微信支付:正常入口"
)
wxPayById
(
payParams
!!
.
payId
,
payParams
?.
merchantType
.
toString
())
}
INLET_TEST
->
{
//测评入口
if
(
null
!=
testAddOrderBean
&&
!
TextUtils
.
isEmpty
(
testAddOrderBean
!!
.
payId
!!
))
{
wxPayById
(
testAddOrderBean
!!
.
payId
!!
,
payParams
?.
merchantType
.
toString
())
AliYunLogHelper
.
getInstance
().
sendLog
(
AliYunLogConfig
.
PAY
,
"微信支付:测评入口"
)
wxPayById
(
testAddOrderBean
!!
.
payId
!!
,
payParams
?.
merchantType
.
toString
())
}
else
{
null
}
}
else
->
{
wxPayById
(
payParams
!!
.
payId
,
payParams
?.
merchantType
.
toString
())
AliYunLogHelper
.
getInstance
().
sendLog
(
AliYunLogConfig
.
PAY
,
"微信支付"
)
wxPayById
(
payParams
!!
.
payId
,
payParams
?.
merchantType
.
toString
())
}
}
}
...
...
@@ -744,8 +781,8 @@ class PayActivity : BaseActivity() {
* 微信支付
* @param payId 支付id
*/
private
fun
wxPayById
(
payId
:
String
,
merchantType
:
String
):
Observable
<
PayStatus
>
{
val
bean
=
WxPayParam
(
payId
,
1
,
merchantType
)
private
fun
wxPayById
(
payId
:
String
,
merchantType
:
String
):
Observable
<
PayStatus
>
{
val
bean
=
WxPayParam
(
payId
,
1
,
merchantType
)
return
HttpUtils
.
wxPay
(
bean
)
.
compose
(
RxUtils
.
resultData
())
.
observeOn
(
AndroidSchedulers
.
mainThread
())
...
...
@@ -760,17 +797,23 @@ class PayActivity : BaseActivity() {
return
when
(
inlet
)
{
INLET_NORMAL
->
{
//正常入口
AliYunLogHelper
.
getInstance
().
sendLog
(
AliYunLogConfig
.
PAY
,
"支付宝支付:正常入口"
)
aliPayById
(
payParams
!!
.
payId
)
}
INLET_TEST
->
{
//测评入口
if
(
null
!=
testAddOrderBean
&&
!
TextUtils
.
isEmpty
(
testAddOrderBean
!!
.
payId
!!
))
{
AliYunLogHelper
.
getInstance
().
sendLog
(
AliYunLogConfig
.
PAY
,
"支付宝支付:测评入口"
)
aliPayById
(
testAddOrderBean
!!
.
payId
!!
)
}
else
{
null
}
}
else
->
{
AliYunLogHelper
.
getInstance
().
sendLog
(
AliYunLogConfig
.
PAY
,
"支付宝支付"
)
aliPayById
(
payParams
!!
.
payId
)
}
}
...
...
@@ -811,7 +854,8 @@ class PayActivity : BaseActivity() {
.
create
()
}
if
(
dialogContentView
==
null
)
{
dialogContentView
=
LayoutInflater
.
from
(
this
).
inflate
(
R
.
layout
.
pay_fragment_loading_dialog
,
null
)
dialogContentView
=
LayoutInflater
.
from
(
this
).
inflate
(
R
.
layout
.
pay_fragment_loading_dialog
,
null
)
dialogContentView
?.
tvMsg
?.
visibility
=
View
.
GONE
}
dialog
?.
show
()
...
...
ydl-pay/src/main/java/com/yidianling/ydl_pay/pay/RxPay.kt
View file @
8b9a99be
...
...
@@ -3,14 +3,16 @@ package com.yidianling.ydl_pay.pay
import
android.app.Activity
import
android.content.Context
import
com.alipay.sdk.app.PayTask
import
com.yidianling.ydl_pay.pay.bean.PayStatus
import
com.tencent.mm.opensdk.constants.Build
import
com.tencent.mm.opensdk.modelpay.PayReq
import
com.tencent.mm.opensdk.openapi.WXAPIFactory
import
com.yidianling.ydl_pay.pay.bean.WXPayEvent
import
com.ydl.ydlcommon.data.http.CustomThrowable
import
com.ydl.ydlcommon.utils.log.AliYunLogConfig
import
com.ydl.ydlcommon.utils.log.AliYunLogHelper
import
com.yidianling.ydl_pay.common.bean.CommonWXPayBean
import
com.yidianling.ydl_pay.common.bean.PayResult
import
com.yidianling.ydl_pay.pay.bean.PayStatus
import
com.yidianling.ydl_pay.pay.bean.WXPayEvent
import
de.greenrobot.event.EventBus
import
io.reactivex.Emitter
import
io.reactivex.Observable
...
...
@@ -59,8 +61,18 @@ object RxPay {
val
result
=
alipay
.
payV2
(
aliSign
,
true
)
val
payResult
=
PayResult
(
result
)
when
{
"9000"
==
payResult
.
resultStatus
->
it
.
onNext
(
PayStatus
(
true
))
else
->
it
.
onError
(
CustomThrowable
(
payResult
.
memo
))
"9000"
==
payResult
.
resultStatus
->
{
it
.
onNext
(
PayStatus
(
true
))
AliYunLogHelper
.
getInstance
().
sendLog
(
AliYunLogConfig
.
PAY
,
"支付宝支付成功"
)
}
else
->
{
it
.
onError
(
CustomThrowable
(
payResult
.
memo
))
AliYunLogHelper
.
getInstance
()
.
sendLog
(
AliYunLogConfig
.
PAY
,
"支付宝支付失败 memo:${payResult.memo}"
)
}
}
it
.
onComplete
()
}
...
...
ydl-pay/src/main/java/com/yidianling/ydl_pay/pay/payDialog/PayDialog.kt
View file @
8b9a99be
...
...
@@ -9,6 +9,8 @@ import android.support.v7.app.AlertDialog
import
android.view.*
import
com.ydl.ydlcommon.data.http.RxUtils
import
com.ydl.ydlcommon.utils.StringUtils
import
com.ydl.ydlcommon.utils.log.AliYunLogConfig
import
com.ydl.ydlcommon.utils.log.AliYunLogHelper
import
com.ydl.ydlcommon.utils.log.LogHelper
import
com.ydl.ydlcommon.utils.remind.ToastHelper
import
com.yidianling.ydl_pay.R
...
...
@@ -160,6 +162,7 @@ class PayDialog : Dialog {
if
(
data
?.
payId
==
null
)
{
ToastHelper
.
show
(
"支付id有误,请返回重试"
)
AliYunLogHelper
.
getInstance
().
sendLog
(
AliYunLogConfig
.
PAY
,
"支付id有误,请返回重试"
)
return
}
...
...
@@ -187,9 +190,12 @@ class PayDialog : Dialog {
this
.
callBack
?.
onSuccess
()
}
LogHelper
.
getInstance
().
writeLogSync
(
"支付成功"
)
AliYunLogHelper
.
getInstance
().
sendLog
(
AliYunLogConfig
.
PAY
,
"支付成功"
)
this
.
callBack
?.
onSuccess
()
dismiss
()
},
{
AliYunLogHelper
.
getInstance
().
sendLog
(
AliYunLogConfig
.
PAY
,
"支付失败:${it.message}"
)
ToastHelper
.
show
(
it
.
message
?:
"支付失败"
)
LogHelper
.
getInstance
().
writeLogSync
(
"支付失败:${it.message}"
)
})
...
...
@@ -200,6 +206,7 @@ class PayDialog : Dialog {
* @param payId 支付id
*/
private
fun
wxPayById
(
payId
:
String
,
merchantType
:
String
):
Observable
<
PayStatus
>
{
AliYunLogHelper
.
getInstance
().
sendLog
(
AliYunLogConfig
.
PAY
,
"微信支付"
)
val
bean
=
WxPayParam
(
payId
,
1
,
merchantType
)
return
HttpUtils
.
wxPay
(
bean
)
.
compose
(
RxUtils
.
resultData
())
...
...
@@ -212,6 +219,8 @@ class PayDialog : Dialog {
* @param payId 支付Id
*/
private
fun
aliPayById
(
payId
:
String
):
Observable
<
PayStatus
>
{
AliYunLogHelper
.
getInstance
().
sendLog
(
AliYunLogConfig
.
PAY
,
"支付宝支付"
)
var
bean
=
AliPayParam
(
payId
,
1
)
return
HttpUtils
.
getAliPayOrderId
(
bean
)
.
compose
(
RxUtils
.
resultData
())
...
...
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