Support rebate offers in MCP#37
Conversation
|
Quick context: rebate MCP support was one of a few things that existed in the original feature branches but silently never made it to A few things worth a quick confirm before merge: 1. Stacking on churnkey-api#953. Just confirming this lands after it — API 2. MCP docs. The MCP reference page ( 3. Minor overlap with #38. It also touches |
There was a problem hiding this comment.
Schema's clean and forward-correct — the zod rebate config matches the API's new contract exactly: amountType FIXED|PERCENT, fixedAmounts: [{ currency, amountMinor }], percentAmount 0–100, mbgWindowDays, invoiceScope FIRST_PAID|LATEST_PAID. Currency handling (/^[A-Za-z]{3}$/ + lowercase) matches the API's lowercase expectation, the uniqueness refine and .strict() mirror the server checks, and REBATE slots into the offerType enum without touching the existing DISCOUNT/customAmount path. 👍
The one that matters (you know this — it's the whole point of the stack): this sends fixedAmounts, which API master rejects until churnkey-api#953 deploys — so ship this after that, or every fixed-currency rebate 422s. Ordering, not a code issue.
Nits, non-blocking:
- Tests are fully mocked, so they can't catch that contract drift and skip the failure modes (negative
amountMinor,percentAmount > 100, emptyfixedAmounts) — worth a couple of schema-rejection cases. amountMinoruses.int()vs the API's safe-integer check — only matters above 2^53, so negligible.
Approving 🚀 (ship after the API PR deploys)
Review companion — currency-specific rebate caps (re-review) · Derive
What changed
Why
The MCP schema previously could not create or update rebate offers. Currency-aware validation keeps MCP writes aligned with the API and admin builder.
Validation