Skip to content

fix(setups): align the payment setup request shape with the spec - #694

Open
rodrigojara-cko wants to merge 4 commits into
masterfrom
feat/INT-1725-payment-setup-shape-gaps
Open

rodrigojara-cko wants to merge 4 commits into
masterfrom
feat/INT-1725-payment-setup-shape-gaps

Conversation

@rodrigojara-cko

@rodrigojara-cko rodrigojara-cko commented Oct 14, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Several POST /payments/setups fields were modelled in a shape the API does not accept, so their values were dropped without an error. This moves the card data under card.details, sends the Apple Pay and Google Pay token as an object, renames number_of_trades to number_of_sales, and adds the fields the model was missing.

Changes

  • entities/paymentMethods/card/Card.java: adds token (CardToken), details (CardDetails), schemes and preferredScheme; the flat card fields move into CardDetails.
  • entities/paymentMethods/card/CardDetails.java, CardToken.java: new.
  • entities/paymentMethods/common/PaymentSetupScheme.java: new enum with the 17 scheme names from the spec. PaymentRoutingScheme was not reused because it has no china_union_pay.
  • entities/paymentMethods/common/WalletToken.java: new, {id, expires_on}.
  • entities/paymentMethods/applepay/ApplePay.java, googlepay/GooglePay.java: token is now a WalletToken and the flat expiresOn moves inside it. Add schemes and preferredScheme (payments.PreferredSchema).
  • entities/order/OrderSubMerchant.java: numberOfSales (number_of_sales) replaces numberOfTrades.
  • entities/settings/Settings.java: adds capture and excludedPaymentMethods.
  • entities/paymentMethods/PaymentMethods.java: adds autoConfirm.
  • requests/PaymentSetupsRequest.java, responses/PaymentSetupsResponse.java, responses/PaymentSetupsConfirmResponse.java: add metadata.
  • entities/paymentMethods/instrument/Instrument.java: adds the read-only type.
  • entities/paymentMethods/klarna/Klarna.java: adds the read-only iban.
  • entities/paymentMethods/common/CardAccountHolder.java: adds companyName (company_name), shared by card, Apple Pay and Google Pay.
  • entities/paymentMethods/common/PaymentMethodStatus.java: PENDING and AVAILABLE are @Deprecated; they are not in the spec enum.
  • Tests: PaymentMethodsSerializationTest, PaymentSetupsNewFieldsSerializationTest and LocalDateFieldsRegressionTest cover roundtrip, the literal wire key of every new field (details, token.id, token.expires_on, schemes, preferred_scheme, number_of_sales, capture, excluded_payment_methods, auto_confirm, metadata, type, iban) and the swagger examples.

API Reference

  • POST /payments/setups
  • PUT /payments/setups/{id}
  • GET /payments/setups/{id}
  • POST /payments/setups/{id}/confirm/{payment_method_name}

Breaking changes

Forced by the API, so this is a minor release, to be called out in the changelog:

  • Card: the flat fields (number, last4, bin, scheme, expiryMonth, expiryYear, name, cvv, stored, expiresOn, allowUpdate) move to card.details (CardDetails), and token is a CardToken {id}.
  • ApplePay / GooglePay: token changes from String to WalletToken {id, expires_on}, and expiresOn moves inside token.
  • OrderSubMerchant: numberOfTrades becomes numberOfSales (number_of_sales).

In every case the previous shape was not accepted by the API, so nothing that worked stops working. The old members are removed rather than kept as deprecated aliases: they never produced a request the API accepts, so a compile error is the useful signal for anyone still using them. Python keeps deprecated aliases for the same members because in a dynamic language removing them would not fail and the data would be silently dropped again.

README

No change needed.

@agent-wall-e

agent-wall-e Bot commented Oct 14, 2026

Copy link
Copy Markdown

🟡 Risk Classification: MINOR

Approval route: AI Review + Human Approval
Rollback controls: Staged rollout + rollback

Classification reasons

  • exceeds_bounded_scope:591>250

Operational gates

  • ✅ jira_ticket (INT-1725)
  • ✅ independent_review

Files analysed: 17


wall-e 2026.06.19-02 · policy 6b4ce2b3b45a…

@agent-wall-e

agent-wall-e Bot commented Oct 14, 2026

Copy link
Copy Markdown
🔬 Debug — why this classification?

Each reason code emitted by the classifier, its source clause in the AI in SDLC Control Framework, and what it means.

Reason code Kind Clause Meaning
exceeds_bounded_scope — 591>250 classifying §2.1 M8 More than 250 non-test, non-doc, non-lockfile lines changed.

