CouponsReportCreatedPayload coupons.report.created@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.report.created.v1.json

coupons.report.created v1 (OpenVibe.Coupons server/domain/reports.js report). A signed-in person (site form, a browser-helper install token with scope coupons.report, or a service acting for a person with X-OV-Subject) reported that an active code worked or failed, in the transaction that stored the report. One event per new (reporter, code, UTC day) row: a repeat the same day is deduplicated and a same-day switch to the other outcome corrects that row, and neither emits (both still recompute). The payload never identifies the reporter: not the subject, the HMAC reporter key or the install. reason is present only on failed reports that gave one. A coupons.confidence.changed and, when the status moved, a lifecycle event follow in the same transaction. Envelope: subject { type: coupon, id: cpn_… }, visibility internal, priority important (not set: the Events default), actor service:coupons. No known consumers.

Fields

FieldTypeRequiredDescriptionConstraints
merchant_idstringyesThe merchant of the reported code.
  • pattern ^mer_[0-9A-HJKMNP-TV-Z]{26}$
outcomeenumyes
  • one of "worked", "failed"
reasonenumWhy a failed code failed, when the reporter said. Never on a worked report.
  • one of "invalid", "expired", "min_spend_not_met", "not_eligible", "other"
channelenumyesHow the report arrived: the site form, a browser-helper install token, or the API (a Network token or a service acting for a person).
  • one of "site", "extension", "api"
daystringyesThe UTC day of the report (YYYY-MM-DD), the deduplication bucket.
  • format date

Examples

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

Valid: failed-with-reason
{
  "merchant_id": "mer_01K5R7A1B2C3D4E5F6G7H8J9KM",
  "outcome": "failed",
  "reason": "min_spend_not_met",
  "channel": "extension",
  "day": "2026-09-23"
}
Valid: worked
{
  "merchant_id": "mer_01K5R7A1B2C3D4E5F6G7H8J9KM",
  "outcome": "worked",
  "channel": "site",
  "day": "2026-09-23"
}
Rejected: bad-channel
{
  "merchant_id": "mer_01K5R7A1B2C3D4E5F6G7H8J9KM",
  "outcome": "failed",
  "reason": "invalid",
  "channel": "app",
  "day": "2026-09-23"
}
Rejected: names-reporter
{
  "merchant_id": "mer_01K5R7A1B2C3D4E5F6G7H8J9KM",
  "outcome": "failed",
  "channel": "site",
  "day": "2026-09-23",
  "reporter": "usr_01K5R5E4F3G2H1J0K9M8N7P6QR"
}
Rejected: worked-with-reason
{
  "merchant_id": "mer_01K5R7A1B2C3D4E5F6G7H8J9KM",
  "outcome": "worked",
  "reason": "other",
  "channel": "api",
  "day": "2026-09-23"
}

Validate

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