@sonatel-os/strapi-plugin-split 0.1.0 → 0.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -8,15 +8,16 @@ It assumes nothing about its host. Who the people are (a header your gateway set
8
8
 
9
9
  ## What you get
10
10
 
11
- | Area | In the admin | For the app (`/api/split`) |
12
- | --------------- | ---------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------- |
13
- | **People** | Search by name or phone (masked), reveal a full number (permission, logged), deactivate. | `GET /me` |
14
- | **Home** | Dashboard: people, groups, amount spent together, amount settled, by method. | `GET /overview` (what to pay, who owes you, every group), `GET /activity` |
15
- | **Groups** | Search by name or invite code; one group's books: seats, balances, payments, history. Archive. | `POST /groups`, `POST /groups/join`, `GET/PATCH /groups/:group`, `…/archive`, `…/leave` |
16
- | **Members** | Seats with their state: uses the app, added by name, left. | `POST /groups/:group/members`, `DELETE /groups/:group/members/:member` |
17
- | **Expenses** | The most recent fifty of a group. | `GET/POST /groups/:group/expenses`, `PUT/DELETE …/expenses/:expense` |
18
- | **Settlements** | Look a payment up by the reference the customer has. | `GET/POST /groups/:group/settlements`, `POST …/settlements/:settlement/confirm`, `…/reject`, `…/cancel` |
19
- | **Audit** | Who did what in which group, newest first. | — |
11
+ | Area | In the admin | For the app (`/api/split`) |
12
+ | --------------- | ---------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------ |
13
+ | **People** | Search by name or phone (masked), reveal a full number (permission, logged), deactivate. | `GET /me` |
14
+ | **Home** | Dashboard: people, groups, amount spent together, amount settled, by method. | `GET /overview` (what to pay, who owes you, every group), `GET /activity` |
15
+ | **Groups** | Search by name or invite code; one group's books: seats, balances, payments, history. Archive. | `POST /groups`, `POST /groups/join`, `GET/PATCH/PUT /groups/:group`, `…/archive`, `…/leave` |
16
+ | **Members** | Seats with their state: uses the app, added by name, left. | `POST /groups/:group/members`, `DELETE /groups/:group/members/:member` |
17
+ | **Expenses** | The most recent fifty of a group. | `GET/POST /groups/:group/expenses`, `PUT/DELETE …/expenses/:expense` |
18
+ | **Settlements** | Look a payment up by the reference the customer has. | `GET/POST /groups/:group/settlements`, `POST …/settlements/:settlement/confirm`, `…/reject`, `…/cancel` |
19
+ | **Orders** | — (each one is in the audit trail; a closed one is an expense). | `GET/POST /groups/:group/orders`, `GET …/orders/:order`, `PUT …/orders/:order/lines`, `POST …/orders/:order/close`, `…/cancel` |
20
+ | **Audit** | Who did what in which group, newest first. | — |
20
21
 
21
22
  All plugin tables are prefixed `split_` and hidden from the Content Manager: a ledger is not edited by hand, and the admin screens are read-mostly on purpose.
22
23
 
@@ -27,6 +28,7 @@ All plugin tables are prefixed `split_` and hidden from the Content Manager: a l
27
28
  - **Never more than is owed.** A settlement is checked against the books inside the transaction that writes it, behind the group's lock: no more than the payer owes, no more than the receiver is owed, less what is already declared between them. The refusal says how much is left (`details.outstanding`).
28
29
  - **Who confirms.** A method marked `instant` is one the host pays itself: confirmed at once. Otherwise the settlement is `pending` until the receiver confirms (or rejects; the payer can cancel). Pending settlements do not move balances.
29
30
  - **Seats before people.** A member can be added by name and phone before they ever open the app; the seat is theirs on their first visit. A member added by name only can owe and be owed, and what they are paid needs nobody's confirmation.
31
+ - **An order is not money until it closes.** Someone lists items with a unit price and, if they want, a closing time; members say how many of each they take (`PUT …/lines` replaces what one member takes; the organiser can set anyone's, also after the closing time). Closing writes one `free` expense paid by the organiser: each member owes what they took plus an equal part of the delivery fee given at closing. The expense carries the order's reference, so closing twice writes once.
30
32
  - **No seat, no group.** Asking for a group you are not in answers the same `404` as a group that does not exist.
31
33
 
32
34
  ## Install
@@ -75,6 +77,12 @@ x-person-name: Fatou%20Sow
75
77
  "reference": "PP261122.1135.A64593", "clientRef": "5f1c…" }
76
78
  ```
77
79
 
80
+ The receiver can write a payment too, with `from` instead of `to`: "this member paid me". It is confirmed at once whatever the method, since it is the receiver's own word that the money came, and it is how a debt is closed for a member who does not use the app. It is held to the same ceiling: never more than that member owes the caller.
81
+
82
+ ```json
83
+ { "from": "<member id>", "amount": 30000, "method": "cash", "clientRef": "8a2d…" }
84
+ ```
85
+
78
86
  The id can be anything stable the host owns. When it is a phone number it has one spelling: digits only, and without the country code when `countryCode` is set (with `221`, `+221 77 000 00 01`, `00221770000001` and `770000001` are the same person). A seat added by phone is matched to the person on that spelling. Missing header → `400 PERSON_REQUIRED`; deactivated in the admin → `403 PERSON_INACTIVE`.
79
87
 
80
88
  ## Language