Skip to content

Commit

Permalink
Merge pull request #91 from BitBagCommerce/feature/OP-363-add-sylius-…
Browse files Browse the repository at this point in the history
…1.13-support

Upgrade plugin to Sylius 1.13 compatibility
  • Loading branch information
senghe authored Jul 25, 2024
2 parents ad6476e + 081fbe4 commit 0089d20
Show file tree
Hide file tree
Showing 222 changed files with 699 additions and 444 deletions.
29 changes: 15 additions & 14 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,30 +14,31 @@ on:

jobs:
tests:
runs-on: ubuntu-22.04
runs-on: ubuntu-latest

name: "Sylius ${{ matrix.sylius }}, PHP ${{ matrix.php }}, Symfony ${{ matrix.symfony }}, MySQL ${{ matrix.mysql }}"

strategy:
fail-fast: false
matrix:
php: [ "8.0" ]
symfony: [ "^5.4", "^6.0" ]
sylius: [ "~1.11.0", "~1.12.0" ]
node: [ "^14.17.x" ]
php: [ "8.0", "8.1", "8.2", "8.3" ]
symfony: [ "^5.4", "^6.4" ]
sylius: [ "~1.12.0", "~1.13.0" ]
node: [ "^18.0", "^20.0" ]
mysql: [ "8.0" ]

exclude:
- sylius: ~1.11.0
symfony: "^6.0"
- sylius: "~1.13.0"
php: "8.0"
- symfony: "^6.4"
php: "8.0"

env:
APP_ENV: test
DATABASE_URL: "mysql://root:[email protected]/sylius?serverVersion=${{ matrix.mysql }}"

steps:
-
uses: actions/checkout@v2
uses: actions/checkout@v3

-
name: Setup PHP
Expand All @@ -50,7 +51,7 @@ jobs:

-
name: Setup Node
uses: actions/setup-node@v1
uses: actions/setup-node@v4
with:
node-version: "${{ matrix.node }}"

Expand Down Expand Up @@ -88,7 +89,7 @@ jobs:

-
name: Cache Composer
uses: actions/cache@v2
uses: actions/cache@v4
with:
path: ${{ steps.composer-cache.outputs.dir }}
key: ${{ runner.os }}-php-${{ matrix.php }}-composer-${{ hashFiles('**/composer.json **/composer.lock') }}
Expand All @@ -115,7 +116,7 @@ jobs:
-
name: Get Yarn cache directory
id: yarn-cache
run: echo "::set-output name=dir::$(yarn cache dir)"
run: echo "dir=$(yarn cache dir)" >> $GITHUB_OUTPUT

-
name: Cache Yarn
Expand Down Expand Up @@ -184,7 +185,7 @@ jobs:

-
name: Upload Behat logs
uses: actions/upload-artifact@v2
uses: actions/upload-artifact@v3
if: failure()
with:
name: Behat logs
Expand All @@ -202,4 +203,4 @@ jobs:
SLACK_MESSAGE: ':x:'
SLACK_TITLE: Failed build on ${{ github.event.repository.name }} repository
SLACK_USERNAME: ${{ secrets.FAILED_BUILD_SLACK_USERNAME }}
SLACK_WEBHOOK: ${{ secrets.FAILED_BUILD_SLACK_WEBHOOK }}
SLACK_WEBHOOK: ${{ secrets.FAILED_BUILD_SLACK_WEBHOOK }}
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -92,9 +92,9 @@ We work on stable, supported and up-to-date versions of packages. We recommend y
| ext-json: | * |
| sylius/refund-plugin | ^1.0.0 |
| sylius/resource-bundle | ^1.8 |
| sylius/sylius | ^1.11.0 or ^1.12.0 |
| symfony/messenger | ^5.4 |
| adyen/php-api-library | ^10.1 |
| sylius/sylius | ~1.12.0 or ~1.13.0 |
| symfony/messenger | ^5.4 or ^6.0 |
| adyen/php-api-library | ^11.0 |

----

