Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
64 commits
Select commit Hold shift + click to select a range
202b339
deprecate tax calculation methods and rely on Magento_Weee module to …
RokPopov Jun 7, 2024
3852ec3
Merge branch 'main' into ECP-9225
RokPopov Jul 3, 2024
77d8c6b
fix unit tests
RokPopov Jul 4, 2024
07d8bdb
Merge branch 'main' into ECP-9225
RokPopov Jul 4, 2024
2f0447e
set magento_weee version
RokPopov Jul 5, 2024
0931f1e
fix open invoice unit tests
RokPopov Jul 5, 2024
395709e
add area code to magento installation script for CI/CD pipeline
RokPopov Jul 5, 2024
10c3ebe
fix code sniffer issue
RokPopov Jul 5, 2024
2285397
add verbose output to debug pipeline workflows
RokPopov Jul 5, 2024
d837f56
capture errors directly
RokPopov Jul 5, 2024
39425f8
add verbose output to plugin installation
RokPopov Jul 5, 2024
f2e7d34
debugging makefile
RokPopov Jul 5, 2024
27a2cdd
output stack trace directly
RokPopov Jul 5, 2024
151e76c
verbose output in setup:upgrade command
RokPopov Jul 5, 2024
c8d622b
debug makefile
RokPopov Jul 5, 2024
576051f
debug 2 makefile
RokPopov Jul 5, 2024
40cfa44
more verbose outputs
RokPopov Jul 5, 2024
2f1d264
run n98-magerun command as www-data user
RokPopov Jul 5, 2024
0b2c12e
debug 3
RokPopov Jul 5, 2024
5498b2d
debug 4
RokPopov Jul 5, 2024
6a9231f
debug 5
RokPopov Jul 5, 2024
f629ad7
debug 6
RokPopov Jul 5, 2024
2013f6f
debug 6
RokPopov Jul 5, 2024
ff84c91
add area code to EnablePaymentMethodsCommand
RokPopov Jul 9, 2024
d0a6b57
Merge branch 'main' into ECP-9225
RokPopov Jul 9, 2024
d3f3b9e
fix enable payment methods command tests
RokPopov Jul 9, 2024
a3574ca
set area when calling cli upgrade script
RokPopov Jul 9, 2024
12b96f8
try to fix area issue in ci/cd pipeline
RokPopov Jul 9, 2024
aeaec39
Merge branch 'main' into ECP-9225
RokPopov Jul 10, 2024
80c6557
CI/CD debugging
RokPopov Jul 10, 2024
ba31221
remove area code setup command from magento installation
RokPopov Jul 10, 2024
d40d756
add state to custom webhook processor command, fix unit test
RokPopov Jul 10, 2024
02f3ba7
debug pipeline
RokPopov Jul 10, 2024
94707a7
fix unit test
RokPopov Jul 10, 2024
509d182
debug functional tests
RokPopov Jul 10, 2024
ba3ffae
add custom console command to set the area code and include it before…
RokPopov Jul 10, 2024
4ef944f
replicate restapi workflow magento installation into mftf workflow
RokPopov Jul 11, 2024
4407b74
remove redundant console command class and change steps in mftf workf…
RokPopov Jul 11, 2024
98a0bc5
remove unused console command from di.xml
RokPopov Jul 11, 2024
1064653
change order of processes in mftf.yml
RokPopov Jul 11, 2024
c18aa54
flush the cache before running install
RokPopov Jul 11, 2024
a84e7f5
copy rest api tests into mftf tests to check if install step will fail
RokPopov Jul 11, 2024
2c75b48
remove mftf specific container to check the result of the workflow
RokPopov Jul 11, 2024
7a903c8
mirror restapi tests completely
RokPopov Jul 12, 2024
80cf3c5
execute on pull request on main
RokPopov Jul 12, 2024
4ebd605
add mftf container
RokPopov Jul 12, 2024
7a3aa70
enable mftf tests to run
RokPopov Jul 12, 2024
0b4c63e
temporarily comment out mftf part of the workflow
RokPopov Jul 12, 2024
835634e
enable mftf part again
RokPopov Jul 12, 2024
8a53218
Merge branch 'main' into ECP-9225
RokPopov Jul 12, 2024
f0689f3
Merge branch 'main' into ECP-9225
candemiralp Jan 8, 2025
417a3cb
[ECP-9225] Revert workflow related changes
candemiralp Jan 8, 2025
66da533
[ECP-9225] Use Magento_Tax module instead of Magento_Weee
candemiralp Jan 8, 2025
82d7c4f
[ECP-9225] Replace Weee module import
candemiralp Jan 8, 2025
1ef5b68
[ECP-9225] Use factory to load Renderer class
candemiralp Jan 8, 2025
48d37c9
[ECP-9225] Fix unit test
candemiralp Jan 8, 2025
ce71f32
[ECP-9225] Fix unit test
candemiralp Jan 8, 2025
68dd837
[ECP-9225] Remove unused variable
candemiralp Jan 8, 2025
a6dd6ea
[ECP-9225] Fix unit tests
candemiralp Jan 8, 2025
1627983
Merge branch 'main' into ECP-9225
candemiralp Jan 8, 2025
4904f41
Merge branch 'main' into ECP-9225
candemiralp Feb 11, 2025
3089f1f
Merge branch 'main' into ECP-9225
candemiralp Feb 14, 2025
dee95cb
Merge branch 'main' into ECP-9225
candemiralp Feb 17, 2025
9151334
Merge branch 'main' into ECP-9225
candemiralp Feb 18, 2025
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
46 changes: 21 additions & 25 deletions Helper/ChargedCurrency.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
use Magento\Sales\Model\Order;
use Magento\Sales\Model\Order\Invoice;
use Magento\Sales\Api\Data\CreditmemoItemInterface;
use Magento\Weee\Block\Adminhtml\Items\Price\Renderer;

