From 393ad70e9a2cf48e40ded20c387da91ce8767c9b Mon Sep 17 00:00:00 2001 From: Nabil Azahaf Date: Thu, 6 Aug 2026 16:08:18 +0200 Subject: [PATCH 1/3] fix(checkout): guard invalid carrier settings (#513) * Guard carrier settings * test: clean carrier guard * fix: validate carrier entries * fix: ignore malformed carrier settings * refactor: simplify carrier settings guard --- .../Service/DeliveryOptionsService.php | 13 +++- .../Service/CapabilitiesValidationService.php | 7 +- .../AbstractPdkSettingsRepository.php | 14 +++- .../Model/DeliveryOptionsConfigTest.php | 5 ++ ...DeliveryOptionsServiceCapabilitiesTest.php | 38 ++++++++++- ...tionsServiceInvalidCarrierSettingsTest.php | 66 +++++++++++++++++++ .../AbstractSettingsRepositoryTest.php | 22 +++++++ 7 files changed, 159 insertions(+), 6 deletions(-) create mode 100644 tests/Unit/App/DeliveryOptions/Service/DeliveryOptionsServiceInvalidCarrierSettingsTest.php diff --git a/src/App/DeliveryOptions/Service/DeliveryOptionsService.php b/src/App/DeliveryOptions/Service/DeliveryOptionsService.php index fb6480d28..a57db58de 100644 --- a/src/App/DeliveryOptions/Service/DeliveryOptionsService.php +++ b/src/App/DeliveryOptions/Service/DeliveryOptionsService.php @@ -15,6 +15,7 @@ use MyParcelNL\Pdk\Base\Support\Collection; use MyParcelNL\Pdk\Base\Support\SettingKey; use MyParcelNL\Pdk\Base\Support\Utils; +use MyParcelNL\Pdk\Carrier\Collection\CarrierCollection; use MyParcelNL\Pdk\Carrier\Contract\CarrierRepositoryInterface; use MyParcelNL\Pdk\Carrier\Model\Carrier; use MyParcelNL\Pdk\Carrier\Service\CapabilitiesValidationService; @@ -229,8 +230,18 @@ private function getBaseSettings(CarrierSettings $carrierSettings, PdkCart $cart */ private function getValidCarrierOptions(PdkCart $cart): array { + $carrierSettings = Settings::get(CarrierSettings::ID); + + $carrierSettings = array_filter( + is_array($carrierSettings) ? $carrierSettings : [], + static fn($settings): bool => is_array($settings) + ); + + if (empty($carrierSettings)) { + return [DeliveryOptions::DEFAULT_PACKAGE_TYPE_NAME, new CarrierCollection()]; + } + $allCarriers = $this->carrierRepository->all(); - $carrierSettings = Settings::get(CarrierSettings::ID); $shippingAddress = $cart->shippingMethod->shippingAddress; $cc = $shippingAddress->cc ?? null; $isBusiness = $shippingAddress->isBusiness; diff --git a/src/Carrier/Service/CapabilitiesValidationService.php b/src/Carrier/Service/CapabilitiesValidationService.php index 4c8299018..2dc6d942d 100644 --- a/src/Carrier/Service/CapabilitiesValidationService.php +++ b/src/Carrier/Service/CapabilitiesValidationService.php @@ -133,11 +133,16 @@ private function getEnabledCarrierNames(): array { $carrierSettings = Settings::get(CarrierSettings::ID) ?? []; + if (! is_array($carrierSettings)) { + return []; + } + return array_keys( array_filter( $carrierSettings, static function ($settings): bool { - return ! empty($settings[CarrierSettings::DELIVERY_OPTIONS_ENABLED]); + return is_array($settings) + && ! empty($settings[CarrierSettings::DELIVERY_OPTIONS_ENABLED]); } ) ); diff --git a/src/Settings/Repository/AbstractPdkSettingsRepository.php b/src/Settings/Repository/AbstractPdkSettingsRepository.php index 121ba1da3..7e61f9db1 100644 --- a/src/Settings/Repository/AbstractPdkSettingsRepository.php +++ b/src/Settings/Repository/AbstractPdkSettingsRepository.php @@ -137,10 +137,18 @@ protected function updateSettingsFromCollection( ): Settings { $category = $this->get($this->createSettingsKey($settingsId)) ?? []; - foreach ($category as $key => $item) { - $values = ['id' => $key] + $this->get($this->createSettingsKey("$settingsId.$key")); + if (! is_array($category)) { + $category = []; + } + + foreach (array_keys($category) as $key) { + $values = $this->get($this->createSettingsKey("$settingsId.$key")); + + if (! is_array($values)) { + continue; + } - $collection->offsetSet($key, $values); + $collection->offsetSet($key, ['id' => $key] + $values); } $settings->setAttribute($settingsId, $collection); diff --git a/tests/Unit/App/Context/Model/DeliveryOptionsConfigTest.php b/tests/Unit/App/Context/Model/DeliveryOptionsConfigTest.php index 24712d07e..49d46340c 100644 --- a/tests/Unit/App/Context/Model/DeliveryOptionsConfigTest.php +++ b/tests/Unit/App/Context/Model/DeliveryOptionsConfigTest.php @@ -15,6 +15,7 @@ use MyParcelNL\Pdk\Facade\Pdk; use MyParcelNL\Pdk\Facade\Settings; use MyParcelNL\Pdk\Proposition\Proposition; +use MyParcelNL\Pdk\Settings\Model\CarrierSettings; use MyParcelNL\Pdk\Settings\Model\CheckoutSettings; use MyParcelNL\Pdk\Tests\Bootstrap\MockPdkProductRepository; use MyParcelNL\Pdk\Tests\Bootstrap\TestBootstrapper; @@ -135,6 +136,10 @@ ->withAllowPickupLocationsViewSelection(true) ->store(); + factory(CarrierSettings::class, RefCapabilitiesSharedCarrierV2::POSTNL) + ->withDeliveryOptionsEnabled(true) + ->store(); + /** @var \MyParcelNL\Pdk\Tests\Bootstrap\MockPdkProductRepository $productRepository */ $productRepository = Pdk::get(PdkProductRepositoryInterface::class); diff --git a/tests/Unit/App/DeliveryOptions/Service/DeliveryOptionsServiceCapabilitiesTest.php b/tests/Unit/App/DeliveryOptions/Service/DeliveryOptionsServiceCapabilitiesTest.php index 36c791420..6c4df49a8 100644 --- a/tests/Unit/App/DeliveryOptions/Service/DeliveryOptionsServiceCapabilitiesTest.php +++ b/tests/Unit/App/DeliveryOptions/Service/DeliveryOptionsServiceCapabilitiesTest.php @@ -13,6 +13,7 @@ use MyParcelNL\Pdk\Carrier\Model\Carrier; use MyParcelNL\Pdk\Facade\FrontendData; use MyParcelNL\Pdk\Facade\Pdk; +use MyParcelNL\Pdk\Settings\Contract\PdkSettingsRepositoryInterface; use MyParcelNL\Pdk\Settings\Model\CarrierSettings; use MyParcelNL\Pdk\Settings\Model\Settings; use MyParcelNL\Pdk\Shipment\Model\DeliveryOptions; @@ -307,6 +308,42 @@ function enqueueCapabilitiesPerType(array $responsesPerType): void ->and($result['carrierSettings'])->not->toHaveKey($disabledId); }); +it('keeps valid carriers when another carrier setting is malformed', function () { + $carrierName = RefCapabilitiesSharedCarrierV2::getAllowableEnumValues()[0]; + + storeCarrierSettings([$carrierName => true]); + + /** @var \MyParcelNL\Pdk\Settings\Contract\PdkSettingsRepositoryInterface $settingsRepository */ + $settingsRepository = Pdk::get(PdkSettingsRepositoryInterface::class); + $settingsKey = Pdk::get('createSettingsKey')(CarrierSettings::ID); + $carrierSettings = $settingsRepository->get($settingsKey); + + $settingsRepository->store($settingsKey, array_merge($carrierSettings, ['invalid' => 'invalid'])); + + factory(Shop::class) + ->withCarriers( + factory(CarrierCollection::class) + ->push(factory(Carrier::class) + ->withCarrier($carrierName) + ->withCapabilityPackageTypes(['PACKAGE'])) + ) + ->store(); + + resetStorageCache(); + + enqueueCapabilitiesPerType([ + 'PACKAGE' => [capabilityResult($carrierName, 100, ['PACKAGE'])], + ]); + + /** @var DeliveryOptionsServiceInterface $service */ + $service = Pdk::get(DeliveryOptionsServiceInterface::class); + $result = $service->createAllCarrierSettings(makeCart('NL')); + + $carrierId = FrontendData::getLegacyCarrierIdentifier($carrierName); + + expect($result['carrierSettings'])->toHaveKey($carrierId); +}); + it('passes contract ID from capabilities to carrier settings output', function () { storeCarrierSettings([RefCapabilitiesSharedCarrierV2::POSTNL => true]); @@ -476,4 +513,3 @@ function enqueueCapabilitiesPerType(array $responsesPerType): void expect($result['packageType'])->toBe(DeliveryOptions::PACKAGE_TYPE_MAILBOX_NAME); }); - diff --git a/tests/Unit/App/DeliveryOptions/Service/DeliveryOptionsServiceInvalidCarrierSettingsTest.php b/tests/Unit/App/DeliveryOptions/Service/DeliveryOptionsServiceInvalidCarrierSettingsTest.php new file mode 100644 index 000000000..21df8e139 --- /dev/null +++ b/tests/Unit/App/DeliveryOptions/Service/DeliveryOptionsServiceInvalidCarrierSettingsTest.php @@ -0,0 +1,66 @@ +group('checkout'); + +usesShared(new UsesMockPdkInstance(), new UsesAccountMock()); + +it('does not expose carriers when carrier settings are missing or invalid', function ($carrierSettings) { + $settingsManager = Mockery::mock(SettingsManagerInterface::class); + $settingsManager + ->shouldReceive('get') + ->andReturnUsing(static function ( + string $key, + ?string $namespace = null, + $default = null + ) use ($carrierSettings) { + return CarrierSettings::ID === $key && null === $namespace + ? $carrierSettings + : $default; + }); + Pdk::set(SettingsManagerInterface::class, $settingsManager); + + /** @var DeliveryOptionsServiceInterface $service */ + $service = Pdk::get(DeliveryOptionsServiceInterface::class); + + $result = $service->createAllCarrierSettings(new PdkCart([ + 'shippingMethod' => [ + 'shippingAddress' => ['cc' => 'NL'], + ], + 'lines' => [ + [ + 'quantity' => 1, + 'product' => [ + 'weight' => 1000, + 'isDeliverable' => true, + ], + ], + ], + ])); + + expect($result['packageType'])->toBe(DeliveryOptions::DEFAULT_PACKAGE_TYPE_NAME) + ->and($result['carrierSettings'])->toBe([]); +})->with([ + 'missing' => [null], + 'empty array' => [[]], + 'malformed carrier entry' => [['carrier' => 'invalid']], + 'boolean value' => [false], + 'string value' => ['invalid'], +]); diff --git a/tests/Unit/Settings/Repository/AbstractSettingsRepositoryTest.php b/tests/Unit/Settings/Repository/AbstractSettingsRepositoryTest.php index eb66121ad..efb1d5b13 100644 --- a/tests/Unit/Settings/Repository/AbstractSettingsRepositoryTest.php +++ b/tests/Unit/Settings/Repository/AbstractSettingsRepositoryTest.php @@ -49,6 +49,28 @@ assertMatchesJsonSnapshot(json_encode($settings->toArrayWithoutNull())); }); +it('skips malformed entries when retrieving collection settings', function () { + /** @var \MyParcelNL\Pdk\Settings\Contract\PdkSettingsRepositoryInterface $repository */ + $repository = Pdk::get(PdkSettingsRepositoryInterface::class); + $createSettingsKey = Pdk::get('createSettingsKey'); + + $currentCarrierSettings = $repository->get($createSettingsKey(CarrierSettings::ID)); + + try { + $repository->store($createSettingsKey(CarrierSettings::ID), array_merge($currentCarrierSettings, [ + 'valid' => [CarrierSettings::DELIVERY_OPTIONS_ENABLED => true], + 'invalid' => 'invalid', + ])); + + $carrierSettings = $repository->all()->carrier; + + expect($carrierSettings->has('valid'))->toBeTrue() + ->and($carrierSettings->has('invalid'))->toBeFalse(); + } finally { + $repository->store($createSettingsKey(CarrierSettings::ID), $currentCarrierSettings); + } +}); + it('retrieves a single setting from a category', function (string $key, $expected) { /** @var \MyParcelNL\Pdk\Settings\Contract\PdkSettingsRepositoryInterface $repository */ $repository = Pdk::get(PdkSettingsRepositoryInterface::class); From 4c0f840885aae97f65c0a6800dc770488e6a504a Mon Sep 17 00:00:00 2001 From: Freek van Rijt Date: Wed, 29 Jul 2026 10:38:27 +0200 Subject: [PATCH 2/3] fix(insurance): read insurance limits from the flat capabilities format The MyParcel API is dropping the old nested wrapper around insurance limits from the capabilities and contract definitions responses. The PDK read the limits through that wrapper, so insurance would have broken in the webshops the moment it disappeared. Insurance limits now come from the flat min, max and default fields. Each limit stands on its own: no minimum means there is no floor, no maximum means the carrier sets no ceiling so a requested amount is kept as-is, and no default falls back to the minimum. For the carrier settings the "insure up to" dropdown needs a maximum to list amounts against, so without one it stays empty and logs a warning instead. The API still sends both formats until after this ships. So that nothing starts depending on the old one again, the PDK now drops it as capabilities come in, which means stored carrier data and the admin only ever see the flat fields. That part is temporary and can go once the SDK is regenerated without the wrapper. Resolves INT-1697 Co-Authored-By: Claude Opus 5 (1M context) --- .../General/InsuranceCalculator.php | 72 +- .../Service/CarrierValidationService.php | 23 +- .../CoreApi/Shipment/CapabilitiesService.php | 42 +- .../MockCarrierCapabilitiesRepository.php | 31 +- .../ExampleContractDefinitionsResponse.php | 6 + .../Account/UpdateAccountActionTest.php | 13 +- .../General/InsuranceCalculatorTest.php | 40 + tests/Unit/Base/Model/SdkBackedModelTest.php | 26 +- .../Service/CarrierValidationServiceTest.php | 14 + .../Shipment/CapabilitiesServiceTest.php | 82 ++ ...untTest__it_creates_storable_array__1.json | 384 +++--- ...data_with_data_set_multiple_orders__1.json | 48 +- ...xt_data_with_data_set_single_order__1.json | 24 +- ..._data_set_simple_domestic_shipment__1.json | 48 +- ...rts_return_with_data_set_insurance__1.json | 144 +-- ...th_data_set_no_return_capabilities__1.json | 144 +-- ...return_with_data_set_simple_orders__1.json | 144 +-- ...omponent_with_data_set_init_script__1.json | 1152 ++++++++--------- ..._component_with_data_set_order_box__1.json | 24 +- ...nt_with_data_set_order_list_column__1.json | 24 +- ...dk_order_with_data_set_empty_order__1.json | 24 +- ...with_data_set_order_with_shipments__1.json | 24 +- ...h_data_set_order_without_shipments__1.json | 24 +- ...e_order_containing_many_attributes__1.json | 24 +- ...ith_data_set_one_order_with_pickup__1.json | 24 +- ...e_order_containing_many_attributes__1.json | 24 +- ...ith_data_set_one_order_with_pickup__1.json | 24 +- ...order_collection_from_queried_data__1.json | 24 +- ...data_with_data_set_normal_shipment__1.json | 48 +- ...th_data_set_shipment_with_contract__1.json | 48 +- ...a_set_shipment_with_drop-off_point__1.json | 48 +- ...with_data_set_shipment_with_pickup__1.json | 48 +- ...t_order_containing_many_attributes__1.json | 24 +- ...ta_with_data_set_order_with_pickup__1.json | 24 +- ...pment_with_data_set_empty_shipment__1.json | 24 +- ...data_set_shipment_with_all_options__1.json | 24 +- ...ent_when_no_pdk_shipment_is_passed__1.json | 24 +- .../Carrier/Model/CarrierFactory.php | 18 +- 38 files changed, 1507 insertions(+), 1500 deletions(-) diff --git a/src/App/Order/Calculator/General/InsuranceCalculator.php b/src/App/Order/Calculator/General/InsuranceCalculator.php index bf2305fef..89a20bed5 100644 --- a/src/App/Order/Calculator/General/InsuranceCalculator.php +++ b/src/App/Order/Calculator/General/InsuranceCalculator.php @@ -65,6 +65,10 @@ public function calculate(): void * narrow below the carrier-wide contract range. Tier resolution and clamping * use those shipment-specific bounds. * + * The capability advertises them as flat `min`/`max`/`default` money objects, each + * optional. An absent minimum means the carrier imposes no floor, an absent maximum + * means it imposes no ceiling, and an absent default falls back to the minimum. + * * - NULL or DISABLED (0): use carrier minimum. * - INHERIT (-1): fall back to settings; if settings do not enable insurance, use carrier default. * - Explicit amount: resolve to nearest valid tier. @@ -83,10 +87,13 @@ private function calculateInsurance(?int $amount): int return 0; } - $insuredAmount = $carrierInsurance->getInsuredAmount(); - $carrierMin = $insuredAmount->getMin()->getAmount(); - $carrierMax = $insuredAmount->getMax()->getAmount(); - $carrierDefault = $insuredAmount->getDefault()->getAmount(); + $min = $carrierInsurance->getMin(); + $max = $carrierInsurance->getMax(); + $default = $carrierInsurance->getDefault(); + + $carrierMin = $min ? $min->getAmount() : 0; + $carrierMax = $max ? $max->getAmount() : null; + $carrierDefault = $default ? $default->getAmount() : $carrierMin; // No insurance set? We still need to respect the carrier's minimum insurance amount or the request will fail. if (null === $amount || TriStateService::DISABLED === $amount) { @@ -97,11 +104,32 @@ private function calculateInsurance(?int $amount): int return $this->calculateFromSettings($carrier, $carrierMin, $carrierMax, $carrierDefault); } - // Explicit amount: resolve to nearest valid tier, clamp to shipment range. - $allowedAmounts = InsuranceTierMath::buildTiers($carrierMin, $carrierMax); + return $this->resolveToTier($amount, $carrierMin, $carrierMax); + } + + /** + * Resolve a requested amount to a value the carrier accepts. + * + * Snaps the amount up to the nearest tier in the carrier's range, then clamps it to that + * range. Without a carrier maximum there is no ladder to snap to, so the amount passes + * through with only the carrier minimum applied as a floor. + * + * @param int $amount + * @param int $min + * @param null|int $max + * + * @return int + */ + private function resolveToTier(int $amount, int $min, ?int $max): int + { + if (null === $max) { + return max($min, $amount); + } + + $allowedAmounts = InsuranceTierMath::buildTiers($min, $max); $validated = $this->getMinimumInsuranceAmount($allowedAmounts, $amount); - return $this->clampToCarrierRange($validated, $carrierMin, $carrierMax); + return $this->clampToCarrierRange($validated, $min, $max); } /** @@ -144,15 +172,22 @@ private function fetchShipmentInsurance(Carrier $carrier): ?RefCapabilitiesRespo /** * Calculate insurance from carrier settings when the shipment option is set to INHERIT. * + * When the carrier advertises no maximum, the "insure up to" setting is the only ceiling + * that applies — the settings cap is what bounds an otherwise unbounded carrier. + * * @param \MyParcelNL\Pdk\Carrier\Model\Carrier $carrier * @param int $carrierMin - * @param int $carrierMax + * @param null|int $carrierMax * @param int $carrierDefault * * @return int */ - private function calculateFromSettings(Carrier $carrier, int $carrierMin, int $carrierMax, int $carrierDefault): int - { + private function calculateFromSettings( + Carrier $carrier, + int $carrierMin, + ?int $carrierMax, + int $carrierDefault + ): int { $carrierSettings = CarrierSettings::fromCarrier($carrier); if (! $carrierSettings->exportInsurance) { @@ -171,8 +206,7 @@ private function calculateFromSettings(Carrier $carrier, int $carrierMin, int $c return $carrierMin; } - $allowedAmounts = InsuranceTierMath::buildTiers($carrierMin, $carrierMax); - $validated = $this->getMinimumInsuranceAmount($allowedAmounts, $orderAmount); + $validated = $this->resolveToTier($orderAmount, $carrierMin, $carrierMax); $insuranceUpToKey = $this->getInsuranceUpToKey($this->order->shippingAddress->cc); $maxInsuranceValue = $carrierSettings->getAttribute($insuranceUpToKey) ?? 0; @@ -184,15 +218,19 @@ private function calculateFromSettings(Carrier $carrier, int $carrierMin, int $c /** * Clamp the given amount to the carrier's allowed insurance range. * - * @param int $amount - * @param int $min - * @param int $max + * A null maximum means the carrier advertises no ceiling, so only the floor applies. + * + * @param int $amount + * @param int $min + * @param null|int $max * * @return int */ - private function clampToCarrierRange(int $amount, int $min, int $max): int + private function clampToCarrierRange(int $amount, int $min, ?int $max): int { - return max($min, min($amount, $max)); + $floored = max($min, $amount); + + return null === $max ? $floored : min($floored, $max); } /** diff --git a/src/Carrier/Service/CarrierValidationService.php b/src/Carrier/Service/CarrierValidationService.php index 462ca5454..ee35a8496 100644 --- a/src/Carrier/Service/CarrierValidationService.php +++ b/src/Carrier/Service/CarrierValidationService.php @@ -8,6 +8,7 @@ use MyParcelNL\Pdk\App\Options\Definition\InsuranceDefinition; use MyParcelNL\Pdk\Carrier\Model\Carrier; use MyParcelNL\Pdk\Carrier\Util\InsuranceTierMath; +use MyParcelNL\Pdk\Facade\Logger; use MyParcelNL\Sdk\Client\Generated\CoreApi\Model\RefShipmentPackageTypeV2; /** @@ -83,7 +84,8 @@ public function supportsDigitalStamp(Carrier $carrier): bool /** * Insurance tier ladder allowed for the carrier (cents). * - * Returns an empty array when the carrier does not support insurance. + * Returns an empty array when the carrier does not support insurance + * or when it does not advertise any maximum amount. * * @return int[] */ @@ -93,12 +95,21 @@ public function getAllowedInsuranceAmounts(Carrier $carrier): array return []; } - $insured = $carrier->options->getInsurance()->getInsuredAmount(); + $insurance = $carrier->options->getInsurance(); + $max = $insurance ? $insurance->getMax() : null; - return InsuranceTierMath::buildTiers( - $insured->getMin()->getAmount(), - $insured->getMax()->getAmount() - ); + if (! $max) { + Logger::warning( + 'Carrier advertises insurance without a maximum, so no insurance amounts can be offered', + ['carrier' => $carrier->carrier] + ); + + return []; + } + + $min = $insurance->getMin(); + + return InsuranceTierMath::buildTiers($min ? $min->getAmount() : 0, $max->getAmount()); } /** diff --git a/src/SdkApi/Service/CoreApi/Shipment/CapabilitiesService.php b/src/SdkApi/Service/CoreApi/Shipment/CapabilitiesService.php index 55e8aaafd..286db3e1c 100644 --- a/src/SdkApi/Service/CoreApi/Shipment/CapabilitiesService.php +++ b/src/SdkApi/Service/CoreApi/Shipment/CapabilitiesService.php @@ -115,7 +115,7 @@ public function getCapabilities(array $parameters, bool $filterSupported = false /** @var CapabilitiesResponsesCapabilitiesV2 $response */ $response = $this->shipmentApi->postCapabilities($request, $this->getUserAgent()); - $results = $response->getResults(); + $results = $this->dropDeprecatedInsuranceShape($response->getResults()); return $filterSupported ? $this->filterSupportedCapabilities($results) : $results; } @@ -263,8 +263,46 @@ public function getContractDefinitions(?string $carrier, bool $filterSupported = $request, $this->getUserAgent() ); - $items = $response->getItems(); + $items = $this->dropDeprecatedInsuranceShape($response->getItems()); return $filterSupported ? $this->filterSupportedCapabilities($items) : $items; } + + /** + * Remove the deprecated nested insurance wrapper so only the flat bounds survive. + * + * The API still returns `insured_amount` alongside the flat `min`/`max`/`default`. We drop + * it on the way in so nothing downstream can start depending on it again: stored carrier + * data and the payload handed to the admin end up flat-only, on the migration refresh and + * on every refresh after it. + * + * Uses the same trick as {@see stripUnregisteredOptions()}: `insured_amount` is declared + * non-nullable, and the serializer omits non-nullable nulls, so setting it to null makes + * the key disappear from `jsonSerialize()` entirely. + * + * @TODO: Remove this method and both call sites once INT-1696 has regenerated the SDK + * against the schema without the nested wrapper — there is nothing left to strip + * then, and the property no longer exists on the model. + * + * @param array $models + * + * @return array + */ + private function dropDeprecatedInsuranceShape(array $models): array + { + foreach ($models as $model) { + $options = $model->getOptions(); + + if (null !== $options) { + $insurance = $options->getInsurance(); + + if (null !== $insurance && null !== $insurance->getInsuredAmount()) { + // @phpstan-ignore argument.type + $insurance->offsetSet('insured_amount', null); + } + } + } + + return $models; + } } diff --git a/tests/Bootstrap/MockCarrierCapabilitiesRepository.php b/tests/Bootstrap/MockCarrierCapabilitiesRepository.php index 4bad4cdc6..b5866c9fd 100644 --- a/tests/Bootstrap/MockCarrierCapabilitiesRepository.php +++ b/tests/Bootstrap/MockCarrierCapabilitiesRepository.php @@ -114,9 +114,10 @@ private function buildPermissiveCapabilities(string $carrierName): array 'sameDayDelivery' => $option, 'saturdayDelivery' => $option, 'tracked' => $option, - 'insurance' => array_merge($option, [ - 'insuredAmount' => $this->resolveInsuredAmountFromCarrier($carrierName), - ]), + 'insurance' => array_merge( + $option, + $this->resolveInsuranceBoundsFromCarrier($carrierName) + ), 'priorityDelivery' => $option, 'requiresReceiptCode' => $option, 'scheduledCollection' => $option, @@ -154,12 +155,13 @@ private function buildPermissiveCapabilities(string $carrierName): array * using `factory(Carrier::class)->withInsurance($default, $min, $max)` keep working * after the calculator switched to per-shipment capability bounds. * - * Falls back to a permissive 0–500000 range when the carrier or its insurance option - * is not configured. + * Returns the flat `default`/`min`/`max` keys the capabilities response uses, ready to + * merge into the insurance option. Falls back to a permissive 0–500000 range when the + * carrier or its insurance option is not configured. * * @return array> */ - private function resolveInsuredAmountFromCarrier(string $carrierName): array + private function resolveInsuranceBoundsFromCarrier(string $carrierName): array { try { $shop = Pdk::get(AccountSettingsServiceInterface::class)->getShop(); @@ -170,15 +172,20 @@ private function resolveInsuredAmountFromCarrier(string $carrierName): array }) : null; - $insured = $carrier && $carrier->options - ? $carrier->options->getInsurance()->getInsuredAmount() // @phpstan-ignore-line SDK declares non-nullable but may be missing + $insurance = $carrier && $carrier->options + ? $carrier->options->getInsurance() // @phpstan-ignore-line SDK declares non-nullable but may be missing : null; - if ($insured) { + $min = $insurance ? $insurance->getMin() : null; + $max = $insurance ? $insurance->getMax() : null; + + if ($min && $max) { + $default = $insurance->getDefault(); + return [ - 'default' => ['currency' => 'EUR', 'amount' => $insured->getDefault()->getAmount()], - 'min' => ['currency' => 'EUR', 'amount' => $insured->getMin()->getAmount()], - 'max' => ['currency' => 'EUR', 'amount' => $insured->getMax()->getAmount()], + 'default' => ['currency' => 'EUR', 'amount' => $default ? $default->getAmount() : 0], + 'min' => ['currency' => 'EUR', 'amount' => $min->getAmount()], + 'max' => ['currency' => 'EUR', 'amount' => $max->getAmount()], ]; } } catch (Throwable $e) { diff --git a/tests/SdkApi/Response/ExampleContractDefinitionsResponse.php b/tests/SdkApi/Response/ExampleContractDefinitionsResponse.php index 02cf7bcbe..b053d6429 100644 --- a/tests/SdkApi/Response/ExampleContractDefinitionsResponse.php +++ b/tests/SdkApi/Response/ExampleContractDefinitionsResponse.php @@ -60,9 +60,15 @@ protected function getDefaultItems(): array 'transactionTypes' => ['B2C', 'B2B'], 'options' => [ 'requiresAgeVerification' => ['isSelectedByDefault' => false, 'isRequired' => false], + // Insurance bounds appear twice, matching what the API sends today: the flat + // fields plus the deprecated nested wrapper. The PDK drops the nested one on + // the way in, so only the flat bounds should reach stored carrier data. 'insurance' => [ 'isSelectedByDefault' => false, 'isRequired' => false, + 'default' => ['amount' => 0, 'currency' => 'EUR'], + 'max' => ['amount' => 500000, 'currency' => 'EUR'], + 'min' => ['amount' => 0, 'currency' => 'EUR'], 'insuredAmount' => [ 'default' => ['amount' => 0, 'currency' => 'EUR'], 'max' => ['amount' => 500000, 'currency' => 'EUR'], diff --git a/tests/Unit/App/Action/Backend/Account/UpdateAccountActionTest.php b/tests/Unit/App/Action/Backend/Account/UpdateAccountActionTest.php index ba214645d..b2059b4e7 100644 --- a/tests/Unit/App/Action/Backend/Account/UpdateAccountActionTest.php +++ b/tests/Unit/App/Action/Backend/Account/UpdateAccountActionTest.php @@ -160,12 +160,13 @@ function executeUpdateAccount( $insurance = $options->getInsurance(); expect($insurance->getIsSelectedByDefault())->toBeFalse(); expect($insurance->getIsRequired())->toBeFalse(); - expect($insurance->getInsuredAmount()->getDefault()->getCurrency())->toBe('EUR'); - expect($insurance->getInsuredAmount()->getDefault()->getAmount())->toBe(0); - expect($insurance->getInsuredAmount()->getMin()->getCurrency())->toBe('EUR'); - expect($insurance->getInsuredAmount()->getMin()->getAmount())->toBe(0); - expect($insurance->getInsuredAmount()->getMax()->getCurrency())->toBe('EUR'); - expect($insurance->getInsuredAmount()->getMax()->getAmount())->toBe(500000); + expect($insurance->getInsuredAmount())->toBeNull(); + expect($insurance->getDefault()->getCurrency())->toBe('EUR'); + expect($insurance->getDefault()->getAmount())->toBe(0); + expect($insurance->getMin()->getCurrency())->toBe('EUR'); + expect($insurance->getMin()->getAmount())->toBe(0); + expect($insurance->getMax()->getCurrency())->toBe('EUR'); + expect($insurance->getMax()->getAmount())->toBe(500000); expect($firstCarrier->collo->getMax())->toBe(10); }); diff --git a/tests/Unit/App/Order/Calculator/General/InsuranceCalculatorTest.php b/tests/Unit/App/Order/Calculator/General/InsuranceCalculatorTest.php index 222b4d715..4b04e821b 100644 --- a/tests/Unit/App/Order/Calculator/General/InsuranceCalculatorTest.php +++ b/tests/Unit/App/Order/Calculator/General/InsuranceCalculatorTest.php @@ -756,3 +756,43 @@ // orderPrice 5000 < fromAmount 10000 → would return 0, but carrier min=50000 takes precedence expect($newOrder->deliveryOptions->shipmentOptions->insurance)->toBe(50000); }); + +it('keeps the requested amount when the shipment capability advertises insurance without bounds', function () { + mockPdkProperty('orderCalculators', [InsuranceCalculator::class]); + + // What an install looks like before its stored carrier data has been refreshed: the + // insurance option is present, but the flat bounds are missing. No maximum means no + // carrier ceiling, so the requested amount survives — and no fatal on a null money object. + factory(Shop::class) + ->withCarriers( + factory(CarrierCollection::class) + ->push(factory(Carrier::class)->withAllCapabilities(RefCapabilitiesSharedCarrierV2::POSTNL)) + ->push( + factory(Carrier::class) + ->withCarrier(RefCapabilitiesSharedCarrierV2::TRUNKRS) + ->withOptions(['insurance' => ['isRequired' => false, 'isSelectedByDefault' => false]]) + ) + ) + ->store(); + + factory(Settings::class) + ->withCarrier(RefCapabilitiesSharedCarrierV2::TRUNKRS, [ + (new InsuranceDefinition())->getCarrierSettingsKey() => true, + CarrierSettings::EXPORT_INSURANCE_UP_TO => 200000, + ]) + ->store(); + + $order = factory(PdkOrder::class) + ->withDeliveryOptions( + factory(DeliveryOptions::class) + ->withCarrier(RefCapabilitiesSharedCarrierV2::TRUNKRS) + ->withShipmentOptions(factory(ShipmentOptions::class)->withInsurance(10000)) + ) + ->make(); + + /** @var \MyParcelNL\Pdk\App\Order\Contract\PdkOrderOptionsServiceInterface $service */ + $service = Pdk::get(PdkOrderOptionsServiceInterface::class); + $newOrder = $service->calculate($order); + + expect($newOrder->deliveryOptions->shipmentOptions->insurance)->toBe(10000); +}); diff --git a/tests/Unit/Base/Model/SdkBackedModelTest.php b/tests/Unit/Base/Model/SdkBackedModelTest.php index a7ec3395a..75fdcc5a2 100644 --- a/tests/Unit/Base/Model/SdkBackedModelTest.php +++ b/tests/Unit/Base/Model/SdkBackedModelTest.php @@ -14,7 +14,6 @@ use MyParcelNL\Sdk\Client\Generated\CoreApi\Model\RefCapabilitiesContractDefinitionsResponseOptionsOptionV2; use MyParcelNL\Sdk\Client\Generated\CoreApi\Model\RefCapabilitiesContractDefinitionsResponseOptionsOptionsV2; use MyParcelNL\Sdk\Client\Generated\CoreApi\Model\RefCapabilitiesResponseCollo; -use MyParcelNL\Sdk\Client\Generated\CoreApi\Model\RefCapabilitiesSharedOptionsInsuranceBaseInsuranceV2InsuredAmount; use MyParcelNL\Sdk\Client\Generated\CoreApi\Model\RefTypesMoney; use function expect; use function MyParcelNL\Pdk\Tests\usesShared; @@ -253,15 +252,13 @@ ->and($reload->collo->getMax())->toBe(4); }); -it('hydrates insurance option with nested insuredAmount from plain arrays', function () { +it('hydrates insurance option bounds from plain arrays', function () { $carrier = new Carrier([ 'options' => [ 'insurance' => [ - 'insuredAmount' => [ - 'default' => ['currency' => 'EUR', 'amount' => 0], - 'min' => ['currency' => 'EUR', 'amount' => 0], - 'max' => ['currency' => 'EUR', 'amount' => 500000], - ], + 'default' => ['currency' => 'EUR', 'amount' => 0], + 'min' => ['currency' => 'EUR', 'amount' => 0], + 'max' => ['currency' => 'EUR', 'amount' => 500000], ], ], ]); @@ -272,13 +269,10 @@ $insurance = $options->getInsurance(); expect($insurance)->toBeInstanceOf(RefCapabilitiesContractDefinitionsResponseOptionsInsuranceOptionV2::class); - $insuredAmount = $insurance->getInsuredAmount(); - expect($insuredAmount)->toBeInstanceOf(RefCapabilitiesSharedOptionsInsuranceBaseInsuranceV2InsuredAmount::class); - - expect($insuredAmount->getMax())->toBeInstanceOf(RefTypesMoney::class) - ->and($insuredAmount->getMax()->getAmount())->toBe(500000) - ->and($insuredAmount->getMin())->toBeInstanceOf(RefTypesMoney::class) - ->and($insuredAmount->getMin()->getAmount())->toBe(0) - ->and($insuredAmount->getDefault())->toBeInstanceOf(RefTypesMoney::class) - ->and($insuredAmount->getDefault()->getAmount())->toBe(0); + expect($insurance->getMax())->toBeInstanceOf(RefTypesMoney::class) + ->and($insurance->getMax()->getAmount())->toBe(500000) + ->and($insurance->getMin())->toBeInstanceOf(RefTypesMoney::class) + ->and($insurance->getMin()->getAmount())->toBe(0) + ->and($insurance->getDefault())->toBeInstanceOf(RefTypesMoney::class) + ->and($insurance->getDefault()->getAmount())->toBe(0); }); diff --git a/tests/Unit/Carrier/Service/CarrierValidationServiceTest.php b/tests/Unit/Carrier/Service/CarrierValidationServiceTest.php index dce9364df..dbc3832ae 100644 --- a/tests/Unit/Carrier/Service/CarrierValidationServiceTest.php +++ b/tests/Unit/Carrier/Service/CarrierValidationServiceTest.php @@ -140,6 +140,20 @@ expect($service->getAllowedInsuranceAmounts($carrier))->toEqual([]); }); +it('getAllowedInsuranceAmounts returns an empty array when insurance carries no bounds', function () { + // What a carrier looks like before its stored data has been refreshed: the insurance + // option is advertised, but without the flat bounds to build a ladder from. + $carrier = factory(Carrier::class) + ->withCarrier('POSTNL') + ->withOptions(['insurance' => ['isRequired' => false, 'isSelectedByDefault' => false]]) + ->make(); + + /** @var CarrierValidationService $service */ + $service = Pdk::get(CarrierValidationService::class); + + expect($service->getAllowedInsuranceAmounts($carrier))->toEqual([]); +}); + it('getAllowedInsuranceAmounts returns the tier ladder when insurance is available', function () { $carrier = factory(Carrier::class) ->withCarrier('POSTNL') diff --git a/tests/Unit/SdkApi/Service/CoreApi/Shipment/CapabilitiesServiceTest.php b/tests/Unit/SdkApi/Service/CoreApi/Shipment/CapabilitiesServiceTest.php index 2ae50508c..b970e96a6 100644 --- a/tests/Unit/SdkApi/Service/CoreApi/Shipment/CapabilitiesServiceTest.php +++ b/tests/Unit/SdkApi/Service/CoreApi/Shipment/CapabilitiesServiceTest.php @@ -430,6 +430,88 @@ protected function createGuzzleClient(): \GuzzleHttp\Client expect($responseLog[0]['context']['body'])->toBe(['items' => []]); }); +// Tests for dropping the deprecated nested insurance wrapper +it('getCapabilities keeps the flat insurance bounds and drops the nested wrapper', function () { + TestBootstrapper::hasApiKey('test-key'); + + $service = new MockableCapabilitiesService(); + // Mirrors what the API sends today: flat bounds AND the deprecated nested wrapper. + // The nested one carries different amounts so we can prove which set survived. + $service->mockHandler->append(new Response(200, [], json_encode([ + 'results' => [ + [ + 'carrier' => RefCapabilitiesSharedCarrierV2::POSTNL, + 'options' => [ + 'insurance' => [ + 'isSelectedByDefault' => false, + 'isRequired' => false, + 'requires' => [], + 'excludes' => [], + 'min' => ['amount' => 10000, 'currency' => 'EUR'], + 'max' => ['amount' => 200000, 'currency' => 'EUR'], + 'default' => ['amount' => 50000, 'currency' => 'EUR'], + 'insuredAmount' => [ + 'min' => ['amount' => 1, 'currency' => 'EUR'], + 'max' => ['amount' => 2, 'currency' => 'EUR'], + 'default' => ['amount' => 3, 'currency' => 'EUR'], + ], + ], + ], + ], + ], + ]))); + + $results = $service->getCapabilities([ + 'carrier' => 'POSTNL', + 'recipient' => ['country_code' => 'NL'], + 'package_type' => 'PACKAGE', + ]); + $insurance = $results[0]->getOptions() + ->getInsurance(); + + expect($insurance->getInsuredAmount())->toBeNull() + ->and($insurance->getMin()->getAmount())->toBe(10000) + ->and($insurance->getMax()->getAmount())->toBe(200000) + ->and($insurance->getDefault()->getAmount())->toBe(50000) + // Serialization is what reaches stored carrier data and the admin payload. + ->and((array) $insurance->jsonSerialize())->not->toHaveKey('insuredAmount'); +}); + +it('getContractDefinitions drops the nested insurance wrapper', function () { + TestBootstrapper::hasApiKey('test-key'); + + $service = new MockableCapabilitiesService(); + $service->mockHandler->append(new Response(200, [], json_encode([ + 'items' => [ + [ + 'carrier' => RefCapabilitiesSharedCarrierV2::POSTNL, + 'options' => [ + 'insurance' => [ + 'isSelectedByDefault' => false, + 'isRequired' => false, + 'min' => ['amount' => 0, 'currency' => 'EUR'], + 'max' => ['amount' => 500000, 'currency' => 'EUR'], + 'default' => ['amount' => 0, 'currency' => 'EUR'], + 'insuredAmount' => [ + 'min' => ['amount' => 1, 'currency' => 'EUR'], + 'max' => ['amount' => 2, 'currency' => 'EUR'], + 'default' => ['amount' => 3, 'currency' => 'EUR'], + ], + ], + ], + ], + ], + ]))); + + $items = $service->getContractDefinitions(null); + $insurance = $items[0]->getOptions() + ->getInsurance(); + + expect($insurance->getInsuredAmount())->toBeNull() + ->and($insurance->getMax()->getAmount())->toBe(500000) + ->and((array) $insurance->jsonSerialize())->not->toHaveKey('insuredAmount'); +}); + // Tests for Accept-header middleware in CapabilitiesService it('sets version-2 Accept header for all capabilities endpoints', function () { TestBootstrapper::hasApiKey('test-key'); diff --git a/tests/__snapshots__/AccountTest__it_creates_storable_array__1.json b/tests/__snapshots__/AccountTest__it_creates_storable_array__1.json index f9f8e9ce6..902ca95c3 100644 --- a/tests/__snapshots__/AccountTest__it_creates_storable_array__1.json +++ b/tests/__snapshots__/AccountTest__it_creates_storable_array__1.json @@ -52,19 +52,17 @@ "scheduledCollection": [], "tracked": [], "insurance": { - "insuredAmount": { - "default": { - "currency": "EUR", - "amount": 0 - }, - "min": { - "currency": "EUR", - "amount": 0 - }, - "max": { - "currency": "EUR", - "amount": 500000 - } + "default": { + "currency": "EUR", + "amount": 0 + }, + "min": { + "currency": "EUR", + "amount": 0 + }, + "max": { + "currency": "EUR", + "amount": 500000 } } }, @@ -108,19 +106,17 @@ "scheduledCollection": [], "tracked": [], "insurance": { - "insuredAmount": { - "default": { - "currency": "EUR", - "amount": 0 - }, - "min": { - "currency": "EUR", - "amount": 0 - }, - "max": { - "currency": "EUR", - "amount": 500000 - } + "default": { + "currency": "EUR", + "amount": 0 + }, + "min": { + "currency": "EUR", + "amount": 0 + }, + "max": { + "currency": "EUR", + "amount": 500000 } } }, @@ -164,19 +160,17 @@ "scheduledCollection": [], "tracked": [], "insurance": { - "insuredAmount": { - "default": { - "currency": "EUR", - "amount": 0 - }, - "min": { - "currency": "EUR", - "amount": 0 - }, - "max": { - "currency": "EUR", - "amount": 500000 - } + "default": { + "currency": "EUR", + "amount": 0 + }, + "min": { + "currency": "EUR", + "amount": 0 + }, + "max": { + "currency": "EUR", + "amount": 500000 } } }, @@ -220,19 +214,17 @@ "scheduledCollection": [], "tracked": [], "insurance": { - "insuredAmount": { - "default": { - "currency": "EUR", - "amount": 0 - }, - "min": { - "currency": "EUR", - "amount": 0 - }, - "max": { - "currency": "EUR", - "amount": 500000 - } + "default": { + "currency": "EUR", + "amount": 0 + }, + "min": { + "currency": "EUR", + "amount": 0 + }, + "max": { + "currency": "EUR", + "amount": 500000 } } }, @@ -276,19 +268,17 @@ "scheduledCollection": [], "tracked": [], "insurance": { - "insuredAmount": { - "default": { - "currency": "EUR", - "amount": 0 - }, - "min": { - "currency": "EUR", - "amount": 0 - }, - "max": { - "currency": "EUR", - "amount": 500000 - } + "default": { + "currency": "EUR", + "amount": 0 + }, + "min": { + "currency": "EUR", + "amount": 0 + }, + "max": { + "currency": "EUR", + "amount": 500000 } } }, @@ -332,19 +322,17 @@ "scheduledCollection": [], "tracked": [], "insurance": { - "insuredAmount": { - "default": { - "currency": "EUR", - "amount": 0 - }, - "min": { - "currency": "EUR", - "amount": 0 - }, - "max": { - "currency": "EUR", - "amount": 500000 - } + "default": { + "currency": "EUR", + "amount": 0 + }, + "min": { + "currency": "EUR", + "amount": 0 + }, + "max": { + "currency": "EUR", + "amount": 500000 } } }, @@ -388,19 +376,17 @@ "scheduledCollection": [], "tracked": [], "insurance": { - "insuredAmount": { - "default": { - "currency": "EUR", - "amount": 0 - }, - "min": { - "currency": "EUR", - "amount": 0 - }, - "max": { - "currency": "EUR", - "amount": 500000 - } + "default": { + "currency": "EUR", + "amount": 0 + }, + "min": { + "currency": "EUR", + "amount": 0 + }, + "max": { + "currency": "EUR", + "amount": 500000 } } }, @@ -444,19 +430,17 @@ "scheduledCollection": [], "tracked": [], "insurance": { - "insuredAmount": { - "default": { - "currency": "EUR", - "amount": 0 - }, - "min": { - "currency": "EUR", - "amount": 0 - }, - "max": { - "currency": "EUR", - "amount": 500000 - } + "default": { + "currency": "EUR", + "amount": 0 + }, + "min": { + "currency": "EUR", + "amount": 0 + }, + "max": { + "currency": "EUR", + "amount": 500000 } } }, @@ -500,19 +484,17 @@ "scheduledCollection": [], "tracked": [], "insurance": { - "insuredAmount": { - "default": { - "currency": "EUR", - "amount": 0 - }, - "min": { - "currency": "EUR", - "amount": 0 - }, - "max": { - "currency": "EUR", - "amount": 500000 - } + "default": { + "currency": "EUR", + "amount": 0 + }, + "min": { + "currency": "EUR", + "amount": 0 + }, + "max": { + "currency": "EUR", + "amount": 500000 } } }, @@ -556,19 +538,17 @@ "scheduledCollection": [], "tracked": [], "insurance": { - "insuredAmount": { - "default": { - "currency": "EUR", - "amount": 0 - }, - "min": { - "currency": "EUR", - "amount": 0 - }, - "max": { - "currency": "EUR", - "amount": 500000 - } + "default": { + "currency": "EUR", + "amount": 0 + }, + "min": { + "currency": "EUR", + "amount": 0 + }, + "max": { + "currency": "EUR", + "amount": 500000 } } }, @@ -612,19 +592,17 @@ "scheduledCollection": [], "tracked": [], "insurance": { - "insuredAmount": { - "default": { - "currency": "EUR", - "amount": 0 - }, - "min": { - "currency": "EUR", - "amount": 0 - }, - "max": { - "currency": "EUR", - "amount": 500000 - } + "default": { + "currency": "EUR", + "amount": 0 + }, + "min": { + "currency": "EUR", + "amount": 0 + }, + "max": { + "currency": "EUR", + "amount": 500000 } } }, @@ -668,19 +646,17 @@ "scheduledCollection": [], "tracked": [], "insurance": { - "insuredAmount": { - "default": { - "currency": "EUR", - "amount": 0 - }, - "min": { - "currency": "EUR", - "amount": 0 - }, - "max": { - "currency": "EUR", - "amount": 500000 - } + "default": { + "currency": "EUR", + "amount": 0 + }, + "min": { + "currency": "EUR", + "amount": 0 + }, + "max": { + "currency": "EUR", + "amount": 500000 } } }, @@ -724,19 +700,17 @@ "scheduledCollection": [], "tracked": [], "insurance": { - "insuredAmount": { - "default": { - "currency": "EUR", - "amount": 0 - }, - "min": { - "currency": "EUR", - "amount": 0 - }, - "max": { - "currency": "EUR", - "amount": 500000 - } + "default": { + "currency": "EUR", + "amount": 0 + }, + "min": { + "currency": "EUR", + "amount": 0 + }, + "max": { + "currency": "EUR", + "amount": 500000 } } }, @@ -780,19 +754,17 @@ "scheduledCollection": [], "tracked": [], "insurance": { - "insuredAmount": { - "default": { - "currency": "EUR", - "amount": 0 - }, - "min": { - "currency": "EUR", - "amount": 0 - }, - "max": { - "currency": "EUR", - "amount": 500000 - } + "default": { + "currency": "EUR", + "amount": 0 + }, + "min": { + "currency": "EUR", + "amount": 0 + }, + "max": { + "currency": "EUR", + "amount": 500000 } } }, @@ -836,19 +808,17 @@ "scheduledCollection": [], "tracked": [], "insurance": { - "insuredAmount": { - "default": { - "currency": "EUR", - "amount": 0 - }, - "min": { - "currency": "EUR", - "amount": 0 - }, - "max": { - "currency": "EUR", - "amount": 500000 - } + "default": { + "currency": "EUR", + "amount": 0 + }, + "min": { + "currency": "EUR", + "amount": 0 + }, + "max": { + "currency": "EUR", + "amount": 500000 } } }, @@ -892,19 +862,17 @@ "scheduledCollection": [], "tracked": [], "insurance": { - "insuredAmount": { - "default": { - "currency": "EUR", - "amount": 0 - }, - "min": { - "currency": "EUR", - "amount": 0 - }, - "max": { - "currency": "EUR", - "amount": 500000 - } + "default": { + "currency": "EUR", + "amount": 0 + }, + "min": { + "currency": "EUR", + "amount": 0 + }, + "max": { + "currency": "EUR", + "amount": 500000 } } }, diff --git a/tests/__snapshots__/ContextServiceTest__it_gets_context_data_with_data_set_multiple_orders__1.json b/tests/__snapshots__/ContextServiceTest__it_gets_context_data_with_data_set_multiple_orders__1.json index 86f952f5f..f688d3672 100644 --- a/tests/__snapshots__/ContextServiceTest__it_gets_context_data_with_data_set_multiple_orders__1.json +++ b/tests/__snapshots__/ContextServiceTest__it_gets_context_data_with_data_set_multiple_orders__1.json @@ -30,19 +30,17 @@ "scheduledCollection": [], "tracked": [], "insurance": { - "insuredAmount": { - "default": { - "currency": "EUR", - "amount": 0 - }, - "min": { - "currency": "EUR", - "amount": 0 - }, - "max": { - "currency": "EUR", - "amount": 500000 - } + "default": { + "currency": "EUR", + "amount": 0 + }, + "min": { + "currency": "EUR", + "amount": 0 + }, + "max": { + "currency": "EUR", + "amount": 500000 } } }, @@ -508,19 +506,17 @@ "scheduledCollection": [], "tracked": [], "insurance": { - "insuredAmount": { - "default": { - "currency": "EUR", - "amount": 0 - }, - "min": { - "currency": "EUR", - "amount": 0 - }, - "max": { - "currency": "EUR", - "amount": 500000 - } + "default": { + "currency": "EUR", + "amount": 0 + }, + "min": { + "currency": "EUR", + "amount": 0 + }, + "max": { + "currency": "EUR", + "amount": 500000 } } }, diff --git a/tests/__snapshots__/ContextServiceTest__it_gets_context_data_with_data_set_single_order__1.json b/tests/__snapshots__/ContextServiceTest__it_gets_context_data_with_data_set_single_order__1.json index c6663ec17..4397f833f 100644 --- a/tests/__snapshots__/ContextServiceTest__it_gets_context_data_with_data_set_single_order__1.json +++ b/tests/__snapshots__/ContextServiceTest__it_gets_context_data_with_data_set_single_order__1.json @@ -30,19 +30,17 @@ "scheduledCollection": [], "tracked": [], "insurance": { - "insuredAmount": { - "default": { - "currency": "EUR", - "amount": 0 - }, - "min": { - "currency": "EUR", - "amount": 0 - }, - "max": { - "currency": "EUR", - "amount": 500000 - } + "default": { + "currency": "EUR", + "amount": 0 + }, + "min": { + "currency": "EUR", + "amount": 0 + }, + "max": { + "currency": "EUR", + "amount": 500000 } } }, diff --git a/tests/__snapshots__/CreateReturnShipmentsTest__it_creates_return_shipment_with_data_set_simple_domestic_shipment__1.json b/tests/__snapshots__/CreateReturnShipmentsTest__it_creates_return_shipment_with_data_set_simple_domestic_shipment__1.json index 989f5c3d8..8fe00a9f3 100644 --- a/tests/__snapshots__/CreateReturnShipmentsTest__it_creates_return_shipment_with_data_set_simple_domestic_shipment__1.json +++ b/tests/__snapshots__/CreateReturnShipmentsTest__it_creates_return_shipment_with_data_set_simple_domestic_shipment__1.json @@ -33,19 +33,17 @@ "scheduledCollection": [], "tracked": [], "insurance": { - "insuredAmount": { - "default": { - "currency": "EUR", - "amount": 0 - }, - "min": { - "currency": "EUR", - "amount": 0 - }, - "max": { - "currency": "EUR", - "amount": 500000 - } + "default": { + "currency": "EUR", + "amount": 0 + }, + "min": { + "currency": "EUR", + "amount": 0 + }, + "max": { + "currency": "EUR", + "amount": 500000 } } }, @@ -110,19 +108,17 @@ "scheduledCollection": [], "tracked": [], "insurance": { - "insuredAmount": { - "default": { - "currency": "EUR", - "amount": 0 - }, - "min": { - "currency": "EUR", - "amount": 0 - }, - "max": { - "currency": "EUR", - "amount": 500000 - } + "default": { + "currency": "EUR", + "amount": 0 + }, + "min": { + "currency": "EUR", + "amount": 0 + }, + "max": { + "currency": "EUR", + "amount": 500000 } } }, diff --git a/tests/__snapshots__/ExportReturnActionTest__it_exports_return_with_data_set_insurance__1.json b/tests/__snapshots__/ExportReturnActionTest__it_exports_return_with_data_set_insurance__1.json index 602d849ef..e98d972f9 100644 --- a/tests/__snapshots__/ExportReturnActionTest__it_exports_return_with_data_set_insurance__1.json +++ b/tests/__snapshots__/ExportReturnActionTest__it_exports_return_with_data_set_insurance__1.json @@ -31,19 +31,17 @@ "scheduledCollection": [], "tracked": [], "insurance": { - "insuredAmount": { - "default": { - "currency": "EUR", - "amount": 0 - }, - "min": { - "currency": "EUR", - "amount": 0 - }, - "max": { - "currency": "EUR", - "amount": 500000 - } + "default": { + "currency": "EUR", + "amount": 0 + }, + "min": { + "currency": "EUR", + "amount": 0 + }, + "max": { + "currency": "EUR", + "amount": 500000 } } }, @@ -136,19 +134,17 @@ "scheduledCollection": [], "tracked": [], "insurance": { - "insuredAmount": { - "default": { - "currency": "EUR", - "amount": 0 - }, - "min": { - "currency": "EUR", - "amount": 0 - }, - "max": { - "currency": "EUR", - "amount": 500000 - } + "default": { + "currency": "EUR", + "amount": 0 + }, + "min": { + "currency": "EUR", + "amount": 0 + }, + "max": { + "currency": "EUR", + "amount": 500000 } } }, @@ -195,19 +191,17 @@ "scheduledCollection": [], "tracked": [], "insurance": { - "insuredAmount": { - "default": { - "currency": "EUR", - "amount": 0 - }, - "min": { - "currency": "EUR", - "amount": 0 - }, - "max": { - "currency": "EUR", - "amount": 500000 - } + "default": { + "currency": "EUR", + "amount": 0 + }, + "min": { + "currency": "EUR", + "amount": 0 + }, + "max": { + "currency": "EUR", + "amount": 500000 } } }, @@ -285,19 +279,17 @@ "scheduledCollection": [], "tracked": [], "insurance": { - "insuredAmount": { - "default": { - "currency": "EUR", - "amount": 0 - }, - "min": { - "currency": "EUR", - "amount": 0 - }, - "max": { - "currency": "EUR", - "amount": 500000 - } + "default": { + "currency": "EUR", + "amount": 0 + }, + "min": { + "currency": "EUR", + "amount": 0 + }, + "max": { + "currency": "EUR", + "amount": 500000 } } }, @@ -344,19 +336,17 @@ "scheduledCollection": [], "tracked": [], "insurance": { - "insuredAmount": { - "default": { - "currency": "EUR", - "amount": 0 - }, - "min": { - "currency": "EUR", - "amount": 0 - }, - "max": { - "currency": "EUR", - "amount": 500000 - } + "default": { + "currency": "EUR", + "amount": 0 + }, + "min": { + "currency": "EUR", + "amount": 0 + }, + "max": { + "currency": "EUR", + "amount": 500000 } } }, @@ -904,19 +894,17 @@ "scheduledCollection": [], "tracked": [], "insurance": { - "insuredAmount": { - "default": { - "currency": "EUR", - "amount": 0 - }, - "min": { - "currency": "EUR", - "amount": 0 - }, - "max": { - "currency": "EUR", - "amount": 500000 - } + "default": { + "currency": "EUR", + "amount": 0 + }, + "min": { + "currency": "EUR", + "amount": 0 + }, + "max": { + "currency": "EUR", + "amount": 500000 } } }, diff --git a/tests/__snapshots__/ExportReturnActionTest__it_exports_return_with_data_set_no_return_capabilities__1.json b/tests/__snapshots__/ExportReturnActionTest__it_exports_return_with_data_set_no_return_capabilities__1.json index 602d849ef..e98d972f9 100644 --- a/tests/__snapshots__/ExportReturnActionTest__it_exports_return_with_data_set_no_return_capabilities__1.json +++ b/tests/__snapshots__/ExportReturnActionTest__it_exports_return_with_data_set_no_return_capabilities__1.json @@ -31,19 +31,17 @@ "scheduledCollection": [], "tracked": [], "insurance": { - "insuredAmount": { - "default": { - "currency": "EUR", - "amount": 0 - }, - "min": { - "currency": "EUR", - "amount": 0 - }, - "max": { - "currency": "EUR", - "amount": 500000 - } + "default": { + "currency": "EUR", + "amount": 0 + }, + "min": { + "currency": "EUR", + "amount": 0 + }, + "max": { + "currency": "EUR", + "amount": 500000 } } }, @@ -136,19 +134,17 @@ "scheduledCollection": [], "tracked": [], "insurance": { - "insuredAmount": { - "default": { - "currency": "EUR", - "amount": 0 - }, - "min": { - "currency": "EUR", - "amount": 0 - }, - "max": { - "currency": "EUR", - "amount": 500000 - } + "default": { + "currency": "EUR", + "amount": 0 + }, + "min": { + "currency": "EUR", + "amount": 0 + }, + "max": { + "currency": "EUR", + "amount": 500000 } } }, @@ -195,19 +191,17 @@ "scheduledCollection": [], "tracked": [], "insurance": { - "insuredAmount": { - "default": { - "currency": "EUR", - "amount": 0 - }, - "min": { - "currency": "EUR", - "amount": 0 - }, - "max": { - "currency": "EUR", - "amount": 500000 - } + "default": { + "currency": "EUR", + "amount": 0 + }, + "min": { + "currency": "EUR", + "amount": 0 + }, + "max": { + "currency": "EUR", + "amount": 500000 } } }, @@ -285,19 +279,17 @@ "scheduledCollection": [], "tracked": [], "insurance": { - "insuredAmount": { - "default": { - "currency": "EUR", - "amount": 0 - }, - "min": { - "currency": "EUR", - "amount": 0 - }, - "max": { - "currency": "EUR", - "amount": 500000 - } + "default": { + "currency": "EUR", + "amount": 0 + }, + "min": { + "currency": "EUR", + "amount": 0 + }, + "max": { + "currency": "EUR", + "amount": 500000 } } }, @@ -344,19 +336,17 @@ "scheduledCollection": [], "tracked": [], "insurance": { - "insuredAmount": { - "default": { - "currency": "EUR", - "amount": 0 - }, - "min": { - "currency": "EUR", - "amount": 0 - }, - "max": { - "currency": "EUR", - "amount": 500000 - } + "default": { + "currency": "EUR", + "amount": 0 + }, + "min": { + "currency": "EUR", + "amount": 0 + }, + "max": { + "currency": "EUR", + "amount": 500000 } } }, @@ -904,19 +894,17 @@ "scheduledCollection": [], "tracked": [], "insurance": { - "insuredAmount": { - "default": { - "currency": "EUR", - "amount": 0 - }, - "min": { - "currency": "EUR", - "amount": 0 - }, - "max": { - "currency": "EUR", - "amount": 500000 - } + "default": { + "currency": "EUR", + "amount": 0 + }, + "min": { + "currency": "EUR", + "amount": 0 + }, + "max": { + "currency": "EUR", + "amount": 500000 } } }, diff --git a/tests/__snapshots__/ExportReturnActionTest__it_exports_return_with_data_set_simple_orders__1.json b/tests/__snapshots__/ExportReturnActionTest__it_exports_return_with_data_set_simple_orders__1.json index b3ce38c85..2de4ef2c1 100644 --- a/tests/__snapshots__/ExportReturnActionTest__it_exports_return_with_data_set_simple_orders__1.json +++ b/tests/__snapshots__/ExportReturnActionTest__it_exports_return_with_data_set_simple_orders__1.json @@ -31,19 +31,17 @@ "scheduledCollection": [], "tracked": [], "insurance": { - "insuredAmount": { - "default": { - "currency": "EUR", - "amount": 0 - }, - "min": { - "currency": "EUR", - "amount": 0 - }, - "max": { - "currency": "EUR", - "amount": 500000 - } + "default": { + "currency": "EUR", + "amount": 0 + }, + "min": { + "currency": "EUR", + "amount": 0 + }, + "max": { + "currency": "EUR", + "amount": 500000 } } }, @@ -136,19 +134,17 @@ "scheduledCollection": [], "tracked": [], "insurance": { - "insuredAmount": { - "default": { - "currency": "EUR", - "amount": 0 - }, - "min": { - "currency": "EUR", - "amount": 0 - }, - "max": { - "currency": "EUR", - "amount": 500000 - } + "default": { + "currency": "EUR", + "amount": 0 + }, + "min": { + "currency": "EUR", + "amount": 0 + }, + "max": { + "currency": "EUR", + "amount": 500000 } } }, @@ -195,19 +191,17 @@ "scheduledCollection": [], "tracked": [], "insurance": { - "insuredAmount": { - "default": { - "currency": "EUR", - "amount": 0 - }, - "min": { - "currency": "EUR", - "amount": 0 - }, - "max": { - "currency": "EUR", - "amount": 500000 - } + "default": { + "currency": "EUR", + "amount": 0 + }, + "min": { + "currency": "EUR", + "amount": 0 + }, + "max": { + "currency": "EUR", + "amount": 500000 } } }, @@ -285,19 +279,17 @@ "scheduledCollection": [], "tracked": [], "insurance": { - "insuredAmount": { - "default": { - "currency": "EUR", - "amount": 0 - }, - "min": { - "currency": "EUR", - "amount": 0 - }, - "max": { - "currency": "EUR", - "amount": 500000 - } + "default": { + "currency": "EUR", + "amount": 0 + }, + "min": { + "currency": "EUR", + "amount": 0 + }, + "max": { + "currency": "EUR", + "amount": 500000 } } }, @@ -344,19 +336,17 @@ "scheduledCollection": [], "tracked": [], "insurance": { - "insuredAmount": { - "default": { - "currency": "EUR", - "amount": 0 - }, - "min": { - "currency": "EUR", - "amount": 0 - }, - "max": { - "currency": "EUR", - "amount": 500000 - } + "default": { + "currency": "EUR", + "amount": 0 + }, + "min": { + "currency": "EUR", + "amount": 0 + }, + "max": { + "currency": "EUR", + "amount": 500000 } } }, @@ -904,19 +894,17 @@ "scheduledCollection": [], "tracked": [], "insurance": { - "insuredAmount": { - "default": { - "currency": "EUR", - "amount": 0 - }, - "min": { - "currency": "EUR", - "amount": 0 - }, - "max": { - "currency": "EUR", - "amount": 500000 - } + "default": { + "currency": "EUR", + "amount": 0 + }, + "min": { + "currency": "EUR", + "amount": 0 + }, + "max": { + "currency": "EUR", + "amount": 500000 } } }, diff --git a/tests/__snapshots__/FrontendRenderServiceTest__it_renders_component_with_data_set_init_script__1.json b/tests/__snapshots__/FrontendRenderServiceTest__it_renders_component_with_data_set_init_script__1.json index 63f677c57..2c033a255 100644 --- a/tests/__snapshots__/FrontendRenderServiceTest__it_renders_component_with_data_set_init_script__1.json +++ b/tests/__snapshots__/FrontendRenderServiceTest__it_renders_component_with_data_set_init_script__1.json @@ -327,19 +327,17 @@ "scheduledCollection": [], "tracked": [], "insurance": { - "insuredAmount": { - "default": { - "currency": "EUR", - "amount": 0 - }, - "min": { - "currency": "EUR", - "amount": 0 - }, - "max": { - "currency": "EUR", - "amount": 500000 - } + "default": { + "currency": "EUR", + "amount": 0 + }, + "min": { + "currency": "EUR", + "amount": 0 + }, + "max": { + "currency": "EUR", + "amount": 500000 } } }, @@ -383,19 +381,17 @@ "scheduledCollection": [], "tracked": [], "insurance": { - "insuredAmount": { - "default": { - "currency": "EUR", - "amount": 0 - }, - "min": { - "currency": "EUR", - "amount": 0 - }, - "max": { - "currency": "EUR", - "amount": 500000 - } + "default": { + "currency": "EUR", + "amount": 0 + }, + "min": { + "currency": "EUR", + "amount": 0 + }, + "max": { + "currency": "EUR", + "amount": 500000 } } }, @@ -439,19 +435,17 @@ "scheduledCollection": [], "tracked": [], "insurance": { - "insuredAmount": { - "default": { - "currency": "EUR", - "amount": 0 - }, - "min": { - "currency": "EUR", - "amount": 0 - }, - "max": { - "currency": "EUR", - "amount": 500000 - } + "default": { + "currency": "EUR", + "amount": 0 + }, + "min": { + "currency": "EUR", + "amount": 0 + }, + "max": { + "currency": "EUR", + "amount": 500000 } } }, @@ -495,19 +489,17 @@ "scheduledCollection": [], "tracked": [], "insurance": { - "insuredAmount": { - "default": { - "currency": "EUR", - "amount": 0 - }, - "min": { - "currency": "EUR", - "amount": 0 - }, - "max": { - "currency": "EUR", - "amount": 500000 - } + "default": { + "currency": "EUR", + "amount": 0 + }, + "min": { + "currency": "EUR", + "amount": 0 + }, + "max": { + "currency": "EUR", + "amount": 500000 } } }, @@ -551,19 +543,17 @@ "scheduledCollection": [], "tracked": [], "insurance": { - "insuredAmount": { - "default": { - "currency": "EUR", - "amount": 0 - }, - "min": { - "currency": "EUR", - "amount": 0 - }, - "max": { - "currency": "EUR", - "amount": 500000 - } + "default": { + "currency": "EUR", + "amount": 0 + }, + "min": { + "currency": "EUR", + "amount": 0 + }, + "max": { + "currency": "EUR", + "amount": 500000 } } }, @@ -607,19 +597,17 @@ "scheduledCollection": [], "tracked": [], "insurance": { - "insuredAmount": { - "default": { - "currency": "EUR", - "amount": 0 - }, - "min": { - "currency": "EUR", - "amount": 0 - }, - "max": { - "currency": "EUR", - "amount": 500000 - } + "default": { + "currency": "EUR", + "amount": 0 + }, + "min": { + "currency": "EUR", + "amount": 0 + }, + "max": { + "currency": "EUR", + "amount": 500000 } } }, @@ -663,19 +651,17 @@ "scheduledCollection": [], "tracked": [], "insurance": { - "insuredAmount": { - "default": { - "currency": "EUR", - "amount": 0 - }, - "min": { - "currency": "EUR", - "amount": 0 - }, - "max": { - "currency": "EUR", - "amount": 500000 - } + "default": { + "currency": "EUR", + "amount": 0 + }, + "min": { + "currency": "EUR", + "amount": 0 + }, + "max": { + "currency": "EUR", + "amount": 500000 } } }, @@ -719,19 +705,17 @@ "scheduledCollection": [], "tracked": [], "insurance": { - "insuredAmount": { - "default": { - "currency": "EUR", - "amount": 0 - }, - "min": { - "currency": "EUR", - "amount": 0 - }, - "max": { - "currency": "EUR", - "amount": 500000 - } + "default": { + "currency": "EUR", + "amount": 0 + }, + "min": { + "currency": "EUR", + "amount": 0 + }, + "max": { + "currency": "EUR", + "amount": 500000 } } }, @@ -775,19 +759,17 @@ "scheduledCollection": [], "tracked": [], "insurance": { - "insuredAmount": { - "default": { - "currency": "EUR", - "amount": 0 - }, - "min": { - "currency": "EUR", - "amount": 0 - }, - "max": { - "currency": "EUR", - "amount": 500000 - } + "default": { + "currency": "EUR", + "amount": 0 + }, + "min": { + "currency": "EUR", + "amount": 0 + }, + "max": { + "currency": "EUR", + "amount": 500000 } } }, @@ -831,19 +813,17 @@ "scheduledCollection": [], "tracked": [], "insurance": { - "insuredAmount": { - "default": { - "currency": "EUR", - "amount": 0 - }, - "min": { - "currency": "EUR", - "amount": 0 - }, - "max": { - "currency": "EUR", - "amount": 500000 - } + "default": { + "currency": "EUR", + "amount": 0 + }, + "min": { + "currency": "EUR", + "amount": 0 + }, + "max": { + "currency": "EUR", + "amount": 500000 } } }, @@ -887,19 +867,17 @@ "scheduledCollection": [], "tracked": [], "insurance": { - "insuredAmount": { - "default": { - "currency": "EUR", - "amount": 0 - }, - "min": { - "currency": "EUR", - "amount": 0 - }, - "max": { - "currency": "EUR", - "amount": 500000 - } + "default": { + "currency": "EUR", + "amount": 0 + }, + "min": { + "currency": "EUR", + "amount": 0 + }, + "max": { + "currency": "EUR", + "amount": 500000 } } }, @@ -943,19 +921,17 @@ "scheduledCollection": [], "tracked": [], "insurance": { - "insuredAmount": { - "default": { - "currency": "EUR", - "amount": 0 - }, - "min": { - "currency": "EUR", - "amount": 0 - }, - "max": { - "currency": "EUR", - "amount": 500000 - } + "default": { + "currency": "EUR", + "amount": 0 + }, + "min": { + "currency": "EUR", + "amount": 0 + }, + "max": { + "currency": "EUR", + "amount": 500000 } } }, @@ -999,19 +975,17 @@ "scheduledCollection": [], "tracked": [], "insurance": { - "insuredAmount": { - "default": { - "currency": "EUR", - "amount": 0 - }, - "min": { - "currency": "EUR", - "amount": 0 - }, - "max": { - "currency": "EUR", - "amount": 500000 - } + "default": { + "currency": "EUR", + "amount": 0 + }, + "min": { + "currency": "EUR", + "amount": 0 + }, + "max": { + "currency": "EUR", + "amount": 500000 } } }, @@ -1055,19 +1029,17 @@ "scheduledCollection": [], "tracked": [], "insurance": { - "insuredAmount": { - "default": { - "currency": "EUR", - "amount": 0 - }, - "min": { - "currency": "EUR", - "amount": 0 - }, - "max": { - "currency": "EUR", - "amount": 500000 - } + "default": { + "currency": "EUR", + "amount": 0 + }, + "min": { + "currency": "EUR", + "amount": 0 + }, + "max": { + "currency": "EUR", + "amount": 500000 } } }, @@ -1111,19 +1083,17 @@ "scheduledCollection": [], "tracked": [], "insurance": { - "insuredAmount": { - "default": { - "currency": "EUR", - "amount": 0 - }, - "min": { - "currency": "EUR", - "amount": 0 - }, - "max": { - "currency": "EUR", - "amount": 500000 - } + "default": { + "currency": "EUR", + "amount": 0 + }, + "min": { + "currency": "EUR", + "amount": 0 + }, + "max": { + "currency": "EUR", + "amount": 500000 } } }, @@ -1167,19 +1137,17 @@ "scheduledCollection": [], "tracked": [], "insurance": { - "insuredAmount": { - "default": { - "currency": "EUR", - "amount": 0 - }, - "min": { - "currency": "EUR", - "amount": 0 - }, - "max": { - "currency": "EUR", - "amount": 500000 - } + "default": { + "currency": "EUR", + "amount": 0 + }, + "min": { + "currency": "EUR", + "amount": 0 + }, + "max": { + "currency": "EUR", + "amount": 500000 } } }, @@ -1246,19 +1214,17 @@ "scheduledCollection": [], "tracked": [], "insurance": { - "insuredAmount": { - "default": { - "currency": "EUR", - "amount": 0 - }, - "min": { - "currency": "EUR", - "amount": 0 - }, - "max": { - "currency": "EUR", - "amount": 500000 - } + "default": { + "currency": "EUR", + "amount": 0 + }, + "min": { + "currency": "EUR", + "amount": 0 + }, + "max": { + "currency": "EUR", + "amount": 500000 } } }, @@ -1302,19 +1268,17 @@ "scheduledCollection": [], "tracked": [], "insurance": { - "insuredAmount": { - "default": { - "currency": "EUR", - "amount": 0 - }, - "min": { - "currency": "EUR", - "amount": 0 - }, - "max": { - "currency": "EUR", - "amount": 500000 - } + "default": { + "currency": "EUR", + "amount": 0 + }, + "min": { + "currency": "EUR", + "amount": 0 + }, + "max": { + "currency": "EUR", + "amount": 500000 } } }, @@ -1358,19 +1322,17 @@ "scheduledCollection": [], "tracked": [], "insurance": { - "insuredAmount": { - "default": { - "currency": "EUR", - "amount": 0 - }, - "min": { - "currency": "EUR", - "amount": 0 - }, - "max": { - "currency": "EUR", - "amount": 500000 - } + "default": { + "currency": "EUR", + "amount": 0 + }, + "min": { + "currency": "EUR", + "amount": 0 + }, + "max": { + "currency": "EUR", + "amount": 500000 } } }, @@ -1414,19 +1376,17 @@ "scheduledCollection": [], "tracked": [], "insurance": { - "insuredAmount": { - "default": { - "currency": "EUR", - "amount": 0 - }, - "min": { - "currency": "EUR", - "amount": 0 - }, - "max": { - "currency": "EUR", - "amount": 500000 - } + "default": { + "currency": "EUR", + "amount": 0 + }, + "min": { + "currency": "EUR", + "amount": 0 + }, + "max": { + "currency": "EUR", + "amount": 500000 } } }, @@ -1470,19 +1430,17 @@ "scheduledCollection": [], "tracked": [], "insurance": { - "insuredAmount": { - "default": { - "currency": "EUR", - "amount": 0 - }, - "min": { - "currency": "EUR", - "amount": 0 - }, - "max": { - "currency": "EUR", - "amount": 500000 - } + "default": { + "currency": "EUR", + "amount": 0 + }, + "min": { + "currency": "EUR", + "amount": 0 + }, + "max": { + "currency": "EUR", + "amount": 500000 } } }, @@ -1526,19 +1484,17 @@ "scheduledCollection": [], "tracked": [], "insurance": { - "insuredAmount": { - "default": { - "currency": "EUR", - "amount": 0 - }, - "min": { - "currency": "EUR", - "amount": 0 - }, - "max": { - "currency": "EUR", - "amount": 500000 - } + "default": { + "currency": "EUR", + "amount": 0 + }, + "min": { + "currency": "EUR", + "amount": 0 + }, + "max": { + "currency": "EUR", + "amount": 500000 } } }, @@ -1582,19 +1538,17 @@ "scheduledCollection": [], "tracked": [], "insurance": { - "insuredAmount": { - "default": { - "currency": "EUR", - "amount": 0 - }, - "min": { - "currency": "EUR", - "amount": 0 - }, - "max": { - "currency": "EUR", - "amount": 500000 - } + "default": { + "currency": "EUR", + "amount": 0 + }, + "min": { + "currency": "EUR", + "amount": 0 + }, + "max": { + "currency": "EUR", + "amount": 500000 } } }, @@ -1638,19 +1592,17 @@ "scheduledCollection": [], "tracked": [], "insurance": { - "insuredAmount": { - "default": { - "currency": "EUR", - "amount": 0 - }, - "min": { - "currency": "EUR", - "amount": 0 - }, - "max": { - "currency": "EUR", - "amount": 500000 - } + "default": { + "currency": "EUR", + "amount": 0 + }, + "min": { + "currency": "EUR", + "amount": 0 + }, + "max": { + "currency": "EUR", + "amount": 500000 } } }, @@ -1694,19 +1646,17 @@ "scheduledCollection": [], "tracked": [], "insurance": { - "insuredAmount": { - "default": { - "currency": "EUR", - "amount": 0 - }, - "min": { - "currency": "EUR", - "amount": 0 - }, - "max": { - "currency": "EUR", - "amount": 500000 - } + "default": { + "currency": "EUR", + "amount": 0 + }, + "min": { + "currency": "EUR", + "amount": 0 + }, + "max": { + "currency": "EUR", + "amount": 500000 } } }, @@ -1750,19 +1700,17 @@ "scheduledCollection": [], "tracked": [], "insurance": { - "insuredAmount": { - "default": { - "currency": "EUR", - "amount": 0 - }, - "min": { - "currency": "EUR", - "amount": 0 - }, - "max": { - "currency": "EUR", - "amount": 500000 - } + "default": { + "currency": "EUR", + "amount": 0 + }, + "min": { + "currency": "EUR", + "amount": 0 + }, + "max": { + "currency": "EUR", + "amount": 500000 } } }, @@ -1806,19 +1754,17 @@ "scheduledCollection": [], "tracked": [], "insurance": { - "insuredAmount": { - "default": { - "currency": "EUR", - "amount": 0 - }, - "min": { - "currency": "EUR", - "amount": 0 - }, - "max": { - "currency": "EUR", - "amount": 500000 - } + "default": { + "currency": "EUR", + "amount": 0 + }, + "min": { + "currency": "EUR", + "amount": 0 + }, + "max": { + "currency": "EUR", + "amount": 500000 } } }, @@ -1862,19 +1808,17 @@ "scheduledCollection": [], "tracked": [], "insurance": { - "insuredAmount": { - "default": { - "currency": "EUR", - "amount": 0 - }, - "min": { - "currency": "EUR", - "amount": 0 - }, - "max": { - "currency": "EUR", - "amount": 500000 - } + "default": { + "currency": "EUR", + "amount": 0 + }, + "min": { + "currency": "EUR", + "amount": 0 + }, + "max": { + "currency": "EUR", + "amount": 500000 } } }, @@ -1918,19 +1862,17 @@ "scheduledCollection": [], "tracked": [], "insurance": { - "insuredAmount": { - "default": { - "currency": "EUR", - "amount": 0 - }, - "min": { - "currency": "EUR", - "amount": 0 - }, - "max": { - "currency": "EUR", - "amount": 500000 - } + "default": { + "currency": "EUR", + "amount": 0 + }, + "min": { + "currency": "EUR", + "amount": 0 + }, + "max": { + "currency": "EUR", + "amount": 500000 } } }, @@ -1974,19 +1916,17 @@ "scheduledCollection": [], "tracked": [], "insurance": { - "insuredAmount": { - "default": { - "currency": "EUR", - "amount": 0 - }, - "min": { - "currency": "EUR", - "amount": 0 - }, - "max": { - "currency": "EUR", - "amount": 500000 - } + "default": { + "currency": "EUR", + "amount": 0 + }, + "min": { + "currency": "EUR", + "amount": 0 + }, + "max": { + "currency": "EUR", + "amount": 500000 } } }, @@ -2030,19 +1970,17 @@ "scheduledCollection": [], "tracked": [], "insurance": { - "insuredAmount": { - "default": { - "currency": "EUR", - "amount": 0 - }, - "min": { - "currency": "EUR", - "amount": 0 - }, - "max": { - "currency": "EUR", - "amount": 500000 - } + "default": { + "currency": "EUR", + "amount": 0 + }, + "min": { + "currency": "EUR", + "amount": 0 + }, + "max": { + "currency": "EUR", + "amount": 500000 } } }, @@ -2086,19 +2024,17 @@ "scheduledCollection": [], "tracked": [], "insurance": { - "insuredAmount": { - "default": { - "currency": "EUR", - "amount": 0 - }, - "min": { - "currency": "EUR", - "amount": 0 - }, - "max": { - "currency": "EUR", - "amount": 500000 - } + "default": { + "currency": "EUR", + "amount": 0 + }, + "min": { + "currency": "EUR", + "amount": 0 + }, + "max": { + "currency": "EUR", + "amount": 500000 } } }, @@ -3329,19 +3265,17 @@ "scheduledCollection": [], "tracked": [], "insurance": { - "insuredAmount": { - "default": { - "currency": "EUR", - "amount": 0 - }, - "min": { - "currency": "EUR", - "amount": 0 - }, - "max": { - "currency": "EUR", - "amount": 500000 - } + "default": { + "currency": "EUR", + "amount": 0 + }, + "min": { + "currency": "EUR", + "amount": 0 + }, + "max": { + "currency": "EUR", + "amount": 500000 } } }, @@ -3385,19 +3319,17 @@ "scheduledCollection": [], "tracked": [], "insurance": { - "insuredAmount": { - "default": { - "currency": "EUR", - "amount": 0 - }, - "min": { - "currency": "EUR", - "amount": 0 - }, - "max": { - "currency": "EUR", - "amount": 500000 - } + "default": { + "currency": "EUR", + "amount": 0 + }, + "min": { + "currency": "EUR", + "amount": 0 + }, + "max": { + "currency": "EUR", + "amount": 500000 } } }, @@ -3441,19 +3373,17 @@ "scheduledCollection": [], "tracked": [], "insurance": { - "insuredAmount": { - "default": { - "currency": "EUR", - "amount": 0 - }, - "min": { - "currency": "EUR", - "amount": 0 - }, - "max": { - "currency": "EUR", - "amount": 500000 - } + "default": { + "currency": "EUR", + "amount": 0 + }, + "min": { + "currency": "EUR", + "amount": 0 + }, + "max": { + "currency": "EUR", + "amount": 500000 } } }, @@ -3497,19 +3427,17 @@ "scheduledCollection": [], "tracked": [], "insurance": { - "insuredAmount": { - "default": { - "currency": "EUR", - "amount": 0 - }, - "min": { - "currency": "EUR", - "amount": 0 - }, - "max": { - "currency": "EUR", - "amount": 500000 - } + "default": { + "currency": "EUR", + "amount": 0 + }, + "min": { + "currency": "EUR", + "amount": 0 + }, + "max": { + "currency": "EUR", + "amount": 500000 } } }, @@ -3553,19 +3481,17 @@ "scheduledCollection": [], "tracked": [], "insurance": { - "insuredAmount": { - "default": { - "currency": "EUR", - "amount": 0 - }, - "min": { - "currency": "EUR", - "amount": 0 - }, - "max": { - "currency": "EUR", - "amount": 500000 - } + "default": { + "currency": "EUR", + "amount": 0 + }, + "min": { + "currency": "EUR", + "amount": 0 + }, + "max": { + "currency": "EUR", + "amount": 500000 } } }, @@ -3609,19 +3535,17 @@ "scheduledCollection": [], "tracked": [], "insurance": { - "insuredAmount": { - "default": { - "currency": "EUR", - "amount": 0 - }, - "min": { - "currency": "EUR", - "amount": 0 - }, - "max": { - "currency": "EUR", - "amount": 500000 - } + "default": { + "currency": "EUR", + "amount": 0 + }, + "min": { + "currency": "EUR", + "amount": 0 + }, + "max": { + "currency": "EUR", + "amount": 500000 } } }, @@ -3665,19 +3589,17 @@ "scheduledCollection": [], "tracked": [], "insurance": { - "insuredAmount": { - "default": { - "currency": "EUR", - "amount": 0 - }, - "min": { - "currency": "EUR", - "amount": 0 - }, - "max": { - "currency": "EUR", - "amount": 500000 - } + "default": { + "currency": "EUR", + "amount": 0 + }, + "min": { + "currency": "EUR", + "amount": 0 + }, + "max": { + "currency": "EUR", + "amount": 500000 } } }, @@ -3721,19 +3643,17 @@ "scheduledCollection": [], "tracked": [], "insurance": { - "insuredAmount": { - "default": { - "currency": "EUR", - "amount": 0 - }, - "min": { - "currency": "EUR", - "amount": 0 - }, - "max": { - "currency": "EUR", - "amount": 500000 - } + "default": { + "currency": "EUR", + "amount": 0 + }, + "min": { + "currency": "EUR", + "amount": 0 + }, + "max": { + "currency": "EUR", + "amount": 500000 } } }, @@ -3777,19 +3697,17 @@ "scheduledCollection": [], "tracked": [], "insurance": { - "insuredAmount": { - "default": { - "currency": "EUR", - "amount": 0 - }, - "min": { - "currency": "EUR", - "amount": 0 - }, - "max": { - "currency": "EUR", - "amount": 500000 - } + "default": { + "currency": "EUR", + "amount": 0 + }, + "min": { + "currency": "EUR", + "amount": 0 + }, + "max": { + "currency": "EUR", + "amount": 500000 } } }, @@ -3833,19 +3751,17 @@ "scheduledCollection": [], "tracked": [], "insurance": { - "insuredAmount": { - "default": { - "currency": "EUR", - "amount": 0 - }, - "min": { - "currency": "EUR", - "amount": 0 - }, - "max": { - "currency": "EUR", - "amount": 500000 - } + "default": { + "currency": "EUR", + "amount": 0 + }, + "min": { + "currency": "EUR", + "amount": 0 + }, + "max": { + "currency": "EUR", + "amount": 500000 } } }, @@ -3889,19 +3805,17 @@ "scheduledCollection": [], "tracked": [], "insurance": { - "insuredAmount": { - "default": { - "currency": "EUR", - "amount": 0 - }, - "min": { - "currency": "EUR", - "amount": 0 - }, - "max": { - "currency": "EUR", - "amount": 500000 - } + "default": { + "currency": "EUR", + "amount": 0 + }, + "min": { + "currency": "EUR", + "amount": 0 + }, + "max": { + "currency": "EUR", + "amount": 500000 } } }, @@ -3945,19 +3859,17 @@ "scheduledCollection": [], "tracked": [], "insurance": { - "insuredAmount": { - "default": { - "currency": "EUR", - "amount": 0 - }, - "min": { - "currency": "EUR", - "amount": 0 - }, - "max": { - "currency": "EUR", - "amount": 500000 - } + "default": { + "currency": "EUR", + "amount": 0 + }, + "min": { + "currency": "EUR", + "amount": 0 + }, + "max": { + "currency": "EUR", + "amount": 500000 } } }, @@ -4001,19 +3913,17 @@ "scheduledCollection": [], "tracked": [], "insurance": { - "insuredAmount": { - "default": { - "currency": "EUR", - "amount": 0 - }, - "min": { - "currency": "EUR", - "amount": 0 - }, - "max": { - "currency": "EUR", - "amount": 500000 - } + "default": { + "currency": "EUR", + "amount": 0 + }, + "min": { + "currency": "EUR", + "amount": 0 + }, + "max": { + "currency": "EUR", + "amount": 500000 } } }, @@ -4057,19 +3967,17 @@ "scheduledCollection": [], "tracked": [], "insurance": { - "insuredAmount": { - "default": { - "currency": "EUR", - "amount": 0 - }, - "min": { - "currency": "EUR", - "amount": 0 - }, - "max": { - "currency": "EUR", - "amount": 500000 - } + "default": { + "currency": "EUR", + "amount": 0 + }, + "min": { + "currency": "EUR", + "amount": 0 + }, + "max": { + "currency": "EUR", + "amount": 500000 } } }, @@ -4113,19 +4021,17 @@ "scheduledCollection": [], "tracked": [], "insurance": { - "insuredAmount": { - "default": { - "currency": "EUR", - "amount": 0 - }, - "min": { - "currency": "EUR", - "amount": 0 - }, - "max": { - "currency": "EUR", - "amount": 500000 - } + "default": { + "currency": "EUR", + "amount": 0 + }, + "min": { + "currency": "EUR", + "amount": 0 + }, + "max": { + "currency": "EUR", + "amount": 500000 } } }, @@ -4169,19 +4075,17 @@ "scheduledCollection": [], "tracked": [], "insurance": { - "insuredAmount": { - "default": { - "currency": "EUR", - "amount": 0 - }, - "min": { - "currency": "EUR", - "amount": 0 - }, - "max": { - "currency": "EUR", - "amount": 500000 - } + "default": { + "currency": "EUR", + "amount": 0 + }, + "min": { + "currency": "EUR", + "amount": 0 + }, + "max": { + "currency": "EUR", + "amount": 500000 } } }, diff --git a/tests/__snapshots__/FrontendRenderServiceTest__it_renders_component_with_data_set_order_box__1.json b/tests/__snapshots__/FrontendRenderServiceTest__it_renders_component_with_data_set_order_box__1.json index 3e411b342..4ee9f9081 100644 --- a/tests/__snapshots__/FrontendRenderServiceTest__it_renders_component_with_data_set_order_box__1.json +++ b/tests/__snapshots__/FrontendRenderServiceTest__it_renders_component_with_data_set_order_box__1.json @@ -30,19 +30,17 @@ "scheduledCollection": [], "tracked": [], "insurance": { - "insuredAmount": { - "default": { - "currency": "EUR", - "amount": 0 - }, - "min": { - "currency": "EUR", - "amount": 0 - }, - "max": { - "currency": "EUR", - "amount": 500000 - } + "default": { + "currency": "EUR", + "amount": 0 + }, + "min": { + "currency": "EUR", + "amount": 0 + }, + "max": { + "currency": "EUR", + "amount": 500000 } } }, diff --git a/tests/__snapshots__/FrontendRenderServiceTest__it_renders_component_with_data_set_order_list_column__1.json b/tests/__snapshots__/FrontendRenderServiceTest__it_renders_component_with_data_set_order_list_column__1.json index 8b7d0d2fb..fa6fa75a2 100644 --- a/tests/__snapshots__/FrontendRenderServiceTest__it_renders_component_with_data_set_order_list_column__1.json +++ b/tests/__snapshots__/FrontendRenderServiceTest__it_renders_component_with_data_set_order_list_column__1.json @@ -30,19 +30,17 @@ "scheduledCollection": [], "tracked": [], "insurance": { - "insuredAmount": { - "default": { - "currency": "EUR", - "amount": 0 - }, - "min": { - "currency": "EUR", - "amount": 0 - }, - "max": { - "currency": "EUR", - "amount": 500000 - } + "default": { + "currency": "EUR", + "amount": 0 + }, + "min": { + "currency": "EUR", + "amount": 0 + }, + "max": { + "currency": "EUR", + "amount": 500000 } } }, diff --git a/tests/__snapshots__/OrderTest__it_creates_fulfilment_order_from_pdk_order_with_data_set_empty_order__1.json b/tests/__snapshots__/OrderTest__it_creates_fulfilment_order_from_pdk_order_with_data_set_empty_order__1.json index e438929dd..baa5cb01a 100644 --- a/tests/__snapshots__/OrderTest__it_creates_fulfilment_order_from_pdk_order_with_data_set_empty_order__1.json +++ b/tests/__snapshots__/OrderTest__it_creates_fulfilment_order_from_pdk_order_with_data_set_empty_order__1.json @@ -30,19 +30,17 @@ "scheduledCollection": [], "tracked": [], "insurance": { - "insuredAmount": { - "default": { - "currency": "EUR", - "amount": 0 - }, - "min": { - "currency": "EUR", - "amount": 0 - }, - "max": { - "currency": "EUR", - "amount": 500000 - } + "default": { + "currency": "EUR", + "amount": 0 + }, + "min": { + "currency": "EUR", + "amount": 0 + }, + "max": { + "currency": "EUR", + "amount": 500000 } } }, diff --git a/tests/__snapshots__/OrderTest__it_creates_fulfilment_order_from_pdk_order_with_data_set_order_with_shipments__1.json b/tests/__snapshots__/OrderTest__it_creates_fulfilment_order_from_pdk_order_with_data_set_order_with_shipments__1.json index e438929dd..baa5cb01a 100644 --- a/tests/__snapshots__/OrderTest__it_creates_fulfilment_order_from_pdk_order_with_data_set_order_with_shipments__1.json +++ b/tests/__snapshots__/OrderTest__it_creates_fulfilment_order_from_pdk_order_with_data_set_order_with_shipments__1.json @@ -30,19 +30,17 @@ "scheduledCollection": [], "tracked": [], "insurance": { - "insuredAmount": { - "default": { - "currency": "EUR", - "amount": 0 - }, - "min": { - "currency": "EUR", - "amount": 0 - }, - "max": { - "currency": "EUR", - "amount": 500000 - } + "default": { + "currency": "EUR", + "amount": 0 + }, + "min": { + "currency": "EUR", + "amount": 0 + }, + "max": { + "currency": "EUR", + "amount": 500000 } } }, diff --git a/tests/__snapshots__/OrderTest__it_creates_fulfilment_order_from_pdk_order_with_data_set_order_without_shipments__1.json b/tests/__snapshots__/OrderTest__it_creates_fulfilment_order_from_pdk_order_with_data_set_order_without_shipments__1.json index 1718710cb..bd620d031 100644 --- a/tests/__snapshots__/OrderTest__it_creates_fulfilment_order_from_pdk_order_with_data_set_order_without_shipments__1.json +++ b/tests/__snapshots__/OrderTest__it_creates_fulfilment_order_from_pdk_order_with_data_set_order_without_shipments__1.json @@ -48,19 +48,17 @@ "scheduledCollection": [], "tracked": [], "insurance": { - "insuredAmount": { - "default": { - "currency": "EUR", - "amount": 0 - }, - "min": { - "currency": "EUR", - "amount": 0 - }, - "max": { - "currency": "EUR", - "amount": 500000 - } + "default": { + "currency": "EUR", + "amount": 0 + }, + "min": { + "currency": "EUR", + "amount": 0 + }, + "max": { + "currency": "EUR", + "amount": 500000 } } }, diff --git a/tests/__snapshots__/PdkOrderTest__it_creates_pdk_order_from_fulfilment_order_with_data_set_one_order_containing_many_attributes__1.json b/tests/__snapshots__/PdkOrderTest__it_creates_pdk_order_from_fulfilment_order_with_data_set_one_order_containing_many_attributes__1.json index bebab5de0..1120dc850 100644 --- a/tests/__snapshots__/PdkOrderTest__it_creates_pdk_order_from_fulfilment_order_with_data_set_one_order_containing_many_attributes__1.json +++ b/tests/__snapshots__/PdkOrderTest__it_creates_pdk_order_from_fulfilment_order_with_data_set_one_order_containing_many_attributes__1.json @@ -28,19 +28,17 @@ "scheduledCollection": [], "tracked": [], "insurance": { - "insuredAmount": { - "default": { - "currency": "EUR", - "amount": 0 - }, - "min": { - "currency": "EUR", - "amount": 0 - }, - "max": { - "currency": "EUR", - "amount": 500000 - } + "default": { + "currency": "EUR", + "amount": 0 + }, + "min": { + "currency": "EUR", + "amount": 0 + }, + "max": { + "currency": "EUR", + "amount": 500000 } } }, diff --git a/tests/__snapshots__/PdkOrderTest__it_creates_pdk_order_from_fulfilment_order_with_data_set_one_order_with_pickup__1.json b/tests/__snapshots__/PdkOrderTest__it_creates_pdk_order_from_fulfilment_order_with_data_set_one_order_with_pickup__1.json index bebab5de0..1120dc850 100644 --- a/tests/__snapshots__/PdkOrderTest__it_creates_pdk_order_from_fulfilment_order_with_data_set_one_order_with_pickup__1.json +++ b/tests/__snapshots__/PdkOrderTest__it_creates_pdk_order_from_fulfilment_order_with_data_set_one_order_with_pickup__1.json @@ -28,19 +28,17 @@ "scheduledCollection": [], "tracked": [], "insurance": { - "insuredAmount": { - "default": { - "currency": "EUR", - "amount": 0 - }, - "min": { - "currency": "EUR", - "amount": 0 - }, - "max": { - "currency": "EUR", - "amount": 500000 - } + "default": { + "currency": "EUR", + "amount": 0 + }, + "min": { + "currency": "EUR", + "amount": 0 + }, + "max": { + "currency": "EUR", + "amount": 500000 } } }, diff --git a/tests/__snapshots__/PostOrdersTest__it_creates_a_valid_order_collection_from_api_data_with_data_set_one_order_containing_many_attributes__1.json b/tests/__snapshots__/PostOrdersTest__it_creates_a_valid_order_collection_from_api_data_with_data_set_one_order_containing_many_attributes__1.json index fddff7f4b..584cfc4ed 100644 --- a/tests/__snapshots__/PostOrdersTest__it_creates_a_valid_order_collection_from_api_data_with_data_set_one_order_containing_many_attributes__1.json +++ b/tests/__snapshots__/PostOrdersTest__it_creates_a_valid_order_collection_from_api_data_with_data_set_one_order_containing_many_attributes__1.json @@ -53,19 +53,17 @@ "scheduledCollection": [], "tracked": [], "insurance": { - "insuredAmount": { - "default": { - "currency": "EUR", - "amount": 0 - }, - "min": { - "currency": "EUR", - "amount": 0 - }, - "max": { - "currency": "EUR", - "amount": 500000 - } + "default": { + "currency": "EUR", + "amount": 0 + }, + "min": { + "currency": "EUR", + "amount": 0 + }, + "max": { + "currency": "EUR", + "amount": 500000 } } }, diff --git a/tests/__snapshots__/PostOrdersTest__it_creates_a_valid_order_collection_from_api_data_with_data_set_one_order_with_pickup__1.json b/tests/__snapshots__/PostOrdersTest__it_creates_a_valid_order_collection_from_api_data_with_data_set_one_order_with_pickup__1.json index fddff7f4b..584cfc4ed 100644 --- a/tests/__snapshots__/PostOrdersTest__it_creates_a_valid_order_collection_from_api_data_with_data_set_one_order_with_pickup__1.json +++ b/tests/__snapshots__/PostOrdersTest__it_creates_a_valid_order_collection_from_api_data_with_data_set_one_order_with_pickup__1.json @@ -53,19 +53,17 @@ "scheduledCollection": [], "tracked": [], "insurance": { - "insuredAmount": { - "default": { - "currency": "EUR", - "amount": 0 - }, - "min": { - "currency": "EUR", - "amount": 0 - }, - "max": { - "currency": "EUR", - "amount": 500000 - } + "default": { + "currency": "EUR", + "amount": 0 + }, + "min": { + "currency": "EUR", + "amount": 0 + }, + "max": { + "currency": "EUR", + "amount": 500000 } } }, diff --git a/tests/__snapshots__/QueryTest__it_creates_order_collection_from_queried_data__1.json b/tests/__snapshots__/QueryTest__it_creates_order_collection_from_queried_data__1.json index 8a023d083..de855dfe2 100644 --- a/tests/__snapshots__/QueryTest__it_creates_order_collection_from_queried_data__1.json +++ b/tests/__snapshots__/QueryTest__it_creates_order_collection_from_queried_data__1.json @@ -116,19 +116,17 @@ "scheduledCollection": [], "tracked": [], "insurance": { - "insuredAmount": { - "default": { - "currency": "EUR", - "amount": 0 - }, - "min": { - "currency": "EUR", - "amount": 0 - }, - "max": { - "currency": "EUR", - "amount": 500000 - } + "default": { + "currency": "EUR", + "amount": 0 + }, + "min": { + "currency": "EUR", + "amount": 0 + }, + "max": { + "currency": "EUR", + "amount": 500000 } } }, diff --git a/tests/__snapshots__/QueryTest__it_creates_shipment_collection_from_queried_data_with_data_set_normal_shipment__1.json b/tests/__snapshots__/QueryTest__it_creates_shipment_collection_from_queried_data_with_data_set_normal_shipment__1.json index 1cb2b082f..9fb3b6067 100644 --- a/tests/__snapshots__/QueryTest__it_creates_shipment_collection_from_queried_data_with_data_set_normal_shipment__1.json +++ b/tests/__snapshots__/QueryTest__it_creates_shipment_collection_from_queried_data_with_data_set_normal_shipment__1.json @@ -32,19 +32,17 @@ "scheduledCollection": [], "tracked": [], "insurance": { - "insuredAmount": { - "default": { - "currency": "EUR", - "amount": 0 - }, - "min": { - "currency": "EUR", - "amount": 0 - }, - "max": { - "currency": "EUR", - "amount": 500000 - } + "default": { + "currency": "EUR", + "amount": 0 + }, + "min": { + "currency": "EUR", + "amount": 0 + }, + "max": { + "currency": "EUR", + "amount": 500000 } } }, @@ -109,19 +107,17 @@ "scheduledCollection": [], "tracked": [], "insurance": { - "insuredAmount": { - "default": { - "currency": "EUR", - "amount": 0 - }, - "min": { - "currency": "EUR", - "amount": 0 - }, - "max": { - "currency": "EUR", - "amount": 500000 - } + "default": { + "currency": "EUR", + "amount": 0 + }, + "min": { + "currency": "EUR", + "amount": 0 + }, + "max": { + "currency": "EUR", + "amount": 500000 } } }, diff --git a/tests/__snapshots__/QueryTest__it_creates_shipment_collection_from_queried_data_with_data_set_shipment_with_contract__1.json b/tests/__snapshots__/QueryTest__it_creates_shipment_collection_from_queried_data_with_data_set_shipment_with_contract__1.json index 7b728d57d..1d55979a9 100644 --- a/tests/__snapshots__/QueryTest__it_creates_shipment_collection_from_queried_data_with_data_set_shipment_with_contract__1.json +++ b/tests/__snapshots__/QueryTest__it_creates_shipment_collection_from_queried_data_with_data_set_shipment_with_contract__1.json @@ -32,19 +32,17 @@ "scheduledCollection": [], "tracked": [], "insurance": { - "insuredAmount": { - "default": { - "currency": "EUR", - "amount": 0 - }, - "min": { - "currency": "EUR", - "amount": 0 - }, - "max": { - "currency": "EUR", - "amount": 500000 - } + "default": { + "currency": "EUR", + "amount": 0 + }, + "min": { + "currency": "EUR", + "amount": 0 + }, + "max": { + "currency": "EUR", + "amount": 500000 } } }, @@ -92,19 +90,17 @@ "scheduledCollection": [], "tracked": [], "insurance": { - "insuredAmount": { - "default": { - "currency": "EUR", - "amount": 0 - }, - "min": { - "currency": "EUR", - "amount": 0 - }, - "max": { - "currency": "EUR", - "amount": 500000 - } + "default": { + "currency": "EUR", + "amount": 0 + }, + "min": { + "currency": "EUR", + "amount": 0 + }, + "max": { + "currency": "EUR", + "amount": 500000 } } }, diff --git a/tests/__snapshots__/QueryTest__it_creates_shipment_collection_from_queried_data_with_data_set_shipment_with_drop-off_point__1.json b/tests/__snapshots__/QueryTest__it_creates_shipment_collection_from_queried_data_with_data_set_shipment_with_drop-off_point__1.json index e394d40e6..21d245c3e 100644 --- a/tests/__snapshots__/QueryTest__it_creates_shipment_collection_from_queried_data_with_data_set_shipment_with_drop-off_point__1.json +++ b/tests/__snapshots__/QueryTest__it_creates_shipment_collection_from_queried_data_with_data_set_shipment_with_drop-off_point__1.json @@ -31,19 +31,17 @@ "scheduledCollection": [], "tracked": [], "insurance": { - "insuredAmount": { - "default": { - "currency": "EUR", - "amount": 0 - }, - "min": { - "currency": "EUR", - "amount": 0 - }, - "max": { - "currency": "EUR", - "amount": 500000 - } + "default": { + "currency": "EUR", + "amount": 0 + }, + "min": { + "currency": "EUR", + "amount": 0 + }, + "max": { + "currency": "EUR", + "amount": 500000 } } }, @@ -90,19 +88,17 @@ "scheduledCollection": [], "tracked": [], "insurance": { - "insuredAmount": { - "default": { - "currency": "EUR", - "amount": 0 - }, - "min": { - "currency": "EUR", - "amount": 0 - }, - "max": { - "currency": "EUR", - "amount": 500000 - } + "default": { + "currency": "EUR", + "amount": 0 + }, + "min": { + "currency": "EUR", + "amount": 0 + }, + "max": { + "currency": "EUR", + "amount": 500000 } } }, diff --git a/tests/__snapshots__/QueryTest__it_creates_shipment_collection_from_queried_data_with_data_set_shipment_with_pickup__1.json b/tests/__snapshots__/QueryTest__it_creates_shipment_collection_from_queried_data_with_data_set_shipment_with_pickup__1.json index ecb2ba50f..f84791be0 100644 --- a/tests/__snapshots__/QueryTest__it_creates_shipment_collection_from_queried_data_with_data_set_shipment_with_pickup__1.json +++ b/tests/__snapshots__/QueryTest__it_creates_shipment_collection_from_queried_data_with_data_set_shipment_with_pickup__1.json @@ -32,19 +32,17 @@ "scheduledCollection": [], "tracked": [], "insurance": { - "insuredAmount": { - "default": { - "currency": "EUR", - "amount": 0 - }, - "min": { - "currency": "EUR", - "amount": 0 - }, - "max": { - "currency": "EUR", - "amount": 500000 - } + "default": { + "currency": "EUR", + "amount": 0 + }, + "min": { + "currency": "EUR", + "amount": 0 + }, + "max": { + "currency": "EUR", + "amount": 500000 } } }, @@ -91,19 +89,17 @@ "scheduledCollection": [], "tracked": [], "insurance": { - "insuredAmount": { - "default": { - "currency": "EUR", - "amount": 0 - }, - "min": { - "currency": "EUR", - "amount": 0 - }, - "max": { - "currency": "EUR", - "amount": 500000 - } + "default": { + "currency": "EUR", + "amount": 0 + }, + "min": { + "currency": "EUR", + "amount": 0 + }, + "max": { + "currency": "EUR", + "amount": 500000 } } }, diff --git a/tests/__snapshots__/SaveOrderTest__it_creates_a_valid_order_collection_from_api_data_with_data_set_order_containing_many_attributes__1.json b/tests/__snapshots__/SaveOrderTest__it_creates_a_valid_order_collection_from_api_data_with_data_set_order_containing_many_attributes__1.json index fddff7f4b..584cfc4ed 100644 --- a/tests/__snapshots__/SaveOrderTest__it_creates_a_valid_order_collection_from_api_data_with_data_set_order_containing_many_attributes__1.json +++ b/tests/__snapshots__/SaveOrderTest__it_creates_a_valid_order_collection_from_api_data_with_data_set_order_containing_many_attributes__1.json @@ -53,19 +53,17 @@ "scheduledCollection": [], "tracked": [], "insurance": { - "insuredAmount": { - "default": { - "currency": "EUR", - "amount": 0 - }, - "min": { - "currency": "EUR", - "amount": 0 - }, - "max": { - "currency": "EUR", - "amount": 500000 - } + "default": { + "currency": "EUR", + "amount": 0 + }, + "min": { + "currency": "EUR", + "amount": 0 + }, + "max": { + "currency": "EUR", + "amount": 500000 } } }, diff --git a/tests/__snapshots__/SaveOrderTest__it_creates_a_valid_order_collection_from_api_data_with_data_set_order_with_pickup__1.json b/tests/__snapshots__/SaveOrderTest__it_creates_a_valid_order_collection_from_api_data_with_data_set_order_with_pickup__1.json index fddff7f4b..584cfc4ed 100644 --- a/tests/__snapshots__/SaveOrderTest__it_creates_a_valid_order_collection_from_api_data_with_data_set_order_with_pickup__1.json +++ b/tests/__snapshots__/SaveOrderTest__it_creates_a_valid_order_collection_from_api_data_with_data_set_order_with_pickup__1.json @@ -53,19 +53,17 @@ "scheduledCollection": [], "tracked": [], "insurance": { - "insuredAmount": { - "default": { - "currency": "EUR", - "amount": 0 - }, - "min": { - "currency": "EUR", - "amount": 0 - }, - "max": { - "currency": "EUR", - "amount": 500000 - } + "default": { + "currency": "EUR", + "amount": 0 + }, + "min": { + "currency": "EUR", + "amount": 0 + }, + "max": { + "currency": "EUR", + "amount": 500000 } } }, diff --git a/tests/__snapshots__/ShipmentTest__it_creates_fulfilment_shipment_from_pdk_shipment_with_data_set_empty_shipment__1.json b/tests/__snapshots__/ShipmentTest__it_creates_fulfilment_shipment_from_pdk_shipment_with_data_set_empty_shipment__1.json index f6d358fbf..06c462be1 100644 --- a/tests/__snapshots__/ShipmentTest__it_creates_fulfilment_shipment_from_pdk_shipment_with_data_set_empty_shipment__1.json +++ b/tests/__snapshots__/ShipmentTest__it_creates_fulfilment_shipment_from_pdk_shipment_with_data_set_empty_shipment__1.json @@ -26,19 +26,17 @@ "scheduledCollection": [], "tracked": [], "insurance": { - "insuredAmount": { - "default": { - "currency": "EUR", - "amount": 0 - }, - "min": { - "currency": "EUR", - "amount": 0 - }, - "max": { - "currency": "EUR", - "amount": 500000 - } + "default": { + "currency": "EUR", + "amount": 0 + }, + "min": { + "currency": "EUR", + "amount": 0 + }, + "max": { + "currency": "EUR", + "amount": 500000 } } }, diff --git a/tests/__snapshots__/ShipmentTest__it_creates_fulfilment_shipment_from_pdk_shipment_with_data_set_shipment_with_all_options__1.json b/tests/__snapshots__/ShipmentTest__it_creates_fulfilment_shipment_from_pdk_shipment_with_data_set_shipment_with_all_options__1.json index d3dfbd974..b98654bb0 100644 --- a/tests/__snapshots__/ShipmentTest__it_creates_fulfilment_shipment_from_pdk_shipment_with_data_set_shipment_with_all_options__1.json +++ b/tests/__snapshots__/ShipmentTest__it_creates_fulfilment_shipment_from_pdk_shipment_with_data_set_shipment_with_all_options__1.json @@ -26,19 +26,17 @@ "scheduledCollection": [], "tracked": [], "insurance": { - "insuredAmount": { - "default": { - "currency": "EUR", - "amount": 0 - }, - "min": { - "currency": "EUR", - "amount": 0 - }, - "max": { - "currency": "EUR", - "amount": 500000 - } + "default": { + "currency": "EUR", + "amount": 0 + }, + "min": { + "currency": "EUR", + "amount": 0 + }, + "max": { + "currency": "EUR", + "amount": 500000 } } }, diff --git a/tests/__snapshots__/ShipmentTest__it_returns_empty_fulfilment_shipment_when_no_pdk_shipment_is_passed__1.json b/tests/__snapshots__/ShipmentTest__it_returns_empty_fulfilment_shipment_when_no_pdk_shipment_is_passed__1.json index 698462b3c..e0a155b62 100644 --- a/tests/__snapshots__/ShipmentTest__it_returns_empty_fulfilment_shipment_when_no_pdk_shipment_is_passed__1.json +++ b/tests/__snapshots__/ShipmentTest__it_returns_empty_fulfilment_shipment_when_no_pdk_shipment_is_passed__1.json @@ -26,19 +26,17 @@ "scheduledCollection": [], "tracked": [], "insurance": { - "insuredAmount": { - "default": { - "currency": "EUR", - "amount": 0 - }, - "min": { - "currency": "EUR", - "amount": 0 - }, - "max": { - "currency": "EUR", - "amount": 500000 - } + "default": { + "currency": "EUR", + "amount": 0 + }, + "min": { + "currency": "EUR", + "amount": 0 + }, + "max": { + "currency": "EUR", + "amount": 500000 } } }, diff --git a/tests/factories/Carrier/Model/CarrierFactory.php b/tests/factories/Carrier/Model/CarrierFactory.php index e01c66087..8fedd137a 100644 --- a/tests/factories/Carrier/Model/CarrierFactory.php +++ b/tests/factories/Carrier/Model/CarrierFactory.php @@ -131,11 +131,9 @@ public function withInsurance(int $default = 0, int $min = 0, int $max = 500000, return $this->withOptions(array_merge($existingOptions, [ 'insurance' => [ - 'insuredAmount' => [ - 'default' => ['currency' => $currency, 'amount' => $default], - 'min' => ['currency' => $currency, 'amount' => $min], - 'max' => ['currency' => $currency, 'amount' => $max], - ], + 'default' => ['currency' => $currency, 'amount' => $default], + 'min' => ['currency' => $currency, 'amount' => $min], + 'max' => ['currency' => $currency, 'amount' => $max], ], ])); } @@ -161,15 +159,13 @@ public function withAllCapabilities(string $carrier = RefCapabilitiesSharedCarri continue; } - // Insurance requires a populated insuredAmount; all other options can be empty arrays. + // Insurance requires populated bounds; all other options can be empty arrays. // openAPITypes() returns class names with a leading backslash, while ::class does not — trim before comparing. if (ltrim($model, '\\') === RefCapabilitiesContractDefinitionsResponseOptionsInsuranceOptionV2::class) { $allShipmentOptions[$optionKey] = [ - 'insuredAmount' => [ - 'default' => ['currency' => 'EUR', 'amount' => 0], - 'min' => ['currency' => 'EUR', 'amount' => 0], - 'max' => ['currency' => 'EUR', 'amount' => 500000], - ], + 'default' => ['currency' => 'EUR', 'amount' => 0], + 'min' => ['currency' => 'EUR', 'amount' => 0], + 'max' => ['currency' => 'EUR', 'amount' => 500000], ]; } else { $allShipmentOptions[$optionKey] = []; From dc03ad2eb7f639bc9fe3d101a3f09596747d2796 Mon Sep 17 00:00:00 2001 From: Freek van Rijt Date: Thu, 6 Aug 2026 14:45:29 +0200 Subject: [PATCH 3/3] docs(insurance): describe what the settings calculation actually returns The old note said the "insure up to" setting bounds a carrier without a maximum. It does cap the amount, but it defaults to 0 when unset, so the result lands on the carrier minimum instead. Also records why the insurance fields are dropped when there is no tier ladder: the fields are tier dropdowns, so a carrier without a maximum has nothing to render, and that case does not occur in practice. Resolves INT-1697 Co-Authored-By: Claude Opus 5 (1M context) --- src/App/Order/Calculator/General/InsuranceCalculator.php | 7 +++++-- src/Frontend/View/CarrierSettingsItemView.php | 4 ++++ 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/src/App/Order/Calculator/General/InsuranceCalculator.php b/src/App/Order/Calculator/General/InsuranceCalculator.php index 89a20bed5..43720d27a 100644 --- a/src/App/Order/Calculator/General/InsuranceCalculator.php +++ b/src/App/Order/Calculator/General/InsuranceCalculator.php @@ -172,8 +172,11 @@ private function fetchShipmentInsurance(Carrier $carrier): ?RefCapabilitiesRespo /** * Calculate insurance from carrier settings when the shipment option is set to INHERIT. * - * When the carrier advertises no maximum, the "insure up to" setting is the only ceiling - * that applies — the settings cap is what bounds an otherwise unbounded carrier. + * With insurance switched off in the settings the carrier default applies. Otherwise the + * "insure up to" setting caps the calculated amount; it defaults to 0 when unset, which + * brings the result down to the carrier minimum. + * + * Without a carrier maximum the amount is not snapped to a tier. * * @param \MyParcelNL\Pdk\Carrier\Model\Carrier $carrier * @param int $carrierMin diff --git a/src/Frontend/View/CarrierSettingsItemView.php b/src/Frontend/View/CarrierSettingsItemView.php index 5ef5321c5..23743295d 100644 --- a/src/Frontend/View/CarrierSettingsItemView.php +++ b/src/Frontend/View/CarrierSettingsItemView.php @@ -607,6 +607,10 @@ private function getExportInsuranceFields(): array { $insuranceAmounts = $this->carrierValidationService->getAllowedInsuranceAmounts($this->carrier); + // The insurance fields are tier dropdowns built from this ladder, so there is nothing to + // render without one: no carrier maximum means no tiers, and a single tier means no choice. + // Carriers without a maximum do not occur in practice — CarrierValidationService logs a + // warning if one ever shows up. if (count($insuranceAmounts) <= 1) { return []; }