Example #1
0
 /**
  * 将xml转为array
  * @param string $xml
  * @throws Exception
  */
 public static function Init($xml, API $api)
 {
     WechatLog::create(['log' => $xml, 'waid' => $api->waid, 'url' => app('url')->full()]);
     $obj = new self();
     $obj->fromXml($xml);
     //fix bug 2015-06-29
     if ($obj->values['return_code'] == 'SUCCESS') {
         $obj->CheckSign($api->mchkey);
     }
     return $obj->getValues();
 }
Example #2
0
 /**
  * 将xml转为array
  * @param string $xml
  * @throws WxPayException
  */
 public static function Init($xml)
 {
     $obj = new self();
     $obj->fromXml($xml);
     //fix bug 2015-06-29
     if ($obj->values['return_code'] != 'SUCCESS') {
         return $obj->getValues();
     }
     $obj->CheckSign();
     return $obj->getValues();
 }
Example #3
0
 /**
  * 将xml转为array
  * @param string $xml
  * @param string $mchKey 商户Api密钥
  * @throws WxPayException
  */
 public static function init($xml, $mchKey = '')
 {
     $obj = new self();
     if ($mchKey) {
         $obj->setMchKey($mchKey);
     }
     $obj->fromXml($xml);
     //fix bug 2015-06-29
     if ($obj->values['return_code'] != 'SUCCESS') {
         return $obj->getValues();
     }
     $obj->checkSign();
     return $obj->getValues();
 }
Example #4
0
 /**
  * 将xml转为array
  * @param $xml 需要解析的xml内容
  * @param bool|true $checkSign 是否需要验证签名
  * @param $key  验证签名的key
  * @return array
  * @throws \Exception
  */
 public static function init($xml, $checkSign = true, $key = "")
 {
     $obj = new self();
     $obj->fromXml($xml);
     if ($obj->values['return_code'] != 'SUCCESS') {
         return $obj->getValues();
     }
     if ($checkSign) {
         $obj->checkSign($key);
     }
     return $obj->getValues();
 }