Exemplo n.º 1
0
 /**
  * Make a API request.
  *
  * @param string $api
  * @param array  $params
  * @param string $method
  *
  * @return \EasyWeChat\Support\Collection
  */
 protected function request($api, array $params, $method = 'post')
 {
     $params['nonce_str'] = uniqid();
     $params['sign'] = \EasyWeChat\Payment\generate_sign($params, $this->merchant->key, 'md5');
     $options = ['body' => XML::build($params), 'cert' => $this->merchant->get('cert_path'), 'ssl_key' => $this->merchant->get('key_path')];
     return $this->parseResponse($this->getHttp()->request($api, $method, $options));
 }
Exemplo n.º 2
0
 /**
  * Request with SSL.
  *
  * @param string $api
  * @param array  $params
  * @param string $method
  *
  * @return \EasyWeChat\Support\Collection
  */
 protected function safeRequest($api, array $params, $method = 'post')
 {
     $options = ['cert' => $this->merchant->get('cert_path'), 'ssl_key' => $this->merchant->get('key_path')];
     return $this->request($api, $params, $method, $options);
 }