Skip to content

Commit

Permalink
Merge pull request #7 from JanPalen/feature/OP-446-upgrade-plugin-to-…
Browse files Browse the repository at this point in the history
…sylius-1.13-support

Upgrade plugin to Sylius 1.13 compatibility
  • Loading branch information
senghe authored Sep 16, 2024
2 parents a3f5eb3 + dc1bd9f commit 137b233
Show file tree
Hide file tree
Showing 66 changed files with 429 additions and 587 deletions.
43 changes: 22 additions & 21 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -1,43 +1,44 @@
name: Build

on:
push: ~
push:
branches-ignore:
- 'dependabot/**'
pull_request: ~
release:
types: [created]
types: [ created ]
schedule:
- cron: "0 1 * * 6"
workflow_dispatch: ~

jobs:
tests:
runs-on: ubuntu-latest

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

strategy:
fail-fast: false
matrix:
php: [8.0]
sylius: [~1.10.0, ~1.11.0]
node: [12.x]
mysql: [5.7, 8.0]
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:
- # Segmentation fault while clearing cache
php: 8.0
mysql: 5.7
-
sylius: ~1.9.0
php: 8.0
-
sylius: ~1.11.0
php: 7.4
- 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 @@ -51,7 +52,7 @@ jobs:

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

Expand Down Expand Up @@ -106,7 +107,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 All @@ -128,8 +129,8 @@ jobs:
-
name: Prepare test application assets
run: |
(cd tests/Application && yarn encore dev)
(cd tests/Application && bin/console assets:install public -vvv)
(cd tests/Application && yarn build)
-
name: Prepare test application cache
run: (cd tests/Application && bin/console cache:warmup -vvv)
Expand All @@ -154,7 +155,7 @@ jobs:
name: Run Behat
run: vendor/bin/behat --colors --strict -vvv --no-interaction || vendor/bin/behat --colors --strict -vvv --no-interaction --rerun

-
-
name: Failed build Slack notification
uses: rtCamp/action-slack-notify@v2
if: ${{ failure() && (github.ref == 'refs/heads/main' || github.ref == 'refs/heads/master') }}
Expand Down
10 changes: 5 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ This plugin allows you to integrate QuadPay payment with Sylius platform app.
----
We work on stable, supported and up-to-date versions of packages. We recommend you to do the same.
```bash
$ composer require bitbag/quadpay-plugin
composer require bitbag/quadpay-plugin
```

Add plugin dependencies to your `config/bundles.php` file:
Expand Down Expand Up @@ -103,13 +103,13 @@ parameters:

Install assets:

