paypal Trippest站的收款在未找到订单时先邮件通知,以防止新订单邮件漏单

feature/pay
lyt 6 years ago
parent 40a8c2e2f2
commit 52839d2b9a

@ -981,6 +981,7 @@ class Index extends CI_Controller {
public function trippest_note($orderid_info, $paypal_msg)
{
$send_type = '';
$tp_orderid = '';
$real_orderid = $orderid_info->orderid;
if (substr($orderid_info->orderid, 0, 2) == '01') {
@ -990,19 +991,27 @@ class Index extends CI_Controller {
// 获取HT订单号
$ht_tp_order = $this->Paypal_model->get_trippest_order($tp_orderid, $real_orderid);
if (empty($ht_tp_order)) {
return $this->Note_model->update_send($paypal_msg->pn_txn_id, 'sendfail');
}
/**
* 此处不直接退出是为了:在(邮件订单不能自动录入/未收到新订单邮件)时也能通知外联已收款,防止漏单
* 本方法内-以下的非空判断同理: !empty($ht_tp_order)
* * 未找到订单先邮件通知: pn_send='', 继续排队等待录入. 直到匹配订单变更为send
*/
// return $this->Note_model->update_send($paypal_msg->pn_txn_id, 'sendfail');
} else {
$tp_orderid = $ht_tp_order->COLI_PriceMemo;
$real_orderid = $ht_tp_order->COLI_ID;
//更新正确的订单信息到记录中,以这个为主
$this->Note_model->set_invoice($paypal_msg->pn_txn_id, $ht_tp_order->COLI_ID . '_TP');
}
$ssje = $this->Paypal_model->get_ssje($paypal_msg->pn_mc_gross, '15002', mb_strtoupper($paypal_msg->pn_mc_currency));
$ht_memo = '交易号(自动录入):' . $paypal_msg->pn_txn_id;
if (false == $this->Paypal_model->if_biz_gai_exists($paypal_msg->pn_txn_id) ) {
if ( ! empty($ht_tp_order)) {
$this->Paypal_model->update_biz_coli_state($ht_tp_order->COLI_SN, 13);
$this->Paypal_model->insert_biz_order_log($ht_tp_order->COLI_SN, 'BS13');
$this->Paypal_model->update_paymanner($ht_tp_order->COLI_SN, '15010');
}
if (trim($paypal_msg->pn_send)!='' && trim($paypal_msg->pn_send)!='send') {
$opi_firstname = "David";
$opi_email = "david@trippest.com";
$fromName = !empty($paypal_msg->pn_payer) ? $paypal_msg->pn_payer : '';
@ -1015,7 +1024,10 @@ class Index extends CI_Controller {
$M_AddTime = $paypal_msg->pn_payment_date;
$M_State = 0;
$this->Paypal_model->save_automail($fromName, $fromEmail, $toName, $toEmail, $subject, $body, $M_RelatedInfo, $M_State, $M_AddTime, 'paypal note');
empty($ht_tp_order) ? $send_type = "" : false ; // 未录订单先通知收款, 置为空继续排队
}
}
if ( ! empty($ht_tp_order)) {
$this->Paypal_model->add_account_info(
$ht_tp_order->COLI_SN,
$ht_tp_order->COLI_ID,
@ -1031,8 +1043,10 @@ class Index extends CI_Controller {
$paypal_msg->pn_txn_id,
$ht_memo
);
$send_type = "send";
}
$this->Note_model->update_send($paypal_msg->pn_txn_id, 'send');
$this->Note_model->update_send($paypal_msg->pn_txn_id, $send_type);
}
//所有记录列表

Loading…
Cancel
Save