diff --git a/config/schema/myparcel/order/postnl/be_package.json b/config/schema/myparcel/order/postnl/be_package.json index 48fc8e29b..7f539a89d 100644 --- a/config/schema/myparcel/order/postnl/be_package.json +++ b/config/schema/myparcel/order/postnl/be_package.json @@ -15,7 +15,7 @@ "enum": [0, 1] }, "receiptCode": { - "enum": [-1] + "enum": [-1, 0, 1] } } } diff --git a/src/App/Order/Calculator/PostNl/PostNLReceiptCodeCalculator.php b/src/App/Order/Calculator/PostNl/PostNLReceiptCodeCalculator.php index 8f2183a70..e2a38c107 100644 --- a/src/App/Order/Calculator/PostNl/PostNLReceiptCodeCalculator.php +++ b/src/App/Order/Calculator/PostNl/PostNLReceiptCodeCalculator.php @@ -18,7 +18,7 @@ final class PostNLReceiptCodeCalculator extends AbstractPdkOrderOptionCalculator /** * Calculates the receipt code options for PostNL shipments. * When receipt code is enabled: - * - Shipment must be to the Netherlands + * - Shipment must be to the Netherlands or Belgium * - Receipt code will be disabled if age check is active * - Signature and only recipient will be disabled * - Large format will be disabled @@ -33,7 +33,7 @@ public function calculate(): void return; } - if ($this->order->shippingAddress->cc !== CountryCodes::CC_NL) { + if (! in_array($this->order->shippingAddress->cc, [CountryCodes::CC_NL, CountryCodes::CC_BE])) { $shipmentOptions->receiptCode = TriStateService::DISABLED; return; } diff --git a/tests/Unit/App/Order/Calculator/PostNl/PostNLReceiptCodeCalculatorTest.php b/tests/Unit/App/Order/Calculator/PostNl/PostNLReceiptCodeCalculatorTest.php index 51cc3efa8..6fe2807d0 100644 --- a/tests/Unit/App/Order/Calculator/PostNl/PostNLReceiptCodeCalculatorTest.php +++ b/tests/Unit/App/Order/Calculator/PostNl/PostNLReceiptCodeCalculatorTest.php @@ -181,11 +181,11 @@ $reset(); }); -it('disables receipt code when shipping to a non-NL country', function () { +it('disables receipt code when shipping to a non-NL/BE country', function () { $reset = mockPdkProperty('orderCalculators', [PostNLReceiptCodeCalculator::class]); $order = factory(PdkOrder::class) - ->withShippingAddress(['cc' => 'BE']) + ->withShippingAddress(['cc' => 'DE']) ->withDeliveryOptions( factory(DeliveryOptions::class) ->withShipmentOptions(