@@ -73,7 +73,7 @@ discard block |
||
| 73 | 73 | $dadosCliente = $this->setCliente($dadosCliente); |
| 74 | 74 | if(!empty($dadosCliente['error'])){ |
| 75 | 75 | return $dadosCliente; |
| 76 | - }else { |
|
| 76 | + } else { |
|
| 77 | 77 | return $this->http->post('/customers', $dadosCliente); |
| 78 | 78 | } |
| 79 | 79 | } |
@@ -83,7 +83,7 @@ discard block |
||
| 83 | 83 | $dadosCliente = $this->setCliente($dadosCliente); |
| 84 | 84 | if(!empty($dadosCliente['error'])){ |
| 85 | 85 | return $dadosCliente; |
| 86 | - }else { |
|
| 86 | + } else { |
|
| 87 | 87 | return $this->http->post('/customers/' . $id, $dadosCliente); |
| 88 | 88 | } |
| 89 | 89 | } |
@@ -53,58 +53,58 @@ discard block |
||
| 53 | 53 | } |
| 54 | 54 | |
| 55 | 55 | // Retorna a listagem de clientes |
| 56 | - public function getAll($filtros = false){ |
|
| 56 | + public function getAll($filtros = false) { |
|
| 57 | 57 | $filtro = ''; |
| 58 | - if(is_array($filtros)){ |
|
| 59 | - if($filtros){ |
|
| 60 | - foreach($filtros as $key => $f){ |
|
| 61 | - if(!empty($f)){ |
|
| 62 | - if($filtro){ |
|
| 58 | + if (is_array($filtros)) { |
|
| 59 | + if ($filtros) { |
|
| 60 | + foreach ($filtros as $key => $f) { |
|
| 61 | + if (!empty($f)) { |
|
| 62 | + if ($filtro) { |
|
| 63 | 63 | $filtro .= '&'; |
| 64 | 64 | } |
| 65 | - $filtro .= $key.'='.$f; |
|
| 65 | + $filtro .= $key . '=' . $f; |
|
| 66 | 66 | } |
| 67 | 67 | } |
| 68 | - $filtro = '?'.$filtro; |
|
| 68 | + $filtro = '?' . $filtro; |
|
| 69 | 69 | } |
| 70 | 70 | } |
| 71 | - return $this->http->get('/customers'.$filtro); |
|
| 71 | + return $this->http->get('/customers' . $filtro); |
|
| 72 | 72 | } |
| 73 | 73 | |
| 74 | 74 | // Retorna os dados do cliente de acordo com o Id |
| 75 | - public function getById($id){ |
|
| 76 | - return $this->http->get('/customers/'.$id); |
|
| 75 | + public function getById($id) { |
|
| 76 | + return $this->http->get('/customers/' . $id); |
|
| 77 | 77 | } |
| 78 | 78 | |
| 79 | 79 | // Retorna os dados do cliente de acordo com o Email |
| 80 | - public function getByEmail($email){ |
|
| 80 | + public function getByEmail($email) { |
|
| 81 | 81 | $option = 'limit=1&email=' . $email; |
| 82 | 82 | return $this->http->get('/customers', $option); |
| 83 | 83 | } |
| 84 | 84 | |
| 85 | 85 | // Insere um novo cliente |
| 86 | - public function create(array $dadosCliente){ |
|
| 86 | + public function create(array $dadosCliente) { |
|
| 87 | 87 | $dadosCliente = $this->setCliente($dadosCliente); |
| 88 | - if(!empty($dadosCliente['error'])){ |
|
| 88 | + if (!empty($dadosCliente['error'])) { |
|
| 89 | 89 | return $dadosCliente; |
| 90 | - }else { |
|
| 90 | + } else { |
|
| 91 | 91 | return $this->http->post('/customers', $dadosCliente); |
| 92 | 92 | } |
| 93 | 93 | } |
| 94 | 94 | |
| 95 | 95 | // Atualiza os dados do cliente |
| 96 | - public function update($id, array $dadosCliente){ |
|
| 96 | + public function update($id, array $dadosCliente) { |
|
| 97 | 97 | $dadosCliente = $this->setCliente($dadosCliente); |
| 98 | - if(!empty($dadosCliente['error'])){ |
|
| 98 | + if (!empty($dadosCliente['error'])) { |
|
| 99 | 99 | return $dadosCliente; |
| 100 | - }else { |
|
| 100 | + } else { |
|
| 101 | 101 | return $this->http->post('/customers/' . $id, $dadosCliente); |
| 102 | 102 | } |
| 103 | 103 | } |
| 104 | 104 | |
| 105 | 105 | // Deleta uma cliente |
| 106 | - public function delete($id){ |
|
| 107 | - return $this->http->get('/customers/'.$id,'','DELETE'); |
|
| 106 | + public function delete($id) { |
|
| 107 | + return $this->http->get('/customers/' . $id, '', 'DELETE'); |
|
| 108 | 108 | } |
| 109 | 109 | |
| 110 | 110 | |
@@ -139,7 +139,7 @@ discard block |
||
| 139 | 139 | public function setCliente($cliente) |
| 140 | 140 | { |
| 141 | 141 | try { |
| 142 | - if ( ! $this->cliente_valid($cliente) ) { |
|
| 142 | + if (!$this->cliente_valid($cliente)) { |
|
| 143 | 143 | return ClienteException::invalidClient(); |
| 144 | 144 | } |
| 145 | 145 | |
@@ -175,6 +175,6 @@ discard block |
||
| 175 | 175 | */ |
| 176 | 176 | public function cliente_valid($cliente) |
| 177 | 177 | { |
| 178 | - return ! ( (empty($cliente['name']) OR empty($cliente['cpfCnpj']) OR empty($cliente['email'])) ? 1 : '' ); |
|
| 178 | + return !((empty($cliente['name']) OR empty($cliente['cpfCnpj']) OR empty($cliente['email'])) ? 1 : ''); |
|
| 179 | 179 | } |
| 180 | 180 | } |
| 181 | 181 | \ No newline at end of file |
@@ -52,7 +52,7 @@ |
||
| 52 | 52 | $dadosCobranca = $this->setCobranca($dadosCobranca); |
| 53 | 53 | if(!empty($dadosCobranca['error'])){ |
| 54 | 54 | return $dadosCobranca; |
| 55 | - }else { |
|
| 55 | + } else { |
|
| 56 | 56 | return $this->http->post('/payments', $dadosCobranca); |
| 57 | 57 | } |
| 58 | 58 | } |
@@ -14,78 +14,78 @@ discard block |
||
| 14 | 14 | } |
| 15 | 15 | |
| 16 | 16 | // Retorna a listagem de cobranças |
| 17 | - public function getAll(array $filtros){ |
|
| 17 | + public function getAll(array $filtros) { |
|
| 18 | 18 | $filtro = ''; |
| 19 | - if(is_array($filtros)){ |
|
| 20 | - if($filtros){ |
|
| 21 | - foreach($filtros as $key => $f){ |
|
| 22 | - if(!empty($f)){ |
|
| 23 | - if($filtro){ |
|
| 19 | + if (is_array($filtros)) { |
|
| 20 | + if ($filtros) { |
|
| 21 | + foreach ($filtros as $key => $f) { |
|
| 22 | + if (!empty($f)) { |
|
| 23 | + if ($filtro) { |
|
| 24 | 24 | $filtro .= '&'; |
| 25 | 25 | } |
| 26 | - $filtro .= $key.'='.$f; |
|
| 26 | + $filtro .= $key . '=' . $f; |
|
| 27 | 27 | } |
| 28 | 28 | } |
| 29 | - $filtro = '?'.$filtro; |
|
| 29 | + $filtro = '?' . $filtro; |
|
| 30 | 30 | } |
| 31 | 31 | } |
| 32 | - return $this->http->get('/payments'.$filtro); |
|
| 32 | + return $this->http->get('/payments' . $filtro); |
|
| 33 | 33 | } |
| 34 | 34 | |
| 35 | 35 | // Retorna os dados da cobrança de acordo com o Id |
| 36 | - public function getById($id){ |
|
| 37 | - return $this->http->get('/payments/'.$id); |
|
| 36 | + public function getById($id) { |
|
| 37 | + return $this->http->get('/payments/' . $id); |
|
| 38 | 38 | } |
| 39 | 39 | |
| 40 | 40 | // Retorna a listagem de cobranças de acordo com o Id do Cliente |
| 41 | - public function getByCustomer($customer_id){ |
|
| 42 | - return $this->http->get('/payments?customer='.$customer_id); |
|
| 41 | + public function getByCustomer($customer_id) { |
|
| 42 | + return $this->http->get('/payments?customer=' . $customer_id); |
|
| 43 | 43 | } |
| 44 | 44 | |
| 45 | 45 | // Retorna a listagem de cobranças de acordo com o Id da Assinaturas |
| 46 | - public function getBySubscription($subscription_id){ |
|
| 47 | - return $this->http->get('/payments?subscription='.$subscription_id); |
|
| 46 | + public function getBySubscription($subscription_id) { |
|
| 47 | + return $this->http->get('/payments?subscription=' . $subscription_id); |
|
| 48 | 48 | } |
| 49 | 49 | |
| 50 | 50 | // Insere uma nova cobrança |
| 51 | - public function create(array $dadosCobranca){ |
|
| 51 | + public function create(array $dadosCobranca) { |
|
| 52 | 52 | $dadosCobranca = $this->setCobranca($dadosCobranca); |
| 53 | - if(!empty($dadosCobranca['error'])){ |
|
| 53 | + if (!empty($dadosCobranca['error'])) { |
|
| 54 | 54 | return $dadosCobranca; |
| 55 | - }else { |
|
| 55 | + } else { |
|
| 56 | 56 | return $this->http->post('/payments', $dadosCobranca); |
| 57 | 57 | } |
| 58 | 58 | } |
| 59 | 59 | |
| 60 | 60 | // Insere uma nova cobrança parcelada |
| 61 | - public function parcelada(array $dadosCobranca){ |
|
| 61 | + public function parcelada(array $dadosCobranca) { |
|
| 62 | 62 | |
| 63 | 63 | } |
| 64 | 64 | |
| 65 | 65 | // Insere uma nova cobrança com split |
| 66 | 66 | /* Saldo dividido em multiplas contas do Asaas*/ |
| 67 | - public function split(array $dadosCobranca){ |
|
| 67 | + public function split(array $dadosCobranca) { |
|
| 68 | 68 | |
| 69 | 69 | } |
| 70 | 70 | |
| 71 | 71 | // Atualiza os dados da cobrança |
| 72 | - public function update($id, array $dadosCobranca){ |
|
| 72 | + public function update($id, array $dadosCobranca) { |
|
| 73 | 73 | |
| 74 | 74 | return $this->http->post('/payments/' . $id, $dadosCobranca); |
| 75 | 75 | } |
| 76 | 76 | |
| 77 | 77 | // Restaura cobrança removida |
| 78 | - public function restore($id){ |
|
| 78 | + public function restore($id) { |
|
| 79 | 79 | |
| 80 | 80 | } |
| 81 | 81 | |
| 82 | 82 | // Estorna cobrança |
| 83 | - public function estorno($id){ |
|
| 83 | + public function estorno($id) { |
|
| 84 | 84 | |
| 85 | 85 | } |
| 86 | 86 | |
| 87 | 87 | // Confirmação em dinheiro |
| 88 | - public function confirmacao($id, $dados){ |
|
| 88 | + public function confirmacao($id, $dados) { |
|
| 89 | 89 | $data = array( |
| 90 | 90 | "paymentDate" => "2019-09-03", |
| 91 | 91 | "value" => 100.00, |
@@ -94,8 +94,8 @@ discard block |
||
| 94 | 94 | } |
| 95 | 95 | |
| 96 | 96 | // Deleta uma cobrança |
| 97 | - public function delete($id){ |
|
| 98 | - return $this->http->get('/payments/'.$id,'','DELETE'); |
|
| 97 | + public function delete($id) { |
|
| 98 | + return $this->http->get('/payments/' . $id, '', 'DELETE'); |
|
| 99 | 99 | } |
| 100 | 100 | |
| 101 | 101 | /** |
@@ -13,9 +13,9 @@ |
||
| 13 | 13 | |
| 14 | 14 | if($status == 'producao'){ |
| 15 | 15 | $this->api_status = false; |
| 16 | - }elseif($status == 'homologacao'){ |
|
| 16 | + } elseif($status == 'homologacao'){ |
|
| 17 | 17 | $this->api_status = 1; |
| 18 | - }else{ |
|
| 18 | + } else{ |
|
| 19 | 19 | die('Tipo de homologação invalida'); |
| 20 | 20 | } |
| 21 | 21 | $this->api_key = $token; |
@@ -11,11 +11,11 @@ discard block |
||
| 11 | 11 | |
| 12 | 12 | public function __construct($token, $status) { |
| 13 | 13 | |
| 14 | - if($status == 'producao'){ |
|
| 14 | + if ($status == 'producao') { |
|
| 15 | 15 | $this->api_status = false; |
| 16 | - }elseif($status == 'homologacao'){ |
|
| 16 | + }elseif ($status == 'homologacao') { |
|
| 17 | 17 | $this->api_status = 1; |
| 18 | - }else{ |
|
| 18 | + } else { |
|
| 19 | 19 | die('Tipo de homologação invalida'); |
| 20 | 20 | } |
| 21 | 21 | $this->api_key = $token; |
@@ -26,21 +26,21 @@ discard block |
||
| 26 | 26 | } |
| 27 | 27 | |
| 28 | 28 | |
| 29 | - public function get($url, $option = false, $custom = false ) |
|
| 29 | + public function get($url, $option = false, $custom = false) |
|
| 30 | 30 | { |
| 31 | 31 | |
| 32 | 32 | $ch = curl_init(); |
| 33 | - curl_setopt($ch, CURLOPT_URL, $this->base_url .'.asaas.com/api/v3'. $url.$option); |
|
| 33 | + curl_setopt($ch, CURLOPT_URL, $this->base_url . '.asaas.com/api/v3' . $url . $option); |
|
| 34 | 34 | curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE); |
| 35 | 35 | curl_setopt($ch, CURLOPT_HEADER, FALSE); |
| 36 | 36 | |
| 37 | - if(!empty($custom)){ |
|
| 37 | + if (!empty($custom)) { |
|
| 38 | 38 | curl_setopt($ch, CURLOPT_CUSTOMREQUEST, $custom); |
| 39 | 39 | } |
| 40 | 40 | |
| 41 | 41 | curl_setopt($ch, CURLOPT_HTTPHEADER, array( |
| 42 | 42 | "Content-Type: application/json", |
| 43 | - "access_token: ".$this->api_key |
|
| 43 | + "access_token: " . $this->api_key |
|
| 44 | 44 | )); |
| 45 | 45 | |
| 46 | 46 | $response = curl_exec($ch); |
@@ -57,7 +57,7 @@ discard block |
||
| 57 | 57 | $params = json_encode($params); |
| 58 | 58 | $ch = curl_init(); |
| 59 | 59 | |
| 60 | - curl_setopt($ch, CURLOPT_URL, $this->base_url .'.asaas.com/api/v3'. $url); |
|
| 60 | + curl_setopt($ch, CURLOPT_URL, $this->base_url . '.asaas.com/api/v3' . $url); |
|
| 61 | 61 | curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE); |
| 62 | 62 | curl_setopt($ch, CURLOPT_HEADER, FALSE); |
| 63 | 63 | |
@@ -67,7 +67,7 @@ discard block |
||
| 67 | 67 | |
| 68 | 68 | curl_setopt($ch, CURLOPT_HTTPHEADER, array( |
| 69 | 69 | "Content-Type: application/json", |
| 70 | - "access_token: ".$this->api_key |
|
| 70 | + "access_token: " . $this->api_key |
|
| 71 | 71 | )); |
| 72 | 72 | |
| 73 | 73 | $response = curl_exec($ch); |
@@ -13,35 +13,35 @@ |
||
| 13 | 13 | } |
| 14 | 14 | |
| 15 | 15 | |
| 16 | - public function getAll($parametos = false){ |
|
| 16 | + public function getAll($parametos = false) { |
|
| 17 | 17 | $filtro = ''; |
| 18 | - if(is_array($parametos)){ |
|
| 19 | - if($parametos){ |
|
| 20 | - foreach($parametos as $key => $f){ |
|
| 21 | - if(!empty($f)){ |
|
| 22 | - if($filtro){ |
|
| 18 | + if (is_array($parametos)) { |
|
| 19 | + if ($parametos) { |
|
| 20 | + foreach ($parametos as $key => $f) { |
|
| 21 | + if (!empty($f)) { |
|
| 22 | + if ($filtro) { |
|
| 23 | 23 | $filtro .= '&'; |
| 24 | 24 | } |
| 25 | - $filtro .= $key.'='.$f; |
|
| 25 | + $filtro .= $key . '=' . $f; |
|
| 26 | 26 | } |
| 27 | 27 | } |
| 28 | - $filtro = '?'.$filtro; |
|
| 28 | + $filtro = '?' . $filtro; |
|
| 29 | 29 | } |
| 30 | 30 | } |
| 31 | - return $this->http->get('/transfers/'.$filtro); |
|
| 31 | + return $this->http->get('/transfers/' . $filtro); |
|
| 32 | 32 | //https://www.asaas.com/api/v3/subscriptions/id/invoices?offset=&limit=&status= |
| 33 | 33 | } |
| 34 | 34 | |
| 35 | - public function consultaSaldo(){ |
|
| 35 | + public function consultaSaldo() { |
|
| 36 | 36 | return $this->http->get('/finance/getCurrentBalance'); |
| 37 | 37 | } |
| 38 | 38 | |
| 39 | - public function consultaWalletId(){ |
|
| 39 | + public function consultaWalletId() { |
|
| 40 | 40 | return $this->http->get('/wallets'); |
| 41 | 41 | } |
| 42 | 42 | |
| 43 | 43 | |
| 44 | - public function conta($dadosConta){ |
|
| 44 | + public function conta($dadosConta) { |
|
| 45 | 45 | return $this->http->post('/transfers', $dadosConta); |
| 46 | 46 | } |
| 47 | 47 | } |
@@ -14,47 +14,47 @@ |
||
| 14 | 14 | } |
| 15 | 15 | |
| 16 | 16 | // Retorna a listagem de notificações |
| 17 | - public function getAll(array $filtros){ |
|
| 17 | + public function getAll(array $filtros) { |
|
| 18 | 18 | $filtro = ''; |
| 19 | - if(is_array($filtros)){ |
|
| 20 | - if($filtros){ |
|
| 21 | - foreach($filtros as $key => $f){ |
|
| 22 | - if(!empty($f)){ |
|
| 23 | - if($filtro){ |
|
| 19 | + if (is_array($filtros)) { |
|
| 20 | + if ($filtros) { |
|
| 21 | + foreach ($filtros as $key => $f) { |
|
| 22 | + if (!empty($f)) { |
|
| 23 | + if ($filtro) { |
|
| 24 | 24 | $filtro .= '&'; |
| 25 | 25 | } |
| 26 | - $filtro .= $key.'='.$f; |
|
| 26 | + $filtro .= $key . '=' . $f; |
|
| 27 | 27 | } |
| 28 | 28 | } |
| 29 | - $filtro = '?'.$filtro; |
|
| 29 | + $filtro = '?' . $filtro; |
|
| 30 | 30 | } |
| 31 | 31 | } |
| 32 | - return $this->http->get('/notifications'.$filtro); |
|
| 32 | + return $this->http->get('/notifications' . $filtro); |
|
| 33 | 33 | } |
| 34 | 34 | |
| 35 | 35 | // Retorna os dados da notificação de acordo com o Id |
| 36 | - public function getById($id){ |
|
| 37 | - return $this->http->get('/notifications/'.$id); |
|
| 36 | + public function getById($id) { |
|
| 37 | + return $this->http->get('/notifications/' . $id); |
|
| 38 | 38 | } |
| 39 | 39 | |
| 40 | 40 | // Retorna a listagem de notificações de acordo com o Id do Cliente |
| 41 | - public function getByCustomer($customer_id){ |
|
| 42 | - return $this->http->get('/customers/'.$id.'/notifications'); |
|
| 41 | + public function getByCustomer($customer_id) { |
|
| 42 | + return $this->http->get('/customers/' . $id . '/notifications'); |
|
| 43 | 43 | } |
| 44 | 44 | |
| 45 | 45 | // Insere uma nova notificação |
| 46 | - public function create(array $dadosNotificacao){ |
|
| 46 | + public function create(array $dadosNotificacao) { |
|
| 47 | 47 | return $this->http->post('/notifications', $dadosNotificacao); |
| 48 | 48 | } |
| 49 | 49 | |
| 50 | 50 | // Atualiza os dados da notificação |
| 51 | - public function update($id, array $dadosNotificacao){ |
|
| 51 | + public function update($id, array $dadosNotificacao) { |
|
| 52 | 52 | return $this->http->post('/notifications', $dadosNotificacao); |
| 53 | 53 | } |
| 54 | 54 | |
| 55 | 55 | // Deleta uma notificação |
| 56 | - public function delete($id){ |
|
| 57 | - return $this->http->get('/notifications/'.$id,'','DELETE'); |
|
| 56 | + public function delete($id) { |
|
| 57 | + return $this->http->get('/notifications/' . $id, '', 'DELETE'); |
|
| 58 | 58 | } |
| 59 | 59 | |
| 60 | 60 | } |
@@ -13,27 +13,27 @@ |
||
| 13 | 13 | } |
| 14 | 14 | |
| 15 | 15 | // Retorna a listagem de cobranças |
| 16 | - public function getAll(array $filtros){ |
|
| 16 | + public function getAll(array $filtros) { |
|
| 17 | 17 | $filtro = ''; |
| 18 | - if(is_array($filtros)){ |
|
| 19 | - if($filtros){ |
|
| 20 | - foreach($filtros as $key => $f){ |
|
| 21 | - if(!empty($f)){ |
|
| 22 | - if($filtro){ |
|
| 18 | + if (is_array($filtros)) { |
|
| 19 | + if ($filtros) { |
|
| 20 | + foreach ($filtros as $key => $f) { |
|
| 21 | + if (!empty($f)) { |
|
| 22 | + if ($filtro) { |
|
| 23 | 23 | $filtro .= '&'; |
| 24 | 24 | } |
| 25 | - $filtro .= $key.'='.$f; |
|
| 25 | + $filtro .= $key . '=' . $f; |
|
| 26 | 26 | } |
| 27 | 27 | } |
| 28 | - $filtro = '?'.$filtro; |
|
| 28 | + $filtro = '?' . $filtro; |
|
| 29 | 29 | } |
| 30 | 30 | } |
| 31 | - return $this->http->get('/cities'.$filtro); |
|
| 31 | + return $this->http->get('/cities' . $filtro); |
|
| 32 | 32 | } |
| 33 | 33 | |
| 34 | 34 | // Retorna os dados da cobrança de acordo com o Id |
| 35 | - public function getById($id){ |
|
| 36 | - return $this->http->get('/cities/'.$id); |
|
| 35 | + public function getById($id) { |
|
| 36 | + return $this->http->get('/cities/' . $id); |
|
| 37 | 37 | } |
| 38 | 38 | |
| 39 | 39 | } |
@@ -13,100 +13,100 @@ |
||
| 13 | 13 | } |
| 14 | 14 | |
| 15 | 15 | // Retorna a listagem de assinaturas |
| 16 | - public function getAll(array $filtros){ |
|
| 16 | + public function getAll(array $filtros) { |
|
| 17 | 17 | $filtro = ''; |
| 18 | - if(is_array($filtros)){ |
|
| 19 | - if($filtros){ |
|
| 20 | - foreach($filtros as $key => $f){ |
|
| 21 | - if(!empty($f)){ |
|
| 22 | - if($filtro){ |
|
| 18 | + if (is_array($filtros)) { |
|
| 19 | + if ($filtros) { |
|
| 20 | + foreach ($filtros as $key => $f) { |
|
| 21 | + if (!empty($f)) { |
|
| 22 | + if ($filtro) { |
|
| 23 | 23 | $filtro .= '&'; |
| 24 | 24 | } |
| 25 | - $filtro .= $key.'='.$f; |
|
| 25 | + $filtro .= $key . '=' . $f; |
|
| 26 | 26 | } |
| 27 | 27 | } |
| 28 | - $filtro = '?'.$filtro; |
|
| 28 | + $filtro = '?' . $filtro; |
|
| 29 | 29 | } |
| 30 | 30 | } |
| 31 | - return $this->http->get('/subscriptions'.$filtro); |
|
| 31 | + return $this->http->get('/subscriptions' . $filtro); |
|
| 32 | 32 | |
| 33 | 33 | } |
| 34 | 34 | |
| 35 | 35 | // Retorna os dados da assinatura de acordo com o Id |
| 36 | - public function getById($id){ |
|
| 37 | - return $this->http->get('/subscriptions/'.$id); |
|
| 36 | + public function getById($id) { |
|
| 37 | + return $this->http->get('/subscriptions/' . $id); |
|
| 38 | 38 | |
| 39 | 39 | } |
| 40 | 40 | |
| 41 | 41 | // Retorna a listagem de assinaturas de acordo com o Id do Cliente |
| 42 | - public function getByCustomer($customer_id){ |
|
| 43 | - return $this->http->get('/subscriptions?customer='.$customer_id); |
|
| 42 | + public function getByCustomer($customer_id) { |
|
| 43 | + return $this->http->get('/subscriptions?customer=' . $customer_id); |
|
| 44 | 44 | } |
| 45 | 45 | |
| 46 | 46 | |
| 47 | 47 | // Retorna a listagem de todos os pagamentos da assinatura |
| 48 | - public function getByPayment($subscription_id){ |
|
| 49 | - return $this->http->get('/subscriptions/'.$subscription_id.'/payments'); |
|
| 48 | + public function getByPayment($subscription_id) { |
|
| 49 | + return $this->http->get('/subscriptions/' . $subscription_id . '/payments'); |
|
| 50 | 50 | } |
| 51 | 51 | |
| 52 | 52 | // Insere uma nova assinatura |
| 53 | 53 | |
| 54 | - public function create(array $dadosAssinatura){ |
|
| 54 | + public function create(array $dadosAssinatura) { |
|
| 55 | 55 | return $this->http->post('/subscriptions', $dadosAssinatura); |
| 56 | 56 | } |
| 57 | 57 | |
| 58 | 58 | // Atualiza os dados da assinatura |
| 59 | - public function update($id, array $dadosAssinatura){ |
|
| 59 | + public function update($id, array $dadosAssinatura) { |
|
| 60 | 60 | |
| 61 | 61 | return $this->http->post('/subscriptions/' . $id, $dadosAssinatura); |
| 62 | 62 | } |
| 63 | 63 | |
| 64 | - public function getNotaFiscal($id, array $parametos){ |
|
| 64 | + public function getNotaFiscal($id, array $parametos) { |
|
| 65 | 65 | $filtro = ''; |
| 66 | - if(is_array($parametos)){ |
|
| 67 | - if($parametos){ |
|
| 68 | - foreach($parametos as $key => $f){ |
|
| 69 | - if(!empty($f)){ |
|
| 70 | - if($filtro){ |
|
| 66 | + if (is_array($parametos)) { |
|
| 67 | + if ($parametos) { |
|
| 68 | + foreach ($parametos as $key => $f) { |
|
| 69 | + if (!empty($f)) { |
|
| 70 | + if ($filtro) { |
|
| 71 | 71 | $filtro .= '&'; |
| 72 | 72 | } |
| 73 | - $filtro .= $key.'='.$f; |
|
| 73 | + $filtro .= $key . '=' . $f; |
|
| 74 | 74 | } |
| 75 | 75 | } |
| 76 | - $filtro = '?'.$filtro; |
|
| 76 | + $filtro = '?' . $filtro; |
|
| 77 | 77 | } |
| 78 | 78 | } |
| 79 | - return $this->http->get('/subscriptions/'.$id.$filtro); |
|
| 79 | + return $this->http->get('/subscriptions/' . $id . $filtro); |
|
| 80 | 80 | //https://www.asaas.com/api/v3/subscriptions/id/invoices?offset=&limit=&status= |
| 81 | 81 | } |
| 82 | 82 | |
| 83 | - public function createNotaFiscal($subscription_id, $dadosAssinatura){ |
|
| 83 | + public function createNotaFiscal($subscription_id, $dadosAssinatura) { |
|
| 84 | 84 | |
| 85 | 85 | return $this->http->post('/subscriptions', $dadosAssinatura); |
| 86 | 86 | //https://www.asaas.com/api/v3/subscriptions/id/invoiceSettings |
| 87 | 87 | } |
| 88 | 88 | |
| 89 | 89 | // Atualiza Nota Fiscal da assinatura |
| 90 | - public function updateNotaFiscal($subscription_id, $dadosAssinatura){ |
|
| 90 | + public function updateNotaFiscal($subscription_id, $dadosAssinatura) { |
|
| 91 | 91 | |
| 92 | 92 | return $this->http->post('/subscriptions', $dadosAssinatura); |
| 93 | 93 | //https://www.asaas.com/api/v3/subscriptions/id/invoiceSettings |
| 94 | 94 | } |
| 95 | 95 | |
| 96 | 96 | // Recuperar configuração para emissão de Notas Fiscais |
| 97 | - public function getConfigNotaFiscal($subscription_id){ |
|
| 98 | - return $this->http->get('/subscriptions/'.$subscription_id.'/invoiceSettings'); |
|
| 97 | + public function getConfigNotaFiscal($subscription_id) { |
|
| 98 | + return $this->http->get('/subscriptions/' . $subscription_id . '/invoiceSettings'); |
|
| 99 | 99 | //https://www.asaas.com/api/v3/subscriptions/id/invoiceSettings |
| 100 | 100 | } |
| 101 | 101 | |
| 102 | 102 | // Deleta configuração para emissão de Notas Fiscais |
| 103 | - public function deleteConfigNotaFiscal($id){ |
|
| 104 | - return $this->http->get('/subscriptions/'.$subscription_id.'/invoiceSettings','','DELETE'); |
|
| 103 | + public function deleteConfigNotaFiscal($id) { |
|
| 104 | + return $this->http->get('/subscriptions/' . $subscription_id . '/invoiceSettings', '', 'DELETE'); |
|
| 105 | 105 | } |
| 106 | 106 | |
| 107 | 107 | // Deleta uma assinatura |
| 108 | - public function delete($id){ |
|
| 109 | - return $this->http->get('/subscriptions/'.$id,'','DELETE'); |
|
| 108 | + public function delete($id) { |
|
| 109 | + return $this->http->get('/subscriptions/' . $id, '', 'DELETE'); |
|
| 110 | 110 | } |
| 111 | 111 | |
| 112 | 112 | } |