account-lookup-service 17.0.3 → 17.2.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.
Files changed (122) hide show
  1. package/.circleci/config.yml +2 -1
  2. package/CHANGELOG.md +24 -0
  3. package/docker-compose.yml +8 -2
  4. package/jest.config.js +1 -0
  5. package/migrations/01_currency.js +5 -5
  6. package/migrations/02_endpointType.js +5 -5
  7. package/migrations/03_endpointType-indexes.js +5 -5
  8. package/migrations/04_partyIdType.js +5 -5
  9. package/migrations/05_partyIdType-indexes.js +5 -5
  10. package/migrations/08_oracleEndpoint.js +5 -5
  11. package/migrations/09_oracleEndpoint-indexes.js +5 -5
  12. package/migrations/10_oracleEndpoint-remove-constraints.js +5 -5
  13. package/package.json +17 -16
  14. package/scripts/_wait4_all.js +3 -1
  15. package/seeds/currency.js +5 -5
  16. package/seeds/endpointType.js +4 -4
  17. package/seeds/partyIdType.js +4 -4
  18. package/src/api/endpointcache.js +4 -4
  19. package/src/api/health.js +4 -4
  20. package/src/api/index.js +4 -4
  21. package/src/api/oracles/{ID}.js +31 -6
  22. package/src/api/oracles.js +33 -7
  23. package/src/api/participants/{ID}/error.js +5 -5
  24. package/src/api/participants/{ID}.js +5 -5
  25. package/src/api/participants/{Type}/{ID}/error.js +22 -6
  26. package/src/api/participants/{Type}/{ID}/{SubId}/error.js +5 -5
  27. package/src/api/participants/{Type}/{ID}/{SubId}.js +99 -5
  28. package/src/api/participants/{Type}/{ID}.js +83 -10
  29. package/src/api/participants.js +19 -6
  30. package/src/api/parties/{Type}/{ID}/error.js +20 -6
  31. package/src/api/parties/{Type}/{ID}/{SubId}/error.js +32 -7
  32. package/src/api/parties/{Type}/{ID}/{SubId}.js +55 -7
  33. package/src/api/parties/{Type}/{ID}.js +37 -10
  34. package/src/api/routes.js +5 -5
  35. package/src/domain/oracle/index.js +5 -5
  36. package/src/domain/oracle/oracle.js +11 -45
  37. package/src/domain/participants/index.js +5 -5
  38. package/src/domain/participants/participants.js +20 -59
  39. package/src/domain/parties/getPartiesByTypeAndID.js +9 -14
  40. package/src/domain/parties/index.js +5 -5
  41. package/src/domain/parties/parties.js +12 -23
  42. package/src/domain/timeout/dto.js +14 -2
  43. package/src/domain/timeout/index.js +6 -12
  44. package/src/handlers/TimeoutHandler.js +3 -3
  45. package/src/handlers/index.js +3 -3
  46. package/src/handlers/register.js +3 -3
  47. package/src/index.js +4 -4
  48. package/src/interface/admin-swagger.yaml +4 -0
  49. package/src/interface/admin_swagger.json +902 -900
  50. package/src/interface/api_swagger.json +2824 -2824
  51. package/src/interface/thirdparty/admin-swagger.yaml +2 -2
  52. package/src/interface/thirdparty/admin_swagger.json +902 -902
  53. package/src/interface/thirdparty/api_swagger.json +2917 -2917
  54. package/src/lib/argv.js +5 -5
  55. package/src/lib/cache.js +5 -5
  56. package/src/lib/config.js +5 -5
  57. package/src/lib/db.js +5 -5
  58. package/src/lib/headers.js +5 -5
  59. package/src/lib/healthCheck/subServiceHealth.js +5 -5
  60. package/src/lib/util.js +20 -2
  61. package/src/models/currency/currency.js +7 -16
  62. package/src/models/currency/index.js +5 -5
  63. package/src/models/endpointType/endpointType.js +7 -16
  64. package/src/models/endpointType/index.js +5 -5
  65. package/src/models/misc/migrationLock.js +5 -5
  66. package/src/models/oracle/facade.js +5 -5
  67. package/src/models/oracle/index.js +5 -5
  68. package/src/models/oracle/oracleEndpoint.js +17 -71
  69. package/src/models/oracle/oracleEndpointCached.js +5 -5
  70. package/src/models/participantEndpoint/facade.js +5 -5
  71. package/src/models/partyIdType/index.js +5 -5
  72. package/src/models/partyIdType/partyIdType.js +7 -16
  73. package/src/plugins.js +4 -4
  74. package/src/server.js +8 -12
  75. package/test/integration/api/parties.test.js +5 -5
  76. package/test/integration/domain/oracle/index.test.js +23 -5
  77. package/test/integration/domain/timeout/index.test.js +1 -1
  78. package/test/integration/models/currency/currency.test.js +5 -5
  79. package/test/integration/plugins.test.js +5 -5
  80. package/test/unit/api/health.test.js +5 -5
  81. package/test/unit/api/oracles/{ID}.test.js +5 -5
  82. package/test/unit/api/oracles.test.js +5 -5
  83. package/test/unit/api/participants/participants.test.js +5 -5
  84. package/test/unit/api/participants/{Type}/{ID}/error.test.js +7 -5
  85. package/test/unit/api/participants/{Type}/{ID}/{SubId}/error.test.js +5 -5
  86. package/test/unit/api/participants/{Type}/{ID}/{SubId}.test.js +5 -5
  87. package/test/unit/api/participants/{Type}/{ID}.test.js +5 -5
  88. package/test/unit/api/participants.test.js +5 -5
  89. package/test/unit/api/parties/endpointcache.test.js +5 -5
  90. package/test/unit/api/parties/parties.test.js +5 -5
  91. package/test/unit/api/parties/{Type}/{ID}/error.test.js +8 -6
  92. package/test/unit/api/parties/{Type}/{ID}/{SubId}/error.test.js +15 -5
  93. package/test/unit/api/parties/{Type}/{ID}/{SubId}.test.js +5 -5
  94. package/test/unit/api/parties/{Type}/{ID}.test.js +5 -5
  95. package/test/unit/domain/oracle/oracle.test.js +5 -5
  96. package/test/unit/domain/participants/participants.test.js +6 -6
  97. package/test/unit/domain/parties/parties.test.js +8 -8
  98. package/test/unit/domain/parties/utils.test.js +5 -5
  99. package/test/unit/domain/timeout/index.test.js +3 -3
  100. package/test/unit/handlers/TimeoutHandler.test.js +3 -3
  101. package/test/unit/handlers/index.test.js +3 -3
  102. package/test/unit/handlers/register.test.js +3 -3
  103. package/test/unit/index.test.js +5 -5
  104. package/test/unit/iso20022/partiesValidation.test.js +5 -5
  105. package/test/unit/lib/argv.test.js +5 -5
  106. package/test/unit/lib/config.test.js +5 -5
  107. package/test/unit/lib/healthCheck/subServiceHealth.test.js +5 -5
  108. package/test/unit/lib/migrator.test.js +5 -5
  109. package/test/unit/lib/util.test.js +5 -5
  110. package/test/unit/mocks.js +3 -3
  111. package/test/unit/models/currency/currency.test.js +5 -5
  112. package/test/unit/models/endpointType/endpointType.test.js +5 -5
  113. package/test/unit/models/misc/migrationLock.test.js +5 -5
  114. package/test/unit/models/oracle/facade.test.js +5 -5
  115. package/test/unit/models/oracle/oracleEndpoint.test.js +5 -5
  116. package/test/unit/models/oracle/oracleEndpointCached.test.js +5 -5
  117. package/test/unit/models/participantEndpoint/facade.test.js +5 -5
  118. package/test/unit/models/partyIdType/partyIdType.test.js +5 -5
  119. package/test/unit/plugins.test.js +5 -5
  120. package/test/util/helper.js +5 -5
  121. package/test/util/mockgen.js +5 -5
  122. package/test/util/testConfig.js +5 -5
