paypal 退款:客人邮件模板

feature/pay
lyt 6 years ago
parent d6d761bc4d
commit 2665fcbdb9

@ -362,19 +362,19 @@ $config['proxy_ips'] = '';
$config['site'] = array(
'cht' => array('site_code' => 'cht', 'site_id' => 14, 'site_lgc' => '1', 'site_url' => 'http://www.chinahighlights.com'),
'gm' => array('site_code' => 'gm', 'site_id' => 22, 'site_lgc' => '4', 'site_url' => 'http://www.chinarundreisen.com'),
'vc' => array('site_code' => 'vc', 'site_id' => 30, 'site_lgc' => '5', 'site_url' => 'http://www.voyageschine.com'),
'jp' => array('site_code' => 'jp', 'site_id' => 88, 'site_lgc' => '3', 'site_url' => 'http://www.arachina.com'),
'vac' => array('site_code' => 'vac', 'site_id' => 95, 'site_lgc' => '6', 'site_url' => 'http://www.viaje-a-china.com'),
'it' => array('site_code' => 'it', 'site_id' => 168, 'site_lgc' => '8', 'site_url' => 'http://www.viaggio-in-cina.it'),
'ru' => array('site_code' => 'ru', 'site_id' => 102, 'site_lgc' => '7', 'site_url' => 'http://www.chinahighlights.ru'),
'wt' => array('site_code' => 'wt', 'site_id' => 172, 'site_lgc' => '2', 'site_url' => 'http://www.iiiyooo.com'),
'tbt' => array('site_code' => 'tbt', 'site_id' => 169, 'site_lgc' => '1', 'site_url' => 'http://www.tibettravel.info'),
'sht' => array('site_code' => 'sht', 'site_id' => 96, 'site_lgc' => '1', 'site_url' => 'http://www.shanghaihighlights.com'),
'yz' => array('site_code' => 'yz', 'site_id' => 89, 'site_lgc' => '1', 'site_url' => 'http://www.yangtzeriver.org'),
'gl' => array('site_code' => 'gl', 'site_id' => 90, 'site_lgc' => '1', 'site_url' => 'http://www.guilinchina.net'),
'mbj' => array('site_code' => 'mbj', 'site_id' => 98, 'site_lgc' => '1', 'site_url' => 'http://www.mybeijingchina.com'),
'ct' => array('site_code' => 'ct', 'site_id' => 1000, 'site_lgc' => '104', 'site_url' => 'http://www.chinatravel.com'),
'dct' => array('site_code' => 'dct', 'site_id' => 99, 'site_lgc' => '1', 'site_url' => 'http://www.diychinatours.com')
'cht' => array('site_code' => 'cht', 'site_id' => 14, 'site_lgc' => '1', 'site_url' => 'https://www.chinahighlights.com'),
'gm' => array('site_code' => 'gm', 'site_id' => 22, 'site_lgc' => '4', 'site_url' => 'https://www.chinarundreisen.com'),
'vc' => array('site_code' => 'vc', 'site_id' => 30, 'site_lgc' => '5', 'site_url' => 'https://www.voyageschine.com'),
'jp' => array('site_code' => 'jp', 'site_id' => 88, 'site_lgc' => '3', 'site_url' => 'https://www.arachina.com'),
'vac' => array('site_code' => 'vac', 'site_id' => 95, 'site_lgc' => '6', 'site_url' => 'https://www.viaje-a-china.com'),
'it' => array('site_code' => 'it', 'site_id' => 168, 'site_lgc' => '8', 'site_url' => 'https://www.viaggio-in-cina.it'),
'ru' => array('site_code' => 'ru', 'site_id' => 102, 'site_lgc' => '7', 'site_url' => 'https://www.chinahighlights.ru'),
'wt' => array('site_code' => 'wt', 'site_id' => 172, 'site_lgc' => '2', 'site_url' => 'https://www.iiiyooo.com'),
'tbt' => array('site_code' => 'tbt', 'site_id' => 169, 'site_lgc' => '1', 'site_url' => 'https://www.tibettravel.info'),
'sht' => array('site_code' => 'sht', 'site_id' => 96, 'site_lgc' => '1', 'site_url' => 'https://www.shanghaihighlights.com'),
'yz' => array('site_code' => 'yz', 'site_id' => 89, 'site_lgc' => '1', 'site_url' => 'https://www.yangtzeriver.org'),
'gl' => array('site_code' => 'gl', 'site_id' => 90, 'site_lgc' => '1', 'site_url' => 'https://www.guilinchina.net'),
'mbj' => array('site_code' => 'mbj', 'site_id' => 98, 'site_lgc' => '1', 'site_url' => 'https://www.mybeijingchina.com'),
'ct' => array('site_code' => 'ct', 'site_id' => 1000, 'site_lgc' => '104', 'site_url' => 'https://www.chinatravel.com'),
'dct' => array('site_code' => 'dct', 'site_id' => 99, 'site_lgc' => '1', 'site_url' => 'https://www.diychinatours.com')
);

