cityworks 0.0.51 → 0.0.53

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.
Files changed (45) hide show
  1. package/README.md +1 -1
  2. package/dist/activity_link.js +219 -0
  3. package/dist/attachments.d.ts +59 -0
  4. package/dist/briefcase.d.ts +28 -7
  5. package/dist/briefcase.js +327 -0
  6. package/dist/case_admin.d.ts +0 -22
  7. package/dist/case_admin.js +821 -0
  8. package/dist/case_assets.js +129 -0
  9. package/dist/case_data.js +416 -0
  10. package/dist/case_financial.js +848 -0
  11. package/dist/case_workflow.js +455 -0
  12. package/dist/comments.js +126 -0
  13. package/dist/error.js +30 -0
  14. package/dist/event_layer.d.ts +97 -0
  15. package/dist/event_layer.js +207 -0
  16. package/dist/general.d.ts +23 -0
  17. package/dist/general.js +212 -0
  18. package/dist/gis.js +250 -0
  19. package/dist/index.d.ts +10 -8
  20. package/dist/index.js +1 -1
  21. package/dist/index.js.map +1 -1
  22. package/dist/index.m.js +1 -1
  23. package/dist/index.m.js.map +1 -1
  24. package/dist/index.modern.mjs +1 -1
  25. package/dist/index.modern.mjs.map +1 -1
  26. package/dist/index.umd.js +1 -1
  27. package/dist/index.umd.js.map +1 -1
  28. package/dist/inspection.d.ts +17 -1
  29. package/dist/inspection.js +933 -0
  30. package/dist/inspection_admin.js +43 -0
  31. package/dist/inspection_costs.js +200 -0
  32. package/dist/message_queue.js +248 -0
  33. package/dist/query.d.ts +108 -0
  34. package/dist/query.js +242 -0
  35. package/dist/request.d.ts +5 -1
  36. package/dist/request.js +899 -0
  37. package/dist/request_admin.js +32 -0
  38. package/dist/request_costs.js +113 -0
  39. package/dist/search.d.ts +12 -1
  40. package/dist/search.js +371 -0
  41. package/dist/workorder.d.ts +4 -0
  42. package/dist/workorder.js +951 -0
  43. package/dist/workorder_admin.js +248 -0
  44. package/dist/workorder_costs.js +274 -0
  45. package/package.json +7 -2
