From cde718aa69907befb05fb6de70c325ff1164d7b7 Mon Sep 17 00:00:00 2001 From: lyt Date: Mon, 28 May 2018 14:37:01 +0800 Subject: [PATCH] =?UTF-8?q?paypal=20=E6=9A=82=E6=97=B6=E6=8E=A5=E6=94=B6tr?= =?UTF-8?q?ippest=E7=9A=84paypal=20IPN,=20=E7=94=B1=E4=BA=8EtourMaster?= =?UTF-8?q?=E7=9A=84=E6=8F=92=E4=BB=B6bug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../third_party/paypal/controllers/index.php | 33 ++++++++++++++++++- 1 file changed, 32 insertions(+), 1 deletion(-) diff --git a/webht/third_party/paypal/controllers/index.php b/webht/third_party/paypal/controllers/index.php index 7d1f3d8b..c4365398 100644 --- a/webht/third_party/paypal/controllers/index.php +++ b/webht/third_party/paypal/controllers/index.php @@ -633,6 +633,10 @@ class Index extends CI_Controller { $ordertype = 'B'; } } + // 2018.05.28 for Trippest, tourMaster的订单号是01开头 + if (substr($note_invoice_string[0], 0, 2) == '01') { + $ordertype = 'TP'; + } //手机订单、机票订单都没有加标示,在这里帮加上,暂时的,今后还是要在网前设置好 if ($ordertype == 'N' && isset($note_invoice_string[0])) { @@ -759,6 +763,12 @@ class Index extends CI_Controller { $orderid_info = json_decode($orderid_info); $advisor_info = $this->Paypal_model->get_order($orderid_info->orderid, false, $orderid_info->ordertype); + // for trippest tourMaster 2018.05.28 + if ($orderid_info->ordertype == 'TP') { + $this->trippest_note($orderid_info, $item); + continue; + } + //查不到订单信息 if (empty($advisor_info)) { $this->Note_model->update_send($item->pn_txn_id, 'sendfail'); @@ -809,12 +819,14 @@ class Index extends CI_Controller { $opi_email = !empty($advisor_info->OPI_Email) ? $advisor_info->OPI_Email : ''; //lussie@chinahighlights.net $opi_firstname = !empty($advisor_info->OPI_FirstName) ? $advisor_info->OPI_FirstName : !empty($advisor_info->OPI_Name) ? $advisor_info->OPI_Name : ''; //lussie + //没有外联信息表示订单未分配 if (empty($opi_email) || empty($opi_firstname)) { $this->Note_model->update_send($item->pn_txn_id, 'sendfail'); continue; } + //添加邮件发送记录 //给外联发送通知邮件 $fromName = !empty($item->pn_payer) ? $item->pn_payer : ''; @@ -825,7 +837,7 @@ class Index extends CI_Controller { $body = $this->load->view('mail_templete', $item, true); //$item->pn_memo; $M_RelatedInfo = $item->pn_sn; $M_AddTime = $item->pn_payment_date; - $M_State = 0; //设置已经发送,测试专用 + $M_State = 0; $this->Paypal_model->save_automail($fromName, $fromEmail, $toName, $toEmail, $subject, $body, $M_RelatedInfo, $M_State, $M_AddTime, 'paypal note'); //添加邮件发送记录 end @@ -834,6 +846,25 @@ class Index extends CI_Controller { //echo 'done!'; } + public function trippest_note($orderid_info, $paypal_msg) + { + $opi_firstname = "David"; + $opi_email = "david@trippest.com"; + $orderid_info->orderid = $orderid_info->orderid . "#" . substr($orderid_info->orderid, 10); + + $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'); + } + //所有记录列表 public function note_list() { $data = array();