@pax2pay/model-banking 0.0.46 → 0.0.47

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.
@@ -14,18 +14,21 @@ export class Transactions extends rest.Collection<gracely.Error> {
14
14
  }
15
15
  async list(options?: {
16
16
  account?: string
17
+ limit?: number
18
+ cursor?: string
17
19
  status?: "review" | "created" | "approved" | "rejected" | "processing" | "finalized"
18
20
  currency?: string
21
+ direction?: "inbound" | "outbound"
22
+ rail?: "internal"
19
23
  start?: string
20
24
  end?: string
21
- limit?: number
22
- cursor?: string
23
25
  }): Promise<Transaction[] | gracely.Error> {
24
- let query = ""
25
- query += options?.currency ? `?currency=${options?.currency}` : ""
26
- query += options?.status ? `?status=${options?.status}` : ""
27
- query += options?.start ? `&start=${options?.start}` : ""
28
- query += options?.end ? `&end=${options?.end}` : ""
26
+ const searchOptions = options && (({ account, limit, cursor, ...search }) => search)(options)
27
+ const query = searchOptions
28
+ ? Object.entries(searchOptions)
29
+ .map(([k, v]) => `${k}=${v}`)
30
+ .reduce((prev, curr, i) => `${prev}${i == 0 ? "?" : "&"}${curr}`, "")
31
+ : ""
29
32
  const path = options && options.account ? `/account/${options.account}/transaction${query}` : `/transaction${query}`
30
33
  return this.client.get<Transaction[]>(path) //{ limit: options?.limit ? options.limit.toString() : undefined, cursor: options?.cursor, }
31
34
  }
@@ -9,11 +9,13 @@ export declare class Transactions extends rest.Collection<gracely.Error> {
9
9
  create(account: string, transaction: Transaction.Creatable): Promise<Transaction | gracely.Error>;
10
10
  list(options?: {
11
11
  account?: string;
12
+ limit?: number;
13
+ cursor?: string;
12
14
  status?: "review" | "created" | "approved" | "rejected" | "processing" | "finalized";
13
15
  currency?: string;
16
+ direction?: "inbound" | "outbound";
17
+ rail?: "internal";
14
18
  start?: string;
15
19
  end?: string;
16
- limit?: number;
17
- cursor?: string;
18
20
  }): Promise<Transaction[] | gracely.Error>;
19
21
  }
@@ -9,11 +9,12 @@ export class Transactions extends rest.Collection {
9
9
  return this.client.post(`/account/${account}/transaction`, transaction);
10
10
  }
11
11
  async list(options) {
12
- let query = "";
13
- query += options?.currency ? `?currency=${options?.currency}` : "";
14
- query += options?.status ? `?status=${options?.status}` : "";
15
- query += options?.start ? `&start=${options?.start}` : "";
16
- query += options?.end ? `&end=${options?.end}` : "";
12
+ const searchOptions = options && (({ account, limit, cursor, ...search }) => search)(options);
13
+ const query = searchOptions
14
+ ? Object.entries(searchOptions)
15
+ .map(([k, v]) => `${k}=${v}`)
16
+ .reduce((prev, curr, i) => `${prev}${i == 0 ? "?" : "&"}${curr}`, "")
17
+ : "";
17
18
  const path = options && options.account ? `/account/${options.account}/transaction${query}` : `/transaction${query}`;
18
19
  return this.client.get(path);
19
20
  }
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"../","sources":["Client/Transactions/index.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,IAAI,MAAM,cAAc,CAAA;AAEpC,OAAO,EAAE,KAAK,EAAE,MAAM,SAAS,CAAA;AAE/B,MAAM,OAAO,YAAa,SAAQ,IAAI,CAAC,UAAyB;IAE/D,YAAY,MAAmB;QAC9B,KAAK,CAAC,MAAM,CAAC,CAAA;QAFL,UAAK,GAAG,IAAI,KAAK,CAAC,IAAI,CAAC,MAAM,CAAC,CAAA;IAGvC,CAAC;IACD,KAAK,CAAC,MAAM,CAAC,OAAe,EAAE,WAAkC;QAC/D,OAAO,IAAI,CAAC,MAAM,CAAC,IAAI,CAAc,YAAY,OAAO,cAAc,EAAE,WAAW,CAAC,CAAA;IACrF,CAAC;IACD,KAAK,CAAC,IAAI,CAAC,OAQV;QACA,IAAI,KAAK,GAAG,EAAE,CAAA;QACd,KAAK,IAAI,OAAO,EAAE,QAAQ,CAAC,CAAC,CAAC,aAAa,OAAO,EAAE,QAAQ,EAAE,CAAC,CAAC,CAAC,EAAE,CAAA;QAClE,KAAK,IAAI,OAAO,EAAE,MAAM,CAAC,CAAC,CAAC,WAAW,OA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AAM,KAAK,GAAG,aAAa;YAC1B,CAAC,CAAC,MAAM,CAAC,OAAO,CAAC,aAAa,CAAC;iBAC5B,GAAG,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE,CAAC;iBAC5B,MAAM,CAAC,CAAC,IAAI,EAAE,IAAI,EAAE,CAAC,EAAE,EAAE,CAAC,GAAG,IAAI,GAAG,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,GAAG,GAAG,IAAI,EAAE,EAAE,EAAE,CAAC;YACvE,CAAC,CAAC,EAAE,CAAA;QACL,MAAM,IAAI,GAAG,OAAO,IAAI,OAAO,CAAC,OAAO,CAAC,CAAC,CAAC,YAAY,OAAO,CAAC,OAAO,eAAe,KAAK,EAAE,CAAC,CAAC,CAAC,eAAe,KAAK,EAAE,CAAA;QACpH,OAAO,IAAI,CAAC,MAAM,CAAC,GAAG,CAAgB,IAAI,CAAC,CAAA;IAC5C,CAAC;CACD"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pax2pay/model-banking",
3
- "version": "0.0.46",
3
+ "version": "0.0.47",
4
4
  "description": "Library containing data model types and functions for the Pax2Pay Banking API.",
5
5
  "author": "Pax2Pay Ltd",
6
6
  "license": "MIT",