CouponsCoupon coupons.coupon@1
Generated at from
openvibe-contracts v0.53.0 and
openvibe-sdk v0.11.0.
- Version
- 1.0.0
- Owner
- coupons
- Visibility
- first-party
- Status
- active
- Compatibility
- backward
- Schema
https://openvibe.network/contracts/coupons/coupon.v1.json
coupons.coupon@1: one code as OpenVibe.Coupons shows it (server/domain/coupons.js view): its status and confidence come only from people's reports (counts in a window, report times rounded to the hour), a known or unknown expiry, restrictions, hints and evidence. No submitter or reporter is ever named.
Fields
| Field | Type | Required | Description | Constraints |
|---|---|---|---|---|
id | string | yes | ||
merchant_id | string | yes | ||
code | string | yes |
| |
title | string | yes | ||
description | string | null | |||
status | enum | yes |
| |
active | boolean | yes | ||
confidence | any | |||
reports | object | yes | ||
reports.window_days | integer | |||
reports.last_report_at | string | null |
| ||
reports.last_worked_at | string | null |
| ||
reports.last_failed_at | string | null |
| ||
expiry | object | yes | ||
expiry.known | boolean | yes | ||
expiry.expires_at | string | null | yes |
| |
expiry.precision | string | null | |||
expiry.basis | string | null | |||
restrictions | array of object | yes | ||
restrictions[].kind | enum | yes |
| |
restrictions[].value | any | |||
restrictions[].amount | string | |||
restrictions[].amount_minor | integer | |||
restrictions[].currency | string | |||
hints | array of object | |||
hints[].text | string | |||
hints[].scope | enum |
| ||
evidence | array of object | |||
evidence[].kind | string | |||
evidence[].url | string | null | |||
evidence[].merchant_page | boolean | |||
evidence[].sources_item | string | |||
evidence[].retrieved_at | string | null |
| ||
origin | string | yes | ||
created_at | string | null |
| ||
updated_at | string | null |
| ||
expired_at | string | null |
| ||
url | string | yes |
Examples
From the contract's own test fixtures: valid ones validate, rejected ones must fail.
Valid: working
{
"id": "cpn_01JAB2C3D4E5F6G7H8J9K0MNPR",
"merchant_id": "mer_01JAB2C3D4E5F6G7H8J9K0MNPQ",
"code": "FALL15",
"title": "15% off sneakers",
"description": null,
"status": "reported_working",
"active": true,
"confidence": 0.82,
"reports": {
"worked": 9,
"failed": 1,
"window_days": 30,
"last_report_at": "2026-09-25T17:00:00.000Z",
"last_worked_at": "2026-09-25T17:00:00.000Z",
"last_failed_at": "2026-09-20T09:00:00.000Z"
},
"expiry": {
"known": true,
"expires_at": "2026-10-31T23:59:59.999Z",
"precision": "date",
"basis": "evidence"
},
"restrictions": [
{
"kind": "min_spend",
"amount": "$50.00",
"amount_minor": 5000,
"currency": "USD"
},
{
"kind": "new_customers_only"
}
],
"hints": [],
"evidence": [
{
"kind": "page",
"url": "https://shoes.example.com/fall-sale",
"merchant_page": true
}
],
"origin": "member",
"created_at": "2026-09-20T09:00:00.000Z",
"updated_at": "2026-09-25T17:03:00.000Z",
"expired_at": null,
"url": "https://openvibe.coupons/c/cpn_01JAB2C3D4E5F6G7H8J9K0MNPR"
}Rejected: verified-status
{
"id": "cpn_01JAB2C3D4E5F6G7H8J9K0MNPR",
"merchant_id": "mer_01JAB2C3D4E5F6G7H8J9K0MNPQ",
"code": "FALL15",
"title": "15% off sneakers",
"description": null,
"status": "verified",
"active": true,
"confidence": 0.82,
"reports": {
"worked": 9,
"failed": 1,
"window_days": 30,
"last_report_at": "2026-09-25T17:00:00.000Z",
"last_worked_at": "2026-09-25T17:00:00.000Z",
"last_failed_at": "2026-09-20T09:00:00.000Z"
},
"expiry": {
"known": true,
"expires_at": "2026-10-31T23:59:59.999Z",
"precision": "date",
"basis": "evidence"
},
"restrictions": [
{
"kind": "min_spend",
"amount": "$50.00",
"amount_minor": 5000,
"currency": "USD"
},
{
"kind": "new_customers_only"
}
],
"hints": [],
"evidence": [
{
"kind": "page",
"url": "https://shoes.example.com/fall-sale",
"merchant_page": true
}
],
"origin": "member",
"created_at": "2026-09-20T09:00:00.000Z",
"updated_at": "2026-09-25T17:03:00.000Z",
"expired_at": null,
"url": "https://openvibe.coupons/c/cpn_01JAB2C3D4E5F6G7H8J9K0MNPR"
}Validate
const contracts = require('openvibe-contracts');
contracts.validate('coupons.coupon@1', value); // { valid, errors: [{ path, message }] }