@financeable/aggregation 0.14.0 → 0.15.0

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 (58) hide show
  1. package/README.md +3 -3
  2. package/examples/package-lock.json +1 -1
  3. package/jsr.json +1 -1
  4. package/lib/config.d.ts +3 -3
  5. package/lib/config.js +3 -3
  6. package/lib/config.js.map +1 -1
  7. package/models/components/businessapplicationresource.d.ts +39 -0
  8. package/models/components/businessapplicationresource.d.ts.map +1 -1
  9. package/models/components/businessapplicationresource.js +33 -1
  10. package/models/components/businessapplicationresource.js.map +1 -1
  11. package/models/components/businessloanpurpose.d.ts +14 -0
  12. package/models/components/businessloanpurpose.d.ts.map +1 -0
  13. package/models/components/businessloanpurpose.js +51 -0
  14. package/models/components/businessloanpurpose.js.map +1 -0
  15. package/models/components/commercialsecuredapplicationresource.d.ts +39 -0
  16. package/models/components/commercialsecuredapplicationresource.d.ts.map +1 -1
  17. package/models/components/commercialsecuredapplicationresource.js +34 -1
  18. package/models/components/commercialsecuredapplicationresource.js.map +1 -1
  19. package/models/components/commercialsecuredloanassettype.d.ts +32 -16
  20. package/models/components/commercialsecuredloanassettype.d.ts.map +1 -1
  21. package/models/components/commercialsecuredloanassettype.js +32 -16
  22. package/models/components/commercialsecuredloanassettype.js.map +1 -1
  23. package/models/components/consumersecuredapplicationresource.d.ts +39 -0
  24. package/models/components/consumersecuredapplicationresource.d.ts.map +1 -1
  25. package/models/components/consumersecuredapplicationresource.js +34 -1
  26. package/models/components/consumersecuredapplicationresource.js.map +1 -1
  27. package/models/components/consumersecuredloanassettype.d.ts +15 -3
  28. package/models/components/consumersecuredloanassettype.d.ts.map +1 -1
  29. package/models/components/consumersecuredloanassettype.js +15 -3
  30. package/models/components/consumersecuredloanassettype.js.map +1 -1
  31. package/models/components/index.d.ts +2 -0
  32. package/models/components/index.d.ts.map +1 -1
  33. package/models/components/index.js +2 -0
  34. package/models/components/index.js.map +1 -1
  35. package/models/components/loandetailsattributes.d.ts +20 -6
  36. package/models/components/loandetailsattributes.d.ts.map +1 -1
  37. package/models/components/loandetailsattributes.js +33 -3
  38. package/models/components/loandetailsattributes.js.map +1 -1
  39. package/models/components/personalapplicationresource.d.ts +39 -0
  40. package/models/components/personalapplicationresource.d.ts.map +1 -1
  41. package/models/components/personalapplicationresource.js +33 -1
  42. package/models/components/personalapplicationresource.js.map +1 -1
  43. package/models/components/personalloanpurpose.d.ts +20 -0
  44. package/models/components/personalloanpurpose.d.ts.map +1 -0
  45. package/models/components/personalloanpurpose.js +57 -0
  46. package/models/components/personalloanpurpose.js.map +1 -0
  47. package/package.json +1 -1
  48. package/src/lib/config.ts +3 -3
  49. package/src/models/components/businessapplicationresource.ts +46 -0
  50. package/src/models/components/businessloanpurpose.ts +23 -0
  51. package/src/models/components/commercialsecuredapplicationresource.ts +46 -0
  52. package/src/models/components/commercialsecuredloanassettype.ts +35 -19
  53. package/src/models/components/consumersecuredapplicationresource.ts +43 -0
  54. package/src/models/components/consumersecuredloanassettype.ts +15 -3
  55. package/src/models/components/index.ts +2 -0
  56. package/src/models/components/loandetailsattributes.ts +65 -8
  57. package/src/models/components/personalapplicationresource.ts +46 -0
  58. package/src/models/components/personalloanpurpose.ts +29 -0
@@ -6,6 +6,11 @@ import * as z from "zod/v3";
6
6
  import { safeParse } from "../../lib/schemas.js";
