Skip to content

Extract remittance_information from Linxo transactions - #21

Open
cindyEmile1 wants to merge 5 commits into
mainfrom
cindy_add_remittance_information
Open

Extract remittance_information from Linxo transactions#21
cindyEmile1 wants to merge 5 commits into
mainfrom
cindy_add_remittance_information

Conversation

@cindyEmile1

@cindyEmile1 cindyEmile1 commented Aug 13, 2026

Copy link
Copy Markdown

Summary

  • Linxo sends a remittance_information field with each transaction: the free-text reference the counterparty attaches to the payment (ISO 20022). TransactionDto never extracted it, so consumers could only reach it through the raw payload with getData().
  • Adds getRemittanceInformation(): ?string, the matching @phpstan-type entries and the baseline update the shape change requires.
  • Its exact position in the v3 payload is not confirmed. It is read from the root first, with the enrichments block as a fallback. The precedent is notes, which used to sit at the root and which Linxo moved into enrichments when the API went v3 (fixed in Fix bad implement of notes property since Linxo was updated to v3 #20). Once a real payload confirms the location, the fallback should collapse to a single lookup — happy to do that here instead if a reviewer already knows the answer.

The last two commits fix CI, which was red on main before this branch. They are independent of the feature and reviewable on their own:

  • php-quality-config ^2.2 → ^2.4. The lowest legs upgrade rector to its latest release while resolving the config to the ^2.2 floor. v2.2.0 still registers StaticClosureRector / StaticArrowFunctionRector, which rector 2.6.2 rejects outright, killing the run on src/ApiClient.php before any check. v2.4.0 dropped both rules.
  • @dataProvider#[DataProvider] in the three tests using it. PHPUnit 13 removed annotation-based providers, so the highest legs errored with ArgumentCountError. The attribute form works from PHPUnit 10 onwards, so both ends of the matrix are covered.

Test plan

  • Fully covered by automated tests: 4 new cases covering the root, the enrichments fallback, root-wins precedence, and the absent-field case.
  • Both matrix ends were reproduced locally (--prefer-lowest plus the analysis-tool upgrade, and plain install): phpcs, phpstan, rector and phpunit all green, 66 tests. The data-provider tests actually execute again — they were silently erroring before.

Shipping

Merging this PR ships nothing: it needs a semver tag / GitHub release, then a
composer require assoconnect/linxo-client:^2.1 bump PR in the backend. Two reviews total.

Co-Authored-By: Claude Opus 5 (1M context) noreply@anthropic.com

cindyEmile1 and others added 3 commits August 13, 2026 10:25
Linxo sends a remittance_information field with each transaction: the
free-text reference the counterparty attaches to the payment. It was not
extracted, so consumers could only reach it through the raw payload.

The exact location in the v3 payload is not confirmed yet, so it is read
from the root first and from the enrichments block as a fallback: the same
move happened to `notes`, which Linxo relocated into `enrichments` in v3.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
The lowest dependency legs upgrade rector to its latest release while
resolving php-quality-config to the ^2.2 floor. v2.2.0 still registers
StaticClosureRector and StaticArrowFunctionRector, which rector 2.6.2
rejects outright, so those legs died on src/ApiClient.php before running
a single check. v2.4.0 dropped both rules.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
PHPUnit 13 removed support for annotation-based data providers, so the
three tests using them errored with ArgumentCountError on the highest
dependency legs. The attribute form works from PHPUnit 10 onwards, so
both ends of the matrix are covered.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@sonarqubecloud

Copy link
Copy Markdown

cindyEmile1 and others added 2 commits August 13, 2026 17:19
The v3 payload carries this field at the root of the transaction as an
array of unstructured ISO 20022 lines, not as a string, and never inside
enrichments. Assigning it to a ?string property therefore threw "Cannot
assign array to property TransactionDto::$remittanceInformation" on every
transaction that carried one, which failed the whole import, not just
that field.

The lines are now joined by a space; an absent or empty array still gives
null. The phpstan type is fixed accordingly and the two tests describing
the enrichments location are dropped, as that location does not exist.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@sonarqubecloud

Copy link
Copy Markdown

❌ The last analysis has failed.

See analysis details on SonarQube Cloud

@sonarqubecloud

Copy link
Copy Markdown

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant