diff --git a/src/BBBoletoPDF.php b/src/BBBoletoPDF.php index 06f1208..fe47b5f 100644 --- a/src/BBBoletoPDF.php +++ b/src/BBBoletoPDF.php @@ -1,4 +1,5 @@ codigoLinhaDigitavel = $this->formatarLinhaDigitavel($dadosBoleto->codigoLinhaDigitavel); } + $dadosBoleto->instrucoes = $dadosBoleto->instrucoes ?? $this->montarInstrucoes($dadosBoleto); + return $dadosBoleto; + } + private function montarInstrucoes($dadosBoleto) + { + $instrucoes = []; + array_push($instrucoes, 'Pagável em qualquer banco até o vencimento'); + if (in_array($dadosBoleto->codigoTipoMulta, [1, 2])) { + $dataMulta = str_replace('.', '/', $dadosBoleto->dataMultaTitulo); + $msgMulta = ''; + if ($dadosBoleto->codigoTipoMulta == 1 && $dadosBoleto->valorMultaTituloCobranca > 0) { + $multa = number_format($dadosBoleto->valorMultaTituloCobranca, 2, ',', '.'); + $msgMulta = "Em $dataMulta, multa de R$ $multa."; + } - return $dadosBoleto; + if ($dadosBoleto->codigoTipoMulta == 2 && $dadosBoleto->percentualMultaTitulo > 0) { + $multa = number_format(($dadosBoleto->valorAtualTituloCobranca * $dadosBoleto->percentualMultaTitulo) / 100, 2, ',', '.'); + $msgMulta = "Em $dataMulta, multa de $dadosBoleto->percentualMultaTitulo%, R$ $multa."; + } + array_push($instrucoes, $msgMulta); + } + + if (in_array($dadosBoleto->codigoTipoJuroMora, [1, 2])) { + + $dataMora = str_replace('.', '/', $dadosBoleto->dataMultaTitulo); + $msgMora = ''; + if ($dadosBoleto->codigoTipoJuroMora == 1 && $dadosBoleto->valorJuroMoraTitulo > 0) { + $mora = number_format($dadosBoleto->valorJuroMoraTitulo, 2, ',', '.'); + $msgMora = "A partir de $dataMora, mora diária de R$ $mora."; + } + + if ($dadosBoleto->codigoTipoJuroMora == 2 && $dadosBoleto->percentualJuroMoraTitulo > 0) { + $mora = number_format(($dadosBoleto->valorAtualTituloCobranca * $dadosBoleto->percentualJuroMoraTitulo) / 100, 2, ',', '.'); + $msgMora = "A partir de $dataMora, mora mensal de R$ $mora."; + } + array_push($instrucoes, $msgMora); + } + + return $instrucoes; } } diff --git a/src/BankingBB.php b/src/BankingBB.php index bfddfeb..52704d5 100644 --- a/src/BankingBB.php +++ b/src/BankingBB.php @@ -2,13 +2,18 @@ namespace Divulgueregional\apibbphp; +use Divulgueregional\ApiBbPhp\Exceptions\InternalServerErrorException; +use Divulgueregional\ApiBbPhp\Exceptions\InvalidRequestException; +use Divulgueregional\ApiBbPhp\Exceptions\ServiceUnavailableException; +use Divulgueregional\ApiBbPhp\Exceptions\UnauthorizedException; use Exception; use GuzzleHttp\Client; use GuzzleHttp\Exception\ClientException; use GuzzleHttp\Psr7\Message; use JetBrains\PhpStorm\NoReturn; -class BankingBB{ +class BankingBB +{ protected $urlToken; protected $header; protected $token; @@ -27,13 +32,13 @@ class BankingBB{ function __construct($config) { $this->config = $config; - if($config['endPoints']==1){ + if ($config['endPoints'] == 1) { $this->urls = 'https://api.bb.com.br/cobrancas/v2'; $this->urlToken = 'https://oauth.bb.com.br/oauth/token'; //GuzzleHttp $this->uriToken = 'https://oauth.bb.com.br/oauth/token'; $this->uriCobranca = 'https://api.bb.com.br'; - }else{ + } else { $this->urls = 'https://api.sandbox.bb.com.br/cobrancas/v2'; $this->urlToken = 'https://oauth.sandbox.bb.com.br/oauth/token'; //GuzzleHttp @@ -46,12 +51,12 @@ function __construct($config) $this->clientCobranca = new Client([ 'base_uri' => $this->uriCobranca, ]); - + //startar o token - if(isset($this->config['token'])){ - if($this->config['token'] !=''){ + if (isset($this->config['token'])) { + if ($this->config['token'] != '') { $this->setToken($this->config['token']); - }else{ + } else { $this->gerarToken(); } } @@ -61,7 +66,8 @@ function __construct($config) ############## TOKEN ################################# ###################################################### - public function gerarToken(){ + public function gerarToken() + { try { $response = $this->clientToken->request( 'POST', @@ -70,7 +76,7 @@ public function gerarToken(){ 'headers' => [ 'Accept' => '*/*', 'Content-Type' => 'application/x-www-form-urlencoded', - 'Authorization' => 'Basic '. base64_encode($this->config['client_id'].':'.$this->config['client_secret']).'' + 'Authorization' => 'Basic ' . base64_encode($this->config['client_id'] . ':' . $this->config['client_secret']) . '' ], 'verify' => false, 'form_params' => [ @@ -89,32 +95,41 @@ public function gerarToken(){ } } - public function setToken(string $token){ + public function setToken(string $token) + { $this->token = $token; } - public function getToken(){ + public function getToken() + { return $this->token; } - protected function fields(array $fields, string $format="json"): void { - if($format == "json") { + protected function fields(array $fields, string $format = "json"): void + { + if ($format == "json") { $this->fields = (!empty($fields) ? json_encode($fields) : null); } - if($format == "query"){ + if ($format == "query") { $this->fields = (!empty($fields) ? http_build_query($fields) : null); } } - protected function headers(array $headers): void { - if (!$headers) { return; } + protected function headers(array $headers): void + { + if (!$headers) { + return; + } foreach ($headers as $k => $v) { - $this->header($k,$v); + $this->header($k, $v); } } - - protected function header(string $key, string $value): void { - if(!$key || is_int($key)){ return; } + + protected function header(string $key, string $value): void + { + if (!$key || is_int($key)) { + return; + } $keys = filter_var($key, FILTER_SANITIZE_STRIPPED); $values = filter_var($value, FILTER_SANITIZE_STRIPPED); $this->headers[] = "{$keys}: {$values}"; @@ -126,7 +141,9 @@ protected function header(string $key, string $value): void { ###################################################### ############## COBRANÇAS ############################# ###################################################### - public function registrarBoleto(array $fields){ + public function registrarBoleto(array $fields) + { + $filters = []; try { $response = $this->clientCobranca->request( 'POST', @@ -135,7 +152,7 @@ public function registrarBoleto(array $fields){ 'headers' => [ 'Content-Type' => 'application/json', 'X-Developer-Application-Key' => $this->config['application_key'], - 'Authorization' => 'Bearer ' . $this->token.'' + 'Authorization' => 'Bearer ' . $this->token . '' ], 'verify' => false, 'query' => [ @@ -148,19 +165,41 @@ public function registrarBoleto(array $fields){ $result = json_decode($response->getBody()->getContents()); return array('status' => $statusCode, 'response' => $result); } catch (ClientException $e) { - $response = $e->getResponse(); - $responseBodyAsString = json_decode($response->getBody()->getContents()); - if($responseBodyAsString==''){ - return ($response); + $statusCode = $e->getResponse()->getStatusCode(); + $requestParameters = $e->getRequest(); + $bodyContent = json_decode($e->getResponse()->getBody()->getContents()); + + switch ($statusCode) { + case InvalidRequestException::HTTP_STATUS_CODE: + $exception = new InvalidRequestException($bodyContent->erros[0]->mensagem); + $exception->setRequestParameters($requestParameters); + $exception->setBodyContent($bodyContent); + throw $exception; + case UnauthorizedException::HTTP_STATUS_CODE: + $exception = new UnauthorizedException($bodyContent->message); + $exception->setRequestParameters($requestParameters); + $exception->setBodyContent($bodyContent); + throw $exception; + case InternalServerErrorException::HTTP_STATUS_CODE: + $exception = new InternalServerErrorException($bodyContent->erros[0]->mensagem); + $exception->setRequestParameters($requestParameters); + $exception->setBodyContent($bodyContent); + throw $exception; + case ServiceUnavailableException::HTTP_STATUS_CODE: + $exception = new ServiceUnavailableException("SERVIÇO INDISPONÍVEL"); + $exception->setRequestParameters($requestParameters); + throw $exception; + default: + throw $e; } - return ($responseBodyAsString); } catch (\Exception $e) { $response = $e->getMessage(); return ['error' => "Falha ao incluir Boleto Cobranca: {$response}"]; } } - public function alterarBoleto(string $id, array $fields){ + public function alterarBoleto(string $id, array $fields) + { try { $response = $this->clientCobranca->request( 'PATCH', @@ -169,8 +208,8 @@ public function alterarBoleto(string $id, array $fields){ 'headers' => [ 'accept' => 'application/json', 'Content-Type' => 'application/json', - // 'X-Developer-Application-Key' => $this->config['application_key'], - 'Authorization' => 'Bearer ' . $this->token.'' + 'X-Developer-Application-Key' => $this->config['application_key'], + 'Authorization' => 'Bearer ' . $this->token . '' ], 'verify' => false, 'query' => [ @@ -183,16 +222,41 @@ public function alterarBoleto(string $id, array $fields){ $result = json_decode($response->getBody()->getContents()); return array('status' => $statusCode, 'response' => $result); } catch (ClientException $e) { - $response = $e->getResponse(); - $responseBodyAsString = json_decode($response->getBody()->getContents()); - return ($responseBodyAsString); + $statusCode = $e->getResponse()->getStatusCode(); + $requestParameters = $e->getRequest(); + $bodyContent = json_decode($e->getResponse()->getBody()->getContents()); + + switch ($statusCode) { + case InvalidRequestException::HTTP_STATUS_CODE: + $exception = new InvalidRequestException($bodyContent->erros[0]->mensagem); + $exception->setRequestParameters($requestParameters); + $exception->setBodyContent($bodyContent); + throw $exception; + case UnauthorizedException::HTTP_STATUS_CODE: + $exception = new UnauthorizedException($bodyContent->message); + $exception->setRequestParameters($requestParameters); + $exception->setBodyContent($bodyContent); + throw $exception; + case InternalServerErrorException::HTTP_STATUS_CODE: + $exception = new InternalServerErrorException($bodyContent->erros[0]->mensagem); + $exception->setRequestParameters($requestParameters); + $exception->setBodyContent($bodyContent); + throw $exception; + case ServiceUnavailableException::HTTP_STATUS_CODE: + $exception = new ServiceUnavailableException("SERVIÇO INDISPONÍVEL"); + $exception->setRequestParameters($requestParameters); + throw $exception; + default: + throw $e; + } } catch (\Exception $e) { $response = $e->getMessage(); return ['error' => "Falha ao alterar Boleto Cobranca: {$response}"]; } } - public function detalheDoBoleto(string $id){ + public function detalheDoBoleto(string $id) + { try { $response = $this->clientCobranca->request( 'GET', @@ -200,7 +264,7 @@ public function detalheDoBoleto(string $id){ [ 'headers' => [ 'X-Developer-Application-Key' => $this->config['application_key'], - 'Authorization' => 'Bearer ' . $this->token.'' + 'Authorization' => 'Bearer ' . $this->token . '' ], 'verify' => false, 'query' => [ @@ -212,16 +276,45 @@ public function detalheDoBoleto(string $id){ $result = json_decode($response->getBody()->getContents()); return array('status' => $statusCode, 'response' => $result); } catch (ClientException $e) { - $response = $e->getResponse(); - $responseBodyAsString = json_decode($response->getBody()->getContents()); - return ($responseBodyAsString); + $statusCode = $e->getResponse()->getStatusCode(); + $requestParameters = $e->getRequest(); + $bodyContent = json_decode($e->getResponse()->getBody()->getContents()); + + switch ($statusCode) { + case InvalidRequestException::HTTP_STATUS_CODE: + $exception = new InvalidRequestException($bodyContent->erros[0]->mensagem); + $exception->setRequestParameters($requestParameters); + $exception->setBodyContent($bodyContent); + throw $exception; + case UnauthorizedException::HTTP_STATUS_CODE: + $exception = new UnauthorizedException($bodyContent->message); + $exception->setRequestParameters($requestParameters); + $exception->setBodyContent($bodyContent); + throw $exception; + case InternalServerErrorException::HTTP_STATUS_CODE: + $exception = new InternalServerErrorException($bodyContent->erros[0]->mensagem); + $exception->setRequestParameters($requestParameters); + $exception->setBodyContent($bodyContent); + throw $exception; + case ServiceUnavailableException::HTTP_STATUS_CODE: + $exception = new ServiceUnavailableException("SERVIÇO INDISPONÍVEL"); + $exception->setRequestParameters($requestParameters); + throw $exception; + default: + throw $e; + } } catch (\Exception $e) { $response = $e->getMessage(); return ['error' => "Falha ao detalhar Boleto Cobranca: {$response}"]; } } - public function listarBoletos($filters){ + public function listarBoletos($filters) + { + $query = array_merge( + ['gw-dev-app-key' => $this->config['application_key']], + $filters + ); try { $response = $this->clientCobranca->request( 'GET', @@ -229,34 +322,51 @@ public function listarBoletos($filters){ [ 'headers' => [ 'Content-Type' => 'application/json', - 'Authorization' => 'Bearer ' . $this->token.'' + 'Authorization' => 'Bearer ' . $this->token . '' ], 'verify' => false, - 'query' => [ - 'gw-dev-app-key' => $this->config['application_key'], - 'indicadorSituacao' => $filters['indicadorSituacao'], - 'agenciaBeneficiario' => $filters["agenciaBeneficiario"], - 'contaBeneficiario' => $filters["contaBeneficiario"], - 'cnpjPagador'=> '', - 'digitoCNPJPagador'=> '', - 'digitoCNPJPagador'=> '', - 'codigoEstadoTituloCobranca' => $filters['codigoEstadoTituloCobranca'], - 'boletoVencido' => $filters['boletoVencido'], - ], + 'query' => $query, ] ); $statusCode = $response->getStatusCode(); $result = json_decode($response->getBody()->getContents()); return array('status' => $statusCode, 'response' => $result); } catch (ClientException $e) { - return ($e); + $statusCode = $e->getResponse()->getStatusCode(); + $requestParameters = $e->getRequest(); + $bodyContent = json_decode($e->getResponse()->getBody()->getContents()); + + switch ($statusCode) { + case InvalidRequestException::HTTP_STATUS_CODE: + $exception = new InvalidRequestException($bodyContent->erros[0]->mensagem); + $exception->setRequestParameters($requestParameters); + $exception->setBodyContent($bodyContent); + throw $exception; + case UnauthorizedException::HTTP_STATUS_CODE: + $exception = new UnauthorizedException($bodyContent->message); + $exception->setRequestParameters($requestParameters); + $exception->setBodyContent($bodyContent); + throw $exception; + case InternalServerErrorException::HTTP_STATUS_CODE: + $exception = new InternalServerErrorException($bodyContent->erros[0]->mensagem); + $exception->setRequestParameters($requestParameters); + $exception->setBodyContent($bodyContent); + throw $exception; + case ServiceUnavailableException::HTTP_STATUS_CODE: + $exception = new ServiceUnavailableException("SERVIÇO INDISPONÍVEL"); + $exception->setRequestParameters($requestParameters); + throw $exception; + default: + throw $e; + } } catch (\Exception $e) { $response = $e->getMessage(); return ['error' => "Falha ao baixar Boleto Cobranca: {$response}"]; } } - public function baixarBoleto(string $id){ + public function baixarBoleto(string $id) + { $fields['numeroConvenio'] = $this->config['numeroConvenio']; try { $response = $this->clientCobranca->request( @@ -266,7 +376,7 @@ public function baixarBoleto(string $id){ 'headers' => [ 'Content-Type' => 'application/json', 'X-Developer-Application-Key' => $this->config['application_key'], - 'Authorization' => 'Bearer ' . $this->token.'' + 'Authorization' => 'Bearer ' . $this->token . '' ], 'verify' => false, 'body' => json_encode($fields), @@ -276,19 +386,41 @@ public function baixarBoleto(string $id){ $result = json_decode($response->getBody()->getContents()); return array('status' => $statusCode, 'response' => $result); } catch (ClientException $e) { - $response = $e->getResponse(); - $responseBodyAsString = json_decode($response->getBody()->getContents()); - if($responseBodyAsString==''){ - return ($response); + $statusCode = $e->getResponse()->getStatusCode(); + $requestParameters = $e->getRequest(); + $bodyContent = json_decode($e->getResponse()->getBody()->getContents()); + + switch ($statusCode) { + case InvalidRequestException::HTTP_STATUS_CODE: + $exception = new InvalidRequestException($bodyContent->erros[0]->mensagem); + $exception->setRequestParameters($requestParameters); + $exception->setBodyContent($bodyContent); + throw $exception; + case UnauthorizedException::HTTP_STATUS_CODE: + $exception = new UnauthorizedException($bodyContent->message); + $exception->setRequestParameters($requestParameters); + $exception->setBodyContent($bodyContent); + throw $exception; + case InternalServerErrorException::HTTP_STATUS_CODE: + $exception = new InternalServerErrorException($bodyContent->erros[0]->mensagem); + $exception->setRequestParameters($requestParameters); + $exception->setBodyContent($bodyContent); + throw $exception; + case ServiceUnavailableException::HTTP_STATUS_CODE: + $exception = new ServiceUnavailableException("SERVIÇO INDISPONÍVEL"); + $exception->setRequestParameters($requestParameters); + throw $exception; + default: + throw $e; } - return ($responseBodyAsString); } catch (\Exception $e) { $response = $e->getMessage(); return ['error' => "Falha ao baixar Boleto Cobranca: {$response}"]; } } - public function consultaPixBoleto(string $id){ + public function consultaPixBoleto(string $id) + { try { $response = $this->clientCobranca->request( 'GET', @@ -296,7 +428,7 @@ public function consultaPixBoleto(string $id){ [ 'headers' => [ 'Content-Type' => 'application/json', - 'Authorization' => 'Bearer ' . $this->token.'' + 'Authorization' => 'Bearer ' . $this->token . '' ], 'verify' => false, 'query' => [ @@ -309,14 +441,41 @@ public function consultaPixBoleto(string $id){ $result = json_decode($response->getBody()->getContents()); return array('status' => $statusCode, 'response' => $result); } catch (ClientException $e) { - return ($e); + $statusCode = $e->getResponse()->getStatusCode(); + $requestParameters = $e->getRequest(); + $bodyContent = json_decode($e->getResponse()->getBody()->getContents()); + + switch ($statusCode) { + case InvalidRequestException::HTTP_STATUS_CODE: + $exception = new InvalidRequestException($bodyContent->erros[0]->mensagem); + $exception->setRequestParameters($requestParameters); + $exception->setBodyContent($bodyContent); + throw $exception; + case UnauthorizedException::HTTP_STATUS_CODE: + $exception = new UnauthorizedException($bodyContent->message); + $exception->setRequestParameters($requestParameters); + $exception->setBodyContent($bodyContent); + throw $exception; + case InternalServerErrorException::HTTP_STATUS_CODE: + $exception = new InternalServerErrorException($bodyContent->erros[0]->mensagem); + $exception->setRequestParameters($requestParameters); + $exception->setBodyContent($bodyContent); + throw $exception; + case ServiceUnavailableException::HTTP_STATUS_CODE: + $exception = new ServiceUnavailableException("SERVIÇO INDISPONÍVEL"); + $exception->setRequestParameters($requestParameters); + throw $exception; + default: + throw $e; + } } catch (\Exception $e) { $response = $e->getMessage(); return ['error' => "Falha ao baixar Boleto Cobranca: {$response}"]; } } - public function cancelarPixBoleto(string $id){ + public function cancelarPixBoleto(string $id) + { $fields['numeroConvenio'] = $this->config['numeroConvenio']; try { $response = $this->clientCobranca->request( @@ -326,7 +485,7 @@ public function cancelarPixBoleto(string $id){ 'headers' => [ 'accept' => 'application/json', 'Content-Type' => 'application/json', - 'Authorization' => 'Bearer ' . $this->token.'' + 'Authorization' => 'Bearer ' . $this->token . '' ], 'verify' => false, 'query' => [ @@ -339,14 +498,41 @@ public function cancelarPixBoleto(string $id){ $result = json_decode($response->getBody()->getContents()); return array('status' => $statusCode, 'response' => $result); } catch (ClientException $e) { - return ($e); + $statusCode = $e->getResponse()->getStatusCode(); + $requestParameters = $e->getRequest(); + $bodyContent = json_decode($e->getResponse()->getBody()->getContents()); + + switch ($statusCode) { + case InvalidRequestException::HTTP_STATUS_CODE: + $exception = new InvalidRequestException($bodyContent->erros[0]->mensagem); + $exception->setRequestParameters($requestParameters); + $exception->setBodyContent($bodyContent); + throw $exception; + case UnauthorizedException::HTTP_STATUS_CODE: + $exception = new UnauthorizedException($bodyContent->message); + $exception->setRequestParameters($requestParameters); + $exception->setBodyContent($bodyContent); + throw $exception; + case InternalServerErrorException::HTTP_STATUS_CODE: + $exception = new InternalServerErrorException($bodyContent->erros[0]->mensagem); + $exception->setRequestParameters($requestParameters); + $exception->setBodyContent($bodyContent); + throw $exception; + case ServiceUnavailableException::HTTP_STATUS_CODE: + $exception = new ServiceUnavailableException("SERVIÇO INDISPONÍVEL"); + $exception->setRequestParameters($requestParameters); + throw $exception; + default: + throw $e; + } } catch (\Exception $e) { $response = $e->getMessage(); return ['error' => "Falha ao baixar Boleto Cobranca: {$response}"]; } } - - public function gerarPixBoleto(string $id){ + + public function gerarPixBoleto(string $id) + { $fields['numeroConvenio'] = $this->config['numeroConvenio']; try { $response = $this->clientCobranca->request( @@ -354,7 +540,7 @@ public function gerarPixBoleto(string $id){ "/cobrancas/v2/boletos/{$id}/gerar-pix", [ 'headers' => [ - 'Authorization' => 'Bearer ' . $this->token.'', + 'Authorization' => 'Bearer ' . $this->token . '', 'accept' => 'application/json', 'Content-Type' => 'application/json', // 'X-Developer-Application-Key' => $this->config['application_key'], @@ -370,24 +556,51 @@ public function gerarPixBoleto(string $id){ $result = json_decode($response->getBody()->getContents()); return array('status' => $statusCode, 'response' => $result); } catch (ClientException $e) { - return ($e); + $statusCode = $e->getResponse()->getStatusCode(); + $requestParameters = $e->getRequest(); + $bodyContent = json_decode($e->getResponse()->getBody()->getContents()); + + switch ($statusCode) { + case InvalidRequestException::HTTP_STATUS_CODE: + $exception = new InvalidRequestException($bodyContent->erros[0]->mensagem); + $exception->setRequestParameters($requestParameters); + $exception->setBodyContent($bodyContent); + throw $exception; + case UnauthorizedException::HTTP_STATUS_CODE: + $exception = new UnauthorizedException($bodyContent->message); + $exception->setRequestParameters($requestParameters); + $exception->setBodyContent($bodyContent); + throw $exception; + case InternalServerErrorException::HTTP_STATUS_CODE: + $exception = new InternalServerErrorException($bodyContent->erros[0]->mensagem); + $exception->setRequestParameters($requestParameters); + $exception->setBodyContent($bodyContent); + throw $exception; + case ServiceUnavailableException::HTTP_STATUS_CODE: + $exception = new ServiceUnavailableException("SERVIÇO INDISPONÍVEL"); + $exception->setRequestParameters($requestParameters); + throw $exception; + default: + throw $e; + } } catch (\Exception $e) { $response = $e->getMessage(); return ['error' => "Falha ao baixar Boleto Cobranca: {$response}"]; } } - public function gerarPixBoleto2(string $id, array $fields){ + public function gerarPixBoleto2(string $id, array $fields) + { $this->headers([ "Authorization" => "Bearer " . $this->token, "accept" => "application/json", "Content-Type" => "application/json", // "X-Developer-Application-Key" => $this->config['application_key'] ]); - $this->fields($fields,'json'); + $this->fields($fields, 'json'); $curl = curl_init("https://api.sandbox.bb.com.br/cobrancas/v2/boletos/00031285570000150024/gerar-pix?gw-dev-app-key=d27be77909ffab001369e17d80050056b9b1a5b0"); - curl_setopt_array($curl,[ + curl_setopt_array($curl, [ CURLOPT_RETURNTRANSFER => true, CURLOPT_MAXREDIRS => 10, CURLOPT_TIMEOUT => 30, @@ -400,7 +613,7 @@ public function gerarPixBoleto2(string $id, array $fields){ CURLOPT_SSL_VERIFYPEER => false, CURLINFO_HEADER_OUT => true ]); - + $gerarPixBoleto = json_decode(curl_exec($curl)); return $gerarPixBoleto; } @@ -420,7 +633,8 @@ public function gerarPixBoleto2(string $id, array $fields){ ###################################################### ############## PAGAMENTOS ############################ ###################################################### - public function pagarBoletoLinha(string $linhaDigitavel){ + public function pagarBoletoLinha(string $linhaDigitavel) + { // $this->headers([ // "accept" => "application/json", // // "Content-Type" => "application/json", @@ -440,12 +654,13 @@ public function pagarBoletoLinha(string $linhaDigitavel){ // CURLOPT_SSL_VERIFYPEER => false, // CURLINFO_HEADER_OUT => true // ]); - - // $pagarBoletoLinha = json_decode(curl_exec($curl)); + + // $pagarBoletoLinha = json_decode(curl_exec($curl)); // return $pagarBoletoLinha; } - public function pagarBoletoPix(string $pix){ + public function pagarBoletoPix(string $pix) + { // $this->headers([ // "Content-Type" => "application/json", // "accept" => "application/json", @@ -467,8 +682,8 @@ public function pagarBoletoPix(string $pix){ // CURLOPT_SSL_VERIFYPEER => false, // CURLINFO_HEADER_OUT => true // ]); - - // $pagarBoletoPix = json_decode(curl_exec($curl)); + + // $pagarBoletoPix = json_decode(curl_exec($curl)); // return $pagarBoletoPix; } ###################################################### @@ -479,7 +694,8 @@ public function pagarBoletoPix(string $pix){ ###################################################### ############## QRCODES ############################### ###################################################### - public function gerarQRCode(string $pix){ + public function gerarQRCode(string $pix) + { // $this->headers([ // "Content-Type" => "application/json", // "accept" => "application/json", @@ -519,12 +735,11 @@ public function gerarQRCode(string $pix){ // CURLOPT_SSL_VERIFYPEER => false, // CURLINFO_HEADER_OUT => true // ]); - - // $gerarQRCode = json_decode(curl_exec($curl)); + + // $gerarQRCode = json_decode(curl_exec($curl)); // return $gerarQRCode; } ###################################################### ############## FIM - QRCODES ######################### ###################################################### - -} \ No newline at end of file +} diff --git a/src/BoletoPDF/HTMLBoletoBB.php b/src/BoletoPDF/HTMLBoletoBB.php index c0012f7..0d02bde 100644 --- a/src/BoletoPDF/HTMLBoletoBB.php +++ b/src/BoletoPDF/HTMLBoletoBB.php @@ -197,48 +197,11 @@