@@ -182,9 +182,10 @@ private function calculateAllowedTax(Creditmemo $creditMemo): float
182
182
{
183
183
$ invoice = $ creditMemo ->getInvoice ();
184
184
$ order = $ creditMemo ->getOrder ();
185
- $ amount = $ invoice !== null ? $ invoice ->getTaxAmount () : $ order ->getTaxInvoiced ();
185
+ $ amount = $ invoice !== null ? $ invoice ->getTaxAmount ()
186
+ : $ order ->getTaxInvoiced () - $ order ->getTaxRefunded ();
186
187
187
- return (float ) $ amount - $ order -> getTaxRefunded () - $ creditMemo ->getTaxAmount ();
188
+ return (float ) $ amount - $ creditMemo ->getTaxAmount ();
188
189
}
189
190
190
191
/**
@@ -197,9 +198,10 @@ private function calculateAllowedBaseTax(Creditmemo $creditMemo): float
197
198
{
198
199
$ invoice = $ creditMemo ->getInvoice ();
199
200
$ order = $ creditMemo ->getOrder ();
200
- $ amount = $ invoice !== null ? $ invoice ->getBaseTaxAmount () : $ order ->getBaseTaxInvoiced ();
201
+ $ amount = $ invoice !== null ? $ invoice ->getBaseTaxAmount ()
202
+ : $ order ->getBaseTaxInvoiced () - $ order ->getBaseTaxRefunded ();
201
203
202
- return (float ) $ amount - $ order -> getBaseTaxRefunded () - $ creditMemo ->getBaseTaxAmount ();
204
+ return (float ) $ amount - $ creditMemo ->getBaseTaxAmount ();
203
205
}
204
206
205
207
/**
@@ -218,12 +220,12 @@ private function calculateAllowedDiscountTaxCompensation(Creditmemo $creditMemo)
218
220
+ $ invoice ->getShippingDiscountTaxCompensationAmount ();
219
221
} else {
220
222
$ amount = $ order ->getDiscountTaxCompensationInvoiced ()
221
- + $ order ->getShippingDiscountTaxCompensationAmount ();
223
+ + $ order ->getShippingDiscountTaxCompensationAmount ()
224
+ - $ order ->getDiscountTaxCompensationRefunded ()
225
+ - $ order ->getShippingDiscountTaxCompensationRefunded ();
222
226
}
223
227
224
228
return (float ) $ amount
225
- - $ order ->getDiscountTaxCompensationRefunded ()
226
- - $ order ->getShippingDiscountTaxCompensationRefunded ()
227
229
- $ creditMemo ->getDiscountTaxCompensationAmount ()
228
230
- $ creditMemo ->getShippingDiscountTaxCompensationAmount ();
229
231
}
@@ -244,12 +246,12 @@ private function calculateAllowedBaseDiscountTaxCompensation(Creditmemo $creditM
244
246
+ $ invoice ->getBaseShippingDiscountTaxCompensationAmnt ();
245
247
} else {
246
248
$ amount = $ order ->getBaseDiscountTaxCompensationInvoiced ()
247
- + $ order ->getBaseShippingDiscountTaxCompensationAmnt ();
249
+ + $ order ->getBaseShippingDiscountTaxCompensationAmnt ()
250
+ - $ order ->getBaseDiscountTaxCompensationRefunded ()
251
+ - $ order ->getBaseShippingDiscountTaxCompensationRefunded ();
248
252
}
249
253
250
254
return (float ) $ amount
251
- - $ order ->getBaseDiscountTaxCompensationRefunded ()
252
- - $ order ->getBaseShippingDiscountTaxCompensationRefunded ()
253
255
- $ creditMemo ->getBaseShippingDiscountTaxCompensationAmnt ()
254
256
- $ creditMemo ->getBaseDiscountTaxCompensationAmount ();
255
257
}
0 commit comments