@pax2pay/model-banking 0.1.467 → 0.1.468
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/Client/Processor/Tpl.ts +22 -0
- package/Client/Processor/index.ts +9 -0
- package/Client/index.ts +2 -0
- package/dist/Client/Processor/Tpl.d.ts +12 -0
- package/dist/Client/Processor/Tpl.js +10 -0
- package/dist/Client/Processor/Tpl.js.map +1 -0
- package/dist/Client/Processor/index.d.ts +7 -0
- package/dist/Client/Processor/index.js +8 -0
- package/dist/Client/Processor/index.js.map +1 -0
- package/dist/Client/index.d.ts +2 -0
- package/dist/Client/index.js +2 -0
- package/dist/Client/index.js.map +1 -1
- package/dist/reports/visa/Data/Country.d.ts +1 -0
- package/dist/reports/visa/Data/Country.js +13 -0
- package/dist/reports/visa/Data/Country.js.map +1 -1
- package/dist/reports/visa/Data/Monthly.d.ts +2 -0
- package/dist/reports/visa/Data/Monthly.js +17 -5
- package/dist/reports/visa/Data/Monthly.js.map +1 -1
- package/dist/reports/visa/Data/NonMonthly.d.ts +2 -1
- package/dist/reports/visa/Data/NonMonthly.js +18 -7
- package/dist/reports/visa/Data/NonMonthly.js.map +1 -1
- package/dist/reports/visa/Data/Regional.d.ts +1 -0
- package/dist/reports/visa/Data/Regional.js +7 -0
- package/dist/reports/visa/Data/Regional.js.map +1 -1
- package/dist/reports/visa/Data/index.d.ts +3 -2
- package/dist/reports/visa/Data/index.js +10 -1
- package/dist/reports/visa/Data/index.js.map +1 -1
- package/package.json +1 -1
- package/reports/visa/Data/Country.ts +12 -0
- package/reports/visa/Data/Monthly.ts +20 -5
- package/reports/visa/Data/NonMonthly.ts +15 -6
- package/reports/visa/Data/Regional.ts +6 -0
- package/reports/visa/Data/index.ts +10 -2
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { gracely } from "gracely"
|
|
2
|
+
import { http } from "cloudly-http"
|
|
3
|
+
import { storage } from "cloudly-storage"
|
|
4
|
+
import { Card } from "../../Card"
|
|
5
|
+
import { reports } from "../../reports"
|
|
6
|
+
|
|
7
|
+
export class Tpl {
|
|
8
|
+
constructor(private readonly client: http.Client) {}
|
|
9
|
+
|
|
10
|
+
async getQuarterly(
|
|
11
|
+
stack: Card.Stack,
|
|
12
|
+
[start, end]: NonNullable<storage.KeyValueStore.ListOptions["range"]>,
|
|
13
|
+
cursor?: string,
|
|
14
|
+
limit?: number
|
|
15
|
+
): Promise<(reports.visa.Data & { cursor?: string }) | gracely.Error> {
|
|
16
|
+
const search =
|
|
17
|
+
`?start=${start}&end=${end}` + `${cursor ? `&cursor=${cursor}` : ""}` + `${limit ? `&limit=${limit}` : ""}`
|
|
18
|
+
return await this.client.get<reports.visa.Data & { cursor?: string }>(
|
|
19
|
+
`/processor/${stack}/report/quarterly${search}`
|
|
20
|
+
)
|
|
21
|
+
}
|
|
22
|
+
}
|
package/Client/index.ts
CHANGED
|
@@ -9,6 +9,7 @@ import { Labels } from "./Labels"
|
|
|
9
9
|
import { Logs } from "./Logs"
|
|
10
10
|
import { Operations } from "./Operations"
|
|
11
11
|
import { Organizations } from "./Organizations"
|
|
12
|
+
import { Processor } from "./Processor"
|
|
12
13
|
import { Reports } from "./Reports"
|
|
13
14
|
import { Rules } from "./Rules"
|
|
14
15
|
import { Settlements } from "./Settlements"
|
|
@@ -35,6 +36,7 @@ export class Client {
|
|
|
35
36
|
readonly groups = new Labels(this.client, "group")
|
|
36
37
|
readonly userwidgets = (server: string, application: string) =>
|
|
37
38
|
new userwidgets.ClientCollection(new http.Client(server), { application })
|
|
39
|
+
readonly processors = new Processor(this.client)
|
|
38
40
|
readonly version = new Version(this.client)
|
|
39
41
|
onUnauthorized?: (client: Client) => Promise<boolean>
|
|
40
42
|
private constructor(private readonly client: http.Client<gracely.Error>) {
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { gracely } from "gracely";
|
|
2
|
+
import { http } from "cloudly-http";
|
|
3
|
+
import { storage } from "cloudly-storage";
|
|
4
|
+
import { Card } from "../../Card";
|
|
5
|
+
import { reports } from "../../reports";
|
|
6
|
+
export declare class Tpl {
|
|
7
|
+
private readonly client;
|
|
8
|
+
constructor(client: http.Client);
|
|
9
|
+
getQuarterly(stack: Card.Stack, [start, end]: NonNullable<storage.KeyValueStore.ListOptions["range"]>, cursor?: string, limit?: number): Promise<(reports.visa.Data & {
|
|
10
|
+
cursor?: string;
|
|
11
|
+
}) | gracely.Error>;
|
|
12
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export class Tpl {
|
|
2
|
+
constructor(client) {
|
|
3
|
+
this.client = client;
|
|
4
|
+
}
|
|
5
|
+
async getQuarterly(stack, [start, end], cursor, limit) {
|
|
6
|
+
const search = `?start=${start}&end=${end}` + `${cursor ? `&cursor=${cursor}` : ""}` + `${limit ? `&limit=${limit}` : ""}`;
|
|
7
|
+
return await this.client.get(`/processor/${stack}/report/quarterly${search}`);
|
|
8
|
+
}
|
|
9
|
+
}
|
|
10
|
+
//# sourceMappingURL=Tpl.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Tpl.js","sourceRoot":"../","sources":["Client/Processor/Tpl.ts"],"names":[],"mappings":"AAMA,MAAM,OAAO,GAAG;IACf,YAA6B,MAAmB;QAAnB,WAAM,GAAN,MAAM,CAAa;IAAG,CAAC;IAEpD,KAAK,CAAC,YAAY,CACjB,KAAiB,EACjB,CAAC,KAAK,EAAE,GAAG,CAA0D,EACrE,MAAe,EACf,KAAc;QAEd,MAAM,MAAM,GACX,UAAU,KAAK,QAAQ,GAAG,EAAE,GAAG,GAAG,MAAM,CAAC,CAAC,CAAC,WAAW,MAAM,EAAE,CAAC,CAAC,CAAC,EAAE,EAAE,GAAG,GAAG,KAAK,CAAC,CAAC,CAAC,UAAU,KAAK,EAAE,CAAC,CAAC,CAAC,EAAE,EAAE,CAAA;QAC5G,OAAO,MAAM,IAAI,CAAC,MAAM,CAAC,GAAG,CAC3B,cAAc,KAAK,oBAAoB,MAAM,EAAE,CAC/C,CAAA;IACF,CAAC;CACD"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"../","sources":["Client/Processor/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,GAAG,EAAE,MAAM,OAAO,CAAA;AAE3B,MAAM,OAAO,SAAS;IAErB,YAA6B,MAAmB;QAAnB,WAAM,GAAN,MAAM,CAAa;QAC/C,IAAI,CAAC,GAAG,GAAG,IAAI,GAAG,CAAC,IAAI,CAAC,MAAM,CAAC,CAAA;IAChC,CAAC;CACD"}
|
package/dist/Client/index.d.ts
CHANGED
|
@@ -8,6 +8,7 @@ import { Labels } from "./Labels";
|
|
|
8
8
|
import { Logs } from "./Logs";
|
|
9
9
|
import { Operations } from "./Operations";
|
|
10
10
|
import { Organizations } from "./Organizations";
|
|
11
|
+
import { Processor } from "./Processor";
|
|
11
12
|
import { Reports } from "./Reports";
|
|
12
13
|
import { Rules } from "./Rules";
|
|
13
14
|
import { Settlements } from "./Settlements";
|
|
@@ -33,6 +34,7 @@ export declare class Client {
|
|
|
33
34
|
readonly flags: Labels;
|
|
34
35
|
readonly groups: Labels;
|
|
35
36
|
readonly userwidgets: (server: string, application: string) => userwidgets.ClientCollection;
|
|
37
|
+
readonly processors: Processor;
|
|
36
38
|
readonly version: Version;
|
|
37
39
|
onUnauthorized?: (client: Client) => Promise<boolean>;
|
|
38
40
|
private constructor();
|
package/dist/Client/index.js
CHANGED
|
@@ -8,6 +8,7 @@ import { Labels } from "./Labels";
|
|
|
8
8
|
import { Logs } from "./Logs";
|
|
9
9
|
import { Operations } from "./Operations";
|
|
10
10
|
import { Organizations } from "./Organizations";
|
|
11
|
+
import { Processor } from "./Processor";
|
|
11
12
|
import { Reports } from "./Reports";
|
|
12
13
|
import { Rules } from "./Rules";
|
|
13
14
|
import { Settlements } from "./Settlements";
|
|
@@ -32,6 +33,7 @@ export class Client {
|
|
|
32
33
|
this.flags = new Labels(this.client, "flag");
|
|
33
34
|
this.groups = new Labels(this.client, "group");
|
|
34
35
|
this.userwidgets = (server, application) => new userwidgets.ClientCollection(new http.Client(server), { application });
|
|
36
|
+
this.processors = new Processor(this.client);
|
|
35
37
|
this.version = new Version(this.client);
|
|
36
38
|
this.client.onUnauthorized = async () => this.onUnauthorized != undefined && (await this.onUnauthorized(this));
|
|
37
39
|
}
|
package/dist/Client/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"../","sources":["Client/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAA;AAChD,OAAO,EAAE,IAAI,EAAE,MAAM,cAAc,CAAA;AACnC,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAA;AACrC,OAAO,EAAE,KAAK,EAAE,MAAM,SAAS,CAAA;AAC/B,OAAO,EAAE,KAAK,EAAE,MAAM,SAAS,CAAA;AAC/B,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAA;AACvC,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAA;AACjC,OAAO,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAA;AAC7B,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAA;AACzC,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAA;AAC/C,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAA;AACnC,OAAO,EAAE,KAAK,EAAE,MAAM,SAAS,CAAA;AAC/B,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAA;AAC3C,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAA;AAC7C,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAA;AACrC,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAA;AAEnC,MAAM,OAAO,MAAM;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"../","sources":["Client/index.ts"],"names":[],"mappings":"AAC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ace Country {
|
|
|
11
11
|
function toCsv(country: Country): string;
|
|
12
12
|
function csvLine(country: string, region: Region, data: PerCountry, presence: "present" | "notPresent", type: "count" | "volume"): string;
|
|
13
13
|
function update(country: Country, transaction: Transaction.CardTransaction): Country;
|
|
14
|
+
function merge(previous: Country, addition: Country): Country;
|
|
14
15
|
}
|
|
15
16
|
export {};
|
|
@@ -39,5 +39,18 @@ export var Country;
|
|
|
39
39
|
result[key] = Monthly.update(result[key], transaction);
|
|
40
40
|
return result;
|
|
41
41
|
}
|
|
42
|
+
function merge(previous, addition) {
|
|
43
|
+
const result = {};
|
|
44
|
+
for (const country of Object.keys(previous).concat(Object.keys(addition)))
|
|
45
|
+
result[country] = mergePerCountry(previous[country] ?? {}, addition[country] ?? {});
|
|
46
|
+
return result;
|
|
47
|
+
}
|
|
48
|
+
Country.merge = merge;
|
|
42
49
|
})(Country || (Country = {}));
|
|
50
|
+
function mergePerCountry(previous, addition) {
|
|
51
|
+
return {
|
|
52
|
+
present: Monthly.merge(previous.present, addition.present),
|
|
53
|
+
notPresent: Monthly.merge(previous.notPresent, addition.notPresent),
|
|
54
|
+
};
|
|
55
|
+
}
|
|
43
56
|
//# sourceMappingURL=Country.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Country.js","sourceRoot":"../","sources":["reports/visa/Data/Country.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,GAAG,EAAE,MAAM,OAAO,CAAA;AAC3B,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAA;AACnC,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAA;AASjC,MAAM,KAAW,OAAO,
|
|
1
|
+
{"version":3,"file":"Country.js","sourceRoot":"../","sources":["reports/visa/Data/Country.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,GAAG,EAAE,MAAM,OAAO,CAAA;AAC3B,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAA;AACnC,OAAO,EAAE,MAAM,EAAE,MAA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Q,CAAC,OAAO,CAAC,IAAI,EAAE,CAAC,CAAA;QACpF,OAAO,MAAM,CAAA;IACd,CAAC;IALe,aAAK,QAKpB,CAAA;AACF,CAAC,EAnDgB,OAAO,KAAP,OAAO,QAmDvB;AACD,SAAS,eAAe,CAAC,QAAoB,EAAE,QAAoB;IAClE,OAAO;QACN,OAAO,EAAE,OAAO,CAAC,KAAK,CAAC,QAAQ,CAAC,OAAO,EAAE,QAAQ,CAAC,OAAO,CAAC;QAC1D,UAAU,EAAE,OAAO,CAAC,KAAK,CAAC,QAAQ,CAAC,UAAU,EAAE,QAAQ,CAAC,UAAU,CAAC;KACnE,CAAA;AACF,CAAC"}
|
|
@@ -10,5 +10,7 @@ export declare namespace Monthly {
|
|
|
10
10
|
const values: readonly [1, 2, 3];
|
|
11
11
|
}
|
|
12
12
|
function getMonth(transaction: Transaction.CardTransaction): Monthly.Month;
|
|
13
|
+
function empty(): Monthly;
|
|
13
14
|
function update(previous: Monthly | undefined, transaction: Transaction.CardTransaction): Monthly;
|
|
15
|
+
function merge(previous: Monthly | undefined, addition: Monthly | undefined): Monthly;
|
|
14
16
|
}
|
|
@@ -11,12 +11,12 @@ export var Monthly;
|
|
|
11
11
|
return (((month - 1) % 3) + 1);
|
|
12
12
|
}
|
|
13
13
|
Monthly.getMonth = getMonth;
|
|
14
|
+
function empty() {
|
|
15
|
+
return { "1": { count: {}, volume: {} }, "2": { count: {}, volume: {} }, "3": { count: {}, volume: {} } };
|
|
16
|
+
}
|
|
17
|
+
Monthly.empty = empty;
|
|
14
18
|
function update(previous, transaction) {
|
|
15
|
-
const result = previous ??
|
|
16
|
-
"1": { count: {}, volume: {} },
|
|
17
|
-
"2": { count: {}, volume: {} },
|
|
18
|
-
"3": { count: {}, volume: {} },
|
|
19
|
-
};
|
|
19
|
+
const result = previous ?? empty();
|
|
20
20
|
if (transaction.direction == "outbound" && transaction.status == "finalized") {
|
|
21
21
|
const month = getMonth(transaction);
|
|
22
22
|
result[month].count[transaction.account.iin] =
|
|
@@ -30,5 +30,17 @@ export var Monthly;
|
|
|
30
30
|
return result;
|
|
31
31
|
}
|
|
32
32
|
Monthly.update = update;
|
|
33
|
+
function merge(previous, addition) {
|
|
34
|
+
const result = empty();
|
|
35
|
+
previous ??= empty();
|
|
36
|
+
addition ??= empty();
|
|
37
|
+
for (const month of Monthly.Month.values)
|
|
38
|
+
for (const iin of Iin.values) {
|
|
39
|
+
result[month].count[iin] = (previous[month].count[iin] ?? 0) + (addition[month].count[iin] ?? 0);
|
|
40
|
+
result[month].volume[iin] = isoly.Currency.add("GBP", previous[month].volume[iin] ?? 0, addition[month].volume[iin] ?? 0);
|
|
41
|
+
}
|
|
42
|
+
return result;
|
|
43
|
+
}
|
|
44
|
+
Monthly.merge = merge;
|
|
33
45
|
})(Monthly || (Monthly = {}));
|
|
34
46
|
//# sourceMappingURL=Monthly.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Monthly.js","sourceRoot":"../","sources":["reports/visa/Data/Monthly.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,OAAO,CAAA;AAE7B,OAAO,EAAE,GAAG,EAAE,MAAM,OAAO,CAAA;AAM3B,MAAM,KAAW,OAAO,
|
|
1
|
+
{"version":3,"file":"Monthly.js","sourceRoot":"../","sources":["reports/visa/Data/Monthly.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,OAAO,CAAA;AAE7B,OAAO,EAAE,GAAG,EAAE,MAAM,OAAO,CAAA;AAM3B,MAAM,KAAW,OAAO,CAmDvB;AAnDD,WAAiB,OAAO;IAEvB,IAAiB,KAAK,CAErB;IAFD,WAAiB,KAAK;QACR,YAAM,GAAG,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAU,CAAA;IACzC,CAAC,EAFgB,KAAK,GAAL,aAAK,KAAL,aAAK,QAErB;IAED,SAAgB,QAAQ,CAAC,WAAwC;QAChE,MAAM,KAAK,GAAG,K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,CAAC,MAAM,CAAC,GAAG,CAAC,GAAG,KAAK,CAAC,QAAQ,CAAC,GAAG,CAC7C,KAAK,EACL,QAAQ,CAAC,KAAK,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC,IAAI,CAAC,EAChC,QAAQ,CAAC,KAAK,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC,IAAI,CAAC,CAChC,CAAA;YACF,CAAC;QAEF,OAAO,MAAM,CAAA;IACd,CAAC;IAfe,aAAK,QAepB,CAAA;AACF,CAAC,EAnDgB,OAAO,KAAP,OAAO,QAmDvB"}
|
|
@@ -3,7 +3,8 @@ import { rows } from "../rows";
|
|
|
3
3
|
import { Iin } from "./Iin";
|
|
4
4
|
export type NonMonthly = Record<"Total Number of Cards" | "Total Number of Active Cards" | "Total Number of Accounts" | "Number of Accounts - International Enabled" | "Payments Transactions Declined for Insufficient Funds - Number", Partial<Record<Iin, number>>>;
|
|
5
5
|
export declare namespace NonMonthly {
|
|
6
|
-
|
|
6
|
+
function empty(): NonMonthly;
|
|
7
7
|
function update(previous: NonMonthly, transaction: Transaction.CardTransaction): NonMonthly;
|
|
8
8
|
function toCsvRow(data: NonMonthly, row: rows.NonZero): string;
|
|
9
|
+
function merge(previous: NonMonthly, addition: NonMonthly): NonMonthly;
|
|
9
10
|
}
|
|
@@ -1,13 +1,16 @@
|
|
|
1
1
|
import { Iin } from "./Iin";
|
|
2
2
|
export var NonMonthly;
|
|
3
3
|
(function (NonMonthly) {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
4
|
+
function empty() {
|
|
5
|
+
return {
|
|
6
|
+
"Number of Accounts - International Enabled": {},
|
|
7
|
+
"Payments Transactions Declined for Insufficient Funds - Number": {},
|
|
8
|
+
"Total Number of Accounts": {},
|
|
9
|
+
"Total Number of Active Cards": {},
|
|
10
|
+
"Total Number of Cards": {},
|
|
11
|
+
};
|
|
12
|
+
}
|
|
13
|
+
NonMonthly.empty = empty;
|
|
11
14
|
function update(previous, transaction) {
|
|
12
15
|
const result = previous;
|
|
13
16
|
if (Array.isArray(transaction.status) && transaction.status[1] == "insufficient funds")
|
|
@@ -25,5 +28,13 @@ export var NonMonthly;
|
|
|
25
28
|
return result;
|
|
26
29
|
}
|
|
27
30
|
NonMonthly.toCsvRow = toCsvRow;
|
|
31
|
+
function merge(previous, addition) {
|
|
32
|
+
const result = empty();
|
|
33
|
+
for (const key of Object.keys(result))
|
|
34
|
+
for (const iin of Iin.values)
|
|
35
|
+
result[key][iin] = (previous[key]?.[iin] ?? 0) + (addition[key]?.[iin] ?? 0);
|
|
36
|
+
return result;
|
|
37
|
+
}
|
|
38
|
+
NonMonthly.merge = merge;
|
|
28
39
|
})(NonMonthly || (NonMonthly = {}));
|
|
29
40
|
//# sourceMappingURL=NonMonthly.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"NonMonthly.js","sourceRoot":"../","sources":["reports/visa/Data/NonMonthly.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,GAAG,EAAE,MAAM,OAAO,CAAA;AAU3B,MAAM,KAAW,UAAU,
|
|
1
|
+
{"version":3,"file":"NonMonthly.js","sourceRoot":"../","sources":["reports/visa/Data/NonMonthly.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,GAAG,EAAE,MAAM,OAAO,CAAA;AAU3B,MAAM,KAAW,UAAU,CAgC1B;AAhCD,WAAiB,UAAU;IAC1B,SAAgB,KAAK;QACpB,OAAO;YACN,4CAA4C,EAAE,EAAE;YAChD,gEAAgE,EAAE,EAAE;YACpE,0BAA0B,EAAE,EAAE;YAC9B,8BAA8B,EAAE,EAAE;YAClC,uBAAuB,EAAE,EAAE;SAC3B,CAAA;IACF,CAAC;IARe,gBAAK,QAQpB,CAAA;IACD,SAAgB,MAAM,CAAC,QAAoB,EAAE,WAAwC;QACpF,MAAM,MAAM,GAAG,QAAQ,CAAA;QACvB,IAAI,KAAK,CAAC,O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";
|
|
|
4
4
|
export type Regional = Partial<Record<Region, Monthly>>;
|
|
5
5
|
export declare namespace Regional {
|
|
6
6
|
function update(previous: Regional, transaction: Transaction.CardTransaction): Regional;
|
|
7
|
+
function merge(previous: Regional, addition: Regional): Regional;
|
|
7
8
|
function toCsvRow(regional: Regional, row: string): string;
|
|
8
9
|
}
|
|
@@ -10,6 +10,13 @@ export var Regional;
|
|
|
10
10
|
return result;
|
|
11
11
|
}
|
|
12
12
|
Regional.update = update;
|
|
13
|
+
function merge(previous, addition) {
|
|
14
|
+
const result = {};
|
|
15
|
+
for (const region of Region.values)
|
|
16
|
+
result[region] = Monthly.merge(previous[region], addition[region]);
|
|
17
|
+
return result;
|
|
18
|
+
}
|
|
19
|
+
Regional.merge = merge;
|
|
13
20
|
function toCsvRow(regional, row) {
|
|
14
21
|
let result = "";
|
|
15
22
|
const region = Region.fromRow(row);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Regional.js","sourceRoot":"../","sources":["reports/visa/Data/Regional.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,GAAG,EAAE,MAAM,OAAO,CAAA;AAC3B,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAA;AACnC,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAA;AAGjC,MAAM,KAAW,QAAQ,
|
|
1
|
+
{"version":3,"file":"Regional.js","sourceRoot":"../","sources":["reports/visa/Data/Regional.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,GAAG,EAAE,MAAM,OAAO,CAAA;AAC3B,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAA;AACnC,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAA;AAGjC,MAAM,KAAW,QAAQ,CAyBxB;AAzBD,WAAiB,QAAQ;IACxB,SAAgB,MAAM,CAAC,QAAkB,EAAE,WAAwC;QAClF,MAAM,MAAM,GAAG,MAAM,CAAC,IAAI,CAAC,WAAW,CAAC,WAAW,CAAC,QAAQ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AXe,iBAAQ,WAWvB,CAAA;AACF,CAAC,EAzBgB,QAAQ,KAAR,QAAQ,QAyBxB"}
|
|
@@ -4,14 +4,15 @@ import { Country as DataCountry } from "./Country";
|
|
|
4
4
|
import { Iin as DataIin } from "./Iin";
|
|
5
5
|
import { NonMonthly } from "./NonMonthly";
|
|
6
6
|
import { Regional } from "./Regional";
|
|
7
|
-
export
|
|
7
|
+
export interface Data {
|
|
8
8
|
regional: Regional;
|
|
9
9
|
nonMonthly: NonMonthly;
|
|
10
10
|
country: Data.Country;
|
|
11
|
-
}
|
|
11
|
+
}
|
|
12
12
|
export declare namespace Data {
|
|
13
13
|
export import Iin = DataIin;
|
|
14
14
|
export import Country = DataCountry;
|
|
15
15
|
function create(transactions: Transaction.CardTransaction[]): Data;
|
|
16
|
+
function merge(previous: Data, addition: Data): Data;
|
|
16
17
|
function toCsv(data: Data, row: rows.NonZero): string;
|
|
17
18
|
}
|
|
@@ -7,7 +7,7 @@ export var Data;
|
|
|
7
7
|
Data.Iin = DataIin;
|
|
8
8
|
Data.Country = DataCountry;
|
|
9
9
|
function create(transactions) {
|
|
10
|
-
const result = { regional: {}, nonMonthly: NonMonthly.empty, country: {} };
|
|
10
|
+
const result = { regional: {}, nonMonthly: NonMonthly.empty(), country: {} };
|
|
11
11
|
for (const transaction of transactions) {
|
|
12
12
|
result.nonMonthly = NonMonthly.update(result.nonMonthly, transaction);
|
|
13
13
|
result.regional = Regional.update(result.regional, transaction);
|
|
@@ -16,6 +16,15 @@ export var Data;
|
|
|
16
16
|
return result;
|
|
17
17
|
}
|
|
18
18
|
Data.create = create;
|
|
19
|
+
function merge(previous, addition) {
|
|
20
|
+
const result = {
|
|
21
|
+
regional: Regional.merge(previous.regional, addition.regional),
|
|
22
|
+
nonMonthly: NonMonthly.merge(previous.nonMonthly, addition.nonMonthly),
|
|
23
|
+
country: Data.Country.merge(previous.country, addition.country),
|
|
24
|
+
};
|
|
25
|
+
return result;
|
|
26
|
+
}
|
|
27
|
+
Data.merge = merge;
|
|
19
28
|
function toCsv(data, row) {
|
|
20
29
|
let result;
|
|
21
30
|
if (row.endsWith("Month x"))
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"../","sources":["reports/visa/Data/index.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,OAAO,IAAI,WAAW,EAAE,MAAM,WAAW,CAAA;AAClD,OAAO,EAAE,GAAG,IAAI,OAAO,EAAE,MAAM,OAAO,CAAA;AACtC,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAA;AACzC,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAA;AAOrC,MAAM,KAAW,IAAI,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"../","sources":["reports/visa/Data/index.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,OAAO,IAAI,WAAW,EAAE,MAAM,WAAW,CAAA;AAClD,OAAO,EAAE,GAAG,IAAI,OAAO,EAAE,MAAM,OAAO,CAAA;AACtC,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAA;AACzC,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAA;AAOrC,MAAM,KAAW,IAAI,CA4BpB;AA5BD,WAAiB,IAAI;IACN,QAAG,GAAG,OAAO,CAAA;IACb,YAAO,GAAG,WAAW,CAAA;IACnC,SAAgB,MAAM,CAAC,YAA2C;QACjE,MAAM,MAAM,GAAS,EAAE,QAAQ,EAAE,EAAE,EAAE,UAAU,EAAE,UAAU,CAAC,KAAK,EAAE,EAAE,OAAO,EAAE,EAAE,EAAE,CAAA;QAClF,KAAK,MAAM,WAAW,IAAI,YAAY,EAAE,CAAC;YACxC,MAAM,CAAC,UAAU,GAAG,UAAU,CAAC,MAAM,CAAC,MAAM,CAAC,UAAU,EAAE,WAAW,CAAC,CAAA;YACrE,MAAM,CAAC,QAAQ,GAAG,QAAQ,CAAC,MAAM,CAAC,MAAM,CAAC,QAAQ,EAAE,WAAW,CAAC,CAAA;YAC/D,MAAM,CAAC,OAAO,GAAG,KAAA,OAAO,CAAC,MAAM,CAAC,MAAM,CAAC,OAAO,EAAE,WAAW,CAAC,CAAA;QAC7D,CAAC;QACD,OAAO,MAAM,CAAA;IACd,CAAC;IARe,WAAM,SAQrB,CAAA;IACD,SAAgB,KAAK,CAAC,QAAc,EAAE,QAAc;QACnD,MAAM,MAAM,GAAS;YACpB,QAAQ,EAAE,QAAQ,CAAC,KAAK,CAAC,QAAQ,CAAC,QAAQ,EAAE,QAAQ,CAAC,QAAQ,CAAC;YAC9D,UAAU,EAAE,UAAU,CAAC,KAAK,CAAC,QAAQ,CAAC,UAAU,EAAE,QAAQ,CAAC,UAAU,CAAC;YACtE,OAAO,EAAE,IAAI,CAAC,OAAO,CAAC,KAAK,CAAC,QAAQ,CAAC,OAAO,EAAE,QAAQ,CAAC,OAAO,CAAC;SAC/D,CAAA;QACD,OAAO,MAAM,CAAA;IACd,CAAC;IAPe,UAAK,QAOpB,CAAA;IACD,SAAgB,KAAK,CAAC,IAAU,EAAE,GAAiB;QAClD,IAAI,MAAc,CAAA;QAClB,IAAI,GAAG,CAAC,QAAQ,CAAC,SAAS,CAAC;YAC1B,MAAM,GAAG,QAAQ,CAAC,QAAQ,CAAC,IAAI,CAAC,QAAQ,EAAE,GAAG,CAAC,CAAA;;YAE9C,MAAM,GAAG,UAAU,CAAC,QAAQ,CAAC,IAAI,CAAC,UAAU,EAAE,GAAG,CAAC,CAAA;QACnD,OAAO,MAAM,CAAA;IACd,CAAC;IAPe,UAAK,QAOpB,CAAA;AACF,CAAC,EA5BgB,IAAI,KAAJ,IAAI,QA4BpB"}
|
package/package.json
CHANGED
|
@@ -56,4 +56,16 @@ export namespace Country {
|
|
|
56
56
|
result[key] = Monthly.update(result[key], transaction)
|
|
57
57
|
return result
|
|
58
58
|
}
|
|
59
|
+
export function merge(previous: Country, addition: Country): Country {
|
|
60
|
+
const result: Country = {}
|
|
61
|
+
for (const country of Object.keys(previous).concat(Object.keys(addition)) as isoly.CountryCode.Alpha2[])
|
|
62
|
+
result[country] = mergePerCountry(previous[country] ?? {}, addition[country] ?? {})
|
|
63
|
+
return result
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
function mergePerCountry(previous: PerCountry, addition: PerCountry): PerCountry {
|
|
67
|
+
return {
|
|
68
|
+
present: Monthly.merge(previous.present, addition.present),
|
|
69
|
+
notPresent: Monthly.merge(previous.notPresent, addition.notPresent),
|
|
70
|
+
}
|
|
59
71
|
}
|
|
@@ -16,12 +16,11 @@ export namespace Monthly {
|
|
|
16
16
|
const month = isoly.DateTime.getMonth(transaction.transacted ?? transaction.posted)
|
|
17
17
|
return (((month - 1) % 3) + 1) as Monthly.Month
|
|
18
18
|
}
|
|
19
|
+
export function empty(): Monthly {
|
|
20
|
+
return { "1": { count: {}, volume: {} }, "2": { count: {}, volume: {} }, "3": { count: {}, volume: {} } }
|
|
21
|
+
}
|
|
19
22
|
export function update(previous: Monthly | undefined, transaction: Transaction.CardTransaction): Monthly {
|
|
20
|
-
const result: Monthly = previous ??
|
|
21
|
-
"1": { count: {}, volume: {} },
|
|
22
|
-
"2": { count: {}, volume: {} },
|
|
23
|
-
"3": { count: {}, volume: {} },
|
|
24
|
-
}
|
|
23
|
+
const result: Monthly = previous ?? empty()
|
|
25
24
|
if (transaction.direction == "outbound" && transaction.status == "finalized") {
|
|
26
25
|
const month = getMonth(transaction)
|
|
27
26
|
result[month].count[transaction.account.iin as Iin] =
|
|
@@ -42,4 +41,20 @@ export namespace Monthly {
|
|
|
42
41
|
}
|
|
43
42
|
return result
|
|
44
43
|
}
|
|
44
|
+
export function merge(previous: Monthly | undefined, addition: Monthly | undefined): Monthly {
|
|
45
|
+
const result: Monthly = empty()
|
|
46
|
+
previous ??= empty()
|
|
47
|
+
addition ??= empty()
|
|
48
|
+
for (const month of Monthly.Month.values)
|
|
49
|
+
for (const iin of Iin.values) {
|
|
50
|
+
result[month].count[iin] = (previous[month].count[iin] ?? 0) + (addition[month].count[iin] ?? 0)
|
|
51
|
+
result[month].volume[iin] = isoly.Currency.add(
|
|
52
|
+
"GBP",
|
|
53
|
+
previous[month].volume[iin] ?? 0,
|
|
54
|
+
addition[month].volume[iin] ?? 0
|
|
55
|
+
)
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
return result
|
|
59
|
+
}
|
|
45
60
|
}
|
|
@@ -11,12 +11,14 @@ export type NonMonthly = Record<
|
|
|
11
11
|
Partial<Record<Iin, number>>
|
|
12
12
|
>
|
|
13
13
|
export namespace NonMonthly {
|
|
14
|
-
export
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
14
|
+
export function empty(): NonMonthly {
|
|
15
|
+
return {
|
|
16
|
+
"Number of Accounts - International Enabled": {},
|
|
17
|
+
"Payments Transactions Declined for Insufficient Funds - Number": {},
|
|
18
|
+
"Total Number of Accounts": {},
|
|
19
|
+
"Total Number of Active Cards": {},
|
|
20
|
+
"Total Number of Cards": {},
|
|
21
|
+
}
|
|
20
22
|
}
|
|
21
23
|
export function update(previous: NonMonthly, transaction: Transaction.CardTransaction): NonMonthly {
|
|
22
24
|
const result = previous
|
|
@@ -33,4 +35,11 @@ export namespace NonMonthly {
|
|
|
33
35
|
result += "\n"
|
|
34
36
|
return result
|
|
35
37
|
}
|
|
38
|
+
export function merge(previous: NonMonthly, addition: NonMonthly): NonMonthly {
|
|
39
|
+
const result: NonMonthly = empty()
|
|
40
|
+
for (const key of Object.keys(result) as (keyof NonMonthly)[])
|
|
41
|
+
for (const iin of Iin.values)
|
|
42
|
+
result[key][iin] = (previous[key]?.[iin] ?? 0) + (addition[key]?.[iin] ?? 0)
|
|
43
|
+
return result
|
|
44
|
+
}
|
|
36
45
|
}
|
|
@@ -11,6 +11,12 @@ export namespace Regional {
|
|
|
11
11
|
result[region] = Monthly.update(result[region], transaction)
|
|
12
12
|
return result
|
|
13
13
|
}
|
|
14
|
+
export function merge(previous: Regional, addition: Regional): Regional {
|
|
15
|
+
const result: Regional = {}
|
|
16
|
+
for (const region of Region.values)
|
|
17
|
+
result[region] = Monthly.merge(previous[region], addition[region])
|
|
18
|
+
return result
|
|
19
|
+
}
|
|
14
20
|
export function toCsvRow(regional: Regional, row: string): string {
|
|
15
21
|
let result = ""
|
|
16
22
|
const region = Region.fromRow(row)
|
|
@@ -5,7 +5,7 @@ import { Iin as DataIin } from "./Iin"
|
|
|
5
5
|
import { NonMonthly } from "./NonMonthly"
|
|
6
6
|
import { Regional } from "./Regional"
|
|
7
7
|
|
|
8
|
-
export
|
|
8
|
+
export interface Data {
|
|
9
9
|
regional: Regional
|
|
10
10
|
nonMonthly: NonMonthly
|
|
11
11
|
country: Data.Country
|
|
@@ -14,7 +14,7 @@ export namespace Data {
|
|
|
14
14
|
export import Iin = DataIin
|
|
15
15
|
export import Country = DataCountry
|
|
16
16
|
export function create(transactions: Transaction.CardTransaction[]): Data {
|
|
17
|
-
const result: Data = { regional: {}, nonMonthly: NonMonthly.empty, country: {} }
|
|
17
|
+
const result: Data = { regional: {}, nonMonthly: NonMonthly.empty(), country: {} }
|
|
18
18
|
for (const transaction of transactions) {
|
|
19
19
|
result.nonMonthly = NonMonthly.update(result.nonMonthly, transaction)
|
|
20
20
|
result.regional = Regional.update(result.regional, transaction)
|
|
@@ -22,6 +22,14 @@ export namespace Data {
|
|
|
22
22
|
}
|
|
23
23
|
return result
|
|
24
24
|
}
|
|
25
|
+
export function merge(previous: Data, addition: Data): Data {
|
|
26
|
+
const result: Data = {
|
|
27
|
+
regional: Regional.merge(previous.regional, addition.regional),
|
|
28
|
+
nonMonthly: NonMonthly.merge(previous.nonMonthly, addition.nonMonthly),
|
|
29
|
+
country: Data.Country.merge(previous.country, addition.country),
|
|
30
|
+
}
|
|
31
|
+
return result
|
|
32
|
+
}
|
|
25
33
|
export function toCsv(data: Data, row: rows.NonZero): string {
|
|
26
34
|
let result: string
|
|
27
35
|
if (row.endsWith("Month x"))
|