@sonatel-os/strapi-plugin-split 0.2.0 → 0.4.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 +15 -10
- package/dist/server/index.js +879 -134
- package/dist/server/index.mjs +879 -134
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -8,15 +8,17 @@ 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/PUT /groups/:group`, `…/archive`, `…/leave`
|
|
16
|
-
| **
|
|
17
|
-
| **
|
|
18
|
-
| **
|
|
19
|
-
| **
|
|
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`, `PUT /me` (`{ autoAcceptInvites }`) |
|
|
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
|
+
| **Invitations** | — | `GET /invitations`, `POST /invitations/:invitation/accept`, `…/decline` |
|
|
17
|
+
| **Members** | Seats with their state: uses the app, added by name, left. | `POST /groups/:group/members`, `DELETE /groups/:group/members/:member` |
|
|
18
|
+
| **Expenses** | The most recent fifty of a group. | `GET/POST /groups/:group/expenses`, `PUT/DELETE …/expenses/:expense` |
|
|
19
|
+
| **Settlements** | Look a payment up by the reference the customer has. | `GET/POST /groups/:group/settlements`, `POST …/settlements/:settlement/confirm`, `…/reject`, `…/cancel` |
|
|
20
|
+
| **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` |
|
|
21
|
+
| **Audit** | Who did what in which group, newest first. | — |
|
|
20
22
|
|
|
21
23
|
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
24
|
|
|
@@ -26,7 +28,10 @@ All plugin tables are prefixed `split_` and hidden from the Content Manager: a l
|
|
|
26
28
|
- **Written once.** `POST` an expense or a settlement with your own `clientRef`; sending it again answers the same record with `200` and `meta.replayed: true` instead of `201`. A settlement the host paid also carries the host's `reference` (a mobile-money transaction id, for instance), and the same reference is never written twice in a group. The columns are unique at the database level, so two requests at once cannot both write.
|
|
27
29
|
- **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
30
|
- **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
|
-
- **Seats before people.** A member can be added by name and phone before they ever open the app
|
|
31
|
+
- **Seats before people.** A member can be added by name and phone before they ever open the app. A member added by name only can owe and be owed, and what they are paid needs nobody's confirmation.
|
|
32
|
+
- **Being added is an offer.** A seat added with the phone of someone who uses the app (or who opens it later) is an invitation: they see it in `GET /invitations` and in `GET /overview` (`invitations`), and the group stays closed to them until they accept. Entering the group's invite code accepts it too. Someone who set `autoAcceptInvites` is in at once. Until the answer, the seat counts like a name: the group can include it in expenses (`invite: "pending"` on the member), and what it is paid needs nobody's confirmation. Declining frees the seat when nothing is on the books for it; otherwise the seat stays as a name nobody holds (`invite: "declined"`), so the books still add up.
|
|
33
|
+
- **Nobody leaves with an open account.** Leaving a group, or being removed from it, is refused (`MEMBER_NOT_SETTLED`, with `details.balance`) while the seat owes, is owed, or has a payment awaiting confirmation.
|
|
34
|
+
- **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
35
|
- **No seat, no group.** Asking for a group you are not in answers the same `404` as a group that does not exist.
|
|
31
36
|
|
|
32
37
|
## Install
|