1 | <?php |
||
2 | |||
3 | namespace WagnerMontanini\ApiNfeFasa; |
||
4 | |||
5 | |||
6 | /** |
||
7 | * Class StateTaxes |
||
8 | * @package WagnerMontanini\ApiNfeFasa |
||
9 | */ |
||
10 | class StateTaxes extends ApiNfeFasa |
||
11 | { |
||
12 | /** @var array */ |
||
13 | private $headers; |
||
0 ignored issues
–
show
introduced
by
![]() |
|||
14 | |||
15 | /** |
||
16 | * StateTaxes constructor. |
||
17 | * @param string $apiUrl |
||
18 | * @param string $token |
||
19 | * @param string $company_id |
||
20 | */ |
||
21 | public function __construct(string $apiUrl, string $token, string $company_id) |
||
22 | { |
||
23 | parent::__construct($apiUrl, $token); |
||
24 | $this->company = $company_id; |
||
0 ignored issues
–
show
|
|||
25 | } |
||
26 | |||
27 | /** |
||
28 | * @param array|null $headers |
||
29 | * @return StateTaxes |
||
30 | */ |
||
31 | public function index(?array $headers): StateTaxes |
||
32 | { |
||
33 | $this->request( |
||
34 | "GET", |
||
35 | "/companies/{$this->company}/statetaxes", |
||
36 | null, |
||
37 | $headers |
||
38 | ); |
||
39 | |||
40 | return $this; |
||
41 | } |
||
42 | |||
43 | /** |
||
44 | * @param array $fields |
||
45 | * @return StateTaxes |
||
46 | */ |
||
47 | public function create(array $fields): StateTaxes |
||
48 | { |
||
49 | $this->request( |
||
50 | "POST", |
||
51 | "/companies/{$this->company}/statetaxes", |
||
52 | $fields |
||
53 | ); |
||
54 | |||
55 | return $this; |
||
56 | } |
||
57 | |||
58 | /** |
||
59 | * @param string $statetax_id |
||
60 | * @return StateTaxes |
||
61 | */ |
||
62 | public function read(string $statetax_id): StateTaxes |
||
63 | { |
||
64 | $this->request( |
||
65 | "GET", |
||
66 | "/companies/{$this->company}/statetaxes/{$statetax_id}" |
||
67 | ); |
||
68 | |||
69 | return $this; |
||
70 | } |
||
71 | |||
72 | /** |
||
73 | * @param string $statetax_id |
||
74 | * @param array $fields |
||
75 | * @return StateTaxes |
||
76 | */ |
||
77 | public function update(string $statetax_id, array $fields): StateTaxes |
||
78 | { |
||
79 | $this->request( |
||
80 | "PUT", |
||
81 | "/companies/{$this->company}/statetaxes/{$statetax_id}", |
||
82 | $fields |
||
83 | ); |
||
84 | |||
85 | return $this; |
||
86 | } |
||
87 | |||
88 | /** |
||
89 | * @param string $statetax_id |
||
90 | * @return StateTaxes |
||
91 | */ |
||
92 | public function delete(string $statetax_id): StateTaxes |
||
93 | { |
||
94 | $this->request( |
||
95 | "DELETE", |
||
96 | "/companies/{$this->company}/statetaxes/{$statetax_id}" |
||
97 | ); |
||
98 | |||
99 | return $this; |
||
100 | } |
||
101 | } |