installment.js
2.81 KB
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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
/**
* 分期付款
* @author: wsl<shuiling.wang@yoho.cn>
* @date: 2016/08/01
*/
'use strict';
const api = global.yoho.API;
const logger = global.yoho.logger;
// const camelCase = global.yoho.camelCase;
// 获取分期开通状态
const getStauts = (uid) => {
return api.get('', {
method: 'user.instalment.getStatus',
uid: uid
}).then((result) => {
result = {
alg: 'SALT_MD5',
code: 200,
data: {
status: 2
},
md5: '6d729d4b35f10fc73531210bd7ecff91',
message: 'success'
};
if (result && result.code === 200) {
return result.data.status;
} else {
logger.error('get installment open status return is not 200');
return '';
}
});
};
// 获取用户可用额度信息
const getQueryCreditInfo = (uid) => {
return api.get('', {
method: 'order.queryCreditInfo',
uid: uid
}).then((result) => {
result = {
alg: 'SALT_MD5',
code: 200,
data: {
initCredit: '8000.00',
currCredit: '5000.00',
status: 2
},
md5: 'c1d725306fb09dcbf504776d276521cb',
message: 'ok'
};
if (result && result.code === 200) {
return result.data;
} else {
logger.error('get user installment usable price info return is not 200');
return '';
}
});
};
// 获取用户待还款金额
const getQueryAmtInfo = (uid) => {
return api.get('', {
method: 'order.queryAmtInfo',
uid: uid
}).then((result) => {
result = {
alg: 'SALT_MD5',
code: 200,
data: {
totalAmt: '2000.00',
monthAmt: '800.00',
_7daysAmt: '400.00',
overAmt: '400.00'
},
md5: 'c1d725306fb09dcbf504776d276521cb',
message: 'ok'
};
if (result && result.code === 200) {
result.data.dayAmt = result.data._7daysAmt;
return result.data;
} else {
logger.error('get user installment repay info return is not 200');
return '';
}
});
};
// 分期专享推荐商品
const getSearchIntallment = () => {
return api.get('', {
method: 'app.search.instalment',
limit: '50',
cache: true
}).then((result) => {
if (result && result.code === 200) {
return result.data;
} else {
logger.error('get instalment promote goods return is not 200');
return '';
}
});
};
module.exports = {
getStauts,
getQueryCreditInfo,
getQueryAmtInfo,
getSearchIntallment
sendVerifyCode,
activateService
};