@ -747,8 +747,10 @@ class Index extends CI_Controller {
}
//退款状态默认为已经处理,陆燕在退款前手动通知外联了,系统跳过处理
if ($item->pn_payment_status == 'Refunded') {
$this->Note_model->update_send($item->pn_txn_id, 'send');
$this->send_refund($item, $handpick, $old_ssje);
continue;
// $this->Note_model->update_send($item->pn_txn_id, 'send');
// continue;
}
//只处理完成状态,其他状态由陆燕处理
@ -892,7 +894,8 @@ class Index extends CI_Controller {
public function send_refund($item, $handpick, $old_ssje=NULL)
{
// 找到原始收款交易的订单
$parent_note = $this->note_modal->note($item->parent_txn_id);
$parent_txn_id = json_decode($item->pn_memo)->parent_txn_id;
$parent_note = $this->Note_model->note($parent_txn_id);
if (empty($parent_note)) {
return false;
}
@ -904,7 +907,7 @@ class Index extends CI_Controller {
$this->Note_model->update_send($item->pn_txn_id, 'sendfail');
return false;
}
$orderid_info = json_decode($orderid_info);
// for trippest tourMaster 2018.05.28
if ($orderid_info->ordertype == 'TP') {
$this->trippest_note($orderid_info, $item);
@ -912,7 +915,6 @@ 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, $handpick);
//查不到订单信息
@ -931,24 +933,24 @@ class Index extends CI_Controller {
$ssje = $old_ssje===NULL ? $ssje : $old_ssje;
//更新还没有填的客邮和交易号de收款记录商务订单
if (isset($advisor_info->order_type) && $advisor_info->order_type == 0) {
$ht_memo = '退款交易号(自动录入):' . $item->pn_txn_id . "\n. ";
$ht_memo .= '原收款交易(自动录入):' . $item->parent_txn_id;
$ht_memo = '(自动录入)退款号:' . $item->pn_txn_id . "\n. ";
$ht_memo .= '原收款号:' . $parent_txn_id;
$GAI_COLI_SN = isset($advisor_info->COLI_SN) ? $advisor_info->COLI_SN : 0;
//CHTAPP订单添加记录前判断是否有记录以前的APP版本没有交易号只能拿金额来判断
if (substr($advisor_info->COLI_WebCode, 0, 6) == 'CHTAPP') {//只判断前6位字符CHTAPP-fr CHTAPP-jp等各语种都属于APP订单
$this->Paypal_model->add_account_info_forAPP($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_email, $item->pn_txn_id, $ht_memo);
$this->Paypal_model->add_account_info_forAPP($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);
$this->Paypal_model->insert_biz_order_log($GAI_COLI_SN, 'Refunded');
} else {
if (false == $this->Paypal_model->if_biz_gai_exists($item->pn_txn_id) ) {
$this->Paypal_model->insert_biz_order_log($GAI_COLI_SN, 'Refunded');
}
$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_email, $item->pn_txn_id, $ht_memo);
$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 .= '原收款交易号(自动录入):' . $item->parent_txn_id;
$ht_memo = '(自动)退款号:' . $item->pn_txn_id . "\n. ";
$ht_memo .= '原交易号:' . $parent_txn_id;
$GAI_COLI_SN = isset($advisor_info->COLI_SN) ? $advisor_info->COLI_SN : 0;
$gai_sn = $this->Paypal_model->add_tour_account_info($GAI_COLI_SN, $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);
//添加汉特的订单提醒
@ -965,7 +967,12 @@ class Index extends CI_Controller {
$this->Note_model->update_send($item->pn_txn_id, 'sendfail');
return false;
}
// TODO site_code
$site_info = $this->config->item('site');
$site_info = $site_info['cht'];
$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'];
//添加邮件发送记录
//给外联发送通知邮件
$fromName = !empty($item->pn_payer) ? $item->pn_payer : '';
@ -979,6 +986,8 @@ class Index extends CI_Controller {
$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);
// TODO 通知财务, 如果已做账
//添加邮件发送记录 end

@ -19,7 +19,7 @@ class Paypal_model extends CI_Model {
$fieldsql = $orderinfo == false ? '' : " ,* ";
//先查商务订单B,APP订单A、再查传统订单T
if ($ordertype == 'B' || $ordertype == 'A') {
$sql = "SELECT TOP 2 0 as order_type,COLI_SN,COLI_ID,OPI_Email,OPI_FirstName,OPI_Name,COLI_WebCode,COLI_Department,COLI_PayManner,COLI_State $fieldsql from BIZ_ConfirmLineInfo
$sql = "SELECT TOP 2 0 as order_type,COLI_SN,COLI_ID,OPI_Email,OPI_FirstName,OPI_SN,OPI_Name,COLI_WebCode,COLI_Department,COLI_PayManner,COLI_State $fieldsql from BIZ_ConfirmLineInfo
LEFT JOIN OperatorInfo ON COLI_OPI_ID=OPI_SN
where COLI_ID =?";
$query = $this->HT->query($sql, array($COLI_ID));
@ -27,7 +27,7 @@ class Paypal_model extends CI_Model {
}
//后查传统订单的原因是因为传统订单的订单号去掉外联名字首字母后可能会和商务订单的重合。
if (empty($result) && ($ordertype == 'T')) {
$sql = "SELECT TOP 2 1 as order_type, COLI_SN,COLI_ID,OPI_Email,OPI_FirstName,OPI_Name,COLI_WebCode,COLI_State $fieldsql from ConfirmLineInfo
$sql = "SELECT TOP 2 1 as order_type, COLI_SN,COLI_ID,OPI_SN,OPI_Email,OPI_FirstName,OPI_Name,COLI_WebCode,COLI_State $fieldsql from ConfirmLineInfo
LEFT JOIN OperatorInfo ON COLI_OPI_ID=OPI_SN
where COLI_ID like '%$COLI_ID'
order by CHARINDEX('$COLI_ID', COLI_ID) ";
@ -41,7 +41,7 @@ class Paypal_model extends CI_Model {
//查传统订单add_code网前实时支付会先生成一个临时订单号存在add_code里如订单45103248
if (empty($result) && ($ordertype == 'M')) {
$sql = "SELECT TOP 2 1 as order_type, COLI_SN,COLI_ID,OPI_Email,OPI_FirstName,OPI_Name,COLI_WebCode $fieldsql from ConfirmLineInfo
$sql = "SELECT TOP 2 1 as order_type, COLI_SN,COLI_ID,OPI_SN,OPI_Email,OPI_FirstName,OPI_Name,COLI_WebCode $fieldsql from ConfirmLineInfo
LEFT JOIN OperatorInfo ON COLI_OPI_ID=OPI_SN
where COLI_AddCode =? ";
$query = $this->HT->query($sql, array($COLI_ID));
@ -49,7 +49,7 @@ class Paypal_model extends CI_Model {
}
if (empty($result) && ($ordertype == 'M')) {
$sql = "SELECT TOP 2 1 as order_type, COLI_SN,COLI_ID,OPI_Email,OPI_FirstName,OPI_Name,COLI_WebCode $fieldsql from ConfirmLineInfo cli
$sql = "SELECT TOP 2 1 as order_type, COLI_SN,COLI_ID,OPI_SN,OPI_Email,OPI_FirstName,OPI_Name,COLI_WebCode $fieldsql from ConfirmLineInfo cli
LEFT JOIN OperatorInfo ON COLI_OPI_ID=OPI_SN
where
EXISTS (
@ -65,7 +65,7 @@ class Paypal_model extends CI_Model {
//订单号查询不到尝试使用团号查询
if (empty($result) && $ordertype == 'B') {
$sql = "SELECT TOP 2 0 as order_type,COLI_SN,COLI_ID,OPI_Email,OPI_FirstName,OPI_Name,COLI_WebCode,COLI_Department,COLI_State $fieldsql from BIZ_ConfirmLineInfo
$sql = "SELECT TOP 2 0 as order_type,COLI_SN,COLI_ID,OPI_SN,OPI_Email,OPI_FirstName,OPI_Name,COLI_WebCode,COLI_Department,COLI_State $fieldsql from BIZ_ConfirmLineInfo
LEFT JOIN OperatorInfo ON COLI_OPI_ID=OPI_SN
where COLI_GroupCode like '%-$COLI_ID%'";
$query = $this->HT->query($sql);
@ -611,4 +611,12 @@ class Paypal_model extends CI_Model {
$real_orderid ? $sql.=" and COLI_ID=$real_orderid " : "";
return $this->HT->query($sql)->row();
}
public function get_advisor_detail($OPI_SN, $lgc=1)
{
$sql = "SELECT OPI_SN,OPI_MoveTelephone,OPI_Telephone,OPI_Email,OPI2_Name,OPI2_FirstName,OPI2_LastName
FROM [Tourmanager].[dbo].[V_Operator_Info]
where OPI_SN=? and LGC_LGC=? ";
return $this->HT->query($sql, array($OPI_SN, $lgc))->row();
}
}

@ -0,0 +1,46 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns=http://www.w3.org/1999/xhtml>
<head><meta http-equiv=Content-Type content="text/html; charset=utf-8"><title>Your Submission Was Successful! - China Highlights</title><style type=text/css>* { margin:0; font-family: Verdana, Arial, Helvetica, sans-serif; }body { font-family: Verdana, Arial, Helvetica, sans-serif; font-size:13px; color:#545454; right: auto; }img, ul, ul li { padding:0; margin:0; border:0; }#warp { border-top:8px solid #a31022!important; }#logo { border: none!important}#logo, #surveyContent { width:210mm; margin:5px auto; padding:5px; }h1 { margin:15px 0 10px 0; font-size:24px; border-bottom:1px solid #d9d9d9; color:#545454; }h2 { margin:15px 0 10px 0; font-size:20px; color:#545454; }.tableSurvey table td { padding:5px; }.tableSurvey table td strong { margin-top:8px; }.tableSurvey1 { border:1px solid #e1e1e1; }.tableSurvey1 th { border:1px solid #fff; height:30px; padding-right:10px; text-align:right; background:#f1f1f1; }.tableSurvey1 td { border:1px solid #f9f9f9; padding:5px; text-align:center; width:80px; }.tableSurvey2 { border:1px solid #e1e1e1; }.tableSurvey2 th { border:1px solid #fff; padding:5px 10px; text-align:right; background:#f1f1f1; font-weight:normal; }.tableSurvey2 td { border:1px solid #f9f9f9; padding:5px; text-align:center; width:80px; }.blue{ color:#0070C0}
.text-bold {font-weight: bold;}
.text-right{text-align: right;}
.title-bold{font-weight: bold;background-color: #ddd;padding: 3px 0;}
</style></head>
<body>
<div id=warp>
<div id=surveyContent>
<?php $raw = json_decode($pn_memo); $c_gross = str_replace("-", "", $pn_mc_gross); ?>
<p>Dear <?php echo $pn_payer ?>,</p>
<br>
<p>China Highlights has refunded to your account today - <?php echo $c_gross ?><?php echo $pn_mc_currency ?>. The transaction to appear on your account may take up to 2-weeks.</p>
<br>
<p>Please find below details of your refund transaction:</p>
<br>
<p class="title-bold">Transaction details</p>
<p ><?php echo $raw->payment_date ?></p>
<p >Payment status: <?php echo $pn_payment_status ?></p>
<br>
<p class="title-bold">Payment details</p>
<p>Gross amount</p>
<p class="text-right"><?php echo $pn_mc_gross ?> <?php echo $pn_mc_currency ?></p>
<br>
<p class="title-bold">Invoice ID</p>
<p><?php echo $pn_invoice ?></p>
<br>
<p class="title-bold">Contact information</p>
<p ><?php echo $pn_payer ?></p>
<p ><?php echo $pn_payer_email ?></p>
<br>
<br>
<pre style="font-family: Verdana, Arial, Helvetica, sans-serif;font-size:13px;">
Best Regards!
<?php echo $advisor_detail->OPI2_Name ?>, Travel Advisor<br>
Tel: +86-773-<?php echo $advisor_detail->OPI_Telephone ?> Mobile: +86-<?php echo $advisor_detail->OPI_MoveTelephone ?><br>
E-mail: <?php echo $advisor_detail->OPI_Email ?><br>
<?php echo $site; ?><br>
Address: Building 6, Chuangyi Business Park, 70 Qilidian Road, Guilin, Guangxi, 541004, China
</pre>
</div>
</div>
</body>
</html>
Loading…
Cancel
Save