@mojaloop/central-ledger 17.7.8 → 17.8.0-orb.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 (147) hide show
  1. package/.ncurc.yaml +3 -1
  2. package/.nvmrc +1 -1
  3. package/.nycrc.yml +16 -1
  4. package/Dockerfile +9 -10
  5. package/README.md +39 -9
  6. package/audit-ci.jsonc +15 -2
  7. package/config/default.json +17 -1
  8. package/docker/central-ledger/default.json +9 -0
  9. package/docker/config-modifier/configs/central-ledger.js +25 -0
  10. package/docker/env.sh +15 -0
  11. package/docker/kafka/scripts/provision.sh +4 -1
  12. package/docker/ml-api-adapter/default.json +4 -1
  13. package/docker-compose.yml +90 -2
  14. package/documentation/db/erd-transfer-timeout.png +0 -0
  15. package/documentation/db/erd-transfer-timeout.txt +81 -0
  16. package/documentation/fx-implementation/README.md +48 -0
  17. package/documentation/fx-implementation/assets/fx-position-movements.drawio.svg +4 -0
  18. package/documentation/fx-implementation/assets/test-scenario.drawio.svg +4 -0
  19. package/documentation/sequence-diagrams/Handler - FX timeout.plantuml +123 -0
  20. package/documentation/sequence-diagrams/Handler - FX timeout.png +0 -0
  21. package/documentation/sequence-diagrams/Handler - timeout.plantuml +81 -0
  22. package/documentation/sequence-diagrams/Handler - timeout.png +0 -0
  23. package/documentation/state-diagrams/transfer-ML-spec-states-diagram.png +0 -0
  24. package/documentation/state-diagrams/transfer-internal-states-diagram.png +0 -0
  25. package/documentation/state-diagrams/transfer-internal-states.plantuml +75 -0
  26. package/documentation/state-diagrams/transfer-states.plantuml +13 -0
  27. package/migrations/310204_transferParticipant-participantId.js +52 -0
  28. package/migrations/310403_participantPositionChange-participantCurrencyId.js +47 -0
  29. package/migrations/310404_participantPositionChange-change.js +46 -0
  30. package/migrations/600010_fxTransferType.js +43 -0
  31. package/migrations/600011_fxTransferType-indexes.js +38 -0
  32. package/migrations/600012_fxParticipantCurrencyType.js +43 -0
  33. package/migrations/600013_fxParticipantCurrencyType-indexes.js +38 -0
  34. package/migrations/600100_fxTransferDuplicateCheck.js +42 -0
  35. package/migrations/600110_fxTransferErrorDuplicateCheck.js.js +17 -0
  36. package/migrations/600200_fxTransfer.js +51 -0
  37. package/migrations/600201_fxTransfer-indexes.js +40 -0
  38. package/migrations/600400_fxTransferStateChange.js +46 -0
  39. package/migrations/600401_fxTransferStateChange-indexes.js +40 -0
  40. package/migrations/600501_fxWatchList.js +46 -0
  41. package/migrations/600502_fxWatchList-indexes.js +40 -0
  42. package/migrations/600600_fxTransferFulfilmentDuplicateCheck.js +43 -0
  43. package/migrations/600601_fxTransferFulfilmentDuplicateCheck-indexes.js +38 -0
  44. package/migrations/600700_fxTransferFulfilment.js +47 -0
  45. package/migrations/600701_fxTransferFulfilment-indexes.js +43 -0
  46. package/migrations/600800_fxTransferExtension.js +47 -0
  47. package/migrations/601400_fxTransferTimeout.js +43 -0
  48. package/migrations/601401_fxTransferTimeout-indexes.js +37 -0
  49. package/migrations/601500_fxTransferError.js +44 -0
  50. package/migrations/601501_fxTransferError-indexes.js +37 -0
  51. package/migrations/610200_fxTransferParticipant.js +52 -0
  52. package/migrations/610201_fxTransferParticipant-indexes.js +44 -0
  53. package/migrations/610202_fxTransferParticipant-participantId.js +52 -0
  54. package/migrations/610403_participantPositionChange-fxTransfer.js +46 -0
  55. package/migrations/910101_feature904DataMigration.js +46 -52
  56. package/migrations/910102_feature949DataMigration.js +219 -225
  57. package/migrations/950104_settlementModel-settlementAccountTypeId.js +15 -20
  58. package/migrations/950108_participantProxy.js +18 -0
  59. package/migrations/950109_fxQuote.js +19 -0
  60. package/migrations/950110_fxQuoteResponse.js +25 -0
  61. package/migrations/950111_fxQuoteError.js +23 -0
  62. package/migrations/950113_fxQuoteDuplicateCheck.js +18 -0
  63. package/migrations/950114_fxQuoteResponseDuplicateCheck.js +21 -0
  64. package/migrations/950115_fxQuoteConversionTerms.js +36 -0
  65. package/migrations/950116_fxQuoteConversionTermsExtension.js +21 -0
  66. package/migrations/950117_fxQuoteResponseConversionTerms.js +39 -0
  67. package/migrations/950118_fxQuoteResponseConversionTermsExtension.js +21 -0
  68. package/migrations/950119_fxCharge.js +27 -0
  69. package/migrations/960100_create_externalParticipant.js +47 -0
  70. package/migrations/960110_alter_transferParticipant__addFiled_externalParticipantId.js +50 -0
  71. package/migrations/960111_alter_fxTransferParticipant__addFiled_externalParticipantId.js +50 -0
  72. package/package.json +27 -20
  73. package/seeds/endpointType.js +18 -0
  74. package/seeds/fxParticipantCurrencyType.js +45 -0
  75. package/seeds/fxTransferType.js +45 -0
  76. package/seeds/participant.js +2 -1
  77. package/seeds/transferParticipantRoleType.js +9 -0
  78. package/seeds/transferState.js +10 -0
  79. package/src/api/interface/swagger.json +23 -30
  80. package/src/api/participants/handler.js +6 -2
  81. package/src/api/participants/routes.js +8 -7
  82. package/src/api/root/handler.js +15 -5
  83. package/src/domain/fx/cyril.js +466 -0
  84. package/src/domain/fx/index.js +107 -0
  85. package/src/domain/participant/index.js +108 -1
  86. package/src/domain/position/abort.js +215 -0
  87. package/src/domain/position/binProcessor.js +361 -99
  88. package/src/domain/position/fulfil.js +252 -111
  89. package/src/domain/position/fx-fulfil.js +138 -0
  90. package/src/domain/position/fx-prepare.js +280 -0
  91. package/src/domain/position/fx-timeout-reserved.js +159 -0
  92. package/src/domain/position/index.js +1 -0
  93. package/src/domain/position/prepare.js +69 -49
  94. package/src/domain/position/timeout-reserved.js +162 -0
  95. package/src/domain/timeout/index.js +26 -2
  96. package/src/domain/transfer/index.js +22 -5
  97. package/src/domain/transfer/transform.js +19 -6
  98. package/src/handlers/admin/handler.js +0 -2
  99. package/src/handlers/bulk/fulfil/handler.js +5 -5
  100. package/src/handlers/bulk/get/handler.js +5 -5
  101. package/src/handlers/bulk/prepare/handler.js +9 -9
  102. package/src/handlers/bulk/processing/handler.js +8 -7
  103. package/src/handlers/bulk/shared/validator.js +1 -1
  104. package/src/handlers/positions/handler.js +23 -10
  105. package/src/handlers/positions/handlerBatch.js +54 -26
  106. package/src/handlers/register.js +2 -1
  107. package/src/handlers/timeouts/handler.js +212 -68
  108. package/src/handlers/transfers/FxFulfilService.js +387 -0
  109. package/src/handlers/transfers/createRemittanceEntity.js +106 -0
  110. package/src/handlers/transfers/dto.js +53 -0
  111. package/src/handlers/transfers/handler.js +609 -571
  112. package/src/handlers/transfers/prepare.js +572 -0
  113. package/src/handlers/transfers/validator.js +75 -14
  114. package/src/lib/cache.js +1 -1
  115. package/src/lib/config.js +6 -3
  116. package/src/lib/healthCheck/subServiceHealth.js +12 -2
  117. package/src/lib/proxyCache.js +131 -0
  118. package/src/models/bulkTransfer/facade.js +58 -82
  119. package/src/models/fxTransfer/duplicateCheck.js +153 -0
  120. package/src/models/fxTransfer/fxTransfer.js +578 -0
  121. package/src/models/fxTransfer/fxTransferError.js +53 -0
  122. package/src/models/fxTransfer/fxTransferExtension.js +41 -0
  123. package/src/models/fxTransfer/fxTransferTimeout.js +68 -0
  124. package/src/models/fxTransfer/index.js +15 -0
  125. package/src/models/fxTransfer/stateChange.js +47 -0
  126. package/src/models/fxTransfer/watchList.js +49 -0
  127. package/src/models/ledgerAccountType/ledgerAccountType.js +8 -32
  128. package/src/models/misc/segment.js +0 -1
  129. package/src/models/participant/externalParticipant.js +96 -0
  130. package/src/models/participant/externalParticipantCached.js +148 -0
  131. package/src/models/participant/facade.js +192 -123
  132. package/src/models/participant/participant.js +2 -1
  133. package/src/models/participant/participantCurrency.js +1 -1
  134. package/src/models/participant/participantPosition.js +2 -8
  135. package/src/models/position/batch.js +90 -1
  136. package/src/models/position/facade.js +5 -5
  137. package/src/models/position/participantPositionChanges.js +68 -0
  138. package/src/models/settlement/settlementModel.js +5 -23
  139. package/src/models/transfer/facade.js +806 -447
  140. package/src/shared/constants.js +52 -0
  141. package/src/shared/fspiopErrorFactory.js +131 -0
  142. package/src/shared/logger/index.js +8 -0
  143. package/src/shared/loggingPlugin.js +43 -0
  144. package/src/shared/plugins.js +6 -0
  145. package/src/shared/setup.js +10 -0
  146. package/test-integration.Dockerfile +1 -1
  147. package/test.Dockerfile +1 -1