Kinds:

  • classifying — this rule contributed to the chosen tier.
  • informational — context only; did not by itself decide the tier.

See issue #3 for the proposal to formalise this map as Appendix A of the standards doc.

wall-e 2026.06.19-02 · debug

@agent-wall-e

agent-wall-e Bot commented Oct 14, 2026 •

Copy link
Copy Markdown

🟢 Advisory review: Looks good to me

This PR still needs a human approval — wall-e cannot auto-approve it. For what it's worth, I read the diff and found nothing I'd block on.

This PR aligns the Java payment-setup model with the API spec by restructuring card fields under CardDetails, changing wallet tokens to WalletToken objects, renaming numberOfTrades to numberOfSales, and adding missing fields across several entities. The diff does what the description claims, new types are consistent, and tests verify both wire-key names and roundtrip correctness.

What I checked

  • All field renames and restructurings (card.details, WalletToken, numberOfSales, Settings.capture/excludedPaymentMethods, metadata, autoConfirm) are verified against their JSON serialization in the new and updated tests.
  • PaymentSetupScheme enum covers 17 scheme values with correct @SerializedName annotations; the justification for not reusing PaymentRoutingScheme (missing china_union_pay) is consistent with the diff.
  • WalletToken.expiresOn is typed as Instant, matching the removed flat expiresOn fields in ApplePay and GooglePay — no regression in date-time handling.
  • PENDING and AVAILABLE enum values are correctly marked @deprecated rather than removed, preserving backward binary compatibility while signalling their non-spec status; the test that previously used PENDING/AVAILABLE now uses ACTION_REQUIRED/READY/INITIALIZATION_REQUIRED which are valid spec values.
  • The truncated test diff shows assertFalse checks on wire keys (e.g. number_of_trades, autoConfirm camelCase) which correctly guards against silent serialization regressions.
  • metadata is typed as Map<String, Object> in both request and response classes, consistent with how it appears in tests (String, Double, Boolean values); this is the standard pattern used elsewhere in the SDK.

⚠️ The diff was too large to read in full, so this review covers only part of the change.


This is not an approval. wall-e cannot auto-approve this PR — it is an opinion to help whoever does. Advisory review · us.anthropic.claude-sonnet-4-6 · wall-e 2026.06.19-02

@agent-wall-e

agent-wall-e Bot commented Oct 14, 2026

Copy link
Copy Markdown

🟡 Risk Classification: MINOR

Approval route: AI Review + Human Approval
Rollback controls: Staged rollout + rollback

Classification reasons

  • exceeds_bounded_scope:689>250

Operational gates

  • ✅ jira_ticket (INT-1725)
  • ✅ independent_review

Files analysed: 18


wall-e 2026.06.19-02 · policy 6b4ce2b3b45a…

@agent-wall-e

agent-wall-e Bot commented Oct 14, 2026

Copy link
Copy Markdown
🔬 Debug — why this classification?

Each reason code emitted by the classifier, its source clause in the AI in SDLC Control Framework, and what it means.

Reason code Kind Clause Meaning
exceeds_bounded_scope — 689>250 classifying §2.1 M8 More than 250 non-test, non-doc, non-lockfile lines changed.

Kinds:

  • classifying — this rule contributed to the chosen tier.
  • informational — context only; did not by itself decide the tier.

See issue #3 for the proposal to formalise this map as Appendix A of the standards doc.

wall-e 2026.06.19-02 · debug

@agent-wall-e

agent-wall-e Bot commented Oct 15, 2026

Copy link
Copy Markdown

🟡 Risk Classification: MINOR

Approval route: AI Review + Human Approval
Rollback controls: Staged rollout + rollback

Classification reasons

  • exceeds_bounded_scope:466>250

Operational gates

  • ✅ jira_ticket (INT-1725)
  • ✅ independent_review

Files analysed: 19


wall-e 2026.06.19-02 · policy 6b4ce2b3b45a…

@agent-wall-e

agent-wall-e Bot commented Oct 15, 2026

Copy link
Copy Markdown
🔬 Debug — why this classification?

Each reason code emitted by the classifier, its source clause in the AI in SDLC Control Framework, and what it means.

Reason code Kind Clause Meaning
exceeds_bounded_scope — 466>250 classifying §2.1 M8 More than 250 non-test, non-doc, non-lockfile lines changed.

Kinds:

  • classifying — this rule contributed to the chosen tier.
  • informational — context only; did not by itself decide the tier.

