@andco/protocol 0.0.13 → 0.0.15
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +2 -2
- package/dist/api-errors.d.ts +9 -9
- package/dist/api-errors.js +9 -9
- package/dist/authorization-preparation.js +2 -2
- package/dist/authorization.d.ts +1 -1
- package/dist/authorization.js +1 -1
- package/dist/consent.d.ts +2 -2
- package/dist/consent.js +2 -2
- package/dist/constants.d.ts +15 -2
- package/dist/constants.d.ts.map +1 -1
- package/dist/constants.js +17 -3
- package/dist/errors.d.ts +36 -9
- package/dist/errors.d.ts.map +1 -1
- package/dist/errors.js +49 -11
- 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 +431 -872
- package/dist/intent-input.d.ts.map +1 -1
- package/dist/intent-input.js +142 -121
- package/dist/miniapp-icon.js +1 -1
- package/dist/miniapp-manifest.d.ts +1 -1
- package/dist/native-intent.d.ts +82 -68
- package/dist/native-intent.d.ts.map +1 -1
- package/dist/native-intent.js +134 -84
- package/dist/native.d.ts +1 -1
- package/dist/rar/account-matchers.d.ts +35 -30
- package/dist/rar/account-matchers.d.ts.map +1 -1
- package/dist/rar/account-matchers.js +27 -21
- package/dist/rar/bank.d.ts +81 -81
- package/dist/rar/bank.js +1 -1
- package/dist/rar/catalog.d.ts +48 -48
- package/dist/rar/catalog.js +6 -6
- package/dist/rar/detail.d.ts +1 -1
- package/dist/rar/detail.js +1 -1
- package/dist/rar/json-schemas.generated.d.ts +1 -1
- package/dist/rar/json-schemas.generated.d.ts.map +1 -1
- package/dist/rar/json-schemas.generated.js +25 -21
- package/dist/rar/subject-data.d.ts +1 -1
- package/dist/rar/subject-data.js +1 -1
- package/dist/rar/subject.d.ts +1 -1
- package/dist/rar/subject.js +1 -1
- package/dist/rest/accounts.d.ts +28 -28
- package/dist/rest/accounts.d.ts.map +1 -1
- package/dist/rest/accounts.js +22 -22
- package/dist/rest/api-error.d.ts +1 -1
- package/dist/rest/api-error.js +1 -1
- package/dist/rest/catalog.d.ts +3 -3
- package/dist/rest/catalog.js +2 -2
- package/dist/rest/common.d.ts +3 -3
- package/dist/rest/common.js +3 -3
- package/dist/rest/contract.d.ts +905 -528
- package/dist/rest/contract.d.ts.map +1 -1
- package/dist/rest/contract.js +17 -5
- package/dist/rest/events.d.ts +1 -1
- package/dist/rest/events.d.ts.map +1 -1
- package/dist/rest/events.js +2 -2
- package/dist/rest/identity.d.ts +22 -22
- package/dist/rest/identity.js +5 -5
- package/dist/rest/index.d.ts +1 -0
- package/dist/rest/index.d.ts.map +1 -1
- package/dist/rest/index.js +1 -0
- package/dist/rest/intents.d.ts +787 -716
- package/dist/rest/intents.d.ts.map +1 -1
- package/dist/rest/intents.js +62 -53
- package/dist/rest/signatures.d.ts +11 -5
- package/dist/rest/signatures.d.ts.map +1 -1
- package/dist/rest/signatures.js +10 -0
- package/dist/rest/subjects.d.ts +1 -1
- package/dist/rest/subjects.d.ts.map +1 -1
- package/dist/rest/subjects.js +3 -2
- package/dist/rest/transfers.d.ts +612 -0
- package/dist/rest/transfers.d.ts.map +1 -0
- package/dist/rest/transfers.js +115 -0
- package/dist/scopes.d.ts +1 -1
- package/dist/signing.d.ts +13 -2
- package/dist/signing.d.ts.map +1 -1
- package/dist/signing.js +13 -0
- package/dist/transfer.d.ts +363 -0
- package/dist/transfer.d.ts.map +1 -0
- package/dist/transfer.js +287 -0
- package/dist/transport/financial-events.d.ts +21 -17
- package/dist/transport/financial-events.d.ts.map +1 -1
- package/dist/transport/generated/oauth-api.d.ts +1017 -194
- package/dist/transport/generated/oauth-api.d.ts.map +1 -1
- package/dist/transport/intents.d.ts +28 -12
- package/dist/transport/intents.d.ts.map +1 -1
- package/dist/transport/intents.js +1 -1
- package/dist/transport/rest.d.ts +4 -4
- package/dist/transport/rest.d.ts.map +1 -1
- package/dist/transport/rest.js +33 -4
- package/dist/urls.d.ts +25 -2
- package/dist/urls.d.ts.map +1 -1
- package/dist/urls.js +47 -4
- package/dist/userinfo.d.ts +2 -2
- package/dist/userinfo.js +2 -2
- package/dist/webhooks.d.ts +19 -15
- package/dist/webhooks.d.ts.map +1 -1
- package/dist/webhooks.js +17 -15
- package/dist/window-features.d.ts +2 -2
- package/dist/window-features.js +2 -2
- package/package.json +2 -2
|
@@ -0,0 +1,612 @@
|
|
|
1
|
+
import * as v from "valibot";
|
|
2
|
+
import { InsufficientAuthorization, InvalidIdentifier, InvalidOrigin, InvalidRequest, InvalidToken, NotFound, PayloadTooLarge, ServerError, TemporarilyUnavailable, UnsupportedMediaType, UnsupportedVersion } from "./common.js";
|
|
3
|
+
import { AmountOutOfGrant, BankConnectionUnavailable, BankRefused, BankRejected, BankReviewRequired, ExpiredSignedInstruction, IdempotencyConflict, IdempotencyKeyNotAllowed, InsufficientFunds, IntentInteractionRequired, InvalidDestination, InvalidSignedInstruction, InvalidSource, NotImplemented, TransferSenderIdentityUnavailable } from "./intents.js";
|
|
4
|
+
/**
|
|
5
|
+
* The media type a signed transfer travels as: a JWS in the General JSON Serialization (RFC 7515
|
|
6
|
+
* §7.2.1), the {@link SignedTransferEnvelopeSchema} itself.
|
|
7
|
+
*/
|
|
8
|
+
export declare const SIGNED_TRANSFER_MEDIA_TYPE = "application/jose+json";
|
|
9
|
+
declare const SenderMismatch_base: (abstract new (data: {}, message?: string, hint?: string) => {
|
|
10
|
+
readonly error: "sender_mismatch";
|
|
11
|
+
readonly hint?: string;
|
|
12
|
+
readonly data: {};
|
|
13
|
+
name: string;
|
|
14
|
+
message: string;
|
|
15
|
+
stack?: string;
|
|
16
|
+
cause?: unknown;
|
|
17
|
+
}) & {
|
|
18
|
+
readonly error: "sender_mismatch";
|
|
19
|
+
readonly status: 422;
|
|
20
|
+
readonly data: v.SchemaWithPipe<readonly [v.ObjectSchema<{}, undefined>, v.DescriptionAction<{}, "The signed sender is not the account: country `CL`, bank `0739`, its own account type and its holder's RUT.">]>;
|
|
21
|
+
define<const Code extends string, const Status extends number, Data extends import("./api-error.js").AndcoAPIErrorDataSchema>(error: Code, status: Status, data: Data): (abstract new (data: v.InferOutput<Data>, message?: string, hint?: string) => {
|
|
22
|
+
readonly error: Code;
|
|
23
|
+
readonly hint?: string;
|
|
24
|
+
readonly data: v.InferOutput<Data>;
|
|
25
|
+
name: string;
|
|
26
|
+
message: string;
|
|
27
|
+
stack?: string;
|
|
28
|
+
cause?: unknown;
|
|
29
|
+
}) & {
|
|
30
|
+
readonly error: Code;
|
|
31
|
+
readonly status: Status;
|
|
32
|
+
readonly data: Data;
|
|
33
|
+
define<const Code extends string, const Status extends number, Data extends import("./api-error.js").AndcoAPIErrorDataSchema>(error: Code, status: Status, data: Data): /*elided*/ any;
|
|
34
|
+
};
|
|
35
|
+
};
|
|
36
|
+
/**
|
|
37
|
+
* The signed `sender` is not the account it names: its `country` is `CL`, its `bank_code` AndCo's
|
|
38
|
+
* (`0739`), its `account_type` the account's own and its `national_id` the RUT of the account's
|
|
39
|
+
* holder, compared as normalized RUTs. Its `name` is never compared. The core runs the same check
|
|
40
|
+
* when it executes; the API runs it first so that the mistake fails before anything is stored.
|
|
41
|
+
*/
|
|
42
|
+
export declare class SenderMismatch extends /* @__PURE__ */ SenderMismatch_base {
|
|
43
|
+
constructor(message?: string);
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
* A Transfer: the movement of an amount from a Remitente (`sender`) to a Receptor (`receiver`), as
|
|
47
|
+
* AndCo represents it (ADR 0093). One signature uploads one Transfer, named by its `jti`.
|
|
48
|
+
*
|
|
49
|
+
* `sender`, `receiver` and `comment` are what was signed, in Core's vocabulary and as they were
|
|
50
|
+
* signed: what was signed never changes. `status` is where the Transfer stands, in the words an
|
|
51
|
+
* Intent uses; `core_status` is the core's own word for its transfer, for the record only.
|
|
52
|
+
*
|
|
53
|
+
* @example
|
|
54
|
+
* const transfer: Transfer = {
|
|
55
|
+
* object: "transfer", id, jti, status: "succeeded", core_status: "confirmed", approved: true,
|
|
56
|
+
* sender, receiver, comment: "Factura 42", created_at, expires_at,
|
|
57
|
+
* };
|
|
58
|
+
*/
|
|
59
|
+
export declare const Transfer: v.SchemaWithPipe<readonly [v.StrictObjectSchema<{
|
|
60
|
+
readonly object: v.LiteralSchema<"transfer", undefined>;
|
|
61
|
+
readonly id: v.SchemaWithPipe<readonly [v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.UuidAction<string, undefined>]>, v.DescriptionAction<string, "The Transfer's own id: what `GET /transfers/{transfer_id}` reads.">]>;
|
|
62
|
+
readonly jti: v.SchemaWithPipe<readonly [v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.UuidAction<string, undefined>]>, v.DescriptionAction<string, "The `jti` of the Signed Instruction that uploaded it. Sending the same instruction again answers this same Transfer.">]>;
|
|
63
|
+
readonly status: v.SchemaWithPipe<readonly [v.SchemaWithPipe<readonly [v.PicklistSchema<["requires_action", "processing.confirmed", "processing.settling", "processing.reversing", "processing.reconciling", "processing.opening", "processing.closing", "succeeded", "failed", "failed.insufficient_funds", "failed.fraud_rejected", "failed.bank_refused", "failed.bank_rejected", "failed.bank_review_required", "failed.own_account_transfer_not_implemented", "failed.bank_challenge_required", "failed.unknown_key", "failed.revoked_key", "failed.expired_key", "failed.invalid_signature", "failed.expired_signed_instruction", "failed.sender_mismatch", "failed.bank_authorization_denied", "failed.bank_holder_without_account", "failed.bank_account_limit_reached", "failed.account_opening_not_implemented", "failed.bank_core_unavailable", "failed.bank_account_save_failed", "failed.bank_connection_unavailable", "failed.bank_account_quota_exceeded", "failed.account_key_taken", "failed.bank_account_not_found", "failed.bank_account_balance_not_zero", "cancelled", "cancelled.grant_revoked", "cancelled.grant_expired", "rejected", "expired"], undefined>, v.DescriptionAction<"succeeded" | "failed" | "cancelled" | "rejected" | "expired" | "requires_action" | "processing.confirmed" | "processing.settling" | "processing.reversing" | "processing.reconciling" | "processing.opening" | "processing.closing" | "failed.insufficient_funds" | "failed.fraud_rejected" | "failed.bank_refused" | "failed.bank_rejected" | "failed.bank_review_required" | "failed.own_account_transfer_not_implemented" | "failed.bank_challenge_required" | "failed.unknown_key" | "failed.revoked_key" | "failed.expired_key" | "failed.invalid_signature" | "failed.expired_signed_instruction" | "failed.sender_mismatch" | "failed.bank_authorization_denied" | "failed.bank_holder_without_account" | "failed.bank_account_limit_reached" | "failed.account_opening_not_implemented" | "failed.bank_core_unavailable" | "failed.bank_account_save_failed" | "failed.bank_connection_unavailable" | "failed.bank_account_quota_exceeded" | "failed.account_key_taken" | "failed.bank_account_not_found" | "failed.bank_account_balance_not_zero" | "cancelled.grant_revoked" | "cancelled.grant_expired", "`<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 AndPass or typing the SMS code does not change its status. It becomes `processing.confirmed`, and `transfer.confirmed` is published once, when AndCo 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 AndCo 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 AndCo 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). A signed Transfer that leaves its holder (`POST /transfers`, ADR 0092) is never confirmed by a person: it also fails with `failed.bank_challenge_required` (the bank's fraud engine asked for a challenge nobody answers for a signature; send the same transfer as an Intent a person confirms) or with the core's refusal of its signature, in the words the upload uses: `failed.unknown_key` (the core holds no such key), `failed.revoked_key`, `failed.invalid_signature`, `failed.expired_signed_instruction` (its `exp` passed before the core executed it) and `failed.sender_mismatch`. A signed Transfer on either rail also fails, before anything is sent, when a key that signed it is no longer usable as it executes, even if it was at upload: `failed.revoked_key`, `failed.expired_key`, or `failed.unknown_key` (no Project of the holder has it any more, or, for one that leaves its holder, the core no longer holds it). In `failed.fraud_rejected`, `failed.bank_refused`, `failed.own_account_transfer_not_implemented`, `failed.bank_challenge_required`, `failed.expired_key` and the core's refusals of a signature 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.">]>, v.DescriptionAction<"succeeded" | "failed" | "cancelled" | "rejected" | "expired" | "requires_action" | "processing.confirmed" | "processing.settling" | "processing.reversing" | "processing.reconciling" | "processing.opening" | "processing.closing" | "failed.insufficient_funds" | "failed.fraud_rejected" | "failed.bank_refused" | "failed.bank_rejected" | "failed.bank_review_required" | "failed.own_account_transfer_not_implemented" | "failed.bank_challenge_required" | "failed.unknown_key" | "failed.revoked_key" | "failed.expired_key" | "failed.invalid_signature" | "failed.expired_signed_instruction" | "failed.sender_mismatch" | "failed.bank_authorization_denied" | "failed.bank_holder_without_account" | "failed.bank_account_limit_reached" | "failed.account_opening_not_implemented" | "failed.bank_core_unavailable" | "failed.bank_account_save_failed" | "failed.bank_connection_unavailable" | "failed.bank_account_quota_exceeded" | "failed.account_key_taken" | "failed.bank_account_not_found" | "failed.bank_account_balance_not_zero" | "cancelled.grant_revoked" | "cancelled.grant_expired", "Where the Transfer stands, in the words an Intent uses (`IntentStatus`): decide on the base, never on the whole value. A signed transfer that is not approved is `requires_action` until a Grant with `bank_transfer` `approve` or a person approves it. A transfer between two accounts of the same holder is `processing.confirmed` from its release until AndCo answers for good, then `succeeded` or `failed.<code>`.">]>;
|
|
64
|
+
readonly core_status: v.SchemaWithPipe<readonly [v.NullableSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MinLengthAction<string, 1, undefined>]>, undefined>, v.DescriptionAction<string | null, "The core bancario's own word for its transfer (`requested`, `confirmed`, `rejected_insufficient_funds`, …), for the record. Null while AndCo has not read one. Never branch on it: a word the core adds later appears here as it is, and `status` is what to decide on.">]>;
|
|
65
|
+
readonly approved: v.SchemaWithPipe<readonly [v.BooleanSchema<undefined>, v.DescriptionAction<boolean, "The signed `approved`: whether the instruction ordered the transfer sent as soon as it was uploaded.">]>;
|
|
66
|
+
readonly sender: v.SchemaWithPipe<readonly [v.VariantSchema<"country", [v.StrictObjectSchema<{
|
|
67
|
+
country: v.LiteralSchema<"CL", undefined>;
|
|
68
|
+
bank_code: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.RegexAction<string, undefined>, v.DescriptionAction<string, "The bank's four-digit code in Core's catalog. Andco is `0739`.">]>;
|
|
69
|
+
account_type: v.SchemaWithPipe<readonly [v.PicklistSchema<["10", "20", "40"], undefined>, v.DescriptionAction<"10" | "20" | "40", "Core's account type code: `\"10\"` savings, `\"20\"` checking, `\"40\"` debit (cuenta vista).">]>;
|
|
70
|
+
account_number: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MinLengthAction<string, 1, undefined>, v.MaxLengthAction<string, 64, undefined>, v.DescriptionAction<string, "The account number, as its bank writes it.">]>;
|
|
71
|
+
name: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MinLengthAction<string, 1, undefined>, v.DescriptionAction<string, "The holder's name. Core stores it as it arrives and never compares it.">]>;
|
|
72
|
+
national_kind_id: v.LiteralSchema<"RUT", undefined>;
|
|
73
|
+
national_id: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MinLengthAction<string, 1, undefined>, v.MaxLengthAction<string, 64, undefined>, v.DescriptionAction<string, "The holder's RUT. Core compares it as a normalized RUT.">]>;
|
|
74
|
+
}, undefined>], undefined>, v.DescriptionAction<{
|
|
75
|
+
country: "CL";
|
|
76
|
+
bank_code: string;
|
|
77
|
+
account_type: "10" | "20" | "40";
|
|
78
|
+
account_number: string;
|
|
79
|
+
name: string;
|
|
80
|
+
national_kind_id: "RUT";
|
|
81
|
+
national_id: string;
|
|
82
|
+
}, "The Remitente, as Core's `sender`: the account the money leaves and its holder. `country` and `national_kind_id` are always declared. Core checks the country, the bank (`0739`), the account's own type and the holder's RUT; it stores `name` as it arrives.">]>;
|
|
83
|
+
readonly receiver: v.SchemaWithPipe<readonly [v.VariantSchema<"country", [v.StrictObjectSchema<{
|
|
84
|
+
readonly amount: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.IntegerAction<number, undefined>, v.MinValueAction<number, 1, undefined>, v.MaxValueAction<number, 2147483647, undefined>, v.DescriptionAction<number, "An integer in the minor unit of the currency (CLP: whole pesos), from 1 to 2147483647, because Core stores it as int4. A larger one is refused with `max_value`.">]>;
|
|
85
|
+
readonly currency: v.LiteralSchema<"CLP", undefined>;
|
|
86
|
+
readonly email: v.SchemaWithPipe<readonly [v.OptionalSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.EmailAction<string, undefined>]>, undefined>, v.DescriptionAction<string | undefined, "Where Core notifies the Receptor.">]>;
|
|
87
|
+
readonly country: v.LiteralSchema<"CL", undefined>;
|
|
88
|
+
readonly bank_code: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.RegexAction<string, undefined>, v.DescriptionAction<string, "The bank's four-digit code in Core's catalog. Andco is `0739`.">]>;
|
|
89
|
+
readonly account_type: v.SchemaWithPipe<readonly [v.PicklistSchema<["10", "20", "40"], undefined>, v.DescriptionAction<"10" | "20" | "40", "Core's account type code: `\"10\"` savings, `\"20\"` checking, `\"40\"` debit (cuenta vista).">]>;
|
|
90
|
+
readonly account_number: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MinLengthAction<string, 1, undefined>, v.MaxLengthAction<string, 64, undefined>, v.DescriptionAction<string, "The account number, as its bank writes it.">]>;
|
|
91
|
+
readonly name: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MinLengthAction<string, 1, undefined>, v.DescriptionAction<string, "The holder's name. Core stores it as it arrives and never compares it.">]>;
|
|
92
|
+
readonly national_kind_id: v.LiteralSchema<"RUT", undefined>;
|
|
93
|
+
readonly national_id: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MinLengthAction<string, 1, undefined>, v.MaxLengthAction<string, 64, undefined>, v.DescriptionAction<string, "The holder's RUT. Core compares it as a normalized RUT.">]>;
|
|
94
|
+
}, undefined>], undefined>, v.DescriptionAction<{
|
|
95
|
+
amount: number;
|
|
96
|
+
currency: "CLP";
|
|
97
|
+
email?: string | undefined;
|
|
98
|
+
country: "CL";
|
|
99
|
+
bank_code: string;
|
|
100
|
+
account_type: "10" | "20" | "40";
|
|
101
|
+
account_number: string;
|
|
102
|
+
name: string;
|
|
103
|
+
national_kind_id: "RUT";
|
|
104
|
+
national_id: string;
|
|
105
|
+
}, "The Receptor, as Core's `receiver`: the account the money lands on, its holder, and the amount, an integer in the minor unit of the currency. `country` and `national_kind_id` are always declared.">]>;
|
|
106
|
+
readonly comment: v.SchemaWithPipe<readonly [v.OptionalSchema<v.StringSchema<undefined>, undefined>, v.DescriptionAction<string | undefined, "The signed comment, when there is one.">]>;
|
|
107
|
+
readonly created_at: v.SchemaWithPipe<readonly [v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.IsoTimestampAction<string, undefined>]>, v.DescriptionAction<string, "When the Transfer was uploaded.">]>;
|
|
108
|
+
readonly expires_at: v.SchemaWithPipe<readonly [v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.IsoTimestampAction<string, undefined>]>, v.DescriptionAction<string, "The Transfer's deadline: the signature's `exp`. A transfer still waiting for its approval at this instant expires.">]>;
|
|
109
|
+
}, undefined>, v.DescriptionAction<{
|
|
110
|
+
object: "transfer";
|
|
111
|
+
id: string;
|
|
112
|
+
jti: string;
|
|
113
|
+
status: "succeeded" | "failed" | "cancelled" | "rejected" | "expired" | "requires_action" | "processing.confirmed" | "processing.settling" | "processing.reversing" | "processing.reconciling" | "processing.opening" | "processing.closing" | "failed.insufficient_funds" | "failed.fraud_rejected" | "failed.bank_refused" | "failed.bank_rejected" | "failed.bank_review_required" | "failed.own_account_transfer_not_implemented" | "failed.bank_challenge_required" | "failed.unknown_key" | "failed.revoked_key" | "failed.expired_key" | "failed.invalid_signature" | "failed.expired_signed_instruction" | "failed.sender_mismatch" | "failed.bank_authorization_denied" | "failed.bank_holder_without_account" | "failed.bank_account_limit_reached" | "failed.account_opening_not_implemented" | "failed.bank_core_unavailable" | "failed.bank_account_save_failed" | "failed.bank_connection_unavailable" | "failed.bank_account_quota_exceeded" | "failed.account_key_taken" | "failed.bank_account_not_found" | "failed.bank_account_balance_not_zero" | "cancelled.grant_revoked" | "cancelled.grant_expired";
|
|
114
|
+
core_status: string | null;
|
|
115
|
+
approved: boolean;
|
|
116
|
+
sender: {
|
|
117
|
+
country: "CL";
|
|
118
|
+
bank_code: string;
|
|
119
|
+
account_type: "10" | "20" | "40";
|
|
120
|
+
account_number: string;
|
|
121
|
+
name: string;
|
|
122
|
+
national_kind_id: "RUT";
|
|
123
|
+
national_id: string;
|
|
124
|
+
};
|
|
125
|
+
receiver: {
|
|
126
|
+
amount: number;
|
|
127
|
+
currency: "CLP";
|
|
128
|
+
email?: string | undefined;
|
|
129
|
+
country: "CL";
|
|
130
|
+
bank_code: string;
|
|
131
|
+
account_type: "10" | "20" | "40";
|
|
132
|
+
account_number: string;
|
|
133
|
+
name: string;
|
|
134
|
+
national_kind_id: "RUT";
|
|
135
|
+
national_id: string;
|
|
136
|
+
};
|
|
137
|
+
comment?: string | undefined;
|
|
138
|
+
created_at: string;
|
|
139
|
+
expires_at: string;
|
|
140
|
+
}, "A Transfer uploaded as a Signed Instruction (ADR 0093), in Core's vocabulary: `sender`, `receiver` (with the amount, an integer in the minor unit of the currency) and `comment` exactly as signed. `status` is where it stands; `core_status` the core's own word, for the record.">]>;
|
|
141
|
+
/** A Transfer uploaded as a Signed Instruction. */
|
|
142
|
+
export type Transfer = v.InferOutput<typeof Transfer>;
|
|
143
|
+
/** Uploads a signed transfer: one General JSON JWS (`application/jose+json`), one Transfer. */
|
|
144
|
+
export declare const createTransfer: import("@orpc/contract").ProcedureContractBuilderWithInputOutput<v.SchemaWithPipe<readonly [v.StrictObjectSchema<{
|
|
145
|
+
readonly payload: v.SchemaWithPipe<readonly [v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.RegexAction<string, undefined>]>, v.DescriptionAction<string, "The base64url of the JSON claims (`SignedTransferClaims`).">]>;
|
|
146
|
+
readonly signatures: v.SchemaWithPipe<readonly [v.ArraySchema<v.StrictObjectSchema<{
|
|
147
|
+
readonly protected: v.SchemaWithPipe<readonly [v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.RegexAction<string, undefined>]>, v.DescriptionAction<string, "The base64url of the JSON protected header (`SignedTransferHeader`).">]>;
|
|
148
|
+
readonly signature: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.RegexAction<string, undefined>]>;
|
|
149
|
+
}, undefined>, undefined>, v.MinLengthAction<{
|
|
150
|
+
protected: string;
|
|
151
|
+
signature: string;
|
|
152
|
+
}[], 1, undefined>, v.DescriptionAction<{
|
|
153
|
+
protected: string;
|
|
154
|
+
signature: string;
|
|
155
|
+
}[], "At least one signature over the same payload; the core verifies every one.">]>;
|
|
156
|
+
}, undefined>, v.DescriptionAction<{
|
|
157
|
+
payload: string;
|
|
158
|
+
signatures: {
|
|
159
|
+
protected: string;
|
|
160
|
+
signature: string;
|
|
161
|
+
}[];
|
|
162
|
+
}, "A signed transfer: a JWS in the General JSON Serialization (RFC 7515 §7.2.1), with one `payload` and at least one signature, each with a protected header of `typ` `transfer.v1+jwt`. Sent as `application/jose+json`.">]>, v.SchemaWithPipe<readonly [v.StrictObjectSchema<{
|
|
163
|
+
readonly object: v.LiteralSchema<"transfer", undefined>;
|
|
164
|
+
readonly id: v.SchemaWithPipe<readonly [v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.UuidAction<string, undefined>]>, v.DescriptionAction<string, "The Transfer's own id: what `GET /transfers/{transfer_id}` reads.">]>;
|
|
165
|
+
readonly jti: v.SchemaWithPipe<readonly [v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.UuidAction<string, undefined>]>, v.DescriptionAction<string, "The `jti` of the Signed Instruction that uploaded it. Sending the same instruction again answers this same Transfer.">]>;
|
|
166
|
+
readonly status: v.SchemaWithPipe<readonly [v.SchemaWithPipe<readonly [v.PicklistSchema<["requires_action", "processing.confirmed", "processing.settling", "processing.reversing", "processing.reconciling", "processing.opening", "processing.closing", "succeeded", "failed", "failed.insufficient_funds", "failed.fraud_rejected", "failed.bank_refused", "failed.bank_rejected", "failed.bank_review_required", "failed.own_account_transfer_not_implemented", "failed.bank_challenge_required", "failed.unknown_key", "failed.revoked_key", "failed.expired_key", "failed.invalid_signature", "failed.expired_signed_instruction", "failed.sender_mismatch", "failed.bank_authorization_denied", "failed.bank_holder_without_account", "failed.bank_account_limit_reached", "failed.account_opening_not_implemented", "failed.bank_core_unavailable", "failed.bank_account_save_failed", "failed.bank_connection_unavailable", "failed.bank_account_quota_exceeded", "failed.account_key_taken", "failed.bank_account_not_found", "failed.bank_account_balance_not_zero", "cancelled", "cancelled.grant_revoked", "cancelled.grant_expired", "rejected", "expired"], undefined>, v.DescriptionAction<"succeeded" | "failed" | "cancelled" | "rejected" | "expired" | "requires_action" | "processing.confirmed" | "processing.settling" | "processing.reversing" | "processing.reconciling" | "processing.opening" | "processing.closing" | "failed.insufficient_funds" | "failed.fraud_rejected" | "failed.bank_refused" | "failed.bank_rejected" | "failed.bank_review_required" | "failed.own_account_transfer_not_implemented" | "failed.bank_challenge_required" | "failed.unknown_key" | "failed.revoked_key" | "failed.expired_key" | "failed.invalid_signature" | "failed.expired_signed_instruction" | "failed.sender_mismatch" | "failed.bank_authorization_denied" | "failed.bank_holder_without_account" | "failed.bank_account_limit_reached" | "failed.account_opening_not_implemented" | "failed.bank_core_unavailable" | "failed.bank_account_save_failed" | "failed.bank_connection_unavailable" | "failed.bank_account_quota_exceeded" | "failed.account_key_taken" | "failed.bank_account_not_found" | "failed.bank_account_balance_not_zero" | "cancelled.grant_revoked" | "cancelled.grant_expired", "`<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 AndPass or typing the SMS code does not change its status. It becomes `processing.confirmed`, and `transfer.confirmed` is published once, when AndCo 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 AndCo 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 AndCo 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). A signed Transfer that leaves its holder (`POST /transfers`, ADR 0092) is never confirmed by a person: it also fails with `failed.bank_challenge_required` (the bank's fraud engine asked for a challenge nobody answers for a signature; send the same transfer as an Intent a person confirms) or with the core's refusal of its signature, in the words the upload uses: `failed.unknown_key` (the core holds no such key), `failed.revoked_key`, `failed.invalid_signature`, `failed.expired_signed_instruction` (its `exp` passed before the core executed it) and `failed.sender_mismatch`. A signed Transfer on either rail also fails, before anything is sent, when a key that signed it is no longer usable as it executes, even if it was at upload: `failed.revoked_key`, `failed.expired_key`, or `failed.unknown_key` (no Project of the holder has it any more, or, for one that leaves its holder, the core no longer holds it). In `failed.fraud_rejected`, `failed.bank_refused`, `failed.own_account_transfer_not_implemented`, `failed.bank_challenge_required`, `failed.expired_key` and the core's refusals of a signature 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.">]>, v.DescriptionAction<"succeeded" | "failed" | "cancelled" | "rejected" | "expired" | "requires_action" | "processing.confirmed" | "processing.settling" | "processing.reversing" | "processing.reconciling" | "processing.opening" | "processing.closing" | "failed.insufficient_funds" | "failed.fraud_rejected" | "failed.bank_refused" | "failed.bank_rejected" | "failed.bank_review_required" | "failed.own_account_transfer_not_implemented" | "failed.bank_challenge_required" | "failed.unknown_key" | "failed.revoked_key" | "failed.expired_key" | "failed.invalid_signature" | "failed.expired_signed_instruction" | "failed.sender_mismatch" | "failed.bank_authorization_denied" | "failed.bank_holder_without_account" | "failed.bank_account_limit_reached" | "failed.account_opening_not_implemented" | "failed.bank_core_unavailable" | "failed.bank_account_save_failed" | "failed.bank_connection_unavailable" | "failed.bank_account_quota_exceeded" | "failed.account_key_taken" | "failed.bank_account_not_found" | "failed.bank_account_balance_not_zero" | "cancelled.grant_revoked" | "cancelled.grant_expired", "Where the Transfer stands, in the words an Intent uses (`IntentStatus`): decide on the base, never on the whole value. A signed transfer that is not approved is `requires_action` until a Grant with `bank_transfer` `approve` or a person approves it. A transfer between two accounts of the same holder is `processing.confirmed` from its release until AndCo answers for good, then `succeeded` or `failed.<code>`.">]>;
|
|
167
|
+
readonly core_status: v.SchemaWithPipe<readonly [v.NullableSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MinLengthAction<string, 1, undefined>]>, undefined>, v.DescriptionAction<string | null, "The core bancario's own word for its transfer (`requested`, `confirmed`, `rejected_insufficient_funds`, …), for the record. Null while AndCo has not read one. Never branch on it: a word the core adds later appears here as it is, and `status` is what to decide on.">]>;
|
|
168
|
+
readonly approved: v.SchemaWithPipe<readonly [v.BooleanSchema<undefined>, v.DescriptionAction<boolean, "The signed `approved`: whether the instruction ordered the transfer sent as soon as it was uploaded.">]>;
|
|
169
|
+
readonly sender: v.SchemaWithPipe<readonly [v.VariantSchema<"country", [v.StrictObjectSchema<{
|
|
170
|
+
country: v.LiteralSchema<"CL", undefined>;
|
|
171
|
+
bank_code: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.RegexAction<string, undefined>, v.DescriptionAction<string, "The bank's four-digit code in Core's catalog. Andco is `0739`.">]>;
|
|
172
|
+
account_type: v.SchemaWithPipe<readonly [v.PicklistSchema<["10", "20", "40"], undefined>, v.DescriptionAction<"10" | "20" | "40", "Core's account type code: `\"10\"` savings, `\"20\"` checking, `\"40\"` debit (cuenta vista).">]>;
|
|
173
|
+
account_number: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MinLengthAction<string, 1, undefined>, v.MaxLengthAction<string, 64, undefined>, v.DescriptionAction<string, "The account number, as its bank writes it.">]>;
|
|
174
|
+
name: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MinLengthAction<string, 1, undefined>, v.DescriptionAction<string, "The holder's name. Core stores it as it arrives and never compares it.">]>;
|
|
175
|
+
national_kind_id: v.LiteralSchema<"RUT", undefined>;
|
|
176
|
+
national_id: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MinLengthAction<string, 1, undefined>, v.MaxLengthAction<string, 64, undefined>, v.DescriptionAction<string, "The holder's RUT. Core compares it as a normalized RUT.">]>;
|
|
177
|
+
}, undefined>], undefined>, v.DescriptionAction<{
|
|
178
|
+
country: "CL";
|
|
179
|
+
bank_code: string;
|
|
180
|
+
account_type: "10" | "20" | "40";
|
|
181
|
+
account_number: string;
|
|
182
|
+
name: string;
|
|
183
|
+
national_kind_id: "RUT";
|
|
184
|
+
national_id: string;
|
|
185
|
+
}, "The Remitente, as Core's `sender`: the account the money leaves and its holder. `country` and `national_kind_id` are always declared. Core checks the country, the bank (`0739`), the account's own type and the holder's RUT; it stores `name` as it arrives.">]>;
|
|
186
|
+
readonly receiver: v.SchemaWithPipe<readonly [v.VariantSchema<"country", [v.StrictObjectSchema<{
|
|
187
|
+
readonly amount: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.IntegerAction<number, undefined>, v.MinValueAction<number, 1, undefined>, v.MaxValueAction<number, 2147483647, undefined>, v.DescriptionAction<number, "An integer in the minor unit of the currency (CLP: whole pesos), from 1 to 2147483647, because Core stores it as int4. A larger one is refused with `max_value`.">]>;
|
|
188
|
+
readonly currency: v.LiteralSchema<"CLP", undefined>;
|
|
189
|
+
readonly email: v.SchemaWithPipe<readonly [v.OptionalSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.EmailAction<string, undefined>]>, undefined>, v.DescriptionAction<string | undefined, "Where Core notifies the Receptor.">]>;
|
|
190
|
+
readonly country: v.LiteralSchema<"CL", undefined>;
|
|
191
|
+
readonly bank_code: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.RegexAction<string, undefined>, v.DescriptionAction<string, "The bank's four-digit code in Core's catalog. Andco is `0739`.">]>;
|
|
192
|
+
readonly account_type: v.SchemaWithPipe<readonly [v.PicklistSchema<["10", "20", "40"], undefined>, v.DescriptionAction<"10" | "20" | "40", "Core's account type code: `\"10\"` savings, `\"20\"` checking, `\"40\"` debit (cuenta vista).">]>;
|
|
193
|
+
readonly account_number: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MinLengthAction<string, 1, undefined>, v.MaxLengthAction<string, 64, undefined>, v.DescriptionAction<string, "The account number, as its bank writes it.">]>;
|
|
194
|
+
readonly name: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MinLengthAction<string, 1, undefined>, v.DescriptionAction<string, "The holder's name. Core stores it as it arrives and never compares it.">]>;
|
|
195
|
+
readonly national_kind_id: v.LiteralSchema<"RUT", undefined>;
|
|
196
|
+
readonly national_id: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MinLengthAction<string, 1, undefined>, v.MaxLengthAction<string, 64, undefined>, v.DescriptionAction<string, "The holder's RUT. Core compares it as a normalized RUT.">]>;
|
|
197
|
+
}, undefined>], undefined>, v.DescriptionAction<{
|
|
198
|
+
amount: number;
|
|
199
|
+
currency: "CLP";
|
|
200
|
+
email?: string | undefined;
|
|
201
|
+
country: "CL";
|
|
202
|
+
bank_code: string;
|
|
203
|
+
account_type: "10" | "20" | "40";
|
|
204
|
+
account_number: string;
|
|
205
|
+
name: string;
|
|
206
|
+
national_kind_id: "RUT";
|
|
207
|
+
national_id: string;
|
|
208
|
+
}, "The Receptor, as Core's `receiver`: the account the money lands on, its holder, and the amount, an integer in the minor unit of the currency. `country` and `national_kind_id` are always declared.">]>;
|
|
209
|
+
readonly comment: v.SchemaWithPipe<readonly [v.OptionalSchema<v.StringSchema<undefined>, undefined>, v.DescriptionAction<string | undefined, "The signed comment, when there is one.">]>;
|
|
210
|
+
readonly created_at: v.SchemaWithPipe<readonly [v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.IsoTimestampAction<string, undefined>]>, v.DescriptionAction<string, "When the Transfer was uploaded.">]>;
|
|
211
|
+
readonly expires_at: v.SchemaWithPipe<readonly [v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.IsoTimestampAction<string, undefined>]>, v.DescriptionAction<string, "The Transfer's deadline: the signature's `exp`. A transfer still waiting for its approval at this instant expires.">]>;
|
|
212
|
+
}, undefined>, v.DescriptionAction<{
|
|
213
|
+
object: "transfer";
|
|
214
|
+
id: string;
|
|
215
|
+
jti: string;
|
|
216
|
+
status: "succeeded" | "failed" | "cancelled" | "rejected" | "expired" | "requires_action" | "processing.confirmed" | "processing.settling" | "processing.reversing" | "processing.reconciling" | "processing.opening" | "processing.closing" | "failed.insufficient_funds" | "failed.fraud_rejected" | "failed.bank_refused" | "failed.bank_rejected" | "failed.bank_review_required" | "failed.own_account_transfer_not_implemented" | "failed.bank_challenge_required" | "failed.unknown_key" | "failed.revoked_key" | "failed.expired_key" | "failed.invalid_signature" | "failed.expired_signed_instruction" | "failed.sender_mismatch" | "failed.bank_authorization_denied" | "failed.bank_holder_without_account" | "failed.bank_account_limit_reached" | "failed.account_opening_not_implemented" | "failed.bank_core_unavailable" | "failed.bank_account_save_failed" | "failed.bank_connection_unavailable" | "failed.bank_account_quota_exceeded" | "failed.account_key_taken" | "failed.bank_account_not_found" | "failed.bank_account_balance_not_zero" | "cancelled.grant_revoked" | "cancelled.grant_expired";
|
|
217
|
+
core_status: string | null;
|
|
218
|
+
approved: boolean;
|
|
219
|
+
sender: {
|
|
220
|
+
country: "CL";
|
|
221
|
+
bank_code: string;
|
|
222
|
+
account_type: "10" | "20" | "40";
|
|
223
|
+
account_number: string;
|
|
224
|
+
name: string;
|
|
225
|
+
national_kind_id: "RUT";
|
|
226
|
+
national_id: string;
|
|
227
|
+
};
|
|
228
|
+
receiver: {
|
|
229
|
+
amount: number;
|
|
230
|
+
currency: "CLP";
|
|
231
|
+
email?: string | undefined;
|
|
232
|
+
country: "CL";
|
|
233
|
+
bank_code: string;
|
|
234
|
+
account_type: "10" | "20" | "40";
|
|
235
|
+
account_number: string;
|
|
236
|
+
name: string;
|
|
237
|
+
national_kind_id: "RUT";
|
|
238
|
+
national_id: string;
|
|
239
|
+
};
|
|
240
|
+
comment?: string | undefined;
|
|
241
|
+
created_at: string;
|
|
242
|
+
expires_at: string;
|
|
243
|
+
}, "A Transfer uploaded as a Signed Instruction (ADR 0093), in Core's vocabulary: `sender`, `receiver` (with the amount, an integer in the minor unit of the currency) and `comment` exactly as signed. `status` is where it stands; `core_status` the core's own word, for the record.">]>, import("./api-error.js").AndcoAPIErrorMap<readonly [typeof InvalidRequest, typeof IdempotencyKeyNotAllowed, typeof InvalidSignedInstruction, typeof InvalidToken, typeof ExpiredSignedInstruction, typeof InvalidOrigin, typeof InsufficientAuthorization, typeof UnsupportedVersion, typeof ServerError, typeof IdempotencyConflict, typeof IntentInteractionRequired, typeof PayloadTooLarge, typeof UnsupportedMediaType, typeof SenderMismatch, typeof TransferSenderIdentityUnavailable, typeof AmountOutOfGrant, typeof InvalidSource, typeof InvalidDestination, typeof BankConnectionUnavailable, typeof BankRefused, typeof InsufficientFunds, typeof BankRejected, typeof BankReviewRequired, typeof NotImplemented, typeof TemporarilyUnavailable]>>;
|
|
244
|
+
/** Reads one Transfer uploaded under the same exact OAuth Grant. */
|
|
245
|
+
export declare const getTransfer: import("@orpc/contract").ProcedureContractBuilderWithInputOutput<v.ObjectSchema<{
|
|
246
|
+
readonly transfer_id: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.UuidAction<string, undefined>]>;
|
|
247
|
+
}, undefined>, v.SchemaWithPipe<readonly [v.StrictObjectSchema<{
|
|
248
|
+
readonly object: v.LiteralSchema<"transfer", undefined>;
|
|
249
|
+
readonly id: v.SchemaWithPipe<readonly [v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.UuidAction<string, undefined>]>, v.DescriptionAction<string, "The Transfer's own id: what `GET /transfers/{transfer_id}` reads.">]>;
|
|
250
|
+
readonly jti: v.SchemaWithPipe<readonly [v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.UuidAction<string, undefined>]>, v.DescriptionAction<string, "The `jti` of the Signed Instruction that uploaded it. Sending the same instruction again answers this same Transfer.">]>;
|
|
251
|
+
readonly status: v.SchemaWithPipe<readonly [v.SchemaWithPipe<readonly [v.PicklistSchema<["requires_action", "processing.confirmed", "processing.settling", "processing.reversing", "processing.reconciling", "processing.opening", "processing.closing", "succeeded", "failed", "failed.insufficient_funds", "failed.fraud_rejected", "failed.bank_refused", "failed.bank_rejected", "failed.bank_review_required", "failed.own_account_transfer_not_implemented", "failed.bank_challenge_required", "failed.unknown_key", "failed.revoked_key", "failed.expired_key", "failed.invalid_signature", "failed.expired_signed_instruction", "failed.sender_mismatch", "failed.bank_authorization_denied", "failed.bank_holder_without_account", "failed.bank_account_limit_reached", "failed.account_opening_not_implemented", "failed.bank_core_unavailable", "failed.bank_account_save_failed", "failed.bank_connection_unavailable", "failed.bank_account_quota_exceeded", "failed.account_key_taken", "failed.bank_account_not_found", "failed.bank_account_balance_not_zero", "cancelled", "cancelled.grant_revoked", "cancelled.grant_expired", "rejected", "expired"], undefined>, v.DescriptionAction<"succeeded" | "failed" | "cancelled" | "rejected" | "expired" | "requires_action" | "processing.confirmed" | "processing.settling" | "processing.reversing" | "processing.reconciling" | "processing.opening" | "processing.closing" | "failed.insufficient_funds" | "failed.fraud_rejected" | "failed.bank_refused" | "failed.bank_rejected" | "failed.bank_review_required" | "failed.own_account_transfer_not_implemented" | "failed.bank_challenge_required" | "failed.unknown_key" | "failed.revoked_key" | "failed.expired_key" | "failed.invalid_signature" | "failed.expired_signed_instruction" | "failed.sender_mismatch" | "failed.bank_authorization_denied" | "failed.bank_holder_without_account" | "failed.bank_account_limit_reached" | "failed.account_opening_not_implemented" | "failed.bank_core_unavailable" | "failed.bank_account_save_failed" | "failed.bank_connection_unavailable" | "failed.bank_account_quota_exceeded" | "failed.account_key_taken" | "failed.bank_account_not_found" | "failed.bank_account_balance_not_zero" | "cancelled.grant_revoked" | "cancelled.grant_expired", "`<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 AndPass or typing the SMS code does not change its status. It becomes `processing.confirmed`, and `transfer.confirmed` is published once, when AndCo 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 AndCo 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 AndCo 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). A signed Transfer that leaves its holder (`POST /transfers`, ADR 0092) is never confirmed by a person: it also fails with `failed.bank_challenge_required` (the bank's fraud engine asked for a challenge nobody answers for a signature; send the same transfer as an Intent a person confirms) or with the core's refusal of its signature, in the words the upload uses: `failed.unknown_key` (the core holds no such key), `failed.revoked_key`, `failed.invalid_signature`, `failed.expired_signed_instruction` (its `exp` passed before the core executed it) and `failed.sender_mismatch`. A signed Transfer on either rail also fails, before anything is sent, when a key that signed it is no longer usable as it executes, even if it was at upload: `failed.revoked_key`, `failed.expired_key`, or `failed.unknown_key` (no Project of the holder has it any more, or, for one that leaves its holder, the core no longer holds it). In `failed.fraud_rejected`, `failed.bank_refused`, `failed.own_account_transfer_not_implemented`, `failed.bank_challenge_required`, `failed.expired_key` and the core's refusals of a signature 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.">]>, v.DescriptionAction<"succeeded" | "failed" | "cancelled" | "rejected" | "expired" | "requires_action" | "processing.confirmed" | "processing.settling" | "processing.reversing" | "processing.reconciling" | "processing.opening" | "processing.closing" | "failed.insufficient_funds" | "failed.fraud_rejected" | "failed.bank_refused" | "failed.bank_rejected" | "failed.bank_review_required" | "failed.own_account_transfer_not_implemented" | "failed.bank_challenge_required" | "failed.unknown_key" | "failed.revoked_key" | "failed.expired_key" | "failed.invalid_signature" | "failed.expired_signed_instruction" | "failed.sender_mismatch" | "failed.bank_authorization_denied" | "failed.bank_holder_without_account" | "failed.bank_account_limit_reached" | "failed.account_opening_not_implemented" | "failed.bank_core_unavailable" | "failed.bank_account_save_failed" | "failed.bank_connection_unavailable" | "failed.bank_account_quota_exceeded" | "failed.account_key_taken" | "failed.bank_account_not_found" | "failed.bank_account_balance_not_zero" | "cancelled.grant_revoked" | "cancelled.grant_expired", "Where the Transfer stands, in the words an Intent uses (`IntentStatus`): decide on the base, never on the whole value. A signed transfer that is not approved is `requires_action` until a Grant with `bank_transfer` `approve` or a person approves it. A transfer between two accounts of the same holder is `processing.confirmed` from its release until AndCo answers for good, then `succeeded` or `failed.<code>`.">]>;
|
|
252
|
+
readonly core_status: v.SchemaWithPipe<readonly [v.NullableSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MinLengthAction<string, 1, undefined>]>, undefined>, v.DescriptionAction<string | null, "The core bancario's own word for its transfer (`requested`, `confirmed`, `rejected_insufficient_funds`, …), for the record. Null while AndCo has not read one. Never branch on it: a word the core adds later appears here as it is, and `status` is what to decide on.">]>;
|
|
253
|
+
readonly approved: v.SchemaWithPipe<readonly [v.BooleanSchema<undefined>, v.DescriptionAction<boolean, "The signed `approved`: whether the instruction ordered the transfer sent as soon as it was uploaded.">]>;
|
|
254
|
+
readonly sender: v.SchemaWithPipe<readonly [v.VariantSchema<"country", [v.StrictObjectSchema<{
|
|
255
|
+
country: v.LiteralSchema<"CL", undefined>;
|
|
256
|
+
bank_code: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.RegexAction<string, undefined>, v.DescriptionAction<string, "The bank's four-digit code in Core's catalog. Andco is `0739`.">]>;
|
|
257
|
+
account_type: v.SchemaWithPipe<readonly [v.PicklistSchema<["10", "20", "40"], undefined>, v.DescriptionAction<"10" | "20" | "40", "Core's account type code: `\"10\"` savings, `\"20\"` checking, `\"40\"` debit (cuenta vista).">]>;
|
|
258
|
+
account_number: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MinLengthAction<string, 1, undefined>, v.MaxLengthAction<string, 64, undefined>, v.DescriptionAction<string, "The account number, as its bank writes it.">]>;
|
|
259
|
+
name: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MinLengthAction<string, 1, undefined>, v.DescriptionAction<string, "The holder's name. Core stores it as it arrives and never compares it.">]>;
|
|
260
|
+
national_kind_id: v.LiteralSchema<"RUT", undefined>;
|
|
261
|
+
national_id: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MinLengthAction<string, 1, undefined>, v.MaxLengthAction<string, 64, undefined>, v.DescriptionAction<string, "The holder's RUT. Core compares it as a normalized RUT.">]>;
|
|
262
|
+
}, undefined>], undefined>, v.DescriptionAction<{
|
|
263
|
+
country: "CL";
|
|
264
|
+
bank_code: string;
|
|
265
|
+
account_type: "10" | "20" | "40";
|
|
266
|
+
account_number: string;
|
|
267
|
+
name: string;
|
|
268
|
+
national_kind_id: "RUT";
|
|
269
|
+
national_id: string;
|
|
270
|
+
}, "The Remitente, as Core's `sender`: the account the money leaves and its holder. `country` and `national_kind_id` are always declared. Core checks the country, the bank (`0739`), the account's own type and the holder's RUT; it stores `name` as it arrives.">]>;
|
|
271
|
+
readonly receiver: v.SchemaWithPipe<readonly [v.VariantSchema<"country", [v.StrictObjectSchema<{
|
|
272
|
+
readonly amount: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.IntegerAction<number, undefined>, v.MinValueAction<number, 1, undefined>, v.MaxValueAction<number, 2147483647, undefined>, v.DescriptionAction<number, "An integer in the minor unit of the currency (CLP: whole pesos), from 1 to 2147483647, because Core stores it as int4. A larger one is refused with `max_value`.">]>;
|
|
273
|
+
readonly currency: v.LiteralSchema<"CLP", undefined>;
|
|
274
|
+
readonly email: v.SchemaWithPipe<readonly [v.OptionalSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.EmailAction<string, undefined>]>, undefined>, v.DescriptionAction<string | undefined, "Where Core notifies the Receptor.">]>;
|
|
275
|
+
readonly country: v.LiteralSchema<"CL", undefined>;
|
|
276
|
+
readonly bank_code: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.RegexAction<string, undefined>, v.DescriptionAction<string, "The bank's four-digit code in Core's catalog. Andco is `0739`.">]>;
|
|
277
|
+
readonly account_type: v.SchemaWithPipe<readonly [v.PicklistSchema<["10", "20", "40"], undefined>, v.DescriptionAction<"10" | "20" | "40", "Core's account type code: `\"10\"` savings, `\"20\"` checking, `\"40\"` debit (cuenta vista).">]>;
|
|
278
|
+
readonly account_number: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MinLengthAction<string, 1, undefined>, v.MaxLengthAction<string, 64, undefined>, v.DescriptionAction<string, "The account number, as its bank writes it.">]>;
|
|
279
|
+
readonly name: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MinLengthAction<string, 1, undefined>, v.DescriptionAction<string, "The holder's name. Core stores it as it arrives and never compares it.">]>;
|
|
280
|
+
readonly national_kind_id: v.LiteralSchema<"RUT", undefined>;
|
|
281
|
+
readonly national_id: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MinLengthAction<string, 1, undefined>, v.MaxLengthAction<string, 64, undefined>, v.DescriptionAction<string, "The holder's RUT. Core compares it as a normalized RUT.">]>;
|
|
282
|
+
}, undefined>], undefined>, v.DescriptionAction<{
|
|
283
|
+
amount: number;
|
|
284
|
+
currency: "CLP";
|
|
285
|
+
email?: string | undefined;
|
|
286
|
+
country: "CL";
|
|
287
|
+
bank_code: string;
|
|
288
|
+
account_type: "10" | "20" | "40";
|
|
289
|
+
account_number: string;
|
|
290
|
+
name: string;
|
|
291
|
+
national_kind_id: "RUT";
|
|
292
|
+
national_id: string;
|
|
293
|
+
}, "The Receptor, as Core's `receiver`: the account the money lands on, its holder, and the amount, an integer in the minor unit of the currency. `country` and `national_kind_id` are always declared.">]>;
|
|
294
|
+
readonly comment: v.SchemaWithPipe<readonly [v.OptionalSchema<v.StringSchema<undefined>, undefined>, v.DescriptionAction<string | undefined, "The signed comment, when there is one.">]>;
|
|
295
|
+
readonly created_at: v.SchemaWithPipe<readonly [v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.IsoTimestampAction<string, undefined>]>, v.DescriptionAction<string, "When the Transfer was uploaded.">]>;
|
|
296
|
+
readonly expires_at: v.SchemaWithPipe<readonly [v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.IsoTimestampAction<string, undefined>]>, v.DescriptionAction<string, "The Transfer's deadline: the signature's `exp`. A transfer still waiting for its approval at this instant expires.">]>;
|
|
297
|
+
}, undefined>, v.DescriptionAction<{
|
|
298
|
+
object: "transfer";
|
|
299
|
+
id: string;
|
|
300
|
+
jti: string;
|
|
301
|
+
status: "succeeded" | "failed" | "cancelled" | "rejected" | "expired" | "requires_action" | "processing.confirmed" | "processing.settling" | "processing.reversing" | "processing.reconciling" | "processing.opening" | "processing.closing" | "failed.insufficient_funds" | "failed.fraud_rejected" | "failed.bank_refused" | "failed.bank_rejected" | "failed.bank_review_required" | "failed.own_account_transfer_not_implemented" | "failed.bank_challenge_required" | "failed.unknown_key" | "failed.revoked_key" | "failed.expired_key" | "failed.invalid_signature" | "failed.expired_signed_instruction" | "failed.sender_mismatch" | "failed.bank_authorization_denied" | "failed.bank_holder_without_account" | "failed.bank_account_limit_reached" | "failed.account_opening_not_implemented" | "failed.bank_core_unavailable" | "failed.bank_account_save_failed" | "failed.bank_connection_unavailable" | "failed.bank_account_quota_exceeded" | "failed.account_key_taken" | "failed.bank_account_not_found" | "failed.bank_account_balance_not_zero" | "cancelled.grant_revoked" | "cancelled.grant_expired";
|
|
302
|
+
core_status: string | null;
|
|
303
|
+
approved: boolean;
|
|
304
|
+
sender: {
|
|
305
|
+
country: "CL";
|
|
306
|
+
bank_code: string;
|
|
307
|
+
account_type: "10" | "20" | "40";
|
|
308
|
+
account_number: string;
|
|
309
|
+
name: string;
|
|
310
|
+
national_kind_id: "RUT";
|
|
311
|
+
national_id: string;
|
|
312
|
+
};
|
|
313
|
+
receiver: {
|
|
314
|
+
amount: number;
|
|
315
|
+
currency: "CLP";
|
|
316
|
+
email?: string | undefined;
|
|
317
|
+
country: "CL";
|
|
318
|
+
bank_code: string;
|
|
319
|
+
account_type: "10" | "20" | "40";
|
|
320
|
+
account_number: string;
|
|
321
|
+
name: string;
|
|
322
|
+
national_kind_id: "RUT";
|
|
323
|
+
national_id: string;
|
|
324
|
+
};
|
|
325
|
+
comment?: string | undefined;
|
|
326
|
+
created_at: string;
|
|
327
|
+
expires_at: string;
|
|
328
|
+
}, "A Transfer uploaded as a Signed Instruction (ADR 0093), in Core's vocabulary: `sender`, `receiver` (with the amount, an integer in the minor unit of the currency) and `comment` exactly as signed. `status` is where it stands; `core_status` the core's own word, for the record.">]>, import("./api-error.js").AndcoAPIErrorMap<readonly [typeof InvalidIdentifier, typeof InvalidToken, typeof InvalidOrigin, typeof NotFound, typeof UnsupportedVersion, typeof ServerError, typeof TemporarilyUnavailable]>>;
|
|
329
|
+
/**
|
|
330
|
+
* A page of Transfers. Today the only way to get one is `GET /transfers?jti=`, so it holds zero or one
|
|
331
|
+
* edge; a full listing can come later in the same shape.
|
|
332
|
+
*/
|
|
333
|
+
export declare const TransferPage: v.SchemaWithPipe<readonly [v.StrictObjectSchema<{
|
|
334
|
+
readonly edges: v.ArraySchema<v.StrictObjectSchema<{
|
|
335
|
+
readonly cursor: v.NullableSchema<v.StringSchema<undefined>, undefined>;
|
|
336
|
+
readonly node: v.SchemaWithPipe<readonly [v.StrictObjectSchema<{
|
|
337
|
+
readonly object: v.LiteralSchema<"transfer", undefined>;
|
|
338
|
+
readonly id: v.SchemaWithPipe<readonly [v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.UuidAction<string, undefined>]>, v.DescriptionAction<string, "The Transfer's own id: what `GET /transfers/{transfer_id}` reads.">]>;
|
|
339
|
+
readonly jti: v.SchemaWithPipe<readonly [v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.UuidAction<string, undefined>]>, v.DescriptionAction<string, "The `jti` of the Signed Instruction that uploaded it. Sending the same instruction again answers this same Transfer.">]>;
|
|
340
|
+
readonly status: v.SchemaWithPipe<readonly [v.SchemaWithPipe<readonly [v.PicklistSchema<["requires_action", "processing.confirmed", "processing.settling", "processing.reversing", "processing.reconciling", "processing.opening", "processing.closing", "succeeded", "failed", "failed.insufficient_funds", "failed.fraud_rejected", "failed.bank_refused", "failed.bank_rejected", "failed.bank_review_required", "failed.own_account_transfer_not_implemented", "failed.bank_challenge_required", "failed.unknown_key", "failed.revoked_key", "failed.expired_key", "failed.invalid_signature", "failed.expired_signed_instruction", "failed.sender_mismatch", "failed.bank_authorization_denied", "failed.bank_holder_without_account", "failed.bank_account_limit_reached", "failed.account_opening_not_implemented", "failed.bank_core_unavailable", "failed.bank_account_save_failed", "failed.bank_connection_unavailable", "failed.bank_account_quota_exceeded", "failed.account_key_taken", "failed.bank_account_not_found", "failed.bank_account_balance_not_zero", "cancelled", "cancelled.grant_revoked", "cancelled.grant_expired", "rejected", "expired"], undefined>, v.DescriptionAction<"succeeded" | "failed" | "cancelled" | "rejected" | "expired" | "requires_action" | "processing.confirmed" | "processing.settling" | "processing.reversing" | "processing.reconciling" | "processing.opening" | "processing.closing" | "failed.insufficient_funds" | "failed.fraud_rejected" | "failed.bank_refused" | "failed.bank_rejected" | "failed.bank_review_required" | "failed.own_account_transfer_not_implemented" | "failed.bank_challenge_required" | "failed.unknown_key" | "failed.revoked_key" | "failed.expired_key" | "failed.invalid_signature" | "failed.expired_signed_instruction" | "failed.sender_mismatch" | "failed.bank_authorization_denied" | "failed.bank_holder_without_account" | "failed.bank_account_limit_reached" | "failed.account_opening_not_implemented" | "failed.bank_core_unavailable" | "failed.bank_account_save_failed" | "failed.bank_connection_unavailable" | "failed.bank_account_quota_exceeded" | "failed.account_key_taken" | "failed.bank_account_not_found" | "failed.bank_account_balance_not_zero" | "cancelled.grant_revoked" | "cancelled.grant_expired", "`<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 AndPass or typing the SMS code does not change its status. It becomes `processing.confirmed`, and `transfer.confirmed` is published once, when AndCo 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 AndCo 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 AndCo 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). A signed Transfer that leaves its holder (`POST /transfers`, ADR 0092) is never confirmed by a person: it also fails with `failed.bank_challenge_required` (the bank's fraud engine asked for a challenge nobody answers for a signature; send the same transfer as an Intent a person confirms) or with the core's refusal of its signature, in the words the upload uses: `failed.unknown_key` (the core holds no such key), `failed.revoked_key`, `failed.invalid_signature`, `failed.expired_signed_instruction` (its `exp` passed before the core executed it) and `failed.sender_mismatch`. A signed Transfer on either rail also fails, before anything is sent, when a key that signed it is no longer usable as it executes, even if it was at upload: `failed.revoked_key`, `failed.expired_key`, or `failed.unknown_key` (no Project of the holder has it any more, or, for one that leaves its holder, the core no longer holds it). In `failed.fraud_rejected`, `failed.bank_refused`, `failed.own_account_transfer_not_implemented`, `failed.bank_challenge_required`, `failed.expired_key` and the core's refusals of a signature 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.">]>, v.DescriptionAction<"succeeded" | "failed" | "cancelled" | "rejected" | "expired" | "requires_action" | "processing.confirmed" | "processing.settling" | "processing.reversing" | "processing.reconciling" | "processing.opening" | "processing.closing" | "failed.insufficient_funds" | "failed.fraud_rejected" | "failed.bank_refused" | "failed.bank_rejected" | "failed.bank_review_required" | "failed.own_account_transfer_not_implemented" | "failed.bank_challenge_required" | "failed.unknown_key" | "failed.revoked_key" | "failed.expired_key" | "failed.invalid_signature" | "failed.expired_signed_instruction" | "failed.sender_mismatch" | "failed.bank_authorization_denied" | "failed.bank_holder_without_account" | "failed.bank_account_limit_reached" | "failed.account_opening_not_implemented" | "failed.bank_core_unavailable" | "failed.bank_account_save_failed" | "failed.bank_connection_unavailable" | "failed.bank_account_quota_exceeded" | "failed.account_key_taken" | "failed.bank_account_not_found" | "failed.bank_account_balance_not_zero" | "cancelled.grant_revoked" | "cancelled.grant_expired", "Where the Transfer stands, in the words an Intent uses (`IntentStatus`): decide on the base, never on the whole value. A signed transfer that is not approved is `requires_action` until a Grant with `bank_transfer` `approve` or a person approves it. A transfer between two accounts of the same holder is `processing.confirmed` from its release until AndCo answers for good, then `succeeded` or `failed.<code>`.">]>;
|
|
341
|
+
readonly core_status: v.SchemaWithPipe<readonly [v.NullableSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MinLengthAction<string, 1, undefined>]>, undefined>, v.DescriptionAction<string | null, "The core bancario's own word for its transfer (`requested`, `confirmed`, `rejected_insufficient_funds`, …), for the record. Null while AndCo has not read one. Never branch on it: a word the core adds later appears here as it is, and `status` is what to decide on.">]>;
|
|
342
|
+
readonly approved: v.SchemaWithPipe<readonly [v.BooleanSchema<undefined>, v.DescriptionAction<boolean, "The signed `approved`: whether the instruction ordered the transfer sent as soon as it was uploaded.">]>;
|
|
343
|
+
readonly sender: v.SchemaWithPipe<readonly [v.VariantSchema<"country", [v.StrictObjectSchema<{
|
|
344
|
+
country: v.LiteralSchema<"CL", undefined>;
|
|
345
|
+
bank_code: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.RegexAction<string, undefined>, v.DescriptionAction<string, "The bank's four-digit code in Core's catalog. Andco is `0739`.">]>;
|
|
346
|
+
account_type: v.SchemaWithPipe<readonly [v.PicklistSchema<["10", "20", "40"], undefined>, v.DescriptionAction<"10" | "20" | "40", "Core's account type code: `\"10\"` savings, `\"20\"` checking, `\"40\"` debit (cuenta vista).">]>;
|
|
347
|
+
account_number: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MinLengthAction<string, 1, undefined>, v.MaxLengthAction<string, 64, undefined>, v.DescriptionAction<string, "The account number, as its bank writes it.">]>;
|
|
348
|
+
name: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MinLengthAction<string, 1, undefined>, v.DescriptionAction<string, "The holder's name. Core stores it as it arrives and never compares it.">]>;
|
|
349
|
+
national_kind_id: v.LiteralSchema<"RUT", undefined>;
|
|
350
|
+
national_id: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MinLengthAction<string, 1, undefined>, v.MaxLengthAction<string, 64, undefined>, v.DescriptionAction<string, "The holder's RUT. Core compares it as a normalized RUT.">]>;
|
|
351
|
+
}, undefined>], undefined>, v.DescriptionAction<{
|
|
352
|
+
country: "CL";
|
|
353
|
+
bank_code: string;
|
|
354
|
+
account_type: "10" | "20" | "40";
|
|
355
|
+
account_number: string;
|
|
356
|
+
name: string;
|
|
357
|
+
national_kind_id: "RUT";
|
|
358
|
+
national_id: string;
|
|
359
|
+
}, "The Remitente, as Core's `sender`: the account the money leaves and its holder. `country` and `national_kind_id` are always declared. Core checks the country, the bank (`0739`), the account's own type and the holder's RUT; it stores `name` as it arrives.">]>;
|
|
360
|
+
readonly receiver: v.SchemaWithPipe<readonly [v.VariantSchema<"country", [v.StrictObjectSchema<{
|
|
361
|
+
readonly amount: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.IntegerAction<number, undefined>, v.MinValueAction<number, 1, undefined>, v.MaxValueAction<number, 2147483647, undefined>, v.DescriptionAction<number, "An integer in the minor unit of the currency (CLP: whole pesos), from 1 to 2147483647, because Core stores it as int4. A larger one is refused with `max_value`.">]>;
|
|
362
|
+
readonly currency: v.LiteralSchema<"CLP", undefined>;
|
|
363
|
+
readonly email: v.SchemaWithPipe<readonly [v.OptionalSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.EmailAction<string, undefined>]>, undefined>, v.DescriptionAction<string | undefined, "Where Core notifies the Receptor.">]>;
|
|
364
|
+
readonly country: v.LiteralSchema<"CL", undefined>;
|
|
365
|
+
readonly bank_code: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.RegexAction<string, undefined>, v.DescriptionAction<string, "The bank's four-digit code in Core's catalog. Andco is `0739`.">]>;
|
|
366
|
+
readonly account_type: v.SchemaWithPipe<readonly [v.PicklistSchema<["10", "20", "40"], undefined>, v.DescriptionAction<"10" | "20" | "40", "Core's account type code: `\"10\"` savings, `\"20\"` checking, `\"40\"` debit (cuenta vista).">]>;
|
|
367
|
+
readonly account_number: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MinLengthAction<string, 1, undefined>, v.MaxLengthAction<string, 64, undefined>, v.DescriptionAction<string, "The account number, as its bank writes it.">]>;
|
|
368
|
+
readonly name: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MinLengthAction<string, 1, undefined>, v.DescriptionAction<string, "The holder's name. Core stores it as it arrives and never compares it.">]>;
|
|
369
|
+
readonly national_kind_id: v.LiteralSchema<"RUT", undefined>;
|
|
370
|
+
readonly national_id: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MinLengthAction<string, 1, undefined>, v.MaxLengthAction<string, 64, undefined>, v.DescriptionAction<string, "The holder's RUT. Core compares it as a normalized RUT.">]>;
|
|
371
|
+
}, undefined>], undefined>, v.DescriptionAction<{
|
|
372
|
+
amount: number;
|
|
373
|
+
currency: "CLP";
|
|
374
|
+
email?: string | undefined;
|
|
375
|
+
country: "CL";
|
|
376
|
+
bank_code: string;
|
|
377
|
+
account_type: "10" | "20" | "40";
|
|
378
|
+
account_number: string;
|
|
379
|
+
name: string;
|
|
380
|
+
national_kind_id: "RUT";
|
|
381
|
+
national_id: string;
|
|
382
|
+
}, "The Receptor, as Core's `receiver`: the account the money lands on, its holder, and the amount, an integer in the minor unit of the currency. `country` and `national_kind_id` are always declared.">]>;
|
|
383
|
+
readonly comment: v.SchemaWithPipe<readonly [v.OptionalSchema<v.StringSchema<undefined>, undefined>, v.DescriptionAction<string | undefined, "The signed comment, when there is one.">]>;
|
|
384
|
+
readonly created_at: v.SchemaWithPipe<readonly [v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.IsoTimestampAction<string, undefined>]>, v.DescriptionAction<string, "When the Transfer was uploaded.">]>;
|
|
385
|
+
readonly expires_at: v.SchemaWithPipe<readonly [v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.IsoTimestampAction<string, undefined>]>, v.DescriptionAction<string, "The Transfer's deadline: the signature's `exp`. A transfer still waiting for its approval at this instant expires.">]>;
|
|
386
|
+
}, undefined>, v.DescriptionAction<{
|
|
387
|
+
object: "transfer";
|
|
388
|
+
id: string;
|
|
389
|
+
jti: string;
|
|
390
|
+
status: "succeeded" | "failed" | "cancelled" | "rejected" | "expired" | "requires_action" | "processing.confirmed" | "processing.settling" | "processing.reversing" | "processing.reconciling" | "processing.opening" | "processing.closing" | "failed.insufficient_funds" | "failed.fraud_rejected" | "failed.bank_refused" | "failed.bank_rejected" | "failed.bank_review_required" | "failed.own_account_transfer_not_implemented" | "failed.bank_challenge_required" | "failed.unknown_key" | "failed.revoked_key" | "failed.expired_key" | "failed.invalid_signature" | "failed.expired_signed_instruction" | "failed.sender_mismatch" | "failed.bank_authorization_denied" | "failed.bank_holder_without_account" | "failed.bank_account_limit_reached" | "failed.account_opening_not_implemented" | "failed.bank_core_unavailable" | "failed.bank_account_save_failed" | "failed.bank_connection_unavailable" | "failed.bank_account_quota_exceeded" | "failed.account_key_taken" | "failed.bank_account_not_found" | "failed.bank_account_balance_not_zero" | "cancelled.grant_revoked" | "cancelled.grant_expired";
|
|
391
|
+
core_status: string | null;
|
|
392
|
+
approved: boolean;
|
|
393
|
+
sender: {
|
|
394
|
+
country: "CL";
|
|
395
|
+
bank_code: string;
|
|
396
|
+
account_type: "10" | "20" | "40";
|
|
397
|
+
account_number: string;
|
|
398
|
+
name: string;
|
|
399
|
+
national_kind_id: "RUT";
|
|
400
|
+
national_id: string;
|
|
401
|
+
};
|
|
402
|
+
receiver: {
|
|
403
|
+
amount: number;
|
|
404
|
+
currency: "CLP";
|
|
405
|
+
email?: string | undefined;
|
|
406
|
+
country: "CL";
|
|
407
|
+
bank_code: string;
|
|
408
|
+
account_type: "10" | "20" | "40";
|
|
409
|
+
account_number: string;
|
|
410
|
+
name: string;
|
|
411
|
+
national_kind_id: "RUT";
|
|
412
|
+
national_id: string;
|
|
413
|
+
};
|
|
414
|
+
comment?: string | undefined;
|
|
415
|
+
created_at: string;
|
|
416
|
+
expires_at: string;
|
|
417
|
+
}, "A Transfer uploaded as a Signed Instruction (ADR 0093), in Core's vocabulary: `sender`, `receiver` (with the amount, an integer in the minor unit of the currency) and `comment` exactly as signed. `status` is where it stands; `core_status` the core's own word, for the record.">]>;
|
|
418
|
+
}, undefined>, undefined>;
|
|
419
|
+
readonly pageInfo: v.StrictObjectSchema<{
|
|
420
|
+
readonly startCursor: v.NullableSchema<v.StringSchema<undefined>, undefined>;
|
|
421
|
+
readonly endCursor: v.NullableSchema<v.StringSchema<undefined>, undefined>;
|
|
422
|
+
readonly hasPreviousPage: v.BooleanSchema<undefined>;
|
|
423
|
+
readonly hasNextPage: v.BooleanSchema<undefined>;
|
|
424
|
+
}, undefined>;
|
|
425
|
+
}, undefined>, v.DescriptionAction<{
|
|
426
|
+
edges: {
|
|
427
|
+
cursor: string | null;
|
|
428
|
+
node: {
|
|
429
|
+
object: "transfer";
|
|
430
|
+
id: string;
|
|
431
|
+
jti: string;
|
|
432
|
+
status: "succeeded" | "failed" | "cancelled" | "rejected" | "expired" | "requires_action" | "processing.confirmed" | "processing.settling" | "processing.reversing" | "processing.reconciling" | "processing.opening" | "processing.closing" | "failed.insufficient_funds" | "failed.fraud_rejected" | "failed.bank_refused" | "failed.bank_rejected" | "failed.bank_review_required" | "failed.own_account_transfer_not_implemented" | "failed.bank_challenge_required" | "failed.unknown_key" | "failed.revoked_key" | "failed.expired_key" | "failed.invalid_signature" | "failed.expired_signed_instruction" | "failed.sender_mismatch" | "failed.bank_authorization_denied" | "failed.bank_holder_without_account" | "failed.bank_account_limit_reached" | "failed.account_opening_not_implemented" | "failed.bank_core_unavailable" | "failed.bank_account_save_failed" | "failed.bank_connection_unavailable" | "failed.bank_account_quota_exceeded" | "failed.account_key_taken" | "failed.bank_account_not_found" | "failed.bank_account_balance_not_zero" | "cancelled.grant_revoked" | "cancelled.grant_expired";
|
|
433
|
+
core_status: string | null;
|
|
434
|
+
approved: boolean;
|
|
435
|
+
sender: {
|
|
436
|
+
country: "CL";
|
|
437
|
+
bank_code: string;
|
|
438
|
+
account_type: "10" | "20" | "40";
|
|
439
|
+
account_number: string;
|
|
440
|
+
name: string;
|
|
441
|
+
national_kind_id: "RUT";
|
|
442
|
+
national_id: string;
|
|
443
|
+
};
|
|
444
|
+
receiver: {
|
|
445
|
+
amount: number;
|
|
446
|
+
currency: "CLP";
|
|
447
|
+
email?: string | undefined;
|
|
448
|
+
country: "CL";
|
|
449
|
+
bank_code: string;
|
|
450
|
+
account_type: "10" | "20" | "40";
|
|
451
|
+
account_number: string;
|
|
452
|
+
name: string;
|
|
453
|
+
national_kind_id: "RUT";
|
|
454
|
+
national_id: string;
|
|
455
|
+
};
|
|
456
|
+
comment?: string | undefined;
|
|
457
|
+
created_at: string;
|
|
458
|
+
expires_at: string;
|
|
459
|
+
};
|
|
460
|
+
}[];
|
|
461
|
+
pageInfo: {
|
|
462
|
+
startCursor: string | null;
|
|
463
|
+
endCursor: string | null;
|
|
464
|
+
hasPreviousPage: boolean;
|
|
465
|
+
hasNextPage: boolean;
|
|
466
|
+
};
|
|
467
|
+
}, string>]>;
|
|
468
|
+
/** A page of Transfers. */
|
|
469
|
+
export type TransferPage = v.InferOutput<typeof TransferPage>;
|
|
470
|
+
/**
|
|
471
|
+
* Finds the Transfer that a `jti` names, under the same exact OAuth Grant: for a client that lost the
|
|
472
|
+
* answer to `POST /transfers` and whose `exp` has passed.
|
|
473
|
+
*/
|
|
474
|
+
export declare const listTransfers: import("@orpc/contract").ProcedureContractBuilderWithInputOutput<v.ObjectSchema<{
|
|
475
|
+
readonly jti: v.SchemaWithPipe<readonly [v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.UuidAction<string, undefined>]>, v.DescriptionAction<string, "The `jti` of the Signed Instruction that uploaded the Transfer.">]>;
|
|
476
|
+
}, undefined>, v.SchemaWithPipe<readonly [v.StrictObjectSchema<{
|
|
477
|
+
readonly edges: v.ArraySchema<v.StrictObjectSchema<{
|
|
478
|
+
readonly cursor: v.NullableSchema<v.StringSchema<undefined>, undefined>;
|
|
479
|
+
readonly node: v.SchemaWithPipe<readonly [v.StrictObjectSchema<{
|
|
480
|
+
readonly object: v.LiteralSchema<"transfer", undefined>;
|
|
481
|
+
readonly id: v.SchemaWithPipe<readonly [v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.UuidAction<string, undefined>]>, v.DescriptionAction<string, "The Transfer's own id: what `GET /transfers/{transfer_id}` reads.">]>;
|
|
482
|
+
readonly jti: v.SchemaWithPipe<readonly [v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.UuidAction<string, undefined>]>, v.DescriptionAction<string, "The `jti` of the Signed Instruction that uploaded it. Sending the same instruction again answers this same Transfer.">]>;
|
|
483
|
+
readonly status: v.SchemaWithPipe<readonly [v.SchemaWithPipe<readonly [v.PicklistSchema<["requires_action", "processing.confirmed", "processing.settling", "processing.reversing", "processing.reconciling", "processing.opening", "processing.closing", "succeeded", "failed", "failed.insufficient_funds", "failed.fraud_rejected", "failed.bank_refused", "failed.bank_rejected", "failed.bank_review_required", "failed.own_account_transfer_not_implemented", "failed.bank_challenge_required", "failed.unknown_key", "failed.revoked_key", "failed.expired_key", "failed.invalid_signature", "failed.expired_signed_instruction", "failed.sender_mismatch", "failed.bank_authorization_denied", "failed.bank_holder_without_account", "failed.bank_account_limit_reached", "failed.account_opening_not_implemented", "failed.bank_core_unavailable", "failed.bank_account_save_failed", "failed.bank_connection_unavailable", "failed.bank_account_quota_exceeded", "failed.account_key_taken", "failed.bank_account_not_found", "failed.bank_account_balance_not_zero", "cancelled", "cancelled.grant_revoked", "cancelled.grant_expired", "rejected", "expired"], undefined>, v.DescriptionAction<"succeeded" | "failed" | "cancelled" | "rejected" | "expired" | "requires_action" | "processing.confirmed" | "processing.settling" | "processing.reversing" | "processing.reconciling" | "processing.opening" | "processing.closing" | "failed.insufficient_funds" | "failed.fraud_rejected" | "failed.bank_refused" | "failed.bank_rejected" | "failed.bank_review_required" | "failed.own_account_transfer_not_implemented" | "failed.bank_challenge_required" | "failed.unknown_key" | "failed.revoked_key" | "failed.expired_key" | "failed.invalid_signature" | "failed.expired_signed_instruction" | "failed.sender_mismatch" | "failed.bank_authorization_denied" | "failed.bank_holder_without_account" | "failed.bank_account_limit_reached" | "failed.account_opening_not_implemented" | "failed.bank_core_unavailable" | "failed.bank_account_save_failed" | "failed.bank_connection_unavailable" | "failed.bank_account_quota_exceeded" | "failed.account_key_taken" | "failed.bank_account_not_found" | "failed.bank_account_balance_not_zero" | "cancelled.grant_revoked" | "cancelled.grant_expired", "`<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 AndPass or typing the SMS code does not change its status. It becomes `processing.confirmed`, and `transfer.confirmed` is published once, when AndCo 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 AndCo 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 AndCo 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). A signed Transfer that leaves its holder (`POST /transfers`, ADR 0092) is never confirmed by a person: it also fails with `failed.bank_challenge_required` (the bank's fraud engine asked for a challenge nobody answers for a signature; send the same transfer as an Intent a person confirms) or with the core's refusal of its signature, in the words the upload uses: `failed.unknown_key` (the core holds no such key), `failed.revoked_key`, `failed.invalid_signature`, `failed.expired_signed_instruction` (its `exp` passed before the core executed it) and `failed.sender_mismatch`. A signed Transfer on either rail also fails, before anything is sent, when a key that signed it is no longer usable as it executes, even if it was at upload: `failed.revoked_key`, `failed.expired_key`, or `failed.unknown_key` (no Project of the holder has it any more, or, for one that leaves its holder, the core no longer holds it). In `failed.fraud_rejected`, `failed.bank_refused`, `failed.own_account_transfer_not_implemented`, `failed.bank_challenge_required`, `failed.expired_key` and the core's refusals of a signature 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.">]>, v.DescriptionAction<"succeeded" | "failed" | "cancelled" | "rejected" | "expired" | "requires_action" | "processing.confirmed" | "processing.settling" | "processing.reversing" | "processing.reconciling" | "processing.opening" | "processing.closing" | "failed.insufficient_funds" | "failed.fraud_rejected" | "failed.bank_refused" | "failed.bank_rejected" | "failed.bank_review_required" | "failed.own_account_transfer_not_implemented" | "failed.bank_challenge_required" | "failed.unknown_key" | "failed.revoked_key" | "failed.expired_key" | "failed.invalid_signature" | "failed.expired_signed_instruction" | "failed.sender_mismatch" | "failed.bank_authorization_denied" | "failed.bank_holder_without_account" | "failed.bank_account_limit_reached" | "failed.account_opening_not_implemented" | "failed.bank_core_unavailable" | "failed.bank_account_save_failed" | "failed.bank_connection_unavailable" | "failed.bank_account_quota_exceeded" | "failed.account_key_taken" | "failed.bank_account_not_found" | "failed.bank_account_balance_not_zero" | "cancelled.grant_revoked" | "cancelled.grant_expired", "Where the Transfer stands, in the words an Intent uses (`IntentStatus`): decide on the base, never on the whole value. A signed transfer that is not approved is `requires_action` until a Grant with `bank_transfer` `approve` or a person approves it. A transfer between two accounts of the same holder is `processing.confirmed` from its release until AndCo answers for good, then `succeeded` or `failed.<code>`.">]>;
|
|
484
|
+
readonly core_status: v.SchemaWithPipe<readonly [v.NullableSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MinLengthAction<string, 1, undefined>]>, undefined>, v.DescriptionAction<string | null, "The core bancario's own word for its transfer (`requested`, `confirmed`, `rejected_insufficient_funds`, …), for the record. Null while AndCo has not read one. Never branch on it: a word the core adds later appears here as it is, and `status` is what to decide on.">]>;
|
|
485
|
+
readonly approved: v.SchemaWithPipe<readonly [v.BooleanSchema<undefined>, v.DescriptionAction<boolean, "The signed `approved`: whether the instruction ordered the transfer sent as soon as it was uploaded.">]>;
|
|
486
|
+
readonly sender: v.SchemaWithPipe<readonly [v.VariantSchema<"country", [v.StrictObjectSchema<{
|
|
487
|
+
country: v.LiteralSchema<"CL", undefined>;
|
|
488
|
+
bank_code: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.RegexAction<string, undefined>, v.DescriptionAction<string, "The bank's four-digit code in Core's catalog. Andco is `0739`.">]>;
|
|
489
|
+
account_type: v.SchemaWithPipe<readonly [v.PicklistSchema<["10", "20", "40"], undefined>, v.DescriptionAction<"10" | "20" | "40", "Core's account type code: `\"10\"` savings, `\"20\"` checking, `\"40\"` debit (cuenta vista).">]>;
|
|
490
|
+
account_number: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MinLengthAction<string, 1, undefined>, v.MaxLengthAction<string, 64, undefined>, v.DescriptionAction<string, "The account number, as its bank writes it.">]>;
|
|
491
|
+
name: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MinLengthAction<string, 1, undefined>, v.DescriptionAction<string, "The holder's name. Core stores it as it arrives and never compares it.">]>;
|
|
492
|
+
national_kind_id: v.LiteralSchema<"RUT", undefined>;
|
|
493
|
+
national_id: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MinLengthAction<string, 1, undefined>, v.MaxLengthAction<string, 64, undefined>, v.DescriptionAction<string, "The holder's RUT. Core compares it as a normalized RUT.">]>;
|
|
494
|
+
}, undefined>], undefined>, v.DescriptionAction<{
|
|
495
|
+
country: "CL";
|
|
496
|
+
bank_code: string;
|
|
497
|
+
account_type: "10" | "20" | "40";
|
|
498
|
+
account_number: string;
|
|
499
|
+
name: string;
|
|
500
|
+
national_kind_id: "RUT";
|
|
501
|
+
national_id: string;
|
|
502
|
+
}, "The Remitente, as Core's `sender`: the account the money leaves and its holder. `country` and `national_kind_id` are always declared. Core checks the country, the bank (`0739`), the account's own type and the holder's RUT; it stores `name` as it arrives.">]>;
|
|
503
|
+
readonly receiver: v.SchemaWithPipe<readonly [v.VariantSchema<"country", [v.StrictObjectSchema<{
|
|
504
|
+
readonly amount: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.IntegerAction<number, undefined>, v.MinValueAction<number, 1, undefined>, v.MaxValueAction<number, 2147483647, undefined>, v.DescriptionAction<number, "An integer in the minor unit of the currency (CLP: whole pesos), from 1 to 2147483647, because Core stores it as int4. A larger one is refused with `max_value`.">]>;
|
|
505
|
+
readonly currency: v.LiteralSchema<"CLP", undefined>;
|
|
506
|
+
readonly email: v.SchemaWithPipe<readonly [v.OptionalSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.EmailAction<string, undefined>]>, undefined>, v.DescriptionAction<string | undefined, "Where Core notifies the Receptor.">]>;
|
|
507
|
+
readonly country: v.LiteralSchema<"CL", undefined>;
|
|
508
|
+
readonly bank_code: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.RegexAction<string, undefined>, v.DescriptionAction<string, "The bank's four-digit code in Core's catalog. Andco is `0739`.">]>;
|
|
509
|
+
readonly account_type: v.SchemaWithPipe<readonly [v.PicklistSchema<["10", "20", "40"], undefined>, v.DescriptionAction<"10" | "20" | "40", "Core's account type code: `\"10\"` savings, `\"20\"` checking, `\"40\"` debit (cuenta vista).">]>;
|
|
510
|
+
readonly account_number: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MinLengthAction<string, 1, undefined>, v.MaxLengthAction<string, 64, undefined>, v.DescriptionAction<string, "The account number, as its bank writes it.">]>;
|
|
511
|
+
readonly name: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MinLengthAction<string, 1, undefined>, v.DescriptionAction<string, "The holder's name. Core stores it as it arrives and never compares it.">]>;
|
|
512
|
+
readonly national_kind_id: v.LiteralSchema<"RUT", undefined>;
|
|
513
|
+
readonly national_id: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MinLengthAction<string, 1, undefined>, v.MaxLengthAction<string, 64, undefined>, v.DescriptionAction<string, "The holder's RUT. Core compares it as a normalized RUT.">]>;
|
|
514
|
+
}, undefined>], undefined>, v.DescriptionAction<{
|
|
515
|
+
amount: number;
|
|
516
|
+
currency: "CLP";
|
|
517
|
+
email?: string | undefined;
|
|
518
|
+
country: "CL";
|
|
519
|
+
bank_code: string;
|
|
520
|
+
account_type: "10" | "20" | "40";
|
|
521
|
+
account_number: string;
|
|
522
|
+
name: string;
|
|
523
|
+
national_kind_id: "RUT";
|
|
524
|
+
national_id: string;
|
|
525
|
+
}, "The Receptor, as Core's `receiver`: the account the money lands on, its holder, and the amount, an integer in the minor unit of the currency. `country` and `national_kind_id` are always declared.">]>;
|
|
526
|
+
readonly comment: v.SchemaWithPipe<readonly [v.OptionalSchema<v.StringSchema<undefined>, undefined>, v.DescriptionAction<string | undefined, "The signed comment, when there is one.">]>;
|
|
527
|
+
readonly created_at: v.SchemaWithPipe<readonly [v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.IsoTimestampAction<string, undefined>]>, v.DescriptionAction<string, "When the Transfer was uploaded.">]>;
|
|
528
|
+
readonly expires_at: v.SchemaWithPipe<readonly [v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.IsoTimestampAction<string, undefined>]>, v.DescriptionAction<string, "The Transfer's deadline: the signature's `exp`. A transfer still waiting for its approval at this instant expires.">]>;
|
|
529
|
+
}, undefined>, v.DescriptionAction<{
|
|
530
|
+
object: "transfer";
|
|
531
|
+
id: string;
|
|
532
|
+
jti: string;
|
|
533
|
+
status: "succeeded" | "failed" | "cancelled" | "rejected" | "expired" | "requires_action" | "processing.confirmed" | "processing.settling" | "processing.reversing" | "processing.reconciling" | "processing.opening" | "processing.closing" | "failed.insufficient_funds" | "failed.fraud_rejected" | "failed.bank_refused" | "failed.bank_rejected" | "failed.bank_review_required" | "failed.own_account_transfer_not_implemented" | "failed.bank_challenge_required" | "failed.unknown_key" | "failed.revoked_key" | "failed.expired_key" | "failed.invalid_signature" | "failed.expired_signed_instruction" | "failed.sender_mismatch" | "failed.bank_authorization_denied" | "failed.bank_holder_without_account" | "failed.bank_account_limit_reached" | "failed.account_opening_not_implemented" | "failed.bank_core_unavailable" | "failed.bank_account_save_failed" | "failed.bank_connection_unavailable" | "failed.bank_account_quota_exceeded" | "failed.account_key_taken" | "failed.bank_account_not_found" | "failed.bank_account_balance_not_zero" | "cancelled.grant_revoked" | "cancelled.grant_expired";
|
|
534
|
+
core_status: string | null;
|
|
535
|
+
approved: boolean;
|
|
536
|
+
sender: {
|
|
537
|
+
country: "CL";
|
|
538
|
+
bank_code: string;
|
|
539
|
+
account_type: "10" | "20" | "40";
|
|
540
|
+
account_number: string;
|
|
541
|
+
name: string;
|
|
542
|
+
national_kind_id: "RUT";
|
|
543
|
+
national_id: string;
|
|
544
|
+
};
|
|
545
|
+
receiver: {
|
|
546
|
+
amount: number;
|
|
547
|
+
currency: "CLP";
|
|
548
|
+
email?: string | undefined;
|
|
549
|
+
country: "CL";
|
|
550
|
+
bank_code: string;
|
|
551
|
+
account_type: "10" | "20" | "40";
|
|
552
|
+
account_number: string;
|
|
553
|
+
name: string;
|
|
554
|
+
national_kind_id: "RUT";
|
|
555
|
+
national_id: string;
|
|
556
|
+
};
|
|
557
|
+
comment?: string | undefined;
|
|
558
|
+
created_at: string;
|
|
559
|
+
expires_at: string;
|
|
560
|
+
}, "A Transfer uploaded as a Signed Instruction (ADR 0093), in Core's vocabulary: `sender`, `receiver` (with the amount, an integer in the minor unit of the currency) and `comment` exactly as signed. `status` is where it stands; `core_status` the core's own word, for the record.">]>;
|
|
561
|
+
}, undefined>, undefined>;
|
|
562
|
+
readonly pageInfo: v.StrictObjectSchema<{
|
|
563
|
+
readonly startCursor: v.NullableSchema<v.StringSchema<undefined>, undefined>;
|
|
564
|
+
readonly endCursor: v.NullableSchema<v.StringSchema<undefined>, undefined>;
|
|
565
|
+
readonly hasPreviousPage: v.BooleanSchema<undefined>;
|
|
566
|
+
readonly hasNextPage: v.BooleanSchema<undefined>;
|
|
567
|
+
}, undefined>;
|
|
568
|
+
}, undefined>, v.DescriptionAction<{
|
|
569
|
+
edges: {
|
|
570
|
+
cursor: string | null;
|
|
571
|
+
node: {
|
|
572
|
+
object: "transfer";
|
|
573
|
+
id: string;
|
|
574
|
+
jti: string;
|
|
575
|
+
status: "succeeded" | "failed" | "cancelled" | "rejected" | "expired" | "requires_action" | "processing.confirmed" | "processing.settling" | "processing.reversing" | "processing.reconciling" | "processing.opening" | "processing.closing" | "failed.insufficient_funds" | "failed.fraud_rejected" | "failed.bank_refused" | "failed.bank_rejected" | "failed.bank_review_required" | "failed.own_account_transfer_not_implemented" | "failed.bank_challenge_required" | "failed.unknown_key" | "failed.revoked_key" | "failed.expired_key" | "failed.invalid_signature" | "failed.expired_signed_instruction" | "failed.sender_mismatch" | "failed.bank_authorization_denied" | "failed.bank_holder_without_account" | "failed.bank_account_limit_reached" | "failed.account_opening_not_implemented" | "failed.bank_core_unavailable" | "failed.bank_account_save_failed" | "failed.bank_connection_unavailable" | "failed.bank_account_quota_exceeded" | "failed.account_key_taken" | "failed.bank_account_not_found" | "failed.bank_account_balance_not_zero" | "cancelled.grant_revoked" | "cancelled.grant_expired";
|
|
576
|
+
core_status: string | null;
|
|
577
|
+
approved: boolean;
|
|
578
|
+
sender: {
|
|
579
|
+
country: "CL";
|
|
580
|
+
bank_code: string;
|
|
581
|
+
account_type: "10" | "20" | "40";
|
|
582
|
+
account_number: string;
|
|
583
|
+
name: string;
|
|
584
|
+
national_kind_id: "RUT";
|
|
585
|
+
national_id: string;
|
|
586
|
+
};
|
|
587
|
+
receiver: {
|
|
588
|
+
amount: number;
|
|
589
|
+
currency: "CLP";
|
|
590
|
+
email?: string | undefined;
|
|
591
|
+
country: "CL";
|
|
592
|
+
bank_code: string;
|
|
593
|
+
account_type: "10" | "20" | "40";
|
|
594
|
+
account_number: string;
|
|
595
|
+
name: string;
|
|
596
|
+
national_kind_id: "RUT";
|
|
597
|
+
national_id: string;
|
|
598
|
+
};
|
|
599
|
+
comment?: string | undefined;
|
|
600
|
+
created_at: string;
|
|
601
|
+
expires_at: string;
|
|
602
|
+
};
|
|
603
|
+
}[];
|
|
604
|
+
pageInfo: {
|
|
605
|
+
startCursor: string | null;
|
|
606
|
+
endCursor: string | null;
|
|
607
|
+
hasPreviousPage: boolean;
|
|
608
|
+
hasNextPage: boolean;
|
|
609
|
+
};
|
|
610
|
+
}, string>]>, import("./api-error.js").AndcoAPIErrorMap<readonly [typeof InvalidRequest, typeof InvalidToken, typeof InvalidOrigin, typeof UnsupportedVersion, typeof ServerError, typeof TemporarilyUnavailable]>>;
|
|
611
|
+
export {};
|
|
612
|
+
//# sourceMappingURL=transfers.d.ts.map
|