/**
  * Comment.
  */
 public function refund($orderId, $request)
 {
     require_once dirname(__FILE__) . '/Alipay/alipay.config.php';
     require_once dirname(__FILE__) . '/Alipay/lib/alipay_submit.class.php';
     $refundRequest = $this->refundRequest($orderId, $request);
     //Refund no
     $out_return_no = $refundRequest['returnId'];
     //required
     //Old Partner transaction ID
     $out_trade_no = $refundRequest['orderId'];
     //required
     //Refund sum
     $return_amount = $refundRequest['returnAmount'];
     //required
     //Currency
     $currency = $refundRequest['returnCurrency'];
     //Refer to abbreviation of currencies
     date_default_timezone_set('PRC');
     //Refund Transaction time
     $gmt_return = date('YmdHis');
     //YYYYMMDDHHMMSS Beijing Time
     //Reason for refundament
     $reason = $refundRequest['returnReason'];
     //required
     /************************************************************/
     //构造要请求的参数数组,无需改动
     $parameter = array('service' => 'forex_refund', 'partner' => trim($alipay_config['partner']), 'out_return_no' => $out_return_no, 'out_trade_no' => $out_trade_no, 'return_amount' => $return_amount, 'currency' => $currency, 'gmt_return' => $gmt_return, 'reason' => $reason, '_input_charset' => trim(strtolower($alipay_config['input_charset'])));
     //建立请求
     $alipaySubmit = new \AlipaySubmit($alipay_config);
     // $html_text = $alipaySubmit->buildRequestForm($parameter, "get", "确认");
     $html_text = $alipaySubmit->buildRequestHttpGet($parameter);
     // echo $html_text;
     $doc = new \DOMDocument();
     $doc->loadXML($html_text);
     if (!empty($doc->getElementsByTagName('alipay')->item(0)->nodeValue)) {
         $alipay = $doc->getElementsByTagName('alipay')->item(0)->nodeValue;
         if ($alipay == 'T') {
             // confirm refund here, change the order status
             $this->updateOrderStatus('8', $out_trade_no);
             return true;
         } else {
             return false;
         }
     } else {
         return false;
     }
 }