diff --git a/.github/ISSUE_TEMPLATE/bug.yml b/.github/ISSUE_TEMPLATE/bug.yml new file mode 100644 index 0000000..52f37d5 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/bug.yml @@ -0,0 +1,52 @@ +name: Bug Report +description: Report an Issue or Bug with the Package +title: "[Bug]: " +labels: ["bug"] +body: + - type: markdown + attributes: + value: | + We're sorry to hear you have a problem. Can you help us solve it by providing the following details. + - type: textarea + id: what-happened + attributes: + label: What happened? + description: What did you expect to happen? + placeholder: I cannot currently do X thing because when I do, it breaks X thing. + validations: + required: true + + - type: input + id: package-version + attributes: + label: Package Version + description: What version of our Package are you running? Please be as specific as possible + placeholder: 2.0.0 + validations: + required: true + - type: input + id: php-version + attributes: + label: PHP Version + description: What version of PHP are you running? Please be as specific as possible + placeholder: 8.2.0 + validations: + required: true + - type: input + id: laravel-version + attributes: + label: Laravel Version + description: What version of Laravel are you running? Please be as specific as possible + placeholder: 9.0.0 + validations: + required: true + - type: dropdown + id: operating-systems + attributes: + label: Which operating systems does with happen with? + description: You may select more than one. + multiple: true + options: + - macOS + - Windows + - Linux diff --git a/.github/workflows/dependabot-auto-merge.yml b/.github/workflows/dependabot-auto-merge.yml index 14da349..3451cb2 100644 --- a/.github/workflows/dependabot-auto-merge.yml +++ b/.github/workflows/dependabot-auto-merge.yml @@ -1,3 +1,4 @@ + name: dependabot-auto-merge on: pull_request_target @@ -10,20 +11,21 @@ jobs: runs-on: ubuntu-latest if: ${{ github.actor == 'dependabot[bot]' }} steps: - + - name: Dependabot metadata id: metadata - uses: dependabot/fetch-metadata@v1.3.3 + + uses: dependabot/fetch-metadata@v1.4.0 with: github-token: "${{ secrets.GITHUB_TOKEN }}" - + - name: Auto-merge Dependabot PRs for semver-minor updates if: ${{steps.metadata.outputs.update-type == 'version-update:semver-minor'}} run: gh pr merge --auto --merge "$PR_URL" env: PR_URL: ${{github.event.pull_request.html_url}} GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}} - + - name: Auto-merge Dependabot PRs for semver-patch updates if: ${{steps.metadata.outputs.update-type == 'version-update:semver-patch'}} run: gh pr merge --auto --merge "$PR_URL" diff --git a/.github/workflows/dependency-review.yml b/.github/workflows/dependency-review.yml new file mode 100644 index 0000000..b0dedc4 --- /dev/null +++ b/.github/workflows/dependency-review.yml @@ -0,0 +1,20 @@ +# Dependency Review Action +# +# This Action will scan dependency manifest files that change as part of a Pull Request, surfacing known-vulnerable versions of the packages declared or updated in the PR. Once installed, if the workflow run is marked as required, PRs introducing known-vulnerable packages will be blocked from merging. +# +# Source repository: https://github.com/actions/dependency-review-action +# Public documentation: https://docs.github.com/en/code-security/supply-chain-security/understanding-your-software-supply-chain/about-dependency-review#dependency-review-enforcement +name: 'Dependency Review' +on: [pull_request] + +permissions: + contents: read + +jobs: + dependency-review: + runs-on: ubuntu-latest + steps: + - name: 'Checkout Repository' + uses: actions/checkout@v3 + - name: 'Dependency Review' + uses: actions/dependency-review-action@v3 diff --git a/.github/workflows/php-cs-fixer.yml b/.github/workflows/fix-php-code-style-issues.yml similarity index 54% rename from .github/workflows/php-cs-fixer.yml rename to .github/workflows/fix-php-code-style-issues.yml index 3517cf1..cc0c956 100644 --- a/.github/workflows/php-cs-fixer.yml +++ b/.github/workflows/fix-php-code-style-issues.yml @@ -1,12 +1,9 @@ -name: Check & fix styling +name: Fix PHP code style issues -on: - push: - branches: - - styling +on: [push] jobs: - php-cs-fixer: + php-code-styling: runs-on: ubuntu-latest steps: @@ -15,10 +12,8 @@ jobs: with: ref: ${{ github.head_ref }} - - name: Run PHP CS Fixer - uses: docker://oskarstark/php-cs-fixer-ga - with: - args: --config=.php-cs-fixer.dist.php --allow-risky=yes + - name: Fix PHP code style issues + uses: aglipanci/laravel-pint-action@2.2.0 - name: Commit changes uses: stefanzweifel/git-auto-commit-action@v4 diff --git a/.github/workflows/phpstan.yml b/.github/workflows/phpstan.yml index 3c93dae..090fd83 100644 --- a/.github/workflows/phpstan.yml +++ b/.github/workflows/phpstan.yml @@ -2,9 +2,9 @@ name: PHPStan on: push: - paths: - - '**.php' - - 'phpstan.neon.dist' + branches: [ main ] + pull_request: + branches: [ main ] jobs: phpstan: @@ -20,7 +20,7 @@ jobs: coverage: none - name: Install composer dependencies - uses: ramsey/composer-install@v1 + uses: ramsey/composer-install@v2 - name: Run PHPStan - run: ./vendor/bin/phpstan --error-format=github + run: ./vendor/bin/phpstan analyse src --error-format=github diff --git a/.github/workflows/run-tests.yml b/.github/workflows/run-tests.yml index 9f9a31c..d13152a 100644 --- a/.github/workflows/run-tests.yml +++ b/.github/workflows/run-tests.yml @@ -58,4 +58,4 @@ jobs: name: Store report retention-days: 1 path: | - ./reports + ./reports \ No newline at end of file diff --git a/.gitignore b/.gitignore index d16f891..a510a25 100644 --- a/.gitignore +++ b/.gitignore @@ -3,6 +3,7 @@ .php_cs.cache .php-cs-fixer.cache .phpunit.result.cache +.phpunit.cache .DS_STORE build composer.lock diff --git a/README.md b/README.md index 2fc1e9b..9ecc179 100644 --- a/README.md +++ b/README.md @@ -12,8 +12,16 @@ cp phpunit.xml.dist phpunit.xml Modify environment variables in the phpunit.xml-file: ```xml - - + + + + + + + + + + ``` Run the tests: diff --git a/composer.json b/composer.json index 803f70c..c26aa30 100644 --- a/composer.json +++ b/composer.json @@ -1,85 +1,85 @@ { - "name": "codebar-ag/laravel-postfinance-b2b", - "description": "B2B Service integration for Laravel", - "keywords": [ - "postfinance", - "b2b", - "laravel", - "codebar-ag", - "laravel-postfinance-b2b" - ], - "homepage": "https://github.com/codebar-ag/laravel-postfinance-b2b", - "license": "MIT", - "authors": [ - { - "name": "Sebastian Bürgin", - "email": "sebastian.buergin@codebar.ch", - "homepage": "https://www.codebar.ch", - "role": "Developer" - } - ], - "require": { - "php": "^8.2", - "ext-soap": "*", - "ext-xsl": "*", - "guzzlehttp/guzzle": "^7.5", - "illuminate/contracts": "^10.0", - "monolog/monolog": "^3.5", - "nyholm/psr7": "^1.8", - "php-http/logger-plugin": "^1.3", - "php-soap/psr18-wsse-middleware": "^2.3", - "phpro/soap-client": "^3.1", - "spatie/laravel-package-tools": "^1.9.2", - "symfony/http-client": "^6.2" - }, - "require-dev": { - "laravel/pint": "^1.5", - "nunomaduro/collision": "^7.0", - "nunomaduro/larastan": "^2.4.0", - "orchestra/testbench": "^8.0", - "pestphp/pest": "^2.0", - "pestphp/pest-plugin-laravel": "^2.0", - "phpstan/extension-installer": "^1.1", - "phpstan/phpstan-deprecation-rules": "^1.0", - "phpstan/phpstan-phpunit": "^1.0", - "phpunit/phpunit": "^10.0", - "spatie/laravel-ray": "^1.9" - }, - "autoload": { - "psr-4": { - "CodebarAg\\PostfinanceB2B\\": "src" - } - }, - "autoload-dev": { - "psr-4": { - "CodebarAg\\PostfinanceB2B\\Tests\\": "tests" - } - }, - "scripts": { - "analyse": "vendor/bin/phpstan analyse", - "test": "vendor/bin/pest", - "test-coverage": "vendor/bin/pest --coverage", - "format": "vendor/bin/pint" - }, - "config": { - "sort-packages": true, - "allow-plugins": { - "composer/package-versions-deprecated": false, - "pestphp/pest-plugin": true, - "phpstan/extension-installer": true, - "php-http/discovery": true - } - }, - "extra": { - "laravel": { - "providers": [ - "CodebarAg\\PostfinanceB2B\\PostfinanceB2BServiceProvider" - ], - "aliases": { - "PostfinanceB2B": "CodebarAg\\PostfinanceB2B\\Facades\\PostfinanceB2B" - } - } - }, - "minimum-stability": "dev", - "prefer-stable": true -} + "name": "codebar-ag/laravel-postfinance-b2b", + "description": "B2B Service integration for Laravel", + "keywords": [ + "postfinance", + "b2b", + "laravel", + "codebar-ag", + "laravel-postfinance-b2b" + ], + "homepage": "https://github.com/codebar-ag/laravel-postfinance-b2b", + "license": "MIT", + "authors": [ + { + "name": "Sebastian Bürgin", + "email": "sebastian.buergin@codebar.ch", + "homepage": "https://www.codebar.ch", + "role": "Developer" + } + ], + "require": { + "php": ">=8.2", + "ext-soap": "*", + "ext-xsl": "*", + "guzzlehttp/guzzle": "^7.8", + "illuminate/contracts": "^11.0", + "monolog/monolog": "^3.5", + "nyholm/psr7": "^1.8", + "php-http/logger-plugin": "^1.3", + "php-soap/psr18-wsse-middleware": "^2.3", + "phpro/soap-client": "^3.1", + "spatie/laravel-package-tools": "^1.16", + "symfony/http-client": "^6.4" + }, + "require-dev": { + "laravel/pint": "^1.14", + "nunomaduro/collision": "^8.1", + "larastan/larastan": "^2.9", + "orchestra/testbench": "^9.1", + "pestphp/pest": "^2.0", + "pestphp/pest-plugin-laravel": "^2.3", + "phpstan/extension-installer": "^1.3", + "phpstan/phpstan-deprecation-rules": "^1.1", + "phpstan/phpstan-phpunit": "^1.3", + "phpunit/phpunit": "^10.5", + "spatie/laravel-ray": "^1.35" + }, + "autoload": { + "psr-4": { + "CodebarAg\\PostfinanceB2B\\": "src" + } + }, + "autoload-dev": { + "psr-4": { + "CodebarAg\\PostfinanceB2B\\Tests\\": "tests" + } + }, + "scripts": { + "analyse": "vendor/bin/phpstan analyse", + "test": "vendor/bin/pest", + "test-coverage": "vendor/bin/pest --coverage", + "format": "vendor/bin/pint" + }, + "config": { + "sort-packages": true, + "allow-plugins": { + "composer/package-versions-deprecated": false, + "pestphp/pest-plugin": true, + "phpstan/extension-installer": true, + "php-http/discovery": true + } + }, + "extra": { + "laravel": { + "providers": [ + "CodebarAg\\PostfinanceB2B\\PostfinanceB2BServiceProvider" + ], + "aliases": { + "PostfinanceB2B": "CodebarAg\\PostfinanceB2B\\Facades\\PostfinanceB2B" + } + } + }, + "minimum-stability": "dev", + "prefer-stable": true +} \ No newline at end of file diff --git a/src/Client/PostfinanceClientFactory.php b/src/Client/PostfinanceClientFactory.php index 0e55445..bf73a3c 100644 --- a/src/Client/PostfinanceClientFactory.php +++ b/src/Client/PostfinanceClientFactory.php @@ -12,7 +12,6 @@ use Phpro\SoapClient\Caller\EngineCaller; use Phpro\SoapClient\Caller\EventDispatchingCaller; use Phpro\SoapClient\Soap\DefaultEngineFactory; -use function Psl\invariant; use Soap\ExtSoapEngine\ExtSoapOptions; use Soap\Psr18Transport\Middleware\RemoveEmptyNodesMiddleware; use Soap\Psr18Transport\Psr18Transport; @@ -21,6 +20,8 @@ use Soap\Psr18WsseMiddleware\WsseMiddleware; use Symfony\Component\EventDispatcher\EventDispatcher; +use function Psl\invariant; + class PostfinanceClientFactory { /** diff --git a/tests/Feature/GetInvoiceListPayerTest.php b/tests/Feature/GetInvoiceListPayerTest.php index ca7d9e5..3218a07 100644 --- a/tests/Feature/GetInvoiceListPayerTest.php +++ b/tests/Feature/GetInvoiceListPayerTest.php @@ -12,5 +12,4 @@ $response = $client->getInvoiceListPayer(new GetInvoiceListPayer($payerId, false)); expect($response->getGetInvoiceListPayerResult()->getInvoiceReport())->toBeIterable(); -}) - ->group('get', 'test'); +})->group('get', 'test'); diff --git a/tests/Feature/GetInvoicePayerTest.php b/tests/Feature/GetInvoicePayerTest.php index 2fc2b25..5946abd 100644 --- a/tests/Feature/GetInvoicePayerTest.php +++ b/tests/Feature/GetInvoicePayerTest.php @@ -18,5 +18,4 @@ $response = $client->getInvoicePayer(new GetInvoicePayer($payerId, $billerId, $transactionId, $fileType)); expect($response->getGetInvoicePayerResult()->getData())->toBeString()->not()->toBeEmpty(); -}) - ->group('get', 'test'); +})->group('get', 'test'); diff --git a/tests/Feature/PingTest.php b/tests/Feature/PingTest.php index aa361a1..89d4089 100644 --- a/tests/Feature/PingTest.php +++ b/tests/Feature/PingTest.php @@ -11,7 +11,6 @@ $client = PostfinanceClientFactory::factory($config); $response = $client->executePing(new ExecutePing(null, $payerId, null, null)); - expect($response->getExecutePingResult())->toBeNumeric(); -}) - ->group('get', 'test'); + expect($response->getExecutePingResult())->toBeNumeric(); +})->group('get', 'test');