wechat.js
952 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
/**
*
* @author: jiangfeng<jeff.jiang@yoho.cn>
* @date: 16/9/8
*/
'use strict';
const ServiceAPI = global.yoho.ServiceAPI;
const helpers = global.yoho.helpers;
const Wechat = {
pay(user, order, info) {
return ServiceAPI.get('payment/weixin_data', {
order_code: order.orderCode,
payment_code: info.id,
app_key: 'blkpc'
}).then(result => {
if (result && result.code === 200 && result.data) {
let url = `/shopping/pay/online/weixin?url=${result.data.codeUrl}&code=${order.orderCode}`;
return {
code: 200,
data: {
href: helpers.urlFormat(url)
}
};
} else {
return {
code: 400,
message: result.message
};
}
});
}
};
module.exports = Wechat;