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

FieldTypeRequiredDescriptionConstraints
idstringyes
slugstringyes
namestringyes
homepage_urlstring | null
urlstringyes
domainsarray of objectyes
domains[].hoststringyes
domains[].include_subdomainsbooleanyes
domains[].path_prefixstring | nullyes
active_codesintegeryes
  • minimum 0
hintsarray of stringyes
statusenum
  • one of "pending", "active", "disabled"

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 }] }