Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
Y
ydl-packages
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
1
Merge Requests
1
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-packages
Commits
1be0abe5
Commit
1be0abe5
authored
Dec 11, 2023
by
zhengxiao
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'feat_wechat_231115' into feat_pay_230904
parents
b669e734
53323d51
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
8 additions
and
1 deletions
+8
-1
Defined.ts
packages/toolkit/src/Payment/Defined.ts
+4
-0
Payment.ts
packages/toolkit/src/Payment/Payment.ts
+3
-0
Utils.ts
packages/toolkit/src/Utils/Utils.ts
+1
-1
No files found.
packages/toolkit/src/Payment/Defined.ts
View file @
1be0abe5
...
...
@@ -118,6 +118,10 @@ export enum PayErrorMessage {
WECHAT_JSSDK_PAY_ERROR
=
'支付失败'
,
WECHAT_H5_PAY_BREAK
=
'微信h5支付中断'
,
ALIPAY_H5_PAY_BREAK
=
'支付宝支付中断'
,
/**
* 微信支付appid和openid不匹配
*/
WECHAT_OPENID_APPID_NOT_MATCH
=
'appid和openid不匹配'
,
}
export
type
ToPayReturns
=
{
...
...
packages/toolkit/src/Payment/Payment.ts
View file @
1be0abe5
...
...
@@ -280,6 +280,9 @@ export class Payment {
doUnifiedParams
.
payChannel
=
payChannel
}
const
res
=
await
requestForJava
.
post
<
DoUnifiedParams
,
DefaultResponse
>
(
UNIT_PAY
,
doUnifiedParams
)
if
(
Utils
.
isWechat
()
&&
res
.
msg
===
PayErrorMessage
.
WECHAT_OPENID_APPID_NOT_MATCH
)
{
window
.
location
.
href
=
`https://m.ydl.com/pay/wx-pay-open-id?toLink=
${
window
.
location
.
href
}
`
;
}
if
(
res
.
code
!==
'200'
)
return
{
errorMessage
:
res
.
msg
as
any
,
success
:
false
,
errorType
:
PayError
.
BACKEND
}
if
(
params
.
payType
===
PayType
.
BALANCE
&&
res
.
data
)
{
return
{
success
:
res
.
data
.
result
,
errorType
:
PayError
.
BALANCE
}
...
...
packages/toolkit/src/Utils/Utils.ts
View file @
1be0abe5
...
...
@@ -5,7 +5,7 @@ export class Utils {
return
/MicroMessenger/i
.
test
(
window
.
navigator
.
userAgent
)
}
static
isAlipay
():
boolean
{
return
/AlipayClient/i
.
test
(
window
.
navigator
.
userAgent
)
return
/AlipayClient/i
.
test
(
window
.
navigator
.
userAgent
)
||
/AliApp/i
.
test
(
window
.
navigator
.
userAgent
)
}
static
getCookie
(
key
:
string
):
string
|
null
{
return
Cookies
.
get
(
key
)
||
null
...
...
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