paypal Trippest的收款自动录入订单

feature/pay
lyt 7 years ago
parent a06156b1cb
commit a93320bca0

@ -647,7 +647,9 @@ class Index extends CI_Controller {
$ordertype = 'N';
if (isset($note_invoice_string[1])) {
$ordertype_temp = trim($note_invoice_string[1]);
if (substr($ordertype_temp, 0, 1) == 'T') {
if (substr($ordertype_temp, 0, 2) == 'TP') {
$ordertype = 'TP';
} elseif (substr($ordertype_temp, 0, 1) == 'T') {
$ordertype = 'T';
} elseif (substr($ordertype_temp, 0, 1) == 'B') {
$ordertype = 'B';
@ -979,14 +981,21 @@ class Index extends CI_Controller {
public function trippest_note($orderid_info, $paypal_msg)
{
$tp_orderid = "#" . substr($orderid_info->orderid, 10);
$tp_orderid = '';
$real_orderid = $orderid_info->orderid;
if (substr($orderid_info->orderid, 0, 2) == '01') {
$tp_orderid = "#" . substr($orderid_info->orderid, 10);
$real_orderid = '';
}
// 获取HT订单号
$ht_tp_order = $this->Paypal_model->get_trippest_order($tp_orderid);
$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');
}
$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 . '_B');
$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;
$this->Paypal_model->add_account_info(
@ -1004,20 +1013,25 @@ class Index extends CI_Controller {
$paypal_msg->pn_txn_id,
$ht_memo
);
if (false == $this->Paypal_model->if_biz_gai_exists($paypal_msg->pn_txn_id) ) {
$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, '15002');
$opi_firstname = "David";
$opi_email = "david@trippest.com";
$fromName = !empty($paypal_msg->pn_payer) ? $paypal_msg->pn_payer : '';
$fromEmail = !empty($paypal_msg->pn_payer_email) ? $paypal_msg->pn_payer_email : '';
$toName = !empty($opi_firstname) ? $opi_firstname : '';
$toEmail = !empty($opi_email) ? $opi_email : '';
$subject = $real_orderid . $tp_orderid . '_' . $orderid_info->ordertype . ' / ' . $paypal_msg->pn_mc_gross . $paypal_msg->pn_mc_currency . ' / ' . $fromName;
$body = $this->load->view('mail_templete', $paypal_msg, true); //$paypal_msg->pn_memo;
$M_RelatedInfo = $paypal_msg->pn_sn;
$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');
}
$opi_firstname = "David";
$opi_email = "david@trippest.com";
$orderid_info->orderid = $orderid_info->orderid . "#" . $tp_orderid;
$fromName = !empty($paypal_msg->pn_payer) ? $paypal_msg->pn_payer : '';
$fromEmail = !empty($paypal_msg->pn_payer_email) ? $paypal_msg->pn_payer_email : '';
$toName = !empty($opi_firstname) ? $opi_firstname : '';
$toEmail = !empty($opi_email) ? $opi_email : '';
$subject = $orderid_info->orderid . '_' . $orderid_info->ordertype . ' / ' . $paypal_msg->pn_mc_gross . $paypal_msg->pn_mc_currency . ' / ' . $fromName;
$body = $this->load->view('mail_templete', $paypal_msg, true); //$paypal_msg->pn_memo;
$M_RelatedInfo = $paypal_msg->pn_sn;
$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');
$this->Note_model->update_send($paypal_msg->pn_txn_id, 'send');
}

@ -603,10 +603,12 @@ class Paypal_model extends CI_Model {
return $this->HT->insert("BIZ_OrderOperationLog", $db_column);
}
public function get_trippest_order($tp_order)
public function get_trippest_order($tp_order='', $real_orderid='')
{
$sql = "SELECT top 1 * from BIZ_ConfirmLineInfo
WHERE COLI_PriceMemo=? ";
return $this->HT->query($sql, array($tp_order))->row();
WHERE 1=1 ";
$tp_order ? $sql.=" and COLI_PriceMemo=$tp_order " : "";
$real_orderid ? $sql.=" and COLI_ID=$real_orderid " : "";
return $this->HT->query($sql)->row();
}
}

Loading…
Cancel
Save