From 77e8c09a1a9e3a3f1b8ebd915ed09e8c605e2dda Mon Sep 17 00:00:00 2001 From: Edie Lemoine Date: Fri, 27 Oct 2023 15:20:48 +0200 Subject: [PATCH] fix(core): fix data that should not be stored being stored (#226) --- .../Types/Shared/Model/ClassDefinition.php | 3 +- private/Types/Shared/Model/ClassMethod.php | 3 +- src/Account/Model/Account.php | 11 +- src/App/Order/Model/PdkOrder.php | 17 ++- src/App/Order/Model/PdkOrderNote.php | 12 +- src/App/Order/Model/PdkPhysicalProperties.php | 73 ++++++++++ src/App/Order/Model/PdkProduct.php | 3 +- src/Base/Concern/HasAttributes.php | 5 +- src/Base/Contract/Arrayable.php | 4 + src/Base/Model/Model.php | 12 +- src/Carrier/Model/Carrier.php | 10 ++ src/Context/Model/OrderDataContext.php | 2 +- src/Fulfilment/Model/Shipment.php | 9 +- src/Fulfilment/Request/PostOrdersRequest.php | 17 +-- src/Settings/Model/AbstractSettingsModel.php | 5 +- .../Collection/ShipmentCollection.php | 6 +- src/Shipment/Model/DeliveryOptions.php | 15 +- src/Shipment/Model/PhysicalProperties.php | 64 ++------- src/Shipment/Model/Shipment.php | 11 +- src/Shipment/Request/PostShipmentsRequest.php | 2 +- tests/Mocks/MockStorableModel.php | 3 +- tests/Unit/Account/Model/AccountTest.php | 24 ++++ .../Backend/Order/ExportReturnActionTest.php | 16 ++- .../General/WeightCalculatorTest.php | 4 +- .../Model/PdkPhysicalPropertiesTest.php} | 6 +- .../Fulfilment/Repository/PostOrdersTest.php | 133 ++++++------------ ...untTest__it_creates_storable_array__1.json | 52 +++++++ ...n_with_data_set_multiple_shipments__1.json | 4 +- ..._data_set_simple_domestic_shipment__1.json | 2 +- ..._data_set_simple_domestic_shipment__1.json | 4 +- ...heck__data_set_carrier_dhl_for_you__1.json | 8 +- ...t_age_check__data_set_single_order__1.json | 8 +- ...ort_age_check__data_set_two_orders__1.json | 16 +-- ..._data_set_various_delivery_options__1.json | 24 +--- ...ance__data_set_carrier_dhl_for_you__1.json | 8 +- ...t_insurance__data_set_single_order__1.json | 8 +- ...ort_insurance__data_set_two_orders__1.json | 16 +-- ..._data_set_various_delivery_options__1.json | 24 +--- ...rmat__data_set_carrier_dhl_for_you__1.json | 8 +- ...arge_format__data_set_single_order__1.json | 8 +- ..._large_format__data_set_two_orders__1.json | 16 +-- ..._data_set_various_delivery_options__1.json | 24 +--- ...ient__data_set_carrier_dhl_for_you__1.json | 8 +- ...y_recipient__data_set_single_order__1.json | 8 +- ...nly_recipient__data_set_two_orders__1.json | 16 +-- ..._data_set_various_delivery_options__1.json | 24 +--- ...turn__data_set_carrier_dhl_for_you__1.json | 8 +- ...port_return__data_set_single_order__1.json | 8 +- ...export_return__data_set_two_orders__1.json | 16 +-- ..._data_set_various_delivery_options__1.json | 24 +--- ...ture__data_set_carrier_dhl_for_you__1.json | 8 +- ...t_signature__data_set_single_order__1.json | 8 +- ...ort_signature__data_set_two_orders__1.json | 16 +-- ..._data_set_various_delivery_options__1.json | 24 +--- ...dk_order_with_data_set_empty_order__1.json | 4 +- ...with_data_set_order_with_shipments__1.json | 4 +- ...h_data_set_order_without_shipments__1.json | 4 +- ..._with_data_set_carrier_dhl_for_you__1.json | 4 +- ...e_array_with_data_set_single_order__1.json | 4 +- ...ble_array_with_data_set_two_orders__1.json | 8 +- ..._data_set_various_delivery_options__1.json | 12 +- ...e_order_containing_many_attributes__1.json | 4 +- ...ith_data_set_one_order_with_pickup__1.json | 4 +- ...order_collection_from_queried_data__1.json | 4 +- ...data_with_data_set_normal_shipment__1.json | 4 +- ...th_data_set_shipment_with_contract__1.json | 4 +- ...a_set_shipment_with_drop-off_point__1.json | 4 +- ...with_data_set_shipment_with_pickup__1.json | 4 +- ...t_order_containing_many_attributes__1.json | 4 +- ...ta_with_data_set_order_with_pickup__1.json | 4 +- ...pment_with_data_set_empty_shipment__1.json | 4 +- ...data_set_shipment_with_all_options__1.json | 4 +- ...ent_when_no_pdk_shipment_is_passed__1.json | 4 +- ...tsActionTest__it_updates_shipments__1.json | 23 +-- .../App/Order/Model/PdkOrderFactory.php | 4 +- .../Model/PdkPhysicalPropertiesFactory.php | 25 ++++ .../Shipment/Model/DeliveryOptionsFactory.php | 11 +- .../Model/PhysicalPropertiesFactory.php | 1 - .../Shipment/Model/ShipmentFactory.php | 23 ++- 79 files changed, 469 insertions(+), 574 deletions(-) create mode 100644 src/App/Order/Model/PdkPhysicalProperties.php create mode 100644 tests/Unit/Account/Model/AccountTest.php rename tests/Unit/{Shipment/Model/PhysicalPropertiesTest.php => App/Order/Model/PdkPhysicalPropertiesTest.php} (89%) create mode 100644 tests/__snapshots__/AccountTest__it_creates_storable_array__1.json create mode 100644 tests/factories/App/Order/Model/PdkPhysicalPropertiesFactory.php diff --git a/private/Types/Shared/Model/ClassDefinition.php b/private/Types/Shared/Model/ClassDefinition.php index 9c9d519a1..ea7a72372 100644 --- a/private/Types/Shared/Model/ClassDefinition.php +++ b/private/Types/Shared/Model/ClassDefinition.php @@ -4,7 +4,6 @@ namespace MyParcelNL\Pdk\Console\Types\Shared\Model; -use MyParcelNL\Pdk\Base\Contract\StorableArrayable; use MyParcelNL\Pdk\Base\Model\Model; use MyParcelNL\Pdk\Base\Support\Arr; use MyParcelNL\Pdk\Base\Support\Collection; @@ -25,7 +24,7 @@ * @property ReflectionClass $ref * @property TypeCollection $types */ -final class ClassDefinition extends Model implements StorableArrayable +final class ClassDefinition extends Model { public $attributes = [ 'comments' => KeyValueCollection::class, diff --git a/private/Types/Shared/Model/ClassMethod.php b/private/Types/Shared/Model/ClassMethod.php index 04e416264..a33cd5bc2 100644 --- a/private/Types/Shared/Model/ClassMethod.php +++ b/private/Types/Shared/Model/ClassMethod.php @@ -4,7 +4,6 @@ namespace MyParcelNL\Pdk\Console\Types\Shared\Model; -use MyParcelNL\Pdk\Base\Contract\StorableArrayable; use MyParcelNL\Pdk\Base\Model\Model; use ReflectionMethod; @@ -13,7 +12,7 @@ * @property \ReflectionMethod $ref * @property array $parameters */ -class ClassMethod extends Model implements StorableArrayable +class ClassMethod extends Model { public $attributes = [ 'name' => null, diff --git a/src/Account/Model/Account.php b/src/Account/Model/Account.php index 74eb78e58..d52174f7d 100644 --- a/src/Account/Model/Account.php +++ b/src/Account/Model/Account.php @@ -5,7 +5,6 @@ namespace MyParcelNL\Pdk\Account\Model; use MyParcelNL\Pdk\Account\Collection\ShopCollection; -use MyParcelNL\Pdk\Base\Contract\StorableArrayable; use MyParcelNL\Pdk\Base\Model\ContactDetails; use MyParcelNL\Pdk\Base\Model\Model; use MyParcelNL\Pdk\Base\Support\Collection; @@ -19,7 +18,7 @@ * @property int $status * @property array $subscriptionFeatures */ -class Account extends Model implements StorableArrayable +class Account extends Model { public const FEATURE_ORDER_NOTES = 'allow_order_notes'; @@ -42,12 +41,4 @@ class Account extends Model implements StorableArrayable 'status' => 'int', 'subscriptionFeatures' => Collection::class, ]; - - /** - * @throws \MyParcelNL\Pdk\Base\Exception\InvalidCastException - */ - public function toStorableArray(): array - { - return $this->toArrayWithoutNull(); - } } diff --git a/src/App/Order/Model/PdkOrder.php b/src/App/Order/Model/PdkOrder.php index 9a7c0d2e0..45f76000f 100644 --- a/src/App/Order/Model/PdkOrder.php +++ b/src/App/Order/Model/PdkOrder.php @@ -7,7 +7,6 @@ use MyParcelNL\Pdk\App\Order\Collection\PdkOrderLineCollection; use MyParcelNL\Pdk\App\Order\Collection\PdkOrderNoteCollection; use MyParcelNL\Pdk\App\Order\Contract\PdkOrderNoteRepositoryInterface; -use MyParcelNL\Pdk\Base\Contract\StorableArrayable; use MyParcelNL\Pdk\Base\Model\ContactDetails; use MyParcelNL\Pdk\Base\Model\Model; use MyParcelNL\Pdk\Base\Support\Arr; @@ -17,7 +16,6 @@ use MyParcelNL\Pdk\Shipment\Collection\ShipmentCollection; use MyParcelNL\Pdk\Shipment\Model\CustomsDeclaration; use MyParcelNL\Pdk\Shipment\Model\DeliveryOptions; -use MyParcelNL\Pdk\Shipment\Model\PhysicalProperties; use MyParcelNL\Pdk\Shipment\Model\Shipment; use MyParcelNL\Pdk\Validation\Validator\OrderValidator; @@ -33,7 +31,7 @@ * @property null|\MyParcelNL\Pdk\Base\Model\ContactDetails $billingAddress * @property \MyParcelNL\Pdk\App\Order\Model\ShippingAddress $shippingAddress * @property null|\MyParcelNL\Pdk\Shipment\Collection\ShipmentCollection $shipments - * @property \MyParcelNL\Pdk\Shipment\Model\PhysicalProperties $physicalProperties + * @property \MyParcelNL\Pdk\App\Order\Model\PdkPhysicalProperties $physicalProperties * @property null|\DateTimeImmutable $orderDate * @property bool $exported * @property int $shipmentPrice @@ -46,7 +44,7 @@ * @property int $totalPriceAfterVat * @property int $totalVat */ -class PdkOrder extends Model implements StorableArrayable +class PdkOrder extends Model { protected $attributes = [ /** Plugin order id */ @@ -69,7 +67,7 @@ class PdkOrder extends Model implements StorableArrayable */ 'shipments' => ShipmentCollection::class, 'customsDeclaration' => null, - 'physicalProperties' => PhysicalProperties::class, + 'physicalProperties' => PdkPhysicalProperties::class, 'lines' => PdkOrderLineCollection::class, 'notes' => null, @@ -108,7 +106,7 @@ class PdkOrder extends Model implements StorableArrayable 'shipments' => ShipmentCollection::class, 'customsDeclaration' => CustomsDeclaration::class, - 'physicalProperties' => PhysicalProperties::class, + 'physicalProperties' => PdkPhysicalProperties::class, 'lines' => PdkOrderLineCollection::class, 'notes' => PdkOrderNoteCollection::class, @@ -192,7 +190,12 @@ public function createShipment(): Shipment 'carrier' => $deliveryOptions->carrier, 'orderId' => $this->externalIdentifier, 'dropOffPoint' => null, - 'physicalProperties' => $this->physicalProperties, + 'physicalProperties' => [ + 'height' => $this->physicalProperties->height, + 'length' => $this->physicalProperties->length, + 'width' => $this->physicalProperties->width, + 'weight' => $this->physicalProperties->totalWeight, + ], ]); } diff --git a/src/App/Order/Model/PdkOrderNote.php b/src/App/Order/Model/PdkOrderNote.php index b1249746f..dc70b64bb 100644 --- a/src/App/Order/Model/PdkOrderNote.php +++ b/src/App/Order/Model/PdkOrderNote.php @@ -4,7 +4,6 @@ namespace MyParcelNL\Pdk\App\Order\Model; -use MyParcelNL\Pdk\Base\Contract\StorableArrayable; use MyParcelNL\Pdk\Base\Model\Model; use MyParcelNL\Pdk\Fulfilment\Model\OrderNote; @@ -17,7 +16,7 @@ * @property null|\DateTime $createdAt * @property null|\DateTime $updatedAt */ -class PdkOrderNote extends Model implements StorableArrayable +class PdkOrderNote extends Model { public $attributes = [ /** @@ -67,13 +66,4 @@ public static function fromFulfilmentOrderNote(OrderNote $orderNote): self 'updatedAt' => $orderNote->updatedAt, ]); } - - /** - * @return array - * @throws \MyParcelNL\Pdk\Base\Exception\InvalidCastException - */ - public function toStorableArray(): array - { - return $this->toArrayWithoutNull(); - } } diff --git a/src/App/Order/Model/PdkPhysicalProperties.php b/src/App/Order/Model/PdkPhysicalProperties.php new file mode 100644 index 000000000..2b487842d --- /dev/null +++ b/src/App/Order/Model/PdkPhysicalProperties.php @@ -0,0 +1,73 @@ + null, + 'length' => null, + 'width' => null, + + /** + * Base weight. + */ + 'initialWeight' => 0, + + /** + * Optional manual override of the initial weight. + */ + 'manualWeight' => TriStateService::INHERIT, + + /** + * Calculated automatically based on the initial weight and manual weight. + */ + 'totalWeight' => 0, + ]; + + protected $casts = [ + 'height' => 'int', + 'length' => 'int', + 'width' => 'int', + 'initialWeight' => 'int', + 'manualWeight' => 'int', + 'totalWeight' => 'int', + ]; + + /** + * @return array + */ + public function toStorableArray(): array + { + return Utils::filterNull([ + 'manualWeight' => TriStateService::INHERIT === $this->manualWeight ? null : $this->manualWeight, + ]); + } + + /** + * @return int + * @noinspection PhpUnused + */ + protected function getTotalWeightAttribute(): int + { + /** @var TriStateService $triStateService */ + $triStateService = Pdk::get(TriStateService::class); + + return $triStateService->resolve($this->manualWeight, $this->initialWeight); + } +} diff --git a/src/App/Order/Model/PdkProduct.php b/src/App/Order/Model/PdkProduct.php index d531dcdff..b3d5a2e87 100644 --- a/src/App/Order/Model/PdkProduct.php +++ b/src/App/Order/Model/PdkProduct.php @@ -4,7 +4,6 @@ namespace MyParcelNL\Pdk\App\Order\Model; -use MyParcelNL\Pdk\Base\Contract\StorableArrayable; use MyParcelNL\Pdk\Base\Model\Currency; use MyParcelNL\Pdk\Base\Model\Model; use MyParcelNL\Pdk\Facade\Pdk; @@ -27,7 +26,7 @@ * @property \MyParcelNL\Pdk\Settings\Model\ProductSettings $mergedSettings * @property null|\MyParcelNL\Pdk\App\Order\Model\PdkProduct $parent */ -class PdkProduct extends Model implements StorableArrayable +class PdkProduct extends Model { /** * @var array diff --git a/src/Base/Concern/HasAttributes.php b/src/Base/Concern/HasAttributes.php index f58b6354e..b88a121ca 100644 --- a/src/Base/Concern/HasAttributes.php +++ b/src/Base/Concern/HasAttributes.php @@ -9,6 +9,7 @@ use DateTimeInterface; use DateTimeZone; use MyParcelNL\Pdk\Base\Contract\Arrayable; +use MyParcelNL\Pdk\Base\Contract\StorableArrayable; use MyParcelNL\Pdk\Base\Exception\InvalidCastException; use MyParcelNL\Pdk\Base\Support\Arr; use MyParcelNL\Pdk\Base\Support\Collection; @@ -327,7 +328,9 @@ protected function addCastAttributesToArray(array $attributes, array $mutatedAtt $attributes[$key] = $this->serializeDate($attributes[$key]); } - if ($attributes[$key] instanceof Arrayable) { + if ($flags & Arrayable::STORABLE && $attributes[$key] instanceof StorableArrayable) { + $attributes[$key] = $attributes[$key]->toStorableArray(); + } elseif ($attributes[$key] instanceof Arrayable) { $attributes[$key] = $attributes[$key]->toArray($flags); } diff --git a/src/Base/Contract/Arrayable.php b/src/Base/Contract/Arrayable.php index a8bcc459f..bd1a2944b 100644 --- a/src/Base/Contract/Arrayable.php +++ b/src/Base/Contract/Arrayable.php @@ -10,6 +10,10 @@ interface Arrayable public const CASE_KEBAB = 2; public const CASE_STUDLY = 4; public const SKIP_NULL = 8; + public const STORABLE = 16; + // Combinations + public const STORABLE_NULL = self::STORABLE | self::SKIP_NULL; + public const ENCODED = self::SKIP_NULL | self::CASE_SNAKE; /** * Get the instance as an array. diff --git a/src/Base/Model/Model.php b/src/Base/Model/Model.php index cfba1644f..c192d737f 100644 --- a/src/Base/Model/Model.php +++ b/src/Base/Model/Model.php @@ -8,13 +8,14 @@ use MyParcelNL\Pdk\Base\Concern\HasAttributes; use MyParcelNL\Pdk\Base\Contract\Arrayable; use MyParcelNL\Pdk\Base\Contract\ModelInterface; +use MyParcelNL\Pdk\Base\Contract\StorableArrayable; use MyParcelNL\Pdk\Base\Support\Utils; use MyParcelNL\Sdk\src\Support\Str; /** * @SuppressWarnings(PHPMD.TooManyPublicMethods) */ -class Model implements Arrayable, ArrayAccess, ModelInterface +class Model implements StorableArrayable, ArrayAccess, ModelInterface { use HasAttributes; @@ -231,6 +232,15 @@ public function toSnakeCaseArray(): array return $this->toArray(Arrayable::CASE_SNAKE); } + /** + * @return array + * @throws \MyParcelNL\Pdk\Base\Exception\InvalidCastException + */ + public function toStorableArray(): array + { + return $this->toArray(Arrayable::STORABLE_NULL); + } + /** * @return array * @throws \MyParcelNL\Pdk\Base\Exception\InvalidCastException diff --git a/src/Carrier/Model/Carrier.php b/src/Carrier/Model/Carrier.php index 417e65ba7..4ee9169a3 100644 --- a/src/Carrier/Model/Carrier.php +++ b/src/Carrier/Model/Carrier.php @@ -163,4 +163,14 @@ public function getTypeAttribute(): string { return $this->subscriptionId ? self::TYPE_CUSTOM : self::TYPE_MAIN; } + + /** + * @return string[] + */ + public function toStorableArray(): array + { + return [ + 'externalIdentifier' => $this->externalIdentifier, + ]; + } } diff --git a/src/Context/Model/OrderDataContext.php b/src/Context/Model/OrderDataContext.php index 6354ae33d..3ef610dff 100644 --- a/src/Context/Model/OrderDataContext.php +++ b/src/Context/Model/OrderDataContext.php @@ -24,7 +24,7 @@ * @property null|\MyParcelNL\Pdk\Base\Model\ContactDetails $billingAddress * @property \MyParcelNL\Pdk\App\Order\Model\ShippingAddress $shippingAddress * @property null|\MyParcelNL\Pdk\Shipment\Collection\ShipmentCollection $shipments - * @property \MyParcelNL\Pdk\Shipment\Model\PhysicalProperties $physicalProperties + * @property \MyParcelNL\Pdk\App\Order\Model\PdkPhysicalProperties $physicalProperties * @property null|\DateTimeImmutable $orderDate * @property bool $exported * @property int $shipmentPrice diff --git a/src/Fulfilment/Model/Shipment.php b/src/Fulfilment/Model/Shipment.php index bbcd7bd5f..344d037b9 100644 --- a/src/Fulfilment/Model/Shipment.php +++ b/src/Fulfilment/Model/Shipment.php @@ -75,11 +75,10 @@ public static function fromPdkShipment(?PdkShipment $pdkShipment): self 'recipient' => $pdkShipment->recipient, 'dropOffPoint' => $pdkShipment->dropOffPoint, 'physicalProperties' => [ - 'height' => $pdkShipment->physicalProperties->height ?? 0, - 'width' => $pdkShipment->physicalProperties->width ?? 0, - 'length' => $pdkShipment->physicalProperties->length ?? 0, - 'initialWeight' => $pdkShipment->physicalProperties->initialWeight, - 'manualWeight' => $pdkShipment->physicalProperties->manualWeight, + 'height' => $pdkShipment->physicalProperties->height ?? 0, + 'width' => $pdkShipment->physicalProperties->width ?? 0, + 'length' => $pdkShipment->physicalProperties->length ?? 0, + 'weight' => $pdkShipment->physicalProperties->weight ?? 0, ], ]); } diff --git a/src/Fulfilment/Request/PostOrdersRequest.php b/src/Fulfilment/Request/PostOrdersRequest.php index f393eefa6..755467c7b 100644 --- a/src/Fulfilment/Request/PostOrdersRequest.php +++ b/src/Fulfilment/Request/PostOrdersRequest.php @@ -78,7 +78,7 @@ private function encodeOrder(Order $order): array : null, 'order_lines' => $order->lines->reduce( function (array $carry, OrderLine $orderLine) { - $carry[] = $orderLine->except('vat', Arrayable::CASE_SNAKE); + $carry[] = $orderLine->except('vat', Arrayable::ENCODED); return $carry; }, @@ -126,20 +126,15 @@ private function getShipment(Order $order): array return [ 'carrier' => $shipment->carrier, 'customs_declaration' => $shipment->customsDeclaration - ? $shipment->customsDeclaration->toSnakeCaseArray() + ? $shipment->customsDeclaration->toArray(Arrayable::ENCODED) : null, 'drop_off_point' => $shipment->dropOffPoint - ? $shipment->dropOffPoint->toSnakeCaseArray() + ? $shipment->dropOffPoint->toArray(Arrayable::ENCODED) : null, 'options' => $this->getShipmentOptions($shipment), - 'physical_properties' => Utils::filterNull([ - 'height' => $shipment->physicalProperties->height, - 'length' => $shipment->physicalProperties->length, - 'width' => $shipment->physicalProperties->width, - 'weight' => $shipment->physicalProperties->totalWeight, - ]), + 'physical_properties' => $shipment->physicalProperties->toArray(Arrayable::ENCODED), 'pickup' => $shipment->pickup - ? $shipment->pickup->toSnakeCaseArray() + ? $shipment->pickup->toArray(Arrayable::ENCODED) : null, 'recipient' => $this->getAddress($shipment->recipient), ]; @@ -153,7 +148,7 @@ private function getShipment(Order $order): array */ private function getShipmentOptions(Shipment $shipment): array { - $options = $shipment->options->toArray(Arrayable::CASE_SNAKE | Arrayable::SKIP_NULL); + $options = $shipment->options->toArray(Arrayable::ENCODED); $options['insurance'] = [ 'amount' => $shipment->options->insurance, diff --git a/src/Settings/Model/AbstractSettingsModel.php b/src/Settings/Model/AbstractSettingsModel.php index 8856f4927..fab63f7e2 100644 --- a/src/Settings/Model/AbstractSettingsModel.php +++ b/src/Settings/Model/AbstractSettingsModel.php @@ -4,7 +4,6 @@ namespace MyParcelNL\Pdk\Settings\Model; -use MyParcelNL\Pdk\Base\Contract\StorableArrayable; use MyParcelNL\Pdk\Base\Model\Model; use MyParcelNL\Pdk\Base\Support\Arr; use MyParcelNL\Pdk\Facade\Logger; @@ -15,7 +14,7 @@ * * @property string $id */ -abstract class AbstractSettingsModel extends Model implements StorableArrayable +abstract class AbstractSettingsModel extends Model { /** * @param null|array $data @@ -47,7 +46,7 @@ public function all(): array */ public function toStorableArray(): array { - return Arr::except($this->toArrayWithoutNull(), 'id'); + return Arr::except(parent::toStorableArray(), 'id'); } /** diff --git a/src/Shipment/Collection/ShipmentCollection.php b/src/Shipment/Collection/ShipmentCollection.php index 19a81f02f..adb1af56a 100644 --- a/src/Shipment/Collection/ShipmentCollection.php +++ b/src/Shipment/Collection/ShipmentCollection.php @@ -4,6 +4,7 @@ namespace MyParcelNL\Pdk\Shipment\Collection; +use MyParcelNL\Pdk\Base\Contract\Arrayable; use MyParcelNL\Pdk\Base\Support\Collection; use MyParcelNL\Pdk\Shipment\Model\Shipment; @@ -48,11 +49,10 @@ public function filterNotDeleted(): self */ public function toStorableArray(): array { - return $this - ->filterNotDeleted() + return (new Collection($this->filterNotDeleted())) ->map(function (Shipment $shipment) { return $shipment->toStorableArray(); }) - ->toArrayWithoutNull(); + ->toArray(Arrayable::STORABLE_NULL); } } diff --git a/src/Shipment/Model/DeliveryOptions.php b/src/Shipment/Model/DeliveryOptions.php index d014e5cec..cb6f470d7 100644 --- a/src/Shipment/Model/DeliveryOptions.php +++ b/src/Shipment/Model/DeliveryOptions.php @@ -7,7 +7,6 @@ use DateTime; use DateTimeInterface; -use MyParcelNL\Pdk\Base\Contract\StorableArrayable; use MyParcelNL\Pdk\Base\Model\Model; use MyParcelNL\Pdk\Base\Support\Utils; use MyParcelNL\Pdk\Carrier\Model\Carrier; @@ -22,7 +21,7 @@ * @property null|RetailLocation $pickupLocation * @property ShipmentOptions $shipmentOptions */ -class DeliveryOptions extends Model implements StorableArrayable +class DeliveryOptions extends Model { /** * Attributes @@ -209,16 +208,4 @@ public function toArray(?int $flags = null): array { return Utils::filterNull([self::DATE => $this->getDateAsString()]) + parent::toArray($flags); } - - /** - * @return array - * @throws \MyParcelNL\Pdk\Base\Exception\InvalidCastException - */ - public function toStorableArray(): array - { - $array = $this->toArrayWithoutNull(); - $array[self::CARRIER] = $this->carrier->externalIdentifier ?? null; - - return $array; - } } diff --git a/src/Shipment/Model/PhysicalProperties.php b/src/Shipment/Model/PhysicalProperties.php index 3641235ee..6db38f4e4 100644 --- a/src/Shipment/Model/PhysicalProperties.php +++ b/src/Shipment/Model/PhysicalProperties.php @@ -4,71 +4,27 @@ namespace MyParcelNL\Pdk\Shipment\Model; -use MyParcelNL\Pdk\Base\Contract\StorableArrayable; use MyParcelNL\Pdk\Base\Model\Model; -use MyParcelNL\Pdk\Base\Support\Utils; -use MyParcelNL\Pdk\Facade\Pdk; -use MyParcelNL\Pdk\Types\Service\TriStateService; /** * @property null|int $height * @property null|int $length * @property null|int $width - * @property int $initialWeight - * @property int $manualWeight - * @property int $totalWeight + * @property null|int $weight */ -class PhysicalProperties extends Model implements StorableArrayable +class PhysicalProperties extends Model { protected $attributes = [ - 'height' => null, - 'length' => null, - 'width' => null, - - /** - * Base weight. - */ - 'initialWeight' => 0, - - /** - * Optional manual override of the initial weight. - */ - 'manualWeight' => TriStateService::INHERIT, - - /** - * Calculated automatically based on the initial weight and manual weight. - */ - 'totalWeight' => 0, + 'height' => null, + 'length' => null, + 'width' => null, + 'weight' => null, ]; protected $casts = [ - 'height' => 'int', - 'length' => 'int', - 'width' => 'int', - 'initialWeight' => 'int', - 'manualWeight' => 'int', - 'totalWeight' => 'int', + 'height' => 'int', + 'length' => 'int', + 'width' => 'int', + 'weight' => 'int', ]; - - /** - * @return array - */ - public function toStorableArray(): array - { - return Utils::filterNull([ - 'manualWeight' => TriStateService::INHERIT === $this->manualWeight ? null : $this->manualWeight, - ]); - } - - /** - * @return int - * @noinspection PhpUnused - */ - protected function getTotalWeightAttribute(): int - { - /** @var TriStateService $triStateService */ - $triStateService = Pdk::get(TriStateService::class); - - return $triStateService->resolve($this->manualWeight, $this->initialWeight); - } } diff --git a/src/Shipment/Model/Shipment.php b/src/Shipment/Model/Shipment.php index 7a7be7918..7da88a874 100644 --- a/src/Shipment/Model/Shipment.php +++ b/src/Shipment/Model/Shipment.php @@ -8,11 +8,9 @@ use DateTime; use DateTimeZone; use MyParcelNL\Pdk\App\Order\Model\ShippingAddress; -use MyParcelNL\Pdk\Base\Contract\StorableArrayable; use MyParcelNL\Pdk\Base\Model\ContactDetails; use MyParcelNL\Pdk\Base\Model\Currency; use MyParcelNL\Pdk\Base\Model\Model; -use MyParcelNL\Pdk\Base\Support\Arr; use MyParcelNL\Pdk\Carrier\Model\Carrier; use MyParcelNL\Pdk\Facade\Pdk; @@ -49,7 +47,7 @@ * @property null|\DateTime $modified * @property null|int $modifiedBy */ -class Shipment extends Model implements StorableArrayable +class Shipment extends Model { public const SHIPMENT_TYPE_STANDARD = 1; public const SHIPMENT_TYPE_RETURN = 2; @@ -220,12 +218,7 @@ public function toStorableArray(): array $this->updated = new DateTime('now', $timeZone); } - $attributes = $this->toArrayWithoutNull(); - - // TODO: replace this with except() when nested properties are supported - Arr::forget($attributes, ['carrier.capabilities', 'carrier.returnCapabilities']); - - return $attributes; + return parent::toStorableArray(); } /** diff --git a/src/Shipment/Request/PostShipmentsRequest.php b/src/Shipment/Request/PostShipmentsRequest.php index 27f992468..a5a417209 100644 --- a/src/Shipment/Request/PostShipmentsRequest.php +++ b/src/Shipment/Request/PostShipmentsRequest.php @@ -287,7 +287,7 @@ private function getRecipient(Shipment $shipment): array */ private function getWeight(Shipment $shipment): int { - return $shipment->customsDeclaration->weight ?? $shipment->physicalProperties->totalWeight ?? 0; + return $shipment->customsDeclaration->weight ?? $shipment->physicalProperties->weight ?? 0; } /** diff --git a/tests/Mocks/MockStorableModel.php b/tests/Mocks/MockStorableModel.php index d284f5c76..8e45f4a40 100644 --- a/tests/Mocks/MockStorableModel.php +++ b/tests/Mocks/MockStorableModel.php @@ -4,13 +4,12 @@ namespace MyParcelNL\Pdk\Tests\Mocks; -use MyParcelNL\Pdk\Base\Contract\StorableArrayable; use MyParcelNL\Pdk\Base\Model\Model; /** * @property array|null $property */ -class MockStorableModel extends Model implements StorableArrayable +class MockStorableModel extends Model { protected $attributes = [ 'property' => null, diff --git a/tests/Unit/Account/Model/AccountTest.php b/tests/Unit/Account/Model/AccountTest.php new file mode 100644 index 000000000..2ef2f408e --- /dev/null +++ b/tests/Unit/Account/Model/AccountTest.php @@ -0,0 +1,24 @@ +not->toBeNull(); + /** @noinspection NullPointerExceptionInspection */ + assertMatchesJsonSnapshot(json_encode($account->toStorableArray())); +}); diff --git a/tests/Unit/App/Action/Backend/Order/ExportReturnActionTest.php b/tests/Unit/App/Action/Backend/Order/ExportReturnActionTest.php index 0eef7436f..03f7c0fd0 100644 --- a/tests/Unit/App/Action/Backend/Order/ExportReturnActionTest.php +++ b/tests/Unit/App/Action/Backend/Order/ExportReturnActionTest.php @@ -9,6 +9,7 @@ use MyParcelNL\Pdk\App\Order\Collection\PdkOrderCollection; use MyParcelNL\Pdk\App\Order\Collection\PdkOrderCollectionFactory; use MyParcelNL\Pdk\App\Order\Model\PdkOrder; +use MyParcelNL\Pdk\Base\Support\Arr; use MyParcelNL\Pdk\Carrier\Model\Carrier; use MyParcelNL\Pdk\Facade\Actions; use MyParcelNL\Pdk\Shipment\Model\DeliveryOptions; @@ -37,7 +38,20 @@ 'orderIds' => ['701', '247'], ]); - assertMatchesJsonSnapshot($response->getContent()); + $content = json_decode($response->getContent(), true); + + // Remove updated key from each shipment. + $content['data']['orders'] = array_map(function (array $order) { + return array_replace($order, [ + 'shipments' => array_map(function (array $shipment) { + Arr::forget($shipment, ['updated']); + + return $shipment; + }, $order['shipments'] ?? []), + ]); + }, $content['data']['orders']); + + assertMatchesJsonSnapshot(json_encode($content)); expect($response) ->toBeInstanceOf(Response::class) ->and($response->getStatusCode()) diff --git a/tests/Unit/App/Order/Calculator/General/WeightCalculatorTest.php b/tests/Unit/App/Order/Calculator/General/WeightCalculatorTest.php index fced9193c..6dc375920 100644 --- a/tests/Unit/App/Order/Calculator/General/WeightCalculatorTest.php +++ b/tests/Unit/App/Order/Calculator/General/WeightCalculatorTest.php @@ -10,12 +10,12 @@ use MyParcelNL\Pdk\App\Order\Contract\PdkOrderOptionsServiceInterface; use MyParcelNL\Pdk\App\Order\Model\PdkOrder; use MyParcelNL\Pdk\App\Order\Model\PdkOrderLine; +use MyParcelNL\Pdk\App\Order\Model\PdkPhysicalProperties; use MyParcelNL\Pdk\App\Order\Model\PdkProduct; use MyParcelNL\Pdk\Facade\Pdk; use MyParcelNL\Pdk\Settings\Model\OrderSettings; use MyParcelNL\Pdk\Shipment\Model\CustomsDeclaration; use MyParcelNL\Pdk\Shipment\Model\DeliveryOptions; -use MyParcelNL\Pdk\Shipment\Model\PhysicalProperties; use MyParcelNL\Pdk\Tests\Uses\UsesMockPdkInstance; use function MyParcelNL\Pdk\Tests\factory; use function MyParcelNL\Pdk\Tests\mockPdkProperty; @@ -38,7 +38,7 @@ $order = factory(PdkOrder::class) ->withDeliveryOptions(factory(DeliveryOptions::class)->withPackageType($packageType)) - ->withPhysicalProperties(factory(PhysicalProperties::class)->withManualWeight($manualWeight)) + ->withPhysicalProperties(factory(PdkPhysicalProperties::class)->withManualWeight($manualWeight)) ->withLines( factory(PdkOrderLineCollection::class)->push( factory(PdkOrderLine::class) diff --git a/tests/Unit/Shipment/Model/PhysicalPropertiesTest.php b/tests/Unit/App/Order/Model/PdkPhysicalPropertiesTest.php similarity index 89% rename from tests/Unit/Shipment/Model/PhysicalPropertiesTest.php rename to tests/Unit/App/Order/Model/PdkPhysicalPropertiesTest.php index 6cfa3d82a..412d16102 100644 --- a/tests/Unit/Shipment/Model/PhysicalPropertiesTest.php +++ b/tests/Unit/App/Order/Model/PdkPhysicalPropertiesTest.php @@ -3,7 +3,7 @@ declare(strict_types=1); -namespace MyParcelNL\Pdk\Shipment\Model; +namespace MyParcelNL\Pdk\App\Order\Model; use MyParcelNL\Pdk\Tests\Uses\UsesMockPdkInstance; use MyParcelNL\Pdk\Types\Service\TriStateService; @@ -13,7 +13,7 @@ usesShared(new UsesMockPdkInstance()); it('calculates total weight', function (array $input, int $result) { - $physicalProperties = factory(PhysicalProperties::class) + $physicalProperties = factory(PdkPhysicalProperties::class) ->fromScratch() ->with($input) ->make(); @@ -45,7 +45,7 @@ ]); it('creates a storable array', function (int $manualWeight, array $result) { - $physicalProperties = factory(PhysicalProperties::class) + $physicalProperties = factory(PdkPhysicalProperties::class) ->withInitialWeight(2000) ->withWidth(20) ->withHeight(30) diff --git a/tests/Unit/Fulfilment/Repository/PostOrdersTest.php b/tests/Unit/Fulfilment/Repository/PostOrdersTest.php index ef1759b4c..8120789e0 100644 --- a/tests/Unit/Fulfilment/Repository/PostOrdersTest.php +++ b/tests/Unit/Fulfilment/Repository/PostOrdersTest.php @@ -5,15 +5,18 @@ namespace MyParcelNL\Pdk\Fulfilment\Repository; -use MyParcelNL\Pdk\Carrier\Model\Carrier; +use MyParcelNL\Pdk\App\Order\Collection\PdkOrderCollection; +use MyParcelNL\Pdk\App\Order\Collection\PdkOrderCollectionFactory; +use MyParcelNL\Pdk\App\Order\Model\PdkOrder; use MyParcelNL\Pdk\Facade\Pdk; use MyParcelNL\Pdk\Fulfilment\Collection\OrderCollection; use MyParcelNL\Pdk\Fulfilment\Model\Order; -use MyParcelNL\Pdk\Shipment\Model\DeliveryOptions; +use MyParcelNL\Pdk\Shipment\Model\Shipment; use MyParcelNL\Pdk\Tests\Api\Response\ExampleGetOrdersResponse; use MyParcelNL\Pdk\Tests\Api\Response\ExamplePostOrdersResponse; use MyParcelNL\Pdk\Tests\Bootstrap\MockApi; use MyParcelNL\Pdk\Tests\Uses\UsesMockPdkInstance; +use function MyParcelNL\Pdk\Tests\factory; use function MyParcelNL\Pdk\Tests\usesShared; use function Spatie\Snapshots\assertMatchesJsonSnapshot; @@ -32,13 +35,19 @@ assertMatchesJsonSnapshot(json_encode($savedOrders->toArray())); })->with('fulfilmentOrders'); -it('creates order', function ($input, $path, $query) { +it('creates order', function (PdkOrderCollectionFactory $factory) { MockApi::enqueue(new ExampleGetOrdersResponse()); /** @var \MyParcelNL\Pdk\Fulfilment\Repository\OrderRepository $repository */ - $repository = Pdk::get(OrderRepository::class); - $order = new Order($input); - $orderCollection = (new OrderCollection())->push($order); + $repository = Pdk::get(OrderRepository::class); + + $pdkOrderCollection = $factory + ->store() + ->make(); + + $orderCollection = new OrderCollection($pdkOrderCollection->map(function (PdkOrder $pdkOrder) { + return Order::fromPdkOrder($pdkOrder); + })); /** @var OrderRepository $response */ $response = $repository->postOrders($orderCollection); @@ -46,94 +55,34 @@ $uri = $request->getUri(); - expect($uri->getQuery()) - ->toBe($query) - ->and($uri->getPath()) - ->toBe($path) + expect($uri->getPath()) + ->toBe('API/fulfilment/orders') ->and($response) ->toBeInstanceOf(OrderCollection::class); })->with([ - 'empty query with single shipment response' => [ - 'input' => [ - 'invoiceAddress' => [ - 'cc' => 'NL', - 'city' => 'Boskoop', - ], - 'language' => null, - 'orderDate' => '2022-08-22 00:00:00', - 'lines' => [ - [ - 'uuid' => '1234', - 'quantity' => 1, - 'price' => 250, - 'vat' => 10, - 'priceAfterVat' => 260, - 'product' => [ - 'uuid' => '12345', - 'sku' => '018234', - 'ean' => '018234', - 'externalIdentifier' => '018234', - 'name' => 'Paarse stofzuiger', - 'description' => 'Een paars object waarmee stof opgezogen kan worden', - 'width' => null, - 'length' => null, - 'height' => null, - 'weight' => 3500, - ], - ], - - ], - 'price' => 260, - 'shipment' => [ - 'carrier' => [ - 'id' => Carrier::CARRIER_POSTNL_ID, - ], - 'customsDeclaration' => null, - 'deliveryOptions' => [ - 'date' => '2022-08-22 00:00:00', - 'deliveryType' => DeliveryOptions::DELIVERY_TYPE_STANDARD_NAME, - 'packageType' => DeliveryOptions::PACKAGE_TYPE_PACKAGE_NAME, - 'shipmentOptions' => [ - 'ageCheck' => 1, - 'insurance' => [ - 'amount' => 0, - 'currency' => 'EUR', - ], - 'labelDescription' => null, - 'largeFormat' => 0, - 'onlyRecipient' => 0, - 'return' => 0, - 'sameDayDelivery' => 0, - 'signature' => 1, - ], - ], - 'dropOffPoint' => null, - 'physicalProperties' => [ - 'weight' => 3500, - ], - 'recipient' => [ - 'cc' => 'NL', - 'city' => 'Hoofddorp', - 'person' => 'Jaap Krekel', - 'postalCode' => '2132JE', - 'address1' => 'Antareslaan 31', - ], - 'sender' => [ - 'cc' => 'NL', - 'city' => 'Amsterdam', - 'person' => 'Willem Wever', - 'postalCode' => '4164ZF', - 'address1' => 'Werf 2', - ], - ], - 'shopId' => null, - 'status' => null, - 'type' => null, - 'updatedAt' => null, - 'uuid' => null, - 'vat' => null, - ], - 'path' => 'API/fulfilment/orders', - 'query' => '', + 'simple order' => [ + function () { + return factory(PdkOrderCollection::class); + }, + ], + + 'order with drop-off point' => [ + function () { + return factory(PdkOrderCollection::class)->push( + factory(PdkOrder::class)->withShipments([ + factory(Shipment::class)->withDropOffPoint(), + ]) + ); + }, + ], + + 'order with shipment to pickup location' => [ + function () { + return factory(PdkOrderCollection::class)->push( + factory(PdkOrder::class)->withShipments([ + factory(Shipment::class)->withDeliveryOptionsWithPickupLocation(), + ]) + ); + }, ], ]); diff --git a/tests/__snapshots__/AccountTest__it_creates_storable_array__1.json b/tests/__snapshots__/AccountTest__it_creates_storable_array__1.json new file mode 100644 index 000000000..16bcc4f5f --- /dev/null +++ b/tests/__snapshots__/AccountTest__it_creates_storable_array__1.json @@ -0,0 +1,52 @@ +{ + "id": 1, + "platformId": 3, + "contactInfo": { + "address1": "Antareslaan 31", + "cc": "NL", + "city": "Hoofddorp", + "postalCode": "2132 JE", + "email": "support@myparcel.nl", + "person": "Felicia Parcel", + "company": "MyParcel" + }, + "generalSettings": { + "isTest": false, + "orderMode": false, + "hasCarrierContract": false + }, + "shops": [ + { + "accountId": 1, + "platformId": 3, + "hidden": false, + "billing": [], + "deliveryAddress": { + "address1": "Antareslaan 31", + "address2": null, + "area": null, + "cc": "NL", + "city": "Hoofddorp", + "postalCode": "2132 JE", + "region": null, + "state": null, + "email": "support@myparcel.nl", + "phone": null, + "person": "Felicia Parcel", + "company": "MyParcel" + }, + "generalSettings": [], + "return": [], + "shipmentOptions": [], + "trackTrace": [], + "carriers": [ + { + "externalIdentifier": "postnl" + } + ], + "carrierConfigurations": [] + } + ], + "status": 2, + "subscriptionFeatures": [] +} diff --git a/tests/__snapshots__/CreateConceptsTest__it_creates_a_valid_request_from_a_shipment_collection_with_data_set_multiple_shipments__1.json b/tests/__snapshots__/CreateConceptsTest__it_creates_a_valid_request_from_a_shipment_collection_with_data_set_multiple_shipments__1.json index c0c493b2c..6340d4914 100644 --- a/tests/__snapshots__/CreateConceptsTest__it_creates_a_valid_request_from_a_shipment_collection_with_data_set_multiple_shipments__1.json +++ b/tests/__snapshots__/CreateConceptsTest__it_creates_a_valid_request_from_a_shipment_collection_with_data_set_multiple_shipments__1.json @@ -13,7 +13,7 @@ "only_recipient": 1 }, "physical_properties": { - "weight": 0 + "weight": 2000 }, "recipient": { "cc": "NL", @@ -40,7 +40,7 @@ "only_recipient": 1 }, "physical_properties": { - "weight": 0 + "weight": 2000 }, "recipient": { "cc": "NL", diff --git a/tests/__snapshots__/CreateConceptsTest__it_creates_a_valid_request_from_a_shipment_collection_with_data_set_simple_domestic_shipment__1.json b/tests/__snapshots__/CreateConceptsTest__it_creates_a_valid_request_from_a_shipment_collection_with_data_set_simple_domestic_shipment__1.json index 91392d7c1..8af03d662 100644 --- a/tests/__snapshots__/CreateConceptsTest__it_creates_a_valid_request_from_a_shipment_collection_with_data_set_simple_domestic_shipment__1.json +++ b/tests/__snapshots__/CreateConceptsTest__it_creates_a_valid_request_from_a_shipment_collection_with_data_set_simple_domestic_shipment__1.json @@ -17,7 +17,7 @@ "only_recipient": 1 }, "physical_properties": { - "weight": 0 + "weight": 2000 }, "recipient": { "cc": "NL", 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 8980dfdcb..e5e91c1cb 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 @@ -120,9 +120,7 @@ "height": 20, "length": 40, "width": 30, - "initialWeight": 0, - "manualWeight": -1, - "totalWeight": 0 + "weight": 3500 }, "price": { "amount": 5390, diff --git a/tests/__snapshots__/ExportOrderActionTest__it_exports_order_with_data_set_order_mode__data_set_export_age_check__data_set_carrier_dhl_for_you__1.json b/tests/__snapshots__/ExportOrderActionTest__it_exports_order_with_data_set_order_mode__data_set_export_age_check__data_set_carrier_dhl_for_you__1.json index cda6052da..2df476b90 100644 --- a/tests/__snapshots__/ExportOrderActionTest__it_exports_order_with_data_set_order_mode__data_set_export_age_check__data_set_carrier_dhl_for_you__1.json +++ b/tests/__snapshots__/ExportOrderActionTest__it_exports_order_with_data_set_order_mode__data_set_export_age_check__data_set_carrier_dhl_for_you__1.json @@ -15,17 +15,13 @@ "order_date": "2030-01-01 12:00:00", "order_lines": [ { - "uuid": null, "quantity": 1, "price": 0, "price_after_vat": 0, "product": { - "uuid": null, "sku": "test", - "ean": null, "external_identifier": "PDK-1", "name": "test", - "description": null, "width": 0, "length": 0, "height": 0, @@ -56,8 +52,8 @@ "physical_properties": { "height": 0, "length": 0, - "weight": 0, - "width": 0 + "width": 0, + "weight": 0 }, "pickup": null, "recipient": { diff --git a/tests/__snapshots__/ExportOrderActionTest__it_exports_order_with_data_set_order_mode__data_set_export_age_check__data_set_single_order__1.json b/tests/__snapshots__/ExportOrderActionTest__it_exports_order_with_data_set_order_mode__data_set_export_age_check__data_set_single_order__1.json index 231b5dfa9..250ec335d 100644 --- a/tests/__snapshots__/ExportOrderActionTest__it_exports_order_with_data_set_order_mode__data_set_export_age_check__data_set_single_order__1.json +++ b/tests/__snapshots__/ExportOrderActionTest__it_exports_order_with_data_set_order_mode__data_set_export_age_check__data_set_single_order__1.json @@ -15,17 +15,13 @@ "order_date": "2030-01-01 12:00:00", "order_lines": [ { - "uuid": null, "quantity": 1, "price": 0, "price_after_vat": 0, "product": { - "uuid": null, "sku": "test", - "ean": null, "external_identifier": "PDK-1", "name": "test", - "description": null, "width": 0, "length": 0, "height": 0, @@ -56,8 +52,8 @@ "physical_properties": { "height": 0, "length": 0, - "weight": 0, - "width": 0 + "width": 0, + "weight": 0 }, "pickup": null, "recipient": { diff --git a/tests/__snapshots__/ExportOrderActionTest__it_exports_order_with_data_set_order_mode__data_set_export_age_check__data_set_two_orders__1.json b/tests/__snapshots__/ExportOrderActionTest__it_exports_order_with_data_set_order_mode__data_set_export_age_check__data_set_two_orders__1.json index e1c980562..46a193c3c 100644 --- a/tests/__snapshots__/ExportOrderActionTest__it_exports_order_with_data_set_order_mode__data_set_export_age_check__data_set_two_orders__1.json +++ b/tests/__snapshots__/ExportOrderActionTest__it_exports_order_with_data_set_order_mode__data_set_export_age_check__data_set_two_orders__1.json @@ -15,17 +15,13 @@ "order_date": "2030-01-01 12:00:00", "order_lines": [ { - "uuid": null, "quantity": 1, "price": 0, "price_after_vat": 0, "product": { - "uuid": null, "sku": "test", - "ean": null, "external_identifier": "PDK-1", "name": "test", - "description": null, "width": 0, "length": 0, "height": 0, @@ -56,8 +52,8 @@ "physical_properties": { "height": 0, "length": 0, - "weight": 0, - "width": 0 + "width": 0, + "weight": 0 }, "pickup": null, "recipient": { @@ -84,17 +80,13 @@ "order_date": "2030-01-01 12:00:00", "order_lines": [ { - "uuid": null, "quantity": 1, "price": 0, "price_after_vat": 0, "product": { - "uuid": null, "sku": "test", - "ean": null, "external_identifier": "PDK-2", "name": "test", - "description": null, "width": 0, "length": 0, "height": 0, @@ -125,8 +117,8 @@ "physical_properties": { "height": 0, "length": 0, - "weight": 0, - "width": 0 + "width": 0, + "weight": 0 }, "pickup": null, "recipient": { diff --git a/tests/__snapshots__/ExportOrderActionTest__it_exports_order_with_data_set_order_mode__data_set_export_age_check__data_set_various_delivery_options__1.json b/tests/__snapshots__/ExportOrderActionTest__it_exports_order_with_data_set_order_mode__data_set_export_age_check__data_set_various_delivery_options__1.json index 853377579..f59c1b021 100644 --- a/tests/__snapshots__/ExportOrderActionTest__it_exports_order_with_data_set_order_mode__data_set_export_age_check__data_set_various_delivery_options__1.json +++ b/tests/__snapshots__/ExportOrderActionTest__it_exports_order_with_data_set_order_mode__data_set_export_age_check__data_set_various_delivery_options__1.json @@ -15,17 +15,13 @@ "order_date": "2030-01-01 12:00:00", "order_lines": [ { - "uuid": null, "quantity": 5, "price": 0, "price_after_vat": 0, "product": { - "uuid": null, "sku": "test", - "ean": null, "external_identifier": "PDK-2", "name": "test", - "description": null, "width": 0, "length": 0, "height": 0, @@ -56,8 +52,8 @@ "physical_properties": { "height": 0, "length": 0, - "weight": 0, - "width": 0 + "width": 0, + "weight": 0 }, "pickup": null, "recipient": { @@ -84,17 +80,13 @@ "order_date": "2030-01-01 12:00:00", "order_lines": [ { - "uuid": null, "quantity": 1, "price": 0, "price_after_vat": 0, "product": { - "uuid": null, "sku": "test", - "ean": null, "external_identifier": "PDK-3", "name": "test", - "description": null, "width": 0, "length": 0, "height": 0, @@ -126,8 +118,8 @@ "physical_properties": { "height": 0, "length": 0, - "weight": 0, - "width": 0 + "width": 0, + "weight": 0 }, "pickup": null, "recipient": { @@ -154,17 +146,13 @@ "order_date": "2030-01-01 12:00:00", "order_lines": [ { - "uuid": null, "quantity": 1, "price": 0, "price_after_vat": 0, "product": { - "uuid": null, "sku": "test", - "ean": null, "external_identifier": "PDK-4", "name": "test", - "description": null, "width": 0, "length": 0, "height": 0, @@ -195,8 +183,8 @@ "physical_properties": { "height": 0, "length": 0, - "weight": 0, - "width": 0 + "width": 0, + "weight": 0 }, "pickup": null, "recipient": { diff --git a/tests/__snapshots__/ExportOrderActionTest__it_exports_order_with_data_set_order_mode__data_set_export_insurance__data_set_carrier_dhl_for_you__1.json b/tests/__snapshots__/ExportOrderActionTest__it_exports_order_with_data_set_order_mode__data_set_export_insurance__data_set_carrier_dhl_for_you__1.json index 3afd1e24a..76e09572c 100644 --- a/tests/__snapshots__/ExportOrderActionTest__it_exports_order_with_data_set_order_mode__data_set_export_insurance__data_set_carrier_dhl_for_you__1.json +++ b/tests/__snapshots__/ExportOrderActionTest__it_exports_order_with_data_set_order_mode__data_set_export_insurance__data_set_carrier_dhl_for_you__1.json @@ -15,17 +15,13 @@ "order_date": "2030-01-01 12:00:00", "order_lines": [ { - "uuid": null, "quantity": 1, "price": 0, "price_after_vat": 0, "product": { - "uuid": null, "sku": "test", - "ean": null, "external_identifier": "PDK-1", "name": "test", - "description": null, "width": 0, "length": 0, "height": 0, @@ -56,8 +52,8 @@ "physical_properties": { "height": 0, "length": 0, - "weight": 0, - "width": 0 + "width": 0, + "weight": 0 }, "pickup": null, "recipient": { diff --git a/tests/__snapshots__/ExportOrderActionTest__it_exports_order_with_data_set_order_mode__data_set_export_insurance__data_set_single_order__1.json b/tests/__snapshots__/ExportOrderActionTest__it_exports_order_with_data_set_order_mode__data_set_export_insurance__data_set_single_order__1.json index ce0d9bdb6..d65c0a49f 100644 --- a/tests/__snapshots__/ExportOrderActionTest__it_exports_order_with_data_set_order_mode__data_set_export_insurance__data_set_single_order__1.json +++ b/tests/__snapshots__/ExportOrderActionTest__it_exports_order_with_data_set_order_mode__data_set_export_insurance__data_set_single_order__1.json @@ -15,17 +15,13 @@ "order_date": "2030-01-01 12:00:00", "order_lines": [ { - "uuid": null, "quantity": 1, "price": 0, "price_after_vat": 0, "product": { - "uuid": null, "sku": "test", - "ean": null, "external_identifier": "PDK-1", "name": "test", - "description": null, "width": 0, "length": 0, "height": 0, @@ -56,8 +52,8 @@ "physical_properties": { "height": 0, "length": 0, - "weight": 0, - "width": 0 + "width": 0, + "weight": 0 }, "pickup": null, "recipient": { diff --git a/tests/__snapshots__/ExportOrderActionTest__it_exports_order_with_data_set_order_mode__data_set_export_insurance__data_set_two_orders__1.json b/tests/__snapshots__/ExportOrderActionTest__it_exports_order_with_data_set_order_mode__data_set_export_insurance__data_set_two_orders__1.json index e1c980562..46a193c3c 100644 --- a/tests/__snapshots__/ExportOrderActionTest__it_exports_order_with_data_set_order_mode__data_set_export_insurance__data_set_two_orders__1.json +++ b/tests/__snapshots__/ExportOrderActionTest__it_exports_order_with_data_set_order_mode__data_set_export_insurance__data_set_two_orders__1.json @@ -15,17 +15,13 @@ "order_date": "2030-01-01 12:00:00", "order_lines": [ { - "uuid": null, "quantity": 1, "price": 0, "price_after_vat": 0, "product": { - "uuid": null, "sku": "test", - "ean": null, "external_identifier": "PDK-1", "name": "test", - "description": null, "width": 0, "length": 0, "height": 0, @@ -56,8 +52,8 @@ "physical_properties": { "height": 0, "length": 0, - "weight": 0, - "width": 0 + "width": 0, + "weight": 0 }, "pickup": null, "recipient": { @@ -84,17 +80,13 @@ "order_date": "2030-01-01 12:00:00", "order_lines": [ { - "uuid": null, "quantity": 1, "price": 0, "price_after_vat": 0, "product": { - "uuid": null, "sku": "test", - "ean": null, "external_identifier": "PDK-2", "name": "test", - "description": null, "width": 0, "length": 0, "height": 0, @@ -125,8 +117,8 @@ "physical_properties": { "height": 0, "length": 0, - "weight": 0, - "width": 0 + "width": 0, + "weight": 0 }, "pickup": null, "recipient": { diff --git a/tests/__snapshots__/ExportOrderActionTest__it_exports_order_with_data_set_order_mode__data_set_export_insurance__data_set_various_delivery_options__1.json b/tests/__snapshots__/ExportOrderActionTest__it_exports_order_with_data_set_order_mode__data_set_export_insurance__data_set_various_delivery_options__1.json index 853377579..f59c1b021 100644 --- a/tests/__snapshots__/ExportOrderActionTest__it_exports_order_with_data_set_order_mode__data_set_export_insurance__data_set_various_delivery_options__1.json +++ b/tests/__snapshots__/ExportOrderActionTest__it_exports_order_with_data_set_order_mode__data_set_export_insurance__data_set_various_delivery_options__1.json @@ -15,17 +15,13 @@ "order_date": "2030-01-01 12:00:00", "order_lines": [ { - "uuid": null, "quantity": 5, "price": 0, "price_after_vat": 0, "product": { - "uuid": null, "sku": "test", - "ean": null, "external_identifier": "PDK-2", "name": "test", - "description": null, "width": 0, "length": 0, "height": 0, @@ -56,8 +52,8 @@ "physical_properties": { "height": 0, "length": 0, - "weight": 0, - "width": 0 + "width": 0, + "weight": 0 }, "pickup": null, "recipient": { @@ -84,17 +80,13 @@ "order_date": "2030-01-01 12:00:00", "order_lines": [ { - "uuid": null, "quantity": 1, "price": 0, "price_after_vat": 0, "product": { - "uuid": null, "sku": "test", - "ean": null, "external_identifier": "PDK-3", "name": "test", - "description": null, "width": 0, "length": 0, "height": 0, @@ -126,8 +118,8 @@ "physical_properties": { "height": 0, "length": 0, - "weight": 0, - "width": 0 + "width": 0, + "weight": 0 }, "pickup": null, "recipient": { @@ -154,17 +146,13 @@ "order_date": "2030-01-01 12:00:00", "order_lines": [ { - "uuid": null, "quantity": 1, "price": 0, "price_after_vat": 0, "product": { - "uuid": null, "sku": "test", - "ean": null, "external_identifier": "PDK-4", "name": "test", - "description": null, "width": 0, "length": 0, "height": 0, @@ -195,8 +183,8 @@ "physical_properties": { "height": 0, "length": 0, - "weight": 0, - "width": 0 + "width": 0, + "weight": 0 }, "pickup": null, "recipient": { diff --git a/tests/__snapshots__/ExportOrderActionTest__it_exports_order_with_data_set_order_mode__data_set_export_large_format__data_set_carrier_dhl_for_you__1.json b/tests/__snapshots__/ExportOrderActionTest__it_exports_order_with_data_set_order_mode__data_set_export_large_format__data_set_carrier_dhl_for_you__1.json index 3afd1e24a..76e09572c 100644 --- a/tests/__snapshots__/ExportOrderActionTest__it_exports_order_with_data_set_order_mode__data_set_export_large_format__data_set_carrier_dhl_for_you__1.json +++ b/tests/__snapshots__/ExportOrderActionTest__it_exports_order_with_data_set_order_mode__data_set_export_large_format__data_set_carrier_dhl_for_you__1.json @@ -15,17 +15,13 @@ "order_date": "2030-01-01 12:00:00", "order_lines": [ { - "uuid": null, "quantity": 1, "price": 0, "price_after_vat": 0, "product": { - "uuid": null, "sku": "test", - "ean": null, "external_identifier": "PDK-1", "name": "test", - "description": null, "width": 0, "length": 0, "height": 0, @@ -56,8 +52,8 @@ "physical_properties": { "height": 0, "length": 0, - "weight": 0, - "width": 0 + "width": 0, + "weight": 0 }, "pickup": null, "recipient": { diff --git a/tests/__snapshots__/ExportOrderActionTest__it_exports_order_with_data_set_order_mode__data_set_export_large_format__data_set_single_order__1.json b/tests/__snapshots__/ExportOrderActionTest__it_exports_order_with_data_set_order_mode__data_set_export_large_format__data_set_single_order__1.json index 981e7a5b1..fc8d2b07b 100644 --- a/tests/__snapshots__/ExportOrderActionTest__it_exports_order_with_data_set_order_mode__data_set_export_large_format__data_set_single_order__1.json +++ b/tests/__snapshots__/ExportOrderActionTest__it_exports_order_with_data_set_order_mode__data_set_export_large_format__data_set_single_order__1.json @@ -15,17 +15,13 @@ "order_date": "2030-01-01 12:00:00", "order_lines": [ { - "uuid": null, "quantity": 1, "price": 0, "price_after_vat": 0, "product": { - "uuid": null, "sku": "test", - "ean": null, "external_identifier": "PDK-1", "name": "test", - "description": null, "width": 0, "length": 0, "height": 0, @@ -56,8 +52,8 @@ "physical_properties": { "height": 0, "length": 0, - "weight": 0, - "width": 0 + "width": 0, + "weight": 0 }, "pickup": null, "recipient": { diff --git a/tests/__snapshots__/ExportOrderActionTest__it_exports_order_with_data_set_order_mode__data_set_export_large_format__data_set_two_orders__1.json b/tests/__snapshots__/ExportOrderActionTest__it_exports_order_with_data_set_order_mode__data_set_export_large_format__data_set_two_orders__1.json index e1c980562..46a193c3c 100644 --- a/tests/__snapshots__/ExportOrderActionTest__it_exports_order_with_data_set_order_mode__data_set_export_large_format__data_set_two_orders__1.json +++ b/tests/__snapshots__/ExportOrderActionTest__it_exports_order_with_data_set_order_mode__data_set_export_large_format__data_set_two_orders__1.json @@ -15,17 +15,13 @@ "order_date": "2030-01-01 12:00:00", "order_lines": [ { - "uuid": null, "quantity": 1, "price": 0, "price_after_vat": 0, "product": { - "uuid": null, "sku": "test", - "ean": null, "external_identifier": "PDK-1", "name": "test", - "description": null, "width": 0, "length": 0, "height": 0, @@ -56,8 +52,8 @@ "physical_properties": { "height": 0, "length": 0, - "weight": 0, - "width": 0 + "width": 0, + "weight": 0 }, "pickup": null, "recipient": { @@ -84,17 +80,13 @@ "order_date": "2030-01-01 12:00:00", "order_lines": [ { - "uuid": null, "quantity": 1, "price": 0, "price_after_vat": 0, "product": { - "uuid": null, "sku": "test", - "ean": null, "external_identifier": "PDK-2", "name": "test", - "description": null, "width": 0, "length": 0, "height": 0, @@ -125,8 +117,8 @@ "physical_properties": { "height": 0, "length": 0, - "weight": 0, - "width": 0 + "width": 0, + "weight": 0 }, "pickup": null, "recipient": { diff --git a/tests/__snapshots__/ExportOrderActionTest__it_exports_order_with_data_set_order_mode__data_set_export_large_format__data_set_various_delivery_options__1.json b/tests/__snapshots__/ExportOrderActionTest__it_exports_order_with_data_set_order_mode__data_set_export_large_format__data_set_various_delivery_options__1.json index 8f56c35f2..b5fb7fc81 100644 --- a/tests/__snapshots__/ExportOrderActionTest__it_exports_order_with_data_set_order_mode__data_set_export_large_format__data_set_various_delivery_options__1.json +++ b/tests/__snapshots__/ExportOrderActionTest__it_exports_order_with_data_set_order_mode__data_set_export_large_format__data_set_various_delivery_options__1.json @@ -15,17 +15,13 @@ "order_date": "2030-01-01 12:00:00", "order_lines": [ { - "uuid": null, "quantity": 5, "price": 0, "price_after_vat": 0, "product": { - "uuid": null, "sku": "test", - "ean": null, "external_identifier": "PDK-2", "name": "test", - "description": null, "width": 0, "length": 0, "height": 0, @@ -56,8 +52,8 @@ "physical_properties": { "height": 0, "length": 0, - "weight": 0, - "width": 0 + "width": 0, + "weight": 0 }, "pickup": null, "recipient": { @@ -84,17 +80,13 @@ "order_date": "2030-01-01 12:00:00", "order_lines": [ { - "uuid": null, "quantity": 1, "price": 0, "price_after_vat": 0, "product": { - "uuid": null, "sku": "test", - "ean": null, "external_identifier": "PDK-3", "name": "test", - "description": null, "width": 0, "length": 0, "height": 0, @@ -126,8 +118,8 @@ "physical_properties": { "height": 0, "length": 0, - "weight": 0, - "width": 0 + "width": 0, + "weight": 0 }, "pickup": null, "recipient": { @@ -154,17 +146,13 @@ "order_date": "2030-01-01 12:00:00", "order_lines": [ { - "uuid": null, "quantity": 1, "price": 0, "price_after_vat": 0, "product": { - "uuid": null, "sku": "test", - "ean": null, "external_identifier": "PDK-4", "name": "test", - "description": null, "width": 0, "length": 0, "height": 0, @@ -195,8 +183,8 @@ "physical_properties": { "height": 0, "length": 0, - "weight": 0, - "width": 0 + "width": 0, + "weight": 0 }, "pickup": null, "recipient": { diff --git a/tests/__snapshots__/ExportOrderActionTest__it_exports_order_with_data_set_order_mode__data_set_export_only_recipient__data_set_carrier_dhl_for_you__1.json b/tests/__snapshots__/ExportOrderActionTest__it_exports_order_with_data_set_order_mode__data_set_export_only_recipient__data_set_carrier_dhl_for_you__1.json index 018da18c6..aab2a091c 100644 --- a/tests/__snapshots__/ExportOrderActionTest__it_exports_order_with_data_set_order_mode__data_set_export_only_recipient__data_set_carrier_dhl_for_you__1.json +++ b/tests/__snapshots__/ExportOrderActionTest__it_exports_order_with_data_set_order_mode__data_set_export_only_recipient__data_set_carrier_dhl_for_you__1.json @@ -15,17 +15,13 @@ "order_date": "2030-01-01 12:00:00", "order_lines": [ { - "uuid": null, "quantity": 1, "price": 0, "price_after_vat": 0, "product": { - "uuid": null, "sku": "test", - "ean": null, "external_identifier": "PDK-1", "name": "test", - "description": null, "width": 0, "length": 0, "height": 0, @@ -56,8 +52,8 @@ "physical_properties": { "height": 0, "length": 0, - "weight": 0, - "width": 0 + "width": 0, + "weight": 0 }, "pickup": null, "recipient": { diff --git a/tests/__snapshots__/ExportOrderActionTest__it_exports_order_with_data_set_order_mode__data_set_export_only_recipient__data_set_single_order__1.json b/tests/__snapshots__/ExportOrderActionTest__it_exports_order_with_data_set_order_mode__data_set_export_only_recipient__data_set_single_order__1.json index 6e5a3504e..a0f9229f7 100644 --- a/tests/__snapshots__/ExportOrderActionTest__it_exports_order_with_data_set_order_mode__data_set_export_only_recipient__data_set_single_order__1.json +++ b/tests/__snapshots__/ExportOrderActionTest__it_exports_order_with_data_set_order_mode__data_set_export_only_recipient__data_set_single_order__1.json @@ -15,17 +15,13 @@ "order_date": "2030-01-01 12:00:00", "order_lines": [ { - "uuid": null, "quantity": 1, "price": 0, "price_after_vat": 0, "product": { - "uuid": null, "sku": "test", - "ean": null, "external_identifier": "PDK-1", "name": "test", - "description": null, "width": 0, "length": 0, "height": 0, @@ -56,8 +52,8 @@ "physical_properties": { "height": 0, "length": 0, - "weight": 0, - "width": 0 + "width": 0, + "weight": 0 }, "pickup": null, "recipient": { diff --git a/tests/__snapshots__/ExportOrderActionTest__it_exports_order_with_data_set_order_mode__data_set_export_only_recipient__data_set_two_orders__1.json b/tests/__snapshots__/ExportOrderActionTest__it_exports_order_with_data_set_order_mode__data_set_export_only_recipient__data_set_two_orders__1.json index e1c980562..46a193c3c 100644 --- a/tests/__snapshots__/ExportOrderActionTest__it_exports_order_with_data_set_order_mode__data_set_export_only_recipient__data_set_two_orders__1.json +++ b/tests/__snapshots__/ExportOrderActionTest__it_exports_order_with_data_set_order_mode__data_set_export_only_recipient__data_set_two_orders__1.json @@ -15,17 +15,13 @@ "order_date": "2030-01-01 12:00:00", "order_lines": [ { - "uuid": null, "quantity": 1, "price": 0, "price_after_vat": 0, "product": { - "uuid": null, "sku": "test", - "ean": null, "external_identifier": "PDK-1", "name": "test", - "description": null, "width": 0, "length": 0, "height": 0, @@ -56,8 +52,8 @@ "physical_properties": { "height": 0, "length": 0, - "weight": 0, - "width": 0 + "width": 0, + "weight": 0 }, "pickup": null, "recipient": { @@ -84,17 +80,13 @@ "order_date": "2030-01-01 12:00:00", "order_lines": [ { - "uuid": null, "quantity": 1, "price": 0, "price_after_vat": 0, "product": { - "uuid": null, "sku": "test", - "ean": null, "external_identifier": "PDK-2", "name": "test", - "description": null, "width": 0, "length": 0, "height": 0, @@ -125,8 +117,8 @@ "physical_properties": { "height": 0, "length": 0, - "weight": 0, - "width": 0 + "width": 0, + "weight": 0 }, "pickup": null, "recipient": { diff --git a/tests/__snapshots__/ExportOrderActionTest__it_exports_order_with_data_set_order_mode__data_set_export_only_recipient__data_set_various_delivery_options__1.json b/tests/__snapshots__/ExportOrderActionTest__it_exports_order_with_data_set_order_mode__data_set_export_only_recipient__data_set_various_delivery_options__1.json index 853377579..f59c1b021 100644 --- a/tests/__snapshots__/ExportOrderActionTest__it_exports_order_with_data_set_order_mode__data_set_export_only_recipient__data_set_various_delivery_options__1.json +++ b/tests/__snapshots__/ExportOrderActionTest__it_exports_order_with_data_set_order_mode__data_set_export_only_recipient__data_set_various_delivery_options__1.json @@ -15,17 +15,13 @@ "order_date": "2030-01-01 12:00:00", "order_lines": [ { - "uuid": null, "quantity": 5, "price": 0, "price_after_vat": 0, "product": { - "uuid": null, "sku": "test", - "ean": null, "external_identifier": "PDK-2", "name": "test", - "description": null, "width": 0, "length": 0, "height": 0, @@ -56,8 +52,8 @@ "physical_properties": { "height": 0, "length": 0, - "weight": 0, - "width": 0 + "width": 0, + "weight": 0 }, "pickup": null, "recipient": { @@ -84,17 +80,13 @@ "order_date": "2030-01-01 12:00:00", "order_lines": [ { - "uuid": null, "quantity": 1, "price": 0, "price_after_vat": 0, "product": { - "uuid": null, "sku": "test", - "ean": null, "external_identifier": "PDK-3", "name": "test", - "description": null, "width": 0, "length": 0, "height": 0, @@ -126,8 +118,8 @@ "physical_properties": { "height": 0, "length": 0, - "weight": 0, - "width": 0 + "width": 0, + "weight": 0 }, "pickup": null, "recipient": { @@ -154,17 +146,13 @@ "order_date": "2030-01-01 12:00:00", "order_lines": [ { - "uuid": null, "quantity": 1, "price": 0, "price_after_vat": 0, "product": { - "uuid": null, "sku": "test", - "ean": null, "external_identifier": "PDK-4", "name": "test", - "description": null, "width": 0, "length": 0, "height": 0, @@ -195,8 +183,8 @@ "physical_properties": { "height": 0, "length": 0, - "weight": 0, - "width": 0 + "width": 0, + "weight": 0 }, "pickup": null, "recipient": { diff --git a/tests/__snapshots__/ExportOrderActionTest__it_exports_order_with_data_set_order_mode__data_set_export_return__data_set_carrier_dhl_for_you__1.json b/tests/__snapshots__/ExportOrderActionTest__it_exports_order_with_data_set_order_mode__data_set_export_return__data_set_carrier_dhl_for_you__1.json index bbe6ce0a4..ae8d7329a 100644 --- a/tests/__snapshots__/ExportOrderActionTest__it_exports_order_with_data_set_order_mode__data_set_export_return__data_set_carrier_dhl_for_you__1.json +++ b/tests/__snapshots__/ExportOrderActionTest__it_exports_order_with_data_set_order_mode__data_set_export_return__data_set_carrier_dhl_for_you__1.json @@ -15,17 +15,13 @@ "order_date": "2030-01-01 12:00:00", "order_lines": [ { - "uuid": null, "quantity": 1, "price": 0, "price_after_vat": 0, "product": { - "uuid": null, "sku": "test", - "ean": null, "external_identifier": "PDK-1", "name": "test", - "description": null, "width": 0, "length": 0, "height": 0, @@ -56,8 +52,8 @@ "physical_properties": { "height": 0, "length": 0, - "weight": 0, - "width": 0 + "width": 0, + "weight": 0 }, "pickup": null, "recipient": { diff --git a/tests/__snapshots__/ExportOrderActionTest__it_exports_order_with_data_set_order_mode__data_set_export_return__data_set_single_order__1.json b/tests/__snapshots__/ExportOrderActionTest__it_exports_order_with_data_set_order_mode__data_set_export_return__data_set_single_order__1.json index 7f8cec2ff..16fc39bad 100644 --- a/tests/__snapshots__/ExportOrderActionTest__it_exports_order_with_data_set_order_mode__data_set_export_return__data_set_single_order__1.json +++ b/tests/__snapshots__/ExportOrderActionTest__it_exports_order_with_data_set_order_mode__data_set_export_return__data_set_single_order__1.json @@ -15,17 +15,13 @@ "order_date": "2030-01-01 12:00:00", "order_lines": [ { - "uuid": null, "quantity": 1, "price": 0, "price_after_vat": 0, "product": { - "uuid": null, "sku": "test", - "ean": null, "external_identifier": "PDK-1", "name": "test", - "description": null, "width": 0, "length": 0, "height": 0, @@ -56,8 +52,8 @@ "physical_properties": { "height": 0, "length": 0, - "weight": 0, - "width": 0 + "width": 0, + "weight": 0 }, "pickup": null, "recipient": { diff --git a/tests/__snapshots__/ExportOrderActionTest__it_exports_order_with_data_set_order_mode__data_set_export_return__data_set_two_orders__1.json b/tests/__snapshots__/ExportOrderActionTest__it_exports_order_with_data_set_order_mode__data_set_export_return__data_set_two_orders__1.json index e1c980562..46a193c3c 100644 --- a/tests/__snapshots__/ExportOrderActionTest__it_exports_order_with_data_set_order_mode__data_set_export_return__data_set_two_orders__1.json +++ b/tests/__snapshots__/ExportOrderActionTest__it_exports_order_with_data_set_order_mode__data_set_export_return__data_set_two_orders__1.json @@ -15,17 +15,13 @@ "order_date": "2030-01-01 12:00:00", "order_lines": [ { - "uuid": null, "quantity": 1, "price": 0, "price_after_vat": 0, "product": { - "uuid": null, "sku": "test", - "ean": null, "external_identifier": "PDK-1", "name": "test", - "description": null, "width": 0, "length": 0, "height": 0, @@ -56,8 +52,8 @@ "physical_properties": { "height": 0, "length": 0, - "weight": 0, - "width": 0 + "width": 0, + "weight": 0 }, "pickup": null, "recipient": { @@ -84,17 +80,13 @@ "order_date": "2030-01-01 12:00:00", "order_lines": [ { - "uuid": null, "quantity": 1, "price": 0, "price_after_vat": 0, "product": { - "uuid": null, "sku": "test", - "ean": null, "external_identifier": "PDK-2", "name": "test", - "description": null, "width": 0, "length": 0, "height": 0, @@ -125,8 +117,8 @@ "physical_properties": { "height": 0, "length": 0, - "weight": 0, - "width": 0 + "width": 0, + "weight": 0 }, "pickup": null, "recipient": { diff --git a/tests/__snapshots__/ExportOrderActionTest__it_exports_order_with_data_set_order_mode__data_set_export_return__data_set_various_delivery_options__1.json b/tests/__snapshots__/ExportOrderActionTest__it_exports_order_with_data_set_order_mode__data_set_export_return__data_set_various_delivery_options__1.json index 067fcdd88..b679071a0 100644 --- a/tests/__snapshots__/ExportOrderActionTest__it_exports_order_with_data_set_order_mode__data_set_export_return__data_set_various_delivery_options__1.json +++ b/tests/__snapshots__/ExportOrderActionTest__it_exports_order_with_data_set_order_mode__data_set_export_return__data_set_various_delivery_options__1.json @@ -15,17 +15,13 @@ "order_date": "2030-01-01 12:00:00", "order_lines": [ { - "uuid": null, "quantity": 5, "price": 0, "price_after_vat": 0, "product": { - "uuid": null, "sku": "test", - "ean": null, "external_identifier": "PDK-2", "name": "test", - "description": null, "width": 0, "length": 0, "height": 0, @@ -56,8 +52,8 @@ "physical_properties": { "height": 0, "length": 0, - "weight": 0, - "width": 0 + "width": 0, + "weight": 0 }, "pickup": null, "recipient": { @@ -84,17 +80,13 @@ "order_date": "2030-01-01 12:00:00", "order_lines": [ { - "uuid": null, "quantity": 1, "price": 0, "price_after_vat": 0, "product": { - "uuid": null, "sku": "test", - "ean": null, "external_identifier": "PDK-3", "name": "test", - "description": null, "width": 0, "length": 0, "height": 0, @@ -126,8 +118,8 @@ "physical_properties": { "height": 0, "length": 0, - "weight": 0, - "width": 0 + "width": 0, + "weight": 0 }, "pickup": null, "recipient": { @@ -154,17 +146,13 @@ "order_date": "2030-01-01 12:00:00", "order_lines": [ { - "uuid": null, "quantity": 1, "price": 0, "price_after_vat": 0, "product": { - "uuid": null, "sku": "test", - "ean": null, "external_identifier": "PDK-4", "name": "test", - "description": null, "width": 0, "length": 0, "height": 0, @@ -195,8 +183,8 @@ "physical_properties": { "height": 0, "length": 0, - "weight": 0, - "width": 0 + "width": 0, + "weight": 0 }, "pickup": null, "recipient": { diff --git a/tests/__snapshots__/ExportOrderActionTest__it_exports_order_with_data_set_order_mode__data_set_export_signature__data_set_carrier_dhl_for_you__1.json b/tests/__snapshots__/ExportOrderActionTest__it_exports_order_with_data_set_order_mode__data_set_export_signature__data_set_carrier_dhl_for_you__1.json index 4c863b267..0c3b07438 100644 --- a/tests/__snapshots__/ExportOrderActionTest__it_exports_order_with_data_set_order_mode__data_set_export_signature__data_set_carrier_dhl_for_you__1.json +++ b/tests/__snapshots__/ExportOrderActionTest__it_exports_order_with_data_set_order_mode__data_set_export_signature__data_set_carrier_dhl_for_you__1.json @@ -15,17 +15,13 @@ "order_date": "2030-01-01 12:00:00", "order_lines": [ { - "uuid": null, "quantity": 1, "price": 0, "price_after_vat": 0, "product": { - "uuid": null, "sku": "test", - "ean": null, "external_identifier": "PDK-1", "name": "test", - "description": null, "width": 0, "length": 0, "height": 0, @@ -56,8 +52,8 @@ "physical_properties": { "height": 0, "length": 0, - "weight": 0, - "width": 0 + "width": 0, + "weight": 0 }, "pickup": null, "recipient": { diff --git a/tests/__snapshots__/ExportOrderActionTest__it_exports_order_with_data_set_order_mode__data_set_export_signature__data_set_single_order__1.json b/tests/__snapshots__/ExportOrderActionTest__it_exports_order_with_data_set_order_mode__data_set_export_signature__data_set_single_order__1.json index ce0d9bdb6..d65c0a49f 100644 --- a/tests/__snapshots__/ExportOrderActionTest__it_exports_order_with_data_set_order_mode__data_set_export_signature__data_set_single_order__1.json +++ b/tests/__snapshots__/ExportOrderActionTest__it_exports_order_with_data_set_order_mode__data_set_export_signature__data_set_single_order__1.json @@ -15,17 +15,13 @@ "order_date": "2030-01-01 12:00:00", "order_lines": [ { - "uuid": null, "quantity": 1, "price": 0, "price_after_vat": 0, "product": { - "uuid": null, "sku": "test", - "ean": null, "external_identifier": "PDK-1", "name": "test", - "description": null, "width": 0, "length": 0, "height": 0, @@ -56,8 +52,8 @@ "physical_properties": { "height": 0, "length": 0, - "weight": 0, - "width": 0 + "width": 0, + "weight": 0 }, "pickup": null, "recipient": { diff --git a/tests/__snapshots__/ExportOrderActionTest__it_exports_order_with_data_set_order_mode__data_set_export_signature__data_set_two_orders__1.json b/tests/__snapshots__/ExportOrderActionTest__it_exports_order_with_data_set_order_mode__data_set_export_signature__data_set_two_orders__1.json index e1c980562..46a193c3c 100644 --- a/tests/__snapshots__/ExportOrderActionTest__it_exports_order_with_data_set_order_mode__data_set_export_signature__data_set_two_orders__1.json +++ b/tests/__snapshots__/ExportOrderActionTest__it_exports_order_with_data_set_order_mode__data_set_export_signature__data_set_two_orders__1.json @@ -15,17 +15,13 @@ "order_date": "2030-01-01 12:00:00", "order_lines": [ { - "uuid": null, "quantity": 1, "price": 0, "price_after_vat": 0, "product": { - "uuid": null, "sku": "test", - "ean": null, "external_identifier": "PDK-1", "name": "test", - "description": null, "width": 0, "length": 0, "height": 0, @@ -56,8 +52,8 @@ "physical_properties": { "height": 0, "length": 0, - "weight": 0, - "width": 0 + "width": 0, + "weight": 0 }, "pickup": null, "recipient": { @@ -84,17 +80,13 @@ "order_date": "2030-01-01 12:00:00", "order_lines": [ { - "uuid": null, "quantity": 1, "price": 0, "price_after_vat": 0, "product": { - "uuid": null, "sku": "test", - "ean": null, "external_identifier": "PDK-2", "name": "test", - "description": null, "width": 0, "length": 0, "height": 0, @@ -125,8 +117,8 @@ "physical_properties": { "height": 0, "length": 0, - "weight": 0, - "width": 0 + "width": 0, + "weight": 0 }, "pickup": null, "recipient": { diff --git a/tests/__snapshots__/ExportOrderActionTest__it_exports_order_with_data_set_order_mode__data_set_export_signature__data_set_various_delivery_options__1.json b/tests/__snapshots__/ExportOrderActionTest__it_exports_order_with_data_set_order_mode__data_set_export_signature__data_set_various_delivery_options__1.json index 853377579..f59c1b021 100644 --- a/tests/__snapshots__/ExportOrderActionTest__it_exports_order_with_data_set_order_mode__data_set_export_signature__data_set_various_delivery_options__1.json +++ b/tests/__snapshots__/ExportOrderActionTest__it_exports_order_with_data_set_order_mode__data_set_export_signature__data_set_various_delivery_options__1.json @@ -15,17 +15,13 @@ "order_date": "2030-01-01 12:00:00", "order_lines": [ { - "uuid": null, "quantity": 5, "price": 0, "price_after_vat": 0, "product": { - "uuid": null, "sku": "test", - "ean": null, "external_identifier": "PDK-2", "name": "test", - "description": null, "width": 0, "length": 0, "height": 0, @@ -56,8 +52,8 @@ "physical_properties": { "height": 0, "length": 0, - "weight": 0, - "width": 0 + "width": 0, + "weight": 0 }, "pickup": null, "recipient": { @@ -84,17 +80,13 @@ "order_date": "2030-01-01 12:00:00", "order_lines": [ { - "uuid": null, "quantity": 1, "price": 0, "price_after_vat": 0, "product": { - "uuid": null, "sku": "test", - "ean": null, "external_identifier": "PDK-3", "name": "test", - "description": null, "width": 0, "length": 0, "height": 0, @@ -126,8 +118,8 @@ "physical_properties": { "height": 0, "length": 0, - "weight": 0, - "width": 0 + "width": 0, + "weight": 0 }, "pickup": null, "recipient": { @@ -154,17 +146,13 @@ "order_date": "2030-01-01 12:00:00", "order_lines": [ { - "uuid": null, "quantity": 1, "price": 0, "price_after_vat": 0, "product": { - "uuid": null, "sku": "test", - "ean": null, "external_identifier": "PDK-4", "name": "test", - "description": null, "width": 0, "length": 0, "height": 0, @@ -195,8 +183,8 @@ "physical_properties": { "height": 0, "length": 0, - "weight": 0, - "width": 0 + "width": 0, + "weight": 0 }, "pickup": null, "recipient": { 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 cbf05be0e..0e0143f96 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 @@ -51,9 +51,7 @@ "height": 0, "length": 0, "width": 0, - "initialWeight": 0, - "manualWeight": -1, - "totalWeight": 0 + "weight": 0 }, "dropOffPoint": null }, 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 cbf05be0e..0e0143f96 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 @@ -51,9 +51,7 @@ "height": 0, "length": 0, "width": 0, - "initialWeight": 0, - "manualWeight": -1, - "totalWeight": 0 + "weight": 0 }, "dropOffPoint": null }, 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 df44bc35e..86bf81450 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 @@ -88,9 +88,7 @@ "height": 100, "length": 100, "width": 100, - "initialWeight": 1000, - "manualWeight": -1, - "totalWeight": 1000 + "weight": 1000 }, "dropOffPoint": null }, 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 9dc6b77f7..95e19471e 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 @@ -2,7 +2,9 @@ { "exported": false, "deliveryOptions": { - "carrier": "dhlforyou", + "carrier": { + "externalIdentifier": "dhlforyou" + }, "labelAmount": 1, "shipmentOptions": { "insurance": -1, 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 dc98a98b1..26c3a4107 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 @@ -2,7 +2,9 @@ { "exported": false, "deliveryOptions": { - "carrier": "postnl", + "carrier": { + "externalIdentifier": "postnl" + }, "labelAmount": 1, "shipmentOptions": { "insurance": -1, diff --git a/tests/__snapshots__/PdkOrderTest__it_creates_a_storable_array_with_data_set_two_orders__1.json b/tests/__snapshots__/PdkOrderTest__it_creates_a_storable_array_with_data_set_two_orders__1.json index f92597195..b85a51121 100644 --- a/tests/__snapshots__/PdkOrderTest__it_creates_a_storable_array_with_data_set_two_orders__1.json +++ b/tests/__snapshots__/PdkOrderTest__it_creates_a_storable_array_with_data_set_two_orders__1.json @@ -2,7 +2,9 @@ { "exported": false, "deliveryOptions": { - "carrier": "postnl", + "carrier": { + "externalIdentifier": "postnl" + }, "labelAmount": 2, "shipmentOptions": { "insurance": -1, @@ -22,7 +24,9 @@ { "exported": false, "deliveryOptions": { - "carrier": "postnl", + "carrier": { + "externalIdentifier": "postnl" + }, "labelAmount": 1, "shipmentOptions": { "insurance": -1, 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 4b497aa30..f3e196ceb 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 @@ -2,7 +2,9 @@ { "exported": false, "deliveryOptions": { - "carrier": "postnl", + "carrier": { + "externalIdentifier": "postnl" + }, "labelAmount": 1, "shipmentOptions": { "insurance": -1, @@ -23,7 +25,9 @@ "exported": false, "deliveryOptions": { "date": "2077-10-23 09:47:51", - "carrier": "postnl", + "carrier": { + "externalIdentifier": "postnl" + }, "labelAmount": 1, "shipmentOptions": { "insurance": -1, @@ -43,7 +47,9 @@ { "exported": false, "deliveryOptions": { - "carrier": "dhlforyou", + "carrier": { + "externalIdentifier": "dhlforyou" + }, "labelAmount": 1, "shipmentOptions": { "insurance": 1, 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 e76626b5a..0fc7b065e 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 @@ -100,9 +100,7 @@ "height": null, "length": null, "width": null, - "initialWeight": 0, - "manualWeight": -1, - "totalWeight": 0 + "weight": 3500 }, "dropOffPoint": null }, 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 e76626b5a..0fc7b065e 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 @@ -100,9 +100,7 @@ "height": null, "length": null, "width": null, - "initialWeight": 0, - "manualWeight": -1, - "totalWeight": 0 + "weight": 3500 }, "dropOffPoint": null }, 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 0cbc3a9b1..c7367d240 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 @@ -122,9 +122,7 @@ "height": null, "length": null, "width": null, - "initialWeight": 0, - "manualWeight": -1, - "totalWeight": 0 + "weight": 35 }, "dropOffPoint": null }, 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 d0b005bd2..0eb50ce69 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 @@ -83,9 +83,7 @@ "height": 20, "length": 40, "width": 30, - "initialWeight": 0, - "manualWeight": -1, - "totalWeight": 0 + "weight": 3500 }, "price": { "amount": 5390, 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 6b38402ff..8bd46666c 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 @@ -66,9 +66,7 @@ "height": null, "length": null, "width": null, - "initialWeight": 0, - "manualWeight": -1, - "totalWeight": 0 + "weight": null }, "price": { "amount": 625, 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 02fe3cb6b..477ba8a62 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 @@ -79,9 +79,7 @@ "height": null, "length": null, "width": null, - "initialWeight": 0, - "manualWeight": -1, - "totalWeight": 0 + "weight": 5000 }, "price": { "amount": 1920, 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 9dc24c8c7..ae368d8f3 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 @@ -79,9 +79,7 @@ "height": null, "length": null, "width": null, - "initialWeight": 0, - "manualWeight": -1, - "totalWeight": 0 + "weight": 1000 }, "price": { "amount": 625, 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 e76626b5a..0fc7b065e 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 @@ -100,9 +100,7 @@ "height": null, "length": null, "width": null, - "initialWeight": 0, - "manualWeight": -1, - "totalWeight": 0 + "weight": 3500 }, "dropOffPoint": null }, 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 e76626b5a..0fc7b065e 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 @@ -100,9 +100,7 @@ "height": null, "length": null, "width": null, - "initialWeight": 0, - "manualWeight": -1, - "totalWeight": 0 + "weight": 3500 }, "dropOffPoint": null }, 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 4d6564fce..ca92ced0f 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 @@ -38,9 +38,7 @@ "height": 0, "length": 0, "width": 0, - "initialWeight": 0, - "manualWeight": -1, - "totalWeight": 0 + "weight": 0 }, "dropOffPoint": null } 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 bdf2be79b..0077e7968 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 @@ -68,9 +68,7 @@ "height": 0, "length": 0, "width": 0, - "initialWeight": 0, - "manualWeight": -1, - "totalWeight": 0 + "weight": 0 }, "dropOffPoint": null } 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 9ddf999b6..63e8b8b2f 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 @@ -38,9 +38,7 @@ "height": null, "length": null, "width": null, - "initialWeight": 0, - "manualWeight": -1, - "totalWeight": 0 + "weight": null }, "dropOffPoint": null } diff --git a/tests/__snapshots__/UpdateShipmentsActionTest__it_updates_shipments__1.json b/tests/__snapshots__/UpdateShipmentsActionTest__it_updates_shipments__1.json index e7dc95ac4..7feb00b2a 100644 --- a/tests/__snapshots__/UpdateShipmentsActionTest__it_updates_shipments__1.json +++ b/tests/__snapshots__/UpdateShipmentsActionTest__it_updates_shipments__1.json @@ -9,14 +9,7 @@ "externalIdentifier": "CV515676839NL", "barcode": "CV515676839NL", "carrier": { - "id": 1, - "name": "postnl", - "human": "PostNL", - "enabled": false, - "isDefault": true, - "optional": false, - "primary": false, - "type": "main" + "externalIdentifier": "postnl" }, "customsDeclaration": { "contents": 1, @@ -40,15 +33,7 @@ "delivered": false, "deliveryOptions": { "carrier": { - "externalIdentifier": "postnl", - "id": 1, - "name": "postnl", - "human": "PostNL", - "enabled": false, - "isDefault": true, - "optional": false, - "primary": false, - "type": "main" + "externalIdentifier": "postnl" }, "labelAmount": 1, "shipmentOptions": { @@ -72,9 +57,7 @@ "height": 20, "length": 40, "width": 30, - "initialWeight": 0, - "manualWeight": -1, - "totalWeight": 0 + "weight": 3500 }, "price": { "amount": 5390, diff --git a/tests/factories/App/Order/Model/PdkOrderFactory.php b/tests/factories/App/Order/Model/PdkOrderFactory.php index ab70da023..7b6259545 100644 --- a/tests/factories/App/Order/Model/PdkOrderFactory.php +++ b/tests/factories/App/Order/Model/PdkOrderFactory.php @@ -17,8 +17,6 @@ use MyParcelNL\Pdk\Shipment\Model\CustomsDeclarationFactory; use MyParcelNL\Pdk\Shipment\Model\DeliveryOptions; use MyParcelNL\Pdk\Shipment\Model\DeliveryOptionsFactory; -use MyParcelNL\Pdk\Shipment\Model\PhysicalProperties; -use MyParcelNL\Pdk\Shipment\Model\PhysicalPropertiesFactory; use MyParcelNL\Pdk\Shipment\Model\RetailLocation; use MyParcelNL\Pdk\Shipment\Model\ShipmentFactory; use MyParcelNL\Pdk\Shipment\Model\ShipmentOptions; @@ -40,7 +38,7 @@ * @method $this withOrderPrice(int $orderPrice) * @method $this withOrderPriceAfterVat(int $orderPriceAfterVat) * @method $this withOrderVat(int $orderVat) - * @method $this withPhysicalProperties(array|PhysicalProperties|PhysicalPropertiesFactory $physicalProperties) + * @method $this withPhysicalProperties(array|PdkPhysicalProperties|PdkPhysicalPropertiesFactory $physicalProperties) * @method $this withSenderAddress(array|ContactDetails|ContactDetailsFactory $senderAddress) * @method $this withShipmentPrice(int $shipmentPrice) * @method $this withShipmentPriceAfterVat(int $shipmentPriceAfterVat) diff --git a/tests/factories/App/Order/Model/PdkPhysicalPropertiesFactory.php b/tests/factories/App/Order/Model/PdkPhysicalPropertiesFactory.php new file mode 100644 index 000000000..4ffdaac3d --- /dev/null +++ b/tests/factories/App/Order/Model/PdkPhysicalPropertiesFactory.php @@ -0,0 +1,25 @@ +withShipmentOptions(factory(ShipmentOptions::class)->withAllOptions()); } + /** + * @param array|RetailLocation|RetailLocationFactory $pickupLocation + * + * @return $this + */ + public function withPickupLocation($pickupLocation = null): self + { + return $this->with(['pickupLocation' => $pickupLocation ?? factory(RetailLocation::class)]); + } + protected function createDefault(): FactoryInterface { return $this diff --git a/tests/factories/Shipment/Model/PhysicalPropertiesFactory.php b/tests/factories/Shipment/Model/PhysicalPropertiesFactory.php index 57065a64a..ed729024f 100644 --- a/tests/factories/Shipment/Model/PhysicalPropertiesFactory.php +++ b/tests/factories/Shipment/Model/PhysicalPropertiesFactory.php @@ -1,5 +1,4 @@ withDeliveryOptions(factory(DeliveryOptions::class)->withPickupLocation()); + } + + /** + * @param array|RetailLocation|RetailLocationFactory $dropOffPoint + * + * @return $this + */ + public function withDropOffPoint($dropOffPoint = null): self + { + return $this->with(['dropOffPoint' => $dropOffPoint ?? factory(RetailLocation::class)]); + } + /** * @param null|int $id *