Skip to content

Commit

Permalink
Merge remote-tracking branch 'folks/checkout' into MAGETWO-34804
Browse files Browse the repository at this point in the history
Conflicts:
	app/code/Magento/Tax/Model/Quote/GrandTotalDetails.php
  • Loading branch information
slavvka committed May 15, 2015
2 parents 68c535c + d9475ee commit bf6516d
Showing 1 changed file with 18 additions and 2 deletions.
20 changes: 18 additions & 2 deletions app/code/Magento/Tax/Model/Quote/GrandTotalDetails.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,11 @@ class GrandTotalDetails
*/
protected $taxConfig;

/**
* @var \Magento\Quote\Model\Quote\Address\Total\Tax
*/
protected $taxTotal;

/**
* @param \Magento\Tax\Api\Data\GrandTotalDetailsInterfaceFactory $detailsFactory
* @param \Magento\Tax\Api\Data\GrandTotalRatesInterfaceFactory $ratesFactory
Expand All @@ -46,12 +51,14 @@ public function __construct(
\Magento\Tax\Api\Data\GrandTotalRatesInterfaceFactory $ratesFactory,
\Magento\Framework\Api\ExtensionAttributesFactory $extensionFactory,
\Magento\Tax\Model\Config $taxConfig,
\Magento\Quote\Model\Quote\Address\Total\Tax $taxTotal,
\Magento\Quote\Model\QuoteRepository $quoteRepository
) {
$this->detailsFactory = $detailsFactory;
$this->ratesFactory = $ratesFactory;
$this->extensionFactory = $extensionFactory;
$this->taxConfig = $taxConfig;
$this->taxTotal = $taxTotal;
$this->quoteRepository = $quoteRepository;
}

Expand Down Expand Up @@ -83,11 +90,20 @@ public function aroundGet(CartTotalRepository $subject, \Closure $proceed, $cart
{
$result = $proceed($cartId);
$quote = $this->quoteRepository->getActive($cartId);
$taxes = $quote->getShippingAddress()->getAppliedTaxes();
$totals = $quote->getTotals();

if (!array_key_exists('tax', $totals)) {
return $result;
}

$taxes = $totals['tax']->getData();
if (!array_key_exists('full_info', $taxes)) {
return $result;
}

$detailsId = 1;
$finalData = [];
foreach ($taxes as $info) {
foreach ($taxes['full_info'] as $info) {
if ((array_key_exists('hidden', $info) && $info['hidden'])
|| ($info['amount'] == 0 && $this->taxConfig->displayCartZeroTax())
) {
Expand Down

0 comments on commit bf6516d

Please sign in to comment.