@financeable/aggregation 0.2.1 → 0.3.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 +9 -121
- package/README.md +74 -483
- package/docs/sdks/applications/README.md +20 -12
- package/docs/sdks/financeable/README.md +84 -0
- package/funcs/applicationsCreate.d.ts +2 -1
- package/funcs/applicationsCreate.d.ts.map +1 -1
- package/funcs/applicationsCreate.js +19 -8
- package/funcs/applicationsCreate.js.map +1 -1
- package/funcs/applicationsGet.d.ts +2 -1
- package/funcs/applicationsGet.d.ts.map +1 -1
- package/funcs/applicationsGet.js +19 -8
- package/funcs/applicationsGet.js.map +1 -1
- package/funcs/applicationsList.d.ts +2 -1
- package/funcs/applicationsList.d.ts.map +1 -1
- package/funcs/applicationsList.js +19 -8
- package/funcs/applicationsList.js.map +1 -1
- package/funcs/getToken.d.ts +13 -0
- package/funcs/getToken.d.ts.map +1 -0
- package/funcs/getToken.js +111 -0
- package/funcs/getToken.js.map +1 -0
- package/jsr.json +1 -1
- package/lib/config.d.ts +5 -4
- package/lib/config.d.ts.map +1 -1
- package/lib/config.js +7 -4
- package/lib/config.js.map +1 -1
- package/lib/env.d.ts +1 -0
- package/lib/env.d.ts.map +1 -1
- package/lib/env.js +1 -0
- package/lib/env.js.map +1 -1
- package/lib/security.d.ts +3 -0
- package/lib/security.d.ts.map +1 -1
- package/lib/security.js +19 -0
- package/lib/security.js.map +1 -1
- package/models/components/customerattributes.d.ts +5 -36
- package/models/components/customerattributes.d.ts.map +1 -1
- package/models/components/customerattributes.js +6 -41
- package/models/components/customerattributes.js.map +1 -1
- package/models/components/customeridtype.d.ts +28 -0
- package/models/components/customeridtype.d.ts.map +1 -0
- package/models/components/customeridtype.js +60 -0
- package/models/components/customeridtype.js.map +1 -0
- package/models/components/index.d.ts +4 -0
- package/models/components/index.d.ts.map +1 -1
- package/models/components/index.js +4 -0
- package/models/components/index.js.map +1 -1
- package/models/components/security.d.ts +29 -0
- package/models/components/security.d.ts.map +1 -0
- package/models/components/security.js +69 -0
- package/models/components/security.js.map +1 -0
- package/models/components/tokenrequest.d.ts +79 -0
- package/models/components/tokenrequest.d.ts.map +1 -0
- package/models/components/tokenrequest.js +110 -0
- package/models/components/tokenrequest.js.map +1 -0
- package/models/components/tokenresponse.d.ts +50 -0
- package/models/components/tokenresponse.d.ts.map +1 -0
- package/models/components/tokenresponse.js +88 -0
- package/models/components/tokenresponse.js.map +1 -0
- package/package.json +1 -1
- package/sdk/sdk.d.ts +6 -1
- package/sdk/sdk.d.ts.map +1 -1
- package/sdk/sdk.js +8 -0
- package/sdk/sdk.js.map +1 -1
- package/src/funcs/applicationsCreate.ts +45 -9
- package/src/funcs/applicationsGet.ts +45 -9
- package/src/funcs/applicationsList.ts +45 -9
- package/src/funcs/getToken.ts +153 -0
- package/src/lib/config.ts +9 -4
- package/src/lib/env.ts +4 -0
- package/src/lib/security.ts +27 -0
- package/src/models/components/customerattributes.ts +13 -53
- package/src/models/components/customeridtype.ts +33 -0
- package/src/models/components/index.ts +4 -0
- package/src/models/components/security.ts +62 -0
- package/src/models/components/tokenrequest.ts +133 -0
- package/src/models/components/tokenresponse.ts +102 -0
- package/src/sdk/sdk.ts +18 -1
- package/src/types/async.ts +68 -0
- package/types/async.d.ts +23 -0
- package/types/async.d.ts.map +1 -0
- package/types/async.js +44 -0
- package/types/async.js.map +1 -0
package/README.md
CHANGED
|
@@ -954,6 +954,7 @@ You can also enable a default debug logger by setting an environment variable `F
|
|
|
954
954
|
* [SDK Installation](#sdk-installation-1)
|
|
955
955
|
* [Requirements](#requirements-1)
|
|
956
956
|
* [SDK Example Usage](#sdk-example-usage-1)
|
|
957
|
+
* [Authentication](#authentication)
|
|
957
958
|
* [Available Resources and Operations](#available-resources-and-operations-1)
|
|
958
959
|
* [Standalone functions](#standalone-functions-1)
|
|
959
960
|
* [Retries](#retries-1)
|
|
@@ -1011,128 +1012,16 @@ For supported JavaScript runtimes, please consult [RUNTIMES.md](RUNTIMES.md).
|
|
|
1011
1012
|
```typescript
|
|
1012
1013
|
import { Financeable } from "@financeable/aggregation";
|
|
1013
1014
|
|
|
1014
|
-
const financeable = new Financeable(
|
|
1015
|
+
const financeable = new Financeable({
|
|
1016
|
+
clientCredentials: process.env["FINANCEABLE_CLIENT_CREDENTIALS"] ?? "",
|
|
1017
|
+
});
|
|
1015
1018
|
|
|
1016
1019
|
async function run() {
|
|
1017
|
-
const result = await financeable.
|
|
1018
|
-
|
|
1019
|
-
|
|
1020
|
-
|
|
1021
|
-
|
|
1022
|
-
applicationType: "consumer",
|
|
1023
|
-
},
|
|
1024
|
-
relationships: {
|
|
1025
|
-
loanDetails: {
|
|
1026
|
-
data: {
|
|
1027
|
-
type: "loan-details",
|
|
1028
|
-
attributes: {
|
|
1029
|
-
repayments: 12,
|
|
1030
|
-
repaymentFrequency: "monthly",
|
|
1031
|
-
repaymentStructure: "group-payments",
|
|
1032
|
-
loanAmount: "10280.95",
|
|
1033
|
-
purpose: "Purchase of a motor vehicle",
|
|
1034
|
-
term: 48,
|
|
1035
|
-
balloon: 5,
|
|
1036
|
-
deposit: "2500",
|
|
1037
|
-
originationFee: 200,
|
|
1038
|
-
rate: "0.15",
|
|
1039
|
-
rateAdjustment: "-0.01",
|
|
1040
|
-
},
|
|
1041
|
-
},
|
|
1042
|
-
},
|
|
1043
|
-
customers: {
|
|
1044
|
-
data: [
|
|
1045
|
-
{
|
|
1046
|
-
type: "customers",
|
|
1047
|
-
attributes: {
|
|
1048
|
-
title: "Mr",
|
|
1049
|
-
firstName: "John",
|
|
1050
|
-
lastName: "Smith",
|
|
1051
|
-
dateOfBirth: "01-01-1990",
|
|
1052
|
-
idExpiryDate: "01-01-2025",
|
|
1053
|
-
idType: "licence",
|
|
1054
|
-
idNumber: "12345678",
|
|
1055
|
-
},
|
|
1056
|
-
relationships: {
|
|
1057
|
-
addresses: {
|
|
1058
|
-
data: [
|
|
1059
|
-
{
|
|
1060
|
-
type: "addresses",
|
|
1061
|
-
attributes: {
|
|
1062
|
-
addressType: "residential",
|
|
1063
|
-
fullAddress: "42 Wallaby Way, Sydney NSW 2000",
|
|
1064
|
-
city: "Sydney",
|
|
1065
|
-
postCode: "2000",
|
|
1066
|
-
streetAddress: "42 Wallaby Way",
|
|
1067
|
-
addressLine2: "",
|
|
1068
|
-
streetNumber: "42",
|
|
1069
|
-
streetType: "Way",
|
|
1070
|
-
street: "Wallaby",
|
|
1071
|
-
state: "NSW",
|
|
1072
|
-
country: "Australia",
|
|
1073
|
-
status: "current",
|
|
1074
|
-
monthsAt: 24,
|
|
1075
|
-
yearsAt: 2,
|
|
1076
|
-
},
|
|
1077
|
-
},
|
|
1078
|
-
{
|
|
1079
|
-
type: "addresses",
|
|
1080
|
-
attributes: {
|
|
1081
|
-
addressType: "residential",
|
|
1082
|
-
fullAddress: "42 Wallaby Way, Sydney NSW 2000",
|
|
1083
|
-
city: "Sydney",
|
|
1084
|
-
postCode: "2000",
|
|
1085
|
-
streetAddress: "42 Wallaby Way",
|
|
1086
|
-
addressLine2: "",
|
|
1087
|
-
streetNumber: "42",
|
|
1088
|
-
streetType: "Way",
|
|
1089
|
-
street: "Wallaby",
|
|
1090
|
-
state: "NSW",
|
|
1091
|
-
country: "Australia",
|
|
1092
|
-
status: "current",
|
|
1093
|
-
monthsAt: 24,
|
|
1094
|
-
yearsAt: 2,
|
|
1095
|
-
},
|
|
1096
|
-
},
|
|
1097
|
-
],
|
|
1098
|
-
},
|
|
1099
|
-
},
|
|
1100
|
-
},
|
|
1101
|
-
],
|
|
1102
|
-
},
|
|
1103
|
-
asset: {
|
|
1104
|
-
data: {
|
|
1105
|
-
type: "asset",
|
|
1106
|
-
attributes: {
|
|
1107
|
-
ageOfAsset: 3,
|
|
1108
|
-
ageOfAssetAtEnd: 8,
|
|
1109
|
-
condition: "USED",
|
|
1110
|
-
assetType: "MOTOR_VEHICLE_(<4.5_TONNES)",
|
|
1111
|
-
purpose: "VEHICLE",
|
|
1112
|
-
assetValue: "35000.00",
|
|
1113
|
-
make: "Toyota",
|
|
1114
|
-
assetModel: "Camry",
|
|
1115
|
-
registrationNumber: "ABC123",
|
|
1116
|
-
registrationState: "VIC",
|
|
1117
|
-
vin: "1HGCM82633A123456",
|
|
1118
|
-
supplierName: "Mr and Mrs Smith",
|
|
1119
|
-
supplierABN: "12345678901",
|
|
1120
|
-
supplierAddress: "123 Car Street, Melbourne VIC 3000",
|
|
1121
|
-
supplierPhone: "0412345678",
|
|
1122
|
-
supplierContactName: "John Smith",
|
|
1123
|
-
supplierEmail: "john.smith@mrandmrssmith.com.au",
|
|
1124
|
-
privateSale: false,
|
|
1125
|
-
typeOfSale: "DEALER",
|
|
1126
|
-
description: "2020 Toyota Camry Hybrid SL, Silver, 45,000km",
|
|
1127
|
-
netAssetValue: "32000.00",
|
|
1128
|
-
isLuxury: false,
|
|
1129
|
-
additionalFees: "995.00",
|
|
1130
|
-
additionalTaxes: "0.00",
|
|
1131
|
-
},
|
|
1132
|
-
},
|
|
1133
|
-
},
|
|
1134
|
-
},
|
|
1135
|
-
},
|
|
1020
|
+
const result = await financeable.getToken({
|
|
1021
|
+
grantType: "client_credentials",
|
|
1022
|
+
clientId: "<id>",
|
|
1023
|
+
clientSecret: "<value>",
|
|
1024
|
+
scope: "<value>",
|
|
1136
1025
|
});
|
|
1137
1026
|
|
|
1138
1027
|
// Handle the result
|
|
@@ -1144,6 +1033,42 @@ run();
|
|
|
1144
1033
|
```
|
|
1145
1034
|
<!-- End SDK Example Usage [usage] -->
|
|
1146
1035
|
|
|
1036
|
+
<!-- Start Authentication [security] -->
|
|
1037
|
+
## Authentication
|
|
1038
|
+
|
|
1039
|
+
### Per-Client Security Schemes
|
|
1040
|
+
|
|
1041
|
+
This SDK supports the following security scheme globally:
|
|
1042
|
+
|
|
1043
|
+
| Name | Type | Scheme | Environment Variable |
|
|
1044
|
+
| ------------------- | ------ | ------------ | -------------------------------- |
|
|
1045
|
+
| `clientCredentials` | oauth2 | OAuth2 token | `FINANCEABLE_CLIENT_CREDENTIALS` |
|
|
1046
|
+
|
|
1047
|
+
To authenticate with the API the `clientCredentials` parameter must be set when initializing the SDK client instance. For example:
|
|
1048
|
+
```typescript
|
|
1049
|
+
import { Financeable } from "@financeable/aggregation";
|
|
1050
|
+
|
|
1051
|
+
const financeable = new Financeable({
|
|
1052
|
+
clientCredentials: process.env["FINANCEABLE_CLIENT_CREDENTIALS"] ?? "",
|
|
1053
|
+
});
|
|
1054
|
+
|
|
1055
|
+
async function run() {
|
|
1056
|
+
const result = await financeable.getToken({
|
|
1057
|
+
grantType: "client_credentials",
|
|
1058
|
+
clientId: "<id>",
|
|
1059
|
+
clientSecret: "<value>",
|
|
1060
|
+
scope: "<value>",
|
|
1061
|
+
});
|
|
1062
|
+
|
|
1063
|
+
// Handle the result
|
|
1064
|
+
console.log(result);
|
|
1065
|
+
}
|
|
1066
|
+
|
|
1067
|
+
run();
|
|
1068
|
+
|
|
1069
|
+
```
|
|
1070
|
+
<!-- End Authentication [security] -->
|
|
1071
|
+
|
|
1147
1072
|
<!-- Start Available Resources and Operations [operations] -->
|
|
1148
1073
|
## Available Resources and Operations
|
|
1149
1074
|
|
|
@@ -1156,6 +1081,9 @@ run();
|
|
|
1156
1081
|
* [list](docs/sdks/applications/README.md#list) - Retrieve a list of applications
|
|
1157
1082
|
* [get](docs/sdks/applications/README.md#get) - Retrieve an application by its ID
|
|
1158
1083
|
|
|
1084
|
+
### [Financeable SDK](docs/sdks/financeable/README.md)
|
|
1085
|
+
|
|
1086
|
+
* [getToken](docs/sdks/financeable/README.md#gettoken) - Obtain an OAuth client_credentials token
|
|
1159
1087
|
|
|
1160
1088
|
</details>
|
|
1161
1089
|
<!-- End Available Resources and Operations [operations] -->
|
|
@@ -1178,6 +1106,7 @@ To read more about standalone functions, check [FUNCTIONS.md](./FUNCTIONS.md).
|
|
|
1178
1106
|
- [`applicationsCreate`](docs/sdks/applications/README.md#create) - Create an application in the Financeable platform.
|
|
1179
1107
|
- [`applicationsGet`](docs/sdks/applications/README.md#get) - Retrieve an application by its ID
|
|
1180
1108
|
- [`applicationsList`](docs/sdks/applications/README.md#list) - Retrieve a list of applications
|
|
1109
|
+
- [`getToken`](docs/sdks/financeable/README.md#gettoken) - Obtain an OAuth client_credentials token
|
|
1181
1110
|
|
|
1182
1111
|
</details>
|
|
1183
1112
|
<!-- End Standalone functions [standalone-funcs] -->
|
|
@@ -1191,128 +1120,16 @@ To change the default retry strategy for a single API call, simply provide a ret
|
|
|
1191
1120
|
```typescript
|
|
1192
1121
|
import { Financeable } from "@financeable/aggregation";
|
|
1193
1122
|
|
|
1194
|
-
const financeable = new Financeable(
|
|
1123
|
+
const financeable = new Financeable({
|
|
1124
|
+
clientCredentials: process.env["FINANCEABLE_CLIENT_CREDENTIALS"] ?? "",
|
|
1125
|
+
});
|
|
1195
1126
|
|
|
1196
1127
|
async function run() {
|
|
1197
|
-
const result = await financeable.
|
|
1198
|
-
|
|
1199
|
-
|
|
1200
|
-
|
|
1201
|
-
|
|
1202
|
-
applicationType: "consumer",
|
|
1203
|
-
},
|
|
1204
|
-
relationships: {
|
|
1205
|
-
loanDetails: {
|
|
1206
|
-
data: {
|
|
1207
|
-
type: "loan-details",
|
|
1208
|
-
attributes: {
|
|
1209
|
-
repayments: 12,
|
|
1210
|
-
repaymentFrequency: "monthly",
|
|
1211
|
-
repaymentStructure: "group-payments",
|
|
1212
|
-
loanAmount: "10280.95",
|
|
1213
|
-
purpose: "Purchase of a motor vehicle",
|
|
1214
|
-
term: 48,
|
|
1215
|
-
balloon: 5,
|
|
1216
|
-
deposit: "2500",
|
|
1217
|
-
originationFee: 200,
|
|
1218
|
-
rate: "0.15",
|
|
1219
|
-
rateAdjustment: "-0.01",
|
|
1220
|
-
},
|
|
1221
|
-
},
|
|
1222
|
-
},
|
|
1223
|
-
customers: {
|
|
1224
|
-
data: [
|
|
1225
|
-
{
|
|
1226
|
-
type: "customers",
|
|
1227
|
-
attributes: {
|
|
1228
|
-
title: "Mr",
|
|
1229
|
-
firstName: "John",
|
|
1230
|
-
lastName: "Smith",
|
|
1231
|
-
dateOfBirth: "01-01-1990",
|
|
1232
|
-
idExpiryDate: "01-01-2025",
|
|
1233
|
-
idType: "licence",
|
|
1234
|
-
idNumber: "12345678",
|
|
1235
|
-
},
|
|
1236
|
-
relationships: {
|
|
1237
|
-
addresses: {
|
|
1238
|
-
data: [
|
|
1239
|
-
{
|
|
1240
|
-
type: "addresses",
|
|
1241
|
-
attributes: {
|
|
1242
|
-
addressType: "residential",
|
|
1243
|
-
fullAddress: "42 Wallaby Way, Sydney NSW 2000",
|
|
1244
|
-
city: "Sydney",
|
|
1245
|
-
postCode: "2000",
|
|
1246
|
-
streetAddress: "42 Wallaby Way",
|
|
1247
|
-
addressLine2: "",
|
|
1248
|
-
streetNumber: "42",
|
|
1249
|
-
streetType: "Way",
|
|
1250
|
-
street: "Wallaby",
|
|
1251
|
-
state: "NSW",
|
|
1252
|
-
country: "Australia",
|
|
1253
|
-
status: "current",
|
|
1254
|
-
monthsAt: 24,
|
|
1255
|
-
yearsAt: 2,
|
|
1256
|
-
},
|
|
1257
|
-
},
|
|
1258
|
-
{
|
|
1259
|
-
type: "addresses",
|
|
1260
|
-
attributes: {
|
|
1261
|
-
addressType: "residential",
|
|
1262
|
-
fullAddress: "42 Wallaby Way, Sydney NSW 2000",
|
|
1263
|
-
city: "Sydney",
|
|
1264
|
-
postCode: "2000",
|
|
1265
|
-
streetAddress: "42 Wallaby Way",
|
|
1266
|
-
addressLine2: "",
|
|
1267
|
-
streetNumber: "42",
|
|
1268
|
-
streetType: "Way",
|
|
1269
|
-
street: "Wallaby",
|
|
1270
|
-
state: "NSW",
|
|
1271
|
-
country: "Australia",
|
|
1272
|
-
status: "current",
|
|
1273
|
-
monthsAt: 24,
|
|
1274
|
-
yearsAt: 2,
|
|
1275
|
-
},
|
|
1276
|
-
},
|
|
1277
|
-
],
|
|
1278
|
-
},
|
|
1279
|
-
},
|
|
1280
|
-
},
|
|
1281
|
-
],
|
|
1282
|
-
},
|
|
1283
|
-
asset: {
|
|
1284
|
-
data: {
|
|
1285
|
-
type: "asset",
|
|
1286
|
-
attributes: {
|
|
1287
|
-
ageOfAsset: 3,
|
|
1288
|
-
ageOfAssetAtEnd: 8,
|
|
1289
|
-
condition: "USED",
|
|
1290
|
-
assetType: "MOTOR_VEHICLE_(<4.5_TONNES)",
|
|
1291
|
-
purpose: "VEHICLE",
|
|
1292
|
-
assetValue: "35000.00",
|
|
1293
|
-
make: "Toyota",
|
|
1294
|
-
assetModel: "Camry",
|
|
1295
|
-
registrationNumber: "ABC123",
|
|
1296
|
-
registrationState: "VIC",
|
|
1297
|
-
vin: "1HGCM82633A123456",
|
|
1298
|
-
supplierName: "Mr and Mrs Smith",
|
|
1299
|
-
supplierABN: "12345678901",
|
|
1300
|
-
supplierAddress: "123 Car Street, Melbourne VIC 3000",
|
|
1301
|
-
supplierPhone: "0412345678",
|
|
1302
|
-
supplierContactName: "John Smith",
|
|
1303
|
-
supplierEmail: "john.smith@mrandmrssmith.com.au",
|
|
1304
|
-
privateSale: false,
|
|
1305
|
-
typeOfSale: "DEALER",
|
|
1306
|
-
description: "2020 Toyota Camry Hybrid SL, Silver, 45,000km",
|
|
1307
|
-
netAssetValue: "32000.00",
|
|
1308
|
-
isLuxury: false,
|
|
1309
|
-
additionalFees: "995.00",
|
|
1310
|
-
additionalTaxes: "0.00",
|
|
1311
|
-
},
|
|
1312
|
-
},
|
|
1313
|
-
},
|
|
1314
|
-
},
|
|
1315
|
-
},
|
|
1128
|
+
const result = await financeable.getToken({
|
|
1129
|
+
grantType: "client_credentials",
|
|
1130
|
+
clientId: "<id>",
|
|
1131
|
+
clientSecret: "<value>",
|
|
1132
|
+
scope: "<value>",
|
|
1316
1133
|
}, {
|
|
1317
1134
|
retries: {
|
|
1318
1135
|
strategy: "backoff",
|
|
@@ -1349,128 +1166,15 @@ const financeable = new Financeable({
|
|
|
1349
1166
|
},
|
|
1350
1167
|
retryConnectionErrors: false,
|
|
1351
1168
|
},
|
|
1169
|
+
clientCredentials: process.env["FINANCEABLE_CLIENT_CREDENTIALS"] ?? "",
|
|
1352
1170
|
});
|
|
1353
1171
|
|
|
1354
1172
|
async function run() {
|
|
1355
|
-
const result = await financeable.
|
|
1356
|
-
|
|
1357
|
-
|
|
1358
|
-
|
|
1359
|
-
|
|
1360
|
-
applicationType: "consumer",
|
|
1361
|
-
},
|
|
1362
|
-
relationships: {
|
|
1363
|
-
loanDetails: {
|
|
1364
|
-
data: {
|
|
1365
|
-
type: "loan-details",
|
|
1366
|
-
attributes: {
|
|
1367
|
-
repayments: 12,
|
|
1368
|
-
repaymentFrequency: "monthly",
|
|
1369
|
-
repaymentStructure: "group-payments",
|
|
1370
|
-
loanAmount: "10280.95",
|
|
1371
|
-
purpose: "Purchase of a motor vehicle",
|
|
1372
|
-
term: 48,
|
|
1373
|
-
balloon: 5,
|
|
1374
|
-
deposit: "2500",
|
|
1375
|
-
originationFee: 200,
|
|
1376
|
-
rate: "0.15",
|
|
1377
|
-
rateAdjustment: "-0.01",
|
|
1378
|
-
},
|
|
1379
|
-
},
|
|
1380
|
-
},
|
|
1381
|
-
customers: {
|
|
1382
|
-
data: [
|
|
1383
|
-
{
|
|
1384
|
-
type: "customers",
|
|
1385
|
-
attributes: {
|
|
1386
|
-
title: "Mr",
|
|
1387
|
-
firstName: "John",
|
|
1388
|
-
lastName: "Smith",
|
|
1389
|
-
dateOfBirth: "01-01-1990",
|
|
1390
|
-
idExpiryDate: "01-01-2025",
|
|
1391
|
-
idType: "licence",
|
|
1392
|
-
idNumber: "12345678",
|
|
1393
|
-
},
|
|
1394
|
-
relationships: {
|
|
1395
|
-
addresses: {
|
|
1396
|
-
data: [
|
|
1397
|
-
{
|
|
1398
|
-
type: "addresses",
|
|
1399
|
-
attributes: {
|
|
1400
|
-
addressType: "residential",
|
|
1401
|
-
fullAddress: "42 Wallaby Way, Sydney NSW 2000",
|
|
1402
|
-
city: "Sydney",
|
|
1403
|
-
postCode: "2000",
|
|
1404
|
-
streetAddress: "42 Wallaby Way",
|
|
1405
|
-
addressLine2: "",
|
|
1406
|
-
streetNumber: "42",
|
|
1407
|
-
streetType: "Way",
|
|
1408
|
-
street: "Wallaby",
|
|
1409
|
-
state: "NSW",
|
|
1410
|
-
country: "Australia",
|
|
1411
|
-
status: "current",
|
|
1412
|
-
monthsAt: 24,
|
|
1413
|
-
yearsAt: 2,
|
|
1414
|
-
},
|
|
1415
|
-
},
|
|
1416
|
-
{
|
|
1417
|
-
type: "addresses",
|
|
1418
|
-
attributes: {
|
|
1419
|
-
addressType: "residential",
|
|
1420
|
-
fullAddress: "42 Wallaby Way, Sydney NSW 2000",
|
|
1421
|
-
city: "Sydney",
|
|
1422
|
-
postCode: "2000",
|
|
1423
|
-
streetAddress: "42 Wallaby Way",
|
|
1424
|
-
addressLine2: "",
|
|
1425
|
-
streetNumber: "42",
|
|
1426
|
-
streetType: "Way",
|
|
1427
|
-
street: "Wallaby",
|
|
1428
|
-
state: "NSW",
|
|
1429
|
-
country: "Australia",
|
|
1430
|
-
status: "current",
|
|
1431
|
-
monthsAt: 24,
|
|
1432
|
-
yearsAt: 2,
|
|
1433
|
-
},
|
|
1434
|
-
},
|
|
1435
|
-
],
|
|
1436
|
-
},
|
|
1437
|
-
},
|
|
1438
|
-
},
|
|
1439
|
-
],
|
|
1440
|
-
},
|
|
1441
|
-
asset: {
|
|
1442
|
-
data: {
|
|
1443
|
-
type: "asset",
|
|
1444
|
-
attributes: {
|
|
1445
|
-
ageOfAsset: 3,
|
|
1446
|
-
ageOfAssetAtEnd: 8,
|
|
1447
|
-
condition: "USED",
|
|
1448
|
-
assetType: "MOTOR_VEHICLE_(<4.5_TONNES)",
|
|
1449
|
-
purpose: "VEHICLE",
|
|
1450
|
-
assetValue: "35000.00",
|
|
1451
|
-
make: "Toyota",
|
|
1452
|
-
assetModel: "Camry",
|
|
1453
|
-
registrationNumber: "ABC123",
|
|
1454
|
-
registrationState: "VIC",
|
|
1455
|
-
vin: "1HGCM82633A123456",
|
|
1456
|
-
supplierName: "Mr and Mrs Smith",
|
|
1457
|
-
supplierABN: "12345678901",
|
|
1458
|
-
supplierAddress: "123 Car Street, Melbourne VIC 3000",
|
|
1459
|
-
supplierPhone: "0412345678",
|
|
1460
|
-
supplierContactName: "John Smith",
|
|
1461
|
-
supplierEmail: "john.smith@mrandmrssmith.com.au",
|
|
1462
|
-
privateSale: false,
|
|
1463
|
-
typeOfSale: "DEALER",
|
|
1464
|
-
description: "2020 Toyota Camry Hybrid SL, Silver, 45,000km",
|
|
1465
|
-
netAssetValue: "32000.00",
|
|
1466
|
-
isLuxury: false,
|
|
1467
|
-
additionalFees: "995.00",
|
|
1468
|
-
additionalTaxes: "0.00",
|
|
1469
|
-
},
|
|
1470
|
-
},
|
|
1471
|
-
},
|
|
1472
|
-
},
|
|
1473
|
-
},
|
|
1173
|
+
const result = await financeable.getToken({
|
|
1174
|
+
grantType: "client_credentials",
|
|
1175
|
+
clientId: "<id>",
|
|
1176
|
+
clientSecret: "<value>",
|
|
1177
|
+
scope: "<value>",
|
|
1474
1178
|
});
|
|
1475
1179
|
|
|
1476
1180
|
// Handle the result
|
|
@@ -1501,7 +1205,9 @@ import {
|
|
|
1501
1205
|
SDKValidationError,
|
|
1502
1206
|
} from "@financeable/aggregation/models/errors";
|
|
1503
1207
|
|
|
1504
|
-
const financeable = new Financeable(
|
|
1208
|
+
const financeable = new Financeable({
|
|
1209
|
+
clientCredentials: process.env["FINANCEABLE_CLIENT_CREDENTIALS"] ?? "",
|
|
1210
|
+
});
|
|
1505
1211
|
|
|
1506
1212
|
async function run() {
|
|
1507
1213
|
let result;
|
|
@@ -1541,9 +1247,7 @@ async function run() {
|
|
|
1541
1247
|
firstName: "John",
|
|
1542
1248
|
lastName: "Smith",
|
|
1543
1249
|
dateOfBirth: "01-01-1990",
|
|
1544
|
-
idExpiryDate: "
|
|
1545
|
-
idType: "licence",
|
|
1546
|
-
idNumber: "12345678",
|
|
1250
|
+
idExpiryDate: "<value>",
|
|
1547
1251
|
},
|
|
1548
1252
|
relationships: {
|
|
1549
1253
|
addresses: {
|
|
@@ -1674,134 +1378,21 @@ In some rare cases, the SDK can fail to get a response from the server or even m
|
|
|
1674
1378
|
|
|
1675
1379
|
### Override Server URL Per-Client
|
|
1676
1380
|
|
|
1677
|
-
The default server can
|
|
1381
|
+
The default server can be overridden globally by passing a URL to the `serverURL: string` optional parameter when initializing the SDK client instance. For example:
|
|
1678
1382
|
```typescript
|
|
1679
1383
|
import { Financeable } from "@financeable/aggregation";
|
|
1680
1384
|
|
|
1681
1385
|
const financeable = new Financeable({
|
|
1682
1386
|
serverURL: "https://api.financeable.com.au",
|
|
1387
|
+
clientCredentials: process.env["FINANCEABLE_CLIENT_CREDENTIALS"] ?? "",
|
|
1683
1388
|
});
|
|
1684
1389
|
|
|
1685
1390
|
async function run() {
|
|
1686
|
-
const result = await financeable.
|
|
1687
|
-
|
|
1688
|
-
|
|
1689
|
-
|
|
1690
|
-
|
|
1691
|
-
applicationType: "consumer",
|
|
1692
|
-
},
|
|
1693
|
-
relationships: {
|
|
1694
|
-
loanDetails: {
|
|
1695
|
-
data: {
|
|
1696
|
-
type: "loan-details",
|
|
1697
|
-
attributes: {
|
|
1698
|
-
repayments: 12,
|
|
1699
|
-
repaymentFrequency: "monthly",
|
|
1700
|
-
repaymentStructure: "group-payments",
|
|
1701
|
-
loanAmount: "10280.95",
|
|
1702
|
-
purpose: "Purchase of a motor vehicle",
|
|
1703
|
-
term: 48,
|
|
1704
|
-
balloon: 5,
|
|
1705
|
-
deposit: "2500",
|
|
1706
|
-
originationFee: 200,
|
|
1707
|
-
rate: "0.15",
|
|
1708
|
-
rateAdjustment: "-0.01",
|
|
1709
|
-
},
|
|
1710
|
-
},
|
|
1711
|
-
},
|
|
1712
|
-
customers: {
|
|
1713
|
-
data: [
|
|
1714
|
-
{
|
|
1715
|
-
type: "customers",
|
|
1716
|
-
attributes: {
|
|
1717
|
-
title: "Mr",
|
|
1718
|
-
firstName: "John",
|
|
1719
|
-
lastName: "Smith",
|
|
1720
|
-
dateOfBirth: "01-01-1990",
|
|
1721
|
-
idExpiryDate: "01-01-2025",
|
|
1722
|
-
idType: "licence",
|
|
1723
|
-
idNumber: "12345678",
|
|
1724
|
-
},
|
|
1725
|
-
relationships: {
|
|
1726
|
-
addresses: {
|
|
1727
|
-
data: [
|
|
1728
|
-
{
|
|
1729
|
-
type: "addresses",
|
|
1730
|
-
attributes: {
|
|
1731
|
-
addressType: "residential",
|
|
1732
|
-
fullAddress: "42 Wallaby Way, Sydney NSW 2000",
|
|
1733
|
-
city: "Sydney",
|
|
1734
|
-
postCode: "2000",
|
|
1735
|
-
streetAddress: "42 Wallaby Way",
|
|
1736
|
-
addressLine2: "",
|
|
1737
|
-
streetNumber: "42",
|
|
1738
|
-
streetType: "Way",
|
|
1739
|
-
street: "Wallaby",
|
|
1740
|
-
state: "NSW",
|
|
1741
|
-
country: "Australia",
|
|
1742
|
-
status: "current",
|
|
1743
|
-
monthsAt: 24,
|
|
1744
|
-
yearsAt: 2,
|
|
1745
|
-
},
|
|
1746
|
-
},
|
|
1747
|
-
{
|
|
1748
|
-
type: "addresses",
|
|
1749
|
-
attributes: {
|
|
1750
|
-
addressType: "residential",
|
|
1751
|
-
fullAddress: "42 Wallaby Way, Sydney NSW 2000",
|
|
1752
|
-
city: "Sydney",
|
|
1753
|
-
postCode: "2000",
|
|
1754
|
-
streetAddress: "42 Wallaby Way",
|
|
1755
|
-
addressLine2: "",
|
|
1756
|
-
streetNumber: "42",
|
|
1757
|
-
streetType: "Way",
|
|
1758
|
-
street: "Wallaby",
|
|
1759
|
-
state: "NSW",
|
|
1760
|
-
country: "Australia",
|
|
1761
|
-
status: "current",
|
|
1762
|
-
monthsAt: 24,
|
|
1763
|
-
yearsAt: 2,
|
|
1764
|
-
},
|
|
1765
|
-
},
|
|
1766
|
-
],
|
|
1767
|
-
},
|
|
1768
|
-
},
|
|
1769
|
-
},
|
|
1770
|
-
],
|
|
1771
|
-
},
|
|
1772
|
-
asset: {
|
|
1773
|
-
data: {
|
|
1774
|
-
type: "asset",
|
|
1775
|
-
attributes: {
|
|
1776
|
-
ageOfAsset: 3,
|
|
1777
|
-
ageOfAssetAtEnd: 8,
|
|
1778
|
-
condition: "USED",
|
|
1779
|
-
assetType: "MOTOR_VEHICLE_(<4.5_TONNES)",
|
|
1780
|
-
purpose: "VEHICLE",
|
|
1781
|
-
assetValue: "35000.00",
|
|
1782
|
-
make: "Toyota",
|
|
1783
|
-
assetModel: "Camry",
|
|
1784
|
-
registrationNumber: "ABC123",
|
|
1785
|
-
registrationState: "VIC",
|
|
1786
|
-
vin: "1HGCM82633A123456",
|
|
1787
|
-
supplierName: "Mr and Mrs Smith",
|
|
1788
|
-
supplierABN: "12345678901",
|
|
1789
|
-
supplierAddress: "123 Car Street, Melbourne VIC 3000",
|
|
1790
|
-
supplierPhone: "0412345678",
|
|
1791
|
-
supplierContactName: "John Smith",
|
|
1792
|
-
supplierEmail: "john.smith@mrandmrssmith.com.au",
|
|
1793
|
-
privateSale: false,
|
|
1794
|
-
typeOfSale: "DEALER",
|
|
1795
|
-
description: "2020 Toyota Camry Hybrid SL, Silver, 45,000km",
|
|
1796
|
-
netAssetValue: "32000.00",
|
|
1797
|
-
isLuxury: false,
|
|
1798
|
-
additionalFees: "995.00",
|
|
1799
|
-
additionalTaxes: "0.00",
|
|
1800
|
-
},
|
|
1801
|
-
},
|
|
1802
|
-
},
|
|
1803
|
-
},
|
|
1804
|
-
},
|
|
1391
|
+
const result = await financeable.getToken({
|
|
1392
|
+
grantType: "client_credentials",
|
|
1393
|
+
clientId: "<id>",
|
|
1394
|
+
clientSecret: "<value>",
|
|
1395
|
+
scope: "<value>",
|
|
1805
1396
|
});
|
|
1806
1397
|
|
|
1807
1398
|
// Handle the result
|