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
00aaf9a1
Commit
00aaf9a1
authored
Aug 24, 2022
by
liusl
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat(custom): add pay params payId \& modify return
parent
d32de7b1
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
8 additions
and
3 deletions
+8
-3
Defined.ts
packages/toolkit/src/Payment/Defined.ts
+4
-0
Payment.ts
packages/toolkit/src/Payment/Payment.ts
+4
-3
No files found.
packages/toolkit/src/Payment/Defined.ts
View file @
00aaf9a1
...
...
@@ -98,6 +98,10 @@ export type ToPayParams = {
*/
openId
?:
string
;
appId
?:
string
;
/**
* 支付记录id, 采用余额支付的时候如果前端有此值就带过来
*/
payId
?:
number
;
}
export
enum
PayError
{
...
...
packages/toolkit/src/Payment/Payment.ts
View file @
00aaf9a1
...
...
@@ -146,7 +146,7 @@ export class Payment {
}
async
toPay
(
params
:
ToPayParams
):
Promise
<
ToPayReturns
>
{
const
{
totalAmount
,
payType
,
returnUrl
,
orderId
,
redirectUrl
,
openId
,
appId
,}
=
params
const
{
totalAmount
,
payType
,
returnUrl
,
orderId
,
redirectUrl
,
openId
,
appId
,
payId
,
}
=
params
let
quitUrl
=
params
.
quitUrl
// validate start >>>
switch
(
payType
)
{
...
...
@@ -221,6 +221,7 @@ export class Payment {
payType
,
openId
,
appId
,
payId
,
...
this
.
computeAmount
(
totalAmount
,
this
.
balance
),
}
if
(
payChannel
!==
null
)
{
...
...
@@ -228,8 +229,8 @@ export class Payment {
}
const
res
=
await
requestForJava
.
post
<
DoUnifiedParams
,
DefaultResponse
>
(
UNIT_PAY
,
doUnifiedParams
)
if
(
res
.
code
!==
'200'
)
return
{
errorMessage
:
res
.
msg
as
any
,
success
:
false
,
errorType
:
PayError
.
BACKEND
}
if
(
params
.
payType
===
PayType
.
BALANCE
&&
res
.
data
.
balancePayResult
)
{
return
{
success
:
res
.
data
.
balancePayResult
===
'true'
,
errorType
:
PayError
.
BALANCE
}
if
(
params
.
payType
===
PayType
.
BALANCE
&&
res
.
data
)
{
return
{
success
:
res
.
data
.
result
,
errorType
:
PayError
.
BALANCE
}
}
else
if
(
payChannel
===
PayChannel
.
WX_JSAPI
)
{
const
isPaySucc
=
await
this
.
wechatPayJSSDK
(
res
.
data
)
return
{
...
...
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