forked from izatop/cloudpayments
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathClientService.ts
More file actions
41 lines (33 loc) · 1.17 KB
/
ClientService.ts
File metadata and controls
41 lines (33 loc) · 1.17 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
import {ClientAbstract, ClientOptions} from "./Client";
import {ClientApi} from "./ClientApi";
import {ReceiptApi} from "./ReceiptApi";
import {NotificationHandlers} from "./NotificationHandlers";
export class ClientService extends ClientAbstract {
protected client: ClientApi;
protected receipt: ReceiptApi;
protected handlers: NotificationHandlers;
constructor(options: ClientOptions) {
super(options);
this.client = ClientService.createClientApi(this.options);
this.handlers = ClientService.createNotificationHandlers(this.options);
this.receipt = ClientService.createReceiptApi(this.options);
}
public static createClientApi(options: ClientOptions) {
return new ClientApi(options);
}
public static createReceiptApi(options: ClientOptions) {
return new ReceiptApi(options);
}
public static createNotificationHandlers(options: ClientOptions) {
return new NotificationHandlers(options);
}
public getClientApi() {
return this.client;
}
public getNotificationHandlers() {
return this.handlers;
}
public getReceiptApi() {
return this.receipt;
}
}