@v3finance/core-sdk 0.19.0 → 0.20.1
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 +67 -0
- package/README.md +6 -3
- package/dist/cjs/core/gated.d.ts +11 -2
- package/dist/cjs/core/gated.d.ts.map +1 -1
- package/dist/cjs/core/gated.js +11 -2
- package/dist/cjs/core/gated.js.map +1 -1
- package/dist/cjs/core/pagination.d.ts +4 -3
- package/dist/cjs/core/pagination.d.ts.map +1 -1
- package/dist/cjs/core/pagination.js +4 -3
- package/dist/cjs/core/pagination.js.map +1 -1
- package/dist/cjs/generated/operations.d.ts +40 -0
- package/dist/cjs/generated/operations.d.ts.map +1 -1
- package/dist/cjs/generated/operations.js +42 -2
- package/dist/cjs/generated/operations.js.map +1 -1
- package/dist/cjs/generated/types.d.ts +148 -21
- package/dist/cjs/generated/types.d.ts.map +1 -1
- package/dist/cjs/index.d.ts +1 -1
- package/dist/cjs/index.d.ts.map +1 -1
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/resources/aml.d.ts +184 -7
- package/dist/cjs/resources/aml.d.ts.map +1 -1
- package/dist/cjs/resources/aml.js +174 -10
- package/dist/cjs/resources/aml.js.map +1 -1
- package/dist/cjs/version.d.ts +1 -1
- package/dist/cjs/version.js +1 -1
- package/dist/esm/core/gated.d.ts +11 -2
- package/dist/esm/core/gated.d.ts.map +1 -1
- package/dist/esm/core/gated.js +11 -2
- package/dist/esm/core/gated.js.map +1 -1
- package/dist/esm/core/pagination.d.ts +4 -3
- package/dist/esm/core/pagination.d.ts.map +1 -1
- package/dist/esm/core/pagination.js +4 -3
- package/dist/esm/core/pagination.js.map +1 -1
- package/dist/esm/generated/operations.d.ts +40 -0
- package/dist/esm/generated/operations.d.ts.map +1 -1
- package/dist/esm/generated/operations.js +42 -2
- package/dist/esm/generated/operations.js.map +1 -1
- package/dist/esm/generated/types.d.ts +148 -21
- package/dist/esm/generated/types.d.ts.map +1 -1
- package/dist/esm/index.d.ts +1 -1
- package/dist/esm/index.d.ts.map +1 -1
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/resources/aml.d.ts +184 -7
- package/dist/esm/resources/aml.d.ts.map +1 -1
- package/dist/esm/resources/aml.js +174 -10
- package/dist/esm/resources/aml.js.map +1 -1
- package/dist/esm/version.d.ts +1 -1
- package/dist/esm/version.js +1 -1
- package/docs/concepts.md +11 -0
- package/docs/errors.md +27 -6
- package/package.json +1 -1
- package/src/core/gated.ts +11 -2
- package/src/core/pagination.ts +4 -3
- package/src/generated/operations.ts +42 -2
- package/src/generated/types.ts +155 -24
- package/src/index.ts +6 -1
- package/src/resources/aml.ts +226 -10
- package/src/version.ts +1 -1
package/src/resources/aml.ts
CHANGED
|
@@ -1,8 +1,12 @@
|
|
|
1
1
|
import { seg, type HttpClient } from '../core/http.js'
|
|
2
2
|
import { toGated, type Gated } from '../core/gated.js'
|
|
3
|
+
import type { PageParams } from '../core/pagination.js'
|
|
3
4
|
import type {
|
|
4
5
|
AddAmlStopListBody,
|
|
5
6
|
AmlDepositDecisionResult,
|
|
7
|
+
AmlDraft,
|
|
8
|
+
AmlDraftResult,
|
|
9
|
+
AmlDraftsPage,
|
|
6
10
|
AmlOperations,
|
|
7
11
|
AmlProvenance,
|
|
8
12
|
AmlRuleVersions,
|
|
@@ -22,6 +26,7 @@ import type {
|
|
|
22
26
|
AmlVisibilityGrant,
|
|
23
27
|
AmlVisibilityGrants,
|
|
24
28
|
ApprovalRequestCreated,
|
|
29
|
+
CreateAmlDecisionDraftBody,
|
|
25
30
|
CreateAmlVisibilityGrantBody,
|
|
26
31
|
UpdateAmlSettingsBody,
|
|
27
32
|
} from '../generated/types.js'
|
|
@@ -41,6 +46,38 @@ export interface AmlOperationsFilter {
|
|
|
41
46
|
address?: string | undefined
|
|
42
47
|
}
|
|
43
48
|
|
|
49
|
+
/**
|
|
50
|
+
* `draft` — waiting to be confirmed from the phone; `sent` — confirmed and in
|
|
51
|
+
* force (the outcome is in `result`); `discarded` — deleted; `stale` — can no
|
|
52
|
+
* longer be applied (`staleReason`); `expired` — 24 hours passed. Nothing was
|
|
53
|
+
* applied for the last three.
|
|
54
|
+
*/
|
|
55
|
+
export type AmlDraftStatus = AmlDraft['status']
|
|
56
|
+
|
|
57
|
+
/** `deposit_decision` — a decision on a deposit; the other four — an AML edit that weakens a control. */
|
|
58
|
+
export type AmlDraftKind = AmlDraft['kind']
|
|
59
|
+
|
|
60
|
+
export interface ListAmlDraftsParams extends PageParams {
|
|
61
|
+
/**
|
|
62
|
+
* The status as it is NOW, worked out on reading — a `draft` past its
|
|
63
|
+
* `expiresAt` is `expired`. Because of that a filtered page can be shorter
|
|
64
|
+
* than `limit` and still not be the last: only `nextCursor: null` ends it.
|
|
65
|
+
*/
|
|
66
|
+
status?: AmlDraftStatus | undefined
|
|
67
|
+
kind?: AmlDraftKind | undefined
|
|
68
|
+
/**
|
|
69
|
+
* Drafts of a decision on this deposit — how to find the draft after a lost
|
|
70
|
+
* answer. With a `kind` other than `deposit_decision` it is 400.
|
|
71
|
+
*/
|
|
72
|
+
depositId?: string | undefined
|
|
73
|
+
/**
|
|
74
|
+
* Drafts of an edit of this target, with `kind`: a rule id
|
|
75
|
+
* (`rule_update`), a stop-list entry id (`stop_list_remove`), `user:<id>` or
|
|
76
|
+
* `group:<id>` (`visibility_grant`), `settings` (`settings_update`).
|
|
77
|
+
*/
|
|
78
|
+
targetId?: string | undefined
|
|
79
|
+
}
|
|
80
|
+
|
|
44
81
|
/**
|
|
45
82
|
* AML checks of a vault, in the typed model (AML v2).
|
|
46
83
|
*
|
|
@@ -60,6 +97,16 @@ export interface AmlOperationsFilter {
|
|
|
60
97
|
* Not to be confused with `registries.amlScore()`: that one keeps the
|
|
61
98
|
* earlier shape for the transfer form; this one is the model decisions are
|
|
62
99
|
* made on, with a record id you can come back to.
|
|
100
|
+
*
|
|
101
|
+
* AN OFFICER'S DECISIONS TAKE EFFECT ONLY FROM THE PHONE. A session that may
|
|
102
|
+
* not sign — a web login (the web version, the Mac and Windows apps), or a
|
|
103
|
+
* browser of anyone but a platform administrator — prepares them as DRAFTS:
|
|
104
|
+
* a decision on a deposit with `createDecisionDraft`, and an edit that
|
|
105
|
+
* weakens AML (`updateRule`, `removeFromStopList`, `grantVisibility`,
|
|
106
|
+
* `updateSettings`) comes back as `outcome: 'pending'` with the draft instead
|
|
107
|
+
* of being applied. The author gets a push on their phones and confirms with
|
|
108
|
+
* `sendDraft` from there. A draft is seen and touched only by its author, an
|
|
109
|
+
* administrator included: anyone else's is 404 `AML_DRAFT_NOT_FOUND`.
|
|
63
110
|
*/
|
|
64
111
|
export class AmlResource {
|
|
65
112
|
readonly #http: HttpClient
|
|
@@ -75,6 +122,10 @@ export class AmlResource {
|
|
|
75
122
|
* as is (`cached: true`); otherwise the provider is called and a new
|
|
76
123
|
* record is written. 502 `AML_UNAVAILABLE` — the provider is down: show
|
|
77
124
|
* "could not check", not a green badge.
|
|
125
|
+
*
|
|
126
|
+
* A provider call (no fresh stored check) counts towards the 60 paid checks
|
|
127
|
+
* an hour, as in `recheck`: beyond that 429 `AML_CHECK_RATE_LIMITED`. A
|
|
128
|
+
* stored check is always returned and costs nothing.
|
|
78
129
|
*/
|
|
79
130
|
check(
|
|
80
131
|
address: string,
|
|
@@ -88,7 +139,13 @@ export class AmlResource {
|
|
|
88
139
|
|
|
89
140
|
/**
|
|
90
141
|
* A fresh check, always calling the provider. Paid per call — only on an
|
|
91
|
-
* explicit action of a person. Admins only (403 for a
|
|
142
|
+
* explicit action of a person. Admins and AML officers only (403 for a
|
|
143
|
+
* member).
|
|
144
|
+
*
|
|
145
|
+
* At most 60 paid checks an hour per person in a vault, this method and an
|
|
146
|
+
* immediate `checkInternal` together: beyond that 429
|
|
147
|
+
* `AML_CHECK_RATE_LIMITED`, with `details.retryAfterSeconds` (and the
|
|
148
|
+
* `Retry-After` header) — when to try again.
|
|
92
149
|
*/
|
|
93
150
|
recheck(input: AmlRecheckBody): Promise<AmlCheck> {
|
|
94
151
|
return this.#http.request<AmlCheck>('POST', `${this.#base}/checks`, { body: input })
|
|
@@ -143,9 +200,18 @@ export class AmlResource {
|
|
|
143
200
|
* is validated: exactly one enabled default provider (400
|
|
144
201
|
* `AML_DEFAULT_PROVIDER_REQUIRED`), `maxAgeSeconds` 0…30 days (0 — every
|
|
145
202
|
* check calls the paid provider). Admins and officers only.
|
|
203
|
+
*
|
|
204
|
+
* `outcome: 'applied'` carries the settings. `'pending'` — the change
|
|
205
|
+
* weakens AML and came from a session that may not sign (see the class):
|
|
206
|
+
* NOTHING was applied, the answer is the draft to confirm from the phone.
|
|
207
|
+
* Weakening here: widening `memberDefaultView`, another default provider,
|
|
208
|
+
* disabling a provider, a larger `maxAgeSeconds` or 0. The server decides;
|
|
209
|
+
* do not guess in advance. Settings have no version — read them again after
|
|
210
|
+
* saving.
|
|
146
211
|
*/
|
|
147
|
-
updateSettings(input: UpdateAmlSettingsBody): Promise<AmlSettings
|
|
148
|
-
|
|
212
|
+
async updateSettings(input: UpdateAmlSettingsBody): Promise<Gated<AmlSettings, AmlDraftResult>> {
|
|
213
|
+
const res = await this.#http.requestRaw<unknown>('PUT', `${this.#base}/settings`, { body: input })
|
|
214
|
+
return toGated<AmlSettings, AmlDraftResult>(res.status, res.data)
|
|
149
215
|
}
|
|
150
216
|
|
|
151
217
|
/** Who sees more than the vault's default. Admins and officers only. */
|
|
@@ -160,11 +226,20 @@ export class AmlResource {
|
|
|
160
226
|
* Idempotent like every grant: the same subject again changes the role or
|
|
161
227
|
* reactivates a revoked grant. You must be able to see the member
|
|
162
228
|
* (`NOT_VISIBLE`); not to yourself (`SELF_SHARE`). Admins and officers only.
|
|
229
|
+
*
|
|
230
|
+
* `outcome: 'applied'` carries the grant — status 201 for a new one, 200 for
|
|
231
|
+
* an existing one updated. `'pending'` — the grant weakens AML (a new or
|
|
232
|
+
* revoked grant, or `links` → `full`) and came from a session that may not
|
|
233
|
+
* sign (see the class): NOTHING was granted, the answer is the draft to
|
|
234
|
+
* confirm from the phone. The same or a narrower role applies at once.
|
|
163
235
|
*/
|
|
164
|
-
grantVisibility(
|
|
165
|
-
|
|
236
|
+
async grantVisibility(
|
|
237
|
+
input: CreateAmlVisibilityGrantBody,
|
|
238
|
+
): Promise<Gated<AmlVisibilityGrant, AmlDraftResult>> {
|
|
239
|
+
const res = await this.#http.requestRaw<unknown>('POST', `${this.#base}/visibility-grants`, {
|
|
166
240
|
body: input,
|
|
167
241
|
})
|
|
242
|
+
return toGated<AmlVisibilityGrant, AmlDraftResult>(res.status, res.data)
|
|
168
243
|
}
|
|
169
244
|
|
|
170
245
|
/** Soft and immediate; repeating it is not an error. Admins and officers only. */
|
|
@@ -187,6 +262,9 @@ export class AmlResource {
|
|
|
187
262
|
* is the request's `resolvedResultId`. No policy — 403. No view of the
|
|
188
263
|
* address — 404. Always a fresh, paid provider call. `outcome: 'applied'`
|
|
189
264
|
* carries the check; `'pending'` — the request awaiting approval.
|
|
265
|
+
*
|
|
266
|
+
* An immediate check counts towards the limit of `recheck` (429
|
|
267
|
+
* `AML_CHECK_RATE_LIMITED`); creating the request does not.
|
|
190
268
|
*/
|
|
191
269
|
async checkInternal(addressId: string): Promise<Gated<AmlCheck, ApprovalRequestCreated>> {
|
|
192
270
|
const res = await this.#http.requestRaw<unknown>('POST', `${this.#base}/internal-checks`, {
|
|
@@ -232,9 +310,25 @@ export class AmlResource {
|
|
|
232
310
|
/**
|
|
233
311
|
* Absent fields stay; the RESULTING rule is validated. Every change is a new
|
|
234
312
|
* `version`. 409 `AML_RULE_CONFLICT` — someone changed it meanwhile: reload.
|
|
313
|
+
*
|
|
314
|
+
* `outcome: 'applied'` carries the rule. `'pending'` — the change weakens an
|
|
315
|
+
* ENABLED rule and came from a session that may not sign (see the class):
|
|
316
|
+
* NOTHING was saved, the answer is the draft to confirm from the phone, and
|
|
317
|
+
* it is checked against the version the rule had when the draft was made.
|
|
318
|
+
* Weakening: disabling, `block` → `officer`, allowing the initiator to
|
|
319
|
+
* approve, dropping a kind from `appliesTo`, a `scope` not proven at least
|
|
320
|
+
* as wide (removing it is not), a risk condition not proven to fire at
|
|
321
|
+
* least as often, another `subject` or
|
|
322
|
+
* provider, a smaller `provenance.depth`. One weakening field sends the
|
|
323
|
+
* whole change. Name and description, enabling a rule and any change of a
|
|
324
|
+
* disabled one apply at once. The checks above (400, 404, 409
|
|
325
|
+
* `AML_RULE_CONFLICT`) run before the draft is made.
|
|
235
326
|
*/
|
|
236
|
-
updateRule(ruleId: string, patch: PatchAmlRuleBody): Promise<AmlRule
|
|
237
|
-
|
|
327
|
+
async updateRule(ruleId: string, patch: PatchAmlRuleBody): Promise<Gated<AmlRule, AmlDraftResult>> {
|
|
328
|
+
const res = await this.#http.requestRaw<unknown>('PATCH', `${this.#base}/rules/${seg(ruleId)}`, {
|
|
329
|
+
body: patch,
|
|
330
|
+
})
|
|
331
|
+
return toGated<AmlRule, AmlDraftResult>(res.status, res.data)
|
|
238
332
|
}
|
|
239
333
|
|
|
240
334
|
/**
|
|
@@ -246,6 +340,11 @@ export class AmlResource {
|
|
|
246
340
|
* With `action: "counterparty_address_add" | "counterparty_group_add"` it
|
|
247
341
|
* runs the rules on counterparty-directory edits instead: `address` is the
|
|
248
342
|
* counterparty's address and `network` is required; `fromAddressId` is not.
|
|
343
|
+
*
|
|
344
|
+
* `check.cached` says whether the recipient's check came from a stored one
|
|
345
|
+
* (`true`) or was fetched from the provider just now (`false`). A provider
|
|
346
|
+
* call counts towards the 60 paid checks an hour: beyond that 429
|
|
347
|
+
* `AML_CHECK_RATE_LIMITED`, with `details.retryAfterSeconds`.
|
|
249
348
|
*/
|
|
250
349
|
evaluateRules(input: AmlRuleEvaluateBody): Promise<AmlRuleEvaluation> {
|
|
251
350
|
return this.#http.request<AmlRuleEvaluation>('POST', `${this.#base}/rules/evaluate`, { body: input })
|
|
@@ -263,9 +362,20 @@ export class AmlResource {
|
|
|
263
362
|
return this.#http.request<AmlStopListEntry>('POST', `${this.#base}/stop-list`, { body: input })
|
|
264
363
|
}
|
|
265
364
|
|
|
266
|
-
/**
|
|
267
|
-
|
|
268
|
-
|
|
365
|
+
/**
|
|
366
|
+
* Soft; repeating it is not an error.
|
|
367
|
+
*
|
|
368
|
+
* `outcome: 'applied'` carries the removed entry. Removing an ACTIVE address
|
|
369
|
+
* always weakens AML, so from a session that may not sign (see the class)
|
|
370
|
+
* it is `'pending'`: the address STAYS on the stop list, and the answer is
|
|
371
|
+
* the draft to confirm from the phone.
|
|
372
|
+
*/
|
|
373
|
+
async removeFromStopList(entryId: string): Promise<Gated<AmlStopListEntry, AmlDraftResult>> {
|
|
374
|
+
const res = await this.#http.requestRaw<unknown>(
|
|
375
|
+
'DELETE',
|
|
376
|
+
`${this.#base}/stop-list/${seg(entryId)}`,
|
|
377
|
+
)
|
|
378
|
+
return toGated<AmlStopListEntry, AmlDraftResult>(res.status, res.data)
|
|
269
379
|
}
|
|
270
380
|
|
|
271
381
|
/**
|
|
@@ -294,6 +404,112 @@ export class AmlResource {
|
|
|
294
404
|
})
|
|
295
405
|
}
|
|
296
406
|
|
|
407
|
+
// ---------- Officer's drafts: prepare anywhere, confirm from the phone ----------
|
|
408
|
+
|
|
409
|
+
/**
|
|
410
|
+
* An AML officer's decision on a deposit, made in a session that may not
|
|
411
|
+
* sign — the Mac above all. It is a DRAFT: nothing happens to the deposit
|
|
412
|
+
* until the author confirms it from the phone with `sendDraft`. Allowed in
|
|
413
|
+
* any session. AML officers only — an administrator is not one (403
|
|
414
|
+
* `FORBIDDEN`): it is a decision on risk.
|
|
415
|
+
*
|
|
416
|
+
* `decision`: `release` / `block` — a held deposit (a vote on its request
|
|
417
|
+
* `amlrev_<depositId>`); `unblock` — release a rejected one; `reviewed` —
|
|
418
|
+
* mark a past deposit reviewed. The comment is required for every one.
|
|
419
|
+
*
|
|
420
|
+
* Checked at once by the rules of the direct actions, with their codes: 404
|
|
421
|
+
* `DEPOSIT_NOT_FOUND`; 409 `DEPOSIT_NOT_HELD` (release, block),
|
|
422
|
+
* `DEPOSIT_NOT_BLOCKED` (unblock), `ALREADY_VOTED`, `DEPOSIT_ALREADY_DECIDED`
|
|
423
|
+
* (`details.decidedById` — who did); 403 `NOT_APPROVER`, `AML_OWN_DEPOSIT`.
|
|
424
|
+
* Everything is checked again when the draft is confirmed.
|
|
425
|
+
*
|
|
426
|
+
* One waiting draft per deposit and author. The same decision and comment
|
|
427
|
+
* again answers 200 with that draft and no second push (a new one is 201 and
|
|
428
|
+
* pushes); a different one is 409 `AML_DRAFT_EXISTS` with `details.draftId` —
|
|
429
|
+
* confirm or discard that one first. Both successes mean the same thing — a
|
|
430
|
+
* draft exactly as asked is waiting — so the status is not surfaced. After a
|
|
431
|
+
* lost answer, find it with `drafts({ depositId })`. A draft expires after
|
|
432
|
+
* 24 hours.
|
|
433
|
+
*
|
|
434
|
+
* The push to the author's phones has `data.type: "aml_draft_created"`, with
|
|
435
|
+
* `draftId`, `kind` and `incomingId` (the deposit).
|
|
436
|
+
*/
|
|
437
|
+
createDecisionDraft(depositId: string, input: CreateAmlDecisionDraftBody): Promise<AmlDraftResult> {
|
|
438
|
+
return this.#http.request<AmlDraftResult>(
|
|
439
|
+
'POST',
|
|
440
|
+
`${this.#base}/deposits/${seg(depositId)}/decision-drafts`,
|
|
441
|
+
{ body: input },
|
|
442
|
+
)
|
|
443
|
+
}
|
|
444
|
+
|
|
445
|
+
/**
|
|
446
|
+
* Your own AML drafts, newest first — decisions on deposits and edits that
|
|
447
|
+
* weaken AML. Nobody else's, an administrator's view included.
|
|
448
|
+
* Keyset-paginated: `{items, nextCursor}`, 20 by default, at most 50.
|
|
449
|
+
*
|
|
450
|
+
* `status` is worked out on reading: a `draft` past `expiresAt` reads as
|
|
451
|
+
* `expired`, one that can no longer be applied (another officer decided,
|
|
452
|
+
* you are no longer an officer, the rule changed…) as `stale` with
|
|
453
|
+
* `staleReason`, and one whose action is already in force as `sent`.
|
|
454
|
+
*/
|
|
455
|
+
drafts(params: ListAmlDraftsParams = {}): Promise<AmlDraftsPage> {
|
|
456
|
+
return this.#http.request<AmlDraftsPage>('GET', `${this.#base}/drafts`, { query: { ...params } })
|
|
457
|
+
}
|
|
458
|
+
|
|
459
|
+
/**
|
|
460
|
+
* One of your drafts — where a tap on the `aml_draft_created` push leads.
|
|
461
|
+
* Everything to show before confirming is in it: for a decision, the
|
|
462
|
+
* deposit as it was when the draft was made (`deposit`), `decision` and
|
|
463
|
+
* `comment`; for an edit, `target` and `changes` (was → becomes, with
|
|
464
|
+
* `weakens` on what weakens); where it was made (`createdFrom`). Anyone
|
|
465
|
+
* else's, a missing one and one from another vault are all 404
|
|
466
|
+
* `AML_DRAFT_NOT_FOUND`.
|
|
467
|
+
*/
|
|
468
|
+
draft(draftId: string): Promise<AmlDraftResult> {
|
|
469
|
+
return this.#http.request<AmlDraftResult>('GET', `${this.#base}/drafts/${seg(draftId)}`)
|
|
470
|
+
}
|
|
471
|
+
|
|
472
|
+
/**
|
|
473
|
+
* Deletes a draft — softly: `draft` becomes `discarded` and can no longer
|
|
474
|
+
* be confirmed. Allowed in any session. Discarding again is not an error,
|
|
475
|
+
* nor is discarding a draft already stale or expired: 200.
|
|
476
|
+
*
|
|
477
|
+
* A confirmed one is 409 `AML_DRAFT_ALREADY_SENT` (`details.draftId`,
|
|
478
|
+
* `details.result`): it is in force, and discarding does not undo it. The
|
|
479
|
+
* same 409 comes back when the action is in force but the draft is not
|
|
480
|
+
* marked `sent` yet — it is being confirmed from a phone right now, or that
|
|
481
|
+
* broke off — and the mark is written then.
|
|
482
|
+
*/
|
|
483
|
+
discardDraft(draftId: string): Promise<AmlDraftResult> {
|
|
484
|
+
return this.#http.request<AmlDraftResult>('DELETE', `${this.#base}/drafts/${seg(draftId)}`)
|
|
485
|
+
}
|
|
486
|
+
|
|
487
|
+
/**
|
|
488
|
+
* Confirms a draft: applies it by the SAME path as the direct action — the
|
|
489
|
+
* vote, `unblockDeposit`, `markDepositReviewed`, the rule edit (against the
|
|
490
|
+
* version the draft was made on), the stop-list removal, the grant, the
|
|
491
|
+
* settings. There is no body; everything comes from the draft. Only the
|
|
492
|
+
* author, and only from a session that may sign — the mobile app: a web
|
|
493
|
+
* login, or a browser of anyone but a platform administrator, gets 403
|
|
494
|
+
* `WEB_SESSION_CANNOT_SIGN`.
|
|
495
|
+
*
|
|
496
|
+
* 200 — `{draft}` with `status: 'sent'` and the outcome in `result`. A
|
|
497
|
+
* repeat (a double tap, a second phone, a retry after a broken connection)
|
|
498
|
+
* answers 200 with the same draft and applies nothing a second time, so a
|
|
499
|
+
* timed-out confirmation is retried by calling this again.
|
|
500
|
+
*
|
|
501
|
+
* Everything is checked anew first. Not applied, nothing changed:
|
|
502
|
+
* 409 `AML_DRAFT_STALE` — out of date (`details.staleReason`, and
|
|
503
|
+
* `details.cause` — the code and message the direct action gave);
|
|
504
|
+
* 409 `AML_DRAFT_EXPIRED`; 409 `AML_DRAFT_DISCARDED`. The draft is recorded
|
|
505
|
+
* as such and cannot be confirmed later — make a new one. A temporary
|
|
506
|
+
* refusal of the path itself (409 `DEPOSIT_MONEY_MISSING` — the money is not
|
|
507
|
+
* on hold yet) leaves it a `draft`: retry later.
|
|
508
|
+
*/
|
|
509
|
+
sendDraft(draftId: string): Promise<AmlDraftResult> {
|
|
510
|
+
return this.#http.request<AmlDraftResult>('POST', `${this.#base}/drafts/${seg(draftId)}/send`)
|
|
511
|
+
}
|
|
512
|
+
|
|
297
513
|
// ---------- Officer's view ----------
|
|
298
514
|
|
|
299
515
|
/**
|
package/src/version.ts
CHANGED