@mojaloop/central-ledger 9.2.2 → 15.1.3-snapshot.2

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 (256) hide show
  1. package/.circleci/config.yml +625 -204
  2. package/.env +3 -2
  3. package/.ncurc.yaml +9 -0
  4. package/.nvmrc +1 -1
  5. package/.versionrc +15 -0
  6. package/CHANGELOG.md +353 -0
  7. package/CODEOWNERS +31 -0
  8. package/Dockerfile +20 -14
  9. package/LICENSE.md +4 -4
  10. package/Onboarding.md +0 -7
  11. package/README.md +99 -22
  12. package/audit-resolve.json +136 -1
  13. package/config/default.json +82 -27
  14. package/docker/central-ledger/default.json +68 -21
  15. package/docker/ml-api-adapter/default.json +10 -1
  16. package/docker/wait-for/wait-for-objstore.sh +1 -6
  17. package/docker/wait-for/wait-for.env +1 -1
  18. package/docker-compose.integration.yml +8 -5
  19. package/docker-compose.yml +73 -16
  20. package/migrations/310203_transferParticipant-indexes.js +38 -0
  21. package/migrations/310503_participantLimit-indexes-composite.js +38 -0
  22. package/migrations/{400401_settlementWindowStateChange-indexes.js → 400401_settlmentWindowStateChange-indexes.js} +0 -0
  23. package/migrations/401301_settlementModel-indexes.js +2 -0
  24. package/migrations/500401_quote-hotfix-2719.js +58 -0
  25. package/migrations/500501_feature-fixSubIdRef.js +53 -0
  26. package/migrations/500601_party-2480.js +63 -0
  27. package/migrations/501001_quoteExtension-quote-service-174.js +46 -0
  28. package/migrations/501002_quoteExtension-2522.js +61 -0
  29. package/migrations/800101_feature-fixSubIdRef.js +90 -0
  30. package/migrations/910102_hotfix954.js +4 -1
  31. package/migrations/940100_quotePartyIdInfoExtension.js +52 -0
  32. package/migrations/940101_quotePartyIdInfoExtension-2522.js +64 -0
  33. package/migrations/950100_settlementContentAggregation-decimal184.js +40 -0
  34. package/migrations/950101_transferParticipantStateChange.js +46 -0
  35. package/migrations/950102_settlementModel-adjustPosition.js +42 -0
  36. package/migrations/950103_dropTransferParticipantStateChange.js +47 -0
  37. package/migrations/950104_settlementModel-settlementAccountTypeId.js +79 -0
  38. package/migrations/950106_unique_settlement_model_ledger_account_currency.js +38 -0
  39. package/migrations/950107_settlementWindowContent_foreign_settlementModel.js +60 -0
  40. package/package.json +99 -81
  41. package/scripts/_wait4_all.js +146 -0
  42. package/seeds/amountType.js +4 -6
  43. package/seeds/balanceOfPayments.js +4 -6
  44. package/seeds/bulkProcessingState.js +4 -6
  45. package/seeds/bulkTransferState.js +4 -6
  46. package/seeds/currency.js +4 -6
  47. package/seeds/endpointType.js +128 -7
  48. package/seeds/ledgerAccountType.js +11 -10
  49. package/seeds/ledgerEntryType.js +5 -7
  50. package/seeds/participant.js +4 -6
  51. package/seeds/participantLimitType.js +4 -6
  52. package/seeds/partyIdentifierType.js +4 -6
  53. package/seeds/partyType.js +4 -6
  54. package/seeds/settlementDelay.js +4 -6
  55. package/seeds/settlementGranularity.js +4 -6
  56. package/seeds/settlementInterchange.js +4 -6
  57. package/seeds/settlementState.js +4 -6
  58. package/seeds/settlementWindow1State.js +4 -6
  59. package/seeds/transactionInitiator.js +4 -6
  60. package/seeds/transactionInitiatorType.js +4 -6
  61. package/seeds/transactionScenario.js +4 -6
  62. package/seeds/transferParticipantRoleType.js +4 -6
  63. package/seeds/transferState.js +9 -6
  64. package/src/api/interface/swagger.json +728 -948
  65. package/src/api/ledgerAccountTypes/handler.js +55 -0
  66. package/src/api/ledgerAccountTypes/routes.js +63 -0
  67. package/src/api/metrics/handler.js +2 -2
  68. package/src/api/metrics/routes.js +1 -1
  69. package/src/api/participants/handler.js +43 -35
  70. package/src/api/participants/routes.js +13 -13
  71. package/src/api/root/routes.js +2 -2
  72. package/src/api/settlementModels/handler.js +9 -26
  73. package/src/api/settlementModels/routes.js +4 -4
  74. package/src/api/transactions/handler.js +46 -0
  75. package/src/api/transactions/routes.js +45 -0
  76. package/src/domain/bulkTransfer/index.js +6 -5
  77. package/src/domain/ledgerAccountTypes/index.js +58 -0
  78. package/src/domain/participant/index.js +55 -4
  79. package/src/domain/position/index.js +18 -2
  80. package/src/domain/settlement/index.js +39 -6
  81. package/src/domain/transactions/index.js +61 -0
  82. package/src/domain/transfer/index.js +22 -2
  83. package/src/domain/transfer/transform.js +3 -3
  84. package/src/handlers/admin/handler.js +24 -32
  85. package/src/handlers/bulk/fulfil/handler.js +89 -56
  86. package/src/handlers/bulk/get/handler.js +203 -0
  87. package/src/handlers/bulk/index.js +4 -1
  88. package/src/handlers/bulk/prepare/handler.js +30 -29
  89. package/src/handlers/bulk/processing/handler.js +61 -32
  90. package/src/handlers/bulk/shared/validator.js +13 -1
  91. package/src/handlers/index.js +18 -9
  92. package/src/handlers/positions/handler.js +67 -46
  93. package/src/handlers/register.js +7 -7
  94. package/src/handlers/timeouts/handler.js +9 -4
  95. package/src/handlers/transfers/handler.js +408 -182
  96. package/src/handlers/transfers/validator.js +41 -11
  97. package/src/lib/cache.js +8 -34
  98. package/src/lib/config.js +5 -7
  99. package/src/lib/enum.js +22 -22
  100. package/src/lib/enumCached.js +76 -0
  101. package/src/lib/healthCheck/subServiceHealth.js +2 -2
  102. package/src/lib/requestLogger.js +9 -9
  103. package/src/lib/urlParser.js +1 -1
  104. package/src/models/bulkTransfer/bulkTransfer.js +6 -6
  105. package/src/models/bulkTransfer/bulkTransferAssociation.js +3 -3
  106. package/src/models/bulkTransfer/bulkTransferDuplicateCheck.js +4 -4
  107. package/src/models/bulkTransfer/bulkTransferExtension.js +2 -2
  108. package/src/models/bulkTransfer/bulkTransferFulfilmentDuplicateCheck.js +4 -4
  109. package/src/models/bulkTransfer/bulkTransferStateChange.js +7 -7
  110. package/src/models/bulkTransfer/facade.js +54 -3
  111. package/src/models/bulkTransfer/individualTransfer.js +2 -2
  112. package/src/models/ilpPackets/ilpPacket.js +36 -0
  113. package/src/models/ledgerAccountType/ledgerAccountType.js +139 -3
  114. package/src/models/misc/migrationLock.js +1 -1
  115. package/src/models/misc/segment.js +1 -1
  116. package/src/models/participant/facade.js +226 -76
  117. package/src/models/participant/participant.js +6 -5
  118. package/src/models/participant/participantCached.js +8 -0
  119. package/src/models/participant/participantCurrency.js +7 -7
  120. package/src/models/participant/participantCurrencyCached.js +11 -1
  121. package/src/models/participant/participantLimit.js +13 -13
  122. package/src/models/participant/participantLimitCached.js +124 -0
  123. package/src/models/participant/participantPosition.js +34 -5
  124. package/src/models/participant/participantPositionChange.js +10 -2
  125. package/src/models/position/facade.js +112 -18
  126. package/src/models/position/participantPosition.js +6 -6
  127. package/src/models/settlement/settlementModel.js +92 -17
  128. package/src/models/settlement/settlementModelCached.js +139 -0
  129. package/src/models/transfer/facade.js +97 -32
  130. package/src/models/transfer/ilpPacket.js +4 -4
  131. package/src/models/transfer/transfer.js +7 -7
  132. package/src/models/transfer/transferDuplicateCheck.js +21 -5
  133. package/src/models/transfer/transferError.js +5 -5
  134. package/src/models/transfer/transferErrorDuplicateCheck.js +4 -4
  135. package/src/models/transfer/transferExtension.js +4 -4
  136. package/src/models/transfer/transferFulfilment.js +5 -5
  137. package/src/models/transfer/transferFulfilmentDuplicateCheck.js +4 -4
  138. package/src/models/transfer/transferParticipant.js +3 -3
  139. package/src/models/transfer/transferStateChange.js +11 -11
  140. package/src/models/transfer/transferTimeout.js +5 -5
  141. package/src/schema/bulkTransfer.js +4 -4
  142. package/src/shared/plugins.js +10 -9
  143. package/src/shared/setup.js +69 -46
  144. package/test/integration/domain/participant/index.test.js +2 -0
  145. package/test/integration/handlers/handlers.test.js +605 -166
  146. package/test/integration/handlers/root.test.js +1 -1
  147. package/test/integration/helpers/hubAccounts.js +62 -0
  148. package/test/integration/helpers/ilpPacket.js +1 -1
  149. package/test/integration/helpers/participantFundsInOut.js +80 -0
  150. package/test/integration/helpers/participantLimit.js +6 -1
  151. package/test/integration/helpers/settlementModels.js +88 -0
  152. package/test/integration/helpers/testConsumer.js +163 -0
  153. package/test/integration/helpers/testProducer.js +0 -1
  154. package/test/integration/helpers/transferDuplicateCheck.js +1 -1
  155. package/test/integration/helpers/transferStateChange.js +1 -1
  156. package/test/integration/helpers/transferTestHelper.js +3 -5
  157. package/test/integration/models/transfer/transferStateChange.test.js +6 -0
  158. package/test/unit/api/ledgerAccountTypes/handler.test.js +126 -0
  159. package/test/unit/api/ledgerAccountTypes/routes.test.js +52 -0
  160. package/test/unit/api/participants/handler.test.js +75 -33
  161. package/test/unit/api/root/handler.test.js +1 -1
  162. package/test/unit/api/root/routes.test.js +2 -2
  163. package/test/unit/api/settlementModels/handler.test.js +21 -57
  164. package/test/unit/api/transactions/handler.test.js +108 -0
  165. package/test/unit/api/transactions/routes.test.js +38 -0
  166. package/test/unit/domain/ledgerAccountTypes/index.test.js +197 -0
  167. package/test/unit/domain/participant/index.test.js +115 -2
  168. package/test/unit/domain/settlement/index.test.js +199 -29
  169. package/test/unit/domain/transactions/index.test.js +128 -0
  170. package/test/unit/domain/transfer/index.test.js +1 -0
  171. package/test/unit/domain/transfer/transform.test.js +2 -0
  172. package/test/unit/handlers/admin/handler.test.js +5 -5
  173. package/test/unit/handlers/bulk/get/handler.test.js +401 -0
  174. package/test/unit/handlers/index.test.js +6 -0
  175. package/test/unit/handlers/positions/handler.test.js +26 -0
  176. package/test/unit/handlers/register.test.js +2 -0
  177. package/test/unit/handlers/transfers/handler.test.js +491 -36
  178. package/test/unit/handlers/transfers/validator.test.js +31 -31
  179. package/test/unit/lib/cache.test.js +0 -64
  180. package/test/unit/lib/cachingOfEnums.test.js +121 -0
  181. package/test/unit/lib/config.test.js +34 -0
  182. package/test/unit/lib/enum.test.js +6 -1
  183. package/test/unit/lib/enumCached.test.js +82 -0
  184. package/test/unit/lib/healthCheck/subServiceHealth.test.js +2 -0
  185. package/test/unit/lib/requestLogger.test.js +14 -12
  186. package/test/unit/models/ilpPackets/ilpPacket.test.js +89 -0
  187. package/test/unit/models/ledgerAccountType/ledgerAccountType.test.js +255 -6
  188. package/test/unit/models/misc/migrationLock.test.js +4 -0
  189. package/test/unit/models/misc/segment.test.js +5 -0
  190. package/test/unit/models/participant/facade.test.js +493 -54
  191. package/test/unit/models/participant/participant.test.js +4 -0
  192. package/test/unit/models/participant/participantCurrency.test.js +22 -9
  193. package/test/unit/models/participant/participantCurrencyCached.test.js +1 -1
  194. package/test/unit/models/participant/participantLimit.test.js +97 -0
  195. package/test/unit/models/participant/participantLimitCached.test.js +232 -0
  196. package/test/unit/models/participant/participantPosition.test.js +217 -0
  197. package/test/unit/models/participant/participantPositionChange.test.js +3 -0
  198. package/test/unit/models/position/facade.test.js +318 -29
  199. package/test/unit/models/position/participantPosition.test.js +22 -7
  200. package/test/unit/models/settlement/settlementModel.test.js +18 -37
  201. package/test/unit/models/settlement/settlementModelCached.test.js +171 -0
  202. package/test/unit/models/transfer/facade.test.js +115 -0
  203. package/test/unit/models/transfer/ilpPacket.test.js +28 -11
  204. package/test/unit/models/transfer/transfer.test.js +13 -4
  205. package/test/unit/models/transfer/transferDuplicateCheck.test.js +4 -0
  206. package/test/unit/models/transfer/transferError.test.js +5 -1
  207. package/test/unit/models/transfer/transferErrorDuplicateCheck.test.js +4 -0
  208. package/test/unit/models/transfer/transferExtension.test.js +26 -9
  209. package/test/unit/models/transfer/transferFulfilment.test.js +14 -5
  210. package/test/unit/models/transfer/transferFulfilmentDuplicateCheck.test.js +4 -0
  211. package/test/unit/models/transfer/transferParticipant.test.js +14 -5
  212. package/test/unit/models/transfer/transferStateChange.test.js +3 -0
  213. package/test/unit/models/transfer/transferTimeout.test.js +6 -0
  214. package/test/unit/seeds/amountType.test.js +6 -22
  215. package/test/unit/seeds/balanceOfPayments.test.js +6 -22
  216. package/test/unit/seeds/bulkProcessingState.test.js +84 -0
  217. package/test/unit/{lib/sidecar/nullClient.test.js → seeds/bulkTransferState.test.js} +36 -39
  218. package/test/unit/seeds/currency.test.js +6 -22
  219. package/test/unit/seeds/endpointType.test.js +6 -22
  220. package/test/unit/seeds/ledgerAccountType.test.js +5 -22
  221. package/test/unit/seeds/ledgerEntryType.test.js +6 -22
  222. package/test/unit/seeds/participant.test.js +5 -22
  223. package/test/unit/seeds/participantLimitType.test.js +6 -22
  224. package/test/unit/seeds/partyIdentifierType.test.js +6 -22
  225. package/test/unit/seeds/partyType.test.js +6 -22
  226. package/test/unit/seeds/settlementState.test.js +5 -22
  227. package/test/unit/seeds/settlementWindow1State.test.js +5 -22
  228. package/test/unit/seeds/transactionInitiator.test.js +6 -22
  229. package/test/unit/seeds/transactionInitiatorType.test.js +6 -22
  230. package/test/unit/seeds/transactionScenario.test.js +6 -22
  231. package/test/unit/seeds/transferParticipantRoleType.test.js +6 -22
  232. package/test/unit/seeds/transferState.test.js +6 -22
  233. package/test/unit/shared/plugins.test.js +31 -1
  234. package/test/unit/shared/setup.test.js +25 -36
  235. package/test/util/helpers.js +37 -2
  236. package/test/util/randomTransfers.js +1 -1
  237. package/test/util/scripts/env.sh +6 -5
  238. package/test/util/scripts/populateTestData.sh +204 -181
  239. package/test/util/scripts/populateTestDataForLegacySimulator.sh +261 -0
  240. package/test/util/scripts/restartObjStore.sh +1 -1
  241. package/test-integration.Dockerfile +15 -15
  242. package/test.Dockerfile +12 -12
  243. package/.circleci/_set_up_deploy_envs.sh +0 -47
  244. package/.dockerignore +0 -17
  245. package/.ncurc.json +0 -3
  246. package/server.sh +0 -4
  247. package/sonar-project.properties +0 -17
  248. package/src/lib/sidecar/index.js +0 -47
  249. package/src/lib/sidecar/nullClient.js +0 -18
  250. package/test/.env +0 -8
  251. package/test/integration-config.json +0 -367
  252. package/test/integration-runner.env +0 -31
  253. package/test/integration-runner.sh +0 -264
  254. package/test/spec-runner.sh +0 -132
  255. package/test/unit/lib/sidecar/index.test.js +0 -148
  256. package/test/unit/models/position/participantLimit.test.js +0 -135
