Skip to content

Commit 1ad0e32

Browse files
committed
MC-20244: Pricing :: FPT calculation
- removing display settings form resolver - fixing a bug with the old weee schema
1 parent a9dcf13 commit 1ad0e32

File tree

3 files changed

+7
-10
lines changed

3 files changed

+7
-10
lines changed

app/code/Magento/WeeeGraphQl/Model/Resolver/FptResolver.php

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
use Magento\Framework\Exception\LocalizedException;
1515
use Magento\Tax\Helper\Data as TaxHelper;
1616
use Magento\Store\Api\Data\StoreInterface;
17+
use Magento\Tax\Model\Config;
1718

1819
class FptResolver implements ResolverInterface
1920
{
@@ -58,21 +59,15 @@ public function resolve(
5859
/** @var StoreInterface $store */
5960
$store = $context->getExtensionAttributes()->getStore();
6061

61-
62-
if (!$this->weeeHelper->isEnabled($store)) {
63-
return $fptArray;
64-
}
65-
66-
67-
if ($this->weeeHelper->isDisplayInclDesc($store) || $this->weeeHelper->isDisplayExclDescIncl($store)) {
62+
if ($this->weeeHelper->isEnabled($store)) {
6863
$attributes = $this->weeeHelper->getProductWeeeAttributesForDisplay($product);
6964
foreach ($attributes as $attribute) {
7065
$displayInclTaxes = $this->taxHelper->getPriceDisplayType($store);
7166
$amount = $attribute->getData('amount');
7267
//add display mode for WEE to not return WEE if excluded
73-
if ($displayInclTaxes === 1) {
68+
if ($displayInclTaxes === Config::DISPLAY_TYPE_EXCLUDING_TAX) {
7469
$amount = $attribute->getData('amount_excl_tax');
75-
} elseif ($displayInclTaxes === 2) {
70+
} elseif ($displayInclTaxes === Config::DISPLAY_TYPE_INCLUDING_TAX) {
7671
$amount = $attribute->getData('amount_excl_tax') + $attribute->getData('tax_amount');
7772
}
7873
$fptArray[] = [
@@ -84,6 +79,7 @@ public function resolve(
8479
];
8580
}
8681
}
82+
8783
return $fptArray;
8884
}
8985
}

app/code/Magento/WeeeGraphQl/composer.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
"magento/framework": "*"
88
},
99
"suggest": {
10+
"magento/module-tax": "*",
1011
"magento/module-weee": "*",
1112
"magento/module-catalog-graph-ql": "*"
1213
},

app/code/Magento/WeeeGraphQl/etc/schema.graphqls

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33

44
enum PriceAdjustmentCodesEnum {
55
WEEE
6-
WEEETAX
6+
WEEE_TAX
77
}
88

99
type ProductPrice {

0 commit comments

Comments
 (0)