@@ -0,0 +1,848 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.CaseFinancial = void 0;
4
+ var error_1 = require("./error");
5
+ var _ = require('lodash');
6
+ var CaseFinancial = /** @class */ (function () {
7
+ /**
8
+ * @hidden
9
+ */
10
+ function CaseFinancial(cw) {
11
+ this.cw = cw;
12
+ }
13
+ /**
14
+ * Adds a fee to the case specified by the CaObectId.
15
+ *
16
+ * @category Case Fees
17
+ * @param {number} caObjectId - The Case Object ID for the case to which to add the fee
18
+ * @param {number} feeSetupId - The fee setup id for the fee to add to the case.
19
+ * @param {Object} [options] - See /{subdirectory}/apidocs/#/service-info/Pll/CaseFees for more options. (Checkboxes -- Autorecalculate -- are Y/N strings)
20
+ * @return {Object} Returns Promise that represents an object describing the newly-added fee. See /{subdirectory}/apidocs/#/data-type-info;dataType=CaFeesItemBase
21
+ */
22
+ CaseFinancial.prototype.addFee = function (caObjectId, feeSetupId, options) {
23
+ var _this = this;
24
+ return new Promise(function (resolve, reject) {
25
+ var init_data = {
26
+ CaObjectId: caObjectId,
27
+ FeeSetupId: feeSetupId
28
+ };
29
+ var data = _.merge(init_data, options);
30
+ _this.cw.runRequest('Pll/CaseFees/Add', data).then(function (r) {
31
+ resolve(r.Value);
32
+ }).catch(function (e) {
33
+ reject(e);
34
+ });
35
+ });
36
+ };
37
+ /**
38
+ * Add Case Fee Payment. Adds a payment to the case fee specified by caObjectId.
39
+ *
40
+ * @category Case Payments
41
+ * @param {number} caObjectId - The Case Object ID for the case to which to add the fee
42
+ * @param {Object} options - See /{subdirectory}/apidocs/#/service-info/Pll/CasePayment for more options, including required fields.
43
+ * @return {Object} Returns Promise that represents an object describing the newly-added payment. See /{subdirectory}/apidocs/#/data-type-info;dataType=CaPaymentItemBase
44
+ */
45
+ CaseFinancial.prototype.addPayment = function (caObjectId, options) {
46
+ var _this = this;
47
+ return new Promise(function (resolve, reject) {
48
+ var init_data = {
49
+ CaObjectId: caObjectId
50
+ };
51
+ var data = _.merge(init_data, options);
52
+ _this.cw.runRequest('Pll/CasePayment/Add', data).then(function (r) {
53
+ resolve(r.Value);
54
+ }).catch(function (e) {
55
+ reject(e);
56
+ });
57
+ });
58
+ };
59
+ /**
60
+ * Add Case Payment Refund. Refunds a payment on the case payment specified by caPaymentId.
61
+ *
62
+ * @category Case Payment Refunds
63
+ * @param {number} caPaymentId - The Case Payment ID for the case payment which to refund
64
+ * @param {number} refundAmount - The amount to refund
65
+ * @param {string} comment - A comment to append to the refund
66
+ * @return {Object} Returns Promise that represents an object describing the newly-added payment refund. See /{subdirectory}/apidocs/#/data-type-info;dataType=CaPaymentRefundItemBase
67
+ */
68
+ CaseFinancial.prototype.addRefund = function (caPaymentId, refundAmount, comment) {
69
+ var _this = this;
70
+ return new Promise(function (resolve, reject) {
71
+ var data = {
72
+ CaPaymentId: caPaymentId,
73
+ RefundAmount: refundAmount,
74
+ Comments: comment
75
+ };
76
+ _this.cw.runRequest('Pll/CasePaymentRefund/Add', data).then(function (r) {
77
+ resolve(r.Value);
78
+ }).catch(function (e) {
79
+ reject(e);
80
+ });
81
+ });
82
+ };
83
+ /**
84
+ * Add Case Deposit Payment. Adds a payment to the case deposit specified by CaDepositId.
85
+ *
86
+ * @category Case Payments
87
+ * @param {number} caDepositId - The Case Deposit ID for the case deposit to which to add the fee
88
+ * @param {Object} options - See /{subdirectory}/apidocs/#/service-info/Pll/CasePayment for more options, including required fields.
89
+ * @return {Object} Returns Promise that represents an object describing the newly-added payment. See /{subdirectory}/apidocs/#/data-type-info;dataType=CaPaymentItemBase
90
+ */
91
+ CaseFinancial.prototype.addDepositPayment = function (caDepositId, options) {
92
+ var _this = this;
93
+ return new Promise(function (resolve, reject) {
94
+ var init_data = {
95
+ CaDepositId: caDepositId
96
+ };
97
+ var data = _.merge(init_data, options);
98
+ _this.cw.runRequest('Pll/CasePayment/AddDeposit', data).then(function (r) {
99
+ resolve(r.Value);
100
+ }).catch(function (e) {
101
+ reject(e);
102
+ });
103
+ });
104
+ };
105
+ /**
106
+ * Adds a deposit to the case specified by the CaObectId.
107
+ *
108
+ * @category Case Deposits
109
+ * @param {number} caObjectId - The Case Object ID for the case to which to add the fee
110
+ * @param {number} depositId - The deposit setup id for the deposit to add to the case.
111
+ * @param {number} [amount] - The amount of the deposit (optional)
112
+ * @param {string} [comment] - Comment text to add to the deposit (optional)
113
+ * @return {Object} Returns Promise that represents an object describing the newly-added deposit. See /{subdirectory}/apidocs/#/data-type-info;dataType=CaDepositItemBase
114
+ */
115
+ CaseFinancial.prototype.addDeposit = function (caObjectId, depositId, amount, comment) {
116
+ var _this = this;
117
+ return new Promise(function (resolve, reject) {
118
+ var data = {
119
+ CaObjectId: caObjectId,
120
+ DepositId: depositId
121
+ };
122
+ if (typeof (amount) != 'undefined') {
123
+ _.set(data, 'Amount', amount);
124
+ }
125
+ if (typeof (comment) != 'undefined') {
126
+ _.set(data, 'CommentText', comment);
127
+ }
128
+ _this.cw.runRequest('CaseDeposit/Add', data).then(function (r) {
129
+ resolve(r.Value);
130
+ }).catch(function (e) {
131
+ reject(e);
132
+ });
133
+ });
134
+ };
135
+ /**
136
+ * Adds an instrument to the case specified by the CaObectId.
137
+ *
138
+ * @category Case Instruments
139
+ * @param {number} caObjectId - The Case Object ID for the case to which to add the instrument
140
+ * @param {number} instTypeId - The instrument type id for the instrument being added to the case.
141
+ * @param {number} amount - The amount of the instrument
142
+ * @param {Date} dateExpire - The datetime for the instrument to expire.
143
+ * @param {Object} [options] - See /{subdirectory}/apidocs/#/service-info/Pll/CaseInstrument for more options.
144
+ * @return {Object} Returns Promise that represents an object describing the newly-added instrument. See /{subdirectory}/apidocs/#/service-info/Pll/CaseInstrument
145
+ */
146
+ CaseFinancial.prototype.addInstrument = function (caObjectId, instTypeId, amount, dateExpire, options) {
147
+ var _this = this;
148
+ return new Promise(function (resolve, reject) {
149
+ var init_data = {
150
+ CaObjectId: caObjectId,
151
+ InstTypeId: instTypeId,
152
+ Amount: amount,
153
+ DateExpire: dateExpire
154
+ };
155
+ var data = _.merge(init_data, options);
156
+ _this.cw.runRequest('Pll/CaseInstrument/Add', data).then(function (r) {
157
+ resolve(r.Value);
158
+ }).catch(function (e) {
159
+ reject(e);
160
+ });
161
+ });
162
+ };
163
+ /**
164
+ * Updates a fee specified by the CaFeeId.
165
+ *
166
+ * @category Case Fees
167
+ * @param {number} caFeeId - The Fee ID for the specific instance of the fee you wish to update
168
+ * @param {Object} [options] - See /{subdirectory}/apidocs/#/service-info/Pll/CaseFees for more options. (Checkboxes -- Autorecalculate -- are Y/N strings)
169
+ * @return {Object} Returns Promise that represents an object describing the updated fee. See /{subdirectory}/apidocs/#/data-type-info;dataType=CaFeesItemBase
170
+ */
171
+ CaseFinancial.prototype.updateFee = function (caFeeId, options) {
172
+ var _this = this;
173
+ return new Promise(function (resolve, reject) {
174
+ var init_data = {
175
+ CaFeeId: caFeeId
176
+ };
177
+ var data = _.merge(init_data, options);
178
+ _this.cw.runRequest('Pll/CaseFees/Update', data).then(function (r) {
179
+ resolve(r.Value);
180
+ }).catch(function (e) {
181
+ reject(e);
182
+ });
183
+ });
184
+ };
185
+ /**
186
+ * Void a refund.
187
+ *
188
+ * @category Case Refund Payment
189
+ * @param {number} caPaymentRefundId - The Refund ID for the specific refund to void
190
+ * @param {String} voided - A string. No clue.
191
+ * @return {Object} Returns Promise that represents an object describing the voided refund. See /{subdirectory}/apidocs/#/data-type-info;dataType=CaPaymentRefundItemBase
192
+ */
193
+ CaseFinancial.prototype.voidRefund = function (caPaymentRefundId, voided) {
194
+ var _this = this;
195
+ return new Promise(function (resolve, reject) {
196
+ var data = {
197
+ CaPaymentRefundId: caPaymentRefundId,
198
+ Voided: voided
199
+ };
200
+ _this.cw.runRequest('Pll/CasePaymentRefund/Update', data).then(function (r) {
201
+ resolve(r.Value);
202
+ }).catch(function (e) {
203
+ reject(e);
204
+ });
205
+ });
206
+ };
207
+ /**
208
+ * Adds Default Case Fees. Adds fees to the case specified by the CaObectId and BusCaseId.
209
+ *
210
+ * @category Case Fees
211
+ * @param {number} caObjectId - The Case Object ID for the case to which to add the default fees
212
+ * @param {number} busCaseId - The business case ID whose default fees should be added to the case
213
+ * @return {Object} Returns Promise that represents a collection of Fee Items. See /{subdirectory}/apidocs/#/data-type-info;dataType=CaFeesItemBase
214
+ */
215
+ CaseFinancial.prototype.addDefaultFees = function (caObjectId, busCaseId) {
216
+ var _this = this;
217
+ return new Promise(function (resolve, reject) {
218
+ var data = {
219
+ CaObjectId: caObjectId,
220
+ BusCaseId: busCaseId
221
+ };
222
+ _this.cw.runRequest('Pll/CaseFees/AddDefault', data).then(function (r) {
223
+ resolve(r.Value);
224
+ }).catch(function (e) {
225
+ reject(e);
226
+ });
227
+ });
228
+ };
229
+ /**
230
+ * Adds Default Case Deposits. Adds deposits to the case specified by the CaObectId and BusCaseId.
231
+ *
232
+ * @category Case Deposits
233
+ * @param {number} caObjectId - The Case Object ID for the case to which to add the default deposits
234
+ * @param {number} busCaseId - The business case ID whose default deposits should be added to the case
235
+ * @return {Object} Returns Promise that represents a collection of Deposit Items. See /{subdirectory}/apidocs/#/data-type-info;dataType=CaDepositItemBase
236
+ */
237
+ CaseFinancial.prototype.addDefaultDeposits = function (caObjectId, busCaseId) {
238
+ var _this = this;
239
+ return new Promise(function (resolve, reject) {
240
+ var data = {
241
+ CaObjectId: caObjectId,
242
+ BusCaseId: busCaseId
243
+ };
244
+ _this.cw.runRequest('Pll/CaseDeposit/AddDefault', data).then(function (r) {
245
+ resolve(r.Value);
246
+ }).catch(function (e) {
247
+ reject(e);
248
+ });
249
+ });
250
+ };
251
+ /**
252
+ * Gets the fees from the case specified by the CaObectId.
253
+ *
254
+ * @category Case Fees
255
+ * @param {number} caObjectId - The Case Object ID for the case to which to get the fees
256
+ * @return {Object} Returns Promise that represents a collection of Case Fees.
257
+ */
258
+ CaseFinancial.prototype.getFees = function (caObjectId) {
259
+ var _this = this;
260
+ return new Promise(function (resolve, reject) {
261
+ var data = {
262
+ CaObjectId: caObjectId
263
+ };
264
+ _this.cw.runRequest('Pll/CaseFees/ByCaObjectId', data).then(function (r) {
265
+ resolve(r.Value);
266
+ }).catch(function (e) {
267
+ reject(e);
268
+ });
269
+ });
270
+ };
271
+ /**
272
+ * Get Case Deposit by Case ObjectId.
273
+ *
274
+ * @category Case Deposits
275
+ * @param {number} caObjectId - The Case Object ID for the case to which to get the deposits
276
+ * @return {Object} Returns Promise that represents a collection of Case Deposits.
277
+ */
278
+ CaseFinancial.prototype.getDeposits = function (caObjectId) {
279
+ var _this = this;
280
+ return new Promise(function (resolve, reject) {
281
+ var data = {
282
+ CaObjectId: caObjectId
283
+ };
284
+ _this.cw.runRequest('Pll/CaseDeposit/ByCaObjectId', data).then(function (r) {
285
+ resolve(r.Value);
286
+ }).catch(function (e) {
287
+ reject(e);
288
+ });
289
+ });
290
+ };
291
+ /**
292
+ * Get Case Payments by Case ObjectId
293
+ *
294
+ * @category Case Payments
295
+ * @param {number} caObjectId - The Case Object ID for the case to which to get the payments
296
+ * @return {Object} Returns Promise that represents a collection of Case Payments.
297
+ */
298
+ CaseFinancial.prototype.getPayments = function (caObjectId) {
299
+ var _this = this;
300
+ return new Promise(function (resolve, reject) {
301
+ var data = {
302
+ CaObjectId: caObjectId
303
+ };
304
+ _this.cw.runRequest('Pll/CasePayment/ByCaObjectId', data).then(function (r) {
305
+ resolve(r.Value);
306
+ }).catch(function (e) {
307
+ reject(e);
308
+ });
309
+ });
310
+ };
311
+ /**
312
+ * Gets the instruments from the case specified by the CaObectId.
313
+ *
314
+ * @category Case Instruments
315
+ * @param {number} caObjectId - The Case Object ID for the case to which to get the fees
316
+ * @return {Object} Returns Promise that represents a collection of Case Instruments.
317
+ */
318
+ CaseFinancial.prototype.getInstruments = function (caObjectId) {
319
+ var _this = this;
320
+ return new Promise(function (resolve, reject) {
321
+ var data = {
322
+ CaObjectId: caObjectId
323
+ };
324
+ _this.cw.runRequest('Pll/CaseInstrument/ByCaObjectId', data).then(function (r) {
325
+ resolve(r.Value);
326
+ }).catch(function (e) {
327
+ reject(e);
328
+ });
329
+ });
330
+ };
331
+ /**
332
+ * Delete the fee specified by the caFeeId.
333
+ *
334
+ * @category Case Fees
335
+ * @param {number} caFeeId - The Case Fee ID which should be deleted
336
+ * @return {Object} Returns Promise that represents a Case Fee object.
337
+ */
338
+ CaseFinancial.prototype.deleteFee = function (caFeeId) {
339
+ var _this = this;
340
+ return new Promise(function (resolve, reject) {
341
+ var data = {
342
+ CaFeeId: caFeeId
343
+ };
344
+ _this.cw.runRequest('Pll/CaseFees/Delete', data).then(function (r) {
345
+ resolve(r.Value);
346
+ }).catch(function (e) {
347
+ reject(e);
348
+ });
349
+ });
350
+ };
351
+ /**
352
+ * Delete Case Fees by Case ObjectId. Delete from the system all Fees linked to a specific Case as specified by the Case Id parameter (CaObjectId).
353
+ *
354
+ * @category Case Fees
355
+ * @param {number} caObjectId - The Case Object ID whose fees should be deleted
356
+ * @return {Object} Returns Promise that represents a number (?)
357
+ */
358
+ CaseFinancial.prototype.deleteFeesByCaseId = function (caObjectId) {
359
+ var _this = this;
360
+ return new Promise(function (resolve, reject) {
361
+ var data = {
362
+ CaObjectId: caObjectId
363
+ };
364
+ _this.cw.runRequest('Pll/CaseFees/DeleteByCaObjectId', data).then(function (r) {
365
+ resolve(r.Value);
366
+ }).catch(function (e) {
367
+ reject(e);
368
+ });
369
+ });
370
+ };
371
+ /**
372
+ * Delete a Case Payment by Id. Delete a specific case payment by CaPaymentId.
373
+ *
374
+ * @category Case Payments
375
+ * @param {number} caPaymentId - The Case Payment ID which should be deleted
376
+ * @return {Object} Returns Promise that represents a Case Payment object.
377
+ */
378
+ CaseFinancial.prototype.deletePayment = function (caFeeId) {
379
+ var _this = this;
380
+ return new Promise(function (resolve, reject) {
381
+ var data = {
382
+ CaFeeId: caFeeId
383
+ };
384
+ _this.cw.runRequest('Pll/CasePayment/Delete', data).then(function (r) {
385
+ resolve(r.Value);
386
+ }).catch(function (e) {
387
+ reject(e);
388
+ });
389
+ });
390
+ };
391
+ /**
392
+ * Delete Case Payment Refund. Removes a refund on a payment.
393
+ *
394
+ * @category Case Payment Refunds
395
+ * @param {number} caPaymentRefundId - The Case Payment ID for the case payment which to refund
396
+ * @return {Object} Returns Promise that represents an object describing the deleted payment refund. See /{subdirectory}/apidocs/#/data-type-info;dataType=CaPaymentRefundItemBase
397
+ */
398
+ CaseFinancial.prototype.deleteRefund = function (caPaymentRefundId) {
399
+ var _this = this;
400
+ return new Promise(function (resolve, reject) {
401
+ var data = {
402
+ CaPaymentRefundId: caPaymentRefundId
403
+ };
404
+ _this.cw.runRequest('Pll/CasePaymentRefund/Delete', data).then(function (r) {
405
+ resolve(r.Value);
406
+ }).catch(function (e) {
407
+ reject(e);
408
+ });
409
+ });
410
+ };
411
+ /**
412
+ * Delete Case Payments by Case ObjectId. Delete from the system all payments associated to a specific case as specified by the case id (CaObjectId)
413
+ *
414
+ * @category Case Payments
415
+ * @param {number} caObjectId - The Case Object ID whose payments should be deleted
416
+ * @return {Object} Returns Promise that represents a number (?)
417
+ */
418
+ CaseFinancial.prototype.deletePaymentsByCaseId = function (caObjectId) {
419
+ var _this = this;
420
+ return new Promise(function (resolve, reject) {
421
+ var data = {
422
+ CaObjectId: caObjectId
423
+ };
424
+ _this.cw.runRequest('Pll/CasePayment/DeleteByCaObjectId', data).then(function (r) {
425
+ resolve(r.Value);
426
+ }).catch(function (e) {
427
+ reject(e);
428
+ });
429
+ });
430
+ };
431
+ /**
432
+ * Delete the fee specified by the caFeeId.
433
+ *
434
+ * @category Case Deposits
435
+ * @param {number} caDepositId - The Case Deposit ID which should be deleted
436
+ * @return {Object} Returns Promise that represents a collection of Case Deposits.
437
+ */
438
+ CaseFinancial.prototype.deleteDeposit = function (caDepositId) {
439
+ var _this = this;
440
+ return new Promise(function (resolve, reject) {
441
+ var data = {
442
+ CaDepositId: caDepositId
443
+ };
444
+ _this.cw.runRequest('Pll/CaseDeposit/Delete', data).then(function (r) {
445
+ resolve(r.Value);
446
+ }).catch(function (e) {
447
+ reject(e);
448
+ });
449
+ });
450
+ };
451
+ /**
452
+ * Delete Case Fees by Case ObjectId. Delete from the system all Fees linked to a specific Case as specified by the Case Id parameter (CaObjectId).
453
+ *
454
+ * @category Case Deposits
455
+ * @param {number} caObjectId - The Case Object ID whose fees should be deleted
456
+ * @return {Object} Returns Promise that represents a number (?)
457
+ */
458
+ CaseFinancial.prototype.deleteDepositsByCaseId = function (caObjectId) {
459
+ var _this = this;
460
+ return new Promise(function (resolve, reject) {
461
+ var data = {
462
+ CaObjectId: caObjectId
463
+ };
464
+ _this.cw.runRequest('Pll/CaseDeposit/DeleteByCaObjectId', data).then(function (r) {
465
+ resolve(r.Value);
466
+ }).catch(function (e) {
467
+ reject(e);
468
+ });
469
+ });
470
+ };
471
+ /**
472
+ * Delete the instrument specified by the caInstrumentId.
473
+ *
474
+ * @category Case Instruments
475
+ * @param {number} caInstrumentId - The Case Instrument ID which should be deleted
476
+ * @return {Object} Returns Promise that represents a Case Instrument.
477
+ */
478
+ CaseFinancial.prototype.deleteInstrument = function (caInstrumentId) {
479
+ var _this = this;
480
+ return new Promise(function (resolve, reject) {
481
+ var data = {
482
+ CaInstrumentId: caInstrumentId
483
+ };
484
+ _this.cw.runRequest('Pll/CaseInstrument/Delete', data).then(function (r) {
485
+ resolve(r.Value);
486
+ }).catch(function (e) {
487
+ reject(e);
488
+ });
489
+ });
490
+ };
491
+ /**
492
+ * Delete Case Instruments by Case ObjectId. Delete from the system all Instruments linked to a specific Case as specified by the Case Id parameter (CaObjectId).
493
+ *
494
+ * @category Case Instruments
495
+ * @param {number} caObjectId - The Case Object ID whose instruments should be deleted
496
+ * @return {Object} Returns Promise that represents a number (?)
497
+ */
498
+ CaseFinancial.prototype.deleteInstrumentsByCaseId = function (caObjectId) {
499
+ var _this = this;
500
+ return new Promise(function (resolve, reject) {
501
+ var data = {
502
+ CaObjectId: caObjectId
503
+ };
504
+ _this.cw.runRequest('Pll/CaseInstrument/DeleteByCaObjectId', data).then(function (r) {
505
+ resolve(r.Value);
506
+ }).catch(function (e) {
507
+ reject(e);
508
+ });
509
+ });
510
+ };
511
+ /**
512
+ * Search for Case Fees. Include at least one of the search fields. A logical 'and' operation is applied for multiple search fields.
513
+ *
514
+ * @category Case Fees
515
+ * @param {Object} filters - The parameter(s) to search by
516
+ * @return {Object} Returns Promise that represents an Array of case fee IDs
517
+ */
518
+ CaseFinancial.prototype.searchFees = function (filters) {
519
+ var _this = this;
520
+ return new Promise(function (resolve, reject) {
521
+ if (_.intersectionBy(_.keysIn(filters), ['CaFeeId', 'CaObjectId', 'FeeCode', 'FeeDesc']).length == 0) {
522
+ reject(new error_1.CWError(4, 'At least one of the attributes (CaFeeId, CaObjectId, FeeCode, FeeDesc) must be defined.'));
523
+ }
524
+ var data = filters;
525
+ _this.cw.runRequest('Pll/CaseFees/Search', data).then(function (r) {
526
+ resolve(r.Value);
527
+ }).catch(function (e) {
528
+ reject(e);
529
+ });
530
+ });
531
+ };
532
+ /**
533
+ * Search for Case Payments. Include one or more of the search fields. A logical 'and' operation is applied for multiple search fields.
534
+ *
535
+ * @category Case Payments
536
+ * @param {Object} filters - The filters to search for matched Case Payments
537
+ * @return {Object} Returns Promise that represents an Array of case payment IDs
538
+ */
539
+ CaseFinancial.prototype.searchPayments = function (filters) {
540
+ var _this = this;
541
+ return new Promise(function (resolve, reject) {
542
+ if (_.intersectionBy(_.keysIn(filters), ['CaPaymentId', 'CommentText', 'FeeAmount', 'FeeCode', 'FeeDesc', 'PaymentAccount', 'PaymentAmount', 'TenderType']).length == 0) {
543
+ reject(new error_1.CWError(5, 'At least one of the attributes (CaPaymentId, CommentText, FeeAmount, FeeCode, FeeDesc, PaymentAccount, PaymentAmount, TenderType) must be defined.'));
544
+ }
545
+ var data = filters;
546
+ _this.cw.runRequest('Pll/CasePayment/Search', data).then(function (r) {
547
+ resolve(r.Value);
548
+ }).catch(function (e) {
549
+ reject(e);
550
+ });
551
+ });
552
+ };
553
+ /**
554
+ * Search for Case Payment Refunds. Include one or more of the search fields. A logical 'and' operation is applied for multiple search fields.
555
+ *
556
+ * @category Case Payment Refunds
557
+ * @param {Object} filters - The filters to search for matched Case Payments.
558
+ * @return {Object} Returns Promise that represents an Array of case payment refund IDs
559
+ */
560
+ CaseFinancial.prototype.searchRefunds = function (filters) {
561
+ var _this = this;
562
+ return new Promise(function (resolve, reject) {
563
+ if (_.intersectionBy(_.keysIn(filters), ['CaPaymentId', 'CaPaymentRefundId', 'Comments', 'RefundAmount']).length == 0) {
564
+ reject(new error_1.CWError(6, 'At least one of the attributes (CaPaymentId, CaPaymentRefundId, Comments, RefundAmount) must be defined.'));
565
+ }
566
+ var data = filters;
567
+ _this.cw.runRequest('Pll/CasePayment/Search', data).then(function (r) {
568
+ resolve(r.Value);
569
+ }).catch(function (e) {
570
+ reject(e);
571
+ });
572
+ });
573
+ };
574
+ /**
575
+ * Search for Case Deposits. Include at least one of the search fields. A logical 'and' operation is applied for multiple search fields.
576
+ *
577
+ * @category Case Deposits
578
+ * @param {Object} filters - The parameters to search by.
579
+ * @return {Object} Returns Promise that represents an Array of case fee IDs
580
+ */
581
+ CaseFinancial.prototype.searchDeposits = function (filters) {
582
+ var _this = this;
583
+ return new Promise(function (resolve, reject) {
584
+ if (_.intersectionBy(_.keysIn(filters), ['CaDepositId', 'CaObjectId', 'DepositCode', 'DepositDesc']).length == 0) {
585
+ reject(new error_1.CWError(1, 'At least one of the arguments (CaDepositId, CaObjectId, DepositCode, DepositDesc) must be defined.'));
586
+ }
587
+ var data = filters;
588
+ _this.cw.runRequest('Pll/CaseDeposit/Search', data).then(function (r) {
589
+ resolve(r.Value);
590
+ }).catch(function (e) {
591
+ reject(e);
592
+ });
593
+ });
594
+ };
595
+ /**
596
+ * Get All Fee Templates
597
+ *
598
+ * @category Case Fees
599
+ * @return {Object} Returns Promise that represents an object describing the newly-added fee. See /{subdirectory}/apidocs/#/data-type-info;dataType=CaFeesItemBase
600
+ */
601
+ CaseFinancial.prototype.getAllFeeTemplates = function () {
602
+ var _this = this;
603
+ return new Promise(function (resolve, reject) {
604
+ var data = {};
605
+ _this.cw.runRequest('Pll/FeeSetup/All', data).then(function (r) {
606
+ resolve(r.Value);
607
+ }).catch(function (e) {
608
+ reject(e);
609
+ });
610
+ });
611
+ };
612
+ /**
613
+ * Search for Fees. Include at least one of the search fields. A logical 'and' operation is applied for multiple search fields.
614
+ *
615
+ * @category Case Fees
616
+ * @param {Object} filters - The parameters to search by
617
+ * @return {Object} Returns Promise that represents an Array of case fee IDs
618
+ */
619
+ CaseFinancial.prototype.searchFeeTemplates = function (filters) {
620
+ var _this = this;
621
+ return new Promise(function (resolve, reject) {
622
+ if (_.intersectionBy(_.keysIn(filters), ['FeeSetupId', 'FeeTypeId', 'FeeCode', 'FeeDesc', 'AccountCode']).length == 0) {
623
+ reject(new error_1.CWError(7, 'At least one of the arguments (FeeSetupId, FeeTypeId, FeeCode, FeeDesc, AccountCode) must be defined.'));
624
+ }
625
+ var data = filters;
626
+ _this.cw.runRequest('Pll/FeeSetup/Search', data).then(function (r) {
627
+ resolve(r.Value);
628
+ }).catch(function (e) {
629
+ reject(e);
630
+ });
631
+ });
632
+ };
633
+ /**
634
+ * Search for Case Instruments. Include at least one of the search fields. A logical 'and' operation is applied for multiple search fields.
635
+ *
636
+ * @category Case Instruments
637
+ * @param {Object} filters - The parameters to search by (AddressLine1, Amount, CaInstrumentId, CityName, CommentText, Company, ContactEmail, ContactName, ContactPhone, CountryCode, InstTypeId, SerialNumber, StateCode, ZipCode)
638
+ * @return {Object} Returns Promise that represents an Array of case instrument IDs
639
+ */
640
+ CaseFinancial.prototype.searchCaseInstruments = function (filters) {
641
+ var _this = this;
642
+ return new Promise(function (resolve, reject) {
643
+ if (_.intersectionBy(_.keysIn(filters), ['AddressLine1', 'Amount', 'CaInstrumentId', 'CityName', 'CommentText', 'Company', 'ContactEmail', 'ContactName', 'ContactPhone', 'CountryCode', 'InstTypeId', 'SerialNumber', 'StateCode', 'ZipCode']).length == 0) {
644
+ reject(new error_1.CWError(9, 'At least one of the arguments (AddressLine1, Amount, CaInstrumentId, CityName, CommentText, Company, ContactEmail, ContactName, ContactPhone, CountryCode, InstTypeId, SerialNumber, StateCode, ZipCode) must be defined.'));
645
+ }
646
+ var data = filters;
647
+ _this.cw.runRequest('Pll/CaseInstrument/Search', data).then(function (r) {
648
+ resolve(r.Value);
649
+ }).catch(function (e) {
650
+ reject(e);
651
+ });
652
+ });
653
+ };
654
+ /**
655
+ * Get the Defined Instruments
656
+ *
657
+ * @category Instruments
658
+ * @param {Object} options - the options to filter the instruments returned by
659
+ * @return {Object} Returns Promise that represents an Array of CaInstrumentItem
660
+ */
661
+ CaseFinancial.prototype.getInstrumentList = function (options) {
662
+ var _this = this;
663
+ return new Promise(function (resolve, reject) {
664
+ var data = options;
665
+ _this.cw.runRequest('Pll/CaseInstrument/GetList', data).then(function (r) {
666
+ resolve(r.Value);
667
+ }).catch(function (e) {
668
+ reject(e);
669
+ });
670
+ });
671
+ };
672
+ /**
673
+ * Adds a release to a case instrument specified by the caInstrumentId. Must provide either amountReleased OR percentReleased
674
+ *
675
+ * @category Case Instrument Releases
676
+ * @param {number} caInstrumentId - The Case Instrument ID to which to add the instrument release
677
+ * @param {number} releasedBy - UserID to attach to the release.
678
+ * @param {Date} dateReleased - The date of the release
679
+ * @param {number} [amountReleased] - The amount to be released
680
+ * @param {number} [percentReleased] - OR the percent to be released
681
+ * @param {string} [comment] - Comment to attach to the release
682
+ * @return {Object} Returns Promise that represents an object describing the newly-added instrument release. See /{subdirectory}/apidocs/#/data-type-info;dataType=CaInstReleasesItemBase
683
+ */
684
+ CaseFinancial.prototype.addCaseInstrumentRelease = function (caInstrumentId, releasedBy, dateReleased, amountReleased, percentReleased, comment) {
685
+ var _this = this;
686
+ return new Promise(function (resolve, reject) {
687
+ var data = {
688
+ CaInstrumentId: caInstrumentId,
689
+ DateReleased: dateReleased,
690
+ ReleasedBy: releasedBy
691
+ };
692
+ if ((typeof (percentReleased) != 'undefined' || percentReleased != null) && (typeof (amountReleased) != 'undefined' || amountReleased != null)) {
693
+ reject(new error_1.CWError(2, 'Either amountReleased or percentReleased must be specified.'));
694
+ }
695
+ else if (typeof (percentReleased) != 'undefined' && percentReleased != null) {
696
+ _.set(data, 'PercentReleased', percentReleased);
697
+ }
698
+ else if (typeof (amountReleased) != 'undefined' && amountReleased != null) {
699
+ _.set(data, 'AmountReleased', amountReleased);
700
+ }
701
+ if (typeof (comment) != 'undefined') {
702
+ _.set(data, 'CommentText', comment);
703
+ }
704
+ _this.cw.runRequest('Pll/CaseInstReleases/Add', data).then(function (r) {
705
+ resolve(r.Value);
706
+ }).catch(function (e) {
707
+ reject(e);
708
+ });
709
+ });
710
+ };
711
+ /**
712
+ * Deletes a release specified by the caInstReleasesId.
713
+ *
714
+ * @category Case Instrument Releases
715
+ * @param {number} caInstReleasesId - The Case Instrument Release ID to delete
716
+ * @return {Object} Returns Promise that represents an object describing the deleted instrument release. See /{subdirectory}/apidocs/#/data-type-info;dataType=CaInstReleasesItemBase
717
+ */
718
+ CaseFinancial.prototype.deleteCaseInstrumentRelease = function (caInstReleasesId) {
719
+ var _this = this;
720
+ return new Promise(function (resolve, reject) {
721
+ var data = {
722
+ CaInstReleasesId: caInstReleasesId
723
+ };
724
+ _this.cw.runRequest('Pll/CaseInstReleases/Delete', data).then(function (r) {
725
+ resolve(r.Value);
726
+ }).catch(function (e) {
727
+ reject(e);
728
+ });
729
+ });
730
+ };
731
+ /**
732
+ * Search for Case Instrument Releases. Include one or more of the search fields. A logical 'and' operation is applied for muliple search fields.
733
+ *
734
+ * @category Case Instrument Releases
735
+ * @param {Object} filters - Specify at least one of the following: AmountReleased, CaInstReleasesId, CaInstrumentId, CommentText, PercentReleased, ReleasedBy
736
+ * @return {Object} Returns Promise that represents an Array of Case Instruments resulting from the search
737
+ */
738
+ CaseFinancial.prototype.searchCaseInstrumentReleases = function (filters) {
739
+ var _this = this;
740
+ return new Promise(function (resolve, reject) {
741
+ var data = filters;
742
+ if (_.intersectionBy(_.keysIn(filters), ['AmountReleased', 'CaInstReleasesId', 'CaInstrumentId', 'CommentText', 'PercentReleased', 'ReleasedBy']).length == 0) {
743
+ reject(new error_1.CWError(3, 'At least one of the attributes (AmountReleased, CaInstReleasesId, CaInstrumentId, CommentText, PercentReleased, ReleasedBy) must be defined.'));
744
+ }
745
+ _this.cw.runRequest('Pll/CaseInstReleases/Search', data).then(function (r) {
746
+ resolve(r.Value);
747
+ }).catch(function (e) {
748
+ reject(e);
749
+ });
750
+ });
751
+ };
752
+ /**
753
+ * Get All Fees
754
+ *
755
+ * @category Fees
756
+ * @return {Object} Returns Promise that represents a collection of FeeSetups. See /{subdirectory}/apidocs/#/data-type-info;dataType=FeeSetupItemBase
757
+ */
758
+ CaseFinancial.prototype.fees = function () {
759
+ var _this = this;
760
+ return new Promise(function (resolve, reject) {
761
+ _this.cw.runRequest('Pll/FeeSetup/All', {}).then(function (r) {
762
+ resolve(r.Value);
763
+ }).catch(function (e) {
764
+ reject(e);
765
+ });
766
+ });
767
+ };
768
+ /**
769
+ * Search for Fees. Include one or more of the search fields. A logical 'and' operation is applied for muliple search fields.
770
+ *
771
+ * @category Fees
772
+ * @param {Object} filters - Specify at least one.
773
+ * @return {Object} Returns Promise that represents a collection of FeeSetups. See /{subdirectory}/apidocs/#/data-type-info;dataType=FeeSetupItemBase
774
+ */
775
+ CaseFinancial.prototype.searchAvailableFees = function (filters) {
776
+ var _this = this;
777
+ return new Promise(function (resolve, reject) {
778
+ if (_.intersectionBy(_.keysIn(filters), ['AccountCode', 'FeeCode', 'FeeDesc', 'FeeSetupId', 'FeeTypeId']).length == 0) {
779
+ reject(new error_1.CWError(8, 'At least one of the attributes (AccountCode, FeeCode, FeeDesc, FeeSetupId, FeeTypeId) must be defined.'));
780
+ }
781
+ var data = filters;
782
+ _this.cw.runRequest('Pll/FeeSetup/Search', data).then(function (r) {
783
+ resolve(r.Value);
784
+ }).catch(function (e) {
785
+ reject(e);
786
+ });
787
+ });
788
+ };
789
+ /**
790
+ * Get all tender types configured
791
+ *
792
+ * @category Tender Types
793
+ * @return {Object} Returns Promise that represents a collection of tender type objects. See /{subdirectory}/apidocs/#/data-type-info;dataType=TenderTypeItem
794
+ */
795
+ CaseFinancial.prototype.getTenderTypes = function () {
796
+ var _this = this;
797
+ return new Promise(function (resolve, reject) {
798
+ var data = {};
799
+ _this.cw.runRequest('Pll/TenderType/All', data).then(function (r) {
800
+ resolve(r.Value);
801
+ }).catch(function (e) {
802
+ reject(e);
803
+ });
804
+ });
805
+ };
806
+ /**
807
+ * Adds a tender type configuration
808
+ *
809
+ * @category Tender Types
810
+ * @param {Object} options - See /{subdirectory}/apidocs/#/service-info/Pll/TenderType
811
+ * @return {Object} Returns Promise that represents an object describing the newly-added tender type. See /{subdirectory}/apidocs/#/data-type-info;dataType=TenderTypeItem
812
+ */
813
+ CaseFinancial.prototype.addTenderType = function (options) {
814
+ var _this = this;
815
+ return new Promise(function (resolve, reject) {
816
+ var data = options;
817
+ _this.cw.runRequest('Pll/TenderType/Add', data).then(function (r) {
818
+ resolve(r.Value);
819
+ }).catch(function (e) {
820
+ reject(e);
821
+ });
822
+ });
823
+ };
824
+ /**
825
+ * Update a tender type configuration
826
+ *
827
+ * @category Tender Types
828
+ * @param {number} tenderTypeId - ID of the tender type to update
829
+ * @param {Object} options - See /{subdirectory}/apidocs/#/service-info/Pll/TenderType
830
+ * @return {Object} Returns Promise that represents an object describing the newly-added tender type. See /{subdirectory}/apidocs/#/data-type-info;dataType=TenderTypeItem
831
+ */
832
+ CaseFinancial.prototype.updateTenderType = function (tenderTypeId, options) {
833
+ var _this = this;
834
+ return new Promise(function (resolve, reject) {
835
+ var data_init = {
836
+ TenderTypeId: tenderTypeId
837
+ };
838
+ var data = _.merge(data_init, options);
839
+ _this.cw.runRequest('Pll/TenderType/Update', data).then(function (r) {
840
+ resolve(r.Value);
841
+ }).catch(function (e) {
842
+ reject(e);
843
+ });
844
+ });
845
+ };
846
+ return CaseFinancial;
847
+ }());
848
+ exports.CaseFinancial = CaseFinancial;