2020.02新版

This commit is contained in:
Blokura
2020-02-21 16:20:55 +08:00
parent 45e2415d71
commit a2f29a310b
755 changed files with 95144 additions and 0 deletions

28
plugins/wxpay/refund.php Normal file
View File

@@ -0,0 +1,28 @@
<?php
/*
* 微信退款接口
*/
if(!defined('IN_REFUND'))exit();
require_once PAY_ROOT."inc/WxPay.Api.php";
try{
$input = new WxPayRefund();
$input->SetTransaction_id($order['api_trade_no']);
$input->SetTotal_fee(strval($order['realmoney']*100));
$input->SetRefund_fee(strval($order['realmoney']*100));
$input->SetOut_refund_no($order['trade_no']);
$input->SetOp_user_id(WxPayConfig::MCHID);
$result = WxPayApi::refund($input);
if($result['return_code']=='SUCCESS' && $result['result_code']=='SUCCESS'){
$result = ['code'=>0, 'trade_no'=>$result['transaction_id'], 'refund_fee'=>$result['refund_fee']];
}elseif(isset($result["err_code"])){
$result = ['code'=>-1, 'msg'=>'['.$result["err_code"].']'.$result["err_code_des"]];
}else{
$result = ['code'=>-1, 'msg'=>'['.$result["return_code"].']'.$result["return_msg"]];
}
} catch(Exception $e) {
$result = ['code'=>-1, 'msg'=>$e->getMessage()];
}
return $result;