@@ -0,0 +1,43 @@
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
+ - Vijay Kumar Guthi <vijaya.guthi@infitx.com>
23
+ --------------
24
+ ******/
25
+
26
+ 'use strict'
27
+
28
+ exports.up = async (knex) => {
29
+ return await knex.schema.hasTable('fxTransferType').then(function(exists) {
30
+ if (!exists) {
31
+ return knex.schema.createTable('fxTransferType', (t) => {
32
+ t.increments('fxTransferTypeId').primary().notNullable()
33
+ t.string('name', 50).notNullable()
34
+ t.string('description', 512).defaultTo(null).nullable()
35
+ t.dateTime('createdDate').defaultTo(knex.fn.now()).notNullable()
36
+ })
37
+ }
38
+ })
39
+ }
40
+
41
+ exports.down = function (knex) {
42
+ return knex.schema.dropTableIfExists('fxParticipantCurrencyType')
43
+ }
@@ -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
+ - Vijay Kumar Guthi <vijaya.guthi@infitx.com>
23
+ --------------
24
+ ******/
25
+
26
+ 'use strict'
27
+
28
+ exports.up = function (knex) {
29
+ return knex.schema.table('fxTransferType', (t) => {
30
+ t.unique('name')
31
+ })
32
+ }
33
+
34
+ exports.down = function (knex) {
35
+ return knex.schema.table('fxTransferType', (t) => {
36
+ t.dropUnique('name')
37
+ })
38
+ }
@@ -0,0 +1,43 @@
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
+ - Vijay Kumar Guthi <vijaya.guthi@infitx.com>
23
+ --------------
24
+ ******/
25
+
26
+ 'use strict'
27
+
28
+ exports.up = async (knex) => {
29
+ return await knex.schema.hasTable('fxParticipantCurrencyType').then(function(exists) {
30
+ if (!exists) {
31
+ return knex.schema.createTable('fxParticipantCurrencyType', (t) => {
32
+ t.increments('fxParticipantCurrencyTypeId').primary().notNullable()
33
+ t.string('name', 50).notNullable()
34
+ t.string('description', 512).defaultTo(null).nullable()
35
+ t.dateTime('createdDate').defaultTo(knex.fn.now()).notNullable()
36
+ })
37
+ }
38
+ })
39
+ }
40
+
41
+ exports.down = function (knex) {
42
+ return knex.schema.dropTableIfExists('fxParticipantCurrencyType')
43
+ }
@@ -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
+ - Vijay Kumar Guthi <vijaya.guthi@infitx.com>
23
+ --------------
24
+ ******/
25
+
26
+ 'use strict'
27
+
28
+ exports.up = function (knex) {
29
+ return knex.schema.table('fxParticipantCurrencyType', (t) => {
30
+ t.unique('name')
31
+ })
32
+ }
33
+
34
+ exports.down = function (knex) {
35
+ return knex.schema.table('fxParticipantCurrencyType', (t) => {
36
+ t.dropUnique('name')
37
+ })
38
+ }
@@ -0,0 +1,42 @@
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
+ * INFITX
22
+ - Vijay Kumar Guthi <vijaya.guthi@infitx.com>
23
+ --------------
24
+ ******/
25
+
26
+ 'use strict'
27
+
28
+ exports.up = async (knex) => {
29
+ return await knex.schema.hasTable('fxTransferDuplicateCheck').then(function(exists) {
30
+ if (!exists) {
31
+ return knex.schema.createTable('fxTransferDuplicateCheck', (t) => {
32
+ t.string('commitRequestId', 36).primary().notNullable()
33
+ t.string('hash', 256).notNullable()
34
+ t.dateTime('createdDate').defaultTo(knex.fn.now()).notNullable()
35
+ })
36
+ }
37
+ })
38
+ }
39
+
40
+ exports.down = function (knex) {
41
+ return knex.schema.dropTableIfExists('fxTransferDuplicateCheck')
42
+ }
@@ -0,0 +1,17 @@
1
+ 'use strict'
2
+
3
+ exports.up = async (knex) => {
4
+ return await knex.schema.hasTable('fxTransferErrorDuplicateCheck').then(function(exists) {
5
+ if (!exists) {
6
+ return knex.schema.createTable('fxTransferErrorDuplicateCheck', (t) => {
7
+ t.string('commitRequestId', 36).primary().notNullable()
8
+ t.string('hash', 256).notNullable()
9
+ t.dateTime('createdDate').defaultTo(knex.fn.now()).notNullable()
10
+ })
11
+ }
12
+ })
13
+ }
14
+
15
+ exports.down = function (knex) {
16
+ return knex.schema.dropTableIfExists('fxTransferErrorDuplicateCheck')
17
+ }
@@ -0,0 +1,51 @@
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
+ * INFITX
22
+ - Vijay Kumar Guthi <vijaya.guthi@infitx.com>
23
+ --------------
24
+ ******/
25
+
26
+ 'use strict'
27
+
28
+ exports.up = async (knex) => {
29
+ return await knex.schema.hasTable('fxTransfer').then(function(exists) {
30
+ if (!exists) {
31
+ return knex.schema.createTable('fxTransfer', (t) => {
32
+ t.string('commitRequestId', 36).primary().notNullable()
33
+ t.foreign('commitRequestId').references('commitRequestId').inTable('fxTransferDuplicateCheck')
34
+ t.string('determiningTransferId', 36).defaultTo(null).nullable()
35
+ t.decimal('sourceAmount', 18, 4).notNullable()
36
+ t.decimal('targetAmount', 18, 4).notNullable()
37
+ t.string('sourceCurrency', 3).notNullable()
38
+ t.foreign('sourceCurrency').references('currencyId').inTable('currency')
39
+ t.string('targetCurrency', 3).notNullable()
40
+ t.foreign('targetCurrency').references('currencyId').inTable('currency')
41
+ t.string('ilpCondition', 256).notNullable()
42
+ t.dateTime('expirationDate').notNullable()
43
+ t.dateTime('createdDate').defaultTo(knex.fn.now()).notNullable()
44
+ })
45
+ }
46
+ })
47
+ }
48
+
49
+ exports.down = function (knex) {
50
+ return knex.schema.dropTableIfExists('fxTransfer')
51
+ }
@@ -0,0 +1,40 @@
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
+ * INFITX
22
+ - Vijay Kumar Guthi <vijaya.guthi@infitx.com>
23
+ --------------
24
+ ******/
25
+
26
+ 'use strict'
27
+
28
+ exports.up = function (knex) {
29
+ return knex.schema.table('fxTransfer', (t) => {
30
+ t.index('sourceCurrency')
31
+ t.index('targetCurrency')
32
+ })
33
+ }
34
+
35
+ exports.down = function (knex) {
36
+ return knex.schema.table('fxTransfer', (t) => {
37
+ t.dropIndex('sourceCurrency')
38
+ t.dropIndex('targetCurrency')
39
+ })
40
+ }
@@ -0,0 +1,46 @@
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
+ * INFITX
22
+ - Vijay Kumar Guthi <vijaya.guthi@infitx.com>
23
+ --------------
24
+ ******/
25
+
26
+ 'use strict'
27
+
28
+ exports.up = async (knex) => {
29
+ return await knex.schema.hasTable('fxTransferStateChange').then(function(exists) {
30
+ if (!exists) {
31
+ return knex.schema.createTable('fxTransferStateChange', (t) => {
32
+ t.bigIncrements('fxTransferStateChangeId').primary().notNullable()
33
+ t.string('commitRequestId', 36).notNullable()
34
+ t.foreign('commitRequestId').references('commitRequestId').inTable('fxTransfer')
35
+ t.string('transferStateId', 50).notNullable()
36
+ t.foreign('transferStateId').references('transferStateId').inTable('transferState')
37
+ t.string('reason', 512).defaultTo(null).nullable()
38
+ t.dateTime('createdDate').defaultTo(knex.fn.now()).notNullable()
39
+ })
40
+ }
41
+ })
42
+ }
43
+
44
+ exports.down = function (knex) {
45
+ return knex.schema.dropTableIfExists('fxTransferStateChange')
46
+ }
@@ -0,0 +1,40 @@
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
+ * INFITX
22
+ - Vijay Kumar Guthi <vijaya.guthi@infitx.com>
23
+ --------------
24
+ ******/
25
+
26
+ 'use strict'
27
+
28
+ exports.up = function (knex) {
29
+ return knex.schema.table('fxTransferStateChange', (t) => {
30
+ t.index('commitRequestId')
31
+ t.index('transferStateId')
32
+ })
33
+ }
34
+
35
+ exports.down = function (knex) {
36
+ return knex.schema.table('fxTransferStateChange', (t) => {
37
+ t.dropIndex('commitRequestId')
38
+ t.dropIndex('transferStateId')
39
+ })
40
+ }
@@ -0,0 +1,46 @@
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
+ * INFITX
22
+ - Vijay Kumar Guthi <vijaya.guthi@infitx.com>
23
+ --------------
24
+ ******/
25
+
26
+ 'use strict'
27
+
28
+ exports.up = async (knex) => {
29
+ return await knex.schema.hasTable('fxWatchList').then(function(exists) {
30
+ if (!exists) {
31
+ return knex.schema.createTable('fxWatchList', (t) => {
32
+ t.bigIncrements('fxWatchListId').primary().notNullable()
33
+ t.string('commitRequestId', 36).notNullable()
34
+ t.foreign('commitRequestId').references('commitRequestId').inTable('fxTransfer')
35
+ t.string('determiningTransferId', 36).notNullable()
36
+ t.integer('fxTransferTypeId').unsigned().notNullable()
37
+ t.foreign('fxTransferTypeId').references('fxTransferTypeId').inTable('fxTransferType')
38
+ t.dateTime('createdDate').defaultTo(knex.fn.now()).notNullable()
39
+ })
40
+ }
41
+ })
42
+ }
43
+
44
+ exports.down = function (knex) {
45
+ return knex.schema.dropTableIfExists('fxWatchList')
46
+ }
@@ -0,0 +1,40 @@
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
+ * INFITX
22
+ - Vijay Kumar Guthi <vijaya.guthi@infitx.com>
23
+ --------------
24
+ ******/
25
+
26
+ 'use strict'
27
+
28
+ exports.up = function (knex) {
29
+ return knex.schema.table('fxWatchList', (t) => {
30
+ t.index('commitRequestId')
31
+ t.index('determiningTransferId')
32
+ })
33
+ }
34
+
35
+ exports.down = function (knex) {
36
+ return knex.schema.table('fxWatchList', (t) => {
37
+ t.dropIndex('commitRequestId')
38
+ t.dropIndex('determiningTransferId')
39
+ })
40
+ }
@@ -0,0 +1,43 @@
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
+ - Vijay Kumar Guthi <vijaya.guthi@infitx.com>
23
+ --------------
24
+ ******/
25
+
26
+ 'use strict'
27
+
28
+ exports.up = async (knex) => {
29
+ return await knex.schema.hasTable('fxTransferFulfilmentDuplicateCheck').then(function(exists) {
30
+ if (!exists) {
31
+ return knex.schema.createTable('fxTransferFulfilmentDuplicateCheck', (t) => {
32
+ t.string('commitRequestId', 36).primary().notNullable()
33
+ t.foreign('commitRequestId').references('commitRequestId').inTable('fxTransfer')
34
+ t.string('hash', 256).nullable()
35
+ t.dateTime('createdDate').defaultTo(knex.fn.now()).notNullable()
36
+ })
37
+ }
38
+ })
39
+ }
40
+
41
+ exports.down = function (knex) {
42
+ return knex.schema.dropTableIfExists('fxTransferFulfilmentDuplicateCheck')
43
+ }
@@ -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
+ - Vijay Kumar Guthi <vijaya.guthi@infitx.com>
23
+ --------------
24
+ ******/
25
+
26
+ 'use strict'
27
+
28
+ exports.up = function (knex) {
29
+ return knex.schema.table('fxTransferFulfilmentDuplicateCheck', (t) => {
30
+ t.index('commitRequestId')
31
+ })
32
+ }
33
+
34
+ exports.down = function (knex) {
35
+ return knex.schema.table('fxTransferFulfilmentDuplicateCheck', (t) => {
36
+ t.dropIndex('commitRequestId')
37
+ })
38
+ }
@@ -0,0 +1,47 @@
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
+ - Vijay Kumar Guthi <vijaya.guthi@infitx.com>
23
+ --------------
24
+ ******/
25
+
26
+ 'use strict'
27
+
28
+ exports.up = async (knex) => {
29
+ return await knex.schema.hasTable('fxTransferFulfilment').then(function(exists) {
30
+ if (!exists) {
31
+ return knex.schema.createTable('fxTransferFulfilment', (t) => {
32
+ t.string('commitRequestId', 36).primary().notNullable()
33
+ t.foreign('commitRequestId').references('commitRequestId').inTable('fxTransfer')
34
+ t.string('ilpFulfilment', 256).nullable()
35
+ t.dateTime('completedDate').notNullable()
36
+ t.boolean('isValid').nullable()
37
+ t.bigInteger('settlementWindowId').unsigned().nullable()
38
+ t.foreign('settlementWindowId').references('settlementWindowId').inTable('settlementWindow')
39
+ t.dateTime('createdDate').defaultTo(knex.fn.now()).notNullable()
40
+ })
41
+ }
42
+ })
43
+ }
44
+
45
+ exports.down = function (knex) {
46
+ return knex.schema.dropTableIfExists('fxTransferFulfilment')
47
+ }