Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: allow receipt code be #326

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,10 +78,10 @@
],
],

'disables receipt code when shipping to a non-NL country' => [
'disables receipt code when shipping to a non-NL or BE country' => [
[ShipmentOptions::RECEIPT_CODE => TriStateService::ENABLED],
[ShipmentOptions::RECEIPT_CODE => TriStateService::DISABLED],
'BE',
'FR',
],

'disables signature, only recipient, large format and return when receipt code is enabled' => [
Expand Down