@mft/moneyhub-api-client 4.19.0 → 4.20.0
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/package.json +1 -1
- package/readme.md +407 -261
- package/src/__tests__/auth-urls.js +22 -0
- package/src/__tests__/index.js +13 -0
- package/src/__tests__/savings-goals.js +68 -0
- package/src/__tests__/spending-goals.js +52 -0
- package/src/get-auth-urls.js +37 -0
- package/src/index.js +2 -0
- package/src/requests/savings-goals.js +49 -0
- package/src/requests/spending-goals.js +49 -0
- package/src/requests/unauthenticated.js +2 -0
- package/src/requests/users-and-connections.js +15 -5
package/readme.md
CHANGED
|
@@ -31,15 +31,15 @@ Currently this library supports `client_secret_basic`, `client_secret_jwt` and `
|
|
|
31
31
|
|
|
32
32
|
The breaking changes when upgrading are outlined below:
|
|
33
33
|
|
|
34
|
-
|
|
34
|
+
- Normalisation of all methods to use object destructuring to pass parameters. Please refer to the docs of each method when migrating to this version
|
|
35
35
|
|
|
36
|
-
|
|
36
|
+
- Delete methods only return the status code when succesful
|
|
37
37
|
|
|
38
|
-
|
|
38
|
+
- All methods to retrieve data return the body response as json, on previous versions some methods were returning the full response from the got library.
|
|
39
39
|
|
|
40
|
-
|
|
40
|
+
- When our API response code is not 2xx an HTTP error is thrown. Includes a response property with more information.
|
|
41
41
|
|
|
42
|
-
|
|
42
|
+
- Removal of all the methods with the suffix `WithToken`. To migrate to this version you can use the method with the same name but without the suffix. e.g `getUserConnectionsWithToken()` => `getUserConnections()`
|
|
43
43
|
|
|
44
44
|
For the full list of changes please refer to the [changelog](CHANGELOG.md)
|
|
45
45
|
|
|
@@ -89,7 +89,9 @@ const moneyhub = await Moneyhub({
|
|
|
89
89
|
Once the api client has been initialised it provides a simple promise based interface with the following methods:
|
|
90
90
|
|
|
91
91
|
### Auth API
|
|
92
|
+
|
|
92
93
|
The options below can be set on the following URL generating methods:
|
|
94
|
+
|
|
93
95
|
- `getAuthorizeUrl`
|
|
94
96
|
- `getAuthorizeUrlForCreatedUser`
|
|
95
97
|
- `getReauthAuthorizeUrlForCreatedUser`
|
|
@@ -98,6 +100,7 @@ The options below can be set on the following URL generating methods:
|
|
|
98
100
|
The `expirationDateTime` and `transactionFromDateTime` options can be set according to the [AIS Consents documentation](https://docs.moneyhubenterprise.com/docs/ais-consents)
|
|
99
101
|
|
|
100
102
|
Set `enableAsync` to true if you wish to make an AIS connection that won't wait for accounts and transactions to be fetched.
|
|
103
|
+
|
|
101
104
|
#### `getAuthorizeUrl`
|
|
102
105
|
|
|
103
106
|
This method returns an authorize url for your API client. You can redirect a user to this url, after which they will be redirected back to your `redirect_uri`.
|
|
@@ -108,7 +111,6 @@ This method returns an authorize url for your API client. You can redirect a use
|
|
|
108
111
|
|
|
109
112
|
[Claims](https://docs.moneyhubenterprise.com/docs/claims)
|
|
110
113
|
|
|
111
|
-
|
|
112
114
|
```javascript
|
|
113
115
|
const url = await moneyhub.getAuthorizeUrl({
|
|
114
116
|
scope: "openid bank-id-scope other-data-scopes",
|
|
@@ -118,8 +120,8 @@ const url = await moneyhub.getAuthorizeUrl({
|
|
|
118
120
|
permissions: ["ReadBeneficiariesDetail"], // optional - set of extra permissions to set for auth URL
|
|
119
121
|
expirationDateTime: "2022-09-01T00:00:00.000Z", // optional
|
|
120
122
|
transactionFromDateTime: "2020-09-01T00:00:00.000Z", // optional,
|
|
121
|
-
enableAsync: false // optional
|
|
122
|
-
})
|
|
123
|
+
enableAsync: false, // optional
|
|
124
|
+
});
|
|
123
125
|
|
|
124
126
|
// Default claims if none are provided
|
|
125
127
|
const defaultClaims = {
|
|
@@ -131,7 +133,7 @@ const defaultClaims = {
|
|
|
131
133
|
essential: true,
|
|
132
134
|
},
|
|
133
135
|
},
|
|
134
|
-
}
|
|
136
|
+
};
|
|
135
137
|
```
|
|
136
138
|
|
|
137
139
|
#### `getAuthorizeUrlForCreatedUser`
|
|
@@ -152,11 +154,11 @@ const url = await moneyhub.getAuthorizeUrlForCreatedUser({
|
|
|
152
154
|
nonce: "your nonce value", // optional
|
|
153
155
|
claims: claimsObject, // optional
|
|
154
156
|
permissions: ["ReadBeneficiariesDetail"], // optional - set of extra permissions to set for auth URL
|
|
155
|
-
enableAsync: false // optional
|
|
156
|
-
})
|
|
157
|
+
enableAsync: false, // optional
|
|
158
|
+
});
|
|
157
159
|
|
|
158
160
|
// Scope used with the bankId provided
|
|
159
|
-
const scope = `id:${bankId} openid
|
|
161
|
+
const scope = `id:${bankId} openid`;
|
|
160
162
|
|
|
161
163
|
// Default claims if none are provided
|
|
162
164
|
const defaultClaims = {
|
|
@@ -169,7 +171,7 @@ const defaultClaims = {
|
|
|
169
171
|
essential: true,
|
|
170
172
|
},
|
|
171
173
|
},
|
|
172
|
-
}
|
|
174
|
+
};
|
|
173
175
|
```
|
|
174
176
|
|
|
175
177
|
#### `getReauthAuthorizeUrlForCreatedUser`
|
|
@@ -183,8 +185,8 @@ const url = await moneyhub.getReauthAuthorizeUrlForCreatedUser({
|
|
|
183
185
|
state: "your state value", // optional
|
|
184
186
|
nonce: "your nonce value", // optional
|
|
185
187
|
claims: claimsObject, // optional
|
|
186
|
-
enableAsync: false // optional
|
|
187
|
-
})
|
|
188
|
+
enableAsync: false, // optional
|
|
189
|
+
});
|
|
188
190
|
|
|
189
191
|
// Default claims if none are provided
|
|
190
192
|
const defaultClaims = {
|
|
@@ -198,7 +200,7 @@ const defaultClaims = {
|
|
|
198
200
|
value: connectionId, // connectionId provided
|
|
199
201
|
},
|
|
200
202
|
},
|
|
201
|
-
}
|
|
203
|
+
};
|
|
202
204
|
```
|
|
203
205
|
|
|
204
206
|
#### `getRefreshAuthorizeUrlForCreatedUser`
|
|
@@ -212,8 +214,8 @@ const url = await moneyhub.getRefreshAuthorizeUrlForCreatedUser({
|
|
|
212
214
|
state: "your state value", // optional
|
|
213
215
|
nonce: "your nonce value", // optional
|
|
214
216
|
claims: claimsObject, // optional
|
|
215
|
-
enableAsync: false // optional
|
|
216
|
-
})
|
|
217
|
+
enableAsync: false, // optional
|
|
218
|
+
});
|
|
217
219
|
|
|
218
220
|
// Default claims if none are provided
|
|
219
221
|
const defaultClaims = {
|
|
@@ -227,7 +229,7 @@ const defaultClaims = {
|
|
|
227
229
|
value: connectionId, // connectionId provided
|
|
228
230
|
},
|
|
229
231
|
},
|
|
230
|
-
}
|
|
232
|
+
};
|
|
231
233
|
```
|
|
232
234
|
|
|
233
235
|
#### `exchangeCodeForTokensLegacy`
|
|
@@ -241,7 +243,7 @@ const tokens = await moneyhub.exchangeCodeForTokens({
|
|
|
241
243
|
nonce: "your nonce value", // optional
|
|
242
244
|
state: "your state value", // optional
|
|
243
245
|
id_token: "your id token", // optional
|
|
244
|
-
})
|
|
246
|
+
});
|
|
245
247
|
```
|
|
246
248
|
|
|
247
249
|
#### `exchangeCodeForTokens`
|
|
@@ -252,8 +254,9 @@ The signature for this method changed in v3.
|
|
|
252
254
|
The previous function is available at 'exchangeCodeForTokensLegacy'
|
|
253
255
|
|
|
254
256
|
This method requires an object with two properties:
|
|
255
|
-
|
|
256
|
-
|
|
257
|
+
|
|
258
|
+
- `paramsFromCallback` : an object with all the params received at your redirect uri
|
|
259
|
+
- `localParams` : an object with params that you have in the local session for the user.
|
|
257
260
|
|
|
258
261
|
```javascript
|
|
259
262
|
const tokens = await moneyhub.exchangeCodeForTokens({
|
|
@@ -281,7 +284,7 @@ Use this to get a client credentials access token.
|
|
|
281
284
|
const tokens = await moneyhub.getClientCredentialTokens({
|
|
282
285
|
scope: "the-required-scope",
|
|
283
286
|
sub: "the user id", // optional
|
|
284
|
-
})
|
|
287
|
+
});
|
|
285
288
|
```
|
|
286
289
|
|
|
287
290
|
#### `refreshTokens`
|
|
@@ -291,7 +294,7 @@ Use this to get a new access token using a refresh token
|
|
|
291
294
|
```javascript
|
|
292
295
|
const tokens = await moneyhub.refreshTokens({
|
|
293
296
|
refreshToken: "refresh-token",
|
|
294
|
-
})
|
|
297
|
+
});
|
|
295
298
|
```
|
|
296
299
|
|
|
297
300
|
### Auth Request URI
|
|
@@ -306,7 +309,7 @@ const tokens = await moneyhub.requestObject({
|
|
|
306
309
|
state: "state",
|
|
307
310
|
nonce: "nonce",
|
|
308
311
|
claims: claimsObject,
|
|
309
|
-
})
|
|
312
|
+
});
|
|
310
313
|
```
|
|
311
314
|
|
|
312
315
|
#### `getRequestUri`
|
|
@@ -314,9 +317,7 @@ const tokens = await moneyhub.requestObject({
|
|
|
314
317
|
Use this to create a request uri from a request object
|
|
315
318
|
|
|
316
319
|
```javascript
|
|
317
|
-
const tokens = await moneyhub.getRequestUri(
|
|
318
|
-
requestObject
|
|
319
|
-
)
|
|
320
|
+
const tokens = await moneyhub.getRequestUri(requestObject);
|
|
320
321
|
```
|
|
321
322
|
|
|
322
323
|
#### `getAuthorizeUrlFromRequestUri`
|
|
@@ -325,8 +326,8 @@ Use this to retrieve an authorization url from a request uri
|
|
|
325
326
|
|
|
326
327
|
```javascript
|
|
327
328
|
const tokens = await moneyhub.getAuthorizeUrlFromRequestUri({
|
|
328
|
-
requestUri: "request-uri"
|
|
329
|
-
})
|
|
329
|
+
requestUri: "request-uri",
|
|
330
|
+
});
|
|
330
331
|
```
|
|
331
332
|
|
|
332
333
|
### Auth Requests
|
|
@@ -339,10 +340,10 @@ Creates a connection auth request
|
|
|
339
340
|
const tokens = await moneyhub.createAuthRequest({
|
|
340
341
|
redirectUri: "redirect-uri",
|
|
341
342
|
userId: "user-id",
|
|
342
|
-
scope:"openid 1ffe704d39629a929c8e293880fb449a", // replace bank id with the bank you want to connect to
|
|
343
|
+
scope: "openid 1ffe704d39629a929c8e293880fb449a", // replace bank id with the bank you want to connect to
|
|
343
344
|
categorisationType: "personal", // optional - defaults to personal
|
|
344
|
-
permissions: ["ReadBeneficiariesDetail"] // optional - set of extra permissions to set for auth request
|
|
345
|
-
})
|
|
345
|
+
permissions: ["ReadBeneficiariesDetail"], // optional - set of extra permissions to set for auth request
|
|
346
|
+
});
|
|
346
347
|
```
|
|
347
348
|
|
|
348
349
|
Creates a reauth auth request
|
|
@@ -352,8 +353,8 @@ const tokens = await moneyhub.createAuthRequest({
|
|
|
352
353
|
redirectUri: "redirect-uri",
|
|
353
354
|
userId: "user-id",
|
|
354
355
|
connectionId: "connection-id",
|
|
355
|
-
scope:"openid reauth",
|
|
356
|
-
})
|
|
356
|
+
scope: "openid reauth",
|
|
357
|
+
});
|
|
357
358
|
```
|
|
358
359
|
|
|
359
360
|
Creates a refresh auth request
|
|
@@ -363,8 +364,8 @@ const tokens = await moneyhub.createAuthRequest({
|
|
|
363
364
|
redirectUri: "redirect-uri",
|
|
364
365
|
userId: "user-id",
|
|
365
366
|
connectionId: "connection-id",
|
|
366
|
-
scope:"openid refresh",
|
|
367
|
-
})
|
|
367
|
+
scope: "openid refresh",
|
|
368
|
+
});
|
|
368
369
|
```
|
|
369
370
|
|
|
370
371
|
Creates a payment auth request
|
|
@@ -374,14 +375,14 @@ const tokens = await moneyhub.createAuthRequest({
|
|
|
374
375
|
redirectUri: "redirect-uri",
|
|
375
376
|
userId: "user-id",
|
|
376
377
|
connectionId: "connection-id",
|
|
377
|
-
scope:"openid payment",
|
|
378
|
+
scope: "openid payment",
|
|
378
379
|
payment: {
|
|
379
380
|
payeeId: "payee-id",
|
|
380
381
|
amount: 200,
|
|
381
382
|
payeeRef: "Payee ref",
|
|
382
|
-
payerRef: "Payer ref"
|
|
383
|
+
payerRef: "Payer ref",
|
|
383
384
|
},
|
|
384
|
-
})
|
|
385
|
+
});
|
|
385
386
|
```
|
|
386
387
|
|
|
387
388
|
Creates a reverse payment auth request
|
|
@@ -391,11 +392,11 @@ const tokens = await moneyhub.createAuthRequest({
|
|
|
391
392
|
redirectUri: "redirect-uri",
|
|
392
393
|
userId: "user-id",
|
|
393
394
|
connectionId: "connection-id",
|
|
394
|
-
scope:"openid reverse_payment",
|
|
395
|
+
scope: "openid reverse_payment",
|
|
395
396
|
reversePayment: {
|
|
396
|
-
paymentId: "payment-id"
|
|
397
|
+
paymentId: "payment-id",
|
|
397
398
|
},
|
|
398
|
-
})
|
|
399
|
+
});
|
|
399
400
|
```
|
|
400
401
|
|
|
401
402
|
#### `completeAuthRequest`
|
|
@@ -420,10 +421,11 @@ const tokens = await moneyhub.completeAuthRequest({
|
|
|
420
421
|
id: "auth-request-id",
|
|
421
422
|
authParams: {
|
|
422
423
|
error: "error-code",
|
|
423
|
-
|
|
424
|
-
}
|
|
425
|
-
})
|
|
424
|
+
error_description: "error description",
|
|
425
|
+
},
|
|
426
|
+
});
|
|
426
427
|
```
|
|
428
|
+
|
|
427
429
|
#### `getAllAuthRequests`
|
|
428
430
|
|
|
429
431
|
Retrieves auth requests
|
|
@@ -431,8 +433,8 @@ Retrieves auth requests
|
|
|
431
433
|
```javascript
|
|
432
434
|
const tokens = await moneyhub.getAllAuthRequests({
|
|
433
435
|
limit: 10, // optional
|
|
434
|
-
offset: 0 // optional
|
|
435
|
-
})
|
|
436
|
+
offset: 0, // optional
|
|
437
|
+
});
|
|
436
438
|
```
|
|
437
439
|
|
|
438
440
|
#### `getAuthRequest`
|
|
@@ -441,8 +443,8 @@ Retrieve a single auth request
|
|
|
441
443
|
|
|
442
444
|
```javascript
|
|
443
445
|
const tokens = await moneyhub.getAuthRequest({
|
|
444
|
-
id: "auth-request-id"
|
|
445
|
-
})
|
|
446
|
+
id: "auth-request-id",
|
|
447
|
+
});
|
|
446
448
|
```
|
|
447
449
|
|
|
448
450
|
### User Management
|
|
@@ -453,8 +455,8 @@ Helper method that gets the correct client credentials access token and then reg
|
|
|
453
455
|
|
|
454
456
|
```javascript
|
|
455
457
|
const user = await moneyhub.registerUser({
|
|
456
|
-
clientUserId: "your user id" // optional
|
|
457
|
-
})
|
|
458
|
+
clientUserId: "your user id", // optional
|
|
459
|
+
});
|
|
458
460
|
```
|
|
459
461
|
|
|
460
462
|
#### `getUsers`
|
|
@@ -465,8 +467,8 @@ Returns all the users registered for your api-client
|
|
|
465
467
|
const users = await moneyhub.getUsers({
|
|
466
468
|
limit,
|
|
467
469
|
offset,
|
|
468
|
-
isDemo
|
|
469
|
-
|
|
470
|
+
isDemo,
|
|
471
|
+
});
|
|
470
472
|
```
|
|
471
473
|
|
|
472
474
|
#### `getUser`
|
|
@@ -475,8 +477,8 @@ Get a single user by their id
|
|
|
475
477
|
|
|
476
478
|
```javascript
|
|
477
479
|
const user = await moneyhub.getUser({
|
|
478
|
-
userId: "user-id"
|
|
479
|
-
|
|
480
|
+
userId: "user-id",
|
|
481
|
+
});
|
|
480
482
|
```
|
|
481
483
|
|
|
482
484
|
#### `deleteUser`
|
|
@@ -485,11 +487,10 @@ Helper method that gets the correct client credentials access token and then del
|
|
|
485
487
|
|
|
486
488
|
```javascript
|
|
487
489
|
const user = await moneyhub.deleteUser({
|
|
488
|
-
userId: "user-id"
|
|
489
|
-
|
|
490
|
+
userId: "user-id",
|
|
491
|
+
});
|
|
490
492
|
```
|
|
491
493
|
|
|
492
|
-
|
|
493
494
|
### User Connections
|
|
494
495
|
|
|
495
496
|
#### `getUserConnections`
|
|
@@ -498,8 +499,8 @@ Helper method that gets the correct client credentials access token and then get
|
|
|
498
499
|
|
|
499
500
|
```javascript
|
|
500
501
|
const user = await moneyhub.getUserConnections({
|
|
501
|
-
userId: "user-id"
|
|
502
|
-
|
|
502
|
+
userId: "user-id",
|
|
503
|
+
});
|
|
503
504
|
```
|
|
504
505
|
|
|
505
506
|
#### `syncUserConnection`
|
|
@@ -512,7 +513,7 @@ const tokens = await moneyhub.syncUserConnection({
|
|
|
512
513
|
connectionId,
|
|
513
514
|
customerIpAddress, // optional
|
|
514
515
|
customerLastLoggedTime, // optional
|
|
515
|
-
})
|
|
516
|
+
});
|
|
516
517
|
```
|
|
517
518
|
|
|
518
519
|
#### `deleteUserConnection`
|
|
@@ -522,32 +523,46 @@ Helper method that gets the correct client credentials access token and then del
|
|
|
522
523
|
```javascript
|
|
523
524
|
const user = await moneyhub.deleteUserConnection({
|
|
524
525
|
userId: "user-id",
|
|
525
|
-
connectionId: "connection-id"
|
|
526
|
-
|
|
526
|
+
connectionId: "connection-id",
|
|
527
|
+
});
|
|
527
528
|
```
|
|
528
529
|
|
|
529
530
|
#### `getConnectionSyncs`
|
|
530
531
|
|
|
531
532
|
Retrieve the syncs for a given connection ID.
|
|
533
|
+
|
|
532
534
|
```javascript
|
|
533
535
|
const syncs = await moneyhub.getConnectionSyncs({
|
|
534
536
|
userId: "user-id",
|
|
535
537
|
connectionId: "connection-id",
|
|
536
538
|
params: {
|
|
537
539
|
limit: 10,
|
|
538
|
-
offset: 0
|
|
539
|
-
}
|
|
540
|
-
})
|
|
540
|
+
offset: 0,
|
|
541
|
+
},
|
|
542
|
+
});
|
|
541
543
|
```
|
|
542
544
|
|
|
543
545
|
#### `getSync`
|
|
544
546
|
|
|
545
547
|
Retrieve the syncs for the given sync ID.
|
|
548
|
+
|
|
546
549
|
```javascript
|
|
547
550
|
const syncs = await moneyhub.getSync({
|
|
548
551
|
userId: "user-id",
|
|
549
|
-
syncId: "sync-id"
|
|
550
|
-
})
|
|
552
|
+
syncId: "sync-id",
|
|
553
|
+
});
|
|
554
|
+
```
|
|
555
|
+
|
|
556
|
+
#### `updateUserConnection`
|
|
557
|
+
|
|
558
|
+
Helper method that updates a connection. Requires scope `user:update`. Currently only the consent can be updated by updating the `expiresAt` field. This field should be a valid date-time ISO string and not be more than 90 days away. This method can only be used by those clients that have bypassed consent (the `Enforce user consent` option in the Admin Portal). If successful returns a 204.
|
|
559
|
+
|
|
560
|
+
```javascript
|
|
561
|
+
const user = await moneyhub.updateUserConnection({
|
|
562
|
+
userId: "user-id",
|
|
563
|
+
connectionId: "connection-id",
|
|
564
|
+
expiresAt: "2022-06-26T09:43:16.318+00:00"
|
|
565
|
+
})
|
|
551
566
|
```
|
|
552
567
|
|
|
553
568
|
### Data API
|
|
@@ -557,11 +572,11 @@ const syncs = await moneyhub.getSync({
|
|
|
557
572
|
Get all accounts for a user. This function uses the scope `accounts:read`.
|
|
558
573
|
|
|
559
574
|
```javascript
|
|
560
|
-
const queryParams = {limit: 10, offset: 5}
|
|
575
|
+
const queryParams = { limit: 10, offset: 5 };
|
|
561
576
|
const accounts = await moneyhub.getAccounts({
|
|
562
577
|
userId: "userId",
|
|
563
578
|
params: queryParams,
|
|
564
|
-
|
|
579
|
+
});
|
|
565
580
|
```
|
|
566
581
|
|
|
567
582
|
#### `getAccountsWithDetails`
|
|
@@ -569,11 +584,11 @@ const accounts = await moneyhub.getAccounts({
|
|
|
569
584
|
Get all accounts for a user including extra details (sort code, account number, account holder name). This function uses the scopes `accounts:read accounts_details:read`.
|
|
570
585
|
|
|
571
586
|
```javascript
|
|
572
|
-
const queryParams = {limit: 10, offset: 5}
|
|
587
|
+
const queryParams = { limit: 10, offset: 5 };
|
|
573
588
|
const accounts = await moneyhub.getAccountsWithDetails({
|
|
574
589
|
userId: "userId",
|
|
575
|
-
params: queryParams
|
|
576
|
-
|
|
590
|
+
params: queryParams,
|
|
591
|
+
});
|
|
577
592
|
```
|
|
578
593
|
|
|
579
594
|
#### `getAccount`
|
|
@@ -583,8 +598,8 @@ Get a single account for a user by the accountId. This function uses the scope `
|
|
|
583
598
|
```javascript
|
|
584
599
|
const account = await moneyhub.getAccount({
|
|
585
600
|
userId: "userId",
|
|
586
|
-
accountId: "accountId"
|
|
587
|
-
|
|
601
|
+
accountId: "accountId",
|
|
602
|
+
});
|
|
588
603
|
```
|
|
589
604
|
|
|
590
605
|
#### `getAccountWithDetails`
|
|
@@ -594,9 +609,9 @@ Get a single account for a user by the accountId including extra details (sort c
|
|
|
594
609
|
```javascript
|
|
595
610
|
const account = await moneyhub.getAccountWithDetails({
|
|
596
611
|
userId: "userId",
|
|
597
|
-
accountId: "accountId"
|
|
598
|
-
|
|
599
|
-
|
|
612
|
+
accountId: "accountId",
|
|
613
|
+
});
|
|
614
|
+
```
|
|
600
615
|
|
|
601
616
|
#### `getAccountBalances`
|
|
602
617
|
|
|
@@ -605,8 +620,8 @@ Get account balances for a user. This function uses the scope `accounts:read`.
|
|
|
605
620
|
```javascript
|
|
606
621
|
const account = await moneyhub.getAccountBalances({
|
|
607
622
|
userId: "userId",
|
|
608
|
-
accountId: "accountId"
|
|
609
|
-
|
|
623
|
+
accountId: "accountId",
|
|
624
|
+
});
|
|
610
625
|
```
|
|
611
626
|
|
|
612
627
|
#### `getAccountHoldings`
|
|
@@ -616,8 +631,8 @@ Get account holdings for a user. This function uses the scope `accounts:read`.
|
|
|
616
631
|
```javascript
|
|
617
632
|
const account = await moneyhub.getAccountHoldings({
|
|
618
633
|
userId: "userId",
|
|
619
|
-
accountId: "accountId"
|
|
620
|
-
|
|
634
|
+
accountId: "accountId",
|
|
635
|
+
});
|
|
621
636
|
```
|
|
622
637
|
|
|
623
638
|
#### `getAccountHoldingsWithMatches`
|
|
@@ -627,8 +642,8 @@ Get account holdings with ISIN codes matchers for a user. This function uses the
|
|
|
627
642
|
```javascript
|
|
628
643
|
const account = await moneyhub.getAccountHoldingsWithMatches({
|
|
629
644
|
userId: "userId",
|
|
630
|
-
accountId: "accountId"
|
|
631
|
-
|
|
645
|
+
accountId: "accountId",
|
|
646
|
+
});
|
|
632
647
|
```
|
|
633
648
|
|
|
634
649
|
#### `getAccountHolding`
|
|
@@ -639,8 +654,8 @@ Get a single holding from a user's account. This function uses the scope `accoun
|
|
|
639
654
|
const account = await moneyhub.getAccountHolding({
|
|
640
655
|
userId: "userId",
|
|
641
656
|
accountId: "accountId",
|
|
642
|
-
holdingId: "holdingId"
|
|
643
|
-
|
|
657
|
+
holdingId: "holdingId",
|
|
658
|
+
});
|
|
644
659
|
```
|
|
645
660
|
|
|
646
661
|
#### `getAccountCounterparties`
|
|
@@ -650,8 +665,8 @@ Get account counterparties for a user. This function uses the scope `accounts:re
|
|
|
650
665
|
```javascript
|
|
651
666
|
const account = await moneyhub.getAccountCounterparties({
|
|
652
667
|
userId: "userId",
|
|
653
|
-
accountId: "accountId"
|
|
654
|
-
|
|
668
|
+
accountId: "accountId",
|
|
669
|
+
});
|
|
655
670
|
```
|
|
656
671
|
|
|
657
672
|
#### `getAccountRecurringTransactions`
|
|
@@ -661,8 +676,8 @@ Get account recurring transactions for a user. This function uses the scope `acc
|
|
|
661
676
|
```javascript
|
|
662
677
|
const account = await moneyhub.getAccountRecurringTransactions({
|
|
663
678
|
userId: "userId",
|
|
664
|
-
accountId: "accountId"
|
|
665
|
-
|
|
679
|
+
accountId: "accountId",
|
|
680
|
+
});
|
|
666
681
|
```
|
|
667
682
|
|
|
668
683
|
#### `getAccountStandingOrders`
|
|
@@ -672,8 +687,8 @@ Get the standing orders for an account. This function uses the scope `standing_o
|
|
|
672
687
|
```javascript
|
|
673
688
|
const standingOrders = await moneyhub.getAccountStandingOrders({
|
|
674
689
|
userId: "userId",
|
|
675
|
-
accountId: "accountId"
|
|
676
|
-
|
|
690
|
+
accountId: "accountId",
|
|
691
|
+
});
|
|
677
692
|
```
|
|
678
693
|
|
|
679
694
|
#### `getAccountStandingOrdersWithDetail`
|
|
@@ -683,8 +698,8 @@ Get the standing orders with detail (payee information) for an account. This fun
|
|
|
683
698
|
```javascript
|
|
684
699
|
const standingOrders = await moneyhub.getAccountStandingOrdersWithDetail({
|
|
685
700
|
userId: "userId",
|
|
686
|
-
accountId: "accountId"
|
|
687
|
-
|
|
701
|
+
accountId: "accountId",
|
|
702
|
+
});
|
|
688
703
|
```
|
|
689
704
|
|
|
690
705
|
#### `createAccount`
|
|
@@ -702,11 +717,11 @@ const account = await moneyhub.createAccount({
|
|
|
702
717
|
balance: {
|
|
703
718
|
date: "2018-08-12",
|
|
704
719
|
amount: {
|
|
705
|
-
value: 300023
|
|
706
|
-
}
|
|
707
|
-
}
|
|
708
|
-
}
|
|
709
|
-
})
|
|
720
|
+
value: 300023,
|
|
721
|
+
},
|
|
722
|
+
},
|
|
723
|
+
},
|
|
724
|
+
});
|
|
710
725
|
```
|
|
711
726
|
|
|
712
727
|
#### `deleteAccount`
|
|
@@ -716,8 +731,8 @@ Delete a manual account for a user. This function uses the scope `accounts:write
|
|
|
716
731
|
```javascript
|
|
717
732
|
const result = await moneyhub.deleteAccount({
|
|
718
733
|
userId: "userId",
|
|
719
|
-
accountId: "accountId"
|
|
720
|
-
})
|
|
734
|
+
accountId: "accountId",
|
|
735
|
+
});
|
|
721
736
|
```
|
|
722
737
|
|
|
723
738
|
#### `getTransactions`
|
|
@@ -725,11 +740,11 @@ const result = await moneyhub.deleteAccount({
|
|
|
725
740
|
Get all transactions for a user. This function uses the scope `transactions:read:all`..
|
|
726
741
|
|
|
727
742
|
```javascript
|
|
728
|
-
const queryParams = {limit: 10, offset: 5}
|
|
743
|
+
const queryParams = { limit: 10, offset: 5 };
|
|
729
744
|
const transactions = await moneyhub.getTransactions({
|
|
730
745
|
userId: "userId",
|
|
731
|
-
params: queryParams
|
|
732
|
-
|
|
746
|
+
params: queryParams,
|
|
747
|
+
});
|
|
733
748
|
```
|
|
734
749
|
|
|
735
750
|
#### `getTransaction`
|
|
@@ -739,8 +754,8 @@ Get a transaction by ID for a user. This function uses the scope `transactions:r
|
|
|
739
754
|
```javascript
|
|
740
755
|
const transactions = await moneyhub.getTransaction({
|
|
741
756
|
userId: "userId",
|
|
742
|
-
transactionId: "transactionId"
|
|
743
|
-
})
|
|
757
|
+
transactionId: "transactionId",
|
|
758
|
+
});
|
|
744
759
|
```
|
|
745
760
|
|
|
746
761
|
#### `updateTransaction`
|
|
@@ -753,10 +768,10 @@ const transactions = await moneyhub.updateTransaction({
|
|
|
753
768
|
transactionId: "transactionId",
|
|
754
769
|
transaction: {
|
|
755
770
|
amount: {
|
|
756
|
-
value: 10
|
|
757
|
-
}
|
|
758
|
-
}
|
|
759
|
-
})
|
|
771
|
+
value: 10,
|
|
772
|
+
},
|
|
773
|
+
},
|
|
774
|
+
});
|
|
760
775
|
```
|
|
761
776
|
|
|
762
777
|
#### `addTransaction`
|
|
@@ -768,10 +783,10 @@ const transactions = await moneyhub.addTransaction({
|
|
|
768
783
|
userId: "userId",
|
|
769
784
|
transaction: {
|
|
770
785
|
amount: {
|
|
771
|
-
value: 10
|
|
772
|
-
}
|
|
773
|
-
}
|
|
774
|
-
})
|
|
786
|
+
value: 10,
|
|
787
|
+
},
|
|
788
|
+
},
|
|
789
|
+
});
|
|
775
790
|
```
|
|
776
791
|
|
|
777
792
|
#### `addTransactions`
|
|
@@ -784,19 +799,19 @@ const transactions = await moneyhub.addTransactions({
|
|
|
784
799
|
transactions: [
|
|
785
800
|
{
|
|
786
801
|
amount: {
|
|
787
|
-
value: 10
|
|
788
|
-
}
|
|
802
|
+
value: 10,
|
|
803
|
+
},
|
|
789
804
|
},
|
|
790
805
|
{
|
|
791
806
|
amount: {
|
|
792
|
-
value: 25
|
|
793
|
-
}
|
|
794
|
-
}
|
|
807
|
+
value: 25,
|
|
808
|
+
},
|
|
809
|
+
},
|
|
795
810
|
],
|
|
796
811
|
params: {
|
|
797
|
-
categorise: true // optional - enable categorisatio for transactions
|
|
798
|
-
}
|
|
799
|
-
})
|
|
812
|
+
categorise: true, // optional - enable categorisatio for transactions
|
|
813
|
+
},
|
|
814
|
+
});
|
|
800
815
|
```
|
|
801
816
|
|
|
802
817
|
#### `deleteTransaction`
|
|
@@ -806,8 +821,8 @@ Delete a transaction for a user. This function uses the scopes `transactions:wri
|
|
|
806
821
|
```javascript
|
|
807
822
|
const result = await moneyhub.deleteTransaction({
|
|
808
823
|
userId: "userId",
|
|
809
|
-
id: "transactionId"
|
|
810
|
-
})
|
|
824
|
+
id: "transactionId",
|
|
825
|
+
});
|
|
811
826
|
```
|
|
812
827
|
|
|
813
828
|
#### `getBeneficiaries`
|
|
@@ -815,11 +830,11 @@ const result = await moneyhub.deleteTransaction({
|
|
|
815
830
|
Get all beneficiaries for a user. This function uses the scope `beneficiaries:read`
|
|
816
831
|
|
|
817
832
|
```javascript
|
|
818
|
-
const queryParams = {limit: 10, offset: 5}
|
|
833
|
+
const queryParams = { limit: 10, offset: 5 };
|
|
819
834
|
const beneficiaries = await moneyhub.getBeneficiaries({
|
|
820
835
|
userId: "userId",
|
|
821
|
-
params: queryParams
|
|
822
|
-
})
|
|
836
|
+
params: queryParams,
|
|
837
|
+
});
|
|
823
838
|
```
|
|
824
839
|
|
|
825
840
|
#### `getBeneficiariesWithDetail`
|
|
@@ -827,11 +842,11 @@ const beneficiaries = await moneyhub.getBeneficiaries({
|
|
|
827
842
|
Get all beneficiaries for a user, including beneficiary detail. This function uses the scope `beneficiaries_detail:read`
|
|
828
843
|
|
|
829
844
|
```javascript
|
|
830
|
-
const queryParams = {limit: 10, offset: 5}
|
|
845
|
+
const queryParams = { limit: 10, offset: 5 };
|
|
831
846
|
const beneficiaries = await moneyhub.getBeneficiariesWithDetail({
|
|
832
847
|
userId: "userId",
|
|
833
|
-
params: queryParams
|
|
834
|
-
})
|
|
848
|
+
params: queryParams,
|
|
849
|
+
});
|
|
835
850
|
```
|
|
836
851
|
|
|
837
852
|
#### `getBeneficiary`
|
|
@@ -841,8 +856,8 @@ Get a beneficiary for a user. This function uses the scope `beneficiaries:read`
|
|
|
841
856
|
```javascript
|
|
842
857
|
const beneficiary = await moneyhub.getBeneficiary({
|
|
843
858
|
userId: "userId",
|
|
844
|
-
id: "beneficiaryId"
|
|
845
|
-
})
|
|
859
|
+
id: "beneficiaryId",
|
|
860
|
+
});
|
|
846
861
|
```
|
|
847
862
|
|
|
848
863
|
#### `getBeneficiaryWithDetail`
|
|
@@ -852,8 +867,8 @@ Get a beneficiary for a user, including beneficiary detail. This function uses t
|
|
|
852
867
|
```javascript
|
|
853
868
|
const beneficiary = await moneyhub.getBeneficiaryWithDetail({
|
|
854
869
|
userId: "userId",
|
|
855
|
-
id: "beneficiaryId"
|
|
856
|
-
})
|
|
870
|
+
id: "beneficiaryId",
|
|
871
|
+
});
|
|
857
872
|
```
|
|
858
873
|
|
|
859
874
|
#### `addFileToTransaction`
|
|
@@ -862,11 +877,11 @@ Add an attachment to a transaction. This call requires an access token with a sc
|
|
|
862
877
|
|
|
863
878
|
```javascript
|
|
864
879
|
const file = await money.addFileToTransaction({
|
|
865
|
-
userId: "userId"
|
|
880
|
+
userId: "userId",
|
|
866
881
|
transactionId: "transactionId",
|
|
867
882
|
fileName: "file-name",
|
|
868
883
|
fileData: fs.createReadStream("path/to/file.png"),
|
|
869
|
-
|
|
884
|
+
});
|
|
870
885
|
```
|
|
871
886
|
|
|
872
887
|
#### `getTransactionFiles`
|
|
@@ -875,9 +890,9 @@ Get all attachments associated with a transaction. This call requires an access
|
|
|
875
890
|
|
|
876
891
|
```javascript
|
|
877
892
|
const files = await money.getTransactionFiles({
|
|
878
|
-
userId: "userId"
|
|
893
|
+
userId: "userId",
|
|
879
894
|
transactionId: "transactionId",
|
|
880
|
-
|
|
895
|
+
});
|
|
881
896
|
```
|
|
882
897
|
|
|
883
898
|
#### `getTransactionFile`
|
|
@@ -886,10 +901,10 @@ Get an attachment associated with a transaction. This call requires an access to
|
|
|
886
901
|
|
|
887
902
|
```javascript
|
|
888
903
|
const files = await money.getTransactionFile({
|
|
889
|
-
userId: "userId"
|
|
904
|
+
userId: "userId",
|
|
890
905
|
transactionId: "transactionId",
|
|
891
906
|
fileId: "fileId",
|
|
892
|
-
|
|
907
|
+
});
|
|
893
908
|
```
|
|
894
909
|
|
|
895
910
|
#### `deleteTransactionFile`
|
|
@@ -898,61 +913,69 @@ Delete an attachment associated with a transaction. This call requires an access
|
|
|
898
913
|
|
|
899
914
|
```javascript
|
|
900
915
|
await money.deleteTransactionFile({
|
|
901
|
-
userId: "userId"
|
|
916
|
+
userId: "userId",
|
|
902
917
|
transactionId: "transactionId",
|
|
903
918
|
fileId: "fileId",
|
|
904
|
-
|
|
919
|
+
});
|
|
905
920
|
```
|
|
906
921
|
|
|
907
922
|
#### `splitTransaction`
|
|
923
|
+
|
|
908
924
|
Split up a transaction into different categories and/or projects.
|
|
925
|
+
|
|
909
926
|
```javascript
|
|
910
927
|
const splits = await moneyhub.splitTransaction({
|
|
911
|
-
|
|
912
|
-
|
|
913
|
-
|
|
914
|
-
|
|
915
|
-
|
|
916
|
-
|
|
917
|
-
|
|
918
|
-
|
|
919
|
-
|
|
920
|
-
|
|
921
|
-
|
|
922
|
-
|
|
923
|
-
|
|
924
|
-
|
|
925
|
-
})
|
|
928
|
+
userId: "userId",
|
|
929
|
+
transactionId: "transactionId",
|
|
930
|
+
splits: [
|
|
931
|
+
{
|
|
932
|
+
categoryId: "std:5a7ff1f3-cd2c-4676-a368-caf09f2ca35a",
|
|
933
|
+
description: "Split 1",
|
|
934
|
+
amount: -6000,
|
|
935
|
+
},
|
|
936
|
+
{
|
|
937
|
+
categoryId: "std:eac238ec-3899-49ff-8cce-e3b9f4b1aede",
|
|
938
|
+
description: "Split 2",
|
|
939
|
+
amount: -4000,
|
|
940
|
+
},
|
|
941
|
+
],
|
|
942
|
+
});
|
|
926
943
|
```
|
|
927
944
|
|
|
928
945
|
#### `getTransactionSplits`
|
|
946
|
+
|
|
929
947
|
Get a transactions splits.
|
|
948
|
+
|
|
930
949
|
```javascript
|
|
931
950
|
const splits = await moneyhub.getTransactionSplits({
|
|
932
|
-
|
|
933
|
-
|
|
934
|
-
})
|
|
951
|
+
userId: "userId",
|
|
952
|
+
transactionId: "transactionId",
|
|
953
|
+
});
|
|
935
954
|
```
|
|
936
955
|
|
|
937
956
|
#### `patchTransactionSplit`
|
|
957
|
+
|
|
938
958
|
Update a transaction's split's description, categoryId or projectId.
|
|
959
|
+
|
|
939
960
|
```javascript
|
|
940
961
|
const splits = await moneyhub.patchTransactionSplit({
|
|
941
|
-
|
|
942
|
-
|
|
943
|
-
|
|
944
|
-
|
|
945
|
-
|
|
946
|
-
})
|
|
962
|
+
userId: "userId",
|
|
963
|
+
transactionId: "transactionId",
|
|
964
|
+
split: {
|
|
965
|
+
description: "New description",
|
|
966
|
+
},
|
|
967
|
+
});
|
|
947
968
|
```
|
|
948
969
|
|
|
949
970
|
#### `deleteTransactionSplits`
|
|
971
|
+
|
|
950
972
|
Delete a transaction's splits and merge them back together.
|
|
973
|
+
|
|
951
974
|
```javascript
|
|
952
975
|
const splits = await moneyhub.deleteTransactionSplits({
|
|
953
|
-
|
|
954
|
-
|
|
955
|
-
})
|
|
976
|
+
userId: "userId",
|
|
977
|
+
transactionId: "transactionId",
|
|
978
|
+
});
|
|
956
979
|
```
|
|
957
980
|
|
|
958
981
|
#### `getGlobalCounterparties`
|
|
@@ -960,23 +983,20 @@ const splits = await moneyhub.deleteTransactionSplits({
|
|
|
960
983
|
Get global counterparties.
|
|
961
984
|
|
|
962
985
|
```javascript
|
|
963
|
-
|
|
964
|
-
const accounts = await moneyhub.getGlobalCounterparties()
|
|
986
|
+
const accounts = await moneyhub.getGlobalCounterparties();
|
|
965
987
|
```
|
|
966
988
|
|
|
967
|
-
|
|
968
989
|
#### `getCategories`
|
|
969
990
|
|
|
970
991
|
Get all categories for a user. This function uses the scope `categories:read`.
|
|
971
992
|
|
|
972
993
|
```javascript
|
|
973
|
-
|
|
974
994
|
const categories = await moneyhub.getCategories({
|
|
975
995
|
userId: "userId",
|
|
976
996
|
params: {
|
|
977
|
-
type: "personal" // optional personal|business
|
|
978
|
-
|
|
979
|
-
|
|
997
|
+
type: "personal", // optional personal|business
|
|
998
|
+
},
|
|
999
|
+
});
|
|
980
1000
|
```
|
|
981
1001
|
|
|
982
1002
|
#### `getCategory`
|
|
@@ -986,8 +1006,8 @@ Get a single category for a user. This function uses the scope `categories:read`
|
|
|
986
1006
|
```javascript
|
|
987
1007
|
const category = await moneyhub.getCategory({
|
|
988
1008
|
userId: "userId",
|
|
989
|
-
categoryId: "categoryId"
|
|
990
|
-
|
|
1009
|
+
categoryId: "categoryId",
|
|
1010
|
+
});
|
|
991
1011
|
```
|
|
992
1012
|
|
|
993
1013
|
#### `getCategoryGroups`
|
|
@@ -995,13 +1015,12 @@ const category = await moneyhub.getCategory({
|
|
|
995
1015
|
Get all category groups for a user. This function uses the scope `categories:read`.
|
|
996
1016
|
|
|
997
1017
|
```javascript
|
|
998
|
-
|
|
999
1018
|
const categoryGroups = await moneyhub.getCategoryGroups({
|
|
1000
1019
|
userId: "userId",
|
|
1001
1020
|
params: {
|
|
1002
|
-
type: "personal" // optional personal|business
|
|
1003
|
-
|
|
1004
|
-
|
|
1021
|
+
type: "personal", // optional personal|business
|
|
1022
|
+
},
|
|
1023
|
+
});
|
|
1005
1024
|
```
|
|
1006
1025
|
|
|
1007
1026
|
#### `getStandardCategories`
|
|
@@ -1009,12 +1028,11 @@ const categoryGroups = await moneyhub.getCategoryGroups({
|
|
|
1009
1028
|
Get standard categories.
|
|
1010
1029
|
|
|
1011
1030
|
```javascript
|
|
1012
|
-
|
|
1013
1031
|
const categories = await moneyhub.getStandardCategories({
|
|
1014
1032
|
params: {
|
|
1015
|
-
type: "personal" // optional personal|business|all
|
|
1016
|
-
|
|
1017
|
-
|
|
1033
|
+
type: "personal", // optional personal|business|all
|
|
1034
|
+
},
|
|
1035
|
+
});
|
|
1018
1036
|
```
|
|
1019
1037
|
|
|
1020
1038
|
#### `getStandardCategoryGroups`
|
|
@@ -1022,13 +1040,13 @@ const categories = await moneyhub.getStandardCategories({
|
|
|
1022
1040
|
Get standard categories.
|
|
1023
1041
|
|
|
1024
1042
|
```javascript
|
|
1025
|
-
|
|
1026
1043
|
const categoryGroups = await moneyhub.getStandardCategoryGroups({
|
|
1027
1044
|
params: {
|
|
1028
|
-
type: "personal" // optional personal|business|all
|
|
1029
|
-
|
|
1030
|
-
|
|
1045
|
+
type: "personal", // optional personal|business|all
|
|
1046
|
+
},
|
|
1047
|
+
});
|
|
1031
1048
|
```
|
|
1049
|
+
|
|
1032
1050
|
#### `createCustomCategory`
|
|
1033
1051
|
|
|
1034
1052
|
Create a custom category. This function uses the scopes `categories:read categories:write`.
|
|
@@ -1055,23 +1073,19 @@ const projects = await moneyhub.getSpendingAnalysis({
|
|
|
1055
1073
|
userId: "userId",
|
|
1056
1074
|
dates: [
|
|
1057
1075
|
{
|
|
1058
|
-
|
|
1059
|
-
|
|
1060
|
-
|
|
1076
|
+
name: "currentMonth",
|
|
1077
|
+
from: "2018-10-01",
|
|
1078
|
+
to: "2018-10-31",
|
|
1061
1079
|
},
|
|
1062
1080
|
{
|
|
1063
|
-
|
|
1064
|
-
|
|
1065
|
-
|
|
1066
|
-
}
|
|
1081
|
+
name: "previousMonth",
|
|
1082
|
+
from: "2018-09-01",
|
|
1083
|
+
to: "2018-09-30",
|
|
1084
|
+
},
|
|
1067
1085
|
],
|
|
1068
|
-
accountIds: [
|
|
1069
|
-
|
|
1070
|
-
|
|
1071
|
-
categoryIds: [
|
|
1072
|
-
"std:338d2636-7f88-491d-8129-255c98da1eb8"
|
|
1073
|
-
] // optional
|
|
1074
|
-
})
|
|
1086
|
+
accountIds: ["ac9bd177-d01e-449c-9f29-d3656d2edc2e"], // optional
|
|
1087
|
+
categoryIds: ["std:338d2636-7f88-491d-8129-255c98da1eb8"], // optional
|
|
1088
|
+
});
|
|
1075
1089
|
```
|
|
1076
1090
|
|
|
1077
1091
|
### Projects
|
|
@@ -1086,8 +1100,8 @@ const projects = await moneyhub.getProjects({
|
|
|
1086
1100
|
params: {
|
|
1087
1101
|
limit: "limit", // optional
|
|
1088
1102
|
offset: "offset", // optional
|
|
1089
|
-
} // optional
|
|
1090
|
-
})
|
|
1103
|
+
}, // optional
|
|
1104
|
+
});
|
|
1091
1105
|
```
|
|
1092
1106
|
|
|
1093
1107
|
#### `getProject`
|
|
@@ -1097,8 +1111,8 @@ Get a single project for a user by the projectId. This function uses the scope `
|
|
|
1097
1111
|
```javascript
|
|
1098
1112
|
const project = await moneyhub.getProject({
|
|
1099
1113
|
userId: "userId",
|
|
1100
|
-
projectId: "projectId"
|
|
1101
|
-
|
|
1114
|
+
projectId: "projectId",
|
|
1115
|
+
});
|
|
1102
1116
|
```
|
|
1103
1117
|
|
|
1104
1118
|
#### `addProject`
|
|
@@ -1112,8 +1126,8 @@ const project = await moneyhub.addProject({
|
|
|
1112
1126
|
name: "Project Name",
|
|
1113
1127
|
accountIds: "id1,id2", // comma-separated list of account IDs
|
|
1114
1128
|
type: "PropertyProject",
|
|
1115
|
-
}
|
|
1116
|
-
})
|
|
1129
|
+
},
|
|
1130
|
+
});
|
|
1117
1131
|
```
|
|
1118
1132
|
|
|
1119
1133
|
#### `updateProject`
|
|
@@ -1129,23 +1143,25 @@ const project = await moneyhub.updateProject({
|
|
|
1129
1143
|
accountIds: "id1,id2", // comma-separated list of account IDs
|
|
1130
1144
|
type: "PropertyProject",
|
|
1131
1145
|
archived: false,
|
|
1132
|
-
}
|
|
1133
|
-
})
|
|
1146
|
+
},
|
|
1147
|
+
});
|
|
1134
1148
|
```
|
|
1135
1149
|
|
|
1136
1150
|
#### `deleteProject`
|
|
1151
|
+
|
|
1137
1152
|
Delete a project for a user given a project ID. This function uses the scope `projects.delete`.
|
|
1138
1153
|
|
|
1139
1154
|
```javascript
|
|
1140
1155
|
const result = await moneyhub.deleteProject({
|
|
1141
1156
|
userId: "userId",
|
|
1142
|
-
projectId: "projectId"
|
|
1143
|
-
|
|
1157
|
+
projectId: "projectId",
|
|
1158
|
+
});
|
|
1144
1159
|
```
|
|
1145
1160
|
|
|
1146
1161
|
### Tax Return
|
|
1147
1162
|
|
|
1148
1163
|
#### `getTaxReturn`
|
|
1164
|
+
|
|
1149
1165
|
Get a tax return object for a subset of transactions. This makes use of the `enhancedCategories` on transactions. This functions uses the scope `tax:read`
|
|
1150
1166
|
|
|
1151
1167
|
```javascript
|
|
@@ -1156,11 +1172,10 @@ const result = await moneyhub.getTaxReturn({
|
|
|
1156
1172
|
endDate: "2020-02-01",
|
|
1157
1173
|
accountId: "accountId",
|
|
1158
1174
|
projectId: "projectId",
|
|
1159
|
-
}
|
|
1160
|
-
})
|
|
1175
|
+
},
|
|
1176
|
+
});
|
|
1161
1177
|
```
|
|
1162
1178
|
|
|
1163
|
-
|
|
1164
1179
|
### Payments
|
|
1165
1180
|
|
|
1166
1181
|
#### `getPaymentAuthorizeUrl`
|
|
@@ -1184,10 +1199,10 @@ const url = await moneyhub.getPaymentAuthorizeUrl({
|
|
|
1184
1199
|
context: "Payment context [Other,BillPayment,PartyToParty]", // optional - defaults to PartyToParty
|
|
1185
1200
|
userId: "Moneyhub API User ID you wish to attach to the payment", // optional
|
|
1186
1201
|
claims: claimsObject, // optional
|
|
1187
|
-
})
|
|
1202
|
+
});
|
|
1188
1203
|
|
|
1189
1204
|
// Scope used with the bankId provided
|
|
1190
|
-
const scope = `payment openid id:${bankId}
|
|
1205
|
+
const scope = `payment openid id:${bankId}`;
|
|
1191
1206
|
|
|
1192
1207
|
// Default claims if none are provided
|
|
1193
1208
|
const defaultClaims = {
|
|
@@ -1210,7 +1225,7 @@ const defaultClaims = {
|
|
|
1210
1225
|
},
|
|
1211
1226
|
},
|
|
1212
1227
|
},
|
|
1213
|
-
}
|
|
1228
|
+
};
|
|
1214
1229
|
```
|
|
1215
1230
|
|
|
1216
1231
|
#### `getReversePaymentAuthorizeUrl`
|
|
@@ -1260,7 +1275,7 @@ const payee = await moneyhub.addPayee({
|
|
|
1260
1275
|
sortCode: "your sort code",
|
|
1261
1276
|
name: "name of Payee",
|
|
1262
1277
|
externalId: "your external id",
|
|
1263
|
-
})
|
|
1278
|
+
});
|
|
1264
1279
|
```
|
|
1265
1280
|
|
|
1266
1281
|
#### `getPayees`
|
|
@@ -1271,7 +1286,7 @@ This method returns a list of registered payees. This function uses the scope `p
|
|
|
1271
1286
|
const payees = await moneyhub.getPayees({
|
|
1272
1287
|
limit: "limit", // optional
|
|
1273
1288
|
offset: "offset", // optional
|
|
1274
|
-
})
|
|
1289
|
+
});
|
|
1275
1290
|
```
|
|
1276
1291
|
|
|
1277
1292
|
#### `getPayments`
|
|
@@ -1286,7 +1301,7 @@ const payments = await moneyhub.getPayments({
|
|
|
1286
1301
|
payeeId: "payee-id", // optional
|
|
1287
1302
|
startDate: "2020-01-01", // optional
|
|
1288
1303
|
endDate: "2020-12-31", // optional
|
|
1289
|
-
})
|
|
1304
|
+
});
|
|
1290
1305
|
```
|
|
1291
1306
|
|
|
1292
1307
|
#### `getPayment`
|
|
@@ -1296,7 +1311,7 @@ Get a single payment by its id . This function uses the scope `payment:read`
|
|
|
1296
1311
|
```javascript
|
|
1297
1312
|
const paymentData = await moneyhub.getPayment({
|
|
1298
1313
|
id: "payment-id",
|
|
1299
|
-
})
|
|
1314
|
+
});
|
|
1300
1315
|
```
|
|
1301
1316
|
|
|
1302
1317
|
#### `getPaymentFromIDToken`
|
|
@@ -1306,8 +1321,8 @@ you will receive back an ID Token that contains the payment id. This is a utilit
|
|
|
1306
1321
|
|
|
1307
1322
|
```javascript
|
|
1308
1323
|
const paymentData = await moneyhub.getPaymentFromIDToken({
|
|
1309
|
-
idToken: "eyJhbGciOiJSUz..."
|
|
1310
|
-
|
|
1324
|
+
idToken: "eyJhbGciOiJSUz...",
|
|
1325
|
+
});
|
|
1311
1326
|
```
|
|
1312
1327
|
|
|
1313
1328
|
### Standing Orders
|
|
@@ -1389,7 +1404,7 @@ const standingOrders = await moneyhub.getStandingOrders({
|
|
|
1389
1404
|
payeeId: "payee-id", // optional
|
|
1390
1405
|
startDate: "2020-01-01", // optional
|
|
1391
1406
|
endDate: "2020-12-31", // optional
|
|
1392
|
-
})
|
|
1407
|
+
});
|
|
1393
1408
|
```
|
|
1394
1409
|
|
|
1395
1410
|
#### `getStandingOrder`
|
|
@@ -1399,7 +1414,7 @@ Get a single standing order request by its id. This function uses the scope `pay
|
|
|
1399
1414
|
```javascript
|
|
1400
1415
|
const standingOrder = await moneyhub.getStandingOrder({
|
|
1401
1416
|
id: "standing-order-id",
|
|
1402
|
-
})
|
|
1417
|
+
});
|
|
1403
1418
|
```
|
|
1404
1419
|
|
|
1405
1420
|
### Recurring Payments (VRP)
|
|
@@ -1416,7 +1431,7 @@ const url = await moneyhub.getRecurringPaymentAuthorizeUrl({
|
|
|
1416
1431
|
payerId: "Id of payer", // requird only if payerType is defined
|
|
1417
1432
|
payerType: "Payer type [mh-user-account]", // required only if payerId is used
|
|
1418
1433
|
reference: "The reference for recurring payment",
|
|
1419
|
-
validFromDate: "The date from which the authorisation is effective"
|
|
1434
|
+
validFromDate: "The date from which the authorisation is effective", // should be in an international format, e.g. 15-MAR-2021 or ISO date
|
|
1420
1435
|
validToDate: "The date to which the authorisation is effective", // should be in an international format, e.g. 15-MAR-2021 or ISO date
|
|
1421
1436
|
maximumIndividualAmount: "The maimum single amount that will be allowed", // the valid in whole minor units (i.e. pence)
|
|
1422
1437
|
currency: "The currency code for the maxiumum recurring payment amount [GBP]",
|
|
@@ -1424,22 +1439,24 @@ const url = await moneyhub.getRecurringPaymentAuthorizeUrl({
|
|
|
1424
1439
|
{
|
|
1425
1440
|
amount: "The maximum amount for this recurring payment limit", // the valid in whole minor units (i.e. pence)
|
|
1426
1441
|
currency: "The currency code for this recurring payment limit [GBP]",
|
|
1427
|
-
periodType:
|
|
1428
|
-
|
|
1429
|
-
|
|
1442
|
+
periodType:
|
|
1443
|
+
"The period over which the limit is effective [Day, Week, Fortnight, Month, Half-year, Year]",
|
|
1444
|
+
periodAlignment:
|
|
1445
|
+
"Specifies whether the period starts on the date of consent creation or lines up with a calendar [Consent, Calendar]",
|
|
1446
|
+
},
|
|
1430
1447
|
],
|
|
1431
1448
|
type: [
|
|
1432
1449
|
"Sweeping", // Specifies that the recurring payment is for the purpose of sweeping payments
|
|
1433
|
-
"Other" // Specifies that the recurring payment is for other payments of another purpose
|
|
1450
|
+
"Other", // Specifies that the recurring payment is for other payments of another purpose
|
|
1434
1451
|
],
|
|
1435
1452
|
context: "Payment context [Other,BillPayment,PartyToParty]", // optional - defaults to PartyToParty
|
|
1436
1453
|
state: "your state value",
|
|
1437
1454
|
nonce: "your nonce value", // optional
|
|
1438
1455
|
claims: claimsObject, // optional
|
|
1439
|
-
})
|
|
1456
|
+
});
|
|
1440
1457
|
|
|
1441
1458
|
// Scope used with the bankId provided
|
|
1442
|
-
const scope = `recurring_payment:create openid id:${bankId}
|
|
1459
|
+
const scope = `recurring_payment:create openid id:${bankId}`;
|
|
1443
1460
|
|
|
1444
1461
|
// Default claims if none are provided
|
|
1445
1462
|
const defaultClaims = {
|
|
@@ -1464,7 +1481,7 @@ const defaultClaims = {
|
|
|
1464
1481
|
},
|
|
1465
1482
|
},
|
|
1466
1483
|
},
|
|
1467
|
-
}
|
|
1484
|
+
};
|
|
1468
1485
|
```
|
|
1469
1486
|
|
|
1470
1487
|
#### `getRecurringPayments`
|
|
@@ -1479,7 +1496,7 @@ const recurringPayments = await moneyhub.getRecurringPayments({
|
|
|
1479
1496
|
payeeId: "payee-id", // optional
|
|
1480
1497
|
startDate: "2020-01-01", // optional
|
|
1481
1498
|
endDate: "2020-12-31", // optional
|
|
1482
|
-
})
|
|
1499
|
+
});
|
|
1483
1500
|
```
|
|
1484
1501
|
|
|
1485
1502
|
#### `getRecurringPayment`
|
|
@@ -1488,8 +1505,8 @@ This method gets a recurring payment consent. This function uses the scope `recu
|
|
|
1488
1505
|
|
|
1489
1506
|
```javascript
|
|
1490
1507
|
const recurringPayment = await moneyhub.getRecurringPayment({
|
|
1491
|
-
recurringPaymentId: "Id of the recurring payment consent"
|
|
1492
|
-
})
|
|
1508
|
+
recurringPaymentId: "Id of the recurring payment consent",
|
|
1509
|
+
});
|
|
1493
1510
|
```
|
|
1494
1511
|
|
|
1495
1512
|
#### `makeRecurringPayment`
|
|
@@ -1503,9 +1520,9 @@ const recurringPayments = await moneyhub.getRecurringPayments({
|
|
|
1503
1520
|
payeeId: "payee-id", // optional
|
|
1504
1521
|
amount: 200,
|
|
1505
1522
|
payeeRef: "Payee ref",
|
|
1506
|
-
payerRef: "Payer ref"
|
|
1507
|
-
}
|
|
1508
|
-
})
|
|
1523
|
+
payerRef: "Payer ref",
|
|
1524
|
+
},
|
|
1525
|
+
});
|
|
1509
1526
|
```
|
|
1510
1527
|
|
|
1511
1528
|
#### `revokeRecurringPayment`
|
|
@@ -1514,8 +1531,8 @@ This method revokes a recurring payment consent. This function uses the scope `r
|
|
|
1514
1531
|
|
|
1515
1532
|
```javascript
|
|
1516
1533
|
const revokedRecurringPayment = await moneyhub.revokeRecurringPayment({
|
|
1517
|
-
recurringPaymentId: "Id of the recurring payment consent"
|
|
1518
|
-
})
|
|
1534
|
+
recurringPaymentId: "Id of the recurring payment consent",
|
|
1535
|
+
});
|
|
1519
1536
|
```
|
|
1520
1537
|
|
|
1521
1538
|
#### `getRegularTransactions`
|
|
@@ -1523,11 +1540,11 @@ const revokedRecurringPayment = await moneyhub.revokeRecurringPayment({
|
|
|
1523
1540
|
Get all the regular transactions for a user, there is an option to pass an account ID as a parameter as a filter. This function uses the scope `accounts:read`, `transactions:read:all` and `regular_transactions:read`
|
|
1524
1541
|
|
|
1525
1542
|
```javascript
|
|
1526
|
-
const queryParams = {accountID}
|
|
1543
|
+
const queryParams = { accountID };
|
|
1527
1544
|
const regulartransactions = await moneyhub.getRegularTransactions({
|
|
1528
1545
|
userId: "userId",
|
|
1529
1546
|
params: queryParams,
|
|
1530
|
-
})
|
|
1547
|
+
});
|
|
1531
1548
|
```
|
|
1532
1549
|
|
|
1533
1550
|
### Rental records
|
|
@@ -1538,9 +1555,9 @@ This method will return the rental record for the user. Requires the scope `rent
|
|
|
1538
1555
|
|
|
1539
1556
|
```javascript
|
|
1540
1557
|
const getRentalRecordResponse = await moneyhub.getRentalRecords({
|
|
1541
|
-
userId: "user-id"
|
|
1542
|
-
})
|
|
1543
|
-
const rentalRecord = getRentalRecordResponse.data[0]
|
|
1558
|
+
userId: "user-id",
|
|
1559
|
+
});
|
|
1560
|
+
const rentalRecord = getRentalRecordResponse.data[0];
|
|
1544
1561
|
```
|
|
1545
1562
|
|
|
1546
1563
|
#### `createRentalRecord`
|
|
@@ -1562,12 +1579,12 @@ const createRentalRecordResponse = await moneyhub.createRentalRecord({
|
|
|
1562
1579
|
postalCode: "CA12345",
|
|
1563
1580
|
tenancyStartDate: "2020-11-19",
|
|
1564
1581
|
rentalAmount: {
|
|
1565
|
-
value: 10000
|
|
1582
|
+
value: 10000,
|
|
1566
1583
|
},
|
|
1567
1584
|
rentalFrequency: "monthly",
|
|
1568
|
-
}
|
|
1569
|
-
})
|
|
1570
|
-
const createdRentalRecord = createRentalRecordResponse.data
|
|
1585
|
+
},
|
|
1586
|
+
});
|
|
1587
|
+
const createdRentalRecord = createRentalRecordResponse.data;
|
|
1571
1588
|
```
|
|
1572
1589
|
|
|
1573
1590
|
#### `deleteRentalRecord`
|
|
@@ -1577,8 +1594,138 @@ This method deletes the rental record for a user.
|
|
|
1577
1594
|
```javascript
|
|
1578
1595
|
await moneyhub.deleteRentalRecord({
|
|
1579
1596
|
userId: "user-id",
|
|
1580
|
-
rentalId: "rental-id"
|
|
1581
|
-
})
|
|
1597
|
+
rentalId: "rental-id",
|
|
1598
|
+
});
|
|
1599
|
+
```
|
|
1600
|
+
|
|
1601
|
+
### Spending Goals
|
|
1602
|
+
|
|
1603
|
+
#### `createSpendingGoal`
|
|
1604
|
+
|
|
1605
|
+
This method will create a single spending goal for the user. Requires the scopes`spending_goals:read` and `spending_goals:write:all`.
|
|
1606
|
+
|
|
1607
|
+
```javascript
|
|
1608
|
+
const spendingGoal = await moneyhub.createSpendingGoal({
|
|
1609
|
+
categoryId: "std:all",
|
|
1610
|
+
amount: { value: 200 },
|
|
1611
|
+
periodStart: "20",
|
|
1612
|
+
periodType: "monthly",
|
|
1613
|
+
userId: "user-id",
|
|
1614
|
+
});
|
|
1615
|
+
```
|
|
1616
|
+
|
|
1617
|
+
#### `getSpendingGoals`
|
|
1618
|
+
|
|
1619
|
+
This method will return the spending goals for the user. Requires the scope `spending_goals:read`.
|
|
1620
|
+
|
|
1621
|
+
```javascript
|
|
1622
|
+
const spendingGoals = await moneyhub.getSpendingGoals({
|
|
1623
|
+
userId: "user-id",
|
|
1624
|
+
limit: 1,
|
|
1625
|
+
offset: 0,
|
|
1626
|
+
});
|
|
1627
|
+
const spendingGoal = spendingGoals.data[0];
|
|
1628
|
+
```
|
|
1629
|
+
|
|
1630
|
+
#### `getSpendingGoal`
|
|
1631
|
+
|
|
1632
|
+
This method will return the specified spending goal for the user. Requires the scope `spending_goals:read`.
|
|
1633
|
+
|
|
1634
|
+
```javascript
|
|
1635
|
+
const spendingGoals = await moneyhub.getSpendingGoal({
|
|
1636
|
+
userId: "user-id",
|
|
1637
|
+
goalId: "goal-id",
|
|
1638
|
+
});
|
|
1639
|
+
```
|
|
1640
|
+
|
|
1641
|
+
#### `updateSpendingGoal`
|
|
1642
|
+
|
|
1643
|
+
This method will update the specified spending goal for the user. Requires the scopes `spending_goals:read` and `spending_goals:write`.
|
|
1644
|
+
|
|
1645
|
+
```javascript
|
|
1646
|
+
const spendingGoals = await moneyhub.updateSpendingGoal({
|
|
1647
|
+
userId: "user-id",
|
|
1648
|
+
goalId: "goal-id",
|
|
1649
|
+
categoryId: "id",
|
|
1650
|
+
amount: { value: 302 },
|
|
1651
|
+
});
|
|
1652
|
+
```
|
|
1653
|
+
|
|
1654
|
+
#### `deleteSpendingGoal`
|
|
1655
|
+
|
|
1656
|
+
This method will delete the specified spending goal for the user. Requires the scope `spending_goals:write:all`.
|
|
1657
|
+
|
|
1658
|
+
```javascript
|
|
1659
|
+
const spendingGoals = await moneyhub.deleteSpendingGoal({
|
|
1660
|
+
userId: "user-id",
|
|
1661
|
+
goalId: "goal-id",
|
|
1662
|
+
});
|
|
1663
|
+
```
|
|
1664
|
+
|
|
1665
|
+
### Savings Goals
|
|
1666
|
+
|
|
1667
|
+
#### `createSavingsGoal`
|
|
1668
|
+
|
|
1669
|
+
This method will create a single savings goal for the user. Requires the scopes`savings_goals:read` and `savings_goals:write:all`.
|
|
1670
|
+
|
|
1671
|
+
```javascript
|
|
1672
|
+
const savingsGoal = await moneyhub.createSavingsGoal({
|
|
1673
|
+
name: "savings",
|
|
1674
|
+
amount: { value: 200 },
|
|
1675
|
+
imageUrl: "https://myimage.com",
|
|
1676
|
+
notes: "lots'o'money",
|
|
1677
|
+
userId: "user-id",
|
|
1678
|
+
accounts: [{ id: "1234" }],
|
|
1679
|
+
});
|
|
1680
|
+
```
|
|
1681
|
+
|
|
1682
|
+
#### `getSavingsGoals`
|
|
1683
|
+
|
|
1684
|
+
This method will return the savings goals for the user. Requires the scope `savings_goals:read`.
|
|
1685
|
+
|
|
1686
|
+
```javascript
|
|
1687
|
+
const savingsGoals = await moneyhub.getSavingsGoals({
|
|
1688
|
+
userId: "user-id",
|
|
1689
|
+
limit: 1,
|
|
1690
|
+
offset: 0,
|
|
1691
|
+
});
|
|
1692
|
+
const savingsGoal = savingsGoals.data[0];
|
|
1693
|
+
```
|
|
1694
|
+
|
|
1695
|
+
#### `getSavingsGoal`
|
|
1696
|
+
|
|
1697
|
+
This method will return the specified savings goal for the user. Requires the scope `savings_goals:read`.
|
|
1698
|
+
|
|
1699
|
+
```javascript
|
|
1700
|
+
const savingsGoals = await moneyhub.getSavingsGoal({
|
|
1701
|
+
userId: "user-id",
|
|
1702
|
+
goalId: "goal-id",
|
|
1703
|
+
});
|
|
1704
|
+
```
|
|
1705
|
+
|
|
1706
|
+
#### `updateSavingsGoal`
|
|
1707
|
+
|
|
1708
|
+
This method will update the specified savings goal for the user. Requires the scopes `savings_goals:read` and `savings_goals:write`.
|
|
1709
|
+
|
|
1710
|
+
```javascript
|
|
1711
|
+
const savingsGoals = await moneyhub.updateSavingsGoal({
|
|
1712
|
+
userId: "user-id",
|
|
1713
|
+
goalId: "goal-id",
|
|
1714
|
+
name: "new-name",
|
|
1715
|
+
amount: { value: 302 },
|
|
1716
|
+
accounts: [{ id: "1234" }],
|
|
1717
|
+
});
|
|
1718
|
+
```
|
|
1719
|
+
|
|
1720
|
+
#### `deleteSavingsGoal`
|
|
1721
|
+
|
|
1722
|
+
This method will delete the specified savings goal for the user. Requires the scope `savings_goals:write:all`.
|
|
1723
|
+
|
|
1724
|
+
```javascript
|
|
1725
|
+
const savingsGoals = await moneyhub.deleteSavingsGoal({
|
|
1726
|
+
userId: "user-id",
|
|
1727
|
+
goalId: "goal-id",
|
|
1728
|
+
});
|
|
1582
1729
|
```
|
|
1583
1730
|
|
|
1584
1731
|
### Financial Connections
|
|
@@ -1588,7 +1735,7 @@ await moneyhub.deleteRentalRecord({
|
|
|
1588
1735
|
This method will resolve with a list of all the available connections (banks, etc.) that a user can connect to.
|
|
1589
1736
|
|
|
1590
1737
|
```javascript
|
|
1591
|
-
const availableConnections = await moneyhub.listConnections()
|
|
1738
|
+
const availableConnections = await moneyhub.listConnections();
|
|
1592
1739
|
```
|
|
1593
1740
|
|
|
1594
1741
|
#### `listAPIConnections`
|
|
@@ -1596,7 +1743,7 @@ const availableConnections = await moneyhub.listConnections()
|
|
|
1596
1743
|
This method will resolve with a list of all the API connections that a user can connect to.
|
|
1597
1744
|
|
|
1598
1745
|
```javascript
|
|
1599
|
-
const availableConnections = await moneyhub.listAPIConnections()
|
|
1746
|
+
const availableConnections = await moneyhub.listAPIConnections();
|
|
1600
1747
|
```
|
|
1601
1748
|
|
|
1602
1749
|
#### `listTestConnections`
|
|
@@ -1604,7 +1751,7 @@ const availableConnections = await moneyhub.listAPIConnections()
|
|
|
1604
1751
|
This method will resolve with a list of all the Test connections that a user can connect to.
|
|
1605
1752
|
|
|
1606
1753
|
```javascript
|
|
1607
|
-
const availableConnections = await moneyhub.listTestConnections()
|
|
1754
|
+
const availableConnections = await moneyhub.listTestConnections();
|
|
1608
1755
|
```
|
|
1609
1756
|
|
|
1610
1757
|
### OpenID Config
|
|
@@ -1614,10 +1761,9 @@ const availableConnections = await moneyhub.listTestConnections()
|
|
|
1614
1761
|
This method will resolve with our open id configuration.
|
|
1615
1762
|
|
|
1616
1763
|
```javascript
|
|
1617
|
-
const availableConnections = await moneyhub.getOpenIdConfig()
|
|
1764
|
+
const availableConnections = await moneyhub.getOpenIdConfig();
|
|
1618
1765
|
```
|
|
1619
1766
|
|
|
1620
|
-
|
|
1621
1767
|
### Examples
|
|
1622
1768
|
|
|
1623
1769
|
We have a couple of examples under the `/examples` folder that can be helpful to start using our client.
|