Skip to content

[CC-4239] Add recurring flag to SepaDirectDebit - #247

Merged
Ryouzanpaku merged 14 commits into
mainfrom
CC-4239/sepa-recurring-flag
Nov 18, 2026
Merged

Ryouzanpaku merged 14 commits into
mainfrom
CC-4239/sepa-recurring-flag

Conversation

@Ryouzanpaku

@Ryouzanpaku Ryouzanpaku commented Nov 5, 2026 •

Copy link
Copy Markdown
Contributor

What

Adds a recurring boolean request field to the sepa-direct-debit payment type. For SEPA, recurrence intent is captured once at type registration via recurring on POST /v1/types/sepa-direct-debit.

  • SepaDirectDebit::setRecurring(bool $recurring): self — public, fluent (matches setIban/setBic/setHolder).
  • SepaDirectDebit::isRecurring(): bool — getter (from CanRecur); returns the set value, or the value mapped from a fetched resource, false when never set.
  • recurring is always included in the type-registration request body, defaulting to false when never set.

Why

SepaDirectDebit relies on the shared CanRecur trait whose $recurring property is private. AbstractUnzerResource::expose() serializes only protected (non-null) properties, so the flag never reached the request body — it only reflected the API's read-only response flag. This is the same class of bug fixed for Keypair in 4.0.2 ("silently omitted when serialized into a request payload").

How it's implemented

The shared CanRecur trait is left untouched — its $recurring stays private/response-only, so Card, Paypal and SepaDirectDebitSecured are unaffected (zero blast radius). SepaDirectDebit keeps use CanRecur and adds only two members:

  • setRecurring(bool): self — widens the trait's protected setter to public and writes the trait's own $recurring, so isRecurring() (from the trait) reflects it.
  • expose() override — always appends recurring (default false) to the serialized body.

Keeping the trait means activateRecurring() and the ResourceService::activateRecurringPayment() capability gate (in_array(CanRecur::class, class_uses(...))) continue to accept SepaDirectDebit. Removing the trait would have thrown RuntimeException before reaching the API — see the resolved review thread.

Trade-off

Ideally recurring would be omitted when never set, but the trait's property is a non-nullable bool (can't model "unset"), and a nullable redeclaration on the subclass collides with the trait. Always sending the flag with a false default is the chosen compromise; it is scoped to SepaDirectDebit only.

Tests

  • Unit (test/unit/Resources/PaymentTypes/SepaDirectDebitTest.php): setter/getter round-trip, expose() always contains recurring (true / false / default-false), empty-type edge case, and response-mapping via handleResponse().
  • test/unit/Services/ResourceServiceTest.php::activateRecurringPaymentAcceptsSepaDirectDebit — regression guard that the type keeps the CanRecur gate.
  • Integration (test/integration/PaymentTypes/SepaDirectDebitTest.php): create-with-setRecurring(true) → fetch → isRecurring() is true. Requires sandbox credentials; not run in CI.
  • Full unit suite green (751 tests).

CHANGELOG

The CHANGELOG entry is not part of this PR. Changelog and version edits for the 4.1.0 release are scoped to the release ticket CC-4078 in #248, which adds the ### Added entry for this feature alongside the 5.0.0 → 4.1.0 version rename. This keeps #247 code-only.

Merge order

#247 and #248 both target the 4.1.0 release and change disjoint files, so either can merge first without a conflict.

🤖 Generated with Claude Code

For SEPA, recurrence intent is captured once at type registration via a
recurring boolean on POST /v1/types/sepa-direct-debit.

The CanRecur trait declared $recurring as a private property, so
AbstractUnzerResource::expose() (which serializes only protected
properties) silently omitted it from request bodies. Make the trait
property protected and nullable (default null) and null-safe in
isRecurring(), mirroring the 4.0.2 Keypair private->protected fix.
SepaDirectDebit redeclares the property and adds a public fluent
setRecurring(); the value is only sent when explicitly set, so request
bodies are unchanged when unset. Response mapping is unchanged.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Keep the recurring entry under the planned 4.1.0 release header instead
of 5.0.0, consistent with CC-4078.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Ryouzanpaku added a commit that referenced this pull request Nov 5, 2026
Scope the SepaDirectDebit recurring changelog entry under the release
ticket (CC-4078) alongside the version rename, so the feature PR #247
(CC-4239) stays code-only and the two don't conflict.
Changelog and version edits live in the release ticket (CC-4078), so this
feature branch is code-only and won't conflict with the release changelog.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

