Skip to content

[CC-4346] Support SECCI /plans endpoint for Paylater Invoice and Direct Debit (CCD2) - #253

Merged
Ryouzanpaku merged 11 commits into
mainfrom
feature/CC-4346-secci-paylater-plans
Nov 24, 2026
Merged

Ryouzanpaku merged 11 commits into
mainfrom
feature/CC-4346-secci-paylater-plans

Conversation

@Ryouzanpaku

@Ryouzanpaku Ryouzanpaku commented Nov 23, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Generalises the existing Paylater Installment plan flow so plans — including the secciUrl (SECCI PDF link) — can be fetched for Paylater Invoice and Paylater Direct Debit via the new PAPI endpoints GET /v1/types/paylater-invoice/plans and GET /v1/types/paylater-direct-debit/plans, mirroring .../paylater-installment/plans.

What changed

  • New generalised models:
    • PaylaterPlansQuery (query DTO: amount, currency, country, customerType — default B2C).
    • PaylaterPlans (result model, reuses InstallmentPlan including secciUrl).
  • New API Unzer::fetchPaylaterPlans(BasePaymentType $paymentType, PaylaterPlansQuery $query): PaylaterPlans and the matching PaymentService method (added to PaymentServiceInterface). Call site: $unzer->fetchPaylaterPlans(new PaylaterInvoice(), $query).
  • Permissive design: the payment type is passed through as a BasePaymentType object — no marker interface, no SDK-side allowlist, no input validation. The endpoint segment (types/<kebab-name>/plans) is derived from the payment-type class name via parent-resource URI chaining; unsupported types / invalid input are rejected by PAPI as UnzerApiException.
  • SECCI PDF locale flows from Unzer::setLocale() → Accept-Language; no new API.
  • Version bumped to 4.1.0; CHANGELOG.md updated.

Backward compatibility (decoupled, verified)

  • InstallmentPlansQuery and PaylaterInstallmentPlans are kept as standalone @deprecated classes with their original signatures unchanged — they do not extend the new generalised classes. Making them subclasses was tried and reverted: it silently widened the legacy fluent setters' declared return types and widened PaylaterInstallmentPlans::setQueryParameter()'s parameter (a PHP declaration-compatibility fatal for any subclass override) — a real BC regression for a minor release. Decoupling preserves the legacy public API byte-for-byte (verified: git diff origin/main shows only the added @deprecated docblock).
  • Unzer::fetchPaylaterInstallmentPlans(InstallmentPlansQuery): PaylaterInstallmentPlans is unchanged in signature and return type.

Tests

  • Unit (794 green): resource path per paylater type (parameterised); query assembly + default customerType; response mapping including secciUrl; plans without installmentRates; empty plans; an end-to-end regression of the original fetchPaylaterInstallmentPlans flow; the new fetchPaylaterPlans exercised across all three plan-supporting types; and reflection-based signature-pin tests guarding the legacy BC contract.
  • Integration (sandbox): happy-path invoice + direct-debit assert non-empty plans + secciUrl; unsupported-type and invalid-input cases assert an UnzerApiException with a populated merchant message (exception type + error presence only — specific error codes are intentionally not pinned, to avoid brittle maintenance). Un-gated; run in CI with the sandbox key.
  • Independent GitHub Copilot review: clean (routing bug for identified types fixed; the decoupling resolved the earlier return-type / subclass-override BC findings).

Dependencies

  • The PAPI Paylater Invoice and Direct Debit /plans endpoints are live (previously tracked as WIP under CC-4014) — dependency cleared.
  • Independent of the Java SDK counterpart CC-4345 (no merge-order constraint between them).

🤖 Generated with Claude Code

Ryouzanpaku and others added 2 commits November 23, 2026 13:37
…ct Debit

Generalize the paylater installment plan flow so plans (including the SECCI
PDF URL) can be fetched for any paylater payment type via the new
PAPI `types/paylater-invoice/plans` and `types/paylater-direct-debit/plans`
endpoints, mirroring the existing installment endpoint.

- Add PaylaterPlansQuery (query DTO) and PaylaterPlans (result) as the
  generalized models; keep InstallmentPlansQuery and PaylaterInstallmentPlans
  as deprecated subclasses for backward compatibility.
- Add Unzer::fetchPaylaterPlans(BasePaymentType, PaylaterPlansQuery) and the
  PaymentService method. The payment type and query are passed through to PAPI
  unchanged (permissive design, no SDK-side validation or allowlist); the
  endpoint segment is derived from the payment type class name via parent-
  resource URI chaining.
