@autobusal/admin-api-consumers 1.1.0 → 1.2.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/CHANGELOG.md CHANGED
@@ -1,5 +1,18 @@
1
1
  # Changelog
2
2
 
3
+ ## 1.2.0
4
+
5
+ ### Added
6
+
7
+ - **Credit limit on the partner form, running balance on receivables.** A
8
+ Mode 1 partner now sells against a running account (obtapi Payments\
9
+ External\Charge): every sale debits the net they owe, cancellations
10
+ credit it back, and recorded settlements raise it. `credit_limit` is the
11
+ floor - 0 means prepaid (deposit before selling), a positive number means
12
+ postpaid down to -that-much. The receivables table shows the live
13
+ `balance` and `headroom` alongside the statement figures, deliberately
14
+ from two books: when they disagree, something needs investigating.
15
+
3
16
  All notable changes to `@autobusal/admin-api-consumers` are documented here.
4
17
  This project adheres to [Keep a Changelog](https://keepachangelog.com/en/1.1.0/)
5
18
  and [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
package/Manage.tsx CHANGED
@@ -131,6 +131,16 @@ const Manage = ({ url, t }: Props): JSX.Element => {
131
131
  type: 'select',
132
132
  value: data?.user.comissions?.unique ?? 0,
133
133
  values: getAllowed(t)
134
+ }, {
135
+ // Claude - 2026-08-22: the floor of the partner's running
136
+ // account. 0 = prepaid (they deposit before they can sell);
137
+ // a positive number = postpaid down to -that-much. "Unlimited"
138
+ // is a big number typed on purpose, never a switch.
139
+ label: t('admin_api_consumers.manage.credit_limit', { ns: 'common' }),
140
+ name: 'credit_limit',
141
+ type: 'text',
142
+ value: data?.credit_limit ?? 0,
143
+ rules: 'required|numeric'
134
144
  }, {
135
145
  label: t('admin_api_consumers.manage.status', { ns: 'common' }),
136
146
  name: 'status',
package/Receivables.tsx CHANGED
@@ -50,6 +50,8 @@ const Receivables = ({ url, t }: Props): JSX.Element => {
50
50
  <th>{ t('admin_api_consumers.receivables.net', { ns: 'common' }) }</th>
51
51
  <th>{ t('admin_api_consumers.receivables.settled', { ns: 'common' }) }</th>
52
52
  <th>{ t('admin_api_consumers.receivables.outstanding', { ns: 'common' }) }</th>
53
+ <th>{ t('admin_api_consumers.receivables.balance', { ns: 'common' }) }</th>
54
+ <th>{ t('admin_api_consumers.receivables.headroom', { ns: 'common' }) }</th>
53
55
  <th />
54
56
  </tr>
55
57
  </thead>
@@ -65,6 +67,11 @@ const Receivables = ({ url, t }: Props): JSX.Element => {
65
67
  <td>{ row.net.toFixed(2) }</td>
66
68
  <td>{ row.settled.toFixed(2) }</td>
67
69
  <td>{ row.outstanding.toFixed(2) }</td>
70
+ { /* the running account: negative is what they owe right
71
+ now; headroom is what they can still sell before
72
+ their credit floor refuses them */ }
73
+ <td>{ row.balance.toFixed(2) }</td>
74
+ <td>{ row.headroom.toFixed(2) }</td>
68
75
  <td>
69
76
  <Link to={ `${ url }/receivables/${ row.agent_id }?from=${ from }&to=${ to }` }>
70
77
  { t('admin_api_consumers.receivables.view', { ns: 'common' }) }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@autobusal/admin-api-consumers",
3
- "version": "1.1.0",
3
+ "version": "1.2.0",
4
4
  "author": "Ferjolt Ozuni",
5
5
  "type": "module",
6
6
  "main": "index.ts"
package/types.ts CHANGED
@@ -6,6 +6,10 @@ export interface ApiConsumerData {
6
6
  operators: (number | string)[]
7
7
  external_providers: (number | string)[]
8
8
  is_api_consumer: boolean
9
+ // Claude - 2026-08-22: the running account and its floor - see
10
+ // ReceivableData below for what they mean
11
+ funds?: number
12
+ credit_limit?: number
9
13
  user: {
10
14
  id: number
11
15
  email: string
@@ -31,6 +35,13 @@ export interface ReceivableData {
31
35
  net: number
32
36
  settled: number
33
37
  outstanding: number
38
+ // Claude - 2026-08-22: the LIVE running account (debited per sale,
39
+ // credited by settlements) and its floor - alongside the statement
40
+ // figures, which describe the same debt from the frozen columns. When
41
+ // balance and -outstanding disagree, something needs investigating.
42
+ balance: number
43
+ credit_limit: number
44
+ headroom: number
34
45
  }
35
46
 
36
47
  export interface ReceivableOrderData {