@ -67,6 +73,17 @@ class Note_model extends CI_Model {
return $this->get_list();
}
public function notewebhooks($topnum = 2, $api = false) {
$this->init();
$this->topnum = $topnum;
$sql = " AND (SUBSTRING(pn_memo, 8, 3) ='WH-' ) ";
$this->pn_send = $sql;
// $this->orderby=" ORDER BY pn_payment_date DESC, pn.pn_sn ASC ";
$api_order = $api === false ? "" : " WHEN 'send-wh' THEN 2 ";
$this->orderby=" ORDER BY CASE pn.pn_send WHEN 'sendfail' THEN 1 $api_order ELSE 99 END ,pn.pn_sn DESC ";
return $this->get_list();
}
public function noteaccount($topnum = 2, $account = '') {
$this->init();
$this->topnum = $topnum;
@ -78,10 +95,14 @@ class Note_model extends CI_Model {
public function search_date($date) {
$this->init();
$search_sql = " AND (pn.pn_datetime BETWEEN '$date 00:00:00' AND '$date 23:59:59' OR isnull(pn_send,'') in ('sendfail','unsend','')) AND pn_memo NOT LIKE '{\"id\":\"WH-%' "; // {"id":"WH-
$search_sql = " AND (pn.pn_datetime BETWEEN '$date 00:00:00' AND '$date 23:59:59' OR isnull(pn_send,'') in ('sendfail','unsend','')) AND pn_send NOT LIKE 'send-wh%' "; // {"id":"WH-
// AND pn_memo NOT LIKE '{\"id\":\"WH-%'
$this->search = $search_sql;
// $this->orderby=" ORDER BY CASE pn.pn_send WHEN 'sendfail' THEN 1 ELSE 2 END ,pn.pn_sn DESC ";
$this->orderby=" ORDER BY CASE WHEN pn.pn_send='sendfail' AND pn.pn_payment_status='Completed' THEN 1 WHEN pn.pn_send = 'sendfail' THEN 2 ELSE 9 END ,pn.pn_sn DESC ";
$this->orderby=" ORDER BY CASE WHEN pn.pn_send='sendfail' AND pn.pn_payment_status COLLATE SQL_Latin1_General_CP1_CI_AS = 'Completed' THEN 1
WHEN pn.pn_payment_status = 'DECLINED'
THEN 99
WHEN pn.pn_send = 'sendfail' THEN 2 ELSE 9 END, pn.pn_payment_date DESC ,pn.pn_sn DESC ";
// WHEN pn.pn_send = 'sendfail' THEN 2
return $this->get_list();
@ -95,6 +116,21 @@ class Note_model extends CI_Model {
$this->orderby=" ORDER BY pn_payment_date, pn_payer desc ";
return $this->get_list();
}
public function note_completed($pn_txn_id){
$this->init();
$this->topnum=1;
$this->pn_txn_id=" AND pn_payment_status='Completed' AND pn.pn_txn_id=".$this->HT->escape($pn_txn_id);
$this->orderby=" ORDER BY pn_payment_date, pn_payer desc ";
return $this->get_list();
}
public function search_note($pn_txn_id){
$this->init();
$this->topnum=10;
$this->pn_txn_id=" AND pn.pn_txn_id=".$this->HT->escape($pn_txn_id);
$this->orderby=" ORDER BY pn_payer desc ";
return $this->get_list();
}
public function search_key($search_key) {
$this->init();
@ -103,43 +139,47 @@ class Note_model extends CI_Model {
$search_key = trim($search_key);
if (!empty($search_key)) {
$search_sql.=" AND ( pn.pn_txn_id = '$search_key'
OR pn_reference_id = '$search_key'
OR pn.pn_invoice like '%$search_key%'
OR pn.pn_custom like '%$search_key%'
OR pn.pn_item_name like '%$search_key%'
OR pn.pn_item_number like '%$search_key%'
OR pn.pn_payer like '%$search_key%'
OR pn.pn_payer_email like '%$search_key%' )";
OR pn.pn_payer_email like '%$search_key%'
-- OR SUBSTRING(pn_memo, CHARINDEX('parent_txn_id\"', pn_memo) + 16, 17) = '$search_key'
) ";
}
$this->search = $search_sql;
return $this->get_list();
}
//存储paypal的实时通知
public function save_paypal_note($pn_txn_id, $pn_invoice, $pn_custom, $pn_mc_gross, $pn_item_name, $pn_item_number, $pn_mc_currency, $pn_payment_status, $pn_payer, $pn_payer_email, $pn_payment_date, $pn_memo) {
public function save_paypal_note($pn_txn_id, $pn_invoice, $pn_custom, $pn_mc_gross, $pn_mc_fee, $pn_item_name, $pn_item_number, $pn_mc_currency, $pn_payment_status, $pn_payer, $pn_payer_email, $pn_payment_date, $pn_memo, $pn_receiver_account=null, $pn_reference_id=null) {
<divstyle="margin-top: 10px;color:#333 !important;font-family: arial,helvetica,sans-serif;font-size:12px;"><spanstyle="color:#333333 !important;font-weight:bold;font-family: arial,helvetica,sans-serif;">Hello Guilin China International Travel Service Co., Ltd,</span>
<divstyle="margin-top: 10px;color:#333 !important;font-family: arial,helvetica,sans-serif;font-size:12px;"><spanstyle="color:#333333 !important;font-weight:bold;font-family: arial,helvetica,sans-serif;">Hello China Highlights International Travel Service Co., Ltd,</span>
<br>
<spanstyle="font-size:14px;color:#C88039;font-weight:bold;text-decoration:none;">You received a payment of <?phpecho$mailinfo->pm_money.' '.$mailinfo->pm_currency;?> from <?phpecho$mailinfo->pm_payer;?></span><spanstyle="font-size:14px;color:#C88039;font-weight:bold;text-decoration:none;"> (<?phpecho$mailinfo->pm_payer_email;?>)</span><br>
<?php$jsondata=json_decode($pn_memo);?><html><head><metahttp-equiv="Content-Type"content="text/html; charset=utf-8"/></head><bodystyle="font-size: 12px;font-family: arial,helvetica,sans-serif;margin-top:0;margin-bottom:0;"><divclass="ppmail"><tablealign="center"border="0"cellpadding="0"cellspacing="0"width="100%"><tbody><trvalign="top"><tdwidth="100%"><tablealign="center"border="0"cellpadding="0"cellspacing="0"style="color:#333333 !important;font-family: arial,helvetica,sans-serif;font-size:12px;"width="100%"><tbody><trvalign="top"><td><imgsrc="http://www.mycht.cn/css/images/paypal_logo.gif"border="0"alt="PayPal logo"></td><tdvalign="middle"align="right"><?phpecho$pn_payment_date;?><br>Transaction ID:<atarget="new"href="https://www.paypal.com/c2/cgi-bin/webscr?cmd=_view-a-trans&id=<?phpecho$pn_txn_id;?>"><?phpecho$pn_txn_id;?></a></td></tr></tbody></table><divstyle="margin-top: 10px;color:#333 !important;font-family: arial,helvetica,sans-serif;font-size:12px;"><spanstyle="color:#333333 !important;font-weight:bold;font-family: arial,helvetica,sans-serif;">Hello China Highlights International Travel Service Co.,Ltd,</span><br><spanstyle="font-size:14px;color:#C88039;font-weight:bold;text-decoration:none;">You received a payment of <?phpecho$pn_mc_gross;?><?phpecho$pn_mc_currency;?> from <?phpecho$pn_payer;?></span><spanstyle="font-size:14px;color:#C88039;font-weight:bold;text-decoration:none;">( <?phpecho$pn_payer_email;?> )</span><br><tablecellpadding="5"style="color:#333333 !important;font-family: arial,helvetica,sans-serif;font-size:12px;"><tbody><tr><tdvalign="top">Thanks for using PayPal.You can now ship any items.To see all the transaction details,log in to your PayPal account.<br>It may take a few moments for this transaction to appear in your account.<br><spanstyle="font-weight:bold;color:#333333;">Seller Protection-</span><spanstyle="color: #4c8f3a;"></span></td><td></td></tr></tbody></table><divstyle="margin-top:0px;border-bottom:1px solid #aaaaaa;"></div><tableborder="0"cellpadding="0"cellspacing="0"style="color:#333 !important;font-family: arial,helvetica,sans-serif;font-size:12px; margin-bottom:5px;"width="98%"align="left"><tbody><tr><tdstyle="padding-top:5px;"valign="top"width="50%"align="left"><spanstyle="color:#333333;font-weight:bold;">Buyer</span><br><?phpecho$pn_payer;?><br><?phpecho$pn_payer_email;?><br><?phpecho!empty($jsondata->payer_status)?$jsondata->payer_status:false;?></td><tdstyle="padding-top:5px;"valign="top"><spanstyle="color:#333333;font-weight:bold;display:none;">Instructions to merchant<br></span><spanstyle="color:#333333;font-weight:bold;">Shipping Address:</span><br><spanstyle="font-size:12px;"><?phpecho!empty($jsondata->address_name)?$jsondata->address_name:false;?><br><?phpecho!empty($jsondata->address_street)?$jsondata->address_street:false;?><br><?phpecho!empty($jsondata->address_city)?$jsondata->address_city:false;?><br><?phpecho!empty($jsondata->address_zip)?$jsondata->address_zip:false;?><br><?phpecho!empty($jsondata->address_country)?$jsondata->address_country:false;?></span></td></tr></tbody></table><tablealign="center"border="0"cellpadding="0"cellspacing="0"style="clear:both;color:#333 !important;font-family: arial,helvetica,sans-serif;font-size:12px;margin-top:5px;"width="100%"><tbody><tr><tdstyle="border:1px solid #ccc;border-right:none;border-left:none;padding:5px 10px 5px 10px !important;color: #333333 !important;"width="330"align="left">Description</td><tdstyle="border:1px solid #ccc;border-right:none;border-left:none;padding:5px 10px 5px 10px !important;color: #333333 !important;"width="75"align="right"> </td><tdstyle="border:1px solid #ccc;border-right:none;border-left:none;padding:5px 10px 5px 10px !important;color: #333333 !important;"width="75"align="right"> </td><tdstyle="border:1px solid #ccc;border-right:none;border-left:none;padding:5px 10px 5px 10px !important;color: #333333 !important;"width="80"align="right">Amount</td></tr><tr><tdstyle="padding:10px;"width="330"align="left"><?phpecho$pn_invoice;?><br><?phpecho$pn_custom;?><br><?phpecho$pn_item_name;?><br><?phpecho$pn_item_number;?><br></td><tdstyle="padding:10px;"width="75"align="right"></td><tdstyle="padding:10px;"width="75"align="right"></td><tdstyle="padding:10px;"width="80"align="right"><?phpecho$pn_mc_gross;?><?phpecho$pn_mc_currency;?></td></tr></tbody></table></tr></tbody></table></div></body></html>
<?php$jsondata=json_decode($pn_memo);?><html><head><metahttp-equiv="Content-Type"content="text/html; charset=utf-8"/></head><bodystyle="font-size: 12px;font-family: arial,helvetica,sans-serif;margin-top:0;margin-bottom:0;"><divclass="ppmail"><tablealign="center"border="0"cellpadding="0"cellspacing="0"width="100%"><tbody><trvalign="top"><tdwidth="100%"><tablealign="center"border="0"cellpadding="0"cellspacing="0"style="color:#333333 !important;font-family: arial,helvetica,sans-serif;font-size:12px;"width="100%"><tbody><trvalign="top"><td><imgsrc="http://www.mycht.cn/css/images/paypalLogo-2.png"border="0"alt="PayPal logo"></td><tdvalign="middle"align="right"><?phpecho$pn_payment_date;?><br>Transaction ID:<atarget="new"href="https://www.paypal.com/c2/cgi-bin/webscr?cmd=_view-a-trans&id=<?phpecho$pn_txn_id;?>"><?phpecho$pn_txn_id;?></a></td></tr></tbody></table><divstyle="margin-top: 10px;color:#333 !important;font-family: arial,helvetica,sans-serif;font-size:12px;"><spanstyle="color:#333333 !important;font-weight:bold;font-family: arial,helvetica,sans-serif;">Hello China Highlights International Travel Service Co.,Ltd,</span><br><spanstyle="font-size:14px;color:#C88039;font-weight:bold;text-decoration:none;">You received a payment of <?phpecho$pn_mc_gross;?><?phpecho$pn_mc_currency;?> from <?phpecho$pn_payer;?></span><spanstyle="font-size:14px;color:#C88039;font-weight:bold;text-decoration:none;">( <?phpecho$pn_payer_email;?> )</span><br><tablecellpadding="5"style="color:#333333 !important;font-family: arial,helvetica,sans-serif;font-size:12px;"><tbody><tr><tdvalign="top">Thanks for using PayPal.You can now ship any items.To see all the transaction details,log in to your PayPal account.<br>It may take a few moments for this transaction to appear in your account.<br><spanstyle="font-weight:bold;color:#333333;">Seller Protection-</span><spanstyle="color: #4c8f3a;"></span></td><td></td></tr></tbody></table><divstyle="margin-top:0px;border-bottom:1px solid #aaaaaa;"></div><tableborder="0"cellpadding="0"cellspacing="0"style="color:#333 !important;font-family: arial,helvetica,sans-serif;font-size:12px; margin-bottom:5px;"width="98%"align="left"><tbody><tr><tdstyle="padding-top:5px;"valign="top"width="50%"align="left"><spanstyle="color:#333333;font-weight:bold;">Buyer</span><br><?phpecho$pn_payer;?><br><?phpecho$pn_payer_email;?><br><?phpecho!empty($jsondata->payer_status)?$jsondata->payer_status:false;?></td><tdstyle="padding-top:5px;"valign="top"><spanstyle="color:#333333;font-weight:bold;display:none;">Instructions to merchant<br></span><spanstyle="color:#333333;font-weight:bold;">Shipping Address:</span><br><spanstyle="font-size:12px;"><?phpecho!empty($jsondata->address_name)?$jsondata->address_name:false;?><br><?phpecho!empty($jsondata->address_street)?$jsondata->address_street:false;?><br><?phpecho!empty($jsondata->address_city)?$jsondata->address_city:false;?><br><?phpecho!empty($jsondata->address_zip)?$jsondata->address_zip:false;?><br><?phpecho!empty($jsondata->address_country)?$jsondata->address_country:false;?></span></td></tr></tbody></table><tablealign="center"border="0"cellpadding="0"cellspacing="0"style="clear:both;color:#333 !important;font-family: arial,helvetica,sans-serif;font-size:12px;margin-top:5px;"width="100%"><tbody><tr><tdstyle="border:1px solid #ccc;border-right:none;border-left:none;padding:5px 10px 5px 10px !important;color: #333333 !important;"width="330"align="left">Description</td><tdstyle="border:1px solid #ccc;border-right:none;border-left:none;padding:5px 10px 5px 10px !important;color: #333333 !important;"width="75"align="right"> </td><tdstyle="border:1px solid #ccc;border-right:none;border-left:none;padding:5px 10px 5px 10px !important;color: #333333 !important;"width="75"align="right"> </td><tdstyle="border:1px solid #ccc;border-right:none;border-left:none;padding:5px 10px 5px 10px !important;color: #333333 !important;"width="80"align="right">Amount</td></tr><tr><tdstyle="padding:10px;"width="330"align="left"><?phpecho$pn_invoice;?><br><?phpecho$pn_custom;?><br><?phpecho$pn_item_name;?><br><?phpecho$pn_item_number;?><br></td><tdstyle="padding:10px;"width="75"align="right"></td><tdstyle="padding:10px;"width="75"align="right"></td><tdstyle="padding:10px;"width="80"align="right"><?phpecho$pn_mc_gross;?><?phpecho$pn_mc_currency;?></td></tr></tbody></table></tr></tbody></table></div></body></html>
<divstyle="margin-top: 30px;color:#333 !important;font-family: arial,helvetica,sans-serif;font-size:12px;"><spanstyle="color:#333333 !important;font-weight:bold;font-family: arial,helvetica,sans-serif;">Hello Guilin China International Travel Service Co., Ltd,</span><br>
<divstyle="margin-top: 30px;color:#333 !important;font-family: arial,helvetica,sans-serif;font-size:12px;"><spanstyle="color:#333333 !important;font-weight:bold;font-family: arial,helvetica,sans-serif;">Hello China Highlights International Travel Service Co., Ltd,</span><br>
<br>
<spanstyle="font-size:14px;color:#C88039;font-weight:bold;text-decoration:none;">You received a payment of <?phpecho$mailinfo->pm_money.' '.$mailinfo->pm_currency;?> from <?phpecho$mailinfo->pm_payer;?></span><spanstyle="font-size:14px;color:#C88039;font-weight:bold;text-decoration:none;"> (<?phpecho$mailinfo->pm_payer_email;?>)</span><br>
<imgsrc="http://www.mycht.cn/css/images/icon_help_16x16.gif"border="0"style="margin-right: 5px;vertical-align: middle;"alt="">Questions? Go to the Help Center at: www.paypal.com/c2/help.<br>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<htmlxmlns=http://www.w3.org/1999/xhtml><head><metahttp-equiv=Content-Typecontent="text/html; charset=utf-8"><title>Your Submission Was Successful! - China Highlights</title><styletype=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,ulli{padding:0;margin:0;border:0;}#warp{border-top:8pxsolid#a31022!important;}#logo{border:none!important}#logo,#surveyContent{width:210mm;margin:5pxauto;padding:5px;}h1{margin:15px010px0;font-size:24px;border-bottom:1pxsolid#d9d9d9;color:#545454;}h2{margin:15px010px0;font-size:20px;color:#545454;}.tableSurveytabletd{padding:5px;}.tableSurveytabletdstrong{margin-top:8px;}.tableSurvey1{border:1pxsolid#e1e1e1;}.tableSurvey1th{border:1pxsolid#fff;height:30px;padding-right:10px;text-align:right;background:#f1f1f1;}.tableSurvey1td{border:1pxsolid#f9f9f9;padding:5px;text-align:center;width:80px;}.tableSurvey2{border:1pxsolid#e1e1e1;}.tableSurvey2th{border:1pxsolid#fff;padding:5px10px;text-align:right;background:#f1f1f1;font-weight:normal;}.tableSurvey2td{border:1pxsolid#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:3px0;}</style></head><body><divid=warp><divid=surveyContent><?php$raw=json_decode($pn_memo);$c_gross=str_replace("-","",$pn_mc_gross);?><p>Dear <?phpecho$pn_payer?>,</p><br><p>China Highlights has refunded to your account today - <?phpecho$c_gross?><?phpecho$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><pclass=title-bold>Transaction details</p><p><?phpecho$raw->payment_date ?></p><p>Payment status: <?phpecho$pn_payment_status?></p><br><pclass=title-bold>Payment details</p><p>Gross amount</p><pclass=text-right><?phpecho$pn_mc_gross?><?phpecho$pn_mc_currency?></p><br><pclass=title-bold>Invoice ID</p><p><?phpecho$pn_invoice?></p><br><pclass=title-bold>Contact information</p><p><?phpecho$pn_payer?></p><p><?phpecho$pn_payer_email?></p><br><br><prestyle="font-family: Verdana, Arial, Helvetica, sans-serif;font-size:13px;">
<htmlxmlns=http://www.w3.org/1999/xhtml><head><metahttp-equiv=Content-Typecontent="text/html; charset=utf-8"><title>Your Submission Was Successful! - China Highlights</title><styletype=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,ulli{padding:0;margin:0;border:0;}#warp{border-top:8pxsolid#a31022!important;}#logo{border:none!important}#logo,#surveyContent{width:210mm;margin:5pxauto;padding:5px;}h1{margin:15px010px0;font-size:24px;border-bottom:1pxsolid#d9d9d9;color:#545454;}h2{margin:15px010px0;font-size:20px;color:#545454;}.tableSurveytabletd{padding:5px;}.tableSurveytabletdstrong{margin-top:8px;}.tableSurvey1{border:1pxsolid#e1e1e1;}.tableSurvey1th{border:1pxsolid#fff;height:30px;padding-right:10px;text-align:right;background:#f1f1f1;}.tableSurvey1td{border:1pxsolid#f9f9f9;padding:5px;text-align:center;width:80px;}.tableSurvey2{border:1pxsolid#e1e1e1;}.tableSurvey2th{border:1pxsolid#fff;padding:5px10px;text-align:right;background:#f1f1f1;font-weight:normal;}.tableSurvey2td{border:1pxsolid#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:3px0;}</style></head><body><divid=warp><divid=surveyContent><?php$raw=json_decode($pn_memo);$c_gross=str_replace("-","",$pn_mc_gross);?><p>Dear <?phpecho$pn_payer?>,</p><br><p>China Highlights has refunded to your account today - <?phpecho$c_gross?><?phpecho$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><pclass=title-bold>Transaction details</p><p><?phpechoisset($raw->payment_date)?$raw->payment_date:$pn_payment_date ?></p><p>Payment status: <?phpecho$pn_payment_status?></p><br><pclass=title-bold>Payment details</p><p>Gross amount</p><pclass=text-right><?phpecho$pn_mc_gross?><?phpecho$pn_mc_currency?></p><br><pclass=title-bold>Invoice ID</p><p><?phpecho$pn_invoice?></p><br><pclass=title-bold>Contact information</p><p><?phpecho$pn_payer?></p><p><?phpecho$pn_payer_email?></p><br><br><prestyle="font-family: Verdana, Arial, Helvetica, sans-serif;font-size:13px;">