退款处理30%

feature/pay
lyt 6 years ago
parent d1b78f0c62
commit c25105bba8

@ -714,6 +714,7 @@ class Index extends CI_Controller {
//找到没有发送的记录 //找到没有发送的记录
public function send_note($pn_txn_id = false, $old_ssje=NULL) { public function send_note($pn_txn_id = false, $old_ssje=NULL) {
$data = array(); $data = array();
$handpick = empty($pn_txn_id) ? false : TRUE;
//优先处理指定的交易号,用于修正交易号直接发送通知 //优先处理指定的交易号,用于修正交易号直接发送通知
if (!empty($pn_txn_id)) { if (!empty($pn_txn_id)) {
@ -880,7 +881,7 @@ class Index extends CI_Controller {
//echo 'done!'; //echo 'done!';
} }
public function send_refund($item) public function send_refund($item, $handpick, $old_ssje=NULL)
{ {
// 找到原始收款交易的订单 // 找到原始收款交易的订单
$parent_note = $this->note_modal->note($item->parent_txn_id); $parent_note = $this->note_modal->note($item->parent_txn_id);
@ -904,7 +905,6 @@ class Index extends CI_Controller {
//根据订单号查找外联信息 //根据订单号查找外联信息
$orderid_info = json_decode($orderid_info); $orderid_info = json_decode($orderid_info);
$handpick = empty($pn_txn_id) ? false : TRUE;
$advisor_info = $this->Paypal_model->get_order($orderid_info->orderid, false, $orderid_info->ordertype, $handpick); $advisor_info = $this->Paypal_model->get_order($orderid_info->orderid, false, $orderid_info->ordertype, $handpick);
//查不到订单信息 //查不到订单信息
@ -931,7 +931,6 @@ class Index extends CI_Controller {
$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_email, $item->pn_txn_id, $ht_memo);
$this->Paypal_model->insert_biz_order_log($GAI_COLI_SN, 'Refunded'); $this->Paypal_model->insert_biz_order_log($GAI_COLI_SN, 'Refunded');
} else { } else {
// 把订单状态设置为13-新订单已支付
if (false == $this->Paypal_model->if_biz_gai_exists($item->pn_txn_id) ) { 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->insert_biz_order_log($GAI_COLI_SN, 'Refunded');
} }
@ -946,8 +945,6 @@ class Index extends CI_Controller {
$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); $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);
//添加汉特的订单提醒 //添加汉特的订单提醒
$this->Paypal_model->update_coli_introduction($GAI_COLI_SN, '已退款 ' . mb_strtoupper($item->pn_mc_currency) . $item->pn_mc_gross); $this->Paypal_model->update_coli_introduction($GAI_COLI_SN, '已退款 ' . mb_strtoupper($item->pn_mc_currency) . $item->pn_mc_gross);
// 添加HT任务 // todo 是否还需要
$this->Paypal_model->exec_addToTask($gai_sn);
} }
} }
@ -973,8 +970,10 @@ class Index extends CI_Controller {
$M_AddTime = $item->pn_payment_date; $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'); $this->Paypal_model->save_automail($fromName, $fromEmail, $toName, $toEmail, $subject, $body, $M_RelatedInfo, $M_State, $M_AddTime, 'paypal note');
// TODO 通知财务, 如果已做账
//添加邮件发送记录 end //添加邮件发送记录 end
return $this->Note_model->update_send($item->pn_txn_id, 'send'); return $this->Note_model->update_send($item->pn_txn_id, 'send');
} }

Loading…
Cancel
Save