@mft/moneyhub-api-client 6.99.0 → 6.100.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 (49) hide show
  1. package/CHANGELOG.md +222 -3
  2. package/dist/get-auth-urls.js +5 -5
  3. package/dist/get-auth-urls.js.map +1 -1
  4. package/dist/index.d.ts +11 -0
  5. package/dist/index.d.ts.map +1 -1
  6. package/dist/requests/caas/types/regular-transactions.d.ts +5 -6
  7. package/dist/requests/caas/types/regular-transactions.d.ts.map +1 -1
  8. package/dist/requests/caas/types/response-meta.d.ts +8 -0
  9. package/dist/requests/caas/types/response-meta.d.ts.map +1 -0
  10. package/dist/requests/caas/types/response-meta.js +3 -0
  11. package/dist/requests/caas/types/response-meta.js.map +1 -0
  12. package/dist/requests/caas/types/transactions.d.ts +2 -4
  13. package/dist/requests/caas/types/transactions.d.ts.map +1 -1
  14. package/dist/requests/index.d.ts +11 -0
  15. package/dist/requests/index.d.ts.map +1 -1
  16. package/dist/requests/index.js +2 -0
  17. package/dist/requests/index.js.map +1 -1
  18. package/dist/requests/standard-financial-statements.d.ts +5 -0
  19. package/dist/requests/standard-financial-statements.d.ts.map +1 -0
  20. package/dist/requests/standard-financial-statements.js +23 -0
  21. package/dist/requests/standard-financial-statements.js.map +1 -0
  22. package/dist/requests/types/standard-financial-statements.d.ts +19 -0
  23. package/dist/requests/types/standard-financial-statements.d.ts.map +1 -0
  24. package/dist/requests/types/standard-financial-statements.js +3 -0
  25. package/dist/requests/types/standard-financial-statements.js.map +1 -0
  26. package/dist/requests/types/unauthenticated.d.ts +4 -0
  27. package/dist/requests/types/unauthenticated.d.ts.map +1 -1
  28. package/dist/requests/unauthenticated.d.ts.map +1 -1
  29. package/dist/requests/unauthenticated.js +1 -0
  30. package/dist/requests/unauthenticated.js.map +1 -1
  31. package/dist/schema/standard-financial-statement.d.ts +21 -0
  32. package/dist/schema/standard-financial-statement.d.ts.map +1 -0
  33. package/dist/schema/standard-financial-statement.js +3 -0
  34. package/dist/schema/standard-financial-statement.js.map +1 -0
  35. package/package.json +5 -4
  36. package/readme.md +105 -28
  37. package/scripts/assert-github-actions-publish.js +11 -1
  38. package/scripts/check-secrets.js +66 -0
  39. package/.idea/codeStyles/Project.xml +0 -21
  40. package/.idea/codeStyles/codeStyleConfig.xml +0 -5
  41. package/.idea/dbnavigator.xml +0 -450
  42. package/.idea/git_toolbox_blame.xml +0 -6
  43. package/.idea/inspectionProfiles/Project_Default.xml +0 -6
  44. package/.idea/jsLinters/eslint.xml +0 -6
  45. package/.idea/modules.xml +0 -8
  46. package/.idea/moneyhub-api-client.iml +0 -12
  47. package/.idea/prettier.xml +0 -6
  48. package/.idea/vcs.xml +0 -6
  49. package/.idea/workspace.xml +0 -338
