From 103b8567a63fdddc30c579339951f64afae5e4c4 Mon Sep 17 00:00:00 2001 From: Jochem Gravendeel <119667571+GravendeelJochem@users.noreply.github.com> Date: Wed, 13 Nov 2024 10:46:00 +0100 Subject: [PATCH] feat: add receipt code (#314) INT-684 --- config/pdk-business-logic.php | 2 + config/pdk-settings.php | 1 + config/platform/myparcel.php | 1 + .../myparcel/order/postnl/be_package.json | 3 + .../myparcel/order/postnl/nl_package.json | 3 + config/schema/order.json | 3 + .../Definition/ReceiptCodeDefinition.php | 34 +++ .../PackageTypeShipmentOptionsCalculator.php | 1 + .../Calculator/PostNl/PostNLCalculator.php | 1 + .../PostNl/PostNLReceiptCodeCalculator.php | 85 ++++++ src/Frontend/View/CarrierSettingsItemView.php | 4 + src/Settings/Model/CarrierSettings.php | 3 + src/Shipment/Model/ShipmentOptions.php | 4 + src/Validation/Validator/CarrierSchema.php | 6 + .../PostNLReceiptCodeCalculatorTest.php | 257 ++++++++++++++++++ .../Context/Model/OrderDataContextTest.php | 3 + .../Model/Options/DeliveryOptionsTest.php | 2 + ...etrieves_all_categories_and_fields__1.json | 3 + ...carriers_from_name_with_(myparcel)__1.json | 1 + ...data_with_data_set_multiple_orders__1.json | 14 +- ...xt_data_with_data_set_single_order__1.json | 7 +- ..._data_set_simple_domestic_shipment__1.json | 4 +- ...rts_return_with_data_set_insurance__1.json | 14 +- ...th_data_set_no_return_capabilities__1.json | 14 +- ...return_with_data_set_simple_orders__1.json | 14 +- ...omponent_with_data_set_init_script__1.json | 1 + ..._component_with_data_set_order_box__1.json | 7 +- ...nt_with_data_set_order_list_column__1.json | 7 +- ...a_set_pickup_without_location_code__1.json | 3 + ...tes_order_with_data_set_BE_mailbox__1.json | 8 + ..._EU_package_with_correct_insurance__1.json | 8 + ...data_set_EU_package_with_no_weight__1.json | 8 + ...a_set_EU_package_without_insurance__1.json | 8 + ...es_order_with_data_set_ROW_package__1.json | 8 + ...ta_set_ROW_package_without_invoice__1.json | 8 + ...ge_without_weight,_without_invoice__1.json | 8 + ..._with_data_set_dhlforyou_to_France__1.json | 8 + ..._set_mailbox_with_morning_delivery__1.json | 8 + ...a_set_mailbox_with_shipmentOptions__1.json | 8 + ...h_data_set_package_without_country__1.json | 8 + ..._with_data_set_carrier_dhl_for_you__1.json | 3 +- ...e_array_with_data_set_single_order__1.json | 3 +- ..._data_set_various_delivery_options__1.json | 9 +- ...e_order_containing_many_attributes__1.json | 4 +- ...ith_data_set_one_order_with_pickup__1.json | 4 +- ...__it_gets_carriers_with_(myparcel)__1.json | 1 + ..._for_each_platform_with_(myparcel)__1.json | 1 + ...data_with_data_set_normal_shipment__1.json | 3 +- ...th_data_set_shipment_with_contract__1.json | 3 +- ...a_set_shipment_with_drop-off_point__1.json | 3 +- ...with_data_set_shipment_with_pickup__1.json | 3 +- ...ult_carrier_settings_with_(belgie)__1.json | 4 + ...carrier_settings_with_(flespakket)__1.json | 2 + ...t_carrier_settings_with_(myparcel)__1.json | 7 + ...tsActionTest__it_updates_shipments__1.json | 3 +- 55 files changed, 608 insertions(+), 35 deletions(-) create mode 100644 src/App/Options/Definition/ReceiptCodeDefinition.php create mode 100644 src/App/Order/Calculator/PostNl/PostNLReceiptCodeCalculator.php create mode 100644 tests/Unit/App/Order/Calculator/PostNl/PostNLReceiptCodeCalculatorTest.php diff --git a/config/pdk-business-logic.php b/config/pdk-business-logic.php index 753cc7a50..b6ce5ca2b 100644 --- a/config/pdk-business-logic.php +++ b/config/pdk-business-logic.php @@ -11,6 +11,7 @@ use MyParcelNL\Pdk\App\Options\Definition\SameDayDeliveryDefinition; use MyParcelNL\Pdk\App\Options\Definition\SignatureDefinition; use MyParcelNL\Pdk\App\Options\Definition\TrackedDefinition; +use MyParcelNL\Pdk\App\Options\Definition\ReceiptCodeDefinition; use MyParcelNL\Pdk\App\Order\Calculator\General\AllowedInCarrierCalculator; use MyParcelNL\Pdk\App\Order\Calculator\General\CarrierSpecificCalculator; use MyParcelNL\Pdk\App\Order\Calculator\General\CustomerInformationCalculator; @@ -74,6 +75,7 @@ new SameDayDeliveryDefinition(), new SignatureDefinition(), new TrackedDefinition(), + new ReceiptCodeDefinition(), ]; }), diff --git a/config/pdk-settings.php b/config/pdk-settings.php index d0dafedb1..6089813fd 100644 --- a/config/pdk-settings.php +++ b/config/pdk-settings.php @@ -55,6 +55,7 @@ 'dropOffDaysDeviations' => [], ], CarrierSettings::EXPORT_AGE_CHECK => false, + CarrierSettings::EXPORT_RECEIPT_CODE => false, CarrierSettings::EXPORT_INSURANCE => false, CarrierSettings::EXPORT_INSURANCE_FROM_AMOUNT => 0, CarrierSettings::EXPORT_INSURANCE_PRICE_PERCENTAGE => 100, diff --git a/config/platform/myparcel.php b/config/platform/myparcel.php index a7ef00f82..f7df4684f 100644 --- a/config/platform/myparcel.php +++ b/config/platform/myparcel.php @@ -47,6 +47,7 @@ 'return' => true, 'sameDayDelivery' => false, 'signature' => true, + 'receiptCode' => true, 'insurance' => [ 0, 10000, diff --git a/config/schema/myparcel/order/postnl/be_package.json b/config/schema/myparcel/order/postnl/be_package.json index 0a748b672..48fc8e29b 100644 --- a/config/schema/myparcel/order/postnl/be_package.json +++ b/config/schema/myparcel/order/postnl/be_package.json @@ -13,6 +13,9 @@ }, "tracked": { "enum": [0, 1] + }, + "receiptCode": { + "enum": [-1] } } } diff --git a/config/schema/myparcel/order/postnl/nl_package.json b/config/schema/myparcel/order/postnl/nl_package.json index 450949969..00a678d86 100644 --- a/config/schema/myparcel/order/postnl/nl_package.json +++ b/config/schema/myparcel/order/postnl/nl_package.json @@ -22,6 +22,9 @@ 500000, null ] + }, + "receiptCode": { + "enum": [-1, 0, 1] } } } diff --git a/config/schema/order.json b/config/schema/order.json index 489d669a4..f7c9ea2a3 100644 --- a/config/schema/order.json +++ b/config/schema/order.json @@ -143,6 +143,9 @@ }, "tracked": { "enum": [0, 1] + }, + "receiptCode": { + "enum": [0, 1] } } } diff --git a/src/App/Options/Definition/ReceiptCodeDefinition.php b/src/App/Options/Definition/ReceiptCodeDefinition.php new file mode 100644 index 000000000..fefa0b947 --- /dev/null +++ b/src/App/Options/Definition/ReceiptCodeDefinition.php @@ -0,0 +1,34 @@ +canHaveReceiptCode(); + } +} diff --git a/src/App/Order/Calculator/General/PackageTypeShipmentOptionsCalculator.php b/src/App/Order/Calculator/General/PackageTypeShipmentOptionsCalculator.php index a4b361b05..855240149 100644 --- a/src/App/Order/Calculator/General/PackageTypeShipmentOptionsCalculator.php +++ b/src/App/Order/Calculator/General/PackageTypeShipmentOptionsCalculator.php @@ -31,6 +31,7 @@ public function calculate(): void ShipmentOptions::ONLY_RECIPIENT => TriStateService::DISABLED, ShipmentOptions::SAME_DAY_DELIVERY => TriStateService::DISABLED, ShipmentOptions::SIGNATURE => TriStateService::DISABLED, + ShipmentOptions::RECEIPT_CODE => TriStateService::DISABLED, ShipmentOptions::TRACKED => $this->calculateTracked(), ]); } diff --git a/src/App/Order/Calculator/PostNl/PostNLCalculator.php b/src/App/Order/Calculator/PostNl/PostNLCalculator.php index 1ef7c62b2..fd6bee0cd 100644 --- a/src/App/Order/Calculator/PostNl/PostNLCalculator.php +++ b/src/App/Order/Calculator/PostNl/PostNLCalculator.php @@ -13,6 +13,7 @@ protected function getCalculators(): array return [ PostNLCountryShipmentOptionsCalculator::class, PostNLAgeCheckCalculator::class, + PostNLReceiptCodeCalculator::class, PostNLDeliveryTypeCalculator::class, ]; } diff --git a/src/App/Order/Calculator/PostNl/PostNLReceiptCodeCalculator.php b/src/App/Order/Calculator/PostNl/PostNLReceiptCodeCalculator.php new file mode 100644 index 000000000..8f2183a70 --- /dev/null +++ b/src/App/Order/Calculator/PostNl/PostNLReceiptCodeCalculator.php @@ -0,0 +1,85 @@ +order->deliveryOptions->shipmentOptions; + + if (TriStateService::ENABLED !== $shipmentOptions->receiptCode) { + return; + } + + if ($this->order->shippingAddress->cc !== CountryCodes::CC_NL) { + $shipmentOptions->receiptCode = TriStateService::DISABLED; + return; + } + + if (TriStateService::ENABLED === $shipmentOptions->ageCheck) { + $shipmentOptions->receiptCode = TriStateService::DISABLED; + return; + } + + $shipmentOptions->signature = TriStateService::DISABLED; + $shipmentOptions->onlyRecipient = TriStateService::DISABLED; + $shipmentOptions->largeFormat = TriStateService::DISABLED; + $shipmentOptions->return = TriStateService::DISABLED; + + if ($shipmentOptions->insurance === TriStateService::DISABLED) { + /** @var \MyParcelNL\Pdk\Validation\Validator\CarrierSchema $schema */ + $schema = Pdk::get(CarrierSchema::class); + $allowedInsuranceAmounts = $schema + ->setCarrier($this->order->deliveryOptions->carrier) + ->getAllowedInsuranceAmounts(); + + $shipmentOptions->insurance = $this->getLowestInsuranceAmount($allowedInsuranceAmounts); + } + } + + /** + * Gets the lowest allowed insurance amount that is greater than 0. + * + * @param int[] $insuranceAmount + * + * @return int + */ + private function getLowestInsuranceAmount(array $insuranceAmount): int + { + $lowestAmount = null; + + foreach ($insuranceAmount as $allowedInsuranceAmount) { + if ($allowedInsuranceAmount <= 0) { + continue; + } + + if (null === $lowestAmount || $allowedInsuranceAmount < $lowestAmount) { + $lowestAmount = $allowedInsuranceAmount; + } + } + + return $lowestAmount ?? 0; + } +} diff --git a/src/Frontend/View/CarrierSettingsItemView.php b/src/Frontend/View/CarrierSettingsItemView.php index edf496330..0ef2aeef8 100644 --- a/src/Frontend/View/CarrierSettingsItemView.php +++ b/src/Frontend/View/CarrierSettingsItemView.php @@ -248,6 +248,10 @@ function (FormOperationBuilder $builder) { : [] ), + $this->carrierSchema->canHaveReceiptCode() ? [ + new InteractiveElement(CarrierSettings::EXPORT_RECEIPT_CODE, Components::INPUT_TOGGLE), + ] : [], + $this->carrierSchema->canHaveLargeFormat() ? [new InteractiveElement(CarrierSettings::EXPORT_LARGE_FORMAT, Components::INPUT_TOGGLE)] : [], diff --git a/src/Settings/Model/CarrierSettings.php b/src/Settings/Model/CarrierSettings.php index c09744efa..38c1f92dc 100644 --- a/src/Settings/Model/CarrierSettings.php +++ b/src/Settings/Model/CarrierSettings.php @@ -105,6 +105,7 @@ class CarrierSettings extends AbstractSettingsModel public const EXPORT_RETURN_PACKAGE_TYPE = 'exportReturnPackageType'; public const EXPORT_SIGNATURE = 'exportSignature'; public const EXPORT_TRACKED = 'exportTracked'; + public const EXPORT_RECEIPT_CODE = 'exportReceiptCode'; public const PRICE_DELIVERY_TYPE_EVENING = 'priceDeliveryTypeEvening'; public const PRICE_DELIVERY_TYPE_MONDAY = 'priceDeliveryTypeMonday'; public const PRICE_DELIVERY_TYPE_MORNING = 'priceDeliveryTypeMorning'; @@ -144,6 +145,7 @@ class CarrierSettings extends AbstractSettingsModel self::DROP_OFF_DELAY => 0, self::DROP_OFF_POSSIBILITIES => DropOffPossibilities::class, self::EXPORT_AGE_CHECK => false, + self::EXPORT_RECEIPT_CODE => false, self::EXPORT_HIDE_SENDER => false, self::EXPORT_INSURANCE => false, self::EXPORT_INSURANCE_FROM_AMOUNT => 0, @@ -197,6 +199,7 @@ class CarrierSettings extends AbstractSettingsModel self::DROP_OFF_DELAY => 'int', self::DROP_OFF_POSSIBILITIES => DropOffPossibilities::class, self::EXPORT_AGE_CHECK => 'bool', + self::EXPORT_RECEIPT_CODE => 'bool', self::EXPORT_INSURANCE => 'bool', self::EXPORT_INSURANCE_FROM_AMOUNT => 'int', self::EXPORT_INSURANCE_PRICE_PERCENTAGE => 'float', diff --git a/src/Shipment/Model/ShipmentOptions.php b/src/Shipment/Model/ShipmentOptions.php index 8fa16e4f6..97df31462 100644 --- a/src/Shipment/Model/ShipmentOptions.php +++ b/src/Shipment/Model/ShipmentOptions.php @@ -18,6 +18,7 @@ * @property int<-1|0|1> $sameDayDelivery * @property int<-1|0|1> $signature * @property int<-1|0|1> $tracked + * @property int<-1|0|1> $receiptCode */ class ShipmentOptions extends Model { @@ -31,6 +32,7 @@ class ShipmentOptions extends Model public const SAME_DAY_DELIVERY = 'sameDayDelivery'; public const SIGNATURE = 'signature'; public const TRACKED = 'tracked'; + public const RECEIPT_CODE = 'receiptCode'; protected $attributes = [ self::LABEL_DESCRIPTION => null, @@ -43,6 +45,7 @@ class ShipmentOptions extends Model self::SAME_DAY_DELIVERY => TriStateService::INHERIT, self::SIGNATURE => TriStateService::INHERIT, self::TRACKED => TriStateService::INHERIT, + self::RECEIPT_CODE => TriStateService::INHERIT, ]; protected $casts = [ @@ -56,5 +59,6 @@ class ShipmentOptions extends Model self::SAME_DAY_DELIVERY => TriStateService::TYPE_STRICT, self::SIGNATURE => TriStateService::TYPE_STRICT, self::TRACKED => TriStateService::TYPE_STRICT, + self::RECEIPT_CODE => TriStateService::TYPE_STRICT, ]; } diff --git a/src/Validation/Validator/CarrierSchema.php b/src/Validation/Validator/CarrierSchema.php index 3a394430a..d8eb36cae 100644 --- a/src/Validation/Validator/CarrierSchema.php +++ b/src/Validation/Validator/CarrierSchema.php @@ -12,6 +12,7 @@ use MyParcelNL\Pdk\App\Options\Definition\InsuranceDefinition; use MyParcelNL\Pdk\App\Options\Definition\LargeFormatDefinition; use MyParcelNL\Pdk\App\Options\Definition\OnlyRecipientDefinition; +use MyParcelNL\Pdk\App\Options\Definition\ReceiptCodeDefinition; use MyParcelNL\Pdk\App\Options\Definition\SameDayDeliveryDefinition; use MyParcelNL\Pdk\App\Options\Definition\SignatureDefinition; use MyParcelNL\Pdk\App\Options\Definition\TrackedDefinition; @@ -127,6 +128,11 @@ public function canHavePickup(): bool return $this->hasDeliveryType(DeliveryOptions::DELIVERY_TYPE_PICKUP_NAME); } + public function canHaveReceiptCode(): bool + { + return $this->canHave(ReceiptCodeDefinition::class); + } + public function canHaveSameDayDelivery(): bool { return $this->canHave(SameDayDeliveryDefinition::class); diff --git a/tests/Unit/App/Order/Calculator/PostNl/PostNLReceiptCodeCalculatorTest.php b/tests/Unit/App/Order/Calculator/PostNl/PostNLReceiptCodeCalculatorTest.php new file mode 100644 index 000000000..51cc3efa8 --- /dev/null +++ b/tests/Unit/App/Order/Calculator/PostNl/PostNLReceiptCodeCalculatorTest.php @@ -0,0 +1,257 @@ +withShippingAddress(['cc' => 'NL']) + ->withDeliveryOptions( + factory(DeliveryOptions::class) + ->withShipmentOptions( + factory(ShipmentOptions::class) + ->withSignature(TriStateService::ENABLED) + ->withOnlyRecipient(TriStateService::ENABLED) + ->withLargeFormat(TriStateService::ENABLED) + ->withReturn(TriStateService::ENABLED) + ->withReceiptCode(TriStateService::ENABLED) + ) + ) + ->make(); + + $calculator = new PostNLReceiptCodeCalculator($order); + $calculator->calculate(); + + $shipmentOptions = $order->deliveryOptions->shipmentOptions; + + expect($shipmentOptions->signature) + ->toBe(TriStateService::DISABLED) + ->and($shipmentOptions->onlyRecipient) + ->toBe(TriStateService::DISABLED) + ->and($shipmentOptions->largeFormat) + ->toBe(TriStateService::DISABLED) + ->and($shipmentOptions->return) + ->toBe(TriStateService::DISABLED); + + $reset(); +}); + +it('sets minimum insurance when receipt code is enabled and insurance is not set', function () { + $reset = mockPdkProperty('orderCalculators', [PostNLReceiptCodeCalculator::class]); + + $carrier = factory(Carrier::class) + ->withName(Carrier::CARRIER_POSTNL_NAME) + ->withCapabilities( + factory(CarrierCapabilities::class)->withShipmentOptions(['insurance' => [5000, 10000, 25000]]) + ) + ->make(); + + $order = factory(PdkOrder::class) + ->withShippingAddress(['cc' => CountryCodes::CC_NL]) + ->withDeliveryOptions( + factory(DeliveryOptions::class) + ->withCarrier($carrier) + ->withShipmentOptions( + factory(ShipmentOptions::class) + ->withReceiptCode(TriStateService::ENABLED) + ->withInsurance(0) + ) + ) + ->make(); + + $calculator = new PostNLReceiptCodeCalculator($order); + $calculator->calculate(); + + expect($order->deliveryOptions->shipmentOptions->insurance)->toBe(5000); + + $reset(); +}); + +it('does not change insurance when receipt code is enabled and insurance is already set', function () { + $reset = mockPdkProperty('orderCalculators', [PostNLReceiptCodeCalculator::class]); + + $carrier = factory(Carrier::class) + ->withName(Carrier::CARRIER_POSTNL_NAME) + ->withCapabilities( + factory(CarrierCapabilities::class)->withShipmentOptions(['insurance' => [5000, 10000, 25000]]) + ) + ->make(); + + $order = factory(PdkOrder::class) + ->withShippingAddress(['cc' => CountryCodes::CC_NL]) + ->withDeliveryOptions( + factory(DeliveryOptions::class) + ->withCarrier($carrier) + ->withShipmentOptions( + factory(ShipmentOptions::class) + ->withReceiptCode(TriStateService::ENABLED) + ->withInsurance(10000) + ) + ) + ->make(); + + $calculator = new PostNLReceiptCodeCalculator($order); + $calculator->calculate(); + + expect($order->deliveryOptions->shipmentOptions->insurance)->toBe(10000); + + $reset(); +}); + +it('does nothing when receipt code is disabled', function () { + $reset = mockPdkProperty('orderCalculators', [PostNLReceiptCodeCalculator::class]); + + $order = factory(PdkOrder::class) + ->withShippingAddress(['cc' => CountryCodes::CC_NL]) + ->withDeliveryOptions( + factory(DeliveryOptions::class) + ->withShipmentOptions( + factory(ShipmentOptions::class) + ->withReceiptCode(TriStateService::DISABLED) + ->withSignature(TriStateService::ENABLED) + ->withOnlyRecipient(TriStateService::ENABLED) + ->withLargeFormat(TriStateService::ENABLED) + ->withReturn(TriStateService::ENABLED) + ) + ) + ->make(); + + $calculator = new PostNLReceiptCodeCalculator($order); + $calculator->calculate(); + + $shipmentOptions = $order->deliveryOptions->shipmentOptions; + + expect($shipmentOptions->signature) + ->toBe(TriStateService::ENABLED) + ->and($shipmentOptions->onlyRecipient) + ->toBe(TriStateService::ENABLED) + ->and($shipmentOptions->largeFormat) + ->toBe(TriStateService::ENABLED) + ->and($shipmentOptions->return) + ->toBe(TriStateService::ENABLED); + + $reset(); +}); + +it('returns 0 when no valid insurance amounts are available', function () { + $reset = mockPdkProperty('orderCalculators', [PostNLReceiptCodeCalculator::class]); + + $carrier = factory(Carrier::class) + ->withName(Carrier::CARRIER_POSTNL_NAME) + ->withCapabilities( + factory(CarrierCapabilities::class)->withShipmentOptions(['insurance' => [0]]) + ) + ->make(); + + $order = factory(PdkOrder::class) + ->withShippingAddress(['cc' => CountryCodes::CC_NL]) + ->withDeliveryOptions( + factory(DeliveryOptions::class) + ->withCarrier($carrier) + ->withShipmentOptions( + factory(ShipmentOptions::class) + ->withReceiptCode(TriStateService::ENABLED) + ->withInsurance(TriStateService::DISABLED) + ) + ) + ->make(); + + $calculator = new PostNLReceiptCodeCalculator($order); + $calculator->calculate(); + + expect($order->deliveryOptions->shipmentOptions->insurance)->toBe(0); + + $reset(); +}); + +it('disables receipt code when shipping to a non-NL country', function () { + $reset = mockPdkProperty('orderCalculators', [PostNLReceiptCodeCalculator::class]); + + $order = factory(PdkOrder::class) + ->withShippingAddress(['cc' => 'BE']) + ->withDeliveryOptions( + factory(DeliveryOptions::class) + ->withShipmentOptions( + factory(ShipmentOptions::class) + ->withReceiptCode(TriStateService::ENABLED) + ->withSignature(TriStateService::ENABLED) + ->withOnlyRecipient(TriStateService::ENABLED) + ->withLargeFormat(TriStateService::ENABLED) + ->withReturn(TriStateService::ENABLED) + ) + ) + ->make(); + + $calculator = new PostNLReceiptCodeCalculator($order); + $calculator->calculate(); + + $shipmentOptions = $order->deliveryOptions->shipmentOptions; + + expect($shipmentOptions->receiptCode) + ->toBe(TriStateService::DISABLED) + ->and($shipmentOptions->signature) + ->toBe(TriStateService::ENABLED) + ->and($shipmentOptions->onlyRecipient) + ->toBe(TriStateService::ENABLED) + ->and($shipmentOptions->largeFormat) + ->toBe(TriStateService::ENABLED) + ->and($shipmentOptions->return) + ->toBe(TriStateService::ENABLED); + + $reset(); +}); + +it('disables receipt code when age check is enabled', function () { + $reset = mockPdkProperty('orderCalculators', [PostNLReceiptCodeCalculator::class]); + + $order = factory(PdkOrder::class) + ->withShippingAddress(['cc' => CountryCodes::CC_NL]) + ->withDeliveryOptions( + factory(DeliveryOptions::class) + ->withShipmentOptions( + factory(ShipmentOptions::class) + ->withReceiptCode(TriStateService::ENABLED) + ->withAgeCheck(TriStateService::ENABLED) + ->withSignature(TriStateService::ENABLED) + ->withOnlyRecipient(TriStateService::ENABLED) + ->withLargeFormat(TriStateService::ENABLED) + ->withReturn(TriStateService::ENABLED) + ) + ) + ->make(); + + $calculator = new PostNLReceiptCodeCalculator($order); + $calculator->calculate(); + + $shipmentOptions = $order->deliveryOptions->shipmentOptions; + + expect($shipmentOptions->receiptCode) + ->toBe(TriStateService::DISABLED) + ->and($shipmentOptions->signature) + ->toBe(TriStateService::ENABLED) + ->and($shipmentOptions->onlyRecipient) + ->toBe(TriStateService::ENABLED) + ->and($shipmentOptions->largeFormat) + ->toBe(TriStateService::ENABLED) + ->and($shipmentOptions->return) + ->toBe(TriStateService::ENABLED); + + $reset(); +}); diff --git a/tests/Unit/Context/Model/OrderDataContextTest.php b/tests/Unit/Context/Model/OrderDataContextTest.php index ee14c5cbb..247fe4499 100644 --- a/tests/Unit/Context/Model/OrderDataContextTest.php +++ b/tests/Unit/Context/Model/OrderDataContextTest.php @@ -86,6 +86,7 @@ function setup(): void ShipmentOptions::SAME_DAY_DELIVERY => TriStateService::INHERIT, ShipmentOptions::SIGNATURE => TriStateService::INHERIT, ShipmentOptions::TRACKED => TriStateService::INHERIT, + ShipmentOptions::RECEIPT_CODE => TriStateService::INHERIT, ]) ->and($context->inheritedDeliveryOptions->toArrayWithoutNull()) ->toEqual([ @@ -106,6 +107,7 @@ function setup(): void // Enabled by carrier ShipmentOptions::SIGNATURE => TriStateService::ENABLED, ShipmentOptions::TRACKED => TriStateService::DISABLED, + ShipmentOptions::RECEIPT_CODE => TriStateService::DISABLED, ], ], 'dhlforyou:12345' => [ @@ -124,6 +126,7 @@ function setup(): void ShipmentOptions::SAME_DAY_DELIVERY => TriStateService::DISABLED, ShipmentOptions::SIGNATURE => TriStateService::DISABLED, ShipmentOptions::TRACKED => TriStateService::DISABLED, + ShipmentOptions::RECEIPT_CODE => TriStateService::DISABLED, ], ], ]); diff --git a/tests/Unit/Shipment/Model/Options/DeliveryOptionsTest.php b/tests/Unit/Shipment/Model/Options/DeliveryOptionsTest.php index eabb66fb1..7663af4e8 100644 --- a/tests/Unit/Shipment/Model/Options/DeliveryOptionsTest.php +++ b/tests/Unit/Shipment/Model/Options/DeliveryOptionsTest.php @@ -54,6 +54,7 @@ 'return' => true, 'sameDayDelivery' => true, 'signature' => true, + 'receiptCode' => true, ], ]); @@ -69,6 +70,7 @@ 'sameDayDelivery' => true, 'signature' => true, 'tracked' => true, + 'receiptCode' => true, ]); }); diff --git a/tests/__snapshots__/AbstractSettingsRepositoryTest__it_retrieves_all_categories_and_fields__1.json b/tests/__snapshots__/AbstractSettingsRepositoryTest__it_retrieves_all_categories_and_fields__1.json index bfd90fcb6..f36e3a496 100644 --- a/tests/__snapshots__/AbstractSettingsRepositoryTest__it_retrieves_all_categories_and_fields__1.json +++ b/tests/__snapshots__/AbstractSettingsRepositoryTest__it_retrieves_all_categories_and_fields__1.json @@ -70,6 +70,7 @@ "dropOffDaysDeviations": [] }, "exportAgeCheck": false, + "exportReceiptCode": false, "exportHideSender": false, "exportInsurance": false, "exportInsuranceFromAmount": 0, @@ -123,6 +124,7 @@ "dropOffDaysDeviations": [] }, "exportAgeCheck": false, + "exportReceiptCode": false, "exportHideSender": false, "exportInsurance": false, "exportInsuranceFromAmount": 0, @@ -176,6 +178,7 @@ "dropOffDaysDeviations": [] }, "exportAgeCheck": false, + "exportReceiptCode": false, "exportHideSender": false, "exportInsurance": false, "exportInsuranceFromAmount": 0, diff --git a/tests/__snapshots__/CarrierTest__it_instantiates_carriers_from_name_with_(myparcel)__1.json b/tests/__snapshots__/CarrierTest__it_instantiates_carriers_from_name_with_(myparcel)__1.json index 465abe5b6..b03e1831e 100644 --- a/tests/__snapshots__/CarrierTest__it_instantiates_carriers_from_name_with_(myparcel)__1.json +++ b/tests/__snapshots__/CarrierTest__it_instantiates_carriers_from_name_with_(myparcel)__1.json @@ -24,6 +24,7 @@ "return": true, "sameDayDelivery": false, "signature": true, + "receiptCode": true, "insurance": [0, 10000, 25000, 50000, 100000, 150000, 200000, 250000, 300000, 350000, 400000, 450000, 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 f2828524e..f5e5fd3f5 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 @@ -28,6 +28,7 @@ "return": true, "sameDayDelivery": false, "signature": true, + "receiptCode": true, "insurance": [ 0, 10000, 25000, 50000, 100000, 150000, 200000, 250000, 300000, 350000, 400000, 450000, 500000 ] @@ -62,7 +63,8 @@ "return": -1, "sameDayDelivery": -1, "signature": -1, - "tracked": -1 + "tracked": -1, + "receiptCode": -1 }, "deliveryType": "standard", "packageType": "package" @@ -98,7 +100,8 @@ "return": 0, "sameDayDelivery": 0, "signature": 0, - "tracked": 0 + "tracked": 0, + "receiptCode": 0 }, "deliveryType": "standard", "packageType": "package" @@ -155,6 +158,7 @@ "return": true, "sameDayDelivery": false, "signature": true, + "receiptCode": true, "insurance": [ 0, 10000, 25000, 50000, 100000, 150000, 200000, 250000, 300000, 350000, 400000, 450000, 500000 ] @@ -189,7 +193,8 @@ "return": -1, "sameDayDelivery": -1, "signature": -1, - "tracked": -1 + "tracked": -1, + "receiptCode": -1 }, "deliveryType": "standard", "packageType": "package" @@ -225,7 +230,8 @@ "return": 0, "sameDayDelivery": 0, "signature": 0, - "tracked": 0 + "tracked": 0, + "receiptCode": 0 }, "deliveryType": "standard", "packageType": "package" 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 b945ab680..7ff11fb57 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 @@ -28,6 +28,7 @@ "return": true, "sameDayDelivery": false, "signature": true, + "receiptCode": true, "insurance": [ 0, 10000, 25000, 50000, 100000, 150000, 200000, 250000, 300000, 350000, 400000, 450000, 500000 ] @@ -62,7 +63,8 @@ "return": -1, "sameDayDelivery": -1, "signature": -1, - "tracked": -1 + "tracked": -1, + "receiptCode": -1 }, "deliveryType": "standard", "packageType": "package" @@ -98,7 +100,8 @@ "return": 0, "sameDayDelivery": 0, "signature": 0, - "tracked": 0 + "tracked": 0, + "receiptCode": 0 }, "deliveryType": "standard", "packageType": "package" 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 a4232b819..18d3a1481 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 @@ -63,6 +63,7 @@ "return": true, "sameDayDelivery": false, "signature": true, + "receiptCode": true, "insurance": [ 0, 10000, 25000, 50000, 100000, 150000, 200000, 250000, 300000, 350000, 400000, 450000, 500000 ] @@ -98,7 +99,8 @@ "return": 0, "sameDayDelivery": -1, "signature": 0, - "tracked": -1 + "tracked": -1, + "receiptCode": -1 }, "deliveryType": "standard", "packageType": "package" 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 0c8413c0a..94294cff6 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 @@ -29,6 +29,7 @@ "return": true, "sameDayDelivery": false, "signature": true, + "receiptCode": true, "insurance": [ 0, 10000, 25000, 50000, 100000, 150000, 200000, 250000, 300000, 350000, 400000, 450000, 500000 ] @@ -63,7 +64,8 @@ "return": -1, "sameDayDelivery": -1, "signature": -1, - "tracked": -1 + "tracked": -1, + "receiptCode": -1 }, "deliveryType": "standard", "packageType": "package" @@ -127,7 +129,8 @@ "return": -1, "sameDayDelivery": -1, "signature": -1, - "tracked": -1 + "tracked": -1, + "receiptCode": -1 }, "deliveryType": "standard", "packageType": "package" @@ -180,7 +183,8 @@ "return": -1, "sameDayDelivery": -1, "signature": -1, - "tracked": -1 + "tracked": -1, + "receiptCode": -1 }, "deliveryType": "standard", "packageType": "package" @@ -299,6 +303,7 @@ "return": true, "sameDayDelivery": false, "signature": true, + "receiptCode": true, "insurance": [ 0, 10000, 25000, 50000, 100000, 150000, 200000, 250000, 300000, 350000, 400000, 450000, 500000 ] @@ -333,7 +338,8 @@ "return": -1, "sameDayDelivery": -1, "signature": -1, - "tracked": -1 + "tracked": -1, + "receiptCode": -1 }, "deliveryType": "standard", "packageType": "package" 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 4a9affa51..fe1fcc333 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 @@ -29,6 +29,7 @@ "return": true, "sameDayDelivery": false, "signature": true, + "receiptCode": true, "insurance": [ 0, 10000, 25000, 50000, 100000, 150000, 200000, 250000, 300000, 350000, 400000, 450000, 500000 ] @@ -63,7 +64,8 @@ "return": -1, "sameDayDelivery": -1, "signature": -1, - "tracked": -1 + "tracked": -1, + "receiptCode": -1 }, "deliveryType": "standard", "packageType": "package" @@ -127,7 +129,8 @@ "return": -1, "sameDayDelivery": -1, "signature": -1, - "tracked": -1 + "tracked": -1, + "receiptCode": -1 }, "deliveryType": "standard", "packageType": "package" @@ -180,7 +183,8 @@ "return": -1, "sameDayDelivery": -1, "signature": -1, - "tracked": -1 + "tracked": -1, + "receiptCode": -1 }, "deliveryType": "standard", "packageType": "package" @@ -299,6 +303,7 @@ "return": true, "sameDayDelivery": false, "signature": true, + "receiptCode": true, "insurance": [ 0, 10000, 25000, 50000, 100000, 150000, 200000, 250000, 300000, 350000, 400000, 450000, 500000 ] @@ -333,7 +338,8 @@ "return": -1, "sameDayDelivery": -1, "signature": -1, - "tracked": -1 + "tracked": -1, + "receiptCode": -1 }, "deliveryType": "standard", "packageType": "package" 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 442a821a5..c139ff696 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 @@ -29,6 +29,7 @@ "return": true, "sameDayDelivery": false, "signature": true, + "receiptCode": true, "insurance": [ 0, 10000, 25000, 50000, 100000, 150000, 200000, 250000, 300000, 350000, 400000, 450000, 500000 ] @@ -63,7 +64,8 @@ "return": -1, "sameDayDelivery": -1, "signature": -1, - "tracked": -1 + "tracked": -1, + "receiptCode": -1 }, "deliveryType": "standard", "packageType": "package" @@ -127,7 +129,8 @@ "return": -1, "sameDayDelivery": -1, "signature": -1, - "tracked": -1 + "tracked": -1, + "receiptCode": -1 }, "deliveryType": "standard", "packageType": "package" @@ -180,7 +183,8 @@ "return": -1, "sameDayDelivery": -1, "signature": 1, - "tracked": -1 + "tracked": -1, + "receiptCode": -1 }, "deliveryType": "morning", "packageType": "package" @@ -299,6 +303,7 @@ "return": true, "sameDayDelivery": false, "signature": true, + "receiptCode": true, "insurance": [ 0, 10000, 25000, 50000, 100000, 150000, 200000, 250000, 300000, 350000, 400000, 450000, 500000 ] @@ -333,7 +338,8 @@ "return": -1, "sameDayDelivery": -1, "signature": -1, - "tracked": -1 + "tracked": -1, + "receiptCode": -1 }, "deliveryType": "evening", "packageType": "package" 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 3a0acd744..b453c727a 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 @@ -441,6 +441,7 @@ "dropOffDaysDeviations": [] }, "exportAgeCheck": false, + "exportReceiptCode": false, "exportHideSender": false, "exportInsurance": false, "exportInsuranceFromAmount": 0, 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 c7114706a..bbcd57259 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 @@ -28,6 +28,7 @@ "return": true, "sameDayDelivery": false, "signature": true, + "receiptCode": true, "insurance": [ 0, 10000, 25000, 50000, 100000, 150000, 200000, 250000, 300000, 350000, 400000, 450000, 500000 ] @@ -62,7 +63,8 @@ "return": -1, "sameDayDelivery": -1, "signature": -1, - "tracked": -1 + "tracked": -1, + "receiptCode": -1 }, "deliveryType": "standard", "packageType": "package" @@ -98,7 +100,8 @@ "return": 0, "sameDayDelivery": 0, "signature": 0, - "tracked": 0 + "tracked": 0, + "receiptCode": 0 }, "deliveryType": "standard", "packageType": "package" 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 de7737950..487fdd74d 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 @@ -28,6 +28,7 @@ "return": true, "sameDayDelivery": false, "signature": true, + "receiptCode": true, "insurance": [ 0, 10000, 25000, 50000, 100000, 150000, 200000, 250000, 300000, 350000, 400000, 450000, 500000 ] @@ -62,7 +63,8 @@ "return": -1, "sameDayDelivery": -1, "signature": -1, - "tracked": -1 + "tracked": -1, + "receiptCode": -1 }, "deliveryType": "standard", "packageType": "package" @@ -98,7 +100,8 @@ "return": 0, "sameDayDelivery": 0, "signature": 0, - "tracked": 0 + "tracked": 0, + "receiptCode": 0 }, "deliveryType": "standard", "packageType": "package" diff --git a/tests/__snapshots__/OrderValidatorTest__it_returns_correct_schema_with_data_set_pickup_without_location_code__1.json b/tests/__snapshots__/OrderValidatorTest__it_returns_correct_schema_with_data_set_pickup_without_location_code__1.json index 087f1a716..9f553dc3c 100644 --- a/tests/__snapshots__/OrderValidatorTest__it_returns_correct_schema_with_data_set_pickup_without_location_code__1.json +++ b/tests/__snapshots__/OrderValidatorTest__it_returns_correct_schema_with_data_set_pickup_without_location_code__1.json @@ -161,6 +161,9 @@ }, "tracked": { "enum": [0, 1] + }, + "receiptCode": { + "enum": [-1, 0, 1] } } } diff --git a/tests/__snapshots__/OrderValidatorTest__it_validates_order_with_data_set_BE_mailbox__1.json b/tests/__snapshots__/OrderValidatorTest__it_validates_order_with_data_set_BE_mailbox__1.json index fda506131..30d4ba6e1 100644 --- a/tests/__snapshots__/OrderValidatorTest__it_validates_order_with_data_set_BE_mailbox__1.json +++ b/tests/__snapshots__/OrderValidatorTest__it_validates_order_with_data_set_BE_mailbox__1.json @@ -108,5 +108,13 @@ "constraint": "enum", "context": 1, "enum": [0, 1] + }, + { + "property": "deliveryOptions.shipmentOptions.receiptCode", + "pointer": "/deliveryOptions/shipmentOptions/receiptCode", + "message": "Does not have a value in the enumeration [0,1]", + "constraint": "enum", + "context": 1, + "enum": [0, 1] } ] diff --git a/tests/__snapshots__/OrderValidatorTest__it_validates_order_with_data_set_EU_package_with_correct_insurance__1.json b/tests/__snapshots__/OrderValidatorTest__it_validates_order_with_data_set_EU_package_with_correct_insurance__1.json index f71fe23bd..cc9d7cc51 100644 --- a/tests/__snapshots__/OrderValidatorTest__it_validates_order_with_data_set_EU_package_with_correct_insurance__1.json +++ b/tests/__snapshots__/OrderValidatorTest__it_validates_order_with_data_set_EU_package_with_correct_insurance__1.json @@ -124,5 +124,13 @@ "constraint": "enum", "context": 1, "enum": [0, 1] + }, + { + "property": "deliveryOptions.shipmentOptions.receiptCode", + "pointer": "/deliveryOptions/shipmentOptions/receiptCode", + "message": "Does not have a value in the enumeration [0,1]", + "constraint": "enum", + "context": 1, + "enum": [0, 1] } ] diff --git a/tests/__snapshots__/OrderValidatorTest__it_validates_order_with_data_set_EU_package_with_no_weight__1.json b/tests/__snapshots__/OrderValidatorTest__it_validates_order_with_data_set_EU_package_with_no_weight__1.json index f71fe23bd..cc9d7cc51 100644 --- a/tests/__snapshots__/OrderValidatorTest__it_validates_order_with_data_set_EU_package_with_no_weight__1.json +++ b/tests/__snapshots__/OrderValidatorTest__it_validates_order_with_data_set_EU_package_with_no_weight__1.json @@ -124,5 +124,13 @@ "constraint": "enum", "context": 1, "enum": [0, 1] + }, + { + "property": "deliveryOptions.shipmentOptions.receiptCode", + "pointer": "/deliveryOptions/shipmentOptions/receiptCode", + "message": "Does not have a value in the enumeration [0,1]", + "constraint": "enum", + "context": 1, + "enum": [0, 1] } ] diff --git a/tests/__snapshots__/OrderValidatorTest__it_validates_order_with_data_set_EU_package_without_insurance__1.json b/tests/__snapshots__/OrderValidatorTest__it_validates_order_with_data_set_EU_package_without_insurance__1.json index a563eb0c2..125226f8f 100644 --- a/tests/__snapshots__/OrderValidatorTest__it_validates_order_with_data_set_EU_package_without_insurance__1.json +++ b/tests/__snapshots__/OrderValidatorTest__it_validates_order_with_data_set_EU_package_without_insurance__1.json @@ -140,5 +140,13 @@ "constraint": "enum", "context": 1, "enum": [0, 1] + }, + { + "property": "deliveryOptions.shipmentOptions.receiptCode", + "pointer": "/deliveryOptions/shipmentOptions/receiptCode", + "message": "Does not have a value in the enumeration [0,1]", + "constraint": "enum", + "context": 1, + "enum": [0, 1] } ] diff --git a/tests/__snapshots__/OrderValidatorTest__it_validates_order_with_data_set_ROW_package__1.json b/tests/__snapshots__/OrderValidatorTest__it_validates_order_with_data_set_ROW_package__1.json index f0a9b4385..9cce6cfa5 100644 --- a/tests/__snapshots__/OrderValidatorTest__it_validates_order_with_data_set_ROW_package__1.json +++ b/tests/__snapshots__/OrderValidatorTest__it_validates_order_with_data_set_ROW_package__1.json @@ -140,5 +140,13 @@ "constraint": "enum", "context": 1, "enum": [0, 1] + }, + { + "property": "deliveryOptions.shipmentOptions.receiptCode", + "pointer": "/deliveryOptions/shipmentOptions/receiptCode", + "message": "Does not have a value in the enumeration [0,1]", + "constraint": "enum", + "context": 1, + "enum": [0, 1] } ] diff --git a/tests/__snapshots__/OrderValidatorTest__it_validates_order_with_data_set_ROW_package_without_invoice__1.json b/tests/__snapshots__/OrderValidatorTest__it_validates_order_with_data_set_ROW_package_without_invoice__1.json index f0a9b4385..9cce6cfa5 100644 --- a/tests/__snapshots__/OrderValidatorTest__it_validates_order_with_data_set_ROW_package_without_invoice__1.json +++ b/tests/__snapshots__/OrderValidatorTest__it_validates_order_with_data_set_ROW_package_without_invoice__1.json @@ -140,5 +140,13 @@ "constraint": "enum", "context": 1, "enum": [0, 1] + }, + { + "property": "deliveryOptions.shipmentOptions.receiptCode", + "pointer": "/deliveryOptions/shipmentOptions/receiptCode", + "message": "Does not have a value in the enumeration [0,1]", + "constraint": "enum", + "context": 1, + "enum": [0, 1] } ] diff --git a/tests/__snapshots__/OrderValidatorTest__it_validates_order_with_data_set_ROW_package_without_weight,_without_invoice__1.json b/tests/__snapshots__/OrderValidatorTest__it_validates_order_with_data_set_ROW_package_without_weight,_without_invoice__1.json index b4de56479..18c29be3c 100644 --- a/tests/__snapshots__/OrderValidatorTest__it_validates_order_with_data_set_ROW_package_without_weight,_without_invoice__1.json +++ b/tests/__snapshots__/OrderValidatorTest__it_validates_order_with_data_set_ROW_package_without_weight,_without_invoice__1.json @@ -147,5 +147,13 @@ "constraint": "enum", "context": 1, "enum": [0, 1] + }, + { + "property": "deliveryOptions.shipmentOptions.receiptCode", + "pointer": "/deliveryOptions/shipmentOptions/receiptCode", + "message": "Does not have a value in the enumeration [0,1]", + "constraint": "enum", + "context": 1, + "enum": [0, 1] } ] diff --git a/tests/__snapshots__/OrderValidatorTest__it_validates_order_with_data_set_dhlforyou_to_France__1.json b/tests/__snapshots__/OrderValidatorTest__it_validates_order_with_data_set_dhlforyou_to_France__1.json index 8338cf5c6..cfe9c0377 100644 --- a/tests/__snapshots__/OrderValidatorTest__it_validates_order_with_data_set_dhlforyou_to_France__1.json +++ b/tests/__snapshots__/OrderValidatorTest__it_validates_order_with_data_set_dhlforyou_to_France__1.json @@ -62,5 +62,13 @@ "constraint": "enum", "context": 1, "enum": [0, 1] + }, + { + "property": "deliveryOptions.shipmentOptions.receiptCode", + "pointer": "/deliveryOptions/shipmentOptions/receiptCode", + "message": "Does not have a value in the enumeration [0,1]", + "constraint": "enum", + "context": 1, + "enum": [0, 1] } ] diff --git a/tests/__snapshots__/OrderValidatorTest__it_validates_order_with_data_set_mailbox_with_morning_delivery__1.json b/tests/__snapshots__/OrderValidatorTest__it_validates_order_with_data_set_mailbox_with_morning_delivery__1.json index b1de89b7b..fe47a7249 100644 --- a/tests/__snapshots__/OrderValidatorTest__it_validates_order_with_data_set_mailbox_with_morning_delivery__1.json +++ b/tests/__snapshots__/OrderValidatorTest__it_validates_order_with_data_set_mailbox_with_morning_delivery__1.json @@ -116,5 +116,13 @@ "constraint": "enum", "context": 1, "enum": [0, 1] + }, + { + "property": "deliveryOptions.shipmentOptions.receiptCode", + "pointer": "/deliveryOptions/shipmentOptions/receiptCode", + "message": "Does not have a value in the enumeration [0,1]", + "constraint": "enum", + "context": 1, + "enum": [0, 1] } ] diff --git a/tests/__snapshots__/OrderValidatorTest__it_validates_order_with_data_set_mailbox_with_shipmentOptions__1.json b/tests/__snapshots__/OrderValidatorTest__it_validates_order_with_data_set_mailbox_with_shipmentOptions__1.json index 0a4306737..8da091d0a 100644 --- a/tests/__snapshots__/OrderValidatorTest__it_validates_order_with_data_set_mailbox_with_shipmentOptions__1.json +++ b/tests/__snapshots__/OrderValidatorTest__it_validates_order_with_data_set_mailbox_with_shipmentOptions__1.json @@ -100,5 +100,13 @@ "constraint": "enum", "context": 1, "enum": [0, 1] + }, + { + "property": "deliveryOptions.shipmentOptions.receiptCode", + "pointer": "/deliveryOptions/shipmentOptions/receiptCode", + "message": "Does not have a value in the enumeration [0,1]", + "constraint": "enum", + "context": 1, + "enum": [0, 1] } ] diff --git a/tests/__snapshots__/OrderValidatorTest__it_validates_order_with_data_set_package_without_country__1.json b/tests/__snapshots__/OrderValidatorTest__it_validates_order_with_data_set_package_without_country__1.json index 0520685db..00229da8e 100644 --- a/tests/__snapshots__/OrderValidatorTest__it_validates_order_with_data_set_package_without_country__1.json +++ b/tests/__snapshots__/OrderValidatorTest__it_validates_order_with_data_set_package_without_country__1.json @@ -115,5 +115,13 @@ "constraint": "enum", "context": 1, "enum": [0, 1] + }, + { + "property": "deliveryOptions.shipmentOptions.receiptCode", + "pointer": "/deliveryOptions/shipmentOptions/receiptCode", + "message": "Does not have a value in the enumeration [0,1]", + "constraint": "enum", + "context": 1, + "enum": [0, 1] } ] diff --git a/tests/__snapshots__/PdkOrderTest__it_creates_a_storable_array_with_data_set_carrier_dhl_for_you__1.json b/tests/__snapshots__/PdkOrderTest__it_creates_a_storable_array_with_data_set_carrier_dhl_for_you__1.json index f4718287c..610199979 100644 --- a/tests/__snapshots__/PdkOrderTest__it_creates_a_storable_array_with_data_set_carrier_dhl_for_you__1.json +++ b/tests/__snapshots__/PdkOrderTest__it_creates_a_storable_array_with_data_set_carrier_dhl_for_you__1.json @@ -15,7 +15,8 @@ "return": -1, "sameDayDelivery": -1, "signature": -1, - "tracked": -1 + "tracked": -1, + "receiptCode": -1 }, "deliveryType": "standard", "packageType": "package" diff --git a/tests/__snapshots__/PdkOrderTest__it_creates_a_storable_array_with_data_set_single_order__1.json b/tests/__snapshots__/PdkOrderTest__it_creates_a_storable_array_with_data_set_single_order__1.json index 0031a99a7..6ca2c8d64 100644 --- a/tests/__snapshots__/PdkOrderTest__it_creates_a_storable_array_with_data_set_single_order__1.json +++ b/tests/__snapshots__/PdkOrderTest__it_creates_a_storable_array_with_data_set_single_order__1.json @@ -15,7 +15,8 @@ "return": -1, "sameDayDelivery": -1, "signature": 1, - "tracked": -1 + "tracked": -1, + "receiptCode": -1 }, "deliveryType": "standard", "packageType": "package" diff --git a/tests/__snapshots__/PdkOrderTest__it_creates_a_storable_array_with_data_set_various_delivery_options__1.json b/tests/__snapshots__/PdkOrderTest__it_creates_a_storable_array_with_data_set_various_delivery_options__1.json index c794f39ef..8c2f3c22d 100644 --- a/tests/__snapshots__/PdkOrderTest__it_creates_a_storable_array_with_data_set_various_delivery_options__1.json +++ b/tests/__snapshots__/PdkOrderTest__it_creates_a_storable_array_with_data_set_various_delivery_options__1.json @@ -15,7 +15,8 @@ "return": -1, "sameDayDelivery": -1, "signature": -1, - "tracked": -1 + "tracked": -1, + "receiptCode": -1 }, "deliveryType": "standard", "packageType": "mailbox" @@ -39,7 +40,8 @@ "return": -1, "sameDayDelivery": -1, "signature": 1, - "tracked": -1 + "tracked": -1, + "receiptCode": -1 }, "deliveryType": "evening", "packageType": "package" @@ -62,7 +64,8 @@ "return": 1, "sameDayDelivery": -1, "signature": 1, - "tracked": -1 + "tracked": -1, + "receiptCode": -1 }, "deliveryType": "standard", "packageType": "package" 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 3087777da..98fa60e91 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 @@ -26,6 +26,7 @@ "return": true, "sameDayDelivery": false, "signature": true, + "receiptCode": true, "insurance": [ 0, 10000, 25000, 50000, 100000, 150000, 200000, 250000, 300000, 350000, 400000, 450000, 500000 ] @@ -60,7 +61,8 @@ "return": -1, "sameDayDelivery": -1, "signature": -1, - "tracked": -1 + "tracked": -1, + "receiptCode": -1 }, "deliveryType": "standard", "packageType": "package" 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 3087777da..98fa60e91 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 @@ -26,6 +26,7 @@ "return": true, "sameDayDelivery": false, "signature": true, + "receiptCode": true, "insurance": [ 0, 10000, 25000, 50000, 100000, 150000, 200000, 250000, 300000, 350000, 400000, 450000, 500000 ] @@ -60,7 +61,8 @@ "return": -1, "sameDayDelivery": -1, "signature": -1, - "tracked": -1 + "tracked": -1, + "receiptCode": -1 }, "deliveryType": "standard", "packageType": "package" diff --git a/tests/__snapshots__/PlatformManagerTest__it_gets_carriers_with_(myparcel)__1.json b/tests/__snapshots__/PlatformManagerTest__it_gets_carriers_with_(myparcel)__1.json index 465abe5b6..b03e1831e 100644 --- a/tests/__snapshots__/PlatformManagerTest__it_gets_carriers_with_(myparcel)__1.json +++ b/tests/__snapshots__/PlatformManagerTest__it_gets_carriers_with_(myparcel)__1.json @@ -24,6 +24,7 @@ "return": true, "sameDayDelivery": false, "signature": true, + "receiptCode": true, "insurance": [0, 10000, 25000, 50000, 100000, 150000, 200000, 250000, 300000, 350000, 400000, 450000, 500000] } }, diff --git a/tests/__snapshots__/PlatformManagerTest__it_retrieves_config_for_each_platform_with_(myparcel)__1.json b/tests/__snapshots__/PlatformManagerTest__it_retrieves_config_for_each_platform_with_(myparcel)__1.json index 1132c0d14..4cb657f0a 100644 --- a/tests/__snapshots__/PlatformManagerTest__it_retrieves_config_for_each_platform_with_(myparcel)__1.json +++ b/tests/__snapshots__/PlatformManagerTest__it_retrieves_config_for_each_platform_with_(myparcel)__1.json @@ -24,6 +24,7 @@ "return": true, "sameDayDelivery": false, "signature": true, + "receiptCode": true, "insurance": [0, 10000, 25000, 50000, 100000, 150000, 200000, 250000, 300000, 350000, 400000, 450000, 500000] }, "features": { 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 bedc2be7e..c75b56332 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 @@ -59,7 +59,8 @@ "return": 0, "sameDayDelivery": -1, "signature": 0, - "tracked": -1 + "tracked": -1, + "receiptCode": -1 }, "deliveryType": "standard", "packageType": "package" 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 43800469c..55eddf32d 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 @@ -42,7 +42,8 @@ "return": -1, "sameDayDelivery": -1, "signature": -1, - "tracked": -1 + "tracked": -1, + "receiptCode": -1 }, "deliveryType": "standard", "packageType": "package" 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 0e6c86b3a..50ce5a83c 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 @@ -40,7 +40,8 @@ "return": 1, "sameDayDelivery": 1, "signature": 0, - "tracked": -1 + "tracked": -1, + "receiptCode": -1 }, "deliveryType": "standard", "packageType": "package" 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 498d3d339..41f0e04a6 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 @@ -51,7 +51,8 @@ "return": 0, "sameDayDelivery": 0, "signature": 1, - "tracked": -1 + "tracked": -1, + "receiptCode": -1 }, "deliveryType": "pickup", "packageType": "package" diff --git a/tests/__snapshots__/SettingsManagerTest__it_retrieves_default_carrier_settings_with_(belgie)__1.json b/tests/__snapshots__/SettingsManagerTest__it_retrieves_default_carrier_settings_with_(belgie)__1.json index 5e01c87aa..f41d39404 100644 --- a/tests/__snapshots__/SettingsManagerTest__it_retrieves_default_carrier_settings_with_(belgie)__1.json +++ b/tests/__snapshots__/SettingsManagerTest__it_retrieves_default_carrier_settings_with_(belgie)__1.json @@ -67,6 +67,7 @@ "dropOffDaysDeviations": [] }, "exportAgeCheck": false, + "exportReceiptCode": false, "exportHideSender": false, "exportInsurance": false, "exportInsuranceFromAmount": 0, @@ -163,6 +164,7 @@ "dropOffDaysDeviations": [] }, "exportAgeCheck": false, + "exportReceiptCode": false, "exportHideSender": false, "exportInsurance": false, "exportInsuranceFromAmount": 0, @@ -259,6 +261,7 @@ "dropOffDaysDeviations": [] }, "exportAgeCheck": false, + "exportReceiptCode": false, "exportHideSender": false, "exportInsurance": false, "exportInsuranceFromAmount": 0, @@ -355,6 +358,7 @@ "dropOffDaysDeviations": [] }, "exportAgeCheck": false, + "exportReceiptCode": false, "exportHideSender": false, "exportInsurance": false, "exportInsuranceFromAmount": 0, diff --git a/tests/__snapshots__/SettingsManagerTest__it_retrieves_default_carrier_settings_with_(flespakket)__1.json b/tests/__snapshots__/SettingsManagerTest__it_retrieves_default_carrier_settings_with_(flespakket)__1.json index 16153d9fc..f3ea50c26 100644 --- a/tests/__snapshots__/SettingsManagerTest__it_retrieves_default_carrier_settings_with_(flespakket)__1.json +++ b/tests/__snapshots__/SettingsManagerTest__it_retrieves_default_carrier_settings_with_(flespakket)__1.json @@ -67,6 +67,7 @@ "dropOffDaysDeviations": [] }, "exportAgeCheck": false, + "exportReceiptCode": false, "exportHideSender": false, "exportInsurance": false, "exportInsuranceFromAmount": 0, @@ -163,6 +164,7 @@ "dropOffDaysDeviations": [] }, "exportAgeCheck": false, + "exportReceiptCode": false, "exportHideSender": false, "exportInsurance": false, "exportInsuranceFromAmount": 0, diff --git a/tests/__snapshots__/SettingsManagerTest__it_retrieves_default_carrier_settings_with_(myparcel)__1.json b/tests/__snapshots__/SettingsManagerTest__it_retrieves_default_carrier_settings_with_(myparcel)__1.json index d908c7721..07b82a51b 100644 --- a/tests/__snapshots__/SettingsManagerTest__it_retrieves_default_carrier_settings_with_(myparcel)__1.json +++ b/tests/__snapshots__/SettingsManagerTest__it_retrieves_default_carrier_settings_with_(myparcel)__1.json @@ -67,6 +67,7 @@ "dropOffDaysDeviations": [] }, "exportAgeCheck": false, + "exportReceiptCode": false, "exportHideSender": false, "exportInsurance": false, "exportInsuranceFromAmount": 0, @@ -163,6 +164,7 @@ "dropOffDaysDeviations": [] }, "exportAgeCheck": false, + "exportReceiptCode": false, "exportHideSender": false, "exportInsurance": false, "exportInsuranceFromAmount": 0, @@ -259,6 +261,7 @@ "dropOffDaysDeviations": [] }, "exportAgeCheck": false, + "exportReceiptCode": false, "exportHideSender": false, "exportInsurance": false, "exportInsuranceFromAmount": 0, @@ -355,6 +358,7 @@ "dropOffDaysDeviations": [] }, "exportAgeCheck": false, + "exportReceiptCode": false, "exportHideSender": false, "exportInsurance": false, "exportInsuranceFromAmount": 0, @@ -451,6 +455,7 @@ "dropOffDaysDeviations": [] }, "exportAgeCheck": false, + "exportReceiptCode": false, "exportHideSender": false, "exportInsurance": false, "exportInsuranceFromAmount": 0, @@ -547,6 +552,7 @@ "dropOffDaysDeviations": [] }, "exportAgeCheck": false, + "exportReceiptCode": false, "exportHideSender": false, "exportInsurance": false, "exportInsuranceFromAmount": 0, @@ -643,6 +649,7 @@ "dropOffDaysDeviations": [] }, "exportAgeCheck": false, + "exportReceiptCode": false, "exportHideSender": false, "exportInsurance": false, "exportInsuranceFromAmount": 0, diff --git a/tests/__snapshots__/UpdateShipmentsActionTest__it_updates_shipments__1.json b/tests/__snapshots__/UpdateShipmentsActionTest__it_updates_shipments__1.json index 58faa4d05..e07b171be 100644 --- a/tests/__snapshots__/UpdateShipmentsActionTest__it_updates_shipments__1.json +++ b/tests/__snapshots__/UpdateShipmentsActionTest__it_updates_shipments__1.json @@ -28,7 +28,8 @@ "return": 0, "sameDayDelivery": -1, "signature": 0, - "tracked": -1 + "tracked": -1, + "receiptCode": -1 }, "deliveryType": "standard", "packageType": "package"