Skip to content

Commit

Permalink
Release 4.0.1
Browse files Browse the repository at this point in the history
  • Loading branch information
edgaraswallee committed Jun 17, 2021
1 parent 0c45256 commit f6811b0
Show file tree
Hide file tree
Showing 9 changed files with 26 additions and 8 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# 4.0.1
- Fixed tax calculation for custom products

# 4.0.0
- Support for Shopware 6.4

Expand Down
3 changes: 3 additions & 0 deletions CHANGELOG_de-DE.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# 4.0.1
- Feste Steuerberechnung für kundenspezifische Produkte

# 4.0.0
- Unterstützung für Shopware 6.4

Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ tail -f var/log/postfinancecheckout_payment*.log

## Documentation

[Documentation](https://plugin-documentation.postfinance-checkout.ch/pfpayments/shopware-6/4.0.0/docs/en/documentation.html)
[Documentation](https://plugin-documentation.postfinance-checkout.ch/pfpayments/shopware-6/4.0.1/docs/en/documentation.html)

## License

Expand Down
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -54,5 +54,5 @@
"postfinancecheckout/sdk": "3.0.0"
},
"type": "shopware-platform-plugin",
"version": "4.0.0"
"version": "4.0.1"
}
2 changes: 1 addition & 1 deletion docs/en/documentation.html
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ <h2>Documentation</h2> </div>
</a>
</li>
<li>
<a href="https://github.com/pfpayments/shopware-6/releases/tag/4.0.0/">
<a href="https://github.com/pfpayments/shopware-6/releases/tag/4.0.1/">
Source
</a>
</li>
Expand Down
19 changes: 17 additions & 2 deletions src/Core/Util/Payload/CustomProducts/CustomProductsLineItems.php
Original file line number Diff line number Diff line change
Expand Up @@ -85,8 +85,10 @@ public function getCustomProductLineItemAttribute(OrderLineItemEntity $shopLineI
public function getCustomProductTaxes(CalculatedTaxCollection $calculatedTaxes, string $title, $amount)
{
$taxes = [];
$sumOfTaxes = $this->getSumOfTaxes($calculatedTaxes);

foreach ($calculatedTaxes as $calculatedTax) {
$taxRate = ($calculatedTax->getTax() * 100) / $amount;
$taxRate = ($calculatedTax->getTax() * 100) / ($amount - $sumOfTaxes);
$taxRate = (float) number_format($taxRate, 8, '.', '');
$tax = (new TaxCreate())
->setRate($taxRate)
Expand All @@ -103,7 +105,6 @@ public function getCustomProductTaxes(CalculatedTaxCollection $calculatedTaxes,
return $taxes;
}


/**
* Extract Custom Product Attribute value
*
Expand Down Expand Up @@ -137,4 +138,18 @@ protected function extractValueFromPayload(OrderLineItemEntity $option): ?string

return $value;
}

/**
* @param CalculatedTaxCollection $calculatedTaxes
* @return float
*/
private function getSumOfTaxes(CalculatedTaxCollection $calculatedTaxes): float
{
$sumOfTaxes = 0;
foreach ($calculatedTaxes as $calculatedTax) {
$sumOfTaxes += $calculatedTax->getTax();
}

return $sumOfTaxes;
}
}

This file was deleted.

This file was deleted.

This file was deleted.

0 comments on commit f6811b0

Please sign in to comment.