Skip to content

Commit

Permalink
feat(csi-633): added externalParticipant model; added JSDocs; updated…
Browse files Browse the repository at this point in the history
… transfer/facade (#1099)

* feat(csi-318): added externalParticipants table

* refactor(csi-631): added calculateProxyObligation fn

* refactor(csi-631): added forwardPrepare fn

* refactor(csi-631): added forwardPrepare fn

* refactor(csi-631): improved logging in transfer facade

* chore(csi-632): added migrations to create externalParticipant table

* chore(csi-632): added migration to add externalParticipantId FK to fxTransferParticipant

* chore(csi-632): added migration to add externalParticipantId FK to fxTransferParticipant

* feat(csi-633): added externalParticipant model; added JSDocs; updated transfer/facade

* feat(csi-633): added externalParticipantId field to fxTransferParticipant table

* feat(csi-633): added externalParticipantId field to fxTransferParticipant table
  • Loading branch information
geka-evk authored Sep 13, 2024
1 parent 33f765d commit eb54f67
Show file tree
Hide file tree
Showing 18 changed files with 1,003 additions and 534 deletions.
1 change: 1 addition & 0 deletions .ncurc.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,5 @@ reject: [
"sinon",
# glob >= 11 requires node >= 20
"glob",
"@mojaloop/central-services-shared", ## todo: temporary!!!!
]
23 changes: 14 additions & 9 deletions audit-ci.jsonc
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,19 @@
// Only use one of ["low": true, "moderate": true, "high": true, "critical": true]
"moderate": true,
"allowlist": [ // NOTE: Please add as much information as possible to any items added to the allowList
"GHSA-w5p7-h5w8-2hfq", // tap-spec>tap-out>trim; This has been analyzed and this is acceptable as it is used to run tests.
"GHSA-2mvq-xp48-4c77", // https://github.com/advisories/GHSA-2mvq-xp48-4c77
"GHSA-5854-jvxx-2cg9", // https://github.com/advisories/GHSA-5854-jvxx-2cg9
"GHSA-7hx8-2rxv-66xv", // https://github.com/advisories/GHSA-7hx8-2rxv-66xv
"GHSA-c429-5p7v-vgjp", // https://github.com/advisories/GHSA-c429-5p7v-vgjp
"GHSA-g64q-3vg8-8f93", // https://github.com/advisories/GHSA-g64q-3vg8-8f93
"GHSA-mg85-8mv5-ffjr", // https://github.com/advisories/GHSA-mg85-8mv5-ffjr
"GHSA-8hc4-vh64-cxmj", // https://github.com/advisories/GHSA-8hc4-vh64-cxmj
"GHSA-952p-6rrq-rcjv" // https://github.com/advisories/GHSA-952p-6rrq-rcjv
"GHSA-w5p7-h5w8-2hfq", // tap-spec>tap-out>trim; This has been analyzed and this is acceptable as it is used to run tests.
"GHSA-2mvq-xp48-4c77", // https://github.com/advisories/GHSA-2mvq-xp48-4c77
"GHSA-5854-jvxx-2cg9", // https://github.com/advisories/GHSA-5854-jvxx-2cg9
"GHSA-7hx8-2rxv-66xv", // https://github.com/advisories/GHSA-7hx8-2rxv-66xv
"GHSA-c429-5p7v-vgjp", // https://github.com/advisories/GHSA-c429-5p7v-vgjp
"GHSA-g64q-3vg8-8f93", // https://github.com/advisories/GHSA-g64q-3vg8-8f93
"GHSA-mg85-8mv5-ffjr", // https://github.com/advisories/GHSA-mg85-8mv5-ffjr
"GHSA-8hc4-vh64-cxmj", // https://github.com/advisories/GHSA-8hc4-vh64-cxmj
"GHSA-952p-6rrq-rcjv", // https://github.com/advisories/GHSA-952p-6rrq-rcjv
"GHSA-9wv6-86v2-598j", // https://github.com/advisories/GHSA-9wv6-86v2-598j
"GHSA-qwcr-r2fm-qrc7", // https://github.com/advisories/GHSA-qwcr-r2fm-qrc7
"GHSA-cm22-4g7w-348p", // https://github.com/advisories/GHSA-cm22-4g7w-348p
"GHSA-m6fv-jmcg-4jfg", // https://github.com/advisories/GHSA-m6fv-jmcg-4jfg
"GHSA-qw6h-vgh9-j6wx" // https://github.com/advisories/GHSA-qw6h-vgh9-j6wx
]
}
47 changes: 47 additions & 0 deletions migrations/960100_create_externalParticipant.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 <[email protected]>
* Eugen Klymniuk <[email protected]>
--------------
**********/

exports.up = async (knex) => {
return knex.schema.hasTable('externalParticipant').then(function(exists) {
if (!exists) {
return knex.schema.createTable('externalParticipant', (t) => {
t.bigIncrements('externalParticipantId').primary().notNullable()
t.string('name', 30).notNullable()
t.unique('name')
t.dateTime('createdDate').defaultTo(knex.fn.now()).notNullable()
t.integer('proxyId').unsigned().notNullable()
t.foreign('proxyId').references('participantId').inTable('participant')
})
}
})
}

exports.down = function (knex) {
return knex.schema.hasTable('externalParticipant').then(function(exists) {
if (!exists) {
return knex.schema.dropTableIfExists('externalParticipant')
}
})
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
/*****
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 <[email protected]>
* Eugen Klymniuk <[email protected]>
--------------
**********/

const EP_ID_FIELD = 'externalParticipantId'

exports.up = async (knex) => {
return knex.schema.hasTable('transferParticipant').then(function(exists) {
if (exists) {
return knex.schema.alterTable('transferParticipant', (t) => {
t.bigint(EP_ID_FIELD).unsigned().nullable()
t.foreign(EP_ID_FIELD).references(EP_ID_FIELD).inTable('externalParticipant')
t.index(EP_ID_FIELD)
})
}
})
}

exports.down = async (knex) => {
return knex.schema.hasTable('transferParticipant').then(function(exists) {
if (exists) {
return knex.schema.alterTable('transferParticipant', (t) => {
t.dropIndex(EP_ID_FIELD)
t.dropForeign(EP_ID_FIELD)
t.dropColumn(EP_ID_FIELD)
})
}
})
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
/*****
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 <[email protected]>
* Eugen Klymniuk <[email protected]>
--------------
**********/

const EP_ID_FIELD = 'externalParticipantId'

exports.up = async (knex) => {
return knex.schema.hasTable('fxTransferParticipant').then((exists) => {
if (exists) {
return knex.schema.alterTable('fxTransferParticipant', (t) => {
t.bigint(EP_ID_FIELD).unsigned().nullable()
t.foreign(EP_ID_FIELD).references(EP_ID_FIELD).inTable('externalParticipant')
t.index(EP_ID_FIELD)
})
}
})
}

exports.down = async (knex) => {
return knex.schema.hasTable('fxTransferParticipant').then((exists) => {
if (exists) {
return knex.schema.alterTable('fxTransferParticipant', (t) => {
t.dropIndex(EP_ID_FIELD)
t.dropForeign(EP_ID_FIELD)
t.dropColumn(EP_ID_FIELD)
})
}
})
}
Loading

0 comments on commit eb54f67

Please sign in to comment.