Toggle navigation
Toggle navigation
This project
Loading...
Sign in
fe
/
yoho-blk
·
Commits
Go to a project
GitLab
Go to group
Project
Activity
Files
Commits
Pipelines
0
Builds
0
Graphs
Milestones
Issues
0
Merge Requests
1
Members
Labels
Wiki
Forks
Network
Create a new issue
Download as
Email Patches
Plain Diff
Browse Files
Authored by
郝肖肖
8 years ago
Commit
8889b5b99a5ea5e91ad44938d88cf0a3d267fe68
1 parent
16127cd7
支付同步地址设置协议 protocol
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
19 additions
and
16 deletions
apps/shopping/controllers/pay.js
apps/shopping/helpers/pay/alibank.js
apps/shopping/helpers/pay/alipay.js
apps/shopping/helpers/payment.js
apps/shopping/models/pay.js
config/common.js
apps/shopping/controllers/pay.js
View file @
8889b5b
...
...
@@ -97,7 +97,7 @@ const toPay = (req, res, next) => {
OrderData
.
orderDetail
(
uid
,
orderCode
).
then
(
result
=>
{
if
(
result
&&
result
.
data
)
{
return
PayHelpers
.
pay
(
user
,
result
.
data
,
payType
);
return
PayHelpers
.
pay
(
user
,
result
.
data
,
payType
,
req
.
protocol
);
}
else
{
return
{
code
:
400
,
...
...
apps/shopping/helpers/pay/alibank.js
View file @
8889b5b
...
...
@@ -17,7 +17,7 @@ const ALIPAY_URL = 'https://mapi.alipay.com/gateway.do';
const
Alibank
=
{
pay
(
user
,
order
,
param
)
{
pay
(
user
,
order
,
param
,
protocol
)
{
let
payParams
=
JSON
.
parse
(
param
.
payParams
);
let
params
=
{
...
...
@@ -25,9 +25,7 @@ const Alibank = {
partner
:
payParams
.
merchant_id
,
_input_charset
:
'utf-8'
,
notify_url
:
config
.
pay
.
serviceNotify
+
'payment/alipay_notify'
,
// return_url: 'http://www.yohobuy.com/shopping/pay/callback/alipay',
return_url
:
'http:'
+
helpers
.
urlFormat
(
'/shopping/pay/callback/alibank'
),
return_url
:
protocol
+
':'
+
helpers
.
urlFormat
(
'/shopping/pay/callback/alibank'
),
subject
:
'BLK订单号:'
+
order
.
order_code
,
out_trade_no
:
order
.
order_code
,
it_b_pay
:
common
.
getPayExpireMin
(
order
.
pay_expire
)
+
'm'
,
...
...
apps/shopping/helpers/pay/alipay.js
View file @
8889b5b
...
...
@@ -17,7 +17,7 @@ const ALIPAY_URL = 'https://mapi.alipay.com/gateway.do';
const
Alipay
=
{
pay
(
user
,
order
,
param
)
{
pay
(
user
,
order
,
param
,
protocol
)
{
let
payParams
=
JSON
.
parse
(
param
.
payParams
);
let
params
=
{
...
...
@@ -25,7 +25,7 @@ const Alipay = {
partner
:
payParams
.
merchant_id
,
_input_charset
:
'utf-8'
,
notify_url
:
config
.
pay
.
serviceNotify
+
'payment/alipay_notify'
,
return_url
:
'http
:'
+
helpers
.
urlFormat
(
'/shopping/pay/callback/alipay'
),
return_url
:
protocol
+
'
:'
+
helpers
.
urlFormat
(
'/shopping/pay/callback/alipay'
),
subject
:
'BLK订单号:'
+
order
.
order_code
,
out_trade_no
:
order
.
order_code
,
it_b_pay
:
common
.
getPayExpireMin
(
order
.
pay_expire
)
+
'm'
,
...
...
apps/shopping/helpers/payment.js
View file @
8889b5b
...
...
@@ -18,7 +18,7 @@ const co = Promise.coroutine;
const
logger
=
global
.
yoho
.
logger
;
const
Payment
=
{
pay
(
user
,
order
,
payType
)
{
pay
(
user
,
order
,
payType
,
protocol
)
{
return
co
(
function
*
()
{
let
result
=
{
code
:
400
,
...
...
@@ -61,12 +61,12 @@ const Payment = {
switch
(
payInfo
.
id
)
{
case
PayData
.
payments
.
alipay
:
result
=
Alipay
.
pay
(
user
,
order
,
payInfo
);
result
=
Alipay
.
pay
(
user
,
order
,
payInfo
,
protocol
);
break
;
case
PayData
.
payments
.
alibank
:
bankCode
=
paymentPars
[
1
];
payInfo
.
bankCode
=
bankCode
;
// 设置默认银行
result
=
Alibank
.
pay
(
user
,
order
,
payInfo
);
result
=
Alibank
.
pay
(
user
,
order
,
payInfo
,
protocol
);
break
;
default
:
break
;
...
...
apps/shopping/models/pay.js
View file @
8889b5b
...
...
@@ -59,9 +59,9 @@ const getOnlinePayProvider = () => {
nav
=
[];
_
.
each
(
payHelpersBank
.
getList
(),
(
val
,
key
)
=>
{
nav
.
push
({
id
:
12
,
id
:
payments
.
alibank
,
name
:
val
.
name
,
value
:
'12
_'
+
key
,
value
:
payments
.
alibank
+
'
_'
+
key
,
img
:
val
.
ico
});
});
...
...
@@ -116,8 +116,8 @@ const getPayInfo = (uid, code) => {
let
findIndex
;
// 渲染选择的默认支付方式
if
(
paymentId
===
12
&&
payment
[
0
][
1
]
&&
payment
[
2
])
{
// 银行支付
findIndex
=
_
.
findIndex
(
payment
[
0
][
1
].
children
,
{
value
:
'12_'
+
payment
[
2
].
bankCode
});
if
(
paymentId
===
payments
.
alibank
&&
payment
[
0
][
1
]
&&
payment
[
2
])
{
// 银行支付
findIndex
=
_
.
findIndex
(
payment
[
0
][
1
].
children
,
{
value
:
payments
.
alibank
+
'_'
+
payment
[
2
].
bankCode
});
findIndex
=
findIndex
>
0
?
findIndex
:
0
;
payment
[
0
][
1
].
selected
=
true
;
payment
[
0
][
1
].
children
[
findIndex
].
selected
=
true
;
...
...
config/common.js
View file @
8889b5b
...
...
@@ -23,9 +23,14 @@ module.exports = {
cookieDomain
:
'yohoblk.com'
,
domains
:
{
singleApi
:
'http://single.yoho.cn/'
,
api
:
'http://api-test3.yohops.com:9999/'
,
service
:
'http://service-test3.yohops.com:9999/'
,
api
:
'http://api.yoho.yohoops.org/'
,
service
:
'http://service.yoho.yohoops.org/'
,
search
:
'http://search.yohoops.org/yohosearch/'
// singleApi: 'http://single.yoho.cn/',
// api: 'http://api-test3.yohops.com:9999/',
// service: 'http://service-test3.yohops.com:9999/',
// search: 'http://search.yohoops.org/yohosearch/'
},
useOneapm
:
false
,
useCache
:
false
,
...
...
Please
register
or
login
to post a comment