@@ -3,7 +3,7 @@
3
3
  "HOSTNAME": "http://central-ledger",
4
4
  "DATABASE": {
5
5
  "DIALECT": "mysql",
6
- "HOST": "localhost",
6
+ "HOST": "mysql",
7
7
  "PORT": 3306,
8
8
  "USER": "central_ledger",
9
9
  "PASSWORD": "password",
@@ -26,13 +26,6 @@
26
26
  "PRECISION": 10,
27
27
  "SCALE": 2
28
28
  },
29
- "SIDECAR": {
30
- "DISABLED": true,
31
- "HOST": "localhost",
32
- "PORT": 5678,
33
- "CONNECT_TIMEOUT": 45000,
34
- "RECONNECT_INTERVAL": 5000
35
- },
36
29
  "MONGODB": {
37
30
  "DISABLED": false,
38
31
  "URI": "mongodb://objstore:27017/mlos"
@@ -46,11 +39,6 @@
46
39
  "API": {
47
40
  "DISABLED": false
48
41
  },
49
- "CRON": {
50
- "DISABLED": false,
51
- "TIMEXP": "*/10 * * * * *",
52
- "TIMEZONE": "UTC"
53
- },
54
42
  "TIMEOUT": {
55
43
  "DISABLED": false,
56
44
  "TIMEXP": "*/15 * * * * *",
@@ -83,6 +71,7 @@
83
71
  ]
84
72
  },
