Skip to content

Commit

Permalink
feat: add package type package_small
Browse files Browse the repository at this point in the history
  • Loading branch information
Mark-Ernst committed Feb 28, 2024
1 parent 9e1f81f commit 4cefdac
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/Services/ConsignmentEncode.php
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,10 @@ public static function encodeExtraOptions(array $consignmentEncoded, AbstractCon
];
}

if (AbstractConsignment::PACKAGE_TYPE_PACKAGE_SMALL === $consignment->getPackageType()) {
$consignmentEncoded['options']['tracked'] = 1;
}

foreach ($consignment->getMandatoryShipmentOptions() as $option) {
$key = "options.$option";
$value = Arr::get($consignmentEncoded, $key);
Expand Down
7 changes: 7 additions & 0 deletions test/Bootstrap/ConsignmentTestCase.php
Original file line number Diff line number Diff line change
Expand Up @@ -328,6 +328,13 @@ protected function getDefaultAddress(string $country = AbstractConsignment::CC_N
self::POSTAL_CODE => '2000',
self::CITY => 'Antwerpen',
];
case 'DE':
return [
self::COUNTRY => 'DE',
self::FULL_STREET => 'Kurfürstendamm 195',
self::POSTAL_CODE => '10707',
self::CITY => 'Berlin',
];
case 'CA':
return [
self::COUNTRY => 'CA',
Expand Down
13 changes: 13 additions & 0 deletions test/Model/Consignment/PostNLConsignmentTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,19 @@ public function providePostNLConsignmentsData(): array
self::expected(self::ONLY_RECIPIENT) => true,
self::expected(self::SIGNATURE) => true,
],
'Letter' => [
self::PACKAGE_TYPE => AbstractConsignment::PACKAGE_TYPE_LETTER,
self::expected(self::DELIVERY_TYPE) => AbstractConsignment::DELIVERY_TYPE_STANDARD,
],
'Small package' => $this->getDefaultAddress('DE') + [
self::PACKAGE_TYPE => AbstractConsignment::PACKAGE_TYPE_PACKAGE_SMALL,
self::expected(self::DELIVERY_TYPE) => AbstractConsignment::DELIVERY_TYPE_STANDARD,
],
'Customs declaration' => $this->getDefaultAddress('CA') + [
self::PACKAGE_TYPE => AbstractConsignment::PACKAGE_TYPE_PACKAGE,
self::CUSTOMS_DECLARATION => $this->getDefaultCustomsDeclaration(),
self::expected(self::DELIVERY_TYPE) => AbstractConsignment::DELIVERY_TYPE_STANDARD,
],
]);
}

Expand Down

0 comments on commit 4cefdac

Please sign in to comment.