octopian-apis 1.0.39 → 1.0.41

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.39",
3
+ "version": "1.0.41",
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": {
@@ -1,10 +1,11 @@
1
1
  import {
2
2
  RequestsAPIConstants,
3
3
  RequestStepsAPIConstants,
4
+ StorageAPIConstants,
4
5
  } from "../web-services/apiConstants";
5
6
  import * as apiHandler from "../web-services/apiHandler";
6
- import { CreateReadSAS } from "./storageServices";
7
-
7
+ import { CreateReadSAS, GetOnPremiseReadSAS, GetOnPremiseWriteSAS } from "./storageServices";
8
+ import { SetStorageType, GetConfig, decodeBase64ToJson } from "../sdkUtilities";
8
9
  /**
9
10
  * @description
10
11
  * Retrieves the list of Correspondences for the current user.
@@ -47,6 +48,7 @@ export async function GetMyApprovedCorrespondenceRequests(
47
48
  GetMyCorrespondenceListDTO["WithRequestAttributes"] = true;
48
49
  GetMyCorrespondenceListDTO["RequestStepStatus"] = "Approved";
49
50
  GetMyCorrespondenceListDTO["WithPreviousClosedRequestSteps"] = true;
51
+ GetMyCorrespondenceListDTO["WithCurrentActiveRequestStep"] = true;
50
52
  let APIResponse = await apiHandler.PostMethod(
51
53
  RequestStepsAPIConstants.uriGetMyRequestStepList(),
52
54
  GetMyCorrespondenceListDTO,
@@ -62,7 +64,9 @@ export async function GetMyApprovedCorrespondenceRequests(
62
64
  let notes = "";
63
65
  let ImagePath = "";
64
66
  let ProcessFlow = [];
65
- let ToName = '';
67
+ let ToName = "";
68
+ let GeneratedDocument = "";
69
+ let Attachments = [];
66
70
  if (element.Request.RequestAttributeList?.length > 0) {
67
71
  element.Request.RequestAttributeList.forEach((attribute) => {
68
72
  if (attribute.Alias === "Subject") {
@@ -77,6 +81,47 @@ export async function GetMyApprovedCorrespondenceRequests(
77
81
  if (attribute.Alias === "To") {
78
82
  ToName = attribute.Value;
79
83
  }
84
+ if (attribute.AttributeTypeValueTypeName === "Attachment" && !attribute.IsRequesterVisible) {
85
+ // if(attribute.Value && ReadSASResult?.Result)
86
+ // {
87
+ // GeneratedDocument = ReadSASResult.Result.split("?")[0] +
88
+ // "/" +
89
+ // attribute.Value +
90
+ // "?" +
91
+ // ReadSASResult.Result.split("?")[1];
92
+ // }
93
+ GeneratedDocument = attribute.Value;
94
+ }
95
+ if(attribute.Alias === "Attachments" && !attribute.IsRequesterVisible)
96
+ {
97
+ if(attribute.Value)
98
+ {
99
+ let DecodedAttachmentsRecordList = decodeBase64ToJson(
100
+ attribute.Value
101
+ );
102
+ for (let attributeGroup of DecodedAttachmentsRecordList) {
103
+ for (let group of attributeGroup) {
104
+ for (let attribute of group.RequestAttributeDtos) {
105
+ if (
106
+ attribute.AttributeTypeValueTypeName ===
107
+ AttributeTypeValueTypeNames.Attachment
108
+ ) {
109
+ Attachments.push({
110
+ id: attribute.RequestAttributeId || 0,
111
+ name: attribute.Name || "",
112
+ type: attribute.Value?.split(".").pop() || "",
113
+ url: ReadSASResult?.Result? (ReadSASResult.Result.split("?")[0] +
114
+ "/" +
115
+ attribute.Value +
116
+ "?" +
117
+ ReadSASResult.Result.split("?")[1]): "",
118
+ });
119
+ }
120
+ }
121
+ }
122
+ }
123
+ }
124
+ }
80
125
  });
81
126
  }
82
127
  if (element.ProviderImagePath) {
@@ -113,19 +158,33 @@ export async function GetMyApprovedCorrespondenceRequests(
113
158
  });
114
159
  });
115
160
  }
161
+ if (element.CurrentActiveRequestStep) {
162
+ ProcessFlow.push({
163
+ Id: element.CurrentActiveRequestStep.RequestStepId,
164
+ ImagePath: "",
165
+ Name: element.CurrentActiveRequestStep.ProviderRoleName,
166
+ Comment: "",
167
+ SubmitDate: element.CurrentActiveRequestStep.StartDate,
168
+ });
169
+ }
170
+
116
171
  MappedResult.push({
117
172
  RequestId: element.RequestId,
118
173
  StepId: element.RequestStepId,
119
174
  RequesterImagePath: ImagePath,
120
175
  RequesterName: element.Request.InteractorName,
121
176
  ToName: ToName,
122
- CategoryColor: element.Request.ExtraLine1 ? element.Request.ExtraLine1 : "#FB4C2F",
177
+ CategoryColor: element.Request.ExtraLine1
178
+ ? element.Request.ExtraLine1
179
+ : "#FB4C2F",
123
180
  CategoryName: element.Request.ServiceSubCategoryName,
124
181
  SubmitDate: element.StartDate,
125
182
  Subject: subject,
126
183
  Notes: notes,
127
184
  IsRead: true,
128
185
  ProcessFlow: ProcessFlow,
186
+ GeneratedDocument: GeneratedDocument,
187
+ Attachments: Attachments,
129
188
  });
130
189
  });
131
190
  APIResponse.Result = MappedResult;
@@ -191,7 +250,9 @@ export async function GetMyRejectedCorrespondenceRequests(
191
250
  let notes = "";
192
251
  let ImagePath = "";
193
252
  let ProcessFlow = [];
194
- let ToName = '';
253
+ let ToName = "";
254
+ let GeneratedDocument = "";
255
+ let Attachments = [];
195
256
  if (element.Request.RequestAttributeList?.length > 0) {
196
257
  element.Request.RequestAttributeList.forEach((attribute) => {
197
258
  if (attribute.Alias === "Subject") {
@@ -206,6 +267,48 @@ export async function GetMyRejectedCorrespondenceRequests(
206
267
  if (attribute.Alias === "To") {
207
268
  ToName = attribute.Value;
208
269
  }
270
+ if (attribute.AttributeTypeValueTypeName === "Attachment" && !attribute.IsRequesterVisible) {
271
+ // if(attribute.Value && ReadSASResult?.Result)
272
+ // {
273
+ // GeneratedDocument = ReadSASResult.Result.split("?")[0] +
274
+ // "/" +
275
+ // attribute.Value +
276
+ // "?" +
277
+ // ReadSASResult.Result.split("?")[1];
278
+ // }
279
+ GeneratedDocument = attribute.Value;
280
+
281
+ }
282
+ if(attribute.Alias === "Attachments" && !attribute.IsRequesterVisible)
283
+ {
284
+ if(attribute.Value)
285
+ {
286
+ let DecodedAttachmentsRecordList = decodeBase64ToJson(
287
+ attribute.Value
288
+ );
289
+ for (let attributeGroup of DecodedAttachmentsRecordList) {
290
+ for (let group of attributeGroup) {
291
+ for (let attribute of group.RequestAttributeDtos) {
292
+ if (
293
+ attribute.AttributeTypeValueTypeName ===
294
+ AttributeTypeValueTypeNames.Attachment
295
+ ) {
296
+ Attachments.push({
297
+ id: attribute.RequestAttributeId || 0,
298
+ name: attribute.Name || "",
299
+ type: attribute.Value?.split(".").pop() || "",
300
+ url: ReadSASResult?.Result? (ReadSASResult.Result.split("?")[0] +
301
+ "/" +
302
+ attribute.Value +
303
+ "?" +
304
+ ReadSASResult.Result.split("?")[1]): "",
305
+ });
306
+ }
307
+ }
308
+ }
309
+ }
310
+ }
311
+ }
209
312
  });
210
313
  }
211
314
  if (element.ProviderImagePath) {
@@ -248,13 +351,17 @@ export async function GetMyRejectedCorrespondenceRequests(
248
351
  RequesterImagePath: ImagePath,
249
352
  RequesterName: element.Request.InteractorName,
250
353
  ToName: ToName,
251
- CategoryColor: element.Request.ExtraLine1 ? element.Request.ExtraLine1 : "#FB4C2F",
354
+ CategoryColor: element.Request.ExtraLine1
355
+ ? element.Request.ExtraLine1
356
+ : "#FB4C2F",
252
357
  CategoryName: element.Request.ServiceSubCategoryName,
253
358
  SubmitDate: element.StartDate,
254
359
  Subject: subject,
255
360
  Notes: notes,
256
361
  IsRead: true,
257
362
  ProcessFlow: ProcessFlow,
363
+ GeneratedDocument: GeneratedDocument,
364
+ Attachments: Attachments,
258
365
  });
259
366
  });
260
367
  APIResponse.Result = MappedResult;
@@ -318,7 +425,9 @@ export async function GetMyDraftCorrespondenceRequests(
318
425
  let subject = element.ServiceName;
319
426
  let notes = "";
320
427
  let ImagePath = "";
321
- let ToName = '';
428
+ let ToName = "";
429
+ let GeneratedDocument = "";
430
+ let Attachments = [];
322
431
  if (element.RequestAttributeList?.length > 0) {
323
432
  element.RequestAttributeList.forEach((attribute) => {
324
433
  if (attribute.Alias === "Subject") {
@@ -333,6 +442,47 @@ export async function GetMyDraftCorrespondenceRequests(
333
442
  if (attribute.Alias === "To") {
334
443
  ToName = attribute.Value;
335
444
  }
445
+ if (attribute.AttributeTypeValueTypeName === "Attachment" && !attribute.IsRequesterVisible) {
446
+ // if(attribute.Value && ReadSASResult?.Result)
447
+ // {
448
+ // GeneratedDocument = ReadSASResult.Result.split("?")[0] +
449
+ // "/" +
450
+ // attribute.Value +
451
+ // "?" +
452
+ // ReadSASResult.Result.split("?")[1];
453
+ // }
454
+ GeneratedDocument = attribute.Value;
455
+ }
456
+ if(attribute.Alias === "Attachments" && !attribute.IsRequesterVisible)
457
+ {
458
+ if(attribute.Value)
459
+ {
460
+ let DecodedAttachmentsRecordList = decodeBase64ToJson(
461
+ attribute.Value
462
+ );
463
+ for (let attributeGroup of DecodedAttachmentsRecordList) {
464
+ for (let group of attributeGroup) {
465
+ for (let attribute of group.RequestAttributeDtos) {
466
+ if (
467
+ attribute.AttributeTypeValueTypeName ===
468
+ AttributeTypeValueTypeNames.Attachment
469
+ ) {
470
+ Attachments.push({
471
+ id: attribute.RequestAttributeId || 0,
472
+ name: attribute.Name || "",
473
+ type: attribute.Value?.split(".").pop() || "",
474
+ url: ReadSASResult?.Result? (ReadSASResult.Result.split("?")[0] +
475
+ "/" +
476
+ attribute.Value +
477
+ "?" +
478
+ ReadSASResult.Result.split("?")[1]): "",
479
+ });
480
+ }
481
+ }
482
+ }
483
+ }
484
+ }
485
+ }
336
486
  });
337
487
  }
338
488
  if (ImagePath && ReadSASResult.StatusCode === 200) {
@@ -356,6 +506,154 @@ export async function GetMyDraftCorrespondenceRequests(
356
506
  Notes: notes,
357
507
  IsRead: true,
358
508
  ProcessFlow: [],
509
+ GeneratedDocument: GeneratedDocument,
510
+ Attachments: Attachments,
511
+ });
512
+ });
513
+ APIResponse.Result = MappedResult;
514
+ }
515
+ return APIResponse;
516
+ }
517
+
518
+ /**
519
+ * @description
520
+ * Retrieves the list of Correspondences for the current user.
521
+ *
522
+ * @param {object} getMyCorrespondenceListDTO
523
+ * Data object containing fields necessary for retrieving the list of requests.
524
+ * PageSize: number
525
+ * PageIndex: number
526
+ * IsAscendingOrder?: boolean (Optional)
527
+ * FromFinishDate?: string (Optional)
528
+ * ToFinishDate?: string (Optional)
529
+ * FromStartDate?: string (Optional)
530
+ * ToStartDate?: string (Optional)
531
+ *
532
+ * @param {string} AuthToken
533
+ * Authentication token for authorization purposes.
534
+ *
535
+ * @param {number} Timeout
536
+ * Time in milliseconds to wait before the request times out. Default is 30000.
537
+ *
538
+ * @returns
539
+ * An object containing the response from the Get My Request List request, including
540
+ * success message, status code, and any additional data returned by the API.
541
+ * {
542
+ * Message: string,
543
+ * StatusCode: number,
544
+ * Result: {
545
+ * -- request data based on selection criteria wether grouped or not--
546
+ * }
547
+ * }
548
+ */
549
+ export async function GetInProcessCorrespondenceRequests(
550
+ GetMyCorrespondenceListDTO,
551
+ AuthToken = null,
552
+ Timeout = 30000,
553
+ RequiredHeaderValue = null
554
+ ) {
555
+ GetMyCorrespondenceListDTO["RequestStatus"] = "InProcess";
556
+ GetMyCorrespondenceListDTO["WithRequestStep"] = true;
557
+ GetMyCorrespondenceListDTO["WithRequestStepAttribute"] = true;
558
+ GetMyCorrespondenceListDTO["WithRequestAttribute"] = true;
559
+
560
+ let APIResponse = await apiHandler.PostMethod(
561
+ RequestsAPIConstants.uriGetMyRequestList(),
562
+ GetMyCorrespondenceListDTO,
563
+ AuthToken,
564
+ Timeout,
565
+ RequiredHeaderValue
566
+ );
567
+ let MappedResult = [];
568
+ let ReadSASResult = await CreateReadSAS(AuthToken, Timeout);
569
+ if (APIResponse.StatusCode === 200 && APIResponse.Result?.length > 0) {
570
+ APIResponse.Result.forEach((element) => {
571
+ let subject = element.ServiceName;
572
+ let notes = "";
573
+ let ImagePath = "";
574
+ let ToName = "";
575
+ let GeneratedDocument = "";
576
+ let Attachments = [];
577
+ if (element.RequestAttributeList?.length > 0) {
578
+ element.RequestAttributeList.forEach((attribute) => {
579
+ if (attribute.Alias === "Subject") {
580
+ subject = attribute.Value;
581
+ }
582
+ if (attribute.Alias === "Notes") {
583
+ notes = attribute.Value;
584
+ }
585
+ if (attribute.Alias === "InteractorImagePath") {
586
+ ImagePath = attribute.Value;
587
+ }
588
+ if (attribute.Alias === "To") {
589
+ ToName = attribute.Value;
590
+ }
591
+ if (attribute.AttributeTypeValueTypeName === "Attachment" && !attribute.IsRequesterVisible) {
592
+ // if(attribute.Value && ReadSASResult?.Result)
593
+ // {
594
+ // GeneratedDocument = ReadSASResult.Result.split("?")[0] +
595
+ // "/" +
596
+ // attribute.Value +
597
+ // "?" +
598
+ // ReadSASResult.Result.split("?")[1];
599
+ // }
600
+ GeneratedDocument = attribute.Value;
601
+ }
602
+ if(attribute.Alias === "Attachments" && !attribute.IsRequesterVisible)
603
+ {
604
+ if(attribute.Value)
605
+ {
606
+ let DecodedAttachmentsRecordList = decodeBase64ToJson(
607
+ attribute.Value
608
+ );
609
+ for (let attributeGroup of DecodedAttachmentsRecordList) {
610
+ for (let group of attributeGroup) {
611
+ for (let attribute of group.RequestAttributeDtos) {
612
+ if (
613
+ attribute.AttributeTypeValueTypeName ===
614
+ AttributeTypeValueTypeNames.Attachment
615
+ ) {
616
+ Attachments.push({
617
+ id: attribute.RequestAttributeId || 0,
618
+ name: attribute.Name || "",
619
+ type: attribute.Value?.split(".").pop() || "",
620
+ url: ReadSASResult?.Result? (ReadSASResult.Result.split("?")[0] +
621
+ "/" +
622
+ attribute.Value +
623
+ "?" +
624
+ ReadSASResult.Result.split("?")[1]): "",
625
+ });
626
+ }
627
+ }
628
+ }
629
+ }
630
+ }
631
+ }
632
+ });
633
+ }
634
+ if (ImagePath && ReadSASResult.StatusCode === 200) {
635
+ ImagePath =
636
+ ReadSASResult.Result.split("?")[0] +
637
+ "/" +
638
+ ImagePath +
639
+ "?" +
640
+ ReadSASResult.Result.split("?")[1];
641
+ }
642
+ MappedResult.push({
643
+ RequestId: element.RequestId,
644
+ StepId: 0,
645
+ RequesterImagePath: ImagePath,
646
+ RequesterName: element.InteractorName,
647
+ ToName: ToName,
648
+ CategoryColor: element.ExtraLine1 ? element.ExtraLine1 : "#FB4C2F",
649
+ CategoryName: element.ServiceSubCategoryName,
650
+ SubmitDate: element.SubmitDate,
651
+ Subject: subject,
652
+ Notes: notes,
653
+ IsRead: true,
654
+ ProcessFlow: [],
655
+ GeneratedDocument: GeneratedDocument,
656
+ Attachments: Attachments,
359
657
  });
360
658
  });
361
659
  APIResponse.Result = MappedResult;
@@ -421,7 +719,9 @@ export async function GetMyClosedCorrespondenceRequests(
421
719
  let notes = "";
422
720
  let ImagePath = "";
423
721
  let ProcessFlow = [];
424
- let ToName = '';
722
+ let ToName = "";
723
+ let GeneratedDocument = "";
724
+ let Attachments = [];
425
725
  if (element.Request.RequestAttributeList?.length > 0) {
426
726
  element.Request.RequestAttributeList.forEach((attribute) => {
427
727
  if (attribute.Alias === "Subject") {
@@ -436,6 +736,47 @@ export async function GetMyClosedCorrespondenceRequests(
436
736
  if (attribute.Alias === "To") {
437
737
  ToName = attribute.Value;
438
738
  }
739
+ if (attribute.AttributeTypeValueTypeName === "Attachment" && !attribute.IsRequesterVisible) {
740
+ // if(attribute.Value && ReadSASResult?.Result)
741
+ // {
742
+ // GeneratedDocument = ReadSASResult.Result.split("?")[0] +
743
+ // "/" +
744
+ // attribute.Value +
745
+ // "?" +
746
+ // ReadSASResult.Result.split("?")[1];
747
+ // }
748
+ GeneratedDocument = attribute.Value;
749
+ }
750
+ if(attribute.Alias === "Attachments" && !attribute.IsRequesterVisible)
751
+ {
752
+ if(attribute.Value)
753
+ {
754
+ let DecodedAttachmentsRecordList = decodeBase64ToJson(
755
+ attribute.Value
756
+ );
757
+ for (let attributeGroup of DecodedAttachmentsRecordList) {
758
+ for (let group of attributeGroup) {
759
+ for (let attribute of group.RequestAttributeDtos) {
760
+ if (
761
+ attribute.AttributeTypeValueTypeName ===
762
+ AttributeTypeValueTypeNames.Attachment
763
+ ) {
764
+ Attachments.push({
765
+ id: attribute.RequestAttributeId || 0,
766
+ name: attribute.Name || "",
767
+ type: attribute.Value?.split(".").pop() || "",
768
+ url: ReadSASResult?.Result? (ReadSASResult.Result.split("?")[0] +
769
+ "/" +
770
+ attribute.Value +
771
+ "?" +
772
+ ReadSASResult.Result.split("?")[1]): "",
773
+ });
774
+ }
775
+ }
776
+ }
777
+ }
778
+ }
779
+ }
439
780
  });
440
781
  }
441
782
  if (element.ProviderImagePath) {
@@ -478,13 +819,17 @@ export async function GetMyClosedCorrespondenceRequests(
478
819
  RequesterImagePath: ImagePath,
479
820
  RequesterName: element.Request.InteractorName,
480
821
  ToName: ToName,
481
- CategoryColor: element.Request.ExtraLine1 ? element.Request.ExtraLine1 : "#FB4C2F",
822
+ CategoryColor: element.Request.ExtraLine1
823
+ ? element.Request.ExtraLine1
824
+ : "#FB4C2F",
482
825
  CategoryName: element.Request.ServiceSubCategoryName,
483
826
  SubmitDate: element.StartDate,
484
827
  Subject: subject,
485
828
  Notes: notes,
486
829
  IsRead: true,
487
830
  ProcessFlow: ProcessFlow,
831
+ GeneratedDocument: GeneratedDocument,
832
+ Attachments: Attachments,
488
833
  });
489
834
  });
490
835
  APIResponse.Result = MappedResult;
@@ -655,7 +1000,7 @@ export async function GetMyInboxCorrespondenceRequests(
655
1000
  AuthToken = null,
656
1001
  Timeout = 30000,
657
1002
  RequiredHeaderValue = null
658
- ) {
1003
+ ) {
659
1004
  GetMyCorrespondenceListDTO["WithRequest"] = true;
660
1005
  GetMyCorrespondenceListDTO["WithRequestStepAttributes"] = true;
661
1006
  GetMyCorrespondenceListDTO["WithRequestAttributes"] = true;
@@ -677,6 +1022,8 @@ export async function GetMyInboxCorrespondenceRequests(
677
1022
  let notes = "";
678
1023
  let ImagePath = "";
679
1024
  let ProcessFlow = [];
1025
+ let GeneratedDocument = "";
1026
+ let Attachments = [];
680
1027
  if (element.Request?.RequestAttributeList?.length > 0) {
681
1028
  element.Request.RequestAttributeList.forEach((attribute) => {
682
1029
  if (attribute.Alias === "Subject") {
@@ -688,6 +1035,47 @@ export async function GetMyInboxCorrespondenceRequests(
688
1035
  if (attribute.Alias === "InteractorImagePath") {
689
1036
  ImagePath = attribute.Value;
690
1037
  }
1038
+ if (attribute.AttributeTypeValueTypeName === "Attachment" && !attribute.IsRequesterVisible) {
1039
+ // if(attribute.Value && ReadSASResult?.Result)
1040
+ // {
1041
+ // GeneratedDocument = ReadSASResult.Result.split("?")[0] +
1042
+ // "/" +
1043
+ // attribute.Value +
1044
+ // "?" +
1045
+ // ReadSASResult.Result.split("?")[1];
1046
+ // }
1047
+ GeneratedDocument = attribute.Value;
1048
+ }
1049
+ if(attribute.Alias === "Attachments" && !attribute.IsRequesterVisible)
1050
+ {
1051
+ if(attribute.Value)
1052
+ {
1053
+ let DecodedAttachmentsRecordList = decodeBase64ToJson(
1054
+ attribute.Value
1055
+ );
1056
+ for (let attributeGroup of DecodedAttachmentsRecordList) {
1057
+ for (let group of attributeGroup) {
1058
+ for (let attribute of group.RequestAttributeDtos) {
1059
+ if (
1060
+ attribute.AttributeTypeValueTypeName ===
1061
+ AttributeTypeValueTypeNames.Attachment
1062
+ ) {
1063
+ Attachments.push({
1064
+ id: attribute.RequestAttributeId || 0,
1065
+ name: attribute.Name || "",
1066
+ type: attribute.Value?.split(".").pop() || "",
1067
+ url: ReadSASResult?.Result? (ReadSASResult.Result.split("?")[0] +
1068
+ "/" +
1069
+ attribute.Value +
1070
+ "?" +
1071
+ ReadSASResult.Result.split("?")[1]): "",
1072
+ });
1073
+ }
1074
+ }
1075
+ }
1076
+ }
1077
+ }
1078
+ }
691
1079
  });
692
1080
  }
693
1081
  if (element.ProviderImagePath) {
@@ -738,6 +1126,8 @@ export async function GetMyInboxCorrespondenceRequests(
738
1126
  Notes: notes,
739
1127
  IsRead: element.IsCheckedOut,
740
1128
  ProcessFlow: ProcessFlow,
1129
+ GeneratedDocument: GeneratedDocument,
1130
+ Attachments: Attachments,
741
1131
  });
742
1132
  });
743
1133
  APIResponse.Result = MappedResult;
@@ -778,3 +1168,57 @@ export async function GetMyInboxCategoryWithCounts(
778
1168
  );
779
1169
  return APIResponse;
780
1170
  }
1171
+ export async function GetStorageType(AuthToken = null, Timeout = 30000) {
1172
+ let StorageType = GetConfig("StorageType");
1173
+ if (StorageType) {
1174
+ return StorageType;
1175
+ }
1176
+ let APIResponse = await apiHandler.GetMethod(
1177
+ StorageAPIConstants.uriGetStorageType(),
1178
+ AuthToken,
1179
+ Timeout
1180
+ );
1181
+ if (APIResponse.StatusCode === 200) {
1182
+ SetStorageType(APIResponse.Result.StorageType);
1183
+ return APIResponse.Result.StorageType;
1184
+ } else {
1185
+ return 0;
1186
+ }
1187
+ }
1188
+ export async function CreateCorrespondenceReadSAS(AuthToken = null, Timeout = 30000) {
1189
+ let StorageType = await GetStorageType(AuthToken, Timeout);
1190
+ if (StorageType === 0) {
1191
+ let APIResponse = await apiHandler.GetMethod(
1192
+ StorageAPIConstants.uriCreateReadSAS(),
1193
+ AuthToken,
1194
+ Timeout
1195
+ );
1196
+ return APIResponse;
1197
+ } else {
1198
+ let APIResponse = await GetOnPremiseReadSAS(AuthToken, Timeout);
1199
+ if (APIResponse.StatusCode === 200) {
1200
+ APIResponse.Result =
1201
+ APIResponse.Result.Uri + "/" + APIResponse.Result.RequestDownloadKey;
1202
+ }
1203
+ return APIResponse;
1204
+ }
1205
+ }
1206
+
1207
+ export async function CreateCorrespondenceWriteSAS(AuthToken = null, Timeout = 30000) {
1208
+ let StorageType = await GetStorageType(AuthToken, Timeout);
1209
+ if (StorageType === 0) {
1210
+ let APIResponse = await apiHandler.GetMethod(
1211
+ StorageAPIConstants.uriCreateWriteSAS(),
1212
+ AuthToken,
1213
+ Timeout
1214
+ );
1215
+ return APIResponse;
1216
+ } else {
1217
+ let APIResponse = await GetOnPremiseWriteSAS(AuthToken, Timeout);
1218
+ if (APIResponse.StatusCode === 200) {
1219
+ APIResponse.Result =
1220
+ APIResponse.Result.Uri + "/" + APIResponse.Result.RequestUpdateKey;
1221
+ }
1222
+ return APIResponse;
1223
+ }
1224
+ }
package/src/config.js CHANGED
@@ -13,6 +13,9 @@ class Config {
13
13
  setToken(AuthToken) {
14
14
  this.settings["Token"] = AuthToken;
15
15
  }
16
+ setStorageType(StorageType) {
17
+ this.settings["StorageType"] = StorageType;
18
+ }
16
19
  getConfig(key) {
17
20
  return key ? this.settings[key] : this.settings;
18
21
  }
package/src/index.d.ts CHANGED
@@ -6398,6 +6398,43 @@ interface CorrespondenceServices {
6398
6398
  Timeout?: number | null
6399
6399
  ) => BaseResponse<GetMyCorrespondenceOutput[] | BaseErrorResponse>;
6400
6400
 
6401
+ /**
6402
+ * @description
6403
+ * Retrieves the list of Correspondences for the current user.
6404
+ *
6405
+ * @param {object} getMyCorrespondenceListDTO
6406
+ * Data object containing fields necessary for retrieving the list of requests.
6407
+ * PageSize: number
6408
+ * PageIndex: number
6409
+ * IsAscendingOrder?: boolean (Optional)
6410
+ * FromFinishDate?: string (Optional)
6411
+ * ToFinishDate?: string (Optional)
6412
+ * FromStartDate?: string (Optional)
6413
+ * ToStartDate?: string (Optional)
6414
+ *
6415
+ * @param {string} AuthToken
6416
+ * Authentication token for authorization purposes.
6417
+ *
6418
+ * @param {number} Timeout
6419
+ * Time in milliseconds to wait before the request times out. Default is 30000.
6420
+ *
6421
+ * @returns
6422
+ * An object containing the response from the Get My Correspondence List request, including
6423
+ * success message, status code, and any additional data returned by the API.
6424
+ * {
6425
+ * Message: string,
6426
+ * StatusCode: number,
6427
+ * Result: {
6428
+ * -- request data based on selection criteria wether grouped or not--
6429
+ * }
6430
+ * }
6431
+ */
6432
+ GetInProcessCorrespondenceRequests: (
6433
+ Input: GetMyCorrespondenceListDTO,
6434
+ AuthToken?: string | null,
6435
+ Timeout?: number | null
6436
+ ) => BaseResponse<GetMyCorrespondenceOutput[] | BaseErrorResponse>;
6437
+
6401
6438
  /**
6402
6439
  * @description
6403
6440
  * Retrieves the list of Correspondences for the current user.
@@ -6594,6 +6631,53 @@ interface CorrespondenceServices {
6594
6631
  AuthToken?: string | null,
6595
6632
  Timeout?: number | null
6596
6633
  ) => BaseResponse<SubmitCartOrderOutput | BaseErrorResponse>;
6634
+
6635
+ /**
6636
+ * @description
6637
+ * Generates a Shared Access Signature (SAS) for writing to the storage.
6638
+ *
6639
+ * @param {string} AuthToken
6640
+ * Authentication token for authorization purposes.
6641
+ *
6642
+ * @param {number} Timeout
6643
+ * Optional Timeout in milliseconds for the request.
6644
+ *
6645
+ * @returns
6646
+ * An object containing the generated write SAS, including
6647
+ * success message, status code, and any additional data returned by the API.
6648
+ * {
6649
+ * Message: Success,
6650
+ * StatusCode: 200,
6651
+ * Result: string
6652
+ * }
6653
+ */
6654
+ CreateCorrespondenceWriteSAS: (
6655
+ AuthToken?: string | null,
6656
+ Timeout?: number | null
6657
+ ) => BaseResponse<string | BaseErrorResponse>;
6658
+ /**
6659
+ * @description
6660
+ * Generates a Shared Access Signature (SAS) for reading from the storage.
6661
+ *
6662
+ * @param {string} AuthToken
6663
+ * Authentication token for authorization purposes.
6664
+ *
6665
+ * @param {number} Timeout
6666
+ * Optional Timeout in milliseconds for the request.
6667
+ *
6668
+ * @returns
6669
+ * An object containing the generated read SAS, including
6670
+ * success message, status code, and any additional data returned by the API.
6671
+ * {
6672
+ * Message: Success,
6673
+ * StatusCode: 200,
6674
+ * Result: string
6675
+ * }
6676
+ */
6677
+ CreateCorrespondenceReadSAS: (
6678
+ AuthToken?: string | null,
6679
+ Timeout?: number | null
6680
+ ) => BaseResponse<string | BaseErrorResponse>;
6597
6681
  }
6598
6682
  interface OctopianSDKConfig {
6599
6683
  /**
package/src/index.js CHANGED
@@ -405,7 +405,11 @@ const {
405
405
  SubmitDraftCorrespondence,
406
406
  GetMyInboxCorrespondenceRequests,
407
407
  GetMyRejectedCorrespondenceRequests,
408
- GetMyInboxCategoryWithCounts
408
+ GetMyInboxCategoryWithCounts,
409
+ GetInProcessCorrespondenceRequests,
410
+ CreateCorrespondenceReadSAS,
411
+ CreateCorrespondenceWriteSAS,
412
+ GetStorageType,
409
413
  } = require('./CoreServices/correspondenceServices')
410
414
 
411
415
  const CorrespondenceServices = {
@@ -417,7 +421,11 @@ const CorrespondenceServices = {
417
421
  SubmitDraftCorrespondence,
418
422
  GetMyInboxCorrespondenceRequests,
419
423
  GetMyRejectedCorrespondenceRequests,
420
- GetMyInboxCategoryWithCounts
424
+ GetMyInboxCategoryWithCounts,
425
+ GetInProcessCorrespondenceRequests,
426
+ CreateCorrespondenceReadSAS,
427
+ CreateCorrespondenceWriteSAS,
428
+ GetStorageType,
421
429
  }
422
430
  //#region DarAlBer
423
431
  const {
@@ -27,5 +27,9 @@ export interface GetMyRequestInput {
27
27
  GroupByBatch?: boolean
28
28
  FilterDismissedRequest?: boolean
29
29
  ParentRequestId?: number
30
+ requesterName?: string;
31
+ requesterEmail?: string;
32
+ requesterMobile?: string;
33
+ requesterExternalId?: string;
30
34
  }
31
35
 
@@ -24,6 +24,7 @@ export interface GetRequestStepListInput {
24
24
  WithChildRequestStep?: boolean
25
25
  WithStepStatus?: boolean
26
26
  WithPreviousClosedRequestSteps?: boolean
27
+ WithCurrentActiveRequestStep?: boolean
27
28
  IsCompleted?: boolean
28
29
  IsAttributesGrouped?: boolean
29
30
  FilterDismissedRequestStep?: boolean
@@ -33,6 +34,11 @@ export interface GetRequestStepListInput {
33
34
  PrivilegeLevel?: number
34
35
  IsSimpleResult?: boolean
35
36
  StepTypeName?: string
37
+ requesterName?: string;
38
+ requesterEmail?: string;
39
+ requesterMobile?: string;
40
+ requesterExternalId?: string;
41
+ serviceId?: number;
36
42
  }
37
43
 
38
44
 
@@ -1,5 +1,12 @@
1
1
  export interface ProcessStepSpecialActionInput {
2
2
  RequestStepId: number;
3
3
  ActionType: string;
4
+ DynamicSteps: DynamicSteps[];
5
+ ProviderComment?: string;
6
+ }
7
+
8
+ export interface DynamicSteps{
9
+ StepName: string;
4
10
  RoleId: number;
11
+ SequenceNo: number;
5
12
  }
@@ -11,6 +11,8 @@
11
11
  Notes:string
12
12
  IsRead: boolean
13
13
  ProcessFlow: ProcessFlow[]
14
+ GeneratedDocument: string
15
+ Attachments: Attachment[]
14
16
  }
15
17
 
16
18
  export interface ProcessFlow {
@@ -20,5 +22,10 @@
20
22
  Comment: string
21
23
  SubmitDate: string
22
24
  }
23
-
25
+ export interface Attachment {
26
+ id: number
27
+ name: string
28
+ type: string
29
+ url: string
30
+ }
24
31
 
@@ -140,6 +140,7 @@ import { GetMyRequestOutput, RequestList } from "../request-modals/GetMyRequestG
140
140
  RequestAttributeGroupsDTO: RequestAttributeGroupsDto[]
141
141
  Request: GetMyRequestOutput
142
142
  PreviousClosedRequestStepList: GetRequestStepListOutput[]
143
+ CurrentActiveRequestStep: GetRequestStepListOutput
143
144
  StepStatusCounter: StepStatusCounter
144
145
  }
145
146
 
@@ -17,6 +17,33 @@ export function Init(APIKey, DomainName) {
17
17
  Config.setToken(Token);
18
18
  }
19
19
 
20
+ export function SetStorageType(StorageType) {
21
+ Config.setStorageType(StorageType);
22
+ }
23
+
20
24
  export function GetConfig(Key) {
21
25
  return Config.getConfig(Key);
22
- }
26
+ }
27
+
28
+ export const decodeBase64ToJson = (base64) => {
29
+ try {
30
+ if (base64 === '') {
31
+ return [];
32
+ }
33
+
34
+ // Decode the Base64 string
35
+ const binaryString = atob(base64);
36
+ const len = binaryString.length;
37
+ const bytes = new Uint8Array(len);
38
+ for (let i = 0; i < len; i++) {
39
+ bytes[i] = binaryString.charCodeAt(i);
40
+ }
41
+ // Decode Uint8Array to string
42
+ const decodedString = new TextDecoder("utf-8").decode(bytes);
43
+ // Parse the decoded string into JSON
44
+ return JSON.parse(decodedString);
45
+ } catch (error) {
46
+ console.error('Error decoding Base64 to JSON:', error);
47
+ return [];
48
+ }
49
+ };
@@ -651,6 +651,9 @@ export class StorageAPIConstants {
651
651
  static uriGetOnPremiseWriteSAS() {
652
652
  return storageURI + "/api/OnPremStorage/GenerateUploadSas";
653
653
  }
654
+ static uriGetStorageType(){
655
+ return storageURI + "/api/OnPremStorage/GetStorageType";
656
+ }
654
657
  }
655
658
 
656
659
  export class TaxiAPIConstants {