@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,902 @@
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
+ // POST Add Loan Account
10
+ // ============================================================================
11
+ /**
12
+ * Loans - Add Loan Account
13
+ * POST /accounts/loans
14
+ * Add a new loan account. Before executing this transaction, the customer and
15
+ * account number must exist in Relationship Management.
16
+ */
17
+ export const loans_add = createAction({
18
+ name: 'loans_add',
19
+ auth: fisHorizonAuth,
20
+ displayName: 'Loans - Add Loan Account',
21
+ description: 'Add a new loan account. Before executing this transaction, the customer and account number must exist in Relationship Management.',
22
+ props: {
23
+ xAuthorization: Property.ShortText({
24
+ displayName: 'Authorization Token',
25
+ description: 'The authorization token obtained from the Get Token endpoint',
26
+ required: true,
27
+ }),
28
+ sourceId: Property.ShortText({
29
+ displayName: 'Source ID',
30
+ description: 'Optional: 6 character ID provided by FIS',
31
+ required: false,
32
+ }),
33
+ // ==========================================================================
34
+ // Base Loan Information (Required)
35
+ // ==========================================================================
36
+ productType: Property.ShortText({
37
+ displayName: 'Product Type',
38
+ description: 'Product Code (max 3 characters). User Defined.',
39
+ required: true,
40
+ }),
41
+ accountNumber: Property.ShortText({
42
+ displayName: 'Account Number',
43
+ description: 'Account number (max 10 characters).',
44
+ required: true,
45
+ }),
46
+ customerId: Property.ShortText({
47
+ displayName: 'Customer ID',
48
+ description: 'Customer Number. Right-justified, zero filled (max 14 characters).',
49
+ required: true,
50
+ }),
51
+ branchNumber: Property.ShortText({
52
+ displayName: 'Branch Number',
53
+ description: 'Branch Number (max 3 characters).',
54
+ required: true,
55
+ }),
56
+ systemType: Property.StaticDropdown({
57
+ displayName: 'System Type',
58
+ description: 'The type of loan system.',
59
+ required: true,
60
+ options: {
61
+ options: [
62
+ { label: '1 - Note', value: '1' },
63
+ { label: '2 - Commitment', value: '2' },
64
+ { label: '3 - Line of Credit', value: '3' },
65
+ { label: '4 - Letter of Credit', value: '4' },
66
+ { label: '5 - Revolving Line of Credit', value: '5' },
67
+ ],
68
+ },
69
+ }),
70
+ generalLedgerType: Property.ShortText({
71
+ displayName: 'General Ledger Type',
72
+ description: 'The general ledger type (4 digits, 0001-9999). Identifies the GL interface account in HORIZON General Ledger.',
73
+ required: true,
74
+ }),
75
+ applicationCode: Property.StaticDropdown({
76
+ displayName: 'Application Code',
77
+ description: 'The application code for the loan.',
78
+ required: true,
79
+ options: {
80
+ options: [
81
+ { label: 'CC - Charge off-Commercial Loan', value: 'CC' },
82
+ { label: 'CI - Charge off-Installment Loan', value: 'CI' },
83
+ { label: 'CL - Commercial Loans', value: 'CL' },
84
+ { label: 'CM - Charge off-Mortgage', value: 'CM' },
85
+ { label: 'CR - Charge off-Real Estate', value: 'CR' },
86
+ { label: 'IL - Installment Loans', value: 'IL' },
87
+ { label: 'RE - Real Estate Secured', value: 'RE' },
88
+ ],
89
+ },
90
+ }),
91
+ demandFlag: Property.StaticDropdown({
92
+ displayName: 'Demand Flag',
93
+ description: 'Indicates if this is a demand loan.',
94
+ required: false,
95
+ options: {
96
+ options: [
97
+ { label: 'Blank - Not a Demand Loan', value: '' },
98
+ { label: 'D - Demand Loan', value: 'D' },
99
+ { label: 'M - Demand with Maturity', value: 'M' },
100
+ ],
101
+ },
102
+ }),
103
+ currentLoanAmount: Property.Number({
104
+ displayName: 'Current Loan Amount',
105
+ description: 'Current Loan Amount (max 999999999.99).',
106
+ required: true,
107
+ }),
108
+ currentNoteDate: Property.ShortText({
109
+ displayName: 'Current Note Date',
110
+ description: 'Current Note Date (Format: CCYYMMDD).',
111
+ required: true,
112
+ }),
113
+ currentNetProceed: Property.Number({
114
+ displayName: 'Current Net Proceed',
115
+ description: 'Current Net Proceed (max 999999999.99).',
116
+ required: true,
117
+ }),
118
+ currentMaturityDate: Property.ShortText({
119
+ displayName: 'Current Maturity Date',
120
+ description: 'Required for all loan types if demandFlag is not D (Format: CCYYMMDD).',
121
+ required: false,
122
+ }),
123
+ creditLineExpiration: Property.ShortText({
124
+ displayName: 'Credit Line Expiration',
125
+ description: 'Required if systemType is 5 (Format: CCYYMMDD).',
126
+ required: false,
127
+ }),
128
+ firstPaymentDate: Property.ShortText({
129
+ displayName: 'First Payment Date',
130
+ description: 'First Payment Date (Format: CCYYMMDD).',
131
+ required: true,
132
+ }),
133
+ interestRate: Property.Number({
134
+ displayName: 'Interest Rate',
135
+ description: 'Interest Rate (must be under 100%). Example: 5% = 0.0500000, 99% = 0.9900000.',
136
+ required: true,
137
+ }),
138
+ annualPercentRate: Property.Number({
139
+ displayName: 'Annual Percent Rate',
140
+ description: 'APR (must be under 1000%). Example: 5% = 0.05000000, 100% = 1.00000000.',
141
+ required: false,
142
+ }),
143
+ prepaymentPenalty: Property.ShortText({
144
+ displayName: 'Prepayment Penalty',
145
+ description: 'Prepayment Penalty (max 4 characters). User Defined.',
146
+ required: false,
147
+ }),
148
+ minimumFinancialCharges: Property.Number({
149
+ displayName: 'Minimum Financial Charges',
150
+ description: 'Minimum Financial Charges (max 999999999.99).',
151
+ required: false,
152
+ }),
153
+ maximumLateChargeOverride: Property.Number({
154
+ displayName: 'Maximum Late Charge Override',
155
+ description: 'Maximum Late Charge Override (max 999999999.99).',
156
+ required: false,
157
+ }),
158
+ maximumLateChargeLoanToDate: Property.Number({
159
+ displayName: 'Maximum Late Charges Loan To Date',
160
+ description: 'Maximum Late Charges Loan To Date (max 999999999.99).',
161
+ required: false,
162
+ }),
163
+ censusTract: Property.ShortText({
164
+ displayName: 'Census Tract',
165
+ description: 'Census tract number (max 8 characters).',
166
+ required: false,
167
+ }),
168
+ paySplitOption: Property.StaticDropdown({
169
+ displayName: 'Pay Split Option',
170
+ description: 'Pay split option for the loan.',
171
+ required: true,
172
+ options: {
173
+ options: [
174
+ { label: '1 - Collect to date of payment', value: '1' },
175
+ { label: '2 - Collect as billed', value: '2' },
176
+ { label: '3 - Collect for scheduled balancing loans', value: '3' },
177
+ ],
178
+ },
179
+ }),
180
+ billOption: Property.StaticDropdown({
181
+ displayName: 'Bill Option',
182
+ description: 'Billing option for the loan.',
183
+ required: true,
184
+ options: {
185
+ options: [
186
+ { label: '0 - Do not send bills', value: '0' },
187
+ { label: '1 - Send all bills', value: '1' },
188
+ { label: '2 - Send final bill only', value: '2' },
189
+ { label: '3 - Coupons used, do not bill', value: '3' },
190
+ { label: '4 - Coupons used, send final bill', value: '4' },
191
+ { label: '5 - ATS used, do not bill', value: '5' },
192
+ { label: '6 - ATS used, send final bill', value: '6' },
193
+ { label: '7 - ACH used, do not bill', value: '7' },
194
+ { label: '8 - ACH used, send final bill', value: '8' },
195
+ { label: '9 - ATS used, send notice', value: '9' },
196
+ ],
197
+ },
198
+ }),
199
+ yearBase: Property.StaticDropdown({
200
+ displayName: 'Year Base',
201
+ description: 'Year base calculation method.',
202
+ required: true,
203
+ options: {
204
+ options: [
205
+ { label: '0 - Actual/365', value: 0 },
206
+ { label: '1 - 360/365', value: 1 },
207
+ { label: '2 - 360/360', value: 2 },
208
+ { label: '3 - Actual/360', value: 3 },
209
+ ],
210
+ },
211
+ }),
212
+ lateChargeCode: Property.StaticDropdown({
213
+ displayName: 'Late Charge Code',
214
+ description: 'Late charge calculation method.',
215
+ required: true,
216
+ options: {
217
+ options: [
218
+ { label: '0 - No Late Charge', value: '0' },
219
+ { label: '1 - % of Payment Remaining', value: '1' },
220
+ { label: '2 - % of Balance', value: '2' },
221
+ { label: '3 - Flat Amount', value: '3' },
222
+ { label: '4 - % of Regular Payment', value: '4' },
223
+ { label: '5 - % of Remaining P & I (pay split 2 & 3)', value: '5' },
224
+ ],
225
+ },
226
+ }),
227
+ lateChargeCollectionMethod: Property.StaticDropdown({
228
+ displayName: 'Late Charge Collection Method',
229
+ description: 'Late charge collection method.',
230
+ required: true,
231
+ options: {
232
+ options: [
233
+ { label: 'A - From Accumulated Balance', value: 'A' },
234
+ { label: 'B - Based on Billed Amount', value: 'B' },
235
+ ],
236
+ },
237
+ }),
238
+ ticklerCode: Property.ShortText({
239
+ displayName: 'Tickler Code',
240
+ description: 'Tickler Code (1 character). User Defined.',
241
+ required: false,
242
+ }),
243
+ creditBureauAccount: Property.ShortText({
244
+ displayName: 'Credit Bureau Account',
245
+ description: 'Credit Bureau Account Type Code (2 characters). See API docs for valid values.',
246
+ required: true,
247
+ }),
248
+ creditRiskCode: Property.ShortText({
249
+ displayName: 'Credit Risk Code',
250
+ description: 'Credit Risk Code (max 5 characters). User Defined.',
251
+ required: false,
252
+ }),
253
+ callReportCode: Property.ShortText({
254
+ displayName: 'Call Report Code',
255
+ description: 'Call Report Code (max 5 characters). User Defined.',
256
+ required: false,
257
+ }),
258
+ purposeCode: Property.ShortText({
259
+ displayName: 'Purpose Code',
260
+ description: 'Purpose Code (max 5 characters). User Defined.',
261
+ required: false,
262
+ }),
263
+ reserveDisbursement: Property.StaticDropdown({
264
+ displayName: 'Reserve Disbursement',
265
+ description: 'Reserve disbursement method.',
266
+ required: false,
267
+ options: {
268
+ options: [
269
+ { label: 'E - When-earned reserve', value: 'E' },
270
+ { label: 'P - When-paid reserve', value: 'P' },
271
+ { label: 'U - Up-front reserve', value: 'U' },
272
+ ],
273
+ },
274
+ }),
275
+ lateChargeFactor: Property.ShortText({
276
+ displayName: 'Late Charge Factor',
277
+ description: 'Late Charge Factor (max 9 characters).',
278
+ required: false,
279
+ }),
280
+ lateChargeWaiveCode: Property.StaticDropdown({
281
+ displayName: 'Late Charge Waive Code',
282
+ description: 'Late charge waive code.',
283
+ required: false,
284
+ options: {
285
+ options: [
286
+ { label: 'Blank - No Waive', value: '' },
287
+ { label: 'B - Notice & Late Charge', value: 'B' },
288
+ { label: 'L - Late Charge Only', value: 'L' },
289
+ { label: 'N - Notice Only', value: 'N' },
290
+ { label: 'X - Notice & Late Charge at Maturity', value: 'X' },
291
+ { label: 'Y - Late Charge at Maturity', value: 'Y' },
292
+ ],
293
+ },
294
+ }),
295
+ loanOfficerApproval: Property.StaticDropdown({
296
+ displayName: 'Loan Officer Approval',
297
+ description: 'Loan officer approval type.',
298
+ required: false,
299
+ options: {
300
+ options: [
301
+ { label: 'Blank - No Override', value: '' },
302
+ { label: 'A - Loan Committee Approval', value: 'A' },
303
+ { label: 'O - Other Approval', value: 'O' },
304
+ ],
305
+ },
306
+ }),
307
+ officerCode1: Property.ShortText({
308
+ displayName: 'Officer Code 1',
309
+ description: 'Officer code 1 (max 3 characters). User Defined.',
310
+ required: false,
311
+ }),
312
+ officerCode2: Property.ShortText({
313
+ displayName: 'Officer Code 2',
314
+ description: 'Officer code 2 (max 3 characters). User Defined.',
315
+ required: false,
316
+ }),
317
+ originatingOfficer: Property.ShortText({
318
+ displayName: 'Originating Officer',
319
+ description: 'Originating Officer ID (max 3 characters).',
320
+ required: false,
321
+ }),
322
+ lateChargeBenefitCostRatioPoint: Property.ShortText({
323
+ displayName: 'Late Charge Benefit Cost Ratio Point',
324
+ description: 'Late Charge Benefit Cost Ratio Point (1 character). User Defined.',
325
+ required: false,
326
+ }),
327
+ lateChargeAssessmentCode: Property.StaticDropdown({
328
+ displayName: 'Late Charge Assessment Code',
329
+ description: 'Late charge assessment code.',
330
+ required: true,
331
+ options: {
332
+ options: [
333
+ { label: 'P - Antipyramiding not in effect', value: 'P' },
334
+ { label: 'A - Antipyramiding in effect', value: 'A' },
335
+ ],
336
+ },
337
+ }),
338
+ couponMailLocation: Property.StaticDropdown({
339
+ displayName: 'Coupon Mail Location',
340
+ description: 'Coupon mail location.',
341
+ required: false,
342
+ options: {
343
+ options: [
344
+ { label: 'Blank - No coupon request', value: '' },
345
+ { label: 'B - Mail to Bank Address', value: 'B' },
346
+ { label: 'C - Mail to Customer Address', value: 'C' },
347
+ ],
348
+ },
349
+ }),
350
+ couponReprintFlag: Property.Checkbox({
351
+ displayName: 'Coupon Reprint Flag',
352
+ description: 'Coupon Reprint Flag. Required if Coupon Mail Location is set.',
353
+ required: false,
354
+ }),
355
+ employeeCode: Property.ShortText({
356
+ displayName: 'Employee Code',
357
+ description: 'Employee Code identifies any relationship with the institution (1 character). User Defined.',
358
+ required: false,
359
+ }),
360
+ tieredInterestRate: Property.ShortText({
361
+ displayName: 'Tiered Interest Rate',
362
+ description: 'Tiered Interest Rate (max 4 characters). User Defined.',
363
+ required: false,
364
+ }),
365
+ tieredRateMethod: Property.StaticDropdown({
366
+ displayName: 'Tiered Rate Method',
367
+ description: 'Tiered rate method.',
368
+ required: false,
369
+ options: {
370
+ options: [
371
+ { label: 'S - Split Balance', value: 'S' },
372
+ { label: 'W - Whole Balance', value: 'W' },
373
+ ],
374
+ },
375
+ }),
376
+ couponProcessingDate: Property.ShortText({
377
+ displayName: 'Coupon Processing Date',
378
+ description: 'Coupon Processing Date (Format: CCYYMMDD). Required if Coupon Mail Location is set.',
379
+ required: false,
380
+ }),
381
+ couponQuantity: Property.Number({
382
+ displayName: 'Coupon Quantity',
383
+ description: 'Coupon Quantity (1-99).',
384
+ required: false,
385
+ }),
386
+ couponMaxQuantity: Property.Number({
387
+ displayName: 'Coupon Max Quantity',
388
+ description: 'Coupon Max Quantity (1-99).',
389
+ required: false,
390
+ }),
391
+ initialRate: Property.Number({
392
+ displayName: 'Initial Rate',
393
+ description: 'Initial Rate (must be under 100%). Example: 5% = 0.0500000.',
394
+ required: false,
395
+ }),
396
+ initialRateExpirationDate: Property.ShortText({
397
+ displayName: 'Initial Rate Expiration Date',
398
+ description: 'Initial Rate Expiration Date (Format: CCYYMMDD). Required if initial rate is used.',
399
+ required: false,
400
+ }),
401
+ homeMortgageDisclosureActLoanFlag: Property.Checkbox({
402
+ displayName: 'Home Mortgage Disclosure Act Loan Flag',
403
+ description: 'HMDA Loan Flag.',
404
+ required: true,
405
+ }),
406
+ hmdaPreapproval: Property.StaticDropdown({
407
+ displayName: 'HMDA Preapproval',
408
+ description: 'HMDA Preapproval status.',
409
+ required: false,
410
+ options: {
411
+ options: [
412
+ { label: 'Blank', value: '' },
413
+ { label: '1 - Preapproval requested', value: '1' },
414
+ { label: '2 - Preapproval not requested', value: '2' },
415
+ { label: '3 - Preapproval not applicable', value: '3' },
416
+ ],
417
+ },
418
+ }),
419
+ homeOwnershipAEquityProtectionActRateSpread: Property.Number({
420
+ displayName: 'HOEPA Rate Spread',
421
+ description: 'Home Ownership and Equity Protection Act Rate Spread (0-9.9999).',
422
+ required: false,
423
+ }),
424
+ introductoryFixedRate: Property.Number({
425
+ displayName: 'Introductory Fixed Rate',
426
+ description: 'Introductory Fixed Rate (must be under 100%). Must be 0 if Introductory Global Index is set.',
427
+ required: false,
428
+ }),
429
+ introductoryGlobalIndex: Property.ShortText({
430
+ displayName: 'Introductory Global Index',
431
+ description: 'Introductory Global Index (max 3 characters). Must be blank if Introductory Fixed Rate > 0.',
432
+ required: false,
433
+ }),
434
+ introductoryAdjustmentFinancialTransitionRight: Property.Number({
435
+ displayName: 'Introductory Adjustment',
436
+ description: 'Introductory Adjustment. Can only be > 0 if Introductory Global Index is set.',
437
+ required: false,
438
+ }),
439
+ introductoryAdjustmentMethod: Property.StaticDropdown({
440
+ displayName: 'Introductory Adjustment Method',
441
+ description: 'Required if Introductory Global Index is set.',
442
+ required: false,
443
+ options: {
444
+ options: [
445
+ { label: 'A - Add', value: 'A' },
446
+ { label: 'P - Percent', value: 'P' },
447
+ { label: 'S - Subtract', value: 'S' },
448
+ ],
449
+ },
450
+ }),
451
+ introductoryExpirationDate: Property.ShortText({
452
+ displayName: 'Introductory Expiration Date',
453
+ description: 'Introductory Expiration Date (Format: CCYYMMDD). Required if Introductory Rate applies.',
454
+ required: false,
455
+ }),
456
+ permanentFixedRate: Property.Number({
457
+ displayName: 'Permanent Fixed Rate',
458
+ description: 'Permanent Fixed Rate (must be under 100%). Required if Introductory Expiration Date > 0 and no LNPRIM record exists.',
459
+ required: false,
460
+ }),
461
+ projectPaymentZeroDue: Property.StaticDropdown({
462
+ displayName: 'Project Payment / Zero Due',
463
+ description: 'Project Payment / Zero Due option.',
464
+ required: true,
465
+ options: {
466
+ options: [
467
+ { label: '0 - No payment projection or zero due notice', value: '0' },
468
+ { label: '1 - One payment projected and zero due notice produced', value: '1' },
469
+ { label: '2 - One payment projected / zero due notice not produced', value: '2' },
470
+ { label: '3 - No payment projected / zero due notice produced', value: '3' },
471
+ ],
472
+ },
473
+ }),
474
+ payInAdvanceFrequency: Property.StaticDropdown({
475
+ displayName: 'Pay in Advance Frequency',
476
+ description: 'Pay in Advance Frequency.',
477
+ required: false,
478
+ options: {
479
+ options: [
480
+ { label: 'E - Excess', value: 'E' },
481
+ { label: 'M - Monthly', value: 'M' },
482
+ { label: 'P - Payments', value: 'P' },
483
+ ],
484
+ },
485
+ }),
486
+ payInAdvanceIncrement: Property.ShortText({
487
+ displayName: 'Pay in Advance Increment',
488
+ description: 'Pay in Advance Increment (2 characters). 00-27 if E, 01 if M, 01-99 if P.',
489
+ required: false,
490
+ }),
491
+ mlaFlag: Property.Checkbox({
492
+ displayName: 'MLA Flag',
493
+ description: 'Military Lending Act Flag.',
494
+ required: true,
495
+ }),
496
+ // ==========================================================================
497
+ // Interest Earnings (Required)
498
+ // ==========================================================================
499
+ interestEarnings: Property.Json({
500
+ displayName: 'Interest Earnings',
501
+ description: 'Interest earnings information (required). JSON object with fields: interestAccrualMethod, receivableType, interestCalculationMethod, rateIndexCode, adjustmentMethod, adjustmentValue, ceiling, ceilingOverride, floor, floorOverride, etc.',
502
+ required: true,
503
+ }),
504
+ // ==========================================================================
505
+ // Overlimit Control (Required)
506
+ // ==========================================================================
507
+ overlimitControl: Property.Json({
508
+ displayName: 'Overlimit Control',
509
+ description: 'Overlimit control information (required). JSON object with fields: monthlyLimitCode, monthlyLimitAmount, monthlyLimitCumulative, maxAdvanceAmount, advanceMaxAmount, advanceMinAmount, etc.',
510
+ required: true,
511
+ }),
512
+ // ==========================================================================
513
+ // Optional Segments
514
+ // ==========================================================================
515
+ lateCharges: Property.Json({
516
+ displayName: 'Late Charges',
517
+ description: 'Late charges information. JSON object with fields: billLateFees, minimumLateFees, lateFeeFreeDays, lateFeeGracePeriod, etc.',
518
+ required: false,
519
+ }),
520
+ dealerReserve: Property.Json({
521
+ displayName: 'Dealer Reserve',
522
+ description: 'Dealer reserve information. JSON object with fields: dealerNumber, dealerRebatePercent, dealerFlatFee, etc.',
523
+ required: false,
524
+ }),
525
+ insuranceEarnings: Property.Json({
526
+ displayName: 'Insurance Earnings',
527
+ description: 'Insurance earnings information. JSON array of insurance earnings records (max 99 items).',
528
+ required: false,
529
+ }),
530
+ feeEarnings: Property.Json({
531
+ displayName: 'Fee Earnings',
532
+ description: 'Fee earnings information. JSON array of fee earnings records (max 99 items).',
533
+ required: false,
534
+ }),
535
+ paymentSchedules: Property.Json({
536
+ displayName: 'Payment Schedules',
537
+ description: 'Payment schedules information. JSON array of payment schedule records (max 99 items).',
538
+ required: false,
539
+ }),
540
+ paymentCalculationMethodsAndCycleControl: Property.Json({
541
+ displayName: 'Payment Calculation Methods and Cycle Control',
542
+ description: 'Payment calculation methods and cycle control information. JSON object.',
543
+ required: false,
544
+ }),
545
+ skipPaymentSchedules: Property.Json({
546
+ displayName: 'Skip Payment Schedules',
547
+ description: 'Skip payment schedules information. JSON array of skip payment schedule records (max 99 items).',
548
+ required: false,
549
+ }),
550
+ primeRateInformation: Property.Json({
551
+ displayName: 'Prime Rate Information',
552
+ description: 'Prime rate information. JSON object with fields: primeRateIndex, adjustmentMethod, adjustmentValue, ceiling, floor, etc.',
553
+ required: false,
554
+ }),
555
+ escrowDetails: Property.Json({
556
+ displayName: 'Escrow Details',
557
+ description: 'Escrow details information. JSON object with fields: escrowUserGrouping, escrowInterestProfit, escrowInterestFrequency, escrowBalances (array), etc.',
558
+ required: false,
559
+ }),
560
+ letterOfCredit: Property.Json({
561
+ displayName: 'Letter of Credit',
562
+ description: 'Letter of credit information. JSON object with fields: letterOfCreditType, beneficiaryName, expirationDate, etc.',
563
+ required: false,
564
+ }),
565
+ userCodesAndOverrides: Property.Json({
566
+ displayName: 'User Codes and Overrides',
567
+ description: 'User codes and overrides information. JSON object with user-defined fields.',
568
+ required: false,
569
+ }),
570
+ automaticTransfer: Property.Json({
571
+ displayName: 'Automatic Transfer',
572
+ description: 'Automatic transfer information. JSON object with fields: debitApplication (DD/SV/GL), debitAccountNumber, transferAmount, frequencyCode, frequencyIncrement, holdTransfer, availableBalanceCalculation, etc.',
573
+ required: false,
574
+ }),
575
+ deferredFeesAndCosts: Property.Json({
576
+ displayName: 'Deferred Fees and Costs',
577
+ description: 'Deferred fees and costs information. JSON object.',
578
+ required: false,
579
+ }),
580
+ masterLoan: Property.Json({
581
+ displayName: 'Master Loan',
582
+ description: 'Master loan information. JSON object with fields: masterLoanDescription, totalNumberOfActiveTranchesAllowed, etc.',
583
+ required: false,
584
+ }),
585
+ },
586
+ async run(context) {
587
+ const auth = context.auth as any;
588
+ const baseUrl = auth['baseUrl'];
589
+ const organizationId = auth['organizationId'];
590
+ const {
591
+ xAuthorization,
592
+ sourceId,
593
+ // Base Loan Information
594
+ productType,
595
+ accountNumber,
596
+ customerId,
597
+ branchNumber,
598
+ systemType,
599
+ generalLedgerType,
600
+ applicationCode,
601
+ demandFlag,
602
+ currentLoanAmount,
603
+ currentNoteDate,
604
+ currentNetProceed,
605
+ currentMaturityDate,
606
+ creditLineExpiration,
607
+ firstPaymentDate,
608
+ interestRate,
609
+ annualPercentRate,
610
+ prepaymentPenalty,
611
+ minimumFinancialCharges,
612
+ maximumLateChargeOverride,
613
+ maximumLateChargeLoanToDate,
614
+ censusTract,
615
+ paySplitOption,
616
+ billOption,
617
+ yearBase,
618
+ lateChargeCode,
619
+ lateChargeCollectionMethod,
620
+ ticklerCode,
621
+ creditBureauAccount,
622
+ creditRiskCode,
623
+ callReportCode,
624
+ purposeCode,
625
+ reserveDisbursement,
626
+ lateChargeFactor,
627
+ lateChargeWaiveCode,
628
+ loanOfficerApproval,
629
+ officerCode1,
630
+ officerCode2,
631
+ originatingOfficer,
632
+ lateChargeBenefitCostRatioPoint,
633
+ lateChargeAssessmentCode,
634
+ couponMailLocation,
635
+ couponReprintFlag,
636
+ employeeCode,
637
+ tieredInterestRate,
638
+ tieredRateMethod,
639
+ couponProcessingDate,
640
+ couponQuantity,
641
+ couponMaxQuantity,
642
+ initialRate,
643
+ initialRateExpirationDate,
644
+ homeMortgageDisclosureActLoanFlag,
645
+ hmdaPreapproval,
646
+ homeOwnershipAEquityProtectionActRateSpread,
647
+ introductoryFixedRate,
648
+ introductoryGlobalIndex,
649
+ introductoryAdjustmentFinancialTransitionRight,
650
+ introductoryAdjustmentMethod,
651
+ introductoryExpirationDate,
652
+ permanentFixedRate,
653
+ projectPaymentZeroDue,
654
+ payInAdvanceFrequency,
655
+ payInAdvanceIncrement,
656
+ mlaFlag,
657
+ // Required segments
658
+ interestEarnings,
659
+ overlimitControl,
660
+ // Optional segments
661
+ lateCharges,
662
+ dealerReserve,
663
+ insuranceEarnings,
664
+ feeEarnings,
665
+ paymentSchedules,
666
+ paymentCalculationMethodsAndCycleControl,
667
+ skipPaymentSchedules,
668
+ primeRateInformation,
669
+ escrowDetails,
670
+ letterOfCredit,
671
+ userCodesAndOverrides,
672
+ automaticTransfer,
673
+ deferredFeesAndCosts,
674
+ masterLoan,
675
+ } = context.propsValue;
676
+
677
+ const uuid = crypto.randomUUID();
678
+
679
+ const headers: Record<string, string> = {
680
+ 'accept': 'application/json',
681
+ 'Content-Type': 'application/json',
682
+ 'organization-id': organizationId,
683
+ 'uuid': uuid,
684
+ 'x-authorization': xAuthorization,
685
+ };
686
+
687
+ if (sourceId) {
688
+ headers['source-id'] = sourceId;
689
+ }
690
+
691
+ // Build baseLoanInformation object
692
+ const baseLoanInformation: Record<string, unknown> = {
693
+ productType,
694
+ accountNumber,
695
+ customerId,
696
+ branchNumber,
697
+ systemType,
698
+ generalLedgerType,
699
+ applicationCode,
700
+ currentLoanAmount,
701
+ currentNoteDate,
702
+ currentNetProceed,
703
+ firstPaymentDate,
704
+ interestRate,
705
+ paySplitOption,
706
+ billOption,
707
+ yearBase,
708
+ lateChargeCode,
709
+ lateChargeCollectionMethod,
710
+ creditBureauAccount,
711
+ lateChargeAssessmentCode,
712
+ homeMortgageDisclosureActLoanFlag,
713
+ mlaFlag,
714
+ projectPaymentZeroDue,
715
+ };
716
+
717
+ // Add optional base loan information fields
718
+ if (demandFlag !== undefined && demandFlag !== null && demandFlag !== '') {
719
+ baseLoanInformation['demandFlag'] = demandFlag;
720
+ }
721
+ if (currentMaturityDate !== undefined && currentMaturityDate !== null && currentMaturityDate !== '') {
722
+ baseLoanInformation['currentMaturityDate'] = currentMaturityDate;
723
+ }
724
+ if (creditLineExpiration !== undefined && creditLineExpiration !== null && creditLineExpiration !== '') {
725
+ baseLoanInformation['creditLineExpiration'] = creditLineExpiration;
726
+ }
727
+ if (annualPercentRate !== undefined && annualPercentRate !== null) {
728
+ baseLoanInformation['annualPercentRate'] = annualPercentRate;
729
+ }
730
+ if (prepaymentPenalty !== undefined && prepaymentPenalty !== null && prepaymentPenalty !== '') {
731
+ baseLoanInformation['prepaymentPenalty'] = prepaymentPenalty;
732
+ }
733
+ if (minimumFinancialCharges !== undefined && minimumFinancialCharges !== null) {
734
+ baseLoanInformation['minimumFinancialCharges'] = minimumFinancialCharges;
735
+ }
736
+ if (maximumLateChargeOverride !== undefined && maximumLateChargeOverride !== null) {
737
+ baseLoanInformation['maximumLateChargeOverride'] = maximumLateChargeOverride;
738
+ }
739
+ if (maximumLateChargeLoanToDate !== undefined && maximumLateChargeLoanToDate !== null) {
740
+ baseLoanInformation['maximumLateChargeLoanToDate'] = maximumLateChargeLoanToDate;
741
+ }
742
+ if (censusTract !== undefined && censusTract !== null && censusTract !== '') {
743
+ baseLoanInformation['censusTract'] = censusTract;
744
+ }
745
+ if (ticklerCode !== undefined && ticklerCode !== null && ticklerCode !== '') {
746
+ baseLoanInformation['ticklerCode'] = ticklerCode;
747
+ }
748
+ if (creditRiskCode !== undefined && creditRiskCode !== null && creditRiskCode !== '') {
749
+ baseLoanInformation['creditRiskCode'] = creditRiskCode;
750
+ }
751
+ if (callReportCode !== undefined && callReportCode !== null && callReportCode !== '') {
752
+ baseLoanInformation['callReportCode'] = callReportCode;
753
+ }
754
+ if (purposeCode !== undefined && purposeCode !== null && purposeCode !== '') {
755
+ baseLoanInformation['purposeCode'] = purposeCode;
756
+ }
757
+ if (reserveDisbursement !== undefined && reserveDisbursement !== null && reserveDisbursement !== '') {
758
+ baseLoanInformation['reserveDisbursement'] = reserveDisbursement;
759
+ }
760
+ if (lateChargeFactor !== undefined && lateChargeFactor !== null && lateChargeFactor !== '') {
761
+ baseLoanInformation['lateChargeFactor'] = lateChargeFactor;
762
+ }
763
+ if (lateChargeWaiveCode !== undefined && lateChargeWaiveCode !== null) {
764
+ baseLoanInformation['lateChargeWaiveCode'] = lateChargeWaiveCode;
765
+ }
766
+ if (loanOfficerApproval !== undefined && loanOfficerApproval !== null) {
767
+ baseLoanInformation['loanOfficerApproval'] = loanOfficerApproval;
768
+ }
769
+ if (officerCode1 !== undefined && officerCode1 !== null && officerCode1 !== '') {
770
+ baseLoanInformation['officerCode1'] = officerCode1;
771
+ }
772
+ if (officerCode2 !== undefined && officerCode2 !== null && officerCode2 !== '') {
773
+ baseLoanInformation['officerCode2'] = officerCode2;
774
+ }
775
+ if (originatingOfficer !== undefined && originatingOfficer !== null && originatingOfficer !== '') {
776
+ baseLoanInformation['originatingOfficer'] = originatingOfficer;
777
+ }
778
+ if (lateChargeBenefitCostRatioPoint !== undefined && lateChargeBenefitCostRatioPoint !== null && lateChargeBenefitCostRatioPoint !== '') {
779
+ baseLoanInformation['lateChargeBenefitCostRatioPoint'] = lateChargeBenefitCostRatioPoint;
780
+ }
781
+ if (couponMailLocation !== undefined && couponMailLocation !== null) {
782
+ baseLoanInformation['couponMailLocation'] = couponMailLocation;
783
+ }
784
+ if (couponReprintFlag !== undefined && couponReprintFlag !== null) {
785
+ baseLoanInformation['couponReprintFlag'] = couponReprintFlag;
786
+ }
787
+ if (employeeCode !== undefined && employeeCode !== null && employeeCode !== '') {
788
+ baseLoanInformation['employeeCode'] = employeeCode;
789
+ }
790
+ if (tieredInterestRate !== undefined && tieredInterestRate !== null && tieredInterestRate !== '') {
791
+ baseLoanInformation['tieredInterestRate'] = tieredInterestRate;
792
+ }
793
+ if (tieredRateMethod !== undefined && tieredRateMethod !== null && tieredRateMethod !== '') {
794
+ baseLoanInformation['tieredRateMethod'] = tieredRateMethod;
795
+ }
796
+ if (couponProcessingDate !== undefined && couponProcessingDate !== null && couponProcessingDate !== '') {
797
+ baseLoanInformation['couponProcessingDate'] = couponProcessingDate;
798
+ }
799
+ if (couponQuantity !== undefined && couponQuantity !== null) {
800
+ baseLoanInformation['couponQuantity'] = couponQuantity;
801
+ }
802
+ if (couponMaxQuantity !== undefined && couponMaxQuantity !== null) {
803
+ baseLoanInformation['couponMaxQuantity'] = couponMaxQuantity;
804
+ }
805
+ if (initialRate !== undefined && initialRate !== null) {
806
+ baseLoanInformation['initialRate'] = initialRate;
807
+ }
808
+ if (initialRateExpirationDate !== undefined && initialRateExpirationDate !== null && initialRateExpirationDate !== '') {
809
+ baseLoanInformation['initialRateExpirationDate'] = initialRateExpirationDate;
810
+ }
811
+ if (hmdaPreapproval !== undefined && hmdaPreapproval !== null) {
812
+ baseLoanInformation['hmdaPreapproval'] = hmdaPreapproval;
813
+ }
814
+ if (homeOwnershipAEquityProtectionActRateSpread !== undefined && homeOwnershipAEquityProtectionActRateSpread !== null) {
815
+ baseLoanInformation['homeOwnershipAEquityProtectionActRateSpread'] = homeOwnershipAEquityProtectionActRateSpread;
816
+ }
817
+ if (introductoryFixedRate !== undefined && introductoryFixedRate !== null) {
818
+ baseLoanInformation['introductoryFixedRate'] = introductoryFixedRate;
819
+ }
820
+ if (introductoryGlobalIndex !== undefined && introductoryGlobalIndex !== null && introductoryGlobalIndex !== '') {
821
+ baseLoanInformation['introductoryGlobalIndex'] = introductoryGlobalIndex;
822
+ }
823
+ if (introductoryAdjustmentFinancialTransitionRight !== undefined && introductoryAdjustmentFinancialTransitionRight !== null) {
824
+ baseLoanInformation['introductoryAdjustmentFinancialTransitionRight'] = introductoryAdjustmentFinancialTransitionRight;
825
+ }
826
+ if (introductoryAdjustmentMethod !== undefined && introductoryAdjustmentMethod !== null && introductoryAdjustmentMethod !== '') {
827
+ baseLoanInformation['introductoryAdjustmentMethod'] = introductoryAdjustmentMethod;
828
+ }
829
+ if (introductoryExpirationDate !== undefined && introductoryExpirationDate !== null && introductoryExpirationDate !== '') {
830
+ baseLoanInformation['introductoryExpirationDate'] = introductoryExpirationDate;
831
+ }
832
+ if (permanentFixedRate !== undefined && permanentFixedRate !== null) {
833
+ baseLoanInformation['permanentFixedRate'] = permanentFixedRate;
834
+ }
835
+ if (payInAdvanceFrequency !== undefined && payInAdvanceFrequency !== null && payInAdvanceFrequency !== '') {
836
+ baseLoanInformation['payInAdvanceFrequency'] = payInAdvanceFrequency;
837
+ }
838
+ if (payInAdvanceIncrement !== undefined && payInAdvanceIncrement !== null && payInAdvanceIncrement !== '') {
839
+ baseLoanInformation['payInAdvanceIncrement'] = payInAdvanceIncrement;
840
+ }
841
+
842
+ // Build request body with required segments
843
+ const body: Record<string, unknown> = {
844
+ baseLoanInformation,
845
+ interestEarnings,
846
+ overlimitControl,
847
+ };
848
+
849
+ // Add optional segments
850
+ if (lateCharges !== undefined && lateCharges !== null) {
851
+ body['lateCharges'] = lateCharges;
852
+ }
853
+ if (dealerReserve !== undefined && dealerReserve !== null) {
854
+ body['dealerReserve'] = dealerReserve;
855
+ }
856
+ if (insuranceEarnings !== undefined && insuranceEarnings !== null) {
857
+ body['insuranceEarnings'] = insuranceEarnings;
858
+ }
859
+ if (feeEarnings !== undefined && feeEarnings !== null) {
860
+ body['feeEarnings'] = feeEarnings;
861
+ }
862
+ if (paymentSchedules !== undefined && paymentSchedules !== null) {
863
+ body['paymentSchedules'] = paymentSchedules;
864
+ }
865
+ if (paymentCalculationMethodsAndCycleControl !== undefined && paymentCalculationMethodsAndCycleControl !== null) {
866
+ body['paymentCalculationMethodsAndCycleControl'] = paymentCalculationMethodsAndCycleControl;
867
+ }
868
+ if (skipPaymentSchedules !== undefined && skipPaymentSchedules !== null) {
869
+ body['skipPaymentSchedules'] = skipPaymentSchedules;
870
+ }
871
+ if (primeRateInformation !== undefined && primeRateInformation !== null) {
872
+ body['primeRateInformation'] = primeRateInformation;
873
+ }
874
+ if (escrowDetails !== undefined && escrowDetails !== null) {
875
+ body['escrowDetails'] = escrowDetails;
876
+ }
877
+ if (letterOfCredit !== undefined && letterOfCredit !== null) {
878
+ body['letterOfCredit'] = letterOfCredit;
879
+ }
880
+ if (userCodesAndOverrides !== undefined && userCodesAndOverrides !== null) {
881
+ body['userCodesAndOverrides'] = userCodesAndOverrides;
882
+ }
883
+ if (automaticTransfer !== undefined && automaticTransfer !== null) {
884
+ body['automaticTransfer'] = automaticTransfer;
885
+ }
886
+ if (deferredFeesAndCosts !== undefined && deferredFeesAndCosts !== null) {
887
+ body['deferredFeesAndCosts'] = deferredFeesAndCosts;
888
+ }
889
+ if (masterLoan !== undefined && masterLoan !== null) {
890
+ body['masterLoan'] = masterLoan;
891
+ }
892
+
893
+ const response = await httpClient.sendRequest({
894
+ method: HttpMethod.POST,
895
+ url: `${baseUrl}/loans/v2/accounts/loans`,
896
+ headers,
897
+ body,
898
+ });
899
+
900
+ return response.body;
901
+ },
902
+ });