@vqnguyen1/piece-fis-horizon 0.0.1 → 0.0.3

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.
Files changed (31) hide show
  1. package/package.json +12 -7
  2. package/project.json +22 -0
  3. package/src/index.ts +534 -0
  4. package/src/lib/actions/account-aggregation.ts +360 -0
  5. package/src/lib/actions/account-restrictions.ts +2427 -0
  6. package/src/lib/actions/bank-controls.ts +2328 -0
  7. package/src/lib/actions/card.ts +488 -0
  8. package/src/lib/actions/collateral.ts +696 -0
  9. package/src/lib/actions/customer.ts +1691 -0
  10. package/src/lib/actions/demand-deposit-savings.ts +731 -0
  11. package/src/lib/actions/get-authorization-token.ts +73 -0
  12. package/src/lib/actions/loans.ts +902 -0
  13. package/src/lib/actions/mortgage-loan.ts +1426 -0
  14. package/src/lib/actions/ready-reserve.ts +818 -0
  15. package/src/lib/actions/safe-deposit.ts +1506 -0
  16. package/src/lib/actions/search-customer-relationship-summary.ts +140 -0
  17. package/src/lib/actions/time-deposit.ts +2922 -0
  18. package/src/lib/actions/transactions.ts +1310 -0
  19. package/src/lib/actions/transfers.ts +1581 -0
  20. package/src/lib/actions/user-security.ts +1032 -0
  21. package/tsconfig.json +19 -0
  22. package/tsconfig.lib.json +10 -0
  23. package/src/index.d.ts +0 -12
  24. package/src/index.js +0 -62
  25. package/src/index.js.map +0 -1
  26. package/src/lib/actions/get-authorization-token.d.ts +0 -10
  27. package/src/lib/actions/get-authorization-token.js +0 -68
  28. package/src/lib/actions/get-authorization-token.js.map +0 -1
  29. package/src/lib/actions/search-customer-relationship-summary.d.ts +0 -15
  30. package/src/lib/actions/search-customer-relationship-summary.js +0 -122
  31. package/src/lib/actions/search-customer-relationship-summary.js.map +0 -1
