@albertomarturelo/cta-core 0.1.0 → 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/banks/bci/bundle.d.ts +25 -0
- package/dist/banks/bci/bundle.d.ts.map +1 -0
- package/dist/banks/bci/bundle.js +197 -0
- package/dist/banks/bci/bundle.js.map +1 -0
- package/dist/banks/bci/cards.d.ts +27 -0
- package/dist/banks/bci/cards.d.ts.map +1 -0
- package/dist/banks/bci/cards.js +200 -0
- package/dist/banks/bci/cards.js.map +1 -0
- package/dist/banks/bci/config.d.ts +14 -7
- package/dist/banks/bci/config.d.ts.map +1 -1
- package/dist/banks/bci/config.js +32 -19
- package/dist/banks/bci/config.js.map +1 -1
- package/dist/banks/bci/login-flow.d.ts +5 -0
- package/dist/banks/bci/login-flow.d.ts.map +1 -1
- package/dist/banks/bci/login-flow.js +11 -0
- package/dist/banks/bci/login-flow.js.map +1 -1
- package/dist/banks/bci/reads.d.ts +19 -10
- package/dist/banks/bci/reads.d.ts.map +1 -1
- package/dist/banks/bci/reads.js +23 -35
- package/dist/banks/bci/reads.js.map +1 -1
- package/dist/domain/types.d.ts +59 -0
- package/dist/domain/types.d.ts.map +1 -1
- package/dist/errors/errors.d.ts +6 -0
- package/dist/errors/errors.d.ts.map +1 -1
- package/dist/errors/errors.js +12 -0
- package/dist/errors/errors.js.map +1 -1
- package/dist/node/banks/bci-driver.d.ts +30 -10
- package/dist/node/banks/bci-driver.d.ts.map +1 -1
- package/dist/node/banks/bci-driver.js +136 -129
- package/dist/node/banks/bci-driver.js.map +1 -1
- package/dist/node/holder/client.d.ts.map +1 -1
- package/dist/node/holder/client.js +1 -0
- package/dist/node/holder/client.js.map +1 -1
- package/dist/node/holder/launch.d.ts.map +1 -1
- package/dist/node/holder/launch.js +1 -0
- package/dist/node/holder/launch.js.map +1 -1
- package/dist/node/holder/protocol.d.ts +1 -1
- package/dist/node/holder/protocol.d.ts.map +1 -1
- package/dist/node/holder/protocol.js +1 -0
- package/dist/node/holder/protocol.js.map +1 -1
- package/dist/node/holder/server.d.ts.map +1 -1
- package/dist/node/holder/server.js +2 -2
- package/dist/node/holder/server.js.map +1 -1
- package/dist/node/http-client.d.ts +2 -0
- package/dist/node/http-client.d.ts.map +1 -1
- package/dist/node/http-client.js +8 -4
- package/dist/node/http-client.js.map +1 -1
- package/dist/seams/fakes.d.ts +5 -2
- package/dist/seams/fakes.d.ts.map +1 -1
- package/dist/seams/fakes.js +18 -0
- package/dist/seams/fakes.js.map +1 -1
- package/dist/seams/seams.d.ts +35 -2
- package/dist/seams/seams.d.ts.map +1 -1
- package/dist/tasks/tasks.d.ts +9 -2
- package/dist/tasks/tasks.d.ts.map +1 -1
- package/dist/tasks/tasks.js +12 -0
- package/dist/tasks/tasks.js.map +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Pure reading of a BCI app's public bundle (ADR-018, contract "Grant without
|
|
3
|
+
* the menu"): the app's HTTP interceptor sets its API headers as constants, so
|
|
4
|
+
* `cta` sends the same values the app would, read at login, never hard-coded.
|
|
5
|
+
* Minifiers rename variables but keep header names as string literals, so the
|
|
6
|
+
* parse anchors on those. Anything unexpected fails closed, naming the header
|
|
7
|
+
* — never printing a value.
|
|
8
|
+
*/
|
|
9
|
+
/** An app's headers without the bearer, and the auth scheme its code writes. */
|
|
10
|
+
export interface AppHeaderTemplate {
|
|
11
|
+
readonly headers: Readonly<Record<string, string>>;
|
|
12
|
+
readonly scheme: string;
|
|
13
|
+
}
|
|
14
|
+
/** The `main.<hash>.js` an app's shell loads; the ES5 copy of a dual build is skipped. */
|
|
15
|
+
export declare function mainScriptOf(html: string, app: string): string;
|
|
16
|
+
/**
|
|
17
|
+
* The headers an app's interceptor sets, from its bundle: the one object that
|
|
18
|
+
* builds `Authorization` from the token and sets `X-IBM-Client-Id`. Only the
|
|
19
|
+
* contract's header names are kept (`Origin`, which a browser never lets a page
|
|
20
|
+
* set, is dropped — ADR-015); each must be a plain constant.
|
|
21
|
+
*/
|
|
22
|
+
export declare function bundleHeaders(js: string, app: string): AppHeaderTemplate;
|
|
23
|
+
/** The headers a read sends: the app's own, its Accept, and the bearer as its code writes it. */
|
|
24
|
+
export declare function withToken(t: AppHeaderTemplate, token: string): Record<string, string>;
|
|
25
|
+
//# sourceMappingURL=bundle.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"bundle.d.ts","sourceRoot":"","sources":["../../../src/banks/bci/bundle.ts"],"names":[],"mappings":"AAIA;;;;;;;GAOG;AAEH,gFAAgF;AAChF,MAAM,WAAW,iBAAiB;IAChC,QAAQ,CAAC,OAAO,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAAC;IACnD,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;CACzB;AAED,0FAA0F;AAC1F,wBAAgB,YAAY,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,GAAG,MAAM,CAM9D;AAkID;;;;;GAKG;AACH,wBAAgB,aAAa,CAAC,EAAE,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,GAAG,iBAAiB,CA+BxE;AAED,iGAAiG;AACjG,wBAAgB,SAAS,CAAC,CAAC,EAAE,iBAAiB,EAAE,KAAK,EAAE,MAAM,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAErF"}
|
|
@@ -0,0 +1,197 @@
|
|
|
1
|
+
import { BankError } from '../../errors/errors.js';
|
|
2
|
+
import { BCI } from './config.js';
|
|
3
|
+
import { unexpected } from './reads.js';
|
|
4
|
+
/** The `main.<hash>.js` an app's shell loads; the ES5 copy of a dual build is skipped. */
|
|
5
|
+
export function mainScriptOf(html, app) {
|
|
6
|
+
const scripts = [...html.matchAll(/<script[^>]*\ssrc="(main[\w.-]*\.js)"/g)]
|
|
7
|
+
.map((m) => m[1])
|
|
8
|
+
.filter((src) => !/(^|[-.])es5[-.]/.test(src));
|
|
9
|
+
if (scripts.length !== 1)
|
|
10
|
+
throw unexpected(`app ${app}: script principal`);
|
|
11
|
+
return scripts[0];
|
|
12
|
+
}
|
|
13
|
+
/** The `{…}` that starts at `open`, skipping braces inside string and template literals. */
|
|
14
|
+
function balanced(src, open) {
|
|
15
|
+
let depth = 0;
|
|
16
|
+
let quote;
|
|
17
|
+
for (let i = open; i < src.length; i++) {
|
|
18
|
+
const c = src[i];
|
|
19
|
+
if (quote) {
|
|
20
|
+
if (c === '\\')
|
|
21
|
+
i++;
|
|
22
|
+
else if (c === quote)
|
|
23
|
+
quote = undefined;
|
|
24
|
+
continue;
|
|
25
|
+
}
|
|
26
|
+
if (c === '"' || c === "'" || c === '`')
|
|
27
|
+
quote = c;
|
|
28
|
+
else if (c === '{')
|
|
29
|
+
depth++;
|
|
30
|
+
else if (c === '}' && --depth === 0)
|
|
31
|
+
return src.slice(open, i + 1);
|
|
32
|
+
}
|
|
33
|
+
throw new Error('unbalanced');
|
|
34
|
+
}
|
|
35
|
+
/** The `{` of the innermost object around `at`; header objects hold no braces in strings. */
|
|
36
|
+
function enclosingOpen(src, at) {
|
|
37
|
+
let depth = 0;
|
|
38
|
+
for (let i = at; i >= 0; i--) {
|
|
39
|
+
if (src[i] === '}')
|
|
40
|
+
depth++;
|
|
41
|
+
else if (src[i] === '{') {
|
|
42
|
+
if (depth === 0)
|
|
43
|
+
return i;
|
|
44
|
+
depth--;
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
throw new Error('no object');
|
|
48
|
+
}
|
|
49
|
+
/** The top-level `key: value` entries of an object literal, as source text. */
|
|
50
|
+
function entriesOf(obj) {
|
|
51
|
+
const body = obj.slice(1, -1);
|
|
52
|
+
const parts = [];
|
|
53
|
+
let depth = 0;
|
|
54
|
+
let quote;
|
|
55
|
+
let start = 0;
|
|
56
|
+
for (let i = 0; i < body.length; i++) {
|
|
57
|
+
const c = body[i];
|
|
58
|
+
if (quote) {
|
|
59
|
+
if (c === '\\')
|
|
60
|
+
i++;
|
|
61
|
+
else if (c === quote)
|
|
62
|
+
quote = undefined;
|
|
63
|
+
continue;
|
|
64
|
+
}
|
|
65
|
+
if (c === '"' || c === "'" || c === '`')
|
|
66
|
+
quote = c;
|
|
67
|
+
else if ('{[('.includes(c))
|
|
68
|
+
depth++;
|
|
69
|
+
else if ('}])'.includes(c))
|
|
70
|
+
depth--;
|
|
71
|
+
else if (c === ',' && depth === 0) {
|
|
72
|
+
parts.push(body.slice(start, i).trim());
|
|
73
|
+
start = i + 1;
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
parts.push(body.slice(start).trim());
|
|
77
|
+
return parts.filter((p) => p !== '');
|
|
78
|
+
}
|
|
79
|
+
const escapeRe = (s) => s.replace(/[$]/g, '\\$');
|
|
80
|
+
/**
|
|
81
|
+
* A value is a string literal, the `` `<scheme> ${token}` `` template of
|
|
82
|
+
* `Authorization`, or a reference to a key of the app's production environment
|
|
83
|
+
* object (the saldos and statements apps' `X-IBM-Client-Id`, observed 2026-10-07).
|
|
84
|
+
*/
|
|
85
|
+
function readEntries(src, obj, depth) {
|
|
86
|
+
const out = { headers: {} };
|
|
87
|
+
for (const entry of entriesOf(obj)) {
|
|
88
|
+
if (entry.startsWith('...')) {
|
|
89
|
+
// `...X.header` (the cards app, observed 2026-10-07): the one `header:{…}`
|
|
90
|
+
// object of the bundle that sets an Application-Id.
|
|
91
|
+
const prop = /\.([\w$]+)$/.exec(entry)?.[1];
|
|
92
|
+
if (prop === undefined || depth > 0)
|
|
93
|
+
throw new Error('spread');
|
|
94
|
+
const found = [...src.matchAll(new RegExp(`[,{]${escapeRe(prop)}:\\{`, 'g'))]
|
|
95
|
+
.map((m) => balanced(src, m.index + m[0].length - 1))
|
|
96
|
+
.filter((o) => o.includes('"Application-Id"'));
|
|
97
|
+
if (found.length !== 1)
|
|
98
|
+
throw new Error('spread');
|
|
99
|
+
const inner = readEntries(src, found[0], depth + 1);
|
|
100
|
+
Object.assign(out.headers, inner.headers);
|
|
101
|
+
continue;
|
|
102
|
+
}
|
|
103
|
+
const kv = /^("[^"]+"|'[^']+'|[\w$]+):([\s\S]+)$/.exec(entry);
|
|
104
|
+
if (!kv)
|
|
105
|
+
throw new Error('entry');
|
|
106
|
+
const name = kv[1].replace(/^["']|["']$/g, '').toLowerCase();
|
|
107
|
+
const raw = kv[2].trim();
|
|
108
|
+
if (name === 'authorization') {
|
|
109
|
+
// Later entries win, as in the object literal: a spread's placeholder
|
|
110
|
+
// string is overridden by the interceptor's own template.
|
|
111
|
+
const scheme = /^`([A-Za-z]+) \$\{[\w$]+\}`$/.exec(raw)?.[1];
|
|
112
|
+
if (scheme !== undefined)
|
|
113
|
+
out.scheme = scheme;
|
|
114
|
+
continue;
|
|
115
|
+
}
|
|
116
|
+
let value = /^"([^"]*)"$/.exec(raw)?.[1];
|
|
117
|
+
const ref = /^[\w$]+(?:\.[\w$]+)*\.([\w$]+)$/.exec(raw)?.[1];
|
|
118
|
+
if (value === undefined && ref !== undefined) {
|
|
119
|
+
const vals = new Set([
|
|
120
|
+
...src.matchAll(new RegExp(`production:!0,[^{}]*?\\b${escapeRe(ref)}:"([^"]+)"`, 'g')),
|
|
121
|
+
].map((m) => m[1]));
|
|
122
|
+
if (vals.size === 1)
|
|
123
|
+
value = [...vals][0];
|
|
124
|
+
}
|
|
125
|
+
if (value === undefined) {
|
|
126
|
+
// A header `cta` does not send may hold anything; one it sends may not.
|
|
127
|
+
if (BCI.apiHeaders.includes(name))
|
|
128
|
+
throw unexpected(`header ${name}`);
|
|
129
|
+
continue;
|
|
130
|
+
}
|
|
131
|
+
out.headers[name] = value;
|
|
132
|
+
}
|
|
133
|
+
return out;
|
|
134
|
+
}
|
|
135
|
+
// Header values are short constants (ids, codes, an IPv4, a media type).
|
|
136
|
+
const VALUE = /^[\w.\-/ ]{1,80}$/;
|
|
137
|
+
const REQUIRED = [
|
|
138
|
+
'content-type',
|
|
139
|
+
'application-id',
|
|
140
|
+
'channel',
|
|
141
|
+
'reference-service',
|
|
142
|
+
'reference-operation',
|
|
143
|
+
'x-ibm-client-id',
|
|
144
|
+
'tracking-id',
|
|
145
|
+
];
|
|
146
|
+
/**
|
|
147
|
+
* The headers an app's interceptor sets, from its bundle: the one object that
|
|
148
|
+
* builds `Authorization` from the token and sets `X-IBM-Client-Id`. Only the
|
|
149
|
+
* contract's header names are kept (`Origin`, which a browser never lets a page
|
|
150
|
+
* set, is dropped — ADR-015); each must be a plain constant.
|
|
151
|
+
*/
|
|
152
|
+
export function bundleHeaders(js, app) {
|
|
153
|
+
const objects = new Set();
|
|
154
|
+
for (const m of js.matchAll(/Authorization:`[A-Za-z]+ \$\{/g)) {
|
|
155
|
+
let obj;
|
|
156
|
+
try {
|
|
157
|
+
obj = balanced(js, enclosingOpen(js, m.index));
|
|
158
|
+
}
|
|
159
|
+
catch {
|
|
160
|
+
continue;
|
|
161
|
+
}
|
|
162
|
+
if (obj.includes('"X-IBM-Client-Id"'))
|
|
163
|
+
objects.add(obj);
|
|
164
|
+
}
|
|
165
|
+
if (objects.size !== 1)
|
|
166
|
+
throw unexpected(`app ${app}: headers`);
|
|
167
|
+
let parsed;
|
|
168
|
+
try {
|
|
169
|
+
parsed = readEntries(js, [...objects][0], 0);
|
|
170
|
+
}
|
|
171
|
+
catch (err) {
|
|
172
|
+
if (err instanceof BankError)
|
|
173
|
+
throw err;
|
|
174
|
+
throw unexpected(`app ${app}: headers`);
|
|
175
|
+
}
|
|
176
|
+
if (parsed.scheme === undefined)
|
|
177
|
+
throw unexpected(`app ${app}: authorization`);
|
|
178
|
+
const headers = {};
|
|
179
|
+
for (const name of BCI.apiHeaders) {
|
|
180
|
+
const v = parsed.headers[name];
|
|
181
|
+
if (v === undefined)
|
|
182
|
+
continue;
|
|
183
|
+
if (!VALUE.test(v))
|
|
184
|
+
throw unexpected(`app ${app}: header ${name}`);
|
|
185
|
+
headers[name] = v;
|
|
186
|
+
}
|
|
187
|
+
for (const name of REQUIRED) {
|
|
188
|
+
if (headers[name] === undefined)
|
|
189
|
+
throw unexpected(`app ${app}: header ${name}`);
|
|
190
|
+
}
|
|
191
|
+
return { headers, scheme: parsed.scheme };
|
|
192
|
+
}
|
|
193
|
+
/** The headers a read sends: the app's own, its Accept, and the bearer as its code writes it. */
|
|
194
|
+
export function withToken(t, token) {
|
|
195
|
+
return { accept: BCI.apiAccept, ...t.headers, authorization: `${t.scheme} ${token}` };
|
|
196
|
+
}
|
|
197
|
+
//# sourceMappingURL=bundle.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"bundle.js","sourceRoot":"","sources":["../../../src/banks/bci/bundle.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,wBAAwB,CAAC;AACnD,OAAO,EAAE,GAAG,EAAE,MAAM,aAAa,CAAC;AAClC,OAAO,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AAiBxC,0FAA0F;AAC1F,MAAM,UAAU,YAAY,CAAC,IAAY,EAAE,GAAW;IACpD,MAAM,OAAO,GAAG,CAAC,GAAG,IAAI,CAAC,QAAQ,CAAC,wCAAwC,CAAC,CAAC;SACzE,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,CAAE,CAAC;SACjB,MAAM,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,CAAC,iBAAiB,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC;IACjD,IAAI,OAAO,CAAC,MAAM,KAAK,CAAC;QAAE,MAAM,UAAU,CAAC,OAAO,GAAG,oBAAoB,CAAC,CAAC;IAC3E,OAAO,OAAO,CAAC,CAAC,CAAE,CAAC;AACrB,CAAC;AAED,4FAA4F;AAC5F,SAAS,QAAQ,CAAC,GAAW,EAAE,IAAY;IACzC,IAAI,KAAK,GAAG,CAAC,CAAC;IACd,IAAI,KAAyB,CAAC;IAC9B,KAAK,IAAI,CAAC,GAAG,IAAI,EAAE,CAAC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/types.js';
|
|
2
|
+
import type { CardRef } from '../../seams/seams.js';
|
|
3
|
+
/** `GET mov-tdc/`: `[{ numeroTarjeta, numeroDeCuenta, descripcionSelectorTarjeta, … }]`. */
|
|
4
|
+
export declare function parseTarjetasLista(json: unknown): CardRef[];
|
|
5
|
+
/** One card account: its first card in the bank's list, and the others that share it. */
|
|
6
|
+
export interface CardAccount {
|
|
7
|
+
readonly first: CardRef;
|
|
8
|
+
readonly others: readonly CardRef[];
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* The list has one entry per plastic, and an additional card shares its
|
|
12
|
+
* account (contract), so accounts are grouped in the bank's order and each is
|
|
13
|
+
* read once: a shared quota is never reported twice (ADR-017).
|
|
14
|
+
*/
|
|
15
|
+
export declare function groupByAccount(cards: readonly CardRef[]): CardAccount[];
|
|
16
|
+
/** `--tarjeta`: the last 4 digits of any card of an account selects that account. */
|
|
17
|
+
export declare function matchTarjeta(accounts: readonly CardAccount[], selector: string): CardAccount;
|
|
18
|
+
/**
|
|
19
|
+
* `POST informacion-tdc` for one card account: quotas, billing dates and the
|
|
20
|
+
* billed and unbilled movements. Inferred until the live run (contract): a
|
|
21
|
+
* positive bank `monto` is a cargo, so it is negated (ADR-007).
|
|
22
|
+
*/
|
|
23
|
+
export declare function parseInformacionTarjeta(json: unknown, account: CardAccount): {
|
|
24
|
+
tarjeta: Tarjeta;
|
|
25
|
+
movimientos: MovimientoTarjeta[];
|
|
26
|
+
};
|
|
27
|
+
//# sourceMappingURL=cards.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cards.d.ts","sourceRoot":"","sources":["../../../src/banks/bci/cards.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAqB,iBAAiB,EAAE,OAAO,EAAE,MAAM,uBAAuB,CAAC;AAG3F,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,sBAAsB,CAAC;AA2BpD,4FAA4F;AAC5F,wBAAgB,kBAAkB,CAAC,IAAI,EAAE,OAAO,GAAG,OAAO,EAAE,CAiB3D;AAED,yFAAyF;AACzF,MAAM,WAAW,WAAW;IAC1B,QAAQ,CAAC,KAAK,EAAE,OAAO,CAAC;IACxB,QAAQ,CAAC,MAAM,EAAE,SAAS,OAAO,EAAE,CAAC;CACrC;AAED;;;;GAIG;AACH,wBAAgB,cAAc,CAAC,KAAK,EAAE,SAAS,OAAO,EAAE,GAAG,WAAW,EAAE,CAQvE;AAED,qFAAqF;AACrF,wBAAgB,YAAY,CAAC,QAAQ,EAAE,SAAS,WAAW,EAAE,EAAE,QAAQ,EAAE,MAAM,GAAG,WAAW,CAQ5F;AA2CD;;;;GAIG;AACH,wBAAgB,uBAAuB,CACrC,IAAI,EAAE,OAAO,EACb,OAAO,EAAE,WAAW,GACnB;IAAE,OAAO,EAAE,OAAO,CAAC;IAAC,WAAW,EAAE,iBAAiB,EAAE,CAAA;CAAE,CA0DxD"}
|
|
@@ -0,0 +1,200 @@
|
|
|
1
|
+
import { toIsoDate } from '../../dates/dates.js';
|
|
2
|
+
import { BankError, NoSuchCard } from '../../errors/errors.js';
|
|
3
|
+
import { money, parseDecimalAmount } from '../../money/money.js';
|
|
4
|
+
import { BCI } from './config.js';
|
|
5
|
+
import { isRecord, unexpected } from './reads.js';
|
|
6
|
+
/**
|
|
7
|
+
* Pure reading of BCI's cards app (`docs/bank-contract/bci.md`, "Credit cards";
|
|
8
|
+
* ADR-017). Card and account keys stay request keys: nothing here puts them in a
|
|
9
|
+
* result or an error message.
|
|
10
|
+
*/
|
|
11
|
+
const KEY = /^\d{1,20}$/;
|
|
12
|
+
const LAST4 = /(\d{4})\D*$/;
|
|
13
|
+
/** A label may show at most 4 digits in a row: a longer run could be a card number. */
|
|
14
|
+
function cardLabel(label) {
|
|
15
|
+
const text = label.trim();
|
|
16
|
+
// The message names the field, never the label itself.
|
|
17
|
+
if (/\d{5,}/.test(text))
|
|
18
|
+
throw unexpected('etiqueta de tarjeta');
|
|
19
|
+
return text;
|
|
20
|
+
}
|
|
21
|
+
function last4Of(label) {
|
|
22
|
+
const m = LAST4.exec(label);
|
|
23
|
+
if (!m)
|
|
24
|
+
throw unexpected('etiqueta de tarjeta');
|
|
25
|
+
return m[1];
|
|
26
|
+
}
|
|
27
|
+
/** `GET mov-tdc/`: `[{ numeroTarjeta, numeroDeCuenta, descripcionSelectorTarjeta, … }]`. */
|
|
28
|
+
export function parseTarjetasLista(json) {
|
|
29
|
+
if (!Array.isArray(json))
|
|
30
|
+
throw unexpected('tarjetas');
|
|
31
|
+
return json.map((e) => {
|
|
32
|
+
if (!isRecord(e))
|
|
33
|
+
throw unexpected('tarjeta');
|
|
34
|
+
const { numeroTarjeta, numeroDeCuenta, descripcionSelectorTarjeta } = e;
|
|
35
|
+
if (typeof numeroTarjeta !== 'string' ||
|
|
36
|
+
!KEY.test(numeroTarjeta) ||
|
|
37
|
+
typeof numeroDeCuenta !== 'string' ||
|
|
38
|
+
!KEY.test(numeroDeCuenta) ||
|
|
39
|
+
typeof descripcionSelectorTarjeta !== 'string') {
|
|
40
|
+
throw unexpected('tarjeta');
|
|
41
|
+
}
|
|
42
|
+
const label = cardLabel(descripcionSelectorTarjeta);
|
|
43
|
+
return { cardKey: numeroTarjeta, accountKey: numeroDeCuenta, label, last4: last4Of(label) };
|
|
44
|
+
});
|
|
45
|
+
}
|
|
46
|
+
/**
|
|
47
|
+
* The list has one entry per plastic, and an additional card shares its
|
|
48
|
+
* account (contract), so accounts are grouped in the bank's order and each is
|
|
49
|
+
* read once: a shared quota is never reported twice (ADR-017).
|
|
50
|
+
*/
|
|
51
|
+
export function groupByAccount(cards) {
|
|
52
|
+
const byAccount = new Map();
|
|
53
|
+
for (const c of cards) {
|
|
54
|
+
const group = byAccount.get(c.accountKey);
|
|
55
|
+
if (group)
|
|
56
|
+
group.push(c);
|
|
57
|
+
else
|
|
58
|
+
byAccount.set(c.accountKey, [c]);
|
|
59
|
+
}
|
|
60
|
+
return [...byAccount.values()].map(([first, ...others]) => ({ first: first, others }));
|
|
61
|
+
}
|
|
62
|
+
/** `--tarjeta`: the last 4 digits of any card of an account selects that account. */
|
|
63
|
+
export function matchTarjeta(accounts, selector) {
|
|
64
|
+
const wanted = selector.replace(/\D/g, '');
|
|
65
|
+
const hits = wanted.length === 4
|
|
66
|
+
? accounts.filter((a) => [a.first, ...a.others].some((c) => c.last4 === wanted))
|
|
67
|
+
: [];
|
|
68
|
+
if (hits.length === 1)
|
|
69
|
+
return hits[0];
|
|
70
|
+
throw new NoSuchCard(BCI.slug, selector, hits.length > 1);
|
|
71
|
+
}
|
|
72
|
+
/** International amounts come as dollars with up to 2 decimals (contract); cents out. */
|
|
73
|
+
function usd(v, what) {
|
|
74
|
+
if (typeof v !== 'number' || !Number.isFinite(v))
|
|
75
|
+
throw unexpected(what);
|
|
76
|
+
try {
|
|
77
|
+
return parseDecimalAmount(String(v), 'USD');
|
|
78
|
+
}
|
|
79
|
+
catch {
|
|
80
|
+
throw unexpected(what);
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
function pesos(v, what) {
|
|
84
|
+
if (typeof v !== 'number' || !Number.isSafeInteger(v))
|
|
85
|
+
throw unexpected(what);
|
|
86
|
+
return money('CLP', v);
|
|
87
|
+
}
|
|
88
|
+
const amountIn = (moneda) => (moneda === 'USD' ? usd : pesos);
|
|
89
|
+
/** Dates come as `D/M/YYYY` without zero padding (contract). */
|
|
90
|
+
function dmy(v, what) {
|
|
91
|
+
const m = typeof v === 'string' ? /^\s*(\d{1,2})\/(\d{1,2})\/(\d{4})\s*$/.exec(v) : null;
|
|
92
|
+
if (!m)
|
|
93
|
+
throw unexpected(what);
|
|
94
|
+
try {
|
|
95
|
+
return toIsoDate(`${m[1].padStart(2, '0')}/${m[2].padStart(2, '0')}/${m[3]}`);
|
|
96
|
+
}
|
|
97
|
+
catch {
|
|
98
|
+
throw unexpected(what);
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
const absent = (v) => v === undefined || v === null || v === '';
|
|
102
|
+
/** A run of card-number length inside a description is masked to its last 4 (ADR-017). */
|
|
103
|
+
const maskCardNumbers = (text) => text.replace(/\d{13,}/g, (d) => `****${d.slice(-4)}`);
|
|
104
|
+
// Each list, its currency and whether it is billed (contract, "Everything for one card").
|
|
105
|
+
const LISTS = [
|
|
106
|
+
['facturadosNacionales', 'CLP', true],
|
|
107
|
+
['noFacturadosNacional', 'CLP', false],
|
|
108
|
+
['facturadosInternacionales', 'USD', true],
|
|
109
|
+
['noFacturadosInternacional', 'USD', false],
|
|
110
|
+
];
|
|
111
|
+
/**
|
|
112
|
+
* `POST informacion-tdc` for one card account: quotas, billing dates and the
|
|
113
|
+
* billed and unbilled movements. Inferred until the live run (contract): a
|
|
114
|
+
* positive bank `monto` is a cargo, so it is negated (ADR-007).
|
|
115
|
+
*/
|
|
116
|
+
export function parseInformacionTarjeta(json, account) {
|
|
117
|
+
if (!isRecord(json))
|
|
118
|
+
throw unexpected('tarjeta');
|
|
119
|
+
// A national failure is the bank's own message; the international one comes
|
|
120
|
+
// with empty lists for a card with no international billing (contract).
|
|
121
|
+
for (const key of ['errorNacional', 'errorNoFacturados']) {
|
|
122
|
+
const err = json[key];
|
|
123
|
+
if (!absent(err)) {
|
|
124
|
+
const msg = isRecord(err) && typeof err['mensaje'] === 'string' ? err['mensaje'].trim() : '';
|
|
125
|
+
throw new BankError(BCI.slug, msg || 'El banco no entregó los datos de la tarjeta.');
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
const opt = (key, read) => absent(json[key]) ? undefined : read(json[key], key);
|
|
129
|
+
const withOpt = (k, v) => (v === undefined ? {} : { [k]: v });
|
|
130
|
+
const nacional = {
|
|
131
|
+
total: pesos(json['cupoNacional'], 'cupoNacional'),
|
|
132
|
+
utilizado: pesos(json['cupoUtilizadoNacional'], 'cupoUtilizadoNacional'),
|
|
133
|
+
disponible: pesos(json['cupoDisponibleNacional'], 'cupoDisponibleNacional'),
|
|
134
|
+
...withOpt('facturado', opt('montoFacturadoNacional', pesos)),
|
|
135
|
+
...withOpt('pagoMinimo', opt('pagoMinimo', pesos)),
|
|
136
|
+
};
|
|
137
|
+
const internacional = {
|
|
138
|
+
total: usd(json['cupoInternacional'], 'cupoInternacional'),
|
|
139
|
+
utilizado: usd(json['cupoUtilizadoInternacional'], 'cupoUtilizadoInternacional'),
|
|
140
|
+
disponible: usd(json['cupoDisponibleInternacional'], 'cupoDisponibleInternacional'),
|
|
141
|
+
...withOpt('facturado', opt('montoFacturadoInternacional', usd)),
|
|
142
|
+
};
|
|
143
|
+
const facturacion = {
|
|
144
|
+
...withOpt('ultima', opt('fechaFacturacion', dmy)),
|
|
145
|
+
...withOpt('proxima', opt('fechaProximaFacturacion', dmy)),
|
|
146
|
+
...withOpt('vencimiento', opt('fechaVencimiento', dmy)),
|
|
147
|
+
...withOpt('vencimientoProximo', opt('fechaVencimientoNoFacturado', dmy)),
|
|
148
|
+
};
|
|
149
|
+
const movimientos = [];
|
|
150
|
+
for (const [key, moneda, facturado] of LISTS) {
|
|
151
|
+
const list = json[key];
|
|
152
|
+
if (absent(list))
|
|
153
|
+
continue;
|
|
154
|
+
if (!Array.isArray(list))
|
|
155
|
+
throw unexpected(key);
|
|
156
|
+
for (const m of list)
|
|
157
|
+
movimientos.push(movimiento(m, moneda, facturado, account));
|
|
158
|
+
}
|
|
159
|
+
const { first, others } = account;
|
|
160
|
+
return {
|
|
161
|
+
tarjeta: {
|
|
162
|
+
banco: BCI.slug,
|
|
163
|
+
tarjeta: first.last4,
|
|
164
|
+
...(others.length ? { adicionales: others.map((c) => c.last4) } : {}),
|
|
165
|
+
descripcion: first.label,
|
|
166
|
+
nacional,
|
|
167
|
+
internacional,
|
|
168
|
+
facturacion,
|
|
169
|
+
},
|
|
170
|
+
movimientos,
|
|
171
|
+
};
|
|
172
|
+
}
|
|
173
|
+
function movimiento(m, moneda, facturado, account) {
|
|
174
|
+
if (!isRecord(m))
|
|
175
|
+
throw unexpected('movimiento de tarjeta');
|
|
176
|
+
const bank = amountIn(moneda)(m['monto'], 'monto de tarjeta').monto;
|
|
177
|
+
// The movement's own label names its card ("<word> **** 0000"), not its sign.
|
|
178
|
+
const label = typeof m['tipo'] === 'string' ? cardLabel(m['tipo']) : '';
|
|
179
|
+
const own = LAST4.exec(label)?.[1];
|
|
180
|
+
const total = m['totalCuotas'];
|
|
181
|
+
const numero = m['numeroCuota'];
|
|
182
|
+
return {
|
|
183
|
+
banco: BCI.slug,
|
|
184
|
+
tarjeta: own ?? account.first.last4,
|
|
185
|
+
fecha: dmy(m['fecha'], 'fecha de tarjeta'),
|
|
186
|
+
descripcion: typeof m['descripcion'] === 'string' ? maskCardNumbers(m['descripcion']) : '',
|
|
187
|
+
monto: money(moneda, bank === 0 ? 0 : -bank),
|
|
188
|
+
tipo: bank < 0 ? 'abono' : 'cargo',
|
|
189
|
+
facturado,
|
|
190
|
+
...(typeof total === 'number' &&
|
|
191
|
+
Number.isInteger(total) &&
|
|
192
|
+
total > 1 &&
|
|
193
|
+
typeof numero === 'number' &&
|
|
194
|
+
Number.isInteger(numero)
|
|
195
|
+
? { cuota: { numero, total } }
|
|
196
|
+
: {}),
|
|
197
|
+
...(m['adicional'] === true ? { adicional: true } : {}),
|
|
198
|
+
};
|
|
199
|
+
}
|
|
200
|
+
//# sourceMappingURL=cards.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cards.js","sourceRoot":"","sources":["../../../src/banks/bci/cards.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAgB,MAAM,sBAAsB,CAAC;AAE/D,OAAO,EAAE,SAAS,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAC;AAC/D,OAAO,EAAE,KAAK,EAAE,kBAAkB,EAA2B,MAAM,sBAAsB,CAAC;AAE1F,OAAO,EAAE,GAAG,EAAE,MAAM,aAAa,CAAC;AAClC,OAAO,EAAE,QAAQ,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AAElD;;;;GAIG;AAEH,MAAM,G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AAC,aAAa,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE;QAC1F,KAAK,EAAE,KAAK,CAAC,MAAM,EAAE,IAAI,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC;QAC5C,IAAI,EAAE,IAAI,GAAG,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,OAAO;QAClC,SAAS;QACT,GAAG,CAAC,OAAO,KAAK,KAAK,QAAQ;YAC7B,MAAM,CAAC,SAAS,CAAC,KAAK,CAAC;YACvB,KAAK,GAAG,CAAC;YACT,OAAO,MAAM,KAAK,QAAQ;YAC1B,MAAM,CAAC,SAAS,CAAC,MAAM,CAAC;YACtB,CAAC,CAAC,EAAE,KAAK,EAAE,EAAE,MAAM,EAAE,KAAK,EAAE,EAAE;YAC9B,CAAC,CAAC,EAAE,CAAC;QACP,GAAG,CAAC,CAAC,CAAC,WAAW,CAAC,KAAK,IAAI,CAAC,CAAC,CAAC,EAAE,SAAS,EAAE,IAAa,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;KACjE,CAAC;AACJ,CAAC"}
|
|
@@ -16,25 +16,32 @@ export declare const BCI: {
|
|
|
16
16
|
readonly pathPrefix: "/web/fe-orq-mo-personas-re-v";
|
|
17
17
|
readonly homeSuffix: "/home";
|
|
18
18
|
readonly miBancoSegment: "/comp/mi_banco/";
|
|
19
|
-
readonly menuMiCuenta: "Mi Cuenta";
|
|
20
|
-
readonly menuUltimosMovimientos: "Últimos Movimientos";
|
|
21
19
|
readonly sessionCookie: "__Host-SESSIONID";
|
|
22
20
|
};
|
|
23
21
|
readonly sessionCookie: "JSESSIONID";
|
|
24
22
|
readonly challengeMarkers: readonly ["__cf_chl_rt_tk", "/cdn-cgi/challenge-platform/"];
|
|
25
23
|
readonly cookieDomainSuffix: "bci.cl";
|
|
26
|
-
readonly
|
|
27
|
-
|
|
28
|
-
|
|
24
|
+
readonly tokenCall: {
|
|
25
|
+
readonly host: "personas.bci.cl";
|
|
26
|
+
readonly path: "/api/api-auth-personas/v1/connectors/td";
|
|
27
|
+
};
|
|
28
|
+
readonly apps: {
|
|
29
|
+
readonly saldos: "https://personas.bci.cl/modernizacion/fe-saldosultimosmovpersonas/";
|
|
30
|
+
readonly cuentas: "https://personas.bci.cl/nuevaWeb/fe-cartolashistoricaspersonas/";
|
|
31
|
+
readonly tarjetas: "https://personas.bci.cl/andes/fe-mismovimientos/";
|
|
32
|
+
};
|
|
29
33
|
readonly api: {
|
|
30
|
-
readonly
|
|
34
|
+
readonly cuentas: "https://apilocal.bci.cl/bci-produccion/api-bci/operaciones-transversales-de-producto/gestion-de-cuenta/ms-gestioncuentascliente-neg/v3.11/SolicitarClienteCuentas";
|
|
31
35
|
readonly saldoPorCuenta: "https://apilocal.bci.cl/bci-produccion/api-bci/bff-saldosyultimosmovimientoswebpersonas/v3.2/cuentas-busquedas/por-numero-cuenta";
|
|
32
36
|
readonly movimientosPorCuenta: "https://apilocal.bci.cl/bci-produccion/api-bci/bff-saldosyultimosmovimientoswebpersonas/v3.2/cuentas-movimientos/por-numero-cuenta";
|
|
37
|
+
readonly tarjetasLista: "https://apilocal.bci.cl/bci-produccion/api-bci/operaciones-y-ejecucion/tarjetas/ms-movimientostdcpersonasweb-exp/v2.0/mov-tdc/";
|
|
38
|
+
readonly informacionTarjeta: "https://apilocal.bci.cl/bci-produccion/api-bci/operaciones-y-ejecucion/tarjetas/ms-movimientostdcpersonasweb-exp/v2.0/mov-tdc/informacion-tdc";
|
|
33
39
|
};
|
|
34
40
|
readonly movementSign: {
|
|
35
41
|
readonly C: "cargo";
|
|
36
42
|
readonly A: "abono";
|
|
37
43
|
};
|
|
38
|
-
readonly apiHeaders: readonly ["
|
|
44
|
+
readonly apiHeaders: readonly ["content-type", "application-id", "channel", "reference-service", "reference-operation", "x-ibm-client-id", "origin-addr", "tracking-id"];
|
|
45
|
+
readonly apiAccept: "application/json, text/plain, */*";
|
|
39
46
|
};
|
|
40
47
|
//# sourceMappingURL=config.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../../../src/banks/bci/config.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,eAAO,MAAM,GAAG
|
|
1
|
+
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../../../src/banks/bci/config.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,eAAO,MAAM,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA2GN,CAAC"}
|
package/dist/banks/bci/config.js
CHANGED
|
@@ -29,12 +29,6 @@ export const BCI = {
|
|
|
29
29
|
pathPrefix: '/web/fe-orq-mo-personas-re-v',
|
|
30
30
|
homeSuffix: '/home',
|
|
31
31
|
miBancoSegment: '/comp/mi_banco/',
|
|
32
|
-
// observed at https://personas.bci.cl/web/fe-orq-mo-personas-re-v1-7/comp/mi_banco/cl/bci/aplicaciones/menu/vistas/inicio/miBanco
|
|
33
|
-
// on 2026-09-28: the user's path to the saldos app — the main frame's link
|
|
34
|
-
// "Mi Cuenta", then its link "Últimos Movimientos" (both href="#"), which
|
|
35
|
-
// routes to /comp/embedded?url=… and loads the app with ?token=… in an iframe
|
|
36
|
-
menuMiCuenta: 'Mi Cuenta',
|
|
37
|
-
menuUltimosMovimientos: 'Últimos Movimientos',
|
|
38
32
|
// observed on personas.bci.cl on 2026-09-28: the only session cookie at this
|
|
39
33
|
// landing — httpOnly, persistent; JSESSIONID on www.bci.cl no longer exists
|
|
40
34
|
sessionCookie: '__Host-SESSIONID',
|
|
@@ -46,32 +40,48 @@ export const BCI = {
|
|
|
46
40
|
challengeMarkers: ['__cf_chl_rt_tk', '/cdn-cgi/challenge-platform/'],
|
|
47
41
|
// Only the bank's own cookies are stored; trackers are dropped.
|
|
48
42
|
cookieDomainSuffix: 'bci.cl',
|
|
49
|
-
// observed at https://personas.bci.cl/
|
|
50
|
-
//
|
|
51
|
-
|
|
52
|
-
//
|
|
53
|
-
//
|
|
54
|
-
|
|
55
|
-
// observed
|
|
56
|
-
//
|
|
57
|
-
|
|
43
|
+
// observed at https://personas.bci.cl/api/api-auth-personas/v1/connectors/td on
|
|
44
|
+
// 2026-09-29 and 2026-10-07: right after the landing the orchestrator itself
|
|
45
|
+
// POSTs here (session cookie, no bearer) and gets {cpi, access_token}; that
|
|
46
|
+
// token is the bearer of every apilocal read (ADR-018). Answered 3 s after the
|
|
47
|
+
// landing on 2026-10-07.
|
|
48
|
+
tokenCall: { host: 'personas.bci.cl', path: '/api/api-auth-personas/v1/connectors/td' },
|
|
49
|
+
// observed at these URLs on 2026-10-07: each app's public shell, served with
|
|
50
|
+
// no session; it names the app's main.<hash>.js, whose HTTP interceptor holds
|
|
51
|
+
// the app's own API headers (ADR-018). Headers come from there at every login.
|
|
52
|
+
apps: {
|
|
53
|
+
// the balances-and-latest-movements app (reads saldo and movimientos)
|
|
54
|
+
saldos: 'https://personas.bci.cl/modernizacion/fe-saldosultimosmovpersonas/',
|
|
55
|
+
// the statements app: its SolicitarClienteCuentas lists accounts with no RUT
|
|
56
|
+
cuentas: 'https://personas.bci.cl/nuevaWeb/fe-cartolashistoricaspersonas/',
|
|
57
|
+
// the credit cards' "Mis movimientos" app
|
|
58
|
+
tarjetas: 'https://personas.bci.cl/andes/fe-mismovimientos/',
|
|
59
|
+
},
|
|
58
60
|
// observed at https://apilocal.bci.cl/bci-produccion/api-bci/bff-saldosyultimosmovimientoswebpersonas/v3.2/ on 2026-09-25
|
|
59
61
|
api: {
|
|
60
|
-
|
|
62
|
+
// observed at this URL on 2026-09-25 (sent by the statements app) and sent from
|
|
63
|
+
// Node with that app's bundle headers on 2026-10-07 → 200: GET, no body, no RUT
|
|
64
|
+
cuentas: 'https://apilocal.bci.cl/bci-produccion/api-bci/operaciones-transversales-de-producto/gestion-de-cuenta/ms-gestioncuentascliente-neg/v3.11/SolicitarClienteCuentas',
|
|
61
65
|
saldoPorCuenta: 'https://apilocal.bci.cl/bci-produccion/api-bci/bff-saldosyultimosmovimientoswebpersonas/v3.2/cuentas-busquedas/por-numero-cuenta',
|
|
62
66
|
// body {numeroCuenta}; the latest movements, no range, no paging (50 seen)
|
|
63
67
|
movimientosPorCuenta: 'https://apilocal.bci.cl/bci-produccion/api-bci/bff-saldosyultimosmovimientoswebpersonas/v3.2/cuentas-movimientos/por-numero-cuenta',
|
|
68
|
+
// observed at https://apilocal.bci.cl/bci-produccion/api-bci/operaciones-y-ejecucion/tarjetas/ms-movimientostdcpersonasweb-exp/v2.0/mov-tdc/
|
|
69
|
+
// on 2026-09-29: GET, no body — the cards app's own card list, one entry per plastic
|
|
70
|
+
tarjetasLista: 'https://apilocal.bci.cl/bci-produccion/api-bci/operaciones-y-ejecucion/tarjetas/ms-movimientostdcpersonasweb-exp/v2.0/mov-tdc/',
|
|
71
|
+
// observed at the same base on 2026-09-29: POST {numeroCuenta, numeroTarjeta}
|
|
72
|
+
// → quotas, billing dates and billed and unbilled movements of one card;
|
|
73
|
+
// answered 200 from Node with the cards app's headers only (contract)
|
|
74
|
+
informacionTarjeta: 'https://apilocal.bci.cl/bci-produccion/api-bci/operaciones-y-ejecucion/tarjetas/ms-movimientostdcpersonasweb-exp/v2.0/mov-tdc/informacion-tdc',
|
|
64
75
|
},
|
|
65
76
|
// observed on cuentas-movimientos/por-numero-cuenta answers on 2026-09-25: only
|
|
66
77
|
// these letters. C = cargo, A = abono confirmed against the bank's app on
|
|
67
78
|
// 2026-09-28 (contract); others fail.
|
|
68
79
|
movementSign: { C: 'cargo', A: 'abono' },
|
|
69
80
|
// observed on apilocal.bci.cl requests of the saldos app on 2026-09-25: the
|
|
70
|
-
// headers it sends besides what the browser adds itself
|
|
81
|
+
// headers it sends besides what the browser adds itself. Only these are taken
|
|
82
|
+
// from a bundle's interceptor; `authorization` is built from the token.
|
|
71
83
|
apiHeaders: [
|
|
72
|
-
'accept',
|
|
73
84
|
'content-type',
|
|
74
|
-
'authorization',
|
|
75
85
|
'application-id',
|
|
76
86
|
'channel',
|
|
77
87
|
'reference-service',
|
|
@@ -80,5 +90,8 @@ export const BCI = {
|
|
|
80
90
|
'origin-addr',
|
|
81
91
|
'tracking-id',
|
|
82
92
|
],
|
|
93
|
+
// Angular HttpClient's default Accept, which the apps' requests carry; sent
|
|
94
|
+
// from Node with every read on 2026-10-07 → 200.
|
|
95
|
+
apiAccept: 'application/json, text/plain, */*',
|
|
83
96
|
};
|
|
84
97
|
//# sourceMappingURL=config.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"config.js","sourceRoot":"","sources":["../../../src/banks/bci/config.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,MAAM,CAAC,MAAM,GAAG,GAAG;IACjB,IAAI,EAAE,KAAK;IACX,IAAI,EAAE,KAAK;IACX,IAAI,EAAE,gCAAgC;IAEtC,mFAAmF;IACnF,0EAA0E;IAC1E,aAAa,EAAE,wDAAwD;IAEvE,gEAAgE;IAChE,0EAA0E;IAC1E,OAAO,EAAE,YAAY;IACrB,aAAa,EAAE,mBAAmB;IAElC,iFAAiF;IACjF,gEAAgE;IAChE,SAAS,EAAE;QACT,oCAAoC;QACpC,qDAAqD;KACtD;IAED,wFAAwF;IACxF,iFAAiF;IACjF,oFAAoF;IACpF,2EAA2E;IAC3E,YAAY,EAAE;QACZ,IAAI,EAAE,iBAAiB;QACvB,UAAU,EAAE,8BAA8B;QAC1C,UAAU,EAAE,OAAO;QACnB,cAAc,EAAE,iBAAiB;QACjC,
|
|
1
|
+
{"version":3,"file":"config.js","sourceRoot":"","sources":["../../../src/banks/bci/config.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,MAAM,CAAC,MAAM,GAAG,GAAG;IACjB,IAAI,EAAE,KAAK;IACX,IAAI,EAAE,KAAK;IACX,IAAI,EAAE,gCAAgC;IAEtC,mFAAmF;IACnF,0EAA0E;IAC1E,aAAa,EAAE,wDAAwD;IAEvE,gEAAgE;IAChE,0EAA0E;IAC1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