private function createOrder(): OrderEntity
{ $order =
new OrderEntity();
$lineItems =
new OrderLineItemCollection();
$lineItems->
add($this->
buildOrderLineItem($this->ids->
get('id1'
), LineItem::PRODUCT_LINE_ITEM_TYPE, 1
));
$lineItems->
add($this->
buildOrderLineItem($this->ids->
get('id2'
), LineItem::PRODUCT_LINE_ITEM_TYPE, 2
));
$lineItems->
add($this->
buildOrderLineItem(null, LineItem::PRODUCT_LINE_ITEM_TYPE, 2
));
$lineItems->
add($this->
buildOrderLineItem($this->ids->
get('discount'
), LineItem::DISCOUNT_LINE_ITEM, 1
));
$order->
setLineItems($lineItems);
return $order;
} private function buildOrderLineItem(?string
$id, string
$type, int
$qty): OrderLineItemEntity
{ $orderLineItemEntity =
new OrderLineItemEntity();
$orderLineItemEntity->
setId(Uuid::
randomHex());
$orderLineItemEntity->
setReferencedId($id);
$orderLineItemEntity->
setType($type);
$orderLineItemEntity->
setIdentifier($id ?? Uuid::
randomHex());