Skip to content

Commit

Permalink
UPGRADE informations and final fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
Zales0123 committed Jun 8, 2021
1 parent f290126 commit 583bf7f
Show file tree
Hide file tree
Showing 7 changed files with 27 additions and 10 deletions.
10 changes: 10 additions & 0 deletions UPGRADE.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,13 @@
### UPGRADE FROM 1.0.0-RC.10 TO 1.0.0-RC.11

1. `orderNumber` field on `Sylius\RefundPlugin\Entity\Refund` has been removed and replaced with relation to `Order` entity.
1. `Sylius\RefundPlugin\Entity\RefundInterface::getOrderNumber` function is left due to easier and smoother upgrades,
but is also deprecated and will be removed in the `v1.0.0` release. Use `Sylius\RefundPlugin\Entity\RefundInterface::getOrder` instead.
1. `Sylius\RefundPlugin\Creator\RefundCreator` takes `\Sylius\Component\Core\Repository\OrderRepositoryInterface`
as the 3rd argument.
1. `Sylius\RefundPlugin\Provider\OrderRefundedTotalProviderInterface::invoke` takes `OrderInterface $order` as an argument
instead of `string $orderNumber`

### UPGRADE FROM 1.0.0-RC.9 TO 1.0.0-RC.10

1. Support for Sylius 1.8 has been dropped, upgrade your application to [Sylius 1.9](https://github.com/Sylius/Sylius/blob/master/UPGRADE-1.9.md)
Expand Down
12 changes: 6 additions & 6 deletions spec/Creator/RefundCreatorSpec.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@

final class RefundCreatorSpec extends ObjectBehavior
{
function let(
public function let(
RefundFactoryInterface $refundFactory,
RemainingTotalProviderInterface $remainingTotalProvider,
OrderRepositoryInterface $orderRepository,
Expand All @@ -40,12 +40,12 @@ function let(
);
}

function it_implements_refund_creator_interface(): void
public function it_implements_refund_creator_interface(): void
{
$this->shouldImplement(RefundCreatorInterface::class);
}

function it_creates_refund_with_given_data_and_save_it_in_database(
public function it_creates_refund_with_given_data_and_save_it_in_database(
RefundFactoryInterface $refundFactory,
RemainingTotalProviderInterface $remainingTotalProvider,
OrderRepositoryInterface $orderRepository,
Expand All @@ -66,7 +66,7 @@ function it_creates_refund_with_given_data_and_save_it_in_database(
$this('000222', 1, 1000, $refundType);
}

function it_throws_an_exception_if_order_with_given_number_does_not_exist(
public function it_throws_an_exception_if_order_with_given_number_does_not_exist(
OrderRepositoryInterface $orderRepository
): void {
$refundType = RefundType::shipment();
Expand All @@ -75,11 +75,11 @@ function it_throws_an_exception_if_order_with_given_number_does_not_exist(

$this
->shouldThrow(\InvalidArgumentException::class)
->during('__invoke', ['000222', 1, 1000, $refundType])
->during('__invoke', ['000222', 1, 1000, $refundType])
;
}

function it_throws_exception_if_unit_has_already_been_refunded(
public function it_throws_exception_if_unit_has_already_been_refunded(
OrderRepositoryInterface $orderRepository,
RemainingTotalProviderInterface $remainingTotalProvider,
OrderInterface $order
Expand Down
1 change: 0 additions & 1 deletion src/Checker/OrderFullyRefundedTotalChecker.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@

use Sylius\Component\Core\Model\OrderInterface;
use Sylius\RefundPlugin\Provider\OrderRefundedTotalProviderInterface;
use Webmozart\Assert\Assert;

final class OrderFullyRefundedTotalChecker implements OrderFullyRefundedTotalCheckerInterface
{
Expand Down
2 changes: 1 addition & 1 deletion src/Entity/Refund.php
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ public function getOrder(): OrderInterface

public function getOrderNumber(): string
{
return $this->order->getNumber();
return (string) $this->order->getNumber();
}

public function getAmount(): int
Expand Down
2 changes: 1 addition & 1 deletion src/Entity/RefundInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ interface RefundInterface extends ResourceInterface
{
public function getOrder(): OrderInterface;

/** @deprecated this function is deprecated and will be removed in v1.0. Use RefundInterface::getOrder() instead */
/** @deprecated this function is deprecated and will be removed in v1.0.0. Use RefundInterface::getOrder() instead */
public function getOrderNumber(): string;

public function getAmount(): int;
Expand Down
9 changes: 9 additions & 0 deletions src/Migrations/Version20210608074013.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,14 @@
<?php

/*
* This file is part of the Sylius package.
*
* (c) Paweł Jędrzejewski
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/

declare(strict_types=1);

namespace Sylius\RefundPlugin\Migrations;
Expand Down
1 change: 0 additions & 1 deletion src/Twig/OrderRefundsExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@

namespace Sylius\RefundPlugin\Twig;

use spec\Sylius\Component\User\Security\Generator\UniquePinGeneratorSpec;
use Sylius\Component\Core\Model\OrderInterface;
use Sylius\Component\Core\Repository\OrderRepositoryInterface;
use Sylius\RefundPlugin\Checker\UnitRefundingAvailabilityCheckerInterface;
Expand Down

0 comments on commit 583bf7f

Please sign in to comment.