- fetchPaylaterInstallmentPlans keeps its signature and return type unchanged.
- Add unit tests (path per type, query assembly/default, response mapping,
  missing/empty rates, BC) and skipped integration tests pending CC-4014.
- Bump SDK_VERSION to 5.0.0 and update CHANGELOG.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Ship the paylater /plans support in the 4.1.0 release: set SDK_VERSION to
4.1.0 and move the Added/Deprecated CHANGELOG entries under a new 4.1.0
section, leaving the pending 5.0.0 (PHP 8.1 removal) content untouched.

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

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

Previously created or fetched payment types route installment-plan requests to /types/<id>/plans instead of the type-specific endpoint, and the routing test lacks coverage for identified types.

1 open issue
What changed in this PR

Extends the PHP SDK’s Paylater plans flow to Invoice and Direct Debit, exposing SECCI PDF links through a shared API while retaining the legacy Installment entry point.

Changes:

  • Adds generalized plan models and fetchPaylaterPlans() across the client and payment service.
  • Converts legacy models into deprecated compatibility subclasses.
  • Adds unit coverage, response fixtures, and integration tests skipped pending endpoint availability.
File Description
test/​unit/​Services/​PaymentServiceTest.php Tests routing, default customer type, and legacy API compatibility.
test/​unit/​Resources/​PaylaterPlansTest.php Tests query assembly and response mapping.
test/​integration/​PaymentTypes/​PaylaterPlansTest.php Adds skipped endpoint success and error tests.
test/​Fixtures/​jsonData/​paylaterPlansResponseNoRates.json Provides plans without installment schedules.
test/​Fixtures/​jsonData/​paylaterPlansResponseEmpty.json Provides an empty plans response.
src/​Unzer.php Exposes the generalized API and sets version 4.1.0.
src/​Services/​PaymentService.php Builds and fetches plans for the supplied payment type.
src/​Resources/​PaylaterPlans.php Adds the shared plans resource and response mapping.
src/​Resources/​PaylaterInstallmentPlans.php Retains the legacy model as a deprecated subclass.
src/​Resources/​EmbeddedResources/​Paylater/​PaylaterPlansQuery.php Adds shared query fields with a B2C default.
src/​Resources/​EmbeddedResources/​Paylater/​InstallmentPlansQuery.php Retains the legacy query as a deprecated subclass.
src/​Interfaces/​PaymentServiceInterface.php Declares and documents the generalized API.
CHANGELOG.md Records the new API, models, and deprecations under 4.1.0.

Review effort: Balanced

Comment thread src/Services/PaymentService.php Resolved
Address Copilot review: an already-created/fetched payment type has an id,
and for GET BasePaymentType::getResourcePath() omits the type name while
getUri() appends the id, so fetchPaylaterPlans() routed to types/<id>/plans
instead of types/<kebab-name>/plans. Route via an identity-free clone of the
supplied type so the URL is always correct; the caller's instance (and its id)
is left untouched. Extend the routing test to cover identified types.

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

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

The public setQueryParameter() type change breaks existing subclasses with a PHP compatibility fatal error, violating the advertised backward-compatible contract.

No open issues 🎉

1 previously missed issue

In code that hasn't changed since last review

Medium severity Preserve the legacy setter signature for subclass compatibility

src/​Resources/​PaylaterInstallmentPlans.php:14

This changes the public setQueryParameter() parameter type from InstallmentPlansQuery to the inherited PaylaterPlansQuery. Existing subclasses that override the old signature now fail at class declaration with a PHP compatibility fatal error, even though this class is advertised as backward-compatible and the release is 4.1.0. Preserve the legacy method contract (for example, share implementation without inheriting the broader setter), or explicitly treat this as a breaking change with migration guidance and a major release.

1 resolved since last review

Review effort: Balanced

Address Copilot review: override setQueryParameter() on the deprecated
PaylaterInstallmentPlans alias so it keeps returning PaylaterInstallmentPlans
(covariant narrowing) instead of the inherited PaylaterPlans, restoring the
original fluent contract. The parameter is widened to PaylaterPlansQuery, which
is backward compatible since InstallmentPlansQuery extends it. Clarify the BC
boundary in the CHANGELOG.

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

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

The widened legacy method parameter causes declaration-compatibility fatal errors for existing subclass overrides, and the SDK version constant misidentifies the 5.0.0 release as 4.1.0 on every request.

No open issues 🎉

2 previously missed issues

In code that hasn't changed since last review

