Runs live, versioned Python application objects on one VM, with a suite of apps: projects, notes, tasks, files and more.

0 downloads

Download zip
Clone
Clone with git
git clone https://gitstable.com/git/askrobots/dbbasic-object-server.git
HTTPS
https://gitstable.com/git/askrobots/dbbasic-object-server.git
SSH
ssh://git@gitstable.com:2222/askrobots/dbbasic-object-server.git

Cloning needs no sign-in. Pushing over HTTPS asks for your username and an access token. SSH needs your key under SSH keys.

danq9 signup: the person chooses the password and name on the confirm page 83c7aa6 2 weeks, 5 days ago History
dbbasic-package.json · 8.3 KB · 85 lines
1{
2 "id": "app-returns",
3 "name": "Returns",
4 "version": "0.4.0",
5 "description": "A customer return is not an undo. The shipment that left the building is a true statement about what went out on a particular day, in a particular box, and it stays true whatever comes back afterwards -- so this package adds documents that REFERENCE the original rather than editing it (docs/logic-decisions.md #3), and adds exactly one collection to do it. The parcel coming back is not a new noun: it is a shipment with direction=inbound, the same rows, the same lines, the same over-quantity arithmetic with the sign reversed, which is why app-shipping's schema gained an inbound ladder (authorized -> in_transit -> received -> dispositioned, plus expired) instead of this package growing a returns table and a returns_lines table that could only ever disagree with the shipment about what is in the box. What an RMA genuinely knows that a parcel does not is who granted it, why the customer asked, when the offer stops being good and which refund it produced -- and that is precisely the field list of return_authorizations, no wider. The three gates are the ones a shop discovers the hard way: you cannot return what never left (the order has to be shipped, delivered or partial -- goods still on our own shelf come off an order by cancelling it, which is different money), you cannot return more than was shipped minus what an earlier RMA already claimed (refused with all the numbers, the mirror of the over-ship gate, because a second RMA for the same mug is how two refunds get paid for one sale), and a return has to say WHY -- the reason decides whether disposal is `damage` or `waste`, whether the mistake was ours, and whether a restocking fee is fair, and a reason asked for a week later is a guess. Goods arriving and goods being judged are two different events on purpose: system_return_posting stamps the authorization when the parcel lands and touches no stock and no money at all, because a box on the dock could hold a mug in its wrapping or the same mug in three pieces, and a handler that guessed would put damaged goods back on the shelf or write off sellable stock depending on which was cheaper to code. A human then makes one call -- action_disposition_return -- which is the ONE place a return and its refund compose, so they cannot drift into a shop that restocked on Monday and refunded on Thursday and can no longer say which goods the money was for. Restock composes a `return` stock move from the customer location back to the shelf; DISPOSAL COMPOSES A MOVE TOO (`waste`, or `damage` when the customer said it arrived broken), because goods that left inventory with no trace is exactly how shrinkage hides and a loss report that only counts what somebody remembered to write down is guaranteed to be optimistic. The refund ceiling is not reimplemented here: hook_refunds already knows what a payment can give back, so this action asks it and surfaces its refusal verbatim, and refund: none is a first-class silent outcome because restocking-fee-only, replacement-instead-of-refund and goodwill restocks are all ordinary. A dispositioned return answers a retry with ok and a note -- no second moves, no second refund -- which is the property the whole slice is judged on. What is deliberately NOT here, named so it reads as a decision rather than an omission: carrier return LABELS (a connector boundary with BYO credentials, manual-first, later slice -- the page says so instead of showing a dead button), a customer-facing tokened return door (it needs a token field on orders, which is another package's schema; the page requires sign-in and says why), a daemon pass sweeping stale authorizations to `expired` (time-driven work belongs with the tracking poll), restocking fees, replacement shipments, and disputes. Ships an attention provider for inbound shipments at `received`: a box that arrived back and has not been judged, so the customer has no refund and the stock has no truth. The RMA is deliberately not what is counted -- an authorization is an intention, and the parcel is the thing with a person waiting on it. 0.3.0 builds the bench. The attention count has been pointing at /orders since it shipped -- a path this package does not own, serving a list that contains none of the things it counted -- because the goods coming back had no page of their own. They do now: /returns is a seeded `views` record whose `list` block carries where:{direction:inbound} over app-shipping's `shipments`, which is the collection the count actually reads. The index is over SHIPMENTS and not over return_authorizations for the same reason the provider counts shipments: an RMA is an intention, several of which will never become a parcel, and the parcel is the thing with a person waiting on it -- a page that disagreed with its badge about what a return even IS would be worse than the /orders link it replaces. `where` rather than `filters` is load-bearing: `filters` renders through the view layer's client-side fallback, which titles each row `title || name || id` and would have drawn a column of raw shipment ids, while `where` compiles to the real server-side narrowing and keeps the schema's table, its status filter bar, search and the row cap (see app-views 0.4.0). The bench shows the whole inbound ladder rather than only `received`, because a returns bench that hides what is in transit and what was settled yesterday cannot answer the two questions anybody standing at it actually asks; `status` is one click away in the filter bar. The door is filed under the operator tier, but the count deliberately carries NO nav_id: a count bound to a door inherits that door's audience, and the people who open the boxes are the people permissions/rules.json already lets disposition them without fetching an owner -- hiding the number from them to keep the menu tidy would undo the reason this queue is counted at all. 0.4.0 unblocks the return nobody could start. site_return_form used to demand a signed-in session because there was no order token to authenticate against, which meant that in a shop whose default sale is a guest checkout, the returns flow was reachable by staff and by literally no customer. app-orders now ships orders.portal_token, so the page accepts `?token=` as an alternative credential -- matched against that one order with hmac.compare_digest, carried through the POST in a hidden field so the submit button cannot bounce somebody the GET already let in. The signed-in path is unchanged. Every refusal -- no credential, wrong token, token for another order, no such order -- renders the same page, so a guessed order id never confirms itself. The permission rule flips from registered to public EXECUTE on the page object; the collections behind it stay owner-scoped.",
6 "compatibility": {
7 "dbbasic_object_server": ">=0.1.0"
8 },
9 "dependencies": [
10 "app-orders",
11 "app-shipping",
12 "app-payments",
13 "app-catalog",
14 "app-views"
15 ],
16 "objects": [
17 {
18 "id": "action_authorize_return",
19 "path": "objects/action/authorize_return.py"
20 },
21 {
22 "id": "action_disposition_return",
23 "path": "objects/action/disposition_return.py"
24 },
25 {
26 "id": "system_return_posting",
27 "path": "objects/system/return_posting.py"
28 },
29 {
30 "id": "site_return_form",
31 "path": "objects/site/return_form.py"
32 },
33 {
34 "id": "system_return_attention",
35 "path": "objects/system/return_attention.py"
36 }
37 ],
38 "schemas": [
39 {
40 "collection": "return_authorizations",
41 "path": "schemas/return_authorizations.json"
42 }
43 ],
44 "permissions": [
45 {
46 "path": "permissions/rules.json"
47 }
48 ],
49 "seed": [
50 {
51 "collection": "return_authorizations",
52 "path": "seed/return_authorizations.tsv"
53 },
54 {
55 "collection": "site_routes",
56 "path": "seed/site_routes.tsv"
57 },
58 {
59 "collection": "views",
60 "path": "seed/views.tsv"
61 }
62 ],
63 "migrations": [],
64 "nav": [
65 {
66 "id": "returns",
67 "label": "Returns",
68 "path": "/returns",
69 "blurb": "The bench: every parcel coming back, and which ones nobody has judged",
70 "surface": "operator",
71 "group": "Warehouse",
72 "order": 530
73 }
74 ],
75 "attention": [
76 {
77 "id": "returns_to_disposition",
78 "object_id": "system_return_attention",
79 "label": "Returns to process",
80 "path": "/returns",
81 "group": "Warehouse",
82 "severity": "normal"
83 }
84 ]
85}