Skip to content

Commit

Permalink
fix(fulfilment): export physical properties (#465)
Browse files Browse the repository at this point in the history
* fix(fulfilment): export physical properties

* test: fix insurance no longer mandatory towards belgium

* test: activate order mode tests
  • Loading branch information
joerivanveen committed Jan 18, 2024
1 parent 998a1ad commit b7ea460
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 18 deletions.
7 changes: 6 additions & 1 deletion src/Collection/Fulfilment/OrderCollection.php
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,12 @@ function (Order $order) {
'pickup' => $order->getPickupLocation() ? $order->getPickupLocation()->toArrayWithoutNull() : null,
'drop_off_point' => $dropOffPointAsArray,
'customs_declaration' => $order->getCustomsDeclaration(),
'physical_properties' => ['weight' => $order->getWeight()],
'physical_properties' => [
'weight' => $order->getWeight(),
'height' => 1,
'length' => 1,
'width' => 1,
],
],
];
}
Expand Down
6 changes: 3 additions & 3 deletions test/Model/Consignment/ConsignmentShipmentOptionsTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -113,9 +113,9 @@ public function provideLargeFormatData(): array
AbstractConsignment::CC_BE
),
self::LARGE_FORMAT => true,
self::expected(self::INSURANCE) => 500,
self::expected(self::ONLY_RECIPIENT) => true,
self::expected(self::SIGNATURE) => true,
self::expected(self::INSURANCE) => 0,
self::expected(self::ONLY_RECIPIENT) => false,
self::expected(self::SIGNATURE) => false,
],
]);
}
Expand Down
6 changes: 3 additions & 3 deletions test/Model/Consignment/PostNLConsignmentTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,9 @@ public function providePostNLConsignmentsData(): array
return $this->createConsignmentProviderDataset([
'NL -> NL' => [],
'NL -> BE' => $this->getDefaultAddress(AbstractConsignment::CC_BE) + [
self::expected(self::INSURANCE) => 500,
self::expected(self::ONLY_RECIPIENT) => true,
self::expected(self::SIGNATURE) => true,
self::expected(self::INSURANCE) => 0,
self::expected(self::ONLY_RECIPIENT) => false,
self::expected(self::SIGNATURE) => false,
],
'BE -> BE' => $this->getDefaultAddress(AbstractConsignment::CC_BE) + [
self::API_KEY => $this->getApiKey(self::ENV_API_KEY_BE),
Expand Down
16 changes: 5 additions & 11 deletions test/Model/Fulfilment/OrderCollectionTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,15 +32,6 @@ class OrderCollectionTest extends TestCase
'street' => 'Telderskade',
];

/**
* @return void
* @before
*/
public function before(): void
{
self::skipUnlessEnabled(self::ENV_TEST_ORDERS, 'The Order API is not available on production yet.');
}

/**
* @throws \MyParcelNL\Sdk\src\Exception\AccountNotActiveException
* @throws \MyParcelNL\Sdk\src\Exception\ApiException
Expand Down Expand Up @@ -83,6 +74,7 @@ public function testSave(): void
$orderLines = $this->generateOrderLines(3);

$order->setOrderLines($orderLines);
$order->setWeight($orderLines->sum('weight'));
$orderCollection->push($order);
}

Expand Down Expand Up @@ -112,13 +104,15 @@ static function (Order $savedOrder) use (&$i, $orderCollection) {
$originalOrder->getInvoiceAddress()
->toArray(),
$savedOrder->getInvoiceAddress()
->toArray()
->toArray(),
'invoice address is not the same'
);
self::assertArraySame(
$originalOrder->getRecipient()
->toArray(),
$savedOrder->getRecipient()
->toArray()
->toArray(),
'recipient is not the same'
);

$savedOrder
Expand Down

0 comments on commit b7ea460

Please sign in to comment.