mojaloop / project

Repo to track product development issues for the Mojaloop project.
Other
22 stars 15 forks source link

FX - Unnecessary participant currency validations in FX transfer #3932

Closed vijayg10 closed 1 week ago

vijayg10 commented 1 month ago

Summary: Observed that some validations are not needed for FX transfer but are happening in the central services. For example:

Severity: High

Priority: Medium

Expected Behavior We should be able to make an FX transfer without onboarding both source and target currencies for payer.

Steps to Reproduce

  1. Observe the integration tests for fxTimeout (test/integration-override/handlers/transfers/fxTimeout.test.js)
  2. In function prepareFxTestData, remove target currency for payer by changing the line
    const payer = await ParticipantHelper.prepareData(dataObj.payer.name, dataObj.sourceAmount.currency, dataObj.targetAmount.currency)
    ----to----
    const payer = await ParticipantHelper.prepareData(dataObj.payer.name, dataObj.sourceAmount.currency)
  3. Execute this integration test and it fails
  4. Observe the logs in central ledger services and we can find some error like 'Participant currency' doesn't exist

Specifications

Tasks

Pull Requests:

vijayg10 commented 1 month ago

I have gone through the sequence diagrams and discussed with @PaulGregoryBaker and came up with the following solution for this problem.

The participant account validations to be done based on the cyril result. i.e, In prepare handler, cyril should return a list of participant accounts (participantCurrencyIds) to be validated and then the prepare handler function iterates through the list and validate the accounts of existence and active status.

The following are the validations based on different FX use cases.

Payer side currency conversion

Payee side currency conversion

PaulGregoryBaker commented 3 weeks ago

2 pts left Integration tests still outstanding.

MichaelJBRichards commented 2 weeks ago

In every case, whether currency conversion is initiated by the debtor or the creditor, the following reservations should be made by the switch:

The same obligations are always created, no matter who is doing the currency conversion; and they are always created after the transfer has completed:

Under no circumstances should any DFSP have an account at the switch in any currency other than its own.