iVendNextDevelopers Request a sandbox

S20 — Warranty capture and a member code (capture)

Two capture services, each at its own address. On scan of an item in the named item groups, before its line goes on the sale, the service answers with a warranty reference for the line (a value of a line attribute the shop keeps). On customer add, before the customer is created, it refuses a customer without a mobile number or with a barred one, and otherwise sends a one-time code: the customer is created only after the right code. No answer writes a customer field or moves money.

The recipe: recipes/capture.md.

File What it is
manifest.json two capture services (scan, customer add), installed switched off
capture.py the pure core: signature check, a new warranty reference per scan (the till sends no line id), the codes (Codes, ten minutes, in this process)
service/app.py the service: POST /cap/scan, POST /cap/customer (each checks its own secret before reading the body), GET /health; its message gateway is a stand-in (Outbox, a private file)
tests/ the core, the service over the wire, every answer against the published contract

Settings (service/.env.local, never committed): PP_POINT_SECRET_SCAN and PP_POINT_SECRET_CUSTOMER (handed back at install as pp_cap:sub:on_scan and pp_cap:sub:on_customer), PP_LINE_ATTRIBUTE (the shop's active line attribute), PP_BARRED_PHONES, PP_OUTBOX (the stand-in's file), PP_PORT.

python3 service/app.py service/.env.local
python3 -m unittest discover -s samples/s20_capture/tests -p 'test_*.py'

Replace before production: Outbox.send with your SMS or WhatsApp provider, and Codes with your own store if you run more than one process.

This page in the kit