/**
  * Consultar detalhes de um pagamento.
  *
  * @param $code
  * @param array $options
  *
  * @return ResponseInterface
  */
 public function find($code, array $options = [])
 {
     $url = $this->interpolate($this->client->getApiUrl() . '/' . self::BASE_PATH . '/{code}', ['environment' => $this->client->getEnvironment(), 'version' => $this->client->getApiVersion(), 'resource' => self::RESOURCE, 'code' => $code]);
     $response = $this->client->get($url, $options);
     if (!$response->results()) {
         $response->setError('MXC3', 'Pagamento não encontrado');
     }
     return $response;
 }
 /**
  * Consultar detalhes de um pagamento.
  *
  * @param $code
  * @param array $options
  *
  * @throws ClientException
  *
  * @return ResponseInterface
  */
 public function find($code, array $options = [])
 {
     $url = $this->interpolate($this->client->getApiUrl() . '/' . self::BASE_PATH . '/{code}', ['environment' => $this->client->getEnvironment(), 'version' => $this->client->getApiVersion(), 'resource' => self::RESOURCE, 'code' => $code]);
     try {
         $find = $this->client->get($url, $options);
     } catch (ClientException $e) {
         $find = [];
     }
     return $find;
 }
 /**
  * @param $code
  * @param array $data
  * @param array $options
  *
  * @throws ClientException
  *
  * @return ResponseInterface
  */
 public function updateBillingInfo($code, array $data, array $options = [])
 {
     $url = $this->interpolate($this->client->getApiUrl() . '/' . self::BASE_PATH . '/{code}/billing_infos', ['environment' => $this->client->getEnvironment(), 'version' => $this->client->getApiVersion(), 'resource' => self::RESOURCE, 'code' => $code]);
     $options = array_merge($options, ['body' => json_encode($data)]);
     return $this->client->put($url, $options);
 }
Example #4
0
 /**
  * Ativar ou desativar um plano.
  *
  * @param $code
  * @param $status [activate, inactivate]
  * @param array $options
  *
  * @throws ClientException
  *
  * @return ResponseInterface
  */
 protected function toogleActive($code, $status, array $options = [])
 {
     $url = $this->interpolate($this->client->getApiUrl() . '/' . self::BASE_PATH . '/{code}/{status}', ['environment' => $this->client->getEnvironment(), 'version' => $this->client->getApiVersion(), 'resource' => self::RESOURCE, 'code' => $code, 'status' => $status]);
     return $this->client->put($url, $options);
 }
 /**
  * Criar regras de retentativas automáticas.
  *
  * @param array $data
  * @param array $options
  *
  * @return ResponseInterface
  */
 public function setPreferencesRetry(array $data, array $options = [])
 {
     $url = $this->interpolate($this->client->getApiUrl() . '/' . self::BASE_PATH, ['environment' => $this->client->getEnvironment(), 'version' => $this->client->getApiVersion(), 'resource' => self::RESOURCE]);
     $options = array_merge($options, ['body' => json_encode($data)]);
     return $this->client->post($url, $options);
 }
 /**
  * Retentar um pagamento.
  *
  * @param $code
  * @param array $options
  *
  * @throws ClientException
  *
  * @return ResponseInterface
  */
 public function retryPayment($code, array $options = [])
 {
     $url = $this->interpolate($this->client->getApiUrl() . '/' . self::BASE_PATH . '/{code}/payments', ['environment' => $this->client->getEnvironment(), 'version' => $this->client->getApiVersion(), 'resource' => self::RESOURCE, 'code' => $code]);
     return $this->client->get($url, $options);
 }