The shared recurring property leaks response-only state into PUT payloads for fetched Card, Paypal, and SepaDirectDebitSecured instances instead of limiting serialization to SepaDirectDebit.

1 open issue
What changed in this PR

Adds support for specifying recurring-payment intent when registering a SEPA Direct Debit payment type in the SDK.

Changes:

  • Adds a public fluent SepaDirectDebit::setRecurring() setter.
  • Makes the shared recurring property serializable while retaining a default-false getter and omitting unset values.
  • Adds unit coverage and a sandbox integration test for recurring registration.
File Description
test/​unit/​Resources/​PaymentTypes/​SepaDirectDebitTest.php Tests setter behavior, conditional serialization, and response mapping.
test/​integration/​PaymentTypes/​SepaDirectDebitTest.php Tests creating and fetching a recurring SEPA payment type.
src/​Traits/​CanRecur.php Makes recurring state protected and nullable, with a null-safe getter.
src/​Resources/​PaymentTypes/​SepaDirectDebit.php Declares the recurring field and adds its public fluent setter.

Review effort: Balanced

Comment thread src/Traits/CanRecur.php Resolved
…t field private

expose() serializes every protected property, so making CanRecur::$recurring
protected leaked the response-only flag into requests for all trait consumers
(Card, Paypal, SepaDirectDebitSecured) after a fetch-then-update. Revert it to
private (nullable, null-safe getter) so it is never serialized for them, and
have SepaDirectDebit expose recurring itself via an expose() override, only once
set. Drops the now-redundant property redeclaration on SepaDirectDebit and adds
a fetched-Card regression test.

Addresses the Copilot review comment on PR #247.
Instead of changing the shared CanRecur trait, SepaDirectDebit no longer uses it
for recurring. The trait is reverted to its original state, so $recurring stays
private/response-only for Card, Paypal and SepaDirectDebitSecured. SEPA declares
its own protected ?bool $recurring, which the default expose() serializes when set
and omits when null (protected + null-skip) — no expose() override needed. The
deprecated activateRecurring() is re-added on the type to preserve BC.

Keeps the fetched-Card regression test.
With CanRecur left untouched, Card is no longer affected by this change, so the
fetched-Card serialization test guards behaviour outside this PR's scope. The
in-scope SepaDirectDebit unit tests already cover the recurring serialization.
@Ryouzanpaku
Ryouzanpaku marked this pull request as ready for review November 9, 2026 14:20
@Ryouzanpaku
Ryouzanpaku requested a review from a team as a code owner November 9, 2026 14:20
@Ryouzanpaku
Ryouzanpaku requested a balanced review from Copilot November 12, 2026 13:19

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

Removing CanRecur causes the service’s trait-based capability check to reject SepaDirectDebit, breaking both existing recurring-activation entry points with a RuntimeException before reaching the API.

1 open issue
1 resolved since last review

Review effort: Balanced

