paypal 暂时接收trippest的paypal IPN, 由于tourMaster的插件bug

feature/trippest
lyt 7 years ago
parent 02598df751
commit cde718aa69

@ -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();

Loading…
Cancel
Save