@financeable/aggregation 0.2.5 → 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.
Files changed (71) hide show
  1. package/FUNCTIONS.md +9 -119
  2. package/README.md +73 -472
  3. package/docs/sdks/applications/README.md +18 -6
  4. package/docs/sdks/financeable/README.md +84 -0
  5. package/funcs/applicationsCreate.d.ts +2 -1
  6. package/funcs/applicationsCreate.d.ts.map +1 -1
  7. package/funcs/applicationsCreate.js +19 -8
  8. package/funcs/applicationsCreate.js.map +1 -1
  9. package/funcs/applicationsGet.d.ts +2 -1
  10. package/funcs/applicationsGet.d.ts.map +1 -1
  11. package/funcs/applicationsGet.js +19 -8
  12. package/funcs/applicationsGet.js.map +1 -1
  13. package/funcs/applicationsList.d.ts +2 -1
  14. package/funcs/applicationsList.d.ts.map +1 -1
  15. package/funcs/applicationsList.js +19 -8
  16. package/funcs/applicationsList.js.map +1 -1
  17. package/funcs/getToken.d.ts +13 -0
  18. package/funcs/getToken.d.ts.map +1 -0
  19. package/funcs/getToken.js +111 -0
  20. package/funcs/getToken.js.map +1 -0
  21. package/jsr.json +1 -1
  22. package/lib/config.d.ts +5 -4
  23. package/lib/config.d.ts.map +1 -1
  24. package/lib/config.js +7 -4
  25. package/lib/config.js.map +1 -1
  26. package/lib/env.d.ts +1 -0
  27. package/lib/env.d.ts.map +1 -1
  28. package/lib/env.js +1 -0
  29. package/lib/env.js.map +1 -1
  30. package/lib/security.d.ts +3 -0
  31. package/lib/security.d.ts.map +1 -1
  32. package/lib/security.js +19 -0
  33. package/lib/security.js.map +1 -1
  34. package/models/components/index.d.ts +3 -0
  35. package/models/components/index.d.ts.map +1 -1
  36. package/models/components/index.js +3 -0
  37. package/models/components/index.js.map +1 -1
  38. package/models/components/security.d.ts +29 -0
  39. package/models/components/security.d.ts.map +1 -0
  40. package/models/components/security.js +69 -0
  41. package/models/components/security.js.map +1 -0
  42. package/models/components/tokenrequest.d.ts +79 -0
  43. package/models/components/tokenrequest.d.ts.map +1 -0
  44. package/models/components/tokenrequest.js +110 -0
  45. package/models/components/tokenrequest.js.map +1 -0
  46. package/models/components/tokenresponse.d.ts +50 -0
  47. package/models/components/tokenresponse.d.ts.map +1 -0
  48. package/models/components/tokenresponse.js +88 -0
  49. package/models/components/tokenresponse.js.map +1 -0
  50. package/package.json +1 -1
  51. package/sdk/sdk.d.ts +6 -1
  52. package/sdk/sdk.d.ts.map +1 -1
  53. package/sdk/sdk.js +8 -0
  54. package/sdk/sdk.js.map +1 -1
  55. package/src/funcs/applicationsCreate.ts +45 -9
  56. package/src/funcs/applicationsGet.ts +45 -9
  57. package/src/funcs/applicationsList.ts +45 -9
  58. package/src/funcs/getToken.ts +153 -0
  59. package/src/lib/config.ts +9 -4
  60. package/src/lib/env.ts +4 -0
  61. package/src/lib/security.ts +27 -0
  62. package/src/models/components/index.ts +3 -0
  63. package/src/models/components/security.ts +62 -0
  64. package/src/models/components/tokenrequest.ts +133 -0
  65. package/src/models/components/tokenresponse.ts +102 -0
  66. package/src/sdk/sdk.ts +18 -1
  67. package/src/types/async.ts +68 -0
  68. package/types/async.d.ts +23 -0
  69. package/types/async.d.ts.map +1 -0
  70. package/types/async.js +44 -0
  71. package/types/async.js.map +1 -0
package/FUNCTIONS.md CHANGED
@@ -20,131 +20,21 @@ specific category of applications.
20
20
 
21
21
  ```typescript
22
22
  import { FinanceableCore } from "@financeable/aggregation/core.js";
23
- import { applicationsCreate } from "@financeable/aggregation/funcs/applicationsCreate.js";
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 applicationsCreate(financeable, {
32
- data: {
33
- type: "applications",
34
- attributes: {
35
- purpose: "Purchase of a motor vehicle",
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: "<value>",
67
- },
68
- relationships: {
69
- addresses: {
70
- data: [
71
- {
72
- type: "addresses",
73
- attributes: {
74
- addressType: "residential",
75
- fullAddress: "42 Wallaby Way, Sydney NSW 2000",
76
- city: "Sydney",
77
- postCode: "2000",
78
- streetAddress: "42 Wallaby Way",
79
- addressLine2: "",
80
- streetNumber: "42",
81
- streetType: "Way",
82
- street: "Wallaby",
83
- state: "NSW",
84
- country: "Australia",
85
- status: "current",
86
- monthsAt: 24,
87
- yearsAt: 2,
88
- },
89
- },
90
- {
91
- type: "addresses",
92
- attributes: {
93
- addressType: "residential",
94
- fullAddress: "42 Wallaby Way, Sydney NSW 2000",
95
- city: "Sydney",
96
- postCode: "2000",
97
- streetAddress: "42 Wallaby Way",
98
- addressLine2: "",
99
- streetNumber: "42",
100
- streetType: "Way",
101
- street: "Wallaby",
102
- state: "NSW",
103
- country: "Australia",
104
- status: "current",
105
- monthsAt: 24,
106
- yearsAt: 2,
107
- },
108
- },
109
- ],
110
- },
111
- },
112
- },
113
- ],
114
- },
115
- asset: {
116
- data: {
117
- type: "asset",
118
- attributes: {
119
- ageOfAsset: 3,
120
- ageOfAssetAtEnd: 8,
121
- condition: "USED",
122
- assetType: "MOTOR_VEHICLE_(<4.5_TONNES)",
123
- purpose: "VEHICLE",
124
- assetValue: "35000.00",
125
- make: "Toyota",
126
- assetModel: "Camry",
127
- registrationNumber: "ABC123",
128
- registrationState: "VIC",
129
- vin: "1HGCM82633A123456",
130
- supplierName: "Mr and Mrs Smith",
131
- supplierABN: "12345678901",
132
- supplierAddress: "123 Car Street, Melbourne VIC 3000",
133
- supplierPhone: "0412345678",
134
- supplierContactName: "John Smith",
135
- supplierEmail: "john.smith@mrandmrssmith.com.au",
136
- privateSale: false,
137
- typeOfSale: "DEALER",
138
- description: "2020 Toyota Camry Hybrid SL, Silver, 45,000km",
139
- netAssetValue: "32000.00",
140
- isLuxury: false,
141
- additionalFees: "995.00",
142
- additionalTaxes: "0.00",
143
- },
144
- },
145
- },
146
- },
147
- },
33
+ const res = await getToken(financeable, {
34
+ grantType: "client_credentials",
35
+ clientId: "<id>",
36
+ clientSecret: "<value>",
37
+ scope: "<value>",
148
38
  });
149
39
 
150
40
  switch (true) {