Skip to content

Commit

Permalink
feat(csi-318): added externalParticipant table (#1092)
Browse files Browse the repository at this point in the history
* feat(csi-318): added externalParticipants table

* refactor(csi-631): added calculateProxyObligation fn (#1093)

* 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 (#1094)

* 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;  updated transfer/facade; added JSDocs; (#1101)

* 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

* feat(csi-633): updated from feat/fx-impl

* feat(csi-650): updated transferTimeout handler to take into account externalParticipant (#1107)

* feat(csi-650): updated transferTimeout handler to take into account externalParticipant

* feat(csi-650): fixed ep1.externalParticipantId field

* feat(csi-650): used leftJoin for externalParticipant table

* feat(csi-650): added externalPayeeName as source to timeout handler

* feat(csi-650): updated fxTimeout logic to take into account externalParticipant info

* feat(csi-650): code cleaning up

* feat(csi-650): code cleaning up

* feat(csi-651): updated fxAbort handling to use externalParticipant info (#1111)

* feat(csi-650): updated transferTimeout handler to take into account externalParticipant

* feat(csi-650): fixed ep1.externalParticipantId field

* feat(csi-650): used leftJoin for externalParticipant table

* feat(csi-650): added externalPayeeName as source to timeout handler

* feat(csi-650): updated fxTimeout logic to take into account externalParticipant info

* feat(csi-650): code cleaning up

* feat(csi-650): code cleaning up

* feat(csi-651): updated fxAbort handling to use externalParticipant info

* feat(csi-651): updated fxValidation handling

* feat(csi-651): fixed one leftJoin clause

* feat(csi-651): updated getExternalParticipantIdByNameOrCreate

* feat(csi-651): updated getExternalParticipantIdByNameOrCreate

* feat(csi-651): added externalParticipantCached model

* feat(csi-651): fixed prepare-internals tests

* feat(csi-651): added more tests

* feat(csi-651): reverted changes back to feat/fx-impl

* feat(csi-651): reverted unneeded changes back to feat/fx-impl version

* feat(csi-651): excluded some files from test coverage check

* chore(snapshot): 17.8.0-snapshot.32

* chore(snapshot): 17.8.0-snapshot.33
  • Loading branch information
geka-evk authored Sep 19, 2024
1 parent 610031f commit 69a424e
Show file tree
Hide file tree
Showing 33 changed files with 2,134 additions and 1,140 deletions.
2 changes: 1 addition & 1 deletion .ncurc.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,5 @@ reject: [
# Issue is tracked here: https://github.com/mojaloop/project/issues/3616
"sinon",
# glob >= 11 requires node >= 20
"glob",
"glob"
]
2 changes: 2 additions & 0 deletions .nycrc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@ exclude: [
'src/handlers/transfers/FxFulfilService.js',
'src/models/position/batch.js',
'src/models/fxTransfer/**',
'src/models/participant/externalParticipantCached.js', # todo: figure out why it shows only 50% coverage in Branch
'src/models/transfer/facade.js', ## add more test coverage
'src/shared/fspiopErrorFactory.js',
'src/lib/proxyCache.js' # todo: remove this line after adding test coverage
]
Expand Down
24 changes: 14 additions & 10 deletions audit-ci.jsonc
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +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-9wv6-86v2-598j" // https://github.com/advisories/GHSA-9wv6-86v2-598j
"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 69a424e

Please sign in to comment.