CouponsMerchant coupons.merchant@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/merchant.v1.json
coupons.merchant@1: one merchant as OpenVibe.Coupons' lookup API shows it (server/http/api.js merchantView): the same bytes for every caller, nothing about any person. Staff and service answers of the merchant routes add its status.
Fields
| Field | Type | Required | Description | Constraints |
|---|---|---|---|---|
id | string | yes | ||
slug | string | yes | ||
name | string | yes | ||
homepage_url | string | null | |||
url | string | yes | ||
domains | array of object | yes | ||
domains[].host | string | yes | ||
domains[].include_subdomains | boolean | yes | ||
domains[].path_prefix | string | null | yes | ||
active_codes | integer | yes |
| |
hints | array of string | yes | ||
status | enum |
|
Examples
From the contract's own test fixtures: valid ones validate, rejected ones must fail.
Valid: shop
{
"id": "mer_01JAB2C3D4E5F6G7H8J9K0MNPQ",
"slug": "example-shoes",
"name": "Example Shoes",
"homepage_url": "https://shoes.example.com/",
"url": "https://openvibe.coupons/m/example-shoes",
"domains": [
{
"host": "shoes.example.com",
"include_subdomains": true,
"path_prefix": null
}
],
"active_codes": 2,
"hints": [
"Enter the code in the Promo field at checkout."
]
}Rejected: negative-count
{
"id": "m",
"slug": "s",
"name": "n",
"url": "u",
"domains": [],
"active_codes": -1,
"hints": []
}Validate
const contracts = require('openvibe-contracts');
contracts.validate('coupons.merchant@1', value); // { valid, errors: [{ path, message }] }