Skip to content

Commit

Permalink
feat: add receipt code for belgium (#874)
Browse files Browse the repository at this point in the history
* feat: add receipt code for belgium

* chore: fix spelling error in comment
  • Loading branch information
joerivanveen authored Nov 21, 2024
1 parent 1d57acf commit e169f63
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
12 changes: 10 additions & 2 deletions Helper/Data.php
Original file line number Diff line number Diff line change
Expand Up @@ -258,15 +258,23 @@ public function consignmentHasShipmentOption(AbstractConsignment $consignment, s
/**
* Business logic determining what shipment options to show, if any.
*/
if (AbstractConsignment::SHIPMENT_OPTION_RECEIPT_CODE === $shipmentOption
&& AbstractConsignment::DELIVERY_TYPE_STANDARD !== $consignment->getDeliveryType()
) {
return false; // receipt code is only available for standard delivery
}

if (AbstractConsignment::CC_NL === $consignment->getCountry()) {
return $consignment->canHaveShipmentOption($shipmentOption);
}

// For PostNL in Belgium - only recipient-only/signature is available
// For PostNL in Belgium - recipient-only, signature and receipt code are available
if (AbstractConsignment::CC_BE === $consignment->getCountry() && CarrierPostNL::NAME === $consignment->getCarrierName()) {
return in_array($shipmentOption, [
AbstractConsignment::SHIPMENT_OPTION_ONLY_RECIPIENT,
AbstractConsignment::SHIPMENT_OPTION_SIGNATURE], true);
AbstractConsignment::SHIPMENT_OPTION_SIGNATURE,
AbstractConsignment::SHIPMENT_OPTION_RECEIPT_CODE,
], true);
}

// No shipment options available in any other case
Expand Down
2 changes: 0 additions & 2 deletions view/adminhtml/templates/new_shipment.phtml
Original file line number Diff line number Diff line change
Expand Up @@ -147,8 +147,6 @@ foreach ($form->getCarrierSpecificAbstractConsignments() as $abstractConsignment
foreach ($abstractConsignment->getAllowedShipmentOptions() as $shipmentOption) {
if (AbstractConsignment::SHIPMENT_OPTION_INSURANCE === $shipmentOption
|| ! $block->consignmentHasShipmentOption($abstractConsignment, $shipmentOption)
|| ($shipmentOption === AbstractConsignment::SHIPMENT_OPTION_RECEIPT_CODE
&& AbstractConsignment::DELIVERY_TYPE_STANDARD !== $block->getDeliveryType())
) {
continue;
}
Expand Down

0 comments on commit e169f63

Please sign in to comment.