package/src/lib/argv.js CHANGED
@@ -1,8 +1,8 @@
1
1
  /*****
2
2
  License
3
3
  --------------
4
- Copyright © 2017 Bill & Melinda Gates Foundation
5
- The Mojaloop files are made available by the Bill & Melinda Gates Foundation under the Apache License, Version 2.0 (the "License") and you may not use these files except in compliance with the License. You may obtain a copy of the License at
4
+ Copyright © 2020-2025 Mojaloop Foundation
5
+ The Mojaloop files are made available by the 2020-2025 Mojaloop Foundation under the Apache License, Version 2.0 (the "License") and you may not use these files except in compliance with the License. You may obtain a copy of the License at
6
6
  http://www.apache.org/licenses/LICENSE-2.0
7
7
  Unless required by applicable law or agreed to in writing, the Mojaloop files are distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
8
8
  Contributors
@@ -12,11 +12,11 @@
12
12
  should be listed with a '*' in the first column. People who have
13
13
  contributed from an organization can be listed under the organization
14
14
  that actually holds the copyright for their contributions (see the
15
- Gates Foundation organization for an example). Those individuals should have
15
+ Mojaloop Foundation organization for an example). Those individuals should have
16
16
  their names indented and be marked with a '-'. Email address can be added
17
17
  optionally within square brackets <email>.
18
- * Gates Foundation
19
- - Name Surname <name.surname@gatesfoundation.com>
18
+ * Mojaloop Foundation
19
+ - Name Surname <name.surname@mojaloop.io>
20
20
 
21
21
  * Crosslake
22
22
  - Lewis daly <lewisd@crosslaketech.com>
package/src/lib/cache.js CHANGED
@@ -1,8 +1,8 @@
1
1
  /*****
2
2
  License
3
3
  --------------
4
- Copyright © 2017 Bill & Melinda Gates Foundation
5
- The Mojaloop files are made available by the Bill & Melinda Gates Foundation under the Apache License, Version 2.0 (the "License") and you may not use these files except in compliance with the License. You may obtain a copy of the License at
4
+ Copyright © 2020-2025 Mojaloop Foundation
5
+ The Mojaloop files are made available by the 2020-2025 Mojaloop Foundation under the Apache License, Version 2.0 (the "License") and you may not use these files except in compliance with the License. You may obtain a copy of the License at
6
6
  http://www.apache.org/licenses/LICENSE-2.0
7
7
  Unless required by applicable law or agreed to in writing, the Mojaloop files are distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
8
8
  Contributors
@@ -12,11 +12,11 @@
12
12
  should be listed with a '*' in the first column. People who have
13
13
  contributed from an organization can be listed under the organization
14
14
  that actually holds the copyright for their contributions (see the
15
- Gates Foundation organization for an example). Those individuals should have
15
+ Mojaloop Foundation organization for an example). Those individuals should have
16
16
  their names indented and be marked with a '-'. Email address can be added
17
17
  optionally within square brackets <email>.
18
- * Gates Foundation
19
- * Name Surname <name.surname@gatesfoundation.com>
18
+ * Mojaloop Foundation
19
+ * Name Surname <name.surname@mojaloop.io>
20
20
 
21
21
  * Kevin Leyow <kevin.leyow@infitx.com>
22
22
 
package/src/lib/config.js CHANGED
@@ -2,8 +2,8 @@
2
2
  * @file This registers all handlers for the central-ledger API
3
3
  License
4
4
  --------------
5
- Copyright © 2017 Bill & Melinda Gates Foundation
6
- The Mojaloop files are made available by the Bill & Melinda Gates Foundation under the Apache License, Version 2.0 (the "License") and you may not use these files except in compliance with the License. You may obtain a copy of the License at
5
+ Copyright © 2020-2025 Mojaloop Foundation
6
+ The Mojaloop files are made available by the 2020-2025 Mojaloop Foundation under the Apache License, Version 2.0 (the "License") and you may not use these files except in compliance with the License. You may obtain a copy of the License at
7
7
 
8
8
  http://www.apache.org/licenses/LICENSE-2.0
9
9
 
@@ -16,12 +16,12 @@
16
16
  should be listed with a '*' in the first column. People who have
17
17
  contributed from an organization can be listed under the organization
18
18
  that actually holds the copyright for their contributions (see the
19
- Gates Foundation organization for an example). Those individuals should have
19
+ Mojaloop Foundation organization for an example). Those individuals should have
20
20
  their names indented and be marked with a '-'. Email address can be added
21
21
  optionally within square brackets <email>.
22
22
 
23
- * Gates Foundation
24
- - Name Surname <name.surname@gatesfoundation.com>
23
+ * Mojaloop Foundation
24
+ - Name Surname <name.surname@mojaloop.io>
25
25
 
26
26
  * Rajiv Mothilal <rajiv.mothilal@modusbox.com>
27
27
 
package/src/lib/db.js CHANGED
@@ -1,8 +1,8 @@
1
1
  /*****
2
2
  License
3
3
  --------------
4
- Copyright © 2017 Bill & Melinda Gates Foundation
5
- The Mojaloop files are made available by the Bill & Melinda Gates Foundation under the Apache License, Version 2.0 (the "License") and you may not use these files except in compliance with the License. You may obtain a copy of the License at
4
+ Copyright © 2020-2025 Mojaloop Foundation
5
+ The Mojaloop files are made available by the 2020-2025 Mojaloop Foundation under the Apache License, Version 2.0 (the "License") and you may not use these files except in compliance with the License. You may obtain a copy of the License at
6
6
  http://www.apache.org/licenses/LICENSE-2.0
7
7
  Unless required by applicable law or agreed to in writing, the Mojaloop files are distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
8
8
  Contributors
@@ -12,11 +12,11 @@
12
12
  should be listed with a '*' in the first column. People who have
13
13
  contributed from an organization can be listed under the organization
14
14
  that actually holds the copyright for their contributions (see the
15
- Gates Foundation organization for an example). Those individuals should have
15
+ Mojaloop Foundation organization for an example). Those individuals should have
16
16
  their names indented and be marked with a '-'. Email address can be added
17
17
  optionally within square brackets <email>.
18
- * Gates Foundation
19
- - Name Surname <name.surname@gatesfoundation.com>
18
+ * Mojaloop Foundation
19
+ - Name Surname <name.surname@mojaloop.io>
20
20
 
21
21
  * Rajiv Mothilal <rajiv.mothilal@modusbox.com>
22
22
  --------------
@@ -1,8 +1,8 @@
1
1
  /*****
2
2
  License
3
3
  --------------
4
- Copyright © 2017 Bill & Melinda Gates Foundation
5
- The Mojaloop files are made available by the Bill & Melinda Gates Foundation under the Apache License, Version 2.0 (the "License") and you may not use these files except in compliance with the License. You may obtain a copy of the License at
4
+ Copyright © 2020-2025 Mojaloop Foundation
5
+ The Mojaloop files are made available by the 2020-2025 Mojaloop Foundation under the Apache License, Version 2.0 (the "License") and you may not use these files except in compliance with the License. You may obtain a copy of the License at
6
6
 
7
7
  http://www.apache.org/licenses/LICENSE-2.0
8
8
 
@@ -15,12 +15,12 @@
15
15
  should be listed with a '*' in the first column. People who have
16
16
  contributed from an organization can be listed under the organization
17
17
  that actually holds the copyright for their contributions (see the
18
- Gates Foundation organization for an example). Those individuals should have
18
+ Mojaloop Foundation organization for an example). Those individuals should have
19
19
  their names indented and be marked with a '-'. Email address can be added
20
20
  optionally within square brackets <email>.
21
21
 
22
- * Gates Foundation
23
- - Name Surname <name.surname@gatesfoundation.com>
22
+ * Mojaloop Foundation
23
+ - Name Surname <name.surname@mojaloop.io>
24
24
 
25
25
  * Steven Oderayi <steven.oderayi@modusbox.com>
26
26
 
@@ -1,8 +1,8 @@
1
1
  /*****
2
2
  License
3
3
  --------------
4
- Copyright © 2017 Bill & Melinda Gates Foundation
5
- The Mojaloop files are made available by the Bill & Melinda Gates Foundation under the Apache License, Version 2.0 (the "License") and you may not use these files except in compliance with the License. You may obtain a copy of the License at
4
+ Copyright © 2020-2025 Mojaloop Foundation
5
+ The Mojaloop files are made available by the 2020-2025 Mojaloop Foundation under the Apache License, Version 2.0 (the "License") and you may not use these files except in compliance with the License. You may obtain a copy of the License at
6
6
  http://www.apache.org/licenses/LICENSE-2.0
7
7
  Unless required by applicable law or agreed to in writing, the Mojaloop files are distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
8
8
  Contributors
@@ -12,11 +12,11 @@
12
12
  should be listed with a '*' in the first column. People who have
13
13
  contributed from an organization can be listed under the organization
14
14
  that actually holds the copyright for their contributions (see the
15
- Gates Foundation organization for an example). Those individuals should have
15
+ Mojaloop Foundation organization for an example). Those individuals should have
16
16
  their names indented and be marked with a '-'. Email address can be added
17
17
  optionally within square brackets <email>.
18
- * Gates Foundation
19
- - Name Surname <name.surname@gatesfoundation.com>
18
+ * Mojaloop Foundation
19
+ - Name Surname <name.surname@mojaloop.io>
20
20
 
21
21
  * Lewis Daly <lewis@vesselstech.com>
22
22
  --------------
package/src/lib/util.js CHANGED
@@ -1,8 +1,9 @@
1
1
  const util = require('util')
2
2
  const Path = require('path')
3
3
  const Enum = require('@mojaloop/central-services-shared').Enum
4
- const { HeaderValidation, Hapi } = require('@mojaloop/central-services-shared').Util
4
+ const { HeaderValidation, Hapi, rethrow } = require('@mojaloop/central-services-shared').Util
5
5
  const Config = require('../lib/config')
6
+ const { logger } = require('./index')
6
7
 
7
8
  const getSpanTags = ({ headers }, transactionType, transactionAction) => {
8
9
  const tags = {
@@ -55,6 +56,20 @@ function getStackOrInspect (err) {
55
56
  return err?.stack || util.inspect(err)
56
57
  }
57
58
 
59
+ const rethrowAndCountFspiopError = (error, options) => {
60
+ options.loggerOverride = logger
61
+ rethrow.rethrowAndCountFspiopError(error, options)
62
+ }
63
+
64
+ const rethrowDatabaseError = (error) => {
65
+ rethrow.rethrowDatabaseError(error, { loggerOverride: logger })
66
+ }
67
+
68
+ const countFspiopError = (error, options) => {
69
+ options.loggerOverride = logger
70
+ rethrow.countFspiopError(error, options)
71
+ }
72
+
58
73
  module.exports = {
59
74
  getSpanTags,
60
75
  pathForInterface,
@@ -62,5 +77,8 @@ module.exports = {
62
77
  hubNameConfig: {
63
78
  hubName: Config.HUB_NAME,
64
79
  hubNameRegex: HeaderValidation.getHubNameRegex(Config.HUB_NAME)
65
- }
80
+ },
81
+ rethrowAndCountFspiopError,
82
+ rethrowDatabaseError,
83
+ countFspiopError
66
84
  }
@@ -1,8 +1,8 @@
1
1
  /*****
2
2
  License
3
3
  --------------
4
- Copyright © 2017 Bill & Melinda Gates Foundation
5
- The Mojaloop files are made available by the Bill & Melinda Gates Foundation under the Apache License, Version 2.0 (the "License") and you may not use these files except in compliance with the License. You may obtain a copy of the License at
4
+ Copyright © 2020-2025 Mojaloop Foundation
5
+ The Mojaloop files are made available by the 2020-2025 Mojaloop Foundation under the Apache License, Version 2.0 (the "License") and you may not use these files except in compliance with the License. You may obtain a copy of the License at
6
6
  http://www.apache.org/licenses/LICENSE-2.0
7
7
  Unless required by applicable law or agreed to in writing, the Mojaloop files are distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
8
8
  Contributors
@@ -12,11 +12,11 @@
12
12
  should be listed with a '*' in the first column. People who have
13
13
  contributed from an organization can be listed under the organization
14
14
  that actually holds the copyright for their contributions (see the
15
- Gates Foundation organization for an example). Those individuals should have
15
+ Mojaloop Foundation organization for an example). Those individuals should have
16
16
  their names indented and be marked with a '-'. Email address can be added
17
17
  optionally within square brackets <email>.
18
- * Gates Foundation
19
- - Name Surname <name.surname@gatesfoundation.com>
18
+ * Mojaloop Foundation
19
+ - Name Surname <name.surname@mojaloop.io>
20
20
 
21
21
  * Rajiv Mothilal <rajiv.mothilal@modusbox.com>
22
22
 
@@ -26,7 +26,7 @@
26
26
  'use strict'
27
27
 
28
28
  const Db = require('../../lib/db')
29
- const ErrorHandler = require('@mojaloop/central-services-error-handling')
29
+ const util = require('../../lib/util')
30
30
 
31
31
  /**
32
32
  * @function getCurrencyById
@@ -39,16 +39,7 @@ const getCurrencyById = async (currencyId) => {
39
39
  try {
40
40
  return Db.from('currency').findOne({ currencyId, isActive: true })
41
41
  } catch (err) {
42
- const extensions = [{
43
- key: 'system',
44
- value: '["db"]'
45
- }]
46
- throw ErrorHandler.Factory.reformatFSPIOPError(
47
- err,
48
- undefined,
49
- undefined,
50
- extensions
51
- )
42
+ util.rethrowDatabaseError(err)
52
43
  }
53
44
  }
54
45
 
@@ -1,8 +1,8 @@
1
1
  /*****
2
2
  License
3
3
  --------------
4
- Copyright © 2017 Bill & Melinda Gates Foundation
5
- The Mojaloop files are made available by the Bill & Melinda Gates Foundation under the Apache License, Version 2.0 (the "License") and you may not use these files except in compliance with the License. You may obtain a copy of the License at
4
+ Copyright © 2020-2025 Mojaloop Foundation
5
+ The Mojaloop files are made available by the 2020-2025 Mojaloop Foundation under the Apache License, Version 2.0 (the "License") and you may not use these files except in compliance with the License. You may obtain a copy of the License at
6
6
  http://www.apache.org/licenses/LICENSE-2.0
7
7
  Unless required by applicable law or agreed to in writing, the Mojaloop files are distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
8
8
  Contributors
@@ -12,11 +12,11 @@
12
12
  should be listed with a '*' in the first column. People who have
13
13
  contributed from an organization can be listed under the organization
14
14
  that actually holds the copyright for their contributions (see the
15
- Gates Foundation organization for an example). Those individuals should have
15
+ Mojaloop Foundation organization for an example). Those individuals should have
16
16
  their names indented and be marked with a '-'. Email address can be added
17
17
  optionally within square brackets <email>.
18
- * Gates Foundation
19
- - Name Surname <name.surname@gatesfoundation.com>
18
+ * Mojaloop Foundation
19
+ - Name Surname <name.surname@mojaloop.io>
20
20
 
21
21
  - Rajiv Mothilal <rajiv.mothilal@modusbox.com>
22
22
 
@@ -1,8 +1,8 @@
1
1
  /*****
2
2
  License
3
3
  --------------
4
- Copyright © 2017 Bill & Melinda Gates Foundation
5
- The Mojaloop files are made available by the Bill & Melinda Gates Foundation under the Apache License, Version 2.0 (the "License") and you may not use these files except in compliance with the License. You may obtain a copy of the License at
4
+ Copyright © 2020-2025 Mojaloop Foundation
5
+ The Mojaloop files are made available by the 2020-2025 Mojaloop Foundation under the Apache License, Version 2.0 (the "License") and you may not use these files except in compliance with the License. You may obtain a copy of the License at
6
6
  http://www.apache.org/licenses/LICENSE-2.0
7
7
  Unless required by applicable law or agreed to in writing, the Mojaloop files are distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
8
8
  Contributors
@@ -12,11 +12,11 @@
12
12
  should be listed with a '*' in the first column. People who have
13
13
  contributed from an organization can be listed under the organization
14
14
  that actually holds the copyright for their contributions (see the
15
- Gates Foundation organization for an example). Those individuals should have
15
+ Mojaloop Foundation organization for an example). Those individuals should have
16
16
  their names indented and be marked with a '-'. Email address can be added
17
17
  optionally within square brackets <email>.
18
- * Gates Foundation
19
- - Name Surname <name.surname@gatesfoundation.com>
18
+ * Mojaloop Foundation
19
+ - Name Surname <name.surname@mojaloop.io>
20
20
 
21
21
  * Rajiv Mothilal <rajiv.mothilal@modusbox.com>
22
22
 
@@ -26,7 +26,7 @@
26
26
  'use strict'
27
27
 
28
28
  const Db = require('../../lib/db')
29
- const ErrorHandler = require('@mojaloop/central-services-error-handling')
29
+ const util = require('../../lib/util')
30
30
 
31
31
  /**
32
32
  * @function getEndpointTypeByType
@@ -39,16 +39,7 @@ const getEndpointTypeByType = async (type) => {
39
39
  try {
40
40
  return Db.from('endpointType').findOne({ type, isActive: true })
41
41
  } catch (err) {
42
- const extensions = [{
43
- key: 'system',
44
- value: '["db"]'
45
- }]
46
- throw ErrorHandler.Factory.reformatFSPIOPError(
47
- err,
48
- undefined,
49
- undefined,
50
- extensions
51
- )
42
+ util.rethrowDatabaseError(err)
52
43
  }
53
44
  }
54
45
 
@@ -1,8 +1,8 @@
1
1
  /*****
2
2
  License
3
3
  --------------
4
- Copyright © 2017 Bill & Melinda Gates Foundation
5
- The Mojaloop files are made available by the Bill & Melinda Gates Foundation under the Apache License, Version 2.0 (the "License") and you may not use these files except in compliance with the License. You may obtain a copy of the License at
4
+ Copyright © 2020-2025 Mojaloop Foundation
5
+ The Mojaloop files are made available by the 2020-2025 Mojaloop Foundation under the Apache License, Version 2.0 (the "License") and you may not use these files except in compliance with the License. You may obtain a copy of the License at
6
6
  http://www.apache.org/licenses/LICENSE-2.0
7
7
  Unless required by applicable law or agreed to in writing, the Mojaloop files are distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
8
8
  Contributors
@@ -12,11 +12,11 @@
12
12
  should be listed with a '*' in the first column. People who have
13
13
  contributed from an organization can be listed under the organization
14
14
  that actually holds the copyright for their contributions (see the
15
- Gates Foundation organization for an example). Those individuals should have
15
+ Mojaloop Foundation organization for an example). Those individuals should have
16
16
  their names indented and be marked with a '-'. Email address can be added
17
17
  optionally within square brackets <email>.
18
- * Gates Foundation
19
- - Name Surname <name.surname@gatesfoundation.com>
18
+ * Mojaloop Foundation
19
+ - Name Surname <name.surname@mojaloop.io>
20
20
 
21
21
  - Rajiv Mothilal <rajiv.mothilal@modusbox.com>
22
22
 
@@ -1,8 +1,8 @@
1
1
  /*****
2
2
  License
3
3
  --------------
4
- Copyright © 2017 Bill & Melinda Gates Foundation
5
- The Mojaloop files are made available by the Bill & Melinda Gates Foundation under the Apache License, Version 2.0 (the "License") and you may not use these files except in compliance with the License. You may obtain a copy of the License at
4
+ Copyright © 2020-2025 Mojaloop Foundation
5
+ The Mojaloop files are made available by the 2020-2025 Mojaloop Foundation under the Apache License, Version 2.0 (the "License") and you may not use these files except in compliance with the License. You may obtain a copy of the License at
6
6
  http://www.apache.org/licenses/LICENSE-2.0
7
7
  Unless required by applicable law or agreed to in writing, the Mojaloop files are distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
8
8
  Contributors
@@ -12,11 +12,11 @@
12
12
  should be listed with a '*' in the first column. People who have
13
13
  contributed from an organization can be listed under the organization
14
14
  that actually holds the copyright for their contributions (see the
15
- Gates Foundation organization for an example). Those individuals should have
15
+ Mojaloop Foundation organization for an example). Those individuals should have
16
16
  their names indented and be marked with a '-'. Email address can be added
17
17
  optionally within square brackets <email>.
18
- * Gates Foundation
19
- - Name Surname <name.surname@gatesfoundation.com>
18
+ * Mojaloop Foundation
19
+ - Name Surname <name.surname@mojaloop.io>
20
20
 
21
21
  * Lewis Daly <lewis@vesselstech.com>
22
22
  --------------
@@ -1,8 +1,8 @@
1
1
  /*****
2
2
  License
3
3
  --------------
4
- Copyright © 2017 Bill & Melinda Gates Foundation
5
- The Mojaloop files are made available by the Bill & Melinda Gates Foundation under the Apache License, Version 2.0 (the "License") and you may not use these files except in compliance with the License. You may obtain a copy of the License at
4
+ Copyright © 2020-2025 Mojaloop Foundation
5
+ The Mojaloop files are made available by the 2020-2025 Mojaloop Foundation under the Apache License, Version 2.0 (the "License") and you may not use these files except in compliance with the License. You may obtain a copy of the License at
6
6
  http://www.apache.org/licenses/LICENSE-2.0
7
7
  Unless required by applicable law or agreed to in writing, the Mojaloop files are distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
8
8
  Contributors
@@ -12,11 +12,11 @@
12
12
  should be listed with a '*' in the first column. People who have
13
13
  contributed from an organization can be listed under the organization
14
14
  that actually holds the copyright for their contributions (see the
15
- Gates Foundation organization for an example). Those individuals should have
15
+ Mojaloop Foundation organization for an example). Those individuals should have
16
16
  their names indented and be marked with a '-'. Email address can be added
17
17
  optionally within square brackets <email>.
18
- * Gates Foundation
19
- * Name Surname <name.surname@gatesfoundation.com>
18
+ * Mojaloop Foundation
19
+ * Name Surname <name.surname@mojaloop.io>
20
20
 
21
21
  * Rajiv Mothilal <rajiv.mothilal@modusbox.com>
22
22
  * Steven Oderayi <steven.oderayi@modusbox.com>
@@ -1,8 +1,8 @@
1
1
  /*****
2
2
  License
3
3
  --------------
4
- Copyright © 2017 Bill & Melinda Gates Foundation
5
- The Mojaloop files are made available by the Bill & Melinda Gates Foundation under the Apache License, Version 2.0 (the "License") and you may not use these files except in compliance with the License. You may obtain a copy of the License at
4
+ Copyright © 2020-2025 Mojaloop Foundation
5
+ The Mojaloop files are made available by the 2020-2025 Mojaloop Foundation under the Apache License, Version 2.0 (the "License") and you may not use these files except in compliance with the License. You may obtain a copy of the License at
6
6
  http://www.apache.org/licenses/LICENSE-2.0
7
7
  Unless required by applicable law or agreed to in writing, the Mojaloop files are distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
8
8
  Contributors
@@ -12,11 +12,11 @@
12
12
  should be listed with a '*' in the first column. People who have
13
13
  contributed from an organization can be listed under the organization
14
14
  that actually holds the copyright for their contributions (see the
15
- Gates Foundation organization for an example). Those individuals should have
15
+ Mojaloop Foundation organization for an example). Those individuals should have
16
16
  their names indented and be marked with a '-'. Email address can be added
17
17
  optionally within square brackets <email>.
18
- * Gates Foundation
19
- - Name Surname <name.surname@gatesfoundation.com>
18
+ * Mojaloop Foundation
19
+ - Name Surname <name.surname@mojaloop.io>
20
20
 
21
21
  - Rajiv Mothilal <rajiv.mothilal@modusbox.com>
22
22
 
@@ -1,8 +1,8 @@
1
1
  /*****
2
2
  License
3
3
  --------------
4
- Copyright © 2017 Bill & Melinda Gates Foundation
5
- The Mojaloop files are made available by the Bill & Melinda Gates Foundation under the Apache License, Version 2.0 (the "License") and you may not use these files except in compliance with the License. You may obtain a copy of the License at
4
+ Copyright © 2020-2025 Mojaloop Foundation
5
+ The Mojaloop files are made available by the 2020-2025 Mojaloop Foundation under the Apache License, Version 2.0 (the "License") and you may not use these files except in compliance with the License. You may obtain a copy of the License at
6
6
  http://www.apache.org/licenses/LICENSE-2.0
7
7
  Unless required by applicable law or agreed to in writing, the Mojaloop files are distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
8
8
  Contributors
@@ -12,11 +12,11 @@
12
12
  should be listed with a '*' in the first column. People who have
13
13
  contributed from an organization can be listed under the organization
14
14
  that actually holds the copyright for their contributions (see the
15
- Gates Foundation organization for an example). Those individuals should have
15
+ Mojaloop Foundation organization for an example). Those individuals should have
16
16
  their names indented and be marked with a '-'. Email address can be added
17
17
  optionally within square brackets <email>.
18
- * Gates Foundation
19
- - Name Surname <name.surname@gatesfoundation.com>
18
+ * Mojaloop Foundation
19
+ - Name Surname <name.surname@mojaloop.io>
20
20
 
21
21
  * Rajiv Mothilal <rajiv.mothilal@modusbox.com>
22
22
 
@@ -26,11 +26,7 @@
26
26
  'use strict'
27
27
 
28
28
  const Db = require('../../lib/db')
29
- const ErrorHandler = require('@mojaloop/central-services-error-handling')
30
- const extensions = [{
31
- key: 'system',
32
- value: '["db"]'
33
- }]
29
+ const util = require('../../lib/util')
34
30
 
35
31
  const getOracleEndpointByType = async (type) => {
36
32
  try {
@@ -47,12 +43,7 @@ const getOracleEndpointByType = async (type) => {
47
43
  'pt.name as idType', 'oracleEndpoint.currencyId as currency', 'oracleEndpoint.isDefault')
48
44
  })
49
45
  } catch (err) {
50
- throw ErrorHandler.Factory.reformatFSPIOPError(
51
- err,
52
- undefined,
53
- undefined,
54
- extensions
55
- )
46
+ util.rethrowDatabaseError(err)
56
47
  }
57
48
  }
58
49
 
@@ -73,12 +64,7 @@ const getOracleEndpointByTypeAndCurrency = async (type, currencyId) => {
73
64
  'pt.name as idType', 'oracleEndpoint.currencyId as currency', 'oracleEndpoint.isDefault')
74
65
  })
75
66
  } catch (err) {
76
- throw ErrorHandler.Factory.reformatFSPIOPError(
77
- err,
78
- undefined,
79
- undefined,
80
- extensions
81
- )
67
+ util.rethrowDatabaseError(err)
82
68
  }
83
69
  }
84
70
 
@@ -98,12 +84,7 @@ const getOracleEndpointByCurrency = async (currencyId) => {
98
84
  'pt.name as idType', 'oracleEndpoint.currencyId as currency', 'oracleEndpoint.isDefault')
99
85
  })
100
86
  } catch (err) {
101
- throw ErrorHandler.Factory.reformatFSPIOPError(
102
- err,
103
- undefined,
104
- undefined,
105
- extensions
106
- )
87
+ util.rethrowDatabaseError(err)
107
88
  }
108
89
  }
109
90
 
@@ -123,12 +104,7 @@ const getOracleEndpointById = async (oracleEndpointId) => {
123
104
  'pt.name as idType', 'oracleEndpoint.currencyId as currency', 'oracleEndpoint.isDefault')
124
105
  })
125
106
  } catch (err) {
126
- throw ErrorHandler.Factory.reformatFSPIOPError(
127
- err,
128
- undefined,
129
- undefined,
130
- extensions
131
- )
107
+ util.rethrowDatabaseError(err)
132
108
  }
133
109
  }
134
110
 
@@ -146,12 +122,7 @@ const getAllOracleEndpoint = async () => {
146
122
  'pt.name as idType', 'oracleEndpoint.currencyId as currency', 'oracleEndpoint.isDefault')
147
123
  })
148
124
  } catch (err) {
149
- throw ErrorHandler.Factory.reformatFSPIOPError(
150
- err,
151
- undefined,
152
- undefined,
153
- extensions
154
- )
125
+ util.rethrowDatabaseError(err)
155
126
  }
156
127
  }
157
128
 
@@ -161,7 +132,7 @@ const getAllOracleEndpointsByMatchCondition = async (oracleEndpointModel, partyI
161
132
  return builder.innerJoin('endpointType AS et', 'oracleEndpoint.endpointTypeId', 'et.endpointTypeId')
162
133
  .innerJoin('partyIdType AS pt', 'oracleEndpoint.partyIdTypeId', 'pt.partyIdTypeId')
163
134
  .where({
164
- 'oracleEndpoint.currencyId': oracleEndpointModel.currency,
135
+ 'oracleEndpoint.currencyId': oracleEndpointModel?.currency || null,
165
136
  'et.endpointTypeId': endpointTypeId,
166
137
  'pt.partyIdTypeId': partyIdTypeId,
167
138
  'oracleEndpoint.isActive': 1
@@ -171,12 +142,7 @@ const getAllOracleEndpointsByMatchCondition = async (oracleEndpointModel, partyI
171
142
  'oracleEndpoint.isActive', 'oracleEndpoint.partyIdTypeId', 'oracleEndpoint.endpointTypeId', 'oracleEndpoint.currencyId')
172
143
  })
173
144
  } catch (err) {
174
- throw ErrorHandler.Factory.reformatFSPIOPError(
175
- err,
176
- undefined,
177
- undefined,
178
- extensions
179
- )
145
+ util.rethrowDatabaseError(err)
180
146
  }
181
147
  }
182
148
 
@@ -184,12 +150,7 @@ const createOracleEndpoint = async (oracleEndpointModel) => {
184
150
  try {
185
151
  return await Db.from('oracleEndpoint').insert(oracleEndpointModel)
186
152
  } catch (err) {
187
- throw ErrorHandler.Factory.reformatFSPIOPError(
188
- err,
189
- undefined,
190
- undefined,
191
- extensions
192
- )
153
+ util.rethrowDatabaseError(err)
193
154
  }
194
155
  }
195
156
 
@@ -197,12 +158,7 @@ const updateOracleEndpointById = async (id, oracleEndpointModel) => {
197
158
  try {
198
159
  return await Db.from('oracleEndpoint').update({ oracleEndpointId: id }, oracleEndpointModel)
199
160
  } catch (err) {
200
- throw ErrorHandler.Factory.reformatFSPIOPError(
201
- err,
202
- undefined,
203
- undefined,
204
- extensions
205
- )
161
+ util.rethrowDatabaseError(err)
206
162
  }
207
163
  }
208
164
 
@@ -210,12 +166,7 @@ const setIsActiveOracleEndpoint = async (oracleType, isActive) => {
210
166
  try {
211
167
  return await Db.from('oracleEndpoint').update({ oracleType }, { isActive })
212
168
  } catch (err) {
213
- throw ErrorHandler.Factory.reformatFSPIOPError(
214
- err,
215
- undefined,
216
- undefined,
217
- extensions
218
- )
169
+ util.rethrowDatabaseError(err)
219
170
  }
220
171
  }
221
172
 
@@ -223,12 +174,7 @@ const destroyOracleEndpointById = async (oracleEndpointId) => {
223
174
  try {
224
175
  return await Db.from('oracleEndpoint').update({ oracleEndpointId }, { isActive: false })
225
176
  } catch (err) {
226
- throw ErrorHandler.Factory.reformatFSPIOPError(
227
- err,
228
- undefined,
229
- undefined,
230
- extensions
231
- )
177
+ util.rethrowDatabaseError(err)
232
178
  }
233
179
  }
234
180