Alipay 增加支付宝退款通知

feature/trippest
lyt 7 years ago
parent 6703a19d7c
commit d97c5552c0

@ -99,29 +99,55 @@ class AlipayTradeService extends CI_Controller
echo "failed";
return;
}
if (true === $this->if_note_exists($asyns_resp->data->trade_no)) {
if ( isset($asyns_resp->data->refund_fee) && true === $this->if_note_exists($asyns_resp->data->out_biz_no) ) {
echo "success";
return;
} else if ( ! isset($asyns_resp->data->refund_fee) && true === $this->if_note_exists($asyns_resp->data->trade_no)) {
echo "success";
return;
}
$notify_type = "pay";
if (isset($asyns_resp->data->refund_fee)) {
$notify_type = "refund";
}
$code = isset($asyns_resp->data->code) ? strval($asyns_resp->data->code) : NULL ;
$buyer = isset($asyns_resp->data->buyer_logon_id) ? strval($asyns_resp->data->buyer_logon_id) : NULL ;
if (strcmp(strval($asyns_resp->data->trade_status), "TRADE_SUCCESS") == 0) {
$this->Alipay_note_model->save_alipay(
strval($asyns_resp->data->trade_no)
,strval($asyns_resp->data->out_trade_no)
,"CNY"
,strval($asyns_resp->data->total_amount)
,NULL
,NULL
,strval($asyns_resp->data->gmt_create)
,strval($asyns_resp->data->gmt_payment)
,json_encode($asyns_resp->data)
,strval("pay")
,$code
,strval($asyns_resp->data->trade_status)
,NULL
,$buyer
);
if (strcmp(trim(strval($asyns_resp->data->trade_status)), "TRADE_SUCCESS") == 0) {
if ($notify_type === "pay") {
$this->Alipay_note_model->save_alipay(
strval($asyns_resp->data->trade_no)
,strval($asyns_resp->data->out_trade_no)
,"CNY"
,strval($asyns_resp->data->total_amount)
,NULL
,NULL
,strval($asyns_resp->data->gmt_create)
,strval($asyns_resp->data->gmt_payment)
,json_encode($asyns_resp->data)
,$notify_type
,$code
,strval($asyns_resp->data->trade_status)
,NULL
,$buyer
);
} else if ($notify_type == "refund") {
$this->Alipay_note_model->save_alipay(
strval($asyns_resp->data->out_biz_no)
,strval($asyns_resp->data->out_trade_no)
,"CNY"
,"-" . strval($asyns_resp->data->refund_fee)
,NULL
,NULL
,strval($asyns_resp->data->gmt_refund)
,strval($asyns_resp->data->notify_time)
,json_encode($asyns_resp->data)
,$notify_type
,$code
,strval($asyns_resp->data->trade_status)
,NULL
,$buyer
);
}
// 查询payer
// $this->AlipayTradeQueryContentBuilder->setTradeNo($asyns_resp->data->trade_no);
// if ($asyns_resp->data->out_trade_no) {
@ -325,7 +351,7 @@ class AlipayTradeService extends CI_Controller
}
//退款状态默认为已经处理,陆燕在退款前手动通知外联了,系统跳过处理
if ($item->ALI_payType == 'Refunded') {
if ($item->ALI_payType == 'refund') {
$this->Alipay_note_model->update_send($item->ALI_dealId, 'send');
continue;
}

Loading…
Cancel
Save