@andco/protocol 0.0.11 → 0.0.12
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/dist/api-errors.d.ts +5 -128
- package/dist/api-errors.d.ts.map +1 -1
- package/dist/api-errors.js +5 -131
- package/dist/authorization-preparation.d.ts +3 -3
- package/dist/authorization-preparation.d.ts.map +1 -1
- package/dist/authorization-preparation.js +4 -0
- package/dist/authorization.js +2 -2
- package/dist/errors.d.ts +52 -16
- package/dist/errors.d.ts.map +1 -1
- package/dist/errors.js +52 -12
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -0
- package/dist/intent-input.d.ts +1791 -725
- package/dist/intent-input.d.ts.map +1 -1
- package/dist/intent-input.js +325 -157
- package/dist/issues.d.ts +61 -0
- package/dist/issues.d.ts.map +1 -0
- package/dist/issues.js +61 -0
- package/dist/messages/index.d.ts +2 -2
- package/dist/messages/index.d.ts.map +1 -1
- package/dist/messages/index.js +10 -3
- package/dist/messages/set-preferences.d.ts +13 -1
- package/dist/messages/set-preferences.d.ts.map +1 -1
- package/dist/messages/set-preferences.js +31 -9
- package/dist/miniapp-manifest.d.ts +2 -2
- package/dist/miniapp-manifest.d.ts.map +1 -1
- package/dist/miniapp-manifest.js +1 -1
- package/dist/native-intent.d.ts +48 -28
- package/dist/native-intent.d.ts.map +1 -1
- package/dist/native-intent.js +76 -24
- package/dist/pagination.d.ts +37 -31
- package/dist/pagination.d.ts.map +1 -1
- package/dist/pagination.js +72 -24
- package/dist/rar/account-matchers.d.ts +47 -240
- package/dist/rar/account-matchers.d.ts.map +1 -1
- package/dist/rar/account-matchers.js +52 -131
- package/dist/rar/bank.d.ts +280 -392
- package/dist/rar/bank.d.ts.map +1 -1
- package/dist/rar/bank.js +68 -137
- package/dist/rar/catalog.d.ts +305 -288
- package/dist/rar/catalog.d.ts.map +1 -1
- package/dist/rar/catalog.js +69 -29
- package/dist/rar/detail.d.ts +15 -32
- package/dist/rar/detail.d.ts.map +1 -1
- package/dist/rar/detail.js +14 -34
- package/dist/rar/index.d.ts +2 -1
- package/dist/rar/index.d.ts.map +1 -1
- package/dist/rar/index.js +2 -1
- package/dist/rar/json-schemas.generated.d.ts +4 -0
- package/dist/rar/json-schemas.generated.d.ts.map +1 -0
- package/dist/rar/json-schemas.generated.js +3570 -0
- package/dist/rar/money.d.ts +5 -5
- package/dist/rar/money.d.ts.map +1 -1
- package/dist/rar/money.js +5 -5
- package/dist/rar/project-users.d.ts +40 -14
- package/dist/rar/project-users.d.ts.map +1 -1
- package/dist/rar/project-users.js +20 -23
- package/dist/rar/subject-data.d.ts +96 -48
- package/dist/rar/subject-data.d.ts.map +1 -1
- package/dist/rar/subject-data.js +61 -34
- package/dist/rar/subject.d.ts +18 -85
- package/dist/rar/subject.d.ts.map +1 -1
- package/dist/rar/subject.js +23 -51
- package/dist/rest/accounts.d.ts +347 -0
- package/dist/rest/accounts.d.ts.map +1 -0
- package/dist/rest/accounts.js +108 -0
- package/dist/rest/addresses.d.ts +581 -0
- package/dist/rest/addresses.d.ts.map +1 -0
- package/dist/rest/addresses.js +190 -0
- package/dist/rest/api-error.d.ts +104 -0
- package/dist/rest/api-error.d.ts.map +1 -0
- package/dist/rest/api-error.js +103 -0
- package/dist/rest/authorization.d.ts +123 -0
- package/dist/rest/authorization.d.ts.map +1 -0
- package/dist/rest/authorization.js +62 -0
- package/dist/rest/catalog.d.ts +199 -0
- package/dist/rest/catalog.d.ts.map +1 -0
- package/dist/rest/catalog.js +63 -0
- package/dist/rest/common.d.ts +637 -0
- package/dist/rest/common.d.ts.map +1 -0
- package/dist/rest/common.js +172 -0
- package/dist/rest/contract.d.ts +3480 -0
- package/dist/rest/contract.d.ts.map +1 -0
- package/dist/rest/contract.js +120 -0
- package/dist/rest/events.d.ts +145 -0
- package/dist/rest/events.d.ts.map +1 -0
- package/dist/rest/events.js +42 -0
- package/dist/rest/http.d.ts +49 -0
- package/dist/rest/http.d.ts.map +1 -0
- package/dist/rest/http.js +25 -0
- package/dist/rest/identity.d.ts +627 -0
- package/dist/rest/identity.d.ts.map +1 -0
- package/dist/rest/identity.js +128 -0
- package/dist/rest/index.d.ts +14 -0
- package/dist/rest/index.d.ts.map +1 -0
- package/dist/rest/index.js +13 -0
- package/dist/rest/intents.d.ts +4556 -0
- package/dist/rest/intents.d.ts.map +1 -0
- package/dist/rest/intents.js +551 -0
- package/dist/rest/signatures.d.ts +110 -0
- package/dist/rest/signatures.d.ts.map +1 -0
- package/dist/rest/signatures.js +113 -0
- package/dist/rest/subjects.d.ts +14 -0
- package/dist/rest/subjects.d.ts.map +1 -0
- package/dist/rest/subjects.js +22 -0
- package/dist/service-grants.d.ts +2 -2
- package/dist/service-grants.d.ts.map +1 -1
- package/dist/service-grants.js +1 -1
- package/dist/transport/generated/oauth-api.d.ts +5547 -1448
- package/dist/transport/generated/oauth-api.d.ts.map +1 -1
- package/dist/transport/intents.d.ts +9 -134
- package/dist/transport/intents.d.ts.map +1 -1
- package/dist/transport/intents.js +21 -405
- package/dist/transport/rest.d.ts +15 -5
- package/dist/transport/rest.d.ts.map +1 -1
- package/dist/userinfo.d.ts +22 -9
- package/dist/userinfo.d.ts.map +1 -1
- package/dist/userinfo.js +17 -12
- package/package.json +13 -2
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"intents.d.ts","sourceRoot":"","sources":["../../src/rest/intents.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,CAAC,MAAM,SAAS,CAAC;AAY7B,OAAO,EAEL,yBAAyB,EACzB,iBAAiB,EACjB,aAAa,EACb,cAAc,EACd,YAAY,EACZ,QAAQ,EAER,eAAe,EACf,WAAW,EACX,sBAAsB,EACtB,oBAAoB,EACpB,kBAAkB,EACnB,MAAM,aAAa,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAkBrB;;;GAGG;AACH,qBAAa,wBAAyB,SAAQ,eAAe,CAAC,6BAS7D;gBACa,OAAO,CAAC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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;0aA4BR,CAAC;AAElB,0EAA0E;AAC1E,eAAO,MAAM,gBAAgB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;8PAuBA,CAAC"}
|
|
@@ -0,0 +1,551 @@
|
|
|
1
|
+
import { oc } from "@orpc/contract";
|
|
2
|
+
import * as v from "valibot";
|
|
3
|
+
import { IntentAccountSchema, IntentCancellationSchema, IntentCreateSchema, IntentNoteSchema, IntentRejectionSchema, TransferDestinationProposalSchema, } from "../intent-input.js";
|
|
4
|
+
import { AccountKeySchema } from "../rar/account-matchers.js";
|
|
5
|
+
import { MoneySchema } from "../rar/money.js";
|
|
6
|
+
import { AndcoAPIError, errors } from "./api-error.js";
|
|
7
|
+
import { ApiIssue, InsufficientAuthorization, InvalidIdentifier, InvalidOrigin, InvalidRequest, InvalidToken, NotFound, PageQuery, PayloadTooLarge, ServerError, TemporarilyUnavailable, UnsupportedMediaType, UnsupportedVersion, } from "./common.js";
|
|
8
|
+
import { FinancialEventPage } from "./events.js";
|
|
9
|
+
import { http } from "./http.js";
|
|
10
|
+
import { SignedInstructionRejectionReason, servedAsSignedInstruction, signedInstructionBody } from "./signatures.js";
|
|
11
|
+
const uuid = /* @__PURE__ */ v.pipe(v.string(), v.uuid());
|
|
12
|
+
const dateTime = /* @__PURE__ */ v.pipe(v.string(), v.isoTimestamp());
|
|
13
|
+
const url = /* @__PURE__ */ v.pipe(v.string(), v.url());
|
|
14
|
+
/** A whole number of pesos that may be zero, as a string: what a deposit collected. */
|
|
15
|
+
const pesos = /* @__PURE__ */ v.pipe(v.string(), v.regex(/^[0-9]+$/));
|
|
16
|
+
/** The Intent a refusal of its release is about; absent when it is refused before one exists. */
|
|
17
|
+
const refusedIntent = /* @__PURE__ */ v.pipe(v.optional(uuid), v.description("The Intent the refusal is about, when it was refused at its release rather than at its creation."));
|
|
18
|
+
// -- Errors -------------------------------------------------------------------------------------
|
|
19
|
+
/**
|
|
20
|
+
* An `Idempotency-Key` arrived beside a Signed Instruction. The idempotency key of a Signed
|
|
21
|
+
* Instruction is its own `jti`; send the instruction without the header.
|
|
22
|
+
*/
|
|
23
|
+
export class IdempotencyKeyNotAllowed extends /* @__PURE__ */ AndcoAPIError.define("idempotency_key_not_allowed", 400, v.pipe(v.object({}), v.description("A Signed Instruction carries its idempotency key in `jti`, so `Idempotency-Key` is refused beside it."))) {
|
|
24
|
+
constructor(message) {
|
|
25
|
+
super({}, message);
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* The Signed Instruction sent to create an Intent was refused: it did not verify (`reason` names the
|
|
30
|
+
* one cause), or its verified claims are not an Intent (`invalid_claims`, with `issues`). An expired
|
|
31
|
+
* one is {@link ExpiredSignedInstruction}. Nothing was created.
|
|
32
|
+
*/
|
|
33
|
+
export class InvalidSignedInstruction extends /* @__PURE__ */ AndcoAPIError.define("invalid_signed_instruction", 400, v.pipe(v.object({
|
|
34
|
+
reason: v.pipe(v.picklist([
|
|
35
|
+
...SignedInstructionRejectionReason.options.filter((reason) => reason !== "expired_assertion"),
|
|
36
|
+
"invalid_claims",
|
|
37
|
+
]), v.description("The one cause: what did not verify, or `invalid_claims` when the verified claims are not an Intent.")),
|
|
38
|
+
issues: v.pipe(v.optional(v.array(ApiIssue)), v.description("On `invalid_claims`, what failed in the claims, as `invalid_request` names it.")),
|
|
39
|
+
}), v.description("The Signed Instruction did not verify, or its verified claims are not an Intent."))) {
|
|
40
|
+
constructor(data, message) {
|
|
41
|
+
super(data, message);
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* The `exp` of the Signed Instruction has passed, so it may no longer be sent. Sign a new one; reuse
|
|
46
|
+
* its `jti` only if it orders exactly the same.
|
|
47
|
+
*/
|
|
48
|
+
export class ExpiredSignedInstruction extends /* @__PURE__ */ AndcoAPIError.define("expired_signed_instruction", 401, v.pipe(v.object({}), v.description("The `exp` of the Signed Instruction has passed."))) {
|
|
49
|
+
constructor(message) {
|
|
50
|
+
super({}, message);
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
/** The Account Key of an account to open does not match the `bank_account` Grant's Account Key patterns. */
|
|
54
|
+
export class AccountKeyOutOfGrant extends /* @__PURE__ */ AndcoAPIError.define("account_key_out_of_grant", 403, v.pipe(v.object({}), v.description("The Account Key is outside the Grant's `accounts` patterns."))) {
|
|
55
|
+
constructor(message) {
|
|
56
|
+
super({}, message);
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
/**
|
|
60
|
+
* The `Idempotency-Key` was already used with a different request. The first operation stands and
|
|
61
|
+
* this one is refused on purpose: replaying a key with changed values is the shape a duplicated
|
|
62
|
+
* payment takes.
|
|
63
|
+
*/
|
|
64
|
+
export class IdempotencyConflict extends /* @__PURE__ */ AndcoAPIError.define("idempotency_conflict", 409, v.pipe(v.object({}), v.description("The idempotency key was already used with a different request."))) {
|
|
65
|
+
constructor(message) {
|
|
66
|
+
super({}, message);
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
/**
|
|
70
|
+
* Only a person can let this Intent go on. `reason` says why: `bank_verification_required` (the bank
|
|
71
|
+
* asks them to confirm the transfer with their web PIN and an SMS code) and `source_account_required`
|
|
72
|
+
* (they still pick the source account) come with `authorization_url`, where they do it; on the release
|
|
73
|
+
* of an Intent that moves with nobody present, `bank_connection_pin_required`,
|
|
74
|
+
* `bank_connection_reconnect_required` and `bank_representative_replacement_required` come with
|
|
75
|
+
* `interaction_url`. Nothing was approved, frozen or moved, and the same request succeeds once the
|
|
76
|
+
* person has acted.
|
|
77
|
+
*
|
|
78
|
+
* The same code on a read of the bank is {@link BankConnectionInteractionRequired}, with `code`.
|
|
79
|
+
*/
|
|
80
|
+
export class IntentInteractionRequired extends /* @__PURE__ */ AndcoAPIError.define("interaction_required", 409, v.pipe(v.object({
|
|
81
|
+
intent_id: refusedIntent,
|
|
82
|
+
reason: v.pipe(v.optional(v.picklist([
|
|
83
|
+
"bank_verification_required",
|
|
84
|
+
"source_account_required",
|
|
85
|
+
"bank_connection_pin_required",
|
|
86
|
+
"bank_connection_reconnect_required",
|
|
87
|
+
"bank_representative_replacement_required",
|
|
88
|
+
])), v.description("Why only a person can go on.")),
|
|
89
|
+
authorization_url: v.pipe(v.optional(url), v.description("Where the person completes the Intent, for `bank_verification_required` and `source_account_required`.")),
|
|
90
|
+
interaction_url: v.pipe(v.optional(url), v.description("Where in Platform the person brings their bank connection back, for the `bank_*` reasons.")),
|
|
91
|
+
}), v.description("Only a person can let this Intent go on; nothing was approved, frozen or moved."))) {
|
|
92
|
+
constructor(data, message) {
|
|
93
|
+
super(data, message);
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
/** The Intent is not in a state where this operation applies: already decided, already executed. */
|
|
97
|
+
export class InvalidIntentState extends /* @__PURE__ */ AndcoAPIError.define("invalid_intent_state", 409, v.pipe(v.object({ intent_id: refusedIntent }), v.description("The Intent is not in a state where this applies."))) {
|
|
98
|
+
constructor(intentId, message) {
|
|
99
|
+
super({ intent_id: intentId }, message);
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
/** The Intent's deadline to be approved and executed has passed. A new Intent is the only way forward. */
|
|
103
|
+
export class IntentExpired extends /* @__PURE__ */ AndcoAPIError.define("intent_expired", 409, v.pipe(v.object({ intent_id: refusedIntent }), v.description("The Intent's deadline has passed."))) {
|
|
104
|
+
constructor(intentId, message) {
|
|
105
|
+
super({ intent_id: intentId }, message);
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
/**
|
|
109
|
+
* The Account Key names an account of the subject: `held_by_subject` when one is open and `upsert`
|
|
110
|
+
* was not asked, `closed` when it named an account that closed, because Account Keys are never reused.
|
|
111
|
+
*/
|
|
112
|
+
export class AccountKeyTaken extends /* @__PURE__ */ AndcoAPIError.define("account_key_taken", 409, v.pipe(v.object({
|
|
113
|
+
reason: v.pipe(v.picklist(["held_by_subject", "closed"]), v.description("`held_by_subject`: an open account carries it; `closed`: a closed account did.")),
|
|
114
|
+
intent_id: refusedIntent,
|
|
115
|
+
}), v.description("The Account Key names an account of the subject."))) {
|
|
116
|
+
constructor(data, message, hint) {
|
|
117
|
+
super(data, message, hint);
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
/** The Organization already holds as many bank accounts as its contract allows. */
|
|
121
|
+
export class BankAccountQuotaExceeded extends /* @__PURE__ */ AndcoAPIError.define("bank_account_quota_exceeded", 409, v.pipe(v.object({
|
|
122
|
+
intent_id: refusedIntent,
|
|
123
|
+
used: v.pipe(v.optional(v.pipe(v.number(), v.integer(), v.minValue(0))), v.description("How many bank accounts the Organization holds, closed ones included. Absent when they could not be read after the refusal.")),
|
|
124
|
+
quota: v.pipe(v.optional(v.pipe(v.number(), v.integer(), v.minValue(0))), v.description("How many bank accounts the Organization may hold. Absent when it could not be read after the refusal.")),
|
|
125
|
+
}), v.description("The Organization holds every bank account its quota allows; nothing was opened."))) {
|
|
126
|
+
constructor(data, message, hint) {
|
|
127
|
+
super(data, message, hint);
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
/**
|
|
131
|
+
* The base of an error that refuses what an Intent asks (`422`): the request is valid, but the Grant or
|
|
132
|
+
* the bank does not let it go on. On a release, `intent_id` names the Intent, which is `failed` with
|
|
133
|
+
* the same word when the bank answered.
|
|
134
|
+
*/
|
|
135
|
+
/* @__NO_SIDE_EFFECTS__ */
|
|
136
|
+
function intentRefusal(error, description) {
|
|
137
|
+
class IntentRefusal extends AndcoAPIError.define(error, 422, v.pipe(v.object({ intent_id: refusedIntent }), v.description(description))) {
|
|
138
|
+
constructor(intentId, message) {
|
|
139
|
+
super({ intent_id: intentId }, message);
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
return IntentRefusal;
|
|
143
|
+
}
|
|
144
|
+
/**
|
|
145
|
+
* The amount is outside what the Grant allows: it exceeds `transactions.maximum` (or differs from
|
|
146
|
+
* `transactions.value`) at creation, or exceeds the approver's maximum at approval, which leaves the
|
|
147
|
+
* Intent pending for another approver.
|
|
148
|
+
*/
|
|
149
|
+
export class AmountOutOfGrant extends /* @__PURE__ */ intentRefusal("amount_out_of_grant", "The amount is outside what the Grant allows.") {
|
|
150
|
+
}
|
|
151
|
+
/** The amount a deposit asks for is outside the bounds the Grant's `bank_deposit` detail sets. */
|
|
152
|
+
export class DepositAmountOutOfBounds extends /* @__PURE__ */ intentRefusal("deposit_amount_out_of_bounds", "The deposit's amount is outside the bounds of the Grant.") {
|
|
153
|
+
}
|
|
154
|
+
/** The source of a transfer is not one the Grant's `sources` admit. */
|
|
155
|
+
export class InvalidSource extends /* @__PURE__ */ intentRefusal("invalid_source", "The source is not one the Grant admits.") {
|
|
156
|
+
}
|
|
157
|
+
/** The destination of a transfer, or the account a deposit names, is not one the Grant admits. */
|
|
158
|
+
export class InvalidDestination extends /* @__PURE__ */ intentRefusal("invalid_destination", "The destination is not one the Grant admits.") {
|
|
159
|
+
}
|
|
160
|
+
/**
|
|
161
|
+
* A deposit named no `destination` and the `bank_deposit` Grant admits more than one account. Name
|
|
162
|
+
* the account in `destination`; a new Grant is not needed.
|
|
163
|
+
*/
|
|
164
|
+
export class DepositDestinationAmbiguous extends /* @__PURE__ */ intentRefusal("deposit_destination_ambiguous", "The deposit names no destination and the Grant admits more than one.") {
|
|
165
|
+
}
|
|
166
|
+
/** The amount of this transfer is the person's to set, and a credential has none to offer. */
|
|
167
|
+
export class TransferAmountRequired extends /* @__PURE__ */ intentRefusal("transfer_amount_required", "The person still sets the transfer's amount.") {
|
|
168
|
+
}
|
|
169
|
+
/** The destination of this transfer is the person's to complete, and a credential has none to offer. */
|
|
170
|
+
export class TransferDestinationRequired extends /* @__PURE__ */ intentRefusal("transfer_destination_required", "The person still completes the transfer's destination.") {
|
|
171
|
+
}
|
|
172
|
+
/** An Organization that never completed its business identity cannot be named to another bank. */
|
|
173
|
+
export class TransferSenderIdentityUnavailable extends /* @__PURE__ */ intentRefusal("transfer_sender_identity_unavailable", "The sender's identity cannot be named to the receiving bank.") {
|
|
174
|
+
}
|
|
175
|
+
/** The destination's bank is not one Andco transfers to. */
|
|
176
|
+
export class UnsupportedBank extends /* @__PURE__ */ intentRefusal("unsupported_bank", "The destination's bank is not supported.") {
|
|
177
|
+
}
|
|
178
|
+
/** The subject has no bank connection to a company; nothing was asked of the bank. */
|
|
179
|
+
export class BankConnectionUnavailable extends /* @__PURE__ */ intentRefusal("bank_connection_unavailable", "The subject has no bank connection to a company.") {
|
|
180
|
+
}
|
|
181
|
+
/** The bank opened no account number for the opening. */
|
|
182
|
+
export class BankAccountNumberMissing extends /* @__PURE__ */ intentRefusal("bank_account_number_missing", "The bank answered the opening without an account number.") {
|
|
183
|
+
}
|
|
184
|
+
/** The bank does not let that person open accounts for that company. */
|
|
185
|
+
export class BankAuthorizationDenied extends /* @__PURE__ */ intentRefusal("bank_authorization_denied", "The bank does not let that person open accounts for that company.") {
|
|
186
|
+
}
|
|
187
|
+
/** The bank knows the holder without an account to open another one from. */
|
|
188
|
+
export class BankHolderWithoutAccount extends /* @__PURE__ */ intentRefusal("bank_holder_without_account", "The holder has no account at the bank.") {
|
|
189
|
+
}
|
|
190
|
+
/** The bank's own ceiling of accounts for the holder is reached. */
|
|
191
|
+
export class BankAccountLimitReached extends /* @__PURE__ */ intentRefusal("bank_account_limit_reached", "The holder reached the bank's ceiling of accounts.") {
|
|
192
|
+
}
|
|
193
|
+
/** The bank or its ledger refused the request before accepting it; no money moved. */
|
|
194
|
+
export class BankRefused extends /* @__PURE__ */ intentRefusal("bank_refused", "The bank refused the request.") {
|
|
195
|
+
}
|
|
196
|
+
/** The source account does not hold enough money for this movement. */
|
|
197
|
+
export class InsufficientFunds extends /* @__PURE__ */ intentRefusal("insufficient_funds", "The source account does not hold enough money.") {
|
|
198
|
+
}
|
|
199
|
+
/** The ledger refused an entry and nothing stays moved. */
|
|
200
|
+
export class BankRejected extends /* @__PURE__ */ intentRefusal("bank_rejected", "The bank rejected the movement; nothing stays moved.") {
|
|
201
|
+
}
|
|
202
|
+
/**
|
|
203
|
+
* The bank stopped half way or gave no usable answer for a day: money may have left the source account
|
|
204
|
+
* without reaching the destination, and the bank must review it. Never retry it under a new Intent.
|
|
205
|
+
*/
|
|
206
|
+
export class BankReviewRequired extends /* @__PURE__ */ intentRefusal("bank_review_required", "The bank must review the movement; money may have left the source account.") {
|
|
207
|
+
}
|
|
208
|
+
/**
|
|
209
|
+
* The requested case is not available, and `code` says which. Not a client error: do not retry. At
|
|
210
|
+
* creation nothing is created; at approval `intent_id` names the Intent, which stays as it was. A
|
|
211
|
+
* case this version of the contract does not name yet comes without `code`, its `message` saying which.
|
|
212
|
+
*/
|
|
213
|
+
export class NotImplemented extends /* @__PURE__ */ AndcoAPIError.define("not_implemented", 501, v.pipe(v.object({
|
|
214
|
+
code: v.pipe(v.optional(v.picklist([
|
|
215
|
+
"account_closure_not_implemented",
|
|
216
|
+
"account_opening_not_implemented",
|
|
217
|
+
"own_account_transfer_not_implemented",
|
|
218
|
+
"external_transfer_execution_not_implemented",
|
|
219
|
+
"multiple_destinations_not_implemented",
|
|
220
|
+
"split_payments_not_implemented",
|
|
221
|
+
"multiple_instructions_not_implemented",
|
|
222
|
+
"intent_type_not_decidable",
|
|
223
|
+
])), v.description("Which case is unavailable: closing an account (postponed with no date), opening an additional account or a transfer between two accounts of the same holder where the bank does not serve them, and the payment shapes not built yet. Absent for a case this version of the contract does not name yet.")),
|
|
224
|
+
intent_id: refusedIntent,
|
|
225
|
+
}), v.description("The requested case is unavailable, and `code` says which when the contract names it."))) {
|
|
226
|
+
constructor(data, message, hint) {
|
|
227
|
+
super(data, message, hint);
|
|
228
|
+
}
|
|
229
|
+
}
|
|
230
|
+
// -- Intents ------------------------------------------------------------------------------------
|
|
231
|
+
/**
|
|
232
|
+
* `<base>[.<detail>]`: where an Intent stands. Decide on the base with `INTENT_STATUS_BASE` and
|
|
233
|
+
* `IS_INTENT_TERMINAL_STATUS`, never on the whole value.
|
|
234
|
+
*/
|
|
235
|
+
export const IntentStatus = /* @__PURE__ */ v.pipe(v.picklist([
|
|
236
|
+
"requires_action",
|
|
237
|
+
"processing.confirmed",
|
|
238
|
+
"processing.settling",
|
|
239
|
+
"processing.reversing",
|
|
240
|
+
"processing.reconciling",
|
|
241
|
+
"processing.opening",
|
|
242
|
+
"processing.closing",
|
|
243
|
+
"succeeded",
|
|
244
|
+
"failed",
|
|
245
|
+
"failed.insufficient_funds",
|
|
246
|
+
"failed.fraud_rejected",
|
|
247
|
+
"failed.bank_refused",
|
|
248
|
+
"failed.bank_rejected",
|
|
249
|
+
"failed.bank_review_required",
|
|
250
|
+
"failed.own_account_transfer_not_implemented",
|
|
251
|
+
"failed.bank_authorization_denied",
|
|
252
|
+
"failed.bank_holder_without_account",
|
|
253
|
+
"failed.bank_account_limit_reached",
|
|
254
|
+
"failed.account_opening_not_implemented",
|
|
255
|
+
"failed.bank_core_unavailable",
|
|
256
|
+
"failed.bank_account_save_failed",
|
|
257
|
+
"failed.bank_connection_unavailable",
|
|
258
|
+
"failed.bank_account_quota_exceeded",
|
|
259
|
+
"failed.account_key_taken",
|
|
260
|
+
"failed.bank_account_not_found",
|
|
261
|
+
"failed.bank_account_balance_not_zero",
|
|
262
|
+
"cancelled",
|
|
263
|
+
"cancelled.grant_revoked",
|
|
264
|
+
"cancelled.grant_expired",
|
|
265
|
+
"rejected",
|
|
266
|
+
"expired",
|
|
267
|
+
]), v.description("`<base>[.<detail>]`. The base, what precedes the first dot, is one of `requires_action`, `processing`, `succeeded`, `failed`, `cancelled`, `rejected` or `expired`, and it is what tells whether the Intent can still change: `requires_action` and `processing` can, every other base is final. Decide on the base, never on the whole value, so that a detail added later is not misread. In TypeScript, `INTENT_STATUS_BASE` and `IS_INTENT_TERMINAL_STATUS` from `@andco/protocol` do exactly that; an exhaustive `switch` over the enum below stops being exhaustive the first time a detail is added.\n\nWhere an Intent stands. `failed` says why, and whether money moved. A transfer that leaves its holder's own accounts (to another bank or to another Andco customer) is `requires_action` from creation for as long as a person still owes the bank a proof, and every read of it carries `interaction_reason: bank_verification_required`; pressing Confirm, typing the web PIN or typing the SMS code does not change its status. It becomes `processing.confirmed`, and `transfer.confirmed` is published once, when the bank accepts the transfer; from then on nobody has to do anything and the outcome arrives as `succeeded` or `failed.bank_rejected`. A challenge the person abandons, lets run out or exhausts with wrong answers leaves the Intent `requires_action` (the person confirms again and gets a new code) until its own expiry, `expired`. A transfer between two accounts of the same holder has no challenge: it is `processing.confirmed` from its release, while the server asks the bank again under the same key. In both, `processing.confirmed` means that the bank holds the command and nobody has to do anything. `processing.settling`, `processing.reversing` and `processing.reconciling` are not emitted. While the bank has been asked and its answer is not yet known (normally one request) the Intent still reads `requires_action`, does not read `expired` even if its deadline passes, and `cancel` and `reject` answer `409 invalid_intent_state`. Transfers: `failed.fraud_rejected` (the bank's fraud engine refused it before accepting, straight from `requires_action`), `failed.bank_refused` (the bank or its ledger refused the request, before accepting it when the transfer leaves its holder; for a transfer between own accounts, for example, the destination is not an active account of the same holder), `failed.bank_rejected` (the bank accepted it and the receiving bank, or the ledger, rejected it; the debit is undone by the bank), `failed.bank_review_required` (a transfer between own accounts the bank stopped half way or gave no usable answer for a day: money may have left the source account without reaching the destination, the bank must review it, and it is never retried under a new Intent) and `failed.own_account_transfer_not_implemented` (the bank does not serve transfers between own accounts). In `failed.fraud_rejected`, `failed.bank_refused` and `failed.own_account_transfer_not_implemented` no money moved; in `failed.bank_rejected` nothing stays moved. Account openings: `failed.bank_authorization_denied` (the bank does not let that person open accounts for that company), `failed.bank_holder_without_account`, `failed.bank_account_limit_reached`, `failed.bank_connection_unavailable` (no bank connection to a company), `failed.account_opening_not_implemented` (the bank does not serve openings), `failed.bank_core_unavailable`, `failed.bank_account_save_failed`, `failed.bank_account_quota_exceeded` (the holder already has as many accounts as allowed) and `failed.account_key_taken`. An opening that failed opened no account in any of them. Closures, which are not served today: `failed.bank_account_not_found` and `failed.bank_account_balance_not_zero`.\n\n`failed.<code>` names the reason. The list holds every code Andco records, and it may grow: a `failed.` value outside this list is a failure like any other."));
|
|
268
|
+
/** What every answered Intent carries, whatever its type. */
|
|
269
|
+
const answeredIntent = {
|
|
270
|
+
id: uuid,
|
|
271
|
+
resource_server: url,
|
|
272
|
+
note: /* @__PURE__ */ v.optional(IntentNoteSchema),
|
|
273
|
+
metadata: /* @__PURE__ */ v.record(v.string(), v.unknown()),
|
|
274
|
+
server_time: dateTime,
|
|
275
|
+
created_at: dateTime,
|
|
276
|
+
authorization_url: url,
|
|
277
|
+
};
|
|
278
|
+
/** A deadline that may be absent (`null`: the Intent never expires), and the lifetime left of it. */
|
|
279
|
+
const openEndedDeadline = {
|
|
280
|
+
expires_at: /* @__PURE__ */ v.pipe(v.nullable(dateTime), v.description("The deadline to approve and execute the Intent. `null`: the Intent never expires.")),
|
|
281
|
+
expires_in_seconds: /* @__PURE__ */ v.pipe(v.nullable(v.pipe(v.number(), v.integer(), v.minValue(0))), v.description("Remaining actionable lifetime at server_time; zero for finite terminal Intents, `null` when the Intent never expires.")),
|
|
282
|
+
};
|
|
283
|
+
const noFee = /* @__PURE__ */ v.strictObject({ currency: v.literal("CLP"), amount: v.literal("0") });
|
|
284
|
+
/** Whether a Signed Instruction created the Intent. */
|
|
285
|
+
const signed = /* @__PURE__ */ v.pipe(v.boolean(), v.description("Whether a Signed Instruction created this Intent rather than a plain request."));
|
|
286
|
+
/** The Andco account a deposit lands on, with what a payer at another bank types to pay into it. */
|
|
287
|
+
export const DepositDestination = /* @__PURE__ */ v.pipe(v.strictObject({
|
|
288
|
+
type: v.literal("account"),
|
|
289
|
+
id: uuid,
|
|
290
|
+
number: v.pipe(v.string(), v.minLength(1), v.maxLength(64)),
|
|
291
|
+
account_type: v.picklist(["checking", "debit", "savings"]),
|
|
292
|
+
holder_id: v.pipe(v.nullable(v.string()), v.description("Null when the holder has no identity document on file.")),
|
|
293
|
+
holder_name: v.string(),
|
|
294
|
+
}), v.description('The Andco account a deposit lands on: the `{ type: "account", id }` matcher plus what a payer at another bank types to pay into it, holder included: `holder_id` is the holder\'s RUT and `holder_name` their name, as a Chilean transfer shows them to whoever sends the money.'));
|
|
295
|
+
/** What a deposit has collected so far, and what it still waits for. */
|
|
296
|
+
export const DepositProgress = /* @__PURE__ */ v.strictObject({ credited: pesos, remaining: v.nullable(pesos) });
|
|
297
|
+
/** The amount a deposit asks for, as it is answered. */
|
|
298
|
+
export const DepositTarget = /* @__PURE__ */ v.pipe(v.strictObject({
|
|
299
|
+
currency: v.literal("CLP"),
|
|
300
|
+
value: v.pipe(MoneySchema, v.description("Immutable amount from the creation request.")),
|
|
301
|
+
editable: v.boolean(),
|
|
302
|
+
confirmed: v.pipe(v.nullable(v.string()), v.description("Explicitly confirmed target; `value` applies until confirmation.")),
|
|
303
|
+
frozen_at: v.pipe(v.nullable(dateTime), v.description("First funding confirmation or attribution freezes the target permanently.")),
|
|
304
|
+
}), v.description("The amount a deposit asks for. `value` is the request's, `confirmed` the payer's own target when `editable`; what arrived is `progress.credited`, never these."));
|
|
305
|
+
const boundedText = (max) => v.pipe(v.string(), v.minLength(1), v.maxLength(max));
|
|
306
|
+
/** One payment a deposit received. */
|
|
307
|
+
export const DepositTransaction = /* @__PURE__ */ v.strictObject({
|
|
308
|
+
id: uuid,
|
|
309
|
+
received_at: dateTime,
|
|
310
|
+
note: v.nullable(v.string()),
|
|
311
|
+
outcome: v.picklist(["credited", "reversed"]),
|
|
312
|
+
receipt_time_source: v.picklist(["bank_timestamp", "unknown"]),
|
|
313
|
+
sender_name: v.pipe(v.nullable(boundedText(256)), v.description("Name of the account holder that sent the money, exactly as the bank reported it.")),
|
|
314
|
+
sender_national_id: v.pipe(v.nullable(boundedText(64)), v.description("National id (RUT) of the sender, as the bank reported it.")),
|
|
315
|
+
sender_bank_name: v.pipe(v.nullable(boundedText(256)), v.description("Display name of the sender's bank.")),
|
|
316
|
+
sender_account_type: v.nullable(v.picklist(["checking", "debit", "savings"])),
|
|
317
|
+
sender_account_number: v.nullable(boundedText(64)),
|
|
318
|
+
currency: v.literal("CLP"),
|
|
319
|
+
amount: MoneySchema,
|
|
320
|
+
transaction_id: v.optional(boundedText(256)),
|
|
321
|
+
});
|
|
322
|
+
/** A deposit's manual closure: when, and how much it had collected. */
|
|
323
|
+
const depositClosure = /* @__PURE__ */ v.object({ closed_at: dateTime, total: pesos });
|
|
324
|
+
/** Authoritative Project-facing state of a deposit. */
|
|
325
|
+
export const DepositIntent = /* @__PURE__ */ v.object({
|
|
326
|
+
...answeredIntent,
|
|
327
|
+
type: v.literal("deposit"),
|
|
328
|
+
status: v.pipe(v.picklist([
|
|
329
|
+
"requires_action",
|
|
330
|
+
"completed",
|
|
331
|
+
"closed",
|
|
332
|
+
"expired",
|
|
333
|
+
"cancelled",
|
|
334
|
+
"cancelled.grant_revoked",
|
|
335
|
+
"cancelled.grant_expired",
|
|
336
|
+
"failed",
|
|
337
|
+
]), v.description("`<base>[.<detail>]`. Read the base, what precedes the first dot, to know whether the Deposit can still change: `requires_action` can, every other base is final. A Grant that ends cancels its waiting Deposits with a detail.")),
|
|
338
|
+
attribution_version: v.pipe(v.number(), v.integer(), v.minValue(0)),
|
|
339
|
+
closure: v.nullable(depositClosure),
|
|
340
|
+
termination: v.pipe(v.optional(v.nullable(v.object({ status: v.string(), at: v.nullable(dateTime), total: v.nullable(pesos) }))), v.description("First terminal state and total, unchanged by later attribution corrections. Legacy unknown totals remain null.")),
|
|
341
|
+
completion: v.nullable(v.object({ completed_at: dateTime, total: pesos })),
|
|
342
|
+
destination: DepositDestination,
|
|
343
|
+
amount: v.nullable(DepositTarget),
|
|
344
|
+
progress: DepositProgress,
|
|
345
|
+
transactions: v.array(DepositTransaction),
|
|
346
|
+
fee: noFee,
|
|
347
|
+
expires_at: v.nullable(dateTime),
|
|
348
|
+
expires_in_seconds: v.pipe(v.nullable(v.pipe(v.number(), v.integer(), v.minValue(0))), v.description("Remaining actionable lifetime at server_time; zero for finite terminal Intents.")),
|
|
349
|
+
});
|
|
350
|
+
/** The amount a transfer orders, as it is answered. */
|
|
351
|
+
export const TransferAmount = /* @__PURE__ */ v.pipe(v.strictObject({
|
|
352
|
+
currency: v.literal("CLP"),
|
|
353
|
+
value: v.pipe(MoneySchema, v.description("Immutable amount from the creation request.")),
|
|
354
|
+
editable: v.boolean(),
|
|
355
|
+
confirmed: v.pipe(v.nullable(v.string()), v.description("The amount the person confirmed, null until then; it is what moves. For a transfer that is not editable it is `value`, set when the person confirms. Always within the Grant's `transactions.minimum` and `transactions.maximum`, when it has them.")),
|
|
356
|
+
}), v.description("The amount a transfer orders, as it is answered. `value` is the request's proposal and never changes; `confirmed` is the amount the person confirmed, null until they confirm, and it is what moves. It is never proof that money moved; read `settled` for that."));
|
|
357
|
+
/** The money a transfer actually moved and when it settled. */
|
|
358
|
+
export const TransferSettlement = /* @__PURE__ */ v.pipe(v.strictObject({ currency: v.literal("CLP"), value: MoneySchema, at: dateTime }), v.description("The money a transfer actually moved and when it settled. Present only once the transfer `succeeded`; null before, and null for ever when it fails, is rejected, cancelled or expires."));
|
|
359
|
+
/** Authoritative Project-facing state of a transfer. */
|
|
360
|
+
export const TransferIntent = /* @__PURE__ */ v.pipe(v.object({
|
|
361
|
+
...answeredIntent,
|
|
362
|
+
...openEndedDeadline,
|
|
363
|
+
type: v.literal("transfer"),
|
|
364
|
+
status: IntentStatus,
|
|
365
|
+
signed,
|
|
366
|
+
source: v.pipe(v.nullable(IntentAccountSchema), v.description("Null while the person has yet to pick where the money leaves from. An AccountKey is answered back as an AccountKey, because it stays unresolved until execution.")),
|
|
367
|
+
destination: v.pipe(v.nullable(TransferDestinationProposalSchema), v.description("Null while the person has yet to complete where the money lands, when the request left it to the screen. Once she confirms, the account she wrote is answered back here, locked.")),
|
|
368
|
+
amount: TransferAmount,
|
|
369
|
+
settled: v.nullable(TransferSettlement),
|
|
370
|
+
fee: noFee,
|
|
371
|
+
interaction_reason: v.pipe(v.optional(v.picklist(["bank_verification_required", "source_account_required"])), v.description("Present on every read of the Intent (GET, list, creation answers and signed-instruction answers) while it is `requires_action` and only a person can release it; absent when a credential may release it, and absent once the Intent is no longer `requires_action`. The same two words `409 interaction_required` gives as `reason` when a credential tries `POST /intents/{intent_id}/approve`. `bank_verification_required`: the transfer leaves its holder's own accounts and the bank asks the person to confirm it at `authorization_url` with their web PIN and an SMS code; the Intent becomes `processing.confirmed` only when the bank accepts it. A transfer created with `destination: null` reads this way until the person completes it, because what she writes there always leaves her accounts. `source_account_required`: the person still picks the account the money leaves from.")),
|
|
372
|
+
}), v.description("Authoritative Project-facing state of a transfer. `source` and `destination` answer in the same matcher vocabulary as the request. `amount.value` is the proposal of the request, `amount.confirmed` the amount the person confirmed (null until then; it is what moves) and `settled` what it moved: reconciliation reads `settled`, which stays null until the money moved. `transfer.confirmed` and the events after it report the confirmed amount."));
|
|
373
|
+
/** Authoritative Project-facing state of an account opening. */
|
|
374
|
+
export const AccountOpeningIntent = /* @__PURE__ */ v.pipe(v.object({
|
|
375
|
+
...answeredIntent,
|
|
376
|
+
...openEndedDeadline,
|
|
377
|
+
type: v.literal("account_opening"),
|
|
378
|
+
status: IntentStatus,
|
|
379
|
+
signed,
|
|
380
|
+
account: v.strictObject({
|
|
381
|
+
accountKey: AccountKeySchema,
|
|
382
|
+
name: v.string(),
|
|
383
|
+
upsert: v.boolean(),
|
|
384
|
+
bank_account_id: v.nullable(uuid),
|
|
385
|
+
}),
|
|
386
|
+
}), v.description("Authoritative Project-facing state of an account opening. It carries no amount and no fee: an opening moves no money. Opening is asynchronous, so `account.bank_account_id` is absent until the core assigns the Número de Cuenta, which arrives on the account's own event stream rather than in this response."));
|
|
387
|
+
/** Authoritative Project-facing state of an account closure. */
|
|
388
|
+
export const AccountClosureIntent = /* @__PURE__ */ v.pipe(v.object({
|
|
389
|
+
...answeredIntent,
|
|
390
|
+
type: v.literal("account_closure"),
|
|
391
|
+
status: IntentStatus,
|
|
392
|
+
signed,
|
|
393
|
+
account: IntentAccountSchema,
|
|
394
|
+
resolved_account_id: v.pipe(v.nullable(uuid), v.description("The account the reference resolved to, once resolution has happened, whether or not the closure itself has settled yet.")),
|
|
395
|
+
expires_at: dateTime,
|
|
396
|
+
expires_in_seconds: v.pipe(v.number(), v.integer(), v.minValue(0), v.description("Remaining actionable lifetime at server_time; zero for finite terminal Intents.")),
|
|
397
|
+
}), v.description("Authoritative Project-facing state of an account closure. It carries no amount and no fee."));
|
|
398
|
+
/** One Intent, of any type, as the Project that created it reads it. */
|
|
399
|
+
export const Intent = /* @__PURE__ */ v.variant("type", [
|
|
400
|
+
DepositIntent,
|
|
401
|
+
TransferIntent,
|
|
402
|
+
AccountOpeningIntent,
|
|
403
|
+
AccountClosureIntent,
|
|
404
|
+
]);
|
|
405
|
+
/** The terminal state of a deposit an application closed, and its historical manual closure. */
|
|
406
|
+
export const DepositCloseResult = /* @__PURE__ */ v.object({
|
|
407
|
+
id: uuid,
|
|
408
|
+
status: v.pipe(v.string(), v.description("Existing terminal outcome is preserved, including expired.")),
|
|
409
|
+
server_time: dateTime,
|
|
410
|
+
closure: v.nullable(depositClosure),
|
|
411
|
+
});
|
|
412
|
+
// -- Operations ---------------------------------------------------------------------------------
|
|
413
|
+
const intentPath = /* @__PURE__ */ v.object({ intent_id: uuid });
|
|
414
|
+
/** The 422 refusals of a release, at creation (a Signed Instruction whose signer may approve) and at approval. */
|
|
415
|
+
const releaseRefusals = [
|
|
416
|
+
AmountOutOfGrant,
|
|
417
|
+
InvalidSource,
|
|
418
|
+
InvalidDestination,
|
|
419
|
+
TransferSenderIdentityUnavailable,
|
|
420
|
+
UnsupportedBank,
|
|
421
|
+
BankConnectionUnavailable,
|
|
422
|
+
BankAccountNumberMissing,
|
|
423
|
+
BankAuthorizationDenied,
|
|
424
|
+
BankHolderWithoutAccount,
|
|
425
|
+
BankAccountLimitReached,
|
|
426
|
+
BankRefused,
|
|
427
|
+
InsufficientFunds,
|
|
428
|
+
BankRejected,
|
|
429
|
+
BankReviewRequired,
|
|
430
|
+
];
|
|
431
|
+
/** Creates an Intent from a proposal (`application/json`) or from a Signed Instruction (`application/jwt`). */
|
|
432
|
+
export const createIntent = /* @__PURE__ */ oc
|
|
433
|
+
.meta(http({
|
|
434
|
+
method: "POST",
|
|
435
|
+
path: "/intents",
|
|
436
|
+
summary: "Create an intent under the exact OAuth Grant",
|
|
437
|
+
description: "The same creation has two representations, and the content type picks between them. An `application/json` body is an Intent born waiting for an Approval. An `application/jwt` body is one Signed Instruction, sent as a compact JWS whose verified payload is `SignedTransferIntentClaims`, `SignedAccountOpeningIntentClaims` or `SignedAccountClosureIntentClaims`, and every value the operation uses comes from those claims and none from the envelope carrying them. A string body sent as anything but `application/jwt` answers `415 unsupported_media_type`. A Signed Instruction that does not verify answers `400 invalid_signed_instruction` with its `reason`, and one whose `exp` passed `401 expired_signed_instruction`. A signed Intent is born approved when the signing client's Grant holds the family's `approve` action (`bank_transfer` or `bank_account`); otherwise it waits, like a proposal, for the person on the hosted screen or for `POST /intents/{intent_id}/approve` by a Grant that holds it. Opening and closing an account fail synchronously with `403 account_key_out_of_grant` when the account_key is outside the Grant's `accounts` patterns and with `409 account_key_taken` when the account_key names an account of the subject (always for a closed one; otherwise unless `upsert`). The new account's number arrives in the `account_opening.succeeded` event as `account: { id, accountKey, number, name }`. Once the request is valid and authorized (a malformed body is still `400 invalid_request` and a Grant without the permission still `403 insufficient_authorization`), an opening and a transfer between two accounts of the same holder work where the bank serves them: the answer is `201` with the Intent `requires_action` and its `authorization_url`, or, for a Signed Instruction whose signer also holds the family's `approve`, the Intent as it is after its release. Where the deployment's bank does not serve one, the same request answers `501 not_implemented` with `code: account_opening_not_implemented` or `code: own_account_transfer_not_implemented`; a closure always answers `501 not_implemented` with `code: account_closure_not_implemented`. Nothing is created in those cases. A subject without a bank connection to a company cannot open an account: `422 bank_connection_unavailable` with the `intent_id`. A released Signed Instruction answers the refusals of `POST /intents/{intent_id}/approve`.",
|
|
438
|
+
successStatus: 201,
|
|
439
|
+
successDescription: "Intent created or returned from an idempotent retry",
|
|
440
|
+
inputStructure: "detailed",
|
|
441
|
+
spec: (operation) => servedAsSignedInstruction(withCanonicalHeaderNames(operation)),
|
|
442
|
+
}))
|
|
443
|
+
.errors(errors(InvalidRequest, IdempotencyKeyNotAllowed, InvalidSignedInstruction, InvalidToken, ExpiredSignedInstruction, InvalidOrigin, InsufficientAuthorization, AccountKeyOutOfGrant, NotFound, UnsupportedVersion, ServerError, IdempotencyConflict, IntentInteractionRequired, AccountKeyTaken, BankAccountQuotaExceeded, InvalidIntentState, IntentExpired, PayloadTooLarge, UnsupportedMediaType, DepositAmountOutOfBounds, DepositDestinationAmbiguous, ...releaseRefusals, NotImplemented, TemporarilyUnavailable))
|
|
444
|
+
.input(v.object({
|
|
445
|
+
headers: v.object({
|
|
446
|
+
"idempotency-key": v.pipe(v.optional(v.pipe(v.string(), v.regex(/^[A-Za-z0-9._:-]{1,128}$/))), v.description("Required with `application/json`, and refused with `application/jwt`, which answers `400 idempotency_key_not_allowed` when it arrives beside a signature: the idempotency key of a Signed Instruction is its own `jti`, and two candidates for one key is exactly the ambiguity that gets read the wrong way round. OpenAPI cannot make a header conditional on the media type, so it is published as optional rather than demanding what the server refuses.")),
|
|
447
|
+
}),
|
|
448
|
+
body: v.union([
|
|
449
|
+
IntentCreateSchema,
|
|
450
|
+
signedInstructionBody("One Signed Instruction as a compact JWS, signed by a Signing Key this OAuth Client registered. The body is the serialized token, not a JSON object: what the claim schemas describe is its decoded payload.", {
|
|
451
|
+
oneOf: [
|
|
452
|
+
{ $ref: "#/components/schemas/SignedTransferIntentClaims" },
|
|
453
|
+
{ $ref: "#/components/schemas/SignedAccountOpeningIntentClaims" },
|
|
454
|
+
{ $ref: "#/components/schemas/SignedAccountClosureIntentClaims" },
|
|
455
|
+
],
|
|
456
|
+
}),
|
|
457
|
+
]),
|
|
458
|
+
}))
|
|
459
|
+
.output(Intent);
|
|
460
|
+
/** Reads one Intent created under the same exact OAuth Grant. */
|
|
461
|
+
export const getIntent = /* @__PURE__ */ oc
|
|
462
|
+
.meta(http({
|
|
463
|
+
method: "GET",
|
|
464
|
+
path: "/intents/{intent_id}",
|
|
465
|
+
summary: "Read one intent created under the same exact OAuth Grant",
|
|
466
|
+
successDescription: "The intent, as the Project that created it reads it",
|
|
467
|
+
}))
|
|
468
|
+
.errors(errors(InvalidIdentifier, InvalidToken, InvalidOrigin, NotFound, UnsupportedVersion, ServerError, TemporarilyUnavailable))
|
|
469
|
+
.input(intentPath)
|
|
470
|
+
.output(Intent);
|
|
471
|
+
/** Closes this application's no-target deposit collection. */
|
|
472
|
+
export const closeDeposit = /* @__PURE__ */ oc
|
|
473
|
+
.meta(http({
|
|
474
|
+
method: "POST",
|
|
475
|
+
path: "/intents/{intent_id}/close",
|
|
476
|
+
summary: "Close this application's no-target deposit collection with an explicit close Grant action",
|
|
477
|
+
description: "Idempotent. Preserves existing terminal outcomes. Does not move funds, cancel accepted bank commands, or grant account transaction access.",
|
|
478
|
+
successDescription: "Current terminal state and historical manual closure, if any",
|
|
479
|
+
}))
|
|
480
|
+
.errors(errors(InvalidIdentifier, InvalidToken, InvalidOrigin, InsufficientAuthorization, NotFound, UnsupportedVersion, ServerError, InvalidIntentState, TemporarilyUnavailable))
|
|
481
|
+
.input(intentPath)
|
|
482
|
+
.output(DepositCloseResult);
|
|
483
|
+
/** Approves an Intent with a Grant holding the family's `approve` action, and releases it. */
|
|
484
|
+
export const approveIntent = /* @__PURE__ */ oc
|
|
485
|
+
.meta(http({
|
|
486
|
+
method: "POST",
|
|
487
|
+
path: "/intents/{intent_id}/approve",
|
|
488
|
+
summary: "Approve an Intent with a Grant holding the family's approve action",
|
|
489
|
+
description: "Approval by a credential, without a person: the Grant behind the token must hold `approve` on the family that releases this Intent type (`bank_transfer` for a transfer) for the same subject, and within that detail's `transactions.maximum`. Above it the call answers `422 amount_out_of_grant` and the Intent stays pending for another approver. A transfer only a person can release answers `409 interaction_required` with `authorization_url` and `reason`, before any approval is recorded and before the bank is called: `bank_verification_required` for a transfer that leaves its holder's own accounts (to another bank or to another Andco customer), which the bank moves only after that person confirms it with their web PIN and a code the bank sends to their phone, and also for a transfer created with `destination: null` that nobody has completed yet; and `source_account_required` when the person still picks the source. Accepted is not moved: wait for `transfer.succeeded` or `transfer.failed`.\n\nTwo kinds of Intent are released with nobody present. Opening an additional account by Account Key needs `bank_account` `approve`; the answer is the Intent, and the account number never comes back in it: it arrives in the `account_opening.succeeded` event. A transfer between two accounts of the same holder needs `bank_transfer` `approve`; the bank asks no fraud engine and no challenge because the money does not leave the holder, and the answer is the Intent `succeeded`, or `processing.confirmed` (which for this rail begins at release, while for a transfer that leaves its holder it begins when the bank accepts it) when the bank has not answered for good yet, in which case nothing else is needed from the caller: the server asks the bank again under the same key on a bounded schedule and the outcome arrives as `transfer.succeeded` or `transfer.failed`. \"Same holder\" is decided by the bank: two accounts of one Organization (or of one person's business) qualify, while an account of a person and an account of a Company they represent do not, and that transfer is an ordinary one that leaves its holder.\n\nRefusals of such a release: `409 interaction_required` with `intent_id`, `reason` and `interaction_url`, where `reason` is `bank_connection_pin_required`, `bank_connection_reconnect_required` or `bank_representative_replacement_required`; the bank asks no challenge, but the web session that acts for the holder needs its person back (or the Organization must connect another bank representative), nothing was opened, frozen or moved, the Intent is untouched and the same request succeeds once the person has acted at `interaction_url`. Also `409 bank_account_quota_exceeded` (with `used` and `quota`), `409 account_key_taken` (with `reason`), `409 intent_expired`, `409 invalid_intent_state` and `403 insufficient_authorization`. `422` with `intent_id` and `error` one of `bank_connection_unavailable` (the subject has no bank connection to a company), `bank_authorization_denied` (the bank does not let that person open accounts for that company), `bank_holder_without_account`, `bank_account_limit_reached`, `bank_refused`, `insufficient_funds`, `bank_rejected` or `bank_review_required`; the Intent is `failed` with the same detail (see `IntentStatus`). `503 temporarily_unavailable` means the bank could not be asked: asking again for the same Intent is safe and answers the same result, because the Intent's id is the bank's idempotency key. Where the bank does not serve the capability, `501 not_implemented` with `account_opening_not_implemented` or `own_account_transfer_not_implemented` and the `intent_id`; the Intent stays as it was. Safe to retry.",
|
|
490
|
+
successDescription: "The Intent after its approval",
|
|
491
|
+
}))
|
|
492
|
+
.errors(errors(InvalidRequest, InvalidIdentifier, InvalidToken, InvalidOrigin, InsufficientAuthorization, NotFound, UnsupportedVersion, ServerError, IntentInteractionRequired, AccountKeyTaken, BankAccountQuotaExceeded, InvalidIntentState, IntentExpired, TransferAmountRequired, TransferDestinationRequired, ...releaseRefusals, NotImplemented, TemporarilyUnavailable))
|
|
493
|
+
.input(intentPath)
|
|
494
|
+
.output(Intent);
|
|
495
|
+
/** Rejects an Intent with a Grant holding the family's `reject` action. */
|
|
496
|
+
export const rejectIntent = /* @__PURE__ */ oc
|
|
497
|
+
.meta(http({
|
|
498
|
+
method: "POST",
|
|
499
|
+
path: "/intents/{intent_id}/reject",
|
|
500
|
+
summary: "Reject an Intent with a Grant holding the family's reject action",
|
|
501
|
+
description: "An approver declining an Intent, recorded as a Rejection and kept apart from a Cancellation (the creator withdrawing it). The Grant behind the token must hold `reject` on the family that releases this Intent type for the same subject; no maximum applies to a rejection. Answers `409 intent_expired` when the Intent's deadline has passed.",
|
|
502
|
+
successDescription: "Rejected Intent",
|
|
503
|
+
inputStructure: "detailed",
|
|
504
|
+
}))
|
|
505
|
+
.errors(errors(InvalidRequest, InvalidIdentifier, InvalidToken, InvalidOrigin, InsufficientAuthorization, NotFound, UnsupportedVersion, ServerError, InvalidIntentState, IntentExpired, PayloadTooLarge, TemporarilyUnavailable))
|
|
506
|
+
.input(v.object({ params: intentPath, body: IntentRejectionSchema }))
|
|
507
|
+
.output(Intent);
|
|
508
|
+
/** Withdraws an Intent the calling client created. */
|
|
509
|
+
export const cancelIntent = /* @__PURE__ */ oc
|
|
510
|
+
.meta(http({
|
|
511
|
+
method: "POST",
|
|
512
|
+
path: "/intents/{intent_id}/cancel",
|
|
513
|
+
summary: "Withdraw an Intent the calling client created",
|
|
514
|
+
description: "A Cancellation is the creator withdrawing its own request: only the client and Grant that created the Intent may cancel it. An approver declining it uses `reject`, and the audit keeps the two apart. Records why: an Intent that vanished without a reason is an unexplained gap. Answers `409 intent_expired` when the Intent's deadline to be approved and executed has already passed.",
|
|
515
|
+
successDescription: "Cancelled Intent",
|
|
516
|
+
inputStructure: "detailed",
|
|
517
|
+
}))
|
|
518
|
+
.errors(errors(InvalidRequest, InvalidIdentifier, InvalidToken, InvalidOrigin, NotFound, UnsupportedVersion, ServerError, InvalidIntentState, IntentExpired, PayloadTooLarge, TemporarilyUnavailable))
|
|
519
|
+
.input(v.object({ params: intentPath, body: IntentCancellationSchema }))
|
|
520
|
+
.output(Intent);
|
|
521
|
+
/** Replays the durable facts of one Intent the exact Grant authorized. */
|
|
522
|
+
export const readIntentEvents = /* @__PURE__ */ oc
|
|
523
|
+
.meta(http({
|
|
524
|
+
method: "GET",
|
|
525
|
+
path: "/intents/{intent_id}/events",
|
|
526
|
+
summary: "Replay durable facts for one authorized Intent",
|
|
527
|
+
description: "Returns edges and camelCase pageInfo. Cursor and offset argument families cannot be mixed.",
|
|
528
|
+
successDescription: "Authorized event page in publication order",
|
|
529
|
+
}))
|
|
530
|
+
.errors(errors(InvalidRequest, InvalidIdentifier, InvalidToken, InvalidOrigin, NotFound, UnsupportedVersion, ServerError, TemporarilyUnavailable))
|
|
531
|
+
.input(v.object({ intent_id: uuid, ...PageQuery }))
|
|
532
|
+
.output(FinancialEventPage);
|
|
533
|
+
/**
|
|
534
|
+
* oRPC reads headers in lower case, as HTTP compares them; the reference names them as they are
|
|
535
|
+
* written (`Idempotency-Key`).
|
|
536
|
+
*/
|
|
537
|
+
function withCanonicalHeaderNames(operation) {
|
|
538
|
+
const parameters = (operation["parameters"] ?? []);
|
|
539
|
+
return {
|
|
540
|
+
...operation,
|
|
541
|
+
parameters: parameters.map((parameter) => {
|
|
542
|
+
if (parameter.in !== "header" || parameter.name === undefined) {
|
|
543
|
+
return parameter;
|
|
544
|
+
}
|
|
545
|
+
return {
|
|
546
|
+
...parameter,
|
|
547
|
+
name: parameter.name.replace(/(^|-)([a-z])/g, (_, dash, letter) => dash + letter.toUpperCase()),
|
|
548
|
+
};
|
|
549
|
+
}),
|
|
550
|
+
};
|
|
551
|
+
}
|