@pax2pay/model-banking 0.1.172 → 0.1.174
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/Rule/State/Card.ts +11 -6
- package/Rule/State/index.ts +7 -6
- package/Rule/index.ts +3 -0
- package/dist/Rule/State/Card.d.ts +20 -9
- package/dist/Rule/State/Card.js +6 -3
- package/dist/Rule/State/Card.js.map +1 -1
- package/dist/Rule/State/index.d.ts +4 -3
- package/dist/Rule/State/index.js +2 -2
- package/dist/Rule/State/index.js.map +1 -1
- package/dist/Rule/index.d.ts +3 -0
- package/dist/Rule/index.js.map +1 -1
- package/package.json +1 -1
package/Rule/State/Card.ts
CHANGED
|
@@ -3,24 +3,29 @@ import { isly } from "isly"
|
|
|
3
3
|
import { Card as ModelCard } from "../../Card"
|
|
4
4
|
import { Realm } from "../../Realm"
|
|
5
5
|
|
|
6
|
-
export interface Card extends Omit<ModelCard, "limit"
|
|
7
|
-
used: { count: number; amount: number }
|
|
8
|
-
reject: { count: number }
|
|
6
|
+
export interface Card extends Omit<ModelCard, "limit">, Card.Statistics {
|
|
9
7
|
age: { days: number; minutes: number }
|
|
10
8
|
limit: number
|
|
11
9
|
original: { currency: isoly.Currency; limit: number }
|
|
12
10
|
}
|
|
13
11
|
|
|
14
12
|
export namespace Card {
|
|
13
|
+
export type Statistics = {
|
|
14
|
+
used: { count: number; amount: number }
|
|
15
|
+
reject: { count: number }
|
|
16
|
+
}
|
|
17
|
+
export const initialStatistics = {
|
|
18
|
+
used: { count: 0, amount: 0 },
|
|
19
|
+
reject: { count: 0 },
|
|
20
|
+
}
|
|
15
21
|
function ageFromTime(time: isoly.DateTime): Card["age"] {
|
|
16
22
|
const minutes = ~~(Date.now() - (isoly.DateTime.epoch(time, "milliseconds") / 1000) * 60)
|
|
17
23
|
return { days: ~~(minutes / (60 * 24)), minutes }
|
|
18
24
|
}
|
|
19
|
-
export function from(card: ModelCard): Card {
|
|
25
|
+
export function from(card: ModelCard, statistics: Statistics = initialStatistics): Card {
|
|
20
26
|
return {
|
|
21
27
|
...card,
|
|
22
|
-
|
|
23
|
-
reject: { count: 0 },
|
|
28
|
+
...statistics,
|
|
24
29
|
age: ageFromTime(card.created),
|
|
25
30
|
limit: card.limit[1], // TODO add currency conversion
|
|
26
31
|
original: { currency: card.limit[0], limit: card.limit[1] },
|
package/Rule/State/index.ts
CHANGED
|
@@ -1,6 +1,4 @@
|
|
|
1
1
|
import { Account as ModelAccount } from "../../Account"
|
|
2
|
-
import { Authorization as ModelAuthorization } from "../../Authorization"
|
|
3
|
-
import { Card as ModelCard } from "../../Card"
|
|
4
2
|
import { Transaction as ModelTransaction } from "../../Transaction"
|
|
5
3
|
import { Account as StateAccount } from "./Account"
|
|
6
4
|
import { Authorization as StateAuthorization } from "./Authorization"
|
|
@@ -24,15 +22,15 @@ export namespace State {
|
|
|
24
22
|
transactions: StateAccount.Transactions,
|
|
25
23
|
days: StateAccount.Days,
|
|
26
24
|
transaction: ModelTransaction.Creatable,
|
|
27
|
-
authorization?:
|
|
28
|
-
card?:
|
|
25
|
+
authorization?: StateAuthorization,
|
|
26
|
+
card?: StateCard
|
|
29
27
|
): State {
|
|
30
28
|
return {
|
|
31
29
|
data,
|
|
32
30
|
account: Account.from(account, transactions, days),
|
|
33
31
|
transaction: Transaction.from(transaction),
|
|
34
|
-
authorization
|
|
35
|
-
card
|
|
32
|
+
authorization,
|
|
33
|
+
card,
|
|
36
34
|
}
|
|
37
35
|
}
|
|
38
36
|
export type Partial = StatePartial
|
|
@@ -41,6 +39,9 @@ export namespace State {
|
|
|
41
39
|
export const Authorization = StateAuthorization
|
|
42
40
|
export type Card = StateCard
|
|
43
41
|
export const Card = StateCard
|
|
42
|
+
export namespace Card {
|
|
43
|
+
export type Statistics = StateCard.Statistics
|
|
44
|
+
}
|
|
44
45
|
export type Account = StateAccount
|
|
45
46
|
export const Account = StateAccount
|
|
46
47
|
export namespace Account {
|
package/Rule/index.ts
CHANGED
|
@@ -20,6 +20,9 @@ export namespace Rule {
|
|
|
20
20
|
}
|
|
21
21
|
export type Authorization = RuleState.Authorization
|
|
22
22
|
export type Card = RuleState.Card
|
|
23
|
+
export namespace Card {
|
|
24
|
+
export type Statstics = RuleState.Card.Statistics
|
|
25
|
+
}
|
|
23
26
|
export type Transaction = RuleState.Transaction
|
|
24
27
|
export type Data = RuleState.Data
|
|
25
28
|
export type Partial = RuleState.Partial
|
|
@@ -1,14 +1,7 @@
|
|
|
1
1
|
import { isoly } from "isoly";
|
|
2
2
|
import { isly } from "isly";
|
|
3
3
|
import { Card as ModelCard } from "../../Card";
|
|
4
|
-
export interface Card extends Omit<ModelCard, "limit"
|
|
5
|
-
used: {
|
|
6
|
-
count: number;
|
|
7
|
-
amount: number;
|
|
8
|
-
};
|
|
9
|
-
reject: {
|
|
10
|
-
count: number;
|
|
11
|
-
};
|
|
4
|
+
export interface Card extends Omit<ModelCard, "limit">, Card.Statistics {
|
|
12
5
|
age: {
|
|
13
6
|
days: number;
|
|
14
7
|
minutes: number;
|
|
@@ -20,7 +13,25 @@ export interface Card extends Omit<ModelCard, "limit"> {
|
|
|
20
13
|
};
|
|
21
14
|
}
|
|
22
15
|
export declare namespace Card {
|
|
23
|
-
|
|
16
|
+
type Statistics = {
|
|
17
|
+
used: {
|
|
18
|
+
count: number;
|
|
19
|
+
amount: number;
|
|
20
|
+
};
|
|
21
|
+
reject: {
|
|
22
|
+
count: number;
|
|
23
|
+
};
|
|
24
|
+
};
|
|
25
|
+
const initialStatistics: {
|
|
26
|
+
used: {
|
|
27
|
+
count: number;
|
|
28
|
+
amount: number;
|
|
29
|
+
};
|
|
30
|
+
reject: {
|
|
31
|
+
count: number;
|
|
32
|
+
};
|
|
33
|
+
};
|
|
34
|
+
function from(card: ModelCard, statistics?: Statistics): Card;
|
|
24
35
|
const type: isly.object.ExtendableType<Card>;
|
|
25
36
|
const is: isly.Type.IsFunction<Card>;
|
|
26
37
|
const flaw: isly.Type.FlawFunction;
|
package/dist/Rule/State/Card.js
CHANGED
|
@@ -4,15 +4,18 @@ import { Card as ModelCard } from "../../Card";
|
|
|
4
4
|
import { Realm } from "../../Realm";
|
|
5
5
|
export var Card;
|
|
6
6
|
(function (Card) {
|
|
7
|
+
Card.initialStatistics = {
|
|
8
|
+
used: { count: 0, amount: 0 },
|
|
9
|
+
reject: { count: 0 },
|
|
10
|
+
};
|
|
7
11
|
function ageFromTime(time) {
|
|
8
12
|
const minutes = ~~(Date.now() - (isoly.DateTime.epoch(time, "milliseconds") / 1000) * 60);
|
|
9
13
|
return { days: ~~(minutes / (60 * 24)), minutes };
|
|
10
14
|
}
|
|
11
|
-
function from(card) {
|
|
15
|
+
function from(card, statistics = Card.initialStatistics) {
|
|
12
16
|
return {
|
|
13
17
|
...card,
|
|
14
|
-
|
|
15
|
-
reject: { count: 0 },
|
|
18
|
+
...statistics,
|
|
16
19
|
age: ageFromTime(card.created),
|
|
17
20
|
limit: card.limit[1],
|
|
18
21
|
original: { currency: card.limit[0], limit: card.limit[1] },
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Card.js","sourceRoot":"../","sources":["Rule/State/Card.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,OAAO,CAAA;AAC7B,OAAO,EAAE,IAAI,EAAE,MAAM,MAAM,CAAA;AAC3B,OAAO,EAAE,IAAI,IAAI,SAAS,EAAE,MAAM,YAAY,CAAA;AAC9C,OAAO,EAAE,KAAK,EAAE,MAAM,aAAa,CAAA;
|
|
1
|
+
{"version":3,"file":"Card.js","sourceRoot":"../","sources":["Rule/State/Card.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,OAAO,CAAA;AAC7B,OAAO,EAAE,IAAI,EAAE,MAAM,MAAM,CAAA;AAC3B,OAAO,EAAE,IAAI,IAAI,SAAS,EAAE,MAAM,YAAY,CAAA;AAC9C,OAAO,EAAE,KAAK,EAAE,MAAM,aAAa,CAAA;AAQnC,M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C,MAAM,EAAE,EAAE,CAAC;QAC7D,GAAG,EAAE,IAAI,CAAC,MAAM,CAAc,EAAE,IAAI,EAAE,IAAI,CAAC,MAAM,EAAE,EAAE,OAAO,EAAE,IAAI,CAAC,MAAM,EAAE,EAAE,CAAC;QAC9E,QAAQ,EAAE,IAAI,CAAC,MAAM,CAAmB;YACvC,QAAQ,EAAE,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,QAAQ,CAAC,KAAK,CAAC;YAC3C,KAAK,EAAE,IAAI,CAAC,MAAM,EAAE;SACpB,CAAC;KACF,CAAC,CAAA;IACW,OAAE,GAAG,KAAA,IAAI,CAAC,EAAE,CAAA;IACZ,SAAI,GAAG,KAAA,IAAI,CAAC,IAAI,CAAA;AAC9B,CAAC,EAxDgB,IAAI,KAAJ,IAAI,QAwDpB"}
|
|
@@ -1,6 +1,4 @@
|
|
|
1
1
|
import { Account as ModelAccount } from "../../Account";
|
|
2
|
-
import { Authorization as ModelAuthorization } from "../../Authorization";
|
|
3
|
-
import { Card as ModelCard } from "../../Card";
|
|
4
2
|
import { Transaction as ModelTransaction } from "../../Transaction";
|
|
5
3
|
import { Account as StateAccount } from "./Account";
|
|
6
4
|
import { Authorization as StateAuthorization } from "./Authorization";
|
|
@@ -16,13 +14,16 @@ export interface State {
|
|
|
16
14
|
card?: StateCard;
|
|
17
15
|
}
|
|
18
16
|
export declare namespace State {
|
|
19
|
-
function from(data: StateData, account: ModelAccount, transactions: StateAccount.Transactions, days: StateAccount.Days, transaction: ModelTransaction.Creatable, authorization?:
|
|
17
|
+
function from(data: StateData, account: ModelAccount, transactions: StateAccount.Transactions, days: StateAccount.Days, transaction: ModelTransaction.Creatable, authorization?: StateAuthorization, card?: StateCard): State;
|
|
20
18
|
type Partial = StatePartial;
|
|
21
19
|
const Partial: typeof StatePartial;
|
|
22
20
|
type Authorization = StateAuthorization;
|
|
23
21
|
const Authorization: typeof StateAuthorization;
|
|
24
22
|
type Card = StateCard;
|
|
25
23
|
const Card: typeof StateCard;
|
|
24
|
+
namespace Card {
|
|
25
|
+
type Statistics = StateCard.Statistics;
|
|
26
|
+
}
|
|
26
27
|
type Account = StateAccount;
|
|
27
28
|
const Account: typeof StateAccount;
|
|
28
29
|
namespace Account {
|
package/dist/Rule/State/index.js
CHANGED
|
@@ -10,8 +10,8 @@ export var State;
|
|
|
10
10
|
data,
|
|
11
11
|
account: State.Account.from(account, transactions, days),
|
|
12
12
|
transaction: State.Transaction.from(transaction),
|
|
13
|
-
authorization
|
|
14
|
-
card
|
|
13
|
+
authorization,
|
|
14
|
+
card,
|
|
15
15
|
};
|
|
16
16
|
}
|
|
17
17
|
State.from = from;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"../","sources":["Rule/State/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"../","sources":["Rule/State/index.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,OAAO,IAAI,YAAY,EAAE,MAAM,WAAW,CAAA;AACnD,OAAO,EAAE,aAAa,IAAI,kBAAkB,EAAE,MAAM,iBAAiB,CAAA;AACrE,OAAO,EAAE,IAAI,IAAI,SAAS,EAAE,MAAM,QAAQ,CAAA;AAE1C,OAAO,EAAE,OAAO,IAAI,YAAY,EAAE,MAAM,WAAW,CAAA;AACnD,OAAO,EAAE,WAAW,IAAI,gBAAgB,EAAE,MAAM,eAAe,CAAA;AAU/D,MAAM,KAAW,KAAK,CAoCrB;AApCD,WAAiB,KAAK;IACrB,SAAgB,IAAI,CACnB,IAAe,EACf,OAAqB,EACrB,YAAuC,EACvC,IAAuB,EACvB,WAAuC,EACvC,aAAkC,EAClC,IAAgB;QAEhB,OAAO;YACN,IAAI;YACJ,OAAO,EAAE,MAAA,OAAO,CAAC,IAAI,CAAC,OAAO,EAAE,YAAY,EAAE,IAAI,CAAC;YAClD,WAAW,EAAE,MAAA,WAAW,CAAC,IAAI,CAAC,WAAW,CAAC;YAC1C,aAAa;YACb,IAAI;SACJ,CAAA;IACF,CAAC;IAhBe,UAAI,OAgBnB,CAAA;IAEY,aAAO,GAAG,YAAY,CAAA;IAEtB,mBAAa,GAAG,kBAAkB,CAAA;IAElC,UAAI,GAAG,SAAS,CAAA;IAKhB,aAAO,GAAG,YAAY,CAAA;IAMtB,iBAAW,GAAG,gBAAgB,CAAA;AAE5C,CAAC,EApCgB,KAAK,KAAL,KAAK,QAoCrB"}
|
package/dist/Rule/index.d.ts
CHANGED
|
@@ -17,6 +17,9 @@ export declare namespace Rule {
|
|
|
17
17
|
}
|
|
18
18
|
type Authorization = RuleState.Authorization;
|
|
19
19
|
type Card = RuleState.Card;
|
|
20
|
+
namespace Card {
|
|
21
|
+
type Statstics = RuleState.Card.Statistics;
|
|
22
|
+
}
|
|
20
23
|
type Transaction = RuleState.Transaction;
|
|
21
24
|
type Data = RuleState.Data;
|
|
22
25
|
type Partial = RuleState.Partial;
|
package/dist/Rule/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"../","sources":["Rule/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAA;AACzC,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAA;AAC3C,OAAO,KAAK,SAAS,MAAM,QAAQ,CAAA;AACnC,OAAO,EAAE,KAAK,IAAI,SAAS,EAAE,MAAM,SAAS,CAAA;AAI5C,MAAM,KAAW,IAAI,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"../","sources":["Rule/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAA;AACzC,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAA;AAC3C,OAAO,KAAK,SAAS,MAAM,QAAQ,CAAA;AACnC,OAAO,EAAE,KAAK,IAAI,SAAS,EAAE,MAAM,SAAS,CAAA;AAI5C,MAAM,KAAW,IAAI,CAuCpB;AAvCD,W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