1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
/** |
4
|
|
|
* This file is part of RussianPost SDK package. |
5
|
|
|
* |
6
|
|
|
* © Appwilio (http://appwilio.com), JhaoDa (https://github.com/jhaoda) |
7
|
|
|
* |
8
|
|
|
* For the full copyright and license information, please view the LICENSE |
9
|
|
|
* file that was distributed with this source code. |
10
|
|
|
*/ |
11
|
|
|
|
12
|
|
|
declare(strict_types=1); |
13
|
|
|
|
14
|
|
|
namespace Appwilio\RussianPostSDK\Dispatching\Endpoints\Documents; |
15
|
|
|
|
16
|
|
|
use GuzzleHttp\Psr7\UploadedFile; |
17
|
|
|
use Appwilio\RussianPostSDK\Core\GenericRequest; |
18
|
|
|
use Appwilio\RussianPostSDK\Dispatching\Enum\PrintType; |
19
|
|
|
use Appwilio\RussianPostSDK\Dispatching\Http\ApiClient; |
20
|
|
|
use Appwilio\RussianPostSDK\Dispatching\Enum\PrintFormType; |
21
|
|
|
use Appwilio\RussianPostSDK\Dispatching\Contracts\Arrayable; |
|
|
|
|
22
|
|
|
|
23
|
|
|
final class Documents |
24
|
|
|
{ |
25
|
|
|
/** @var ApiClient */ |
26
|
|
|
private $client; |
27
|
|
|
|
28
|
1 |
|
public function __construct(ApiClient $client) |
29
|
|
|
{ |
30
|
1 |
|
$this->client = $client; |
31
|
1 |
|
} |
32
|
|
|
|
33
|
|
|
/** |
34
|
|
|
* Форма Ф7п для заказа. |
35
|
|
|
* |
36
|
|
|
* @see https://otpravka.pochta.ru/specification#/documents-create_f7_f22 |
37
|
|
|
* |
38
|
|
|
* @param string $orderId |
39
|
|
|
* @param \DateTimeInterface|null $sendingDate |
40
|
|
|
* @param PrintType|null $printType |
41
|
|
|
* |
42
|
|
|
* @return UploadedFile |
43
|
|
|
*/ |
44
|
|
|
public function orderF7Form(string $orderId, ?\DateTimeInterface $sendingDate = null, ?PrintType $printType = null): UploadedFile |
45
|
|
|
{ |
46
|
|
|
$request = GenericRequest::create([ |
47
|
|
|
'print-type' => $printType, |
48
|
|
|
'sending-date' => $this->formatSendingDate($sendingDate), |
49
|
|
|
]); |
50
|
|
|
|
51
|
|
|
return $this->client->get("/1.0/forms/{$orderId}/f7pdf", $request); |
52
|
|
|
} |
53
|
|
|
|
54
|
|
|
/** |
55
|
|
|
* Форма Ф112ЭК для заказа. |
56
|
|
|
* |
57
|
|
|
* @see https://otpravka.pochta.ru/specification#/documents-create_f112 |
58
|
|
|
* |
59
|
|
|
* @param string $orderId |
60
|
|
|
* @param \DateTimeInterface|null $sendingDate |
61
|
|
|
* |
62
|
|
|
* @return UploadedFile |
63
|
|
|
*/ |
64
|
|
|
public function orderF112Form(string $orderId, ?\DateTimeInterface $sendingDate = null): UploadedFile |
65
|
|
|
{ |
66
|
|
|
$request = GenericRequest::create([ |
67
|
|
|
'id' => $orderId, |
68
|
|
|
'sending-date' => $this->formatSendingDate($sendingDate), |
69
|
|
|
]); |
70
|
|
|
|
71
|
|
|
return $this->client->get("/1.0/forms/{$orderId}/f112pdf", $request); |
72
|
|
|
} |
73
|
|
|
|
74
|
|
|
/** |
75
|
|
|
* Формы для заказа (до формирования партии). |
76
|
|
|
* |
77
|
|
|
* https://otpravka.pochta.ru/specification#/documents-create_forms_backlog |
78
|
|
|
* |
79
|
|
|
* @param string $orderId |
80
|
|
|
* @param \DateTimeInterface|null $sendingDate |
81
|
|
|
* |
82
|
|
|
* @return UploadedFile |
83
|
|
|
*/ |
84
|
|
|
public function orderFormsBundleBacklog(string $orderId, ?\DateTimeInterface $sendingDate = null): UploadedFile |
85
|
|
|
{ |
86
|
|
|
$request = GenericRequest::create([ |
87
|
|
|
'sending-date' => $this->formatSendingDate($sendingDate), |
88
|
|
|
]); |
89
|
|
|
|
90
|
|
|
return $this->client->get("/1.0/forms/backlog/{$orderId}/forms", $request); |
91
|
|
|
} |
92
|
|
|
|
93
|
|
|
/** |
94
|
|
|
* Формы для заказа (после формирования партии). |
95
|
|
|
* |
96
|
|
|
* @sse https://otpravka.pochta.ru/specification#/documents-create_forms |
97
|
|
|
* |
98
|
|
|
* @param string $orderId |
99
|
|
|
* @param \DateTimeInterface|null $sendingDate |
100
|
|
|
* @param PrintType|null $printType |
101
|
|
|
* |
102
|
|
|
* @return UploadedFile |
103
|
|
|
*/ |
104
|
|
|
public function orderFormBundle(string $orderId, ?\DateTimeInterface $sendingDate = null, ?PrintType $printType = null): UploadedFile |
105
|
|
|
{ |
106
|
|
|
$request = GenericRequest::create([ |
107
|
|
|
'print-type' => $printType, |
108
|
|
|
'sending-date' => $this->formatSendingDate($sendingDate), |
109
|
|
|
]); |
110
|
|
|
|
111
|
|
|
return $this->client->get("/1.0/forms/{$orderId}/forms", $request); |
112
|
|
|
} |
113
|
|
|
|
114
|
|
|
/** |
115
|
|
|
* Пакет документов для партии. |
116
|
|
|
* |
117
|
|
|
* @see https://otpravka.pochta.ru/specification#/documents-create_all_docs |
118
|
|
|
* |
119
|
|
|
* @param string $batchName |
120
|
|
|
* @param PrintType|null $printType |
121
|
|
|
* @param PrintFormType|null $printTypeForm |
122
|
|
|
* |
123
|
|
|
* @return UploadedFile |
124
|
|
|
*/ |
125
|
|
|
public function batchFormBundle(string $batchName, ?PrintType $printType = null, ?PrintFormType $printTypeForm = null): UploadedFile |
126
|
|
|
{ |
127
|
|
|
$request = GenericRequest::create([ |
128
|
|
|
'print-type' => $printType, |
129
|
|
|
'print-type-form' => $printTypeForm, |
130
|
|
|
]); |
131
|
|
|
|
132
|
|
|
return $this->client->get("/1.0/forms/{$batchName}/zip-all", $request); |
133
|
|
|
} |
134
|
|
|
|
135
|
|
|
/** |
136
|
|
|
* Форма Ф103 для партии. |
137
|
|
|
* |
138
|
|
|
* @see https://otpravka.pochta.ru/specification#/documents-create_f103 |
139
|
|
|
* |
140
|
|
|
* @param string $batchName |
141
|
|
|
* |
142
|
|
|
* @return UploadedFile |
143
|
|
|
*/ |
144
|
|
|
public function batchF103Form(string $batchName): UploadedFile |
145
|
|
|
{ |
146
|
|
|
return $this->client->get("/1.0/forms/{$batchName}/f103pdf"); |
147
|
|
|
} |
148
|
|
|
|
149
|
|
|
/** |
150
|
|
|
* Форма акта осмотра содержимого партии. |
151
|
|
|
* |
152
|
|
|
* Данный акт будет создан только в том случае, если подключена услуга проверки комплектности. |
153
|
|
|
* |
154
|
|
|
* @see https://otpravka.pochta.ru/specification#/documents-create_comp_check_form |
155
|
|
|
* |
156
|
|
|
* @param string $batchName |
157
|
|
|
* |
158
|
|
|
* @return UploadedFile |
159
|
|
|
*/ |
160
|
|
|
public function batchCheckingForm(string $batchName): UploadedFile |
161
|
|
|
{ |
162
|
|
|
return $this->client->get("/1.0/forms/{$batchName}/completeness-checking-form"); |
163
|
|
|
} |
164
|
|
|
|
165
|
|
|
/** |
166
|
|
|
* Подготовка и отправка электронной формы Ф103 для партии. |
167
|
|
|
* |
168
|
|
|
* @see https://otpravka.pochta.ru/specification#/documents-checkin |
169
|
|
|
* |
170
|
|
|
* @param string $batchName |
171
|
|
|
* |
172
|
|
|
* @return bool |
173
|
|
|
*/ |
174
|
|
|
public function batchCheckIn(string $batchName): bool |
175
|
|
|
{ |
176
|
|
|
return (bool) $this->client->get("/1.0/batch/{$batchName}/checkin"); |
177
|
|
|
} |
178
|
|
|
|
179
|
|
|
/** |
180
|
|
|
* Возвратный ярлык на одной странице. |
181
|
|
|
* |
182
|
|
|
* @see https://otpravka.pochta.ru/specification#/documents-easy_return_pdf |
183
|
|
|
* |
184
|
|
|
* @param string $barcode |
185
|
|
|
* @param PrintType|null $printType |
186
|
|
|
* |
187
|
|
|
* @return UploadedFile |
188
|
|
|
*/ |
189
|
|
|
public function easyReturnForm(string $barcode, ?PrintType $printType = null): UploadedFile |
190
|
|
|
{ |
191
|
|
|
$request = GenericRequest::create([ |
192
|
|
|
'print-type' => $printType, |
193
|
|
|
]); |
194
|
|
|
|
195
|
|
|
return $this->client->get("/1.0/forms/{$barcode}/easy-return-pdf", $request); |
196
|
|
|
} |
197
|
|
|
|
198
|
|
|
private function formatSendingDate(?\DateTimeInterface $sendingDate): ?string |
199
|
|
|
{ |
200
|
|
|
return $sendingDate ? $sendingDate->format('Y-m-d') : null; |
201
|
|
|
} |
202
|
|
|
} |
203
|
|
|
|
The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g.
excluded_paths: ["lib/*"]
, you can move it to the dependency path list as follows:For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths