bkper-js 1.8.1 → 1.9.0
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.
- package/lib/index.d.ts +45 -118
- package/lib/model/Account.js +46 -42
- package/lib/model/Amount.js +53 -53
- package/lib/model/App.js +18 -18
- package/lib/model/Book.js +46 -122
- package/lib/model/Collection.js +12 -13
- package/lib/model/Connection.js +21 -23
- package/lib/model/File.js +19 -17
- package/lib/model/Group.js +28 -27
- package/lib/model/Integration.js +13 -15
- package/lib/model/Template.js +15 -17
- package/lib/model/Transaction.js +69 -70
- package/lib/model/TransactionList.js +7 -7
- package/lib/model/User.js +14 -15
- package/package.json +1 -1
package/lib/model/Amount.js
CHANGED
|
@@ -13,23 +13,23 @@ export class Amount {
|
|
|
13
13
|
constructor(n) {
|
|
14
14
|
this.checkNumberNotNull(n);
|
|
15
15
|
if (typeof n == "string") {
|
|
16
|
-
this.
|
|
16
|
+
this.big = new Big(n);
|
|
17
17
|
}
|
|
18
18
|
else if (n instanceof Amount) {
|
|
19
|
-
this.
|
|
19
|
+
this.big = new Big(n.big);
|
|
20
20
|
}
|
|
21
21
|
else if (n.toString) {
|
|
22
|
-
this.
|
|
22
|
+
this.big = new Big(n.toString());
|
|
23
23
|
}
|
|
24
24
|
else {
|
|
25
|
-
this.
|
|
25
|
+
this.big = new Big(+n);
|
|
26
26
|
}
|
|
27
27
|
}
|
|
28
28
|
/**
|
|
29
29
|
* Returns an absolute Amount.
|
|
30
30
|
*/
|
|
31
31
|
abs() {
|
|
32
|
-
let big = this.
|
|
32
|
+
let big = this.big.abs();
|
|
33
33
|
return this.wrap(big);
|
|
34
34
|
}
|
|
35
35
|
/**
|
|
@@ -38,16 +38,16 @@ export class Amount {
|
|
|
38
38
|
cmp(n) {
|
|
39
39
|
this.checkNumberNotNull(n);
|
|
40
40
|
if (typeof n == "string") {
|
|
41
|
-
return this.
|
|
41
|
+
return this.big.cmp(n);
|
|
42
42
|
}
|
|
43
43
|
else if (n instanceof Amount) {
|
|
44
|
-
return this.
|
|
44
|
+
return this.big.cmp(n.big);
|
|
45
45
|
}
|
|
46
46
|
else if (n.toString) {
|
|
47
|
-
return this.
|
|
47
|
+
return this.big.cmp(n.toString());
|
|
48
48
|
}
|
|
49
49
|
else {
|
|
50
|
-
return this.
|
|
50
|
+
return this.big.cmp(+n);
|
|
51
51
|
}
|
|
52
52
|
}
|
|
53
53
|
/**
|
|
@@ -57,16 +57,16 @@ export class Amount {
|
|
|
57
57
|
this.checkNumberNotNull(n);
|
|
58
58
|
let big;
|
|
59
59
|
if (typeof n == "string") {
|
|
60
|
-
big = this.
|
|
60
|
+
big = this.big.div(n);
|
|
61
61
|
}
|
|
62
62
|
else if (n instanceof Amount) {
|
|
63
|
-
big = this.
|
|
63
|
+
big = this.big.div(n.big);
|
|
64
64
|
}
|
|
65
65
|
else if (n.toString) {
|
|
66
|
-
big = this.
|
|
66
|
+
big = this.big.div(n.toString());
|
|
67
67
|
}
|
|
68
68
|
else {
|
|
69
|
-
big = this.
|
|
69
|
+
big = this.big.div(+n);
|
|
70
70
|
}
|
|
71
71
|
return this.wrap(big);
|
|
72
72
|
}
|
|
@@ -76,16 +76,16 @@ export class Amount {
|
|
|
76
76
|
eq(n) {
|
|
77
77
|
this.checkNumberNotNull(n);
|
|
78
78
|
if (typeof n == "string") {
|
|
79
|
-
return this.
|
|
79
|
+
return this.big.eq(n);
|
|
80
80
|
}
|
|
81
81
|
else if (n instanceof Amount) {
|
|
82
|
-
return this.
|
|
82
|
+
return this.big.eq(n.big);
|
|
83
83
|
}
|
|
84
84
|
else if (n.toString) {
|
|
85
|
-
return this.
|
|
85
|
+
return this.big.eq(n.toString());
|
|
86
86
|
}
|
|
87
87
|
else {
|
|
88
|
-
return this.
|
|
88
|
+
return this.big.eq(+n);
|
|
89
89
|
}
|
|
90
90
|
}
|
|
91
91
|
/**
|
|
@@ -94,16 +94,16 @@ export class Amount {
|
|
|
94
94
|
gt(n) {
|
|
95
95
|
this.checkNumberNotNull(n);
|
|
96
96
|
if (typeof n == "string") {
|
|
97
|
-
return this.
|
|
97
|
+
return this.big.gt(n);
|
|
98
98
|
}
|
|
99
99
|
else if (n instanceof Amount) {
|
|
100
|
-
return this.
|
|
100
|
+
return this.big.gt(n.big);
|
|
101
101
|
}
|
|
102
102
|
else if (n.toString) {
|
|
103
|
-
return this.
|
|
103
|
+
return this.big.gt(n.toString());
|
|
104
104
|
}
|
|
105
105
|
else {
|
|
106
|
-
return this.
|
|
106
|
+
return this.big.gt(+n);
|
|
107
107
|
}
|
|
108
108
|
}
|
|
109
109
|
/**
|
|
@@ -112,16 +112,16 @@ export class Amount {
|
|
|
112
112
|
gte(n) {
|
|
113
113
|
this.checkNumberNotNull(n);
|
|
114
114
|
if (typeof n == "string") {
|
|
115
|
-
return this.
|
|
115
|
+
return this.big.gte(n);
|
|
116
116
|
}
|
|
117
117
|
else if (n instanceof Amount) {
|
|
118
|
-
return this.
|
|
118
|
+
return this.big.gte(n.big);
|
|
119
119
|
}
|
|
120
120
|
else if (n.toString) {
|
|
121
|
-
return this.
|
|
121
|
+
return this.big.gte(n.toString());
|
|
122
122
|
}
|
|
123
123
|
else {
|
|
124
|
-
return this.
|
|
124
|
+
return this.big.gte(+n);
|
|
125
125
|
}
|
|
126
126
|
}
|
|
127
127
|
/**
|
|
@@ -130,16 +130,16 @@ export class Amount {
|
|
|
130
130
|
lt(n) {
|
|
131
131
|
this.checkNumberNotNull(n);
|
|
132
132
|
if (typeof n == "string") {
|
|
133
|
-
return this.
|
|
133
|
+
return this.big.lt(n);
|
|
134
134
|
}
|
|
135
135
|
else if (n instanceof Amount) {
|
|
136
|
-
return this.
|
|
136
|
+
return this.big.lt(n.big);
|
|
137
137
|
}
|
|
138
138
|
else if (n.toString) {
|
|
139
|
-
return this.
|
|
139
|
+
return this.big.lt(n.toString());
|
|
140
140
|
}
|
|
141
141
|
else {
|
|
142
|
-
return this.
|
|
142
|
+
return this.big.lt(+n);
|
|
143
143
|
}
|
|
144
144
|
}
|
|
145
145
|
/**
|
|
@@ -148,16 +148,16 @@ export class Amount {
|
|
|
148
148
|
lte(n) {
|
|
149
149
|
this.checkNumberNotNull(n);
|
|
150
150
|
if (typeof n == "string") {
|
|
151
|
-
return this.
|
|
151
|
+
return this.big.lte(n);
|
|
152
152
|
}
|
|
153
153
|
else if (n instanceof Amount) {
|
|
154
|
-
return this.
|
|
154
|
+
return this.big.lte(n.big);
|
|
155
155
|
}
|
|
156
156
|
else if (n.toString) {
|
|
157
|
-
return this.
|
|
157
|
+
return this.big.lte(n.toString());
|
|
158
158
|
}
|
|
159
159
|
else {
|
|
160
|
-
return this.
|
|
160
|
+
return this.big.lte(+n);
|
|
161
161
|
}
|
|
162
162
|
}
|
|
163
163
|
/**
|
|
@@ -167,16 +167,16 @@ export class Amount {
|
|
|
167
167
|
this.checkNumberNotNull(n);
|
|
168
168
|
let big;
|
|
169
169
|
if (typeof n == "string") {
|
|
170
|
-
big = this.
|
|
170
|
+
big = this.big.plus(n);
|
|
171
171
|
}
|
|
172
172
|
else if (n instanceof Amount) {
|
|
173
|
-
big = this.
|
|
173
|
+
big = this.big.plus(n.big);
|
|
174
174
|
}
|
|
175
175
|
else if (n.toString) {
|
|
176
|
-
big = this.
|
|
176
|
+
big = this.big.plus(n.toString());
|
|
177
177
|
}
|
|
178
178
|
else {
|
|
179
|
-
big = this.
|
|
179
|
+
big = this.big.plus(+n);
|
|
180
180
|
}
|
|
181
181
|
return this.wrap(big);
|
|
182
182
|
}
|
|
@@ -187,16 +187,16 @@ export class Amount {
|
|
|
187
187
|
this.checkNumberNotNull(n);
|
|
188
188
|
let big;
|
|
189
189
|
if (typeof n == "string") {
|
|
190
|
-
big = this.
|
|
190
|
+
big = this.big.minus(n);
|
|
191
191
|
}
|
|
192
192
|
else if (n instanceof Amount) {
|
|
193
|
-
big = this.
|
|
193
|
+
big = this.big.minus(n.big);
|
|
194
194
|
}
|
|
195
195
|
else if (n.toString) {
|
|
196
|
-
big = this.
|
|
196
|
+
big = this.big.minus(n.toString());
|
|
197
197
|
}
|
|
198
198
|
else {
|
|
199
|
-
big = this.
|
|
199
|
+
big = this.big.minus(+n);
|
|
200
200
|
}
|
|
201
201
|
return this.wrap(big);
|
|
202
202
|
}
|
|
@@ -210,16 +210,16 @@ export class Amount {
|
|
|
210
210
|
this.checkNumberNotNull(n);
|
|
211
211
|
let big;
|
|
212
212
|
if (typeof n == "string") {
|
|
213
|
-
big = this.
|
|
213
|
+
big = this.big.mod(n);
|
|
214
214
|
}
|
|
215
215
|
else if (n instanceof Amount) {
|
|
216
|
-
big = this.
|
|
216
|
+
big = this.big.mod(n.big);
|
|
217
217
|
}
|
|
218
218
|
else if (n.toString) {
|
|
219
|
-
big = this.
|
|
219
|
+
big = this.big.mod(n.toString());
|
|
220
220
|
}
|
|
221
221
|
else {
|
|
222
|
-
big = this.
|
|
222
|
+
big = this.big.mod(+n);
|
|
223
223
|
}
|
|
224
224
|
return this.wrap(big);
|
|
225
225
|
}
|
|
@@ -227,7 +227,7 @@ export class Amount {
|
|
|
227
227
|
* Round to a maximum of dp decimal places.
|
|
228
228
|
*/
|
|
229
229
|
round(dp) {
|
|
230
|
-
let big = this.
|
|
230
|
+
let big = this.big.round(dp);
|
|
231
231
|
return this.wrap(big);
|
|
232
232
|
}
|
|
233
233
|
/**
|
|
@@ -237,16 +237,16 @@ export class Amount {
|
|
|
237
237
|
this.checkNumberNotNull(n);
|
|
238
238
|
let big;
|
|
239
239
|
if (typeof n == "string") {
|
|
240
|
-
big = this.
|
|
240
|
+
big = this.big.times(n);
|
|
241
241
|
}
|
|
242
242
|
else if (n instanceof Amount) {
|
|
243
|
-
big = this.
|
|
243
|
+
big = this.big.times(n.big);
|
|
244
244
|
}
|
|
245
245
|
else if (n.toString) {
|
|
246
|
-
big = this.
|
|
246
|
+
big = this.big.times(n.toString());
|
|
247
247
|
}
|
|
248
248
|
else {
|
|
249
|
-
big = this.
|
|
249
|
+
big = this.big.times(+n);
|
|
250
250
|
}
|
|
251
251
|
return this.wrap(big);
|
|
252
252
|
}
|
|
@@ -254,19 +254,19 @@ export class Amount {
|
|
|
254
254
|
* Returns a string representing the value of this Amount in normal notation to a fixed number of decimal places dp.
|
|
255
255
|
*/
|
|
256
256
|
toFixed(dp) {
|
|
257
|
-
return this.
|
|
257
|
+
return this.big.toFixed(dp);
|
|
258
258
|
}
|
|
259
259
|
/**
|
|
260
260
|
* Returns a string representing the value of this Amount.
|
|
261
261
|
*/
|
|
262
262
|
toString() {
|
|
263
|
-
return this.
|
|
263
|
+
return this.big.toString();
|
|
264
264
|
}
|
|
265
265
|
/**
|
|
266
266
|
* Returns a primitive number representing the value of this Amount.
|
|
267
267
|
*/
|
|
268
268
|
toNumber() {
|
|
269
|
-
return this.
|
|
269
|
+
return this.big.toNumber();
|
|
270
270
|
}
|
|
271
271
|
/** @internal */
|
|
272
272
|
checkNumberNotNull(amount) {
|
package/lib/model/App.js
CHANGED
|
@@ -16,8 +16,14 @@ import { createApp, patchApp, updateApp } from "../service/app-service.js";
|
|
|
16
16
|
* @public
|
|
17
17
|
*/
|
|
18
18
|
export class App {
|
|
19
|
-
constructor(
|
|
20
|
-
this.
|
|
19
|
+
constructor(payload) {
|
|
20
|
+
this.payload = payload || {};
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* @returns The wrapped plain json object
|
|
24
|
+
*/
|
|
25
|
+
json() {
|
|
26
|
+
return Object.assign({}, this.payload);
|
|
21
27
|
}
|
|
22
28
|
/**
|
|
23
29
|
*
|
|
@@ -27,10 +33,10 @@ export class App {
|
|
|
27
33
|
*/
|
|
28
34
|
setWebhookUrlDev(webhookUrlDev) {
|
|
29
35
|
if (webhookUrlDev) {
|
|
30
|
-
this.
|
|
36
|
+
this.payload.webhookUrlDev = webhookUrlDev;
|
|
31
37
|
}
|
|
32
38
|
else {
|
|
33
|
-
this.
|
|
39
|
+
this.payload.webhookUrlDev = 'null';
|
|
34
40
|
}
|
|
35
41
|
return this;
|
|
36
42
|
}
|
|
@@ -39,7 +45,7 @@ export class App {
|
|
|
39
45
|
* @returns The App universal identifier
|
|
40
46
|
*/
|
|
41
47
|
getId() {
|
|
42
|
-
return this.
|
|
48
|
+
return this.payload.id;
|
|
43
49
|
}
|
|
44
50
|
/**
|
|
45
51
|
* Sets the whitelabeled user emails
|
|
@@ -47,7 +53,7 @@ export class App {
|
|
|
47
53
|
* @returns This App for chaining
|
|
48
54
|
*/
|
|
49
55
|
setUserEmails(emails) {
|
|
50
|
-
this.
|
|
56
|
+
this.payload.userEmails = emails;
|
|
51
57
|
return this;
|
|
52
58
|
}
|
|
53
59
|
/**
|
|
@@ -56,7 +62,7 @@ export class App {
|
|
|
56
62
|
* @returns This App for chaining
|
|
57
63
|
*/
|
|
58
64
|
setDeveloperEmail(email) {
|
|
59
|
-
this.
|
|
65
|
+
this.payload.developerEmail = email;
|
|
60
66
|
return this;
|
|
61
67
|
}
|
|
62
68
|
/**
|
|
@@ -65,7 +71,7 @@ export class App {
|
|
|
65
71
|
* @returns This App for chaining
|
|
66
72
|
*/
|
|
67
73
|
setClientSecret(clientSecret) {
|
|
68
|
-
this.
|
|
74
|
+
this.payload.clientSecret = clientSecret;
|
|
69
75
|
return this;
|
|
70
76
|
}
|
|
71
77
|
/**
|
|
@@ -74,7 +80,7 @@ export class App {
|
|
|
74
80
|
* @returns This App for chaining
|
|
75
81
|
*/
|
|
76
82
|
setReadme(readme) {
|
|
77
|
-
this.
|
|
83
|
+
this.payload.readme = readme;
|
|
78
84
|
return this;
|
|
79
85
|
}
|
|
80
86
|
/**
|
|
@@ -84,7 +90,7 @@ export class App {
|
|
|
84
90
|
*/
|
|
85
91
|
create() {
|
|
86
92
|
return __awaiter(this, void 0, void 0, function* () {
|
|
87
|
-
yield createApp(this.
|
|
93
|
+
yield createApp(this.payload);
|
|
88
94
|
return this;
|
|
89
95
|
});
|
|
90
96
|
}
|
|
@@ -93,7 +99,7 @@ export class App {
|
|
|
93
99
|
*/
|
|
94
100
|
patch() {
|
|
95
101
|
return __awaiter(this, void 0, void 0, function* () {
|
|
96
|
-
yield patchApp(this.
|
|
102
|
+
yield patchApp(this.payload);
|
|
97
103
|
return this;
|
|
98
104
|
});
|
|
99
105
|
}
|
|
@@ -102,15 +108,9 @@ export class App {
|
|
|
102
108
|
*/
|
|
103
109
|
update() {
|
|
104
110
|
return __awaiter(this, void 0, void 0, function* () {
|
|
105
|
-
yield updateApp(this.
|
|
111
|
+
yield updateApp(this.payload);
|
|
106
112
|
return this;
|
|
107
113
|
});
|
|
108
114
|
}
|
|
109
|
-
/**
|
|
110
|
-
* @returns The wrapped plain json object
|
|
111
|
-
*/
|
|
112
|
-
json() {
|
|
113
|
-
return this.wrapped;
|
|
114
|
-
}
|
|
115
115
|
}
|
|
116
116
|
//# sourceMappingURL=App.js.map
|