@pax2pay/model-banking 0.0.7 → 0.0.8

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.
@@ -10,4 +10,7 @@ export class Accounts extends rest.Collection<gracely.Error> {
10
10
  async create(account: Account.Creatable): Promise<Account | gracely.Error> {
11
11
  return this.client.post<Account>("/account", account)
12
12
  }
13
+ async list(organization: string, realm: string): Promise<Account.Info[] | gracely.Error> {
14
+ return this.client.get<Account.Info[]>("/account", { organization: organization, realm: realm })
15
+ }
13
16
  }
@@ -0,0 +1,16 @@
1
+ import * as gracely from "gracely"
2
+ import * as http from "cloudly-http"
3
+ import * as rest from "cloudly-rest"
4
+ import { Decision } from "../monitoring/Decision"
5
+
6
+ export class Decisions extends rest.Collection<gracely.Error> {
7
+ constructor(client: http.Client) {
8
+ super(client)
9
+ }
10
+ async create(realm: string, transaction: string, decision: Decision.Creatable): Promise<Decision | gracely.Error> {
11
+ return this.client.post<Decision>(`/monitor/decision/${transaction}`, decision, { realm: realm })
12
+ }
13
+ async list(realm: string): Promise<Decision[] | gracely.Error> {
14
+ return this.client.get<Decision[]>(`/monitor/decision`, { realm: realm })
15
+ }
16
+ }
@@ -0,0 +1,13 @@
1
+ import * as gracely from "gracely"
2
+ import * as http from "cloudly-http"
3
+ import * as rest from "cloudly-rest"
4
+ import { Operation } from "../Operation"
5
+
6
+ export class Operations extends rest.Collection<gracely.Error> {
7
+ constructor(client: http.Client) {
8
+ super(client)
9
+ }
10
+ async list(realm: string): Promise<Operation[] | gracely.Error> {
11
+ return this.client.get<Operation[]>(`/operation/${realm}`)
12
+ }
13
+ }
@@ -0,0 +1,16 @@
1
+ import * as gracely from "gracely"
2
+ import * as http from "cloudly-http"
3
+ import * as rest from "cloudly-rest"
4
+ import { Organization } from "../Organization"
5
+
6
+ export class Organizations extends rest.Collection<gracely.Error> {
7
+ constructor(client: http.Client) {
8
+ super(client)
9
+ }
10
+ async list(): Promise<Organization[] | gracely.Error> {
11
+ return this.client.get<Organization[]>(`/organization/`)
12
+ }
13
+ async create(organization: Organization.Creatable): Promise<Organization | gracely.Error> {
14
+ return this.client.post<Organization>(`/organization`, organization)
15
+ }
16
+ }
@@ -0,0 +1,16 @@
1
+ import * as gracely from "gracely"
2
+ import * as http from "cloudly-http"
3
+ import * as rest from "cloudly-rest"
4
+ import { Reviewable } from "../monitoring/Reviewable"
5
+
6
+ export class Queue extends rest.Collection<gracely.Error> {
7
+ constructor(client: http.Client) {
8
+ super(client)
9
+ }
10
+ async change(realm: string, transaction: string, comment: string): Promise<Reviewable | gracely.Error> {
11
+ return this.client.patch<Reviewable>(`/monitor/queue/${transaction}`, comment, { realm: realm })
12
+ }
13
+ async list(realm: string): Promise<Reviewable[] | gracely.Error> {
14
+ return this.client.get<Reviewable[]>(`/monitor/queue`, { realm: realm })
15
+ }
16
+ }
@@ -0,0 +1,20 @@
1
+ import * as gracely from "gracely"
2
+ import * as http from "cloudly-http"
3
+ import * as rest from "cloudly-rest"
4
+ import { Transaction } from "../Transaction"
5
+
6
+ export class Transactions extends rest.Collection<gracely.Error> {
7
+ constructor(client: http.Client) {
8
+ super(client)
9
+ }
10
+ async create(
11
+ organization: string,
12
+ account: string,
13
+ transaction: Transaction.Creatable
14
+ ): Promise<Transaction | gracely.Error> {
15
+ return this.client.post<Transaction>(`/account/${account}/transaction`, transaction, { organization: organization })
16
+ }
17
+ async list(organization: string, account: string): Promise<Transaction[] | gracely.Error> {
18
+ return this.client.get<Transaction[]>(`/account/${account}/transaction`, { organization: organization })
19
+ }
20
+ }
package/Client/index.ts CHANGED
@@ -2,15 +2,25 @@ import * as gracely from "gracely"
2
2
  import * as http from "cloudly-http"
3
3
  import * as rest from "cloudly-rest"
4
4
  import { Accounts } from "./Accounts"
5
+ import { Decisions } from "./Decisions"
6
+ import { Operations } from "./Operations"
7
+ import { Organizations } from "./Organizations"
8
+ import { Queue } from "./Queue"
9
+ import { Transactions } from "./Transactions"
5
10
  import { Version } from "./Version"
6
11
 
7
12
  export class Client extends rest.Client<gracely.Error> {
8
- readonly accounts = new Accounts(this.client)
13
+ readonly account = new Accounts(this.client)
14
+ readonly decision = new Decisions(this.client)
15
+ readonly operation = new Operations(this.client)
16
+ readonly organization = new Organizations(this.client)
17
+ readonly queue = new Queue(this.client)
18
+ readonly transaction = new Transactions(this.client)
9
19
  readonly version = new Version(this.client)
10
20
 
11
- static create<T = Record<string, any>>(server: string, _?: string, load?: (client: http.Client) => T): Client & T {
21
+ static create<T = Record<string, any>>(server: string, key: string, load?: (client: http.Client) => T): Client & T {
12
22
  let httpClient: http.Client<gracely.Error>
13
- const result = new Client((httpClient = new http.Client<gracely.Error>(server, undefined)))
23
+ const result = new Client((httpClient = new http.Client<gracely.Error>(server, key)))
14
24
  if (load)
15
25
  Object.assign(result, load(httpClient))
16
26
  return result as Client & T
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pax2pay/model-banking",
3
- "version": "0.0.7",
3
+ "version": "0.0.8",
4
4
  "description": "Library containing data model types and functions for the Pax2Pay Banking API.",
5
5
  "author": "Pax2Pay Ltd",
6
6
  "license": "MIT",