feat: 支付宝退款: 状态值使用财务系统的值

webht/payment
Lei OT 2 weeks ago
parent e0bd459a52
commit def549e8ac

@ -622,6 +622,10 @@ class AlipayTradeService extends CI_Controller
if (empty($item->ALI_resultMsg)) { if (empty($item->ALI_resultMsg)) {
return; return;
} }
if (($item->ALI_resultMsg) === 'pending') {
// todo: 查询退款结果
return;
}
// raw // raw
$raw = json_decode($item->ALI_memo); $raw = json_decode($item->ALI_memo);
$parent_order = $raw->out_trade_no; $parent_order = $raw->out_trade_no;
@ -1462,11 +1466,11 @@ class AlipayTradeService extends CI_Controller
// $ret_status_mapped = array( // $ret_status_mapped = array(
// "Y" => "1", // COMPLETED // "Y" => "1", // COMPLETED
// "N" => "3", // FAILED // "N" => "3", // FAILED
// // "PENDING" => "2", // todo: // // "PENDING" => "4", // todo:
// // "CANCELLED" => "-1", // todo: // // "CANCELLED" => "2", // todo:
// ); // );
// $refund_res->status = $response->code === '10000' ? '1' : '3'; // $refund_res->status = $response->code === '10000' ? '1' : '3';
$refund_res->status = $response->code === '10000' && $response->fund_change === 'Y' ? '1' : $response->code === '10000' ? '2' : '3'; $refund_res->status = $response->code === '10000' && $response->fund_change === 'Y' ? '1' : $response->code === '10000' ? '4' : '3';
$refund_res->refund_payload = $refund_payload; $refund_res->refund_payload = $refund_payload;
// log_message('error','test: ' . __METHOD__ . ': ' . __LINE__ . ' ' . PHP_EOL . var_export($response, 1)); // log_message('error','test: ' . __METHOD__ . ': ' . __LINE__ . ' ' . PHP_EOL . var_export($response, 1));
// var_dump($response); // var_dump($response);
@ -1482,22 +1486,22 @@ class AlipayTradeService extends CI_Controller
// if ($refund_res->status !== '3') { // if ($refund_res->status !== '3') {
if ($refund_res->status2 === '1') { if ($refund_res->status2 === '1') {
// $ALI_dealId,$ALI_orderId,$ALI_currencyCode,$ALI_orderAmount,$ALI_payAmount,$ALI_stateCode,$ALI_acquiringTime,$ALI_completeTime,$ALI_memo,$ALI_payType,$ALI_resultCode=null,$ALI_resultMsg=null,$ALI_payerName=null,$ALI_payerEmail=NULL, $check_exists=false
$this->Alipay_note_model->save_alipay( $this->Alipay_note_model->save_alipay(
strval($generateId) strval($generateId) // $ALI_dealId,
,strval($paymentOrder) ,strval($paymentOrder) // $ALI_orderId,
,"CNY" ,"CNY" // $ALI_currencyCode,
,"-" . strval($query_res->refund_amount) ,"-" . strval($query_res->refund_amount) // $ALI_orderAmount,
,NULL ,NULL // $ALI_payAmount,
,NULL ,NULL // $ALI_stateCode,
,date('Y-m-d H:i:s') ,date('Y-m-d H:i:s') // $ALI_acquiringTime,
,date('Y-m-d H:i:s') ,date('Y-m-d H:i:s') // $ALI_completeTime,
,json_encode($query_res,JSON_UNESCAPED_UNICODE) ,json_encode($query_res,JSON_UNESCAPED_UNICODE) // $ALI_memo,
,'refund' ,'refund' // $ALI_payType,
,NULL ,NULL // $ALI_resultCode=null,
,$refund_res->status2 === '1' ? 'TRADE_SUCCESS' : '' ,$refund_res->status2 === '1' ? 'TRADE_SUCCESS' : 'pending' // $ALI_resultMsg=null,
,NULL ,NULL // $ALI_payerName=null,
,NULL ,NULL // $ALI_payerEmail=NULL,
// $check_exists=false
); );
} }

Loading…
Cancel
Save