Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
A
android_vedio
Project
Project
Details
Activity
Releases
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
android
android_vedio
Commits
58f6aada
Commit
58f6aada
authored
Oct 31, 2024
by
mengcuiguang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
添加微信预签约逻辑
parent
0cac0b81
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
83 additions
and
33 deletions
+83
-33
WxPayParamBean.java
...ava/com/duben/miaoquplaylet/mvp/model/WxPayParamBean.java
+9
-0
VipActivity.kt
.../java/com/duben/miaoquplaylet/ui/activitys/VipActivity.kt
+3
-1
VipAdapter.kt
...ain/java/com/duben/miaoquplaylet/ui/adapter/VipAdapter.kt
+1
-2
WXPay.java
video/wxpay/src/main/java/com/jobo/wxpay/WXPay.java
+44
-30
WXPayInfoImpl.java
video/wxpay/src/main/java/com/jobo/wxpay/WXPayInfoImpl.java
+26
-0
No files found.
video/app/src/main/java/com/duben/miaoquplaylet/mvp/model/WxPayParamBean.java
View file @
58f6aada
...
...
@@ -50,6 +50,7 @@ public class WxPayParamBean implements Serializable {
private
String
prepayid
;
private
String
noncestr
;
private
String
timestamp
;
private
String
pre_entrustweb_id
;
private
String
params
;
private
boolean
agreement
;
//true-走自动签约
...
...
@@ -106,6 +107,14 @@ public class WxPayParamBean implements Serializable {
return
timestamp
;
}
public
String
getPre_entrustweb_id
()
{
return
pre_entrustweb_id
;
}
public
void
setPre_entrustweb_id
(
String
pre_entrustweb_id
)
{
this
.
pre_entrustweb_id
=
pre_entrustweb_id
;
}
public
void
setTimestamp
(
String
timestamp
)
{
this
.
timestamp
=
timestamp
;
}
...
...
video/app/src/main/java/com/duben/miaoquplaylet/ui/activitys/VipActivity.kt
View file @
58f6aada
...
...
@@ -477,6 +477,8 @@ class VipActivity : BaseActivity(), VipView, View.OnClickListener,
val
wxPay
:
WXPay
=
WXPay
.
getInstance
()
//构造微信订单实体。一般都是由服务端直接返回。
val
wxPayInfoImpl
=
WXPayInfoImpl
()
wxPayInfoImpl
.
payModel
=
payToModel
wxPayInfoImpl
.
pre_entrustweb_id
=
data
.
pre_entrustweb_id
wxPayInfoImpl
.
timestamp
=
data
.
timestamp
wxPayInfoImpl
.
sign
=
data
.
sign
wxPayInfoImpl
.
prepayId
=
data
.
prepayid
...
...
@@ -623,7 +625,7 @@ class VipActivity : BaseActivity(), VipView, View.OnClickListener,
private
fun
ruleAgreementPayDialog
()
{
if
(
vipList
!=
null
&&
vipList
!!
.
size
>
0
)
{
val
vipBean
=
vipList
!!
[
vipAdapter
.
getPosition
()]
ruleAgreementDialog
=
RuleAgreementDialog
(
context
,
payType
,
object
:
DialogListener
()
{
ruleAgreementDialog
=
RuleAgreementDialog
(
context
,
payType
,
object
:
DialogListener
()
{
override
fun
onClick
(
v
:
View
)
{
if
(!
isFinishing
()
&&
ruleAgreementDialog
!=
null
&&
ruleAgreementDialog
!!
.
isShowing
())
{
ruleAgreementDialog
!!
.
dismiss
()
...
...
video/app/src/main/java/com/duben/miaoquplaylet/ui/adapter/VipAdapter.kt
View file @
58f6aada
...
...
@@ -107,9 +107,8 @@ class VipAdapter(val vipList: MutableList<VipBean.ListBean>) :
// }
if
(
vipBean
.
price
==
0.0
){
holder
.
tvVipItemCurMoney
.
text
=
SpanUtils
()
.
append
(
"
0.01
"
)
.
append
(
"
免费试用
"
)
.
setFontSize
(
BubbleUtils
.
sp2px
(
34
))
.
append
(
"元"
)
.
create
()
}
else
{
holder
.
tvVipItemCurMoney
.
text
=
SpanUtils
()
...
...
video/wxpay/src/main/java/com/jobo/wxpay/WXPay.java
View file @
58f6aada
/*
******************************* Copyright (c)*********************************\
**
** (c) Copyright 2017, King, china
** All Rights Reserved
**
** By(King)
**
**------------------------------------------------------------------------------
*/
******************************* Copyright (c)*********************************\
**
** (c) Copyright 2017, King, china
** All Rights Reserved
**
** By(King)
**
**------------------------------------------------------------------------------
*/
package
com
.
jobo
.
wxpay
;
import
android.app.Activity
;
...
...
@@ -18,10 +18,13 @@ import com.jobo.rxpay.base.IPayStrategy;
import
com.jobo.rxpay.callback.IPayCallback
;
import
com.tencent.mm.opensdk.constants.Build
;
import
com.tencent.mm.opensdk.modelbase.BaseResp
;
import
com.tencent.mm.opensdk.modelbiz.WXOpenBusinessWebview
;
import
com.tencent.mm.opensdk.modelpay.PayReq
;
import
com.tencent.mm.opensdk.openapi.IWXAPI
;
import
com.tencent.mm.opensdk.openapi.WXAPIFactory
;
import
java.util.HashMap
;
/**
* @Desc:
* @author: admin wsj
...
...
@@ -40,10 +43,10 @@ public class WXPay implements IPayStrategy<WXPayInfoImpl> {
}
public
static
WXPay
getInstance
(){
if
(
mWXPay
==
null
)
{
synchronized
(
WXPay
.
class
){
if
(
mWXPay
==
null
)
{
public
static
WXPay
getInstance
()
{
if
(
mWXPay
==
null
)
{
synchronized
(
WXPay
.
class
)
{
if
(
mWXPay
==
null
)
{
mWXPay
=
new
WXPay
();
}
}
...
...
@@ -66,11 +69,11 @@ public class WXPay implements IPayStrategy<WXPayInfoImpl> {
this
.
payInfoImpli
=
payInfo
;
sPayCallback
=
payCallback
;
if
(
payInfoImpli
==
null
||
TextUtils
.
isEmpty
(
payInfoImpli
.
getAppid
())
||
TextUtils
.
isEmpty
(
payInfoImpli
.
getPartnerid
())
if
(
payInfoImpli
==
null
||
TextUtils
.
isEmpty
(
payInfoImpli
.
getAppid
())
||
TextUtils
.
isEmpty
(
payInfoImpli
.
getPartnerid
())
||
TextUtils
.
isEmpty
(
payInfoImpli
.
getPrepayId
())
||
TextUtils
.
isEmpty
(
payInfoImpli
.
getPackageValue
())
||
TextUtils
.
isEmpty
(
payInfoImpli
.
getNonceStr
())
||
TextUtils
.
isEmpty
(
payInfoImpli
.
getTimestamp
())
||
TextUtils
.
isEmpty
(
payInfoImpli
.
getSign
()))
{
if
(
payCallback
!=
null
)
{
if
(
payCallback
!=
null
)
{
payCallback
.
failed
(
WXErrCodeEx
.
CODE_ILLEGAL_ARGURE
,
WXErrCodeEx
.
getMessageByCode
(
WXErrCodeEx
.
CODE_ILLEGAL_ARGURE
));
}
return
;
...
...
@@ -80,38 +83,49 @@ public class WXPay implements IPayStrategy<WXPayInfoImpl> {
initWXApi
(
activity
.
getApplicationContext
(),
payInfoImpli
.
getAppid
());
}
if
(!
check
())
{
if
(
payCallback
!=
null
)
{
if
(!
check
())
{
if
(
payCallback
!=
null
)
{
payCallback
.
failed
(
WXErrCodeEx
.
CODE_UNSUPPORT
,
WXErrCodeEx
.
getMessageByCode
(
WXErrCodeEx
.
CODE_UNSUPPORT
));
}
return
;
}
PayReq
req
=
new
PayReq
();
req
.
appId
=
payInfoImpli
.
getAppid
();
req
.
partnerId
=
payInfoImpli
.
getPartnerid
();
req
.
prepayId
=
payInfoImpli
.
getPrepayId
();
req
.
packageValue
=
payInfoImpli
.
getPackageValue
();
req
.
nonceStr
=
payInfoImpli
.
getNonceStr
();
req
.
timeStamp
=
payInfoImpli
.
getTimestamp
();
req
.
sign
=
payInfoImpli
.
getSign
();
mWXApi
.
sendReq
(
req
);
int
payModel
=
payInfoImpli
.
getPayModel
();
if
(
payModel
==
1
)
{
// 纯签约
WXOpenBusinessWebview
.
Req
wreq
=
new
WXOpenBusinessWebview
.
Req
();
wreq
.
businessType
=
12
;
//固定值
HashMap
queryInfo
=
new
HashMap
<>();
queryInfo
.
put
(
"pre_entrustweb_id"
,
payInfoImpli
.
getPre_entrustweb_id
());
wreq
.
queryInfo
=
queryInfo
;
mWXApi
.
sendReq
(
wreq
);
}
else
{
PayReq
req
=
new
PayReq
();
req
.
appId
=
payInfoImpli
.
getAppid
();
req
.
partnerId
=
payInfoImpli
.
getPartnerid
();
req
.
prepayId
=
payInfoImpli
.
getPrepayId
();
req
.
packageValue
=
payInfoImpli
.
getPackageValue
();
req
.
nonceStr
=
payInfoImpli
.
getNonceStr
();
req
.
timeStamp
=
payInfoImpli
.
getTimestamp
();
req
.
sign
=
payInfoImpli
.
getSign
();
mWXApi
.
sendReq
(
req
);
}
}
/**
* 支付回调响应
*/
public
void
onResp
(
int
errorCode
,
String
errorMsg
)
{
if
(
sPayCallback
==
null
)
{
if
(
sPayCallback
==
null
)
{
return
;
}
if
(
errorCode
==
BaseResp
.
ErrCode
.
ERR_OK
)
{
if
(
errorCode
==
BaseResp
.
ErrCode
.
ERR_OK
)
{
sPayCallback
.
success
();
}
else
if
(
errorCode
==
BaseResp
.
ErrCode
.
ERR_COMM
)
{
}
else
if
(
errorCode
==
BaseResp
.
ErrCode
.
ERR_COMM
)
{
sPayCallback
.
failed
(
errorCode
,
errorMsg
);
}
else
if
(
errorCode
==
BaseResp
.
ErrCode
.
ERR_USER_CANCEL
)
{
}
else
if
(
errorCode
==
BaseResp
.
ErrCode
.
ERR_USER_CANCEL
)
{
sPayCallback
.
cancel
();
}
else
{
sPayCallback
.
failed
(
errorCode
,
errorMsg
);
...
...
video/wxpay/src/main/java/com/jobo/wxpay/WXPayInfoImpl.java
View file @
58f6aada
...
...
@@ -35,6 +35,9 @@ public class WXPayInfoImpl implements IPayInfo {
private
String
appid
;
private
String
nonceStr
;
private
String
prepayId
;
private
String
businessType
;
private
String
pre_entrustweb_id
;
private
int
payModel
;
public
String
getSign
()
{
return
sign
;
...
...
@@ -92,4 +95,27 @@ public class WXPayInfoImpl implements IPayInfo {
this
.
prepayId
=
prepayId
;
}
public
String
getBusinessType
()
{
return
businessType
;
}
public
void
setBusinessType
(
String
businessType
)
{
this
.
businessType
=
businessType
;
}
public
String
getPre_entrustweb_id
()
{
return
pre_entrustweb_id
;
}
public
void
setPre_entrustweb_id
(
String
pre_entrustweb_id
)
{
this
.
pre_entrustweb_id
=
pre_entrustweb_id
;
}
public
int
getPayModel
()
{
return
payModel
;
}
public
void
setPayModel
(
int
payModel
)
{
this
.
payModel
=
payModel
;
}
}
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