Skip to content

Commit

Permalink
minor CS fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
AdamKasp committed Mar 13, 2021
1 parent 23979c7 commit 36f832d
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 9 deletions.
2 changes: 0 additions & 2 deletions spec/Provider/TaxRateAmountProviderSpec.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
use Sylius\RefundPlugin\Entity\AdjustmentInterface;
use Sylius\RefundPlugin\Provider\TaxRateAmountProviderInterface;


final class TaxRateAmountProviderSpec extends ObjectBehavior
{
function it_implements_tax_rate_provider_interface(): void
Expand All @@ -23,7 +22,6 @@ function it_provides_a_tax_rate_amount_from_tax_adjustment(AdjustmentInterface $
$this->provide($adjustment)->shouldReturn(0.20);
}


function it_throws_exception_if_order_item_unit_has_more_than_1_tax_adjustment(AdjustmentInterface $adjustment): void
{
$adjustment->getDetails()->willReturn(['detail' => 'detail']);
Expand Down
2 changes: 0 additions & 2 deletions spec/Provider/TaxRateProviderSpec.php
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,6 @@ function it_returns_null_if_there_is_no_tax_adjustment(OrderItemUnitInterface $o
function it_returns_null_if_there_is_no_adjustment_with_details_with_tax_rate_amount(
OrderItemUnitInterface $orderItemUnit,
AdjustmentInterface $taxAdjustment

): void {
$orderItemUnit
->getAdjustments(AdjustmentInterface::TAX_ADJUSTMENT)
Expand All @@ -60,7 +59,6 @@ function it_throws_exception_if_order_item_unit_has_more_than_1_tax_adjustment(
OrderItemUnitInterface $orderItemUnit,
AdjustmentInterface $firstTaxAdjustment,
AdjustmentInterface $secondTaxAdjustment

): void {
$orderItemUnit
->getAdjustments(AdjustmentInterface::TAX_ADJUSTMENT)
Expand Down
9 changes: 6 additions & 3 deletions src/Converter/ShipmentLineItemsConverter.php
Original file line number Diff line number Diff line change
Expand Up @@ -59,12 +59,15 @@ private function convertUnitRefundToLineItem(ShipmentRefund $shipmentRefund): Li

$grossValue = $shipmentRefund->total();

$taxAdjustment = $shipment->getAdjustments(AdjustmentInterface::TAX_ADJUSTMENT)->first();
$taxAdjustments = $shipment->getAdjustments(AdjustmentInterface::TAX_ADJUSTMENT);

$taxAdjustmentAmount = 0;
if (count($taxAdjustments) > 0) {
$taxAdjustmentAmount = $this->taxRateAmountProvider->provide($taxAdjustments->first());
}

$taxAdjustmentAmount = $this->taxRateAmountProvider->provide($taxAdjustment);
$taxRate = $taxAdjustmentAmount * 100 . '%';
$taxAmount = (int) ($grossValue * $taxAdjustmentAmount);

$netValue = $grossValue - $taxAmount;

return new LineItem(
Expand Down
2 changes: 0 additions & 2 deletions tests/Behat/Context/Ui/CreditMemoContext.php
Original file line number Diff line number Diff line change
Expand Up @@ -226,7 +226,6 @@ public function itsTotalShouldBeInCurrency(string $total, string $currencyCode):
public function itsNetTotalShouldBe(string $total): void
{
Assert::same($this->creditMemoDetailsPage->getNetTotal(), $total);

}

/**
Expand All @@ -235,7 +234,6 @@ public function itsNetTotalShouldBe(string $total): void
public function itsTaxTotalShouldBe(string $total): void
{
Assert::same($this->creditMemoDetailsPage->getTaxTotal(), $total);

}

/**
Expand Down

0 comments on commit 36f832d

Please sign in to comment.