85
73
  "INTERNAL_TRANSFER_VALIDITY_SECONDS": "432000",
74
+ "ENABLE_ON_US_TRANSFERS": false,
86
75
  "CACHE": {
87
76
  "CACHE_ENABLED": false,
88
77
  "MAX_BYTE_SIZE": 10000000,
@@ -117,7 +106,8 @@
117
106
  "client.id": "cl-con-bulk-prepare",
118
107
  "group.id": "cl-group-bulk-prepare",
119
108
  "metadata.broker.list": "kafka:29092",
120
- "socket.keepalive.enable": true
109
+ "socket.keepalive.enable": true,
110
+ "allow.auto.create.topics": true
121
111
  },
122
112
  "topicConf": {
123
113
  "auto.offset.reset": "earliest"
@@ -140,7 +130,8 @@
140
130
  "client.id": "cl-con-bulk-processing",
141
131
  "group.id": "cl-group-bulk-processing",
142
132
  "metadata.broker.list": "kafka:29092",
143
- "socket.keepalive.enable": true
133
+ "socket.keepalive.enable": true,
134
+ "allow.auto.create.topics": true
144
135
  },
145
136
  "topicConf": {
146
137
  "auto.offset.reset": "earliest"
@@ -163,7 +154,32 @@
163
154
  "client.id": "cl-con-bulk-fulfil",
164
155
  "group.id": "cl-group-bulk-fulfil",
165
156
  "metadata.broker.list": "kafka:29092",
166
- "socket.keepalive.enable": true
157
+ "socket.keepalive.enable": true,
158
+ "allow.auto.create.topics": true
159
+ },
160
+ "topicConf": {
161
+ "auto.offset.reset": "earliest"
162
+ }
163
+ }
164
+ },
165
+ "GET": {
166
+ "config": {
167
+ "options": {
168
+ "mode": 2,
169
+ "batchSize": 1,
170
+ "pollFrequency": 10,
171
+ "recursiveTimeout": 100,
172
+ "messageCharset": "utf8",
173
+ "messageAsJSON": true,
174
+ "sync": true,
175
+ "consumeTimeout": 1000
176
+ },
177
+ "rdkafkaConf": {
178
+ "client.id": "cl-con-bulk-get",
179
+ "group.id": "cl-group-bulk-get",
180
+ "metadata.broker.list": "kafka:29092",
181
+ "socket.keepalive.enable": true,
182
+ "allow.auto.create.topics": true
167
183
  },
168
184
  "topicConf": {
169
185
  "auto.offset.reset": "earliest"
@@ -188,7 +204,8 @@
188
204
  "client.id": "cl-con-transfer-prepare",
189
205
  "group.id": "cl-group-transfer-prepare",
190
206
  "metadata.broker.list": "kafka:29092",
191
- "socket.keepalive.enable": true
207
+ "socket.keepalive.enable": true,
208
+ "allow.auto.create.topics": true
192
209
  },
193
210
  "topicConf": {
194
211
  "auto.offset.reset": "earliest"
@@ -211,7 +228,8 @@
211
228
  "client.id": "cl-con-transfer-get",
212
229
  "group.id": "cl-group-transfer-get",
213
230
  "metadata.broker.list": "kafka:29092",
214
- "socket.keepalive.enable": true
231
+ "socket.keepalive.enable": true,
232
+ "allow.auto.create.topics": true
215
233
  },
216
234
  "topicConf": {
217
235
  "auto.offset.reset": "earliest"
@@ -234,7 +252,8 @@
234
252
  "client.id": "cl-con-transfer-fulfil",
235
253
  "group.id": "cl-group-transfer-fulfil",
236
254
  "metadata.broker.list": "kafka:29092",
237
- "socket.keepalive.enable": true
255
+ "socket.keepalive.enable": true,
256
+ "allow.auto.create.topics": true
238
257
  },
239
258
  "topicConf": {
240
259
  "auto.offset.reset": "earliest"
@@ -257,7 +276,8 @@
257
276
  "client.id": "cl-con-transfer-position",
258
277
  "group.id": "cl-group-transfer-position",
259
278
  "metadata.broker.list": "kafka:29092",
260
- "socket.keepalive.enable": true
279
+ "socket.keepalive.enable": true,
280
+ "allow.auto.create.topics": true
261
281
  },
262
282
  "topicConf": {
263
283
  "auto.offset.reset": "earliest"
@@ -282,7 +302,34 @@
282
302
  "client.id": "cl-con-transfer-admin",
283
303
  "group.id": "cl-group-transfer-admin",
284
304
  "metadata.broker.list": "kafka:29092",
285
- "socket.keepalive.enable": true
305
+ "socket.keepalive.enable": true,
306
+ "allow.auto.create.topics": true
307
+ },
308
+ "topicConf": {
309
+ "auto.offset.reset": "earliest"
310
+ }
311
+ }
312
+ }
313
+ },
314
+ "NOTIFICATION": {
315
+ "EVENT": {
316
+ "config": {
317
+ "options": {
318
+ "mode": 2,
319
+ "batchSize": 1,
320
+ "pollFrequency": 10,
321
+ "recursiveTimeout": 100,
322
+ "messageCharset": "utf8",
323
+ "messageAsJSON": true,
324
+ "sync": true,
325
+ "consumeTimeout": 1000
326
+ },
327
+ "rdkafkaConf": {
328
+ "client.id": "TESTONLY",
329
+ "group.id": "TESTONLY",
330
+ "metadata.broker.list": "kafka:29092",
331
+ "socket.keepalive.enable": true,
332
+ "allow.auto.create.topics": true
286
333
  },
287
334
  "topicConf": {
288
335
  "auto.offset.reset": "earliest"
@@ -10,6 +10,11 @@
10
10
  "ENDPOINT_SECURITY": {
11
11
  "TLS": {
12
12
  "rejectUnauthorized": true
13
+ },
14
+ "JWS": {
15
+ "JWS_SIGN": false,
16
+ "FSPIOP_SOURCE_TO_SIGN": "switch",
17
+ "JWS_SIGNING_KEY_PATH": "secrets/jwsSigningKey.key"
13
18
  }
14
19
  },
15
20
  "MAX_CALLBACK_TIME_LAG_DILATION_MILLISECONDS": 200,
@@ -80,7 +85,8 @@
80
85
  "client.id": "ml-con-notification-event",
81
86
  "group.id": "ml-group-notification-event",
82
87
  "metadata.broker.list": "kafka:29092",
83
- "socket.keepalive.enable": true
88
+ "socket.keepalive.enable": true,
89
+ "allow.auto.create.topics": true
84
90
  },
85
91
  "topicConf": {
86
92
  "auto.offset.reset": "earliest"
@@ -102,6 +108,7 @@
102
108
  "event_cb": true,
103
109
  "dr_cb": true,
104
110
  "socket.keepalive.enable": true,
111
+ "allow.auto.create.topics": true,
105
112
  "queue.buffering.max.messages": 10000000
106
113
  },
107
114
  "topicConf": {
@@ -120,6 +127,7 @@
120
127
  "event_cb": true,
121
128
  "dr_cb": true,
122
129
  "socket.keepalive.enable": true,
130
+ "allow.auto.create.topics": true,
123
131
  "queue.buffering.max.messages": 10000000
124
132
  },
125
133
  "topicConf": {
@@ -138,6 +146,7 @@
138
146
  "event_cb": true,
139
147
  "dr_cb": true,
140
148
  "socket.keepalive.enable": true,
149
+ "allow.auto.create.topics": true,
141
150
  "queue.buffering.max.messages": 10000000
142
151
  },
143
152
  "topicConf": {
@@ -4,9 +4,4 @@ echo "** STARTUP - Checking for Object Store connection..."
4
4
 
5
5
  source /opt/wait-for/wait-for.env
6
6
 
7
- apk add --no-cache mongodb
8
-
9
- #sh /opt/wait-for/wait-for.sh objstore:1080 -- echo "** STARTUP - Object Store connection successful!"
10
- until result=$(mongo $WAIT_FOR_DB_OBJSTORE_URI --eval "db.adminCommand('ping')") && eval 'echo is_connected=$result' && if [ -z $result ]; then false; fi && if [ $result -ne 1 ]; then false; fi; do echo waiting for ObjStore; sleep 2; done;
11
-
12
- echo "** STARTUP - Object Store connection successful!"
7
+ sh /opt/wait-for/wait-for.sh $WAIT_FOR_OBJSTORE_SERVER -t 240 -- echo "** STARTUP - Object Store connection successful!"
@@ -5,7 +5,7 @@ WAIT_FOR_DB_PORT=3306
5
5
  WAIT_FOR_DB_USER=central_ledger
6
6
  WAIT_FOR_DB_PASSWORD=password
7
7
  WAIT_FOR_DB_DATABASE=central_ledger
8
- WAIT_FOR_DB_OBJSTORE_URI=mongodb://objstore:27017/mlos
8
+ WAIT_FOR_OBJSTORE_SERVER=objstore:27017
9
9
  WAIT_FOR_DB_KAFKA_BROKER=kafka:29092
10
10
  WAIT_FOR_MOCK_HOST=mockserver
11
11
  WAIT_FOR_MOCK_PORT=1080
@@ -15,13 +15,16 @@ services:
15
15
  ports:
16
16
  - "3001:3001"
17
17
  volumes:
18
- - ./docker/central-ledger/default.json:/opt/central-ledger/config/default.json
19
- - ./test:/opt/central-ledger/test
20
- - ./src:/opt/central-ledger/src
21
- # - ./node_modules:/opt/central-ledger/node_modules
18
+ - ./docker/central-ledger/default.json:/opt/app/config/default.json
19
+ - ./test:/opt/app/test
20
+ - ./src:/opt/app/src
21
+ # - ./node_modules:/opt/app/node_modules
22
22
  environment:
23
- - CLEDG_SIDECAR__DISABLED=true
24
23
  - CLEDG_MONGODB__DISABLED=true
24
+ # Disable audit logs - makes it too verbose
25
+ - EVENT_SDK_LOG_FILTER="log:info, log:warning, log:error"
26
+ - CSL_LOG_TRANSPORT=console
27
+ - LOG_LEVEL=warn
25
28
  command:
26
29
  - tail
27
30
  - -f
@@ -6,6 +6,10 @@ networks:
6
6
 
7
7
  services:
8
8
  central-ledger:
9
+ image: mojaloop/central-ledger:local
10
+ deploy:
11
+ replicas: 1
12
+ user: root
9
13
  build:
10
14
  context: .
11
15
  cache_from:
@@ -19,20 +23,20 @@ services:
19
23
  ports:
20
24
  - "3001:3001"
21
25
  volumes:
22
- - ./docker/central-ledger/default.json:/opt/central-ledger/config/default.json
26
+ - ./docker/central-ledger/default.json:/opt/app/config/default.json
23
27
  - ./docker/wait-for:/opt/wait-for
24
28
  environment:
25
29
  - LOG_LEVEL=info
26
30
  - CSL_LOG_TRANSPORT=file
27
- - CLEDG_SIDECAR__DISABLED=true
28
31
  - CLEDG_MONGODB__DISABLED=false
29
32
  networks:
30
33
  - cl-mojaloop-net
31
34
  depends_on:
32
35
  - mysql
33
36
  - kafka
37
+ - objstore
34
38
  healthcheck:
35
- test: ["CMD", "bash", "-c" ,"apk --no-cache add curl", ";", "curl", "http://localhost:3001/health"]
39
+ test: ["CMD", "sh", "-c" ,"apk --no-cache add curl", "&&", "curl", "http://localhost:3001/health"]
36
40
  timeout: 20s
37
41
  retries: 10
38
42
  interval: 30s
@@ -40,6 +44,9 @@ services:
40
44
  ml-api-adapter:
41
45
  image: mojaloop/ml-api-adapter:latest
42
46
  container_name: cl_ml-api-adapter
47
+ deploy:
48
+ replicas: 1
49
+ user: root
43
50
  command:
44
51
  - "sh"
45
52
  - "-c"
@@ -47,7 +54,7 @@ services:
47
54
  ports:
48
55
  - "3000:3000"
49
56
  volumes:
50
- - ./docker/ml-api-adapter/default.json:/opt/ml-api-adapter/config/default.json
57
+ - ./docker/ml-api-adapter/default.json:/opt/app/config/default.json
51
58
  - ./docker/wait-for:/opt/wait-for
52
59
  environment:
53
60
  - LOG_LEVEL=info
@@ -56,7 +63,7 @@ services:
56
63
  depends_on:
57
64
  - kafka
58
65
  healthcheck:
59
- test: ["CMD", "sh", "-c" ,"apk --no-cache add curl", ";", "curl", "http://localhost:3000/health"]
66
+ test: ["CMD", "sh", "-c" ,"apk --no-cache add curl", "&&", "curl", "http://localhost:3000/health"]
60
67
  timeout: 20s
61
68
  retries: 10
62
69
  interval: 30s
@@ -64,6 +71,8 @@ services:
64
71
  mysql:
65
72
  image: mysql/mysql-server
66
73
  container_name: cl_mysql
74
+ deploy:
75
+ replicas: 1
67
76
  # Disable logging as it is far too verbose for debugging locally
68
77
  logging:
69
78
  driver: none
@@ -89,6 +98,8 @@ services:
89
98
  mockserver:
90
99
  image: jamesdbloom/mockserver
91
100
  container_name: mockserver
101
+ deploy:
102
+ replicas: 1
92
103
  ports:
93
104
  - "1080:1080"
94
105
  networks:
@@ -100,33 +111,56 @@ services:
100
111
  links:
101
112
  - mockserver
102
113
  volumes:
103
- - ./docker/wait-for/wait-for-mockserver.sh:/opt/wait-for/wait-for-mockserver.sh
114
+ - ./docker/wait-for:/opt/wait-for
104
115
  entrypoint: [ "sh", "-c" ]
105
116
  command:
106
- - /opt/wait-for-mockserver.sh
117
+ - /opt/wait-for/wait-for-mockserver.sh
107
118
  environment: []
108
119
  networks:
109
120
  - cl-mojaloop-net
110
121
  depends_on:
111
122
  - mockserver
112
123
 
124
+ zookeeper:
125
+ image: confluentinc/cp-zookeeper:7.0.1
126
+ container_name: cl_zookeeper
127
+ # Disable logging as it is far too verbose for debugging locally
128
+ logging:
129
+ driver: none
130
+ ports:
131
+ - "2181:2181"
132
+ networks:
133
+ - cl-mojaloop-net
134
+ environment:
135
+ ZOOKEEPER_CLIENT_PORT: 2181
136
+ ZOOKEEPER_TICK_TIME: 2000
137
+
113
138
  kafka:
114
- image: johnnypark/kafka-zookeeper:2.3.0
139
+ image: confluentinc/cp-kafka:7.0.1
115
140
  container_name: cl_kafka
116
141
  # Disable logging as it is far too verbose for debugging locally
117
142
  logging:
118
143
  driver: none
119
- volumes:
120
- - ./docker/kafka/:/opt/kafka_2.12-2.3.0/config/
121
144
  ports:
122
- - "2181:2181"
145
+ # To learn about configuring Kafka for access across networks see
146
+ # https://www.confluent.io/blog/kafka-client-cannot-connect-to-broker-on-aws-on-docker-etc/
123
147
  - "9092:9092"
124
- environment:
125
- - ZOO_LOG4J_PROP=WARN
126
148
  networks:
127
149
  - cl-mojaloop-net
150
+ depends_on:
151
+ - zookeeper
152
+ environment:
153
+ KAFKA_BROKER_ID: 1
154
+ KAFKA_ZOOKEEPER_CONNECT: 'zookeeper:2181'
155
+ KAFKA_LISTENERS: LISTENER_DOCKER://kafka:29092,LISTENER_HOST://kafka:9092
156
+ KAFKA_ADVERTISED_LISTENERS: LISTENER_DOCKER://kafka:29092,LISTENER_HOST://localhost:9092
157
+ KAFKA_LISTENER_SECURITY_PROTOCOL_MAP: LISTENER_DOCKER:PLAINTEXT,LISTENER_HOST:PLAINTEXT
158
+ KAFKA_INTER_BROKER_LISTENER_NAME: LISTENER_DOCKER
159
+ KAFKA_OFFSETS_TOPIC_REPLICATION_FACTOR: 1
160
+ KAFKA_TRANSACTION_STATE_LOG_MIN_ISR: 1
161
+ KAFKA_TRANSACTION_STATE_LOG_REPLICATION_FACTOR: 1
128
162
  healthcheck:
129
- test: ["CMD" ,"/opt/kafka_2.12-2.3.0/bin/kafka-broker-api-versions.sh","--bootstrap-server","localhost:9092"]
163
+ test: ["CMD" ,"kafka-broker-api-versions","--bootstrap-server","kafka:29092"]
130
164
  timeout: 20s
131
165
  retries: 10
132
166
  start_period: 40s
@@ -135,6 +169,8 @@ services:
135
169
  objstore:
136
170
  image: mongo:latest
137
171
  container_name: cl_objstore
172
+ deploy:
173
+ replicas: 1
138
174
  # Disable logging as it is far too verbose for debugging locally
139
175
  logging:
140
176
  driver: none
@@ -143,7 +179,7 @@ services:
143
179
  networks:
144
180
  - cl-mojaloop-net
145
181
  healthcheck:
146
- test: mongo localhost:27017/test --quiet 1
182
+ test: mongo --eval 'db.runCommand("ping").ok' localhost:27017/test --quiet
147
183
  interval: 10s
148
184
  timeout: 10s
149
185
  retries: 5
@@ -152,14 +188,19 @@ services:
152
188
  simulator:
153
189
  image: mojaloop/simulator:latest
154
190
  container_name: cl_simulator
191
+ user: root
192
+ deploy:
193
+ replicas: 1
155
194
  ports:
156
195
  - "8444:8444"
157
196
  environment:
158
197
  - LOG_LEVEL=info
159
- - TRANSFERS_ENDPOINT=http://ml-api-adapter:3000
198
+ - TRANSFERS_ENDPOINT=http://host.docker.internal:3000
160
199
  - QUOTES_ENDPOINT=http://host.docker.internal:3002
161
200
  - PARTIES_ENDPOINT=http://host.docker.internal:4002
162
201
  - TRANSFERS_FULFIL_RESPONSE_DISABLED=false
202
+ - TRANSFERS_CONDITION=HOr22-H3AfTDHrSkPjJtVPRdKouuMkDXTR4ejlQa8Ks
203
+ - TRANSFERS_FULFILMENT=XoSz1cL0tljJSCp_VtIYmPNw-zFUgGfbUqf69AagUzY
163
204
  networks:
164
205
  - cl-mojaloop-net
165
206
  healthcheck:
@@ -167,3 +208,19 @@ services:
167
208
  timeout: 20s
168
209
  retries: 10
169
210
  interval: 30s
211
+
212
+ kowl:
213
+ image: quay.io/cloudhut/kowl:v1.4.0
214
+ container_name: cl_kowl
215
+ deploy:
216
+ replicas: 1
217
+ restart: on-failure
218
+ hostname: kowl
219
+ ports:
220
+ - "8080:8080"
221
+ networks:
222
+ - cl-mojaloop-net
223
+ environment:
224
+ - KAFKA_BROKERS=kafka:29092
225
+ depends_on:
226
+ - kafka
@@ -0,0 +1,38 @@
1
+ /*****
2
+ License
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
6
+ http://www.apache.org/licenses/LICENSE-2.0
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
+ Contributors
9
+ --------------
10
+ This is the official list of the Mojaloop project contributors for this file.
11
+ Names of the original copyright holders (individuals or organizations)
12
+ should be listed with a '*' in the first column. People who have
13
+ contributed from an organization can be listed under the organization
14
+ that actually holds the copyright for their contributions (see the
15
+ Gates Foundation organization for an example). Those individuals should have
16
+ their names indented and be marked with a '-'. Email address can be added
17
+ optionally within square brackets <email>.
18
+ * Gates Foundation
19
+ - Name Surname <name.surname@gatesfoundation.com>
20
+
21
+ * ModusBox
22
+ - Georgi Georgiev <georgi.georgiev@modusbox.com>
23
+ --------------
24
+ ******/
25
+
26
+ 'use strict'
27
+
28
+ exports.up = function (knex) {
29
+ return knex.schema.table('transferParticipant', (t) => {
30
+ t.index(['transferId', 'transferParticipantRoleTypeId', 'ledgerEntryTypeId'], 'getTransferInfoToChangePosition')
31
+ })
32
+ }
33
+
34
+ exports.down = function (knex) {
35
+ return knex.schema.table('transferParticipant', (t) => {
36
+ t.dropIndex(['transferId', 'transferParticipantRoleTypeId', 'ledgerEntryTypeId'], 'getTransferInfoToChangePosition')
37
+ })
38
+ }
@@ -0,0 +1,38 @@
1
+ /*****
2
+ License
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
6
+ http://www.apache.org/licenses/LICENSE-2.0
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
+ Contributors
9
+ --------------
10
+ This is the official list of the Mojaloop project contributors for this file.
11
+ Names of the original copyright holders (individuals or organizations)
12
+ should be listed with a '*' in the first column. People who have
13
+ contributed from an organization can be listed under the organization
14
+ that actually holds the copyright for their contributions (see the
15
+ Gates Foundation organization for an example). Those individuals should have
16
+ their names indented and be marked with a '-'. Email address can be added
17
+ optionally within square brackets <email>.
18
+ * Gates Foundation
19
+ - Name Surname <name.surname@gatesfoundation.com>
20
+
21
+ * ModusBox
22
+ - Shashikant Hirugade <shashikant.hirugade@modusbox.com>
23
+ --------------
24
+ ******/
25
+
26
+ 'use strict'
27
+
28
+ exports.up = function (knex) {
29
+ return knex.schema.table('participantLimit', (t) => {
30
+ t.unique(['participantCurrencyId', 'participantLimitTypeId', 'isActive', 'participantLimitId'], 'participantLimit_unique_idx')
31
+ })
32
+ }
33
+
34
+ exports.down = function (knex) {
35
+ return knex.schema.table('participantLimit', (t) => {
36
+ t.dropUnique(['participantCurrencyId', 'participantLimitTypeId', 'isActive', 'participantLimitId'], 'participantLimit_unique_idx')
37
+ })
38
+ }
@@ -29,6 +29,7 @@ exports.up = function (knex, Promise) {
29
29
  return knex.schema.table('settlementModel', (t) => {
30
30
  t.unique('name')
31
31
  t.unique(['settlementGranularityId', 'settlementInterchangeId', 'settlementDelayId', 'ledgerAccountTypeId', 'currencyId'], 'settlementmodel_unique')
32
+ t.unique(['ledgerAccountTypeId', 'currencyId'], 'settlementmodel_uniqueAccountCurrency')
32
33
  t.index('settlementGranularityId')
33
34
  t.index('settlementInterchangeId')
34
35
  t.index('settlementDelayId')
@@ -41,6 +42,7 @@ exports.down = function (knex, Promise) {
41
42
  return knex.schema.table('settlementModel', (t) => {
42
43
  t.dropUnique('name')
43
44
  t.dropUnique(['settlementGranularityId', 'settlementInterchangeId', 'settlementDelayId', 'ledgerAccountTypeId', 'currencyId'], 'settlementmodel_unique')
45
+ t.dropUnique(['ledgerAccountTypeId', 'currencyId'], 'settlementmodel_uniqueAccountCurrency')
44
46
  t.dropIndex('settlementGranularityId')
45
47
  t.dropIndex('settlementInterchangeId')
46
48
  t.dropIndex('settlementDelayId')
@@ -0,0 +1,58 @@
1
+ /*****
2
+ License
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
6
+ http://www.apache.org/licenses/LICENSE-2.0
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
+
9
+ Initial contribution
10
+ --------------------
11
+ The initial functionality and code base was donated by the Mowali project working in conjunction with MTN and Orange as service provides.
12
+ * Project: Mowali
13
+
14
+ Contributors
15
+ --------------
16
+ This is the official list of the Mojaloop project contributors for this file.
17
+ Names of the original copyright holders (individuals or organizations)
18
+ should be listed with a '*' in the first column. People who have
19
+ contributed from an organization can be listed under the organization
20
+ that actually holds the copyright for their contributions (see the
21
+ Gates Foundation organization for an example). Those individuals should have
22
+ their names indented and be marked with a '-'. Email address can be added
23
+ optionally within square brackets <email>.
24
+ * Gates Foundation
25
+ - Name Surname <name.surname@gatesfoundation.com>
26
+
27
+ * ModusBox
28
+ - Miguel de Barros <miguel.debarros@modusbox.com>
29
+ --------------
30
+ ******/
31
+
32
+ // Notes: this is a fix for the following issue: https://github.com/mojaloop/project/issues/2719
33
+
34
+ 'use strict'
35
+
36
+ exports.up = (knex) => {
37
+ return knex.schema.hasTable('quote').then((exists) => {
38
+ if (exists) {
39
+ return knex.schema
40
+ .table('quote', (t) => {
41
+ // remove unnecessary foreign key constraint that has a conflict with transactionReferenceId foreign key constraint
42
+ t.dropForeign('transactionRequestId')
43
+ })
44
+ }
45
+ })
46
+ }
47
+
48
+ exports.down = (knex) => {
49
+ return knex.schema.hasTable('quote').then((exists) => {
50
+ if (exists) {
51
+ return knex.schema
52
+ .table('quote', (t) => {
53
+ // lets reverse what we did
54
+ t.foreign('transactionRequestId').references('transactionReferenceId').inTable('transactionReference')
55
+ })
56
+ }
57
+ })
58
+ }
@@ -0,0 +1,53 @@
1
+ /*****
2
+ License
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
6
+ http://www.apache.org/licenses/LICENSE-2.0
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
+
9
+ Initial contribution
10
+ --------------------
11
+ The initial functionality and code base was donated by the Mowali project working in conjunction with MTN and Orange as service provides.
12
+ * Project: Mowali
13
+
14
+ Contributors
15
+ --------------
16
+ This is the official list of the Mojaloop project contributors for this file.
17
+ Names of the original copyright holders (individuals or organizations)
18
+ should be listed with a '*' in the first column. People who have
19
+ contributed from an organization can be listed under the organization
20
+ that actually holds the copyright for their contributions (see the
21
+ Gates Foundation organization for an example). Those individuals should have
22
+ their names indented and be marked with a '-'. Email address can be added
23
+ optionally within square brackets <email>.
24
+ * Gates Foundation
25
+ - Name Surname <name.surname@gatesfoundation.com>
26
+
27
+ * ModusBox
28
+ - Vijay Kumar Guthi <vijaya.guthi@modusbox.com>
29
+ --------------
30
+ ******/
31
+
32
+ // Notes: these changes are required for the quoting-service and are not used by central-ledger
33
+ 'use strict'
34
+
35
+ exports.up = (knex) => {
36
+ return knex.schema
37
+ .table('quoteParty', (t) => {
38
+ t.dropForeign('partySubIdOrTypeId')
39
+ })
40
+ .alterTable('quoteParty', function(t) {
41
+ t.string('partySubIdOrTypeId', 128).defaultTo(null).nullable().comment('A sub-identifier or sub-type for the Party').alter();
42
+ })
43
+ }
44
+
45
+ exports.down = (knex) => {
46
+ return knex.schema
47
+ .alterTable('quoteParty', function(t) {
48
+ t.integer('partySubIdOrTypeId').unsigned().defaultTo(null).nullable().comment('A sub-identifier or sub-type for the Party').alter();
49
+ })
50
+ .table('quoteParty', (t) => {
51
+ t.foreign('partySubIdOrTypeId').references('partyIdentifierTypeId').inTable('partyIdentifierType')
52
+ })
53
+ }