class ChargedCurrency
{
Expand All @@ -31,10 +32,17 @@ class ChargedCurrency
*/
private $config;

/**
* @var Renderer
*/
private $weeeRenderer;

public function __construct(
Config $config
Config $config,
Renderer $weeeRenderer
) {
$this->config = $config;
$this->weeeRenderer = $weeeRenderer;
}

/**
Expand Down Expand Up @@ -91,8 +99,7 @@ public function getQuoteItemAmountCurrency(Quote\Item $item): AdyenAmountCurrenc
$item->getBaseDiscountAmount() / $item->getQty(),
$item->getBaseTaxAmount() / $item->getQty(),
null,
$item->getBaseRowTotalInclTax() / $item->getQty(),
$item->getBaseDiscountTaxCompensationAmount() / $item->getQty()
$this->weeeRenderer->getBaseTotalAmount($item)
);
}

Expand All @@ -102,8 +109,7 @@ public function getQuoteItemAmountCurrency(Quote\Item $item): AdyenAmountCurrenc
$item->getDiscountAmount() / $item->getQty(),
$item->getTaxAmount() / $item->getQty(),
null,
$item->getRowTotalInclTax() / $item->getQty(),
$item->getDiscountTaxCompensationAmount() / $item->getQty()
$this->weeeRenderer->getTotalAmount($item)
);
}

Expand All @@ -118,8 +124,7 @@ public function getInvoiceItemAmountCurrency(Invoice\Item $item): AdyenAmountCur
$item->getBaseDiscountAmount() / $item->getQty(),
$item->getBaseTaxAmount() / $item->getQty(),
null,
$item->getBaseRowTotalInclTax() / $item->getQty(),
$item->getBaseDiscountTaxCompensationAmount() / $item->getQty()
$this->weeeRenderer->getBaseTotalAmount($item)
);
}

Expand All @@ -129,8 +134,7 @@ public function getInvoiceItemAmountCurrency(Invoice\Item $item): AdyenAmountCur
$item->getDiscountAmount() / $item->getQty(),
$item->getTaxAmount() / $item->getQty(),
null,
$item->getRowTotalInclTax() / $item->getQty(),
$item->getDiscountTaxCompensationAmount() / $item->getQty()
$this->weeeRenderer->getTotalAmount($item)
);
}

Expand Down Expand Up @@ -188,8 +192,7 @@ public function getCreditMemoShippingAmountCurrency(CreditmemoInterface $creditM
null,
$creditMemo->getBaseShippingTaxAmount(),
null,
$creditMemo->getBaseShippingInclTax(),
$creditMemo->getBaseShippingDiscountTaxCompensationAmnt()
$creditMemo->getBaseShippingInclTax()
);
}
return new AdyenAmountCurrency(
Expand All @@ -198,8 +201,7 @@ public function getCreditMemoShippingAmountCurrency(CreditmemoInterface $creditM
null,
$creditMemo->getShippingTaxAmount(),
null,
$creditMemo->getShippingInclTax(),
$creditMemo->getShippingDiscountTaxCompensationAmount()
$creditMemo->getShippingInclTax()
);
}

Expand All @@ -214,8 +216,7 @@ public function getCreditMemoItemAmountCurrency(CreditmemoItemInterface $item):
$item->getBaseDiscountAmount() / $item->getQty(),
$item->getBaseTaxAmount() / $item->getQty(),
null,
$item->getBaseRowTotalInclTax() / $item->getQty(),
$item->getBaseDiscountTaxCompensationAmount() / $item->getQty()
$this->weeeRenderer->getBaseTotalAmount($item)
);
}
return new AdyenAmountCurrency(
Expand All @@ -224,8 +225,7 @@ public function getCreditMemoItemAmountCurrency(CreditmemoItemInterface $item):
$item->getDiscountAmount() / $item->getQty(),
$item->getTaxAmount() / $item->getQty(),
null,
$item->getRowTotalInclTax() / $item->getQty(),
$item->getDiscountTaxCompensationAmount() / $item->getQty()
$this->weeeRenderer->getTotalAmount($item)
);
}

Expand All @@ -240,8 +240,7 @@ public function getQuoteShippingAmountCurrency(Quote $quote): AdyenAmountCurrenc
$quote->getShippingAddress()->getBaseShippingDiscountAmount(),
$quote->getShippingAddress()->getBaseShippingTaxAmount(),
null,
$quote->getShippingAddress()->getBaseShippingInclTax(),
$quote->getShippingAddress()->getBaseShippingDiscountTaxCompensationAmnt()
$quote->getShippingAddress()->getBaseShippingInclTax()
);
}

Expand All @@ -251,8 +250,7 @@ public function getQuoteShippingAmountCurrency(Quote $quote): AdyenAmountCurrenc
$quote->getShippingAddress()->getShippingDiscountAmount(),
$quote->getShippingAddress()->getShippingTaxAmount(),
null,
$quote->getShippingAddress()->getShippingInclTax(),
$quote->getShippingAddress()->getShippingDiscountTaxCompensationAmount()
$quote->getShippingAddress()->getShippingInclTax()
);
}

Expand All @@ -267,8 +265,7 @@ public function getInvoiceShippingAmountCurrency(Invoice $invoice): AdyenAmountC
null,
$invoice->getBaseShippingTaxAmount(),
null,
$invoice->getBaseShippingInclTax(),
$invoice->getBaseShippingDiscountTaxCompensationAmnt()
$invoice->getBaseShippingInclTax()
);
}

Expand All @@ -278,8 +275,7 @@ public function getInvoiceShippingAmountCurrency(Invoice $invoice): AdyenAmountC
null,
$invoice->getShippingTaxAmount(),
null,
$invoice->getShippingInclTax(),
$invoice->getShippingDiscountTaxCompensationAmount()
$invoice->getShippingInclTax()
);
}

Expand Down
25 changes: 6 additions & 19 deletions Helper/OpenInvoice.php
Original file line number Diff line number Diff line change
Expand Up @@ -142,42 +142,28 @@ protected function formatShippingLineItem(
): array {
$currency = $shippingAmount->getCurrencyCode();

$formattedPriceExcludingTax = $this->adyenHelper->formatAmount(
$shippingAmount->getAmountWithDiscount(),
$currency
);
$formattedPriceIncludingTax = $this->adyenHelper->formatAmount(
$shippingAmount->getAmountIncludingTaxWithDiscount(),
$shippingAmount->getAmountIncludingTax(),
$currency
);

$formattedTaxAmount = $this->adyenHelper->formatAmount($shippingAmount->getTaxAmount(), $currency);
$formattedTaxPercentage = $this->adyenHelper->formatAmount(
$shippingAmount->getCalculatedTaxPercentage(),
$currency
);

return [
'id' => 'shippingCost',
'amountExcludingTax' => $formattedPriceExcludingTax,
'amountIncludingTax' => $formattedPriceIncludingTax,
'taxAmount' => $formattedTaxAmount,
'description' => $shippingDescription,
'quantity' => 1,
'taxPercentage' => $formattedTaxPercentage
'quantity' => 1
];
}

protected function formatLineItem(AdyenAmountCurrency $itemAmountCurrency, $item, $qty = null): array
{
$currency = $itemAmountCurrency->getCurrencyCode();

$formattedPriceExcludingTax = $this->adyenHelper->formatAmount(
$itemAmountCurrency->getAmountWithDiscount(),
$currency
);
$formattedPriceIncludingTax = $this->adyenHelper->formatAmount(
$itemAmountCurrency->getAmountIncludingTaxWithDiscount(),
$itemAmountCurrency->getAmountIncludingTax(),
$currency
);

Expand All @@ -188,7 +174,6 @@ protected function formatLineItem(AdyenAmountCurrency $itemAmountCurrency, $item

return [
'id' => $product->getId(),
'amountExcludingTax' => $formattedPriceExcludingTax,
'amountIncludingTax' => $formattedPriceIncludingTax,
'taxAmount' => $formattedTaxAmount,
'description' => $item->getName(),
Expand All @@ -199,6 +184,9 @@ protected function formatLineItem(AdyenAmountCurrency $itemAmountCurrency, $item
];
}

/**
* @deprecated
*/
protected function formatInvoiceDiscount(
mixed $discountAmount, $shippingDiscountAmount, AdyenAmountCurrency $itemAmountCurrency
): array
Expand All @@ -210,7 +198,6 @@ protected function formatInvoiceDiscount(

return [
'id' => 'Discount',
'amountExcludingTax' => $itemAmount,
'amountIncludingTax' => $itemAmount,
'taxAmount' => 0,
'description' => $description,
Expand Down
15 changes: 15 additions & 0 deletions Model/AdyenAmountCurrency.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,9 @@ class AdyenAmountCurrency

protected $amountDue;

/**
* @deprecated
*/
protected $discountTaxCompensationAmount;

public function __construct(
Expand Down Expand Up @@ -75,11 +78,17 @@ public function getAmountDue()
return $this->amountDue;
}

/**
* @deprecated
*/
public function getDiscountTaxCompensationAmount()
{
return $this->discountTaxCompensationAmount;
}

/**
* @deprecated
*/
public function getAmountIncludingTaxWithDiscount()
{
if ($this->getDiscountTaxCompensationAmount() > 0) {
Expand All @@ -90,11 +99,17 @@ public function getAmountIncludingTaxWithDiscount()
}
}

/**
* @deprecated
*/
public function getAmountWithDiscount()
{
return $this->getAmount() - $this->getDiscountAmount() + $this->getDiscountTaxCompensationAmount();
}

/**
* @deprecated
*/
public function getCalculatedTaxPercentage()
{
if ($this->getAmountWithDiscount() > 0) {
Expand Down
1 change: 1 addition & 0 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
"magento/framework": ">=103.0.4",
"magento/module-vault": ">=101.2.4",
"magento/module-multishipping": ">=100.4.4",
"magento/module-weee": "*",
"ext-json": "*"
},
"require-dev": {
Expand Down
1 change: 1 addition & 0 deletions etc/module.xml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
<module name="Magento_AdminNotification"/>
<module name="Magento_Vault"/>
<module name="Magento_Multishipping"/>
<module name="Magento_Weee"/>
</sequence>
</module>
</config>