Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: implement changes in position handler for FX #986

Merged
merged 12 commits into from
Nov 22, 2023
Merged
43 changes: 43 additions & 0 deletions migrations/600010_fxTransferType.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
/*****
License
--------------
Copyright © 2017 Bill & Melinda Gates Foundation
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
http://www.apache.org/licenses/LICENSE-2.0
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.
Contributors
--------------
This is the official list of the Mojaloop project contributors for this file.
Names of the original copyright holders (individuals or organizations)
should be listed with a '*' in the first column. People who have
contributed from an organization can be listed under the organization
that actually holds the copyright for their contributions (see the
Gates Foundation organization for an example). Those individuals should have
their names indented and be marked with a '-'. Email address can be added
optionally within square brackets <email>.
* Gates Foundation
- Name Surname <name.surname@gatesfoundation.com>

* ModusBox
- Vijay Kumar Guthi <vijaya.guthi@infitx.com>
--------------
******/

'use strict'

exports.up = async (knex) => {
return await knex.schema.hasTable('fxTransferType').then(function(exists) {
if (!exists) {
return knex.schema.createTable('fxTransferType', (t) => {
t.increments('fxTransferTypeId').primary().notNullable()
t.string('name', 50).notNullable()
t.string('description', 512).defaultTo(null).nullable()
t.dateTime('createdDate').defaultTo(knex.fn.now()).notNullable()
})
}
})
}

exports.down = function (knex) {
return knex.schema.dropTableIfExists('fxParticipantCurrencyType')
}
38 changes: 38 additions & 0 deletions migrations/600011_fxTransferType-indexes.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
/*****
License
--------------
Copyright © 2017 Bill & Melinda Gates Foundation
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
http://www.apache.org/licenses/LICENSE-2.0
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.
Contributors
--------------
This is the official list of the Mojaloop project contributors for this file.
Names of the original copyright holders (individuals or organizations)
should be listed with a '*' in the first column. People who have
contributed from an organization can be listed under the organization
that actually holds the copyright for their contributions (see the
Gates Foundation organization for an example). Those individuals should have
their names indented and be marked with a '-'. Email address can be added
optionally within square brackets <email>.
* Gates Foundation
- Name Surname <name.surname@gatesfoundation.com>

* ModusBox
- Vijay Kumar Guthi <vijaya.guthi@infitx.com>
--------------
******/

'use strict'

exports.up = function (knex) {
return knex.schema.table('fxTransferType', (t) => {
t.unique('name')
})
}

exports.down = function (knex) {
return knex.schema.table('fxTransferType', (t) => {
t.dropUnique('name')
})
}
43 changes: 43 additions & 0 deletions migrations/600012_fxParticipantCurrencyType.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
/*****
License
--------------
Copyright © 2017 Bill & Melinda Gates Foundation
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
http://www.apache.org/licenses/LICENSE-2.0
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.
Contributors
--------------
This is the official list of the Mojaloop project contributors for this file.
Names of the original copyright holders (individuals or organizations)
should be listed with a '*' in the first column. People who have
contributed from an organization can be listed under the organization
that actually holds the copyright for their contributions (see the
Gates Foundation organization for an example). Those individuals should have
their names indented and be marked with a '-'. Email address can be added
optionally within square brackets <email>.
* Gates Foundation
- Name Surname <name.surname@gatesfoundation.com>

* ModusBox
- Vijay Kumar Guthi <vijaya.guthi@infitx.com>
--------------
******/

'use strict'

exports.up = async (knex) => {
return await knex.schema.hasTable('fxParticipantCurrencyType').then(function(exists) {
if (!exists) {
return knex.schema.createTable('fxParticipantCurrencyType', (t) => {
t.increments('fxParticipantCurrencyTypeId').primary().notNullable()
t.string('name', 50).notNullable()
t.string('description', 512).defaultTo(null).nullable()
t.dateTime('createdDate').defaultTo(knex.fn.now()).notNullable()
})
}
})
}

