bkper-js 1.41.0 → 1.42.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 +23 -2
- package/lib/model/Book.js +35 -2
- package/lib/service/transaction-service.js +12 -0
- package/package.json +1 -1
package/lib/index.d.ts
CHANGED
|
@@ -959,11 +959,32 @@ export declare class Book {
|
|
|
959
959
|
*/
|
|
960
960
|
round(value: Amount | number): Amount;
|
|
961
961
|
/**
|
|
962
|
-
*
|
|
962
|
+
* Batch create [[Transactions]] on the Book.
|
|
963
|
+
*
|
|
964
|
+
* @param transactions The transactions to be created
|
|
965
|
+
*
|
|
966
|
+
* @returns The created Transactions
|
|
963
967
|
*/
|
|
964
968
|
batchCreateTransactions(transactions: Transaction[]): Promise<Transaction[]>;
|
|
965
969
|
/**
|
|
966
|
-
*
|
|
970
|
+
* Batch check [[Transactions]] on the Book.
|
|
971
|
+
*
|
|
972
|
+
* @param transactions The transactions to be checked
|
|
973
|
+
*
|
|
974
|
+
*/
|
|
975
|
+
batchCheckTransactions(transactions: Transaction[]): Promise<void>;
|
|
976
|
+
/**
|
|
977
|
+
* Batch uncheck [[Transactions]] on the Book.
|
|
978
|
+
*
|
|
979
|
+
* @param transactions The transactions to be unchecked
|
|
980
|
+
*
|
|
981
|
+
*/
|
|
982
|
+
batchUncheckTransactions(transactions: Transaction[]): Promise<void>;
|
|
983
|
+
/**
|
|
984
|
+
* Batch trash [[Transactions]] on the Book.
|
|
985
|
+
*
|
|
986
|
+
* @param transactions The transactions to be trashed
|
|
987
|
+
*
|
|
967
988
|
*/
|
|
968
989
|
batchTrashTransactions(transactions: Transaction[]): Promise<void>;
|
|
969
990
|
/**
|
package/lib/model/Book.js
CHANGED
|
@@ -406,7 +406,11 @@ export class Book {
|
|
|
406
406
|
return Utils.round(value, this.getFractionDigits());
|
|
407
407
|
}
|
|
408
408
|
/**
|
|
409
|
-
*
|
|
409
|
+
* Batch create [[Transactions]] on the Book.
|
|
410
|
+
*
|
|
411
|
+
* @param transactions The transactions to be created
|
|
412
|
+
*
|
|
413
|
+
* @returns The created Transactions
|
|
410
414
|
*/
|
|
411
415
|
batchCreateTransactions(transactions) {
|
|
412
416
|
return __awaiter(this, void 0, void 0, function* () {
|
|
@@ -418,7 +422,36 @@ export class Book {
|
|
|
418
422
|
});
|
|
419
423
|
}
|
|
420
424
|
/**
|
|
421
|
-
*
|
|
425
|
+
* Batch check [[Transactions]] on the Book.
|
|
426
|
+
*
|
|
427
|
+
* @param transactions The transactions to be checked
|
|
428
|
+
*
|
|
429
|
+
*/
|
|
430
|
+
batchCheckTransactions(transactions) {
|
|
431
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
432
|
+
let transactionPayloads = [];
|
|
433
|
+
transactions.forEach(tx => transactionPayloads.push(tx.json()));
|
|
434
|
+
yield TransactionService.checkTransactionsBatch(this.getId(), transactionPayloads);
|
|
435
|
+
});
|
|
436
|
+
}
|
|
437
|
+
/**
|
|
438
|
+
* Batch uncheck [[Transactions]] on the Book.
|
|
439
|
+
*
|
|
440
|
+
* @param transactions The transactions to be unchecked
|
|
441
|
+
*
|
|
442
|
+
*/
|
|
443
|
+
batchUncheckTransactions(transactions) {
|
|
444
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
445
|
+
let transactionPayloads = [];
|
|
446
|
+
transactions.forEach(tx => transactionPayloads.push(tx.json()));
|
|
447
|
+
yield TransactionService.uncheckTransactionsBatch(this.getId(), transactionPayloads);
|
|
448
|
+
});
|
|
449
|
+
}
|
|
450
|
+
/**
|
|
451
|
+
* Batch trash [[Transactions]] on the Book.
|
|
452
|
+
*
|
|
453
|
+
* @param transactions The transactions to be trashed
|
|
454
|
+
*
|
|
422
455
|
*/
|
|
423
456
|
batchTrashTransactions(transactions) {
|
|
424
457
|
return __awaiter(this, void 0, void 0, function* () {
|
|
@@ -28,6 +28,18 @@ export function createTransactionsBatch(bookId, transactions) {
|
|
|
28
28
|
return transactionList != null && transactionList.items != null ? transactionList.items : [];
|
|
29
29
|
});
|
|
30
30
|
}
|
|
31
|
+
export function checkTransactionsBatch(bookId, transactions) {
|
|
32
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
33
|
+
const payload = { items: transactions };
|
|
34
|
+
yield new HttpBooksApiV5Request(`${bookId}/transactions/check/batch`).setMethod('PATCH').setPayload(payload).fetch();
|
|
35
|
+
});
|
|
36
|
+
}
|
|
37
|
+
export function uncheckTransactionsBatch(bookId, transactions) {
|
|
38
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
39
|
+
const payload = { items: transactions };
|
|
40
|
+
yield new HttpBooksApiV5Request(`${bookId}/transactions/uncheck/batch`).setMethod('PATCH').setPayload(payload).fetch();
|
|
41
|
+
});
|
|
42
|
+
}
|
|
31
43
|
export function trashTransactionsBatch(bookId, transactions) {
|
|
32
44
|
return __awaiter(this, void 0, void 0, function* () {
|
|
33
45
|
let transactionList = {
|