octopian-apis 1.0.65 → 1.0.67

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.65",
3
+ "version": "1.0.67",
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": {
@@ -1442,6 +1442,232 @@ export async function GetPaymentURL(
1442
1442
  }
1443
1443
  }
1444
1444
 
1445
+ /**
1446
+ * @description
1447
+ * Retrieves the payment URL for a service.
1448
+ *
1449
+ * @param {object} getPaymentURLMultipleAssetsDTO
1450
+ * Data object containing fields necessary for retrieving the payment URL.
1451
+ * ServiceID: number
1452
+ * MultipleAssets: MultipleAssetsInput[]
1453
+ * ServiceAlias?: string
1454
+ * PaymentURLAlias: string
1455
+ *
1456
+ * @param {string} AuthToken
1457
+ * Authentication token for authorization purposes.
1458
+ *
1459
+ * @param {number} Timeout
1460
+ * Time in milliseconds to wait before the request times out. Default is 30000.
1461
+ *
1462
+ * @param {string} RequiredHeaderValue
1463
+ * Value for any required header. Default is null.
1464
+ *
1465
+ * @returns
1466
+ * An object containing the response from the Get Payment URL API,
1467
+ * including success message, status code, and any additional data returned by the API.
1468
+ * Message: Success,
1469
+ * StatusCode: 200,
1470
+ * Result: string (payment URL)
1471
+ */
1472
+ export async function GetPaymentURLMultipleAssets(
1473
+ getPaymentURLDTO,
1474
+ AuthToken = null,
1475
+ Timeout = 30000,
1476
+ RequiredHeaderValue = null
1477
+ ) {
1478
+ try {
1479
+ let serviceID = getPaymentURLDTO.ServiceID;
1480
+ if (serviceID === 0 && getPaymentURLDTO.ServiceAlias) {
1481
+ // Fetch the list of services
1482
+ const servicesList = await apiHandler.PostMethod(
1483
+ TransactionsAPIConstants.uriGetServiceList(),
1484
+ { PageSize: 1000, PageIndex: 0 },
1485
+ AuthToken,
1486
+ Timeout,
1487
+ RequiredHeaderValue,
1488
+ true
1489
+ );
1490
+
1491
+ // Validate the response
1492
+ if (!servicesList || !Array.isArray(servicesList.Result)) {
1493
+ return {
1494
+ Message: "Error",
1495
+ StatusCode: -1,
1496
+ Result: {
1497
+ ErrorMessage: "Could not fetch service list",
1498
+ ErrorRefNo: "-1",
1499
+ },
1500
+ };
1501
+ }
1502
+
1503
+ // Find the service with the matching alias
1504
+ const service = servicesList.Result.find(
1505
+ (service) => service.Alias === getPaymentURLDTO.ServiceAlias
1506
+ );
1507
+
1508
+ // Check if the service was found
1509
+ if (!service) {
1510
+ return {
1511
+ Message: "Error",
1512
+ StatusCode: -1,
1513
+ Result: {
1514
+ ErrorMessage: `Service with alias ${getPaymentURLDTO.ServiceAlias} not found`,
1515
+ ErrorRefNo: "-1",
1516
+ },
1517
+ };
1518
+ } else {
1519
+ serviceID = service.ServiceId;
1520
+ }
1521
+ }
1522
+
1523
+ // Fetch the service parameters
1524
+ const serviceAttributes = await apiHandler.PostMethod(
1525
+ TransactionsAPIConstants.uriGetServiceRequestAttributeList(),
1526
+ {
1527
+ ServiceId: serviceID,
1528
+ AssetId: getPaymentURLDTO.MultipleAssets[0].AssetId,
1529
+ IsParameters: false,
1530
+ },
1531
+ AuthToken,
1532
+ Timeout,
1533
+ RequiredHeaderValue,
1534
+ true
1535
+ );
1536
+
1537
+ // Validate the service attributes response
1538
+ if (!serviceAttributes || !Array.isArray(serviceAttributes.Result)) {
1539
+ return {
1540
+ Message: "Error",
1541
+ StatusCode: -1,
1542
+ Result: {
1543
+ ErrorMessage: "Invalid response format for service parameters",
1544
+ ErrorRefNo: "-1",
1545
+ },
1546
+ };
1547
+ }
1548
+ const paymentBatch = await GetPaymentBatch(
1549
+ AuthToken,
1550
+ Timeout,
1551
+ RequiredHeaderValue
1552
+ );
1553
+ let serviceAttributesList = [];
1554
+ getPaymentURLDTO.MultipleAssets.forEach((asset) => {
1555
+ asset.ParametersValues.forEach((parameter) => {
1556
+ let attribute = serviceAttributesList.find(
1557
+ (attribute) => attribute.Alias === parameter.Alias
1558
+ );
1559
+ if (attribute) {
1560
+ if (parameter.Alias === "Amount") {
1561
+ attribute.Value = (
1562
+ parseFloat(parameter.Value) + parseFloat(attribute.Value)
1563
+ ).toString();
1564
+ } else {
1565
+ attribute.Value = parameter.Value;
1566
+ attribute.ExtendedValue = parameter.ExtendedValue;
1567
+ }
1568
+ } else {
1569
+ serviceAttributesList.push({
1570
+ Alias: parameter.Alias,
1571
+ Value: parameter.Value,
1572
+ ExtendedValue: parameter.ExtendedValue,
1573
+ });
1574
+ }
1575
+ });
1576
+ });
1577
+ serviceAttributes.Result.forEach((element) => {
1578
+ if (
1579
+ serviceAttributesList.find((param) => param.Alias === element.Alias)
1580
+ ) {
1581
+ element.Value = serviceAttributesLists.find(
1582
+ (param) => param.Alias === element.Alias
1583
+ ).Value;
1584
+ element.ExtendedValue = serviceAttributesList.find(
1585
+ (param) => param.Alias === element.Alias
1586
+ ).ExtendedValue;
1587
+ }
1588
+ if (element.Alias === "BatchID") {
1589
+ element.Value = paymentBatch.Result.toString();
1590
+ }
1591
+ });
1592
+ const validateIntegrationResult = await ValidateAttributesWithIntegration(
1593
+ {
1594
+ ServiceId: serviceID,
1595
+ AssetId: getPaymentURLDTO.AssetId,
1596
+ BatchId: paymentBatch.Result,
1597
+ ClientRequestAttributeDtos: serviceAttributes.Result,
1598
+ FromPageNo: 1,
1599
+ PageNo: 2,
1600
+ },
1601
+ AuthToken,
1602
+ Timeout,
1603
+ RequiredHeaderValue
1604
+ );
1605
+ // const requestAttributeList = await AssignBatchToRequestList(
1606
+ // {
1607
+ // requestId: result.Result.RequestId,
1608
+ // batchId: result.Result.BatchId,
1609
+ // },
1610
+ // AuthToken,
1611
+ // Timeout,
1612
+ // RequiredHeaderValue
1613
+ // );
1614
+ const paymentURL = validateIntegrationResult.Result.RequestAttributes.find(
1615
+ (attribute) => attribute.Alias === getPaymentURLDTO.PaymentURLAlias
1616
+ );
1617
+ if (paymentURL && paymentURL.Value) {
1618
+ getPaymentURLDTO.MultipleAssets.forEach((asset) => {
1619
+ let assetAttributes = JSON.parse(
1620
+ JSON.stringify(validateIntegrationResult.Result.RequestAttributes)
1621
+ );
1622
+ asset.ParametersValues.forEach((parameter) => {
1623
+ let attribute = assetAttributes.find(
1624
+ (attribute) => attribute.Alias === parameter.Alias
1625
+ );
1626
+ if (attribute) {
1627
+ attribute.Value = parameter.Value;
1628
+ attribute.ExtendedValue = parameter.ExtendedValue;
1629
+ }
1630
+ });
1631
+ AddRequest(
1632
+ {
1633
+ ServiceId: serviceID,
1634
+ AssetId: asset.AssetId,
1635
+ ClientRequestAttributeDtos: assetAttributes,
1636
+ },
1637
+ AuthToken,
1638
+ Timeout,
1639
+ RequiredHeaderValue
1640
+ );
1641
+ });
1642
+
1643
+ return {
1644
+ Message: "Success",
1645
+ StatusCode: 200,
1646
+ Result: paymentURL.Value,
1647
+ };
1648
+ } else {
1649
+ return {
1650
+ Message: "Error",
1651
+ StatusCode: -1,
1652
+ Result: {
1653
+ ErrorMessage: "Error fetching Payment URL",
1654
+ ErrorRefNo: "-1",
1655
+ },
1656
+ };
1657
+ }
1658
+ } catch (error) {
1659
+ // Handle errors
1660
+ return {
1661
+ Message: "Error",
1662
+ StatusCode: -1,
1663
+ Result: {
1664
+ ErrorMessage: "Error fetching Payment URL",
1665
+ ErrorRefNo: "-1",
1666
+ },
1667
+ };
1668
+ }
1669
+ }
1670
+
1445
1671
  /**
1446
1672
  * @description
1447
1673
  * Fetches the payment invoice details for a given invoice ID.
@@ -3671,20 +3897,20 @@ export async function GetDocumentRecordTemplate(
3671
3897
  * @param {string} AuthToken
3672
3898
  * Authentication token for authorization purposes.
3673
3899
  *
3674
- * @param {number} Timeout
3900
+ * @param {number} Timeout
3675
3901
  * Time in milliseconds to wait before the request times out. Default is 30000.
3676
3902
  *
3677
3903
  * @param {string} RequiredHeaderValue
3678
3904
  * Value for any required header. Default is null.
3679
3905
  *
3680
3906
  * @returns
3681
- * An object containing the response from the Get Asset Management Asset Sub Group List API,
3907
+ * An object containing the response from the Get Asset Management Asset Sub Group List API,
3682
3908
  * including success message, status code, and any additional data returned by the API.
3683
3909
  * Message: Success,
3684
3910
  * StatusCode: 200,
3685
3911
  * Result: [
3686
3912
  * --- asset management asset sub group data ---
3687
- * ],
3913
+ * ],
3688
3914
  * HeaderValue: string
3689
3915
  */
