Beispiel #1
0
 /**
  * 交易退款
  *
  * @param      $batch_no //退款的批次号
  * @param      $trade_no //商户交易号
  * @param      $amount //退款的金额
  * @param null $extra //订单退款的其他信息
  *
  * @return mixed
  */
 public function refund($batch_no, $trade_no, $amount, $extra = null)
 {
     $parameters = array('version' => '5.0.0', 'encoding' => 'utf-8', 'certId' => Secure::getSignCertId(), 'signMethod' => '01', 'txnType' => '04', 'txnSubType' => '00', 'bizType' => '000201', 'accessType' => '0', 'channelType' => '07', 'orderId' => $batch_no, 'merId' => Config::MERCHANT_ID, 'origQryId' => $extra['thirdparty_trade_no'], 'txnTime' => date('YmdHis'), 'txnAmt' => $extra['amount'] * 100, 'backUrl' => Config::SDK_BACK_NOTIFY_URL, 'reqReserved' => ' 透传信息');
     Secure::sign($parameters);
     $result = Http::sendHttpRequest(Http::getRequestParamString($parameters), Config::SDK_BACK_TRANS_URL);
     $result_arr = Common::coverStringToArray($result);
     return Secure::verify($result_arr) ? $result_arr : false;
 }