@@ -39,9 +39,7 @@ public function __construct()
39
39
*/
40
40
public function cancelInvoice (int $ id ): self
41
41
{
42
- $ methodName = $ this ->setMethodName ('cancel ' , true );
43
-
44
- $ this ->response = $ this ->api ->$ methodName ($ id );
42
+ $ this ->createResponse ('cancel ' , [$ id ], true );
45
43
46
44
return $ this ;
47
45
}
@@ -55,9 +53,7 @@ public function cancelInvoice(int $id): self
55
53
*/
56
54
public function checkTaxNumber (string $ taxNumber ): self
57
55
{
58
- $ methodName = $ this ->setMethodName ('checkTaxNumber ' );
59
-
60
- $ this ->response = $ this ->api ->$ methodName ($ taxNumber );
56
+ $ this ->createResponse ('checkTaxNumber ' , [$ taxNumber ]);
61
57
62
58
return $ this ;
63
59
}
@@ -70,9 +66,7 @@ public function checkTaxNumber(string $taxNumber): self
70
66
*/
71
67
public function create (): self
72
68
{
73
- $ methodName = $ this ->setMethodName ('create ' , true );
74
-
75
- $ this ->response = $ this ->api ->$ methodName ($ this ->model );
69
+ $ this ->createResponse ('create ' , [$ this ->model ], true );
76
70
77
71
return $ this ;
78
72
}
@@ -86,9 +80,7 @@ public function create(): self
86
80
*/
87
81
public function createInvoiceFromProforma (int $ id ): self
88
82
{
89
- $ methodName = $ this ->setMethodName ('createDocumentFromProforma ' );
90
-
91
- $ this ->response = $ this ->api ->$ methodName ($ id );
83
+ $ this ->createResponse ('createDocumentFromProforma ' , [$ id ]);
92
84
93
85
return $ this ;
94
86
}
@@ -102,16 +94,14 @@ public function createInvoiceFromProforma(int $id): self
102
94
*/
103
95
public function downloadInvoice (int $ id , string $ path = null , string $ extension = null ): self
104
96
{
105
- $ methodName = $ this ->setMethodName ('download ' , true );
106
-
107
97
$ filename = $ id . ($ extension ?? $ this ->extension );
108
98
109
99
Storage::put (
110
100
($ path ?? $ this ->downloadPath ) . $ filename ,
111
- $ this ->api -> $ methodName ( $ id )
101
+ $ this ->createResponse ( ' download ' , [ $ id], true , true )
112
102
);
113
103
114
- $ this ->response ['path ' ] = ($ path ?? $ this ->downloadPath ) . $ filename ;
104
+ $ this ->response = ['path ' => ($ path ?? $ this ->downloadPath ) . $ filename] ;
115
105
116
106
return $ this ;
117
107
}
@@ -125,9 +115,7 @@ public function downloadInvoice(int $id, string $path = null, string $extension
125
115
*/
126
116
public function getPublicUrl (int $ id ): self
127
117
{
128
- $ methodName = $ this ->setMethodName ('getPublicUrl ' );
129
-
130
- $ this ->response = $ this ->api ->$ methodName ($ id );
118
+ $ this ->createResponse ('getPublicUrl ' , [$ id ]);
131
119
132
120
return $ this ;
133
121
}
@@ -141,21 +129,23 @@ public function getPublicUrl(int $id): self
141
129
*/
142
130
public function list (array $ conditions ): self
143
131
{
144
- $ methodName = $ this ->setMethodName ('list ' , true );
145
-
146
- $ this ->response = $ this ->api ->$ methodName (
147
- $ conditions ['page ' ] ?? null ,
148
- $ conditions ['per_page ' ] ?? 25 ,
149
- $ conditions ['block_id ' ] ?? null ,
150
- $ conditions ['partner_id ' ] ?? null ,
151
- $ conditions ['payment_method ' ] ?? null ,
152
- $ conditions ['payment_status ' ] ?? null ,
153
- $ conditions ['start_date ' ] ?? null ,
154
- $ conditions ['end_date ' ] ?? null ,
155
- $ conditions ['start_number ' ] ?? null ,
156
- $ conditions ['end_number ' ] ?? null ,
157
- $ conditions ['start_year ' ] ?? null ,
158
- $ conditions ['end_year ' ] ?? null
132
+ $ this ->createResponse (
133
+ 'list ' ,
134
+ [
135
+ $ conditions ['page ' ] ?? null ,
136
+ $ conditions ['per_page ' ] ?? 25 ,
137
+ $ conditions ['block_id ' ] ?? null ,
138
+ $ conditions ['partner_id ' ] ?? null ,
139
+ $ conditions ['payment_method ' ] ?? null ,
140
+ $ conditions ['payment_status ' ] ?? null ,
141
+ $ conditions ['start_date ' ] ?? null ,
142
+ $ conditions ['end_date ' ] ?? null ,
143
+ $ conditions ['start_number ' ] ?? null ,
144
+ $ conditions ['end_number ' ] ?? null ,
145
+ $ conditions ['start_year ' ] ?? null ,
146
+ $ conditions ['end_year ' ] ?? null
147
+ ],
148
+ true
159
149
);
160
150
161
151
return $ this ;
@@ -170,9 +160,7 @@ public function list(array $conditions): self
170
160
*/
171
161
public function update (int $ id ): self
172
162
{
173
- $ methodName = $ this ->setMethodName ('update ' , true );
174
-
175
- $ this ->response = $ this ->api ->$ methodName ($ this ->model , $ id );
163
+ $ this ->createResponse ('update ' , [$ this ->model , $ id ], true );
176
164
177
165
return $ this ;
178
166
}
@@ -186,9 +174,7 @@ public function update(int $id): self
186
174
*/
187
175
public function sendInvoice (int $ id ): self
188
176
{
189
- $ methodName = $ this ->setMethodName ('send ' , true );
190
-
191
- $ this ->response = $ this ->api ->$ methodName ($ id );
177
+ $ this ->createResponse ('send ' , [$ id ], true );
192
178
193
179
return $ this ;
194
180
}
0 commit comments