octopian-apis 1.0.34 → 1.0.36

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "octopian-apis",
3
- "version": "1.0.34",
3
+ "version": "1.0.36",
4
4
  "description": "Transaction APIs SDK that implements Octopian Services which will be used for any node project typescript or javascript",
5
5
  "main": "./src/index.js",
6
6
  "scripts": {
@@ -0,0 +1,780 @@
1
+ import {
2
+ RequestsAPIConstants,
3
+ RequestStepsAPIConstants,
4
+ } from "../web-services/apiConstants";
5
+ import * as apiHandler from "../web-services/apiHandler";
6
+ import { CreateReadSAS } from "./storageServices";
7
+
8
+ /**
9
+ * @description
10
+ * Retrieves the list of Correspondences for the current user.
11
+ *
12
+ * @param {object} getMyCorrespondenceListDTO
13
+ * Data object containing fields necessary for retrieving the list of requests.
14
+ * PageSize: number
15
+ * PageIndex: number
16
+ * IsAscendingOrder?: boolean (Optional)
17
+ * FromFinishDate?: string (Optional)
18
+ * ToFinishDate?: string (Optional)
19
+ * FromStartDate?: string (Optional)
20
+ * ToStartDate?: string (Optional)
21
+ *
22
+ * @param {string} AuthToken
23
+ * Authentication token for authorization purposes.
24
+ *
25
+ * @param {number} Timeout
26
+ * Time in milliseconds to wait before the request times out. Default is 30000.
27
+ *
28
+ * @returns
29
+ * An object containing the response from the Get My Request List request, including
30
+ * success message, status code, and any additional data returned by the API.
31
+ * {
32
+ * Message: string,
33
+ * StatusCode: number,
34
+ * Result: {
35
+ * -- request data based on selection criteria wether grouped or not--
36
+ * }
37
+ * }
38
+ */
39
+ export async function GetMyApprovedCorrespondenceRequests(
40
+ GetMyCorrespondenceListDTO,
41
+ AuthToken = null,
42
+ Timeout = 30000,
43
+ RequiredHeaderValue = null
44
+ ) {
45
+ GetMyCorrespondenceListDTO["WithRequest"] = true;
46
+ GetMyCorrespondenceListDTO["WithRequestStepAttributes"] = true;
47
+ GetMyCorrespondenceListDTO["WithRequestAttributes"] = true;
48
+ GetMyCorrespondenceListDTO["RequestStepStatus"] = "Approved";
49
+ GetMyCorrespondenceListDTO["WithPreviousClosedRequestSteps"] = true;
50
+ let APIResponse = await apiHandler.PostMethod(
51
+ RequestStepsAPIConstants.uriGetMyRequestStepList(),
52
+ GetMyCorrespondenceListDTO,
53
+ AuthToken,
54
+ Timeout,
55
+ RequiredHeaderValue
56
+ );
57
+ let MappedResult = [];
58
+ let ReadSASResult = await CreateReadSAS(AuthToken, Timeout);
59
+ if (APIResponse.StatusCode === 200 && APIResponse.Result?.length > 0) {
60
+ APIResponse.Result.forEach((element) => {
61
+ let subject = element.Request.ServiceName;
62
+ let notes = "";
63
+ let ImagePath = "";
64
+ let ProcessFlow = [];
65
+ let ToName = '';
66
+ if (element.Request.RequestAttributeList?.length > 0) {
67
+ element.Request.RequestAttributeList.forEach((attribute) => {
68
+ if (attribute.Alias === "Subject") {
69
+ subject = attribute.Value;
70
+ }
71
+ if (attribute.Alias === "Notes") {
72
+ notes = attribute.Value;
73
+ }
74
+ if (attribute.Alias === "InteractorImagePath") {
75
+ ImagePath = attribute.Value;
76
+ }
77
+ if (attribute.Alias === "To") {
78
+ ToName = attribute.Value;
79
+ }
80
+ });
81
+ }
82
+ if (element.ProviderImagePath) {
83
+ ImagePath = element.ProviderImagePath;
84
+ }
85
+ if (ImagePath && ReadSASResult.StatusCode === 200) {
86
+ ImagePath =
87
+ ReadSASResult.Result.split("?")[0] +
88
+ "/" +
89
+ ImagePath +
90
+ "?" +
91
+ ReadSASResult.Result.split("?")[1];
92
+ }
93
+ if (element.PreviousClosedRequestStepList) {
94
+ element.PreviousClosedRequestStepList.forEach((step) => {
95
+ let ProviderImagePath = "";
96
+ if (step.ProviderImagePath) {
97
+ ProviderImagePath = step.ProviderImagePath;
98
+ }
99
+ if (ProviderImagePath && ReadSASResult.StatusCode === 200) {
100
+ ProviderImagePath =
101
+ ReadSASResult.Result.split("?")[0] +
102
+ "/" +
103
+ ProviderImagePath +
104
+ "?" +
105
+ ReadSASResult.Result.split("?")[1];
106
+ }
107
+ ProcessFlow.push({
108
+ Id: step.RequestStepId,
109
+ ImagePath: ProviderImagePath,
110
+ Name: step.ProviderName,
111
+ Comment: step.ProviderComments,
112
+ SubmitDate: step.StartDate,
113
+ });
114
+ });
115
+ }
116
+ MappedResult.push({
117
+ RequestId: element.RequestId,
118
+ StepId: element.RequestStepId,
119
+ RequesterImagePath: ImagePath,
120
+ RequesterName: element.Request.InteractorName,
121
+ ToName: ToName,
122
+ CategoryColor: element.Request.ExtraLine1 ? element.Request.ExtraLine1 : "#FB4C2F",
123
+ CategoryName: element.Request.ServiceSubCategoryName,
124
+ SubmitDate: element.StartDate,
125
+ Subject: subject,
126
+ Notes: notes,
127
+ IsRead: true,
128
+ ProcessFlow: ProcessFlow,
129
+ });
130
+ });
131
+ APIResponse.Result = MappedResult;
132
+ }
133
+ return APIResponse;
134
+ }
135
+
136
+ /**
137
+ * @description
138
+ * Retrieves the list of Correspondences for the current user.
139
+ *
140
+ * @param {object} getMyCorrespondenceInboxListDTO
141
+ * Data object containing fields necessary for retrieving the list of requests.
142
+ * PageSize: number
143
+ * PageIndex: number
144
+ * IsAscendingOrder?: boolean (Optional)
145
+ * FromFinishDate?: string (Optional)
146
+ * ToFinishDate?: string (Optional)
147
+ * FromStartDate?: string (Optional)
148
+ * ToStartDate?: string (Optional)
149
+ *
150
+ * @param {string} AuthToken
151
+ * Authentication token for authorization purposes.
152
+ *
153
+ * @param {number} Timeout
154
+ * Time in milliseconds to wait before the request times out. Default is 30000.
155
+ *
156
+ * @returns
157
+ * An object containing the response from the Get My Request List request, including
158
+ * success message, status code, and any additional data returned by the API.
159
+ * {
160
+ * Message: string,
161
+ * StatusCode: number,
162
+ * Result: {
163
+ * -- request data based on selection criteria wether grouped or not--
164
+ * }
165
+ * }
166
+ */
167
+ export async function GetMyRejectedCorrespondenceRequests(
168
+ GetMyCorrespondenceListDTO,
169
+ AuthToken = null,
170
+ Timeout = 30000,
171
+ RequiredHeaderValue = null
172
+ ) {
173
+ GetMyCorrespondenceListDTO["WithRequest"] = true;
174
+ GetMyCorrespondenceListDTO["WithRequestStepAttributes"] = true;
175
+ GetMyCorrespondenceListDTO["WithRequestAttributes"] = true;
176
+ GetMyCorrespondenceListDTO["RequestStepStatus"] = "Rejected";
177
+ GetMyCorrespondenceListDTO["WithPreviousClosedRequestSteps"] = true;
178
+
179
+ let APIResponse = await apiHandler.PostMethod(
180
+ RequestStepsAPIConstants.uriGetMyRequestStepList(),
181
+ GetMyCorrespondenceListDTO,
182
+ AuthToken,
183
+ Timeout,
184
+ RequiredHeaderValue
185
+ );
186
+ let MappedResult = [];
187
+ let ReadSASResult = await CreateReadSAS(AuthToken, Timeout);
188
+ if (APIResponse.StatusCode === 200 && APIResponse.Result?.length > 0) {
189
+ APIResponse.Result.forEach((element) => {
190
+ let subject = element.Request.ServiceName;
191
+ let notes = "";
192
+ let ImagePath = "";
193
+ let ProcessFlow = [];
194
+ let ToName = '';
195
+ if (element.Request.RequestAttributeList?.length > 0) {
196
+ element.Request.RequestAttributeList.forEach((attribute) => {
197
+ if (attribute.Alias === "Subject") {
198
+ subject = attribute.Value;
199
+ }
200
+ if (attribute.Alias === "Notes") {
201
+ notes = attribute.Value;
202
+ }
203
+ if (attribute.Alias === "InteractorImagePath") {
204
+ ImagePath = attribute.Value;
205
+ }
206
+ if (attribute.Alias === "To") {
207
+ ToName = attribute.Value;
208
+ }
209
+ });
210
+ }
211
+ if (element.ProviderImagePath) {
212
+ ImagePath = element.ProviderImagePath;
213
+ }
214
+ if (ImagePath && ReadSASResult.StatusCode === 200) {
215
+ ImagePath =
216
+ ReadSASResult.Result.split("?")[0] +
217
+ "/" +
218
+ ImagePath +
219
+ "?" +
220
+ ReadSASResult.Result.split("?")[1];
221
+ }
222
+ if (element.PreviousClosedRequestStepList) {
223
+ element.PreviousClosedRequestStepList.forEach((step) => {
224
+ let ProviderImagePath = "";
225
+ if (step.ProviderImagePath) {
226
+ ProviderImagePath = step.ProviderImagePath;
227
+ }
228
+ if (ProviderImagePath && ReadSASResult.StatusCode === 200) {
229
+ ProviderImagePath =
230
+ ReadSASResult.Result.split("?")[0] +
231
+ "/" +
232
+ ProviderImagePath +
233
+ "?" +
234
+ ReadSASResult.Result.split("?")[1];
235
+ }
236
+ ProcessFlow.push({
237
+ Id: step.RequestStepId,
238
+ ImagePath: ProviderImagePath,
239
+ Name: step.ProviderName,
240
+ Comment: step.ProviderComments,
241
+ SubmitDate: step.StartDate,
242
+ });
243
+ });
244
+ }
245
+ MappedResult.push({
246
+ RequestId: element.RequestId,
247
+ StepId: element.RequestStepId,
248
+ RequesterImagePath: ImagePath,
249
+ RequesterName: element.Request.InteractorName,
250
+ ToName: ToName,
251
+ CategoryColor: element.Request.ExtraLine1 ? element.Request.ExtraLine1 : "#FB4C2F",
252
+ CategoryName: element.Request.ServiceSubCategoryName,
253
+ SubmitDate: element.StartDate,
254
+ Subject: subject,
255
+ Notes: notes,
256
+ IsRead: true,
257
+ ProcessFlow: ProcessFlow,
258
+ });
259
+ });
260
+ APIResponse.Result = MappedResult;
261
+ }
262
+ return APIResponse;
263
+ }
264
+
265
+ /**
266
+ * @description
267
+ * Retrieves the list of Correspondences for the current user.
268
+ *
269
+ * @param {object} getMyCorrespondenceListDTO
270
+ * Data object containing fields necessary for retrieving the list of requests.
271
+ * PageSize: number
272
+ * PageIndex: number
273
+ * IsAscendingOrder?: boolean (Optional)
274
+ * FromFinishDate?: string (Optional)
275
+ * ToFinishDate?: string (Optional)
276
+ * FromStartDate?: string (Optional)
277
+ * ToStartDate?: string (Optional)
278
+ *
279
+ * @param {string} AuthToken
280
+ * Authentication token for authorization purposes.
281
+ *
282
+ * @param {number} Timeout
283
+ * Time in milliseconds to wait before the request times out. Default is 30000.
284
+ *
285
+ * @returns
286
+ * An object containing the response from the Get My Request List request, including
287
+ * success message, status code, and any additional data returned by the API.
288
+ * {
289
+ * Message: string,
290
+ * StatusCode: number,
291
+ * Result: {
292
+ * -- request data based on selection criteria wether grouped or not--
293
+ * }
294
+ * }
295
+ */
296
+ export async function GetMyDraftCorrespondenceRequests(
297
+ GetMyCorrespondenceListDTO,
298
+ AuthToken = null,
299
+ Timeout = 30000,
300
+ RequiredHeaderValue = null
301
+ ) {
302
+ GetMyCorrespondenceListDTO["RequestStatus"] = "Draft";
303
+ GetMyCorrespondenceListDTO["WithRequestStep"] = true;
304
+ GetMyCorrespondenceListDTO["WithRequestStepAttribute"] = true;
305
+ GetMyCorrespondenceListDTO["WithRequestAttribute"] = true;
306
+
307
+ let APIResponse = await apiHandler.PostMethod(
308
+ RequestsAPIConstants.uriGetMyRequestList(),
309
+ GetMyCorrespondenceListDTO,
310
+ AuthToken,
311
+ Timeout,
312
+ RequiredHeaderValue
313
+ );
314
+ let MappedResult = [];
315
+ let ReadSASResult = await CreateReadSAS(AuthToken, Timeout);
316
+ if (APIResponse.StatusCode === 200 && APIResponse.Result?.length > 0) {
317
+ APIResponse.Result.forEach((element) => {
318
+ let subject = element.ServiceName;
319
+ let notes = "";
320
+ let ImagePath = "";
321
+ let ToName = '';
322
+ if (element.RequestAttributeList?.length > 0) {
323
+ element.RequestAttributeList.forEach((attribute) => {
324
+ if (attribute.Alias === "Subject") {
325
+ subject = attribute.Value;
326
+ }
327
+ if (attribute.Alias === "Notes") {
328
+ notes = attribute.Value;
329
+ }
330
+ if (attribute.Alias === "InteractorImagePath") {
331
+ ImagePath = attribute.Value;
332
+ }
333
+ if (attribute.Alias === "To") {
334
+ ToName = attribute.Value;
335
+ }
336
+ });
337
+ }
338
+ if (ImagePath && ReadSASResult.StatusCode === 200) {
339
+ ImagePath =
340
+ ReadSASResult.Result.split("?")[0] +
341
+ "/" +
342
+ ImagePath +
343
+ "?" +
344
+ ReadSASResult.Result.split("?")[1];
345
+ }
346
+ MappedResult.push({
347
+ RequestId: element.RequestId,
348
+ StepId: 0,
349
+ RequesterImagePath: ImagePath,
350
+ RequesterName: element.InteractorName,
351
+ ToName: ToName,
352
+ CategoryColor: element.ExtraLine1 ? element.ExtraLine1 : "#FB4C2F",
353
+ CategoryName: element.ServiceSubCategoryName,
354
+ SubmitDate: element.SubmitDate,
355
+ Subject: subject,
356
+ Notes: notes,
357
+ IsRead: true,
358
+ ProcessFlow: [],
359
+ });
360
+ });
361
+ APIResponse.Result = MappedResult;
362
+ }
363
+ return APIResponse;
364
+ }
365
+
366
+ /**
367
+ * @description
368
+ * Retrieves the list of Correspondences for the current user.
369
+ *
370
+ * @param {object} GetMyCorrespondenceListDTO
371
+ * Data object containing fields necessary for retrieving the list of requests.
372
+ * PageSize: number
373
+ * PageIndex: number
374
+ * IsAscendingOrder?: boolean (Optional)
375
+ * FromFinishDate?: string (Optional)
376
+ * ToFinishDate?: string (Optional)
377
+ * FromStartDate?: string (Optional)
378
+ * ToStartDate?: string (Optional)
379
+ *
380
+ * @param {string} AuthToken
381
+ * Authentication token for authorization purposes.
382
+ *
383
+ * @param {number} Timeout
384
+ * Time in milliseconds to wait before the request times out. Default is 30000.
385
+ *
386
+ * @returns
387
+ * An object containing the response from the Get My Request List request, including
388
+ * success message, status code, and any additional data returned by the API.
389
+ * {
390
+ * Message: string,
391
+ * StatusCode: number,
392
+ * Result: {
393
+ * -- request data based on selection criteria wether grouped or not--
394
+ * }
395
+ * }
396
+ */
397
+ export async function GetMyClosedCorrespondenceRequests(
398
+ GetMyCorrespondenceListDTO,
399
+ AuthToken = null,
400
+ Timeout = 30000,
401
+ RequiredHeaderValue = null
402
+ ) {
403
+ GetMyCorrespondenceListDTO["WithRequest"] = true;
404
+ GetMyCorrespondenceListDTO["WithRequestStepAttributes"] = true;
405
+ GetMyCorrespondenceListDTO["WithRequestAttributes"] = true;
406
+ GetMyCorrespondenceListDTO["RequestStepStatus"] = "Archived";
407
+ GetMyCorrespondenceListDTO["WithPreviousClosedRequestSteps"] = true;
408
+
409
+ let APIResponse = await apiHandler.PostMethod(
410
+ RequestStepsAPIConstants.uriGetMyRequestStepList(),
411
+ GetMyCorrespondenceListDTO,
412
+ AuthToken,
413
+ Timeout,
414
+ RequiredHeaderValue
415
+ );
416
+ let MappedResult = [];
417
+ let ReadSASResult = await CreateReadSAS(AuthToken, Timeout);
418
+ if (APIResponse.StatusCode === 200 && APIResponse.Result?.length > 0) {
419
+ APIResponse.Result.forEach((element) => {
420
+ let subject = element.Request.ServiceName;
421
+ let notes = "";
422
+ let ImagePath = "";
423
+ let ProcessFlow = [];
424
+ let ToName = '';
425
+ if (element.Request.RequestAttributeList?.length > 0) {
426
+ element.Request.RequestAttributeList.forEach((attribute) => {
427
+ if (attribute.Alias === "Subject") {
428
+ subject = attribute.Value;
429
+ }
430
+ if (attribute.Alias === "Notes") {
431
+ notes = attribute.Value;
432
+ }
433
+ if (attribute.Alias === "InteractorImagePath") {
434
+ ImagePath = attribute.Value;
435
+ }
436
+ if (attribute.Alias === "To") {
437
+ ToName = attribute.Value;
438
+ }
439
+ });
440
+ }
441
+ if (element.ProviderImagePath) {
442
+ ImagePath = element.ProviderImagePath;
443
+ }
444
+ if (ImagePath && ReadSASResult.StatusCode === 200) {
445
+ ImagePath =
446
+ ReadSASResult.Result.split("?")[0] +
447
+ "/" +
448
+ ImagePath +
449
+ "?" +
450
+ ReadSASResult.Result.split("?")[1];
451
+ }
452
+ if (element.PreviousClosedRequestStepList) {
453
+ element.PreviousClosedRequestStepList.forEach((step) => {
454
+ let ProviderImagePath = "";
455
+ if (step.ProviderImagePath) {
456
+ ProviderImagePath = step.ProviderImagePath;
457
+ }
458
+ if (ProviderImagePath && ReadSASResult.StatusCode === 200) {
459
+ ProviderImagePath =
460
+ ReadSASResult.Result.split("?")[0] +
461
+ "/" +
462
+ ProviderImagePath +
463
+ "?" +
464
+ ReadSASResult.Result.split("?")[1];
465
+ }
466
+ ProcessFlow.push({
467
+ Id: step.RequestStepId,
468
+ ImagePath: ProviderImagePath,
469
+ Name: step.ProviderName,
470
+ Comment: step.ProviderComments,
471
+ SubmitDate: step.StartDate,
472
+ });
473
+ });
474
+ }
475
+ MappedResult.push({
476
+ RequestId: element.RequestId,
477
+ StepId: element.RequestStepId,
478
+ RequesterImagePath: ImagePath,
479
+ RequesterName: element.Request.InteractorName,
480
+ ToName: ToName,
481
+ CategoryColor: element.Request.ExtraLine1 ? element.Request.ExtraLine1 : "#FB4C2F",
482
+ CategoryName: element.Request.ServiceSubCategoryName,
483
+ SubmitDate: element.StartDate,
484
+ Subject: subject,
485
+ Notes: notes,
486
+ IsRead: true,
487
+ ProcessFlow: ProcessFlow,
488
+ });
489
+ });
490
+ APIResponse.Result = MappedResult;
491
+ }
492
+ return APIResponse;
493
+ }
494
+
495
+ /**
496
+ * @description
497
+ * Retrieves the list of comments for a request.
498
+ *
499
+ * @param {object} GetMyCorrespondenceCommentListDTO
500
+ * Data object containing fields necessary for retrieving the list of comments.
501
+ * RequestId: number
502
+ *
503
+ * @param {string} AuthToken
504
+ * Authentication token for authorization purposes.
505
+ *
506
+ * @param {number} Timeout
507
+ * Time in milliseconds to wait before the request times out. Default is 30000.
508
+ *
509
+ * @returns
510
+ * An object containing the response from the Get My Request Comment List API, including
511
+ * success message, status code, and any additional data returned by the API.
512
+ * Message: Success,
513
+ * StatusCode: 200,
514
+ * Result: [{
515
+ * RequestCommentId: number,
516
+ * CommentDate: string,
517
+ * InteractorFullName: string,
518
+ * Comment: string,
519
+ * RequestId: number,
520
+ * IsByRequester: boolean,
521
+ * AlternateComment: string,
522
+ * AlternateInteractorName: string,
523
+ * AttachmentFilePath: string,
524
+ * RequesterComment: string,
525
+ * ProviderPrimaryComment: string,
526
+ * ProviderSecondaryComment: string,
527
+ * DtoState: number
528
+ * },..]
529
+ */
530
+ export async function GetMyCorrespondenceCommentList(
531
+ GetMyCorrespondenceCommentListDTO,
532
+ AuthToken = null,
533
+ Timeout = 30000
534
+ ) {
535
+ let APIResponse = await apiHandler.PostMethod(
536
+ RequestsAPIConstants.uriGetMyRequestCommentList(),
537
+ GetMyCorrespondenceCommentListDTO,
538
+ AuthToken,
539
+ Timeout
540
+ );
541
+ return APIResponse;
542
+ }
543
+
544
+ /**
545
+ * @description
546
+ * Posts a comment for a request.
547
+ *
548
+ * @param {object} PostCommentDTO
549
+ * Data object containing fields necessary for posting a comment.
550
+ * RequestId: number
551
+ * Comment: string
552
+ * CommentLanguageCode: string
553
+ * AttachmentFilePath: string (Optional)
554
+ * ReturnAlternateNames: boolean (Optional)
555
+ *
556
+ * @param {string} AuthToken
557
+ * Authentication token for authorization purposes.
558
+ *
559
+ * @param {number} Timeout
560
+ * Time in milliseconds to wait before the request times out. Default is 30000.
561
+ *
562
+ * @returns
563
+ * An object containing the response from the Post Comment API, including
564
+ * success message, status code, and any additional data returned by the API.
565
+ * Message: Success,
566
+ * StatusCode: 200,
567
+ * Result: boolean
568
+ */
569
+ export async function PostCorrespondenceComment(
570
+ PostCommentDTO,
571
+ AuthToken = null,
572
+ Timeout = 30000
573
+ ) {
574
+ let APIResponse = await apiHandler.PostMethod(
575
+ RequestsAPIConstants.uriPostComment(),
576
+ PostCommentDTO,
577
+ AuthToken,
578
+ Timeout
579
+ );
580
+ return APIResponse;
581
+ }
582
+
583
+ /**
584
+ * @description
585
+ * Submits a draft correspondence with the given details.
586
+ *
587
+ * @param {object} SubmitDraftCorrespondenceDTO
588
+ * Data object containing fields necessary for submitting a draft correspondence.
589
+ * specificRequestIds: CorrespondenceSubmitDraftInput[]
590
+ *
591
+ * @param {string} AuthToken
592
+ * Authentication token for authorization purposes.
593
+ *
594
+ * @param {number} Timeout
595
+ * Time in milliseconds to wait before the request times out. Default is 30000.
596
+ *
597
+ * @returns
598
+ * An object containing the response from the Submit Draft Correspondence request, including
599
+ * success message, status code, and any additional data returned by the API.
600
+ * {
601
+ * Message: string,
602
+ * StatusCode: number,
603
+ * Result: {
604
+ * BatchId: number
605
+ * IsSuccess: boolean
606
+ * }
607
+ * }
608
+ */
609
+ export async function SubmitDraftCorrespondence(
610
+ SubmitDraftCorrespondenceDTO,
611
+ AuthToken = null,
612
+ Timeout = 30000
613
+ ) {
614
+ SubmitDraftCorrespondenceDTO["PaymentMethod"] = "CashOnDelivery";
615
+ let APIResponse = await apiHandler.PostMethod(
616
+ RequestsAPIConstants.uriSubmitCart(),
617
+ SubmitDraftCorrespondenceDTO,
618
+ AuthToken,
619
+ Timeout
620
+ );
621
+ return APIResponse;
622
+ }
623
+
624
+ /**
625
+ * @description
626
+ * Retrieves the list of inbox correspondences.
627
+ *
628
+ * @param {object} GetMyCorrespondenceListDTO
629
+ * Data object containing fields necessary for retrieving the request step list.
630
+ * PageSize: number
631
+ * PageIndex: number
632
+ * IsAscendingOrder?: boolean (Optional)
633
+ * FromFinishDate?: string (Optional)
634
+ * ToFinishDate?: string (Optional)
635
+ * FromStartDate?: string (Optional)
636
+ * ToStartDate?: string (Optional)
637
+ *
638
+ * @param {string} AuthToken
639
+ * Authentication token for authorization purposes.
640
+ *
641
+ * @param {number} Timeout
642
+ * Time in milliseconds to wait before the request times out. Default is 30000.
643
+ *
644
+ * @returns
645
+ * An object containing the API response from the Get My Request Step List request,
646
+ * including a success message, status code, and any additional data returned by the API.
647
+ * {
648
+ * Message: string,
649
+ * StatusCode: number,
650
+ * Result: GetRequestStepListOutput[]
651
+ * }
652
+ */
653
+ export async function GetMyInboxCorrespondenceRequests(
654
+ GetMyCorrespondenceListDTO,
655
+ AuthToken = null,
656
+ Timeout = 30000,
657
+ RequiredHeaderValue = null
658
+ ) {
659
+ GetMyCorrespondenceListDTO["WithRequest"] = true;
660
+ GetMyCorrespondenceListDTO["WithRequestStepAttributes"] = true;
661
+ GetMyCorrespondenceListDTO["WithRequestAttributes"] = true;
662
+ GetMyCorrespondenceListDTO["RequestStepStatus"] = "Active";
663
+ GetMyCorrespondenceListDTO["WithPreviousClosedRequestSteps"] = true;
664
+
665
+ let APIResponse = await apiHandler.PostMethod(
666
+ RequestStepsAPIConstants.uriGetMyRequestStepList(),
667
+ GetMyCorrespondenceListDTO,
668
+ AuthToken,
669
+ Timeout,
670
+ RequiredHeaderValue
671
+ );
672
+ let MappedResult = [];
673
+ let ReadSASResult = await CreateReadSAS(AuthToken, Timeout);
674
+ if (APIResponse.StatusCode === 200 && APIResponse.Result?.length > 0) {
675
+ APIResponse.Result.forEach((element) => {
676
+ let subject = element.Request.ServiceName;
677
+ let notes = "";
678
+ let ImagePath = "";
679
+ let ProcessFlow = [];
680
+ if (element.Request?.RequestAttributeList?.length > 0) {
681
+ element.Request.RequestAttributeList.forEach((attribute) => {
682
+ if (attribute.Alias === "Subject") {
683
+ subject = attribute.Value;
684
+ }
685
+ if (attribute.Alias === "Notes") {
686
+ notes = attribute.Value;
687
+ }
688
+ if (attribute.Alias === "InteractorImagePath") {
689
+ ImagePath = attribute.Value;
690
+ }
691
+ });
692
+ }
693
+ if (element.ProviderImagePath) {
694
+ ImagePath = element.ProviderImagePath;
695
+ }
696
+ if (ImagePath && ReadSASResult.StatusCode === 200) {
697
+ ImagePath =
698
+ ReadSASResult.Result.split("?")[0] +
699
+ "/" +
700
+ ImagePath +
701
+ "?" +
702
+ ReadSASResult.Result.split("?")[1];
703
+ }
704
+ if (element.PreviousClosedRequestStepList) {
705
+ element.PreviousClosedRequestStepList.forEach((step) => {
706
+ let ProviderImagePath = "";
707
+ if (step.ProviderImagePath) {
708
+ ProviderImagePath = step.ProviderImagePath;
709
+ }
710
+ if (ProviderImagePath && ReadSASResult.StatusCode === 200) {
711
+ ProviderImagePath =
712
+ ReadSASResult.Result.split("?")[0] +
713
+ "/" +
714
+ ProviderImagePath +
715
+ "?" +
716
+ ReadSASResult.Result.split("?")[1];
717
+ }
718
+ ProcessFlow.push({
719
+ Id: step.RequestStepId,
720
+ ImagePath: ProviderImagePath,
721
+ Name: step.ProviderName,
722
+ Comment: step.ProviderComments,
723
+ SubmitDate: step.StartDate,
724
+ });
725
+ });
726
+ }
727
+ MappedResult.push({
728
+ RequestId: element.RequestId,
729
+ StepId: element.RequestStepId,
730
+ RequesterImagePath: ImagePath,
731
+ RequesterName: element.Request.InteractorName,
732
+ CategoryColor: element.Request.ExtraLine1
733
+ ? element.Request.ExtraLine1
734
+ : "#FB4C2F",
735
+ CategoryName: element.Request.ServiceSubCategoryName,
736
+ SubmitDate: element.StartDate,
737
+ Subject: subject,
738
+ Notes: notes,
739
+ IsRead: element.IsCheckedOut,
740
+ ProcessFlow: ProcessFlow,
741
+ });
742
+ });
743
+ APIResponse.Result = MappedResult;
744
+ }
745
+ return APIResponse;
746
+ }
747
+
748
+ /**
749
+ * @description
750
+ * Retrieves the list of provider step type counts.
751
+ *
752
+ * @param {string} AuthToken
753
+ * Authentication token for authorization purposes.
754
+ *
755
+ * @param {number} Timeout
756
+ * Time in milliseconds to wait before the request times out. Default is 30000.
757
+ *
758
+ * @returns
759
+ * An object containing the API response from the Get Provider Step Type Counts request,
760
+ * including a success message, status code, and any additional data returned by the API.
761
+ * {
762
+ * Message: string,
763
+ * StatusCode: number,
764
+ * Result: GetProviderStepTypeCountsOutput[]
765
+ * }
766
+ **/
767
+ export async function GetMyInboxCategoryWithCounts(
768
+ AuthToken = null,
769
+ Timeout = 30000,
770
+ RequiredHeaderValue = null
771
+ ) {
772
+ let APIResponse = await apiHandler.PostMethod(
773
+ RequestStepsAPIConstants.uriGetProviderStepTypeCounts(),
774
+ { RequestStepStatus: "Active" },
775
+ AuthToken,
776
+ Timeout,
777
+ RequiredHeaderValue
778
+ );
779
+ return APIResponse;
780
+ }
@@ -1371,10 +1371,10 @@ export async function DABGetPaymentURL(
1371
1371
  ) {
1372
1372
  element.Value = getPaymentURLDTO.ParametersValues.find(
1373
1373
  (param) => param.Alias === element.Alias
1374
- ).Value;
1374
+ )?.Value;
1375
1375
  element.ExtendedValue = getPaymentURLDTO.ParametersValues.find(
1376
1376
  (param) => param.Alias === element.Alias
1377
- ).ExtendedValue;
1377
+ )?.ExtendedValue;
1378
1378
  }
1379
1379
  if (element.Alias === "BatchID") {
1380
1380
  element.Value = paymentBatch.Result.toString();