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!: fx and interscheme implementation #1058

Open
wants to merge 134 commits into
base: main
Choose a base branch
from
Open

feat!: fx and interscheme implementation #1058

wants to merge 134 commits into from

Conversation

kleyow
Copy link
Contributor

@kleyow kleyow commented Jul 4, 2024

Changes:

  • Currency Conversion (FX)
    • Database changes (knex migrations) for FX
    • Updated prepare and position handlers to support FX kafka messages
    • Updated timeout handler to timeout dependent transfers incase of FX
    • Implemented batch mode for the timeout and abort position messages along with FX actions
  • Interscheme
    • Proxy cache implementation using redis
    • Parameterize switch id
    • Extend admin api to support proxy participants
    • Added new transfer internal state (RESERVED_FORWARDED) to support interscheme
    • Adjusted position handler implementation for proxied participants
    • Adjusted validations in prepare handler to support proxied participants
  • Performance optimisations

vijayg10 and others added 30 commits November 8, 2023 18:34
* feat(3574): updated prepare handler for FX

* feat(3574): added fxTransfer related tables;  updated validator for FX

* feat(3574): added fxTransfer related tables;  updated validator for FX

* feat(3574): comments/todos

* feat(3574): added fx roleTypes; added content.context

* feat(3574): added cyril; updated unit-tests
* chore: updated central service shared lib

* feat: added some changes for fx flow

* feat: added changes for position prepare handler

* chore: refactor cyril functions

* feat: position-commit working

* feat: upgraded central shared

* chore(snapshot): 17.4.0-snapshot.0

* chore(snapshot): 17.4.0-snapshot.1

* chore(snapshot): 17.4.0-snapshot.2
* feat: add FX quotes endpointType and kafka topics
* chore: upgrade cs-shared
* chore: fix audit
* fix: cluster performance testing issues (#996)

* test: fix disconnect errors (#998)

* chore(release): 17.6.1 [skip ci]

* chore: fix current tests

* boolean

* chore: add endpoints to test data

* fix endpoint import

* chore: improve validator coverage

* chore: move prepare tests into file to match src structure

---------

Co-authored-by: Kalin Krustev <[email protected]>
Co-authored-by: mojaloopci <[email protected]>
* chore: more coverage

* coverage
@vijayg10 vijayg10 changed the title feat: add fx and interscheme functionality feat: fx and interscheme implementation Sep 4, 2024
kalinkrustev and others added 17 commits September 4, 2024 18:30
* fix: call commit and rollback

* test: fix coverage

* fix: call commit and rollback

* fix: remove unnecessary commit and rollback

* fix: remove unnecessary commit and rollback
* fix: int tests

* fix: int tests

* fix: audit and lint fix

* fix: spelling

* chore: skipped an int test

* chore(snapshot): 17.8.0-snapshot.17

* chore(snapshot): 17.8.0-snapshot.18

* chore(snapshot): 17.8.0-snapshot.19

* chore(snapshot): 17.8.0-snapshot.20

* fix: add duplication logic and test for fxTransfers

* conversionState

* alter int test for message key 0

* alter test

---------

Co-authored-by: Kevin Leyow <[email protected]>
… 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
… updated transfer/facade" (#1100)

Revert "feat(csi-633): added externalParticipant model; added JSDocs; updated…"

This reverts commit eb54f67.
* fix: int tests

* fix: int tests

* fix: audit and lint fix

* fix: spelling

* chore: skipped an int test

* chore(snapshot): 17.8.0-snapshot.17

* chore(snapshot): 17.8.0-snapshot.18

* chore(snapshot): 17.8.0-snapshot.19

* chore(snapshot): 17.8.0-snapshot.20

* fix: get fx transfers

* fix: refactor

* fix: fx fulfilment

* fix: unit tests

* fix: tests
fix: from argument in kafka notification for abort
Revert "fix: fix abort callback (#1106)"

This reverts commit b6e9e2b.
* fix: check participant.isActive in prepare

* chore(snapshot): 17.8.0-snapshot.16

* chore(snapshot): 17.8.0-snapshot.17

* fix: check position account is active in prepare

* chore(snapshot): 17.8.0-snapshot.18

* test: temporarily disable coverage for proxy

* chore(snapshot): 17.8.0-snapshot.19

* chore(snapshot): 17.8.0-snapshot.20

* ci: temporarily disable int tests for snapshots

* chore(snapshot): 17.8.0-snapshot.21

* fix: fix typos

* refactor: reactor getFSPProxy

* chore(snapshot): 17.8.0-snapshot.22

* doc: update comment

* chore(snapshot): 17.8.0-snapshot.23

* fix(csi-603): fix getTransferParticipant query join

* ci: re-enable integration tests for snapshots

* chore(snapshot): 17.8.0-snapshot.24

* chore(snapshot): 17.8.0-snapshot.25

* fix: fix query

* chore(snapshot): 17.8.0-snapshot.26

* refactor: refactor

* refactor: refactor

* fix(csi-610): fix hub responding with RESERVED instead of COMMITED for v1.1 reserved fulfil

* chore(snapshot): 17.8.0-snapshot.27

---------

Co-authored-by: Vijay <[email protected]>
…ss (#1105)

* feat(csi/643): add fx-notify publishing on payer init fxTranfer success

* loop

* deps

* tests

* list
* fix: from argument in kafka notification for abort

* fix: position changes

* fix: to number

* fix: position change in timeout

* fix: related fxtransfer check

* fix: unit tests

* fix: timeout

* chore: deps

* fix fx-abort tests

* fix fx-timeout tests

* chore: added a comment

* fix more tests

* fix: invalid fulfilment

* fix: unit test

* chore(snapshot): 17.8.0-snapshot.28

* chore(snapshot): 17.8.0-snapshot.29

* fix: lint

* chore(snapshot): 17.8.0-snapshot.30

---------

Co-authored-by: Kevin Leyow <[email protected]>
* 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
src/api/participants/routes.js Fixed Show fixed Hide fixed
src/api/participants/routes.js Fixed Show fixed Hide fixed
@kleyow kleyow changed the title feat: fx and interscheme implementation feat!: fx and interscheme implementation Sep 26, 2024
Copy link

sonarcloud bot commented Oct 21, 2024

Quality Gate Failed Quality Gate failed

Failed conditions
26.8% Duplication on New Code (required ≤ 3%)
B Reliability Rating on New Code (required ≥ A)

See analysis details on SonarQube Cloud

Catch issues before they fail your Quality Gate with our IDE extension SonarQube for IDE

return Factory.createFSPIOPError(
Enums.FSPIOPErrorCodes.TRANSFER_EXPIRED,
ERROR_MESSAGES.fxTransferExpired,
cause = null, replyTo = ''
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
cause = null, replyTo = ''
cause, replyTo

@@ -0,0 +1,48 @@
# FX Implementation

## Proof of Concept (PoC) Implementation for Payer-Side Currency Conversion (Happy Path Only)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does this still hold?

"@hapi/inert": "7.1.0",
"@hapi/joi": "17.1.1",
"@hapi/vision": "7.0.3",
"@hapi/catbox-memory": "6.0.2",
"@mojaloop/database-lib": "11.0.5",
"@mojaloop/central-services-error-handling": "13.0.1",
"@mojaloop/central-services-health": "15.0.0",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is it missing dependency @mojaloop/sdk-standard-components required by @mojaloop/central-services-error-handling

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@shashi165
Copy link
Contributor

Need to fix the sonarcloud issues and run the tests. integration tests are failing locally

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants