Skip to content

Commit 1c011ca

Browse files
authored
Merge branch 'master' into use-xml-from-robrichards
2 parents 058063d + 00a71ba commit 1c011ca

89 files changed

Lines changed: 2326 additions & 1131 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

‎.githooks/pre-commit‎

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
#!/bin/sh
2+
set -eu
3+
4+
if git diff --cached --name-only --diff-filter=ACM | grep -qE '\.php$'; then
5+
echo "PHP files changed — running unit tests..."
6+
make test_unit
7+
8+
make lint
9+
else
10+
echo "No PHP changes — skipping unit tests."
11+
fi

‎.github/dependabot.yaml‎

Lines changed: 26 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,30 @@
11
version: 2
2+
23
updates:
3-
- package-ecosystem: "composer"
4-
directory: "/"
4+
- package-ecosystem: composer
5+
directory: /
56
schedule:
6-
interval: "weekly"
7+
interval: weekly
78
open-pull-requests-limit: 10
9+
versioning-strategy: increase-if-necessary
10+
labels:
11+
- dependencies
12+
groups:
13+
php-platform:
14+
patterns:
15+
- php
16+
update-types:
17+
- minor
18+
- patch
19+
composer-minor-and-patch:
20+
patterns:
21+
- "*"
22+
exclude-patterns:
23+
- php
24+
update-types:
25+
- minor
26+
- patch
27+
ignore:
28+
- dependency-name: php
29+
versions:
30+
- "<8.3"

‎.github/workflows/ci.yml‎

Lines changed: 25 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,47 @@
11
name: CI
2-
32
on: [push]
4-
53
jobs:
64
build-test:
75
runs-on: ubuntu-latest
6+
strategy:
7+
matrix:
8+
# add 8.4 soon
9+
php-version: ['8.3']
810

911
steps:
1012
- name: Checkout code
11-
uses: actions/checkout@v2
13+
uses: actions/checkout@v4
1214

1315
- name: Setup .env
1416
run: cp .env.example .env
1517

18+
- name: Setup ownership
19+
run: git config --global --add safe.directory /app
20+
1621
- name: Replace placeholders with GitHub Secrets
1722
run: |
1823
sed -i "s/BLUEM_SENDER_ID=S/BLUEM_SENDER_ID=${{ secrets.BLUEM_SENDER_ID }}/g" .env
1924
sed -i "s/BLUEM_TEST_ACCESS_TOKEN=/BLUEM_TEST_ACCESS_TOKEN=${{ secrets.BLUEM_TEST_ACCESS_TOKEN }}/g" .env
2025
26+
- name: Setup PHP
27+
uses: shivammathur/setup-php@v2
28+
with:
29+
php-version: ${{ matrix.php-version }}
30+
extensions: mbstring, intl
31+
coverage: xdebug
32+
2133
- name: Run composer
22-
uses: php-actions/composer@v5
34+
uses: php-actions/composer@v6
35+
with:
36+
php_version: ${{ matrix.php-version }}
37+
38+
- name: PHPCS Lint
39+
run: make lint
2340

2441
- name: PHPUnit Tests
25-
uses: php-actions/phpunit@v3
42+
uses: php-actions/phpunit@v4
2643
with:
27-
version: 9.5
28-
php_version: 8.1
29-
bootstrap: vendor/autoload.php
44+
php_version: ${{ matrix.php-version }}
45+
version: 11
46+
bootstrap: ./vendor/autoload.php
3047
configuration: ./.github/workflows/phpunit.xml

‎.github/workflows/phpunit.xml‎

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,19 @@
11
<?xml version="1.0" encoding="UTF-8"?>
2-
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" bootstrap="vendor/autoload.php" colors="true" stopOnFailure="false" xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/10.0/phpunit.xsd" cacheDirectory=".phpunit.cache">
2+
<phpunit
3+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
4+
bootstrap="vendor/autoload.php" colors="true"
5+
stopOnFailure="false"
6+
xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/10.0/phpunit.xsd"
7+
>
38
<testsuites>
49
<testsuite name="Unit">
5-
<directory suffix="Test.php">../../tests</directory>
10+
<directory suffix="Test.php">../../tests/Unit</directory>
11+
</testsuite>
12+
<testsuite name="Integration">
13+
<directory suffix="Test.php">../../tests/Integration</directory>
14+
</testsuite>
15+
<testsuite name="Acceptance">
16+
<directory suffix="Test.php">../../tests/Acceptance</directory>
617
</testsuite>
718
</testsuites>
8-
</phpunit>
19+
</phpunit>

‎AGENTS.md‎

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
# AGENTS.md
2+
3+
## Project at a glance
4+
- `bluem-php` is a PHP 8.3 library for Bluem payment flows: Payments, eMandates, iDIN, and IBAN-name check.
5+
- `src/Bluem.php` is the main orchestration layer: it builds requests, validates XML, sends them through `Transport/`, and turns responses into `Responses/*` objects.
6+
- `src/Webhook.php` handles inbound webhook XML and is intentionally strict: HTTPS POST + `text/xml; charset=UTF-8` + XML/signature validation.
7+
8+
## Code structure to preserve
9+
- `src/Contexts/*` defines service-specific bank/BIC sets and XSD schema paths (`IdentityContext`, `PaymentsContext`, `MandatesContext`).
10+
- `src/Requests/*` owns XML/endpoint generation; `src/Responses/*` wraps `SimpleXMLElement` parsing.
11+
- `src/Transport/` isolates HTTP; `CurlHttpTransport` is the default and is injected into `Bluem` for testability.
12+
- `src/Validators/*` enforces XML and webhook constraints; do not bypass these checks in higher layers.
13+
14+
## Conventions specific to this repo
15+
- Public API names are legacy-compatible and intentionally mixed-case in places (`CreateMandateRequest`, `PerformRequest`, `getConfig`, `Webhook::getPurchaseID()`); avoid renaming unless you are ready to update downstream consumers.
16+
- `phpcs.xml.dist` uses PSR-12 with narrow exceptions for legacy method/property naming and file-header ordering.
17+
- Existing code mixes older style and newer strict typing; prefer small, behavior-preserving edits over broad refactors.
18+
19+
## Developer workflow
20+
- Install deps with `composer install`.
21+
- Lint with `make lint`; auto-fix style with `make lint_fix`.
22+
- Run unit tests with `make test_unit` or `./vendor/bin/phpunit tests/Unit`.
23+
- Run live tests with `make test_integration` / `make test_acceptance`; these require `.env`.
24+
- CI (`.github/workflows/ci.yml`) runs on PHP 8.3, then `make lint`, then PHPUnit.
25+
26+
## Environment and testing
27+
- Copy `.env.example` to `.env` for integration/acceptance tests.
28+
- Required env vars are enforced in `tests/Integration/BluemGenericTestCase.php`: `BLUEM_ENV`, `BLUEM_SENDER_ID`, `BLUEM_BRANDID`, `BLUEM_TEST_ACCESS_TOKEN`, `BLUEM_MERCHANTID`, `BLUEM_MERCHANTRETURNURLBASE`.
29+
- Unit tests typically use a fake transport; integration tests extend the shared base case and hit live Bluem services.
30+
31+
## When changing code
32+
- Update request/response/context pieces together so XML shape, endpoint URL, and validation stay aligned.
33+
- Check `validation/*.xsd` and `examples/` when touching service-specific payloads.
34+
- Keep webhook validation strict; relaxing HTTPS, content-type, or signature checks is a security regression.
35+

