CouponsCouponDisabledPayload coupons.coupon.disabled@1

Generated at from openvibe-contracts v0.34.2 and openvibe-sdk v0.5.0.

Version
1.0.0
Owner
coupons
Visibility
first-party
Status
active
Compatibility
backward
Schema
https://openvibe.network/contracts/events/payloads/coupons.coupon.disabled.v1.json

coupons.coupon.disabled v1 (OpenVibe.Coupons server/domain/coupons.js recompute via withdrawSourceItem and setStatus, payload from lifecyclePayload). A code was taken down, in the transaction that recorded it: the last OpenVibe.Sources item that evidenced it was removed at the source (reason source_removed), or staff or a service holding coupons.status.update disabled it (staff, service:<client>[:<note>]). Its page answers 410, it cannot be resubmitted and nothing is deleted. Disabling a merchant does not emit this per code (its codes only get Search tombstones). When the code was in Search, a coupons.index_document.deleted tombstone follows in the same transaction. Envelope: subject { type: coupon, id: cpn_… }, visibility public when the code was publicly listed before the change, otherwise internal, priority important (not set: the Events default), actor service:coupons. No known consumers.

Fields

FieldTypeRequiredDescriptionConstraints
merchant_idstringyesThe merchant the code belongs to.
  • pattern ^mer_[0-9A-HJKMNP-TV-Z]{26}$
statusconstyes
  • = "disabled"
confidencenumber | nullyesReport confidence at the time (rounded to 2 decimals); null = no counted report in the last 30 days.
  • minimum 0
  • maximum 1
review_stateenumyes
  • one of "pending", "published"
expires_atstring | nullyesKnown expiry (UTC); null = expiry unknown.
  • format date-time
canonical_urlstringyesThe code's page on Coupons (<origin>/c/<coupon id>); it now answers 410.
  • pattern ^https?://
  • format uri
  • maxLength 2048
previous_statusenumyesStatus before it was disabled.
  • one of "unknown", "reported_working", "reported_failed", "expired"
reasonone ofyessource_removed, staff, or service:<client>[:<note>].

Examples

From the contract's own test fixtures: valid ones validate, rejected ones must fail.

Valid: source-removed
{
  "merchant_id": "mer_01K5R7A1B2C3D4E5F6G7H8J9KM",
  "status": "disabled",
  "confidence": null,
  "review_state": "pending",
  "expires_at": null,
  "canonical_url": "https://openvibe.coupons/c/cpn_01K5R9B2C3D4E5F6G7H8J9K0MN",
  "previous_status": "unknown",
  "reason": "source_removed"
}
Valid: staff-expired-code
{
  "merchant_id": "mer_01K5R7A1B2C3D4E5F6G7H8J9KM",
  "status": "disabled",
  "confidence": 0.33,
  "review_state": "published",
  "expires_at": "2026-09-20T23:59:59.999Z",
  "canonical_url": "https://openvibe.coupons/c/cpn_01K5R8Z3Q4M2N7P9T1V6W8X0YA",
  "previous_status": "expired",
  "reason": "staff"
}
Rejected: confidence-percent
{
  "merchant_id": "mer_01K5R7A1B2C3D4E5F6G7H8J9KM",
  "status": "disabled",
  "confidence": 33,
  "review_state": "published",
  "expires_at": null,
  "canonical_url": "https://openvibe.coupons/c/cpn_01K5R8Z3Q4M2N7P9T1V6W8X0YA",
  "previous_status": "reported_failed",
  "reason": "staff"
}
Rejected: reason-report
{
  "merchant_id": "mer_01K5R7A1B2C3D4E5F6G7H8J9KM",
  "status": "disabled",
  "confidence": 0.33,
  "review_state": "published",
  "expires_at": null,
  "canonical_url": "https://openvibe.coupons/c/cpn_01K5R8Z3Q4M2N7P9T1V6W8X0YA",
  "previous_status": "reported_failed",
  "reason": "report"
}

Validate

const contracts = require('openvibe-contracts');
contracts.validate('coupons.coupon.disabled@1', value);   // { valid, errors: [{ path, message }] }