installment.js 1.4 KB
/**
 * 分期付款
 * @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) => {
        if (result && result.code === 200) {
           return result.data;
        } 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) => {
        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) => {
        if (result && result.code === 200) {
           return result.data;
        } else {
           logger.error('get user installment repay info return is not 200');
           return '';
        }
    });
}

module.exports = {
    getStauts,
    getQueryCreditInfo
};