S3 — price-deviation audit: every line sold below list by more than a threshold
After each booked sale, this sample records every line charged below its price-list rate by more than the retailer's threshold, so a store manager can read the findings in Desk. It runs as your own service outside the retailer's iVendNext and checks sales after they are booked: nothing changes at the till and no sale is held.
The recipe: Reading iVendNext's events reliably
In the App library: Price-deviation audit

What is in it: runs on its own server and keeps one list (deviation).
Industries: Fashion and footwear, Thrift and resale
When to use it: you want an after-the-sale check on prices, discounts or anything else a booked sale carries.
Door: Event feed
Start from it
ivn new acme_audit --from s3
What to change
What a partner usually changes:
- The default threshold:
DEFAULT_THRESHOLDinoutside/service.py(10 per cent), used when the retailer has made no settings record. Where you run it alone,PP_THRESHOLDsets it. - What counts as a deviation: the judging in
outside/service.py. A line is compared with its own list price; a discount on the whole sale and an item with no list price are not checked. - The record types:
PP PDO DeviationandPP PDO Settingsand the PP PDO Deviations This Month report inoutside/manifest.json;PDO_PREFIXrenames both record types. - Many retailers:
outside/app.py,outside/worker.pyandapp.jsonserve every retailer that installs it, each at its own threshold.
More: the event feed recipe.
The customer sets: the threshold, as the Price-deviation audit settings (PP PDO Settings) record titled Default (a System Manager makes it). The role PP PDO Integration needs no read from the retailer's administrator: the install gives it read on POS Invoice and Sales Invoice, the two record types the feed follows. Needs POS build 2.1.0.691 or later: on an earlier site the install gives the feed's user no read, so the events wait; the service's log says which record type was refused (ivn logs).
Run it
ivn check
ivn try
Versions
1.1.4
- An app made from S3 runs its audit when hosted: a host loads the app's service as
service.app, so the app'sservicefolder hid S3's ownservice.pyand the part never loaded (module 'service' has no attribute 'DEFAULT_THRESHOLD'). New app now loads each part with its own modules first. S3 itself is unchanged. An app made before this: press Add a sample with S3 again, or make it again, to take the service that runs the audit hosted.
1.1.3
- Desk shows plain names (Price deviation, Price deviations this month) through the manifest's
translationsblock, so a search for price deviation finds the record. The stored names are unchanged: an installed site keeps its records. Manifest 0.3.2.
1.1.2
- The deviations list and its report open largest first (the record type sorts by Below list, manifest 0.3.1); before, Desk's sort read Date and the report opened in date order.
1.1.1
- Its two record types give a guide address, so an app with it can be listed for every retailer.
1.1.0
- Hosted on a schedule as a function, paid per call, instead of an always-on container.
- Each setting in app.json says its purpose (the line the Settings screen shows), whether it is required, and which settings go with it.
1.0.0
- First version in the kit: every line sold below list by more than a threshold, as an audit.
- Serves many retailers, each at its own threshold.