@pax2pay/model-banking 0.0.38 → 0.0.39

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.
@@ -12,32 +12,24 @@ export class Transactions extends rest.Collection<gracely.Error> {
12
12
  async create(account: string, transaction: Transaction.Creatable): Promise<Transaction | gracely.Error> {
13
13
  return this.client.post<Transaction>(`/account/${account}/transaction`, transaction)
14
14
  }
15
- async list(
16
- args?:
17
- | {
18
- account: string
19
- search?: {
20
- currency?: string
21
- start?: string
22
- end?: string
23
- reserved?: boolean
24
- }
25
- }
26
- | {
27
- search?: {
28
- currency?: string
29
- status?: string
30
- start?: string
31
- end?: string
32
- }
33
- }
34
- ): Promise<Transaction[] | gracely.Error> {
35
- const query = args?.search
36
- ? Object.entries(args.search)
37
- .map(([k, v]) => `${k}=${v}`)
38
- .reduce((prev, curr, i) => `${prev}${i == 0 ? "?" : "&"}${curr}`, "")
39
- : ""
40
- const path = args && "account" in args ? `/account/${args.account}/transaction${query}` : `/transaction${query}`
41
- return this.client.get<Transaction[]>(path)
15
+ async list(options?: {
16
+ account?: string
17
+ status?: "review" | "created" | "approved" | "rejected" | "processing" | "finalized"
18
+ currency?: string
19
+ start?: string
20
+ end?: string
21
+ limit?: number
22
+ cursor?: string
23
+ }): 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}` : ""
29
+ const path = options && options.account ? `/account/${options.account}/transaction${query}` : `/transaction${query}`
30
+ return this.client.get<Transaction[]>(path, {
31
+ limit: options?.limit ? options.limit.toString() : undefined,
32
+ cursor: options?.cursor,
33
+ })
42
34
  }
43
35
  }
@@ -7,20 +7,13 @@ export declare class Transactions extends rest.Collection<gracely.Error> {
7
7
  readonly Notes: Notes;
8
8
  constructor(client: http.Client);
9
9
  create(account: string, transaction: Transaction.Creatable): Promise<Transaction | gracely.Error>;
10
- list(args?: {
11
- account: string;
12
- search?: {
13
- currency?: string;
14
- start?: string;
15
- end?: string;
16
- reserved?: boolean;
17
- };
18
- } | {
19
- search?: {
20
- currency?: string;
21
- status?: string;
22
- start?: string;
23
- end?: string;
24
- };
10
+ list(options?: {
11
+ account?: string;
12
+ status?: "review" | "created" | "approved" | "rejected" | "processing" | "finalized";
13
+ currency?: string;
14
+ start?: string;
15
+ end?: string;
16
+ limit?: number;
17
+ cursor?: string;
25
18
  }): Promise<Transaction[] | gracely.Error>;
26
19
  }
@@ -8,14 +8,17 @@ export class Transactions extends rest.Collection {
8
8
  async create(account, transaction) {
9
9
  return this.client.post(`/account/${account}/transaction`, transaction);
10
10
  }
11
- async list(args) {
12
- const query = args?.search
13
- ? Object.entries(args.search)
14
- .map(([k, v]) => `${k}=${v}`)
15
- .reduce((prev, curr, i) => `${prev}${i == 0 ? "?" : "&"}${curr}`, "")
16
- : "";
17
- const path = args && "account" in args ? `/account/${args.account}/transaction${query}` : `/transaction${query}`;
18
- return this.client.get(path);
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}` : "";
17
+ const path = options && options.account ? `/account/${options.account}/transaction${query}` : `/transaction${query}`;
18
+ return this.client.get(path, {
19
+ limit: options?.limit ? options.limit.toString() : undefined,
20
+ cursor: options?.cursor,
21
+ });
19
22
  }
20
23
  }
21
24
  //# sourceMappingURL=index.js.map
@@ -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/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,6 +1,6 @@
1
1
  {
2
2
  "name": "@pax2pay/model-banking",
3
- "version": "0.0.38",
3
+ "version": "0.0.39",
4
4
  "description": "Library containing data model types and functions for the Pax2Pay Banking API.",
5
5
  "author": "Pax2Pay Ltd",
6
6
  "license": "MIT",