3690
3916
  export async function GetAssetManagementAssetSubGroupList(
@@ -3942,37 +4168,37 @@ export async function GenerateDocument(
3942
4168
  );
3943
4169
  return APIResponse;
3944
4170
  }
3945
- /**
3946
- * @description
3947
- * Generates a child request step document based on the provided input data.
3948
- *
3949
- * @param {object} GenerateChildRequestStepDocumentInput
3950
- * Data object containing fields necessary for generating the child request step document.
3951
- * parentRequestId: number
3952
- * templateAttributeAlias: string
3953
- * clientRequestAttributes: ClientRequestAttribute[]
3954
- * isGeneratedWord: boolean
3955
- *
3956
- * @param {string} AuthToken
3957
- * Authentication token for authorization purposes.
3958
- *
3959
- * @param {number} Timeout
3960
- * Time in milliseconds to wait before the request times out. Default is 30000.
3961
- *
3962
- * @param {string} RequiredHeaderValue
3963
- * Value for any required header. Default is null.
3964
- *
3965
- * @returns
3966
- * An object containing the response from the Generate Child Request Step Document API,
3967
- * including success message, status code, and any additional data returned by the API.
3968
- * Message: Success,
3969
- * StatusCode: 200,
3970
- * Result: [
3971
- * RequestStepId: id,
3972
- * DocumentPath: added document path
3973
- * ]
3974
- */
3975
- export async function GenerateChildRequestStepDocument(
4171
+ /**
4172
+ * @description
4173
+ * Generates a child request step document based on the provided input data.
4174
+ *
4175
+ * @param {object} GenerateChildRequestStepDocumentInput
4176
+ * Data object containing fields necessary for generating the child request step document.
4177
+ * parentRequestId: number
4178
+ * templateAttributeAlias: string
4179
+ * clientRequestAttributes: ClientRequestAttribute[]
4180
+ * isGeneratedWord: boolean
4181
+ *
4182
+ * @param {string} AuthToken
4183
+ * Authentication token for authorization purposes.
4184
+ *
4185
+ * @param {number} Timeout
4186
+ * Time in milliseconds to wait before the request times out. Default is 30000.
4187
+ *
4188
+ * @param {string} RequiredHeaderValue
4189
+ * Value for any required header. Default is null.
4190
+ *
4191
+ * @returns
4192
+ * An object containing the response from the Generate Child Request Step Document API,
4193
+ * including success message, status code, and any additional data returned by the API.
4194
+ * Message: Success,
4195
+ * StatusCode: 200,
4196
+ * Result: [
4197
+ * RequestStepId: id,
4198
+ * DocumentPath: added document path
4199
+ * ]
4200
+ */
4201
+ export async function GenerateChildRequestStepDocument(
3976
4202
  GenerateChildRequestStepDocumentInput,
3977
4203
  AuthToken = null,
3978
4204
  Timeout = 30000,
@@ -3994,7 +4220,7 @@ export async function GenerateDocument(
3994
4220
  *
3995
4221
  * @param {object} GenerateStepDocumentInput
3996
4222
  * Data object containing fields necessary for generating the step document.
3997
- * ServiceId: number
4223
+ * ServiceId: number
3998
4224
  * StepId: number
3999
4225
  * TemplateAttributeAlias: string
4000
4226
  * ClientRequestAttributes: ClientRequestAttribute[]
@@ -4038,14 +4264,14 @@ export async function GenerateStepDocument(
4038
4264
  * @param {string} AuthToken
4039
4265
  * Authentication token for authorization purposes.
4040
4266
  *
4041
- * @param {number} Timeout
4267
+ * @param {number} Timeout
4042
4268
  * Time in milliseconds to wait before the request times out. Default is 30000.
4043
4269
  *
4044
4270
  * @param {string} RequiredHeaderValue
4045
4271
  * Value for any required header. Default is null.
4046
4272
  *
4047
4273
  * @returns
4048
- * An object containing the response from the Get Notification List API,
4274
+ * An object containing the response from the Get Notification List API,
4049
4275
  * including success message, status code, and any additional data returned by the API.
4050
4276
  * Message: Success,
4051
4277
  * StatusCode: 200,
@@ -4081,13 +4307,13 @@ export async function GetNotificationList(
4081
4307
  * Authentication token for authorization purposes.
4082
4308
  *
4083
4309
  * @param {number} Timeout
4084
- * Time in milliseconds to wait before the request times out. Default is 30000.
4310
+ * Time in milliseconds to wait before the request times out. Default is 30000.
4085
4311
  *
4086
4312
  * @param {string} RequiredHeaderValue
4087
4313
  * Value for any required header. Default is null.
4088
4314
  *
4089
4315
  * @returns
4090
- * An object containing the response from the Update Notification List API,
4316
+ * An object containing the response from the Update Notification List API,
4091
4317
  * including success message, status code, and any additional data returned by the API.
4092
4318
  * Message: Success,
4093
4319
  * StatusCode: 200,
@@ -4100,13 +4326,13 @@ export async function UpdateNotificationList(
4100
4326
  Timeout = 30000,
4101
4327
  RequiredHeaderValue = null
4102
4328
  ) {
4103
- let APIResponse = await apiHandler.PostMethod(
4329
+ let APIResponse = await apiHandler.PostMethod(
4104
4330
  TransactionsAPIConstants.uriUpdateNotificationList(),
4105
4331
  UpdateNotificationListDTO,
4106
4332
  AuthToken,
4107
4333
  Timeout,
4108
4334
  RequiredHeaderValue
4109
- );
4335
+ );
4110
4336
  return APIResponse;
4111
4337
  }
4112
4338
 
@@ -4116,7 +4342,7 @@ export async function UpdateNotificationList(
4116
4342
  *
4117
4343
  * @param {string} AuthToken
4118
4344
  * Authentication token for authorization purposes.
4119
- *
4345
+ *
4120
4346
  * @param {number} Timeout
4121
4347
  * Time in milliseconds to wait before the request times out. Default is 30000.
4122
4348
  *
@@ -4137,7 +4363,7 @@ export async function GetStepTypeList(
4137
4363
  AuthToken = null,
4138
4364
  Timeout = 30000,
4139
4365
  RequiredHeaderValue = null
4140
- ) {
4366
+ ) {
4141
4367
  let APIResponse = await apiHandler.PostMethod(
4142
4368
  TransactionsAPIConstants.uriGetStepTypeList(),
4143
4369
  null,
@@ -4154,7 +4380,7 @@ export async function GetStepTypeList(
4154
4380
  *
4155
4381
  * @param {string} AuthToken
4156
4382
  * Authentication token for authorization purposes.
4157
- *
4383
+ *
4158
4384
  * @param {number} Timeout
4159
4385
  * Time in milliseconds to wait before the request times out. Default is 30000.
4160
4386
  *
@@ -4194,7 +4420,7 @@ export async function GetInteractorSignatures(
4194
4420
  *
4195
4421
  * @param {string} AuthToken
4196
4422
  * Authentication token for authorization purposes.
4197
- *
4423
+ *
4198
4424
  * @param {number} Timeout
4199
4425
  * Time in milliseconds to wait before the request times out. Default is 30000.
4200
4426
  *
@@ -4234,7 +4460,7 @@ export async function GetSignatureBlob(
4234
4460
  *
4235
4461
  * @param {string} AuthToken
4236
4462
  * Authentication token for authorization purposes.
4237
- *
4463
+ *
4238
4464
  * @param {number} Timeout
4239
4465
  * Time in milliseconds to wait before the request times out. Default is 30000.
4240
4466
  *
@@ -4255,13 +4481,13 @@ export async function SignDocument(
4255
4481
  Timeout = 30000,
4256
4482
  RequiredHeaderValue = null
4257
4483
  ) {
4258
- let APIResponse = await apiHandler.PostMethod(
4484
+ let APIResponse = await apiHandler.PostMethod(
4259
4485
  TransactionsAPIConstants.uriSignDocument(),
4260
4486
  SignDocumentDTO,
4261
4487
  AuthToken,
4262
4488
  Timeout,
4263
4489
  RequiredHeaderValue
4264
- );
4490
+ );
4265
4491
  return APIResponse;
4266
4492
  }
4267
4493
 
@@ -4298,13 +4524,13 @@ export async function SignDocumentList(
4298
4524
  Timeout = 30000,
4299
4525
  RequiredHeaderValue = null
4300
4526
  ) {
4301
- let APIResponse = await apiHandler.PostMethod(
4527
+ let APIResponse = await apiHandler.PostMethod(
4302
4528
  TransactionsAPIConstants.uriSignDocumentList(),
4303
4529
  SignDocumentListDTO,
4304
4530
  AuthToken,
4305
4531
  Timeout,
4306
4532
  RequiredHeaderValue
4307
- );
4533
+ );
4308
4534
  return APIResponse;
4309
4535
  }
4310
4536
  //#endregion
@@ -4745,7 +4971,7 @@ export async function GetAssignbleRoleList(
4745
4971
  *
4746
4972
  * @param {object} GetAgentProfileDTO
4747
4973
  * Data object containing fields necessary for retrieving the agent profile.
4748
- * --- agent profile data---
4974
+ * --- agent profile data---
4749
4975
  *
4750
4976
  * @param {string} AuthToken
4751
4977
  * Authentication token for authorization purposes.
@@ -4753,13 +4979,13 @@ export async function GetAssignbleRoleList(
4753
4979
  * @param {number} Timeout
4754
4980
  * Time in milliseconds to wait before the request times out. Default is 30000.
4755
4981
  *
4756
- * @param {string} RequiredHeaderValue
4982
+ * @param {string} RequiredHeaderValue
4757
4983
  * Value for any required header. Default is null.
4758
4984
  *
4759
4985
  * @returns
4760
4986
  * An object containing the response from the Get My Profile Agent API,
4761
4987
  * including success message, status code, and any additional data returned by the API.
4762
- * Message: Success,
4988
+ * Message: Success,
4763
4989
  * StatusCode: 200,
4764
4990
  * Result: --- agent profile data---,
4765
4991
  * HeaderValue: string
@@ -4785,19 +5011,19 @@ export async function GetAgentProfile(
4785
5011
  *
4786
5012
  * @param {object} MaintainMyAttributeListAgentDTO
4787
5013
  * Data object containing fields necessary for maintaining the agent attribute list.
4788
- * --- agent attribute data list---
5014
+ * --- agent attribute data list---
4789
5015
  *
4790
5016
  * @param {string} AuthToken
4791
5017
  * Authentication token for authorization purposes.
4792
5018
  *
4793
5019
  * @param {number} Timeout
4794
- * Time in milliseconds to wait before the request times out. Default is 30000.
5020
+ * Time in milliseconds to wait before the request times out. Default is 30000.
4795
5021
  *
4796
5022
  * @param {string} RequiredHeaderValue
4797
5023
  * Value for any required header. Default is null.
4798
5024
  *
4799
5025
  * @returns
4800
- * An object containing the response from the Maintain My Attribute List Agent API,
5026
+ * An object containing the response from the Maintain My Attribute List Agent API,
4801
5027
  * including success message, status code, and any additional data returned by the API.
4802
5028
  * Message: Success,
4803
5029
  * StatusCode: 200,
@@ -4825,19 +5051,19 @@ export async function MaintainMyAttributeListAgent(
4825
5051
  *
4826
5052
  * @param {object} UpdateMyProfileAgentDTO
4827
5053
  * Data object containing fields necessary for updating the agent profile.
4828
- * --- agent profile data---
5054
+ * --- agent profile data---
4829
5055
  *
4830
5056
  * @param {string} AuthToken
4831
5057
  * Authentication token for authorization purposes.
4832
5058
  *
4833
5059
  * @param {number} Timeout
4834
- * Time in milliseconds to wait before the request times out. Default is 30000.
5060
+ * Time in milliseconds to wait before the request times out. Default is 30000.
4835
5061
  *
4836
5062
  * @param {string} RequiredHeaderValue
4837
5063
  * Value for any required header. Default is null.
4838
5064
  *
4839
5065
  * @returns
4840
- * An object containing the response from the Update My Profile Agent API,
5066
+ * An object containing the response from the Update My Profile Agent API,
4841
5067
  * including success message, status code, and any additional data returned by the API.
4842
5068
  * Message: Success,
4843
5069
  * StatusCode: 200,
@@ -4873,13 +5099,13 @@ export async function UpdateMyProfileAgent(
4873
5099
  * @param {number} Timeout
4874
5100
  * Time in milliseconds to wait before the request times out. Default is 30000.
4875
5101
  *
4876
- * @param {string} RequiredHeaderValue
5102
+ * @param {string} RequiredHeaderValue
4877
5103
  * Value for any required header. Default is null.
4878
5104
  *
4879
5105
  * @returns
4880
5106
  * An object containing the response from the Maintain My Address List Agent API,
4881
5107
  * including success message, status code, and any additional data returned by the API.
4882
- * Message: Success,
5108
+ * Message: Success,
4883
5109
  * StatusCode: 200,
4884
5110
  * Result: --- update agent address list ---,
4885
5111
  * HeaderValue: string
@@ -5030,14 +5256,14 @@ export async function MaintainAgentUnitList(
5030
5256
  * @param {number} Timeout
5031
5257
  * Time in milliseconds to wait before the request times out. Default is 30000.
5032
5258
  *
5033
- * @param {string} RequiredHeaderValue
5259
+ * @param {string} RequiredHeaderValue
5034
5260
  * Value for any required header. Default is null.
5035
5261
  *
5036
5262
  * @returns
5037
5263
  * An object containing the response from the Maintain Agent Interactor List Agent API,
5038
5264
  * including success message, status code, and any additional data returned by the API.
5039
5265
  * Message: Success,
5040
- * StatusCode: 200,
5266
+ * StatusCode: 200,
5041
5267
  * Result: --- update agent interactor list ---,
5042
5268
  * HeaderValue: string
5043
5269
  */
@@ -105,7 +105,7 @@ export async function DABGetServiceItemList(
105
105
  Timeout = 30000,
106
106
  RequiredHeaderValue = null
107
107
  ) {
108
- let serviceID = GetServiceItemListDTO.ServiceID;
108
+ let serviceID = GetServiceItemListDTO.ServiceId;
109
109
  if (serviceID === 0 && GetServiceItemListDTO.ServiceAlias) {
110
110
  // Fetch the list of services
111
111
  const servicesList = await apiHandler.PostMethod(
@@ -133,7 +133,6 @@ export async function DABGetServiceItemList(
133
133
  const service = servicesList.Result.find(
134
134
  (service) => service.Alias === GetServiceItemListDTO.ServiceAlias
135
135
  );
136
-
137
136
  // Check if the service was found
138
137
  if (!service) {
139
138
  return {
@@ -146,12 +145,13 @@ export async function DABGetServiceItemList(
146
145
  };
147
146
  } else {
148
147
  serviceID = service.ServiceId;
148
+
149
149
  }
150
150
  }
151
151
  if (serviceID && serviceID !== 0) {
152
152
  let APIResponse = await apiHandler.PostMethod(
153
153
  TransactionsAPIConstants.uriGetServiceItemList(),
154
- GetServiceItemListDTO,
154
+ {...GetServiceItemListDTO, ServiceId: serviceID},
155
155
  AuthToken,
156
156
  Timeout,
157
157
  RequiredHeaderValue,
@@ -163,7 +163,7 @@ export async function DABGetServiceItemList(
163
163
  Message: "Error",
164
164
  StatusCode: -1,
165
165
  Result: {
166
- ErrorMessage: `Service with alias ${GetServiceItemListDTO.ServiceAlias} not found`,
166
+ ErrorMessage: `Service with alias ${GetServiceItemListDTO.ServiceAlias} test not found`,
167
167
  ErrorRefNo: "-1",
168
168
  },
169
169
  };
@@ -240,7 +240,6 @@ export async function DABGetServiceAssetList(
240
240
  const service = servicesList.Result.find(
241
241
  (service) => service.Alias === GetServiceAssetListDTO.ServiceAlias
242
242
  );
243
- "service", service;
244
243
  // Check if the service was found
245
244
  if (!service) {
246
245
  return {
@@ -1455,6 +1454,232 @@ export async function DABGetPaymentURL(
1455
1454
  }
1456
1455
  }
1457
1456
 
1457
+ /**
1458
+ * @description
1459
+ * Retrieves the payment URL for a service.
1460
+ *
1461
+ * @param {object} getPaymentURLMultipleAssetsDTO
1462
+ * Data object containing fields necessary for retrieving the payment URL.
1463
+ * ServiceID: number
1464
+ * MultipleAssets: MultipleAssetsInput[]
1465
+ * ServiceAlias?: string
1466
+ * PaymentURLAlias: string
1467
+ *
1468
+ * @param {string} AuthToken
1469
+ * Authentication token for authorization purposes.
1470
+ *
1471
+ * @param {number} Timeout
1472
+ * Time in milliseconds to wait before the request times out. Default is 30000.
1473
+ *
1474
+ * @param {string} RequiredHeaderValue
1475
+ * Value for any required header. Default is null.
1476
+ *
1477
+ * @returns
1478
+ * An object containing the response from the Get Payment URL API,
1479
+ * including success message, status code, and any additional data returned by the API.
1480
+ * Message: Success,
1481
+ * StatusCode: 200,
1482
+ * Result: string (payment URL)
1483
+ */
1484
+ export async function DABGetPaymentURLMultipleAssets(
1485
+ getPaymentURLDTO,
1486
+ AuthToken = null,
1487
+ Timeout = 30000,
1488
+ RequiredHeaderValue = null
1489
+ ) {
1490
+ try {
1491
+ let serviceID = getPaymentURLDTO.ServiceID;
1492
+ if (serviceID === 0 && getPaymentURLDTO.ServiceAlias) {
1493
+ // Fetch the list of services
1494
+ const servicesList = await apiHandler.PostMethod(
1495
+ TransactionsAPIConstants.uriGetServiceList(),
1496
+ { PageSize: 1000, PageIndex: 0 },
1497
+ AuthToken,
1498
+ Timeout,
1499
+ RequiredHeaderValue,
1500
+ true
1501
+ );
1502
+
1503
+ // Validate the response
1504
+ if (!servicesList || !Array.isArray(servicesList.Result)) {
1505
+ return {
1506
+ Message: "Error",
1507
+ StatusCode: -1,
1508
+ Result: {
1509
+ ErrorMessage: "Could not fetch service list",
1510
+ ErrorRefNo: "-1",
1511
+ },
1512
+ };
1513
+ }
1514
+
1515
+ // Find the service with the matching alias
1516
+ const service = servicesList.Result.find(
1517
+ (service) => service.Alias === getPaymentURLDTO.ServiceAlias
1518
+ );
1519
+
1520
+ // Check if the service was found
1521
+ if (!service) {
1522
+ return {
1523
+ Message: "Error",
1524
+ StatusCode: -1,
1525
+ Result: {
1526
+ ErrorMessage: `Service with alias ${getPaymentURLDTO.ServiceAlias} not found`,
1527
+ ErrorRefNo: "-1",
1528
+ },
1529
+ };
1530
+ } else {
1531
+ serviceID = service.ServiceId;
1532
+ }
1533
+ }
1534
+
1535
+ // Fetch the service parameters
1536
+ const serviceAttributes = await apiHandler.PostMethod(
1537
+ TransactionsAPIConstants.uriGetServiceRequestAttributeList(),
1538
+ {
1539
+ ServiceId: serviceID,
1540
+ AssetId: getPaymentURLDTO.MultipleAssets[0].AssetId,
1541
+ IsParameters: false,
1542
+ },
1543
+ AuthToken,
1544
+ Timeout,
1545
+ RequiredHeaderValue,
1546
+ true
1547
+ );
1548
+
1549
+ // Validate the service attributes response
1550
+ if (!serviceAttributes || !Array.isArray(serviceAttributes.Result)) {
1551
+ return {
1552
+ Message: "Error",
1553
+ StatusCode: -1,
1554
+ Result: {
1555
+ ErrorMessage: "Invalid response format for service parameters",
1556
+ ErrorRefNo: "-1",
1557
+ },
1558
+ };
1559
+ }
1560
+ const paymentBatch = await DABGetPaymentBatch(
1561
+ AuthToken,
1562
+ Timeout,
1563
+ RequiredHeaderValue
1564
+ );
1565
+ let serviceAttributesList = [];
1566
+ getPaymentURLDTO.MultipleAssets.forEach((asset) => {
1567
+ asset.ParametersValues.forEach((parameter) => {
1568
+ let attribute = serviceAttributesList.find(
1569
+ (attribute) => attribute.Alias === parameter.Alias
1570
+ );
1571
+ if (attribute) {
1572
+ if (parameter.Alias === "Amount") {
1573
+ attribute.Value = (
1574
+ parseFloat(parameter.Value) + parseFloat(attribute.Value)
1575
+ ).toString();
1576
+ } else {
1577
+ attribute.Value = parameter.Value;
1578
+ attribute.ExtendedValue = parameter.ExtendedValue;
1579
+ }
1580
+ } else {
1581
+ serviceAttributesList.push({
1582
+ Alias: parameter.Alias,
1583
+ Value: parameter.Value,
1584
+ ExtendedValue: parameter.ExtendedValue,
1585
+ });
1586
+ }
1587
+ });
1588
+ });
1589
+ serviceAttributes.Result.forEach((element) => {
1590
+ if (
1591
+ serviceAttributesList.find((param) => param.Alias === element.Alias)
1592
+ ) {
1593
+ element.Value = serviceAttributesLists.find(
1594
+ (param) => param.Alias === element.Alias
1595
+ ).Value;
1596
+ element.ExtendedValue = serviceAttributesList.find(
1597
+ (param) => param.Alias === element.Alias
1598
+ ).ExtendedValue;
1599
+ }
1600
+ if (element.Alias === "BatchID") {
1601
+ element.Value = paymentBatch.Result.toString();
1602
+ }
1603
+ });
1604
+ const validateIntegrationResult = await DABValidateAttributesWithIntegration(
1605
+ {
1606
+ ServiceId: serviceID,
1607
+ AssetId: getPaymentURLDTO.AssetId,
1608
+ BatchId: paymentBatch.Result,
1609
+ ClientRequestAttributeDtos: serviceAttributes.Result,
1610
+ FromPageNo: 1,
1611
+ PageNo: 2,
1612
+ },
1613
+ AuthToken,
1614
+ Timeout,
1615
+ RequiredHeaderValue
1616
+ );
1617
+ // const requestAttributeList = await AssignBatchToRequestList(
1618
+ // {
1619
+ // requestId: result.Result.RequestId,
1620
+ // batchId: result.Result.BatchId,
1621
+ // },
1622
+ // AuthToken,
1623
+ // Timeout,
1624
+ // RequiredHeaderValue
1625
+ // );
1626
+ const paymentURL = validateIntegrationResult.Result.RequestAttributes.find(
1627
+ (attribute) => attribute.Alias === getPaymentURLDTO.PaymentURLAlias
1628
+ );
1629
+ if (paymentURL && paymentURL.Value) {
1630
+ getPaymentURLDTO.MultipleAssets.forEach((asset) => {
1631
+ let assetAttributes = JSON.parse(
1632
+ JSON.stringify(validateIntegrationResult.Result.RequestAttributes)
1633
+ );
1634
+ asset.ParametersValues.forEach((parameter) => {
1635
+ let attribute = assetAttributes.find(
1636
+ (attribute) => attribute.Alias === parameter.Alias
1637
+ );
1638
+ if (attribute) {
1639
+ attribute.Value = parameter.Value;
1640
+ attribute.ExtendedValue = parameter.ExtendedValue;
1641
+ }
1642
+ });
1643
+ DABAddRequest(
1644
+ {
1645
+ ServiceId: serviceID,
1646
+ AssetId: asset.AssetId,
1647
+ ClientRequestAttributeDtos: assetAttributes,
1648
+ },
1649
+ AuthToken,
1650
+ Timeout,
1651
+ RequiredHeaderValue
1652
+ );
1653
+ });
1654
+
1655
+ return {
1656
+ Message: "Success",
1657
+ StatusCode: 200,
1658
+ Result: paymentURL.Value,
1659
+ };
1660
+ } else {
1661
+ return {
1662
+ Message: "Error",
1663
+ StatusCode: -1,
1664
+ Result: {
1665
+ ErrorMessage: "Error fetching Payment URL",
1666
+ ErrorRefNo: "-1",
1667
+ },
1668
+ };
1669
+ }
1670
+ } catch (error) {
1671
+ // Handle errors
1672
+ return {
1673
+ Message: "Error",
1674
+ StatusCode: -1,
1675
+ Result: {
1676
+ ErrorMessage: "Error fetching Payment URL",
1677
+ ErrorRefNo: "-1",
1678
+ },
1679
+ };
1680
+ }
1681
+ }
1682
+
1458
1683
  /**
1459
1684
  * @description
1460
1685
  * Adds a service to the cart.
@@ -228,7 +228,7 @@ import { GetParametersValueListInput } from "./modals/input-modals/transaction-c
228
228
  import { AttributeTypeValueOutput } from "./modals/output-modals/transaction-catalog-modals/AttributeTypeValueOutput";
229
229
  import { GetServiceSelectorListInput } from "./modals/input-modals/transaction-catalog-modals/GetServiceSelectorList";
230
230
  import { CustomSubmitInput } from "./modals/input-modals/transaction-catalog-modals/CustomSubmitInput";
231
- import { GetPaymentURLInput } from "./modals/input-modals/transaction-catalog-modals/GetPaymentURLInput";
231
+ import { GetPaymentURLInput, GetPaymentURLMultipleAssetsInput } from "./modals/input-modals/transaction-catalog-modals/GetPaymentURLInput";
232
232
  import { PaymentInvoiceOutput, DonatorDetailsOutput, PaymentDetailsOutput } from "./modals/output-modals/transaction-catalog-modals/PaymentInvoiceOutput";
233
233
  import { LinkedLoginOutput } from "./modals/output-modals/authentications-modals/LinkedLoginOutput";
234
234
  // Define each module with its specific functions
@@ -1588,6 +1588,68 @@ interface DarAlBerServices {
1588
1588
  RequiredHeaderValue?: string
1589
1589
  ) => BaseResponse<string | BaseErrorResponse>;
1590
1590
 
1591
+ /**
1592
+ * @description
1593
+ * Retrieves the payment URL for a service.
1594
+ *
1595
+ * @param {GetPaymentURLMultipleAssetsInput} Input
1596
+ * Data object containing fields necessary for retrieving the payment URL.
1597
+ * ServiceID: number
1598
+ * MultipleAssets: MultipleAssetsInput[]
1599
+ * ServiceAlias?: string
1600
+ * PaymentURLAlias: string
1601
+ *
1602
+ * @param {string} AuthToken
1603
+ * Authentication token for authorization purposes.
1604
+ *
1605
+ * @param {number} Timeout
1606
+ * Time in milliseconds to wait before the request times out. Default is 30000.
1607
+ *
1608
+ * @param {string} RequiredHeaderValue
1609
+ * Value for any required header. Default is null.
1610
+ *
1611
+ * @returns
1612
+ * An object containing the response from the Get Payment URL API,
1613
+ * including success message, status code, and any additional data returned by the API.
1614
+ * Message: Success,
1615
+ * StatusCode: 200,
1616
+ * Result: string (payment URL)
1617
+ */
1618
+ DABGetPaymentURLMultipleAssets: (
1619
+ Input: GetPaymentURLMultipleAssetsInput,
1620
+ AuthToken?: string | null,
1621
+ Timeout?: number | null,
1622
+ RequiredHeaderValue?: string
1623
+ ) => BaseResponse<string | BaseErrorResponse>;
1624
+
1625
+ /**
1626
+ * @description
1627
+ * Adds a request to the cart.
1628
+ *
1629
+ * @param {GetPaymentURLInput} Input
1630
+ * Data object containing fields necessary for adding a request to the cart.
1631
+ * ServiceID: number
1632
+ * AssetId: number
1633
+ * ServiceAlias?: string
1634
+ * ParametersValues: ParametersValues[]
1635
+ *
1636
+ * @param {string} AuthToken
1637
+ * Authentication token for authorization purposes.
1638
+ *
1639
+ * @param {number} Timeout
1640
+ * Time in milliseconds to wait before the request times out. Default is 30000.
1641
+ *
1642
+ * @param {string} RequiredHeaderValue
1643
+ * Value for any required header. Default is null.
1644
+ *
1645
+ * @returns
1646
+ * An object containing the response from the Add Request API,
1647
+ * including success message, status code, and any additional data returned by the API.
1648
+ * Message: Success,
1649
+ * StatusCode: 200,
1650
+ * Result: AddRequestOutput
1651
+ * HeaderValue: string
1652
+ */
1591
1653
  DABAddToCart: (
1592
1654
  Input: GetPaymentURLInput,
1593
1655
  AuthToken?: string | null,
package/src/index.d.ts CHANGED
@@ -248,7 +248,7 @@ import { GetParametersValueListInput } from "./modals/input-modals/transaction-c
248
248
  import { GetServiceSelectorListInput } from "./modals/input-modals/transaction-catalog-modals/GetServiceSelectorList";
249
249
  import { CustomSubmitInput } from "./modals/input-modals/transaction-catalog-modals/CustomSubmitInput";
250
250
  import { ParametersValues } from "./modals/input-modals/transaction-catalog-modals/ParametersValues";
251
- import { GetPaymentURLInput } from "./modals/input-modals/transaction-catalog-modals/GetPaymentURLInput";
251
+ import { GetPaymentURLInput, GetPaymentURLMultipleAssetsInput, MultipleAssetsInput } from "./modals/input-modals/transaction-catalog-modals/GetPaymentURLInput";
252
252
  import { GetAssetListwithParamsInput } from "./modals/input-modals/transaction-catalog-modals/GetAssetListwithParamsInput";
253
253
  import {
254
254
  PaymentInvoiceOutput,
@@ -1658,6 +1658,40 @@ interface TransactionRequesterServices {
1658
1658
  RequiredHeaderValue?: string
1659
1659
  ) => BaseResponse<string | BaseErrorResponse>;
1660
1660
 
1661
+ /**
1662
+ * @description
1663
+ * Retrieves the payment URL for a service.
1664
+ *
1665
+ * @param {GetPaymentURLMultipleAssetsInput} Input
1666
+ * Data object containing fields necessary for retrieving the payment URL.
1667
+ * ServiceID: number
1668
+ * MultipleAssets: MultipleAssetsInput[]
1669
+ * ServiceAlias?: string
1670
+ * PaymentURLAlias: string
1671
+ *
1672
+ * @param {string} AuthToken
1673
+ * Authentication token for authorization purposes.
1674
+ *
1675
+ * @param {number} Timeout
1676
+ * Time in milliseconds to wait before the request times out. Default is 30000.
1677
+ *
1678
+ * @param {string} RequiredHeaderValue
1679
+ * Value for any required header. Default is null.
1680
+ *
1681
+ * @returns
1682
+ * An object containing the response from the Get Payment URL API,
1683
+ * including success message, status code, and any additional data returned by the API.
1684
+ * Message: Success,
1685
+ * StatusCode: 200,
1686
+ * Result: string (payment URL)
1687
+ */
1688
+ GetPaymentURLMultipleAssets: (
1689
+ Input: GetPaymentURLMultipleAssetsInput,
1690
+ AuthToken?: string | null,
1691
+ Timeout?: number | null,
1692
+ RequiredHeaderValue?: string
1693
+ ) => BaseResponse<string | BaseErrorResponse>;
1694
+
1661
1695
  /**
1662
1696
  * @description
1663
1697
  * Fetches the payment invoice for a given invoice ID.
@@ -7826,4 +7860,6 @@ export {
7826
7860
  GenerateChildDocumentsOutput,
7827
7861
  RequesterAddBatchRequestInput,
7828
7862
  UpdateRequestStepAttributesInput,
7863
+ GetPaymentURLMultipleAssetsInput,
7864
+ MultipleAssetsInput,
7829
7865
  };
package/src/index.js CHANGED
@@ -120,6 +120,7 @@ const {
120
120
  CustomRegistration,
121
121
  CustomSubmit,
122
122
  GetPaymentURL,
123
+ GetPaymentURLMultipleAssets,
123
124
  GetInvoiceDetails,
124
125
  ValidateAttributesWithIntegration,
125
126
  GetPaymentBatch,
@@ -163,6 +164,7 @@ const TransactionRequesterServices = {
163
164
  CustomRegistration,
164
165
  CustomSubmit,
165
166
  GetPaymentURL,
167
+ GetPaymentURLMultipleAssets,
166
168
  ValidateAttributesWithIntegration,
167
169
  GetPaymentBatch,
168
170
  GetInvoiceDetails,
@@ -583,6 +585,7 @@ const {
583
585
  DABCustomRegistration,
584
586
  DABCustomSubmit,
585
587
  DABGetPaymentURL,
588
+ DABGetPaymentURLMultipleAssets,
586
589
  DABValidateAttributesWithIntegration,
587
590
  DABGetPaymentBatch,
588
591
  DABGetInvoiceDetails,
@@ -827,6 +830,7 @@ const DarAlBerServices = {
827
830
  DABCustomRegistration,
828
831
  DABCustomSubmit,
829
832
  DABGetPaymentURL,
833
+ DABGetPaymentURLMultipleAssets,
830
834
  DABValidateAttributesWithIntegration,
831
835
  DABGetPaymentBatch,
832
836
  DABGetInvoiceDetails,
@@ -6,4 +6,17 @@ export interface GetPaymentURLInput {
6
6
  ServiceAlias?: string;
7
7
  ParametersValues: ParametersValues[];
8
8
  PaymentURLAlias: string;
9
- }
9
+ }
10
+
11
+
12
+ export interface GetPaymentURLMultipleAssetsInput {
13
+ ServiceID: number;
14
+ MultipleAssets: MultipleAssetsInput[];
15
+ ServiceAlias?: string;
16
+ PaymentURLAlias: string;
17
+ }
18
+
19
+ export interface MultipleAssetsInput {
20
+ AssetId: number;
21
+ ParametersValues: ParametersValues[];
22
+ }