buynow.js 1.37 KB
/**
 * doc: http://git.yoho.cn/yoho-documents/api-interfaces/blob/master/%E8%AE%A2%E5%8D%95/%E7%AB%8B%E5%8D%B3%E8%B4%AD%E4%B9%B0.md
 */
'use strict';

const API = global.yoho.API;
const paymentProcess = require(global.utils + '/payment-process');

exports.payment = options => {
    let queryData = Object.assign({
        method: 'app.Buynow.payment',
    }, options);

    return API.post('', queryData)
        .then(result => {
            // TODO 数据处理
            if (result.code === 200 && result.data) {

            }
            return result;
        });

        // mock
        // .catch()
        // .then(() => {
        //     let mockData = require('./_buynow-mock').payment;

        //     return {
        //         code: 200,
        //         data: paymentProcess.tranformPayment(mockData.data)
        //     };
        // });
};


exports.compute = options => {
    let url = '';
    let queryData = Object.assign({
        method: 'app.Buynow.compute',
    }, options);

    return API.post(url, queryData);

        // mock
        // .catch()
        // .then(() => {
        //     let mockData = require('./_buynow-mock').compute;

        //     return mockData;
        // });
};


exports.submit = options => {
    let url = '';
    let queryData = Object.assign({
        method: 'app.Buynow.submit'
    }, options);

    return API.post(url, queryData);
};