...
|
...
|
@@ -7,7 +7,7 @@ |
|
|
'use strict';
|
|
|
|
|
|
|
|
|
const api = require('./pay-api');
|
|
|
const payApi = require('./pay-api');
|
|
|
const Promise = require('bluebird');
|
|
|
const co = Promise.coroutine;
|
|
|
const camelCase = global.yoho.camelCase;
|
...
|
...
|
@@ -29,7 +29,7 @@ const payments = { |
|
|
* @returns {*|Promise.<TResult>}
|
|
|
*/
|
|
|
const getOnlinePayProvider = () => {
|
|
|
return api.getPayProvider().then(result => {
|
|
|
return payApi.getPayProvider().then(result => {
|
|
|
let payPattern = [], nav = [];
|
|
|
|
|
|
if (!(result.code && result.code === 200)) {
|
...
|
...
|
@@ -95,7 +95,7 @@ const getOrderInfo = (uid, code) => { |
|
|
*/
|
|
|
const getBankByOrder = (id) => {
|
|
|
return co(function *() {
|
|
|
let data = yield api.getBankByOrder(id);
|
|
|
let data = yield payApi.getBankByOrder(id);
|
|
|
|
|
|
if (data && data.code === 200 && data.data) {
|
|
|
return camelCase(data.data);
|
...
|
...
|
@@ -141,7 +141,7 @@ const getPayInfo = (uid, code) => { |
|
|
*/
|
|
|
const getPaymentInfo = (id) => {
|
|
|
return co(function *() {
|
|
|
let data = yield api.getPaymentInfo(id);
|
|
|
let data = yield payApi.getPaymentInfo(id);
|
|
|
|
|
|
if (data && data.code === 200 && data.data) {
|
|
|
return camelCase(data.data);
|
...
|
...
|
@@ -158,7 +158,7 @@ const getPaymentInfo = (id) => { |
|
|
*/
|
|
|
const setOrderPayBank = (code, payment, bankCode) => {
|
|
|
return co(function *() {
|
|
|
let data = yield api.setOrderPayBank(code, payment, bankCode);
|
|
|
let data = yield payApi.setOrderPayBank(code, payment, bankCode);
|
|
|
|
|
|
return data;
|
|
|
})();
|
...
|
...
|
@@ -172,28 +172,13 @@ const setOrderPayBank = (code, payment, bankCode) => { |
|
|
*/
|
|
|
const updateOrderPayBank = (code, payment, bankCode) => {
|
|
|
return co(function *() {
|
|
|
let data = yield api.updateOrderPayBank(code, payment, bankCode);
|
|
|
let data = yield payApi.updateOrderPayBank(code, payment, bankCode);
|
|
|
|
|
|
return data;
|
|
|
})();
|
|
|
};
|
|
|
|
|
|
/**
|
|
|
* 选择支付,校验时间间隔,插入数据
|
|
|
* @param code
|
|
|
* @param payment
|
|
|
* @param uid
|
|
|
*/
|
|
|
const savePrePayInfo = (code, payment, uid) => {
|
|
|
return co(function *() {
|
|
|
let data = yield api.savePrePayInfo(code, payment, uid);
|
|
|
|
|
|
return data;
|
|
|
})();
|
|
|
};
|
|
|
|
|
|
|
|
|
/**
|
|
|
* 支付确认
|
|
|
* @param code
|
|
|
* @param payment
|
...
|
...
|
@@ -201,7 +186,7 @@ const savePrePayInfo = (code, payment, uid) => { |
|
|
*/
|
|
|
const sendPayConfirm = (code, payment, uid) => {
|
|
|
return co(function *() {
|
|
|
let data = yield api.sendPayConfirm(code, payment, uid);
|
|
|
let data = yield payApi.sendPayConfirm(code, payment, uid);
|
|
|
|
|
|
return data;
|
|
|
})();
|
...
|
...
|
@@ -230,7 +215,7 @@ const procOrderData = (payResult, uid) => { |
|
|
if (order.is_cancel === 'Y') {
|
|
|
logger.warn('front pay success but order is cancel.', {payResult: payResult, order: order});
|
|
|
|
|
|
api.sendMessage(order.mobile, 'error_sms', '支付成功,但订单已取消,订单号为' + orderCode);
|
|
|
payApi.sendMessage(order.mobile, 'error_sms', '支付成功,但订单已取消,订单号为' + orderCode);
|
|
|
return {code: 417, message: '支付成功,但订单已取消,需联系客服!'};
|
|
|
}
|
|
|
|
...
|
...
|
@@ -271,7 +256,6 @@ module.exports = { |
|
|
updateOrderPayBank,
|
|
|
sendPayConfirm,
|
|
|
procOrderData,
|
|
|
savePrePayInfo,
|
|
|
payments
|
|
|
};
|
|
|
|
...
|
...
|
|