cityworks 0.0.15 → 0.0.20

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