1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
namespace BoletoSimples; |
4
|
|
|
|
5
|
|
|
class BankBillet extends BaseResource { |
6
|
|
|
public function cancel() { |
7
|
|
|
$response = self::sendRequest('PUT', $this->path('cancel')); |
|
|
|
|
8
|
|
|
return $this->parseResponse($response); |
9
|
|
|
} |
10
|
|
|
|
11
|
|
|
public function duplicate($params = array()) { |
12
|
|
|
$response = self::sendRequest('POST', $this->path('duplicate'), ['query' => $params]); |
|
|
|
|
13
|
|
|
return $this->parseResponse($response); |
14
|
|
|
} |
15
|
|
|
|
16
|
|
|
public function pay($params = array()) { |
17
|
|
|
$response = self::sendRequest('PUT', $this->path('pay'), ['query' => $params]); |
|
|
|
|
18
|
|
|
return $this->parseResponse($response); |
19
|
|
|
} |
20
|
|
|
|
21
|
|
View Code Duplication |
public static function cnpj_cpf($cnpj_cpf) { |
|
|
|
|
22
|
|
|
if (!$cnpj_cpf) { |
23
|
|
|
throw new \Exception("Couldn't find ".get_called_class()." without an cnpj or cpf."); |
24
|
|
|
} |
25
|
|
|
$response = self::sendRequest('GET', 'bank_billets/cnpj_cpf', ['query' => ['q' => $cnpj_cpf]]); |
|
|
|
|
26
|
|
|
$collection = []; |
27
|
|
|
foreach ($response->json() as $attributes) { |
28
|
|
|
$collection[] = new BankBillet($attributes); |
29
|
|
|
} |
30
|
|
|
return $collection; |
31
|
|
|
} |
32
|
|
|
|
33
|
|
View Code Duplication |
public static function status($status) { |
|
|
|
|
34
|
|
|
if (!$status) { |
35
|
|
|
throw new \Exception("Couldn't find ".get_called_class()." without an status."); |
36
|
|
|
} |
37
|
|
|
$response = self::sendRequest('GET', 'bank_billets/status', ['query' => ['q' => $status]]); |
|
|
|
|
38
|
|
|
$collection = []; |
39
|
|
|
foreach ($response->json() as $attributes) { |
40
|
|
|
$collection[] = new BankBillet($attributes); |
41
|
|
|
} |
42
|
|
|
return $collection; |
43
|
|
|
} |
44
|
|
|
|
45
|
|
View Code Duplication |
public static function our_number($our_number) { |
|
|
|
|
46
|
|
|
if (!$our_number) { |
47
|
|
|
throw new \Exception("Couldn't find ".get_called_class()." without an our_number."); |
48
|
|
|
} |
49
|
|
|
$response = self::sendRequest('GET', 'bank_billets/our_number', ['query' => ['q' => $our_number]]); |
|
|
|
|
50
|
|
|
$collection = []; |
51
|
|
|
foreach ($response->json() as $attributes) { |
52
|
|
|
$collection[] = new BankBillet($attributes); |
53
|
|
|
} |
54
|
|
|
return $collection; |
55
|
|
|
} |
56
|
|
|
|
57
|
|
|
public static function bulk($params) { |
58
|
|
|
$response = self::sendRequest('POST', 'bank_billets/bulk', ['body' => json_encode(['bank_billets' => $params])]); |
|
|
|
|
59
|
|
|
return $response->json(); |
60
|
|
|
} |
61
|
|
|
} |
This check marks calls to methods that do not seem to exist on an object.
This is most likely the result of a method being renamed without all references to it being renamed likewise.