@financeable/aggregation 0.5.1 → 0.6.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/FUNCTIONS.md +14 -131
- package/README.md +271 -1512
- package/docs/sdks/applications/README.md +24 -383
- package/docs/sdks/oauthtoken/README.md +5 -5
- package/docs/sdks/supportingdocuments/README.md +121 -0
- package/funcs/applicationsCreate.d.ts +1 -2
- package/funcs/applicationsCreate.d.ts.map +1 -1
- package/funcs/applicationsCreate.js +3 -4
- package/funcs/applicationsCreate.js.map +1 -1
- package/funcs/{oauthTokenGet.d.ts → oauthTokenOauthToken.d.ts} +2 -2
- package/funcs/oauthTokenOauthToken.d.ts.map +1 -0
- package/funcs/{oauthTokenGet.js → oauthTokenOauthToken.js} +3 -3
- package/funcs/oauthTokenOauthToken.js.map +1 -0
- package/funcs/supportingDocumentsCreate.d.ts +14 -0
- package/funcs/supportingDocumentsCreate.d.ts.map +1 -0
- package/funcs/{applicationsList.js → supportingDocumentsCreate.js} +14 -12
- package/funcs/supportingDocumentsCreate.js.map +1 -0
- package/jsr.json +1 -1
- package/lib/config.d.ts +4 -4
- package/lib/config.d.ts.map +1 -1
- package/lib/config.js +4 -7
- package/lib/config.js.map +1 -1
- package/lib/matchers.d.ts +3 -1
- package/lib/matchers.d.ts.map +1 -1
- package/lib/matchers.js +12 -0
- package/lib/matchers.js.map +1 -1
- package/lib/sdks.d.ts +3 -1
- package/lib/sdks.d.ts.map +1 -1
- package/lib/sdks.js +13 -13
- package/lib/sdks.js.map +1 -1
- package/models/components/addressattributes.d.ts +10 -8
- package/models/components/addressattributes.d.ts.map +1 -1
- package/models/components/addressattributes.js +15 -14
- package/models/components/addressattributes.js.map +1 -1
- package/models/components/applicationresource.d.ts +30 -0
- package/models/components/applicationresource.d.ts.map +1 -0
- package/models/components/applicationresource.js +73 -0
- package/models/components/applicationresource.js.map +1 -0
- package/models/components/badrequesterror.d.ts +119 -0
- package/models/components/badrequesterror.d.ts.map +1 -0
- package/models/components/badrequesterror.js +140 -0
- package/models/components/badrequesterror.js.map +1 -0
- package/models/components/commercialapplicationjsonapirelationships.d.ts +384 -0
- package/models/components/commercialapplicationjsonapirelationships.d.ts.map +1 -0
- package/models/components/commercialapplicationjsonapirelationships.js +391 -0
- package/models/components/commercialapplicationjsonapirelationships.js.map +1 -0
- package/models/components/commercialsecuredapplicationpayload.d.ts +164 -0
- package/models/components/commercialsecuredapplicationpayload.d.ts.map +1 -0
- package/models/components/commercialsecuredapplicationpayload.js +158 -0
- package/models/components/commercialsecuredapplicationpayload.js.map +1 -0
- package/models/components/commercialsecuredapplicationresource.d.ts +171 -0
- package/models/components/commercialsecuredapplicationresource.d.ts.map +1 -0
- package/models/components/commercialsecuredapplicationresource.js +161 -0
- package/models/components/commercialsecuredapplicationresource.js.map +1 -0
- package/models/components/commercialsecuredloanassetattributes.d.ts +237 -0
- package/models/components/commercialsecuredloanassetattributes.d.ts.map +1 -0
- package/models/components/commercialsecuredloanassetattributes.js +170 -0
- package/models/components/commercialsecuredloanassetattributes.js.map +1 -0
- package/models/components/commercialsecuredloanassettype.d.ts +100 -0
- package/models/components/commercialsecuredloanassettype.d.ts.map +1 -0
- package/models/components/commercialsecuredloanassettype.js +84 -0
- package/models/components/commercialsecuredloanassettype.js.map +1 -0
- package/models/components/commercialsecuredloancommercialapplicationrelationships.d.ts +537 -0
- package/models/components/commercialsecuredloancommercialapplicationrelationships.d.ts.map +1 -0
- package/models/components/commercialsecuredloancommercialapplicationrelationships.js +548 -0
- package/models/components/commercialsecuredloancommercialapplicationrelationships.js.map +1 -0
- package/models/components/consumerapplicationjsonapirelationships.d.ts +296 -0
- package/models/components/consumerapplicationjsonapirelationships.d.ts.map +1 -0
- package/models/components/consumerapplicationjsonapirelationships.js +310 -0
- package/models/components/consumerapplicationjsonapirelationships.js.map +1 -0
- package/models/components/consumersecuredapplicationpayload.d.ts +164 -0
- package/models/components/consumersecuredapplicationpayload.d.ts.map +1 -0
- package/models/components/consumersecuredapplicationpayload.js +158 -0
- package/models/components/consumersecuredapplicationpayload.js.map +1 -0
- package/models/components/consumersecuredapplicationresource.d.ts +171 -0
- package/models/components/consumersecuredapplicationresource.d.ts.map +1 -0
- package/models/components/consumersecuredapplicationresource.js +161 -0
- package/models/components/consumersecuredapplicationresource.js.map +1 -0
- package/models/components/consumersecuredloanassetattributes.d.ts +237 -0
- package/models/components/consumersecuredloanassetattributes.d.ts.map +1 -0
- package/models/components/consumersecuredloanassetattributes.js +172 -0
- package/models/components/consumersecuredloanassetattributes.js.map +1 -0
- package/models/components/consumersecuredloanassettype.d.ts +64 -0
- package/models/components/consumersecuredloanassettype.d.ts.map +1 -0
- package/models/components/{consumerassettype.js → consumersecuredloanassettype.js} +27 -28
- package/models/components/consumersecuredloanassettype.js.map +1 -0
- package/models/components/consumersecuredloanconsumerapplicationrelationships.d.ts +425 -0
- package/models/components/consumersecuredloanconsumerapplicationrelationships.d.ts.map +1 -0
- package/models/components/consumersecuredloanconsumerapplicationrelationships.js +443 -0
- package/models/components/consumersecuredloanconsumerapplicationrelationships.js.map +1 -0
- package/models/components/createsupportingdocumentsresponse.d.ts +124 -0
- package/models/components/createsupportingdocumentsresponse.d.ts.map +1 -0
- package/models/components/createsupportingdocumentsresponse.js +138 -0
- package/models/components/createsupportingdocumentsresponse.js.map +1 -0
- package/models/components/customerattributes.d.ts +2 -0
- package/models/components/customerattributes.d.ts.map +1 -1
- package/models/components/customerattributes.js +2 -0
- package/models/components/customerattributes.js.map +1 -1
- package/models/components/documenttype.d.ts +70 -0
- package/models/components/documenttype.d.ts.map +1 -0
- package/models/{errors/responsebody.js → components/documenttype.js} +28 -34
- package/models/components/documenttype.js.map +1 -0
- package/models/components/entityattributes.d.ts +2 -22
- package/models/components/entityattributes.d.ts.map +1 -1
- package/models/components/entityattributes.js +2 -19
- package/models/components/entityattributes.js.map +1 -1
- package/models/components/forbiddenerror.d.ts +17 -39
- package/models/components/forbiddenerror.d.ts.map +1 -1
- package/models/components/forbiddenerror.js +27 -46
- package/models/components/forbiddenerror.js.map +1 -1
- package/models/components/index.d.ts +24 -8
- package/models/components/index.d.ts.map +1 -1
- package/models/components/index.js +24 -8
- package/models/components/index.js.map +1 -1
- package/models/components/linkobject.d.ts +47 -0
- package/models/components/linkobject.d.ts.map +1 -0
- package/models/components/{links.js → linkobject.js} +27 -22
- package/models/components/linkobject.js.map +1 -0
- package/models/components/loandetailsattributes.d.ts +2 -0
- package/models/components/loandetailsattributes.d.ts.map +1 -1
- package/models/components/loandetailsattributes.js +2 -0
- package/models/components/loandetailsattributes.js.map +1 -1
- package/models/components/relationshipresourcenotfound.d.ts +116 -0
- package/models/components/relationshipresourcenotfound.d.ts.map +1 -0
- package/models/components/relationshipresourcenotfound.js +139 -0
- package/models/components/relationshipresourcenotfound.js.map +1 -0
- package/models/components/resourcenotfound.d.ts +119 -0
- package/models/components/resourcenotfound.d.ts.map +1 -0
- package/models/components/resourcenotfound.js +139 -0
- package/models/components/resourcenotfound.js.map +1 -0
- package/models/components/supportingdocumentattributes.d.ts +40 -0
- package/models/components/supportingdocumentattributes.d.ts.map +1 -0
- package/models/components/{applicationattributescreate.js → supportingdocumentattributes.js} +24 -24
- package/models/components/supportingdocumentattributes.js.map +1 -0
- package/models/components/supportingdocumentattributesinput.d.ts +38 -0
- package/models/components/supportingdocumentattributesinput.d.ts.map +1 -0
- package/models/components/supportingdocumentattributesinput.js +72 -0
- package/models/components/supportingdocumentattributesinput.js.map +1 -0
- package/models/components/supportingdocumentrelationships.d.ts +448 -0
- package/models/components/supportingdocumentrelationships.d.ts.map +1 -0
- package/models/components/supportingdocumentrelationships.js +434 -0
- package/models/components/supportingdocumentrelationships.js.map +1 -0
- package/models/components/supportingdocumentresource.d.ts +71 -0
- package/models/components/supportingdocumentresource.d.ts.map +1 -0
- package/models/components/supportingdocumentresource.js +98 -0
- package/models/components/supportingdocumentresource.js.map +1 -0
- package/models/components/uploadmimetype.d.ts +49 -0
- package/models/components/uploadmimetype.d.ts.map +1 -0
- package/models/components/{applicationtype.js → uploadmimetype.js} +22 -14
- package/models/components/uploadmimetype.js.map +1 -0
- package/models/errors/createapplication.d.ts +73 -0
- package/models/errors/createapplication.d.ts.map +1 -0
- package/models/errors/createapplication.js +120 -0
- package/models/errors/createapplication.js.map +1 -0
- package/models/errors/index.d.ts +2 -1
- package/models/errors/index.d.ts.map +1 -1
- package/models/errors/index.js +2 -1
- package/models/errors/index.js.map +1 -1
- package/models/errors/supportingdocumentscreate.d.ts +143 -0
- package/models/errors/supportingdocumentscreate.d.ts.map +1 -0
- package/models/errors/supportingdocumentscreate.js +225 -0
- package/models/errors/supportingdocumentscreate.js.map +1 -0
- package/models/operations/createapplication.d.ts +26 -874
- package/models/operations/createapplication.d.ts.map +1 -1
- package/models/operations/createapplication.js +37 -899
- package/models/operations/createapplication.js.map +1 -1
- package/models/operations/index.d.ts +1 -2
- package/models/operations/index.d.ts.map +1 -1
- package/models/operations/index.js +1 -2
- package/models/operations/index.js.map +1 -1
- package/models/operations/supportingdocumentscreate.d.ts +94 -0
- package/models/operations/supportingdocumentscreate.d.ts.map +1 -0
- package/models/operations/supportingdocumentscreate.js +135 -0
- package/models/operations/supportingdocumentscreate.js.map +1 -0
- package/package.json +2 -2
- package/sdk/applications.d.ts +1 -10
- package/sdk/applications.d.ts.map +1 -1
- package/sdk/applications.js +0 -14
- package/sdk/applications.js.map +1 -1
- package/sdk/oauthtoken.d.ts +1 -1
- package/sdk/oauthtoken.d.ts.map +1 -1
- package/sdk/oauthtoken.js +3 -3
- package/sdk/oauthtoken.js.map +1 -1
- package/sdk/sdk.d.ts +3 -0
- package/sdk/sdk.d.ts.map +1 -1
- package/sdk/sdk.js +4 -0
- package/sdk/sdk.js.map +1 -1
- package/sdk/supportingdocuments.d.ts +9 -0
- package/sdk/supportingdocuments.d.ts.map +1 -0
- package/sdk/supportingdocuments.js +19 -0
- package/sdk/supportingdocuments.js.map +1 -0
- package/src/funcs/applicationsCreate.ts +15 -9
- package/src/funcs/{oauthTokenGet.ts → oauthTokenOauthToken.ts} +1 -1
- package/src/funcs/{applicationsList.ts → supportingDocumentsCreate.ts} +30 -20
- package/src/lib/config.ts +4 -7
- package/src/lib/matchers.ts +20 -0
- package/src/lib/sdks.ts +19 -13
- package/src/models/components/addressattributes.ts +22 -14
- package/src/models/components/applicationresource.ts +83 -0
- package/src/models/components/badrequesterror.ts +182 -0
- package/src/models/components/commercialapplicationjsonapirelationships.ts +894 -0
- package/src/models/components/commercialsecuredapplicationpayload.ts +248 -0
- package/src/models/components/commercialsecuredapplicationresource.ts +310 -0
- package/src/models/components/commercialsecuredloanassetattributes.ts +319 -0
- package/src/models/components/commercialsecuredloanassettype.ts +64 -0
- package/src/models/components/commercialsecuredloancommercialapplicationrelationships.ts +1238 -0
- package/src/models/components/consumerapplicationjsonapirelationships.ts +683 -0
- package/src/models/components/consumersecuredapplicationpayload.ts +273 -0
- package/src/models/components/consumersecuredapplicationresource.ts +309 -0
- package/src/models/components/consumersecuredloanassetattributes.ts +334 -0
- package/src/models/components/consumersecuredloanassettype.ts +47 -0
- package/src/models/components/consumersecuredloanconsumerapplicationrelationships.ts +1047 -0
- package/src/models/components/createsupportingdocumentsresponse.ts +206 -0
- package/src/models/components/customerattributes.ts +4 -0
- package/src/models/components/documenttype.ts +49 -0
- package/src/models/components/entityattributes.ts +4 -44
- package/src/models/components/forbiddenerror.ts +35 -58
- package/src/models/components/index.ts +24 -8
- package/src/models/components/linkobject.ts +84 -0
- package/src/models/components/loandetailsattributes.ts +4 -0
- package/src/models/components/relationshipresourcenotfound.ts +195 -0
- package/src/models/components/resourcenotfound.ts +188 -0
- package/src/models/components/supportingdocumentattributes.ts +87 -0
- package/src/models/components/supportingdocumentattributesinput.ts +84 -0
- package/src/models/components/supportingdocumentrelationships.ts +828 -0
- package/src/models/components/supportingdocumentresource.ts +126 -0
- package/src/models/components/uploadmimetype.ts +44 -0
- package/src/models/errors/createapplication.ts +149 -0
- package/src/models/errors/index.ts +2 -1
- package/src/models/errors/supportingdocumentscreate.ts +342 -0
- package/src/models/operations/createapplication.ts +69 -1913
- package/src/models/operations/index.ts +1 -2
- package/src/models/operations/supportingdocumentscreate.ts +222 -0
- package/src/sdk/applications.ts +1 -32
- package/src/sdk/oauthtoken.ts +3 -3
- package/src/sdk/sdk.ts +8 -0
- package/src/sdk/supportingdocuments.ts +24 -0
- package/funcs/applicationsGet.d.ts +0 -14
- package/funcs/applicationsGet.d.ts.map +0 -1
- package/funcs/applicationsGet.js +0 -120
- package/funcs/applicationsGet.js.map +0 -1
- package/funcs/applicationsList.d.ts +0 -14
- package/funcs/applicationsList.d.ts.map +0 -1
- package/funcs/applicationsList.js.map +0 -1
- package/funcs/oauthTokenGet.d.ts.map +0 -1
- package/funcs/oauthTokenGet.js.map +0 -1
- package/models/components/applicationattributes.d.ts +0 -69
- package/models/components/applicationattributes.d.ts.map +0 -1
- package/models/components/applicationattributes.js +0 -85
- package/models/components/applicationattributes.js.map +0 -1
- package/models/components/applicationattributescreate.d.ts +0 -43
- package/models/components/applicationattributescreate.d.ts.map +0 -1
- package/models/components/applicationattributescreate.js.map +0 -1
- package/models/components/applicationresourcebulksubmission.d.ts +0 -527
- package/models/components/applicationresourcebulksubmission.d.ts.map +0 -1
- package/models/components/applicationresourcebulksubmission.js +0 -565
- package/models/components/applicationresourcebulksubmission.js.map +0 -1
- package/models/components/applicationtype.d.ts +0 -28
- package/models/components/applicationtype.d.ts.map +0 -1
- package/models/components/applicationtype.js.map +0 -1
- package/models/components/assetattributes.d.ts +0 -311
- package/models/components/assetattributes.d.ts.map +0 -1
- package/models/components/assetattributes.js +0 -234
- package/models/components/assetattributes.js.map +0 -1
- package/models/components/commercialassettype.d.ts +0 -44
- package/models/components/commercialassettype.d.ts.map +0 -1
- package/models/components/commercialassettype.js +0 -85
- package/models/components/commercialassettype.js.map +0 -1
- package/models/components/consumerassettype.d.ts +0 -32
- package/models/components/consumerassettype.d.ts.map +0 -1
- package/models/components/consumerassettype.js.map +0 -1
- package/models/components/links.d.ts +0 -40
- package/models/components/links.d.ts.map +0 -1
- package/models/components/links.js.map +0 -1
- package/models/errors/responsebody.d.ts +0 -38
- package/models/errors/responsebody.d.ts.map +0 -1
- package/models/errors/responsebody.js.map +0 -1
- package/models/operations/getapplication.d.ts +0 -962
- package/models/operations/getapplication.d.ts.map +0 -1
- package/models/operations/getapplication.js +0 -1030
- package/models/operations/getapplication.js.map +0 -1
- package/models/operations/getapplications.d.ts +0 -962
- package/models/operations/getapplications.d.ts.map +0 -1
- package/models/operations/getapplications.js +0 -1029
- package/models/operations/getapplications.js.map +0 -1
- package/src/funcs/applicationsGet.ts +0 -168
- package/src/models/components/applicationattributes.ts +0 -128
- package/src/models/components/applicationattributescreate.ts +0 -90
- package/src/models/components/applicationresourcebulksubmission.ts +0 -1172
- package/src/models/components/applicationtype.ts +0 -33
- package/src/models/components/assetattributes.ts +0 -411
- package/src/models/components/commercialassettype.ts +0 -61
- package/src/models/components/consumerassettype.ts +0 -43
- package/src/models/components/links.ts +0 -72
- package/src/models/errors/responsebody.ts +0 -76
- package/src/models/operations/getapplication.ts +0 -2246
- package/src/models/operations/getapplications.ts +0 -2191
package/README.md
CHANGED
|
@@ -1,21 +1,28 @@
|
|
|
1
1
|
# financeable-aggregation-api
|
|
2
2
|
|
|
3
|
+
<!-- Start Summary [summary] -->
|
|
3
4
|
## Summary
|
|
4
5
|
|
|
6
|
+
|
|
7
|
+
<!-- End Summary [summary] -->
|
|
8
|
+
|
|
9
|
+
<!-- Start Table of Contents [toc] -->
|
|
5
10
|
## Table of Contents
|
|
11
|
+
<!-- $toc-max-depth=2 -->
|
|
12
|
+
* [financeable-aggregation-api](#financeable-aggregation-api)
|
|
13
|
+
* [SDK Installation](#sdk-installation)
|
|
14
|
+
* [Requirements](#requirements)
|
|
15
|
+
* [SDK Example Usage](#sdk-example-usage)
|
|
16
|
+
* [Available Resources and Operations](#available-resources-and-operations)
|
|
17
|
+
* [Standalone functions](#standalone-functions)
|
|
18
|
+
* [Retries](#retries)
|
|
19
|
+
* [Error Handling](#error-handling)
|
|
20
|
+
* [Custom HTTP Client](#custom-http-client)
|
|
21
|
+
* [Debugging](#debugging)
|
|
6
22
|
|
|
7
|
-
|
|
8
|
-
- [SDK Installation](#sdk-installation)
|
|
9
|
-
- [Requirements](#requirements)
|
|
10
|
-
- [SDK Example Usage](#sdk-example-usage)
|
|
11
|
-
- [Available Resources and Operations](#available-resources-and-operations)
|
|
12
|
-
- [Standalone functions](#standalone-functions)
|
|
13
|
-
- [Retries](#retries)
|
|
14
|
-
- [Error Handling](#error-handling)
|
|
15
|
-
- [Server Selection](#server-selection)
|
|
16
|
-
- [Custom HTTP Client](#custom-http-client)
|
|
17
|
-
- [Debugging](#debugging)
|
|
23
|
+
<!-- End Table of Contents [toc] -->
|
|
18
24
|
|
|
25
|
+
<!-- Start SDK Installation [installation] -->
|
|
19
26
|
## SDK Installation
|
|
20
27
|
|
|
21
28
|
The SDK can be installed with either [npm](https://www.npmjs.com/), [pnpm](https://pnpm.io/), [bun](https://bun.sh/) or [yarn](https://classic.yarnpkg.com/en/) package managers.
|
|
@@ -23,251 +30,65 @@ The SDK can be installed with either [npm](https://www.npmjs.com/), [pnpm](https
|
|
|
23
30
|
### NPM
|
|
24
31
|
|
|
25
32
|
```bash
|
|
26
|
-
npm add
|
|
33
|
+
npm add @financeable/aggregation
|
|
27
34
|
```
|
|
28
35
|
|
|
29
36
|
### PNPM
|
|
30
37
|
|
|
31
38
|
```bash
|
|
32
|
-
pnpm add
|
|
39
|
+
pnpm add @financeable/aggregation
|
|
33
40
|
```
|
|
34
41
|
|
|
35
42
|
### Bun
|
|
36
43
|
|
|
37
44
|
```bash
|
|
38
|
-
bun add
|
|
45
|
+
bun add @financeable/aggregation
|
|
39
46
|
```
|
|
40
47
|
|
|
41
48
|
### Yarn
|
|
42
49
|
|
|
43
50
|
```bash
|
|
44
|
-
yarn add
|
|
51
|
+
yarn add @financeable/aggregation zod
|
|
45
52
|
|
|
46
53
|
# Note that Yarn does not install peer dependencies automatically. You will need
|
|
47
54
|
# to install zod as shown above.
|
|
48
55
|
```
|
|
56
|
+
<!-- End SDK Installation [installation] -->
|
|
49
57
|
|
|
58
|
+
<!-- Start Requirements [requirements] -->
|
|
50
59
|
## Requirements
|
|
51
60
|
|
|
52
61
|
For supported JavaScript runtimes, please consult [RUNTIMES.md](RUNTIMES.md).
|
|
62
|
+
<!-- End Requirements [requirements] -->
|
|
53
63
|
|
|
54
64
|
## SDK Example Usage
|
|
55
65
|
|
|
56
|
-
|
|
57
|
-
import { Financeable } from "@financeable/aggregation";
|
|
58
|
-
import { ConsumerAssetType } from "@financeable/aggregation/models/components"
|
|
66
|
+
### Example
|
|
59
67
|
|
|
68
|
+
```typescript
|
|
60
69
|
const financeable = new Financeable({
|
|
61
|
-
serverURL: "<
|
|
70
|
+
serverURL: "<URL of Financeable tenancy to send Application>",
|
|
62
71
|
});
|
|
63
72
|
|
|
64
73
|
async function run() {
|
|
74
|
+
let result;
|
|
65
75
|
|
|
66
|
-
|
|
76
|
+
const tokenRequest = await financeable.oauthToken.get({
|
|
67
77
|
grantType: 'client_credentials',
|
|
68
78
|
clientId: '<ClientId>',
|
|
69
79
|
clientSecret: '<ClientSecret>',
|
|
70
80
|
scope: 'application:read application:write',
|
|
71
81
|
});
|
|
72
82
|
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
applicationType: 'consumer',
|
|
80
|
-
},
|
|
81
|
-
relationships: {
|
|
82
|
-
loanDetails: {
|
|
83
|
-
data: {
|
|
84
|
-
type: 'loan-details',
|
|
85
|
-
attributes: {
|
|
86
|
-
repayments: 12,
|
|
87
|
-
repaymentFrequency: 'monthly',
|
|
88
|
-
repaymentStructure: 'group-payments',
|
|
89
|
-
loanAmount: '10280.95',
|
|
90
|
-
purpose: 'Purchase of a motor vehicle',
|
|
91
|
-
term: 48,
|
|
92
|
-
balloon: 5,
|
|
93
|
-
deposit: '2500',
|
|
94
|
-
originationFee: 200,
|
|
95
|
-
rate: '0.15',
|
|
96
|
-
rateAdjustment: '-0.01',
|
|
97
|
-
},
|
|
98
|
-
},
|
|
99
|
-
},
|
|
100
|
-
customers: {
|
|
101
|
-
data: [
|
|
102
|
-
{
|
|
103
|
-
type: 'customers',
|
|
104
|
-
attributes: {
|
|
105
|
-
title: 'Mr',
|
|
106
|
-
firstName: 'John',
|
|
107
|
-
emailAddresses: ["john.smith@mrandmrssmith.com.au"],
|
|
108
|
-
phoneNumbers: ["0412345678"],
|
|
109
|
-
lastName: 'Smith',
|
|
110
|
-
dateOfBirth: '1990-01-28',
|
|
111
|
-
idExpiryDate: '2025-11-15',
|
|
112
|
-
idType: 'licence',
|
|
113
|
-
idNumber: '12345678',
|
|
114
|
-
},
|
|
115
|
-
relationships: {
|
|
116
|
-
addresses: {
|
|
117
|
-
data: [
|
|
118
|
-
{
|
|
119
|
-
type: 'addresses',
|
|
120
|
-
attributes: {
|
|
121
|
-
addressType: 'residential',
|
|
122
|
-
fullAddress: '42 Wallaby Way, Sydney NSW 2000',
|
|
123
|
-
city: 'Sydney',
|
|
124
|
-
postCode: '2000',
|
|
125
|
-
streetAddress: '42 Wallaby Way',
|
|
126
|
-
addressLine2: '',
|
|
127
|
-
streetNumber: '42',
|
|
128
|
-
streetType: 'Way',
|
|
129
|
-
street: 'Wallaby',
|
|
130
|
-
state: 'NSW',
|
|
131
|
-
country: 'Australia',
|
|
132
|
-
status: 'current',
|
|
133
|
-
monthsAt: 6,
|
|
134
|
-
yearsAt: 2,
|
|
135
|
-
},
|
|
136
|
-
},
|
|
137
|
-
{
|
|
138
|
-
type: 'addresses',
|
|
139
|
-
attributes: {
|
|
140
|
-
addressType: 'residential',
|
|
141
|
-
fullAddress: '28 Wallaby Way, Sydney NSW 2000',
|
|
142
|
-
city: 'Sydney',
|
|
143
|
-
postCode: '2000',
|
|
144
|
-
streetAddress: '28 Wallaby Way',
|
|
145
|
-
addressLine2: '',
|
|
146
|
-
streetNumber: '28',
|
|
147
|
-
streetType: 'Way',
|
|
148
|
-
street: 'Wallaby',
|
|
149
|
-
state: 'NSW',
|
|
150
|
-
country: 'Australia',
|
|
151
|
-
status: 'previous',
|
|
152
|
-
monthsAt: 0,
|
|
153
|
-
yearsAt: 2,
|
|
154
|
-
},
|
|
155
|
-
},
|
|
156
|
-
],
|
|
157
|
-
},
|
|
158
|
-
},
|
|
159
|
-
},
|
|
160
|
-
],
|
|
161
|
-
},
|
|
162
|
-
asset: {
|
|
163
|
-
data: {
|
|
164
|
-
type: 'assets',
|
|
165
|
-
attributes: {
|
|
166
|
-
assetType: ConsumerAssetType.MotorVehicle,
|
|
167
|
-
ageOfAsset: 3,
|
|
168
|
-
ageOfAssetAtEnd: 8,
|
|
169
|
-
condition: 'USED',
|
|
170
|
-
purpose: 'VEHICLE',
|
|
171
|
-
assetValue: '35000.00',
|
|
172
|
-
make: 'Toyota',
|
|
173
|
-
assetModel: 'Camry',
|
|
174
|
-
registrationNumber: 'ABC123',
|
|
175
|
-
registrationState: 'VIC',
|
|
176
|
-
vin: '1HGCM82633A123456',
|
|
177
|
-
supplierName: 'Mr and Mrs Smith',
|
|
178
|
-
supplierABN: '12345678901',
|
|
179
|
-
supplierAddress: '123 Car Street, Melbourne VIC 3000',
|
|
180
|
-
supplierPhone: '0412345678',
|
|
181
|
-
supplierContactName: 'John Smith',
|
|
182
|
-
supplierEmail: 'john.smith@mrandmrssmith.com.au',
|
|
183
|
-
privateSale: false,
|
|
184
|
-
typeOfSale: 'DEALER',
|
|
185
|
-
description: '2020 Toyota Camry Hybrid SL, Silver, 45,000km',
|
|
186
|
-
netAssetValue: '32000.00',
|
|
187
|
-
isLuxury: false,
|
|
188
|
-
additionalFees: '995.00',
|
|
189
|
-
additionalTaxes: '0.00',
|
|
190
|
-
},
|
|
191
|
-
},
|
|
192
|
-
},
|
|
193
|
-
},
|
|
194
|
-
},
|
|
195
|
-
},
|
|
196
|
-
{
|
|
197
|
-
fetchOptions: {
|
|
198
|
-
headers: {
|
|
199
|
-
authorization: `Bearer ${tokenRequest.accessToken}`,
|
|
200
|
-
},
|
|
83
|
+
try {
|
|
84
|
+
result = await financeable.applications.create({
|
|
85
|
+
data: {
|
|
86
|
+
type: "commercial-secured-applications",
|
|
87
|
+
attributes: {
|
|
88
|
+
applicationType: "commercialSecured",
|
|
201
89
|
},
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
// Handle the result
|
|
206
|
-
console.log(result);
|
|
207
|
-
}
|
|
208
|
-
|
|
209
|
-
run();
|
|
210
|
-
```
|
|
211
|
-
|
|
212
|
-
## Available Resources and Operations
|
|
213
|
-
|
|
214
|
-
<details open>
|
|
215
|
-
<summary>Available methods</summary>
|
|
216
|
-
|
|
217
|
-
### [applications](docs/sdks/applications/README.md)
|
|
218
|
-
|
|
219
|
-
- [create](docs/sdks/applications/README.md#create) - Create an application in the Financeable platform.
|
|
220
|
-
</details>
|
|
221
|
-
|
|
222
|
-
## Standalone functions
|
|
223
|
-
|
|
224
|
-
All the methods listed above are available as standalone functions. These
|
|
225
|
-
functions are ideal for use in applications running in the browser, serverless
|
|
226
|
-
runtimes or other environments where application bundle size is a primary
|
|
227
|
-
concern. When using a bundler to build your application, all unused
|
|
228
|
-
functionality will be either excluded from the final bundle or tree-shaken away.
|
|
229
|
-
|
|
230
|
-
To read more about standalone functions, check [FUNCTIONS.md](./FUNCTIONS.md).
|
|
231
|
-
|
|
232
|
-
<details>
|
|
233
|
-
|
|
234
|
-
<summary>Available standalone functions</summary>
|
|
235
|
-
|
|
236
|
-
- [`applicationsCreate`](docs/sdks/applications/README.md#create) - Create an application in the Financeable platform.
|
|
237
|
-
|
|
238
|
-
</details>
|
|
239
|
-
|
|
240
|
-
## Retries
|
|
241
|
-
|
|
242
|
-
Some of the endpoints in this SDK support retries. If you use the SDK without any configuration, it will fall back to the default retry strategy provided by the API. However, the default retry strategy can be overridden on a per-operation basis, or across the entire SDK.
|
|
243
|
-
|
|
244
|
-
To change the default retry strategy for a single API call, simply provide a retryConfig object to the call:
|
|
245
|
-
|
|
246
|
-
```typescript
|
|
247
|
-
import { Financeable } from "@financeable/aggregation";
|
|
248
|
-
|
|
249
|
-
const financeable = new Financeable({
|
|
250
|
-
serverURL: '<ServerUrl>'
|
|
251
|
-
})
|
|
252
|
-
|
|
253
|
-
async function run() {
|
|
254
|
-
const tokenRequest = await financeable.oauthToken.get({
|
|
255
|
-
grantType: 'client_credentials',
|
|
256
|
-
clientId: '<ClientId>',
|
|
257
|
-
clientSecret: '<ClientSecret>',
|
|
258
|
-
scope: 'application:read application:write',
|
|
259
|
-
});
|
|
260
|
-
|
|
261
|
-
const result = await financeable.applications.create(
|
|
262
|
-
{
|
|
263
|
-
data: {
|
|
264
|
-
type: 'applications',
|
|
265
|
-
attributes: {
|
|
266
|
-
purpose: 'Purchase of a motor vehicle',
|
|
267
|
-
applicationType: 'consumer',
|
|
268
|
-
},
|
|
269
|
-
relationships: {
|
|
270
|
-
loanDetails: {
|
|
90
|
+
relationships: {
|
|
91
|
+
loanDetails: {
|
|
271
92
|
data: {
|
|
272
93
|
type: 'loan-details',
|
|
273
94
|
attributes: {
|
|
@@ -283,71 +104,9 @@ async function run() {
|
|
|
283
104
|
rate: '0.15',
|
|
284
105
|
rateAdjustment: '-0.01',
|
|
285
106
|
},
|
|
286
|
-
}
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
data: [
|
|
290
|
-
{
|
|
291
|
-
type: 'customers',
|
|
292
|
-
attributes: {
|
|
293
|
-
title: 'Mr',
|
|
294
|
-
firstName: 'John',
|
|
295
|
-
emailAddresses: ["john.smith@mrandmrssmith.com.au"],
|
|
296
|
-
phoneNumbers: ["0412345678"],
|
|
297
|
-
lastName: 'Smith',
|
|
298
|
-
dateOfBirth: '1990-01-28',
|
|
299
|
-
idExpiryDate: '2025-11-15',
|
|
300
|
-
idType: 'licence',
|
|
301
|
-
idNumber: '12345678',
|
|
302
|
-
},
|
|
303
|
-
relationships: {
|
|
304
|
-
addresses: {
|
|
305
|
-
data: [
|
|
306
|
-
{
|
|
307
|
-
type: 'addresses',
|
|
308
|
-
attributes: {
|
|
309
|
-
addressType: 'residential',
|
|
310
|
-
fullAddress: '42 Wallaby Way, Sydney NSW 2000',
|
|
311
|
-
city: 'Sydney',
|
|
312
|
-
postCode: '2000',
|
|
313
|
-
streetAddress: '42 Wallaby Way',
|
|
314
|
-
addressLine2: '',
|
|
315
|
-
streetNumber: '42',
|
|
316
|
-
streetType: 'Way',
|
|
317
|
-
street: 'Wallaby',
|
|
318
|
-
state: 'NSW',
|
|
319
|
-
country: 'Australia',
|
|
320
|
-
status: 'current',
|
|
321
|
-
monthsAt: 6,
|
|
322
|
-
yearsAt: 2,
|
|
323
|
-
},
|
|
324
|
-
},
|
|
325
|
-
{
|
|
326
|
-
type: 'addresses',
|
|
327
|
-
attributes: {
|
|
328
|
-
addressType: 'residential',
|
|
329
|
-
fullAddress: '28 Wallaby Way, Sydney NSW 2000',
|
|
330
|
-
city: 'Sydney',
|
|
331
|
-
postCode: '2000',
|
|
332
|
-
streetAddress: '28 Wallaby Way',
|
|
333
|
-
addressLine2: '',
|
|
334
|
-
streetNumber: '28',
|
|
335
|
-
streetType: 'Way',
|
|
336
|
-
street: 'Wallaby',
|
|
337
|
-
state: 'NSW',
|
|
338
|
-
country: 'Australia',
|
|
339
|
-
status: 'previous',
|
|
340
|
-
monthsAt: 0,
|
|
341
|
-
yearsAt: 2,
|
|
342
|
-
},
|
|
343
|
-
},
|
|
344
|
-
],
|
|
345
|
-
},
|
|
346
|
-
},
|
|
347
|
-
},
|
|
348
|
-
],
|
|
349
|
-
},
|
|
350
|
-
asset: {
|
|
107
|
+
}
|
|
108
|
+
},
|
|
109
|
+
asset: {
|
|
351
110
|
data: {
|
|
352
111
|
type: 'assets',
|
|
353
112
|
attributes: {
|
|
@@ -378,850 +137,188 @@ async function run() {
|
|
|
378
137
|
},
|
|
379
138
|
},
|
|
380
139
|
},
|
|
381
|
-
},
|
|
382
|
-
},
|
|
383
|
-
},
|
|
384
|
-
{
|
|
385
|
-
fetchOptions: {
|
|
386
|
-
headers: {
|
|
387
|
-
authorization: `Bearer ${tokenRequest.accessToken}`,
|
|
388
|
-
},
|
|
389
|
-
},
|
|
390
|
-
retries: {
|
|
391
|
-
strategy: "backoff",
|
|
392
|
-
backoff: {
|
|
393
|
-
initialInterval: 1,
|
|
394
|
-
maxInterval: 50,
|
|
395
|
-
exponent: 1.1,
|
|
396
|
-
maxElapsedTime: 100,
|
|
397
|
-
},
|
|
398
|
-
retryConnectionErrors: false,
|
|
399
|
-
}
|
|
400
|
-
},
|
|
401
|
-
);
|
|
402
|
-
|
|
403
|
-
// Handle the result
|
|
404
|
-
console.log(result);
|
|
405
|
-
}
|
|
406
|
-
|
|
407
|
-
run();
|
|
408
|
-
```
|
|
409
|
-
|
|
410
|
-
If you'd like to override the default retry strategy for all operations that support retries, you can provide a retryConfig at SDK initialization:
|
|
411
|
-
|
|
412
|
-
```typescript
|
|
413
|
-
import { Financeable } from "@financeable/aggregation";
|
|
414
|
-
|
|
415
|
-
const financeable = new Financeable({
|
|
416
|
-
serverURL: "<ServerURL>",
|
|
417
|
-
retryConfig: {
|
|
418
|
-
strategy: "backoff",
|
|
419
|
-
backoff: {
|
|
420
|
-
initialInterval: 1,
|
|
421
|
-
maxInterval: 50,
|
|
422
|
-
exponent: 1.1,
|
|
423
|
-
maxElapsedTime: 100,
|
|
424
|
-
},
|
|
425
|
-
retryConnectionErrors: false,
|
|
426
|
-
},
|
|
427
|
-
});
|
|
428
|
-
|
|
429
|
-
async function run() {
|
|
430
|
-
const tokenRequest = await financeable.oauthToken.get({
|
|
431
|
-
grantType: 'client_credentials',
|
|
432
|
-
clientId: '<ClientId>',
|
|
433
|
-
clientSecret: '<ClientSecret>',
|
|
434
|
-
scope: 'application:read application:write',
|
|
435
|
-
});
|
|
436
|
-
|
|
437
|
-
const result = await financeable.applications.create(
|
|
438
|
-
{
|
|
439
|
-
data: {
|
|
440
|
-
type: 'applications',
|
|
441
|
-
attributes: {
|
|
442
|
-
purpose: 'Purchase of a motor vehicle',
|
|
443
|
-
applicationType: 'consumer',
|
|
444
|
-
},
|
|
445
|
-
relationships: {
|
|
446
|
-
loanDetails: {
|
|
447
|
-
data: {
|
|
448
|
-
type: 'loan-details',
|
|
449
|
-
attributes: {
|
|
450
|
-
repayments: 12,
|
|
451
|
-
repaymentFrequency: 'monthly',
|
|
452
|
-
repaymentStructure: 'group-payments',
|
|
453
|
-
loanAmount: '10280.95',
|
|
454
|
-
purpose: 'Purchase of a motor vehicle',
|
|
455
|
-
term: 48,
|
|
456
|
-
balloon: 5,
|
|
457
|
-
deposit: '2500',
|
|
458
|
-
originationFee: 200,
|
|
459
|
-
rate: '0.15',
|
|
460
|
-
rateAdjustment: '-0.01',
|
|
461
|
-
},
|
|
462
|
-
},
|
|
463
|
-
},
|
|
464
|
-
customers: {
|
|
465
|
-
data: [
|
|
466
|
-
{
|
|
467
|
-
type: 'customers',
|
|
468
|
-
attributes: {
|
|
469
|
-
title: 'Mr',
|
|
470
|
-
firstName: 'John',
|
|
471
|
-
emailAddresses: ["john.smith@mrandmrssmith.com.au"],
|
|
472
|
-
phoneNumbers: ["0412345678"],
|
|
473
|
-
lastName: 'Smith',
|
|
474
|
-
dateOfBirth: '1990-01-28',
|
|
475
|
-
idExpiryDate: '2025-11-15',
|
|
476
|
-
idType: 'licence',
|
|
477
|
-
idNumber: '12345678',
|
|
478
|
-
},
|
|
479
|
-
relationships: {
|
|
480
|
-
addresses: {
|
|
481
|
-
data: [
|
|
482
|
-
{
|
|
483
|
-
type: 'addresses',
|
|
484
|
-
attributes: {
|
|
485
|
-
addressType: 'residential',
|
|
486
|
-
fullAddress: '42 Wallaby Way, Sydney NSW 2000',
|
|
487
|
-
city: 'Sydney',
|
|
488
|
-
postCode: '2000',
|
|
489
|
-
streetAddress: '42 Wallaby Way',
|
|
490
|
-
addressLine2: '',
|
|
491
|
-
streetNumber: '42',
|
|
492
|
-
streetType: 'Way',
|
|
493
|
-
street: 'Wallaby',
|
|
494
|
-
state: 'NSW',
|
|
495
|
-
country: 'Australia',
|
|
496
|
-
status: 'current',
|
|
497
|
-
monthsAt: 6,
|
|
498
|
-
yearsAt: 2,
|
|
499
|
-
},
|
|
500
|
-
},
|
|
501
|
-
{
|
|
502
|
-
type: 'addresses',
|
|
503
|
-
attributes: {
|
|
504
|
-
addressType: 'residential',
|
|
505
|
-
fullAddress: '28 Wallaby Way, Sydney NSW 2000',
|
|
506
|
-
city: 'Sydney',
|
|
507
|
-
postCode: '2000',
|
|
508
|
-
streetAddress: '28 Wallaby Way',
|
|
509
|
-
addressLine2: '',
|
|
510
|
-
streetNumber: '28',
|
|
511
|
-
streetType: 'Way',
|
|
512
|
-
street: 'Wallaby',
|
|
513
|
-
state: 'NSW',
|
|
514
|
-
country: 'Australia',
|
|
515
|
-
status: 'previous',
|
|
516
|
-
monthsAt: 0,
|
|
517
|
-
yearsAt: 2,
|
|
518
|
-
},
|
|
519
|
-
},
|
|
520
|
-
],
|
|
521
|
-
},
|
|
522
|
-
},
|
|
523
|
-
},
|
|
524
|
-
],
|
|
525
|
-
},
|
|
526
|
-
asset: {
|
|
527
|
-
data: {
|
|
528
|
-
type: 'assets',
|
|
529
|
-
attributes: {
|
|
530
|
-
assetType: ConsumerAssetType.MotorVehicle,
|
|
531
|
-
ageOfAsset: 3,
|
|
532
|
-
ageOfAssetAtEnd: 8,
|
|
533
|
-
condition: 'USED',
|
|
534
|
-
purpose: 'VEHICLE',
|
|
535
|
-
assetValue: '35000.00',
|
|
536
|
-
make: 'Toyota',
|
|
537
|
-
assetModel: 'Camry',
|
|
538
|
-
registrationNumber: 'ABC123',
|
|
539
|
-
registrationState: 'VIC',
|
|
540
|
-
vin: '1HGCM82633A123456',
|
|
541
|
-
supplierName: 'Mr and Mrs Smith',
|
|
542
|
-
supplierABN: '12345678901',
|
|
543
|
-
supplierAddress: '123 Car Street, Melbourne VIC 3000',
|
|
544
|
-
supplierPhone: '0412345678',
|
|
545
|
-
supplierContactName: 'John Smith',
|
|
546
|
-
supplierEmail: 'john.smith@mrandmrssmith.com.au',
|
|
547
|
-
privateSale: false,
|
|
548
|
-
typeOfSale: 'DEALER',
|
|
549
|
-
description: '2020 Toyota Camry Hybrid SL, Silver, 45,000km',
|
|
550
|
-
netAssetValue: '32000.00',
|
|
551
|
-
isLuxury: false,
|
|
552
|
-
additionalFees: '995.00',
|
|
553
|
-
additionalTaxes: '0.00',
|
|
554
|
-
},
|
|
555
|
-
},
|
|
556
|
-
},
|
|
557
|
-
},
|
|
558
|
-
},
|
|
559
|
-
},
|
|
560
|
-
{
|
|
561
|
-
fetchOptions: {
|
|
562
|
-
headers: {
|
|
563
|
-
authorization: `Bearer ${tokenRequest.accessToken}`,
|
|
564
|
-
},
|
|
565
|
-
}
|
|
566
|
-
},
|
|
567
|
-
);
|
|
568
|
-
|
|
569
|
-
// Handle the result
|
|
570
|
-
console.log(result);
|
|
571
|
-
}
|
|
572
|
-
|
|
573
|
-
run();
|
|
574
|
-
```
|
|
575
|
-
|
|
576
|
-
## Error Handling
|
|
577
|
-
|
|
578
|
-
Some methods specify known errors which can be thrown. All the known errors are enumerated in the `models/errors/errors.ts` module. The known errors for a method are documented under the _Errors_ tables in SDK docs. For example, the `create` method may throw the following errors:
|
|
579
|
-
|
|
580
|
-
| Error Type | Status Code | Content Type |
|
|
581
|
-
| ------------------------------------ | ----------- | ---------------- |
|
|
582
|
-
| errors.CreateApplicationResponseBody | 403 | application/json |
|
|
583
|
-
| errors.APIError | 4XX, 5XX | \*/\* |
|
|
584
|
-
|
|
585
|
-
If the method throws an error and it is not captured by the known errors, it will default to throwing a `APIError`.
|
|
586
|
-
|
|
587
|
-
```typescript
|
|
588
|
-
import { Financeable } from "@financeable/aggregation";
|
|
589
|
-
import {
|
|
590
|
-
CreateApplicationResponseBody,
|
|
591
|
-
SDKValidationError,
|
|
592
|
-
} from "@financeable/aggregation/models/errors";
|
|
593
|
-
import { ConsumerAssetType } from "@financeable/aggregation/models/components"
|
|
594
|
-
|
|
595
|
-
const financeable = new Financeable({
|
|
596
|
-
serverURL: "<ServerURL>"
|
|
597
|
-
});
|
|
598
|
-
|
|
599
|
-
async function run() {
|
|
600
|
-
let result;
|
|
601
|
-
try {
|
|
602
|
-
const tokenRequest = await financeable.oauthToken.get({
|
|
603
|
-
grantType: 'client_credentials',
|
|
604
|
-
clientId: '<ClientId>',
|
|
605
|
-
clientSecret: '<ClientSecret>',
|
|
606
|
-
scope: 'application:read application:write',
|
|
607
|
-
});
|
|
608
|
-
|
|
609
|
-
result = await financeable.applications.create({
|
|
610
|
-
data: {
|
|
611
|
-
type: "applications",
|
|
612
|
-
attributes: {
|
|
613
|
-
purpose: "Purchase of a motor vehicle",
|
|
614
|
-
applicationType: "consumer",
|
|
615
|
-
},
|
|
616
|
-
relationships: {
|
|
617
|
-
loanDetails: {
|
|
618
|
-
data: {
|
|
619
|
-
type: "loan-details",
|
|
620
|
-
attributes: {
|
|
621
|
-
repayments: 12,
|
|
622
|
-
repaymentFrequency: "monthly",
|
|
623
|
-
repaymentStructure: "group-payments",
|
|
624
|
-
loanAmount: "10280.95",
|
|
625
|
-
purpose: "Purchase of a motor vehicle",
|
|
626
|
-
term: 48,
|
|
627
|
-
balloon: 5,
|
|
628
|
-
deposit: "2500",
|
|
629
|
-
originationFee: 200,
|
|
630
|
-
rate: "0.15",
|
|
631
|
-
rateAdjustment: "-0.01",
|
|
632
|
-
},
|
|
633
|
-
},
|
|
634
|
-
},
|
|
635
|
-
customers: {
|
|
636
|
-
data: [
|
|
637
|
-
{
|
|
638
|
-
type: "customers",
|
|
639
|
-
attributes: {
|
|
640
|
-
title: "Mr",
|
|
641
|
-
firstName: "John",
|
|
642
|
-
lastName: "Smith",
|
|
643
|
-
dateOfBirth: "1982-06-21",
|
|
644
|
-
idExpiryDate: "2030-03-15",
|
|
645
|
-
idType: "licence",
|
|
646
|
-
idNumber: "12345678",
|
|
647
|
-
},
|
|
648
|
-
relationships: {
|
|
649
|
-
addresses: {
|
|
650
|
-
data: [
|
|
651
|
-
{
|
|
652
|
-
type: "addresses",
|
|
653
|
-
attributes: {
|
|
654
|
-
addressType: "residential",
|
|
655
|
-
fullAddress: "42 Wallaby Way, Sydney NSW 2000",
|
|
656
|
-
city: "Sydney",
|
|
657
|
-
postCode: "2000",
|
|
658
|
-
streetAddress: "42 Wallaby Way",
|
|
659
|
-
addressLine2: "",
|
|
660
|
-
streetNumber: "42",
|
|
661
|
-
streetType: "Way",
|
|
662
|
-
street: "Wallaby",
|
|
663
|
-
state: "NSW",
|
|
664
|
-
country: "Australia",
|
|
665
|
-
status: "current",
|
|
666
|
-
monthsAt: 5,
|
|
667
|
-
yearsAt: 2,
|
|
668
|
-
},
|
|
669
|
-
},
|
|
670
|
-
{
|
|
671
|
-
type: "addresses",
|
|
672
|
-
attributes: {
|
|
673
|
-
addressType: "residential",
|
|
674
|
-
fullAddress: "28 Wallaby Way, Sydney NSW 2000",
|
|
675
|
-
city: "Sydney",
|
|
676
|
-
postCode: "2000",
|
|
677
|
-
streetAddress: "28 Wallaby Way",
|
|
678
|
-
addressLine2: "",
|
|
679
|
-
streetNumber: "28",
|
|
680
|
-
streetType: "Way",
|
|
681
|
-
street: "Wallaby",
|
|
682
|
-
state: "NSW",
|
|
683
|
-
country: "Australia",
|
|
684
|
-
status: "previous",
|
|
685
|
-
monthsAt: 0,
|
|
686
|
-
yearsAt: 5,
|
|
687
|
-
},
|
|
688
|
-
},
|
|
689
|
-
],
|
|
690
|
-
},
|
|
691
|
-
},
|
|
692
|
-
},
|
|
693
|
-
],
|
|
694
|
-
},
|
|
695
|
-
asset: {
|
|
696
|
-
data: {
|
|
697
|
-
type: "asset",
|
|
698
|
-
attributes: {
|
|
699
|
-
ageOfAsset: 3,
|
|
700
|
-
ageOfAssetAtEnd: 8,
|
|
701
|
-
condition: "USED",
|
|
702
|
-
assetType: ConsumerAssetType.MotorVehicle,
|
|
703
|
-
purpose: "VEHICLE",
|
|
704
|
-
assetValue: "35000.00",
|
|
705
|
-
make: "Toyota",
|
|
706
|
-
assetModel: "Camry",
|
|
707
|
-
registrationNumber: "ABC123",
|
|
708
|
-
registrationState: "VIC",
|
|
709
|
-
vin: "1HGCM82633A123456",
|
|
710
|
-
supplierName: "Mr and Mrs Smith",
|
|
711
|
-
supplierABN: "12345678901",
|
|
712
|
-
supplierAddress: "123 Car Street, Melbourne VIC 3000",
|
|
713
|
-
supplierPhone: "0412345678",
|
|
714
|
-
supplierContactName: "John Smith",
|
|
715
|
-
supplierEmail: "john.smith@mrandmrssmith.com.au",
|
|
716
|
-
privateSale: false,
|
|
717
|
-
typeOfSale: "DEALER",
|
|
718
|
-
description: "2020 Toyota Camry Hybrid SL, Silver, 45,000km",
|
|
719
|
-
netAssetValue: "32000.00",
|
|
720
|
-
isLuxury: false,
|
|
721
|
-
additionalFees: "995.00",
|
|
722
|
-
additionalTaxes: "0.00",
|
|
723
|
-
},
|
|
724
|
-
},
|
|
725
|
-
},
|
|
726
|
-
},
|
|
727
|
-
},
|
|
728
|
-
{
|
|
729
|
-
fetchOptions: {
|
|
730
|
-
headers: {
|
|
731
|
-
authorization: `Bearer ${tokenRequest.accessToken}`,
|
|
732
|
-
},
|
|
733
|
-
}
|
|
734
|
-
}
|
|
735
|
-
});
|
|
736
|
-
|
|
737
|
-
// Handle the result
|
|
738
|
-
console.log(result);
|
|
739
|
-
} catch (err) {
|
|
740
|
-
switch (true) {
|
|
741
|
-
// The server response does not match the expected SDK schema
|
|
742
|
-
case err instanceof SDKValidationError: {
|
|
743
|
-
// Pretty-print will provide a human-readable multi-line error message
|
|
744
|
-
console.error(err.pretty());
|
|
745
|
-
// Raw value may also be inspected
|
|
746
|
-
console.error(err.rawValue);
|
|
747
|
-
return;
|
|
748
|
-
}
|
|
749
|
-
case err instanceof CreateApplicationResponseBody: {
|
|
750
|
-
// Handle err.data$: CreateApplicationResponseBodyData
|
|
751
|
-
console.error(err);
|
|
752
|
-
return;
|
|
753
|
-
}
|
|
754
|
-
default: {
|
|
755
|
-
// Other errors such as network errors, see HTTPClientErrors for more details
|
|
756
|
-
throw err;
|
|
757
|
-
}
|
|
758
|
-
}
|
|
759
|
-
}
|
|
760
|
-
}
|
|
761
|
-
|
|
762
|
-
run();
|
|
763
|
-
```
|
|
764
|
-
|
|
765
|
-
Validation errors can also occur when either method arguments or data returned from the server do not match the expected format. The `SDKValidationError` that is thrown as a result will capture the raw value that failed validation in an attribute called `rawValue`. Additionally, a `pretty()` method is available on this error that can be used to log a nicely formatted multi-line string since validation errors can list many issues and the plain error string may be difficult read when debugging.
|
|
766
|
-
|
|
767
|
-
In some rare cases, the SDK can fail to get a response from the server or even make the request due to unexpected circumstances such as network conditions. These types of errors are captured in the `models/errors/httpclienterrors.ts` module:
|
|
768
|
-
|
|
769
|
-
| HTTP Client Error | Description |
|
|
770
|
-
| --------------------- | ---------------------------------------------------- |
|
|
771
|
-
| RequestAbortedError | HTTP request was aborted by the client |
|
|
772
|
-
| RequestTimeoutError | HTTP request timed out due to an AbortSignal signal |
|
|
773
|
-
| ConnectionError | HTTP client was unable to make a request to a server |
|
|
774
|
-
| InvalidRequestError | Any input used to create a request is invalid |
|
|
775
|
-
| UnexpectedClientError | Unrecognised or unexpected error |
|
|
776
|
-
|
|
777
|
-
## Server Selection
|
|
778
|
-
|
|
779
|
-
### Override Server URL Per-Client
|
|
780
|
-
|
|
781
|
-
The default server can also be overridden globally by passing a URL to the `serverURL: string` optional parameter when initializing the SDK client instance. For example:
|
|
782
|
-
|
|
783
|
-
```typescript
|
|
784
|
-
import { Financeable } from "@financeable/aggregation";
|
|
785
|
-
|
|
786
|
-
const financeable = new Financeable({
|
|
787
|
-
serverURL: "https://dev.server.api.financeable.com.au",
|
|
788
|
-
});
|
|
789
|
-
|
|
790
|
-
async function run() {
|
|
791
|
-
const tokenRequest = await financeable.oauthToken.get({
|
|
792
|
-
grantType: 'client_credentials',
|
|
793
|
-
clientId: '<ClientId>',
|
|
794
|
-
clientSecret: '<ClientSecret>',
|
|
795
|
-
scope: 'application:read application:write',
|
|
796
|
-
});
|
|
797
|
-
|
|
798
|
-
const result = await financeable.applications.create({
|
|
799
|
-
data: {
|
|
800
|
-
type: "applications",
|
|
801
|
-
attributes: {
|
|
802
|
-
purpose: "Purchase of a motor vehicle",
|
|
803
|
-
applicationType: "consumer",
|
|
804
|
-
},
|
|
805
|
-
relationships: {
|
|
806
|
-
loanDetails: {
|
|
807
|
-
data: {
|
|
808
|
-
type: "loan-details",
|
|
809
|
-
attributes: {
|
|
810
|
-
repayments: 12,
|
|
811
|
-
repaymentFrequency: "monthly",
|
|
812
|
-
repaymentStructure: "group-payments",
|
|
813
|
-
loanAmount: "10280.95",
|
|
814
|
-
purpose: "Purchase of a motor vehicle",
|
|
815
|
-
term: 48,
|
|
816
|
-
balloon: 5,
|
|
817
|
-
deposit: "2500",
|
|
818
|
-
originationFee: 200,
|
|
819
|
-
rate: "0.15",
|
|
820
|
-
rateAdjustment: "-0.01",
|
|
821
|
-
},
|
|
822
|
-
},
|
|
823
|
-
},
|
|
824
140
|
customers: {
|
|
825
141
|
data: [
|
|
826
|
-
{
|
|
827
|
-
type: "customers",
|
|
828
|
-
attributes: {
|
|
829
|
-
title: "
|
|
830
|
-
firstName: "
|
|
831
|
-
lastName: "
|
|
832
|
-
dateOfBirth: "
|
|
833
|
-
idExpiryDate: "
|
|
834
|
-
|
|
835
|
-
|
|
836
|
-
|
|
837
|
-
|
|
838
|
-
|
|
839
|
-
|
|
840
|
-
{
|
|
841
|
-
type: "addresses",
|
|
842
|
-
attributes: {
|
|
843
|
-
addressType: "residential",
|
|
844
|
-
fullAddress: "42 Wallaby Way, Sydney NSW 2000",
|
|
845
|
-
city: "Sydney",
|
|
846
|
-
postCode: "2000",
|
|
847
|
-
streetAddress: "42 Wallaby Way",
|
|
848
|
-
addressLine2: "",
|
|
849
|
-
streetNumber: "42",
|
|
850
|
-
streetType: "Way",
|
|
851
|
-
street: "Wallaby",
|
|
852
|
-
state: "NSW",
|
|
853
|
-
country: "Australia",
|
|
854
|
-
status: "current",
|
|
855
|
-
monthsAt: 11,
|
|
856
|
-
yearsAt: 2,
|
|
857
|
-
},
|
|
858
|
-
},
|
|
859
|
-
{
|
|
860
|
-
type: "addresses",
|
|
861
|
-
attributes: {
|
|
862
|
-
addressType: "residential",
|
|
863
|
-
fullAddress: "42 Wallaby Way, Sydney NSW 2000",
|
|
864
|
-
city: "Sydney",
|
|
865
|
-
postCode: "2000",
|
|
866
|
-
streetAddress: "42 Wallaby Way",
|
|
867
|
-
addressLine2: "",
|
|
868
|
-
streetNumber: "42",
|
|
869
|
-
streetType: "Way",
|
|
870
|
-
street: "Wallaby",
|
|
871
|
-
state: "NSW",
|
|
872
|
-
country: "Australia",
|
|
873
|
-
status: "previous",
|
|
874
|
-
monthsAt: 2,
|
|
875
|
-
yearsAt: 2,
|
|
876
|
-
},
|
|
877
|
-
},
|
|
878
|
-
],
|
|
879
|
-
},
|
|
880
|
-
},
|
|
881
|
-
},
|
|
882
|
-
],
|
|
883
|
-
},
|
|
884
|
-
asset: {
|
|
885
|
-
data: {
|
|
886
|
-
type: "assets",
|
|
887
|
-
attributes: {
|
|
888
|
-
ageOfAsset: 3,
|
|
889
|
-
ageOfAssetAtEnd: 8,
|
|
890
|
-
condition: "USED",
|
|
891
|
-
assetType: ConsumerAssetType.MotorVehicle,
|
|
892
|
-
purpose: "VEHICLE",
|
|
893
|
-
assetValue: "35000.00",
|
|
894
|
-
make: "Toyota",
|
|
895
|
-
assetModel: "Camry",
|
|
896
|
-
registrationNumber: "ABC123",
|
|
897
|
-
registrationState: "VIC",
|
|
898
|
-
vin: "1HGCM82633A123456",
|
|
899
|
-
supplierName: "Mr and Mrs Smith",
|
|
900
|
-
supplierABN: "12345678901",
|
|
901
|
-
supplierAddress: "123 Car Street, Melbourne VIC 3000",
|
|
902
|
-
supplierPhone: "0412345678",
|
|
903
|
-
supplierContactName: "John Smith",
|
|
904
|
-
supplierEmail: "john.smith@mrandmrssmith.com.au",
|
|
905
|
-
privateSale: false,
|
|
906
|
-
typeOfSale: "DEALER",
|
|
907
|
-
description: "2020 Toyota Camry Hybrid SL, Silver, 45,000km",
|
|
908
|
-
netAssetValue: "32000.00",
|
|
909
|
-
isLuxury: false,
|
|
910
|
-
additionalFees: "995.00",
|
|
911
|
-
additionalTaxes: "0.00",
|
|
912
|
-
},
|
|
913
|
-
},
|
|
914
|
-
},
|
|
915
|
-
},
|
|
916
|
-
}},
|
|
917
|
-
{
|
|
918
|
-
fetchOptions: {
|
|
919
|
-
headers: {
|
|
920
|
-
authorization: `Bearer ${tokenRequest.accessToken}`,
|
|
921
|
-
},
|
|
922
|
-
}
|
|
923
|
-
},
|
|
924
|
-
);
|
|
925
|
-
|
|
926
|
-
// Handle the result
|
|
927
|
-
console.log(result);
|
|
928
|
-
}
|
|
929
|
-
|
|
930
|
-
run();
|
|
931
|
-
```
|
|
932
|
-
|
|
933
|
-
## Custom HTTP Client
|
|
934
|
-
|
|
935
|
-
The TypeScript SDK makes API calls using an `HTTPClient` that wraps the native
|
|
936
|
-
[Fetch API](https://developer.mozilla.org/en-US/docs/Web/API/Fetch_API). This
|
|
937
|
-
client is a thin wrapper around `fetch` and provides the ability to attach hooks
|
|
938
|
-
around the request lifecycle that can be used to modify the request or handle
|
|
939
|
-
errors and response.
|
|
940
|
-
|
|
941
|
-
The `HTTPClient` constructor takes an optional `fetcher` argument that can be
|
|
942
|
-
used to integrate a third-party HTTP client or when writing tests to mock out
|
|
943
|
-
the HTTP client and feed in fixtures.
|
|
944
|
-
|
|
945
|
-
The following example shows how to use the `"beforeRequest"` hook to to add a
|
|
946
|
-
custom header and a timeout to requests and how to use the `"requestError"` hook
|
|
947
|
-
to log errors:
|
|
948
|
-
|
|
949
|
-
```typescript
|
|
950
|
-
import { Financeable } from "@financeable/aggregation";
|
|
951
|
-
import { HTTPClient } from "@financeable/aggregation/lib/http";
|
|
952
|
-
|
|
953
|
-
const httpClient = new HTTPClient({
|
|
954
|
-
// fetcher takes a function that has the same signature as native `fetch`.
|
|
955
|
-
fetcher: (request) => {
|
|
956
|
-
return fetch(request);
|
|
957
|
-
},
|
|
958
|
-
});
|
|
959
|
-
|
|
960
|
-
httpClient.addHook("beforeRequest", (request) => {
|
|
961
|
-
const nextRequest = new Request(request, {
|
|
962
|
-
signal: request.signal || AbortSignal.timeout(5000),
|
|
963
|
-
});
|
|
964
|
-
|
|
965
|
-
nextRequest.headers.set("x-custom-header", "custom value");
|
|
966
|
-
|
|
967
|
-
return nextRequest;
|
|
968
|
-
});
|
|
969
|
-
|
|
970
|
-
httpClient.addHook("requestError", (error, request) => {
|
|
971
|
-
console.group("Request Error");
|
|
972
|
-
console.log("Reason:", `${error}`);
|
|
973
|
-
console.log("Endpoint:", `${request.method} ${request.url}`);
|
|
974
|
-
console.groupEnd();
|
|
975
|
-
});
|
|
976
|
-
|
|
977
|
-
const sdk = new Financeable({ httpClient });
|
|
978
|
-
```
|
|
979
|
-
|
|
980
|
-
## Debugging
|
|
981
|
-
|
|
982
|
-
You can setup your SDK to emit debug logs for SDK requests and responses.
|
|
983
|
-
|
|
984
|
-
You can pass a logger that matches `console`'s interface as an SDK option.
|
|
985
|
-
|
|
986
|
-
> [!WARNING]
|
|
987
|
-
> Beware that debug logging will reveal secrets, like API tokens in headers, in log messages printed to a console or files. It's recommended to use this feature only during local development and not in production.
|
|
988
|
-
|
|
989
|
-
```typescript
|
|
990
|
-
import { Financeable } from "@financeable/aggregation";
|
|
991
|
-
|
|
992
|
-
const sdk = new Financeable({ debugLogger: console });
|
|
993
|
-
```
|
|
994
|
-
|
|
995
|
-
You can also enable a default debug logger by setting an environment variable `FINANCEABLE_DEBUG` to true.
|
|
996
|
-
|
|
997
|
-
<!-- Start Summary [summary] -->
|
|
998
|
-
## Summary
|
|
999
|
-
|
|
1000
|
-
|
|
1001
|
-
<!-- End Summary [summary] -->
|
|
1002
|
-
|
|
1003
|
-
<!-- Start Table of Contents [toc] -->
|
|
1004
|
-
## Table of Contents
|
|
1005
|
-
<!-- $toc-max-depth=2 -->
|
|
1006
|
-
* [financeable-aggregation-api](#financeable-aggregation-api)
|
|
1007
|
-
* [SDK Installation](#sdk-installation)
|
|
1008
|
-
* [Requirements](#requirements)
|
|
1009
|
-
* [SDK Example Usage](#sdk-example-usage)
|
|
1010
|
-
* [Available Resources and Operations](#available-resources-and-operations)
|
|
1011
|
-
* [Standalone functions](#standalone-functions)
|
|
1012
|
-
* [Retries](#retries)
|
|
1013
|
-
* [Error Handling](#error-handling)
|
|
1014
|
-
* [Server Selection](#server-selection)
|
|
1015
|
-
* [Custom HTTP Client](#custom-http-client)
|
|
1016
|
-
* [Debugging](#debugging)
|
|
1017
|
-
* [SDK Installation](#sdk-installation-1)
|
|
1018
|
-
* [Requirements](#requirements-1)
|
|
1019
|
-
* [SDK Example Usage](#sdk-example-usage-1)
|
|
1020
|
-
* [Available Resources and Operations](#available-resources-and-operations-1)
|
|
1021
|
-
* [Standalone functions](#standalone-functions-1)
|
|
1022
|
-
* [Retries](#retries-1)
|
|
1023
|
-
* [Error Handling](#error-handling-1)
|
|
1024
|
-
* [Custom HTTP Client](#custom-http-client-1)
|
|
1025
|
-
* [Debugging](#debugging-1)
|
|
1026
|
-
|
|
1027
|
-
<!-- End Table of Contents [toc] -->
|
|
1028
|
-
|
|
1029
|
-
<!-- Start SDK Installation [installation] -->
|
|
1030
|
-
## SDK Installation
|
|
1031
|
-
|
|
1032
|
-
The SDK can be installed with either [npm](https://www.npmjs.com/), [pnpm](https://pnpm.io/), [bun](https://bun.sh/) or [yarn](https://classic.yarnpkg.com/en/) package managers.
|
|
1033
|
-
|
|
1034
|
-
### NPM
|
|
1035
|
-
|
|
1036
|
-
```bash
|
|
1037
|
-
npm add @financeable/aggregation
|
|
1038
|
-
```
|
|
1039
|
-
|
|
1040
|
-
### PNPM
|
|
1041
|
-
|
|
1042
|
-
```bash
|
|
1043
|
-
pnpm add @financeable/aggregation
|
|
1044
|
-
```
|
|
1045
|
-
|
|
1046
|
-
### Bun
|
|
1047
|
-
|
|
1048
|
-
```bash
|
|
1049
|
-
bun add @financeable/aggregation
|
|
1050
|
-
```
|
|
1051
|
-
|
|
1052
|
-
### Yarn
|
|
1053
|
-
|
|
1054
|
-
```bash
|
|
1055
|
-
yarn add @financeable/aggregation zod
|
|
1056
|
-
|
|
1057
|
-
# Note that Yarn does not install peer dependencies automatically. You will need
|
|
1058
|
-
# to install zod as shown above.
|
|
1059
|
-
```
|
|
1060
|
-
<!-- End SDK Installation [installation] -->
|
|
1061
|
-
|
|
1062
|
-
<!-- Start Requirements [requirements] -->
|
|
1063
|
-
## Requirements
|
|
1064
|
-
|
|
1065
|
-
For supported JavaScript runtimes, please consult [RUNTIMES.md](RUNTIMES.md).
|
|
1066
|
-
<!-- End Requirements [requirements] -->
|
|
1067
|
-
|
|
1068
|
-
## SDK Example Usage
|
|
1069
|
-
|
|
1070
|
-
### Example
|
|
1071
|
-
|
|
1072
|
-
```typescript
|
|
1073
|
-
import { Financeable } from "@financeable/aggregation";
|
|
1074
|
-
import { ConsumerAssetType } from "@financeable/aggregation/models/components"
|
|
1075
|
-
|
|
1076
|
-
const financeable = new Financeable({
|
|
1077
|
-
serverURL: '<ServerURL>',
|
|
1078
|
-
});
|
|
1079
|
-
|
|
1080
|
-
async function run() {
|
|
1081
|
-
const tokenRequest = await financeable.oauthToken.get({
|
|
1082
|
-
grantType: 'client_credentials',
|
|
1083
|
-
clientId: '<ClientId>',
|
|
1084
|
-
clientSecret: '<ClientSecret>',
|
|
1085
|
-
scope: 'application:read application:write',
|
|
1086
|
-
});
|
|
1087
|
-
|
|
1088
|
-
const result = await financeable.applications.create({
|
|
1089
|
-
data: {
|
|
1090
|
-
type: "applications",
|
|
1091
|
-
attributes: {
|
|
1092
|
-
purpose: "Purchase of a motor vehicle",
|
|
1093
|
-
applicationType: "consumer",
|
|
1094
|
-
},
|
|
1095
|
-
relationships: {
|
|
1096
|
-
loanDetails: {
|
|
1097
|
-
data: {
|
|
1098
|
-
type: "loan-details",
|
|
1099
|
-
attributes: {
|
|
1100
|
-
repayments: 12,
|
|
1101
|
-
repaymentFrequency: "monthly",
|
|
1102
|
-
repaymentStructure: "group-payments",
|
|
1103
|
-
loanAmount: "10280.95",
|
|
1104
|
-
purpose: "Purchase of a motor vehicle",
|
|
1105
|
-
term: 48,
|
|
1106
|
-
balloon: 5,
|
|
1107
|
-
deposit: "2500",
|
|
1108
|
-
originationFee: 200,
|
|
1109
|
-
rate: "0.15",
|
|
1110
|
-
rateAdjustment: "-0.01",
|
|
1111
|
-
},
|
|
1112
|
-
},
|
|
1113
|
-
},
|
|
1114
|
-
customers: {
|
|
1115
|
-
data: [
|
|
1116
|
-
{
|
|
1117
|
-
type: "customers",
|
|
1118
|
-
attributes: {
|
|
1119
|
-
title: "Mr",
|
|
1120
|
-
firstName: "John",
|
|
1121
|
-
lastName: "Smith",
|
|
1122
|
-
dateOfBirth: "1990-06-28",
|
|
1123
|
-
idExpiryDate: "<value>",
|
|
142
|
+
{
|
|
143
|
+
type: "customers",
|
|
144
|
+
attributes: {
|
|
145
|
+
title: "Ms",
|
|
146
|
+
firstName: "Bria",
|
|
147
|
+
lastName: "Schinner",
|
|
148
|
+
dateOfBirth: "2004-04-11",
|
|
149
|
+
idExpiryDate: "<value>",
|
|
150
|
+
},
|
|
151
|
+
relationships: {
|
|
152
|
+
addresses: {
|
|
153
|
+
data: [],
|
|
154
|
+
},
|
|
155
|
+
},
|
|
1124
156
|
},
|
|
1125
|
-
|
|
1126
|
-
|
|
1127
|
-
|
|
1128
|
-
|
|
1129
|
-
|
|
1130
|
-
|
|
1131
|
-
|
|
1132
|
-
|
|
1133
|
-
|
|
1134
|
-
|
|
1135
|
-
|
|
1136
|
-
|
|
1137
|
-
|
|
1138
|
-
|
|
1139
|
-
|
|
1140
|
-
|
|
1141
|
-
|
|
1142
|
-
|
|
1143
|
-
|
|
1144
|
-
|
|
157
|
+
{
|
|
158
|
+
type: "customers",
|
|
159
|
+
attributes: {
|
|
160
|
+
title: "Mr",
|
|
161
|
+
firstName: "Astrid",
|
|
162
|
+
lastName: "Schumm",
|
|
163
|
+
dateOfBirth: "1981-04-17",
|
|
164
|
+
idExpiryDate: "<value>",
|
|
165
|
+
},
|
|
166
|
+
relationships: {
|
|
167
|
+
addresses: {
|
|
168
|
+
data: [
|
|
169
|
+
{
|
|
170
|
+
type: "addresses",
|
|
171
|
+
attributes: {
|
|
172
|
+
addressType: "residential",
|
|
173
|
+
fullAddress: "42 Wallaby Way, Sydney NSW 2000",
|
|
174
|
+
city: "Sydney",
|
|
175
|
+
postCode: "2000",
|
|
176
|
+
streetAddress: "42 Wallaby Way",
|
|
177
|
+
addressLine2: "",
|
|
178
|
+
streetNumber: "42",
|
|
179
|
+
streetType: "Way",
|
|
180
|
+
street: "Wallaby",
|
|
181
|
+
state: "NSW",
|
|
182
|
+
country: "Australia",
|
|
183
|
+
status: "current",
|
|
184
|
+
monthsAt: 24,
|
|
185
|
+
yearsAt: 2,
|
|
186
|
+
},
|
|
187
|
+
},
|
|
188
|
+
{
|
|
189
|
+
type: "addresses",
|
|
190
|
+
attributes: {
|
|
191
|
+
addressType: "residential",
|
|
192
|
+
fullAddress: "42 Wallaby Way, Sydney NSW 2000",
|
|
193
|
+
city: "Sydney",
|
|
194
|
+
postCode: "2000",
|
|
195
|
+
streetAddress: "42 Wallaby Way",
|
|
196
|
+
addressLine2: "",
|
|
197
|
+
streetNumber: "42",
|
|
198
|
+
streetType: "Way",
|
|
199
|
+
street: "Wallaby",
|
|
200
|
+
state: "NSW",
|
|
201
|
+
country: "Australia",
|
|
202
|
+
status: "current",
|
|
203
|
+
monthsAt: 24,
|
|
204
|
+
yearsAt: 2,
|
|
205
|
+
},
|
|
1145
206
|
},
|
|
1146
|
-
|
|
1147
|
-
|
|
1148
|
-
|
|
1149
|
-
|
|
1150
|
-
|
|
1151
|
-
|
|
1152
|
-
|
|
1153
|
-
|
|
1154
|
-
|
|
1155
|
-
|
|
1156
|
-
|
|
1157
|
-
|
|
1158
|
-
|
|
1159
|
-
|
|
1160
|
-
|
|
1161
|
-
|
|
1162
|
-
|
|
1163
|
-
|
|
207
|
+
{
|
|
208
|
+
type: "addresses",
|
|
209
|
+
attributes: {
|
|
210
|
+
addressType: "residential",
|
|
211
|
+
fullAddress: "42 Wallaby Way, Sydney NSW 2000",
|
|
212
|
+
city: "Sydney",
|
|
213
|
+
postCode: "2000",
|
|
214
|
+
streetAddress: "42 Wallaby Way",
|
|
215
|
+
addressLine2: "",
|
|
216
|
+
streetNumber: "42",
|
|
217
|
+
streetType: "Way",
|
|
218
|
+
street: "Wallaby",
|
|
219
|
+
state: "NSW",
|
|
220
|
+
country: "Australia",
|
|
221
|
+
status: "current",
|
|
222
|
+
monthsAt: 24,
|
|
223
|
+
yearsAt: 2,
|
|
224
|
+
},
|
|
1164
225
|
},
|
|
1165
|
-
|
|
226
|
+
],
|
|
227
|
+
},
|
|
228
|
+
},
|
|
229
|
+
},
|
|
230
|
+
],
|
|
231
|
+
},
|
|
232
|
+
entities: {
|
|
233
|
+
data: [
|
|
234
|
+
{
|
|
235
|
+
type: "entities",
|
|
236
|
+
attributes: {
|
|
237
|
+
entityName: "Financeable Pty Ltd",
|
|
238
|
+
abn: "12345678901",
|
|
239
|
+
turnover: 1000000,
|
|
240
|
+
industryType: "Finance",
|
|
241
|
+
emails: [
|
|
242
|
+
"test@financeable.com.au",
|
|
243
|
+
],
|
|
244
|
+
phoneNumbers: [
|
|
245
|
+
"0412345678",
|
|
1166
246
|
],
|
|
1167
247
|
},
|
|
1168
248
|
},
|
|
1169
|
-
|
|
1170
|
-
|
|
1171
|
-
|
|
1172
|
-
|
|
1173
|
-
|
|
1174
|
-
|
|
1175
|
-
|
|
1176
|
-
|
|
1177
|
-
|
|
1178
|
-
|
|
1179
|
-
|
|
1180
|
-
|
|
1181
|
-
|
|
1182
|
-
|
|
1183
|
-
|
|
1184
|
-
|
|
1185
|
-
|
|
1186
|
-
|
|
1187
|
-
|
|
1188
|
-
|
|
1189
|
-
|
|
1190
|
-
|
|
1191
|
-
|
|
1192
|
-
|
|
1193
|
-
|
|
1194
|
-
|
|
1195
|
-
|
|
1196
|
-
|
|
1197
|
-
|
|
1198
|
-
|
|
1199
|
-
|
|
1200
|
-
},
|
|
249
|
+
{
|
|
250
|
+
type: "entities",
|
|
251
|
+
attributes: {
|
|
252
|
+
entityName: "Financeable Pty Ltd",
|
|
253
|
+
abn: "12345678901",
|
|
254
|
+
turnover: 1000000,
|
|
255
|
+
industryType: "Finance",
|
|
256
|
+
emails: [
|
|
257
|
+
"test@financeable.com.au",
|
|
258
|
+
],
|
|
259
|
+
phoneNumbers: [
|
|
260
|
+
"0412345678",
|
|
261
|
+
],
|
|
262
|
+
},
|
|
263
|
+
},
|
|
264
|
+
{
|
|
265
|
+
type: "entities",
|
|
266
|
+
attributes: {
|
|
267
|
+
entityName: "Financeable Pty Ltd",
|
|
268
|
+
abn: "12345678901",
|
|
269
|
+
turnover: 1000000,
|
|
270
|
+
industryType: "Finance",
|
|
271
|
+
emails: [
|
|
272
|
+
"test@financeable.com.au",
|
|
273
|
+
],
|
|
274
|
+
phoneNumbers: [
|
|
275
|
+
"0412345678",
|
|
276
|
+
],
|
|
277
|
+
},
|
|
278
|
+
},
|
|
279
|
+
],
|
|
1201
280
|
},
|
|
1202
281
|
},
|
|
1203
282
|
},
|
|
1204
|
-
},
|
|
1205
|
-
|
|
1206
|
-
|
|
1207
|
-
|
|
1208
|
-
|
|
283
|
+
}, {
|
|
284
|
+
fetchOptions: {
|
|
285
|
+
headers: {
|
|
286
|
+
authorization: `Bearer ${tokenRequest.accessToken}`,
|
|
287
|
+
},
|
|
1209
288
|
},
|
|
1210
|
-
}
|
|
1211
|
-
},
|
|
1212
|
-
});
|
|
289
|
+
});
|
|
1213
290
|
|
|
1214
|
-
|
|
1215
|
-
|
|
291
|
+
// Handle the result
|
|
292
|
+
console.log(result);
|
|
293
|
+
} catch (err) {
|
|
294
|
+
switch (true) {
|
|
295
|
+
// The server response does not match the expected SDK schema
|
|
296
|
+
case (err instanceof SDKValidationError): {
|
|
297
|
+
// Pretty-print will provide a human-readable multi-line error message
|
|
298
|
+
console.error(err.pretty());
|
|
299
|
+
// Raw value may also be inspected
|
|
300
|
+
console.error(err.rawValue);
|
|
301
|
+
return;
|
|
302
|
+
}
|
|
303
|
+
case (err instanceof CreateApplicationResponseBody): {
|
|
304
|
+
// Handle err.data$: CreateApplicationResponseBodyData
|
|
305
|
+
console.error(err);
|
|
306
|
+
return;
|
|
307
|
+
}
|
|
308
|
+
default: {
|
|
309
|
+
// Other errors such as network errors, see HTTPClientErrors for more details
|
|
310
|
+
throw err;
|
|
311
|
+
}
|
|
312
|
+
}
|
|
313
|
+
}
|
|
1216
314
|
}
|
|
1217
315
|
|
|
1218
316
|
run();
|
|
1219
317
|
|
|
1220
318
|
```
|
|
319
|
+
<!-- No SDK Example Usage [usage] -->
|
|
1221
320
|
|
|
1222
|
-
<!-- No
|
|
1223
|
-
|
|
1224
|
-
<!-- No End Authentication [security] -->
|
|
321
|
+
<!-- No Authentication [security] -->
|
|
1225
322
|
|
|
1226
323
|
<!-- Start Available Resources and Operations [operations] -->
|
|
1227
324
|
## Available Resources and Operations
|
|
@@ -1232,13 +329,15 @@ run();
|
|
|
1232
329
|
### [applications](docs/sdks/applications/README.md)
|
|
1233
330
|
|
|
1234
331
|
* [create](docs/sdks/applications/README.md#create) - Create an application in the Financeable platform.
|
|
1235
|
-
* [list](docs/sdks/applications/README.md#list) - Retrieve a list of applications
|
|
1236
|
-
* [get](docs/sdks/applications/README.md#get) - Retrieve an application by its ID
|
|
1237
332
|
|
|
1238
333
|
|
|
1239
334
|
### [oauthToken](docs/sdks/oauthtoken/README.md)
|
|
1240
335
|
|
|
1241
|
-
* [
|
|
336
|
+
* [oauthToken](docs/sdks/oauthtoken/README.md#oauthtoken) - Obtain an OAuth client_credentials token
|
|
337
|
+
|
|
338
|
+
### [supportingDocuments](docs/sdks/supportingdocuments/README.md)
|
|
339
|
+
|
|
340
|
+
* [create](docs/sdks/supportingdocuments/README.md#create) - Create a supporting document record in Financeable, and returns a pre-signed URL to upload this document with.
|
|
1242
341
|
|
|
1243
342
|
</details>
|
|
1244
343
|
<!-- End Available Resources and Operations [operations] -->
|
|
@@ -1259,9 +358,8 @@ To read more about standalone functions, check [FUNCTIONS.md](./FUNCTIONS.md).
|
|
|
1259
358
|
<summary>Available standalone functions</summary>
|
|
1260
359
|
|
|
1261
360
|
- [`applicationsCreate`](docs/sdks/applications/README.md#create) - Create an application in the Financeable platform.
|
|
1262
|
-
- [`
|
|
1263
|
-
- [`
|
|
1264
|
-
- [`oauthTokenGet`](docs/sdks/oauthtoken/README.md#get) - Obtain an OAuth client_credentials token
|
|
361
|
+
- [`oauthTokenOauthToken`](docs/sdks/oauthtoken/README.md#oauthtoken) - Obtain an OAuth client_credentials token
|
|
362
|
+
- [`supportingDocumentsCreate`](docs/sdks/supportingdocuments/README.md#create) - Create a supporting document record in Financeable, and returns a pre-signed URL to upload this document with.
|
|
1265
363
|
|
|
1266
364
|
</details>
|
|
1267
365
|
<!-- End Standalone functions [standalone-funcs] -->
|
|
@@ -1274,143 +372,26 @@ Some of the endpoints in this SDK support retries. If you use the SDK without a
|
|
|
1274
372
|
To change the default retry strategy for a single API call, simply provide a retryConfig object to the call:
|
|
1275
373
|
```typescript
|
|
1276
374
|
import { Financeable } from "@financeable/aggregation";
|
|
1277
|
-
import { CommercialAssetType } from "@financeable/aggregation/models/components";
|
|
1278
375
|
|
|
1279
376
|
const financeable = new Financeable({
|
|
1280
377
|
clientCredentials: process.env["FINANCEABLE_CLIENT_CREDENTIALS"] ?? "",
|
|
1281
378
|
});
|
|
1282
379
|
|
|
1283
380
|
async function run() {
|
|
1284
|
-
const result = await financeable.
|
|
1285
|
-
|
|
1286
|
-
|
|
1287
|
-
|
|
1288
|
-
|
|
1289
|
-
|
|
1290
|
-
|
|
1291
|
-
|
|
1292
|
-
loanDetails: {
|
|
1293
|
-
data: {
|
|
1294
|
-
type: "loan-details",
|
|
1295
|
-
attributes: {
|
|
1296
|
-
repayments: 12,
|
|
1297
|
-
repaymentFrequency: "monthly",
|
|
1298
|
-
repaymentStructure: "group-payments",
|
|
1299
|
-
loanAmount: "10280.95",
|
|
1300
|
-
purpose: "Purchase of a motor vehicle",
|
|
1301
|
-
term: 48,
|
|
1302
|
-
balloon: 5,
|
|
1303
|
-
deposit: "2500",
|
|
1304
|
-
originationFee: 200,
|
|
1305
|
-
rate: "0.15",
|
|
1306
|
-
rateAdjustment: "-0.01",
|
|
1307
|
-
},
|
|
1308
|
-
},
|
|
1309
|
-
},
|
|
1310
|
-
entities: {
|
|
1311
|
-
data: [
|
|
1312
|
-
{
|
|
1313
|
-
type: "entities",
|
|
1314
|
-
attributes: {
|
|
1315
|
-
businessNames: [
|
|
1316
|
-
"<value>",
|
|
1317
|
-
"<value>",
|
|
1318
|
-
],
|
|
1319
|
-
entityName: "<value>",
|
|
1320
|
-
abn: "<value>",
|
|
1321
|
-
acn: "<value>",
|
|
1322
|
-
state: "QLD",
|
|
1323
|
-
entityType: "Australian Private Company",
|
|
1324
|
-
},
|
|
1325
|
-
},
|
|
1326
|
-
],
|
|
1327
|
-
},
|
|
1328
|
-
customers: {
|
|
1329
|
-
data: [
|
|
1330
|
-
{
|
|
1331
|
-
type: "customers",
|
|
1332
|
-
attributes: {
|
|
1333
|
-
title: "Mr",
|
|
1334
|
-
firstName: "John",
|
|
1335
|
-
lastName: "Smith",
|
|
1336
|
-
dateOfBirth: "01-01-1990",
|
|
1337
|
-
idExpiryDate: "<value>",
|
|
1338
|
-
},
|
|
1339
|
-
relationships: {
|
|
1340
|
-
addresses: {
|
|
1341
|
-
data: [
|
|
1342
|
-
{
|
|
1343
|
-
type: "addresses",
|
|
1344
|
-
attributes: {
|
|
1345
|
-
addressType: "residential",
|
|
1346
|
-
fullAddress: "42 Wallaby Way, Sydney NSW 2000",
|
|
1347
|
-
city: "Sydney",
|
|
1348
|
-
postCode: "2000",
|
|
1349
|
-
streetAddress: "42 Wallaby Way",
|
|
1350
|
-
addressLine2: "",
|
|
1351
|
-
streetNumber: "42",
|
|
1352
|
-
streetType: "Way",
|
|
1353
|
-
street: "Wallaby",
|
|
1354
|
-
state: "NSW",
|
|
1355
|
-
country: "Australia",
|
|
1356
|
-
status: "current",
|
|
1357
|
-
monthsAt: 24,
|
|
1358
|
-
yearsAt: 2,
|
|
1359
|
-
},
|
|
1360
|
-
},
|
|
1361
|
-
{
|
|
1362
|
-
type: "addresses",
|
|
1363
|
-
attributes: {
|
|
1364
|
-
addressType: "residential",
|
|
1365
|
-
fullAddress: "42 Wallaby Way, Sydney NSW 2000",
|
|
1366
|
-
city: "Sydney",
|
|
1367
|
-
postCode: "2000",
|
|
1368
|
-
streetAddress: "42 Wallaby Way",
|
|
1369
|
-
addressLine2: "",
|
|
1370
|
-
streetNumber: "42",
|
|
1371
|
-
streetType: "Way",
|
|
1372
|
-
street: "Wallaby",
|
|
1373
|
-
state: "NSW",
|
|
1374
|
-
country: "Australia",
|
|
1375
|
-
status: "current",
|
|
1376
|
-
monthsAt: 24,
|
|
1377
|
-
yearsAt: 2,
|
|
1378
|
-
},
|
|
1379
|
-
},
|
|
1380
|
-
],
|
|
1381
|
-
},
|
|
1382
|
-
},
|
|
1383
|
-
},
|
|
1384
|
-
],
|
|
381
|
+
const result = await financeable.supportingDocuments.create({
|
|
382
|
+
mimeType: "text/plain",
|
|
383
|
+
requestBody: {
|
|
384
|
+
data: {
|
|
385
|
+
type: "supporting-documents",
|
|
386
|
+
attributes: {
|
|
387
|
+
filename: "example.file",
|
|
388
|
+
documentType: "ASIC FILE",
|
|
1385
389
|
},
|
|
1386
|
-
|
|
1387
|
-
|
|
1388
|
-
|
|
1389
|
-
|
|
1390
|
-
|
|
1391
|
-
ageOfAssetAtEnd: 8,
|
|
1392
|
-
condition: "USED",
|
|
1393
|
-
assetType: CommercialAssetType.MotorVehicleLessThan45Tonnes,
|
|
1394
|
-
purpose: "VEHICLE",
|
|
1395
|
-
assetValue: "35000.00",
|
|
1396
|
-
make: "Toyota",
|
|
1397
|
-
assetModel: "Camry",
|
|
1398
|
-
registrationNumber: "ABC123",
|
|
1399
|
-
registrationState: "VIC",
|
|
1400
|
-
vin: "1HGCM82633A123456",
|
|
1401
|
-
supplierName: "Mr and Mrs Smith",
|
|
1402
|
-
supplierABN: "12345678901",
|
|
1403
|
-
supplierAddress: "123 Car Street, Melbourne VIC 3000",
|
|
1404
|
-
supplierPhone: "0412345678",
|
|
1405
|
-
supplierContactName: "John Smith",
|
|
1406
|
-
supplierEmail: "john.smith@mrandmrssmith.com.au",
|
|
1407
|
-
privateSale: false,
|
|
1408
|
-
typeOfSale: "DEALER",
|
|
1409
|
-
description: "2020 Toyota Camry Hybrid SL, Silver, 45,000km",
|
|
1410
|
-
netAssetValue: "32000.00",
|
|
1411
|
-
isLuxury: false,
|
|
1412
|
-
additionalFees: "995.00",
|
|
1413
|
-
additionalTaxes: "0.00",
|
|
390
|
+
relationships: {
|
|
391
|
+
application: {
|
|
392
|
+
data: {
|
|
393
|
+
type: "consumer-secured-applications",
|
|
394
|
+
id: "<id>",
|
|
1414
395
|
},
|
|
1415
396
|
},
|
|
1416
397
|
},
|
|
@@ -1440,7 +421,6 @@ run();
|
|
|
1440
421
|
If you'd like to override the default retry strategy for all operations that support retries, you can provide a retryConfig at SDK initialization:
|
|
1441
422
|
```typescript
|
|
1442
423
|
import { Financeable } from "@financeable/aggregation";
|
|
1443
|
-
import { CommercialAssetType } from "@financeable/aggregation/models/components";
|
|
1444
424
|
|
|
1445
425
|
const financeable = new Financeable({
|
|
1446
426
|
retryConfig: {
|
|
@@ -1457,136 +437,20 @@ const financeable = new Financeable({
|
|
|
1457
437
|
});
|
|
1458
438
|
|
|
1459
439
|
async function run() {
|
|
1460
|
-
const result = await financeable.
|
|
1461
|
-
|
|
1462
|
-
|
|
1463
|
-
|
|
1464
|
-
|
|
1465
|
-
|
|
1466
|
-
|
|
1467
|
-
|
|
1468
|
-
loanDetails: {
|
|
1469
|
-
data: {
|
|
1470
|
-
type: "loan-details",
|
|
1471
|
-
attributes: {
|
|
1472
|
-
repayments: 12,
|
|
1473
|
-
repaymentFrequency: "monthly",
|
|
1474
|
-
repaymentStructure: "group-payments",
|
|
1475
|
-
loanAmount: "10280.95",
|
|
1476
|
-
purpose: "Purchase of a motor vehicle",
|
|
1477
|
-
term: 48,
|
|
1478
|
-
balloon: 5,
|
|
1479
|
-
deposit: "2500",
|
|
1480
|
-
originationFee: 200,
|
|
1481
|
-
rate: "0.15",
|
|
1482
|
-
rateAdjustment: "-0.01",
|
|
1483
|
-
},
|
|
1484
|
-
},
|
|
1485
|
-
},
|
|
1486
|
-
entities: {
|
|
1487
|
-
data: [
|
|
1488
|
-
{
|
|
1489
|
-
type: "entities",
|
|
1490
|
-
attributes: {
|
|
1491
|
-
businessNames: [
|
|
1492
|
-
"<value>",
|
|
1493
|
-
"<value>",
|
|
1494
|
-
],
|
|
1495
|
-
entityName: "<value>",
|
|
1496
|
-
abn: "<value>",
|
|
1497
|
-
acn: "<value>",
|
|
1498
|
-
state: "QLD",
|
|
1499
|
-
entityType: "Australian Private Company",
|
|
1500
|
-
},
|
|
1501
|
-
},
|
|
1502
|
-
],
|
|
1503
|
-
},
|
|
1504
|
-
customers: {
|
|
1505
|
-
data: [
|
|
1506
|
-
{
|
|
1507
|
-
type: "customers",
|
|
1508
|
-
attributes: {
|
|
1509
|
-
title: "Mr",
|
|
1510
|
-
firstName: "John",
|
|
1511
|
-
lastName: "Smith",
|
|
1512
|
-
dateOfBirth: "01-01-1990",
|
|
1513
|
-
idExpiryDate: "<value>",
|
|
1514
|
-
},
|
|
1515
|
-
relationships: {
|
|
1516
|
-
addresses: {
|
|
1517
|
-
data: [
|
|
1518
|
-
{
|
|
1519
|
-
type: "addresses",
|
|
1520
|
-
attributes: {
|
|
1521
|
-
addressType: "residential",
|
|
1522
|
-
fullAddress: "42 Wallaby Way, Sydney NSW 2000",
|
|
1523
|
-
city: "Sydney",
|
|
1524
|
-
postCode: "2000",
|
|
1525
|
-
streetAddress: "42 Wallaby Way",
|
|
1526
|
-
addressLine2: "",
|
|
1527
|
-
streetNumber: "42",
|
|
1528
|
-
streetType: "Way",
|
|
1529
|
-
street: "Wallaby",
|
|
1530
|
-
state: "NSW",
|
|
1531
|
-
country: "Australia",
|
|
1532
|
-
status: "current",
|
|
1533
|
-
monthsAt: 24,
|
|
1534
|
-
yearsAt: 2,
|
|
1535
|
-
},
|
|
1536
|
-
},
|
|
1537
|
-
{
|
|
1538
|
-
type: "addresses",
|
|
1539
|
-
attributes: {
|
|
1540
|
-
addressType: "residential",
|
|
1541
|
-
fullAddress: "42 Wallaby Way, Sydney NSW 2000",
|
|
1542
|
-
city: "Sydney",
|
|
1543
|
-
postCode: "2000",
|
|
1544
|
-
streetAddress: "42 Wallaby Way",
|
|
1545
|
-
addressLine2: "",
|
|
1546
|
-
streetNumber: "42",
|
|
1547
|
-
streetType: "Way",
|
|
1548
|
-
street: "Wallaby",
|
|
1549
|
-
state: "NSW",
|
|
1550
|
-
country: "Australia",
|
|
1551
|
-
status: "current",
|
|
1552
|
-
monthsAt: 24,
|
|
1553
|
-
yearsAt: 2,
|
|
1554
|
-
},
|
|
1555
|
-
},
|
|
1556
|
-
],
|
|
1557
|
-
},
|
|
1558
|
-
},
|
|
1559
|
-
},
|
|
1560
|
-
],
|
|
440
|
+
const result = await financeable.supportingDocuments.create({
|
|
441
|
+
mimeType: "text/plain",
|
|
442
|
+
requestBody: {
|
|
443
|
+
data: {
|
|
444
|
+
type: "supporting-documents",
|
|
445
|
+
attributes: {
|
|
446
|
+
filename: "example.file",
|
|
447
|
+
documentType: "ASIC FILE",
|
|
1561
448
|
},
|
|
1562
|
-
|
|
1563
|
-
|
|
1564
|
-
|
|
1565
|
-
|
|
1566
|
-
|
|
1567
|
-
ageOfAssetAtEnd: 8,
|
|
1568
|
-
condition: "USED",
|
|
1569
|
-
assetType: CommercialAssetType.MotorVehicleLessThan45Tonnes,
|
|
1570
|
-
purpose: "VEHICLE",
|
|
1571
|
-
assetValue: "35000.00",
|
|
1572
|
-
make: "Toyota",
|
|
1573
|
-
assetModel: "Camry",
|
|
1574
|
-
registrationNumber: "ABC123",
|
|
1575
|
-
registrationState: "VIC",
|
|
1576
|
-
vin: "1HGCM82633A123456",
|
|
1577
|
-
supplierName: "Mr and Mrs Smith",
|
|
1578
|
-
supplierABN: "12345678901",
|
|
1579
|
-
supplierAddress: "123 Car Street, Melbourne VIC 3000",
|
|
1580
|
-
supplierPhone: "0412345678",
|
|
1581
|
-
supplierContactName: "John Smith",
|
|
1582
|
-
supplierEmail: "john.smith@mrandmrssmith.com.au",
|
|
1583
|
-
privateSale: false,
|
|
1584
|
-
typeOfSale: "DEALER",
|
|
1585
|
-
description: "2020 Toyota Camry Hybrid SL, Silver, 45,000km",
|
|
1586
|
-
netAssetValue: "32000.00",
|
|
1587
|
-
isLuxury: false,
|
|
1588
|
-
additionalFees: "995.00",
|
|
1589
|
-
additionalTaxes: "0.00",
|
|
449
|
+
relationships: {
|
|
450
|
+
application: {
|
|
451
|
+
data: {
|
|
452
|
+
type: "consumer-secured-applications",
|
|
453
|
+
id: "<id>",
|
|
1590
454
|
},
|
|
1591
455
|
},
|
|
1592
456
|
},
|
|
@@ -1608,19 +472,22 @@ run();
|
|
|
1608
472
|
|
|
1609
473
|
Some methods specify known errors which can be thrown. All the known errors are enumerated in the `models/errors/errors.ts` module. The known errors for a method are documented under the *Errors* tables in SDK docs. For example, the `create` method may throw the following errors:
|
|
1610
474
|
|
|
1611
|
-
| Error Type
|
|
1612
|
-
|
|
|
1613
|
-
| errors.
|
|
1614
|
-
| errors.
|
|
475
|
+
| Error Type | Status Code | Content Type |
|
|
476
|
+
| -------------------------------------------- | ----------- | ---------------- |
|
|
477
|
+
| errors.SupportingDocumentsCreateResponseBody | 400 | application/json |
|
|
478
|
+
| errors.One | 404 | application/json |
|
|
479
|
+
| errors.Two | 404 | application/json |
|
|
480
|
+
| errors.APIError | 4XX, 5XX | \*/\* |
|
|
1615
481
|
|
|
1616
482
|
If the method throws an error and it is not captured by the known errors, it will default to throwing a `APIError`.
|
|
1617
483
|
|
|
1618
484
|
```typescript
|
|
1619
485
|
import { Financeable } from "@financeable/aggregation";
|
|
1620
|
-
import { CommercialAssetType } from "@financeable/aggregation/models/components";
|
|
1621
486
|
import {
|
|
1622
|
-
|
|
487
|
+
One,
|
|
1623
488
|
SDKValidationError,
|
|
489
|
+
SupportingDocumentsCreateResponseBody,
|
|
490
|
+
Two,
|
|
1624
491
|
} from "@financeable/aggregation/models/errors";
|
|
1625
492
|
|
|
1626
493
|
const financeable = new Financeable({
|
|
@@ -1630,136 +497,20 @@ const financeable = new Financeable({
|
|
|
1630
497
|
async function run() {
|
|
1631
498
|
let result;
|
|
1632
499
|
try {
|
|
1633
|
-
result = await financeable.
|
|
1634
|
-
|
|
1635
|
-
|
|
1636
|
-
|
|
1637
|
-
|
|
1638
|
-
|
|
1639
|
-
|
|
1640
|
-
|
|
1641
|
-
loanDetails: {
|
|
1642
|
-
data: {
|
|
1643
|
-
type: "loan-details",
|
|
1644
|
-
attributes: {
|
|
1645
|
-
repayments: 12,
|
|
1646
|
-
repaymentFrequency: "monthly",
|
|
1647
|
-
repaymentStructure: "group-payments",
|
|
1648
|
-
loanAmount: "10280.95",
|
|
1649
|
-
purpose: "Purchase of a motor vehicle",
|
|
1650
|
-
term: 48,
|
|
1651
|
-
balloon: 5,
|
|
1652
|
-
deposit: "2500",
|
|
1653
|
-
originationFee: 200,
|
|
1654
|
-
rate: "0.15",
|
|
1655
|
-
rateAdjustment: "-0.01",
|
|
1656
|
-
},
|
|
1657
|
-
},
|
|
1658
|
-
},
|
|
1659
|
-
entities: {
|
|
1660
|
-
data: [
|
|
1661
|
-
{
|
|
1662
|
-
type: "entities",
|
|
1663
|
-
attributes: {
|
|
1664
|
-
businessNames: [
|
|
1665
|
-
"<value>",
|
|
1666
|
-
"<value>",
|
|
1667
|
-
],
|
|
1668
|
-
entityName: "<value>",
|
|
1669
|
-
abn: "<value>",
|
|
1670
|
-
acn: "<value>",
|
|
1671
|
-
state: "QLD",
|
|
1672
|
-
entityType: "Australian Private Company",
|
|
1673
|
-
},
|
|
1674
|
-
},
|
|
1675
|
-
],
|
|
1676
|
-
},
|
|
1677
|
-
customers: {
|
|
1678
|
-
data: [
|
|
1679
|
-
{
|
|
1680
|
-
type: "customers",
|
|
1681
|
-
attributes: {
|
|
1682
|
-
title: "Mr",
|
|
1683
|
-
firstName: "John",
|
|
1684
|
-
lastName: "Smith",
|
|
1685
|
-
dateOfBirth: "01-01-1990",
|
|
1686
|
-
idExpiryDate: "<value>",
|
|
1687
|
-
},
|
|
1688
|
-
relationships: {
|
|
1689
|
-
addresses: {
|
|
1690
|
-
data: [
|
|
1691
|
-
{
|
|
1692
|
-
type: "addresses",
|
|
1693
|
-
attributes: {
|
|
1694
|
-
addressType: "residential",
|
|
1695
|
-
fullAddress: "42 Wallaby Way, Sydney NSW 2000",
|
|
1696
|
-
city: "Sydney",
|
|
1697
|
-
postCode: "2000",
|
|
1698
|
-
streetAddress: "42 Wallaby Way",
|
|
1699
|
-
addressLine2: "",
|
|
1700
|
-
streetNumber: "42",
|
|
1701
|
-
streetType: "Way",
|
|
1702
|
-
street: "Wallaby",
|
|
1703
|
-
state: "NSW",
|
|
1704
|
-
country: "Australia",
|
|
1705
|
-
status: "current",
|
|
1706
|
-
monthsAt: 24,
|
|
1707
|
-
yearsAt: 2,
|
|
1708
|
-
},
|
|
1709
|
-
},
|
|
1710
|
-
{
|
|
1711
|
-
type: "addresses",
|
|
1712
|
-
attributes: {
|
|
1713
|
-
addressType: "residential",
|
|
1714
|
-
fullAddress: "42 Wallaby Way, Sydney NSW 2000",
|
|
1715
|
-
city: "Sydney",
|
|
1716
|
-
postCode: "2000",
|
|
1717
|
-
streetAddress: "42 Wallaby Way",
|
|
1718
|
-
addressLine2: "",
|
|
1719
|
-
streetNumber: "42",
|
|
1720
|
-
streetType: "Way",
|
|
1721
|
-
street: "Wallaby",
|
|
1722
|
-
state: "NSW",
|
|
1723
|
-
country: "Australia",
|
|
1724
|
-
status: "current",
|
|
1725
|
-
monthsAt: 24,
|
|
1726
|
-
yearsAt: 2,
|
|
1727
|
-
},
|
|
1728
|
-
},
|
|
1729
|
-
],
|
|
1730
|
-
},
|
|
1731
|
-
},
|
|
1732
|
-
},
|
|
1733
|
-
],
|
|
500
|
+
result = await financeable.supportingDocuments.create({
|
|
501
|
+
mimeType: "text/plain",
|
|
502
|
+
requestBody: {
|
|
503
|
+
data: {
|
|
504
|
+
type: "supporting-documents",
|
|
505
|
+
attributes: {
|
|
506
|
+
filename: "example.file",
|
|
507
|
+
documentType: "ASIC FILE",
|
|
1734
508
|
},
|
|
1735
|
-
|
|
1736
|
-
|
|
1737
|
-
|
|
1738
|
-
|
|
1739
|
-
|
|
1740
|
-
ageOfAssetAtEnd: 8,
|
|
1741
|
-
condition: "USED",
|
|
1742
|
-
assetType: CommercialAssetType.MotorVehicleLessThan45Tonnes,
|
|
1743
|
-
purpose: "VEHICLE",
|
|
1744
|
-
assetValue: "35000.00",
|
|
1745
|
-
make: "Toyota",
|
|
1746
|
-
assetModel: "Camry",
|
|
1747
|
-
registrationNumber: "ABC123",
|
|
1748
|
-
registrationState: "VIC",
|
|
1749
|
-
vin: "1HGCM82633A123456",
|
|
1750
|
-
supplierName: "Mr and Mrs Smith",
|
|
1751
|
-
supplierABN: "12345678901",
|
|
1752
|
-
supplierAddress: "123 Car Street, Melbourne VIC 3000",
|
|
1753
|
-
supplierPhone: "0412345678",
|
|
1754
|
-
supplierContactName: "John Smith",
|
|
1755
|
-
supplierEmail: "john.smith@mrandmrssmith.com.au",
|
|
1756
|
-
privateSale: false,
|
|
1757
|
-
typeOfSale: "DEALER",
|
|
1758
|
-
description: "2020 Toyota Camry Hybrid SL, Silver, 45,000km",
|
|
1759
|
-
netAssetValue: "32000.00",
|
|
1760
|
-
isLuxury: false,
|
|
1761
|
-
additionalFees: "995.00",
|
|
1762
|
-
additionalTaxes: "0.00",
|
|
509
|
+
relationships: {
|
|
510
|
+
application: {
|
|
511
|
+
data: {
|
|
512
|
+
type: "consumer-secured-applications",
|
|
513
|
+
id: "<id>",
|
|
1763
514
|
},
|
|
1764
515
|
},
|
|
1765
516
|
},
|
|
@@ -1779,11 +530,19 @@ async function run() {
|
|
|
1779
530
|
console.error(err.rawValue);
|
|
1780
531
|
return;
|
|
1781
532
|
}
|
|
1782
|
-
case (err instanceof
|
|
1783
|
-
// Handle err.data$:
|
|
533
|
+
case (err instanceof SupportingDocumentsCreateResponseBody): {
|
|
534
|
+
// Handle err.data$: SupportingDocumentsCreateResponseBodyData
|
|
1784
535
|
console.error(err);
|
|
1785
536
|
return;
|
|
1786
537
|
}
|
|
538
|
+
case (err instanceof One): {
|
|
539
|
+
// Handle err.data$: OneData
|
|
540
|
+
return;
|
|
541
|
+
}
|
|
542
|
+
case (err instanceof Two): {
|
|
543
|
+
// Handle err.data$: TwoData
|
|
544
|
+
return;
|
|
545
|
+
}
|
|
1787
546
|
default: {
|
|
1788
547
|
// Other errors such as network errors, see HTTPClientErrors for more details
|
|
1789
548
|
throw err;
|
|
@@ -1809,7 +568,7 @@ In some rare cases, the SDK can fail to get a response from the server or even m
|
|
|
1809
568
|
| UnexpectedClientError | Unrecognised or unexpected error |
|
|
1810
569
|
<!-- End Error Handling [errors] -->
|
|
1811
570
|
|
|
1812
|
-
<!-- No
|
|
571
|
+
<!-- No Server Selection [server] -->
|
|
1813
572
|
|
|
1814
573
|
<!-- Start Custom HTTP Client [http-client] -->
|
|
1815
574
|
## Custom HTTP Client
|
|
@@ -1879,4 +638,4 @@ const sdk = new Financeable({ debugLogger: console });
|
|
|
1879
638
|
You can also enable a default debug logger by setting an environment variable `FINANCEABLE_DEBUG` to true.
|
|
1880
639
|
<!-- End Debugging [debug] -->
|
|
1881
640
|
|
|
1882
|
-
<!-- Placeholder for Future Speakeasy SDK Sections -->
|
|
641
|
+
<!-- Placeholder for Future Speakeasy SDK Sections -->
|