From 2c2cf88a43ad99b467420daa272f560013349858 Mon Sep 17 00:00:00 2001 From: RhysLees <43909932+RhysLees@users.noreply.github.com> Date: Fri, 28 Feb 2025 20:51:31 +0000 Subject: [PATCH 01/13] Fix styling --- tests/Feature/DownloadFile.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/Feature/DownloadFile.php b/tests/Feature/DownloadFile.php index 5e853e2..1bc8d22 100644 --- a/tests/Feature/DownloadFile.php +++ b/tests/Feature/DownloadFile.php @@ -10,8 +10,8 @@ $config = config('postfinance-b2b'); $payerId = config('postfinance-b2b.tests.payer_id'); - $billerId = '41101000000834484'; //config('postfinance-b2b.tests.biller_id'); - $transactionId = '9360415238'; //config('postfinance-b2b.tests.transaction_id'); + $billerId = '41101000000834484'; // config('postfinance-b2b.tests.biller_id'); + $transactionId = '9360415238'; // config('postfinance-b2b.tests.transaction_id'); $fileType = config('postfinance-b2b.tests.file_type'); $client = PostfinanceClientFactory::factory($config); From c7ab13ba3cd0350d9d35b01734e2492b194892ff Mon Sep 17 00:00:00 2001 From: Rhys Lees <43909932+RhysLees@users.noreply.github.com> Date: Fri, 28 Feb 2025 21:11:03 +0000 Subject: [PATCH 02/13] WIP --- .gitignore | 12 +++--------- .php-cs-fixer.dist.php | 40 ---------------------------------------- README.md | 39 ++++++++++++++++++++++++++++++++++++++- phpstan.neon.dist | 3 +-- phpunit.xml.dist | 9 +++++++-- 5 files changed, 49 insertions(+), 54 deletions(-) delete mode 100644 .php-cs-fixer.dist.php diff --git a/.gitignore b/.gitignore index 58969c4..91b23b2 100644 --- a/.gitignore +++ b/.gitignore @@ -1,18 +1,12 @@ .idea -.php_cs -.php_cs.cache -.php-cs-fixer.cache .phpunit.result.cache -.phpunit.cache/ .phpunit.cache -.DS_STORE -build composer.lock coverage phpunit.xml -psalm.xml +phpstan.neon testbench.yaml vendor node_modules -phpstan.neon -/local +.phpactor.json +build diff --git a/.php-cs-fixer.dist.php b/.php-cs-fixer.dist.php deleted file mode 100644 index 8d8a790..0000000 --- a/.php-cs-fixer.dist.php +++ /dev/null @@ -1,40 +0,0 @@ -in([ - __DIR__ . '/src', - __DIR__ . '/tests', - ]) - ->name('*.php') - ->notName('*.blade.php') - ->ignoreDotFiles(true) - ->ignoreVCS(true); - -return (new PhpCsFixer\Config()) - ->setRules([ - '@PSR12' => true, - 'array_syntax' => ['syntax' => 'short'], - 'ordered_imports' => ['sort_algorithm' => 'alpha'], - 'no_unused_imports' => true, - 'not_operator_with_successor_space' => true, - 'trailing_comma_in_multiline' => true, - 'phpdoc_scalar' => true, - 'unary_operator_spaces' => true, - 'binary_operator_spaces' => true, - 'blank_line_before_statement' => [ - 'statements' => ['break', 'continue', 'declare', 'return', 'throw', 'try'], - ], - 'phpdoc_single_line_var_spacing' => true, - 'phpdoc_var_without_name' => true, - 'class_attributes_separation' => [ - 'elements' => [ - 'method' => 'one', - ], - ], - 'method_argument_space' => [ - 'on_multiline' => 'ensure_fully_multiline', - 'keep_multiple_spaces_after_comma' => true, - ], - 'single_trait_insert_per_statement' => true, - ]) - ->setFinder($finder); diff --git a/README.md b/README.md index b836b67..fe380ab 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,41 @@ -## Usage + + +[![Latest Version on Packagist](https://img.shields.io/packagist/v/codebar-ag/laravel-postfinance-b2b.svg?style=flat-square)](https://packagist.org/packages/codebar-ag/laravel-postfinance-b2b) +[![GitHub-Tests](https://github.com/codebar-ag/laravel-postfinance-b2b/actions/workflows/run-tests.yml/badge.svg?branch=main)](https://github.com/codebar-ag/laravel-postfinance-b2b/actions/workflows/run-tests.yml) +[![GitHub Code Style](https://github.com/codebar-ag/laravel-postfinance-b2b/actions/workflows/fix-php-code-style-issues.yml/badge.svg?branch=main)](https://github.com/codebar-ag/laravel-postfinance-b2b/actions/workflows/fix-php-code-style-issues.yml) +[![Total Downloads](https://img.shields.io/packagist/dt/codebar-ag/laravel-postfinance-b2b.svg?style=flat-square)](https://packagist.org/packages/codebar-ag/laravel-postfinance-b2b) + +This package was developed to give you a quick start to communicate with the +PostFinance B2B REST API. + +## 💡 What is PostFinance B2B? + +PostFinance B2B is a digital interface for all your invoices +where you can send and receive your invoices electronically. + +## 🛠 Requirements + +| Package | PHP | Laravel | +|:-------:|:-----------:|:-------:| +| v12.0.0 | ^8.2 - ^8.4 | 12.x | +| v11.0.0 | ^8.2 - ^8.3 | 11.x | + +## ⚙️ Installation + +You can install the package via composer: + +```bash +composer require codebar-ag/laravel-postfinance-b2b +``` + +Add the following environment variables to your `.env` file: + +```bash +POSTFINANCE_B2B_USERNAME= +POSTFINANCE_B2B_PASSWORD= +``` + +## 🏗 Usage Invoice download web services provided by PostFinance diff --git a/phpstan.neon.dist b/phpstan.neon.dist index 87d8e08..e64d8ee 100644 --- a/phpstan.neon.dist +++ b/phpstan.neon.dist @@ -9,5 +9,4 @@ parameters: tmpDir: build/phpstan checkOctaneCompatibility: true checkModelProperties: true - checkMissingIterableValueType: false - + noEnvCallsOutsideOfConfig: false diff --git a/phpunit.xml.dist b/phpunit.xml.dist index 0b590da..5a32f80 100644 --- a/phpunit.xml.dist +++ b/phpunit.xml.dist @@ -1,7 +1,11 @@ - + - + tests @@ -16,6 +20,7 @@ + From 85f591b69083baac3d9f04311ab9990b4c52f799 Mon Sep 17 00:00:00 2001 From: Rhys Lees <43909932+RhysLees@users.noreply.github.com> Date: Fri, 28 Feb 2025 23:43:40 +0000 Subject: [PATCH 03/13] WIP --- .github/workflows/run-tests.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/run-tests.yml b/.github/workflows/run-tests.yml index 582eef4..6675f56 100644 --- a/.github/workflows/run-tests.yml +++ b/.github/workflows/run-tests.yml @@ -28,7 +28,7 @@ jobs: uses: shivammathur/setup-php@v2 with: php-version: ${{ matrix.php }} - extensions: dom, curl, libxml, mbstring, zip, pcntl, pdo, sqlite, pdo_sqlite, bcmath, soap, intl, gd, exif, iconv, imagick, fileinfo + extensions: dom, curl, libxml, mbstring, zip, pcntl, pdo, sqlite, pdo_sqlite, bcmath, soap, xsl, intl, gd, exif, iconv, imagick, fileinfo coverage: none - name: Setup problem matchers From 3897d9a212299eb18b9e99a6e13e5923d9dc39d5 Mon Sep 17 00:00:00 2001 From: Rhys Lees <43909932+RhysLees@users.noreply.github.com> Date: Fri, 28 Feb 2025 23:50:30 +0000 Subject: [PATCH 04/13] WIP --- .github/workflows/run-tests.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/workflows/run-tests.yml b/.github/workflows/run-tests.yml index 6675f56..0ed3c96 100644 --- a/.github/workflows/run-tests.yml +++ b/.github/workflows/run-tests.yml @@ -24,6 +24,9 @@ jobs: - name: Checkout code uses: actions/checkout@v4 + - name: Clear Composer Cache + run: composer clear-cache + - name: Setup PHP uses: shivammathur/setup-php@v2 with: From c0d071c53666e0ae6b9bb0f35dddf26bd0cf1316 Mon Sep 17 00:00:00 2001 From: Rhys Lees <43909932+RhysLees@users.noreply.github.com> Date: Sat, 1 Mar 2025 00:01:33 +0000 Subject: [PATCH 05/13] WIP --- composer.json | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/composer.json b/composer.json index ed01a33..12a07a2 100644 --- a/composer.json +++ b/composer.json @@ -28,12 +28,13 @@ "ext-xsl": "*", "guzzlehttp/guzzle": "^7.8", "illuminate/contracts": "^12.0", - "monolog/monolog": "^3.5", + "monolog/monolog": "^3.8", "nyholm/psr7": "^1.8", - "php-http/logger-plugin": "^1.3", - "php-soap/psr18-wsse-middleware": "^2.3", - "phpro/soap-client": "^3.1", - "symfony/http-client": "^6.4", + "php-http/logger-plugin": "^1.4.0", + "php-soap/psr18-wsse-middleware": "^2.5.0", + "phpro/soap-client": "^3.4.1", + "symfony/http-client": "^7.2", + "psr/http-client": "1.0.3", "spatie/laravel-package-tools": "^1.19" }, "require-dev": { From 669cb96d57b6943515faff631d8190c7c0611210 Mon Sep 17 00:00:00 2001 From: Rhys Lees <43909932+RhysLees@users.noreply.github.com> Date: Sat, 1 Mar 2025 00:06:02 +0000 Subject: [PATCH 06/13] WIP --- composer.json | 1 + 1 file changed, 1 insertion(+) diff --git a/composer.json b/composer.json index 12a07a2..7c9b21e 100644 --- a/composer.json +++ b/composer.json @@ -35,6 +35,7 @@ "phpro/soap-client": "^3.4.1", "symfony/http-client": "^7.2", "psr/http-client": "1.0.3", + "psr/http-factory": "1.1.0", "spatie/laravel-package-tools": "^1.19" }, "require-dev": { From cb8ed4667eb27dfdd37ae10c772d0acd060a0be6 Mon Sep 17 00:00:00 2001 From: Rhys Lees <43909932+RhysLees@users.noreply.github.com> Date: Sat, 1 Mar 2025 00:08:25 +0000 Subject: [PATCH 07/13] WIP --- composer.json | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/composer.json b/composer.json index 7c9b21e..ed01a33 100644 --- a/composer.json +++ b/composer.json @@ -28,14 +28,12 @@ "ext-xsl": "*", "guzzlehttp/guzzle": "^7.8", "illuminate/contracts": "^12.0", - "monolog/monolog": "^3.8", + "monolog/monolog": "^3.5", "nyholm/psr7": "^1.8", - "php-http/logger-plugin": "^1.4.0", - "php-soap/psr18-wsse-middleware": "^2.5.0", - "phpro/soap-client": "^3.4.1", - "symfony/http-client": "^7.2", - "psr/http-client": "1.0.3", - "psr/http-factory": "1.1.0", + "php-http/logger-plugin": "^1.3", + "php-soap/psr18-wsse-middleware": "^2.3", + "phpro/soap-client": "^3.1", + "symfony/http-client": "^6.4", "spatie/laravel-package-tools": "^1.19" }, "require-dev": { From d3f7ebb9cce67344efb762d52005f649ac3f493e Mon Sep 17 00:00:00 2001 From: Rhys Lees <43909932+RhysLees@users.noreply.github.com> Date: Sat, 1 Mar 2025 00:10:14 +0000 Subject: [PATCH 08/13] WIP --- composer.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/composer.json b/composer.json index ed01a33..f450b05 100644 --- a/composer.json +++ b/composer.json @@ -68,7 +68,7 @@ "composer/package-versions-deprecated": false, "pestphp/pest-plugin": true, "phpstan/extension-installer": true, - "php-http/discovery": true + "php-http/discovery": false } }, "extra": { From 96088723765bc383c8ed5c91c136fc4b86febfb2 Mon Sep 17 00:00:00 2001 From: Rhys Lees <43909932+RhysLees@users.noreply.github.com> Date: Sat, 1 Mar 2025 00:17:08 +0000 Subject: [PATCH 09/13] WIP --- .github/workflows/run-tests.yml | 5 +---- composer.json | 11 ++++++----- 2 files changed, 7 insertions(+), 9 deletions(-) diff --git a/.github/workflows/run-tests.yml b/.github/workflows/run-tests.yml index 0ed3c96..582eef4 100644 --- a/.github/workflows/run-tests.yml +++ b/.github/workflows/run-tests.yml @@ -24,14 +24,11 @@ jobs: - name: Checkout code uses: actions/checkout@v4 - - name: Clear Composer Cache - run: composer clear-cache - - name: Setup PHP uses: shivammathur/setup-php@v2 with: php-version: ${{ matrix.php }} - extensions: dom, curl, libxml, mbstring, zip, pcntl, pdo, sqlite, pdo_sqlite, bcmath, soap, xsl, intl, gd, exif, iconv, imagick, fileinfo + extensions: dom, curl, libxml, mbstring, zip, pcntl, pdo, sqlite, pdo_sqlite, bcmath, soap, intl, gd, exif, iconv, imagick, fileinfo coverage: none - name: Setup problem matchers diff --git a/composer.json b/composer.json index f450b05..fa576a3 100644 --- a/composer.json +++ b/composer.json @@ -28,12 +28,13 @@ "ext-xsl": "*", "guzzlehttp/guzzle": "^7.8", "illuminate/contracts": "^12.0", - "monolog/monolog": "^3.5", + "monolog/monolog": "^3.8", "nyholm/psr7": "^1.8", - "php-http/logger-plugin": "^1.3", - "php-soap/psr18-wsse-middleware": "^2.3", - "phpro/soap-client": "^3.1", - "symfony/http-client": "^6.4", + "php-http/logger-plugin": "^1.4.0", + "php-soap/psr18-wsse-middleware": "^2.5.0", + "phpro/soap-client": "^3.4.1", + "symfony/http-client": "^7.2", + "psr/http-client": "1.0.3", "spatie/laravel-package-tools": "^1.19" }, "require-dev": { From 3f68f5c89c9491f273a8c1c4eb1e1c3afb8fe2ab Mon Sep 17 00:00:00 2001 From: Rhys Lees <43909932+RhysLees@users.noreply.github.com> Date: Sat, 1 Mar 2025 00:20:05 +0000 Subject: [PATCH 10/13] WIP --- composer.json | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/composer.json b/composer.json index fa576a3..d6508f5 100644 --- a/composer.json +++ b/composer.json @@ -69,9 +69,12 @@ "composer/package-versions-deprecated": false, "pestphp/pest-plugin": true, "phpstan/extension-installer": true, - "php-http/discovery": false + "php-http/discovery": true } }, + "discovery": { + "psr/http-factory-implementation": "GuzzleHttp\\Psr7\\HttpFactory" + }, "extra": { "laravel": { "providers": [ From af173f472ce291e6fbf35bd3b1a1c5065a6452b5 Mon Sep 17 00:00:00 2001 From: Rhys Lees <43909932+RhysLees@users.noreply.github.com> Date: Sat, 1 Mar 2025 00:22:29 +0000 Subject: [PATCH 11/13] WIP --- composer.json | 1 + 1 file changed, 1 insertion(+) diff --git a/composer.json b/composer.json index d6508f5..c855991 100644 --- a/composer.json +++ b/composer.json @@ -35,6 +35,7 @@ "phpro/soap-client": "^3.4.1", "symfony/http-client": "^7.2", "psr/http-client": "1.0.3", + "php-http/message-factory": "1.1.0", "spatie/laravel-package-tools": "^1.19" }, "require-dev": { From 988861b00bb6abe257993bcb83cd3bbff794f489 Mon Sep 17 00:00:00 2001 From: Rhys Lees <43909932+RhysLees@users.noreply.github.com> Date: Sat, 1 Mar 2025 00:23:57 +0000 Subject: [PATCH 12/13] WIP --- composer.json | 3 --- 1 file changed, 3 deletions(-) diff --git a/composer.json b/composer.json index c855991..678fe6b 100644 --- a/composer.json +++ b/composer.json @@ -33,9 +33,6 @@ "php-http/logger-plugin": "^1.4.0", "php-soap/psr18-wsse-middleware": "^2.5.0", "phpro/soap-client": "^3.4.1", - "symfony/http-client": "^7.2", - "psr/http-client": "1.0.3", - "php-http/message-factory": "1.1.0", "spatie/laravel-package-tools": "^1.19" }, "require-dev": { From 8bc4f912d1c371eb7b5ec44a3f965fb5e1fb6d26 Mon Sep 17 00:00:00 2001 From: Rhys Lees <43909932+RhysLees@users.noreply.github.com> Date: Sat, 1 Mar 2025 00:25:23 +0000 Subject: [PATCH 13/13] WIP --- composer.json | 3 --- 1 file changed, 3 deletions(-) diff --git a/composer.json b/composer.json index 678fe6b..b4b70f9 100644 --- a/composer.json +++ b/composer.json @@ -70,9 +70,6 @@ "php-http/discovery": true } }, - "discovery": { - "psr/http-factory-implementation": "GuzzleHttp\\Psr7\\HttpFactory" - }, "extra": { "laravel": { "providers": [