Toggle navigation
Toggle navigation
This project
Loading...
Sign in
fe
/
yohobuy-node
·
Commits
Go to a project
GitLab
Go to group
Project
Activity
Files
Commits
Pipelines
0
Builds
0
Graphs
Milestones
Issues
1
Merge Requests
0
Members
Labels
Wiki
Forks
Network
Create a new issue
Download as
Email Patches
Plain Diff
Browse Files
Authored by
郝肖肖
8 years ago
Commit
ed22ecb9896f623843e8df150c7c5e21bf064a69
1 parent
15b6348f
'支付宝、银行卡、银联上下文'
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
19 additions
and
16 deletions
apps/shopping/helpers/pay/alibank.js
apps/shopping/helpers/payment.js
apps/shopping/helpers/pay/alibank.js
View file @
ed22ecb
...
...
@@ -16,7 +16,10 @@ const logger = global.yoho.logger;
const
PAY_URL
=
'https://mapi.alipay.com/gateway.do?'
;
const
Alibank
=
{
module
.
exports
=
class
extends
global
.
yoho
.
BaseModel
{
constructor
(
ctx
)
{
super
(
ctx
);
}
pay
(
user
,
order
,
param
,
protocol
)
{
let
payParams
=
JSON
.
parse
(
param
.
payParams
);
...
...
@@ -48,13 +51,14 @@ const Alibank = {
href
:
PAY_URL
+
body
}
};
},
}
notify
(
data
,
param
)
{
let
bankList
=
payHelpersBank
.
getList
();
let
payParams
=
JSON
.
parse
(
param
.
payParams
||
'{}'
);
let
orderCode
=
parseInt
(
data
.
out_trade_no
,
10
);
let
extraParam
=
JSON
.
parse
(
data
.
extra_common_param
||
'{}'
);
let
bankName
=
payHelpersBank
.
getList
()[
extraParam
.
defaultbank
]
&&
payHelpersBank
.
getList
()[
extraParam
.
defaultbank
].
name
||
''
;
let
bankName
=
bankList
[
extraParam
.
defaultbank
]
&&
bankList
[
extraParam
.
defaultbank
].
name
||
''
;
logger
.
info
(
`
Alibank
notify
,
params
=
$
{
JSON
.
stringify
(
data
)}
`
);
...
...
@@ -71,7 +75,7 @@ const Alibank = {
tradeNo
:
data
.
trade_no
,
bankBillNo
:
data
.
bank_seq_no
||
''
};
}
,
}
checkNotify
(
data
,
payParams
)
{
let
signValue
=
data
.
sign
;
...
...
@@ -85,5 +89,3 @@ const Alibank = {
return
signValue
===
signStr
;
}
};
module
.
exports
=
Alibank
;
...
...
apps/shopping/helpers/payment.js
View file @
ed22ecb
...
...
@@ -77,18 +77,18 @@ module.exports = class extends global.yoho.BaseModel {
switch
(
payInfo
.
id
)
{
case
payModel
.
payments
.
alipay
:
result
=
Alipay
.
pay
(
user
,
order
,
payInfo
,
protocol
);
result
=
new
Alipay
(
that
.
ctx
)
.
pay
(
user
,
order
,
payInfo
,
protocol
);
break
;
case
payModel
.
payments
.
tenpay
:
result
=
Tenpay
.
pay
(
user
,
order
,
payInfo
,
protocol
);
result
=
new
Tenpay
(
that
.
ctx
)
.
pay
(
user
,
order
,
payInfo
,
protocol
);
break
;
case
payModel
.
payments
.
chinabank
:
result
=
Chinabank
.
pay
(
user
,
order
,
payInfo
,
protocol
);
result
=
new
Chinabank
(
that
.
ctx
)
.
pay
(
user
,
order
,
payInfo
,
protocol
);
break
;
case
payModel
.
payments
.
alibank
:
bankCode
=
paymentPars
[
1
];
payInfo
.
bankCode
=
bankCode
;
// 设置默认银行
result
=
Alibank
.
pay
(
user
,
order
,
payInfo
,
protocol
);
result
=
new
Alibank
(
that
.
ctx
)
.
pay
(
user
,
order
,
payInfo
,
protocol
);
break
;
default
:
break
;
...
...
@@ -143,6 +143,7 @@ module.exports = class extends global.yoho.BaseModel {
_validate
(
query
,
payId
,
user
)
{
let
payModel
=
new
PayData
(
this
.
ctx
);
let
that
=
this
;
return
co
(
function
*
()
{
let
payInfo
=
yield
payModel
.
getPaymentInfo
(
payId
);
...
...
@@ -152,16 +153,16 @@ module.exports = class extends global.yoho.BaseModel {
let
isPcpayNotify
=
false
;
// 回调地址,java未做,走前端逻辑
if
(
payId
===
payModel
.
payments
.
alipay
)
{
payResult
=
Alipay
.
notify
(
query
,
payInfo
);
payResult
=
new
Alipay
(
that
.
ctx
)
.
notify
(
query
,
payInfo
);
}
else
if
(
payId
===
payModel
.
payments
.
alibank
)
{
payResult
=
Alibank
.
notify
(
query
,
payInfo
);
payResult
=
new
Alibank
(
that
.
ctx
)
.
notify
(
query
,
payInfo
);
}
else
if
(
payId
===
payModel
.
payments
.
unionpay
)
{
payResult
=
Unionpay
.
notify
(
query
);
payResult
=
new
Unionpay
(
that
.
ctx
)
.
notify
(
query
);
}
else
if
(
payId
===
payModel
.
payments
.
tenpay
)
{
payResult
=
Tenpay
.
notify
(
query
,
payInfo
);
payResult
=
new
Tenpay
(
that
.
ctx
)
.
notify
(
query
,
payInfo
);
isPcpayNotify
=
true
;
}
else
if
(
payId
===
payModel
.
payments
.
chinabank
)
{
payResult
=
Chinabank
.
notify
(
query
,
payInfo
);
payResult
=
new
Chinabank
(
that
.
ctx
)
.
notify
(
query
,
payInfo
);
isPcpayNotify
=
true
;
}
...
...
Please
register
or
login
to post a comment