exports.down = function (knex) {
return knex.schema.dropTableIfExists('fxParticipantCurrencyType')
}
38 changes: 38 additions & 0 deletions migrations/600013_fxParticipantCurrencyType-indexes.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
/*****
License
--------------
Copyright © 2017 Bill & Melinda Gates Foundation
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
http://www.apache.org/licenses/LICENSE-2.0
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.
Contributors
--------------
This is the official list of the Mojaloop project contributors for this file.
Names of the original copyright holders (individuals or organizations)
should be listed with a '*' in the first column. People who have
contributed from an organization can be listed under the organization
that actually holds the copyright for their contributions (see the
Gates Foundation organization for an example). Those individuals should have
their names indented and be marked with a '-'. Email address can be added
optionally within square brackets <email>.
* Gates Foundation
- Name Surname <name.surname@gatesfoundation.com>

* ModusBox
- Vijay Kumar Guthi <vijaya.guthi@infitx.com>
--------------
******/

'use strict'

exports.up = function (knex) {
return knex.schema.table('fxParticipantCurrencyType', (t) => {
t.unique('name')
})
}

exports.down = function (knex) {
return knex.schema.table('fxParticipantCurrencyType', (t) => {
t.dropUnique('name')
})
}
2 changes: 2 additions & 0 deletions migrations/600501_fxWatchList.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,8 @@ exports.up = async (knex) => {
t.string('commitRequestId', 36).notNullable()
t.foreign('commitRequestId').references('commitRequestId').inTable('fxTransfer')
t.string('determiningTransferId', 36).notNullable()
t.integer('fxTransferTypeId').unsigned().notNullable()
t.foreign('fxTransferTypeId').references('fxTransferTypeId').inTable('fxTransferType')
t.dateTime('createdDate').defaultTo(knex.fn.now()).notNullable()
})
}
Expand Down
43 changes: 43 additions & 0 deletions migrations/600600_fxTransferFulfilmentDuplicateCheck.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
/*****
License
--------------
Copyright © 2017 Bill & Melinda Gates Foundation
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
http://www.apache.org/licenses/LICENSE-2.0
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.
Contributors
--------------
This is the official list of the Mojaloop project contributors for this file.
Names of the original copyright holders (individuals or organizations)
should be listed with a '*' in the first column. People who have
contributed from an organization can be listed under the organization
that actually holds the copyright for their contributions (see the
Gates Foundation organization for an example). Those individuals should have
their names indented and be marked with a '-'. Email address can be added
optionally within square brackets <email>.
* Gates Foundation
- Name Surname <name.surname@gatesfoundation.com>

* ModusBox
- Vijay Kumar Guthi <vijaya.guthi@infitx.com>
--------------
******/

'use strict'

exports.up = async (knex) => {
return await knex.schema.hasTable('fxTransferFulfilmentDuplicateCheck').then(function(exists) {
if (!exists) {
return knex.schema.createTable('fxTransferFulfilmentDuplicateCheck', (t) => {
t.string('commitRequestId', 36).primary().notNullable()
t.foreign('commitRequestId').references('commitRequestId').inTable('fxTransfer')
t.string('hash', 256).nullable()
t.dateTime('createdDate').defaultTo(knex.fn.now()).notNullable()
})
}
})
}

exports.down = function (knex) {
return knex.schema.dropTableIfExists('fxTransferFulfilmentDuplicateCheck')
}
38 changes: 38 additions & 0 deletions migrations/600601_fxTransferFulfilmentDuplicateCheck-indexes.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
/*****
License
--------------
Copyright © 2017 Bill & Melinda Gates Foundation
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
http://www.apache.org/licenses/LICENSE-2.0
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.
Contributors
--------------
This is the official list of the Mojaloop project contributors for this file.
Names of the original copyright holders (individuals or organizations)
should be listed with a '*' in the first column. People who have
contributed from an organization can be listed under the organization
that actually holds the copyright for their contributions (see the
Gates Foundation organization for an example). Those individuals should have
their names indented and be marked with a '-'. Email address can be added
optionally within square brackets <email>.
* Gates Foundation
- Name Surname <name.surname@gatesfoundation.com>

* ModusBox
- Vijay Kumar Guthi <vijaya.guthi@infitx.com>
--------------
******/

'use strict'

exports.up = function (knex) {
return knex.schema.table('fxTransferFulfilmentDuplicateCheck', (t) => {
t.index('commitRequestId')
})
}

