From 756bee5f748b74e03dcd1a6202e2a9a42113867c Mon Sep 17 00:00:00 2001 From: Richard Perdaan Date: Wed, 23 Oct 2019 14:38:16 +0200 Subject: [PATCH 1/3] use multiple consignment --- composer.json | 2 +- src/Helper/MyParcelCollection.php | 5 ++--- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/composer.json b/composer.json index 8488682d..ffa5bdf4 100755 --- a/composer.json +++ b/composer.json @@ -1,6 +1,6 @@ { "name": "myparcelnl/sdk", - "version": "v3.0.0", + "version": "v3.0.1", "description": "This package is designed to send and receive data from MyParcel by means of an API.", "homepage": "https://www.myparcel.nl", "keywords": ["MyParcel", "My Parcel", "Flespakket", "Post NL", "PostNL"], diff --git a/src/Helper/MyParcelCollection.php b/src/Helper/MyParcelCollection.php index 148c22a8..f5419ee3 100644 --- a/src/Helper/MyParcelCollection.php +++ b/src/Helper/MyParcelCollection.php @@ -746,11 +746,10 @@ private function getNewCollectionFromResult($result) $newCollection->addConsignment($consignmentAdapter->getConsignment()->setMultiCollo($isMultiCollo)); foreach ($shipment['secondary_shipments'] as $secondaryShipment) { - $secondaryShipment = Arr::arrayMergeRecursiveDistinct($shipment, $secondaryShipment); - $consignmentAdapter = new ConsignmentAdapter($secondaryShipment, $this->getConsignmentsByReferenceId($secondaryShipment['reference_identifier'])->first()); + $consignment = ConsignmentFactory::createByCarrierId($shipment['carrier_id'])->setApiKey($apiKey); + $consignmentAdapter = new ConsignmentAdapter($secondaryShipment, $consignment); $newCollection->addConsignment($consignmentAdapter->getConsignment()->setMultiCollo($isMultiCollo)); - } } From 38a46f36ef4cfce21f33bc54fb2686c23e9bc944 Mon Sep 17 00:00:00 2001 From: Richard Perdaan Date: Tue, 29 Oct 2019 11:25:22 +0100 Subject: [PATCH 2/3] make new collection --- src/Helper/MyParcelCollection.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Helper/MyParcelCollection.php b/src/Helper/MyParcelCollection.php index f5419ee3..3a0767e5 100644 --- a/src/Helper/MyParcelCollection.php +++ b/src/Helper/MyParcelCollection.php @@ -116,7 +116,7 @@ public function getConsignmentsByReferenceId($id): MyParcelCollection } if ($this->count() === 1) { - return $this; + return new static($this->items); } return $this->where('reference_identifier', $id); From 58274aec7d50fc532b338fcd7b9f38eb062d0a01 Mon Sep 17 00:00:00 2001 From: Richard Perdaan Date: Tue, 29 Oct 2019 11:25:52 +0100 Subject: [PATCH 3/3] update version --- composer.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/composer.json b/composer.json index ffa5bdf4..270cbf2a 100755 --- a/composer.json +++ b/composer.json @@ -1,6 +1,6 @@ { "name": "myparcelnl/sdk", - "version": "v3.0.1", + "version": "v3.0.2", "description": "This package is designed to send and receive data from MyParcel by means of an API.", "homepage": "https://www.myparcel.nl", "keywords": ["MyParcel", "My Parcel", "Flespakket", "Post NL", "PostNL"],