From 8d90d65708bda8d6b89a10a6a238ce6ea0819378 Mon Sep 17 00:00:00 2001 From: jekuaitk Date: Fri, 18 Oct 2024 14:50:13 +0200 Subject: [PATCH 1/6] Drupal 10 readiness --- .github/workflows/pr.yaml | 2 +- os2forms_payment.info.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/pr.yaml b/.github/workflows/pr.yaml index 89dea3f..0972b29 100644 --- a/.github/workflows/pr.yaml +++ b/.github/workflows/pr.yaml @@ -113,7 +113,7 @@ jobs: run: | # We need a Drupal project to run drupal-check (cf. https://github.com/mglaman/drupal-check#usage) # Install Drupal - composer --no-interaction create-project drupal/recommended-project:^9 --stability=dev drupal + composer --no-interaction create-project drupal/recommended-project:^10 --stability=dev drupal # Copy our module source code into the Drupal module folder. mkdir -p drupal/web/modules/contrib/os2forms_payment cp -r os2forms_payment.* composer.json src drupal/web/modules/contrib/os2forms_payment diff --git a/os2forms_payment.info.yml b/os2forms_payment.info.yml index 421d9c7..d043ceb 100644 --- a/os2forms_payment.info.yml +++ b/os2forms_payment.info.yml @@ -2,7 +2,7 @@ name: OS2forms payment type: module description: Accept payments through OS2forms via Nets EasyPay package: OS2Forms -core_version_requirement: ^9 +core_version_requirement: ^9 || ^10 dependencies: - webform:webform From f244ec4faa342c3f08992419eba76fdb68aa13b5 Mon Sep 17 00:00:00 2001 From: jekuaitk Date: Fri, 18 Oct 2024 15:04:45 +0200 Subject: [PATCH 2/6] Removed unused package --- composer.json | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/composer.json b/composer.json index e07b9b8..7fc8199 100644 --- a/composer.json +++ b/composer.json @@ -21,8 +21,7 @@ "php": "^8.1", "drupal/webform": "^6.1", "drush/drush": "^11 || ^12", - "symfony/options-resolver": "^5.4 || ^6.0", - "itk-dev/serviceplatformen": "^1.4" + "symfony/options-resolver": "^5.4 || ^6.0" }, "require-dev": { "drupal/coder": "^8.3", From a37e61cfcd4b20264ce887cd50f778c1eb1e8a4a Mon Sep 17 00:00:00 2001 From: jekuaitk Date: Fri, 18 Oct 2024 15:35:35 +0200 Subject: [PATCH 3/6] Resolve issue with code-analysis --- composer.json | 1 + 1 file changed, 1 insertion(+) diff --git a/composer.json b/composer.json index 7fc8199..26c442a 100644 --- a/composer.json +++ b/composer.json @@ -27,6 +27,7 @@ "drupal/coder": "^8.3", "dealerdirect/phpcodesniffer-composer-installer": "^0.7.1", "mglaman/drupal-check": "^1.4", + "mglaman/phpstan-drupal": "~1.2.0", "phpunit/phpunit": "^9.5" }, "scripts": { From abc6c1143a98c7e39380eceee69e3b3486ad6d84 Mon Sep 17 00:00:00 2001 From: jekuaitk Date: Fri, 18 Oct 2024 15:39:53 +0200 Subject: [PATCH 4/6] Resolved deprecations --- src/Element/NetsEasyPaymentElement.php | 4 ++-- src/Helper/PaymentHelper.php | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/Element/NetsEasyPaymentElement.php b/src/Element/NetsEasyPaymentElement.php index 036d7bc..4b411e9 100644 --- a/src/Element/NetsEasyPaymentElement.php +++ b/src/Element/NetsEasyPaymentElement.php @@ -2,14 +2,14 @@ namespace Drupal\os2forms_payment\Element; -use Drupal\Core\Render\Element\FormElement; +use Drupal\Core\Render\Element\FormElementBase; /** * Provides an OS2forms payment element'. * * @FormElement("os2forms_payment_nets_easy_payment") */ -class NetsEasyPaymentElement extends FormElement { +class NetsEasyPaymentElement extends FormElementBase { /** * {@inheritdoc} diff --git a/src/Helper/PaymentHelper.php b/src/Helper/PaymentHelper.php index e1d67a3..cbd61ce 100644 --- a/src/Helper/PaymentHelper.php +++ b/src/Helper/PaymentHelper.php @@ -3,7 +3,6 @@ namespace Drupal\os2forms_payment\Helper; use Drupal\Core\Form\FormStateInterface; -use Drupal\Core\Http\RequestStack; use Drupal\Core\Site\Settings; use Drupal\Core\StringTranslation\StringTranslationTrait; use Drupal\Core\TempStore\PrivateTempStore; @@ -12,6 +11,7 @@ use Drupal\webform\WebformSubmissionInterface; use GuzzleHttp\ClientInterface; use Psr\Http\Message\ResponseInterface; +use Symfony\Component\HttpFoundation\RequestStack; /** * Payment helper class. From 6d3222d7f32f518729ddd97cfbe57685adbfa3a4 Mon Sep 17 00:00:00 2001 From: jekuaitk Date: Fri, 18 Oct 2024 15:49:04 +0200 Subject: [PATCH 5/6] Updated CHANGELOG --- CHANGELOG.md | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 885e99f..acc2f24 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,6 +9,10 @@ Versioning](https://semver.org/spec/v2.0.0.html). ## Unreleased +### Updated + +- Made OS2Forms payment module Drupal 10 compatible + ### Added - Added OS2Forms payment module @@ -16,4 +20,4 @@ Versioning](https://semver.org/spec/v2.0.0.html). ### Fixed -- Corrected format of payment metods +- Corrected format of payment methods From d8f93240be9cd7d3b5c5e53fb7b93ae62f7d5ac2 Mon Sep 17 00:00:00 2001 From: jekuaitk Date: Fri, 18 Oct 2024 15:50:14 +0200 Subject: [PATCH 6/6] Version updates and typos --- .github/workflows/pr.yaml | 8 ++++---- README.md | 12 ++++++------ src/Helper/PaymentHelper.php | 4 ++-- 3 files changed, 12 insertions(+), 12 deletions(-) diff --git a/.github/workflows/pr.yaml b/.github/workflows/pr.yaml index 0972b29..f959b3e 100644 --- a/.github/workflows/pr.yaml +++ b/.github/workflows/pr.yaml @@ -23,7 +23,7 @@ jobs: runs-on: ubuntu-latest strategy: matrix: - php-versions: [ '8.1' ] + php-versions: [ '8.3' ] dependency-version: [ prefer-lowest, prefer-stable ] steps: - uses: actions/checkout@master @@ -55,7 +55,7 @@ jobs: runs-on: ubuntu-latest strategy: matrix: - php-versions: [ '8.1' ] + php-versions: [ '8.3' ] dependency-version: [ prefer-lowest, prefer-stable ] steps: - uses: actions/checkout@master @@ -88,7 +88,7 @@ jobs: runs-on: ubuntu-latest strategy: matrix: - php-versions: [ '8.1' ] + php-versions: [ '8.3' ] dependency-version: [ prefer-lowest, prefer-stable ] steps: - uses: actions/checkout@master @@ -158,4 +158,4 @@ jobs: node-version: '16' - run: yarn install - name: coding-standards-check - run: yarn coding-standards-check \ No newline at end of file + run: yarn coding-standards-check diff --git a/README.md b/README.md index 3beb409..e3962b7 100644 --- a/README.md +++ b/README.md @@ -38,16 +38,16 @@ amount to pay (field types: Skjult, Vælg). ## Coding standards ```sh -docker run --rm --interactive --tty --volume ${PWD}:/app itkdev/php8.1-fpm:latest composer install -docker run --rm --interactive --tty --volume ${PWD}:/app itkdev/php8.1-fpm:latest composer coding-standards-check +docker run --rm --interactive --tty --volume ${PWD}:/app itkdev/php8.3-fpm:latest composer install +docker run --rm --interactive --tty --volume ${PWD}:/app itkdev/php8.3-fpm:latest composer coding-standards-check -docker run --rm --interactive --tty --volume ${PWD}:/app node:18 yarn --cwd /app install -docker run --rm --interactive --tty --volume ${PWD}:/app node:18 yarn --cwd /app coding-standards-check +docker run --rm --interactive --tty --volume ${PWD}:/app node:20 yarn --cwd /app install +docker run --rm --interactive --tty --volume ${PWD}:/app node:20 yarn --cwd /app coding-standards-check ``` ## Code analysis ```sh -docker run --rm --interactive --tty --volume ${PWD}:/app itkdev/php8.1-fpm:latest composer install -docker run --rm --interactive --tty --volume ${PWD}:/app itkdev/php8.1-fpm:latest composer code-analysis +docker run --rm --interactive --tty --volume ${PWD}:/app itkdev/php8.3-fpm:latest composer install +docker run --rm --interactive --tty --volume ${PWD}:/app itkdev/php8.3-fpm:latest composer code-analysis ``` diff --git a/src/Helper/PaymentHelper.php b/src/Helper/PaymentHelper.php index cbd61ce..dab5c62 100644 --- a/src/Helper/PaymentHelper.php +++ b/src/Helper/PaymentHelper.php @@ -328,7 +328,7 @@ public function responseToObject(ResponseInterface $response): object { } /** - * Sets the amount to pay in private tempoary storage. + * Sets the amount to pay in private temporary storage. * * @param float $amountToPay * The amount to pay. @@ -341,7 +341,7 @@ public function setAmountToPayTemp(float $amountToPay): void { } /** - * Gets the amount to pay in private tempoary storage. + * Gets the amount to pay from private temporary storage. * * @return float * The amount to pay.