See issue #3 for the proposal to formalise this map as Appendix A of the standards doc.

wall-e 2026.06.19-02 · debug

POST /payments/setups modelled several fields in a shape the API no longer
accepts, so the values were dropped without an error.

- card: the card data moves under card.details and token is an object.
  The flat accessors are deprecated and now write inside details, so
  existing code keeps compiling and starts sending the right keys.
- order.sub_merchants: number_of_trades is not an API field; the field is
  number_of_sales. The numberOfTrades accessors are deprecated and delegate.
- card, applepay, googlepay: add schemes and preferred_scheme.
- settings: add capture and excluded_payment_methods.
- payment_methods: add auto_confirm. Add metadata to the request and both
  responses. Add the read-only instrument.type.
- PaymentMethodStatus: deprecate PENDING and AVAILABLE, which the spec
  does not list.
The spec types payment_methods.applepay.token and googlepay.token as an
object {id, expires_on}. The SDK modelled token as a string with
expires_on next to it, a shape the API does not accept.

token is now a WalletToken. The flat expiresOn accessors are deprecated and
write inside token.

This is source-breaking for code that reads or writes token as a String.
That code could not have produced a valid request, since the API expects
an object, so nothing that worked stops working. Breaking because the API
demands it, so a minor release, to be called out in the release notes.
…shape

The flat card accessors, the wallet expiresOn accessors and numberOfTrades
were kept as deprecated methods that wrote into the new shape. The old
shape never worked against the API (the data was dropped without an
error), so removing them breaks nothing that worked, and a compile error
tells a merchant who used them that their data was being lost. It also
keeps these classes on plain Lombok accessors.

Card, ApplePay, GooglePay and OrderSubMerchant now expose only the spec
shape. Breaking because the API demands it, so a minor release.

Also add the read-only klarna.iban.
@rodrigojara-cko
rodrigojara-cko force-pushed the feat/INT-1725-payment-setup-shape-gaps branch from 6a543ff to 5d3e64a Compare October 15, 2026 14:29
@agent-wall-e

agent-wall-e Bot commented Oct 15, 2026

Copy link
Copy Markdown

🟡 Risk Classification: MINOR

Approval route: AI Review + Human Approval
Rollback controls: Staged rollout + rollback

Classification reasons

  • exceeds_bounded_scope:466>250

Operational gates

  • ✅ jira_ticket (INT-1725)
  • ✅ independent_review

Files analysed: 19


wall-e 2026.06.19-02 · policy 6b4ce2b3b45a…

@agent-wall-e

agent-wall-e Bot commented Oct 15, 2026

Copy link
Copy Markdown
🔬 Debug — why this classification?

Each reason code emitted by the classifier, its source clause in the AI in SDLC Control Framework, and what it means.

Reason code Kind Clause Meaning
exceeds_bounded_scope — 466>250 classifying §2.1 M8 More than 250 non-test, non-doc, non-lockfile lines changed.

Kinds:

  • classifying — this rule contributed to the chosen tier.
  • informational — context only; did not by itself decide the tier.

See issue #3 for the proposal to formalise this map as Appendix A of the standards doc.

wall-e 2026.06.19-02 · debug

PaymentSetupAccountHolder, used by card, applepay and googlepay, defines company_name; the model did not carry it.
@agent-wall-e

agent-wall-e Bot commented Oct 16, 2026

Copy link
Copy Markdown

🟡 Risk Classification: MINOR

Approval route: AI Review + Human Approval
Rollback controls: Staged rollout + rollback

Classification reasons

  • exceeds_bounded_scope:475>250

Operational gates

  • ✅ jira_ticket (INT-1725)
  • ✅ independent_review

Files analysed: 20


wall-e 2026.06.19-02 · policy 6b4ce2b3b45a…

@agent-wall-e

agent-wall-e Bot commented Oct 16, 2026

Copy link
Copy Markdown
🔬 Debug — why this classification?

Each reason code emitted by the classifier, its source clause in the AI in SDLC Control Framework, and what it means.

Reason code Kind Clause Meaning
exceeds_bounded_scope — 475>250 classifying §2.1 M8 More than 250 non-test, non-doc, non-lockfile lines changed.

Kinds:

  • classifying — this rule contributed to the chosen tier.
  • informational — context only; did not by itself decide the tier.

See issue #3 for the proposal to formalise this map as Appendix A of the standards doc.

wall-e 2026.06.19-02 · debug

@sonarqubecloud

Copy link
Copy Markdown

This branch has not been deployed

No deployments
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