# Pivo fixture Origin: https://pivo.ecorce.app Ledger: fixture This is a demo ledger. Parties, prices, and on-hand quantities are fixture numbers. They are not PivoHub. This origin has no live API and takes no payment. The object is one order: one buyer, one seller, state accepted, or no order at all. A refused order is not stored. On-hand moves only when an order is accepted, and only at the seller. You are a client. You do not set the price, the minimum, the territory, or the stock. The server does. A price you send is ignored. The stored price is the price list for that buyer and seller. A rep is not a buyer. A rep submits for a party they already represent. ## Discover GET https://pivo.ecorce.app/api/discover No token. Returns the parties you may assume, the operations, and the refusal codes. Prices are not in this response. ## Assume a party POST https://pivo.ecorce.app/api/sessions Content-Type: application/json {"party_id":"retailer.counter"} party_id is one of: - producer.north (producer) North Fixture - producer.orchard (producer) Orchard Fixture - distributor.east (distributor) East Fixture - retailer.counter (retailer) Counter Fixture - retailer.west (retailer) West Fixture - rep.east (rep, represents retailer.counter) East Rep Fixture The response data.token is the credential. Send it on later calls: Authorization: Bearer Do not invent a party. Do not send a type and expect a new account. Assuming a party grants that party's fixture rights only. ## Read the price list GET https://pivo.ecorce.app/api/catalog Authorization: Bearer data.buy is what this session may order. data.sell is what this session sells. Each row: seller_id, buyer_id, sku, name, unit, price_cents, minimum_qty, seller_on_hand. minimum_qty is the sum of line quantities for that buyer and seller, not a per-sku minimum. price_cents is the list. seller_on_hand is the fixture quantity. data.send_buyer_id is true for a rep. ## Submit one order POST https://pivo.ecorce.app/api/orders Authorization: Bearer Content-Type: application/json {"seller_id":"distributor.east","lines":[{"sku":"LAGER","qty":3}]} A rep also sends buyer_id: {"buyer_id":"retailer.counter","seller_id":"distributor.east","lines":[{"sku":"LAGER","qty":3}]} qty is a whole number greater than 0. One line per sku. Do not send a price. Do not send a unit. unit is case, from the sku. The whole order is refused if any line, the minimum, or the on-hand quantity fails. Stock does not move on a refusal. Accepted data.order fields: id, state (accepted), buyer_id, seller_id, submitted_by, lines, qty, minimum_qty, total_cents, price_ignored, accepted_at. Each line: sku, name, unit, qty, price_cents, total_cents, price_sent. price_ignored true means a price was sent and discarded. price_cents on the line is still the list. ### Accepted transcript POST with retailer.counter, seller distributor.east, one line LAGER qty 3. Stored line price_cents is 2000. total_cents is 6000. Seller on-hand for LAGER moves from 5 to 2. ### Refused transcript The same pair with LAGER qty 1. HTTP 422. error.code is refuse. error.reasons[0].code is minimum. The minimum for this pair is 3. No order id. On-hand stays put. Other pairs in the fixture, still fake: distributor.east buys LAGER and ALE from producer.north at 1000, minimum 2. distributor.east buys CIDER from producer.orchard at 1000, minimum 1. retailer.west buys CIDER from producer.orchard at 2000, minimum 1. retailer.west has no price list with distributor.east. ## Read it back GET https://pivo.ecorce.app/api/orders/ Authorization: Bearer Use the buyer, the seller, the submitter, or a rep who represents the buyer or the seller. Anyone else gets lecture_refusee. Read this before you tell a person the order exists. Do not trust your own draft. GET https://pivo.ecorce.app/api/board No token. Every accepted order, same money fields. The board cannot write. It is a second client. ## Errors {"ok":false,"ledger":"fixture","fixture":true,"data":null,"error":{"code":"...","message":"...","reasons":[]}} Success has ok true, data, and error null. ledger and fixture are on every JSON body. Refusal codes: corps, partie_inconnue, mandat_refuse, relation_absente, sku_inconnu, qte_invalide, doublon, minimum, stock_insuffisant, session_requise, jeton_inconnu, commande_inconnue, lecture_refusee. On a refused order, error.code is refuse and reasons[].code is the predicate. HTTP 422. session_requise and jeton_inconnu are HTTP 401. lecture_refusee is HTTP 403. partie_inconnue and commande_inconnue are HTTP 404. corps is HTTP 400 when the JSON itself is not an object. A bad line inside a parsed order comes back as HTTP 422 with reasons. ## Reset POST https://pivo.ecorce.app/api/reset Clears orders and tokens and restores fixture on-hand. Demo only. After a reset the old token is dead. ## Stop accepted on this fixture is not cash, not an invoice, and not a delivery. Do not call a PivoHub API from here. There is no write on this origin except the operations above.