7
7
  import { Result as SafeParseResult } from "../../types/fp.js";
8
8
  import { SDKValidationError } from "../errors/sdkvalidationerror.js";
9
+ import {
10
+ BusinessLoanPurpose,
11
+ BusinessLoanPurpose$inboundSchema,
12
+ BusinessLoanPurpose$outboundSchema,
13
+ } from "./businessloanpurpose.js";
9
14
  import {
10
15
  FrequencyType,
11
16
  FrequencyType$inboundSchema,
@@ -23,6 +28,11 @@ import {
23
28
  PercentageQuantity$Outbound,
24
29
  PercentageQuantity$outboundSchema,
25
30
  } from "./percentagequantity.js";
31
+ import {
32
+ PersonalLoanPurpose,
33
+ PersonalLoanPurpose$inboundSchema,
34
+ PersonalLoanPurpose$outboundSchema,
35
+ } from "./personalloanpurpose.js";
26
36
  import {
27
37
  RepaymentStructure,
28
38
  RepaymentStructure$inboundSchema,
@@ -40,7 +50,12 @@ export type Repayments = MonetaryQuantity | string;
40
50
  export type LoanAmount = MonetaryQuantity | string;
41
51
 
42
52
  /**
43
- * Brokerage quantity as either BrokerageQuantity model (preferred) or floating point dollars as string. The latter will be deprecated. Only applicable to commercialSecured loans.
53
+ * Loan purpose must correspond to application type. For Personal loans, use PersonalLoanPurpose. For Business loans, use BusinessLoanPurpose. For ConsumerSecured and CommercialSecured, any string can be provided.
54
+ */
55
+ export type Purpose = PersonalLoanPurpose | BusinessLoanPurpose | string;
56
+
57
+ /**
58
+ * Applicable for Commercial Secured Loans Only. Brokerage quantity as either MonetaryQuantity or PercentageQuantity model. For all other loan types, use 'commission' instead.
44
59
  */
45
60
  export type Brokerage = MonetaryQuantity | PercentageQuantity | string;
46
61
 
@@ -105,15 +120,15 @@ export type LoanDetailsAttributes = {
105
120
  */
106
121
  requestedLoanAmount?: MonetaryQuantity | undefined;
107
122
  /**
108
- * Loan purpose
123
+ * Loan purpose must correspond to application type. For Personal loans, use PersonalLoanPurpose. For Business loans, use BusinessLoanPurpose. For ConsumerSecured and CommercialSecured, any string can be provided.
109
124
  */
110
- purpose?: string | undefined;
125
+ purpose?: PersonalLoanPurpose | BusinessLoanPurpose | string | undefined;
111
126
  /**
112
127
  * Loan term in integer months
113
128
  */
114
129
  term?: number | undefined;
115
130
  /**
116
- * Brokerage quantity as either BrokerageQuantity model (preferred) or floating point dollars as string. The latter will be deprecated. Only applicable to commercialSecured loans.
131
+ * Applicable for Commercial Secured Loans Only. Brokerage quantity as either MonetaryQuantity or PercentageQuantity model. For all other loan types, use 'commission' instead.
117
132
  */
118
133
  brokerage?: MonetaryQuantity | PercentageQuantity | string | undefined;
119
134
  /**
@@ -145,7 +160,7 @@ export type LoanDetailsAttributes = {
145
160
  */
146
161
  originationFee?: MonetaryQuantity | number | undefined;
147
162
  /**
148
- * Commission amount as MonetaryQuantity.
163
+ * Applicable to Consumer Secured, Personal & Business loans. Commission amount (paid from lender to aggregator/broker) as MonetaryQuantity. See `brokerage` for Commercial Secured loans.
149
164
  */
150
165
  commission?: MonetaryQuantity | undefined;
151
166
  /**
@@ -220,6 +235,40 @@ export function loanAmountFromJSON(
220
235
  );
221
236
  }
222
237
 
238
+ /** @internal */
239
+ export const Purpose$inboundSchema: z.ZodType<Purpose, z.ZodTypeDef, unknown> =
240
+ z.union([
241
+ PersonalLoanPurpose$inboundSchema,
242
+ BusinessLoanPurpose$inboundSchema,
243
+ z.string(),
244
+ ]);
245
+ /** @internal */
246
+ export type Purpose$Outbound = string | string | string;
247
+
248
+ /** @internal */
249
+ export const Purpose$outboundSchema: z.ZodType<
250
+ Purpose$Outbound,
251
+ z.ZodTypeDef,
252
+ Purpose
253
+ > = z.union([
254
+ PersonalLoanPurpose$outboundSchema,
255
+ BusinessLoanPurpose$outboundSchema,
256
+ z.string(),
257
+ ]);
258
+
259
+ export function purposeToJSON(purpose: Purpose): string {
260
+ return JSON.stringify(Purpose$outboundSchema.parse(purpose));
261
+ }
262
+ export function purposeFromJSON(
263
+ jsonString: string,
264
+ ): SafeParseResult<Purpose, SDKValidationError> {
265
+ return safeParse(
266
+ jsonString,
267
+ (x) => Purpose$inboundSchema.parse(JSON.parse(x)),
268
+ `Failed to parse 'Purpose' from JSON`,
269
+ );
270
+ }
271
+
223
272
  /** @internal */
224
273
  export const Brokerage$inboundSchema: z.ZodType<
225
274
  Brokerage,
@@ -468,7 +517,11 @@ export const LoanDetailsAttributes$inboundSchema: z.ZodType<
468
517
  repaymentStructure: RepaymentStructure$inboundSchema.optional(),
469
518
  loanAmount: z.union([MonetaryQuantity$inboundSchema, z.string()]).optional(),
470
519
  requestedLoanAmount: MonetaryQuantity$inboundSchema.optional(),
471
- purpose: z.string().optional(),
520
+ purpose: z.union([
521
+ PersonalLoanPurpose$inboundSchema,
522
+ BusinessLoanPurpose$inboundSchema,
523
+ z.string(),
524
+ ]).optional(),
472
525
  term: z.number().int().optional(),
473
526
  brokerage: z.union([
474
527
  MonetaryQuantity$inboundSchema,
@@ -500,7 +553,7 @@ export type LoanDetailsAttributes$Outbound = {
500
553
  repaymentStructure?: string | undefined;
501
554
  loanAmount?: MonetaryQuantity$Outbound | string | undefined;
502
555
  requestedLoanAmount?: MonetaryQuantity$Outbound | undefined;
503
- purpose?: string | undefined;
556
+ purpose?: string | string | string | undefined;
504
557
  term?: number | undefined;
505
558
  brokerage?:
506
559
  | MonetaryQuantity$Outbound
@@ -535,7 +588,11 @@ export const LoanDetailsAttributes$outboundSchema: z.ZodType<
535
588
  repaymentStructure: RepaymentStructure$outboundSchema.optional(),
536
589
  loanAmount: z.union([MonetaryQuantity$outboundSchema, z.string()]).optional(),
537
590
  requestedLoanAmount: MonetaryQuantity$outboundSchema.optional(),
538
- purpose: z.string().optional(),
591
+ purpose: z.union([
592
+ PersonalLoanPurpose$outboundSchema,
593
+ BusinessLoanPurpose$outboundSchema,
594
+ z.string(),
595
+ ]).optional(),
539
596
  term: z.number().int().optional(),
540
597
  brokerage: z.union([
541
598
  MonetaryQuantity$outboundSchema,
@@ -30,6 +30,42 @@ export type PersonalApplicationResourceApplicationType = ClosedEnum<
30
30
  typeof PersonalApplicationResourceApplicationType
31
31
  >;
32
32
 
33
+ /**
34
+ * The lender with whom the application has settled
35
+ */
36
+ export const PersonalApplicationResourceLender = {
37
+ Metro: "metro",
38
+ Pepper: "pepper",
39
+ Flexi: "flexi",
40
+ Angle: "angle",
41
+ Resimac: "resimac",
42
+ Scotpac: "scotpac",
43
+ Grow: "grow",
44
+ Macquarie: "macquarie",
45
+ Plenti: "plenti",
46
+ AzoraAssetFinance: "azora_asset_finance",
47
+ Moneyplace: "moneyplace",
48
+ Wisr: "wisr",
49
+ Money3: "money3",
50
+ FinanceOne: "finance_one",
51
+ Now: "now",
52
+ Afs: "afs",
53
+ Autopay: "autopay",
54
+ Ammf: "ammf",
55
+ Dynamoney: "dynamoney",
56
+ Firstmac: "firstmac",
57
+ Latitude: "latitude",
58
+ Branded: "branded",
59
+ Liberty: "liberty",
60
+ Westpac: "westpac",
61
+ } as const;
62
+ /**
63
+ * The lender with whom the application has settled
64
+ */
65
+ export type PersonalApplicationResourceLender = ClosedEnum<
66
+ typeof PersonalApplicationResourceLender
67
+ >;
68
+
33
69
  /**
34
70
  * Application resource attributes
35
71
  */
@@ -58,6 +94,10 @@ export type PersonalApplicationResourceAttributes = {
58
94
  * If the application has settled with a lender, the lender's identifier of the application, distinct from Financeable's
59
95
  */
60
96
  lenderApplicationReference?: string | undefined;
97
+ /**
98
+ * The lender with whom the application has settled
99
+ */
100
+ lender?: PersonalApplicationResourceLender | undefined;
61
101
  /**
62
102
  * Creation timestamp
63
103
  */
@@ -91,6 +131,11 @@ export const PersonalApplicationResourceApplicationType$inboundSchema:
91
131
  z.ZodNativeEnum<typeof PersonalApplicationResourceApplicationType> = z
92
132
  .nativeEnum(PersonalApplicationResourceApplicationType);
93
133
 
134
+ /** @internal */
135
+ export const PersonalApplicationResourceLender$inboundSchema: z.ZodNativeEnum<
136
+ typeof PersonalApplicationResourceLender
137
+ > = z.nativeEnum(PersonalApplicationResourceLender);
138
+
94
139
  /** @internal */
95
140
  export const PersonalApplicationResourceAttributes$inboundSchema: z.ZodType<
96
141
  PersonalApplicationResourceAttributes,
@@ -103,6 +148,7 @@ export const PersonalApplicationResourceAttributes$inboundSchema: z.ZodType<
103
148
  status: ApplicationStatus$inboundSchema,
104
149
  settlementDate: z.string().optional(),
105
150
  lenderApplicationReference: z.string().optional(),
151
+ lender: PersonalApplicationResourceLender$inboundSchema.optional(),
106
152
  createdAt: z.string().optional(),
107
153
  updatedAt: z.string().optional(),
108
154
  });
@@ -0,0 +1,29 @@
1
+ /*
2
+ * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
3
+ */
4
+
5
+ import * as z from "zod/v3";
6
+ import { ClosedEnum } from "../../types/enums.js";
7
+
8
+ export const PersonalLoanPurpose = {
9
+ Vehicle: "VEHICLE",
10
+ DebtConsolidation: "DEBT_CONSOLIDATION",
11
+ HomeImprovements: "HOME_IMPROVEMENTS",
12
+ MedicalAndDental: "MEDICAL_AND_DENTAL",
13
+ HouseholdFurnishings: "HOUSEHOLD_FURNISHINGS",
14
+ Education: "EDUCATION",
15
+ Travel: "TRAVEL",
16
+ Wedding: "WEDDING",
17
+ MortgageCostFunding: "MORTGAGE_COST_FUNDING",
18
+ OtherPersonalUse: "OTHER_PERSONAL_USE",
19
+ } as const;
20
+ export type PersonalLoanPurpose = ClosedEnum<typeof PersonalLoanPurpose>;
21
+
22
+ /** @internal */
23
+ export const PersonalLoanPurpose$inboundSchema: z.ZodNativeEnum<
24
+ typeof PersonalLoanPurpose
25
+ > = z.nativeEnum(PersonalLoanPurpose);
26
+ /** @internal */
27
+ export const PersonalLoanPurpose$outboundSchema: z.ZodNativeEnum<
28
+ typeof PersonalLoanPurpose
29
+ > = PersonalLoanPurpose$inboundSchema;