@financeable/aggregation 0.13.4 → 0.14.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.devcontainer/devcontainer.json +45 -0
- package/FUNCTIONS.md +240 -0
- package/RUNTIMES.md +48 -0
- package/core.js.map +1 -0
- package/examples/applicationsCreate.example.ts +179 -0
- package/examples/package-lock.json +610 -0
- package/examples/package.json +18 -0
- package/index.js.map +1 -0
- package/jsr.json +27 -0
- package/lib/config.d.ts +3 -3
- package/lib/config.js +3 -3
- package/lib/config.js.map +1 -1
- package/models/components/abnstatus.d.ts +10 -0
- package/models/components/abnstatus.d.ts.map +1 -0
- package/models/components/abnstatus.js +48 -0
- package/models/components/abnstatus.js.map +1 -0
- package/models/components/businessapplicationresource.d.ts +39 -0
- package/models/components/businessapplicationresource.d.ts.map +1 -1
- package/models/components/businessapplicationresource.js +33 -1
- package/models/components/businessapplicationresource.js.map +1 -1
- package/models/components/commercialsecuredapplicationresource.d.ts +39 -0
- package/models/components/commercialsecuredapplicationresource.d.ts.map +1 -1
- package/models/components/commercialsecuredapplicationresource.js +34 -1
- package/models/components/commercialsecuredapplicationresource.js.map +1 -1
- package/models/components/commercialsecuredloancommercialapplicationrelationships.d.ts +101 -6
- package/models/components/commercialsecuredloancommercialapplicationrelationships.d.ts.map +1 -1
- package/models/components/commercialsecuredloancommercialapplicationrelationships.js +69 -7
- package/models/components/commercialsecuredloancommercialapplicationrelationships.js.map +1 -1
- package/models/components/consumersecuredapplicationresource.d.ts +39 -0
- package/models/components/consumersecuredapplicationresource.d.ts.map +1 -1
- package/models/components/consumersecuredapplicationresource.js +34 -1
- package/models/components/consumersecuredapplicationresource.js.map +1 -1
- package/models/components/consumersecuredloanconsumerapplicationrelationships.d.ts +105 -10
- package/models/components/consumersecuredloanconsumerapplicationrelationships.d.ts.map +1 -1
- package/models/components/consumersecuredloanconsumerapplicationrelationships.js +73 -9
- package/models/components/consumersecuredloanconsumerapplicationrelationships.js.map +1 -1
- package/models/components/employerattributes.d.ts +58 -0
- package/models/components/employerattributes.d.ts.map +1 -0
- package/models/components/employerattributes.js +69 -0
- package/models/components/employerattributes.js.map +1 -0
- package/models/components/employmentstatus.d.ts +10 -0
- package/models/components/employmentstatus.d.ts.map +1 -0
- package/models/components/employmentstatus.js +47 -0
- package/models/components/employmentstatus.js.map +1 -0
- package/models/components/employmenttype.d.ts +15 -0
- package/models/components/employmenttype.d.ts.map +1 -0
- package/models/components/employmenttype.js +52 -0
- package/models/components/employmenttype.js.map +1 -0
- package/models/components/entityattributes.d.ts +4 -4
- package/models/components/entityattributes.d.ts.map +1 -1
- package/models/components/entityattributes.js +4 -5
- package/models/components/entityattributes.js.map +1 -1
- package/models/components/entitytype.d.ts +152 -0
- package/models/components/entitytype.d.ts.map +1 -0
- package/models/components/entitytype.js +190 -0
- package/models/components/entitytype.js.map +1 -0
- package/models/components/index.d.ts +7 -0
- package/models/components/index.d.ts.map +1 -1
- package/models/components/index.js +7 -0
- package/models/components/index.js.map +1 -1
- package/models/components/industry.d.ts +27 -0
- package/models/components/industry.d.ts.map +1 -0
- package/models/components/industry.js +65 -0
- package/models/components/industry.js.map +1 -0
- package/models/components/loandetailsattributes.d.ts +3 -3
- package/models/components/occupation.d.ts +201 -0
- package/models/components/occupation.d.ts.map +1 -0
- package/models/components/occupation.js +239 -0
- package/models/components/occupation.js.map +1 -0
- package/models/components/personalapplicationresource.d.ts +39 -0
- package/models/components/personalapplicationresource.d.ts.map +1 -1
- package/models/components/personalapplicationresource.js +33 -1
- package/models/components/personalapplicationresource.js.map +1 -1
- package/models/components/personalloanpersonalapplicationrelationships.d.ts +105 -10
- package/models/components/personalloanpersonalapplicationrelationships.d.ts.map +1 -1
- package/models/components/personalloanpersonalapplicationrelationships.js +71 -9
- package/models/components/personalloanpersonalapplicationrelationships.js.map +1 -1
- package/package.json +5 -17
- package/src/lib/config.ts +3 -3
- package/src/models/components/abnstatus.ts +16 -0
- package/src/models/components/businessapplicationresource.ts +46 -0
- package/src/models/components/commercialsecuredapplicationresource.ts +46 -0
- package/src/models/components/commercialsecuredloancommercialapplicationrelationships.ts +241 -13
- package/src/models/components/consumersecuredapplicationresource.ts +43 -0
- package/src/models/components/consumersecuredloanconsumerapplicationrelationships.ts +275 -19
- package/src/models/components/employerattributes.ts +97 -0
- package/src/models/components/employmentstatus.ts +17 -0
- package/src/models/components/employmenttype.ts +22 -0
- package/src/models/components/entityattributes.ts +9 -6
- package/src/models/components/entitytype.ts +215 -0
- package/src/models/components/index.ts +7 -0
- package/src/models/components/industry.ts +36 -0
- package/src/models/components/loandetailsattributes.ts +3 -3
- package/src/models/components/occupation.ts +226 -0
- package/src/models/components/personalapplicationresource.ts +46 -0
- package/src/models/components/personalloanpersonalapplicationrelationships.ts +272 -20
- package/tsconfig.json +40 -0
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
// For format details, see https://aka.ms/devcontainer.json. For config options, see the
|
|
2
|
+
// README at: https://github.com/devcontainers/images/tree/main/src/typescript-node
|
|
3
|
+
{
|
|
4
|
+
"name": "TypeScript",
|
|
5
|
+
"image": "mcr.microsoft.com/devcontainers/typescript-node:1-20-bullseye",
|
|
6
|
+
// Features to add to the dev container. More info: https://containers.dev/features.
|
|
7
|
+
// "features": {},
|
|
8
|
+
// Use 'forwardPorts' to make a list of ports inside the container available locally.
|
|
9
|
+
// "forwardPorts": [],
|
|
10
|
+
// Use 'postCreateCommand' to run commands after the container is created.
|
|
11
|
+
"postCreateCommand": "sudo chmod +x ./.devcontainer/setup.sh && ./.devcontainer/setup.sh",
|
|
12
|
+
"customizations": {
|
|
13
|
+
"vscode": {
|
|
14
|
+
"extensions": [
|
|
15
|
+
"ms-vscode.vscode-typescript-tslint-plugin",
|
|
16
|
+
"esbenp.prettier-vscode",
|
|
17
|
+
"github.vscode-pull-request-github"
|
|
18
|
+
],
|
|
19
|
+
"settings": {
|
|
20
|
+
"files.eol": "\n",
|
|
21
|
+
"editor.formatOnSave": true,
|
|
22
|
+
"typescript.tsc.autoDetect": "on",
|
|
23
|
+
"typescript.updateImportsOnFileMove.enabled": "always",
|
|
24
|
+
"typescript.preferences.importModuleSpecifier": "relative",
|
|
25
|
+
"[typescript]": {
|
|
26
|
+
"editor.codeActionsOnSave": {
|
|
27
|
+
"source.organizeImports": true
|
|
28
|
+
}
|
|
29
|
+
},
|
|
30
|
+
"[typescriptreact]": {
|
|
31
|
+
"editor.codeActionsOnSave": {
|
|
32
|
+
"source.organizeImports": true
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
},
|
|
37
|
+
"codespaces": {
|
|
38
|
+
"openFiles": [
|
|
39
|
+
".devcontainer/README.md"
|
|
40
|
+
]
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
// Uncomment to connect as root instead. More info: https://aka.ms/dev-containers-non-root.
|
|
44
|
+
// "remoteUser": "root"
|
|
45
|
+
}
|
package/FUNCTIONS.md
ADDED
|
@@ -0,0 +1,240 @@
|
|
|
1
|
+
# Standalone Functions
|
|
2
|
+
|
|
3
|
+
> [!NOTE]
|
|
4
|
+
> This section is useful if you are using a bundler and targetting browsers and
|
|
5
|
+
> runtimes where the size of an application affects performance and load times.
|
|
6
|
+
|
|
7
|
+
Every method in this SDK is also available as a standalone function. This
|
|
8
|
+
alternative API is suitable when targetting the browser or serverless runtimes
|
|
9
|
+
and using a bundler to build your application since all unused functionality
|
|
10
|
+
will be tree-shaken away. This includes code for unused methods, Zod schemas,
|
|
11
|
+
encoding helpers and response handlers. The result is dramatically smaller
|
|
12
|
+
impact on the application's final bundle size which grows very slowly as you use
|
|
13
|
+
more and more functionality from this SDK.
|
|
14
|
+
|
|
15
|
+
Calling methods through the main SDK class remains a valid and generally more
|
|
16
|
+
more ergonomic option. Standalone functions represent an optimisation for a
|
|
17
|
+
specific category of applications.
|
|
18
|
+
|
|
19
|
+
## Example
|
|
20
|
+
|
|
21
|
+
```typescript
|
|
22
|
+
import { FinanceableCore } from "@financeable/aggregation/core.js";
|
|
23
|
+
import { applicationsCreate } from "@financeable/aggregation/funcs/applicationsCreate.js";
|
|
24
|
+
|
|
25
|
+
// Use `FinanceableCore` for best tree-shaking performance.
|
|
26
|
+
// You can create one instance of it to use across an application.
|
|
27
|
+
const financeable = new FinanceableCore({
|
|
28
|
+
clientCredentials: process.env["FINANCEABLE_CLIENT_CREDENTIALS"] ?? "",
|
|
29
|
+
});
|
|
30
|
+
|
|
31
|
+
async function run() {
|
|
32
|
+
const res = await applicationsCreate(financeable, {
|
|
33
|
+
data: {
|
|
34
|
+
type: "entities",
|
|
35
|
+
attributes: {
|
|
36
|
+
applicationType: "consumerSecured",
|
|
37
|
+
associatedBrokerEmail: "<value>",
|
|
38
|
+
},
|
|
39
|
+
relationships: {
|
|
40
|
+
customers: {
|
|
41
|
+
data: [
|
|
42
|
+
{
|
|
43
|
+
type: "customers",
|
|
44
|
+
attributes: {
|
|
45
|
+
title: "Mr",
|
|
46
|
+
firstName: "Courtney",
|
|
47
|
+
lastName: "Greenfelder",
|
|
48
|
+
dateOfBirth: "1981-06-22",
|
|
49
|
+
idExpiryDate: "<value>",
|
|
50
|
+
},
|
|
51
|
+
relationships: {
|
|
52
|
+
addresses: {
|
|
53
|
+
data: [
|
|
54
|
+
{
|
|
55
|
+
type: "addresses",
|
|
56
|
+
attributes: {
|
|
57
|
+
id: "12345678901",
|
|
58
|
+
addressType: "residential",
|
|
59
|
+
fullAddress: "42 Wallaby Way, Sydney NSW 2000",
|
|
60
|
+
city: "Sydney",
|
|
61
|
+
postCode: "2000",
|
|
62
|
+
streetAddress: "42 Wallaby Way",
|
|
63
|
+
addressLine2: "",
|
|
64
|
+
streetNumber: "42",
|
|
65
|
+
streetType: "Way",
|
|
66
|
+
street: "Wallaby",
|
|
67
|
+
state: "NSW",
|
|
68
|
+
country: "Australia",
|
|
69
|
+
status: "current",
|
|
70
|
+
monthsAt: 24,
|
|
71
|
+
yearsAt: 2,
|
|
72
|
+
},
|
|
73
|
+
},
|
|
74
|
+
],
|
|
75
|
+
},
|
|
76
|
+
},
|
|
77
|
+
},
|
|
78
|
+
{
|
|
79
|
+
type: "customers",
|
|
80
|
+
attributes: {
|
|
81
|
+
title: "Mr",
|
|
82
|
+
firstName: "Courtney",
|
|
83
|
+
lastName: "Greenfelder",
|
|
84
|
+
dateOfBirth: "1981-06-22",
|
|
85
|
+
idExpiryDate: "<value>",
|
|
86
|
+
},
|
|
87
|
+
relationships: {
|
|
88
|
+
addresses: {
|
|
89
|
+
data: [
|
|
90
|
+
{
|
|
91
|
+
type: "addresses",
|
|
92
|
+
attributes: {
|
|
93
|
+
id: "12345678901",
|
|
94
|
+
addressType: "residential",
|
|
95
|
+
fullAddress: "42 Wallaby Way, Sydney NSW 2000",
|
|
96
|
+
city: "Sydney",
|
|
97
|
+
postCode: "2000",
|
|
98
|
+
streetAddress: "42 Wallaby Way",
|
|
99
|
+
addressLine2: "",
|
|
100
|
+
streetNumber: "42",
|
|
101
|
+
streetType: "Way",
|
|
102
|
+
street: "Wallaby",
|
|
103
|
+
state: "NSW",
|
|
104
|
+
country: "Australia",
|
|
105
|
+
status: "current",
|
|
106
|
+
monthsAt: 24,
|
|
107
|
+
yearsAt: 2,
|
|
108
|
+
},
|
|
109
|
+
},
|
|
110
|
+
],
|
|
111
|
+
},
|
|
112
|
+
},
|
|
113
|
+
},
|
|
114
|
+
{
|
|
115
|
+
type: "customers",
|
|
116
|
+
attributes: {
|
|
117
|
+
title: "Mr",
|
|
118
|
+
firstName: "Courtney",
|
|
119
|
+
lastName: "Greenfelder",
|
|
120
|
+
dateOfBirth: "1981-06-22",
|
|
121
|
+
idExpiryDate: "<value>",
|
|
122
|
+
},
|
|
123
|
+
relationships: {
|
|
124
|
+
addresses: {
|
|
125
|
+
data: [
|
|
126
|
+
{
|
|
127
|
+
type: "addresses",
|
|
128
|
+
attributes: {
|
|
129
|
+
id: "12345678901",
|
|
130
|
+
addressType: "residential",
|
|
131
|
+
fullAddress: "42 Wallaby Way, Sydney NSW 2000",
|
|
132
|
+
city: "Sydney",
|
|
133
|
+
postCode: "2000",
|
|
134
|
+
streetAddress: "42 Wallaby Way",
|
|
135
|
+
addressLine2: "",
|
|
136
|
+
streetNumber: "42",
|
|
137
|
+
streetType: "Way",
|
|
138
|
+
street: "Wallaby",
|
|
139
|
+
state: "NSW",
|
|
140
|
+
country: "Australia",
|
|
141
|
+
status: "current",
|
|
142
|
+
monthsAt: 24,
|
|
143
|
+
yearsAt: 2,
|
|
144
|
+
},
|
|
145
|
+
},
|
|
146
|
+
],
|
|
147
|
+
},
|
|
148
|
+
},
|
|
149
|
+
},
|
|
150
|
+
],
|
|
151
|
+
},
|
|
152
|
+
asset: {
|
|
153
|
+
data: {
|
|
154
|
+
type: "assets",
|
|
155
|
+
attributes: {
|
|
156
|
+
id: "12345678901",
|
|
157
|
+
ageOfAsset: 3,
|
|
158
|
+
ageOfAssetAtEnd: 8,
|
|
159
|
+
condition: "USED",
|
|
160
|
+
assetType: "CARAVAN",
|
|
161
|
+
assetValue: "35000.00",
|
|
162
|
+
make: "Toyota",
|
|
163
|
+
assetModel: "Camry",
|
|
164
|
+
registrationNumber: "ABC123",
|
|
165
|
+
registrationState: "VIC",
|
|
166
|
+
vin: "1HGCM82633A123456",
|
|
167
|
+
supplierName: "Mr and Mrs Smith",
|
|
168
|
+
supplierABN: "12345678901",
|
|
169
|
+
supplierAddress: "123 Car Street, Melbourne VIC 3000",
|
|
170
|
+
supplierPhone: "0412345678",
|
|
171
|
+
supplierContactName: "John Smith",
|
|
172
|
+
supplierEmail: "john.smith@mrandmrssmith.com.au",
|
|
173
|
+
privateSale: false,
|
|
174
|
+
typeOfSale: "AUTHORISED_SELLER",
|
|
175
|
+
description: "2020 Toyota Camry Hybrid SL, Silver, 45,000km",
|
|
176
|
+
netAssetValue: "32000.00",
|
|
177
|
+
isLuxury: false,
|
|
178
|
+
additionalFees: "995.00",
|
|
179
|
+
additionalTaxes: "0.00",
|
|
180
|
+
},
|
|
181
|
+
},
|
|
182
|
+
},
|
|
183
|
+
},
|
|
184
|
+
},
|
|
185
|
+
});
|
|
186
|
+
if (res.ok) {
|
|
187
|
+
const { value: result } = res;
|
|
188
|
+
console.log(result);
|
|
189
|
+
} else {
|
|
190
|
+
console.log("applicationsCreate failed:", res.error);
|
|
191
|
+
}
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
run();
|
|
195
|
+
```
|
|
196
|
+
|
|
197
|
+
## Result types
|
|
198
|
+
|
|
199
|
+
Standalone functions differ from SDK methods in that they return a
|
|
200
|
+
`Result<Value, Error>` type to capture _known errors_ and document them using
|
|
201
|
+
the type system. By avoiding throwing errors, application code maintains clear
|
|
202
|
+
control flow and error-handling become part of the regular flow of application
|
|
203
|
+
code.
|
|
204
|
+
|
|
205
|
+
> We use the term "known errors" because standalone functions, and JavaScript
|
|
206
|
+
> code in general, can still throw unexpected errors such as `TypeError`s,
|
|
207
|
+
> `RangeError`s and `DOMException`s. Exhaustively catching all errors may be
|
|
208
|
+
> something this SDK addresses in the future. Nevertheless, there is still a lot
|
|
209
|
+
> of benefit from capturing most errors and turning them into values.
|
|
210
|
+
|
|
211
|
+
The second reason for this style of programming is because these functions will
|
|
212
|
+
typically be used in front-end applications where exception throwing is
|
|
213
|
+
sometimes discouraged or considered unidiomatic. React and similar ecosystems
|
|
214
|
+
and libraries tend to promote this style of programming so that components
|
|
215
|
+
render useful content under all states (loading, success, error and so on).
|
|
216
|
+
|
|
217
|
+
The general pattern when calling standalone functions looks like this:
|
|
218
|
+
|
|
219
|
+
```typescript
|
|
220
|
+
import { Core } from "<sdk-package-name>";
|
|
221
|
+
import { fetchSomething } from "<sdk-package-name>/funcs/fetchSomething.js";
|
|
222
|
+
|
|
223
|
+
const client = new Core();
|
|
224
|
+
|
|
225
|
+
async function run() {
|
|
226
|
+
const result = await fetchSomething(client, { id: "123" });
|
|
227
|
+
if (!result.ok) {
|
|
228
|
+
// You can throw the error or handle it. It's your choice now.
|
|
229
|
+
throw result.error;
|
|
230
|
+
}
|
|
231
|
+
|
|
232
|
+
console.log(result.value);
|
|
233
|
+
}
|
|
234
|
+
|
|
235
|
+
run();
|
|
236
|
+
```
|
|
237
|
+
|
|
238
|
+
Notably, `result.error` above will have an explicit type compared to a try-catch
|
|
239
|
+
variation where the error in the catch block can only be of type `unknown` (or
|
|
240
|
+
`any` depending on your TypeScript settings).
|
package/RUNTIMES.md
ADDED
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
# Supported JavaScript runtimes
|
|
2
|
+
|
|
3
|
+
This SDK is intended to be used in JavaScript runtimes that support ECMAScript 2020 or newer. The SDK uses the following features:
|
|
4
|
+
|
|
5
|
+
- [Web Fetch API][web-fetch]
|
|
6
|
+
- [Web Streams API][web-streams] and in particular `ReadableStream`
|
|
7
|
+
- [Async iterables][async-iter] using `Symbol.asyncIterator`
|
|
8
|
+
|
|
9
|
+
[web-fetch]: https://developer.mozilla.org/en-US/docs/Web/API/Fetch_API
|
|
10
|
+
[web-streams]: https://developer.mozilla.org/en-US/docs/Web/API/Streams_API
|
|
11
|
+
[async-iter]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols#the_async_iterator_and_async_iterable_protocols
|
|
12
|
+
|
|
13
|
+
Runtime environments that are explicitly supported are:
|
|
14
|
+
|
|
15
|
+
- Evergreen browsers which include: Chrome, Safari, Edge, Firefox
|
|
16
|
+
- Node.js active and maintenance LTS releases
|
|
17
|
+
- Currently, this is v18 and v20
|
|
18
|
+
- Bun v1 and above
|
|
19
|
+
- Deno v1.39
|
|
20
|
+
- Note that Deno does not currently have native support for streaming file uploads backed by the filesystem ([issue link][deno-file-streaming])
|
|
21
|
+
|
|
22
|
+
[deno-file-streaming]: https://github.com/denoland/deno/issues/11018
|
|
23
|
+
|
|
24
|
+
## Recommended TypeScript compiler options
|
|
25
|
+
|
|
26
|
+
The following `tsconfig.json` options are recommended for projects using this
|
|
27
|
+
SDK in order to get static type support for features like async iterables,
|
|
28
|
+
streams and `fetch`-related APIs ([`for await...of`][for-await-of],
|
|
29
|
+
[`AbortSignal`][abort-signal], [`Request`][request], [`Response`][response] and
|
|
30
|
+
so on):
|
|
31
|
+
|
|
32
|
+
[for-await-of]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/for-await...of
|
|
33
|
+
[abort-signal]: https://developer.mozilla.org/en-US/docs/Web/API/AbortSignal
|
|
34
|
+
[request]: https://developer.mozilla.org/en-US/docs/Web/API/Request
|
|
35
|
+
[response]: https://developer.mozilla.org/en-US/docs/Web/API/Response
|
|
36
|
+
|
|
37
|
+
```jsonc
|
|
38
|
+
{
|
|
39
|
+
"compilerOptions": {
|
|
40
|
+
"target": "es2020", // or higher
|
|
41
|
+
"lib": ["es2020", "dom", "dom.iterable"]
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
While `target` can be set to older ECMAScript versions, it may result in extra,
|
|
47
|
+
unnecessary compatibility code being generated if you are not targeting old
|
|
48
|
+
runtimes.
|
package/core.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"core.js","sourceRoot":"","sources":["src/core.ts"],"names":[],"mappings":";AAAA;;GAEG;;;AAEH,2CAA0C;AAE1C;;;;;GAKG;AACH,MAAa,eAAgB,SAAQ,mBAAS;CAAG;AAAjD,0CAAiD"}
|
|
@@ -0,0 +1,179 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
import dotenv from "dotenv";
|
|
6
|
+
dotenv.config();
|
|
7
|
+
/**
|
|
8
|
+
* Example usage of the @financeable/aggregation SDK
|
|
9
|
+
*
|
|
10
|
+
* To run this example from the examples directory:
|
|
11
|
+
* npm run build && npx tsx applicationsCreate.example.ts
|
|
12
|
+
*/
|
|
13
|
+
|
|
14
|
+
import { Financeable } from "@financeable/aggregation";
|
|
15
|
+
|
|
16
|
+
const financeable = new Financeable({
|
|
17
|
+
clientCredentials: process.env["FINANCEABLE_CLIENT_CREDENTIALS"] ?? "",
|
|
18
|
+
});
|
|
19
|
+
|
|
20
|
+
async function main() {
|
|
21
|
+
const result = await financeable.applications.create({
|
|
22
|
+
data: {
|
|
23
|
+
type: "entities",
|
|
24
|
+
attributes: {
|
|
25
|
+
applicationType: "consumerSecured",
|
|
26
|
+
associatedBrokerEmail: "<value>",
|
|
27
|
+
},
|
|
28
|
+
relationships: {
|
|
29
|
+
customers: {
|
|
30
|
+
data: [
|
|
31
|
+
{
|
|
32
|
+
type: "customers",
|
|
33
|
+
attributes: {
|
|
34
|
+
title: "Mr",
|
|
35
|
+
firstName: "Courtney",
|
|
36
|
+
lastName: "Greenfelder",
|
|
37
|
+
dateOfBirth: "1981-06-22",
|
|
38
|
+
idExpiryDate: "<value>",
|
|
39
|
+
},
|
|
40
|
+
relationships: {
|
|
41
|
+
addresses: {
|
|
42
|
+
data: [
|
|
43
|
+
{
|
|
44
|
+
type: "addresses",
|
|
45
|
+
attributes: {
|
|
46
|
+
id: "12345678901",
|
|
47
|
+
addressType: "residential",
|
|
48
|
+
fullAddress: "42 Wallaby Way, Sydney NSW 2000",
|
|
49
|
+
city: "Sydney",
|
|
50
|
+
postCode: "2000",
|
|
51
|
+
streetAddress: "42 Wallaby Way",
|
|
52
|
+
addressLine2: "",
|
|
53
|
+
streetNumber: "42",
|
|
54
|
+
streetType: "Way",
|
|
55
|
+
street: "Wallaby",
|
|
56
|
+
state: "NSW",
|
|
57
|
+
country: "Australia",
|
|
58
|
+
status: "current",
|
|
59
|
+
monthsAt: 24,
|
|
60
|
+
yearsAt: 2,
|
|
61
|
+
},
|
|
62
|
+
},
|
|
63
|
+
],
|
|
64
|
+
},
|
|
65
|
+
},
|
|
66
|
+
},
|
|
67
|
+
{
|
|
68
|
+
type: "customers",
|
|
69
|
+
attributes: {
|
|
70
|
+
title: "Mr",
|
|
71
|
+
firstName: "Courtney",
|
|
72
|
+
lastName: "Greenfelder",
|
|
73
|
+
dateOfBirth: "1981-06-22",
|
|
74
|
+
idExpiryDate: "<value>",
|
|
75
|
+
},
|
|
76
|
+
relationships: {
|
|
77
|
+
addresses: {
|
|
78
|
+
data: [
|
|
79
|
+
{
|
|
80
|
+
type: "addresses",
|
|
81
|
+
attributes: {
|
|
82
|
+
id: "12345678901",
|
|
83
|
+
addressType: "residential",
|
|
84
|
+
fullAddress: "42 Wallaby Way, Sydney NSW 2000",
|
|
85
|
+
city: "Sydney",
|
|
86
|
+
postCode: "2000",
|
|
87
|
+
streetAddress: "42 Wallaby Way",
|
|
88
|
+
addressLine2: "",
|
|
89
|
+
streetNumber: "42",
|
|
90
|
+
streetType: "Way",
|
|
91
|
+
street: "Wallaby",
|
|
92
|
+
state: "NSW",
|
|
93
|
+
country: "Australia",
|
|
94
|
+
status: "current",
|
|
95
|
+
monthsAt: 24,
|
|
96
|
+
yearsAt: 2,
|
|
97
|
+
},
|
|
98
|
+
},
|
|
99
|
+
],
|
|
100
|
+
},
|
|
101
|
+
},
|
|
102
|
+
},
|
|
103
|
+
{
|
|
104
|
+
type: "customers",
|
|
105
|
+
attributes: {
|
|
106
|
+
title: "Mr",
|
|
107
|
+
firstName: "Courtney",
|
|
108
|
+
lastName: "Greenfelder",
|
|
109
|
+
dateOfBirth: "1981-06-22",
|
|
110
|
+
idExpiryDate: "<value>",
|
|
111
|
+
},
|
|
112
|
+
relationships: {
|
|
113
|
+
addresses: {
|
|
114
|
+
data: [
|
|
115
|
+
{
|
|
116
|
+
type: "addresses",
|
|
117
|
+
attributes: {
|
|
118
|
+
id: "12345678901",
|
|
119
|
+
addressType: "residential",
|
|
120
|
+
fullAddress: "42 Wallaby Way, Sydney NSW 2000",
|
|
121
|
+
city: "Sydney",
|
|
122
|
+
postCode: "2000",
|
|
123
|
+
streetAddress: "42 Wallaby Way",
|
|
124
|
+
addressLine2: "",
|
|
125
|
+
streetNumber: "42",
|
|
126
|
+
streetType: "Way",
|
|
127
|
+
street: "Wallaby",
|
|
128
|
+
state: "NSW",
|
|
129
|
+
country: "Australia",
|
|
130
|
+
status: "current",
|
|
131
|
+
monthsAt: 24,
|
|
132
|
+
yearsAt: 2,
|
|
133
|
+
},
|
|
134
|
+
},
|
|
135
|
+
],
|
|
136
|
+
},
|
|
137
|
+
},
|
|
138
|
+
},
|
|
139
|
+
],
|
|
140
|
+
},
|
|
141
|
+
asset: {
|
|
142
|
+
data: {
|
|
143
|
+
type: "assets",
|
|
144
|
+
attributes: {
|
|
145
|
+
id: "12345678901",
|
|
146
|
+
ageOfAsset: 3,
|
|
147
|
+
ageOfAssetAtEnd: 8,
|
|
148
|
+
condition: "USED",
|
|
149
|
+
assetType: "CARAVAN",
|
|
150
|
+
assetValue: "35000.00",
|
|
151
|
+
make: "Toyota",
|
|
152
|
+
assetModel: "Camry",
|
|
153
|
+
registrationNumber: "ABC123",
|
|
154
|
+
registrationState: "VIC",
|
|
155
|
+
vin: "1HGCM82633A123456",
|
|
156
|
+
supplierName: "Mr and Mrs Smith",
|
|
157
|
+
supplierABN: "12345678901",
|
|
158
|
+
supplierAddress: "123 Car Street, Melbourne VIC 3000",
|
|
159
|
+
supplierPhone: "0412345678",
|
|
160
|
+
supplierContactName: "John Smith",
|
|
161
|
+
supplierEmail: "john.smith@mrandmrssmith.com.au",
|
|
162
|
+
privateSale: false,
|
|
163
|
+
typeOfSale: "AUTHORISED_SELLER",
|
|
164
|
+
description: "2020 Toyota Camry Hybrid SL, Silver, 45,000km",
|
|
165
|
+
netAssetValue: "32000.00",
|
|
166
|
+
isLuxury: false,
|
|
167
|
+
additionalFees: "995.00",
|
|
168
|
+
additionalTaxes: "0.00",
|
|
169
|
+
},
|
|
170
|
+
},
|
|
171
|
+
},
|
|
172
|
+
},
|
|
173
|
+
},
|
|
174
|
+
});
|
|
175
|
+
|
|
176
|
+
console.log(result);
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
main().catch(console.error);
|