From cc7fc45dbaf55ade8fe05a3d73e8dceb5ed56cb9 Mon Sep 17 00:00:00 2001 From: lyt Date: Tue, 7 May 2019 14:43:15 +0800 Subject: [PATCH] =?UTF-8?q?paypal=20=E9=80=80=E6=AC=BE=E5=A4=84=E7=90=86,?= =?UTF-8?q?=E9=80=9A=E7=9F=A5=E5=AE=A2=E4=BA=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../pay/controllers/AlipayTradeService.php | 1 + .../pay/views/alipay_receipt_mail.php | 2 +- .../third_party/paypal/controllers/index.php | 43 ++++++++++++++----- .../paypal/models/paypal_model.php | 17 ++++++++ webht/third_party/paypal/views/note_list.php | 2 +- 5 files changed, 53 insertions(+), 12 deletions(-) diff --git a/webht/third_party/pay/controllers/AlipayTradeService.php b/webht/third_party/pay/controllers/AlipayTradeService.php index 47db682f..cf9dce05 100644 --- a/webht/third_party/pay/controllers/AlipayTradeService.php +++ b/webht/third_party/pay/controllers/AlipayTradeService.php @@ -549,6 +549,7 @@ class AlipayTradeService extends CI_Controller $this->AlipayTradeQueryContentBuilder->setOutTradeNo($orderId); } $response = $this->Query($this->AlipayTradeQueryContentBuilder); + // return $this->output->set_content_type('application/json')->set_output(json_encode($response)); return $response; } diff --git a/webht/third_party/pay/views/alipay_receipt_mail.php b/webht/third_party/pay/views/alipay_receipt_mail.php index a2590081..76f30880 100644 --- a/webht/third_party/pay/views/alipay_receipt_mail.php +++ b/webht/third_party/pay/views/alipay_receipt_mail.php @@ -1 +1 @@ -
PayPal logo
Transaction ID:
Hello Guilin China International Travel Service Co.,Ltd,
You received a payment of
Thanks for using iPayLinks.You can now ship any items.To see all the transaction details,log in to your iPayLinks account.
It may take a few moments for this transaction to appear in your account.
Seller Protection-
Buyer


Description     Amount

+
PayPal logo
Transaction ID:
Hello Guilin China International Travel Service Co.,Ltd,
You received a payment of
Thanks for using Alipay.You can now ship any items.To see all the transaction details,log in to your Alipay account.
It may take a few moments for this transaction to appear in your account.
Seller Protection-
Buyer


Description     Amount

