Skip to content
This repository was archived by the owner on Oct 8, 2025. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions doc/swagger.yml
Original file line number Diff line number Diff line change
Expand Up @@ -1322,9 +1322,14 @@ definitions:
quantity:
type: "integer"
example: 2
subtotal:
type: "integer"
example: 2000
description: "Raw subtotal without the distributed order discounts (unit price * quantity + unit discount)"
total:
type: "integer"
example: 1000
description: "The total also includes the distributed discount"
product:
type: "object"
allOf:
Expand Down
2 changes: 2 additions & 0 deletions spec/Factory/Cart/CartItemViewFactorySpec.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ function it_builds_cart_item_view(
$cartItem->getId()->willReturn(2);
$cartItem->getQuantity()->willReturn(3);
$cartItem->getTotal()->willReturn(900);
$cartItem->getSubtotal()->willReturn(800);
$cartItem->getProduct()->willReturn($tShirt);
$cartItem->getVariant()->willReturn($tShirtVariant);

Expand All @@ -51,6 +52,7 @@ function it_builds_cart_item_view(
$cartItemView = new ItemView();
$cartItemView->id = 2;
$cartItemView->quantity = 3;
$cartItemView->subTotal = 800;
$cartItemView->total = 900;
$cartItemView->product = new ProductView();
$cartItemView->product->variants = [new ProductVariantView()];
Expand Down
1 change: 1 addition & 0 deletions src/Factory/Cart/CartItemViewFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ public function create(OrderItemInterface $item, ChannelInterface $channel, stri
$itemView->id = $item->getId();
$itemView->quantity = $item->getQuantity();
$itemView->total = $item->getTotal();
$itemView->subTotal = $item->getSubtotal();
$itemView->product = $this->productViewFactory->create($item->getProduct(), $channel, $locale);
$itemView->product->variants = [$this->productVariantViewFactory->create($item->getVariant(), $channel, $locale)];

Expand Down
3 changes: 3 additions & 0 deletions src/View/ItemView.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,9 @@ class ItemView
/** @var int */
public $total;

/** @var int */
public $subTotal;

/** @var ProductView */
public $product;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
{
"id": @integer@,
"quantity": 3,
"subTotal": 5997,
"total": 5997,
"product": {
"code": "LOGAN_MUG_CODE",
Expand Down Expand Up @@ -69,6 +70,7 @@
{
"id": @integer@,
"quantity": 3,
"subTotal": 5997,
"total": 5997,
"product": {
"code": "LOGAN_T_SHIRT_CODE",
Expand Down Expand Up @@ -127,6 +129,7 @@
{
"id": @integer@,
"quantity": 3,
"subTotal": 1500,
"total": 1500,
"product": {
"code": "LOGAN_HAT_CODE",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
{
"id": @integer@,
"quantity": 3,
"subTotal": 5997,
"total": 5997,
"product": {
"code": "LOGAN_MUG_CODE",
Expand Down Expand Up @@ -69,6 +70,7 @@
{
"id": @integer@,
"quantity": 3,
"subTotal": 5997,
"total": 5997,
"product": {
"code": "LOGAN_T_SHIRT_CODE",
Expand Down Expand Up @@ -127,6 +129,7 @@
{
"id": @integer@,
"quantity": 3,
"subTotal": 1500,
"total": 1500,
"product": {
"code": "LOGAN_HAT_CODE",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
"id": @integer@,
"quantity": 6,
"total": 3000,
"subTotal": 3000,
"product": {
"code": "LOGAN_HAT_CODE",
"name": "Logan Hat",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
{
"id": @integer@,
"quantity": 3,
"subTotal": 1500,
"total": 1500,
"product": {
"code": "LOGAN_HAT_CODE",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
"id": @integer@,
"quantity": 6,
"total": 11994,
"subTotal": 11994,
"product": {
"code": "LOGAN_T_SHIRT_CODE",
"name": "Logan T-Shirt",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
{
"id": @integer@,
"quantity": 3,
"subTotal": 5997,
"total": 5997,
"product": {
"code": "LOGAN_T_SHIRT_CODE",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
{
"id": @integer@,
"quantity": 2,
"subTotal": 3998,
"total": 3998,
"product": {
"code": "LOGAN_MUG_CODE",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
{
"id": @integer@,
"quantity": 3,
"subTotal": 5997,
"total": 5997,
"product": {
"code": "LOGAN_MUG_CODE",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
{
"id": @integer@,
"quantity": 3,
"subTotal": 5997,
"total": 5997,
"product": {
"code": "LOGAN_MUG_CODE",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
"id": @integer@,
"quantity": 5,
"total": 8995,
"subTotal": 9995,
"product": {
"code": "LOGAN_MUG_CODE",
"name": "Logan Mug",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
{
"id": @integer@,
"quantity": 3,
"subTotal": 5997,
"total": 5997,
"product": {
"code": "LOGAN_T_SHIRT_CODE",
Expand Down Expand Up @@ -66,6 +67,7 @@
{
"id": @integer@,
"quantity": 3,
"subTotal": 1500,
"total": 1500,
"product": {
"code": "LOGAN_HAT_CODE",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
{
"id": @integer@,
"quantity": 5,
"subTotal": 9995,
"total": 9995,
"product": {
"code": "LOGAN_MUG_CODE",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
{
"id": @integer@,
"quantity": 3,
"subTotal": 1770,
"total": 1770,
"product": {
"code": "LOGAN_HAT_CODE",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
{
"id": @integer@,
"quantity": 5,
"subTotal": 10495,
"total": 10495,
"product": {
"code": "LOGAN_MUG_CODE",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
{
"id": @integer@,
"quantity": 1,
"subTotal": 1999,
"total": 1599,
"product": {
"code": "LOGAN_MUG_CODE",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
"id": @integer@,
"quantity": 1,
"total": 1999,
"subTotal": 1999,
"product": {
"code": "LOGAN_MUG_CODE",
"name": "Logan Mug",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
{
"id": @integer@,
"quantity": 5,
"subTotal": 9995,
"total": 9995,
"product": {
"code": "LOGAN_MUG_CODE",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
{
"id": @integer@,
"quantity": 5,
"subTotal": 9995,
"total": 9995,
"product": {
"code": "LOGAN_MUG_CODE",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
{
"id": @integer@,
"quantity": 5,
"subTotal": 9995,
"total": 9995,
"product": {
"code": "LOGAN_MUG_CODE",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
{
"id": @integer@,
"quantity": 5,
"subTotal": 9995,
"total": 9995,
"product": {
"code": "LOGAN_MUG_CODE",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
{
"id": @integer@,
"quantity": 5,
"subTotal": 9995,
"total": 9995,
"product": {
"code": "LOGAN_MUG_CODE",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
{
"id": @integer@,
"quantity": 5,
"subTotal": 9995,
"total": 9995,
"product": {
"code": "LOGAN_MUG_CODE",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
{
"id": @integer@,
"quantity": 2,
"subTotal": 3998,
"total": 3998,
"product": {
"code": "LOGAN_MUG_CODE",
Expand Down
1 change: 1 addition & 0 deletions tests/Responses/Expected/order/order_details_response.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
{
"id": @integer@,
"quantity": 5,
"subTotal": 9995,
"total": 9995,
"product": {
"code": "LOGAN_MUG_CODE",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
{
"id": @integer@,
"quantity": 5,
"subTotal": 9995,
"total": 9995,
"product": {
"code": "LOGAN_MUG_CODE",
Expand Down
1 change: 1 addition & 0 deletions tests/Responses/Expected/order/orders_list_response.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
{
"id": @integer@,
"quantity": 5,
"subTotal": 9995,
"total": 9995,
"product": {
"code": "LOGAN_MUG_CODE",
Expand Down