exports.down = function (knex) {
return knex.schema.table('fxTransferFulfilmentDuplicateCheck', (t) => {
t.dropIndex('commitRequestId')
})
}
47 changes: 47 additions & 0 deletions migrations/600700_fxTransferFulfilment.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
/*****
License
--------------
Copyright © 2017 Bill & Melinda Gates Foundation
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
http://www.apache.org/licenses/LICENSE-2.0
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.
Contributors
--------------
This is the official list of the Mojaloop project contributors for this file.
Names of the original copyright holders (individuals or organizations)
should be listed with a '*' in the first column. People who have
contributed from an organization can be listed under the organization
that actually holds the copyright for their contributions (see the
Gates Foundation organization for an example). Those individuals should have
their names indented and be marked with a '-'. Email address can be added
optionally within square brackets <email>.
* Gates Foundation
- Name Surname <name.surname@gatesfoundation.com>

* ModusBox
- Vijay Kumar Guthi <vijaya.guthi@infitx.com>
--------------
******/

'use strict'

exports.up = async (knex) => {
return await knex.schema.hasTable('fxTransferFulfilment').then(function(exists) {
if (!exists) {
return knex.schema.createTable('fxTransferFulfilment', (t) => {
t.string('commitRequestId', 36).primary().notNullable()
t.foreign('commitRequestId').references('commitRequestId').inTable('fxTransfer')
t.string('ilpFulfilment', 256).nullable()
t.dateTime('completedDate').notNullable()
t.boolean('isValid').nullable()
t.bigInteger('settlementWindowId').unsigned().nullable()
t.foreign('settlementWindowId').references('settlementWindowId').inTable('settlementWindow')
t.dateTime('createdDate').defaultTo(knex.fn.now()).notNullable()
})
}
})
}

exports.down = function (knex) {
return knex.schema.dropTableIfExists('fxTransferFulfilment')
}
43 changes: 43 additions & 0 deletions migrations/600701_fxTransferFulfilment-indexes.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
/*****
License
--------------
Copyright © 2017 Bill & Melinda Gates Foundation
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
http://www.apache.org/licenses/LICENSE-2.0
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.
Contributors
--------------
This is the official list of the Mojaloop project contributors for this file.
Names of the original copyright holders (individuals or organizations)
should be listed with a '*' in the first column. People who have
contributed from an organization can be listed under the organization
that actually holds the copyright for their contributions (see the
Gates Foundation organization for an example). Those individuals should have
their names indented and be marked with a '-'. Email address can be added
optionally within square brackets <email>.
* Gates Foundation
- Name Surname <name.surname@gatesfoundation.com>

* ModusBox
- Vijay Kumar Guthi <vijaya.guthi@infitx.com>
--------------
******/

'use strict'

exports.up = function (knex) {
return knex.schema.table('fxTransferFulfilment', (t) => {
t.index('commitRequestId')
t.index('settlementWindowId')
// TODO: Need to check if this is required
t.unique(['commitRequestId', 'ilpFulfilment'])
})
}

exports.down = function (knex) {
return knex.schema.table('fxTransferFulfilment', (t) => {
t.dropIndex('transferId')
t.dropIndex('settlementWindowId')
t.unique(['transferId', 'ilpFulfilment'])
})
}
2 changes: 2 additions & 0 deletions migrations/610200_fxTransferParticipant.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,8 @@ exports.up = async (knex) => {
t.foreign('transferParticipantRoleTypeId').references('transferParticipantRoleTypeId').inTable('transferParticipantRoleType')
t.integer('ledgerEntryTypeId').unsigned().notNullable()
t.foreign('ledgerEntryTypeId').references('ledgerEntryTypeId').inTable('ledgerEntryType')
t.integer('fxParticipantCurrencyTypeId').unsigned()
t.foreign('fxParticipantCurrencyTypeId').references('fxParticipantCurrencyTypeId').inTable('fxParticipantCurrencyType')
t.decimal('amount', 18, 4).notNullable()
t.dateTime('createdDate').defaultTo(knex.fn.now()).notNullable()
})
Expand Down
Loading