‎Makefile‎

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
test_unit:
2+
@printf 'Running unit tests:\n';
3+
./vendor/bin/phpunit tests/Unit --testdox --display-errors --display-warnings --display-deprecations --display-phpunit-deprecations --display-notices
4+
5+
test_integration:
6+
@printf 'Running integration tests:\n';
7+
@echo "Note: Ensure you have the necessary environment variables set for integration tests in the .env file."
8+
./vendor/bin/phpunit tests/Integration --testdox --display-errors --display-warnings --display-deprecations --display-phpunit-deprecations --display-notices
9+
10+
test_acceptance:
11+
@printf 'Running acceptance tests:\n';
12+
./vendor/bin/phpunit tests/Acceptance --testdox --display-errors --display-warnings --display-deprecations --display-phpunit-deprecations --display-notices
13+
14+
test:
15+
@printf 'Running all tests:\n';
16+
make test_unit;
17+
make test_acceptance;
18+
make test_integration;
19+
20+
lint:
21+
./vendor/bin/phpcs --standard=phpcs.xml.dist --extensions=php --ignore=vendor/ .
22+
23+
lint_fix:
24+
./vendor/bin/phpcbf --standard=phpcs.xml.dist --extensions=php --ignore=vendor/ .
25+
26+
27+
setup-git-hooks:
28+
@echo "Setting up Git hooks..."
29+
git config core.hooksPath .githooks
30+
chmod +x .githooks/pre-commit

‎README.md‎

Lines changed: 20 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
![Bluem](https://bluem.nl/img/BluemAboutIcon.svg)
1+
<img width="250" height="250" alt="image" src="https://github.com/user-attachments/assets/c1e56d5e-87c6-41db-8076-880255523f86" />
22

33
**Bluem-php for Payment, Mandates, iDIN & IBAN-Name check**
44

@@ -50,14 +50,19 @@ Utilized by other applications as well:
5050
* [Appendices](#appendices)
5151
+ [List of all supported BICs per context](#list-of-all-supported-bics-per-context)
5252

53-
## Requirements
54-
- Update April 2024: Since our release >= 2.4, **PHP 8.1** is the minimum required version for this library. Previous releases requires **PHP 8.0**.
53+
54+
# Requirements & Versioning
55+
## 3.0 is coming with PHP 8.3 support and requirement
56+
A new version of the PHP library will be released in the coming 1-2 months.
57+
Starting this release, **PHP 8.3** is the minimum required version for this library.
58+
- 2026: Starting at our release >= 3.0, **PHP 8.3** is the minimum required version for this library. Previous releases requires **PHP 8.1**.
59+
- 2024: Starting at our release >= 2.4, **PHP 8.1** is the minimum required version for this library. Previous releases requires **PHP 8.0**.
5560
- Update April 2023: Since our release >= 2.3, **PHP 8.0** is the minimum required version for this library. Previous releases requires **PHP 7.4**.
5661

5762
- Please use the [major git releases](https://github.com/bluem-development/bluem-php/releases) for the stable versions of this plugin.
5863
- Refer to the `composer.json` requirements for any other dependencies
5964

60-
## Getting started
65+
# Getting started
6166
Install the library through [Composer](https://getcomposer.org). Run Composer to install this library and dependencies from your project folder.
6267

6368
```bash
@@ -74,6 +79,8 @@ See [Changelog](changelog.md)
7479
## Testing
7580
For improving future features, unit testing is introduced since november 2021.
7681

82+
The repository also has a PHPCS linting setup: `make lint` runs the shared ruleset from `phpcs.xml.dist`, and CI uses the same lint step so local and automated checks stay aligned. That XML file also contains a few narrow exceptions for legacy naming and file-header issues, which lets the existing public API stay intact without failing the build on historical style violations.
83+
7784
Tests are located in the `tests` folder
7885
To run tests:
7986
```
@@ -245,6 +252,12 @@ To use Carte Bancaire, use the following method:
245252
$request = $request->setPaymentMethodToCarteBancaire();
246253
```
247254

255+
To use Bancontact, use the following method
256+
```php
257+
$request = $request->setPaymentMethodToBancontact();
258+
```
259+
260+
248261
These methods will throw an exception if required information is missing.
249262

250263
Once the request executes, the link to the transaction will send you to the Bluem Portal with the corresponding interface and flow.
@@ -790,12 +803,12 @@ To be able to use webhook functionality, retrieve a copy of the Webhook certific
790803
#### ePayments
791804
- ABN AMRO <BR> BIC: `ABNANL2A`
792805
- ASN Bank <BR> BIC: `ASNBNL21`
806+
- ASN (previously SNS) <BR> BIC: `SNSBNL2A`
793807
- bunq <BR> BIC: `BUNQNL2A`
794808
- ING <BR> BIC: `INGBNL2A`
795809
- Knab <BR> BIC: `KNABNL2H`
796810
- Rabobank <BR> BIC: `RABONL2U`
797811
- RegioBank <BR> BIC: `RBRBNL21`
798-
- SNS <BR> BIC: `SNSBNL2A`
799812
- Triodos Bank <BR> BIC: `TRIONL2U`
800813
- Van Lanschot <BR> BIC: `FVLBNL22`
801814
- Revolut <BR> BIC: `REVOLT21`
@@ -805,10 +818,10 @@ To be able to use webhook functionality, retrieve a copy of the Webhook certific
805818
#### eMandates CORE
806819
- ABN AMRO <BR> BIC: `ABNANL2A`
807820
- ASN Bank <BR> BIC: `ASNBNL21`
821+
- ASN (previously SNS) <BR> BIC: `SNSBNL2A`
808822
- ING <BR> BIC: `INGBNL2A`
809823
- Rabobank <BR> BIC: `RABONL2U`
810824
- RegioBank <BR> BIC: `RBRBNL21`
811-
- SNS <BR> BIC: `SNSBNL2A`
812825
- Triodos Bank <BR> BIC: `TRIONL2U`
813826
#### eMandates B2B
814827
- ABN AMRO <BR> BIC: `ABNANL2A`
@@ -818,11 +831,11 @@ To be able to use webhook functionality, retrieve a copy of the Webhook certific
818831
#### Identity
819832
- ABN AMRO <BR> BIC: `ABNANL2A`
820833
- ASN Bank <BR> BIC: `ASNBNL21`
834+
- ASN (previously SNS) <BR> BIC: `SNSBNL2A`
821835
- bunq <BR> BIC: `BUNQNL2A`
822836
- ING <BR> BIC: `INGBNL2A`
823837
- Rabobank <BR> BIC: `RABONL2U`
824838
- RegioBank <BR> BIC: `RBRBNL21`
825-
- SNS <BR> BIC: `SNSBNL2A`
826839

827840
Please note: Knab with BIC: `KNABNL2H` does not support eMandates CORE anymore as of 4th of October 2023.
828841

‎composer.json‎

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,13 @@
2424
"support": {
2525
"issues": "https://github.com/bluem-development/bluem-php"
2626
},
27+
"config": {
28+
"platform": {
29+
"php": "8.3"
30+
}
31+
},
2732
"require": {
28-
"php": ">=8.1",
33+
"php": ">=8.3",
2934
"ext-dom": "*",
3035
"ext-libxml": "*",
3136
"ext-simplexml": "*",
@@ -41,12 +46,11 @@
4146
}
4247
},
4348
"require-dev": {
44-
"phpunit/phpunit": "^9.5",
49+
"phpunit/phpunit": "^12",
4550
"phpspec/prophecy": "~1.0",
4651
"vlucas/phpdotenv": "^5.4",
47-
"rector/rector": "^0.15.10",
52+
"rector/rector": "^2.4",
4853
"squizlabs/php_codesniffer": "^3.7",
49-
"magento/magento-coding-standard": "^31.0",
5054
"phpcompatibility/php-compatibility": "^9.3"
5155
},
5256
"prefer-stable": true,

0 commit comments

Comments
 (0)