Medium severity Widened parameter breaks subclass override compatibility

src/​Resources/​PaylaterInstallmentPlans.php:25

Widening this existing method's parameter is not backward-compatible for subclasses: an override using the previous InstallmentPlansQuery signature now causes a PHP declaration-compatibility fatal error when the class is loaded. Keeping the return type does not prevent this. Preserve the legacy parameter contract, for example by sharing implementation without making the legacy class inherit the broader setter.

Medium severity SDK version constant does not match the 5.0.0 release

src/​Unzer.php:65

The changelog already identifies this source tree as 5.0.0 and records removal of PHP 8.1 support, but this constant reports 4.1.0. Since the HTTP service sends SDK_VERSION on every request, the resulting SDK identifies itself as the wrong release. Align the constant with the 5.0.0 release described above.

Review effort: Balanced

@Ryouzanpaku

This comment was marked as low quality.

…ones

Resolve the backward-compatibility regression Copilot raised: making
InstallmentPlansQuery/PaylaterInstallmentPlans extend the new generalized
classes silently widened their inherited method signatures (return types, and
the setQueryParameter parameter), breaking strict callers and any third-party
subclass override.

Restore both legacy classes to their original standalone definitions (now only
marked @deprecated) with no inheritance from PaylaterPlans/PaylaterPlansQuery -
verified byte-for-byte against origin/main (only the @deprecated docblock
differs). Drop the obsolete covariant setQueryParameter override. The new
PaylaterPlans/PaylaterPlansQuery stay independent; no new code relies on the
legacy types being instances of the new ones.

Add reflection-based signature-pin tests plus a fluent-chaining test for the
legacy classes, and remove the two unit tests that depended on the old
inheritance. Update the CHANGELOG to describe the legacy classes as unchanged
standalone deprecated aliases.

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

Copy link
Copy Markdown
Contributor Author

Revised approach: legacy classes decoupled (supersedes my earlier reply)

Copilot's backward-compatibility concern was correct, and this supersedes my earlier comment defending the extends-based aliasing.

The problem with the previous approach: making InstallmentPlansQuery extends PaylaterPlansQuery and PaylaterInstallmentPlans extends PaylaterPlans silently changed the legacy classes' inherited method signatures — the fluent setters' declared return types widened to the parent type, and PaylaterInstallmentPlans::setQueryParameter()'s parameter widened from InstallmentPlansQuery to PaylaterPlansQuery (a PHP declaration-compatibility fatal for any third-party subclass override). The covariant return-type override I added could not fix the parameter widening while inheriting.

Fix in the latest commit: the two legacy classes are now standalone @deprecated aliases with no inheritance from the new generalized classes. They are restored to their original definitions — verified byte-for-byte against origin/main (the only diff is the added @deprecated docblock), so every public parameter and return type is unchanged. PaylaterPlans / PaylaterPlansQuery remain independent new classes; no new code relies on the legacy types being instances of the new ones. The obsolete covariant override was removed.

This fully resolves both BC findings (subclass-override fatal + return-type drift). Added reflection-based signature-pin tests and a fluent-chaining test for the legacy classes to lock this in. Unit suite green (790 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

Human assessment is needed because URI generation can round and mutate the caller’s amount, contradicting the documented unchanged pass-through behavior.

No open issues 🎉

Review effort: Balanced

Ryouzanpaku and others added 3 commits November 23, 2026 15:56
…flows

Stub the HTTP layer (types/paylater-<segment>/plans) and assert mapping incl.
non-null secciUrl:
- Legacy fetchPaylaterInstallmentPlans(InstallmentPlansQuery) returns a
  PaylaterInstallmentPlans with mapped plans (original-flow regression proof).
- Generic fetchPaylaterPlans() exercised for all three plan-supporting types
  (PaylaterInstallment, PaylaterInvoice, PaylaterDirectDebit), each hitting its
  own types/paylater-<segment>/plans URL and mapping plans with secciUrl.

Pre-existing installment plan tests are left untouched and still pass.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
The invoice/direct-debit /plans endpoints are live, so remove the @group skip
from test/integration/PaymentTypes/PaylaterPlansTest.php; the tests now run
against the sandbox via the repo's standard integration credentials, like the
existing installment integration test.

Sandbox credentials are not available in the dev environment (no
UNZER_PAPI_TEST_PRIVATE_KEY_DEFAULT), so the concrete UnzerApiException codes
could not be observed here. Kept the exception-type assertions and replaced the
TODO placeholders with notes to confirm and pin the exact getCode()/message
from the first CI run. No codes were guessed.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Per review decision, do not pin specific PAPI error codes (too brittle). For the
unsupported-type and invalid-input cases, assert UnzerApiException with a
non-empty getMerchantMessage() instead of a specific getCode(). Keep an
illustrative (non-asserted) comment documenting the observed sandbox behaviour
for an unsupported type. Happy-path assertions unchanged; tests stay un-gated.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@Ryouzanpaku
Ryouzanpaku marked this pull request as ready for review November 23, 2026 15:28
@Ryouzanpaku
Ryouzanpaku requested a review from a team as a code owner November 23, 2026 15:28
Resolve conflicts from main's 4.1.0 release (SEPA recurring flag, Keypair
getRawResponse, PIS/Sofort deprecations, PHP 8.1 removal, Keypair fixes):
- src/Unzer.php: SDK_VERSION stays 4.1.0 (both sides agreed; our bump redundant).
- CHANGELOG.md: fold our Added (fetchPaylaterPlans, PaylaterPlans/PaylaterPlansQuery)
  and Deprecated (PaylaterInstallmentPlans, InstallmentPlansQuery) bullets into main's
  existing [4.1.0] section instead of a duplicate section; keep all of main's entries.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@Ryouzanpaku
