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
25a20355
Commit
25a20355
authored
Sep 22, 2023
by
zhengxiao
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat: 新增获取禁止的支付方式的接口
parent
83f6b73c
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
26 additions
and
6 deletions
+26
-6
API.ts
packages/toolkit/src/Payment/API.ts
+3
-0
Payment.ts
packages/toolkit/src/Payment/Payment.ts
+23
-6
No files found.
packages/toolkit/src/Payment/API.ts
View file @
25a20355
...
@@ -32,3 +32,5 @@ export const IS_PAY = `${BASE_URL_JAVA}/api/auth/Order/orderIsPay`
...
@@ -32,3 +32,5 @@ export const IS_PAY = `${BASE_URL_JAVA}/api/auth/Order/orderIsPay`
export
const
MY_BALANCE
=
`
${
BASE_URL_JAVA
}
/api/auth/cashierV2/myBalance`
export
const
MY_BALANCE
=
`
${
BASE_URL_JAVA
}
/api/auth/cashierV2/myBalance`
export
const
PAY_CHECK_INTERVAL
=
`
${
BASE_URL_JAVA
}
/api/pay/auth/pay/payCheckInterval`
export
const
PAY_CHECK_INTERVAL
=
`
${
BASE_URL_JAVA
}
/api/pay/auth/pay/payCheckInterval`
export
const
GET_EXCLUDE_PAYTYPE
=
`
${
BASE_URL_JAVA
}
/api/auth/cashierV2/getExcludePayType`
\ No newline at end of file
packages/toolkit/src/Payment/Payment.ts
View file @
25a20355
import
{
UNIT_PAY
,
IS_PAY
,
MY_BALANCE
,
PAY_CHECK_INTERVAL
}
from
"./API"
;
import
{
UNIT_PAY
,
IS_PAY
,
MY_BALANCE
,
PAY_CHECK_INTERVAL
,
GET_EXCLUDE_PAYTYPE
}
from
"./API"
;
import
md5
from
'blueimp-md5'
import
md5
from
'blueimp-md5'
import
qs
from
'qs'
import
qs
from
'qs'
import
{
Utils
}
from
"@/Utils/Utils"
;
import
{
Utils
}
from
"@/Utils/Utils"
;
...
@@ -49,6 +49,7 @@ export class Payment {
...
@@ -49,6 +49,7 @@ export class Payment {
return
new
Promise
<
number
|
null
>
(
async
(
resolve
,
reject
)
=>
{
return
new
Promise
<
number
|
null
>
(
async
(
resolve
,
reject
)
=>
{
try
{
try
{
const
res
=
await
requestForJava
.
get
<
Record
<
string
,
string
>
,
DefaultResponse
>
(
MY_BALANCE
)
const
res
=
await
requestForJava
.
get
<
Record
<
string
,
string
>
,
DefaultResponse
>
(
MY_BALANCE
)
console
.
log
(
"🚀 ~ file: Payment.ts:52 ~ Payment ~ returnnewPromise<number|null> ~ res:"
,
res
)
if
(
res
.
code
===
'200'
)
{
if
(
res
.
code
===
'200'
)
{
this
.
balance
=
Number
(
res
.
data
)
this
.
balance
=
Number
(
res
.
data
)
resolve
(
this
.
balance
)
resolve
(
this
.
balance
)
...
@@ -62,23 +63,39 @@ export class Payment {
...
@@ -62,23 +63,39 @@ export class Payment {
}
}
// 获取被禁止的支付方式列表
// 获取被禁止的支付方式列表
getDisabledPayMethodList
():
Promise
<
number
[]
>
{
getDisabledPayMethodList
(
doctorId
:
string
|
undefined
):
Promise
<
number
[]
>
{
return
new
Promise
<
number
[]
>
((
resolve
,
reject
)
=>
{
return
new
Promise
<
number
[]
>
(
async
(
resolve
,
reject
)
=>
{
resolve
([])
try
{
const
res
:
any
=
await
requestForJava
.
get
<
Record
<
string
,
string
>
,
DefaultResponse
>
(
GET_EXCLUDE_PAYTYPE
,
{
params
:
{
doctorId
}
})
if
(
res
.
code
==
200
)
{
resolve
(
res
.
data
)
}
else
{
reject
()
}
}
catch
(
error
)
{
reject
(
error
)
}
})
})
}
}
getPayMethodList
(
totalAmount
:
number
)
{
getPayMethodList
(
totalAmount
:
number
,
doctorId
?:
string
)
{
// 计算支付方式列表
// 计算支付方式列表
const
List
=
this
.
supportCombination
?
this
.
getPayMethodListForCombination
(
totalAmount
)
:
this
.
getPayMethodListForNotCombination
(
totalAmount
)
const
List
=
this
.
supportCombination
?
this
.
getPayMethodListForCombination
(
totalAmount
)
:
this
.
getPayMethodListForNotCombination
(
totalAmount
)
return
new
Promise
(
async
(
resolve
,
reject
)
=>
{
return
new
Promise
(
async
(
resolve
,
reject
)
=>
{
try
{
try
{
const
res
=
await
this
.
getDisabledPayMethodList
()
const
res
=
await
this
.
getDisabledPayMethodList
(
doctorId
)
console
.
log
(
"🚀 ~ file: Payment.ts:93 ~ Payment ~ returnnewPromise ~ res:"
,
res
)
// 从list中过滤出被禁止的支付方式
// 从list中过滤出被禁止的支付方式
const
filterList
=
List
.
filter
(({
value
})
=>
!
res
.
includes
(
value
))
const
filterList
=
List
.
filter
(({
value
})
=>
!
res
.
includes
(
value
))
console
.
log
(
"🚀 ~ file: Payment.ts:95 ~ Payment ~ returnnewPromise ~ filterList:"
,
filterList
)
resolve
(
filterList
)
resolve
(
filterList
)
}
catch
(
error
)
{
}
catch
(
error
)
{
console
.
log
(
"🚀 ~ file: Payment.ts:98 ~ Payment ~ returnnewPromise ~ error:"
,
error
)
reject
(
error
)
reject
(
error
)
}
}
})
})
...
...
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