@pax2pay/model-banking 0.1.368 → 0.1.369

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.
@@ -2,7 +2,7 @@ import { isly } from "isly"
2
2
  import { Acquirer } from "../../Acquirer"
3
3
  import { Card as ModelCard } from "../../Card"
4
4
  import { Merchant } from "../../Merchant"
5
- import { Rule } from "../../Rule"
5
+ import type { Rule } from "../../Rule"
6
6
 
7
7
  export interface Card {
8
8
  type: "card"
@@ -1,20 +1,27 @@
1
1
  import { isoly } from "isoly"
2
- import type { Transaction as ModelTransaction } from "../../Transaction"
2
+ import type { Address } from "../../Rail/Address"
3
+ import { Transaction as ModelTransaction } from "../../Transaction"
3
4
  import { Rule } from "../Rule"
4
5
 
5
6
  export interface Transaction extends Omit<ModelTransaction.Creatable, "currency" | "amount"> {
6
7
  kind: Rule.Base.Kind
7
8
  amount: number
9
+ type: ModelTransaction.Types
8
10
  fee?: number
9
11
  risk?: number
10
12
  original: { currency: isoly.Currency; amount: number }
11
13
  }
12
14
  export namespace Transaction {
13
- export function from(transaction: ModelTransaction.Creatable, kind: Rule.Base.Kind): Transaction {
15
+ export function from(
16
+ accountName: string,
17
+ transaction: ModelTransaction.Creatable & { counterpart: Address },
18
+ kind: Rule.Base.Kind
19
+ ): Transaction {
14
20
  return {
15
21
  ...transaction,
16
22
  kind,
17
23
  amount: Math.abs(transaction.amount),
24
+ type: ModelTransaction.getType(transaction.counterpart, accountName),
18
25
  original: { currency: transaction.currency, amount: Math.abs(transaction.amount) },
19
26
  }
20
27
  }
@@ -1,6 +1,7 @@
1
1
  import { isly } from "isly"
2
2
  import { Account as ModelAccount } from "../../Account"
3
- import { Transaction as ModelTransaction } from "../../Transaction"
3
+ import type { Address } from "../../Rail/Address"
4
+ import type { Transaction as ModelTransaction } from "../../Transaction"
4
5
  import { Rule } from "../Rule"
5
6
  import { Account as StateAccount } from "./Account"
6
7
  import { Authorization as StateAuthorization } from "./Authorization"
@@ -42,7 +43,7 @@ export namespace State {
42
43
  account: ModelAccount,
43
44
  transactions: Account.Transactions,
44
45
  days: Account.Days,
45
- transaction: ModelTransaction.Creatable,
46
+ transaction: ModelTransaction.Creatable & { counterpart: Address },
46
47
  kind: Rule.Base.Kind,
47
48
  authorization?: Authorization,
48
49
  card?: Card,
@@ -51,7 +52,7 @@ export namespace State {
51
52
  return {
52
53
  data,
53
54
  account: Account.from(account, transactions, days),
54
- transaction: Transaction.from(transaction, kind),
55
+ transaction: Transaction.from(account.name, transaction, kind),
55
56
  authorization,
56
57
  card,
57
58
  organization,
@@ -1,6 +1,6 @@
1
1
  import { isoly } from "isoly"
2
2
  import { isly } from "isly"
3
- import { Rule } from "../Rule"
3
+ import type { Rule } from "../Rule"
4
4
 
5
5
  export interface Note extends Note.Creatable {
6
6
  author: string
@@ -22,7 +22,7 @@ export namespace Note {
22
22
  text: isly.string().optional(),
23
23
  action: isly.string(["approve", "reject"]).optional(),
24
24
  flags: isly.string().array().optional(),
25
- rule: Rule.type.optional(),
25
+ rule: isly.any().optional(),
26
26
  })
27
27
  export const is = type.is
28
28
  }
@@ -2,7 +2,7 @@ import { isly } from "isly";
2
2
  import { Acquirer } from "../../Acquirer";
3
3
  import { Card as ModelCard } from "../../Card";
4
4
  import { Merchant } from "../../Merchant";
5
- import { Rule } from "../../Rule";
5
+ import type { Rule } from "../../Rule";
6
6
  export interface Card {
7
7
  type: "card";
8
8
  scheme: ModelCard.Scheme;
@@ -1,9 +1,11 @@
1
1
  import { isoly } from "isoly";
2
- import type { Transaction as ModelTransaction } from "../../Transaction";
2
+ import type { Address } from "../../Rail/Address";
3
+ import { Transaction as ModelTransaction } from "../../Transaction";
3
4
  import { Rule } from "../Rule";
4
5
  export interface Transaction extends Omit<ModelTransaction.Creatable, "currency" | "amount"> {
5
6
  kind: Rule.Base.Kind;
6
7
  amount: number;
8
+ type: ModelTransaction.Types;
7
9
  fee?: number;
8
10
  risk?: number;
9
11
  original: {
@@ -12,5 +14,7 @@ export interface Transaction extends Omit<ModelTransaction.Creatable, "currency"
12
14
  };
13
15
  }
14
16
  export declare namespace Transaction {
15
- function from(transaction: ModelTransaction.Creatable, kind: Rule.Base.Kind): Transaction;
17
+ function from(accountName: string, transaction: ModelTransaction.Creatable & {
18
+ counterpart: Address;
19
+ }, kind: Rule.Base.Kind): Transaction;
16
20
  }
@@ -1,10 +1,12 @@
1
+ import { Transaction as ModelTransaction } from "../../Transaction";
1
2
  export var Transaction;
2
3
  (function (Transaction) {
3
- function from(transaction, kind) {
4
+ function from(accountName, transaction, kind) {
4
5
  return {
5
6
  ...transaction,
6
7
  kind,
7
8
  amount: Math.abs(transaction.amount),
9
+ type: ModelTransaction.getType(transaction.counterpart, accountName),
8
10
  original: { currency: transaction.currency, amount: Math.abs(transaction.amount) },
9
11
  };
10
12
  }
@@ -1 +1 @@
1
- {"version":3,"file":"Transaction.js","sourceRoot":"../","sources":["Rule/State/Transaction.ts"],"names":[],"mappings":"AAWA,MAAM,KAAW,WAAW,CAS3B;AATD,WAAiB,WAAW;IAC3B,SAAgB,IAAI,CAAC,WAAuC,EAAE,IAAoB;QACjF,OAAO;YACN,GAAG,WAAW;YACd,IAAI;YACJ,MAAM,EAAE,IAAI,CAAC,GAAG,CAAC,WAAW,CAAC,MAAM,CAAC;YACpC,QAAQ,EAAE,EAAE,QAAQ,EAAE,WAAW,CAAC,QAAQ,EAAE,MAAM,EAAE,IAAI,CAAC,GAAG,CAAC,WAAW,CAAC,MAAM,CAAC,EAAE;SAClF,CAAA;IACF,CAAC;IAPe,gBAAI,OAOnB,CAAA;AACF,CAAC,EATgB,WAAW,KAAX,WAAW,QAS3B"}
1
+ {"version":3,"file":"Transaction.js","sourceRoot":"../","sources":["Rule/State/Transaction.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,WAAW,IAAI,gBAAgB,EAAE,MAAM,mBAAmB,CAAA;AAWnE,MAAM,KAAW,WAAW,CAc3B;AAdD,WAAiB,WAAW;IAC3B,SAAgB,IAAI,CACnB,WAAmB,EACnB,WAAkE,EAClE,IAAoB;QAEpB,OAAO;YACN,GAAG,WAAW;YACd,IAAI;YACJ,MAAM,EAAE,IAAI,CAAC,GAAG,CAAC,WAAW,CAAC,MAAM,CAAC;YACpC,IAAI,EAAE,gBAAgB,CAAC,OAAO,CAAC,WAAW,CAAC,WAAW,EAAE,WAAW,CAAC;YACpE,QAAQ,EAAE,EAAE,QAAQ,EAAE,WAAW,CAAC,QAAQ,EAAE,MAAM,EAAE,IAAI,CAAC,GAAG,CAAC,WAAW,CAAC,MAAM,CAAC,EAAE;SAClF,CAAA;IACF,CAAC;IAZe,gBAAI,OAYnB,CAAA;AACF,CAAC,EAdgB,WAAW,KAAX,WAAW,QAc3B"}
@@ -1,6 +1,7 @@
1
1
  import { isly } from "isly";
2
2
  import { Account as ModelAccount } from "../../Account";
3
- import { Transaction as ModelTransaction } from "../../Transaction";
3
+ import type { Address } from "../../Rail/Address";
4
+ import type { Transaction as ModelTransaction } from "../../Transaction";
4
5
  import { Rule } from "../Rule";
5
6
  import { Account as StateAccount } from "./Account";
6
7
  import { Authorization as StateAuthorization } from "./Authorization";
@@ -36,5 +37,7 @@ export declare namespace State {
36
37
  flags: string[];
37
38
  notes: ModelTransaction.Note[];
38
39
  }
39
- function from(data: Data, account: ModelAccount, transactions: Account.Transactions, days: Account.Days, transaction: ModelTransaction.Creatable, kind: Rule.Base.Kind, authorization?: Authorization, card?: Card, organization?: Organization): State;
40
+ function from(data: Data, account: ModelAccount, transactions: Account.Transactions, days: Account.Days, transaction: ModelTransaction.Creatable & {
41
+ counterpart: Address;
42
+ }, kind: Rule.Base.Kind, authorization?: Authorization, card?: Card, organization?: Organization): State;
40
43
  }
@@ -22,7 +22,7 @@ export var State;
22
22
  return {
23
23
  data,
24
24
  account: State.Account.from(account, transactions, days),
25
- transaction: State.Transaction.from(transaction, kind),
25
+ transaction: State.Transaction.from(account.name, transaction, kind),
26
26
  authorization,
27
27
  card,
28
28
  organization,
@@ -1 +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AAkB,EAClB,WAAkE,EAClE,IAAoB,EACpB,aAA6B,EAC7B,IAAW,EACX,YAA2B;QAE3B,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,OAAO,CAAC,IAAI,EAAE,WAAW,EAAE,IAAI,CAAC;YAC9D,aAAa;YACb,IAAI;YACJ,YAAY;SACZ,CAAA;IACF,CAAC;IAnBe,UAAI,OAmBnB,CAAA;AACF,CAAC,EAvCgB,KAAK,KAAL,KAAK,QAuCrB"}
@@ -1,6 +1,6 @@
1
1
  import { isoly } from "isoly";
2
2
  import { isly } from "isly";
3
- import { Rule } from "../Rule";
3
+ import type { Rule } from "../Rule";
4
4
  export interface Note extends Note.Creatable {
5
5
  author: string;
6
6
  created: isoly.DateTime;
@@ -1,6 +1,5 @@
1
1
  import { isoly } from "isoly";
2
2
  import { isly } from "isly";
3
- import { Rule } from "../Rule";
4
3
  export var Note;
5
4
  (function (Note) {
6
5
  function fromCreatable(note, author) {
@@ -13,7 +12,7 @@ export var Note;
13
12
  text: isly.string().optional(),
14
13
  action: isly.string(["approve", "reject"]).optional(),
15
14
  flags: isly.string().array().optional(),
16
- rule: Rule.type.optional(),
15
+ rule: isly.any().optional(),
17
16
  });
18
17
  Creatable.is = Creatable.type.is;
19
18
  })(Creatable = Note.Creatable || (Note.Creatable = {}));
@@ -1 +1 @@
1
- {"version":3,"file":"Note.js","sourceRoot":"../","sources":["Transaction/Note.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,OAAO,CAAA;AAC7B,OAAO,EAAE,IAAI,EAAE,MAAM,MAAM,CAAA;AAC3B,OAAO,EAAE,IAAI,EAAE,MAAM,SAAS,CAAA;AAO9B,MAAM,KAAW,IAAI,CAwBpB;AAxBD,WAAiB,IAAI;IACpB,SAAgB,aAAa,CAAC,IA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I,EAAE,OAAO,EAAE,KAAK,CAAC,QAAQ,CAAC,GAAG,EAAE,EAAE,MAAM,EAAE,MAAM,EAAE,CAAA;IAClE,CAAC;IAFe,kBAAa,gBAE5B,CAAA;IAOD,IAAiB,SAAS,CAQzB;IARD,WAAiB,SAAS;QACZ,cAAI,GAAG,IAAI,CAAC,MAAM,CAAY;YAC1C,IAAI,EAAE,IAAI,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;YAC9B,MAAM,EAAE,IAAI,CAAC,MAAM,CAAC,CAAC,SAAS,EAAE,QAAQ,CAAC,CAAC,CAAC,QAAQ,EAAE;YACrD,KAAK,EAAE,IAAI,CAAC,MAAM,EAAE,CAAC,KAAK,EAAE,CAAC,QAAQ,EAAE;YACvC,IAAI,EAAE,IAAI,CAAC,GAAG,EAAE,CAAC,QAAQ,EAAE;SAC3B,CAAC,CAAA;QACW,YAAE,GAAG,UAAA,IAAI,CAAC,EAAE,CAAA;IAC1B,CAAC,EARgB,SAAS,GAAT,cAAS,KAAT,cAAS,QAQzB;IACY,SAAI,GAAG,SAAS,CAAC,IAAI,CAAC,MAAM,CAAO;QAC/C,MAAM,EAAE,IAAI,CAAC,MAAM,EAAE;QACrB,OAAO,EAAE,IAAI,CAAC,MAAM,EAAE;KACtB,CAAC,CAAA;IACW,OAAE,GAAG,KAAA,IAAI,CAAC,EAAE,CAAA;AAC1B,CAAC,EAxBgB,IAAI,KAAJ,IAAI,QAwBpB"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pax2pay/model-banking",
3
- "version": "0.1.368",
3
+ "version": "0.1.369",
4
4
  "description": "Library containing data model types and functions for the Pax2Pay Banking API.",
5
5
  "author": "Pax2Pay Ltd",
6
6
  "license": "MIT",