@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/FUNCTIONS.md
CHANGED
|
@@ -20,133 +20,21 @@ specific category of applications.
|
|
|
20
20
|
|
|
21
21
|
```typescript
|
|
22
22
|
import { FinanceableCore } from "@financeable/aggregation/core.js";
|
|
23
|
-
import {
|
|
23
|
+
import { getToken } from "@financeable/aggregation/funcs/getToken.js";
|
|
24
24
|
import { SDKValidationError } from "@financeable/aggregation/models/errors/sdkvalidationerror.js";
|
|
25
25
|
|
|
26
26
|
// Use `FinanceableCore` for best tree-shaking performance.
|
|
27
27
|
// You can create one instance of it to use across an application.
|
|
28
|
-
const financeable = new FinanceableCore(
|
|
28
|
+
const financeable = new FinanceableCore({
|
|
29
|
+
clientCredentials: process.env["FINANCEABLE_CLIENT_CREDENTIALS"] ?? "",
|
|
30
|
+
});
|
|
29
31
|
|
|
30
32
|
async function run() {
|
|
31
|
-
const res = await
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
applicationType: "consumer",
|
|
37
|
-
},
|
|
38
|
-
relationships: {
|
|
39
|
-
loanDetails: {
|
|
40
|
-
data: {
|
|
41
|
-
type: "loan-details",
|
|
42
|
-
attributes: {
|
|
43
|
-
repayments: 12,
|
|
44
|
-
repaymentFrequency: "monthly",
|
|
45
|
-
repaymentStructure: "group-payments",
|
|
46
|
-
loanAmount: "10280.95",
|
|
47
|
-
purpose: "Purchase of a motor vehicle",
|
|
48
|
-
term: 48,
|
|
49
|
-
balloon: 5,
|
|
50
|
-
deposit: "2500",
|
|
51
|
-
originationFee: 200,
|
|
52
|
-
rate: "0.15",
|
|
53
|
-
rateAdjustment: "-0.01",
|
|
54
|
-
},
|
|
55
|
-
},
|
|
56
|
-
},
|
|
57
|
-
customers: {
|
|
58
|
-
data: [
|
|
59
|
-
{
|
|
60
|
-
type: "customers",
|
|
61
|
-
attributes: {
|
|
62
|
-
title: "Mr",
|
|
63
|
-
firstName: "John",
|
|
64
|
-
lastName: "Smith",
|
|
65
|
-
dateOfBirth: "01-01-1990",
|
|
66
|
-
idExpiryDate: "01-01-2025",
|
|
67
|
-
idType: "licence",
|
|
68
|
-
idNumber: "12345678",
|
|
69
|
-
},
|
|
70
|
-
relationships: {
|
|
71
|
-
addresses: {
|
|
72
|
-
data: [
|
|
73
|
-
{
|
|
74
|
-
type: "addresses",
|
|
75
|
-
attributes: {
|
|
76
|
-
addressType: "residential",
|
|
77
|
-
fullAddress: "42 Wallaby Way, Sydney NSW 2000",
|
|
78
|
-
city: "Sydney",
|
|
79
|
-
postCode: "2000",
|
|
80
|
-
streetAddress: "42 Wallaby Way",
|
|
81
|
-
addressLine2: "",
|
|
82
|
-
streetNumber: "42",
|
|
83
|
-
streetType: "Way",
|
|
84
|
-
street: "Wallaby",
|
|
85
|
-
state: "NSW",
|
|
86
|
-
country: "Australia",
|
|
87
|
-
status: "current",
|
|
88
|
-
monthsAt: 24,
|
|
89
|
-
yearsAt: 2,
|
|
90
|
-
},
|
|
91
|
-
},
|
|
92
|
-
{
|
|
93
|
-
type: "addresses",
|
|
94
|
-
attributes: {
|
|
95
|
-
addressType: "residential",
|
|
96
|
-
fullAddress: "42 Wallaby Way, Sydney NSW 2000",
|
|
97
|
-
city: "Sydney",
|
|
98
|
-
postCode: "2000",
|
|
99
|
-
streetAddress: "42 Wallaby Way",
|
|
100
|
-
addressLine2: "",
|
|
101
|
-
streetNumber: "42",
|
|
102
|
-
streetType: "Way",
|
|
103
|
-
street: "Wallaby",
|
|
104
|
-
state: "NSW",
|
|
105
|
-
country: "Australia",
|
|
106
|
-
status: "current",
|
|
107
|
-
monthsAt: 24,
|
|
108
|
-
yearsAt: 2,
|
|
109
|
-
},
|
|
110
|
-
},
|
|
111
|
-
],
|
|
112
|
-
},
|
|
113
|
-
},
|
|
114
|
-
},
|
|
115
|
-
],
|
|
116
|
-
},
|
|
117
|
-
asset: {
|
|
118
|
-
data: {
|
|
119
|
-
type: "asset",
|
|
120
|
-
attributes: {
|
|
121
|
-
ageOfAsset: 3,
|
|
122
|
-
ageOfAssetAtEnd: 8,
|
|
123
|
-
condition: "USED",
|
|
124
|
-
assetType: "MOTOR_VEHICLE_(<4.5_TONNES)",
|
|
125
|
-
purpose: "VEHICLE",
|
|
126
|
-
assetValue: "35000.00",
|
|
127
|
-
make: "Toyota",
|
|
128
|
-
assetModel: "Camry",
|
|
129
|
-
registrationNumber: "ABC123",
|
|
130
|
-
registrationState: "VIC",
|
|
131
|
-
vin: "1HGCM82633A123456",
|
|
132
|
-
supplierName: "Mr and Mrs Smith",
|
|
133
|
-
supplierABN: "12345678901",
|
|
134
|
-
supplierAddress: "123 Car Street, Melbourne VIC 3000",
|
|
135
|
-
supplierPhone: "0412345678",
|
|
136
|
-
supplierContactName: "John Smith",
|
|
137
|
-
supplierEmail: "john.smith@mrandmrssmith.com.au",
|
|
138
|
-
privateSale: false,
|
|
139
|
-
typeOfSale: "DEALER",
|
|
140
|
-
description: "2020 Toyota Camry Hybrid SL, Silver, 45,000km",
|
|
141
|
-
netAssetValue: "32000.00",
|
|
142
|
-
isLuxury: false,
|
|
143
|
-
additionalFees: "995.00",
|
|
144
|
-
additionalTaxes: "0.00",
|
|
145
|
-
},
|
|
146
|
-
},
|
|
147
|
-
},
|
|
148
|
-
},
|
|
149
|
-
},
|
|
33
|
+
const res = await getToken(financeable, {
|
|
34
|
+
grantType: "client_credentials",
|
|
35
|
+
clientId: "<id>",
|
|
36
|
+
clientSecret: "<value>",
|
|
37
|
+
scope: "<value>",
|
|
150
38
|
});
|
|
151
39
|
|
|
152
40
|
switch (true) {
|