AlmondTill/G3N API

NewCouponInput

input type

Create-input for a Coupon. The tenant (org group) is derived SERVER-SIDE from the principal — NEVER supplied here; the RAW code is normalized (trim+UPPERCASE) + grammar-gated server-side; flavor⟺payload coherence is the boundary refine (trigger ⟺ promotionId, discount ⟺ effect); a trigger promotion must be same-tenant + ACTIVE + couponGated.

Fields

FieldTypeRequiredNotes
captionStringnoOptional: when omitted the per-type default applies — the NORMALIZED code (self-documenting — the code IS the identity); when supplied it must be non-blank.
codeString String!yesThe RAW code (1..64 pre-normalization) — normalized + grammar-gated server-side; the org-group ACTIVE-code UNIQ marker mints IN the create transaction (a LIVE holder refuses CONFLICT/COUPON_CODE_TAKEN naming it; a DOOMED holder is taken over).
flavorCouponFlavor CouponFlavor!yesNo further notes.
promotionIdIDnoREQUIRED iff trigger: the unlocked Promotion (tenant-scoped + ACTIVE + couponGated — REF_STATE / VALIDATION/INVALID otherwise).
effectCouponEffectInputnoREQUIRED iff discount: the carried effect.
startAtStringnoThe window start — omitted ⇒ stamped NOW.
endAtStringnoThe window end (half-open) — omitted ⇒ evergreen.
totalUsesCapIntnoNo further notes.

Used by