Skip to content

fix: accept Brenger's new flat refund amount payload - #3

Open
mrlkn wants to merge 1 commit into
masterfrom
fix/refund-amount-flat-shape
Open

fix: accept Brenger's new flat refund amount payload#3
mrlkn wants to merge 1 commit into
masterfrom
fix/refund-amount-flat-shape

Conversation

@mrlkn

@mrlkn mrlkn commented Aug 4, 2026

Copy link
Copy Markdown
Member

Summary (Claude)

  • Whoppah's daily check_brenger_v2_refunds task fails on every run since Brenger changed the refunds payload: GET /shipments/{id}/refunds now returns amount as a flat {'value': '107.10', 'currency': 'EUR'} instead of the documented {vat, incl_vat, excl_vat} breakdown → V2RefundResponse raises 3 validation errors (all three subfields missing). Verified live in Whoppah prod worker logs (daily 09:10, incl. 2026-08-04).
  • V2RefundResponse.amount becomes V2RefundAmount: all three breakdown fields optional, plus a model_validator(mode='before') that maps a flat {value, currency} payload to incl_vat — so response.amount.incl_vat.value keeps working for both the old and new API shape.
  • Deliberately scoped to the refund response: V2Price (quotes/shipments) is untouched, so unexpected shape changes there still fail loudly.
  • Adds the SDK's first tests (both payload shapes) and a pytest dev-dependency group.

Consumer note

whoppah pins this SDK via branch = "master" + poetry.lock — after this merges, whoppah needs a poetry update brenger lock bump (companion PR referenced there).

🤖 Generated with Claude Code

The refunds endpoint stopped returning the {vat, incl_vat, excl_vat}
breakdown (~2026-07) and now sends a flat {value, currency} object,
which failed V2RefundResponse validation with three missing-field
errors. V2RefundResponse.amount is now a dedicated V2RefundAmount that
accepts both shapes, exposing the flat form as incl_vat so callers keep
reading a single field. Other V2Price call sites are unchanged.

Adds the first SDK tests (pytest dev group).

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@socket-security

Copy link
Copy Markdown

Review the following changes in direct dependencies. Learn more about Socket for GitHub.

Diff Package Supply Chain
Security
Vulnerability Quality Maintenance License
Addedpypi/​pytest@​9.1.187100100100100

View full report

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