```
$ bin/console assets:install
```bash
bin/console assets:install
```
Clear cache:

```
$ bin/console cache:clear
```bash
bin/console cache:clear
```
Add widget to product page: `show.html.twig`
```twig
Expand Down
44 changes: 23 additions & 21 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,15 @@
],
"license": "MIT",
"require": {
"php": "^7.4 || ^8.0",
"sylius/sylius": "~1.9.0 || ~1.10.0 || ~1.11.0",
"php": "^8.0 || ^8.1 || ^8.2 || ^8.3",
"sylius/sylius": " ~1.12.0 || ~1.13.0 ",
"symfony/webpack-encore-bundle": "^1.16",
"php-http/message-factory": "^1.1"
},
"require-dev": {
"behat/behat": "^3.6.1",
"behat/mink-selenium2-driver": "^1.4",
"bitbag/coding-standard": "^1.0",
"behat/behat": "^3.7.0",
"behat/mink-selenium2-driver": "^1.6.0",
"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 @@ -29,27 +30,28 @@
"friendsofsymfony/oauth-server-bundle": "^1.6 || >2.0.0-alpha.0 ^2.0@dev",
"phpspec/phpspec": "^7.0",
"phpstan/extension-installer": "^1.0",
"phpstan/phpstan": "0.12.85",
"phpstan/phpstan-doctrine": "0.12.33",
"phpstan/phpstan-strict-rules": "^0.12.0",
"phpstan/phpstan-webmozart-assert": "0.12.12",
"phpstan/phpstan": "^1.4",
"phpstan/phpstan-doctrine": "^1.0",
"phpstan/phpstan-strict-rules": "^1.0",
"phpstan/phpstan-webmozart-assert": "^1.0",
"phpunit/phpunit": "^9.5",
"polishsymfonycommunity/symfony-mocker-container": "^1.0",
"sensiolabs/security-checker": "^6.0",
"symfony/browser-kit": "^4.4 || ^5.2",
"symfony/debug-bundle": "^4.4 || ^5.2",
"symfony/dotenv": "^4.4 || ^5.2",
"symfony/intl": "^4.4 || ^5.2",
"symfony/web-profiler-bundle": "^4.4 || ^5.2",
"vimeo/psalm": "4.7.1"
"symfony/browser-kit": "^5.4 || 6.4",
"symfony/debug-bundle": "^5.4 || ^6.4",
"symfony/dotenv": "^5.4 || ^6.4",
"symfony/intl": "^5.4 || ^6.4",
"symfony/web-profiler-bundle": "^5.4 || ^6.4",
"vimeo/psalm": "^4.7 || ^5.0"
},
"conflict": {
"behat/mink-selenium2-driver": ">=1.7.0"
},
"config": {
"sort-packages": true,
"allow-plugins": false
},
"extra": {
"branch-alias": {
"dev-master": "1.10-dev"
"allow-plugins": {
"symfony/flex": false,
"dealerdirect/phpcodesniffer-composer-installer": false,
"phpstan/extension-installer": false
}
},
"autoload": {
Expand Down
14 changes: 5 additions & 9 deletions ecs.php
Original file line number Diff line number Diff line change
@@ -1,14 +1,10 @@
<?php

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 {
putenv('ALLOW_BITBAG_OS_HEADER=1');

$parameters = $containerConfigurator->parameters();
$parameters->set(Option::PATHS, [
__DIR__ . '/src',
__DIR__ . '/tests',
]);
$config->import('vendor/bitbag/coding-standard/ecs.php');
$config->paths(['src', 'tests']);
};
9 changes: 5 additions & 4 deletions src/Action/Api/ApiAwareTrait.php
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
<?php

/*
* This file was created by developers working at BitBag
* Do you need more information about us and what we do? Visit our https://bitbag.io website!
* We are hiring developers from all over the world. Join us and start your new, exciting adventure and become part of us: https://bitbag.io/career
*/
* This file has been created by developers from BitBag.
* Feel free to contact us once you face any issues or want to start
* You can find more information about us on https://bitbag.io and write us
* an email on [email protected].
*/

declare(strict_types=1);

Expand Down
10 changes: 5 additions & 5 deletions src/Action/CaptureAction.php
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
<?php

/*
* This file was created by developers working at BitBag
* Do you need more information about us and what we do? Visit our https://bitbag.io website!
* We are hiring developers from all over the world. Join us and start your new, exciting adventure and become part of us: https://bitbag.io/career
*/
* This file has been created by developers from BitBag.
* Feel free to contact us once you face any issues or want to start
* You can find more information about us on https://bitbag.io and write us
* an email on [email protected].
*/

declare(strict_types=1);

Expand All @@ -25,7 +26,6 @@
final class CaptureAction implements ActionInterface, ApiAwareInterface, GatewayAwareInterface
{
use GatewayAwareTrait;

use ApiAwareTrait;

/**
Expand Down
9 changes: 5 additions & 4 deletions src/Action/ConvertPaymentAction.php
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
<?php

/*
* This file was created by developers working at BitBag
* Do you need more information about us and what we do? Visit our https://bitbag.io website!
* We are hiring developers from all over the world. Join us and start your new, exciting adventure and become part of us: https://bitbag.io/career
*/
* This file has been created by developers from BitBag.
* Feel free to contact us once you face any issues or want to start
* You can find more information about us on https://bitbag.io and write us
* an email on [email protected].
*/

declare(strict_types=1);

Expand Down
10 changes: 5 additions & 5 deletions src/Action/StatusAction.php
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
<?php

/*
* This file was created by developers working at BitBag
* Do you need more information about us and what we do? Visit our https://bitbag.io website!
* We are hiring developers from all over the world. Join us and start your new, exciting adventure and become part of us: https://bitbag.io/career
*/
* This file has been created by developers from BitBag.
* Feel free to contact us once you face any issues or want to start
* You can find more information about us on https://bitbag.io and write us
* an email on [email protected].
*/

declare(strict_types=1);

Expand All @@ -26,7 +27,6 @@
final class StatusAction implements ActionInterface, GatewayAwareInterface, ApiAwareInterface
{
use GatewayAwareTrait;

use ApiAwareTrait;

/**
Expand Down
9 changes: 5 additions & 4 deletions src/BitBagSyliusQuadPayPlugin.php
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
<?php

/*
* This file was created by developers working at BitBag
* Do you need more information about us and what we do? Visit our https://bitbag.io website!
* We are hiring developers from all over the world. Join us and start your new, exciting adventure and become part of us: https://bitbag.io/career
*/
* This file has been created by developers from BitBag.
* Feel free to contact us once you face any issues or want to start
* You can find more information about us on https://bitbag.io and write us
* an email on [email protected].
*/

declare(strict_types=1);

Expand Down
41 changes: 17 additions & 24 deletions src/Client/QuadPayApiClient.php
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
<?php

/*
* This file was created by developers working at BitBag
* Do you need more information about us and what we do? Visit our https://bitbag.io website!
* We are hiring developers from all over the world. Join us and start your new, exciting adventure and become part of us: https://bitbag.io/career
*/
* This file has been created by developers from BitBag.
* Feel free to contact us once you face any issues or want to start
* You can find more information about us on https://bitbag.io and write us
* an email on [email protected].
*/

declare(strict_types=1);

Expand All @@ -14,35 +15,27 @@

class QuadPayApiClient implements QuadPayApiClientInterface
{
/** @var ClientInterface */
protected $apiClient;
protected string $clientId;

/** @var string */
protected $clientId;
protected string $clientSecret;

/** @var string */
protected $clientSecret;
protected string $apiEndpoint;

/** @var string */
protected $apiEndpoint;
protected string $authTokenEndpoint;

/** @var string */
protected $authTokenEndpoint;
protected string $apiAudience;

/** @var string */
protected $apiAudience;

public function __construct(ClientInterface $client)
{
$this->apiClient = $client;
public function __construct(
protected ClientInterface $client,
) {
}

public function setConfig(
string $clientId,
string $clientSecret,
string $apiEndpoint,
string $authTokenEndpoint,
string $apiAudience
string $apiAudience,
): void {
$this->clientId = $clientId;
$this->clientSecret = $clientSecret;
Expand Down Expand Up @@ -105,7 +98,7 @@ public function refund(
float $amount,
string $merchantRefundReference,
string $orderToken,
?string $orderId = null
?string $orderId = null,
): array {
if (null === $orderId) {
$orderId = $this->getOrderByToken($orderToken)['orderId'];
Expand Down Expand Up @@ -136,14 +129,14 @@ protected function request(
string $method,
string $url,
array $data = [],
?string $accessToken = null
?string $accessToken = null,
): array {
$options = [
'json' => $data,
'headers' => $this->getHeaders($accessToken),
];

$result = $this->apiClient->request($method, $url, $options);
$result = $this->client->request($method, $url, $options);

return \GuzzleHttp\json_decode((string) $result->getBody(), true);
}
Expand Down
Loading

0 comments on commit 137b233

Please sign in to comment.