@@ -9,6 +9,10 @@ export interface UnauthenticatedRequests {
9
9
  listAPIConnections: (query?: {
10
10
  clientId?: string;
11
11
  }) => Promise<WellKnownConnection[]>;
12
+ /** Identity `.well-known/legacy-connections` */
13
+ listLegacyConnections: (query?: {
14
+ clientId?: string;
15
+ }) => Promise<WellKnownConnection[]>;
12
16
  listTestConnections: (query?: {
13
17
  clientId?: string;
14
18
  }) => Promise<WellKnownConnection[]>;
@@ -1 +1 @@
1
- {"version":3,"file":"unauthenticated.d.ts","sourceRoot":"","sources":["../../../src/requests/types/unauthenticated.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,WAAW,EAAE,YAAY,EAAC,MAAM,eAAe,CAAA;AACvD,OAAO,EAAC,mBAAmB,EAAC,MAAM,yBAAyB,CAAA;AAC3D,OAAO,EAAC,gCAAgC,EAAE,kBAAkB,EAAC,MAAM,2BAA2B,CAAA;AAE9F,MAAM,WAAW,uBAAuB;IACtC,uBAAuB,EAAE,CACvB,MAAM,CAAC,EAAE,gCAAgC,EACzC,OAAO,CAAC,EAAE,YAAY,KACnB,OAAO,CAAC,WAAW,CAAC,kBAAkB,EAAE,CAAC,CAAC,CAAA;IAE/C,eAAe,EAAE,CAAC,KAAK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CAAC,mBAAmB,EAAE,CAAC,CAAA;IAChF,kBAAkB,EAAE,CAAC,KAAK,CAAC,EAAE;QAAC,QAAQ,CAAC,EAAE,MAAM,CAAA;KAAC,KAAK,OAAO,CAAC,mBAAmB,EAAE,CAAC,CAAA;IAEnF,gDAAgD;IAChD,qBAAqB,EAAE,CAAC,KAAK,CAAC,EAAE;QAAC,QAAQ,CAAC,EAAE,MAAM,CAAA;KAAC,KAAK,OAAO,CAAC,mBAAmB,EAAE,CAAC,CAAA;IACtF,mBAAmB,EAAE,CAAC,KAAK,CAAC,EAAE;QAAC,QAAQ,CAAC,EAAE,MAAM,CAAA;KAAC,KAAK,OAAO,CAAC,mBAAmB,EAAE,CAAC,CAAA;IACpF,mBAAmB,EAAE,CAAC,KAAK,CAAC,EAAE;QAAC,QAAQ,CAAC,EAAE,MAAM,CAAA;KAAC,KAAK,OAAO,CAAC,mBAAmB,EAAE,CAAC,CAAA;IACpF,uBAAuB,EAAE,CAAC,KAAK,CAAC,EAAE;QAAC,QAAQ,CAAC,EAAE,MAAM,CAAA;KAAC,KAAK,OAAO,CAAC,mBAAmB,EAAE,CAAC,CAAA;IACxF,eAAe,EAAE,MAAM,OAAO,CAAC,OAAO,CAAC,CAAA;CACxC"}
@@ -1 +1 @@
1
- {"version":3,"file":"unauthenticated.d.ts","sourceRoot":"","sources":["../../src/requests/unauthenticated.ts"],"names":[],"mappings":"AACA,OAAO,EAAC,cAAc,EAAe,MAAM,YAAY,CAAA;AACvD,OAAO,EAAC,uBAAuB,EAAC,MAAM,yBAAyB,CAAA;8CAE5B,cAAc,KAAG,uBAAuB;AAA3E,wBAoBC"}
1
+ {"version":3,"file":"unauthenticated.d.ts","sourceRoot":"","sources":["../../src/requests/unauthenticated.ts"],"names":[],"mappings":"AACA,OAAO,EAAC,cAAc,EAAe,MAAM,YAAY,CAAA;AACvD,OAAO,EAAC,uBAAuB,EAAC,MAAM,yBAAyB,CAAA;8CAE5B,cAAc,KAAG,uBAAuB;AAA3E,wBAsBC"}
@@ -13,6 +13,7 @@ exports.default = ({ config, request }) => {
13
13
  }),
14
14
  listConnections: (query) => request(`${identityServiceUrl}/oidc/.well-known/all-connections?${query && query_string_1.default.stringify(query)}`),
15
15
  listAPIConnections: (query) => request(`${identityServiceUrl}/oidc/.well-known/api-connections?${query && query_string_1.default.stringify(query)}`),
16
+ listLegacyConnections: (query) => request(`${identityServiceUrl}/oidc/.well-known/legacy-connections?${query && query_string_1.default.stringify(query)}`),
16
17
  listTestConnections: (query) => request(`${identityServiceUrl}/oidc/.well-known/test-connections?${query && query_string_1.default.stringify(query)}`),
17
18
  listPaymentsConnections: (query) => request(`${identityServiceUrl}/oidc/.well-known/payments-connections?${query && query_string_1.default.stringify(query)}`),
18
19
  listBetaConnections: (query) => request(`${identityServiceUrl}/oidc/.well-known/beta-connections?${query && query_string_1.default.stringify(query)}`),
@@ -1 +1 @@
1
- {"version":3,"file":"unauthenticated.js","sourceRoot":"","sources":["../../src/requests/unauthenticated.ts"],"names":[],"mappings":";;;;;AAAA,gEAA6B;AAI7B,kBAAe,CAAC,EAAC,MAAM,EAAE,OAAO,EAAiB,EAA2B,EAAE;IAC5E,MAAM,EAAC,iBAAiB,EAAE,kBAAkB,EAAE,eAAe,EAAC,GAAG,MAAM,CAAA;IACvE,OAAO;QACL,uBAAuB,EAAE,CAAC,MAAM,GAAG,EAAE,EAAE,OAAsB,EAAE,EAAE,CAC/D,OAAO,CAAC,GAAG,iBAAiB,wBAAwB,EAAE;YACpD,YAAY,EAAE,MAAM;YACpB,OAAO;SACR,CAAC;QACJ,eAAe,EAAE,CAAC,KAA2B,EAAE,EAAE,CAC/C,OAAO,CAAC,GAAG,kBAAkB,qCAAqC,KAAK,IAAI,sBAAE,CAAC,SAAS,CAAC,KAAK,CAAC,EAAE,CAAC;QACnG,kBAAkB,EAAE,CAAC,KAA2B,EAAE,EAAE,CAClD,OAAO,CAAC,GAAG,kBAAkB,qCAAqC,KAAK,IAAI,sBAAE,CAAC,SAAS,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S,CAAC,KAAK,CAAC,EAAE,CAAC;QACnG,qBAAqB,EAAE,CAAC,KAA2B,EAAE,EAAE,CACrD,OAAO,CAAC,GAAG,kBAAkB,wCAAwC,KAAK,IAAI,sBAAE,CAAC,SAAS,CAAC,KAAK,CAAC,EAAE,CAAC;QACtG,mBAAmB,EAAE,CAAC,KAA2B,EAAE,EAAE,CACnD,OAAO,CAAC,GAAG,kBAAkB,sCAAsC,KAAK,IAAI,sBAAE,CAAC,SAAS,CAAC,KAAK,CAAC,EAAE,CAAC;QACpG,uBAAuB,EAAE,CAAC,KAA2B,EAAE,EAAE,CACvD,OAAO,CAAC,GAAG,kBAAkB,0CAA0C,KAAK,IAAI,sBAAE,CAAC,SAAS,CAAC,KAAK,CAAC,EAAE,CAAC;QACxG,mBAAmB,EAAE,CAAC,KAA2B,EAAE,EAAE,CACnD,OAAO,CAAC,GAAG,kBAAkB,sCAAsC,KAAK,IAAI,sBAAE,CAAC,SAAS,CAAC,KAAK,CAAC,EAAE,CAAC;QACpG,eAAe,EAAE,GAAG,EAAE,CAAC,eAAe,EAAE;KACzC,CAAA;AACH,CAAC,CAAA"}
@@ -0,0 +1,21 @@
1
+ /**
2
+ * Standard Financial Statement (Money Advice Service schema).
3
+ * GET /standard-financial-statements/{reportId} response data.
4
+ */
5
+ export interface StandardFinancialStatement {
6
+ id: string;
7
+ createdAt: string;
8
+ version: string;
9
+ currency: string;
10
+ /** Schema version key (e.g. "2.1") – structure defined by Money Advice Service */
11
+ [key: string]: unknown;
12
+ }
13
+ /**
14
+ * Metadata item from GET /standard-financial-statements list.
15
+ */
16
+ export interface StandardFinancialStatementsMetadata {
17
+ id: string;
18
+ status?: string;
19
+ [key: string]: unknown;
20
+ }
21
+ //# sourceMappingURL=standard-financial-statement.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"standard-financial-statement.d.ts","sourceRoot":"","sources":["../../src/schema/standard-financial-statement.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,MAAM,WAAW,0BAA0B;IACzC,EAAE,EAAE,MAAM,CAAA;IACV,SAAS,EAAE,MAAM,CAAA;IACjB,OAAO,EAAE,MAAM,CAAA;IACf,QAAQ,EAAE,MAAM,CAAA;IAEhB,kFAAkF;IAClF,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAA;CACvB;AAED;;GAEG;AACH,MAAM,WAAW,mCAAmC;IAClD,EAAE,EAAE,MAAM,CAAA;IACV,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAA;CACvB"}
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=standard-financial-statement.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"standard-financial-statement.js","sourceRoot":"","sources":["../../src/schema/standard-financial-statement.ts"],"names":[],"mappings":""}
package/package.json CHANGED
@@ -1,12 +1,13 @@
1
1
  {
2
2
  "name": "@mft/moneyhub-api-client",
3
- "version": "6.99.0",
3
+ "version": "6.100.1",
4
4
  "description": "Node.JS client for the Moneyhub API",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
7
7
  "scripts": {
8
8
  "lint": "eslint src/ ",
9
9
  "lint-fix": "eslint src/ --fix",
10
+ "check-secrets": "node scripts/check-secrets.js",
10
11
  "test": "mocha --require ts-node/register --config test/opts/integration.json",
11
12
  "test-ci": "mocha --require ts-node/register --config test/opts/integration-ci.json",
12
13
  "test-caas": "mocha --require ts-node/register --config test/opts/integration-caas.json",
@@ -26,16 +27,16 @@
26
27
  "api",
27
28
  "openid"
28
29
  ],
29
- "author": "Moneyub Financial Technology",
30
+ "author": "Moneyhub Financial Technology",
30
31
  "homepage": "https://github.com/moneyhub/moneyhub-api-client",
31
32
  "repository": "moneyhub/moneyhub-api-client",
32
33
  "license": "ISC",
33
34
  "engines": {
34
- "node": ">= 12.0.0"
35
+ "node": ">= 18.0.0"
35
36
  },
36
37
  "dependencies": {
37
38
  "@isaacs/ttlcache": "^2.1.4",
38
- "form-data": "^3.0.4",
39
+ "form-data": "^3.0.5",
39
40
  "got": "^11.8.5",
40
41
  "jose": "^5.2.3",
41
42
  "openid-client": "^5.6.5",
package/readme.md CHANGED
@@ -26,6 +26,9 @@ This is an Node.JS client for the [Moneyhub API](https://docs.moneyhubenterprise
26
26
  - Get a tax return for a subset of transactions
27
27
  - Get the regular transactions on an account
28
28
  - Get beneficiaries
29
+ - Create reseller check requests and get consent history
30
+ - Standard financial statements
31
+ - Legacy bank connections listing
29
32
  - CAAS (Categorisation as a Service) API for advanced transaction enrichment and categorisation
30
33
 
31
34
  Currently this library supports `client_secret_basic`, `client_secret_jwt` and `private_key_jwt` authentication.
@@ -64,7 +67,7 @@ const {Moneyhub} = require("@mft/moneyhub-api-client")
64
67
 
65
68
  ## Publishing (maintainers)
66
69
 
67
- Official releases are published to npm by **GitHub Actions** when a [GitHub Release](https://github.com/moneyhub/moneyhub-api-client/releases) is published (see `.github/workflows/publish.yml`). Do not rely on publishing from a developer machine.
70
+ Official releases are published to npm by **GitHub Actions** when a [GitHub Release](https://github.com/moneyhub/moneyhub-api-client/releases) is published (see `.github/workflows/publish.yml`). The publish workflow runs lint and build on GitHub-hosted runners. Live integration tests are not part of publish; they run in the private synced repository (allowlisted IPs / secrets). Do not rely on publishing from a developer machine.
68
71
 
69
72
  The `prepublishOnly` lifecycle script runs **`scripts/assert-github-actions-publish.js`** before the build. It exits with an error unless `GITHUB_ACTIONS` is set (as it is in GitHub Actions), so a normal local `npm publish` is blocked. That reduces accidental publishes; it is **not** a security boundary on its own—npm access control and trusted publishing still matter.
70
73
 
@@ -74,9 +77,10 @@ To bypass the check in a **documented emergency** only, you can run `npm publish
74
77
 
75
78
  To use this API client you will need:
76
79
 
80
+ - Node.js >= 18.0.0
77
81
  - A `client_id`, `client_secret` and `redirect_uri` of a registered API client
78
82
  - The url of the Moneyhub identity service for the environment you are connecting to (https://identity.moneyhub.co.uk)
79
- - The url for the API gateway for the environment that you are connecting to (https://api.moneyhub.co.uk/v2.0)
83
+ - The url for the API gateway for the environment that you are connecting to (https://api.moneyhub.co.uk/v3)
80
84
 
81
85
  ## To install
82
86
 
@@ -257,6 +261,8 @@ The `expirationDateTime` and `transactionFromDateTime` options can be set accord
257
261
 
258
262
  Set `enableAsync` to true if you wish to make an AIS connection that won't wait for accounts and transactions to be fetched.
259
263
 
264
+ Set `accVerification` to true to add the `mh:account_verification` claim. This is independent of `enableAsync`.
265
+
260
266
  **Note:** all methods generate an authorise URL using the Pushed Authorisation Request (PAR) method, see [here](https://docs.moneyhubenterprise.com/docs/pushed-authorisation-requests-par) for more details.
261
267
 
262
268
  #### `getAuthorizeUrl`
@@ -280,6 +286,7 @@ const url = await moneyhub.getAuthorizeUrl({
280
286
  expirationDateTime: "2022-09-01T00:00:00.000Z", // optional
281
287
  transactionFromDateTime: "2020-09-01T00:00:00.000Z", // optional,
282
288
  enableAsync: false, // optional
289
+ accVerification: false, // optional - adds mh:account_verification independently of enableAsync
283
290
  });
284
291
 
285
292
  // Default claims if none are provided
@@ -399,24 +406,6 @@ const defaultClaims = {
399
406
 
400
407
  #### `getRefreshAuthorizeUrlForCreatedUser`
401
408
 
402
- #### `getAuthorizeUrlLegacy`
403
-
404
- This method returns an authorize url for your API client using the legacy method (where a request object is generated and passed in as the `request` query parameter). You can redirect a user to this url, after which they will be redirected back to your `redirect_uri`. It has the same method signature as `getAuthorizeUrl`
405
-
406
- ```javascript
407
- const url = await moneyhub.getAuthorizeUrlLegacy({
408
- scope: "openid bank-id-scope other-data-scopes",
409
- state: " your state value", // optional
410
- nonce: "your nonce value", //optional
411
- claims: claimsObject, // optional
412
- permissions: ["ReadBeneficiariesDetail"], // optional - set of extra permissions to set for auth URL
413
- permissionsAction: "replace" // optional - replace default consent permissions. Defaults to "add"
414
- expirationDateTime: "2022-09-01T00:00:00.000Z", // optional
415
- transactionFromDateTime: "2020-09-01T00:00:00.000Z", // optional,
416
- enableAsync: false, // optional
417
- });
418
- ```
419
-
420
409
  This is a helper function that returns an authorize url for a specific user to refresh an existing connection. This function uses the scope `openid refresh`. (Only relevant for legacy connections)
421
410
 
422
411
  ```javascript
@@ -444,6 +433,24 @@ const defaultClaims = {
444
433
  };
445
434
  ```
446
435
 
436
+ #### `getAuthorizeUrlLegacy`
437
+
438
+ This method returns an authorize url for your API client using the legacy method (where a request object is generated and passed in as the `request` query parameter). You can redirect a user to this url, after which they will be redirected back to your `redirect_uri`. It has the same method signature as `getAuthorizeUrl`
439
+
440
+ ```javascript
441
+ const url = await moneyhub.getAuthorizeUrlLegacy({
442
+ scope: "openid bank-id-scope other-data-scopes",
443
+ state: " your state value", // optional
444
+ nonce: "your nonce value", //optional
445
+ claims: claimsObject, // optional
446
+ permissions: ["ReadBeneficiariesDetail"], // optional - set of extra permissions to set for auth URL
447
+ permissionsAction: "replace" // optional - replace default consent permissions. Defaults to "add"
448
+ expirationDateTime: "2022-09-01T00:00:00.000Z", // optional
449
+ transactionFromDateTime: "2020-09-01T00:00:00.000Z", // optional,
450
+ enableAsync: false, // optional
451
+ });
452
+ ```
453
+
447
454
  #### `exchangeCodeForTokensLegacy`
448
455
 
449
456
  This is a legacy method to get tokens for a user.
@@ -850,7 +857,7 @@ Similar to getAccounts method, however this method does not return `transactionD
850
857
 
851
858
  ```javascript
852
859
  const queryParams = { limit: 10, offset: 5 , showTransacionData: false, showPerformanceScore: true};
853
- const accounts = await moneyhub.getAccounts({
860
+ const accounts = await moneyhub.getAccountsList({
854
861
  userId: "userId",
855
862
  params: queryParams,
856
863
  }, options);
@@ -862,7 +869,7 @@ Similar to getAccountsWithDetails method, however this method does not return `t
862
869
 
863
870
  ```javascript
864
871
  const queryParams = { limit: 10, offset: 5 };
865
- const accounts = await moneyhub.getAccountsWithDetails({
872
+ const accounts = await moneyhub.getAccountsListWithDetails({
866
873
  userId: "userId",
867
874
  params: queryParams,
868
875
  }, options);
@@ -1004,6 +1011,28 @@ const statements = await moneyhub.getAccountStatementsWithDetail({
1004
1011
  }, options);
1005
1012
  ```
1006
1013
 
1014
+ #### `getStandardFinancialStatements`
1015
+
1016
+ List standard financial statement reports for a user (Money Advice Service schema metadata). Uses the scope `standard_financial_statement:read`.
1017
+
1018
+ ```javascript
1019
+ const statements = await moneyhub.getStandardFinancialStatements({
1020
+ userId: "userId",
1021
+ params: {limit: 10, offset: 0},
1022
+ }, options);
1023
+ ```
1024
+
1025
+ #### `getStandardFinancialStatement`
1026
+
1027
+ Get a single standard financial statement report by id. Uses the scope `standard_financial_statement:read`.
1028
+
1029
+ ```javascript
1030
+ const statement = await moneyhub.getStandardFinancialStatement({
1031
+ userId: "userId",
1032
+ reportId: "reportId",
1033
+ }, options);
1034
+ ```
1035
+
1007
1036
  #### `createAccount`
1008
1037
 
1009
1038
  Create a manual account for a user. This function uses the scopes `accounts:read accounts:write:all`
@@ -1353,11 +1382,9 @@ const accounts = await moneyhub.getOsipAccounts({
1353
1382
  Get an account for a user. This function uses the scope `osip:read`.
1354
1383
 
1355
1384
  ```javascript
1356
- const queryParams = { limit: 10, offset: 5 };
1357
- const accounts = await moneyhub.getOsipAccounts({
1385
+ const account = await moneyhub.getOsipAccount({
1358
1386
  userId: "userId",
1359
1387
  accountId: "accountId",
1360
- params: queryParams,
1361
1388
  });
1362
1389
  ```
1363
1390
 
@@ -1367,7 +1394,7 @@ Get account holdings for an account. This function uses the scope `osip:read`.
1367
1394
 
1368
1395
  ```javascript
1369
1396
  const queryParams = { limit: 10, offset: 5 };
1370
- const accounts = await moneyhub.getOsipAccounts({
1397
+ const holdings = await moneyhub.getOsipAccountHoldings({
1371
1398
  userId: "userId",
1372
1399
  accountId: "accountId",
1373
1400
  params: queryParams,
@@ -1380,7 +1407,7 @@ Get account transactions. This function uses the scope `osip:read`.
1380
1407
 
1381
1408
  ```javascript
1382
1409
  const queryParams = { limit: 10, offset: 5 };
1383
- const accounts = await moneyhub.getOsipAccounts({
1410
+ const transactions = await moneyhub.getOsipAccountTransactions({
1384
1411
  userId: "userId",
1385
1412
  accountId: "accountId",
1386
1413
  params: queryParams,
@@ -1728,6 +1755,18 @@ const payees = await moneyhub.getPayees({
1728
1755
  });
1729
1756
  ```
1730
1757
 
1758
+ #### `getPayee`
1759
+
1760
+ Get a single registered payee by id. This function uses the scope `payee:read`.
1761
+
1762
+ ```javascript
1763
+ const payee = await moneyhub.getPayee({
1764
+ id: "payee-id",
1765
+ });
1766
+ ```
1767
+
1768
+ Example script: `node examples/payments/get-payee.js -i payee-id`.
1769
+
1731
1770
  #### `getPayments`
1732
1771
 
1733
1772
  This method returns a list of initiated payments. This function uses the scope `payment:read`
@@ -1995,7 +2034,7 @@ const recurringPayment = await moneyhub.getRecurringPayment({
1995
2034
  This method creates a payment using the recurring payment consent. This function uses the scope `recurring_payment:create`
1996
2035
 
1997
2036
  ```javascript
1998
- const recurringPayments = await moneyhub.getRecurringPayments({
2037
+ const recurringPayment = await moneyhub.makeRecurringPayment({
1999
2038
  recurringPaymentId: "Id of the recurring payment consent",
2000
2039
  payment: {
2001
2040
  payeeId: "payee-id", // optional
@@ -2016,6 +2055,22 @@ const revokedRecurringPayment = await moneyhub.revokeRecurringPayment({
2016
2055
  });
2017
2056
  ```
2018
2057
 
2058
+ #### `confirmFundsForRecurringPayment`
2059
+
2060
+ Confirm that funds are available for a payment under an existing recurring payment consent. This function uses the scope `recurring_payment:funds_confirmation`.
2061
+
2062
+ ```javascript
2063
+ const fundsConfirmation = await moneyhub.confirmFundsForRecurringPayment({
2064
+ recurringPaymentId: "Id of the recurring payment consent",
2065
+ fundsConfirmation: {
2066
+ amount: "10.00",
2067
+ currency: "GBP",
2068
+ },
2069
+ });
2070
+ ```
2071
+
2072
+ Example script: `node examples/recurring-payments/confirm-funds.js -i recurring-payment-id -a 10.00`.
2073
+
2019
2074
  #### `getRegularTransactions`
2020
2075
 
2021
2076
  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`
@@ -2221,6 +2276,20 @@ const resellerCheck = await moneyhub.createResellerCheckRequest({
2221
2276
  }, options);
2222
2277
  ```
2223
2278
 
2279
+ #### `getConsentHistory`
2280
+
2281
+ Get consent history for the API client, optionally filtered by user. This function uses the scope `consent_history:read`.
2282
+
2283
+ ```javascript
2284
+ const consentHistory = await moneyhub.getConsentHistory({
2285
+ limit: 10, // optional
2286
+ offset: 0, // optional
2287
+ userId: "user-id", // optional
2288
+ });
2289
+ ```
2290
+
2291
+ Example script: `node examples/consent-history/get-history.js -u user-id`.
2292
+
2224
2293
  ### CAAS API
2225
2294
 
2226
2295
  The CAAS (Categorisation as a Service) API provides advanced transaction enrichment, categorisation, and management capabilities. All CAAS endpoints use dedicated scopes prefixed with `caas:`.
@@ -2481,6 +2550,14 @@ This method will resolve with a list of all the API connections that a user can
2481
2550
  const availableConnections = await moneyhub.listAPIConnections();
2482
2551
  ```
2483
2552
 
2553
+ #### `listLegacyConnections`
2554
+
2555
+ This method will resolve with a list of legacy connections from Identity (`.well-known/legacy-connections`).
2556
+
2557
+ ```javascript
2558
+ const availableConnections = await moneyhub.listLegacyConnections();
2559
+ ```
2560
+
2484
2561
  #### `listTestConnections`
2485
2562
 
2486
2563
  This method will resolve with a list of all the Test connections that a user can connect to.
@@ -1,10 +1,20 @@
1
1
  #!/usr/bin/env node
2
2
  // prepublishOnly guard; emergency bypass: npm publish --ignore-scripts
3
+ const allowedRepo = "moneyhub/moneyhub-api-client";
4
+
3
5
  if (process.env.GITHUB_ACTIONS !== "true") {
4
6
  console.error(
5
7
  "Publishing this package is restricted to GitHub Actions. " +
6
- "Create a GitHub Release to trigger the publish workflow. " +
8
+ "Create a GitHub Release on moneyhub/moneyhub-api-client to trigger the publish workflow. " +
7
9
  "For a documented emergency bypass, use npm publish --ignore-scripts."
8
10
  );
9
11
  process.exit(1);
10
12
  }
13
+
14
+ if (process.env.GITHUB_REPOSITORY !== allowedRepo) {
15
+ console.error(
16
+ `Publishing this package is restricted to ${allowedRepo}. ` +
17
+ `Current repository: ${process.env.GITHUB_REPOSITORY || "(unset)"}.`
18
+ );
19
+ process.exit(1);
20
+ }
@@ -0,0 +1,66 @@
1
+ #!/usr/bin/env node
2
+ const {execFileSync} = require("child_process")
3
+
4
+ const git = args => execFileSync("git", args, {encoding: "utf8"})
5
+
6
+ const blockedPaths = [
7
+ "examples/config.js",
8
+ ]
9
+
10
+ const secretPatterns = [
11
+ {
12
+ name: "PEM private key",
13
+ regex: /-----BEGIN (?:RSA |EC |OPENSSH |DSA )?PRIVATE KEY-----/,
14
+ },
15
+ {
16
+ name: "JWK private component (\"d\")",
17
+ regex: /"d"\s*:\s*"[A-Za-z0-9_-]{20,}"/,
18
+ },
19
+ {
20
+ name: "Real client_secret value",
21
+ regex: /client_secret"?\s*[:=]\s*"(?!your client secret")[^"]{8,}"/,
22
+ },
23
+ ]
24
+
25
+ const getStagedFiles = () => {
26
+ const output = git(["diff", "--cached", "--name-only", "--diff-filter=ACM", "--no-renames"])
27
+ return output.split("\n").map(line => line.trim()).filter(Boolean)
28
+ }
29
+
30
+ const getStagedContent = file => git(["show", `:${file}`])
31
+
32
+ const scanFile = file => {
33
+ const findings = []
34
+ if (blockedPaths.includes(file)) {
35
+ findings.push(`${file}: file is blocked from being committed (use examples/config.example.js as a template and keep secrets in the git-ignored examples/config.js)`)
36
+ return findings
37
+ }
38
+ let content
39
+ try {
40
+ content = getStagedContent(file)
41
+ } catch (err) {
42
+ findings.push(`${file}: unable to read staged content, cannot verify it is secret-free (${err.message})`)
43
+ return findings
44
+ }
45
+ secretPatterns.forEach(({name, regex}) => {
46
+ if (regex.test(content)) {
47
+ findings.push(`${file}: matched "${name}"`)
48
+ }
49
+ })
50
+ return findings
51
+ }
52
+
53
+ const main = () => {
54
+ const files = getStagedFiles()
55
+ const findings = files.flatMap(scanFile)
56
+ if (findings.length === 0) {
57
+ process.exit(0)
58
+ }
59
+ console.error("\nCommit blocked: potential secrets detected in staged changes\n")
60
+ findings.forEach(finding => console.error(` - ${finding}`))
61
+ console.error("\nRemove the secrets, unstage the file, and commit again.")
62
+ console.error("If this is a false positive, review the staged content before bypassing.\n")
63
+ process.exit(1)
64
+ }
65
+
66
+ main()
@@ -1,21 +0,0 @@
1
- <component name="ProjectCodeStyleConfiguration">
2
- <code_scheme name="Project" version="173">
3
- <JSCodeStyleSettings version="0">
4
- <option name="USE_SEMICOLON_AFTER_STATEMENT" value="false" />
5
- <option name="FORCE_SEMICOLON_STYLE" value="true" />
6
- <option name="SPACE_BEFORE_FUNCTION_LEFT_PARENTH" value="false" />
7
- <option name="FORCE_QUOTE_STYlE" value="true" />
8
- </JSCodeStyleSettings>
9
- <codeStyleSettings language="JavaScript">
10
- <option name="BLOCK_COMMENT_ADD_SPACE" value="true" />
11
- <option name="KEEP_BLANK_LINES_IN_CODE" value="3" />
12
- <option name="INDENT_CASE_FROM_SWITCH" value="false" />
13
- <option name="ALIGN_MULTILINE_PARAMETERS" value="false" />
14
- <option name="ALIGN_MULTILINE_FOR" value="false" />
15
- <indentOptions>
16
- <option name="INDENT_SIZE" value="2" />
17
- <option name="CONTINUATION_INDENT_SIZE" value="2" />
18
- </indentOptions>
19
- </codeStyleSettings>
20
- </code_scheme>
21
- </component>
@@ -1,5 +0,0 @@
1
- <component name="ProjectCodeStyleConfiguration">
2
- <state>
3
- <option name="USE_PER_PROJECT_SETTINGS" value="true" />
4
- </state>
5
- </component>