Skip to content

Commit f80a37c

Browse files
committed
chore: always validate reponse from PostNL
1 parent 02e6b8f commit f80a37c

3 files changed

Lines changed: 6 additions & 0 deletions

File tree

src/Service/ResponseProcessor/Rest/DeliveryDateServiceRestResponseProcessor.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,7 @@ class DeliveryDateServiceRestResponseProcessor extends AbstractRestResponseProce
6565
*/
6666
public function processGetDeliveryDateResponse(ResponseInterface $response): GetDeliveryDateResponse
6767
{
68+
$this->validateResponse(response: $response);
6869
$body = json_decode(json: static::getResponseText(response: $response));
6970
if (isset($body->DeliveryDate)) {
7071
return GetDeliveryDateResponse::jsonDeserialize(json: (object) ['GetDeliveryDateResponse' => $body]);
@@ -91,6 +92,7 @@ public function processGetDeliveryDateResponse(ResponseInterface $response): Get
9192
*/
9293
public function processGetSentDateResponse(ResponseInterface $response): GetSentDateResponse
9394
{
95+
$this->validateResponse(response: $response);
9496
$body = json_decode(json: static::getResponseText(response: $response));
9597
if (isset($body->SentDate)) {
9698
return GetSentDateResponse::jsonDeserialize(json: (object) ['GetSentDateResponse' => $body]);

src/Service/ResponseProcessor/Rest/ShippingServiceRestResponseProcessor.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,7 @@ class ShippingServiceRestResponseProcessor extends AbstractRestResponseProcessor
6262
*/
6363
public function processSendShipmentResponse(ResponseInterface $response): ?SendShipmentResponse
6464
{
65+
$this->validateResponse(response: $response);
6566
$body = json_decode(json: static::getResponseText(response: $response));
6667
if (isset($body->ResponseShipments)) {
6768
return SendShipmentResponse::JsonDeserialize(json: (object) ['SendShipmentResponse' => $body]);

src/Service/ResponseProcessor/Rest/ShippingStatusServiceRestResponseProcessor.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,7 @@ class ShippingStatusServiceRestResponseProcessor extends AbstractRestResponsePro
7171
*/
7272
public function processCurrentStatusResponse(ResponseInterface $response): CurrentStatusResponse
7373
{
74+
$this->validateResponse(response: $response);
7475
$body = json_decode(json: static::getResponseText(response: $response));
7576

7677
/* @var CurrentStatusResponse $object */
@@ -189,6 +190,7 @@ public function processCompleteStatusResponse(ResponseInterface $response): Comp
189190
*/
190191
public function processGetSignatureResponse(ResponseInterface $response): GetSignatureResponseSignature
191192
{
193+
$this->validateResponse(response: $response);
192194
$body = json_decode(json: static::getResponseText(response: $response));
193195

194196
/* @var GetSignatureResponseSignature $object */
@@ -212,6 +214,7 @@ public function processGetSignatureResponse(ResponseInterface $response): GetSig
212214
*/
213215
public function processGetUpdatedShipmentsResponse(ResponseInterface $response): array
214216
{
217+
$this->validateResponse(response: $response);
215218
$body = json_decode(json: static::getResponseText(response: $response));
216219
if (!is_array(value: $body)) {
217220
return [];

0 commit comments

Comments
 (0)