Skip to content

Commit

Permalink
fix(pps): export delivery options (#360)
Browse files Browse the repository at this point in the history
* fix(pps): export delivery options
  • Loading branch information
RichardPerdaan authored and EdieLemoine committed Dec 31, 2021
1 parent fce209d commit 8f782b2
Showing 1 changed file with 14 additions and 11 deletions.
25 changes: 14 additions & 11 deletions src/Collection/Fulfilment/OrderCollection.php
Original file line number Diff line number Diff line change
Expand Up @@ -109,19 +109,22 @@ private function getShipmentOptions(AbstractDeliveryOptionsAdapter $deliveryOpti
? $dateTime->format(AbstractOrder::DATE_FORMAT_FULL)
: null;

$options = [
'package_type' => $deliveryOptions->getPackageTypeId(),
'delivery_date' => $deliveryDate,
];

$shipmentOptions = $deliveryOptions->getShipmentOptions();

if ($shipmentOptions) {
// Map boolean values of shipment options to integers and add them to the options array.
foreach ($shipmentOptions as $optionKey => $optionValue) {
$options[$optionKey] = (int) $optionValue;
}
}
$options = [
'package_type' => $deliveryOptions->getPackageTypeId(),
'delivery_date' => $deliveryDate,
'signature' => (int) $shipmentOptions->hasSignature(),
'only_recipient' => (int) $shipmentOptions->hasOnlyRecipient(),
'age_check' => (int) $shipmentOptions->hasAgeCheck(),
'large_format' => (int) $shipmentOptions->hasLargeFormat(),
'return' => (int) $shipmentOptions->isReturn(),
'insurance' => [
'amount' => $shipmentOptions->getInsurance(),
'currency' => 'EUR'
],
'label_description' => (string) $shipmentOptions->getLabelDescription(),
];

return $options;
}
Expand Down

0 comments on commit 8f782b2

Please sign in to comment.