Ryouzanpaku marked this pull request as draft November 23, 2026 15:59
@Ryouzanpaku
Ryouzanpaku marked this pull request as ready for review November 23, 2026 16:00
Ryouzanpaku and others added 2 commits November 23, 2026 17:08
The API sends minimumInstallmentFee (decimal string, e.g. "0.00") on each plan,
but InstallmentPlan had no property for it so updateValues() dropped it. Add a
$minimumInstallmentFee field with getMinimumInstallmentFee()/setMinimumInstallmentFee()
mirroring the untyped totalAmount style. Purely additive, so it is exposed for
both fetchPaylaterInstallmentPlans and fetchPaylaterPlans with no BC impact.

Set a non-zero fee on a fixture plan and assert getMinimumInstallmentFee() maps
for both the new and legacy plan flows. Document the addition in the CHANGELOG.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Live sandbox run showed amount=0 is ACCEPTED by the API (HTTP 200 with a
degenerate plan), so remove the "zero amount" row from the invalid-input data
provider; keep the cases that genuinely error (negative amount, invalid
currency, invalid country) with the generic exception-type + populated
merchant-message assertions.

The amount=0 response includes an installmentRate without a date field, which
raised an "Undefined property: stdClass::$date" warning in
InstallmentPlan::handleResponse(). Guard with $rate->date ?? null (and
$rate->rate ?? null); InstallmentRate already accepts nulls. Benefits both the
legacy and new plan flows. Add a unit test for a date-less rate.

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

@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.

Approved. Reviewed against CC-4346 (PHP SDK: support SECCI /plans endpoint for Paylater Invoice and Direct Debit) and its acceptance criteria. Unit suite is green locally (796 tests, 2926 assertions).

Verified

  • InstallmentPlansQuery and PaylaterInstallmentPlans differ from main only by the @deprecated docblock; no extends, public signatures unchanged. fetchPaylaterInstallmentPlans() is unchanged and covered by an end-to-end test.
  • fetchPaylaterPlans() resolves to /types/paylater-invoice/plans, /types/paylater-direct-debit/plans and /types/paylater-installment/plans, also for payment types that already have an id. The caller's instance is not modified.
  • Query string is identical to the legacy query for the same input.

