Skip to content

Commit 4d33c7a

Browse files
wip
1 parent 02ec9d9 commit 4d33c7a

5 files changed

Lines changed: 9 additions & 56 deletions

File tree

src/Models/Orders/LineItem.php

Lines changed: 0 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -41,16 +41,6 @@ class LineItem
4141
*/
4242
protected $totalAmount;
4343

44-
/**
45-
* @var string
46-
*/
47-
protected $createdAt;
48-
49-
/**
50-
* @var string
51-
*/
52-
protected $updatedAt;
53-
5444
/**
5545
* @var Product|null
5646
*/
@@ -70,8 +60,6 @@ public function __construct(
7060
string $price,
7161
?int $discountAmount,
7262
int $totalAmount,
73-
string $createdAt,
74-
string $updatedAt,
7563
?Product $product,
7664
array $subLineItems = []
7765
) {
@@ -82,8 +70,6 @@ public function __construct(
8270
$this->price = $price;
8371
$this->discountAmount = $discountAmount;
8472
$this->totalAmount = $totalAmount;
85-
$this->createdAt = $createdAt;
86-
$this->updatedAt = $updatedAt;
8773
$this->product = $product;
8874
$this->subLineItems = $subLineItems;
8975
}
@@ -123,16 +109,6 @@ public function getTotalAmount(): int
123109
return $this->totalAmount;
124110
}
125111

126-
public function getCreatedAt(): string
127-
{
128-
return $this->createdAt;
129-
}
130-
131-
public function getUpdatedAt(): string
132-
{
133-
return $this->updatedAt;
134-
}
135-
136112
public function getProduct(): ?Product
137113
{
138114
return $this->product;

src/Models/Orders/SubLineItem.php

Lines changed: 1 addition & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -41,16 +41,6 @@ class SubLineItem
4141
*/
4242
protected $totalAmount;
4343

44-
/**
45-
* @var string
46-
*/
47-
protected $createdAt;
48-
49-
/**
50-
* @var string
51-
*/
52-
protected $updatedAt;
53-
5444
/**
5545
* @var LineItem
5646
*/
@@ -69,8 +59,6 @@ public function __construct(
6959
string $price,
7060
?int $discountAmount,
7161
int $totalAmount,
72-
string $createdAt,
73-
string $updatedAt,
7462
LineItem $lineItem,
7563
?Product $product
7664
) {
@@ -81,8 +69,6 @@ public function __construct(
8169
$this->price = $price;
8270
$this->discountAmount = $discountAmount;
8371
$this->totalAmount = $totalAmount;
84-
$this->createdAt = $createdAt;
85-
$this->updatedAt = $updatedAt;
8672
$this->lineItem = $lineItem;
8773
$this->product = $product;
8874
}
@@ -121,17 +107,7 @@ public function getTotalAmount(): int
121107
{
122108
return $this->totalAmount;
123109
}
124-
125-
public function getCreatedAt(): string
126-
{
127-
return $this->createdAt;
128-
}
129-
130-
public function getUpdatedAt(): string
131-
{
132-
return $this->updatedAt;
133-
}
134-
110+
135111
public function getLineItem(): LineItem
136112
{
137113
return $this->lineItem;

src/StaticMappers/Orders/LineItemMapper.php

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,11 @@ public static function map(stdClass $data): LineItem
1515
$product = ProductMapper::map($data->product);
1616
}
1717

18+
$subLineItems = null;
19+
if (isset($data->sub_line_items)) {
20+
$subLineItems = SubLineItemsMapper::map($data->sub_line_items);
21+
}
22+
1823
return new LineItem(
1924
$data->uuid,
2025
$data->external_identifier,
@@ -23,10 +28,8 @@ public static function map(stdClass $data): LineItem
2328
$data->price,
2429
$data->discount_amount,
2530
$data->total_amount,
26-
$data->created_at ?? '',
27-
$data->updated_at ?? '',
2831
$product,
29-
$data->sub_line_items
32+
$subLineItems
3033
);
3134
}
3235
}

src/StaticMappers/Orders/OrderMapper.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,8 +39,8 @@ public static function map(stdClass $data): Order
3939
(int) $data->total_discount_amount,
4040
(int) $data->total_order_amount,
4141
$data->paid_at ?? null,
42-
$data->created_at ?? '',
43-
$data->updated_at ?? '',
42+
$data->created_at,
43+
$data->updated_at,
4444
$contact,
4545
$shop,
4646
$lineItems,

src/StaticMappers/Orders/SubLineItemMapper.php

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,6 @@ public static function map(stdClass $data): SubLineItem
2828
$data->price,
2929
$data->discount_amount,
3030
$data->total_amount,
31-
$data->created_at ?? '',
32-
$data->updated_at ?? '',
3331
$lineItem,
3432
$product
3533
);

0 commit comments

Comments
 (0)