Expand Down
26 changes: 12 additions & 14 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,22 +9,20 @@
],
"license": "MIT",
"require": {
"php": "^8.0",
"php": "^8.0 || ^8.1",
"adyen/php-api-library": "^11.0",
"composer/package-versions-deprecated": "^1.11",
"doctrine/annotations": "^1.14",
"nyholm/psr7": "^1.4",
"psalm/plugin-symfony": "^4.0",
"sylius/refund-plugin": "~1.0.0 || ^1.1",
"sylius/sylius": "~1.11.0 || ~1.12.0",
"sylius/sylius": "~1.12.0 || ~1.13.0",
"symfony/messenger": "^5.4 || ^6.0",
"symfony/serializer": "^5.4 || ^6.0",
"symfony/webpack-encore-bundle": "^1.14"
},
"require-dev": {
"behat/behat": "^3.6.1",
"behat/mink-selenium2-driver": "^1.4",
"bitbag/coding-standard": "^1.0.1",
"bitbag/coding-standard": "^3.0.0",
"dmore/behat-chrome-extension": "^1.3",
"dmore/chrome-mink-driver": "^2.7",
"friends-of-behat/mink": "^1.8",
Expand All @@ -37,19 +35,20 @@
"lakion/mink-debug-extension": "^2.0.0",
"phpspec/phpspec": "^7.0",
"phpstan/extension-installer": "^1.0",
"phpstan/phpstan": "0.12.90",
"phpstan/phpstan-doctrine": "0.12.39",
"phpstan/phpstan-strict-rules": "^0.12.0",
"phpstan/phpstan-webmozart-assert": "0.12.12",
"phpunit/phpunit": "^9.5",
"phpstan/phpstan": "^1.4",
"phpstan/phpstan-doctrine": "^1.0",
"phpstan/phpstan-strict-rules": "^1.0",
"phpstan/phpstan-webmozart-assert": "^1.0",
"phpunit/phpunit": ">=8.5",
"polishsymfonycommunity/symfony-mocker-container": "^1.0",
"symfony/browser-kit": "^5.4 || 6.0",
"symfony/debug-bundle": "^5.4 || ^6.0",
"symfony/dotenv": "^5.4 || ^6.0",
"symfony/intl": "^5.4 || ^6.0",
"symfony/web-profiler-bundle": "^5.4 || ^6.0",
"symplify/easy-coding-standard": "^9.3, !=9.3.27",
"vimeo/psalm": "^4.4.1 || ^5.0.0"
"symplify/easy-coding-standard": "^10.0 || ^11.0",
"vimeo/psalm": "~4.12 || ^5.0.0",
"psalm/plugin-symfony": "~4.0 || ~5.0"
},
"config": {
"sort-packages": true,
Expand All @@ -60,8 +59,7 @@
}
},
"conflict": {
"behat/mink-selenium2-driver": ">=1.7.0",
"doctrine/dbal": "^3.0"
"behat/mink-selenium2-driver": ">=1.7.0"
},
"extra": {
"branch-alias": {
Expand Down
Binary file added doc/adyen-allowed-origins-url.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file removed doc/adyen-allowed-origins.png
Binary file not shown.
8 changes: 4 additions & 4 deletions doc/configuration.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@

5. Add an origin; type your shop URL and save it:

![Origin](adyen-allowed-origins.png)
![Origin](adyen-allowed-origins-url.png)

6. Create a new Adyen payment method. Fill in the merchant account, API and client keys obtained in step 4. Also, create a username and password to be used for webhook credentials and choose the correct environment, either `live` or `test`. Don't save yet.

Expand All @@ -50,13 +50,13 @@

11. Save the payment method.

12. Once saved, an additional box will be displayed. Copy the URL and paste it in the Adyen panel:
12. Once saved, an additional box will be displayed. Copy the URL and paste it in the Adyen panel. Remember: if you are testing plugin and using tunneling for example: ngrok, remember to change `localhost:port` to `https://example.ngrok-free.app`

![Adyen notifications endpoint](notifications-endpoint.png)

13. Now you're ready to save and test the webhooks. If everything goes green, you're done and ready to go.

14. Before going to production you will have to create and set up your api url prefix
14. Before going to production you will have to create and set up your api url prefix. In test environment you can type: `prefix`.

![API URLs](adyen-api-urls.png)
![API production prefix](adyen-api-production-prefix.png)
![API production prefix](adyen-api-production-prefix.png)
15 changes: 6 additions & 9 deletions ecs.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,12 @@

declare(strict_types=1);

use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator;
use Symplify\EasyCodingStandard\ValueObject\Option;
use Symplify\EasyCodingStandard\Config\ECSConfig;

return static function (ContainerConfigurator $containerConfigurator): void {
$containerConfigurator->import('vendor/bitbag/coding-standard/ecs.php');
return static function (ECSConfig $config): void {

$parameters = $containerConfigurator->parameters();
$parameters->set(Option::PATHS, [
__DIR__ . '/src',
__DIR__ . '/tests',
]);
putenv('ALLOW_BITBAG_OS_HEADER=1');

$config->import('vendor/bitbag/coding-standard/ecs.php');
$config->paths(['src', 'tests']);
};
1 change: 1 addition & 0 deletions phpstan.neon
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ parameters:
reportUnmatchedIgnoredErrors: false
checkMissingIterableValueType: false
checkGenericClassInNonGenericObjectType: false
treatPhpDocTypesAsCertain: false

excludes_analyse:
# Makes PHPStan crash
Expand Down
4 changes: 4 additions & 0 deletions psalm.xml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,10 @@
<directory name="src/DependencyInjection"/>
</ignoreFiles>
</projectFiles>
<issueHandlers>
<MissingTemplateParam errorLevel="suppress" />
<MissingParamType errorLevel="suppress" />
</issueHandlers>
<plugins>
<pluginClass class="Psalm\SymfonyPsalmPlugin\Plugin"/>
</plugins>
Expand Down
5 changes: 3 additions & 2 deletions src/BitBagSyliusAdyenPlugin.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<?php

/*
* This file has been created by developers from BitBag.
* Feel free to contact us once you face any issues or want to start
Expand Down Expand Up @@ -34,13 +35,13 @@ public function build(ContainerBuilder $container): void
$container->addCompilerPass(
new MessageBusPolyfillPass(),
PassConfig::TYPE_BEFORE_OPTIMIZATION,
1
1,
);

$container->addCompilerPass(
new AuthenticationManagerPolyfillPass(),
PassConfig::TYPE_BEFORE_OPTIMIZATION,
1
1,
);
}
}
1 change: 1 addition & 0 deletions src/Bus/Command/AlterPaymentCommand.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<?php

/*
* This file has been created by developers from BitBag.
* Feel free to contact us once you face any issues or want to start
Expand Down
1 change: 1 addition & 0 deletions src/Bus/Command/AuthorizePayment.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<?php

/*
* This file has been created by developers from BitBag.
* Feel free to contact us once you face any issues or want to start
Expand Down
1 change: 1 addition & 0 deletions src/Bus/Command/CancelPayment.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<?php

/*
* This file has been created by developers from BitBag.
* Feel free to contact us once you face any issues or want to start
Expand Down
1 change: 1 addition & 0 deletions src/Bus/Command/CapturePayment.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<?php

/*
* This file has been created by developers from BitBag.
* Feel free to contact us once you face any issues or want to start
Expand Down
1 change: 1 addition & 0 deletions src/Bus/Command/CreateReferenceForPayment.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<?php

/*
* This file has been created by developers from BitBag.
* Feel free to contact us once you face any issues or want to start
Expand Down
3 changes: 2 additions & 1 deletion src/Bus/Command/CreateReferenceForRefund.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<?php

/*
* This file has been created by developers from BitBag.
* Feel free to contact us once you face any issues or want to start
Expand Down Expand Up @@ -28,7 +29,7 @@ final class CreateReferenceForRefund
public function __construct(
string $refundReference,
RefundPaymentInterface $refundPayment,
PaymentInterface $payment
PaymentInterface $payment,
) {
$details = $payment->getDetails();
Assert::keyExists($details, 'pspReference', 'Payment pspReference is not present');
Expand Down
1 change: 1 addition & 0 deletions src/Bus/Command/CreateToken.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<?php

/*
* This file has been created by developers from BitBag.
* Feel free to contact us once you face any issues or want to start
Expand Down
1 change: 1 addition & 0 deletions src/Bus/Command/MarkPaymentAsProcessedCommand.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<?php

/*
* This file has been created by developers from BitBag.
* Feel free to contact us once you face any issues or want to start
Expand Down
1 change: 1 addition & 0 deletions src/Bus/Command/PaymentCancelledCommand.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<?php

/*
* This file has been created by developers from BitBag.
* Feel free to contact us once you face any issues or want to start
Expand Down
1 change: 1 addition & 0 deletions src/Bus/Command/PaymentFailedCommand.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<?php

/*
* This file has been created by developers from BitBag.
* Feel free to contact us once you face any issues or want to start
Expand Down
1 change: 1 addition & 0 deletions src/Bus/Command/PaymentFinalizationCommand.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<?php

/*
* This file has been created by developers from BitBag.
* Feel free to contact us once you face any issues or want to start
Expand Down
1 change: 1 addition & 0 deletions src/Bus/Command/PaymentLifecycleCommand.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<?php

/*
* This file has been created by developers from BitBag.
* Feel free to contact us once you face any issues or want to start
Expand Down
1 change: 1 addition & 0 deletions src/Bus/Command/PaymentStatusReceived.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<?php

/*
* This file has been created by developers from BitBag.
* Feel free to contact us once you face any issues or want to start
Expand Down
1 change: 1 addition & 0 deletions src/Bus/Command/PrepareOrderForPayment.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<?php

/*
* This file has been created by developers from BitBag.
* Feel free to contact us once you face any issues or want to start
Expand Down
1 change: 1 addition & 0 deletions src/Bus/Command/RefundPayment.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<?php

/*
* This file has been created by developers from BitBag.
* Feel free to contact us once you face any issues or want to start
Expand Down
1 change: 1 addition & 0 deletions src/Bus/Command/RequestCapture.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<?php

/*
* This file has been created by developers from BitBag.
* Feel free to contact us once you face any issues or want to start
Expand Down
1 change: 1 addition & 0 deletions src/Bus/Command/TakeOverPayment.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<?php

/*
* This file has been created by developers from BitBag.
* Feel free to contact us once you face any issues or want to start
Expand Down
3 changes: 2 additions & 1 deletion src/Bus/Dispatcher.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<?php

/*
* This file has been created by developers from BitBag.
* Feel free to contact us once you face any issues or want to start
Expand All @@ -22,7 +23,7 @@ final class Dispatcher implements DispatcherInterface

public function __construct(
MessageBusInterface $messageBus,
PaymentCommandFactoryInterface $commandFactory
PaymentCommandFactoryInterface $commandFactory,
) {
$this->messageBus = $messageBus;
$this->commandFactory = $commandFactory;
Expand Down
1 change: 1 addition & 0 deletions src/Bus/DispatcherInterface.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<?php

/*
* This file has been created by developers from BitBag.
* Feel free to contact us once you face any issues or want to start
Expand Down
Loading

0 comments on commit 0089d20

Please sign in to comment.