Skip to content

Commit 108a391

Browse files
author
Prabhu Ram
committed
MC-20636: MyAccount :: Order Details :: Order Details by Order Number
- review fixes for invoices
1 parent 97248d8 commit 108a391

File tree

4 files changed

+148
-164
lines changed

4 files changed

+148
-164
lines changed

app/code/Magento/SalesGraphQl/Model/Resolver/InvoiceItems.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ private function getInvoiceItemData(OrderInterface $order, InvoiceItemInterface
118118
'product_sku' => $invoiceItem->getSku(),
119119
'product_sale_price' => [
120120
'value' => $invoiceItem->getPrice(),
121-
'currency' => $order->getOrderCurrency()
121+
'currency' => $order->getOrderCurrencyCode()
122122
],
123123
'quantity_invoiced' => $invoiceItem->getQty(),
124124
'model' => $invoiceItem,

app/code/Magento/SalesGraphQl/Model/Resolver/InvoiceTotal.php

Lines changed: 4 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -42,38 +42,17 @@ public function resolve(
4242
/** @var Invoice $invoiceModel */
4343
$invoiceModel = $value['model'];
4444
$currency = $orderModel->getOrderCurrencyCode();
45-
$totals = [
45+
return [
4646
'base_grand_total' => ['value' => $invoiceModel->getBaseGrandTotal(), 'currency' => $currency],
4747
'grand_total' => ['value' => $invoiceModel->getGrandTotal(), 'currency' => $currency],
4848
'subtotal' => ['value' => $invoiceModel->getSubtotal(), 'currency' => $currency],
4949
'total_tax' => ['value' => $invoiceModel->getTaxAmount(), 'currency' => $currency],
50-
'taxes' => $this->getAppliedTaxes($invoiceModel, $currency),
5150
'total_shipping' => ['value' => $invoiceModel->getShippingAmount(), 'currency' => $currency],
5251
'shipping_handling' => [
53-
'amount_exc_tax' => ['value' => $invoiceModel->getShippingTaxAmount(), 'currency' => $currency],
54-
'amount_inc_tax' => ['value' => $invoiceModel->getShippingInclTax(), 'currency' => $currency],
55-
'total_amount' => ['value' => $invoiceModel->getBaseShippingTaxAmount(), 'currency' => $currency],
56-
'taxes' => $this->getAppliedTaxes($invoiceModel, $currency)
52+
'amount_excluding_tax' => ['value' => $invoiceModel->getShippingAmount(), 'currency' => $currency],
53+
'amount_including_tax' => ['value' => $invoiceModel->getShippingInclTax(), 'currency' => $currency],
54+
'total_amount' => ['value' => $invoiceModel->getBaseShippingAmount(), 'currency' => $currency],
5755
]
5856
];
59-
return $totals;
60-
}
61-
62-
/**
63-
* Returns taxes applied to the current invoice
64-
*
65-
* @param Invoice $invoiceModel
66-
* @param string $currency
67-
* @return array
68-
*/
69-
private function getAppliedTaxes(Invoice $invoiceModel, string $currency): array
70-
{
71-
$taxes[] = [
72-
'rate' => $invoiceModel->getStoreToOrderRate(),
73-
'title' => $invoiceModel->getCustomerName(),
74-
'amount' => [ 'value' => $invoiceModel->getTaxAmount(), 'currency' => $currency
75-
]
76-
];
77-
return $taxes;
7857
}
7958
}

0 commit comments

Comments
 (0)