-
The return types of
Sylius\RefundPlugin\Entity\CustomerBillingDataInterface
method has been changed:+ public function getFirstName(): ?string; - public function getFirstName(): string; + public function getLastName(): ?string; - public function getLastName(): string; + public function getStreet(): ?string; - public function getStreet(): string; + public function getPostcode(): ?string; - public function getPostcode(): string; + public function getCountryCode(): ?string; - public function getCountryCode(): string; + public function getCity(): ?string; - public function getCity(): string;
-
The return types of
Sylius\RefundPlugin\Entity\CreditMemoInterface
method has been changed:+ public function getNumber(): ?string; - public function getNumber(): string; + public function getOrder(): ?OrderInterface; - public function getOrder(): OrderInterface; + public function getCurrencyCode(): ?string; - public function getCurrencyCode(): string; + public function getLocaleCode(): ?string; - public function getLocaleCode(): string; + public function getChannel(): ?ChannelInterface; - public function getChannel(): ChannelInterface; + public function getComment(): ?string; - public function getComment(): string; + public function getIssuedAt(): ?\DateTimeImmutable; - public function getIssuedAt(): \DateTimeImmutable; + public function getFrom(): ?CustomerBillingDataInterface; - public function getFrom(): CustomerBillingDataInterface;
-
orderNumber
field onSylius\RefundPlugin\Entity\Refund
andSylius\RefundPlugin\Entity\RefundPayment
has been removed and replaced with relation toOrder
entity. -
Sylius\RefundPlugin\Entity\RefundInterface::getOrderNumber
function is left due to easier and smoother upgrades, but is also deprecated and will be removed in thev1.0.0
release. UseSylius\RefundPlugin\Entity\RefundInterface::getOrder
instead. -
Sylius\RefundPlugin\Entity\RefundPaymentInterface::getOrderNumber
function is left due to easier and smoother upgrades, but is also deprecated and will be removed in thev1.0.0
release. UseSylius\RefundPlugin\Entity\RefundPaymentInterface::getOrder
instead. -
Sylius\RefundPlugin\Creator\RefundCreator
takesSylius\Component\Core\Repository\OrderRepositoryInterface
as the 3rd argument. -
Sylius\RefundPlugin\ProcessManager\RefundPaymentProcessManager
takesSylius\Component\Core\Repository\OrderRepositoryInterface
as the 4th argument. -
Sylius\RefundPlugin\Provider\OrderRefundedTotalProviderInterface::invoke
takesOrderInterface $order
as an argument instead ofstring $orderNumber
-
Sylius\RefundPlugin\Factory\RefundPaymentFactory::createWithData
takesOrderInterface $order
as an argument instead ofstring $orderNumber
-
The constructor of
Sylius\RefundPlugin\Provider\DefaultRelatedPaymentIdProvider
has been removed. -
Constructor of
Sylius\RefundPlugin\Entity\CustomerBillingData
has been removed and nowCustomerBillingData
entity is created bySylius\RefundPlugin\Factory\CustomerBillingDataFactory
. -
Constructor of
Sylius\RefundPlugin\Entity\ShopBillingData
has been removed and nowShopBillingData
entity is created bySylius\RefundPlugin\Factory\ShopBillingDataFactory
. -
The constructor of
Sylius\RefundPlugin\Generator\CreditMemoGenerator
has been changed:public function __construct( LineItemsConverterInterface $lineItemsConverter, LineItemsConverterInterface $shipmentLineItemsConverter, TaxItemsGeneratorInterface $taxItemsGenerator, CreditMemoFactoryInterface $creditMemoFactory, + CustomerBillingDataFactoryInterface $customerBillingDataFactory, + ShopBillingDataFactoryInterface $shopBillingDataFactory ) { ... }
-
The
id
method fromSylius\RefundPlugin\Entity\CustomerBillingData
has its return type removed:- public function id(): ?int; + public function id();
-
The getter methods of
Sylius\RefundPlugin\Entity\CustomerBillingData
are now deprecated and will be replaced with:- public function id(): ?int + public function getId() - public function firstName(): string + public function getFirstName(): string - public function lastName(): string + public function getLastName(): string - public function fullName(): string + public function getFullName(): string - public function street(): string + public function getStreet(): string - public function postcode(): string + public function getPostcode(): string - public function city(): string + public function getCity(): string - public function company(): ?string + public function getCompany(): ?string - public function provinceName(): ?string + public function getProvinceName(): ?string - public function provinceCode(): ?string + public function getProvinceCode(): ?string
-
sylius_refund_plugin.block_event_listener.account.order_show
andsylius_refund_plugin.block_event_listener.order_show.credit_memos
listeners have been replaced bysylius_ui
configuration -
Sylius\RefundPlugin\Factory\RefundPaymentFactoryInterface
andSylius\RefundPlugin\Factory\RefundPaymentFactory
service definitions have been removed and replaced by default resource factorysylius_refund.factory.refund_payment
-
The constructor of
Sylius\RefundPlugin\Factory\RefundPaymentFactory
has been changed:- public function __construct(PaymentMethodRepositoryInterface $paymentMethodRepository) + public function __construct(string $className) { - $this->paymentMethodRepository = $paymentMethodRepository; + $this->className = $className; }
-
The
createWithData
method ofSylius\RefundPlugin\Factory\RefundPaymentFactoryInterface
has been changed:public function createWithData( OrderInterface $order, int $amount, string $currencyCode, string $state, - int $paymentMethodId + PaymentMethodInterface $paymentMethod ): RefundPaymentInterface;
-
The definition of
Sylius\RefundPlugin\ProcessManager\RefundPaymentProcessManager
has been changed:<service id="Sylius\RefundPlugin\ProcessManager\RefundPaymentProcessManager"> <argument type="service" id="Sylius\RefundPlugin\StateResolver\OrderFullyRefundedStateResolverInterface" /> <argument type="service" id="Sylius\RefundPlugin\Provider\RelatedPaymentIdProviderInterface" /> - <argument type="service" id="Sylius\RefundPlugin\Factory\RefundPaymentFactoryInterface" /> + <argument type="service" id="sylius_refund.factory.refund_payment" /> <argument type="service" id="sylius.repository.order" /> + <argument type="service" id="sylius.repository.payment_method" /> <argument type="service" id="doctrine.orm.default_entity_manager" /> <argument type="service" id="sylius.event_bus" /> <tag name="sylius_refund.units_refunded.process_step" priority="50" /> </service>
-
The constructor of
Sylius\RefundPlugin\Creator\RefundUnitsCommandCreator
has been changed:- public function __construct(UnitRefundTotalCalculatorInterface $unitRefundTotalCalculator) + public function __construct(RefundUnitsConverterInterface $refundUnitsConverter) { - $this->unitRefundTotalCalculator = $unitRefundTotalCalculator; + $this->refundUnitsConverter = $refundUnitsConverter; }
-
The constructor of
Sylius\RefundPlugin\Twig\OrderRefundsExtension
has been changed:public function __construct( OrderRefundedTotalProviderInterface $orderRefundedTotalProvider, UnitRefundedTotalProviderInterface $unitRefundedTotalProvider, UnitRefundingAvailabilityCheckerInterface $unitRefundingAvailabilityChecker, OrderRepositoryInterface $orderRepository, RepositoryInterface $refundPaymentRepository RepositoryInterface $refundPaymentRepository, + RefundTypeFactoryInterface $refundTypeFactory ) { ... }
-
Return type on
getType
method ofSylius\RefundPlugin\Entity\Refund
andSylius\RefundPlugin\Entity\RefundInterface
has been changed fromRefundType
toRefundTypeInterface
-
Return type on
convertToPHPValue
method ofSylius\RefundPlugin\Entity\Type\RefundEnumType
has been changed fromRefundType
toRefundTypeInterface
-
We replaced
RefundType
withRefundTypeInterface
in the given list of classes:Sylius\RefundPlugin\Creator\RefundCreator
Sylius\RefundPlugin\Checker\UnitRefundingAvailabilityChecker
Sylius\RefundPlugin\Entity\Type\RefundEnumType
Sylius\RefundPlugin\Entity\Refund
Sylius\RefundPlugin\Factory\RefundFactory
Sylius\RefundPlugin\Provider\RemainingTotalProvider
Sylius\RefundPlugin\Provider\UnitRefundedTotalProvider
Sylius\RefundPlugin\Validator\RefundAmountValidator
-
Sylius\RefundPlugin\Model\RefundType
implementsSylius\RefundPlugin\Model\RefundTypeInterface
and constsORDER_ITEM_UNIT
andSHIPMENT
has been moved toRefundTypeInterface
-
Service
Sylius\RefundPlugin\Twig\OrderRefundsExtension
has been changed:<service id="Sylius\RefundPlugin\Twig\OrderRefundsExtension"> <argument type="service" id="Sylius\RefundPlugin\Provider\OrderRefundedTotalProviderInterface" /> <argument type="service" id="Sylius\RefundPlugin\Provider\UnitRefundedTotalProviderInterface" /> <argument type="service" id="Sylius\RefundPlugin\Checker\UnitRefundingAvailabilityCheckerInterface" /> <argument type="service" id="sylius.repository.order" /> <argument type="service" id="sylius_refund.repository.refund_payment" /> + <argument type="service" id="Sylius\RefundPlugin\Factory\RefundTypeFactoryInterface" /> <tag name="twig.extension"/> </service>
-
The constructor of
Sylius\RefundPlugin\Twig\OrderRefundsExtension
has been changed:public function __construct( OrderRefundedTotalProviderInterface $orderRefundedTotalProvider, UnitRefundedTotalProviderInterface $unitRefundedTotalProvider, UnitRefundingAvailabilityCheckerInterface $unitRefundingAvailabilityChecker, OrderRepositoryInterface $orderRepository, RepositoryInterface $refundPaymentRepository RepositoryInterface $refundPaymentRepository, + RefundTypeFactoryInterface $refundTypeFactory ) { ... }
-
Support for Sylius 1.8 has been dropped, upgrade your application to Sylius 1.9 or Sylius 1.10.
-
Remove usage of:
Sylius\RefundPlugin\Entity\AdjustmentInterface
Sylius\RefundPlugin\Entity\AdjustmentTrait
Sylius\RefundPlugin\Entity\ShipmentInterface
Sylius\RefundPlugin\Entity\ShipmentTrait
-
Delete removed migrations from the migrations table by running:
bin/console doctrine:migrations:version Sylius\\RefundPlugin\\Migrations\\Version20201208105207 --delete bin/console doctrine:migrations:version Sylius\\RefundPlugin\\Migrations\\Version20201130071338 --delete bin/console doctrine:migrations:version Sylius\\RefundPlugin\\Migrations\\Version20201204071301 --delete
-
Command bus
sylius_refund_plugin.command_bus
has been replaced withsylius.command_bus
. -
Event bus
sylius_refund_plugin.event_bus
has been replaced withsylius.event_bus
. -
Sylius\RefundPlugin\Grid\Filter\ChannelFilter
andSylius\RefundPlugin\Form\Type\ChannelFilterType
services have been removed and channel filter configuration in grid has been replaced by entity filter. -
Constructor of
Sylius\RefundPlugin\Entity\CreditMemo
has been removed and nowCreditMemo
entity is created bySylius\RefundPlugin\Factory\CreditMemoFactory
. -
The constructor of
Sylius\RefundPlugin\Generator\CreditMemoGenerator
has been changed:public function __construct( LineItemsConverterInterface $lineItemsConverter, LineItemsConverterInterface $shipmentLineItemsConverter, TaxItemsGeneratorInterface $taxItemsGenerator, - NumberGenerator $creditMemoNumberGenerator, - CurrentDateTimeImmutableProviderInterface $currentDateTimeImmutableProvider, - CreditMemoIdentifierGeneratorInterface $uuidCreditMemoIdentifierGenerator + CreditMemoFactoryInterface $creditMemoFactory ) { ... }
-
Post-units refunded process (containing credit memo and refund payment generation) was changed to synchronous step. Refund payment is therefore always generated after credit memo. Technical changes:
Sylius\RefundPlugin\ProcessManager\CreditMemoProcessManager
andSylius\RefundPlugin\ProcessManager\RefundPaymentProcessManager
no longer directly listen toSylius\RefundPlugin\Event\UnitsRefunded
event.Sylius\RefundPlugin\ProcessManager\UnitsRefundedProcessManager
uses them to facilitate post-units refunding process.- Their
__invoke
methods were replaced bySylius\RefundPlugin\ProcessManager\UnitsRefundedProcessStepInterface::next(UnitsRefunded $unitsRefunded)
.
-
Sylius\RefundPlugin\Generator\NumberGenerator
has been changed toSylius\RefundPlugin\Generator\CreditMemoNumberGeneratorInterface
and its method has been changed frompublic function generate(): string
topublic function generate(OrderInterface $order, \DateTimeInterface $issuedAt): string
. -
Service name and definition has been changed from
Sylius\RefundPlugin\Generator\SequentialNumberGenerator
toSylius\RefundPlugin\Generator\SequentialCreditMemoNumberGenerator
and its last argumentCurrentDateTimeImmutableProviderInterface $currentDateTimeImmutableProvider
has been removed from constructor.
-
The
fully_refunded
state and therefund
transition have been removed fromsylius_order
state machine. -
Sylius\RefundPlugin\Provider\LabelBasedTaxRateProvider
has been changed toSylius\RefundPlugin\Provider\TaxRateProvider
. -
The method
Sylius\RefundPlugin\Provider\TaxRateProviderInterface
has been changed fromprovide(OrderItemUnitInterface $orderItemUnit): ?string
toprovide(AdjustableInterface $adjustable): ?string
. -
The
TaxRateProviderInterface $taxRateProvider
has been added as the second argument in constructor ofSylius\RefundPlugin\Converter\ShipmentLineItemsConverter
-
Service definition for
Sylius\RefundPlugin\Converter\ShipmentLineItemsConverter
has been changed fromSylius\RefundPlugin\Converter\ShipmentLineItemsConverterInterface
toSylius\RefundPlugin\Converter\ShipmentLineItemsConverter
-
Sylius\RefundPlugin\Converter\LineItemsConverter
has been changed toSylius\RefundPlugin\Converter\OrderItemUnitLineItemsConverter
and its service definition has been changed fromSylius\RefundPlugin\Converter\LineItemsConverterInterface
toSylius\RefundPlugin\Converter\OrderItemUnitLineItemsConverter
-
The suffix
Exception
has been removed from classes:Sylius\RefundPlugin\Exception\InvalidRefundAmountException
Sylius\RefundPlugin\Exception\OrderNotAvailableForRefundingException
Sylius\RefundPlugin\Exception\UnitAlreadyRefundedException
- The
Version20201208105207.php
migration was added which extends existing adjustments with additional details (context). Depending on the type of adjustment, additionally defined information are:
- Taxation details (percentage and relation to tax rate)
- Shipping details (shipping relation)
- Taxation for shipping (combined details of percentage and shipping relation)
This data is fetched based on two assumptions:
- Order level taxes relates to shipping only (default Sylius behaviour)
- Tax rate name has not change since the time, the first order has been placed
If these are not true, please adjust migration accordingly to your need. To exclude following migration from execution run following code:
bin/console doctrine:migrations:version 'Sylius\RefundPlugin\Migrations\Version20201208105207' --add
- Add traits that enhance Adjustment and Shipment models from Sylius. These traits are not covered by the backward compatibility promise and it will be removed after update Sylius to 1.9. It is a duplication of a logic from Sylius to provide proper adjustments handling.
<?php
declare(strict_types=1);
namespace Tests\Sylius\RefundPlugin\Application\Entity;
use Doctrine\ORM\Mapping as ORM;
use Sylius\Component\Order\Model\Adjustment as BaseAdjustment;
use Sylius\RefundPlugin\Entity\AdjustmentInterface;
use Sylius\RefundPlugin\Entity\AdjustmentTrait;
/**
* @ORM\Entity()
* @ORM\Table(name="sylius_adjustment")
*/
class Adjustment extends BaseAdjustment implements AdjustmentInterface
{
use AdjustmentTrait;
}
<?php
declare(strict_types=1);
namespace Tests\Sylius\RefundPlugin\Application\Entity;
use Doctrine\ORM\Mapping as ORM;
use Doctrine\Common\Collections\ArrayCollection;
use Sylius\Component\Core\Model\Shipment as BaseShipment;
use Sylius\RefundPlugin\Entity\ShipmentInterface;
use Sylius\RefundPlugin\Entity\ShipmentTrait;
/**
* @ORM\Entity()
* @ORM\Table(name="sylius_shipment")
*/
class Shipment extends BaseShipment implements ShipmentInterface
{
use ShipmentTrait;
public function __construct()
{
parent::__construct();
/** @var ArrayCollection<array-key, BaseAdjustmentInterface> $this->adjustments */
$this->adjustments = new ArrayCollection();
}
}
-
Upgrade your application to Sylius 1.8.
-
Remove previously copied migration files (You may check names of migrations to remove here).
-
Sylius\RefundPlugin\Entity\RefundPaymentInterface
state constants values were changed to lowercase. Backward compatibility provided by migration. -
Adjust new templates from the plugin (ref. PR #198)
⚠️ Check in your git repository, what has changed and only adjust templates where neededcp -R vendor/sylius/refund-plugin/src/Resources/views/SyliusAdminBundle/* templates/bundles/SyliusAdminBundle/
-
Copy new migrations
cp -R vendor/sylius/refund-plugin/migrations/{Version20200306145439.php,Version20200306153205.php,Version20200310094633.php,Version20200310185620.php} src/Migrations
-
Change usage of
Sylius\RefundPlugin\Entity\SequenceInterface
toSylius\RefundPlugin\Entity\CreditMemoSequenceInterface
-
Change usage of
Sylius\RefundPlugin\Provider\CurrentDateTimeProviderInterface
toSylius\RefundPlugin\Provider\CurrentDateTimeImmutableProviderInterface
-
Sylius\RefundPlugin\Entity\CreditMemoUnit
was changed toSylius\RefundPlugin\Entity\LineItem
which is a resource entity now. -
Sylius\RefundPlugin\Generator\CreditMemoUnitGeneratorInterface
was changed toSylius\RefundPlugin\Converter\LineItemsConverterInterface
. -
Sylius\RefundPlugin\Generator\OrderItemUnitCreditMemoUnitGenerator
was changed toSylius\RefundPlugin\Converter\LineItemsConverter
. -
Sylius\RefundPlugin\Generator\ShipmentCreditMemoUnitGenerator
was changed toSylius\RefundPlugin\Converter\ShipmentLineItemsConverter
. -
Sylius\RefundPlugin\Entity\TaxItem
became a resource entity.
There are no migrations that provide backward compatibility, save current credit memos before upgrading the version of plugin.
OfflineRefundPaymentMethodsProvider
renamed toSupportedRefundPaymentMethodsProvider
with the supported gateways array as the 2nd argument (by default onlyoffline
gateway is passed and therefore supported).
-
Removed
CreditMemoChannel
and replaced bySylius\Component\Core\Model\ChannelInterface
. -
Replaced
CustomerBillingData
andShopBillingData
value objects by entities withCustomerBillingDataInterface
andShopBillingDataInterface
interfaces.