Authored by 郝肖肖

支付失败埋点

... ... @@ -168,6 +168,9 @@ const callback = (req, res, next) => {
});
} else {
res.render('pay-fail', {
module: 'shopping',
page: 'fail',
point: result.point,
simpleHeader: header,
payName: result.payName
});
... ...
... ... @@ -247,14 +247,13 @@ const sendPayConfirm = (code, payment, uid) => {
};
/**
* [公共支付成功数据处理]
* @param {[type]} orderInfo [订单信息]
* @param {[type]} fraudData [资源位数据]
* @param {[type]} payId [支付方式ID]
* [埋点数据公共处理]
* @param {[type]} orderInfo [订单详情]
* @param {[type]} payId [支付方式id]
* @param {[type]} payResult [支付成功状态]
* @return {[type]} [{}]
*/
const _execOrderData = (orderInfo, fraudData, payId) => {
let fraud = _.result(_.find(fraudData, {template_name: 'text'}), 'data') || {};
const _point = (orderInfo, payId, payResult) => {
let sknArr = [];
let skuArr = [];
... ... @@ -264,6 +263,26 @@ const _execOrderData = (orderInfo, fraudData, payId) => {
});
return {
order_code: orderInfo.order_code,
payResult: payResult, // 1支付成功,2支付失败
amount: orderInfo.payment_amount,
payStyle: payId, // 支付方式id
proSkn: sknArr.join(','),
proSku: skuArr.join(',')
};
};
/**
* [公共支付成功数据处理]
* @param {[type]} orderInfo [订单信息]
* @param {[type]} fraudData [资源位数据]
* @param {[type]} payId [支付方式ID]
* @return {[type]} [{}]
*/
const _execOrderData = (orderInfo, fraudData, payId) => {
let fraud = _.result(_.find(fraudData, {template_name: 'text'}), 'data') || {};
return {
paymentTypes: (orderInfo.payment_type === 1 ? '在线支付' : '货到付款'),
multiPackage: orderInfo.is_multi_package === 'Y',
ordersUrl: helpers.urlFormat('/home/orders'),
... ... @@ -279,15 +298,7 @@ const _execOrderData = (orderInfo, fraudData, payId) => {
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(',')
}
point: _point(orderInfo, payId, 1)
};
};
... ... @@ -316,7 +327,7 @@ const procOrderData = (payResult, uid, payId) => {
if (orderInfo.is_cancel === 'Y') {
logger.warn('front pay success but order is cancel.', {payResult: payResult, order: orderInfo});
return {code: 417, message: '支付成功,但订单已取消,需联系客服!'};
return {code: 417, message: '支付成功,但订单已取消,需联系客服!', point: _point(orderInfo, payId, 2)};
}
if (orderInfo.payment_status === 'N') {
... ... @@ -327,7 +338,8 @@ const procOrderData = (payResult, uid, payId) => {
logger.warn('front pay success but the amount is not same.', {payResult: payResult, order: orderInfo});
return {
code: 415,
message: '支付金额与订单金额不一致,订单状态更新失败!'
message: '支付金额与订单金额不一致,订单状态更新失败!',
point: _point(orderInfo, payId, 2)
};
}
... ...
... ... @@ -32,3 +32,4 @@
</div>
</div>
</div>
{{> pay/point}}
... ...
... ... @@ -10,7 +10,7 @@
<div class="order-info">
<ul>
<li><span class="l-b">订单号: {{order_code}}</span></li>
<li><span class="l-b">{{#if ../isDelivery}}支付{{else}}在线{{/if}}金额: {{payment_amount}}</span></li>
<li><span class="l-b">订单金额: {{payment_amount}}</span></li>
<li>
<span class="l-b back-yoho-coin">共返有货币:{{yoho_give_coin}}</span>
<a href="{{yohoCoinUrl}}" class="notice-link" target="_blank">有货币能做什么>></a>
... ...