octopian-apis 1.0.32 → 1.0.33

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.32",
3
+ "version": "1.0.33",
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": {
@@ -66,7 +66,10 @@ import { TransactionsAPIConstants } from "../web-services/darAlBerConstants";
66
66
  * BatchRequestAttributeList: BatchRequestAttributeList[]}
67
67
  * }
68
68
  */
69
- export async function DABAgentGetCartDefinition(AuthToken = null, Timeout = 30000) {
69
+ export async function DABAgentGetCartDefinition(
70
+ AuthToken = null,
71
+ Timeout = 30000
72
+ ) {
70
73
  let APIResponse = await apiHandler.GetMethod(
71
74
  RequestsAPIConstants.uriAgentGetCartDefinition(),
72
75
  AuthToken,
@@ -163,7 +166,7 @@ export async function DABAgentAddRequest(
163
166
  * GroupCartParticipantDetailId?: number (Optional),
164
167
  * GroupCartId?: number (Optional),
165
168
  * GroupCartGuid?: guid string (Optional)
166
- *
169
+ *
167
170
  * @param {string} AuthToken
168
171
  * Authentication token for authorization purposes.
169
172
  *
@@ -304,7 +307,7 @@ export async function DABAgentCancelRequest(
304
307
  * IsByAgent: string (Optional),
305
308
  * BatchId: string (Optional),
306
309
  * SpecificRequestIdList: number[] (Optional)
307
- *
310
+ *
308
311
  * @param {string} AuthToken
309
312
  * Authentication token for authorization purposes.
310
313
  *
@@ -663,7 +666,11 @@ export async function DABGetCartDefinition(AuthToken = null, Timeout = 30000) {
663
666
  * }
664
667
  * }
665
668
  */
666
- export async function DABAddRequest(AddRequestDTO, AuthToken = null, Timeout = 30000) {
669
+ export async function DABAddRequest(
670
+ AddRequestDTO,
671
+ AuthToken = null,
672
+ Timeout = 30000
673
+ ) {
667
674
  let APIResponse = await apiHandler.PostMethod(
668
675
  RequestsAPIConstants.uriAddRequest(),
669
676
  AddRequestDTO,
@@ -682,7 +689,7 @@ export async function DABAddRequest(AddRequestDTO, AuthToken = null, Timeout = 3
682
689
  * BillingAddressId: number
683
690
  * PaymentMethod: string
684
691
  * ... other fields as needed
685
- *
692
+ *
686
693
  * @param {string} AuthToken
687
694
  * Authentication token for authorization purposes.
688
695
  *
@@ -698,7 +705,11 @@ export async function DABAddRequest(AddRequestDTO, AuthToken = null, Timeout = 3
698
705
  * Result: number
699
706
  * }
700
707
  */
701
- export async function DABSubmitCart(SubmitCartDTO, AuthToken = null, Timeout = 30000) {
708
+ export async function DABSubmitCart(
709
+ SubmitCartDTO,
710
+ AuthToken = null,
711
+ Timeout = 30000
712
+ ) {
702
713
  let APIResponse = await apiHandler.PostMethod(
703
714
  RequestsAPIConstants.uriSubmitCart(),
704
715
  SubmitCartDTO,
@@ -763,7 +774,7 @@ export async function DABGetMyRequestList(
763
774
  GetMyRequestListDTO,
764
775
  AuthToken = null,
765
776
  Timeout = 30000,
766
- RequiredHeaderValue=null
777
+ RequiredHeaderValue = null
767
778
  ) {
768
779
  let APIResponse = await apiHandler.PostMethod(
769
780
  RequestsAPIConstants.uriGetMyRequestList(),
@@ -779,18 +790,9 @@ export async function DABGetMyDonations(
779
790
  GetMyRequestListDTO,
780
791
  AuthToken = null,
781
792
  Timeout = 30000,
782
- RequiredHeaderValue=null
793
+ RequiredHeaderValue = null
783
794
  ) {
784
- const servicesList = await apiHandler.PostMethod(
785
- TransactionsAPIConstants.uriGetServiceList(),
786
- { PageSize: 1000, PageIndex: 0 },
787
- AuthToken,
788
- Timeout,
789
- RequiredHeaderValue,
790
- true
791
- );
792
-
793
- GetMyRequestListDTO['WithRequestAttribute']=true;
795
+ GetMyRequestListDTO["WithRequestAttribute"] = true;
794
796
  let requestsList = await apiHandler.PostMethod(
795
797
  RequestsAPIConstants.uriGetMyRequestList(),
796
798
  GetMyRequestListDTO,
@@ -798,12 +800,54 @@ export async function DABGetMyDonations(
798
800
  Timeout,
799
801
  RequiredHeaderValue
800
802
  );
801
- if(requestsList.Result.length>0){
802
- requestsList.Result.forEach(request => {
803
- request['ServiceAlias']=servicesList.Result.find(service => service.ServiceId === request.ServiceId)?.Alias;
804
- request['Amount']=request.RequestAttributeList.find(attribute => attribute.Alias=== 'Amount')?.Value;
805
- });
806
- }
803
+ if (requestsList.Result.length > 0) {
804
+ const servicesList = await apiHandler.PostMethod(
805
+ TransactionsAPIConstants.uriGetServiceList(),
806
+ { PageSize: 1000, PageIndex: 0 },
807
+ AuthToken,
808
+ Timeout,
809
+ RequiredHeaderValue,
810
+ true
811
+ );
812
+ for(let request of requestsList.Result){
813
+
814
+ let asset = null;
815
+ if (request.AssetId && request.AssetId > 0) {
816
+ try
817
+ {
818
+
819
+ let assetList = await apiHandler.PostMethod(
820
+ TransactionsAPIConstants.uriGetServiceAssetList(),
821
+ { PageSize: 100, PageIndex: 0, ServiceId: request.ServiceId },
822
+ AuthToken,
823
+ Timeout,
824
+ RequiredHeaderValue,
825
+ true
826
+ )
827
+ if(assetList?.StatusCode==200){
828
+ for (let asset of assetList?.Result) {
829
+ asset = asset?.Assetlist?.find(
830
+ (asset) => asset.AssetId === request.AssetId
831
+ );
832
+ }
833
+ }
834
+ }
835
+ catch(error){
836
+ //console.log(error);
837
+ }
838
+ }
839
+ request["ServiceAlias"] = servicesList?.Result?.find(
840
+ (service) => service.ServiceId === request.ServiceId
841
+ )?.Alias;
842
+ request["Amount"] = request.RequestAttributeList.find(
843
+ (attribute) => attribute.Alias === "Amount"
844
+ )?.Value;
845
+ request["Description"] = request.RequestAttributeList.find(
846
+ (attribute) => attribute.Alias === "Description"
847
+ )?.Value;
848
+ request["AssetImagePath"] = asset?.FullImagePath || "";
849
+ }
850
+ }
807
851
  return requestsList;
808
852
  }
809
853
  /**
@@ -862,7 +906,7 @@ export async function DABGetServiceOwnerRequestList(
862
906
  ServiceOwnerRequestDTO,
863
907
  AuthToken = null,
864
908
  Timeout = 30000,
865
- RequiredHeaderValue=null
909
+ RequiredHeaderValue = null
866
910
  ) {
867
911
  let APIResponse = await apiHandler.PostMethod(
868
912
  RequestsAPIConstants.uriGetServiceOwnerRequestList(),
@@ -1017,7 +1061,11 @@ export async function DABGetMyRequestCommentList(
1017
1061
  * StatusCode: 200,
1018
1062
  * Result: boolean
1019
1063
  */
1020
- export async function DABPostComment(PostCommentDTO, AuthToken = null, Timeout = 30000) {
1064
+ export async function DABPostComment(
1065
+ PostCommentDTO,
1066
+ AuthToken = null,
1067
+ Timeout = 30000
1068
+ ) {
1021
1069
  let APIResponse = await apiHandler.PostMethod(
1022
1070
  RequestsAPIConstants.uriPostComment(),
1023
1071
  PostCommentDTO,
@@ -1144,10 +1192,7 @@ export async function DABGetLastOrderDetail(
1144
1192
  * }
1145
1193
  * }
1146
1194
  */
1147
- export async function DABDashboardWidget(
1148
- AuthToken = null,
1149
- Timeout = 30000
1150
- ) {
1195
+ export async function DABDashboardWidget(AuthToken = null, Timeout = 30000) {
1151
1196
  let APIResponse = await apiHandler.GetMethod(
1152
1197
  RequestsAPIConstants.uriDashboardWidget(),
1153
1198
  AuthToken,
@@ -1365,7 +1410,11 @@ export async function DABReorderTrackableBatch(
1365
1410
  * Result: TrackableBatchRequestList[]
1366
1411
  * }
1367
1412
  */
1368
- export async function DABTrackBatch(TrackBatchDTO, AuthToken = null, Timeout = 30000) {
1413
+ export async function DABTrackBatch(
1414
+ TrackBatchDTO,
1415
+ AuthToken = null,
1416
+ Timeout = 30000
1417
+ ) {
1369
1418
  let APIResponse = await apiHandler.PostMethod(
1370
1419
  RequestsAPIConstants.uriTrackBatch(),
1371
1420
  TrackBatchDTO,
@@ -1486,7 +1535,11 @@ export async function DABEditBatchHeaders(
1486
1535
  * Result: orderList[]
1487
1536
  * }
1488
1537
  */
1489
- export async function DABGetGroupOrder(GroupOrderDTO, AuthToken = null, Timeout = 30000) {
1538
+ export async function DABGetGroupOrder(
1539
+ GroupOrderDTO,
1540
+ AuthToken = null,
1541
+ Timeout = 30000
1542
+ ) {
1490
1543
  let APIResponse = await apiHandler.PostMethod(
1491
1544
  RequestsAPIConstants.uriGetGroupOrder(),
1492
1545
  GroupOrderDTO,
@@ -1623,7 +1676,10 @@ export async function DABLeaveGroupOrder(
1623
1676
  * Result: ActiveGroupOrderDtoList[]
1624
1677
  * }
1625
1678
  */
1626
- export async function DABGetMyActiveGroupOrderList(AuthToken = null, Timeout = 30000) {
1679
+ export async function DABGetMyActiveGroupOrderList(
1680
+ AuthToken = null,
1681
+ Timeout = 30000
1682
+ ) {
1627
1683
  let APIResponse = await apiHandler.PostMethod(
1628
1684
  RequestsAPIConstants.uriGetMyActiveGroupOrderList(),
1629
1685
  null,
@@ -80,6 +80,7 @@ export interface GetMyRequestOutput {
80
80
  InteractorId: number
81
81
  InteractorName: string
82
82
  Amount: string
83
+ Description: string
83
84
  UnitName: string
84
85
  IsByAgent: boolean
85
86
  RequestAgentId: number
@@ -101,6 +102,7 @@ export interface GetMyRequestOutput {
101
102
  AssetGroupName: string
102
103
  AssetSubGroupName: string
103
104
  AssetName: string
105
+ AssetImagePath: string
104
106
  RequestStatusId: number
105
107
  SubmitDate: string
106
108
  FinishDate: string