@vqnguyen1/piece-fis-horizon 0.0.2 → 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 +2 -2
  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,1506 @@
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
+ * Safe Deposit - Account Inquiry
10
+ * GET /accounts/{applicationCode}/{accountNumber}
11
+ * Retrieve basic information relating to a safe deposit account
12
+ */
13
+ export const safe_deposit_account_inquiry = createAction({
14
+ name: 'safe_deposit_account_inquiry',
15
+ auth: fisHorizonAuth,
16
+ displayName: 'Safe Deposit - Account Inquiry',
17
+ description: 'Retrieve basic information relating to a safe deposit account',
18
+ props: {
19
+ xAuthorization: Property.ShortText({
20
+ displayName: 'Authorization Token',
21
+ description: 'The authorization token obtained from the Get Token endpoint',
22
+ required: true,
23
+ }),
24
+ sourceId: Property.ShortText({
25
+ displayName: 'Source ID',
26
+ description: 'Optional: 6 character ID provided by FIS',
27
+ required: false,
28
+ }),
29
+ applicationCode: Property.StaticDropdown({
30
+ displayName: 'Application Code',
31
+ description: 'Application Code for Safe Deposit Box',
32
+ required: true,
33
+ options: {
34
+ options: [
35
+ { label: 'BX - Safe Deposit Box', value: 'BX' },
36
+ ],
37
+ },
38
+ defaultValue: 'BX',
39
+ }),
40
+ accountNumber: Property.ShortText({
41
+ displayName: 'Account Number',
42
+ description: 'Up to 20 digit zero filled account number',
43
+ required: true,
44
+ }),
45
+ customerId: Property.ShortText({
46
+ displayName: 'Customer ID',
47
+ description: 'Specifies the unique identifier associated with a customer. Right-justified, zero filled, up to 14 digits',
48
+ required: false,
49
+ }),
50
+ returnUppercase: Property.StaticDropdown({
51
+ displayName: 'Return Uppercase',
52
+ description: 'Return response in uppercase',
53
+ required: false,
54
+ options: {
55
+ options: [
56
+ { label: 'Yes', value: 'Y' },
57
+ { label: 'No', value: 'N' },
58
+ ],
59
+ },
60
+ }),
61
+ },
62
+ async run(context) {
63
+ const auth = context.auth as any;
64
+ const baseUrl = auth['baseUrl'];
65
+ const organizationId = auth['organizationId'];
66
+ const { xAuthorization, sourceId, applicationCode, accountNumber, customerId, returnUppercase } = context.propsValue;
67
+
68
+ const uuid = crypto.randomUUID();
69
+
70
+ const headers: Record<string, string> = {
71
+ 'accept': 'application/json',
72
+ 'Content-Type': 'application/json',
73
+ 'organization-id': organizationId,
74
+ 'uuid': uuid,
75
+ 'horizon-authorization': xAuthorization,
76
+ };
77
+
78
+ if (sourceId) {
79
+ headers['source-id'] = sourceId;
80
+ }
81
+
82
+ const queryParams: Record<string, string> = {};
83
+ if (customerId) {
84
+ queryParams['customerId'] = customerId;
85
+ }
86
+ if (returnUppercase) {
87
+ queryParams['returnUppercase'] = returnUppercase;
88
+ }
89
+
90
+ const queryString = Object.keys(queryParams).length > 0
91
+ ? '?' + new URLSearchParams(queryParams).toString()
92
+ : '';
93
+
94
+ const response = await httpClient.sendRequest({
95
+ method: HttpMethod.GET,
96
+ url: `${baseUrl}/safe-deposit/v1/accounts/${applicationCode}/${accountNumber}${queryString}`,
97
+ headers,
98
+ });
99
+
100
+ return response.body;
101
+ },
102
+ });
103
+
104
+ /**
105
+ * Safe Deposit - Transaction Inquiry
106
+ * GET /accounts/{applicationCode}/{accountNumber}/transactions
107
+ * Retrieve a list of historic transactions relating to an account
108
+ */
109
+ export const safe_deposit_transaction_inquiry = createAction({
110
+ name: 'safe_deposit_transaction_inquiry',
111
+ auth: fisHorizonAuth,
112
+ displayName: 'Safe Deposit - Transaction Inquiry',
113
+ description: 'Retrieve a list of historic transactions relating to a safe deposit account',
114
+ props: {
115
+ xAuthorization: Property.ShortText({
116
+ displayName: 'Authorization Token',
117
+ description: 'The authorization token obtained from the Get Token endpoint',
118
+ required: true,
119
+ }),
120
+ sourceId: Property.ShortText({
121
+ displayName: 'Source ID',
122
+ description: 'Optional: 6 character ID provided by FIS',
123
+ required: false,
124
+ }),
125
+ applicationCode: Property.StaticDropdown({
126
+ displayName: 'Application Code',
127
+ description: 'Application Code for Safe Deposit Box',
128
+ required: true,
129
+ options: {
130
+ options: [
131
+ { label: 'BX - Safe Deposit Box', value: 'BX' },
132
+ ],
133
+ },
134
+ defaultValue: 'BX',
135
+ }),
136
+ accountNumber: Property.ShortText({
137
+ displayName: 'Account Number',
138
+ description: 'Up to 20 digit zero filled account number',
139
+ required: true,
140
+ }),
141
+ dateSelectOption: Property.StaticDropdown({
142
+ displayName: 'Date Select Option',
143
+ description: 'Date selection option for transactions',
144
+ required: true,
145
+ options: {
146
+ options: [
147
+ { label: 'M - Today\'s memo posted transactions', value: 'M' },
148
+ { label: 'P - All transactions from last BOSS processing run', value: 'P' },
149
+ { label: 'R - User specified date range (Effective Dates)', value: 'R' },
150
+ { label: 'S - All transactions since last statement date', value: 'S' },
151
+ { label: 'T - User specified date range (Transaction Dates)', value: 'T' },
152
+ ],
153
+ },
154
+ }),
155
+ firstNext: Property.StaticDropdown({
156
+ displayName: 'First/Next',
157
+ description: 'First request or next request for additional transactions',
158
+ required: true,
159
+ options: {
160
+ options: [
161
+ { label: 'F - First request', value: 'F' },
162
+ { label: 'N - Next request for additional transactions', value: 'N' },
163
+ ],
164
+ },
165
+ defaultValue: 'F',
166
+ }),
167
+ numberToReturn: Property.Number({
168
+ displayName: 'Number to Return',
169
+ description: 'Number of transactions to return at a time (0-999). 999 returns as many as can fit in buffer',
170
+ required: true,
171
+ defaultValue: 999,
172
+ }),
173
+ beginDate: Property.Number({
174
+ displayName: 'Begin Date',
175
+ description: 'Begin date for date range (YYYYMMDD format). Required when Date Select Option is R, T, or M',
176
+ required: false,
177
+ }),
178
+ endDate: Property.Number({
179
+ displayName: 'End Date',
180
+ description: 'End date for date range (YYYYMMDD format). Optional when Date Select Option is R or T. Defaults to 99999999 if zero',
181
+ required: false,
182
+ }),
183
+ returnMemoPostTransaction: Property.StaticDropdown({
184
+ displayName: 'Return Memo Post Transaction',
185
+ description: 'Option for returning memo post transactions',
186
+ required: false,
187
+ options: {
188
+ options: [
189
+ { label: 'A - Return all of today\'s memo post transactions', value: 'A' },
190
+ { label: 'Y - Return today\'s memo post transactions (excluding those not affecting available balance)', value: 'Y' },
191
+ { label: 'N - Do not return memo post transactions', value: 'N' },
192
+ ],
193
+ },
194
+ }),
195
+ returnPackagePostItems: Property.StaticDropdown({
196
+ displayName: 'Return Package Post Items',
197
+ description: 'Option for returning package post items',
198
+ required: false,
199
+ options: {
200
+ options: [
201
+ { label: 'A - Return all items (including PKPST)', value: 'A' },
202
+ { label: 'P - Return history items and package posted check', value: 'P' },
203
+ ],
204
+ },
205
+ }),
206
+ returnScheduledExternalTransfers: Property.StaticDropdown({
207
+ displayName: 'Return Scheduled External Transfers',
208
+ description: 'Option for returning scheduled auto transfers',
209
+ required: false,
210
+ options: {
211
+ options: [
212
+ { label: 'Y - Return scheduled Auto Transfers', value: 'Y' },
213
+ { label: 'N - Do not return scheduled Auto Transfers', value: 'N' },
214
+ ],
215
+ },
216
+ }),
217
+ sequenceOption: Property.StaticDropdown({
218
+ displayName: 'Sequence Option',
219
+ description: 'Order of returned transactions',
220
+ required: false,
221
+ options: {
222
+ options: [
223
+ { label: 'A - Ascending order', value: 'A' },
224
+ { label: 'D - Descending order', value: 'D' },
225
+ ],
226
+ },
227
+ defaultValue: 'A',
228
+ }),
229
+ searchToken: Property.ShortText({
230
+ displayName: 'Search Token',
231
+ description: 'Search Token for stateless middleware processing (max 20 characters)',
232
+ required: false,
233
+ }),
234
+ },
235
+ async run(context) {
236
+ const auth = context.auth as any;
237
+ const baseUrl = auth['baseUrl'];
238
+ const organizationId = auth['organizationId'];
239
+ const {
240
+ xAuthorization,
241
+ sourceId,
242
+ applicationCode,
243
+ accountNumber,
244
+ dateSelectOption,
245
+ firstNext,
246
+ numberToReturn,
247
+ beginDate,
248
+ endDate,
249
+ returnMemoPostTransaction,
250
+ returnPackagePostItems,
251
+ returnScheduledExternalTransfers,
252
+ sequenceOption,
253
+ searchToken,
254
+ } = context.propsValue;
255
+
256
+ const uuid = crypto.randomUUID();
257
+
258
+ const headers: Record<string, string> = {
259
+ 'accept': 'application/json',
260
+ 'Content-Type': 'application/json',
261
+ 'organization-id': organizationId,
262
+ 'uuid': uuid,
263
+ 'horizon-authorization': xAuthorization,
264
+ };
265
+
266
+ if (sourceId) {
267
+ headers['source-id'] = sourceId;
268
+ }
269
+
270
+ const queryParams: Record<string, string> = {};
271
+ queryParams['dateSelectOption'] = dateSelectOption;
272
+ queryParams['firstNext'] = firstNext;
273
+ queryParams['numberToReturn'] = String(numberToReturn);
274
+
275
+ if (beginDate !== undefined && beginDate !== null) {
276
+ queryParams['beginDate'] = String(beginDate);
277
+ }
278
+ if (endDate !== undefined && endDate !== null) {
279
+ queryParams['endDate'] = String(endDate);
280
+ }
281
+ if (returnMemoPostTransaction) {
282
+ queryParams['returnMemoPostTransaction'] = returnMemoPostTransaction;
283
+ }
284
+ if (returnPackagePostItems) {
285
+ queryParams['returnPackagePostItems'] = returnPackagePostItems;
286
+ }
287
+ if (returnScheduledExternalTransfers) {
288
+ queryParams['returnScheduledExternalTransfers'] = returnScheduledExternalTransfers;
289
+ }
290
+ if (sequenceOption) {
291
+ queryParams['sequenceOption'] = sequenceOption;
292
+ }
293
+ if (searchToken) {
294
+ queryParams['searchToken'] = searchToken;
295
+ }
296
+
297
+ const queryString = '?' + new URLSearchParams(queryParams).toString();
298
+
299
+ const response = await httpClient.sendRequest({
300
+ method: HttpMethod.GET,
301
+ url: `${baseUrl}/safe-deposit/v1/accounts/${applicationCode}/${accountNumber}/transactions${queryString}`,
302
+ headers,
303
+ });
304
+
305
+ return response.body;
306
+ },
307
+ });
308
+
309
+ /**
310
+ * Safe Deposit - Box Inquiry
311
+ * GET /accounts/safe-deposit-box
312
+ * Retrieve the details of a safe deposit box account information
313
+ */
314
+ export const safe_deposit_box_inquiry = createAction({
315
+ name: 'safe_deposit_box_inquiry',
316
+ auth: fisHorizonAuth,
317
+ displayName: 'Safe Deposit - Box Inquiry',
318
+ description: 'Retrieve the details of a safe deposit box account information',
319
+ props: {
320
+ xAuthorization: Property.ShortText({
321
+ displayName: 'Authorization Token',
322
+ description: 'The authorization token obtained from the Get Token endpoint',
323
+ required: true,
324
+ }),
325
+ sourceId: Property.ShortText({
326
+ displayName: 'Source ID',
327
+ description: 'Optional: 6 character ID provided by FIS',
328
+ required: false,
329
+ }),
330
+ branchNumber: Property.Number({
331
+ displayName: 'Branch Number',
332
+ description: 'Branch number (max 3 digits). Conditional: Use branch and box numbers OR account number',
333
+ required: false,
334
+ }),
335
+ boxNumber: Property.ShortText({
336
+ displayName: 'Box Number',
337
+ description: 'Box number (max 5 characters). Conditional: Use branch and box numbers OR account number',
338
+ required: false,
339
+ }),
340
+ accountNumber: Property.Number({
341
+ displayName: 'Account Number',
342
+ description: 'Box account number (max 10 digits). Conditional: Use account number OR branch and box numbers',
343
+ required: false,
344
+ }),
345
+ },
346
+ async run(context) {
347
+ const auth = context.auth as any;
348
+ const baseUrl = auth['baseUrl'];
349
+ const organizationId = auth['organizationId'];
350
+ const { xAuthorization, sourceId, branchNumber, boxNumber, accountNumber } = context.propsValue;
351
+
352
+ const uuid = crypto.randomUUID();
353
+
354
+ const headers: Record<string, string> = {
355
+ 'accept': 'application/json',
356
+ 'Content-Type': 'application/json',
357
+ 'organization-id': organizationId,
358
+ 'uuid': uuid,
359
+ 'horizon-authorization': xAuthorization,
360
+ };
361
+
362
+ if (sourceId) {
363
+ headers['source-id'] = sourceId;
364
+ }
365
+
366
+ const queryParams: Record<string, string> = {};
367
+ if (branchNumber !== undefined && branchNumber !== null) {
368
+ queryParams['branchNumber'] = String(branchNumber);
369
+ }
370
+ if (boxNumber) {
371
+ queryParams['boxNumber'] = boxNumber;
372
+ }
373
+ if (accountNumber !== undefined && accountNumber !== null) {
374
+ queryParams['accountNumber'] = String(accountNumber);
375
+ }
376
+
377
+ const queryString = Object.keys(queryParams).length > 0
378
+ ? '?' + new URLSearchParams(queryParams).toString()
379
+ : '';
380
+
381
+ const response = await httpClient.sendRequest({
382
+ method: HttpMethod.GET,
383
+ url: `${baseUrl}/safe-deposit/v1/accounts/safe-deposit-box${queryString}`,
384
+ headers,
385
+ });
386
+
387
+ return response.body;
388
+ },
389
+ });
390
+
391
+ /**
392
+ * Safe Deposit - Box Maintain
393
+ * PUT /accounts/safe-deposit-box
394
+ * Maintain a safe deposit box account
395
+ */
396
+ export const safe_deposit_box_maintain = createAction({
397
+ name: 'safe_deposit_box_maintain',
398
+ auth: fisHorizonAuth,
399
+ displayName: 'Safe Deposit - Box Maintain',
400
+ description: 'Maintain a safe deposit box account',
401
+ props: {
402
+ xAuthorization: Property.ShortText({
403
+ displayName: 'Authorization Token',
404
+ description: 'The authorization token obtained from the Get Token endpoint',
405
+ required: true,
406
+ }),
407
+ sourceId: Property.ShortText({
408
+ displayName: 'Source ID',
409
+ description: 'Optional: 6 character ID provided by FIS',
410
+ required: false,
411
+ }),
412
+ // Required fields
413
+ branchNumber: Property.ShortText({
414
+ displayName: 'Branch Number',
415
+ description: 'Branch number (1-3 characters)',
416
+ required: true,
417
+ }),
418
+ boxNumber: Property.ShortText({
419
+ displayName: 'Box Number',
420
+ description: 'Box number (1-5 characters)',
421
+ required: true,
422
+ }),
423
+ accountNumber: Property.ShortText({
424
+ displayName: 'Account Number',
425
+ description: 'Box account number (1-10 characters)',
426
+ required: true,
427
+ }),
428
+ boxType: Property.ShortText({
429
+ displayName: 'Box Type',
430
+ description: 'Box Type populated from the BX01 transaction (1-3 characters)',
431
+ required: true,
432
+ }),
433
+ openDate: Property.Number({
434
+ displayName: 'Open Date',
435
+ description: 'A valid date less than or equal to current date (YYYYMMDD format)',
436
+ required: true,
437
+ }),
438
+ status: Property.StaticDropdown({
439
+ displayName: 'Status',
440
+ description: 'Box status',
441
+ required: true,
442
+ options: {
443
+ options: [
444
+ { label: 'D - Drill pending', value: 'D' },
445
+ { label: 'O - Out of service', value: 'O' },
446
+ { label: 'W - Pending activation', value: 'W' },
447
+ { label: '1 - Rented', value: '1' },
448
+ { label: '2 - Available', value: '2' },
449
+ { label: '9 - Deleted', value: '9' },
450
+ ],
451
+ },
452
+ }),
453
+ autodraftIncrement: Property.Number({
454
+ displayName: 'Autodraft Increment',
455
+ description: 'The number of months the safe deposit box is occupied (1-2 digits)',
456
+ required: true,
457
+ }),
458
+ generalLedgerType: Property.ShortText({
459
+ displayName: 'General Ledger Type',
460
+ description: 'Valid general ledger type (1-4 characters)',
461
+ required: true,
462
+ }),
463
+ automaticTransfer: Property.StaticDropdown({
464
+ displayName: 'Automatic Transfer',
465
+ description: 'Automatic transfer setting. If 5 or 9, auto transfer fields are populated',
466
+ required: true,
467
+ options: {
468
+ options: [
469
+ { label: 'N - No, Auto transfer disabled', value: 'N' },
470
+ { label: '5 - ATS, do not bill', value: '5' },
471
+ { label: '9 - ATS, send all bills', value: '9' },
472
+ ],
473
+ },
474
+ }),
475
+ customerId: Property.ShortText({
476
+ displayName: 'Customer ID',
477
+ description: 'The customer key from the customer record of primary account holder (up to 14 characters)',
478
+ required: true,
479
+ }),
480
+ // Optional fields
481
+ boxPrice: Property.Number({
482
+ displayName: 'Box Price',
483
+ description: 'Box Price (7 digits with 2 decimal places)',
484
+ required: false,
485
+ }),
486
+ discountCode: Property.ShortText({
487
+ displayName: 'Discount Code',
488
+ description: 'Box discount code (1 character)',
489
+ required: false,
490
+ }),
491
+ salesTax: Property.StaticDropdown({
492
+ displayName: 'Sales Tax',
493
+ description: 'Sales tax setting',
494
+ required: false,
495
+ options: {
496
+ options: [
497
+ { label: 'Use BCR default', value: '' },
498
+ { label: 'Y - Apply sales tax', value: 'Y' },
499
+ { label: 'N - Do not apply sales tax', value: 'N' },
500
+ ],
501
+ },
502
+ }),
503
+ dateLastPayment: Property.Number({
504
+ displayName: 'Date Last Payment',
505
+ description: 'Last pay date (YYYYMMDD format)',
506
+ required: false,
507
+ }),
508
+ dateNextPayment: Property.Number({
509
+ displayName: 'Date Next Payment',
510
+ description: 'A valid date in the future based on the payment contract (YYYYMMDD format)',
511
+ required: false,
512
+ }),
513
+ amountDue: Property.Number({
514
+ displayName: 'Amount Due',
515
+ description: 'Due amount represents the entire amount owed (7 digits with 2 decimal places)',
516
+ required: false,
517
+ }),
518
+ billDate: Property.Number({
519
+ displayName: 'Bill Date',
520
+ description: 'Billed to date represents the date thru which bills are generated (YYYYMMDD format)',
521
+ required: false,
522
+ }),
523
+ drillNoticeDate: Property.Number({
524
+ displayName: 'Drill Notice Date',
525
+ description: 'Drill notice date reflects the last time that the box had to be drilled to open (YYYYMMDD format)',
526
+ required: false,
527
+ }),
528
+ lastContactDate: Property.Number({
529
+ displayName: 'Last Contact Date',
530
+ description: 'Last date contact (YYYYMMDD format)',
531
+ required: false,
532
+ }),
533
+ abandonedPropFlag: Property.StaticDropdown({
534
+ displayName: 'Abandoned Property Flag',
535
+ description: 'Abandoned property flag',
536
+ required: false,
537
+ options: {
538
+ options: [
539
+ { label: 'Blank', value: '' },
540
+ { label: 'Y', value: 'Y' },
541
+ ],
542
+ },
543
+ }),
544
+ holdFlag: Property.StaticDropdown({
545
+ displayName: 'Hold Flag',
546
+ description: 'Hold flag',
547
+ required: false,
548
+ options: {
549
+ options: [
550
+ { label: 'Blank - No Hold', value: '' },
551
+ { label: 'D - Dormant', value: 'D' },
552
+ { label: 'F - Forced', value: 'F' },
553
+ { label: 'P - Past Due', value: 'P' },
554
+ { label: 'S - Surrendered', value: 'S' },
555
+ ],
556
+ },
557
+ }),
558
+ lastEntryDate: Property.Number({
559
+ displayName: 'Last Entry Date',
560
+ description: 'Date last entry (YYYYMMDD format)',
561
+ required: false,
562
+ }),
563
+ lastEntryCode: Property.StaticDropdown({
564
+ displayName: 'Last Entry Code',
565
+ description: 'Last entry code. Required if date last entry is a valid date',
566
+ required: false,
567
+ options: {
568
+ options: [
569
+ { label: 'Blank', value: '' },
570
+ { label: 'B - Bank', value: 'B' },
571
+ { label: 'C - Customer', value: 'C' },
572
+ { label: 'F - Force Entry', value: 'F' },
573
+ { label: 'L - Lost Key', value: 'L' },
574
+ ],
575
+ },
576
+ }),
577
+ numberBoxKeys: Property.Number({
578
+ displayName: 'Number of Box Keys',
579
+ description: 'Number of keys issued to the customer (1 digit)',
580
+ required: false,
581
+ }),
582
+ salesTaxDue: Property.Number({
583
+ displayName: 'Sales Tax Due',
584
+ description: 'Sales tax due (7 digits with 2 decimal places)',
585
+ required: false,
586
+ }),
587
+ // Auto Transfer fields
588
+ debitApplication: Property.StaticDropdown({
589
+ displayName: 'Debit Application',
590
+ description: 'Debit application (conditional for auto transfer)',
591
+ required: false,
592
+ options: {
593
+ options: [
594
+ { label: 'DD - Demand Deposit', value: 'DD' },
595
+ { label: 'GL - General Ledger', value: 'GL' },
596
+ { label: 'SV - Savings', value: 'SV' },
597
+ { label: 'Blank - Not a HORIZON account', value: '' },
598
+ ],
599
+ },
600
+ }),
601
+ debitAccount: Property.ShortText({
602
+ displayName: 'Debit Account',
603
+ description: 'Debit account number (up to 17 characters)',
604
+ required: false,
605
+ }),
606
+ generalLedgerBranch: Property.ShortText({
607
+ displayName: 'General Ledger Branch',
608
+ description: 'General ledger branch (up to 4 characters)',
609
+ required: false,
610
+ }),
611
+ generalLedgerCenter: Property.Number({
612
+ displayName: 'General Ledger Center',
613
+ description: 'General ledger center (up to 4 digits)',
614
+ required: false,
615
+ }),
616
+ externalDebit: Property.StaticDropdown({
617
+ displayName: 'External Debit',
618
+ description: 'External debit flag',
619
+ required: false,
620
+ options: {
621
+ options: [
622
+ { label: 'Y - External account', value: 'Y' },
623
+ { label: 'N - Not external account', value: 'N' },
624
+ ],
625
+ },
626
+ }),
627
+ individualIdentification: Property.ShortText({
628
+ displayName: 'Individual Identification',
629
+ description: 'Individual identification for external auto transfer (up to 15 characters)',
630
+ required: false,
631
+ }),
632
+ additionalInfo1: Property.ShortText({
633
+ displayName: 'Additional Info 1',
634
+ description: 'Additional information for external auto transfer (up to 40 characters)',
635
+ required: false,
636
+ }),
637
+ additionalInfo2: Property.ShortText({
638
+ displayName: 'Additional Info 2',
639
+ description: 'Additional information for external auto transfer (up to 40 characters)',
640
+ required: false,
641
+ }),
642
+ holdTransfer: Property.StaticDropdown({
643
+ displayName: 'Hold Transfer',
644
+ description: 'Hold flag for auto transfer',
645
+ required: false,
646
+ options: {
647
+ options: [
648
+ { label: 'N - No', value: 'N' },
649
+ { label: 'Y - Yes', value: 'Y' },
650
+ { label: 'O - Once', value: 'O' },
651
+ ],
652
+ },
653
+ }),
654
+ routingNumber: Property.ShortText({
655
+ displayName: 'Routing Number',
656
+ description: 'Routing and transit number for external account (9 characters)',
657
+ required: false,
658
+ }),
659
+ discretionaryData: Property.ShortText({
660
+ displayName: 'Discretionary Data',
661
+ description: 'Discretionary data for external auto transfer (up to 2 characters)',
662
+ required: false,
663
+ }),
664
+ transactionCode: Property.ShortText({
665
+ displayName: 'Transaction Code',
666
+ description: 'Transaction code for auto transfer (up to 4 characters)',
667
+ required: false,
668
+ }),
669
+ debitDescription: Property.ShortText({
670
+ displayName: 'Debit Description',
671
+ description: 'Debit description for auto transfer (up to 30 characters)',
672
+ required: false,
673
+ }),
674
+ creditDescription: Property.ShortText({
675
+ displayName: 'Credit Description',
676
+ description: 'Credit description for auto transfer (up to 30 characters)',
677
+ required: false,
678
+ }),
679
+ transferDescription: Property.ShortText({
680
+ displayName: 'Transfer Description',
681
+ description: 'Transfer description for auto transfer (up to 40 characters)',
682
+ required: false,
683
+ }),
684
+ amount: Property.Number({
685
+ displayName: 'Amount',
686
+ description: 'Amount of transfer (up to 15 digits)',
687
+ required: false,
688
+ }),
689
+ feeOption: Property.StaticDropdown({
690
+ displayName: 'Fee Option',
691
+ description: 'Fee option for auto transfer',
692
+ required: false,
693
+ options: {
694
+ options: [
695
+ { label: 'Y - Yes', value: 'Y' },
696
+ { label: 'N - No', value: 'N' },
697
+ ],
698
+ },
699
+ }),
700
+ frequencyTerm: Property.Number({
701
+ displayName: 'Frequency Term',
702
+ description: 'Number of months or days controlling the auto transfer (up to 3 digits)',
703
+ required: false,
704
+ }),
705
+ frequencyCode: Property.StaticDropdown({
706
+ displayName: 'Frequency Code',
707
+ description: 'Frequency code for auto transfer',
708
+ required: false,
709
+ options: {
710
+ options: [
711
+ { label: 'D - Days', value: 'D' },
712
+ { label: 'E - Month-end', value: 'E' },
713
+ { label: 'M - Months', value: 'M' },
714
+ ],
715
+ },
716
+ }),
717
+ noticeOption: Property.StaticDropdown({
718
+ displayName: 'Notice Option',
719
+ description: 'Notice option for auto transfer',
720
+ required: false,
721
+ options: {
722
+ options: [
723
+ { label: 'B - Both', value: 'B' },
724
+ { label: 'F - From Account', value: 'F' },
725
+ { label: 'I - NSF notice', value: 'I' },
726
+ { label: 'N - No', value: 'N' },
727
+ { label: 'T - To Account', value: 'T' },
728
+ ],
729
+ },
730
+ }),
731
+ nextTransferDate: Property.Number({
732
+ displayName: 'Next Transfer Date',
733
+ description: 'Next transfer date (YYYYMMDD format)',
734
+ required: false,
735
+ }),
736
+ endDate: Property.Number({
737
+ displayName: 'End Date',
738
+ description: 'End date for auto transfer (YYYYMMDD format)',
739
+ required: false,
740
+ }),
741
+ availableBalanceFlag: Property.StaticDropdown({
742
+ displayName: 'Available Balance Flag',
743
+ description: 'Available balance calculation for auto transfer',
744
+ required: false,
745
+ options: {
746
+ options: [
747
+ { label: '1 - Add RRS to Calculation', value: '1' },
748
+ { label: '2 - Add OD limit to Calc', value: '2' },
749
+ { label: '3 - Add RRS+OD Limit to calc', value: '3' },
750
+ { label: '4 - Do not add RRS+OD Limit to Calc', value: '4' },
751
+ { label: '5 - Include RRS and Dynamic Balance', value: '5' },
752
+ { label: '6 - Include OD Limit and Dynamic Balance', value: '6' },
753
+ { label: '7 - Include RRS, OD Limit and Dynamic Balance', value: '7' },
754
+ { label: '8 - Include Dynamic Balance Only', value: '8' },
755
+ ],
756
+ },
757
+ }),
758
+ achTransferRequestMethod: Property.StaticDropdown({
759
+ displayName: 'ACH Transfer Request Method',
760
+ description: 'ACH transfer request method. Required if External Debit is Y',
761
+ required: false,
762
+ options: {
763
+ options: [
764
+ { label: 'Blank - No external debit', value: '' },
765
+ { label: 'E - Electronically', value: 'E' },
766
+ { label: 'P - Person', value: 'P' },
767
+ { label: 'T - Telephone', value: 'T' },
768
+ ],
769
+ },
770
+ }),
771
+ lateChargePointer: Property.ShortText({
772
+ displayName: 'Late Charge Pointer',
773
+ description: 'Late charge pointer (up to 3 characters)',
774
+ required: false,
775
+ }),
776
+ lateChargesWaived: Property.Number({
777
+ displayName: 'Late Charges Waived',
778
+ description: 'Late charges waived life to date (7 digits with 2 decimal places)',
779
+ required: false,
780
+ }),
781
+ feeWaived: Property.Number({
782
+ displayName: 'Fee Waived',
783
+ description: 'Fee waived life to date (7 digits with 2 decimal places)',
784
+ required: false,
785
+ }),
786
+ applyFeeTaxOverrideFlag: Property.StaticDropdown({
787
+ displayName: 'Apply Fee Tax Override Flag',
788
+ description: 'Apply fee tax override flag',
789
+ required: false,
790
+ options: {
791
+ options: [
792
+ { label: 'Blank - Use bank control default', value: '' },
793
+ { label: 'N - Do not apply tax to fees', value: 'N' },
794
+ { label: 'Y - Apply tax to fees', value: 'Y' },
795
+ ],
796
+ },
797
+ }),
798
+ },
799
+ async run(context) {
800
+ const auth = context.auth as any;
801
+ const baseUrl = auth['baseUrl'];
802
+ const organizationId = auth['organizationId'];
803
+ const { xAuthorization, sourceId, ...bodyProps } = context.propsValue;
804
+
805
+ const uuid = crypto.randomUUID();
806
+
807
+ const headers: Record<string, string> = {
808
+ 'accept': 'application/json',
809
+ 'Content-Type': 'application/json',
810
+ 'organization-id': organizationId,
811
+ 'uuid': uuid,
812
+ 'horizon-authorization': xAuthorization,
813
+ };
814
+
815
+ if (sourceId) {
816
+ headers['source-id'] = sourceId;
817
+ }
818
+
819
+ // Build request body with only defined values
820
+ const body: Record<string, unknown> = {};
821
+
822
+ // Required fields
823
+ body['branchNumber'] = bodyProps.branchNumber;
824
+ body['boxNumber'] = bodyProps.boxNumber;
825
+ body['accountNumber'] = bodyProps.accountNumber;
826
+ body['boxType'] = bodyProps.boxType;
827
+ body['openDate'] = bodyProps.openDate;
828
+ body['status'] = bodyProps.status;
829
+ body['autodraftIncrement'] = bodyProps.autodraftIncrement;
830
+ body['generalLedgerType'] = bodyProps.generalLedgerType;
831
+ body['automaticTransfer'] = bodyProps.automaticTransfer;
832
+ body['customerId'] = bodyProps.customerId;
833
+
834
+ // Optional fields - only add if defined
835
+ if (bodyProps.boxPrice !== undefined && bodyProps.boxPrice !== null) {
836
+ body['boxPrice'] = bodyProps.boxPrice;
837
+ }
838
+ if (bodyProps.discountCode) {
839
+ body['discountCode'] = bodyProps.discountCode;
840
+ }
841
+ if (bodyProps.salesTax !== undefined) {
842
+ body['salesTax'] = bodyProps.salesTax;
843
+ }
844
+ if (bodyProps.dateLastPayment !== undefined && bodyProps.dateLastPayment !== null) {
845
+ body['dateLastPayment'] = bodyProps.dateLastPayment;
846
+ }
847
+ if (bodyProps.dateNextPayment !== undefined && bodyProps.dateNextPayment !== null) {
848
+ body['dateNextPayment'] = bodyProps.dateNextPayment;
849
+ }
850
+ if (bodyProps.amountDue !== undefined && bodyProps.amountDue !== null) {
851
+ body['amountDue'] = bodyProps.amountDue;
852
+ }
853
+ if (bodyProps.billDate !== undefined && bodyProps.billDate !== null) {
854
+ body['billDate'] = bodyProps.billDate;
855
+ }
856
+ if (bodyProps.drillNoticeDate !== undefined && bodyProps.drillNoticeDate !== null) {
857
+ body['drillNoticeDate'] = bodyProps.drillNoticeDate;
858
+ }
859
+ if (bodyProps.lastContactDate !== undefined && bodyProps.lastContactDate !== null) {
860
+ body['lastContactDate'] = bodyProps.lastContactDate;
861
+ }
862
+ if (bodyProps.abandonedPropFlag !== undefined) {
863
+ body['abandonedPropFlag'] = bodyProps.abandonedPropFlag;
864
+ }
865
+ if (bodyProps.holdFlag !== undefined) {
866
+ body['holdFlag'] = bodyProps.holdFlag;
867
+ }
868
+ if (bodyProps.lastEntryDate !== undefined && bodyProps.lastEntryDate !== null) {
869
+ body['lastEntryDate'] = bodyProps.lastEntryDate;
870
+ }
871
+ if (bodyProps.lastEntryCode !== undefined) {
872
+ body['lastEntryCode'] = bodyProps.lastEntryCode;
873
+ }
874
+ if (bodyProps.numberBoxKeys !== undefined && bodyProps.numberBoxKeys !== null) {
875
+ body['numberBoxKeys'] = bodyProps.numberBoxKeys;
876
+ }
877
+ if (bodyProps.salesTaxDue !== undefined && bodyProps.salesTaxDue !== null) {
878
+ body['salesTaxDue'] = bodyProps.salesTaxDue;
879
+ }
880
+ if (bodyProps.debitApplication !== undefined) {
881
+ body['debitApplication'] = bodyProps.debitApplication;
882
+ }
883
+ if (bodyProps.debitAccount) {
884
+ body['debitAccount'] = bodyProps.debitAccount;
885
+ }
886
+ if (bodyProps.generalLedgerBranch) {
887
+ body['generalLedgerBranch'] = bodyProps.generalLedgerBranch;
888
+ }
889
+ if (bodyProps.generalLedgerCenter !== undefined && bodyProps.generalLedgerCenter !== null) {
890
+ body['generalLedgerCenter'] = bodyProps.generalLedgerCenter;
891
+ }
892
+ if (bodyProps.externalDebit) {
893
+ body['externalDebit'] = bodyProps.externalDebit;
894
+ }
895
+ if (bodyProps.individualIdentification) {
896
+ body['individualIdentification'] = bodyProps.individualIdentification;
897
+ }
898
+ if (bodyProps.additionalInfo1) {
899
+ body['additionalInfo1'] = bodyProps.additionalInfo1;
900
+ }
901
+ if (bodyProps.additionalInfo2) {
902
+ body['additionalInfo2'] = bodyProps.additionalInfo2;
903
+ }
904
+ if (bodyProps.holdTransfer) {
905
+ body['holdTransfer'] = bodyProps.holdTransfer;
906
+ }
907
+ if (bodyProps.routingNumber) {
908
+ body['routingNumber'] = bodyProps.routingNumber;
909
+ }
910
+ if (bodyProps.discretionaryData) {
911
+ body['discretionaryData'] = bodyProps.discretionaryData;
912
+ }
913
+ if (bodyProps.transactionCode) {
914
+ body['transactionCode'] = bodyProps.transactionCode;
915
+ }
916
+ if (bodyProps.debitDescription) {
917
+ body['debitDescription'] = bodyProps.debitDescription;
918
+ }
919
+ if (bodyProps.creditDescription) {
920
+ body['creditDescription'] = bodyProps.creditDescription;
921
+ }
922
+ if (bodyProps.transferDescription) {
923
+ body['transferDescription'] = bodyProps.transferDescription;
924
+ }
925
+ if (bodyProps.amount !== undefined && bodyProps.amount !== null) {
926
+ body['amount'] = bodyProps.amount;
927
+ }
928
+ if (bodyProps.feeOption) {
929
+ body['feeOption'] = bodyProps.feeOption;
930
+ }
931
+ if (bodyProps.frequencyTerm !== undefined && bodyProps.frequencyTerm !== null) {
932
+ body['frequencyTerm'] = bodyProps.frequencyTerm;
933
+ }
934
+ if (bodyProps.frequencyCode) {
935
+ body['frequencyCode'] = bodyProps.frequencyCode;
936
+ }
937
+ if (bodyProps.noticeOption) {
938
+ body['noticeOption'] = bodyProps.noticeOption;
939
+ }
940
+ if (bodyProps.nextTransferDate !== undefined && bodyProps.nextTransferDate !== null) {
941
+ body['nextTransferDate'] = bodyProps.nextTransferDate;
942
+ }
943
+ if (bodyProps.endDate !== undefined && bodyProps.endDate !== null) {
944
+ body['endDate'] = bodyProps.endDate;
945
+ }
946
+ if (bodyProps.availableBalanceFlag) {
947
+ body['availableBalanceFlag'] = bodyProps.availableBalanceFlag;
948
+ }
949
+ if (bodyProps.achTransferRequestMethod !== undefined) {
950
+ body['achTransferRequestMethod'] = bodyProps.achTransferRequestMethod;
951
+ }
952
+ if (bodyProps.lateChargePointer) {
953
+ body['lateChargePointer'] = bodyProps.lateChargePointer;
954
+ }
955
+ if (bodyProps.lateChargesWaived !== undefined && bodyProps.lateChargesWaived !== null) {
956
+ body['lateChargesWaived'] = bodyProps.lateChargesWaived;
957
+ }
958
+ if (bodyProps.feeWaived !== undefined && bodyProps.feeWaived !== null) {
959
+ body['feeWaived'] = bodyProps.feeWaived;
960
+ }
961
+ if (bodyProps.applyFeeTaxOverrideFlag !== undefined) {
962
+ body['applyFeeTaxOverrideFlag'] = bodyProps.applyFeeTaxOverrideFlag;
963
+ }
964
+
965
+ const response = await httpClient.sendRequest({
966
+ method: HttpMethod.PUT,
967
+ url: `${baseUrl}/safe-deposit/v1/accounts/safe-deposit-box`,
968
+ headers,
969
+ body,
970
+ });
971
+
972
+ return response.body;
973
+ },
974
+ });
975
+
976
+ /**
977
+ * Safe Deposit - Box Add
978
+ * POST /accounts/safe-deposit-box
979
+ * Add a safe deposit box account
980
+ */
981
+ export const safe_deposit_box_add = createAction({
982
+ name: 'safe_deposit_box_add',
983
+ auth: fisHorizonAuth,
984
+ displayName: 'Safe Deposit - Box Add',
985
+ description: 'Add a safe deposit box account',
986
+ props: {
987
+ xAuthorization: Property.ShortText({
988
+ displayName: 'Authorization Token',
989
+ description: 'The authorization token obtained from the Get Token endpoint',
990
+ required: true,
991
+ }),
992
+ sourceId: Property.ShortText({
993
+ displayName: 'Source ID',
994
+ description: 'Optional: 6 character ID provided by FIS',
995
+ required: false,
996
+ }),
997
+ // Required fields
998
+ branchNumber: Property.ShortText({
999
+ displayName: 'Branch Number',
1000
+ description: 'Branch number (1-3 characters)',
1001
+ required: true,
1002
+ }),
1003
+ boxNumber: Property.ShortText({
1004
+ displayName: 'Box Number',
1005
+ description: 'Box number (1-5 characters)',
1006
+ required: true,
1007
+ }),
1008
+ accountNumber: Property.ShortText({
1009
+ displayName: 'Account Number',
1010
+ description: 'Box account number (1-10 characters)',
1011
+ required: true,
1012
+ }),
1013
+ boxType: Property.ShortText({
1014
+ displayName: 'Box Type',
1015
+ description: 'Box Type populated from the BX01 transaction (1-3 characters)',
1016
+ required: true,
1017
+ }),
1018
+ openDate: Property.Number({
1019
+ displayName: 'Open Date',
1020
+ description: 'A valid date less than or equal to current date (YYYYMMDD format)',
1021
+ required: true,
1022
+ }),
1023
+ status: Property.StaticDropdown({
1024
+ displayName: 'Status',
1025
+ description: 'Status for adding a safe deposit box',
1026
+ required: true,
1027
+ options: {
1028
+ options: [
1029
+ { label: '1 - Rented', value: '1' },
1030
+ ],
1031
+ },
1032
+ defaultValue: '1',
1033
+ }),
1034
+ autodraftIncrement: Property.Number({
1035
+ displayName: 'Autodraft Increment',
1036
+ description: 'The number of months the safe deposit box is occupied (1-2 digits)',
1037
+ required: true,
1038
+ }),
1039
+ generalLedgerType: Property.ShortText({
1040
+ displayName: 'General Ledger Type',
1041
+ description: 'Valid general ledger type (1-4 characters)',
1042
+ required: true,
1043
+ }),
1044
+ automaticTransfer: Property.StaticDropdown({
1045
+ displayName: 'Automatic Transfer',
1046
+ description: 'Automatic transfer setting. If 5 or 9, auto transfer fields must be populated',
1047
+ required: true,
1048
+ options: {
1049
+ options: [
1050
+ { label: 'N - No, Auto transfer disabled', value: 'N' },
1051
+ { label: '5 - ATS, do not bill', value: '5' },
1052
+ { label: '9 - ATS, send all bills', value: '9' },
1053
+ ],
1054
+ },
1055
+ }),
1056
+ customerId: Property.ShortText({
1057
+ displayName: 'Customer ID',
1058
+ description: 'The customer key from the customer record of primary account holder (up to 14 characters)',
1059
+ required: true,
1060
+ }),
1061
+ // Optional fields
1062
+ boxPrice: Property.Number({
1063
+ displayName: 'Box Price',
1064
+ description: 'Box Price Filler (7 digits with 2 decimal places)',
1065
+ required: false,
1066
+ }),
1067
+ discountCode: Property.ShortText({
1068
+ displayName: 'Discount Code',
1069
+ description: 'Box discount code (1 character)',
1070
+ required: false,
1071
+ }),
1072
+ salesTax: Property.StaticDropdown({
1073
+ displayName: 'Sales Tax',
1074
+ description: 'Sales tax setting',
1075
+ required: false,
1076
+ options: {
1077
+ options: [
1078
+ { label: 'Use BCR default', value: '' },
1079
+ { label: 'Y - Apply sales tax', value: 'Y' },
1080
+ { label: 'N - Do not apply sales tax', value: 'N' },
1081
+ ],
1082
+ },
1083
+ }),
1084
+ dateLastPayment: Property.Number({
1085
+ displayName: 'Date Last Payment',
1086
+ description: 'Last pay date (YYYYMMDD format)',
1087
+ required: false,
1088
+ }),
1089
+ dateNextPayment: Property.Number({
1090
+ displayName: 'Date Next Payment',
1091
+ description: 'A valid date in the future based on the payment contract (YYYYMMDD format)',
1092
+ required: false,
1093
+ }),
1094
+ lastContactDate: Property.Number({
1095
+ displayName: 'Last Contact Date',
1096
+ description: 'Last date contact (YYYYMMDD format)',
1097
+ required: false,
1098
+ }),
1099
+ abandonedPropFlag: Property.StaticDropdown({
1100
+ displayName: 'Abandoned Property Flag',
1101
+ description: 'Abandoned property flag',
1102
+ required: false,
1103
+ options: {
1104
+ options: [
1105
+ { label: 'Blank', value: '' },
1106
+ { label: 'Y', value: 'Y' },
1107
+ ],
1108
+ },
1109
+ }),
1110
+ holdFlag: Property.ShortText({
1111
+ displayName: 'Hold Flag',
1112
+ description: 'Hold flag to add a safe deposit box (filled with 1 for Rented)',
1113
+ required: false,
1114
+ }),
1115
+ lastEntryDate: Property.Number({
1116
+ displayName: 'Last Entry Date',
1117
+ description: 'Date last entry (YYYYMMDD format)',
1118
+ required: false,
1119
+ }),
1120
+ lastEntryCode: Property.StaticDropdown({
1121
+ displayName: 'Last Entry Code',
1122
+ description: 'Last entry code. Required if date last entry is a valid date',
1123
+ required: false,
1124
+ options: {
1125
+ options: [
1126
+ { label: 'Blank', value: '' },
1127
+ { label: 'B - Bank', value: 'B' },
1128
+ { label: 'C - Customer', value: 'C' },
1129
+ { label: 'F - Force Entry', value: 'F' },
1130
+ { label: 'L - Lost Key', value: 'L' },
1131
+ ],
1132
+ },
1133
+ }),
1134
+ numberBoxKeys: Property.Number({
1135
+ displayName: 'Number of Box Keys',
1136
+ description: 'Number of keys issued to the customer (1 digit)',
1137
+ required: false,
1138
+ }),
1139
+ salesTaxDue: Property.Number({
1140
+ displayName: 'Sales Tax Due',
1141
+ description: 'Sales tax due (7 digits with 2 decimal places)',
1142
+ required: false,
1143
+ }),
1144
+ // Auto Transfer fields
1145
+ debitApplication: Property.StaticDropdown({
1146
+ displayName: 'Debit Application',
1147
+ description: 'Debit application (conditional for auto transfer)',
1148
+ required: false,
1149
+ options: {
1150
+ options: [
1151
+ { label: 'DD - Demand Deposit', value: 'DD' },
1152
+ { label: 'GL - General Ledger', value: 'GL' },
1153
+ { label: 'SV - Savings', value: 'SV' },
1154
+ { label: 'Blank - Not a HORIZON account', value: '' },
1155
+ ],
1156
+ },
1157
+ }),
1158
+ debitAccount: Property.ShortText({
1159
+ displayName: 'Debit Account',
1160
+ description: 'Debit account number (up to 17 characters)',
1161
+ required: false,
1162
+ }),
1163
+ generalLedgerBranch: Property.ShortText({
1164
+ displayName: 'General Ledger Branch',
1165
+ description: 'General ledger branch (up to 4 characters)',
1166
+ required: false,
1167
+ }),
1168
+ generalLedgerCenter: Property.Number({
1169
+ displayName: 'General Ledger Center',
1170
+ description: 'General ledger center (up to 4 digits)',
1171
+ required: false,
1172
+ }),
1173
+ externalDebit: Property.StaticDropdown({
1174
+ displayName: 'External Debit',
1175
+ description: 'External debit flag (Y if debit is to external account)',
1176
+ required: false,
1177
+ options: {
1178
+ options: [
1179
+ { label: 'Y - External account', value: 'Y' },
1180
+ { label: 'N - Not external account', value: 'N' },
1181
+ ],
1182
+ },
1183
+ }),
1184
+ individualIdentification: Property.ShortText({
1185
+ displayName: 'Individual Identification',
1186
+ description: 'Individual identification for external auto transfer (up to 15 characters)',
1187
+ required: false,
1188
+ }),
1189
+ additionalInfo1: Property.ShortText({
1190
+ displayName: 'Additional Info 1',
1191
+ description: 'Additional information for external auto transfer (up to 40 characters)',
1192
+ required: false,
1193
+ }),
1194
+ additionalInfo2: Property.ShortText({
1195
+ displayName: 'Additional Info 2',
1196
+ description: 'Additional information for external auto transfer (up to 40 characters)',
1197
+ required: false,
1198
+ }),
1199
+ holdTransfer: Property.StaticDropdown({
1200
+ displayName: 'Hold Transfer',
1201
+ description: 'Hold flag for auto transfer',
1202
+ required: false,
1203
+ options: {
1204
+ options: [
1205
+ { label: 'N - No', value: 'N' },
1206
+ { label: 'Y - Yes', value: 'Y' },
1207
+ { label: 'O - Once', value: 'O' },
1208
+ ],
1209
+ },
1210
+ }),
1211
+ routingNumber: Property.ShortText({
1212
+ displayName: 'Routing Number',
1213
+ description: 'Routing and transit number for external account (9 characters)',
1214
+ required: false,
1215
+ }),
1216
+ discretionaryData: Property.ShortText({
1217
+ displayName: 'Discretionary Data',
1218
+ description: 'Discretionary data for external auto transfer (up to 2 characters)',
1219
+ required: false,
1220
+ }),
1221
+ transactionCode: Property.ShortText({
1222
+ displayName: 'Transaction Code',
1223
+ description: 'Transaction code for auto transfer (up to 4 characters)',
1224
+ required: false,
1225
+ }),
1226
+ debitDescription: Property.ShortText({
1227
+ displayName: 'Debit Description',
1228
+ description: 'Debit description for auto transfer (up to 30 characters)',
1229
+ required: false,
1230
+ }),
1231
+ creditDescription: Property.ShortText({
1232
+ displayName: 'Credit Description',
1233
+ description: 'Credit description for auto transfer (up to 30 characters)',
1234
+ required: false,
1235
+ }),
1236
+ transferDescription: Property.ShortText({
1237
+ displayName: 'Transfer Description',
1238
+ description: 'Transfer description for auto transfer (up to 40 characters)',
1239
+ required: false,
1240
+ }),
1241
+ amount: Property.Number({
1242
+ displayName: 'Amount',
1243
+ description: 'Amount of transfer (up to 15 digits)',
1244
+ required: false,
1245
+ }),
1246
+ feeOption: Property.StaticDropdown({
1247
+ displayName: 'Fee Option',
1248
+ description: 'Fee option for auto transfer',
1249
+ required: false,
1250
+ options: {
1251
+ options: [
1252
+ { label: 'Y - Yes', value: 'Y' },
1253
+ { label: 'N - No', value: 'N' },
1254
+ ],
1255
+ },
1256
+ }),
1257
+ frequencyTerm: Property.Number({
1258
+ displayName: 'Frequency Term',
1259
+ description: 'Number of months or days controlling the auto transfer (up to 3 digits)',
1260
+ required: false,
1261
+ }),
1262
+ frequencyCode: Property.StaticDropdown({
1263
+ displayName: 'Frequency Code',
1264
+ description: 'Frequency code for auto transfer',
1265
+ required: false,
1266
+ options: {
1267
+ options: [
1268
+ { label: 'D - Days', value: 'D' },
1269
+ { label: 'E - Month-end', value: 'E' },
1270
+ { label: 'M - Months', value: 'M' },
1271
+ ],
1272
+ },
1273
+ }),
1274
+ noticeOption: Property.StaticDropdown({
1275
+ displayName: 'Notice Option',
1276
+ description: 'Notice option for auto transfer',
1277
+ required: false,
1278
+ options: {
1279
+ options: [
1280
+ { label: 'B - Both', value: 'B' },
1281
+ { label: 'F - From Account', value: 'F' },
1282
+ { label: 'I - NSF notice', value: 'I' },
1283
+ { label: 'N - No', value: 'N' },
1284
+ { label: 'T - To Account', value: 'T' },
1285
+ ],
1286
+ },
1287
+ }),
1288
+ nextTransferDate: Property.Number({
1289
+ displayName: 'Next Transfer Date',
1290
+ description: 'Next transfer date (YYYYMMDD format)',
1291
+ required: false,
1292
+ }),
1293
+ endDate: Property.Number({
1294
+ displayName: 'End Date',
1295
+ description: 'End date for auto transfer (YYYYMMDD format)',
1296
+ required: false,
1297
+ }),
1298
+ availableBalanceFlag: Property.StaticDropdown({
1299
+ displayName: 'Available Balance Flag',
1300
+ description: 'Available balance calculation for auto transfer',
1301
+ required: false,
1302
+ options: {
1303
+ options: [
1304
+ { label: '1 - Add RRS to Calculation', value: '1' },
1305
+ { label: '2 - Add OD limit to Calc', value: '2' },
1306
+ { label: '3 - Add RRS+OD Limit to calc', value: '3' },
1307
+ { label: '4 - Do not add RRS+OD Limit to Calc', value: '4' },
1308
+ { label: '5 - Include RRS and Dynamic Balance', value: '5' },
1309
+ { label: '6 - Include OD Limit and Dynamic Balance', value: '6' },
1310
+ { label: '7 - Include RRS, OD Limit and Dynamic Balance', value: '7' },
1311
+ { label: '8 - Include Dynamic Balance Only', value: '8' },
1312
+ ],
1313
+ },
1314
+ }),
1315
+ achTransferRequestMethod: Property.StaticDropdown({
1316
+ displayName: 'ACH Transfer Request Method',
1317
+ description: 'ACH transfer request method. Required if External Debit is Y',
1318
+ required: false,
1319
+ options: {
1320
+ options: [
1321
+ { label: 'Blank - No external debit', value: '' },
1322
+ { label: 'E - Electronically', value: 'E' },
1323
+ { label: 'P - Person', value: 'P' },
1324
+ { label: 'T - Telephone', value: 'T' },
1325
+ ],
1326
+ },
1327
+ }),
1328
+ lateChargePointer: Property.ShortText({
1329
+ displayName: 'Late Charge Pointer',
1330
+ description: 'Late charge pointer (up to 3 characters). Defaults to value from Box Type in bank control if not sent',
1331
+ required: false,
1332
+ }),
1333
+ applyFeeTaxOverrideFlag: Property.StaticDropdown({
1334
+ displayName: 'Apply Fee Tax Override Flag',
1335
+ description: 'Apply fee tax override flag',
1336
+ required: false,
1337
+ options: {
1338
+ options: [
1339
+ { label: 'Blank - Use bank control default', value: '' },
1340
+ { label: 'N - Do not apply tax to fees', value: 'N' },
1341
+ { label: 'Y - Apply tax to fees', value: 'Y' },
1342
+ ],
1343
+ },
1344
+ }),
1345
+ },
1346
+ async run(context) {
1347
+ const auth = context.auth as any;
1348
+ const baseUrl = auth['baseUrl'];
1349
+ const organizationId = auth['organizationId'];
1350
+ const { xAuthorization, sourceId, ...bodyProps } = context.propsValue;
1351
+
1352
+ const uuid = crypto.randomUUID();
1353
+
1354
+ const headers: Record<string, string> = {
1355
+ 'accept': 'application/json',
1356
+ 'Content-Type': 'application/json',
1357
+ 'organization-id': organizationId,
1358
+ 'uuid': uuid,
1359
+ 'horizon-authorization': xAuthorization,
1360
+ };
1361
+
1362
+ if (sourceId) {
1363
+ headers['source-id'] = sourceId;
1364
+ }
1365
+
1366
+ // Build request body with only defined values
1367
+ const body: Record<string, unknown> = {};
1368
+
1369
+ // Required fields
1370
+ body['branchNumber'] = bodyProps.branchNumber;
1371
+ body['boxNumber'] = bodyProps.boxNumber;
1372
+ body['accountNumber'] = bodyProps.accountNumber;
1373
+ body['boxType'] = bodyProps.boxType;
1374
+ body['openDate'] = bodyProps.openDate;
1375
+ body['status'] = bodyProps.status;
1376
+ body['autodraftIncrement'] = bodyProps.autodraftIncrement;
1377
+ body['generalLedgerType'] = bodyProps.generalLedgerType;
1378
+ body['automaticTransfer'] = bodyProps.automaticTransfer;
1379
+ body['customerId'] = bodyProps.customerId;
1380
+
1381
+ // Optional fields - only add if defined
1382
+ if (bodyProps.boxPrice !== undefined && bodyProps.boxPrice !== null) {
1383
+ body['boxPrice'] = bodyProps.boxPrice;
1384
+ }
1385
+ if (bodyProps.discountCode) {
1386
+ body['discountCode'] = bodyProps.discountCode;
1387
+ }
1388
+ if (bodyProps.salesTax !== undefined) {
1389
+ body['salesTax'] = bodyProps.salesTax;
1390
+ }
1391
+ if (bodyProps.dateLastPayment !== undefined && bodyProps.dateLastPayment !== null) {
1392
+ body['dateLastPayment'] = bodyProps.dateLastPayment;
1393
+ }
1394
+ if (bodyProps.dateNextPayment !== undefined && bodyProps.dateNextPayment !== null) {
1395
+ body['dateNextPayment'] = bodyProps.dateNextPayment;
1396
+ }
1397
+ if (bodyProps.lastContactDate !== undefined && bodyProps.lastContactDate !== null) {
1398
+ body['lastContactDate'] = bodyProps.lastContactDate;
1399
+ }
1400
+ if (bodyProps.abandonedPropFlag !== undefined) {
1401
+ body['abandonedPropFlag'] = bodyProps.abandonedPropFlag;
1402
+ }
1403
+ if (bodyProps.holdFlag) {
1404
+ body['holdFlag'] = bodyProps.holdFlag;
1405
+ }
1406
+ if (bodyProps.lastEntryDate !== undefined && bodyProps.lastEntryDate !== null) {
1407
+ body['lastEntryDate'] = bodyProps.lastEntryDate;
1408
+ }
1409
+ if (bodyProps.lastEntryCode !== undefined) {
1410
+ body['lastEntryCode'] = bodyProps.lastEntryCode;
1411
+ }
1412
+ if (bodyProps.numberBoxKeys !== undefined && bodyProps.numberBoxKeys !== null) {
1413
+ body['numberBoxKeys'] = bodyProps.numberBoxKeys;
1414
+ }
1415
+ if (bodyProps.salesTaxDue !== undefined && bodyProps.salesTaxDue !== null) {
1416
+ body['salesTaxDue'] = bodyProps.salesTaxDue;
1417
+ }
1418
+ if (bodyProps.debitApplication !== undefined) {
1419
+ body['debitApplication'] = bodyProps.debitApplication;
1420
+ }
1421
+ if (bodyProps.debitAccount) {
1422
+ body['debitAccount'] = bodyProps.debitAccount;
1423
+ }
1424
+ if (bodyProps.generalLedgerBranch) {
1425
+ body['generalLedgerBranch'] = bodyProps.generalLedgerBranch;
1426
+ }
1427
+ if (bodyProps.generalLedgerCenter !== undefined && bodyProps.generalLedgerCenter !== null) {
1428
+ body['generalLedgerCenter'] = bodyProps.generalLedgerCenter;
1429
+ }
1430
+ if (bodyProps.externalDebit) {
1431
+ body['externalDebit'] = bodyProps.externalDebit;
1432
+ }
1433
+ if (bodyProps.individualIdentification) {
1434
+ body['individualIdentification'] = bodyProps.individualIdentification;
1435
+ }
1436
+ if (bodyProps.additionalInfo1) {
1437
+ body['additionalInfo1'] = bodyProps.additionalInfo1;
1438
+ }
1439
+ if (bodyProps.additionalInfo2) {
1440
+ body['additionalInfo2'] = bodyProps.additionalInfo2;
1441
+ }
1442
+ if (bodyProps.holdTransfer) {
1443
+ body['holdTransfer'] = bodyProps.holdTransfer;
1444
+ }
1445
+ if (bodyProps.routingNumber) {
1446
+ body['routingNumber'] = bodyProps.routingNumber;
1447
+ }
1448
+ if (bodyProps.discretionaryData) {
1449
+ body['discretionaryData'] = bodyProps.discretionaryData;
1450
+ }
1451
+ if (bodyProps.transactionCode) {
1452
+ body['transactionCode'] = bodyProps.transactionCode;
1453
+ }
1454
+ if (bodyProps.debitDescription) {
1455
+ body['debitDescription'] = bodyProps.debitDescription;
1456
+ }
1457
+ if (bodyProps.creditDescription) {
1458
+ body['creditDescription'] = bodyProps.creditDescription;
1459
+ }
1460
+ if (bodyProps.transferDescription) {
1461
+ body['transferDescription'] = bodyProps.transferDescription;
1462
+ }
1463
+ if (bodyProps.amount !== undefined && bodyProps.amount !== null) {
1464
+ body['amount'] = bodyProps.amount;
1465
+ }
1466
+ if (bodyProps.feeOption) {
1467
+ body['feeOption'] = bodyProps.feeOption;
1468
+ }
1469
+ if (bodyProps.frequencyTerm !== undefined && bodyProps.frequencyTerm !== null) {
1470
+ body['frequencyTerm'] = bodyProps.frequencyTerm;
1471
+ }
1472
+ if (bodyProps.frequencyCode) {
1473
+ body['frequencyCode'] = bodyProps.frequencyCode;
1474
+ }
1475
+ if (bodyProps.noticeOption) {
1476
+ body['noticeOption'] = bodyProps.noticeOption;
1477
+ }
1478
+ if (bodyProps.nextTransferDate !== undefined && bodyProps.nextTransferDate !== null) {
1479
+ body['nextTransferDate'] = bodyProps.nextTransferDate;
1480
+ }
1481
+ if (bodyProps.endDate !== undefined && bodyProps.endDate !== null) {
1482
+ body['endDate'] = bodyProps.endDate;
1483
+ }
1484
+ if (bodyProps.availableBalanceFlag) {
1485
+ body['availableBalanceFlag'] = bodyProps.availableBalanceFlag;
1486
+ }
1487
+ if (bodyProps.achTransferRequestMethod !== undefined) {
1488
+ body['achTransferRequestMethod'] = bodyProps.achTransferRequestMethod;
1489
+ }
1490
+ if (bodyProps.lateChargePointer !== undefined) {
1491
+ body['lateChargePointer'] = bodyProps.lateChargePointer;
1492
+ }
1493
+ if (bodyProps.applyFeeTaxOverrideFlag !== undefined) {
1494
+ body['applyFeeTaxOverrideFlag'] = bodyProps.applyFeeTaxOverrideFlag;
1495
+ }
1496
+
1497
+ const response = await httpClient.sendRequest({
1498
+ method: HttpMethod.POST,
1499
+ url: `${baseUrl}/safe-deposit/v1/accounts/safe-deposit-box`,
1500
+ headers,
1501
+ body,
1502
+ });
1503
+
1504
+ return response.body;
1505
+ },
1506
+ });