diff --git a/webht/third_party/paypal/controllers/index.php b/webht/third_party/paypal/controllers/index.php index 1cccf5db..a930c19a 100644 --- a/webht/third_party/paypal/controllers/index.php +++ b/webht/third_party/paypal/controllers/index.php @@ -897,6 +897,7 @@ class Index extends CI_Controller { $parent_txn_id = json_decode($item->pn_memo)->parent_txn_id; $parent_note = $this->Note_model->note($parent_txn_id); if (empty($parent_note)) { + $this->Note_model->update_send($item->pn_txn_id, 'sendfail'); return false; } //订单号 @@ -947,7 +948,7 @@ class Index extends CI_Controller { $this->Paypal_model->add_account_info($GAI_COLI_SN, $advisor_info->COLI_ID, $item->pn_mc_gross, $item->pn_payment_date, mb_strtoupper($item->pn_mc_currency), $ssje, $item->pn_payment_date, $item->pn_payment_date, $item->pn_payment_date, $item->pn_payer, $item->pn_payer_email, $item->pn_txn_id, $ht_memo); } } - //更新还没有填的客邮和交易号de收款记录(传统订单) + //更新还没有填的客邮和交易号的收款记录(传统订单) elseif (isset($advisor_info->order_type) && $advisor_info->order_type == 1) { $ht_memo = '(自动)退款号:' . $item->pn_txn_id . "\n. "; $ht_memo .= '原交易号:' . $parent_txn_id; @@ -958,7 +959,6 @@ 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 @@ -967,9 +967,13 @@ class Index extends CI_Controller { $this->Note_model->update_send($item->pn_txn_id, 'sendfail'); return false; } - // TODO site_code + + $web_code = $advisor_info->COLI_WebCode; $site_info = $this->config->item('site'); - $site_info = $site_info['cht']; + if ( ! isset($site_info[$web_code])) { + $web_code = 'cht'; + } + $site_info = $site_info[$web_code]; $advisor_detail = $this->Paypal_model->get_advisor_detail($advisor_info->OPI_SN, $site_info['site_lgc']); $item->advisor_detail = $advisor_detail; $item->site = $site_info['site_url']; @@ -980,19 +984,38 @@ class Index extends CI_Controller { $toName = !empty($opi_firstname) ? $opi_firstname : ''; $toEmail = !empty($opi_email) ? $opi_email : ''; $subject = $orderid_info->orderid . '_' . $orderid_info->ordertype . ' / ' . $item->pn_mc_gross . $item->pn_mc_currency . ' / ' . $fromName; - $body = $this->load->view('mail_templete', $item, true); //$item->pn_memo; + $body = $this->load->view('mail_templete', $item, true); $M_RelatedInfo = $item->pn_sn; $M_AddTime = $item->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'); - // TODO 通知客人 - $this->load->view('refund_buyer', $item); - + // 通知客人, 客人邮箱 + $customer_detail = $this->Paypal_model->get_customer_detail($advisor_info->COLI_SN, $orderid_info->ordertype); + $c_fromName = $advisor_detail->OPI2_Name; + $c_fromEmail = $advisor_detail->OPI_Email; + $c_toName = $customer_detail->fullname; + $c_toEmail = $customer_detail->email; + $c_subject = $item->pn_mc_currency . " " . str_replace('-', '', $item->pn_mc_gross) . " Refunded to your account, booking number " . $item->pn_invoice; + $c_body = $this->load->view('refund_buyer', $item, true); + $c_M_RelatedInfo = $item->pn_sn; + $c_M_AddTime = $item->pn_payment_date; + $c_M_State = 0; + $this->Paypal_model->save_automail( + $c_fromName, + $c_fromEmail, + $c_toName, + $c_toEmail, + $c_subject, + $c_body, + $c_M_RelatedInfo, + $c_M_State, + $c_M_AddTime, + 'paypal refund receipt'); + $this->Note_model->update_send($item->pn_txn_id, 'send-customer'); // TODO 通知财务, 如果已做账 //添加邮件发送记录 end - - return $this->Note_model->update_send($item->pn_txn_id, 'send'); + return ; } public function trippest_note($orderid_info, $paypal_msg) diff --git a/webht/third_party/paypal/models/paypal_model.php b/webht/third_party/paypal/models/paypal_model.php index 0e2da945..0684017d 100644 --- a/webht/third_party/paypal/models/paypal_model.php +++ b/webht/third_party/paypal/models/paypal_model.php @@ -619,4 +619,21 @@ class Paypal_model extends CI_Model { where OPI_SN=? and LGC_LGC=? "; return $this->HT->query($sql, array($OPI_SN, $lgc))->row(); } + + public function get_customer_detail($COLI_SN, $ordertype) + { + if ($ordertype === 'T') { + $sql = "SELECT mei.MEI_FirstName+' '+isnull(mei.MEI_MiddleName,'')+' '+isnull(mei.MEI_LastName,'') fullname, + mei.MEI_MailList email + FROM MEmberInfo mei + INNER JOIN CUstomerList cul on mei.MEI_SN=cul.CUL_CUI_SN and cul.CUL_IsLinkMan=1 + WHERE CUL_COLI_SN=? "; + return $this->HT->query($sql, $COLI_SN)->row(); + } else { + $sql = "SELECT GUT_FirstName+' '+GUT_LastName fullname,GUT_Email email from BIZ_GUEST g + INNER JOIN BIZ_ConfirmLineInfo coli on coli.COLI_GUT_SN=g.GUT_SN + WHERE COLI_SN=? "; + return $this->HT->query($sql, $COLI_SN)->row(); + } + } } diff --git a/webht/third_party/paypal/views/note_list.php b/webht/third_party/paypal/views/note_list.php index 70dcc979..612750ed 100644 --- a/webht/third_party/paypal/views/note_list.php +++ b/webht/third_party/paypal/views/note_list.php @@ -209,7 +209,7 @@ echo "