Esempio n. 1
0
 /**
  *
  * 查询退款情况
  * @param string $out_trade_no  商户订单号
  * @param int $succCode         查询退款结果
  * @return
  */
 public function refundQuery($out_trade_no)
 {
     $WxPayRefundQuery = new \WxPayRefundQuery();
     $WxPayRefundQuery->SetOut_trade_no($out_trade_no);
     $WxPayRefundQuery->setWxPayApi($this->wxPayApi);
     $result = $this->wxPayApi->refundQuery($WxPayRefundQuery, $this->wxPayConfig['CURL_TIMEOUT']);
     if ($result['return_code'] == 'FAIL') {
         throw new \WxPayException($result['return_msg']);
     }
     if ($result['return_code'] == 'SUCCESS' && $result['result_code'] == 'SUCCESS') {
         //退款成功
         return true;
     }
     return false;
 }
Esempio n. 2
0
 /**
  * 
  * 查询退款
  * 提交退款申请后,通过调用该接口查询退款状态。退款有一定延时,
  * 用零钱支付的退款20分钟内到账,银行卡支付的退款3个工作日后重新查询退款状态。
  * WxPayRefundQuery中out_refund_no、out_trade_no、transaction_id、refund_id四个参数必填一个
  * appid、mchid、spbill_create_ip、nonce_str不需要填入
  * @param WxPayRefundQuery $inputObj
  * @param int $timeOut
  * @throws WxPayException
  * @return 成功时返回,其他抛异常
  */
 public static function refundQuery($inputObj, $timeOut = 6)
 {
     $url = "https://api.mch.weixin.qq.com/pay/refundquery";
     //检测必填参数
     if (!$inputObj->IsOut_refund_noSet() && !$inputObj->IsOut_trade_noSet() && !$inputObj->IsTransaction_idSet() && !$inputObj->IsRefund_idSet()) {
         throw new WxPayException("退款查询接口中,out_refund_no、out_trade_no、transaction_id、refund_id四个参数必填一个!");
     }
     $inputObj->SetAppid(WxPayConfig::APPID);
     //公众账号ID
     $inputObj->SetMch_id(WxPayConfig::MCHID);
     //商户号
     $inputObj->SetNonce_str(self::getNonceStr());
     //随机字符串
     $inputObj->SetSign();
     //签名
     $xml = $inputObj->ToXml();
     $startTimeStamp = self::getMillisecond();
     //请求开始时间
     $response = self::postXmlCurl($xml, $url, false, $timeOut);
     $result = WxPayResults::Init($response);
     self::reportCostTime($url, $startTimeStamp, $result);
     //上报请求花费时间
     return $result;
 }
Esempio n. 3
0
    $out_trade_no = $_REQUEST["out_trade_no"];
    $input = new WxPayRefundQuery();
    $input->SetOut_trade_no($out_trade_no);
    printf_info(WxPayApi::refundQuery($input));
    exit;
}
if (isset($_REQUEST["out_refund_no"]) && $_REQUEST["out_refund_no"] != "") {
    $out_refund_no = $_REQUEST["out_refund_no"];
    $input = new WxPayRefundQuery();
    $input->SetOut_refund_no($out_refund_no);
    printf_info(WxPayApi::refundQuery($input));
    exit;
}
if (isset($_REQUEST["refund_id"]) && $_REQUEST["refund_id"] != "") {
    $refund_id = $_REQUEST["refund_id"];
    $input = new WxPayRefundQuery();
    $input->SetRefund_id($refund_id);
    printf_info(WxPayApi::refundQuery($input));
    exit;
}
?>
<body>  
	<form action="#" method="post">
        <div style="margin-left:2%;color:#f00">微信订单号、商户订单号、微信订单号、微信退款单号选填至少一个,微信退款单号优先:</div><br/>
        <div style="margin-left:2%;">微信订单号:</div><br/>
        <input type="text" style="width:96%;height:35px;margin-left:2%;" name="transaction_id" /><br /><br />
        <div style="margin-left:2%;">商户订单号:</div><br/>
        <input type="text" style="width:96%;height:35px;margin-left:2%;" name="out_trade_no" /><br /><br />
        <div style="margin-left:2%;">商户退款单号:</div><br/>
        <input type="text" style="width:96%;height:35px;margin-left:2%;" name="out_refund_no" /><br /><br />
        <div style="margin-left:2%;">微信退款单号:</div><br/>
Esempio n. 4
0
 /**
  * 订单查询
  * @param array $options 参数数组
  * @return array
  */
 public function queryOrder($options)
 {
     $resArr = ['code' => 0];
     //使用退款查询接口
     $refundQueryModel = new WxPayRefundQuery($this->wx_config);
     $refundQueryModel->setParameter("out_trade_no", $options['order_sn']);
     //退款查询接口结果
     $refundQueryResult = $refundQueryModel->getResult();
     $resArr['data'] = $refundQueryResult;
     return $resArr;
 }
Esempio n. 5
0
 /**
  *
  * 查询退款
  * 提交退款申请后,通过调用该接口查询退款状态。退款有一定延时,
  * 用零钱支付的退款20分钟内到账,银行卡支付的退款3个工作日后重新查询退款状态。
  * WxPayRefundQuery中out_refund_no、out_trade_no、transaction_id、refund_id四个参数必填一个
  * appid、mchid、spbill_create_ip、nonce_str不需要填入
  * @param WxPayRefundQuery $inputObj
  * @param int $timeOut
  * @throws WxPayException
  * @return 成功时返回,其他抛异常
  */
 public function refundQuery($inputObj, $timeOut = 6)
 {
     $url = "https://api.mch.weixin.qq.com/pay/refundquery";
     //检测必填参数
     if (!$inputObj->isOutRefundNoSet() && !$inputObj->isOutTradeNoSet() && !$inputObj->isTransactionIdSet() && !$inputObj->isRefundIdSet()) {
         throw new WxPayException("退款查询接口中,out_refund_no、out_trade_no、transaction_id、refund_id四个参数必填一个!");
     }
     $inputObj->setAppid($this->apiConfig->appid);
     //公众账号ID
     $inputObj->setMchId($this->apiConfig->mchid);
     //商户号
     $inputObj->setMchKey($this->apiConfig->mchkey);
     //商户密钥
     $inputObj->setNonceStr($this->getNonceStr());
     //随机字符串
     $inputObj->setSign();
     //签名
     $xml = $inputObj->toXml();
     $startTimeStamp = $this->getMillisecond();
     //请求开始时间
     $response = $this->postXmlCurl($xml, $url, false, $timeOut);
     $result = WxPayResults::init($response, $this->apiConfig->mchkey);
     $this->reportCostTime($url, $startTimeStamp, $result);
     //上报请求花费时间
     return $result;
 }