diff --git a/Tests/SendConsignments/SendMuliColoConsignmentTest.php b/Tests/SendConsignments/SendMuliColoConsignmentTest.php index e3253f28..967222a7 100755 --- a/Tests/SendConsignments/SendMuliColoConsignmentTest.php +++ b/Tests/SendConsignments/SendMuliColoConsignmentTest.php @@ -103,6 +103,8 @@ public function testMultiColo() $this->assertNotEquals($consignments[0]->getMyParcelConsignmentId(), $consignments[1]->getMyParcelConsignmentId()); $this->assertNotEquals($consignments[0]->getBarcode(), $consignments[1]->getBarcode()); + $this->assertTrue($consignments[0]->isPartOfMultiCollo()); + $this->assertTrue($consignments[1]->isPartOfMultiCollo()); } } diff --git a/composer.json b/composer.json index 51728694..6508451c 100755 --- a/composer.json +++ b/composer.json @@ -1,6 +1,6 @@ { "name": "myparcelnl/sdk", - "version": "v2.1.0-beta.2", + "version": "v2.1.0-beta.3", "description": "This package is designed to send and receive data from MyParcel by means of an API.", "homepage": "https://www.myparcel.nl", "tags": ["MyParcel", "My Parcel", "Flespakket", "Post NL", "PostNL"], diff --git a/src/Helper/MyParcelCollection.php b/src/Helper/MyParcelCollection.php index f748e810..a1c66ebf 100644 --- a/src/Helper/MyParcelCollection.php +++ b/src/Helper/MyParcelCollection.php @@ -604,13 +604,14 @@ private function getNewCollectionFromResult($result) } $consignmentAdapter = new ConsignmentAdapter($shipment, $consignments->first()->getApiKey()); - $newCollection->addConsignment($consignmentAdapter->getConsignment()); + $isMultiCollo = ! empty($shipment['secondary_shipments']); + $newCollection->addConsignment($consignmentAdapter->getConsignment()->setMultiCollo($isMultiCollo)); foreach ($shipment['secondary_shipments'] as $secondaryShipment) { - $secondaryShipment = Arr::arrayMergeRecursiveDistinct($shipment, $secondaryShipment); + $secondaryShipment = Arr::arrayMergeRecursiveDistinct($shipment, $secondaryShipment); $consignmentAdapter = new ConsignmentAdapter($secondaryShipment, $this->getConsignmentsByReferenceId($secondaryShipment['reference_identifier'])); - $newCollection->addConsignment($consignmentAdapter->getConsignment()); + $newCollection->addConsignment($consignmentAdapter->getConsignment()->setMultiCollo($isMultiCollo)); } } diff --git a/src/Model/MyParcelConsignment.php b/src/Model/MyParcelConsignment.php index 88714b13..74d9b67f 100755 --- a/src/Model/MyParcelConsignment.php +++ b/src/Model/MyParcelConsignment.php @@ -390,11 +390,13 @@ public function setApiKey($apiKey) } /** + * @param bool $value + * * @return MyParcelConsignment */ - public function setMultiCollo() + public function setMultiCollo($value = true) { - $this->partOfMultiCollo = true; + $this->partOfMultiCollo = $value; return $this; }