$value){
echo "$key : $value
";
}
}
function ajaxMsg($pMsg = '', $pStatus = 0, $pData = '', $pType = 'json'){
if($pType == 'json'){
header('Content-type: application/json');
}
# 信息
$tResult = array('status' => $pStatus, 'msg' => $pMsg, 'data' => $pData);
# 格式
'json' == $pType && exit(json_encode($tResult));
'xml' == $pType && exit(xml_encode($tResult));
'eval' == $pType && exit($pData);
}
if(isset($_REQUEST["transaction_id"]) && $_REQUEST["transaction_id"] != ""){
$transaction_id = $_REQUEST["transaction_id"];
$total_fee = $_REQUEST["total_fee"];
$refund_fee = $_REQUEST["refund_fee"];
$input = new WxPayRefund();
$input->SetTransaction_id($transaction_id);
$input->SetTotal_fee($total_fee);
$input->SetRefund_fee($refund_fee);
$input->SetOut_refund_no(WxPayConfig::MCHID.date("YmdHis"));
$input->SetOp_user_id(WxPayConfig::MCHID);
printf_info(WxPayApi::refund($input));
exit();
}
//$_REQUEST["out_trade_no"]= "122531270220150304194108";
///$_REQUEST["total_fee"]= "1";
//$_REQUEST["refund_fee"] = "1";
if(isset($_REQUEST["out_trade_no"]) && $_REQUEST["out_trade_no"] != ""){
$out_trade_no = $_REQUEST["out_trade_no"];
$total_fee = $_REQUEST["total_fee"];
$refund_fee = $_REQUEST["refund_fee"];
$input = new WxPayRefund();
$input->SetOut_trade_no($out_trade_no);
$input->SetTotal_fee($total_fee);
$input->SetRefund_fee($refund_fee);
$input->SetOut_refund_no(WxPayConfig::MCHID.date("YmdHis"));
$input->SetOp_user_id(WxPayConfig::MCHID);
// printf_info(WxPayApi::refund($input));
ajaxMsg('', 1, WxPayApi::refund($input));
exit();
}
?>