Skip to content

Commit

Permalink
Unify service definitions of line items converters
Browse files Browse the repository at this point in the history
  • Loading branch information
GSadee committed Mar 17, 2021
1 parent 7b57b60 commit a33a141
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 8 deletions.
8 changes: 7 additions & 1 deletion UPGRADE.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,16 @@
1. The method `Sylius\RefundPlugin\Provider\TaxRateProviderInterface` has been changed
from `provide(OrderItemUnitInterface $orderItemUnit): ?string` to `provide(AdjustableInterface $adjustable): ?string`.

1. Service definition for `Sylius\RefundPlugin\Converter\ShipmentLineItemsConverter` has been changed from
`Sylius\RefundPlugin\Converter\ShipmentLineItemsConverterInterface` to `Sylius\RefundPlugin\Converter\ShipmentLineItemsConverter`

1. `Sylius\RefundPlugin\Converter\LineItemsConverter` has been changed to `Sylius\RefundPlugin\Converter\OrderItemUnitLineItemsConverter`
and its service definition has been changed from `Sylius\RefundPlugin\Converter\LineItemsConverterInterface` to `Sylius\RefundPlugin\Converter\OrderItemUnitLineItemsConverter`

1. The suffix `Exception` has been removed from classes:
* `Sylius\RefundPlugin\Exception\InvalidRefundAmountException`
* `Sylius\RefundPlugin\Exception\OrderNotAvailableForRefundingException`
* `Sylius\RefundPlugin\Exception\UnitAlreadyRefundedException`
* `Sylius\RefundPlugin\Exception\UnitAlreadyRefundedException`

### UPGRADE FROM 1.0.0-RC.5 TO 1.0.0-RC.6

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
use Sylius\RefundPlugin\Provider\TaxRateProviderInterface;
use Webmozart\Assert\Assert;

final class LineItemsConverter implements LineItemsConverterInterface
final class OrderItemUnitLineItemsConverter implements LineItemsConverterInterface
{
/** @var RepositoryInterface */
private $orderItemUnitRepository;
Expand Down
4 changes: 2 additions & 2 deletions src/Converter/ShipmentLineItemsConverter.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,13 +37,13 @@ public function convert(array $units): array

/** @var ShipmentRefund $shipmentRefund */
foreach ($units as $shipmentRefund) {
$lineItems[] = $this->convertUnitRefundToLineItem($shipmentRefund);
$lineItems[] = $this->convertShipmentRefundToLineItem($shipmentRefund);
}

return $lineItems;
}

private function convertUnitRefundToLineItem(ShipmentRefund $shipmentRefund): LineItemInterface
private function convertShipmentRefundToLineItem(ShipmentRefund $shipmentRefund): LineItemInterface
{
/** @var AdjustmentInterface|null $shippingAdjustment */
$shippingAdjustment = $this
Expand Down
4 changes: 2 additions & 2 deletions src/Resources/config/services/converter.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,12 @@
<services>
<defaults autowire="false" autoconfigure="false" public="true" />

<service id="Sylius\RefundPlugin\Converter\LineItemsConverterInterface" class="Sylius\RefundPlugin\Converter\LineItemsConverter">
<service id="Sylius\RefundPlugin\Converter\OrderItemUnitLineItemsConverter">
<argument type="service" id="sylius.repository.order_item_unit" />
<argument type="service" id="Sylius\RefundPlugin\Provider\TaxRateProviderInterface" />
</service>

<service id="Sylius\RefundPlugin\Converter\ShipmentLineItemsConverterInterface" class="Sylius\RefundPlugin\Converter\ShipmentLineItemsConverter">
<service id="Sylius\RefundPlugin\Converter\ShipmentLineItemsConverter">
<argument type="service" id="sylius.repository.adjustment" />
<argument type="service" id="Sylius\RefundPlugin\Provider\TaxRateProviderInterface" />
</service>
Expand Down
4 changes: 2 additions & 2 deletions src/Resources/config/services/generator.xml
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@
</service>

<service id="Sylius\RefundPlugin\Generator\CreditMemoGenerator">
<argument type="service" id="Sylius\RefundPlugin\Converter\LineItemsConverterInterface" />
<argument type="service" id="Sylius\RefundPlugin\Converter\ShipmentLineItemsConverterInterface" />
<argument type="service" id="Sylius\RefundPlugin\Converter\OrderItemUnitLineItemsConverter" />
<argument type="service" id="Sylius\RefundPlugin\Converter\ShipmentLineItemsConverter" />
<argument type="service" id="Sylius\RefundPlugin\Generator\TaxItemsGeneratorInterface" />
<argument type="service" id="Sylius\RefundPlugin\Generator\SequentialNumberGenerator" />
<argument type="service" id="Sylius\RefundPlugin\Provider\CurrentDateTimeImmutableProviderInterface" />
Expand Down

0 comments on commit a33a141

Please sign in to comment.