Skip to content

[CC-4240] Add recurring flag to SepaDirectDebit - #196

Merged
Ryouzanpaku merged 3 commits into
mainfrom
CC-4240/sepa-recurring-flag
Dec 2, 2026
Merged

Ryouzanpaku merged 3 commits into
mainfrom
CC-4240/sepa-recurring-flag

Conversation

@Ryouzanpaku

Copy link
Copy Markdown
Contributor

What

Adds a fluent recurring(boolean) method to SepaDirectDebit, giving integrators a discoverable way to register a sepa-direct-debit payment type for recurring (mandate-based) collection at type registration (POST /v1/types/sepa-direct-debit). Adds Javadoc on the new method and on the recurring field in BasePaymentType.

Why

For SEPA, recurrence intent is captured once, at type registration, via a recurring boolean. The flag must be set before createPaymentType(...) and cannot be changed afterwards; it is not needed for one-off payments and is unrelated to the card-specific recurrenceType on charges/authorizations.

Note: the recurring field already existed on BasePaymentType and was serialized by Gson, so setRecurring(true) already produced "recurring": true in the POST body — but by accident, undocumented and untested. This change makes it explicit, documented, discoverable (fluent), and covered by tests. It is additive and non-breaking; the Lombok @Data setter keeps working.

Tests

  • Unit test (business/paymenttypes/SepaDirectDebitTest): serialization contains "recurring":true/"recurring":false when set, and no recurring key when unset (parameterized); fluent method returns the same instance; response JSON maps to getRecurring() == true via the map(...)/fromJson path.
  • Integration test (integration/paymenttypes/SepaDirectDebitTest): creates a type with the recurring flag, fetches it, asserts getRecurring() is true (compiles; needs sandbox creds to run).

🤖 Generated with Claude Code

Add a fluent recurring(boolean) method to SepaDirectDebit so integrators
have a discoverable way to register the type for recurring (mandate-based)
collection at creation time. The underlying recurring field already existed
on BasePaymentType and was serialized by Gson, so this change is additive
and non-breaking. Add Javadoc on the field and method clarifying the flag
is set before createPaymentType, cannot be changed afterwards, is not needed
for one-off payments, and is unrelated to card-specific recurrenceType.

Add a unit test covering serialization (set true/false, absent when unset)
and the response map path, plus an integration test for the create+fetch
round-trip. Document the change under an Unreleased CHANGELOG section.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Changelog and version edits are scoped to the release ticket (CC-4252),
so this feature branch no longer touches CHANGELOG and won't conflict.
@Ryouzanpaku
Ryouzanpaku marked this pull request as ready for review November 12, 2026 14:57
@sixer1182

Copy link
Copy Markdown
Member

The change fulfils the ticket. One small wording fix: the Javadoc of recurring(boolean) calls setRecurring(Boolean) "Lombok-generated", but BasePaymentType does not use Lombok; the setter is hand-written. Please drop "Lombok-generated" from the Javadoc.

…avadoc

BasePaymentType#setRecurring(Boolean) is hand-written, not Lombok-generated.
Addresses PR #196 review feedback.

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

Copy link
Copy Markdown
Contributor Author

Good catch — BasePaymentType#setRecurring(Boolean) is hand-written, not Lombok-generated. Dropped "Lombok-generated" from the Javadoc in c98ff19.

Ryouzanpaku

This comment was marked as spam.

@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. recurring(boolean) only wraps the existing setter, and the unit tests cover serialization in both directions. The integration test needs sandbox credentials, so CI must provide them.

@Ryouzanpaku
Ryouzanpaku merged commit f69b4f9 into main Dec 2, 2026
2 of 4 checks passed
@Ryouzanpaku
Ryouzanpaku deleted the CC-4240/sepa-recurring-flag branch December 2, 2026 12:21
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.

2 participants