Skip to content

Commit

Permalink
Fixes after code review
Browse files Browse the repository at this point in the history
  • Loading branch information
mpysiak committed Apr 3, 2024
1 parent b183882 commit 20b0181
Show file tree
Hide file tree
Showing 9 changed files with 20 additions and 12 deletions.
13 changes: 10 additions & 3 deletions UPGRADE.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
### UPGRADE FROM 1.5.1 to 1.6

1. Support for Sylius 1.13 has been added, it is now the recommended Sylius version to use.
2. Support for PHP 8.0 has been dropped.
3. The following constructor signatures have been changed:

1. Support for PHP 8.0 has been dropped.

1. The following constructor signatures have been changed:

`Sylius\PayPalPlugin\Client\PayPalClient`:
```diff
Expand All @@ -12,6 +14,7 @@
use Psr\Http\Message\StreamFactoryInterface;

public function __construct(
- private readonly GuzzleClientInterface $client,
+ private readonly GuzzleClientInterface|ClientInterface $client,
private readonly LoggerInterface $logger,
private readonly UuidProviderInterface $uuidProvider,
Expand All @@ -32,6 +35,7 @@
use Psr\Http\Message\RequestFactoryInterface;

public function __construct(
- private readonly GuzzleClientInterface $client,
+ private readonly GuzzleClientInterface|ClientInterface $client,
+ private readonly ?RequestFactoryInterface $requestFactory = null,
)
Expand All @@ -45,6 +49,7 @@
use Psr\Http\Message\StreamFactoryInterface;

public function __construct(
- private readonly GuzzleClientInterface $client,
+ private readonly GuzzleClientInterface|ClientInterface $client,
private readonly string $baseUrl,
+ private readonly ?RequestFactoryInterface $requestFactory = null,
Expand All @@ -59,13 +64,15 @@
use Psr\Http\Message\RequestFactoryInterface;

public function __construct(
- private readonly GuzzleClientInterface $client,
+ private readonly GuzzleClientInterface|ClientInterface $client,
private readonly SellerWebhookRegistrarInterface $sellerWebhookRegistrar,
private readonly string $url,
+ private readonly ?RequestFactoryInterface $requestFactory = null,
)
```
4. Added doctrine migration for PostgreSQL. For more information, please refer to the [Sylius 1.13 UPGRADE.md](https://github.com/Sylius/Sylius/blob/1.13/UPGRADE-1.13.md)

1. Added doctrine migration for PostgreSQL. For more information, please refer to the [Sylius 1.13 UPGRADE.md](https://github.com/Sylius/Sylius/blob/1.13/UPGRADE-1.13.md)

### UPGRADE FROM 1.3.0 to 1.3.1

Expand Down
3 changes: 2 additions & 1 deletion spec/Api/WebhookApiSpec.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,8 @@ function it_registers_webhook(
StreamInterface $body
): void {

$requestFactory->createRequest('POST','http://base-url.com/v1/notifications/webhooks')
$requestFactory
->createRequest('POST','http://base-url.com/v1/notifications/webhooks')
->willReturn($request);
$client->sendRequest($request)->willReturn($response);

Expand Down
2 changes: 1 addition & 1 deletion src/Api/WebhookApi.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ public function __construct(
);
}

if (null === $this->requestFactory && null === $this->streamFactory) {
if (null === $this->requestFactory || null === $this->streamFactory) {
trigger_deprecation(
'sylius/paypal-plugin',
'1.6',
Expand Down
2 changes: 1 addition & 1 deletion src/Client/PayPalClient.php
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ public function __construct(
);
}

if (null === $this->requestFactory && null === $this->streamFactory) {
if (null === $this->requestFactory || null === $this->streamFactory) {
trigger_deprecation(
'sylius/paypal-plugin',
'1.6',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
* file that was distributed with this source code.
*/

namespace Sylius\PayPalPlugin\Listener;
namespace Sylius\PayPalPlugin\EventListener\Workflow;

use Sylius\Component\Core\Model\OrderInterface;
use Sylius\PayPalPlugin\Processor\PayPalOrderCompleteProcessor;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
* file that was distributed with this source code.
*/

namespace Sylius\PayPalPlugin\Listener;
namespace Sylius\PayPalPlugin\EventListener\Workflow;

use Sylius\Component\Core\Model\PaymentInterface;
use Sylius\PayPalPlugin\Processor\PaymentRefundProcessorInterface;
Expand Down
4 changes: 2 additions & 2 deletions src/Resources/config/integrations/workflow.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@

<container xmlns="http://symfony.com/schema/dic/services" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://symfony.com/schema/dic/services http://symfony.com/schema/dic/services/services-1.0.xsd">
<services>
<service id="Sylius\PayPalPlugin\Listener\CompletePayPalOrderListener">
<service id="Sylius\PayPalPlugin\EventListener\Workflow\CompletePayPalOrderListener">
<argument type="service" id="Sylius\PayPalPlugin\Processor\PayPalOrderCompleteProcessor" />

<tag name="kernel.event_listener" event="workflow.sylius_order.completed.complete" priority="100" />
</service>

<service id="Sylius\PayPalPlugin\Listener\RefundPaymentListener">
<service id="Sylius\PayPalPlugin\EventListener\Workflow\RefundPaymentListener">
<argument type="service" id="Sylius\PayPalPlugin\Processor\PaymentRefundProcessorInterface" />

<tag name="kernel.event_listener" event="workflow.sylius_order_payment.enter.refund" priority="100" />
Expand Down
2 changes: 1 addition & 1 deletion src/Resources/config/services/api.xml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
id="Sylius\PayPalPlugin\Client\PayPalClientInterface"
class="Sylius\PayPalPlugin\Client\PayPalClient"
>
<argument type="service" id="Http\Discovery\Psr18Client" />
<argument type="service" id="sylius.http_client" />
<argument type="service" id="monolog.logger.paypal" />
<argument type="service" id="Sylius\PayPalPlugin\Provider\UuidProviderInterface" />
<argument type="service" id="Sylius\PayPalPlugin\Provider\PayPalConfigurationProviderInterface" />
Expand Down
2 changes: 1 addition & 1 deletion tests/Application/config/packages/workflow.yaml
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
framework:
workflows: ~
workflows: ~

0 comments on commit 20b0181

Please sign in to comment.