@@ -0,0 +1,696 @@
1
+ import {
2
+ createAction,
3
+ Property,
4
+ } from '@activepieces/pieces-framework';
5
+ import { httpClient, HttpMethod } from '@activepieces/pieces-common';
6
+ import { fisHorizonAuth } from '../..';
7
+
8
+ // ============================================================================
9
+ // GET Customer Collateral List
10
+ // ============================================================================
11
+ export const collateral_getCustomerCollateralList = createAction({
12
+ name: 'collateral_getCustomerCollateralList',
13
+ auth: fisHorizonAuth,
14
+ displayName: 'Collateral - Get Customer Collateral List',
15
+ description: 'Retrieve a list of collateral records for a given customer.',
16
+ props: {
17
+ customerId: Property.ShortText({
18
+ displayName: 'Customer ID',
19
+ description: 'The Customer Key. Right-justified, zero filled. Up to 14 digits.',
20
+ required: true,
21
+ }),
22
+ horizonAuthorization: Property.ShortText({
23
+ displayName: 'Horizon Authorization Token',
24
+ description: 'The authorization token obtained from the Authorization - Get Token action.',
25
+ required: true,
26
+ }),
27
+ sourceId: Property.ShortText({
28
+ displayName: 'Source ID',
29
+ description: 'Optional: 6 character ID provided by FIS',
30
+ required: false,
31
+ }),
32
+ },
33
+ async run(context) {
34
+ const auth = context.auth as any;
35
+ const baseUrl = auth.baseUrl;
36
+ const organizationId = auth.organizationId;
37
+ const { customerId, horizonAuthorization, sourceId } = context.propsValue;
38
+
39
+ const uuid = crypto.randomUUID();
40
+
41
+ const headers: Record<string, string> = {
42
+ 'accept': 'application/json',
43
+ 'Content-Type': 'application/json',
44
+ 'organization-id': organizationId,
45
+ 'uuid': uuid,
46
+ 'horizon-authorization': horizonAuthorization,
47
+ };
48
+
49
+ if (sourceId) {
50
+ headers['source-id'] = sourceId;
51
+ }
52
+
53
+ const response = await httpClient.sendRequest({
54
+ method: HttpMethod.GET,
55
+ url: `${baseUrl}/collateral/v1/customers/${customerId}/collaterals`,
56
+ headers,
57
+ });
58
+
59
+ return response.body;
60
+ },
61
+ });
62
+
63
+ // ============================================================================
64
+ // POST Add Collateral
65
+ // ============================================================================
66
+ export const collateral_addCollateral = createAction({
67
+ name: 'collateral_addCollateral',
68
+ auth: fisHorizonAuth,
69
+ displayName: 'Collateral - Add Collateral',
70
+ description: 'Add a collateral record for a given customer.',
71
+ props: {
72
+ customerId: Property.ShortText({
73
+ displayName: 'Customer ID',
74
+ description: 'The Customer Key. Right-justified, zero filled. Up to 14 digits.',
75
+ required: true,
76
+ }),
77
+ horizonAuthorization: Property.ShortText({
78
+ displayName: 'Horizon Authorization Token',
79
+ description: 'The authorization token obtained from the Authorization - Get Token action.',
80
+ required: true,
81
+ }),
82
+ sourceId: Property.ShortText({
83
+ displayName: 'Source ID',
84
+ description: 'Optional: 6 character ID provided by FIS',
85
+ required: false,
86
+ }),
87
+ shortDescription: Property.ShortText({
88
+ displayName: 'Short Description',
89
+ description: 'Short description of the collateral (max 20 characters).',
90
+ required: true,
91
+ }),
92
+ longDescription: Property.ShortText({
93
+ displayName: 'Long Description',
94
+ description: 'Long description of the collateral (max 45 characters).',
95
+ required: true,
96
+ }),
97
+ collateralType: Property.ShortText({
98
+ displayName: 'Collateral Type',
99
+ description: 'The collateral type (max 5 characters).',
100
+ required: false,
101
+ }),
102
+ branchNumber: Property.ShortText({
103
+ displayName: 'Branch Number',
104
+ description: 'The branch number (max 4 characters).',
105
+ required: false,
106
+ }),
107
+ officer1: Property.ShortText({
108
+ displayName: 'Officer 1',
109
+ description: 'Officer 1 (max 3 characters).',
110
+ required: false,
111
+ }),
112
+ officer2: Property.ShortText({
113
+ displayName: 'Officer 2',
114
+ description: 'Officer 2 (max 3 characters).',
115
+ required: false,
116
+ }),
117
+ reviewPeriod: Property.StaticDropdown({
118
+ displayName: 'Review Period',
119
+ description: 'Review period type.',
120
+ required: false,
121
+ options: {
122
+ options: [
123
+ { label: 'Days', value: 'D' },
124
+ { label: 'Months', value: 'M' },
125
+ ],
126
+ },
127
+ }),
128
+ reviewIncrement: Property.Number({
129
+ displayName: 'Review Increment',
130
+ description: 'Review increment (0-999).',
131
+ required: false,
132
+ }),
133
+ expirationDate: Property.Number({
134
+ displayName: 'Expiration Date',
135
+ description: 'Expiration date in CCYYMMDD format (e.g., 20081101).',
136
+ required: false,
137
+ }),
138
+ repricePeriod: Property.StaticDropdown({
139
+ displayName: 'Reprice Period',
140
+ description: 'Reprice period type.',
141
+ required: false,
142
+ options: {
143
+ options: [
144
+ { label: 'Days', value: 'D' },
145
+ { label: 'Months', value: 'M' },
146
+ ],
147
+ },
148
+ }),
149
+ repriceIncrement: Property.Number({
150
+ displayName: 'Reprice Increment',
151
+ description: 'Reprice increment (0-999).',
152
+ required: false,
153
+ }),
154
+ unitType: Property.ShortText({
155
+ displayName: 'Unit Type',
156
+ description: 'The unit type (max 5 characters).',
157
+ required: false,
158
+ }),
159
+ pricePerUnit: Property.Number({
160
+ displayName: 'Price Per Unit',
161
+ description: 'Price per unit.',
162
+ required: false,
163
+ }),
164
+ numberOfUnits: Property.Number({
165
+ displayName: 'Number of Units',
166
+ description: 'Number of units (0-9999999).',
167
+ required: false,
168
+ }),
169
+ totalValue: Property.Number({
170
+ displayName: 'Total Value',
171
+ description: 'Total value of the collateral.',
172
+ required: false,
173
+ }),
174
+ margin: Property.Number({
175
+ displayName: 'Margin',
176
+ description: 'Margin (0-9.99999999).',
177
+ required: false,
178
+ }),
179
+ locationCode: Property.ShortText({
180
+ displayName: 'Location Code',
181
+ description: 'Location code (1 character).',
182
+ required: false,
183
+ }),
184
+ repossessionDate: Property.Number({
185
+ displayName: 'Repossession Date',
186
+ description: 'Repossession date in CCYYMMDD format.',
187
+ required: false,
188
+ }),
189
+ repossessionStatus: Property.ShortText({
190
+ displayName: 'Repossession Status',
191
+ description: 'Repossession status (max 5 characters).',
192
+ required: false,
193
+ }),
194
+ dateCollateralSold: Property.Number({
195
+ displayName: 'Date Collateral Sold',
196
+ description: 'Date collateral was sold in CCYYMMDD format.',
197
+ required: false,
198
+ }),
199
+ amountSold: Property.Number({
200
+ displayName: 'Amount Sold',
201
+ description: 'Amount the collateral was sold for.',
202
+ required: false,
203
+ }),
204
+ originalPriceValue: Property.Number({
205
+ displayName: 'Original Price Value',
206
+ description: 'Original price value.',
207
+ required: false,
208
+ }),
209
+ scratchpadNote1: Property.ShortText({
210
+ displayName: 'Scratchpad Note 1',
211
+ description: 'Scratchpad note 1 (max 70 characters).',
212
+ required: false,
213
+ }),
214
+ scratchpadNote2: Property.ShortText({
215
+ displayName: 'Scratchpad Note 2',
216
+ description: 'Scratchpad note 2 (max 70 characters).',
217
+ required: false,
218
+ }),
219
+ scratchpadNote3: Property.ShortText({
220
+ displayName: 'Scratchpad Note 3',
221
+ description: 'Scratchpad note 3 (max 70 characters).',
222
+ required: false,
223
+ }),
224
+ scratchpadNote4: Property.ShortText({
225
+ displayName: 'Scratchpad Note 4',
226
+ description: 'Scratchpad note 4 (max 70 characters).',
227
+ required: false,
228
+ }),
229
+ legalDescriptionCounter: Property.Number({
230
+ displayName: 'Legal Description Counter',
231
+ description: 'Legal description counter (0-99).',
232
+ required: false,
233
+ }),
234
+ itemizationRecordCounter: Property.Number({
235
+ displayName: 'Itemization Record Counter',
236
+ description: 'Itemization record counter (0-99).',
237
+ required: false,
238
+ }),
239
+ uccFilingCounter: Property.Number({
240
+ displayName: 'UCC Filing Counter',
241
+ description: 'UCC filing counter (0-99).',
242
+ required: false,
243
+ }),
244
+ insurancePolicyCounter: Property.Number({
245
+ displayName: 'Insurance Policy Counter',
246
+ description: 'Insurance policy counter (0-99).',
247
+ required: false,
248
+ }),
249
+ propertyCollateral: Property.Json({
250
+ displayName: 'Property Collateral',
251
+ description: 'Property collateral details as JSON object.',
252
+ required: false,
253
+ }),
254
+ titledCollateral: Property.Json({
255
+ displayName: 'Titled Collateral',
256
+ description: 'Titled collateral details (vehicle) as JSON object.',
257
+ required: false,
258
+ }),
259
+ securitiesCollateral: Property.Json({
260
+ displayName: 'Securities Collateral',
261
+ description: 'Securities collateral details as JSON object.',
262
+ required: false,
263
+ }),
264
+ externalDepositsCollateral: Property.Json({
265
+ displayName: 'External Deposits Collateral',
266
+ description: 'External deposits collateral details as JSON object.',
267
+ required: false,
268
+ }),
269
+ internalDepositsCollateral: Property.Json({
270
+ displayName: 'Internal Deposits Collateral',
271
+ description: 'Internal deposits collateral details as JSON object.',
272
+ required: false,
273
+ }),
274
+ legalCollateral: Property.Json({
275
+ displayName: 'Legal Collateral',
276
+ description: 'Legal collateral details as JSON array.',
277
+ required: false,
278
+ }),
279
+ itemizedCollateral: Property.Json({
280
+ displayName: 'Itemized Collateral',
281
+ description: 'Itemized collateral details as JSON array.',
282
+ required: false,
283
+ }),
284
+ uccCollateral: Property.Json({
285
+ displayName: 'UCC Collateral',
286
+ description: 'UCC (Uniform Commercial Code) collateral details as JSON array.',
287
+ required: false,
288
+ }),
289
+ insurancePolicyCollateral: Property.Json({
290
+ displayName: 'Insurance Policy Collateral',
291
+ description: 'Insurance policy collateral details as JSON array.',
292
+ required: false,
293
+ }),
294
+ },
295
+ async run(context) {
296
+ const auth = context.auth as any;
297
+ const baseUrl = auth.baseUrl;
298
+ const organizationId = auth.organizationId;
299
+ const {
300
+ customerId,
301
+ horizonAuthorization,
302
+ sourceId,
303
+ shortDescription,
304
+ longDescription,
305
+ collateralType,
306
+ branchNumber,
307
+ officer1,
308
+ officer2,
309
+ reviewPeriod,
310
+ reviewIncrement,
311
+ expirationDate,
312
+ repricePeriod,
313
+ repriceIncrement,
314
+ unitType,
315
+ pricePerUnit,
316
+ numberOfUnits,
317
+ totalValue,
318
+ margin,
319
+ locationCode,
320
+ repossessionDate,
321
+ repossessionStatus,
322
+ dateCollateralSold,
323
+ amountSold,
324
+ originalPriceValue,
325
+ scratchpadNote1,
326
+ scratchpadNote2,
327
+ scratchpadNote3,
328
+ scratchpadNote4,
329
+ legalDescriptionCounter,
330
+ itemizationRecordCounter,
331
+ uccFilingCounter,
332
+ insurancePolicyCounter,
333
+ propertyCollateral,
334
+ titledCollateral,
335
+ securitiesCollateral,
336
+ externalDepositsCollateral,
337
+ internalDepositsCollateral,
338
+ legalCollateral,
339
+ itemizedCollateral,
340
+ uccCollateral,
341
+ insurancePolicyCollateral,
342
+ } = context.propsValue;
343
+
344
+ const uuid = crypto.randomUUID();
345
+
346
+ const headers: Record<string, string> = {
347
+ 'accept': 'application/json',
348
+ 'Content-Type': 'application/json',
349
+ 'organization-id': organizationId,
350
+ 'uuid': uuid,
351
+ 'horizon-authorization': horizonAuthorization,
352
+ };
353
+
354
+ if (sourceId) {
355
+ headers['source-id'] = sourceId;
356
+ }
357
+
358
+ const body: Record<string, unknown> = {
359
+ shortDescription,
360
+ longDescription,
361
+ };
362
+
363
+ if (collateralType !== undefined && collateralType !== null && collateralType !== '') {
364
+ body['collateralType'] = collateralType;
365
+ }
366
+ if (branchNumber !== undefined && branchNumber !== null && branchNumber !== '') {
367
+ body['branchNumber'] = branchNumber;
368
+ }
369
+ if (officer1 !== undefined && officer1 !== null && officer1 !== '') {
370
+ body['officer1'] = officer1;
371
+ }
372
+ if (officer2 !== undefined && officer2 !== null && officer2 !== '') {
373
+ body['officer2'] = officer2;
374
+ }
375
+ if (reviewPeriod !== undefined && reviewPeriod !== null && reviewPeriod !== '') {
376
+ body['reviewPeriod'] = reviewPeriod;
377
+ }
378
+ if (reviewIncrement !== undefined && reviewIncrement !== null) {
379
+ body['reviewIncrement'] = reviewIncrement;
380
+ }
381
+ if (expirationDate !== undefined && expirationDate !== null) {
382
+ body['expirationDate'] = expirationDate;
383
+ }
384
+ if (repricePeriod !== undefined && repricePeriod !== null && repricePeriod !== '') {
385
+ body['repricePeriod'] = repricePeriod;
386
+ }
387
+ if (repriceIncrement !== undefined && repriceIncrement !== null) {
388
+ body['repriceIncrement'] = repriceIncrement;
389
+ }
390
+ if (unitType !== undefined && unitType !== null && unitType !== '') {
391
+ body['unitType'] = unitType;
392
+ }
393
+ if (pricePerUnit !== undefined && pricePerUnit !== null) {
394
+ body['pricePerUnit'] = pricePerUnit;
395
+ }
396
+ if (numberOfUnits !== undefined && numberOfUnits !== null) {
397
+ body['numberOfUnits'] = numberOfUnits;
398
+ }
399
+ if (totalValue !== undefined && totalValue !== null) {
400
+ body['totalValue'] = totalValue;
401
+ }
402
+ if (margin !== undefined && margin !== null) {
403
+ body['margin'] = margin;
404
+ }
405
+ if (locationCode !== undefined && locationCode !== null && locationCode !== '') {
406
+ body['locationCode'] = locationCode;
407
+ }
408
+ if (repossessionDate !== undefined && repossessionDate !== null) {
409
+ body['repossessionDate'] = repossessionDate;
410
+ }
411
+ if (repossessionStatus !== undefined && repossessionStatus !== null && repossessionStatus !== '') {
412
+ body['repossessionStatus'] = repossessionStatus;
413
+ }
414
+ if (dateCollateralSold !== undefined && dateCollateralSold !== null) {
415
+ body['dateCollateralSold'] = dateCollateralSold;
416
+ }
417
+ if (amountSold !== undefined && amountSold !== null) {
418
+ body['amountSold'] = amountSold;
419
+ }
420
+ if (originalPriceValue !== undefined && originalPriceValue !== null) {
421
+ body['originalPriceValue'] = originalPriceValue;
422
+ }
423
+ if (scratchpadNote1 !== undefined && scratchpadNote1 !== null && scratchpadNote1 !== '') {
424
+ body['scratchpadNote1'] = scratchpadNote1;
425
+ }
426
+ if (scratchpadNote2 !== undefined && scratchpadNote2 !== null && scratchpadNote2 !== '') {
427
+ body['scratchpadNote2'] = scratchpadNote2;
428
+ }
429
+ if (scratchpadNote3 !== undefined && scratchpadNote3 !== null && scratchpadNote3 !== '') {
430
+ body['scratchpadNote3'] = scratchpadNote3;
431
+ }
432
+ if (scratchpadNote4 !== undefined && scratchpadNote4 !== null && scratchpadNote4 !== '') {
433
+ body['scratchpadNote4'] = scratchpadNote4;
434
+ }
435
+ if (legalDescriptionCounter !== undefined && legalDescriptionCounter !== null) {
436
+ body['legalDescriptionCounter'] = legalDescriptionCounter;
437
+ }
438
+ if (itemizationRecordCounter !== undefined && itemizationRecordCounter !== null) {
439
+ body['itemizationRecordCounter'] = itemizationRecordCounter;
440
+ }
441
+ if (uccFilingCounter !== undefined && uccFilingCounter !== null) {
442
+ body['uccFilingCounter'] = uccFilingCounter;
443
+ }
444
+ if (insurancePolicyCounter !== undefined && insurancePolicyCounter !== null) {
445
+ body['insurancePolicyCounter'] = insurancePolicyCounter;
446
+ }
447
+ if (propertyCollateral !== undefined && propertyCollateral !== null) {
448
+ body['propertyCollateral'] = propertyCollateral;
449
+ }
450
+ if (titledCollateral !== undefined && titledCollateral !== null) {
451
+ body['titledCollateral'] = titledCollateral;
452
+ }
453
+ if (securitiesCollateral !== undefined && securitiesCollateral !== null) {
454
+ body['securitiesCollateral'] = securitiesCollateral;
455
+ }
456
+ if (externalDepositsCollateral !== undefined && externalDepositsCollateral !== null) {
457
+ body['externalDepositsCollateral'] = externalDepositsCollateral;
458
+ }
459
+ if (internalDepositsCollateral !== undefined && internalDepositsCollateral !== null) {
460
+ body['internalDepositsCollateral'] = internalDepositsCollateral;
461
+ }
462
+ if (legalCollateral !== undefined && legalCollateral !== null) {
463
+ body['legalCollateral'] = legalCollateral;
464
+ }
465
+ if (itemizedCollateral !== undefined && itemizedCollateral !== null) {
466
+ body['itemizedCollateral'] = itemizedCollateral;
467
+ }
468
+ if (uccCollateral !== undefined && uccCollateral !== null) {
469
+ body['uccCollateral'] = uccCollateral;
470
+ }
471
+ if (insurancePolicyCollateral !== undefined && insurancePolicyCollateral !== null) {
472
+ body['insurancePolicyCollateral'] = insurancePolicyCollateral;
473
+ }
474
+
475
+ const response = await httpClient.sendRequest({
476
+ method: HttpMethod.POST,
477
+ url: `${baseUrl}/collateral/v1/customers/${customerId}/collaterals`,
478
+ headers,
479
+ body,
480
+ });
481
+
482
+ return response.body;
483
+ },
484
+ });
485
+
486
+ // ============================================================================
487
+ // POST Add Collateral Account Relationships
488
+ // ============================================================================
489
+ export const collateral_addCollateralAccountRelationships = createAction({
490
+ name: 'collateral_addCollateralAccountRelationships',
491
+ auth: fisHorizonAuth,
492
+ displayName: 'Collateral - Add Collateral Account Relationships',
493
+ description: 'Add a relationship between loans or mortgage loans to a collateral record.',
494
+ props: {
495
+ applicationCode: Property.StaticDropdown({
496
+ displayName: 'Application Code',
497
+ description: 'The application of the loan account.',
498
+ required: true,
499
+ options: {
500
+ options: [
501
+ { label: 'Loan (LN)', value: 'LN' },
502
+ { label: 'Mortgage Loan (ML)', value: 'ML' },
503
+ ],
504
+ },
505
+ }),
506
+ accountNumber: Property.ShortText({
507
+ displayName: 'Account Number',
508
+ description: 'The account number of the loan (max 10 characters).',
509
+ required: true,
510
+ }),
511
+ collateralId: Property.ShortText({
512
+ displayName: 'Collateral ID',
513
+ description: 'The unique collateral identification number (max 14 characters).',
514
+ required: true,
515
+ }),
516
+ horizonAuthorization: Property.ShortText({
517
+ displayName: 'Horizon Authorization Token',
518
+ description: 'The authorization token obtained from the Authorization - Get Token action.',
519
+ required: true,
520
+ }),
521
+ sourceId: Property.ShortText({
522
+ displayName: 'Source ID',
523
+ description: 'Optional: 6 character ID provided by FIS',
524
+ required: false,
525
+ }),
526
+ primaryRelationshipFlag: Property.StaticDropdown({
527
+ displayName: 'Primary Relationship Flag',
528
+ description: 'Indicates whether this collateral record is the primary piece of collateral for the loan.',
529
+ required: false,
530
+ options: {
531
+ options: [
532
+ { label: 'Yes', value: 'Y' },
533
+ { label: 'No', value: 'N' },
534
+ ],
535
+ },
536
+ }),
537
+ fixedAmountOfValue: Property.Number({
538
+ displayName: 'Fixed Amount of Value',
539
+ description: 'The amount of the collateral being pledged to the loan. Use this OR Percentage of Value, not both.',
540
+ required: false,
541
+ }),
542
+ percentageOfValue: Property.Number({
543
+ displayName: 'Percentage of Value',
544
+ description: 'The percent of the collateral value being pledged to the loan (e.g., 0.0005 for 0.05%). Use this OR Fixed Amount of Value, not both.',
545
+ required: false,
546
+ }),
547
+ },
548
+ async run(context) {
549
+ const auth = context.auth as any;
550
+ const baseUrl = auth.baseUrl;
551
+ const organizationId = auth.organizationId;
552
+ const {
553
+ applicationCode,
554
+ accountNumber,
555
+ collateralId,
556
+ horizonAuthorization,
557
+ sourceId,
558
+ primaryRelationshipFlag,
559
+ fixedAmountOfValue,
560
+ percentageOfValue,
561
+ } = context.propsValue;
562
+
563
+ const uuid = crypto.randomUUID();
564
+
565
+ const headers: Record<string, string> = {
566
+ 'accept': 'application/json',
567
+ 'Content-Type': 'application/json',
568
+ 'organization-id': organizationId,
569
+ 'uuid': uuid,
570
+ 'horizon-authorization': horizonAuthorization,
571
+ };
572
+
573
+ if (sourceId) {
574
+ headers['source-id'] = sourceId;
575
+ }
576
+
577
+ const queryParams: string[] = [];
578
+ if (primaryRelationshipFlag !== undefined && primaryRelationshipFlag !== null && primaryRelationshipFlag !== '') {
579
+ queryParams.push(`primaryRelationshipFlag=${encodeURIComponent(primaryRelationshipFlag)}`);
580
+ }
581
+ if (fixedAmountOfValue !== undefined && fixedAmountOfValue !== null) {
582
+ queryParams.push(`fixedAmountOfValue=${encodeURIComponent(fixedAmountOfValue.toString())}`);
583
+ }
584
+ if (percentageOfValue !== undefined && percentageOfValue !== null) {
585
+ queryParams.push(`percentageOfValue=${encodeURIComponent(percentageOfValue.toString())}`);
586
+ }
587
+
588
+ const queryString = queryParams.length > 0 ? `?${queryParams.join('&')}` : '';
589
+
590
+ const response = await httpClient.sendRequest({
591
+ method: HttpMethod.POST,
592
+ url: `${baseUrl}/collateral/v1/accounts/${applicationCode}/${accountNumber}/collaterals/${collateralId}${queryString}`,
593
+ headers,
594
+ });
595
+
596
+ return response.body;
597
+ },
598
+ });
599
+
600
+ // ============================================================================
601
+ // GET Collateral Account Inquiry
602
+ // ============================================================================
603
+ export const collateral_collateralAccountInquiry = createAction({
604
+ name: 'collateral_collateralAccountInquiry',
605
+ auth: fisHorizonAuth,
606
+ displayName: 'Collateral - Collateral Account Inquiry',
607
+ description: 'Retrieve basic information relating to a collateral account.',
608
+ props: {
609
+ applicationCode: Property.StaticDropdown({
610
+ displayName: 'Application Code',
611
+ description: 'Application Code. Valid Value: CT = Collateral Tracking',
612
+ required: true,
613
+ options: {
614
+ options: [
615
+ { label: 'Collateral Tracking (CT)', value: 'CT' },
616
+ ],
617
+ },
618
+ }),
619
+ accountNumber: Property.ShortText({
620
+ displayName: 'Account Number',
621
+ description: 'Up to 20 digit zero filled account number.',
622
+ required: true,
623
+ }),
624
+ horizonAuthorization: Property.ShortText({
625
+ displayName: 'Horizon Authorization Token',
626
+ description: 'The authorization token obtained from the Authorization - Get Token action.',
627
+ required: true,
628
+ }),
629
+ sourceId: Property.ShortText({
630
+ displayName: 'Source ID',
631
+ description: 'Optional: 6 character ID provided by FIS',
632
+ required: false,
633
+ }),
634
+ customerId: Property.ShortText({
635
+ displayName: 'Customer ID',
636
+ description: 'Optional: Specifies the unique identifier associated with a customer. Right-justified, zero filled. Up to 14 digits.',
637
+ required: false,
638
+ }),
639
+ returnUppercase: Property.StaticDropdown({
640
+ displayName: 'Return Uppercase',
641
+ description: 'Optional: Return data in uppercase.',
642
+ required: false,
643
+ options: {
644
+ options: [
645
+ { label: 'Yes', value: 'Y' },
646
+ { label: 'No', value: 'N' },
647
+ ],
648
+ },
649
+ }),
650
+ },
651
+ async run(context) {
652
+ const auth = context.auth as any;
653
+ const baseUrl = auth.baseUrl;
654
+ const organizationId = auth.organizationId;
655
+ const {
656
+ applicationCode,
657
+ accountNumber,
658
+ horizonAuthorization,
659
+ sourceId,
660
+ customerId,
661
+ returnUppercase,
662
+ } = context.propsValue;
663
+
664
+ const uuid = crypto.randomUUID();
665
+
666
+ const headers: Record<string, string> = {
667
+ 'accept': 'application/json',
668
+ 'Content-Type': 'application/json',
669
+ 'organization-id': organizationId,
670
+ 'uuid': uuid,
671
+ 'horizon-authorization': horizonAuthorization,
672
+ };
673
+
674
+ if (sourceId) {
675
+ headers['source-id'] = sourceId;
676
+ }
677
+
678
+ const queryParams: string[] = [];
679
+ if (customerId !== undefined && customerId !== null && customerId !== '') {
680
+ queryParams.push(`customerId=${encodeURIComponent(customerId)}`);
681
+ }
682
+ if (returnUppercase !== undefined && returnUppercase !== null && returnUppercase !== '') {
683
+ queryParams.push(`returnUppercase=${encodeURIComponent(returnUppercase)}`);
684
+ }
685
+
686
+ const queryString = queryParams.length > 0 ? `?${queryParams.join('&')}` : '';
687
+
688
+ const response = await httpClient.sendRequest({
689
+ method: HttpMethod.GET,
690
+ url: `${baseUrl}/collateral/v1/accounts/${applicationCode}/${accountNumber}${queryString}`,
691
+ headers,
692
+ });
693
+
694
+ return response.body;
695
+ },
696
+ });