@andco/protocol 0.0.1 → 0.0.4
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/LICENSE +1 -1
- package/README.md +33 -3
- package/dist/api-errors.d.ts +109 -0
- package/dist/api-errors.d.ts.map +1 -0
- package/dist/api-errors.js +111 -0
- package/dist/authorization-preparation.d.ts +52 -543
- package/dist/authorization-preparation.d.ts.map +1 -1
- package/dist/authorization-preparation.js +19 -42
- package/dist/authorization.d.ts +64 -22
- package/dist/authorization.d.ts.map +1 -1
- package/dist/authorization.js +136 -55
- package/dist/consent.d.ts +5 -8
- package/dist/consent.d.ts.map +1 -1
- package/dist/consent.js +5 -62
- package/dist/constants.d.ts +19 -3
- package/dist/constants.d.ts.map +1 -1
- package/dist/constants.js +19 -3
- package/dist/errors.d.ts +156 -58
- package/dist/errors.d.ts.map +1 -1
- package/dist/errors.js +176 -57
- package/dist/index.d.ts +5 -5
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +5 -5
- package/dist/intent-input.d.ts +1010 -279
- package/dist/intent-input.d.ts.map +1 -1
- package/dist/intent-input.js +268 -40
- package/dist/messages/error.d.ts +1 -2
- package/dist/messages/error.d.ts.map +1 -1
- package/dist/messages/error.js +5 -2
- package/dist/messages/index.d.ts +3 -3
- package/dist/messages/index.js +2 -2
- package/dist/messages/presentation-response.d.ts +20 -0
- package/dist/messages/presentation-response.d.ts.map +1 -0
- package/dist/messages/presentation-response.js +17 -0
- package/dist/native-copy.d.ts +23 -2
- package/dist/native-copy.d.ts.map +1 -1
- package/dist/native-copy.js +42 -98
- package/dist/native-intent.d.ts +126 -75
- package/dist/native-intent.d.ts.map +1 -1
- package/dist/native-intent.js +140 -48
- package/dist/rar/account-matchers.d.ts +579 -0
- package/dist/rar/account-matchers.d.ts.map +1 -0
- package/dist/rar/account-matchers.js +480 -0
- package/dist/rar/bank.d.ts +1549 -0
- package/dist/rar/bank.d.ts.map +1 -0
- package/dist/rar/bank.js +379 -0
- package/dist/rar/catalog.d.ts +1155 -0
- package/dist/rar/catalog.d.ts.map +1 -0
- package/dist/rar/catalog.js +175 -0
- package/dist/rar/detail.d.ts +39 -0
- package/dist/rar/detail.d.ts.map +1 -0
- package/dist/rar/detail.js +44 -0
- package/dist/rar/index.d.ts +9 -0
- package/dist/rar/index.d.ts.map +1 -0
- package/dist/rar/index.js +8 -0
- package/dist/rar/money.d.ts +58 -0
- package/dist/rar/money.d.ts.map +1 -0
- package/dist/rar/money.js +61 -0
- package/dist/rar/project-users.d.ts +43 -0
- package/dist/rar/project-users.d.ts.map +1 -0
- package/dist/rar/project-users.js +63 -0
- package/dist/rar/subject-data.d.ts +170 -0
- package/dist/rar/subject-data.d.ts.map +1 -0
- package/dist/rar/subject-data.js +127 -0
- package/dist/rar/subject.d.ts +166 -0
- package/dist/rar/subject.d.ts.map +1 -0
- package/dist/rar/subject.js +119 -0
- package/dist/scopes.d.ts +5 -30
- package/dist/scopes.d.ts.map +1 -1
- package/dist/scopes.js +0 -13
- package/dist/service-grants.d.ts +44 -0
- package/dist/service-grants.d.ts.map +1 -0
- package/dist/service-grants.js +45 -0
- package/dist/signing.d.ts +56 -0
- package/dist/signing.d.ts.map +1 -0
- package/dist/signing.js +233 -0
- package/dist/transport/financial-events.d.ts +90 -35
- package/dist/transport/financial-events.d.ts.map +1 -1
- package/dist/transport/financial-events.js +7 -1
- package/dist/transport/generated/oauth-api.d.ts +908 -440
- package/dist/transport/generated/oauth-api.d.ts.map +1 -1
- package/dist/transport/index.d.ts +0 -1
- package/dist/transport/index.d.ts.map +1 -1
- package/dist/transport/index.js +0 -1
- package/dist/transport/intents.d.ts +155 -23
- package/dist/transport/intents.d.ts.map +1 -1
- package/dist/transport/intents.js +192 -59
- package/dist/transport/rest.d.ts +18 -8
- package/dist/transport/rest.d.ts.map +1 -1
- package/dist/transport/rest.js +1 -1
- package/dist/urls.d.ts.map +1 -1
- package/dist/urls.js +1 -1
- package/dist/userinfo.d.ts +10 -1
- package/dist/userinfo.d.ts.map +1 -1
- package/dist/userinfo.js +10 -1
- package/dist/utils.d.ts +15 -0
- package/dist/utils.d.ts.map +1 -1
- package/dist/utils.js +31 -0
- package/dist/webhooks.d.ts +154 -0
- package/dist/webhooks.d.ts.map +1 -0
- package/dist/webhooks.js +249 -0
- package/package.json +18 -1
- package/dist/automatic-charge.d.ts +0 -314
- package/dist/automatic-charge.d.ts.map +0 -1
- package/dist/automatic-charge.js +0 -126
- package/dist/bank-account-authorization.d.ts +0 -6
- package/dist/bank-account-authorization.d.ts.map +0 -1
- package/dist/bank-account-authorization.js +0 -13
- package/dist/messages/authorization-response.d.ts +0 -12
- package/dist/messages/authorization-response.d.ts.map +0 -1
- package/dist/messages/authorization-response.js +0 -9
- package/dist/transport/webhooks.d.ts +0 -27
- package/dist/transport/webhooks.d.ts.map +0 -1
- package/dist/transport/webhooks.js +0 -68
- package/dist/webhook-input.d.ts +0 -22
- package/dist/webhook-input.d.ts.map +0 -1
- package/dist/webhook-input.js +0 -11
- package/dist/webhook-signature.d.ts +0 -54
- package/dist/webhook-signature.d.ts.map +0 -1
- package/dist/webhook-signature.js +0 -74
package/LICENSE
CHANGED
|
@@ -187,7 +187,7 @@
|
|
|
187
187
|
same "printed page" as the copyright notice for easier
|
|
188
188
|
identification within third-party archives.
|
|
189
189
|
|
|
190
|
-
Copyright 2026
|
|
190
|
+
Copyright 2026 Haulmer
|
|
191
191
|
|
|
192
192
|
Licensed under the Apache License, Version 2.0 (the "License");
|
|
193
193
|
you may not use this file except in compliance with the License.
|
package/README.md
CHANGED
|
@@ -1,5 +1,11 @@
|
|
|
1
1
|
# `@andco/protocol`
|
|
2
2
|
|
|
3
|
+
> [!WARNING]
|
|
4
|
+
> **Pre-1.0 software.** Until version 1.0.0 is released, any new version may include breaking
|
|
5
|
+
> changes, including minor and patch releases. Expect any API incompatibility and data resets
|
|
6
|
+
> in the Andco environments without prior notice. Pin an exact version and review the release
|
|
7
|
+
> notes before upgrading.
|
|
8
|
+
|
|
3
9
|
Shared protocol types, schemas, constants, URL helpers, errors, OAuth utilities,
|
|
4
10
|
and portable resource transport used by the AndCo JavaScript packages.
|
|
5
11
|
|
|
@@ -27,6 +33,27 @@ const transactionId = RANDOM_UUID(runtimeCrypto);
|
|
|
27
33
|
If neither an injected source nor a compatible `globalThis.crypto` exists, the helper throws an `AndCoSDKError` with
|
|
28
34
|
the `WEB_CRYPTO_UNAVAILABLE` code. A cryptographically insecure random-number generator must never be used as a fallback.
|
|
29
35
|
|
|
36
|
+
## Permissions
|
|
37
|
+
|
|
38
|
+
The root exports the domain RAR model: scopes are OpenID Connect only (`AndCoKnownScope`), and every
|
|
39
|
+
resource permission is a RAR with a `subject`. Each type has a valibot schema for its Grant Request
|
|
40
|
+
(what an application asks, with `editable` and `null`) and for its Grant (what was conceded):
|
|
41
|
+
`ANDCO_RAR_CATALOG`, `parseAndcoGrantRequest`, `parseAndcoGrant`, the account matchers and
|
|
42
|
+
`accountMatcherContains`. `decodeJwtPayload` reads a JWT payload without verifying it.
|
|
43
|
+
|
|
44
|
+
```ts
|
|
45
|
+
import { parseAndcoGrantRequest } from "@andco/protocol";
|
|
46
|
+
|
|
47
|
+
// Throws AndcoRarError ("invalid_request") when the detail breaks the schema.
|
|
48
|
+
parseAndcoGrantRequest({
|
|
49
|
+
type: "bank_deposit",
|
|
50
|
+
actions: ["create", "read"],
|
|
51
|
+
subject: { type: "organization" },
|
|
52
|
+
destinations: [{ type: "alias", pattern: "cobros" }],
|
|
53
|
+
locations: ["https://api.andco.com"],
|
|
54
|
+
});
|
|
55
|
+
```
|
|
56
|
+
|
|
30
57
|
## Public subpaths
|
|
31
58
|
|
|
32
59
|
- `@andco/protocol` contains the runtime-neutral protocol and validation
|
|
@@ -34,9 +61,12 @@ the `WEB_CRYPTO_UNAVAILABLE` code. A cryptographically insecure random-number ge
|
|
|
34
61
|
- `@andco/protocol/authorization` contains the GET/PAR authorization-request
|
|
35
62
|
transport helpers (`resolveAndCoAuthorization` and related types).
|
|
36
63
|
- `@andco/protocol/messages` contains the secure iframe message union.
|
|
37
|
-
- `@andco/protocol/transport` contains the generated REST client, Financial
|
|
38
|
-
Intent
|
|
39
|
-
|
|
64
|
+
- `@andco/protocol/transport` contains the generated REST client, the Financial
|
|
65
|
+
Intent client, resource types, and lazy Fetch adapter shared by server and
|
|
66
|
+
browser packages.
|
|
67
|
+
- `@andco/protocol/webhooks` contains `andcoWebhooks.verifier()`, which verifies
|
|
68
|
+
Andco's Ed25519-signed webhook deliveries against Andco's public JWKS (cached
|
|
69
|
+
by `kid`), and its header and error constants.
|
|
40
70
|
- `@andco/protocol/server` contains server-only helpers for a confidential
|
|
41
71
|
client authenticated with `client_secret_basic`.
|
|
42
72
|
|
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* What the Andco API answers with in `{ "error": "..." }`. The SDK relays these untouched, so the
|
|
3
|
+
* string an integrator receives here is the one the API reference documents.
|
|
4
|
+
*
|
|
5
|
+
* Known values, not an exhaustive type. The server gains codes without an SDK release -- closing
|
|
6
|
+
* this would make every new server condition wait for a coordinated publish of four SDKs, and would
|
|
7
|
+
* leave a code the server already sends unnameable until then. `AndcoError.code` stays a `string`
|
|
8
|
+
* for the same reason, and {@link ANDCO_ERROR_CODES} shows the comparison shape: branch on the
|
|
9
|
+
* members you handle, keep a `default` for the rest.
|
|
10
|
+
*
|
|
11
|
+
* @see https://sdk.andco.com/docs/reference/error-codes
|
|
12
|
+
*/
|
|
13
|
+
export declare const ANDCO_API_ERROR_CODES: {
|
|
14
|
+
/**
|
|
15
|
+
* The access token is missing, malformed, or no longer valid. Refresh once and retry; a second
|
|
16
|
+
* failure means the Grant is gone and the person has to authorize the application again.
|
|
17
|
+
*/
|
|
18
|
+
readonly INVALID_TOKEN: "invalid_token";
|
|
19
|
+
/**
|
|
20
|
+
* The Grant is valid but carries no scope for this operation. Not retryable: the application has
|
|
21
|
+
* to request that scope and the person has to consent to it. The missing one arrives in
|
|
22
|
+
* `error.details.required_scope`.
|
|
23
|
+
*/
|
|
24
|
+
readonly INSUFFICIENT_SCOPE: "insufficient_scope";
|
|
25
|
+
/**
|
|
26
|
+
* The Grant covers the scope but not this exact resource -- an account outside the pattern it was
|
|
27
|
+
* given, an action its authorization details do not name.
|
|
28
|
+
*/
|
|
29
|
+
readonly INSUFFICIENT_AUTHORIZATION: "insufficient_authorization";
|
|
30
|
+
/**
|
|
31
|
+
* The operation needs a stronger authentication than the session carries. The person completes it
|
|
32
|
+
* and the same request succeeds afterwards.
|
|
33
|
+
*/
|
|
34
|
+
readonly STEP_UP_REQUIRED: "step_up_required";
|
|
35
|
+
/** The request arrived from an origin this Client is not registered for. */
|
|
36
|
+
readonly INVALID_ORIGIN: "invalid_origin";
|
|
37
|
+
/**
|
|
38
|
+
* A Service asked for a token and no approved Grant matches its subject and resource. Someone has
|
|
39
|
+
* to approve the permissions in Platform; there is nothing to retry.
|
|
40
|
+
*/
|
|
41
|
+
readonly AUTHORIZATION_REQUIRED: "authorization_required";
|
|
42
|
+
/**
|
|
43
|
+
* More than one Grant of the Service matches its subject and resource. `error.details.candidate_grant_ids`
|
|
44
|
+
* names them; pin one with `grant`.
|
|
45
|
+
*/
|
|
46
|
+
readonly AMBIGUOUS_GRANT: "ambiguous_grant";
|
|
47
|
+
/** The request body or parameters did not satisfy the contract. `error.details` names the fields. */
|
|
48
|
+
readonly INVALID_REQUEST: "invalid_request";
|
|
49
|
+
/** The addressed resource does not exist, or exists outside what this Grant can see. */
|
|
50
|
+
readonly NOT_FOUND: "not_found";
|
|
51
|
+
/** The route exists and this case of it is not built yet. Not a client error: do not retry. */
|
|
52
|
+
readonly NOT_IMPLEMENTED: "not_implemented";
|
|
53
|
+
/** The `Content-Type` is not one this endpoint accepts. */
|
|
54
|
+
readonly UNSUPPORTED_MEDIA_TYPE: "unsupported_media_type";
|
|
55
|
+
/** The API version in the path is not one this deployment serves. */
|
|
56
|
+
readonly UNSUPPORTED_VERSION: "unsupported_version";
|
|
57
|
+
/**
|
|
58
|
+
* An `Idempotency-Key` was reused for a different money movement. The first operation stands and
|
|
59
|
+
* this one is refused on purpose: replaying a key with changed values is the shape a duplicated
|
|
60
|
+
* payment takes.
|
|
61
|
+
*/
|
|
62
|
+
readonly IDEMPOTENCY_CONFLICT: "idempotency_conflict";
|
|
63
|
+
/**
|
|
64
|
+
* The amount of an Intent is outside what the Grant allows: it exceeds `transactions.maximum` (or
|
|
65
|
+
* differs from `transactions.value`) at creation, or exceeds the approver's maximum at approval,
|
|
66
|
+
* which leaves the Intent pending for another approver. Raised before anything is presented.
|
|
67
|
+
*/
|
|
68
|
+
readonly AMOUNT_OUT_OF_GRANT: "amount_out_of_grant";
|
|
69
|
+
/** The alias of an account to open does not match the `bank_account` Grant's alias patterns. */
|
|
70
|
+
readonly ALIAS_OUT_OF_GRANT: "alias_out_of_grant";
|
|
71
|
+
/**
|
|
72
|
+
* The Account Alias is already in use by an account of this subject and `upsert` was not asked, or
|
|
73
|
+
* it belonged to an account that was closed: Aliases are never reused.
|
|
74
|
+
*/
|
|
75
|
+
readonly ALIAS_TAKEN: "alias_taken";
|
|
76
|
+
/** The source of a transfer is not one the Grant's `sources` admit. */
|
|
77
|
+
readonly INVALID_SOURCE: "invalid_source";
|
|
78
|
+
/** The destination of a transfer, or the account a deposit names, is not one the Grant admits. */
|
|
79
|
+
readonly INVALID_DESTINATION: "invalid_destination";
|
|
80
|
+
/**
|
|
81
|
+
* A deposit named no `destination` and the `bank_deposit` Grant admits more than one account.
|
|
82
|
+
* Name the account in `destination`; a new Grant is not needed.
|
|
83
|
+
*/
|
|
84
|
+
readonly DEPOSIT_DESTINATION_AMBIGUOUS: "deposit_destination_ambiguous";
|
|
85
|
+
/** The Intent still needs a person (for example to pick the source account), so it cannot be approved by API. */
|
|
86
|
+
readonly INTERACTION_REQUIRED: "interaction_required";
|
|
87
|
+
/** The source account does not hold enough money for this movement. */
|
|
88
|
+
readonly INSUFFICIENT_FUNDS: "insufficient_funds";
|
|
89
|
+
/** The Intent is not in a state where this operation applies -- already decided, already executed. */
|
|
90
|
+
readonly INVALID_INTENT_STATE: "invalid_intent_state";
|
|
91
|
+
/** The Intent's deadline passed before it was decided. A new Intent is the only way forward. */
|
|
92
|
+
readonly INTENT_EXPIRED: "intent_expired";
|
|
93
|
+
/** The compact JWS carrying the instruction did not verify against a registered signing key. */
|
|
94
|
+
readonly INVALID_SIGNED_INSTRUCTION: "invalid_signed_instruction";
|
|
95
|
+
/** The cursor was not issued for this collection, or was issued to a different caller. */
|
|
96
|
+
readonly INVALID_CURSOR: "invalid_cursor";
|
|
97
|
+
/** The cursor was not issued for this account listing. */
|
|
98
|
+
readonly INVALID_ACCOUNTS_CURSOR: "invalid_accounts_cursor";
|
|
99
|
+
/** The cursor was not issued for this event feed. */
|
|
100
|
+
readonly INVALID_EVENT_CURSOR: "invalid_event_cursor";
|
|
101
|
+
/**
|
|
102
|
+
* Andco could not serve the request and the caller did nothing wrong. Safe to retry with backoff;
|
|
103
|
+
* a money operation should carry the same `Idempotency-Key` when it does.
|
|
104
|
+
*/
|
|
105
|
+
readonly TEMPORARILY_UNAVAILABLE: "temporarily_unavailable";
|
|
106
|
+
};
|
|
107
|
+
/** One of the conditions {@link ANDCO_API_ERROR_CODES} names. */
|
|
108
|
+
export type AndcoApiErrorCode = (typeof ANDCO_API_ERROR_CODES)[keyof typeof ANDCO_API_ERROR_CODES];
|
|
109
|
+
//# sourceMappingURL=api-errors.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"api-errors.d.ts","sourceRoot":"","sources":["../src/api-errors.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AACH,eAAO,MAAM,qBAAqB;IAEhC;;;OAGG;;IAEH;;;;OAIG;;IAEH;;;OAGG;;IAEH;;;OAGG;;IAEH,4EAA4E;;IAE5E;;;OAGG;;IAEH;;;OAGG;;IAIH,qGAAqG;;IAErG,wFAAwF;;IAExF,+FAA+F;;IAE/F,2DAA2D;;IAE3D,qEAAqE;;IAIrE;;;;OAIG;;IAEH;;;;OAIG;;IAEH,gGAAgG;;IAEhG;;;OAGG;;IAEH,uEAAuE;;IAEvE,kGAAkG;;IAElG;;;OAGG;;IAEH,iHAAiH;;IAEjH,uEAAuE;;IAEvE,sGAAsG;;IAEtG,gGAAgG;;IAEhG,gGAAgG;;IAIhG,0FAA0F;;IAE1F,0DAA0D;;IAE1D,qDAAqD;;IAIrD;;;OAGG;;CAEK,CAAC;AAEX,iEAAiE;AACjE,MAAM,MAAM,iBAAiB,GAAG,CAAC,OAAO,qBAAqB,CAAC,CAAC,MAAM,OAAO,qBAAqB,CAAC,CAAC"}
|
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* What the Andco API answers with in `{ "error": "..." }`. The SDK relays these untouched, so the
|
|
3
|
+
* string an integrator receives here is the one the API reference documents.
|
|
4
|
+
*
|
|
5
|
+
* Known values, not an exhaustive type. The server gains codes without an SDK release -- closing
|
|
6
|
+
* this would make every new server condition wait for a coordinated publish of four SDKs, and would
|
|
7
|
+
* leave a code the server already sends unnameable until then. `AndcoError.code` stays a `string`
|
|
8
|
+
* for the same reason, and {@link ANDCO_ERROR_CODES} shows the comparison shape: branch on the
|
|
9
|
+
* members you handle, keep a `default` for the rest.
|
|
10
|
+
*
|
|
11
|
+
* @see https://sdk.andco.com/docs/reference/error-codes
|
|
12
|
+
*/
|
|
13
|
+
export const ANDCO_API_ERROR_CODES = {
|
|
14
|
+
// -- Authorization ---------------------------------------------------------------------------
|
|
15
|
+
/**
|
|
16
|
+
* The access token is missing, malformed, or no longer valid. Refresh once and retry; a second
|
|
17
|
+
* failure means the Grant is gone and the person has to authorize the application again.
|
|
18
|
+
*/
|
|
19
|
+
INVALID_TOKEN: "invalid_token",
|
|
20
|
+
/**
|
|
21
|
+
* The Grant is valid but carries no scope for this operation. Not retryable: the application has
|
|
22
|
+
* to request that scope and the person has to consent to it. The missing one arrives in
|
|
23
|
+
* `error.details.required_scope`.
|
|
24
|
+
*/
|
|
25
|
+
INSUFFICIENT_SCOPE: "insufficient_scope",
|
|
26
|
+
/**
|
|
27
|
+
* The Grant covers the scope but not this exact resource -- an account outside the pattern it was
|
|
28
|
+
* given, an action its authorization details do not name.
|
|
29
|
+
*/
|
|
30
|
+
INSUFFICIENT_AUTHORIZATION: "insufficient_authorization",
|
|
31
|
+
/**
|
|
32
|
+
* The operation needs a stronger authentication than the session carries. The person completes it
|
|
33
|
+
* and the same request succeeds afterwards.
|
|
34
|
+
*/
|
|
35
|
+
STEP_UP_REQUIRED: "step_up_required",
|
|
36
|
+
/** The request arrived from an origin this Client is not registered for. */
|
|
37
|
+
INVALID_ORIGIN: "invalid_origin",
|
|
38
|
+
/**
|
|
39
|
+
* A Service asked for a token and no approved Grant matches its subject and resource. Someone has
|
|
40
|
+
* to approve the permissions in Platform; there is nothing to retry.
|
|
41
|
+
*/
|
|
42
|
+
AUTHORIZATION_REQUIRED: "authorization_required",
|
|
43
|
+
/**
|
|
44
|
+
* More than one Grant of the Service matches its subject and resource. `error.details.candidate_grant_ids`
|
|
45
|
+
* names them; pin one with `grant`.
|
|
46
|
+
*/
|
|
47
|
+
AMBIGUOUS_GRANT: "ambiguous_grant",
|
|
48
|
+
// -- Request ---------------------------------------------------------------------------------
|
|
49
|
+
/** The request body or parameters did not satisfy the contract. `error.details` names the fields. */
|
|
50
|
+
INVALID_REQUEST: "invalid_request",
|
|
51
|
+
/** The addressed resource does not exist, or exists outside what this Grant can see. */
|
|
52
|
+
NOT_FOUND: "not_found",
|
|
53
|
+
/** The route exists and this case of it is not built yet. Not a client error: do not retry. */
|
|
54
|
+
NOT_IMPLEMENTED: "not_implemented",
|
|
55
|
+
/** The `Content-Type` is not one this endpoint accepts. */
|
|
56
|
+
UNSUPPORTED_MEDIA_TYPE: "unsupported_media_type",
|
|
57
|
+
/** The API version in the path is not one this deployment serves. */
|
|
58
|
+
UNSUPPORTED_VERSION: "unsupported_version",
|
|
59
|
+
// -- Money -----------------------------------------------------------------------------------
|
|
60
|
+
/**
|
|
61
|
+
* An `Idempotency-Key` was reused for a different money movement. The first operation stands and
|
|
62
|
+
* this one is refused on purpose: replaying a key with changed values is the shape a duplicated
|
|
63
|
+
* payment takes.
|
|
64
|
+
*/
|
|
65
|
+
IDEMPOTENCY_CONFLICT: "idempotency_conflict",
|
|
66
|
+
/**
|
|
67
|
+
* The amount of an Intent is outside what the Grant allows: it exceeds `transactions.maximum` (or
|
|
68
|
+
* differs from `transactions.value`) at creation, or exceeds the approver's maximum at approval,
|
|
69
|
+
* which leaves the Intent pending for another approver. Raised before anything is presented.
|
|
70
|
+
*/
|
|
71
|
+
AMOUNT_OUT_OF_GRANT: "amount_out_of_grant",
|
|
72
|
+
/** The alias of an account to open does not match the `bank_account` Grant's alias patterns. */
|
|
73
|
+
ALIAS_OUT_OF_GRANT: "alias_out_of_grant",
|
|
74
|
+
/**
|
|
75
|
+
* The Account Alias is already in use by an account of this subject and `upsert` was not asked, or
|
|
76
|
+
* it belonged to an account that was closed: Aliases are never reused.
|
|
77
|
+
*/
|
|
78
|
+
ALIAS_TAKEN: "alias_taken",
|
|
79
|
+
/** The source of a transfer is not one the Grant's `sources` admit. */
|
|
80
|
+
INVALID_SOURCE: "invalid_source",
|
|
81
|
+
/** The destination of a transfer, or the account a deposit names, is not one the Grant admits. */
|
|
82
|
+
INVALID_DESTINATION: "invalid_destination",
|
|
83
|
+
/**
|
|
84
|
+
* A deposit named no `destination` and the `bank_deposit` Grant admits more than one account.
|
|
85
|
+
* Name the account in `destination`; a new Grant is not needed.
|
|
86
|
+
*/
|
|
87
|
+
DEPOSIT_DESTINATION_AMBIGUOUS: "deposit_destination_ambiguous",
|
|
88
|
+
/** The Intent still needs a person (for example to pick the source account), so it cannot be approved by API. */
|
|
89
|
+
INTERACTION_REQUIRED: "interaction_required",
|
|
90
|
+
/** The source account does not hold enough money for this movement. */
|
|
91
|
+
INSUFFICIENT_FUNDS: "insufficient_funds",
|
|
92
|
+
/** The Intent is not in a state where this operation applies -- already decided, already executed. */
|
|
93
|
+
INVALID_INTENT_STATE: "invalid_intent_state",
|
|
94
|
+
/** The Intent's deadline passed before it was decided. A new Intent is the only way forward. */
|
|
95
|
+
INTENT_EXPIRED: "intent_expired",
|
|
96
|
+
/** The compact JWS carrying the instruction did not verify against a registered signing key. */
|
|
97
|
+
INVALID_SIGNED_INSTRUCTION: "invalid_signed_instruction",
|
|
98
|
+
// -- Pagination ------------------------------------------------------------------------------
|
|
99
|
+
/** The cursor was not issued for this collection, or was issued to a different caller. */
|
|
100
|
+
INVALID_CURSOR: "invalid_cursor",
|
|
101
|
+
/** The cursor was not issued for this account listing. */
|
|
102
|
+
INVALID_ACCOUNTS_CURSOR: "invalid_accounts_cursor",
|
|
103
|
+
/** The cursor was not issued for this event feed. */
|
|
104
|
+
INVALID_EVENT_CURSOR: "invalid_event_cursor",
|
|
105
|
+
// -- Availability ----------------------------------------------------------------------------
|
|
106
|
+
/**
|
|
107
|
+
* Andco could not serve the request and the caller did nothing wrong. Safe to retry with backoff;
|
|
108
|
+
* a money operation should carry the same `Idempotency-Key` when it does.
|
|
109
|
+
*/
|
|
110
|
+
TEMPORARILY_UNAVAILABLE: "temporarily_unavailable",
|
|
111
|
+
};
|