Notes (not blocking)

  1. Integration tests are not run by the PR CI. integration-tests.yml only runs on push to main or manually, so PaylaterPlansTest has not been executed in CI yet. The PR description says it runs in CI with the sandbox key. Please trigger the workflow manually on this branch before merging, or confirm a local run against the sandbox.
  2. Deviation from the ticket snippet: the ticket sets the parent resource directly on the passed payment type. The PR uses a clone without id instead. This is better (identified types would otherwise resolve to /types/<id>/plans, and the caller's object would be mutated), but the ticket should be updated to describe it.
  3. Further deviations from the QA plan: the amount = 0 integration case is dropped because the API accepts it (documented in the test); the no-rates test asserts null instead of an empty list; the unsupported-type test uses SepaDirectDebit instead of Card. Please reflect this in the ticket.
  4. Changes not in the ticket: getMinimumInstallmentFee() on InstallmentPlan and the $rate->date ?? null guard. Both also affect the legacy installment flow. They are harmless and listed in the CHANGELOG, but should be mentioned in the ticket.
  5. Interface BC: adding fetchPaylaterPlans() to PaymentServiceInterface breaks external classes implementing that interface. Worth a line in the CHANGELOG for 4.1.0.
  6. Docs: the ticket asks for docs and CHANGELOG; only the CHANGELOG is updated.

@Ryouzanpaku
Ryouzanpaku merged commit fb5376c into main Nov 24, 2026
6 of 7 checks passed
@Ryouzanpaku
Ryouzanpaku deleted the feature/CC-4346-secci-paylater-plans branch November 24, 2026 10:07
Ryouzanpaku added a commit that referenced this pull request Nov 26, 2026
…ce & direct debit (#255)

* [CC-4346] Make paylater plan model nullable so all params are gettable for every type

QA on PR #253 (CC-4346) found the three paylater plan types return
structurally different plan objects, but the SDK forced them all through
one InstallmentPlan class with non-nullable getters. The live Unzer OpenAPI
spec declares a single schema for all three /plans endpoints with every
field optional and no type discriminator; the types differ only in which
optional fields they populate at runtime (invoice/direct-debit omit the
interest-rate fields and send rates without a date). So one tolerant class
with every field nullable is the correct mapping, not a subclass split.

- InstallmentPlan: all getters/setters nullable; add interestAmount
  (getInterestAmount) that was dropped. Fixes getSecciUrl()/
  getEffectiveInterestRate() throwing on invoice/direct-debit plans.
- PaylaterPlans: setAmount/setCurrency/setPlans tolerate null (a null field
  in the response no longer TypeErrors the fetch; null plans -> empty list).
- Tests: real invoice + direct-debit response fixtures (previously only
  installment-shaped data existed, which hid the crash); unit mapping now
  parameterized over all three types incl. interestAmount; a null-field
  regression test; the integration test exercises all three types via
  fetchPaylaterPlans and asserts every plan parameter is gettable.

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

* [CC-4346] Pin numberOfRates and interestAmount on the legacy installment BC test

The legacy fetchPaylaterInstallmentPlans() flow maps through the same
InstallmentPlan class widened to nullable here. Its mapping regression test
(PaylaterInstallmentPlansTest::verifyJsonResponseIsHandledProperly) already
asserts the plan getters still map, but not the two fields this change
touched. Pin getNumberOfRates() and the new getInterestAmount() on the
legacy path so backward compatibility covers exactly what changed.

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

* [CC-4346] Introduce PaylaterPlan item; deprecate InstallmentPlan as a BC subclass

Mirror the container-level rename (PaylaterInstallmentPlans -> PaylaterPlans)
at the plan-item level so early adopters of the new fetchPaylaterPlans() flow
never have to migrate twice. Since PaylaterPlans is unreleased (4.1.0),
changing what getPlans() returns is free now.

- Add PaylaterPlan as the canonical item model (carries the nullable getters
  + interestAmount). Fluent setters return `static` so the subclass keeps its
  own return typing.
- InstallmentPlan becomes an empty @deprecated subclass of PaylaterPlan: the
  legacy fetchPaylaterInstallmentPlans() flow still returns InstallmentPlan
  and existing type hints / instanceof checks keep working (is-a PaylaterPlan).
  Unlike the standalone container deprecation, inheritance is safe here: the
  item has no sibling-typed parameter method that could widen and fatal.
- PaylaterPlans now maps to PaylaterPlan; PaylaterInstallmentPlans unchanged.
- Tests: new flow asserts PaylaterPlan instances; legacy flow asserts items are
  still InstallmentPlan and now also PaylaterPlan; added a deprecated-subclass
  guard. CHANGELOG: PaylaterPlan added, InstallmentPlan deprecated.

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

* [CC-4346] Make PaylaterPlan/InstallmentPlan standalone, not inheritance, to preserve BC

The previous commit made InstallmentPlan a subclass of PaylaterPlan. With
`static` fluent-setter returns this changed InstallmentPlan::setX()'s declared
return type to `static` and made an existing integration that subclasses
InstallmentPlan and overrides a setter with `: InstallmentPlan` fatal
("must be compatible with ... : static") — the same signature-widening break
the container deprecation (PaylaterInstallmentPlans) deliberately avoided.

Switch to the standalone pattern used for the legacy containers:
- InstallmentPlan is reverted to its original signatures byte-for-byte (only an
  @deprecated docblock added); it does NOT extend PaylaterPlan. Its setters
  return `: InstallmentPlan` exactly as released, so existing type hints and
  subclasses keep working.
- PaylaterPlan is an independent new class with the nullable getters +
  interestAmount and `: PaylaterPlan` returns (no `static`).
- Legacy fetchPaylaterInstallmentPlans() returns InstallmentPlan; new
  fetchPaylaterPlans() returns PaylaterPlan. No is-a relationship between them,
  matching the container decision.

Tests: replaced the subclass guard with a reflection test pinning
InstallmentPlan's setter return types to InstallmentPlan and asserting it is
not a subclass of PaylaterPlan. Full unit suite: 808 tests green.

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

* [CC-4346] Add migration-equivalence test: new flow maps same data as legacy

Feeds the same installment response to both PaylaterInstallmentPlans (legacy)
and PaylaterPlans (new) and asserts the mapped plan data is identical
(id, amount, currency, and per plan: secciUrl, numberOfRates, totalAmount,
minimumInstallmentFee, nominal/effective interest rate, and rates). Documents
that switching flows is a rename of the query/result/item types plus passing
the payment type to fetchPaylaterPlans(), not a data-shape change.

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

* [CC-4346] Address QA review: null-tolerant country/customerType, CHANGELOG fixes

From QA review on PR #254:
- Make PaylaterPlans::setCountry()/setCustomerType() accept null, completing the
  bug-4 null-tolerance (a null field in the response no longer TypeErrors the
  fetch). These are query-only fields not present in the /plans response, so the
  path was unreachable via the real API, but the guard is free and uniform.
  Extended the null-field regression test to cover currency/country/customerType.
- Restore the "## [4.0.2]" CHANGELOG heading that a prior edit accidentally
  dropped, which had mis-nested the 4.0.2 Changed entries under 4.1.0.
- Document the PaymentServiceInterface BC: fetchPaylaterPlans() was added to the
  interface (breaks external implementors) — noted under a 4.1.0 ### Changed.

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

* [CC-4346] Trim 4.1.0 CHANGELOG to net changes; drop non-consumer interface note

- Remove the PaymentServiceInterface "### Changed/Breaking change" note. Adding
  fetchPaylaterPlans() to the interface is not a consumer-facing break: the
  interface already declared fetchPaylaterInstallmentPlans() in the released
  4.0.2, Unzer::getPaymentService() is typed to the interface, and only an
  external class that itself implements the interface is affected (same pattern
  as the already-shipped legacy method). No breaking change for SDK users.
- Collapse the paylater "now exposed / previously dropped" and the nullable
  "Fixed" bullets (they describe churn within this unreleased feature, not a net
  change vs 4.0.2) into one Added entry describing PaylaterPlan's fields.
- Simplify the deprecation entries (drop the standalone/inheritance detail).

The setCountry/setCustomerType null-tolerance code fix stays; it just no longer
needs a CHANGELOG line.

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

* [CC-4346] Use typed properties on PaylaterPlan (PHP 7.4+, min is now 8.2)

Replace the docblock-only `@var` properties with native typed properties
(`?int`/`?string`/`?float`/`?array`, each defaulting to null). The engine now
enforces the types at the language level instead of relying on annotations,
matching the newer resource style (e.g. Resources/V2/Paypage). Safe here: the
fields are private (expose() only reflects protected properties) and default to
null, so there is no uninitialized-typed-property access. Values still flow
through the existing typed setters, so mapping is unchanged.

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

* [CC-4346] Use typed properties on PaylaterPlans too

Convert the PaylaterPlans container's docblock-only `@var` properties to native
typed properties (`?float`/`?string`/`array`/`?PaylaterPlansQuery`, defaulting to
null / []). Matches the already-typed PaylaterPlansQuery and PaylaterPlan.
Properties are private (not read by expose(), which only reflects protected) and
default-initialized, and values still flow through the typed setters, so mapping
and behaviour are unchanged.

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

* [CC-4346] Polish from independent review: docblocks, null-tolerance coverage

Minor follow-ups from an independent PR review (no behaviour change):
- Fix @return docblocks on PaylaterPlans getters to match the nullable
  signatures (float -> float|null, string -> string|null).
- Clarify PaylaterPlan class docblock: invoice/direct-debit omit
  nominalInterestRate and effectiveInterestRate specifically (interestAmount is
  sent by all three types, so the "omit interest-rate fields" wording was
  ambiguous).
- Strengthen nullPlanAndEnvelopeFieldsMapWithoutError: set numberOfRates and
  totalAmount to null too, so their null-tolerance is actually exercised.

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