...
|
...
|
@@ -15,9 +15,13 @@ const _ = require('lodash'); |
|
|
const helpers = global.yoho.helpers;
|
|
|
const FRAUD_CONTENT_CODE = '78d0fb6c97d691863286edcb4d8abfa9';
|
|
|
const payments = {
|
|
|
alipay: 2,
|
|
|
wechat: 21,
|
|
|
alibank: 12
|
|
|
alipay: 2, // 支付宝
|
|
|
wechat: 21, // 微信支付
|
|
|
alibank: 12, // 支付宝支联
|
|
|
unionpayweb: 25, // 银联支付
|
|
|
chinabank: 4, // 网银在线
|
|
|
tenpay: 1, // 财付通
|
|
|
delivery: 3 // 货到付款和0元订单
|
|
|
};
|
|
|
|
|
|
/**
|
...
|
...
|
@@ -246,10 +250,18 @@ const sendPayConfirm = (code, payment, uid) => { |
|
|
* [公共支付成功数据处理]
|
|
|
* @param {[type]} orderInfo [订单信息]
|
|
|
* @param {[type]} fraudData [资源位数据]
|
|
|
* @param {[type]} payId [支付方式ID]
|
|
|
* @return {[type]} [{}]
|
|
|
*/
|
|
|
const _execOrderData = (orderInfo, fraudData) => {
|
|
|
const _execOrderData = (orderInfo, fraudData, payId) => {
|
|
|
let fraud = _.result(_.find(fraudData, {template_name: 'text'}), 'data') || {};
|
|
|
let sknArr = [];
|
|
|
let skuArr = [];
|
|
|
|
|
|
_.each(orderInfo.order_goods, function(el) {
|
|
|
sknArr.push(el.product_skn);
|
|
|
skuArr.push(el.product_sku);
|
|
|
});
|
|
|
|
|
|
return {
|
|
|
paymentTypes: (orderInfo.payment_type === 1 ? '在线支付' : '货到付款'),
|
...
|
...
|
@@ -262,7 +274,20 @@ const _execOrderData = (orderInfo, fraudData) => { |
|
|
orderCode: orderInfo.order_code
|
|
|
}),
|
|
|
packageTitle: orderInfo.package_title || '商品需要品牌商调货',
|
|
|
fraudTip: fraud.text || ''
|
|
|
fraudTip: fraud.text || '',
|
|
|
criteo: {// criteo统计代码有关数据
|
|
|
order_code: orderInfo.order_code,
|
|
|
items: orderInfo.order_goods
|
|
|
},
|
|
|
point: {
|
|
|
order_code: orderInfo.order_code,
|
|
|
payResult: 1, // 1支付成功,2支付失败
|
|
|
amount: orderInfo.payment_amount,
|
|
|
payStyle: payId, // 支付方式id
|
|
|
proSkn: sknArr.join(','),
|
|
|
proSku: skuArr.join(',')
|
|
|
|
|
|
}
|
|
|
};
|
|
|
};
|
|
|
|
...
|
...
|
@@ -271,7 +296,7 @@ const _execOrderData = (orderInfo, fraudData) => { |
|
|
* @param payResult
|
|
|
* @param uid
|
|
|
*/
|
|
|
const procOrderData = (payResult, uid) => {
|
|
|
const procOrderData = (payResult, uid, payId) => {
|
|
|
return co(function *() {
|
|
|
let orderCode = payResult.orderCode;
|
|
|
let result = {code: 400, message: ''};
|
...
|
...
|
@@ -310,7 +335,10 @@ const procOrderData = (payResult, uid) => { |
|
|
code: 200,
|
|
|
message: '支付成功,请等待发货',
|
|
|
data: {
|
|
|
order: Object.assign(orderInfo, _execOrderData(orderInfo, procData[1] && procData[1].data || {}))
|
|
|
order: Object.assign(
|
|
|
orderInfo,
|
|
|
_execOrderData(orderInfo, procData[1] && procData[1].data || {}, payId)
|
|
|
)
|
|
|
}
|
|
|
};
|
|
|
|
...
|
...
|
@@ -321,11 +349,12 @@ const procOrderData = (payResult, uid) => { |
|
|
/**
|
|
|
* [0元订单或者货到付款-成功处理]
|
|
|
* @param {[type]} orderInfo [订单详情]
|
|
|
* @param {[type]} payId [支付方式ID]
|
|
|
* @return {[type]} [{}]
|
|
|
*/
|
|
|
const deliveryData = (orderInfo) => {
|
|
|
const deliveryData = (orderInfo, payId) => {
|
|
|
return payApi.getResourceData(FRAUD_CONTENT_CODE).then(procData => {
|
|
|
return Object.assign(orderInfo, _execOrderData(orderInfo, procData && procData.data || {}));
|
|
|
return Object.assign(orderInfo, _execOrderData(orderInfo, procData && procData.data || {}, payId));
|
|
|
});
|
|
|
};
|
|
|
|
...
|
...
|
|