AlmondTill/G3N API

On this page

doomCouponBatch

mutation · in the family Coupon batch

What it does

Permanently void a batch — its unused codes stop working; already-redeemed history stays.

Doom (terminal) a CouponBatch — VOIDS the unredeemed children (attach refuses naming the batch; their code markers stay owned until the family purges — batch codes are never reissued, the campaign identity law) while redeemed history stands untouched. The PARENT coupon is untouched. Requires the unrestricted capability + the CURRENT revision.

What happens

Permanent. The parent coupon is untouched.

Who may call it

Capability area: Pricing — Prices, price schedules, promotions, coupons and the money rules of selling.

Arguments

NameTypeRequiredNotes
idID ID!yesThe id of the record.
revisionID ID!yesThe revision id you read on the record; the change is refused if an edit landed in the meantime.
reasonStringnoNo further notes.

Returns

CouponBatch CouponBatch! — A CouponBatch: a Coupon-parented batch of UNIQUE SINGLE-USE child codes (the campaign lane). Each child code is a KEY to the PARENT coupon's terms — the parent's flavor/window/cap/eligibility verdicts run UNCHANGED at attach and the parent's REDEEM counter counts every use; the child adds exactly ONE law: it redeems ONCE (the stamp rides the PLACE transaction conditioned — a lost race between two carts refuses the second placement). Minted WHOLE in ONE transaction (≤48 codes — the ceiling IS the transaction bound; bigger campaigns mint more batches) via the bespoke createCouponBatch; the codes are SERVER-GENERATED (<prefix>-<random tail> — unguessable, never caller-supplied), take the SAME org-group code-namespace UNIQ marker parent codes use, and are LISTABLE via couponBatchCodes (campaign codes are distribution artifacts, not secrets). Dooming the batch VOIDS its unredeemed children (attach refuses naming the batch) while redeemed history stands; a clawed-back child (a cancelled order) is REDEEMABLE AGAIN — the customer's code survives a voided sale.

Example request

mutation ExampleDoomCouponBatch($id: ID!, $revision: ID!, $reason: String) {
  doomCouponBatch(id: $id, revision: $revision, reason: $reason) {
    id
    sysId
    type
    caption
    status
    parentId
    rootId
    createdAt
    updatedAt
    revisionNum
    revision
    codePrefix
    codeCount
  }
}

Variables:

{
  "id": "01900000-0000-7000-8000-37386ae00000",
  "revision": "01900000-0000-7000-8000-b7960e180000",
  "reason": "Correcting a miscount."
}

Send it with the envelope naming the version: "extensions": {"at": {"version": {"name":"genesis","number":0}}}.

Example response

{
  "data": {
    "doomCouponBatch": {
      "id": "01900000-0000-7000-8000-37386ae00000",
      "sysId": "CB-EXMP-0000-000F",
      "type": "CouponBatch",
      "caption": "Blue jeans",
      "status": "active",
      "parentId": "01900000-0000-7000-8000-065235280000",
      "rootId": "01900000-0000-7000-8000-a093dd800000",
      "createdAt": "2027-01-31T00:00:00.000Z",
      "updatedAt": "2027-01-31T00:00:00.000Z",
      "revisionNum": 1,
      "revision": "01900000-0000-7000-8000-b7960e180000",
      "codePrefix": "<code prefix>",
      "codeCount": 1
    }
  },
  "extensions": {
    "at": {
      "callId": "01EXAMPLE-CALL-ID",
      "version": {
        "requested": {
          "name": "genesis",
          "number": 0
        },
        "serviced": {
          "name": "genesis",
          "number": 0
        }
      }
    }
  }
}

Errors this call can answer