Comment on lines +134 to +136
public function activateRecurring($returnUrl, $recurrenceType = null): Recurring
{
return $this->getUnzerObject()->activateRecurringPayment($this, $returnUrl, $recurrenceType);

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch — fixed by keeping CanRecur on SepaDirectDebit rather than removing it.

SepaDirectDebit now uses the trait again, so activateRecurringPayment()'s class_uses(CanRecur::class) gate accepts it and both $sdd->activateRecurring(...) and $unzer->activateRecurringPayment($sdd, ...) work. The deprecated activateRecurring() comes from the trait now (local copy dropped).

The original serialization fix is preserved without touching the trait for the other consumers:

  • CanRecur::$recurring stays private / response-only — Card, Paypal, SepaDirectDebitSecured unaffected (no leak on fetch-then-update).
  • The request-time flag is owned by SepaDirectDebit via a nullable $recurringRequested shadow, emitted through an expose() override only when explicitly set (including false); a fresh instance's body is unchanged.

Added regression coverage:

  • ResourceServiceTest::activateRecurringPaymentAcceptsSepaDirectDebit — guards the capability gate so removing the trait fails loudly.
  • SepaDirectDebitTest::recurringIsExposedWhenTypeIsOtherwiseEmpty — covers the expose() override on an empty (null-IBAN) type.

Full unit suite green (751 tests).

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔵 Needs a closer look

Removing CanRecur from SepaDirectDebit without updating the service capability check causes legacy recurring activation calls to throw before reaching the API, breaking the existing SEPA integration test.

1 open issue

Review effort: Balanced

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔵 Needs a closer look

Removing CanRecur from SepaDirectDebit leaves the service’s eligibility check rejecting legacy SEPA recurring activation calls before any API request, breaking backwards compatibility.

1 open issue

Review effort: Balanced

@sixer1182 sixer1182 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Review: changes requested

The mechanism matches the tech spec: the recurring flag is sent once at type registration, nothing is added to the charge, and CanRecur as well as the other payment types stay untouched. Unit tests pass locally (749) and in CI. There is one blocker, tests are missing, and some deviations from the ticket need a decision.

1. Blocker: backward compatibility is broken for the deprecated recurring activation

Backward compatibility must be guaranteed for this change. It is not at the moment.

SepaDirectDebit no longer uses CanRecur, but ResourceService::activateRecurringPayment() still decides per class_uses() whether a payment type supports recurring (src/Services/ResourceService.php:433). For SepaDirectDebit this check now fails. I reproduced it on the PR head (3bae334):

$resourceService->activateRecurringPayment($sdd, 'https://example.com/return');
-> RuntimeException: Recurring is not available for the given payment type.

Both public entry points are affected: $sdd->activateRecurring(...) and $unzer->activateRecurringPayment($sdd, ...). The local copy of activateRecurring() on SepaDirectDebit therefore does not preserve compatibility, and the statements "preserving backwards compatibility" and "zero blast radius" in the PR description are incorrect. This is a breaking change in a minor release. The ticket also explicitly says to keep the CanRecur trait and to leave the deprecated activation flow unchanged. (Copilot raised the same point: #247 (comment))

Please fix it so that existing callers of both entry points keep working exactly as before. Two options:

  1. Keep use CanRecur on SepaDirectDebit (as the ticket asks). The trait's $recurring stays private, and SepaDirectDebit overrides expose() to add recurring only when it was explicitly set. This was the approach of an earlier commit on this branch. I did not test it.
  2. Keep the current inline approach and make the check in ResourceService accept SepaDirectDebit without the trait.

Whichever option you choose, the local duplicate of activateRecurring() should only stay if it is still needed.

2. Missing tests (required before approval)

  1. Unit test for ResourceService::activateRecurringPayment() with a real SepaDirectDebit instance (object and id variant). The existing tests only use the dummy TraitDummyCanRecur, which is why this was not caught.
  2. Unit test for SepaDirectDebit::activateRecurring() calling through to the service without a RuntimeException.
  3. Unit test for the behavior of a fetched type: after handleResponse() with recurring, what does expose() contain? Currently the response value is sent again on update requests ({"iban":…,"id":…,"recurring":false}). Please document the intended behavior in a test. If PAPI does not accept recurring on PUT /v1/types/sepa-direct-debit/{id}, this needs to be changed. Please confirm against the PAPI schema.
  4. The new integration test has not been run (needs sandbox credentials, not part of CI). The ticket's acceptance criteria require it to pass. Please run it against the sandbox and state the result in the PR. Note that the registration call-through to the SEPA PMP sits behind a system property in PAPI; please confirm the sandbox returns recurring on create and fetch.

3. Deviations from the ticket (CC-4239)

  1. CanRecur removed from SepaDirectDebit instead of kept. The ticket says to keep it and resolve the clash. Your reasoning about the private property clash is correct, and the deviation is documented in the ticket comment. It is, however, the cause of the blocker above, and the ticket lists the deprecated activation flow as out of scope for changes. Please resolve it as described in section 1.
  2. Duplicated activateRecurring() on the class. The ticket says to leave the deprecated flow as is. A copy with identical docblock creates two places to maintain.
  3. No CHANGELOG entry in this PR, although the ticket lists CHANGELOG.md among the files and the acceptance criteria. The entry is in #248 (whose title mentions only the version rename). That is acceptable if #247 and #248 are merged together, or #247 first. Please state this in the PR description so the changelog never mentions a feature that is not in the code yet.
  4. Two PRs instead of one. The ticket asks for exactly one PR. Follows from point 3; please confirm this split is agreed.
  5. recurring is serialized for fetched instances (see test item 3). The ticket's criterion "request body unchanged when nothing is set" holds for fresh instances only. This should be a deliberate decision, not a side effect.

4. What looks good

  1. setRecurring(bool): self is public and fluent; isRecurring() returns false when nothing was set.
  2. A fresh instance exposes no recurring key; set to true or false it is exposed.
  3. Response mapping works through handleResponse() and nothing writes the value twice.
  4. SepaDirectDebitSecured, Card and Paypal are unchanged.

Changes requested for: the compatibility break (1), the missing tests (2), and a decision on the deviations (3).

Ryouzanpaku and others added 2 commits November 17, 2026 10:40
…gate

SepaDirectDebit no longer dropped the CanRecur trait. Removing it had
broken the capability gate in ResourceService::activateRecurringPayment()
(class_uses check), so both $sdd->activateRecurring(...) and
$unzer->activateRecurringPayment($sdd, ...) threw RuntimeException before
reaching the API.

The trait's $recurring stays private/response-only (Card, Paypal,
SepaDirectDebitSecured unaffected). The request-time flag is owned by
SepaDirectDebit via a nullable $recurringRequested shadow, exposed through
an expose() override that emits `recurring` only when explicitly set
(including false); a fresh instance's request body is unchanged.

Add ResourceServiceTest::activateRecurringPaymentAcceptsSepaDirectDebit as
a regression guard.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
…epaDirectDebit

Exercises the expose() override's (array) cast when parent::expose()
returns an empty stdClass (null IBAN), the edge case the override guards.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@Ryouzanpaku
Ryouzanpaku force-pushed the CC-4239/sepa-recurring-flag branch from 6035f56 to 531f574 Compare November 17, 2026 09:40
Ryouzanpaku and others added 3 commits November 17, 2026 10:46
…e (default false)

Drop the nullable $recurringRequested shadow and the isRecurring() override.
SepaDirectDebit now writes the trait's own $recurring via a public setRecurring()
and always serializes it (default false) in the type-registration body, instead of
omitting it when unset. The trait's non-nullable bool can't model "unset", so the
always-send-with-false-default is the chosen trade-off.

isRecurring() and activateRecurring() come straight from the trait; the class_uses()
gate in ResourceService still accepts the type.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
…via use-adaptation

The override's body was identical to CanRecur::setRecurring() — its only
purpose was widening visibility. Replace it with `use CanRecur { setRecurring
as public; }`, which changes visibility without redefining the method.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
…ptation

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

Copy link
Copy Markdown
Contributor Author

Reworked along your option 1 (re: #247 (review)).

New approach: SepaDirectDebit keeps use CanRecur and the trait is left completely untouched ($recurring stays private/response-only → Card, Paypal, SepaDirectDebitSecured unaffected). The type now adds only an expose() override that serializes the trait's private recurring property, plus setRecurring as public via trait adaptation to widen the trait's protected setter. isRecurring() and activateRecurring() come straight from the trait again.

Blocker resolved: because the trait is retained, the class_uses(CanRecur::class) gate in ResourceService::activateRecurringPayment() accepts SepaDirectDebit again — both $sdd->activateRecurring(...) and $unzer->activateRecurringPayment($sdd, ...) work as before. The duplicated local activateRecurring() is gone. Added a regression test (ResourceServiceTest::activateRecurringPaymentAcceptsSepaDirectDebit) so removing the trait fails loudly.

Small caveat: the override always sends recurring (defaulting to false when unset) rather than omitting it when unset. The trait's $recurring is a non-nullable bool and can't model "unset" without reintroducing a separate nullable shadow property; a nullable redeclaration on the subclass is a PHP fatal (trait property collision). Always sending recurring: false is acceptable from my side — it's a minor, non-breaking payload addition scoped to sepa-direct-debit only (SEPA registration treats absent and false identically). Noted on CC-4239.

Full unit suite green (751). PR description and the Jira ticket updated to match.

@sixer1182 sixer1182 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Follow-up review: changes still requested

Thanks for the rework. I re-checked the PR head (696dcc1) locally: 751 unit tests pass.

Resolved

  1. The compatibility break is fixed. SepaDirectDebit uses CanRecur again, the trait is untouched, and the class_uses() check in ResourceService::activateRecurringPayment() accepts the type. Card, Paypal and SepaDirectDebitSecured serialize as before, also after a fetch.
  2. The duplicated activateRecurring() is gone.

Still open

1. recurring is now always sent: decision needed

The ticket's acceptance criterion says the request body must be unchanged when setRecurring() was never called. With the expose() override, {"iban":…,"recurring":false} is sent for every new SEPA type. The tech spec says false and absent mean the same (one-off mandate), so the behavior is functionally equivalent for a PAPI that has the field. I still see two risks and one alternative:

  1. A PAPI version without the field, or a strict schema check, could reject an unknown field. The epic names the PAPI release that introduced it, but nothing in this PR confirms that all environments have it.
  2. After a fetch, expose() sends the value from the API response, including on the IBAN-amendment PUT that the tech spec adds. Please confirm with the PAPI team that PUT /v1/types/sepa-direct-debit/{id} accepts or ignores recurring. The mandate type is set once at activation.
  3. The reasoning that "unset" cannot be modeled is too narrow. A separate nullable property in SepaDirectDebit (a different name than the trait's private $recurring, not an exposed protected property) does not collide with the trait. setRecurring() would set both, and expose() would add recurring only when it was explicitly set. This keeps the acceptance criterion.

Please either implement option 3 or get a written confirmation for points 1 and 2 and update the ticket's acceptance criteria accordingly.

2. Missing tests (still requested)

  1. SepaDirectDebit::activateRecurring() called directly on the type (not only through the service).
  2. activateRecurringPayment() with a type ID (the fetch variant), not only with an object.
  3. Behavior after a fetch: what expose() contains after handleResponse() with recurring true and false, and without the field.

3. Integration test

The new integration test still has not been reported as run. Please run it against the sandbox and state the result in the PR, including whether the sandbox returns recurring on create and fetch.

4. Outdated descriptions

  1. The PR description says the CHANGELOG entry was added in this PR. It is not part of the diff (it is in #248). Please correct the text and state the merge order (#247 first or both together).
  2. An earlier comment on this PR describes a $recurringRequested property and an expose() that sends the flag only when set. Neither exists in the current code. Please mark the comment as outdated.

Changes requested for points 1 to 3. Point 4 is clean-up.

@Ryouzanpaku

Ryouzanpaku commented Nov 18, 2026 •

Copy link
Copy Markdown
Contributor Author

Updated: points 2 and 3 resolved (tests added, integration run).

Thanks @sixer1182 — glad the BC break and the duplicate activateRecurring() are resolved. On the open points:

1. recurring always sent — accepted, by design. Emitting the flag at registration is the whole purpose of CC-4239. For SEPA, recurring: false and an absent field are semantically identical: both register a one-off (OOFF) mandate — the mandate type is derived from the flag at registration (CC-4069), there is no recurrence data on the charge. So always sending false for a never-set type changes the payload shape, not the outcome. The field has shipped in PAPI since AHC-8053 (release 1.191 per the epic), which the supported environments run, so an unknown-field rejection isn't a concern on supported PAPI.

We're keeping always-send over option 3 deliberately: staying on use CanRecur preserves activateRecurring() and the ResourceService class_uses(CanRecur) capability gate, whereas a separate nullable property reintroduces a shadow field to keep in sync. The AC's "unchanged when unset" wording is relaxed accordingly to "recurring is always sent, defaulting to false" — recorded on CC-4239.

On the amend PUT: the mandate type is fixed at registration, so a recurring value on a later IBAN-amend PUT is inert; worth a one-line confirmation from the PAPI team, but not a behavioural risk.

2. Tests. ✅ Done. The existing coverage (activateRecurringPaymentAcceptsSepaDirectDebit service gate, createRecurringShouldFetchThePaymentTypeById type-ID/fetch variant, recurringIsMappedFromResponse + recurringIsAlwaysExposed) is now joined by SepaDirectDebitTest::sepaDirectDebitShouldActivateRecurringViaType (integration), covering point 2.1 — activateRecurring() called directly on the type.

3. Integration test. ✅ Run against the sandbox — OK (2 tests, 6 assertions). The sandbox persists and returns recurring on create and fetch (sepaDirectDebitShouldBeCreatableWithRecurringFlag). The new type-level activateRecurring() reaches PAPI and is rejected for SEPA with API.640.550.005 (mandate is registered during charge/authorize), confirming the CanRecur capability gate still routes the type to the API.

4. Descriptions. Fixed: the PR description no longer claims the CHANGELOG is in this PR — it's scoped to #248 (CC-4078) with the version rename, and I added the merge order (disjoint files, either order). The earlier "expose only when set" inline comment is marked outdated below.

…integration)

Guards that keeping the CanRecur trait on SepaDirectDebit leaves the deprecated
activateRecurring() flow working for the type (the ResourceService class_uses
capability gate still accepts it).
…ected

Verified against the sandbox: SEPA registers the mandate during charge/authorize,
so a direct recurring call returns API.640.550.005. Asserting this confirms the
type still passes the CanRecur capability gate and routes to the API.

@sixer1182 sixer1182 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approving. Thanks for the rework and for the explanations.

I re-checked the PR head (aaa157e) locally: 751 unit tests pass. The compatibility break is fixed (CanRecur is kept, the capability check accepts SepaDirectDebit), the other payment types serialize as before, and the PR description now matches the diff.

I accept always sending recurring (default false). The tech spec treats false and absent the same, the field is in the released PAPI versions (1.191 and 1.192), and PAPI manages recurring itself on PUT. A one-line confirmation from the PAPI team that a recurring value in the PUT body is ignored would still be good.

Two points should be done, but they do not block the merge:

  1. Unit test for the fetched state. Please add a test that documents what expose() contains after handleResponse() with recurring true, false, and without the field (for example {"iban":…,"id":…,"recurring":true} after a fetch). The tests named in the last comment (recurringIsMappedFromResponse, recurringIsAlwaysExposed) do not check this: the first only checks isRecurring(), the second only fresh instances.
  2. Acceptance criteria in the ticket. The description of CC-4239 still says "without calling setRecurring() the request body is unchanged". The PR now always sends recurring. Please update the description of the ticket to the current behavior.

Minor: sepaDirectDebitShouldActivateRecurringViaType pins the PAPI error code API.640.550.005 and does not run in CI. That is acceptable, but it will break if PAPI changes that code.

@Ryouzanpaku
Ryouzanpaku enabled auto-merge (squash) November 18, 2026 12:32
@Ryouzanpaku
Ryouzanpaku merged commit a05bd69 into main Nov 18, 2026
7 checks passed
@Ryouzanpaku
Ryouzanpaku deleted the CC-4239/sepa-recurring-flag branch November 18, 2026 12:33
@Ryouzanpaku

Copy link
Copy Markdown
Contributor Author

Thanks for the approval. Both non-blocking points are addressed:

  1. Fetched-state unit test — added SepaDirectDebitTest::recurringIsExposedAfterFetch (data provider), asserting expose() after handleResponse() carries the mapped recurring (true / false) and defaults to false when the response omits the field. Pushed in 15abb62a; SDD unit suite OK (13 tests, 29 assertions).
  2. Ticket AC — updated the CC-4239 description: the old "request body unchanged when setRecurring() is not called" is replaced with "recurring is always sent, defaulting to false (≡ absent for SEPA)".

On the minor: agreed sepaDirectDebitShouldActivateRecurringViaType pins API.640.550.005 and is sandbox-only — if PAPI ever changes that code the test will need a bump. Noted. I'll also chase the one-line PAPI confirmation that a recurring value in the amend PUT body is ignored.

Ryouzanpaku added a commit that referenced this pull request Nov 23, 2026
…G) (#248)

* [CC-4078] Rename unreleased changelog section to planned 4.1.0

The PHP SDK release is planned as 4.1.0, not 5.0.0. Rename the top
unreleased CHANGELOG section header (and its compare URL) accordingly.

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

* [CC-4078] Add recurring entry to 4.1.0 changelog

Scope the SepaDirectDebit recurring changelog entry under the release
ticket (CC-4078) alongside the version rename, so the feature PR #247
(CC-4239) stays code-only and the two don't conflict.

* [CC-4078] Complete the 4.1.0 changelog with all released changes

Add the Keypair getRawResponse() addition (CC-4151) and the PIS payment-type
deprecation (CC-4064) to the 4.1.0 section, alongside the recurring flag
(CC-4239) and the PHP 8.1 removal (CC-4228) — the full set of merged changes
for the release.

* [CC-4078] Add CC-4256 Keypair boolean-parsing fix to 4.1.0 changelog

Document the merged fix (#251): Keypair boolean flags sent as strings
(validateBasket, cof) were coerced so "false" became true; now parsed
correctly. CC-4255 (payment-type duplication, #250) will be added once merged.

* [CC-4078] Prepare 4.1.0 release: bump SDK version and complete changelog

Bump Unzer::SDK_VERSION to 4.1.0 and stage the remaining 4.1.0 changelog
entries: deprecate Sofort (CC-4344, #252) and the Keypair plain-fetch
payment-type de-duplication fix (CC-4255, #250). Those two feature PRs must
merge before this release-preparation PR.

---------

Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Ryouzanpaku added a commit that referenced this pull request Nov 26, 2026
…256)

* [CC-4239] Name SepaDirectDebit::setRecurring param $recurring + add SEPA PHPDoc

QA (CC-4239 comment 495774) on the merged PR #247 found the public setter's
parameter is $active (inherited via `use CanRecur { setRecurring as public; }`),
not $recurring as the ticket specified. Since PHP 8 makes the parameter name
part of the public API, `->setRecurring(recurring: true)` threw
"Unknown named parameter $recurring".

Replace the trait alias with an explicit public override
`setRecurring(bool $recurring): self` on SepaDirectDebit, carrying SEPA-specific
PHPDoc (RCUR/OOFF mandate intent) — this fixes the parameter name (bug 1) and
the missing docblock (bug 2) together. `use CanRecur` is kept, so isRecurring(),
the deprecated activateRecurring() and the ResourceService class_uses(CanRecur)
capability gate are unchanged (verified by reflection probe). Added a unit test
pinning the named-argument form.

Note: 4.1.0 is unreleased, so this only shapes the setter before release — no
CHANGELOG churn.

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

* [CC-4239] Keep setRecurring parameter name as $active (deliberate)

Reverts the parameter name from $recurring back to $active. With the method
already named setRecurring, `$active` reads better than the redundant
`setRecurring(recurring: true)` — a deliberate maintainer decision that
supersedes the ticket AC's suggested `$recurring`. The important BC point still
holds: the public parameter name is settled before release (4.1.0 unreleased),
so there is no future named-argument break.

The explicit public override is kept for the SEPA-specific PHPDoc (bug 2); only
the parameter name changes. Named-argument test updated to `active: true`.

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

* [CC-4239] Pin setRecurring param name via reflection, not a named-arg call

A named-argument call (setRecurring(active: true)) reads contrived for a
single-parameter setter. Replace it with a reflection assertion on the
parameter (name `active`, type `bool`) — that pins the actual public-API
surface directly and matches the repo's existing signature-pinning idiom
(legacySignatureDataProvider).

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

* [CC-4239] Drop the brittle param-name reflection test

A reflection test that hard-pins the parameter name is brittle and low-value:
PHP parameter-name stability is only a BC concern if the library promises
named-argument support, which this SDK does not (cf. Symfony excluding param
names from its BC promise / @no-named-arguments). Behaviour is already covered
by the setter/getter, expose, and response-mapping tests. The parameter stays
$active for consistency with the CanRecur trait — no test needed to enforce it.

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

* [CC-4239] Trim internal detail from setRecurring PHPDoc

Drop the PMP / RCUR-OOFF mandate-derivation and charge-payload internals from
the public docblock — that is internal platform behaviour an integrator should
not need to know. Keep only the caller-facing contract: true = recurring
(mandate-based) collection, false (default) = one-off, applied at type
registration.

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

* [CC-4239] Drop redundant @param/@return from setRecurring docblock

The parameter and return types are already declared in the typed signature
(setRecurring(bool $active): self), so the @param/@return tags add nothing.
Keep the descriptive text only.

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

---------

Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

3 participants