From 70e74ce8242dd15057bdbb2112610e2dead4be24 Mon Sep 17 00:00:00 2001 From: Steven Oderayi Date: Fri, 29 Mar 2024 11:11:44 +0100 Subject: [PATCH 1/9] feat: add fx prepare and position sequence diagrams --- .../sequence/seq-fx-prepare-1.1.0.plantuml | 187 ++++++++++ .../sequence/seq-fx-prepare-1.1.1.a.plantuml | 275 +++++++++++++++ .../sequence/seq-fx-prepare-1.1.2.a.plantuml | 332 ++++++++++++++++++ 3 files changed, 794 insertions(+) create mode 100644 docs/technical/central-ledger/assets/diagrams/sequence/seq-fx-prepare-1.1.0.plantuml create mode 100644 docs/technical/central-ledger/assets/diagrams/sequence/seq-fx-prepare-1.1.1.a.plantuml create mode 100644 docs/technical/central-ledger/assets/diagrams/sequence/seq-fx-prepare-1.1.2.a.plantuml diff --git a/docs/technical/central-ledger/assets/diagrams/sequence/seq-fx-prepare-1.1.0.plantuml b/docs/technical/central-ledger/assets/diagrams/sequence/seq-fx-prepare-1.1.0.plantuml new file mode 100644 index 00000000..48a51be9 --- /dev/null +++ b/docs/technical/central-ledger/assets/diagrams/sequence/seq-fx-prepare-1.1.0.plantuml @@ -0,0 +1,187 @@ +/'***** + 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 . + * Gates Foundation + - Name Surname + + * Steven Oderayi + -------------- + ******'/ + +@startuml PayerFSP-fx-conversion-prepare-request + +!$payerCurrency = "" +!$payeeCurrency = "" +!$payerFSPID = "" +!$payeeFSPID = "" +!$fxpID = "" +!$payerMSISDN = "" +!$payeeMSISDN = "" +!$payeeReceiveAmount = "" +!$payerSendAmount = "" +!$payeeFee = "" +!$targetAmount = "" +!$fxpChargesSource = "" +!$fxpChargesTarget = "" +!$fxpSourceAmount = "" +!$fxpTargetAmount = "" +!$conversionRequestId = "" +!$conversionId = "" +!$homeTransactionId = "" +!$quoteId = "" +!$transactionId = "" +!$quotePayerExpiration = "" +!$quotePayeeExpiration = "" +!$commitRequestId = "" +!$determiningTransferId = "" +!$transferId = "" +!$fxCondition = "" +!$condition = "" + +' declate title +title 1.1.0. PayerFSP sends an FX Conversion prepare request to FXP1 + +autonumber + +' declare actors +actor "PayerFSP" as PayerFSP +actor "PayeeFSP" as DFSP2 +actor "FXP_DH" as FXP1 +boundary "ML API Adapter" as MLAPI +control "ML API Notification Event Handler" as NOTIFY_HANDLER +boundary "Central Service API" as CSAPI +collections "topic-transfer-prepare" as TOPIC_TRANSFER_PREPARE +control "Prepare Event Handler" as PREP_HANDLER +collections "topic-transfer-position" as TOPIC_TRANSFER_POSITION +control "Position Event Handler" as POS_HANDLER +collections "Notification-Topic" as TOPIC_NOTIFICATIONS + +box "Financial Service Providers" #lightGray + participant PayerFSP + participant DFSP2 + participant FXP1 +end box + +box "ML API Adapter Service" #LightBlue + participant MLAPI + participant NOTIFY_HANDLER +end box + +box "Central Service" #LightYellow + participant CSAPI + participant TOPIC_TRANSFER_PREPARE + participant PREP_HANDLER + participant TOPIC_TRANSFER_POSITION + participant POS_HANDLER + participant TOPIC_NOTIFICATIONS +end box + +' start flow +activate NOTIFY_HANDLER +activate PREP_HANDLER +activate POS_HANDLER +group PayerFSP sends an FX Conversion request to FXP1 + note right of PayerFSP #yellow + Headers - transferHeaders: { + Content-Length: , + Content-Type: , + Date: , + X-Forwarded-For: , + FSPIOP-Source: , + FSPIOP-Destination: , + FSPIOP-Encryption: , + FSPIOP-Signature: , + FSPIOP-URI: , + FSPIOP-HTTP-Method: + } + + Payload: + { + "commitRequestId": "$commitRequestId", + "determiningTransferId": "$determiningTransferId", + "initiatingFsp": "$payerFSPID", + "counterPartyFsp": "$fxpID", + "amountType": "SEND", + "sourceAmount": { + "currency": "$payerCurrency", + "amount": "$fxpSourceAmount" + }, + "targetAmount": { + "currency": "$payeeCurrency", + "amount": "$fxpTargetAmount" + }, + "condition": "$fxCondition" + } + end note + PayerFSP ->> MLAPI: POST - /fxTransfers + activate MLAPI + MLAPI -->> PayerFSP: Respond HTTP - 202 (Accepted) + alt Schema validation error + MLAPI-->>PayerFSP: Respond HTTP - 400 (Bad Request) + end + note right of MLAPI #yellow + Message: + { + id: + from: , + to: , + type: application/json + content: { + headers: , + payload: + }, + metadata: { + event: { + id: , + type: prepare, + action: fx_prepare, + createdAt: , + state: { + status: "success", + code: 0 + } + } + } + } + end note + MLAPI -> TOPIC_TRANSFER_PREPARE: Route & Publish FX Prepare event for Payer + activate TOPIC_TRANSFER_PREPARE + TOPIC_TRANSFER_PREPARE <-> TOPIC_TRANSFER_PREPARE: Ensure event is replicated as configured (ACKS=all)\nError code: 2003 + TOPIC_TRANSFER_PREPARE --> MLAPI: Replication acknowledgements have been received + deactivate TOPIC_TRANSFER_PREPARE + alt Error publishing event + MLAPI-->>PayerFSP: Respond HTTP - 500 (Internal Server Error)\n**Error code:** 2003 + end + deactivate MLAPI + ||| + TOPIC_TRANSFER_PREPARE <- PREP_HANDLER: Consume message + ref over TOPIC_TRANSFER_PREPARE, PREP_HANDLER, TOPIC_TRANSFER_POSITION : Prepare Handler Consume\n + PREP_HANDLER -> TOPIC_TRANSFER_POSITION: Produce message + ||| + TOPIC_TRANSFER_POSITION <- POS_HANDLER: Consume message + ref over TOPIC_TRANSFER_POSITION, POS_HANDLER : Position Handler Consume\n + POS_HANDLER -> TOPIC_NOTIFICATIONS: Produce message + ||| + TOPIC_NOTIFICATIONS <- NOTIFY_HANDLER: Consume message + ref over DFSP2, TOPIC_NOTIFICATIONS : Send notification to Participant (Payee)\n + NOTIFY_HANDLER -> DFSP2: Send callback notification + ||| +end +deactivate POS_HANDLER +deactivate PREP_HANDLER +deactivate NOTIFY_HANDLER +@enduml diff --git a/docs/technical/central-ledger/assets/diagrams/sequence/seq-fx-prepare-1.1.1.a.plantuml b/docs/technical/central-ledger/assets/diagrams/sequence/seq-fx-prepare-1.1.1.a.plantuml new file mode 100644 index 00000000..be4c9c35 --- /dev/null +++ b/docs/technical/central-ledger/assets/diagrams/sequence/seq-fx-prepare-1.1.1.a.plantuml @@ -0,0 +1,275 @@ +/'***** + 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 . + * Gates Foundation + - Name Surname + + * Steven Oderayi + -------------- + ******'/ + +@startuml prepare-handler-consume +' declate title +title 1.1.1.a. FX Prepare Handler Consume (single message) + +autonumber + +' declare actors +collections "topic-transfer-prepare" as TOPIC_TRANSFER_PREPARE +control "Prepare Event Handler" as PREP_HANDLER +collections "topic-transfer-position" as TOPIC_TRANSFER_POSITION +collections "Event-Topic" as TOPIC_EVENTS +collections "Notification-Topic" as TOPIC_NOTIFICATIONS +entity "Position DAO" as POS_DAO +entity "Participant DAO" as PARTICIPANT_DAO +database "Central Store" as DB + +box "Central Service" #LightYellow + participant TOPIC_TRANSFER_PREPARE + participant PREP_HANDLER + participant TOPIC_TRANSFER_POSITION + participant TOPIC_EVENTS + participant TOPIC_NOTIFICATIONS + participant POS_DAO + participant PARTICIPANT_DAO + participant DB +end box + +' start flow +activate PREP_HANDLER +group Prepare Handler Consume + TOPIC_TRANSFER_PREPARE <- PREP_HANDLER: Consume Prepare event message + activate TOPIC_TRANSFER_PREPARE + deactivate TOPIC_TRANSFER_PREPARE + + break + group Filter Event + PREP_HANDLER <-> PREP_HANDLER: Filter event - Rules: type == 'prepare' && action == 'fx_prepare'\nError codes: 2001 + end + end + + group Persist Event Information + ||| + PREP_HANDLER -> TOPIC_EVENTS: Publish event information + ref over PREP_HANDLER, TOPIC_EVENTS: Event Handler Consume\n + ||| + end + + group Validate Prepare Transfer + PREP_HANDLER <-> PREP_HANDLER: Schema validation of the incoming message + PREP_HANDLER <-> PREP_HANDLER: Verify the message's signature (to be confirmed in future requirement) + note right of PREP_HANDLER #lightgrey + The above validation steps are already handled by + the ML-Adapter for the open source implementation. + It may need to be added in future for custom adapters. + end note + + group Duplicate Check + ||| + PREP_HANDLER -> DB: Request Duplicate Check + ref over PREP_HANDLER, DB: Request Duplicate Check\n + DB --> PREP_HANDLER: Return { hasDuplicateId: Boolean, hasDuplicateHash: Boolean } + end + + alt hasDuplicateId == TRUE + group Process Duplication + alt hasDuplicateId == TRUE && hasDuplicateHash == FALSE + note right of PREP_HANDLER #lightgrey + Validate Prepare Transfer (failure) - Modified Request + end note + else hasDuplicateId == TRUE && hasDuplicateHash == TRUE + break + PREP_HANDLER -> PREP_HANDLER: stateRecord = await getFxTransferById(commitRequestId) + alt [COMMITTED, ABORTED].includes(stateRecord.transferStateEnumeration) + ||| + + PREP_HANDLER -> TOPIC_NOTIFICATIONS: Produce message [functionality = TRANSFER, action = PREPAPE_DUPLICATE] + else + note right of PREP_HANDLER #lightgrey + Ignore - resend in progress + end note + end + end + end + end + else hasDuplicateId == FALSE + group Validate Prepare Request + group Validate Payer + PREP_HANDLER -> PREP_HANDLER: Validate FSPIOP-Source header matches initiatingFsp + PREP_HANDLER -> PREP_HANDLER: Validate payload.sourceAmount and payload.targetAmount scale and precision + PREP_HANDLER -> PARTICIPANT_DAO: Request to retrieve Payer Participant details (if it exists) + activate PARTICIPANT_DAO + PARTICIPANT_DAO -> DB: Request Participant details + hnote over DB #lightyellow + participant + participantCurrency + end note + activate DB + PARTICIPANT_DAO <-- DB: Return Participant details if it exists + deactivate DB + PARTICIPANT_DAO --> PREP_HANDLER: Return Participant details if it exists + deactivate PARTICIPANT_DAO + PREP_HANDLER <-> PREP_HANDLER: Validate Payer participant is active + PREP_HANDLER <-> PREP_HANDLER: Validate Payer participant position account for the source currency [exists, active] + end + group Validate Payee + PREP_HANDLER -> PARTICIPANT_DAO: Request to retrieve Payee Participant details (if it exists) + activate PARTICIPANT_DAO + PARTICIPANT_DAO -> DB: Request Participant details + hnote over DB #lightyellow + participant + participantCurrency + end note + activate DB + PARTICIPANT_DAO <-- DB: Return Participant details if it exists + deactivate DB + PARTICIPANT_DAO --> PREP_HANDLER: Return Participant details if it exists + deactivate PARTICIPANT_DAO + PREP_HANDLER <-> PREP_HANDLER: Validate Payee participant is active + PREP_HANDLER <-> PREP_HANDLER: Validate Payee participant position account for the target currency [exists, active] + end + group Validate Condition and Expiration + PREP_HANDLER <-> PREP_HANDLER: Validate cryptographic condition + PREP_HANDLER <-> PREP_HANDLER: Validate expiration [payload.expiration is valid ISO date and not in the past] + end + group Validate Different FSPs (if ENABLE_ON_US_TRANSFER == false) + PREP_HANDLER <-> PREP_HANDLER: Validate Payer and Payee FSPs are different + end + alt Validate Prepare Transfer (success) + group Persist Transfer State (with transferState='RECEIVED-PREPARE') + PREP_HANDLER -> POS_DAO: Request to persist transfer\nError codes: 2003 + activate POS_DAO + POS_DAO -> DB: Persist transfer + hnote over DB #lightyellow + fxTransfer + fxTransferParticipant + fxTransferStateChange + fxTransferExtension + end note + activate DB + deactivate DB + POS_DAO --> PREP_HANDLER: Return success + deactivate POS_DAO + end + else Validate Prepare Transfer (failure) + group Persist Transfer State (with transferState='INVALID') (Introducing a new status INVALID to mark these entries) + PREP_HANDLER -> POS_DAO: Request to persist transfer\n(when Payee/Payer/crypto-condition validation fails)\nError codes: 2003 + activate POS_DAO + POS_DAO -> DB: Persist transfer + hnote over DB #lightyellow + fxTransfer + fxTransferParticipant + fxTransferStateChange + fxTransferExtension + fxTransferError + end note + activate DB + deactivate DB + POS_DAO --> PREP_HANDLER: Return success + deactivate POS_DAO + end + end + end + end + end + + alt Validate Prepare Transfer (success) + group Hydrate Transfer Prepare Message + PREP_HANDLER -> PARTICIPANT_DAO: Get participant and currency for FX transfer (with 'payload.determiningTransferId') + activate PARTICIPANT_DAO + PARTICIPANT_DAO -> DB: Request participant and currency + hnote over DB #lightyellow + participant + participantCurrency + end note + activate DB + PARTICIPANT_DAO <-- DB: Return participant and currency + deactivate DB + PARTICIPANT_DAO --> PREP_HANDLER: Return participant and currency + deactivate PARTICIPANT_DAO + + end + note right of PREP_HANDLER #yellow + Message: + { + id: + from: , + to: , + type: application/json + content: { + headers: , + payload: + }, + metadata: { + event: { + id: , + responseTo: , + type: position, + action: fx_prepare, + createdAt: , + state: { + status: "success", + code: 0 + } + } + } + } + end note + PREP_HANDLER -> TOPIC_TRANSFER_POSITION: Route & Publish Position event for Payer\nError codes: 2003 + activate TOPIC_TRANSFER_POSITION + deactivate TOPIC_TRANSFER_POSITION + else Validate Prepare Transfer (failure) + note right of PREP_HANDLER #yellow + Message: + { + id: + from: , + to: , + type: application/json + content: { + headers: , + payload: { + "errorInformation": { + "errorCode": + "errorDescription": "", + "extensionList": + } + }, + metadata: { + event: { + id: , + responseTo: , + type: notification, + action: fx_prepare, + createdAt: , + state: { + status: 'error', + code: + description: + } + } + } + } + end note + PREP_HANDLER -> TOPIC_NOTIFICATIONS: Publish Notification (failure) event for Payer\nError codes: 2003 + activate TOPIC_NOTIFICATIONS + deactivate TOPIC_NOTIFICATIONS + end +end +deactivate PREP_HANDLER +@enduml + diff --git a/docs/technical/central-ledger/assets/diagrams/sequence/seq-fx-prepare-1.1.2.a.plantuml b/docs/technical/central-ledger/assets/diagrams/sequence/seq-fx-prepare-1.1.2.a.plantuml new file mode 100644 index 00000000..2357dd5b --- /dev/null +++ b/docs/technical/central-ledger/assets/diagrams/sequence/seq-fx-prepare-1.1.2.a.plantuml @@ -0,0 +1,332 @@ +/'***** + 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 . + * Gates Foundation + - Name Surname + + * Steven Oderayi + -------------- + ******'/ + +@startuml position-handler-consume +' declate title +title 1.1.2.a. Position Handler Consume (single message) + +autonumber + +' declare actors +collections "topic-transfer-position" as TOPIC_TRANSFER_POSITION +control "Position Event Handler" as POS_HANDLER +entity "Position DAO" as POS_DAO +entity "Settlement DAO" as SETTLEMENT_DAO +collections "Event-Topic" as TOPIC_EVENTS +collections "Notification-Topic" as TOPIC_NOTIFICATIONS +entity "Participant DAO" as PARTICIPANT_DAO +database "Central Store" as DB + +box "Central Service" #LightYellow + participant TOPIC_TRANSFER_POSITION + participant POS_HANDLER + participant TOPIC_EVENTS + participant TOPIC_NOTIFICATIONS + participant POS_DAO + participant PARTICIPANT_DAO + participant SETTLEMENT_DAO + participant DB +end box + +' start flow +activate POS_HANDLER +group Position Handler Consume + TOPIC_TRANSFER_POSITION <- POS_HANDLER: Consume Position event message for Payer + activate TOPIC_TRANSFER_POSITION + deactivate TOPIC_TRANSFER_POSITION + + break + group Validate Event + POS_HANDLER <-> POS_HANDLER: Validate event - Rule: type == 'position' && action == 'fx_prepare' + POS_HANDLER -> POS_HANDLER: Validate 'payload.commitRequestId' or 'message.value.content.uriParams.id' is not empty\n**Error code:** 2003 + end + end + + ' group Persist Event Information + ' ||| + ' POS_HANDLER -> TOPIC_EVENTS: Publish event information + ' ref over POS_HANDLER, TOPIC_EVENTS : Event Handler Consume\n + ' ||| + ' end + + alt Calulate & Validate Latest Position (success) + group Calculate position and persist change + POS_HANDLER -> SETTLEMENT_DAO: Request active settlement models + activate SETTLEMENT_DAO + SETTLEMENT_DAO -> DB: Retrieve active settlement models + activate DB + hnote over DB #lightyellow + settlementModel + end note + DB --> SETTLEMENT_DAO: Return active settlement models + deactivate DB + SETTLEMENT_DAO --> POS_HANDLER: Return active settlement models + deactivate SETTLEMENT_DAO + POS_HANDLER -> POS_HANDLER: Select currency matching or default settlement model for POSITION ledger account type\n**Error code:** 6000 + + POS_HANDLER -> PARTICIPANT_DAO: Request Payer Participant position account by name and currency + activate PARTICIPANT_DAO + PARTICIPANT_DAO -> DB: Retrieve Payer Participant position account by name and currency + activate DB + hnote over DB #lightyellow + participant + participantCurrency + end note + DB --> PARTICIPANT_DAO: Return Payer Participant position account by name and currency + deactivate DB + PARTICIPANT_DAO --> POS_HANDLER: Return Payer Participant position account by name and currency + deactivate PARTICIPANT_DAO + + POS_HANDLER -> POS_DAO: Request latest transfer state from DB + activate POS_DAO + POS_DAO -> DB: Retrieve transfer state from DB by 'commitRequestId' + activate DB + hnote over DB #lightyellow + fxTransferStateChange + end note + DB --> POS_DAO: Retrieve transfer state from DB + deactivate DB + POS_DAO --> POS_HANDLER: Return transfer state + deactivate POS_DAO + + ' POS_HANDLER -> POS_DAO: Request latest position from DB for Payer + ' activate POS_DAO + ' POS_DAO -> DB: Retrieve latest position from DB for Payer + ' activate DB + ' hnote over DB #lightyellow + ' transferPosition + ' end note + ' DB --> POS_DAO: Retrieve latest position from DB for Payer + ' deactivate DB + ' POS_DAO --> POS_HANDLER: Return latest position + ' deactivate POS_DAO + + POS_HANDLER -> PARTICIPANT_DAO: Request position limits for Payer Participant + activate PARTICIPANT_DAO + PARTICIPANT_DAO -> DB: Request position limits for Payer Participant + activate DB + hnote over DB #lightyellow + participant + participantLimit + end note + DB --> PARTICIPANT_DAO: Return position limits + deactivate DB + deactivate DB + PARTICIPANT_DAO --> POS_HANDLER: Return position limits + deactivate PARTICIPANT_DAO + + alt Validate transfer state (transferState='RECEIVED_PREPARE') + POS_HANDLER <-> POS_HANDLER: Update transfer state to RESERVED + POS_HANDLER <-> POS_HANDLER: Calculate latest position for prepare + POS_HANDLER <-> POS_HANDLER: Validate calculated latest position (lpos) against the net-debit cap (netcap) - Rule: lpos < netcap + + POS_HANDLER -> POS_DAO: Request payer participant position for the transfer currency and settlement currency + activate POS_DAO + POS_DAO -> DB: Retrieve payer participant position for the transfer currency and settlement currency + hnote over DB #lightyellow + participantPosiiton + end note + activate DB + deactivate DB + POS_DAO --> POS_HANDLER: Return payer participant position for the transfer currency and settlement currency + deactivate POS_DAO + + ' Update participant position (increase reserved position by transfer amount) + POS_HANDLER <-> POS_HANDLER: Update participant position (increase reserved position by transfer amount) + ' Update payer participant position in DB + POS_HANDLER -> DB: Persist payer participant position in DB + activate DB + hnote over DB #lightyellow + participantPosition + end note + DB -> POS_HANDLER: Return success + deactivate DB + + POS_HANDLER -> PARTICIPANT_DAO: Request payer participant limit by currency + activate PARTICIPANT_DAO + PARTICIPANT_DAO -> DB: Retrieve payer participant limit by currency + activate DB + hnote over DB #lightyellow + participant + participantCurrency + participantLimit + end note + DB --> PARTICIPANT_DAO: Return payer participant limit by currency + deactivate DB + PARTICIPANT_DAO --> POS_HANDLER: Return payer participant limit by currency + deactivate PARTICIPANT_DAO + + POS_HANDLER <-> POS_HANDLER: Calculate latest available position based on payer limit and payer liquidity cover + + alt Validate position limits (success) + POS_HANDLER <-> POS_HANDLER: Update transfer state to RESERVED + POS_HANDLER -> DB: Update participant position + activate DB + hnote over DB #lightyellow + participantPosition + end note + deactivate DB + + POS_HANDLER -> DB: Persist transfer state change (RESERVED) to DB + activate DB + hnote over DB #lightyellow + fxTransferStateChange + end note + deactivate DB + + POS_HANDLER -> DB: Insert participant position change record + activate DB + hnote over DB #lightyellow + participantPositionChange + end note + deactivate DB + else Validate position limits (failure) + POS_HANDLER -> DB: Persist transfer state change (ABORTED_REJECTED) to DB, **Error codes:** 4001, 4200 + activate DB + hnote over DB #lightyellow + fxTransferStateChange + end note + deactivate DB + end + else transferState !='RECEIVED_PREPARE' + POS_HANDLER <-> POS_HANDLER: Update transfer state to ABORTED_REJECTED + POS_HANDLER -> DB: Persist aborted transfer state + activate DB + hnote over DB #lightyellow + fxTransferStateChange + end note + deactivate DB + end + + alt Transfer state is RESERVED + note right of POS_HANDLER #yellow + Message: + { + id: + from: , + to: , + type: application/json + content: { + headers: , + payload: + }, + metadata: { + event: { + id: , + responseTo: , + type: transfer, + action: prepare, + createdAt: , + state: { + status: "success", + code: 0 + } + } + } + } + end note + POS_HANDLER -> TOPIC_NOTIFICATIONS: Publish Notification event to FXP + activate TOPIC_NOTIFICATIONS + deactivate TOPIC_NOTIFICATIONS + else + note right of POS_HANDLER #yellow + Message: + { + id: + from: , + to: , + type: application/json + content: { + headers: , + payload: { + "errorInformation": { + "errorCode": , + "errorDescription": "", + "extensionList": + } + } + }, + metadata: { + event: { + id: , + responseTo: , + type: notification, + action: prepare, + createdAt: , + state: { + status: 'error', + code: + description: + } + } + } + } + end note + POS_HANDLER -> TOPIC_NOTIFICATIONS: Publish Notification (failure) event for Payer. **Error code:** 2001 + activate TOPIC_NOTIFICATIONS + deactivate TOPIC_NOTIFICATIONS + end + + end + else Calculate & Validate Latest Position (failure) + note right of POS_HANDLER #yellow + Message: + { + id: + from: , + to: , + type: application/json + content: { + headers: , + payload: { + "errorInformation": { + "errorCode": , + "errorDescription": "", + "extensionList": + } + }, + metadata: { + event: { + id: , + responseTo: , + type: notification, + action: prepare, + createdAt: , + state: { + status: 'error', + code: + description: + } + } + } + } + end note + POS_HANDLER -> TOPIC_NOTIFICATIONS: Publish Notification (failure) event for Payer **Error codes:** 4001, 4200 + activate TOPIC_NOTIFICATIONS + deactivate TOPIC_NOTIFICATIONS + deactivate POS_HANDLER + end +end +deactivate POS_HANDLER +@enduml From 7ddea19542ee9af8da6f31d669e65d0d427e5ebf Mon Sep 17 00:00:00 2001 From: Steven Oderayi Date: Fri, 29 Mar 2024 11:18:02 +0100 Subject: [PATCH 2/9] chore: update copyright notice --- .../sequence/seq-fx-prepare-1.1.0.plantuml | 15 ++++++++++----- .../sequence/seq-fx-prepare-1.1.1.a.plantuml | 15 ++++++++++----- .../sequence/seq-fx-prepare-1.1.2.a.plantuml | 15 ++++++++++----- 3 files changed, 30 insertions(+), 15 deletions(-) diff --git a/docs/technical/central-ledger/assets/diagrams/sequence/seq-fx-prepare-1.1.0.plantuml b/docs/technical/central-ledger/assets/diagrams/sequence/seq-fx-prepare-1.1.0.plantuml index 48a51be9..6127327c 100644 --- a/docs/technical/central-ledger/assets/diagrams/sequence/seq-fx-prepare-1.1.0.plantuml +++ b/docs/technical/central-ledger/assets/diagrams/sequence/seq-fx-prepare-1.1.0.plantuml @@ -1,10 +1,15 @@ /'***** - License + 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. + Copyright © 2020 Mojaloop Foundation + + The Mojaloop files are made available by the Mojaloop Foundation under the Apache License, Version 2.0 + (the "License") and you may not use these files except in compliance with the [License](http://www.apache.org/licenses/LICENSE-2.0). + + You may obtain a copy of the License at [http://www.apache.org/licenses/LICENSE-2.0](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](http://www.apache.org/licenses/LICENSE-2.0). + Contributors -------------- This is the official list of the Mojaloop project contributors for this file. diff --git a/docs/technical/central-ledger/assets/diagrams/sequence/seq-fx-prepare-1.1.1.a.plantuml b/docs/technical/central-ledger/assets/diagrams/sequence/seq-fx-prepare-1.1.1.a.plantuml index be4c9c35..6c5716bd 100644 --- a/docs/technical/central-ledger/assets/diagrams/sequence/seq-fx-prepare-1.1.1.a.plantuml +++ b/docs/technical/central-ledger/assets/diagrams/sequence/seq-fx-prepare-1.1.1.a.plantuml @@ -1,10 +1,15 @@ /'***** - License + 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. + Copyright © 2020 Mojaloop Foundation + + The Mojaloop files are made available by the Mojaloop Foundation under the Apache License, Version 2.0 + (the "License") and you may not use these files except in compliance with the [License](http://www.apache.org/licenses/LICENSE-2.0). + + You may obtain a copy of the License at [http://www.apache.org/licenses/LICENSE-2.0](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](http://www.apache.org/licenses/LICENSE-2.0). + Contributors -------------- This is the official list of the Mojaloop project contributors for this file. diff --git a/docs/technical/central-ledger/assets/diagrams/sequence/seq-fx-prepare-1.1.2.a.plantuml b/docs/technical/central-ledger/assets/diagrams/sequence/seq-fx-prepare-1.1.2.a.plantuml index 2357dd5b..fb845f76 100644 --- a/docs/technical/central-ledger/assets/diagrams/sequence/seq-fx-prepare-1.1.2.a.plantuml +++ b/docs/technical/central-ledger/assets/diagrams/sequence/seq-fx-prepare-1.1.2.a.plantuml @@ -1,10 +1,15 @@ /'***** - License + 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. + Copyright © 2020 Mojaloop Foundation + + The Mojaloop files are made available by the Mojaloop Foundation under the Apache License, Version 2.0 + (the "License") and you may not use these files except in compliance with the [License](http://www.apache.org/licenses/LICENSE-2.0). + + You may obtain a copy of the License at [http://www.apache.org/licenses/LICENSE-2.0](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](http://www.apache.org/licenses/LICENSE-2.0). + Contributors -------------- This is the official list of the Mojaloop project contributors for this file. From 9f05d4eb4fa4c39b565891ecded9672dc2b641d0 Mon Sep 17 00:00:00 2001 From: Steven Oderayi Date: Fri, 29 Mar 2024 15:10:54 +0100 Subject: [PATCH 3/9] feat: add fx conversion abort request seq diagram --- .../sequence/seq-fx-fulfil-2.1.0.plantuml | 174 ++++++++++++++++++ .../sequence/seq-fx-prepare-1.1.0.plantuml | 36 ++-- .../sequence/seq-fx-prepare-1.1.1.a.plantuml | 5 +- .../sequence/seq-fx-prepare-1.1.2.a.plantuml | 5 +- .../sequence/seq-fx-reject-2.2.0.a.plantuml | 173 +++++++++++++++++ 5 files changed, 364 insertions(+), 29 deletions(-) create mode 100644 docs/technical/central-ledger/assets/diagrams/sequence/seq-fx-fulfil-2.1.0.plantuml create mode 100644 docs/technical/central-ledger/assets/diagrams/sequence/seq-fx-reject-2.2.0.a.plantuml diff --git a/docs/technical/central-ledger/assets/diagrams/sequence/seq-fx-fulfil-2.1.0.plantuml b/docs/technical/central-ledger/assets/diagrams/sequence/seq-fx-fulfil-2.1.0.plantuml new file mode 100644 index 00000000..8655fa28 --- /dev/null +++ b/docs/technical/central-ledger/assets/diagrams/sequence/seq-fx-fulfil-2.1.0.plantuml @@ -0,0 +1,174 @@ +/' + License + -------------- + Copyright © 2020 Mojaloop Foundation + The Mojaloop files are made available by the Mojaloop Foundation under the Apache License, Version 2.0 + (the "License") and you may not use these files except in compliance with the [License](http://www.apache.org/licenses/LICENSE-2.0). + You may obtain a copy of the License at [http://www.apache.org/licenses/LICENSE-2.0](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](http://www.apache.org/licenses/LICENSE-2.0). + + 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 . + * Gates Foundation + - Name Surname + + * Steven Oderayi + -------------- + '/ + + +@startuml fx-fulfil-request +' declate title +title 2.1.0. FXP sends an Fulfil Success FX Conversion Request + +autonumber + +' declare actors +actor "DFSP1\nPayer" as DFSP1 +actor "FXP1\nFXP" as FXP1 +boundary "ML API Adapter" as MLAPI +control "ML API Notification Event Handler" as NOTIFY_HANDLER +boundary "Central Service API" as CSAPI +collections "topic-transfer-fulfil" as TOPIC_FULFIL +control "Fulfil Event Handler" as FULF_HANDLER +collections "topic-\nsettlement-model" as TOPIC_SETMODEL +control "Settlement Model\nHandler" as SETMODEL_HANDLER +collections "topic-\ntransfer-position" as TOPIC_TRANSFER_POSITION +control "Position Handler" as POS_HANDLER +collections "topic-\nnotification" as TOPIC_NOTIFICATIONS + +box "Financial Service Providers" #lightGray + participant DFSP1 + participant FXP1 +end box + +box "ML API Adapter Service" #LightBlue + participant MLAPI + participant NOTIFY_HANDLER +end box + +box "Central Service" #LightYellow + participant CSAPI + participant TOPIC_FULFIL + participant FULF_HANDLER + participant TOPIC_SETMODEL + participant SETMODEL_HANDLER + participant TOPIC_TRANSFER_POSITION + participant POS_HANDLER + participant TOPIC_NOTIFICATIONS +end box + +' start flow +activate NOTIFY_HANDLER +activate FULF_HANDLER +activate SETMODEL_HANDLER +activate POS_HANDLER +group FXP1 sends a fulfil success FX conversion request + FXP1 <-> FXP1: Retrieve fulfilment string generated during\nthe FX quoting process or regenerate it using\n**Local secret** and **ILP Packet** as inputs + note right of FXP1 #yellow + Headers - transferHeaders: { + Content-Length: , + Content-Type: , + Date: , + X-Forwarded-For: , + FSPIOP-Source: , + FSPIOP-Destination: , + FSPIOP-Encryption: , + FSPIOP-Signature: , + FSPIOP-URI: , + FSPIOP-HTTP-Method: + } + + Payload - transferMessage: + { + "conversionState": "" + "fulfilment": , + "completedTimestamp": , + "extensionList": { + "extension": [ + { + "key": , + "value": + } + ] + } + } + end note + FXP1 ->> MLAPI: PUT - /fxTransfers/ + activate MLAPI + MLAPI -> MLAPI: Schema validation\n + break Schema validation failed + MLAPI -->> FXP1: Respond HTTP - 400 (Bad Request) + end + MLAPI -> MLAPI: Validate incoming request \n(e.g transfer has not timed out, completedTimestamp is not in the future)\nError codes: 2001, 3100 + note right of MLAPI #yellow + Message: + { + id: , + from: , + to: , + type: application/json, + content: { + headers: , + payload: + }, + metadata: { + event: { + id: , + type: fulfil, + action: fx_commit, + createdAt: , + state: { + status: "success", + code: 0 + } + } + } + } + end note + MLAPI -> TOPIC_FULFIL: Route & Publish Fulfil event for Payee\nError code: 2001 + activate TOPIC_FULFIL + TOPIC_FULFIL <-> TOPIC_FULFIL: Ensure event is replicated as configured (ACKS=all)\nError code: 2001 + TOPIC_FULFIL --> MLAPI: Respond replication acknowledgements have been received + deactivate TOPIC_FULFIL + MLAPI -->> FXP1: Respond HTTP - 200 (OK) + deactivate MLAPI + TOPIC_FULFIL <- FULF_HANDLER: Consume message + ref over TOPIC_FULFIL, TOPIC_TRANSFER_POSITION: Fulfil Handler Consume (Success) {[[https://github.com/mojaloop/documentation/tree/master/mojaloop-technical-overview/central-ledger/assets/diagrams/sequence/seq-fulfil-2.1.1.svg 2.1.1]]} \n + FULF_HANDLER -> TOPIC_SETMODEL: Produce message + FULF_HANDLER -> TOPIC_TRANSFER_POSITION: Produce message + ||| + TOPIC_SETMODEL <- SETMODEL_HANDLER: Consume message + ref over TOPIC_SETMODEL, SETMODEL_HANDLER: Settlement Model Handler Consume (Success)\n + ||| + TOPIC_TRANSFER_POSITION <- POS_HANDLER: Consume message + ref over TOPIC_TRANSFER_POSITION, TOPIC_NOTIFICATIONS: Position Handler Consume (Success)\n + POS_HANDLER -> TOPIC_NOTIFICATIONS: Produce message + ||| + TOPIC_NOTIFICATIONS <- NOTIFY_HANDLER: Consume message + opt action == 'fx_commit' + ||| + ref over DFSP1, TOPIC_NOTIFICATIONS: Send notification to Participant (Payer)\n + NOTIFY_HANDLER -> DFSP1: Send callback notification + end + ||| + TOPIC_NOTIFICATIONS <- NOTIFY_HANDLER: Consume message + opt action == 'fx_commit' + ||| + ref over FXP1, TOPIC_NOTIFICATIONS: Send notification to Participant (FXP)\n + NOTIFY_HANDLER -> FXP1: Send callback notification + end + ||| +end +deactivate POS_HANDLER +deactivate FULF_HANDLER +deactivate NOTIFY_HANDLER +@enduml \ No newline at end of file diff --git a/docs/technical/central-ledger/assets/diagrams/sequence/seq-fx-prepare-1.1.0.plantuml b/docs/technical/central-ledger/assets/diagrams/sequence/seq-fx-prepare-1.1.0.plantuml index 6127327c..0545869d 100644 --- a/docs/technical/central-ledger/assets/diagrams/sequence/seq-fx-prepare-1.1.0.plantuml +++ b/docs/technical/central-ledger/assets/diagrams/sequence/seq-fx-prepare-1.1.0.plantuml @@ -1,13 +1,10 @@ /'***** - LICENSE + License -------------- Copyright © 2020 Mojaloop Foundation - The Mojaloop files are made available by the Mojaloop Foundation under the Apache License, Version 2.0 (the "License") and you may not use these files except in compliance with the [License](http://www.apache.org/licenses/LICENSE-2.0). - You may obtain a copy of the License at [http://www.apache.org/licenses/LICENSE-2.0](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](http://www.apache.org/licenses/LICENSE-2.0). Contributors @@ -31,8 +28,7 @@ !$payerCurrency = "" !$payeeCurrency = "" -!$payerFSPID = "" -!$payeeFSPID = "" +!$dfsp1Id = "" !$fxpID = "" !$payerMSISDN = "" !$payeeMSISDN = "" @@ -58,14 +54,13 @@ !$condition = "" ' declate title -title 1.1.0. PayerFSP sends an FX Conversion prepare request to FXP1 +title 1.1.0. DFSP1 sends an FX Conversion prepare request to FXP1 autonumber ' declare actors -actor "PayerFSP" as PayerFSP -actor "PayeeFSP" as DFSP2 -actor "FXP_DH" as FXP1 +actor "DFSP1\nPayer" as DFSP1 +actor "FXP1\nFXP" as FXP1 boundary "ML API Adapter" as MLAPI control "ML API Notification Event Handler" as NOTIFY_HANDLER boundary "Central Service API" as CSAPI @@ -76,8 +71,7 @@ control "Position Event Handler" as POS_HANDLER collections "Notification-Topic" as TOPIC_NOTIFICATIONS box "Financial Service Providers" #lightGray - participant PayerFSP - participant DFSP2 + participant DFSP1 participant FXP1 end box @@ -99,8 +93,8 @@ end box activate NOTIFY_HANDLER activate PREP_HANDLER activate POS_HANDLER -group PayerFSP sends an FX Conversion request to FXP1 - note right of PayerFSP #yellow +group DFSP1 sends an FX Conversion request to FXP1 + note right of DFSP1 #yellow Headers - transferHeaders: { Content-Length: , Content-Type: , @@ -118,7 +112,7 @@ group PayerFSP sends an FX Conversion request to FXP1 { "commitRequestId": "$commitRequestId", "determiningTransferId": "$determiningTransferId", - "initiatingFsp": "$payerFSPID", + "initiatingFsp": "$dfsp1Id", "counterPartyFsp": "$fxpID", "amountType": "SEND", "sourceAmount": { @@ -132,11 +126,11 @@ group PayerFSP sends an FX Conversion request to FXP1 "condition": "$fxCondition" } end note - PayerFSP ->> MLAPI: POST - /fxTransfers + DFSP1 ->> MLAPI: POST - /fxTransfers activate MLAPI - MLAPI -->> PayerFSP: Respond HTTP - 202 (Accepted) + MLAPI -->> DFSP1: Respond HTTP - 202 (Accepted) alt Schema validation error - MLAPI-->>PayerFSP: Respond HTTP - 400 (Bad Request) + MLAPI-->>DFSP1: Respond HTTP - 400 (Bad Request) end note right of MLAPI #yellow Message: @@ -169,7 +163,7 @@ group PayerFSP sends an FX Conversion request to FXP1 TOPIC_TRANSFER_PREPARE --> MLAPI: Replication acknowledgements have been received deactivate TOPIC_TRANSFER_PREPARE alt Error publishing event - MLAPI-->>PayerFSP: Respond HTTP - 500 (Internal Server Error)\n**Error code:** 2003 + MLAPI-->>DFSP1: Respond HTTP - 500 (Internal Server Error)\n**Error code:** 2003 end deactivate MLAPI ||| @@ -182,8 +176,8 @@ group PayerFSP sends an FX Conversion request to FXP1 POS_HANDLER -> TOPIC_NOTIFICATIONS: Produce message ||| TOPIC_NOTIFICATIONS <- NOTIFY_HANDLER: Consume message - ref over DFSP2, TOPIC_NOTIFICATIONS : Send notification to Participant (Payee)\n - NOTIFY_HANDLER -> DFSP2: Send callback notification + ref over FXP1, TOPIC_NOTIFICATIONS : Send notification to Participant (Payee)\n + NOTIFY_HANDLER -> FXP1: Send callback notification ||| end deactivate POS_HANDLER diff --git a/docs/technical/central-ledger/assets/diagrams/sequence/seq-fx-prepare-1.1.1.a.plantuml b/docs/technical/central-ledger/assets/diagrams/sequence/seq-fx-prepare-1.1.1.a.plantuml index 6c5716bd..b1e37bfb 100644 --- a/docs/technical/central-ledger/assets/diagrams/sequence/seq-fx-prepare-1.1.1.a.plantuml +++ b/docs/technical/central-ledger/assets/diagrams/sequence/seq-fx-prepare-1.1.1.a.plantuml @@ -1,13 +1,10 @@ /'***** - LICENSE + License -------------- Copyright © 2020 Mojaloop Foundation - The Mojaloop files are made available by the Mojaloop Foundation under the Apache License, Version 2.0 (the "License") and you may not use these files except in compliance with the [License](http://www.apache.org/licenses/LICENSE-2.0). - You may obtain a copy of the License at [http://www.apache.org/licenses/LICENSE-2.0](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](http://www.apache.org/licenses/LICENSE-2.0). Contributors diff --git a/docs/technical/central-ledger/assets/diagrams/sequence/seq-fx-prepare-1.1.2.a.plantuml b/docs/technical/central-ledger/assets/diagrams/sequence/seq-fx-prepare-1.1.2.a.plantuml index fb845f76..228b6ee5 100644 --- a/docs/technical/central-ledger/assets/diagrams/sequence/seq-fx-prepare-1.1.2.a.plantuml +++ b/docs/technical/central-ledger/assets/diagrams/sequence/seq-fx-prepare-1.1.2.a.plantuml @@ -1,13 +1,10 @@ /'***** - LICENSE + License -------------- Copyright © 2020 Mojaloop Foundation - The Mojaloop files are made available by the Mojaloop Foundation under the Apache License, Version 2.0 (the "License") and you may not use these files except in compliance with the [License](http://www.apache.org/licenses/LICENSE-2.0). - You may obtain a copy of the License at [http://www.apache.org/licenses/LICENSE-2.0](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](http://www.apache.org/licenses/LICENSE-2.0). Contributors diff --git a/docs/technical/central-ledger/assets/diagrams/sequence/seq-fx-reject-2.2.0.a.plantuml b/docs/technical/central-ledger/assets/diagrams/sequence/seq-fx-reject-2.2.0.a.plantuml new file mode 100644 index 00000000..dcbde06b --- /dev/null +++ b/docs/technical/central-ledger/assets/diagrams/sequence/seq-fx-reject-2.2.0.a.plantuml @@ -0,0 +1,173 @@ +/'***** + License + -------------- + Copyright © 2020 Mojaloop Foundation + The Mojaloop files are made available by the Mojaloop Foundation under the Apache License, Version 2.0 + (the "License") and you may not use these files except in compliance with the [License](http://www.apache.org/licenses/LICENSE-2.0). + You may obtain a copy of the License at [http://www.apache.org/licenses/LICENSE-2.0](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](http://www.apache.org/licenses/LICENSE-2.0). + + 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 . + * Gates Foundation + - Name Surname + + * Steven Oderayi + -------------- +******'/ + +@startuml fx-conversion-abort-request + +title 2.2.0.a. FXP1 sends a PUT call on /error end-point for an FX conversion request + +autonumber + +' Actor Keys: +' boundary - APIs/Interfaces, etc +' collections - Kafka Topics +' control - Kafka Consumers +' entity - Database Access Objects +' database - Database Persistance Store + +' declare actors +actor "DFSP1\nPayer" as DFSP1 +actor "FXP1\nFXP" as FXP1 +boundary "ML API Adapter" as MLAPI +control "ML API Notification Event Handler" as NOTIFY_HANDLER +boundary "Central Service API" as CSAPI +collections "transfer-fulfil-topic" as TOPIC_FULFIL +control "Fulfil Event Handler" as FULF_HANDLER +collections "topic-transfer-position" as TOPIC_TRANSFER_POSITION +control "Position Event Handler" as POS_HANDLER +collections "Notification-Topic" as TOPIC_NOTIFICATIONS + +box "Financial Service Providers" #lightGray + participant DFSP1 + participant FXP1 +end box + +box "ML API Adapter Service" #LightBlue + participant MLAPI + participant NOTIFY_HANDLER +end box + +box "Central Service" #LightYellow + participant CSAPI + participant TOPIC_FULFIL + participant FULF_HANDLER + participant TOPIC_TRANSFER_POSITION + participant POS_HANDLER + participant TOPIC_NOTIFICATIONS +end box + +' start flow +activate NOTIFY_HANDLER +activate FULF_HANDLER +activate POS_HANDLER +group FXP1 sends a Fulfil Success Transfer request + FXP1 <-> FXP1: During processing of an incoming\nPOST /fxTransfers request, some processing\nerror occurred and an Error callback is made + note right of FXP1 #yellow + Headers - transferHeaders: { + Content-Length: , + Content-Type: , + Date: , + X-Forwarded-For: , + FSPIOP-Source: , + FSPIOP-Destination: , + FSPIOP-Encryption: , + FSPIOP-Signature: , + FSPIOP-URI: , + FSPIOP-HTTP-Method: + } + + Payload - errorMessage: + { + errorInformation + { + "errorCode": , + "errorDescription": + "extensionList": { + "extension": [ + { + "key": , + "value": + } + ] + } + } + } + end note + FXP1 ->> MLAPI: PUT - /fxTransfers//error + activate MLAPI + MLAPI -> MLAPI: Schema validation + alt Schema validation (failure) + MLAPI -> FXP1: Respond HTTP - 400 (Bad Request) + end + MLAPI -> MLAPI: Validate incoming message (e.g error code is valid)\n**Error codes:** 3100 + note right of MLAPI #yellow + Message: + { + id: , + from: , + to: , + type: application/json, + content: { + headers: , + payload: + }, + metadata: { + event: { + id: , + type: fulfil, + action: fx_abort, + createdAt: , + state: { + status: "success", + code: 0 + } + } + } + } + end note + MLAPI -> TOPIC_FULFIL: Route & Publish Abort/Reject event for FXP\nError code: 2001 + activate TOPIC_FULFIL + TOPIC_FULFIL <-> TOPIC_FULFIL: Ensure event is replicated as configured (ACKS=all)\nError code: 2001 + TOPIC_FULFIL --> MLAPI: Respond replication acknowledgements have been received + deactivate TOPIC_FULFIL + MLAPI -->> FXP1: Respond HTTP - 200 (OK) + deactivate MLAPI + TOPIC_FULFIL <- FULF_HANDLER: Consume message + ref over TOPIC_FULFIL, TOPIC_TRANSFER_POSITION: Fulfil Handler Consume (Reject/Abort)\n + FULF_HANDLER -> TOPIC_TRANSFER_POSITION: Produce message + ||| + TOPIC_TRANSFER_POSITION <- POS_HANDLER: Consume message + ref over TOPIC_TRANSFER_POSITION, TOPIC_NOTIFICATIONS: Position Handler Consume (Abort)\n + POS_HANDLER -> TOPIC_NOTIFICATIONS: Produce message + ||| + TOPIC_NOTIFICATIONS <- NOTIFY_HANDLER: Consume message + opt action == 'fx_abort' + ||| + ref over DFSP1, TOPIC_NOTIFICATIONS: Send notification to Participant (Payer)\n + NOTIFY_HANDLER -> DFSP1: Send callback notification + end + ||| + TOPIC_NOTIFICATIONS <- NOTIFY_HANDLER: Consume message + opt action == 'fx_abort' + ||| + ref over FXP1, TOPIC_NOTIFICATIONS: Send notification to Participant (FXP)\n + NOTIFY_HANDLER -> FXP1: Send callback notification + end + ||| +end +deactivate POS_HANDLER +deactivate FULF_HANDLER +deactivate NOTIFY_HANDLER +@enduml \ No newline at end of file From b88f3d403ffc0652461452a7dcb5f320ebc24334 Mon Sep 17 00:00:00 2001 From: Steven Oderayi Date: Mon, 1 Apr 2024 10:11:28 +0100 Subject: [PATCH 4/9] feat: update fx seq diagrams --- .../assets/diagrams/sequence/seq-fx-fulfil-2.1.0.plantuml | 2 +- .../assets/diagrams/sequence/seq-fx-prepare-1.1.0.plantuml | 4 ++-- .../assets/diagrams/sequence/seq-fx-reject-2.2.0.a.plantuml | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/docs/technical/central-ledger/assets/diagrams/sequence/seq-fx-fulfil-2.1.0.plantuml b/docs/technical/central-ledger/assets/diagrams/sequence/seq-fx-fulfil-2.1.0.plantuml index 8655fa28..1939a92d 100644 --- a/docs/technical/central-ledger/assets/diagrams/sequence/seq-fx-fulfil-2.1.0.plantuml +++ b/docs/technical/central-ledger/assets/diagrams/sequence/seq-fx-fulfil-2.1.0.plantuml @@ -33,7 +33,7 @@ autonumber ' declare actors actor "DFSP1\nPayer" as DFSP1 -actor "FXP1\nFXP" as FXP1 +control "FXP1\nFXP" as FXP1 boundary "ML API Adapter" as MLAPI control "ML API Notification Event Handler" as NOTIFY_HANDLER boundary "Central Service API" as CSAPI diff --git a/docs/technical/central-ledger/assets/diagrams/sequence/seq-fx-prepare-1.1.0.plantuml b/docs/technical/central-ledger/assets/diagrams/sequence/seq-fx-prepare-1.1.0.plantuml index 0545869d..0f0fb701 100644 --- a/docs/technical/central-ledger/assets/diagrams/sequence/seq-fx-prepare-1.1.0.plantuml +++ b/docs/technical/central-ledger/assets/diagrams/sequence/seq-fx-prepare-1.1.0.plantuml @@ -60,7 +60,7 @@ autonumber ' declare actors actor "DFSP1\nPayer" as DFSP1 -actor "FXP1\nFXP" as FXP1 +control "FXP1\nFXP" as FXP1 boundary "ML API Adapter" as MLAPI control "ML API Notification Event Handler" as NOTIFY_HANDLER boundary "Central Service API" as CSAPI @@ -176,7 +176,7 @@ group DFSP1 sends an FX Conversion request to FXP1 POS_HANDLER -> TOPIC_NOTIFICATIONS: Produce message ||| TOPIC_NOTIFICATIONS <- NOTIFY_HANDLER: Consume message - ref over FXP1, TOPIC_NOTIFICATIONS : Send notification to Participant (Payee)\n + ref over FXP1, TOPIC_NOTIFICATIONS : Send notification to Participant (FXP)\n NOTIFY_HANDLER -> FXP1: Send callback notification ||| end diff --git a/docs/technical/central-ledger/assets/diagrams/sequence/seq-fx-reject-2.2.0.a.plantuml b/docs/technical/central-ledger/assets/diagrams/sequence/seq-fx-reject-2.2.0.a.plantuml index dcbde06b..ae16da1c 100644 --- a/docs/technical/central-ledger/assets/diagrams/sequence/seq-fx-reject-2.2.0.a.plantuml +++ b/docs/technical/central-ledger/assets/diagrams/sequence/seq-fx-reject-2.2.0.a.plantuml @@ -39,7 +39,7 @@ autonumber ' declare actors actor "DFSP1\nPayer" as DFSP1 -actor "FXP1\nFXP" as FXP1 +control "FXP1\nFXP" as FXP1 boundary "ML API Adapter" as MLAPI control "ML API Notification Event Handler" as NOTIFY_HANDLER boundary "Central Service API" as CSAPI From e2e63e41f6845c78933f5616d533e39e3159dd1a Mon Sep 17 00:00:00 2001 From: Steven Oderayi Date: Mon, 1 Apr 2024 11:12:54 +0100 Subject: [PATCH 5/9] feat: update seq diagrams --- .../sequence/seq-fx-prepare-1.1.1.a.plantuml | 35 +++++++------------ .../sequence/seq-fx-prepare-1.1.2.a.plantuml | 32 +++-------------- 2 files changed, 17 insertions(+), 50 deletions(-) diff --git a/docs/technical/central-ledger/assets/diagrams/sequence/seq-fx-prepare-1.1.1.a.plantuml b/docs/technical/central-ledger/assets/diagrams/sequence/seq-fx-prepare-1.1.1.a.plantuml index b1e37bfb..f4ce2129 100644 --- a/docs/technical/central-ledger/assets/diagrams/sequence/seq-fx-prepare-1.1.1.a.plantuml +++ b/docs/technical/central-ledger/assets/diagrams/sequence/seq-fx-prepare-1.1.1.a.plantuml @@ -34,7 +34,6 @@ autonumber collections "topic-transfer-prepare" as TOPIC_TRANSFER_PREPARE control "Prepare Event Handler" as PREP_HANDLER collections "topic-transfer-position" as TOPIC_TRANSFER_POSITION -collections "Event-Topic" as TOPIC_EVENTS collections "Notification-Topic" as TOPIC_NOTIFICATIONS entity "Position DAO" as POS_DAO entity "Participant DAO" as PARTICIPANT_DAO @@ -44,7 +43,6 @@ box "Central Service" #LightYellow participant TOPIC_TRANSFER_PREPARE participant PREP_HANDLER participant TOPIC_TRANSFER_POSITION - participant TOPIC_EVENTS participant TOPIC_NOTIFICATIONS participant POS_DAO participant PARTICIPANT_DAO @@ -64,13 +62,6 @@ group Prepare Handler Consume end end - group Persist Event Information - ||| - PREP_HANDLER -> TOPIC_EVENTS: Publish event information - ref over PREP_HANDLER, TOPIC_EVENTS: Event Handler Consume\n - ||| - end - group Validate Prepare Transfer PREP_HANDLER <-> PREP_HANDLER: Schema validation of the incoming message PREP_HANDLER <-> PREP_HANDLER: Verify the message's signature (to be confirmed in future requirement) @@ -95,7 +86,13 @@ group Prepare Handler Consume end note else hasDuplicateId == TRUE && hasDuplicateHash == TRUE break - PREP_HANDLER -> PREP_HANDLER: stateRecord = await getFxTransferById(commitRequestId) + PREP_HANDLER -> DB: stateRecord = await getFxTransferById(commitRequestId) + activate DB + hnote over DB #lightyellow + fxTransferStateChange + end note + DB --> PREP_HANDLER: Return stateRecord + deactivate DB alt [COMMITTED, ABORTED].includes(stateRecord.transferStateEnumeration) ||| @@ -153,25 +150,21 @@ group Prepare Handler Consume end alt Validate Prepare Transfer (success) group Persist Transfer State (with transferState='RECEIVED-PREPARE') - PREP_HANDLER -> POS_DAO: Request to persist transfer\nError codes: 2003 - activate POS_DAO - POS_DAO -> DB: Persist transfer + PREP_HANDLER -> DB: Request to persist transfer\nError codes: 2003 + activate DB hnote over DB #lightyellow fxTransfer fxTransferParticipant fxTransferStateChange fxTransferExtension end note - activate DB + DB --> PREP_HANDLER: Return success deactivate DB - POS_DAO --> PREP_HANDLER: Return success - deactivate POS_DAO end else Validate Prepare Transfer (failure) group Persist Transfer State (with transferState='INVALID') (Introducing a new status INVALID to mark these entries) - PREP_HANDLER -> POS_DAO: Request to persist transfer\n(when Payee/Payer/crypto-condition validation fails)\nError codes: 2003 - activate POS_DAO - POS_DAO -> DB: Persist transfer + PREP_HANDLER -> DB: Request to persist transfer\n(when Payee/Payer/crypto-condition validation fails)\nError codes: 2003 + activate DB hnote over DB #lightyellow fxTransfer fxTransferParticipant @@ -179,10 +172,8 @@ group Prepare Handler Consume fxTransferExtension fxTransferError end note - activate DB + DB --> PREP_HANDLER: Return success deactivate DB - POS_DAO --> PREP_HANDLER: Return success - deactivate POS_DAO end end end diff --git a/docs/technical/central-ledger/assets/diagrams/sequence/seq-fx-prepare-1.1.2.a.plantuml b/docs/technical/central-ledger/assets/diagrams/sequence/seq-fx-prepare-1.1.2.a.plantuml index 228b6ee5..ce7655e9 100644 --- a/docs/technical/central-ledger/assets/diagrams/sequence/seq-fx-prepare-1.1.2.a.plantuml +++ b/docs/technical/central-ledger/assets/diagrams/sequence/seq-fx-prepare-1.1.2.a.plantuml @@ -65,13 +65,6 @@ group Position Handler Consume end end - ' group Persist Event Information - ' ||| - ' POS_HANDLER -> TOPIC_EVENTS: Publish event information - ' ref over POS_HANDLER, TOPIC_EVENTS : Event Handler Consume\n - ' ||| - ' end - alt Calulate & Validate Latest Position (success) group Calculate position and persist change POS_HANDLER -> SETTLEMENT_DAO: Request active settlement models @@ -100,30 +93,15 @@ group Position Handler Consume PARTICIPANT_DAO --> POS_HANDLER: Return Payer Participant position account by name and currency deactivate PARTICIPANT_DAO - POS_HANDLER -> POS_DAO: Request latest transfer state from DB - activate POS_DAO - POS_DAO -> DB: Retrieve transfer state from DB by 'commitRequestId' + POS_HANDLER -> DB: Retrieve transfer state from DB by 'commitRequestId' activate DB hnote over DB #lightyellow fxTransferStateChange end note - DB --> POS_DAO: Retrieve transfer state from DB + DB --> POS_HANDLER: Retrieve transfer state from DB deactivate DB - POS_DAO --> POS_HANDLER: Return transfer state - deactivate POS_DAO - - ' POS_HANDLER -> POS_DAO: Request latest position from DB for Payer - ' activate POS_DAO - ' POS_DAO -> DB: Retrieve latest position from DB for Payer - ' activate DB - ' hnote over DB #lightyellow - ' transferPosition - ' end note - ' DB --> POS_DAO: Retrieve latest position from DB for Payer - ' deactivate DB - ' POS_DAO --> POS_HANDLER: Return latest position - ' deactivate POS_DAO - + DB --> POS_HANDLER: Return transfer state + POS_HANDLER -> PARTICIPANT_DAO: Request position limits for Payer Participant activate PARTICIPANT_DAO PARTICIPANT_DAO -> DB: Request position limits for Payer Participant @@ -154,9 +132,7 @@ group Position Handler Consume POS_DAO --> POS_HANDLER: Return payer participant position for the transfer currency and settlement currency deactivate POS_DAO - ' Update participant position (increase reserved position by transfer amount) POS_HANDLER <-> POS_HANDLER: Update participant position (increase reserved position by transfer amount) - ' Update payer participant position in DB POS_HANDLER -> DB: Persist payer participant position in DB activate DB hnote over DB #lightyellow From 3492c8e6b9d4fb392921a3ec20d01200b61f331d Mon Sep 17 00:00:00 2001 From: Steven Oderayi Date: Mon, 1 Apr 2024 12:29:01 +0100 Subject: [PATCH 6/9] fix: fix build error --- docs/.vuepress/config.js | 2 +- docs/community/{ => tools}/test.md | 0 .../diagrams/sequence/seq-fx-fulfil-2.1.0.svg | 330 ++++++++++++ .../sequence/seq-fx-prepare-1.1.0.svg | 252 +++++++++ .../sequence/seq-fx-prepare-1.1.1.a.svg | 465 +++++++++++++++++ .../sequence/seq-fx-prepare-1.1.2.a.svg | 484 ++++++++++++++++++ .../sequence/seq-fx-reject-2.2.0.a.svg | 285 +++++++++++ 7 files changed, 1817 insertions(+), 1 deletion(-) rename docs/community/{ => tools}/test.md (100%) create mode 100644 docs/technical/central-ledger/assets/diagrams/sequence/seq-fx-fulfil-2.1.0.svg create mode 100644 docs/technical/central-ledger/assets/diagrams/sequence/seq-fx-prepare-1.1.0.svg create mode 100644 docs/technical/central-ledger/assets/diagrams/sequence/seq-fx-prepare-1.1.1.a.svg create mode 100644 docs/technical/central-ledger/assets/diagrams/sequence/seq-fx-prepare-1.1.2.a.svg create mode 100644 docs/technical/central-ledger/assets/diagrams/sequence/seq-fx-reject-2.2.0.a.svg diff --git a/docs/.vuepress/config.js b/docs/.vuepress/config.js index 6738d84f..907cdea9 100644 --- a/docs/.vuepress/config.js +++ b/docs/.vuepress/config.js @@ -127,7 +127,7 @@ module.exports = { ['tools/pragmatic-rest', 'Pragmatic Rest'], ['tools/code-quality-metrics', 'Code Quality Metrics'], ['tools/automated-testing', 'Automated Testing'], - ['tools/test', 'Test'], + // ['tools/test', 'Test'], ] }, { diff --git a/docs/community/test.md b/docs/community/tools/test.md similarity index 100% rename from docs/community/test.md rename to docs/community/tools/test.md diff --git a/docs/technical/central-ledger/assets/diagrams/sequence/seq-fx-fulfil-2.1.0.svg b/docs/technical/central-ledger/assets/diagrams/sequence/seq-fx-fulfil-2.1.0.svg new file mode 100644 index 00000000..c338b9c1 --- /dev/null +++ b/docs/technical/central-ledger/assets/diagrams/sequence/seq-fx-fulfil-2.1.0.svg @@ -0,0 +1,330 @@ + + + + + + + + + + + + 2.1.0. FXP sends an Fulfil Success FX Conversion Request + + Financial Service Providers + + ML API Adapter Service + + Central Service + + + + + + + + + + + + + + + + + + + + + + + DFSP1 + Payer + + + DFSP1 + Payer + + + FXP1 + FXP + + + FXP1 + FXP + + + ML API Adapter + + + ML API Adapter + + + ML API Notification Event Handler + + + ML API Notification Event Handler + + + Central Service API + + + Central Service API + + + + + topic-transfer-fulfil + + + topic-transfer-fulfil + Fulfil Event Handler + + + Fulfil Event Handler + + + + + topic- + settlement-model + + + topic- + settlement-model + Settlement Model + Handler + + + Settlement Model + Handler + + + + + topic- + transfer-position + + + topic- + transfer-position + Position Handler + + + Position Handler + + + + + topic- + notification + + + topic- + notification + + + + + + + + + FXP1 sends a fulfil success FX conversion request + + + + + 1 + Retrieve fulfilment string generated during + the FX quoting process or regenerate it using + Local secret + and + ILP Packet + as inputs + + + Headers - transferHeaders: { + Content-Length: <Content-Length>, + Content-Type: <Content-Type>, + Date: <Date>, + X-Forwarded-For: <X-Forwarded-For>, + FSPIOP-Source: <FSPIOP-Source>, + FSPIOP-Destination: <FSPIOP-Destination>, + FSPIOP-Encryption: <FSPIOP-Encryption>, + FSPIOP-Signature: <FSPIOP-Signature>, + FSPIOP-URI: <FSPIOP-URI>, + FSPIOP-HTTP-Method: <FSPIOP-HTTP-Method> + } + + Payload - transferMessage: + { + "conversionState": "<transferState>" + "fulfilment": <IlpFulfilment>, + "completedTimestamp": <DateTime>, + "extensionList": { + "extension": [ + { + "key": <string>, + "value": <string> + } + ] + } + } + + + + 2 + PUT - /fxTransfers/<ID> + + + + + 3 + Schema validation + + + + break + [Schema validation failed] + + + + 4 + Respond HTTP - 400 (Bad Request) + + + + + 5 + Validate incoming request + (e.g transfer has not timed out, completedTimestamp is not in the future) + Error codes: + 2001, 3100 + + + Message: + { + id: <ID>, + from: <transferHeaders.FSPIOP-Source>, + to: <transferHeaders.FSPIOP-Destination>, + type: application/json, + content: { + headers: <transferHeaders>, + payload: <transferMessage> + }, + metadata: { + event: { + id: <uuid>, + type: fulfil, + action: fx_commit, + createdAt: <timestamp>, + state: { + status: "success", + code: 0 + } + } + } + } + + + 6 + Route & Publish Fulfil event for Payee + Error code: + 2001 + + + + + 7 + Ensure event is replicated as configured (ACKS=all) + Error code: + 2001 + + + 8 + Respond replication acknowledgements have been received + + + + 9 + Respond HTTP - 200 (OK) + + + 10 + Consume message + + + ref + Fulfil Handler Consume (Success) { + + 2.1.1 + + } + + + + 11 + Produce message + + + 12 + Produce message + + + 13 + Consume message + + + ref + Settlement Model Handler Consume (Success) + + + + 14 + Consume message + + + ref + Position Handler Consume (Success) + + + + 15 + Produce message + + + 16 + Consume message + + + opt + [action == 'fx_commit'] + + + ref + Send notification to Participant (Payer) + + + + 17 + Send callback notification + + + 18 + Consume message + + + opt + [action == 'fx_commit'] + + + ref + Send notification to Participant (FXP) + + + + 19 + Send callback notification + + diff --git a/docs/technical/central-ledger/assets/diagrams/sequence/seq-fx-prepare-1.1.0.svg b/docs/technical/central-ledger/assets/diagrams/sequence/seq-fx-prepare-1.1.0.svg new file mode 100644 index 00000000..d5d22010 --- /dev/null +++ b/docs/technical/central-ledger/assets/diagrams/sequence/seq-fx-prepare-1.1.0.svg @@ -0,0 +1,252 @@ + + + + + + + + + + + + 1.1.0. DFSP1 sends an FX Conversion prepare request to FXP1 + + Financial Service Providers + + ML API Adapter Service + + Central Service + + + + + + + + + + + + + + + + + + + DFSP1 + Payer + + + DFSP1 + Payer + + + FXP1 + FXP + + + FXP1 + FXP + + + ML API Adapter + + + ML API Adapter + + + ML API Notification Event Handler + + + ML API Notification Event Handler + + + Central Service API + + + Central Service API + + + + + topic-transfer-prepare + + + topic-transfer-prepare + Prepare Event Handler + + + Prepare Event Handler + + + + + topic-transfer-position + + + topic-transfer-position + Position Event Handler + + + Position Event Handler + + + + + Notification-Topic + + + Notification-Topic + + + + + + + + DFSP1 sends an FX Conversion request to FXP1 + + + Headers - transferHeaders: { + Content-Length: <Content-Length>, + Content-Type: <Content-Type>, + Date: <Date>, + X-Forwarded-For: <X-Forwarded-For>, + FSPIOP-Source: <FSPIOP-Source>, + FSPIOP-Destination: <FSPIOP-Destination>, + FSPIOP-Encryption: <FSPIOP-Encryption>, + FSPIOP-Signature: <FSPIOP-Signature>, + FSPIOP-URI: <FSPIOP-URI>, + FSPIOP-HTTP-Method: <FSPIOP-HTTP-Method> + } + + Payload: + { + "commitRequestId": "<UUID>", + "determiningTransferId": "<UUID>", + "initiatingFsp": "<DFSP1>", + "counterPartyFsp": "<fxpId>", + "amountType": "SEND", + "sourceAmount": { + "currency": "<ISO currency code>", + "amount": "<number>" + }, + "targetAmount": { + "currency": "<ISO currency code>", + "amount": "<number>" + }, + "condition": "<ILP condition>" + } + + + + 1 + POST - /fxTransfers + + + + 2 + Respond HTTP - 202 (Accepted) + + + alt + [Schema validation error] + + + + 3 + Respond HTTP - 400 (Bad Request) + + + Message: + { + id: <transferMessage.commitRequestId> + from: <transferMessage.initiatingFsp>, + to: <transferMessage.counterPartyFsp>, + type: application/json + content: { + headers: <transferHeaders>, + payload: <transferMessage> + }, + metadata: { + event: { + id: <UUID>, + type: prepare, + action: fx_prepare, + createdAt: <timestamp>, + state: { + status: "success", + code: 0 + } + } + } + } + + + 4 + Route & Publish FX Prepare event for Payer + + + + + 5 + Ensure event is replicated as configured (ACKS=all) + Error code: + 2003 + + + 6 + Replication acknowledgements have been received + + + alt + [Error publishing event] + + + + 7 + Respond HTTP - 500 (Internal Server Error) + Error code: + 2003 + + + 8 + Consume message + + + ref + Prepare Handler Consume + + + + 9 + Produce message + + + 10 + Consume message + + + ref + Position Handler Consume + + + + 11 + Produce message + + + 12 + Consume message + + + ref + Send notification to Participant (FXP) + + + + 13 + Send callback notification + + diff --git a/docs/technical/central-ledger/assets/diagrams/sequence/seq-fx-prepare-1.1.1.a.svg b/docs/technical/central-ledger/assets/diagrams/sequence/seq-fx-prepare-1.1.1.a.svg new file mode 100644 index 00000000..9a2a23a0 --- /dev/null +++ b/docs/technical/central-ledger/assets/diagrams/sequence/seq-fx-prepare-1.1.1.a.svg @@ -0,0 +1,465 @@ + + + + + + + + + + + + 1.1.1.a. FX Prepare Handler Consume (single message) + + Central Service + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + topic-transfer-prepare + + + topic-transfer-prepare + Prepare Event Handler + + + Prepare Event Handler + + + + + topic-transfer-position + + + topic-transfer-position + + + Notification-Topic + + + Notification-Topic + Position DAO + + + Position DAO + + + Participant DAO + + + Participant DAO + + + Central Store + + + Central Store + + + + + + + + + + + + + + + + + + Prepare Handler Consume + + + 1 + Consume Prepare event message + + + break + + + Filter Event + + + + + 2 + Filter event - Rules: type == 'prepare' && action == 'fx_prepare' + Error codes: + 2001 + + + Validate Prepare Transfer + + + + + 3 + Schema validation of the incoming message + + + + + 4 + Verify the message's signature (to be confirmed in future requirement) + + + The above validation steps are already handled by + the ML-Adapter for the open source implementation. + It may need to be added in future for custom adapters. + + + Duplicate Check + + + 5 + Request Duplicate Check + + + ref + Request Duplicate Check + + + + 6 + Return { hasDuplicateId: Boolean, hasDuplicateHash: Boolean } + + + alt + [hasDuplicateId == TRUE] + + + Process Duplication + + + alt + [hasDuplicateId == TRUE && hasDuplicateHash == FALSE] + + + Validate Prepare Transfer (failure) - Modified Request + + [hasDuplicateId == TRUE && hasDuplicateHash == TRUE] + + + break + + + 7 + stateRecord = await getFxTransferById(commitRequestId) + + fxTransferStateChange + + + 8 + Return stateRecord + + + alt + [[COMMITTED, ABORTED].includes(stateRecord.transferStateEnumeration)] + + + 9 + Produce message [functionality = TRANSFER, action = PREPAPE_DUPLICATE] + + + + Ignore - resend in progress + + [hasDuplicateId == FALSE] + + + Validate Prepare Request + + + Validate Payer + + + + + 10 + Validate FSPIOP-Source header matches initiatingFsp + + + + + 11 + Validate payload.sourceAmount and payload.targetAmount scale and precision + + + 12 + Request to retrieve Payer Participant details (if it exists) + + + 13 + Request Participant details + + participant + participantCurrency + + + 14 + Return Participant details if it exists + + + 15 + Return Participant details if it exists + + + + + 16 + Validate Payer participant is active + + + + + 17 + Validate Payer participant position account for the source currency [exists, active] + + + Validate Payee + + + 18 + Request to retrieve Payee Participant details (if it exists) + + + 19 + Request Participant details + + participant + participantCurrency + + + 20 + Return Participant details if it exists + + + 21 + Return Participant details if it exists + + + + + 22 + Validate Payee participant is active + + + + + 23 + Validate Payee participant position account for the target currency [exists, active] + + + Validate Condition and Expiration + + + + + 24 + Validate cryptographic condition + + + + + 25 + Validate expiration [payload.expiration is valid ISO date and not in the past] + + + Validate Different FSPs (if ENABLE_ON_US_TRANSFER == false) + + + + + 26 + Validate Payer and Payee FSPs are different + + + alt + [Validate Prepare Transfer (success)] + + + Persist Transfer State (with transferState='RECEIVED-PREPARE') + + + 27 + Request to persist transfer + Error codes: + 2003 + + fxTransfer + fxTransferParticipant + fxTransferStateChange + fxTransferExtension + + + 28 + Return success + + [Validate Prepare Transfer (failure)] + + + Persist Transfer State (with transferState='INVALID') (Introducing a new status INVALID to mark these entries) + + + 29 + Request to persist transfer + (when Payee/Payer/crypto-condition validation fails) + Error codes: + 2003 + + fxTransfer + fxTransferParticipant + fxTransferStateChange + fxTransferExtension + fxTransferError + + + 30 + Return success + + + alt + [Validate Prepare Transfer (success)] + + + Hydrate Transfer Prepare Message + + + 31 + Get participant and currency for FX transfer (with 'payload.determiningTransferId') + + + 32 + Request participant and currency + + participant + participantCurrency + + + 33 + Return participant and currency + + + 34 + Return participant and currency + + + Message: + { + id: <transferMessage.commitRequestId> + from: <transferMessage.initiatingFsp>, + to: <transferMessage.counterPartyFsp>, + type: application/json + content: { + headers: <transferHeaders>, + payload: <hydratedTransferMessage> + }, + metadata: { + event: { + id: <uuid>, + responseTo: <previous.uuid>, + type: position, + action: fx_prepare, + createdAt: <timestamp>, + state: { + status: "success", + code: 0 + } + } + } + } + + + 35 + Route & Publish Position event for Payer + Error codes: + 2003 + + [Validate Prepare Transfer (failure)] + + + Message: + { + id: <transferMessage.commitRequestId> + from: <ledgerName>, + to: <transferMessage.initiatingFsp>, + type: application/json + content: { + headers: <transferHeaders>, + payload: { + "errorInformation": { + "errorCode": <possible codes: [2003, 3100, 3105, 3106, 3202, 3203, 3300, 3301]> + "errorDescription": "<refer to section 35.1.3 for description>", + "extensionList": <transferMessage.extensionList> + } + }, + metadata: { + event: { + id: <uuid>, + responseTo: <previous.uuid>, + type: notification, + action: fx_prepare, + createdAt: <timestamp>, + state: { + status: 'error', + code: <errorInformation.errorCode> + description: <errorInformation.errorDescription> + } + } + } + } + + + 36 + Publish Notification (failure) event for Payer + Error codes: + 2003 + + diff --git a/docs/technical/central-ledger/assets/diagrams/sequence/seq-fx-prepare-1.1.2.a.svg b/docs/technical/central-ledger/assets/diagrams/sequence/seq-fx-prepare-1.1.2.a.svg new file mode 100644 index 00000000..2ef69321 --- /dev/null +++ b/docs/technical/central-ledger/assets/diagrams/sequence/seq-fx-prepare-1.1.2.a.svg @@ -0,0 +1,484 @@ + + + + + + + + + + + + 1.1.2.a. Position Handler Consume (single message) + + Central Service + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + topic-transfer-position + + + topic-transfer-position + Position Event Handler + + + Position Event Handler + + + + + Event-Topic + + + Event-Topic + + + Notification-Topic + + + Notification-Topic + Position DAO + + + Position DAO + + + Participant DAO + + + Participant DAO + + + Settlement DAO + + + Settlement DAO + + + Central Store + + + Central Store + + + + + + + + + + + + + + + + + + + + + + + + + + + Position Handler Consume + + + 1 + Consume Position event message for Payer + + + break + + + Validate Event + + + + + 2 + Validate event - Rule: type == 'position' && action == 'fx_prepare' + + + + + 3 + Validate 'payload.commitRequestId' or 'message.value.content.uriParams.id' is not empty + Error code: + 2003 + + + alt + [Calulate & Validate Latest Position (success)] + + + Calculate position and persist change + + + 4 + Request active settlement models + + + 5 + Retrieve active settlement models + + settlementModel + + + 6 + Return active settlement models + + + 7 + Return active settlement models + + + + + 8 + Select currency matching or default settlement model for POSITION ledger account type + Error code: + 6000 + + + 9 + Request Payer Participant position account by name and currency + + + 10 + Retrieve Payer Participant position account by name and currency + + participant + participantCurrency + + + 11 + Return Payer Participant position account by name and currency + + + 12 + Return Payer Participant position account by name and currency + + + 13 + Retrieve transfer state from DB by 'commitRequestId' + + fxTransferStateChange + + + 14 + Retrieve transfer state from DB + + + 15 + Return transfer state + + + 16 + Request position limits for Payer Participant + + + 17 + Request position limits for Payer Participant + + participant + participantLimit + + + 18 + Return position limits + + + 19 + Return position limits + + + alt + [Validate transfer state (transferState='RECEIVED_PREPARE')] + + + + + 20 + Update transfer state to RESERVED + + + + + 21 + Calculate latest position for prepare + + + + + 22 + Validate calculated latest position (lpos) against the net-debit cap (netcap) - Rule: lpos < netcap + + + 23 + Request payer participant position for the transfer currency and settlement currency + + + 24 + Retrieve payer participant position for the transfer currency and settlement currency + + participantPosiiton + + + 25 + Return payer participant position for the transfer currency and settlement currency + + + + + 26 + Update participant position (increase reserved position by transfer amount) + + + 27 + Persist payer participant position in DB + + participantPosition + + + 28 + Return success + + + 29 + Request payer participant limit by currency + + + 30 + Retrieve payer participant limit by currency + + participant + participantCurrency + participantLimit + + + 31 + Return payer participant limit by currency + + + 32 + Return payer participant limit by currency + + + + + 33 + Calculate latest available position based on payer limit and payer liquidity cover + + + alt + [Validate position limits (success)] + + + + + 34 + Update transfer state to RESERVED + + + 35 + Update participant position + + participantPosition + + + 36 + Persist transfer state change (RESERVED) to DB + + fxTransferStateChange + + + 37 + Insert participant position change record + + participantPositionChange + + [Validate position limits (failure)] + + + 38 + Persist transfer state change (ABORTED_REJECTED) to DB, + Error codes: + 4001, 4200 + + fxTransferStateChange + + [transferState !='RECEIVED_PREPARE'] + + + + + 39 + Update transfer state to ABORTED_REJECTED + + + 40 + Persist aborted transfer state + + fxTransferStateChange + + + alt + [Transfer state is RESERVED] + + + Message: + { + id: <transferMessage.commitRequestId> + from: <transferMessage.initiatingFsp>, + to: <transferMessage.counterPartyFsp>, + type: application/json + content: { + headers: <transferHeaders>, + payload: <transferMessage> + }, + metadata: { + event: { + id: <uuid>, + responseTo: <previous.uuid>, + type: transfer, + action: prepare, + createdAt: <timestamp>, + state: { + status: "success", + code: 0 + } + } + } + } + + + 41 + Publish Notification event to FXP + + + + Message: + { + id: <transferMessage.commitRequestId> + from: <switch>, + to: <transferMessage.initiatingFsp>, + type: application/json + content: { + headers: <transferHeaders>, + payload: { + "errorInformation": { + "errorCode": <error code>, + "errorDescription": "<error description>", + "extensionList": <transferMessage.extensionList> + } + } + }, + metadata: { + event: { + id: <uuid>, + responseTo: <previous.uuid>, + type: notification, + action: prepare, + createdAt: <timestamp>, + state: { + status: 'error', + code: <errorInformation.errorCode> + description: <errorInformation.errorDescription> + } + } + } + } + + + 42 + Publish Notification (failure) event for Payer. + Error code: + 2001 + + [Calculate & Validate Latest Position (failure)] + + + Message: + { + id: <transferMessage.transferId> + from: <ledgerName>, + to: <transferMessage.payerFsp>, + type: application/json + content: { + headers: <transferHeaders>, + payload: { + "errorInformation": { + "errorCode": <error code>, + "errorDescription": "<error description>", + "extensionList": <transferMessage.extensionList> + } + }, + metadata: { + event: { + id: <uuid>, + responseTo: <previous.uuid>, + type: notification, + action: prepare, + createdAt: <timestamp>, + state: { + status: 'error', + code: <errorInformation.errorCode> + description: <errorInformation.errorDescription> + } + } + } + } + + + 43 + Publish Notification (failure) event for Payer + Error codes: + 4001, 4200 + + diff --git a/docs/technical/central-ledger/assets/diagrams/sequence/seq-fx-reject-2.2.0.a.svg b/docs/technical/central-ledger/assets/diagrams/sequence/seq-fx-reject-2.2.0.a.svg new file mode 100644 index 00000000..208a3245 --- /dev/null +++ b/docs/technical/central-ledger/assets/diagrams/sequence/seq-fx-reject-2.2.0.a.svg @@ -0,0 +1,285 @@ + + + + + + + + + + + + 2.2.0.a. FXP1 sends a PUT call on /error end-point for an FX conversion request + + Financial Service Providers + + ML API Adapter Service + + Central Service + + + + + + + + + + + + + + + + + + + + DFSP1 + Payer + + + DFSP1 + Payer + + + FXP1 + FXP + + + FXP1 + FXP + + + ML API Adapter + + + ML API Adapter + + + ML API Notification Event Handler + + + ML API Notification Event Handler + + + Central Service API + + + Central Service API + + + + + transfer-fulfil-topic + + + transfer-fulfil-topic + Fulfil Event Handler + + + Fulfil Event Handler + + + + + topic-transfer-position + + + topic-transfer-position + Position Event Handler + + + Position Event Handler + + + + + Notification-Topic + + + Notification-Topic + + + + + + + + FXP1 sends a Fulfil Success Transfer request + + + + + 1 + During processing of an incoming + POST /fxTransfers request, some processing + error occurred and an Error callback is made + + + Headers - transferHeaders: { + Content-Length: <Content-Length>, + Content-Type: <Content-Type>, + Date: <Date>, + X-Forwarded-For: <X-Forwarded-For>, + FSPIOP-Source: <FSPIOP-Source>, + FSPIOP-Destination: <FSPIOP-Destination>, + FSPIOP-Encryption: <FSPIOP-Encryption>, + FSPIOP-Signature: <FSPIOP-Signature>, + FSPIOP-URI: <FSPIOP-URI>, + FSPIOP-HTTP-Method: <FSPIOP-HTTP-Method> + } + + Payload - errorMessage: + { + errorInformation + { + "errorCode": <errorCode>, + "errorDescription": <errorDescription> + "extensionList": { + "extension": [ + { + "key": <string>, + "value": <string> + } + ] + } + } + } + + + + 2 + PUT - /fxTransfers/<ID>/error + + + + + 3 + Schema validation + + + alt + [Schema validation (failure)] + + + 4 + Respond HTTP - 400 (Bad Request) + + + + + 5 + Validate incoming message (e.g error code is valid) + Error codes: + 3100 + + + Message: + { + id: <ID>, + from: <transferHeaders.FSPIOP-Source>, + to: <transferHeaders.FSPIOP-Destination>, + type: application/json, + content: { + headers: <transferHeaders>, + payload: <errorMessage> + }, + metadata: { + event: { + id: <uuid>, + type: fulfil, + action: fx_abort, + createdAt: <timestamp>, + state: { + status: "success", + code: 0 + } + } + } + } + + + 6 + Route & Publish Abort/Reject event for FXP + Error code: + 2001 + + + + + 7 + Ensure event is replicated as configured (ACKS=all) + Error code: + 2001 + + + 8 + Respond replication acknowledgements have been received + + + + 9 + Respond HTTP - 200 (OK) + + + 10 + Consume message + + + ref + Fulfil Handler Consume (Reject/Abort) + + + + 11 + Produce message + + + 12 + Consume message + + + ref + Position Handler Consume (Abort) + + + + 13 + Produce message + + + 14 + Consume message + + + opt + [action == 'fx_abort'] + + + ref + Send notification to Participant (Payer) + + + + 15 + Send callback notification + + + 16 + Consume message + + + opt + [action == 'fx_abort'] + + + ref + Send notification to Participant (FXP) + + + + 17 + Send callback notification + + From 5a5e043184f31cee473c70c555bc3a8b559af423 Mon Sep 17 00:00:00 2001 From: Steven Oderayi Date: Mon, 1 Apr 2024 12:37:43 +0100 Subject: [PATCH 7/9] chore: upgrade dependencies --- package-lock.json | 264 +++++++++++++++++++++++++++++----------------- package.json | 10 +- 2 files changed, 173 insertions(+), 101 deletions(-) diff --git a/package-lock.json b/package-lock.json index 84c99cd8..f18ddd25 100644 --- a/package-lock.json +++ b/package-lock.json @@ -11,12 +11,12 @@ "devDependencies": { "@vuepress/plugin-back-to-top": "^1.9.10", "@vuepress/plugin-medium-zoom": "^1.9.10", - "got": "^13.0.0", - "husky": "^8.0.3", - "markdownlint-cli": "^0.37.0", - "npm-check-updates": "^16.14.6", + "got": "^14.2.1", + "husky": "^9.0.11", + "markdownlint-cli": "^0.39.0", + "npm-check-updates": "^16.14.18", "plantuml-encoder": "^1.4.0", - "svgo": "^3.0.3", + "svgo": "^3.2.0", "vuepress": "^1.9.10", "vuepress-plugin-versioning": "git+https://github.com/mojaloop/vuepress-plugin-versioning.git#dcb14962a69b8e5aaf184d2d1a31ae4f43870bc1", "vuepress-theme-titanium": "^4.11.2" @@ -2410,9 +2410,9 @@ "dev": true }, "node_modules/@types/http-cache-semantics": { - "version": "4.0.1", - "resolved": "https://registry.npmjs.org/@types/http-cache-semantics/-/http-cache-semantics-4.0.1.tgz", - "integrity": "sha512-SZs7ekbP8CN0txVG2xVRH6EgKmEm31BOxA07vkFaETzZz1xh+cbt8BcI0slpymvwhx5dlFnQG2rTlPVQn+iRPQ==", + "version": "4.0.4", + "resolved": "https://registry.npmjs.org/@types/http-cache-semantics/-/http-cache-semantics-4.0.4.tgz", + "integrity": "sha512-1m0bIFVc7eJWyve9S0RnuRgcQqF/Xd5QsUZAZeQFr1Q3/p9JWoQQEqmVy+DPTNpGXwhgIetAoYF8JSc33q29QA==", "dev": true }, "node_modules/@types/http-proxy": { @@ -2490,6 +2490,12 @@ "integrity": "sha512-EEhsLsD6UsDM1yFhAvy0Cjr6VwmpMWqFBCb9w07wVugF7w9nfajxLuVmngTIpgS6svCnm6Vaw+MZhoDCKnOfsw==", "dev": true }, + "node_modules/@types/semver-utils": { + "version": "1.1.3", + "resolved": "https://registry.npmjs.org/@types/semver-utils/-/semver-utils-1.1.3.tgz", + "integrity": "sha512-T+YwkslhsM+CeuhYUxyAjWm7mJ5am/K10UX40RuA6k6Lc7eGtq8iY2xOzy7Vq0GOqhl/xZl5l2FwURZMTPTUww==", + "dev": true + }, "node_modules/@types/send": { "version": "0.17.1", "resolved": "https://registry.npmjs.org/@types/send/-/send-0.17.1.tgz", @@ -5227,15 +5233,15 @@ } }, "node_modules/cacheable-request": { - "version": "10.2.10", - "resolved": "https://registry.npmjs.org/cacheable-request/-/cacheable-request-10.2.10.tgz", - "integrity": "sha512-v6WB+Epm/qO4Hdlio/sfUn69r5Shgh39SsE9DSd4bIezP0mblOlObI+I0kUEM7J0JFc+I7pSeMeYaOYtX1N/VQ==", + "version": "10.2.14", + "resolved": "https://registry.npmjs.org/cacheable-request/-/cacheable-request-10.2.14.tgz", + "integrity": "sha512-zkDT5WAF4hSSoUgyfg5tFIxz8XQK+25W/TLVojJTMKBaxevLBBtLxgqguAuVQB8PVW79FVjHcU+GJ9tVbDZ9mQ==", "dev": true, "dependencies": { - "@types/http-cache-semantics": "^4.0.1", + "@types/http-cache-semantics": "^4.0.2", "get-stream": "^6.0.1", "http-cache-semantics": "^4.1.1", - "keyv": "^4.5.2", + "keyv": "^4.5.3", "mimic-response": "^4.0.0", "normalize-url": "^8.0.0", "responselike": "^3.0.0" @@ -7691,18 +7697,6 @@ "url": "https://github.com/cheeriojs/dom-serializer?sponsor=1" } }, - "node_modules/dom-serializer/node_modules/entities": { - "version": "4.5.0", - "resolved": "https://registry.npmjs.org/entities/-/entities-4.5.0.tgz", - "integrity": "sha512-V0hjH4dGPh9Ao5p0MoRY6BVqtwCjhz6vI5LT8AJ55H+4g9/4vbHx1I54fS0XuclLhDHArPQCiMjDxjaL8fPxhw==", - "dev": true, - "engines": { - "node": ">=0.12" - }, - "funding": { - "url": "https://github.com/fb55/entities?sponsor=1" - } - }, "node_modules/dom-walk": { "version": "0.1.2", "resolved": "https://registry.npmjs.org/dom-walk/-/dom-walk-0.1.2.tgz", @@ -7985,9 +7979,9 @@ } }, "node_modules/entities": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/entities/-/entities-3.0.1.tgz", - "integrity": "sha512-WiyBqoomrwMdFG1e0kqvASYfnlb0lp8M5o5Fw2OFq1hNZxxcNk8Ik0Xm7LxzBhuidnZB/UtBqVCgUz3kBOP51Q==", + "version": "4.5.0", + "resolved": "https://registry.npmjs.org/entities/-/entities-4.5.0.tgz", + "integrity": "sha512-V0hjH4dGPh9Ao5p0MoRY6BVqtwCjhz6vI5LT8AJ55H+4g9/4vbHx1I54fS0XuclLhDHArPQCiMjDxjaL8fPxhw==", "dev": true, "engines": { "node": ">=0.12" @@ -9751,30 +9745,72 @@ } }, "node_modules/got": { - "version": "13.0.0", - "resolved": "https://registry.npmjs.org/got/-/got-13.0.0.tgz", - "integrity": "sha512-XfBk1CxOOScDcMr9O1yKkNaQyy865NbYs+F7dr4H0LZMVgCj2Le59k6PqbNHoL5ToeaEQUYh6c6yMfVcc6SJxA==", + "version": "14.2.1", + "resolved": "https://registry.npmjs.org/got/-/got-14.2.1.tgz", + "integrity": "sha512-KOaPMremmsvx6l9BLC04LYE6ZFW4x7e4HkTe3LwBmtuYYQwpeS4XKqzhubTIkaQ1Nr+eXxeori0zuwupXMovBQ==", "dev": true, "dependencies": { - "@sindresorhus/is": "^5.2.0", + "@sindresorhus/is": "^6.1.0", "@szmarczak/http-timer": "^5.0.1", "cacheable-lookup": "^7.0.0", - "cacheable-request": "^10.2.8", + "cacheable-request": "^10.2.14", "decompress-response": "^6.0.0", - "form-data-encoder": "^2.1.2", - "get-stream": "^6.0.1", - "http2-wrapper": "^2.1.10", + "form-data-encoder": "^4.0.2", + "get-stream": "^8.0.1", + "http2-wrapper": "^2.2.1", "lowercase-keys": "^3.0.0", - "p-cancelable": "^3.0.0", + "p-cancelable": "^4.0.1", "responselike": "^3.0.0" }, "engines": { - "node": ">=16" + "node": ">=20" }, "funding": { "url": "https://github.com/sindresorhus/got?sponsor=1" } }, + "node_modules/got/node_modules/@sindresorhus/is": { + "version": "6.2.0", + "resolved": "https://registry.npmjs.org/@sindresorhus/is/-/is-6.2.0.tgz", + "integrity": "sha512-yM/IGPkVnYGblhDosFBwq0ZGdnVSBkNV4onUtipGMOjZd4kB6GAu3ys91aftSbyMHh6A2GPdt+KDI5NoWP63MQ==", + "dev": true, + "engines": { + "node": ">=16" + }, + "funding": { + "url": "https://github.com/sindresorhus/is?sponsor=1" + } + }, + "node_modules/got/node_modules/form-data-encoder": { + "version": "4.0.2", + "resolved": "https://registry.npmjs.org/form-data-encoder/-/form-data-encoder-4.0.2.tgz", + "integrity": "sha512-KQVhvhK8ZkWzxKxOr56CPulAhH3dobtuQ4+hNQ+HekH/Wp5gSOafqRAeTphQUJAIk0GBvHZgJ2ZGRWd5kphMuw==", + "dev": true, + "engines": { + "node": ">= 18" + } + }, + "node_modules/got/node_modules/get-stream": { + "version": "8.0.1", + "resolved": "https://registry.npmjs.org/get-stream/-/get-stream-8.0.1.tgz", + "integrity": "sha512-VaUJspBffn/LMCJVoMvSAdmscJyS1auj5Zulnn5UoYcY531UWmdwhRWkcGKnGU93m5HSXP9LP2usOryrBtQowA==", + "dev": true, + "engines": { + "node": ">=16" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/got/node_modules/p-cancelable": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/p-cancelable/-/p-cancelable-4.0.1.tgz", + "integrity": "sha512-wBowNApzd45EIKdO1LaU+LrMBwAcjfPaYtVzV3lmfM3gf8Z4CHZsiIqlM8TZZ8okYvh5A1cP6gTfCRQtwUpaUg==", + "dev": true, + "engines": { + "node": ">=14.16" + } + }, "node_modules/graceful-fs": { "version": "4.2.11", "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.11.tgz", @@ -10396,9 +10432,9 @@ } }, "node_modules/http2-wrapper": { - "version": "2.2.0", - "resolved": "https://registry.npmjs.org/http2-wrapper/-/http2-wrapper-2.2.0.tgz", - "integrity": "sha512-kZB0wxMo0sh1PehyjJUWRFEd99KC5TLjZ2cULC4f9iqJBAmKQQXEICjxl5iPJRwP40dpeHFqqhm7tYCvODpqpQ==", + "version": "2.2.1", + "resolved": "https://registry.npmjs.org/http2-wrapper/-/http2-wrapper-2.2.1.tgz", + "integrity": "sha512-V5nVw1PAOgfI3Lmeaj2Exmeg7fenjhRUgz1lPSezy1CuhPYbgQtbQj4jZfEAEMlaL+vupsvhjqCyjzob0yxsmQ==", "dev": true, "dependencies": { "quick-lru": "^5.1.1", @@ -10437,15 +10473,15 @@ } }, "node_modules/husky": { - "version": "8.0.3", - "resolved": "https://registry.npmjs.org/husky/-/husky-8.0.3.tgz", - "integrity": "sha512-+dQSyqPh4x1hlO1swXBiNb2HzTDN1I2IGLQx1GrBuiqFJfoMrnZWwVmatvSiO+Iz8fBUnf+lekwNo4c2LlXItg==", + "version": "9.0.11", + "resolved": "https://registry.npmjs.org/husky/-/husky-9.0.11.tgz", + "integrity": "sha512-AB6lFlbwwyIqMdHYhwPe+kjOC3Oc5P3nThEoW/AaO2BX3vJDjWPFxYLxokUZOo6RNX20He3AaT8sESs9NJcmEw==", "dev": true, "bin": { - "husky": "lib/bin.js" + "husky": "bin.mjs" }, "engines": { - "node": ">=14" + "node": ">=18" }, "funding": { "url": "https://github.com/sponsors/typicode" @@ -10509,9 +10545,9 @@ "dev": true }, "node_modules/ignore": { - "version": "5.2.4", - "resolved": "https://registry.npmjs.org/ignore/-/ignore-5.2.4.tgz", - "integrity": "sha512-MAb38BcSbH0eHNBxn7ql2NH/kX33OkB3lZ1BNdh7ENeRChHTYsTvWrMubiIAMNS2llXEEgZ1MUOBtXChP3kaFQ==", + "version": "5.3.1", + "resolved": "https://registry.npmjs.org/ignore/-/ignore-5.3.1.tgz", + "integrity": "sha512-5Fytz/IraMjqpwfd34ke28PTVMjZjJG2MPn5t7OE4eUCUNf8BAa7b5WUS9/Qvr6mwOQS7Mk6vdsMno5he+T8Xw==", "dev": true, "engines": { "node": ">= 4" @@ -11450,9 +11486,9 @@ } }, "node_modules/jsonc-parser": { - "version": "3.2.0", - "resolved": "https://registry.npmjs.org/jsonc-parser/-/jsonc-parser-3.2.0.tgz", - "integrity": "sha512-gfFQZrcTc8CnKXp6Y4/CBT3fTc0OVuDofpre4aEeEpSBPV5X5v4+Vmx+8snU7RLPrNHPKSgLxGo9YuQzz20o+w==", + "version": "3.2.1", + "resolved": "https://registry.npmjs.org/jsonc-parser/-/jsonc-parser-3.2.1.tgz", + "integrity": "sha512-AilxAyFOAcK5wA1+LeaySVBrHsGQvUFCDWXKpZjzaL0PqW+xfBOttn8GNtWKFWqneyMZj41MWF9Kl6iPWLwgOA==", "dev": true }, "node_modules/jsonfile": { @@ -11495,9 +11531,9 @@ } }, "node_modules/keyv": { - "version": "4.5.2", - "resolved": "https://registry.npmjs.org/keyv/-/keyv-4.5.2.tgz", - "integrity": "sha512-5MHbFaKn8cNSmVW7BYnijeAVlE4cYA/SVkifVgrh7yotnfhKmjuXpDKjrABLnT0SfHWV21P8ow07OGfRrNDg8g==", + "version": "4.5.4", + "resolved": "https://registry.npmjs.org/keyv/-/keyv-4.5.4.tgz", + "integrity": "sha512-oxVHkHR/EJf2CNXnWxRLW6mg7JyCCUcG0DtEGmL2ctUo1PNTin1PUil+r/+4r5MpVgC/fn1kjsx7mjSujKqIpw==", "dev": true, "dependencies": { "json-buffer": "3.0.1" @@ -11553,14 +11589,20 @@ } }, "node_modules/linkify-it": { - "version": "4.0.1", - "resolved": "https://registry.npmjs.org/linkify-it/-/linkify-it-4.0.1.tgz", - "integrity": "sha512-C7bfi1UZmoj8+PQx22XyeXCuBlokoyWQL5pWSP+EI6nzRylyThouddufc2c1NDIcP9k5agmN9fLpA7VNJfIiqw==", + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/linkify-it/-/linkify-it-5.0.0.tgz", + "integrity": "sha512-5aHCbzQRADcdP+ATqnDuhhJ/MRIqDkZX5pyjFHRRysS8vZ5AbqGEoFIb6pYHPZ+L/OC2Lc+xT8uHVVR5CAK/wQ==", "dev": true, "dependencies": { - "uc.micro": "^1.0.1" + "uc.micro": "^2.0.0" } }, + "node_modules/linkify-it/node_modules/uc.micro": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/uc.micro/-/uc.micro-2.1.0.tgz", + "integrity": "sha512-ARDJmphmdvUk6Glw7y9DQ2bFkKBHwQHLi2lsaH6PPmz/Ka9sFOBsBluozhDltWmnv9u/cF6Rt87znRTPV+yp/A==", + "dev": true + }, "node_modules/load-script": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/load-script/-/load-script-1.0.0.tgz", @@ -11799,19 +11841,20 @@ } }, "node_modules/markdown-it": { - "version": "13.0.1", - "resolved": "https://registry.npmjs.org/markdown-it/-/markdown-it-13.0.1.tgz", - "integrity": "sha512-lTlxriVoy2criHP0JKRhO2VDG9c2ypWCsT237eDiLqi09rmbKoUetyGHq2uOIRoRS//kfoJckS0eUzzkDR+k2Q==", + "version": "14.0.0", + "resolved": "https://registry.npmjs.org/markdown-it/-/markdown-it-14.0.0.tgz", + "integrity": "sha512-seFjF0FIcPt4P9U39Bq1JYblX0KZCjDLFFQPHpL5AzHpqPEKtosxmdq/LTVZnjfH7tjt9BxStm+wXcDBNuYmzw==", "dev": true, "dependencies": { "argparse": "^2.0.1", - "entities": "~3.0.1", - "linkify-it": "^4.0.1", - "mdurl": "^1.0.1", - "uc.micro": "^1.0.5" + "entities": "^4.4.0", + "linkify-it": "^5.0.0", + "mdurl": "^2.0.0", + "punycode.js": "^2.3.1", + "uc.micro": "^2.0.0" }, "bin": { - "markdown-it": "bin/markdown-it.js" + "markdown-it": "bin/markdown-it.mjs" } }, "node_modules/markdown-it-anchor": { @@ -11875,32 +11918,47 @@ "node": ">6.4.0" } }, + "node_modules/markdown-it/node_modules/mdurl": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/mdurl/-/mdurl-2.0.0.tgz", + "integrity": "sha512-Lf+9+2r+Tdp5wXDXC4PcIBjTDtq4UKjCPMQhKIuzpJNW0b96kVqSwW0bT7FhRSfmAiFYgP+SCRvdrDozfh0U5w==", + "dev": true + }, + "node_modules/markdown-it/node_modules/uc.micro": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/uc.micro/-/uc.micro-2.1.0.tgz", + "integrity": "sha512-ARDJmphmdvUk6Glw7y9DQ2bFkKBHwQHLi2lsaH6PPmz/Ka9sFOBsBluozhDltWmnv9u/cF6Rt87znRTPV+yp/A==", + "dev": true + }, "node_modules/markdownlint": { - "version": "0.31.1", - "resolved": "https://registry.npmjs.org/markdownlint/-/markdownlint-0.31.1.tgz", - "integrity": "sha512-CKMR2hgcIBrYlIUccDCOvi966PZ0kJExDrUi1R+oF9PvqQmCrTqjOsgIvf2403OmJ+CWomuzDoylr6KbuMyvHA==", + "version": "0.33.0", + "resolved": "https://registry.npmjs.org/markdownlint/-/markdownlint-0.33.0.tgz", + "integrity": "sha512-4lbtT14A3m0LPX1WS/3d1m7Blg+ZwiLq36WvjQqFGsX3Gik99NV+VXp/PW3n+Q62xyPdbvGOCfjPqjW+/SKMig==", "dev": true, "dependencies": { - "markdown-it": "13.0.1", - "markdownlint-micromark": "0.1.7" + "markdown-it": "14.0.0", + "markdownlint-micromark": "0.1.8" }, "engines": { - "node": ">=16" + "node": ">=18" + }, + "funding": { + "url": "https://github.com/sponsors/DavidAnson" } }, "node_modules/markdownlint-cli": { - "version": "0.37.0", - "resolved": "https://registry.npmjs.org/markdownlint-cli/-/markdownlint-cli-0.37.0.tgz", - "integrity": "sha512-hNKAc0bWBBuVhJbSWbUhRzavstiB4o1jh3JeSpwC4/dt6eJ54lRfYHRxVdzVp4qGWBKbeE6Pg490PFEfrKjqSg==", + "version": "0.39.0", + "resolved": "https://registry.npmjs.org/markdownlint-cli/-/markdownlint-cli-0.39.0.tgz", + "integrity": "sha512-ZuFN7Xpsbn1Nbp0YYkeLOfXOMOfLQBik2lKRy8pVI/llmKQ2uW7x+8k5OMgF6o7XCsTDSYC/OOmeJ+3qplvnJQ==", "dev": true, "dependencies": { - "commander": "~11.0.0", + "commander": "~11.1.0", "get-stdin": "~9.0.0", - "glob": "~10.3.4", - "ignore": "~5.2.4", + "glob": "~10.3.10", + "ignore": "~5.3.0", "js-yaml": "^4.1.0", - "jsonc-parser": "~3.2.0", - "markdownlint": "~0.31.1", + "jsonc-parser": "~3.2.1", + "markdownlint": "~0.33.0", "minimatch": "~9.0.3", "run-con": "~1.3.2" }, @@ -11908,25 +11966,28 @@ "markdownlint": "markdownlint.js" }, "engines": { - "node": ">=16" + "node": ">=18" } }, "node_modules/markdownlint-cli/node_modules/commander": { - "version": "11.0.0", - "resolved": "https://registry.npmjs.org/commander/-/commander-11.0.0.tgz", - "integrity": "sha512-9HMlXtt/BNoYr8ooyjjNRdIilOTkVJXB+GhxMTtOKwk0R4j4lS4NpjuqmRxroBfnfTSHQIHQB7wryHhXarNjmQ==", + "version": "11.1.0", + "resolved": "https://registry.npmjs.org/commander/-/commander-11.1.0.tgz", + "integrity": "sha512-yPVavfyCcRhmorC7rWlkHn15b4wDVgVmBA7kV4QVBsF7kv/9TKJAbAXVTxvTnwP8HHKjRCJDClKbciiYS7p0DQ==", "dev": true, "engines": { "node": ">=16" } }, "node_modules/markdownlint-micromark": { - "version": "0.1.7", - "resolved": "https://registry.npmjs.org/markdownlint-micromark/-/markdownlint-micromark-0.1.7.tgz", - "integrity": "sha512-BbRPTC72fl5vlSKv37v/xIENSRDYL/7X/XoFzZ740FGEbs9vZerLrIkFRY0rv7slQKxDczToYuMmqQFN61fi4Q==", + "version": "0.1.8", + "resolved": "https://registry.npmjs.org/markdownlint-micromark/-/markdownlint-micromark-0.1.8.tgz", + "integrity": "sha512-1ouYkMRo9/6gou9gObuMDnvZM8jC/ly3QCFQyoSPCS2XV1ZClU0xpKbL1Ar3bWWRT1RnBZkWUEiNKrI2CwiBQA==", "dev": true, "engines": { "node": ">=16" + }, + "funding": { + "url": "https://github.com/sponsors/DavidAnson" } }, "node_modules/md5.js": { @@ -12918,11 +12979,12 @@ } }, "node_modules/npm-check-updates": { - "version": "16.14.6", - "resolved": "https://registry.npmjs.org/npm-check-updates/-/npm-check-updates-16.14.6.tgz", - "integrity": "sha512-sJ6w4AmSDP7YzBXah94Ul2JhiIbjBDfx9XYgib15um2wtiQkOyjE7Lov3MNUSQ84Ry7T81mE4ynMbl/mGbK4HQ==", + "version": "16.14.18", + "resolved": "https://registry.npmjs.org/npm-check-updates/-/npm-check-updates-16.14.18.tgz", + "integrity": "sha512-9iaRe9ohx9ykdbLjPRIYcq1A0RkrPYUx9HmQK1JIXhfxtJCNE/+497H9Z4PGH6GWRALbz5KF+1iZoySK2uSEpQ==", "dev": true, "dependencies": { + "@types/semver-utils": "^1.1.1", "chalk": "^5.3.0", "cli-table3": "^0.6.3", "commander": "^10.0.1", @@ -15128,6 +15190,15 @@ "node": ">=6" } }, + "node_modules/punycode.js": { + "version": "2.3.1", + "resolved": "https://registry.npmjs.org/punycode.js/-/punycode.js-2.3.1.tgz", + "integrity": "sha512-uxFIHU0YlHYhDQtV4R9J6a52SLx28BCjT+4ieh7IGbgwVJWO+km431c4yRlREUAsAmt/uMjQUyQHNEPf0M39CA==", + "dev": true, + "engines": { + "node": ">=6" + } + }, "node_modules/pupa": { "version": "3.1.0", "resolved": "https://registry.npmjs.org/pupa/-/pupa-3.1.0.tgz", @@ -17705,16 +17776,17 @@ "dev": true }, "node_modules/svgo": { - "version": "3.0.3", - "resolved": "https://registry.npmjs.org/svgo/-/svgo-3.0.3.tgz", - "integrity": "sha512-X4UZvLhOglD5Xrp834HzGHf8RKUW0Ahigg/08yRO1no9t2NxffOkMiQ0WmaMIbaGlVTlSst2zWANsdhz5ybXgA==", + "version": "3.2.0", + "resolved": "https://registry.npmjs.org/svgo/-/svgo-3.2.0.tgz", + "integrity": "sha512-4PP6CMW/V7l/GmKRKzsLR8xxjdHTV4IMvhTnpuHwwBazSIlw5W/5SmPjN8Dwyt7lKbSJrRDgp4t9ph0HgChFBQ==", "dev": true, "dependencies": { "@trysound/sax": "0.2.0", "commander": "^7.2.0", "css-select": "^5.1.0", - "css-tree": "^2.2.1", - "csso": "5.0.5", + "css-tree": "^2.3.1", + "css-what": "^6.1.0", + "csso": "^5.0.5", "picocolors": "^1.0.0" }, "bin": { diff --git a/package.json b/package.json index 92f166ac..dfbb1c5a 100644 --- a/package.json +++ b/package.json @@ -25,12 +25,12 @@ "devDependencies": { "@vuepress/plugin-back-to-top": "^1.9.10", "@vuepress/plugin-medium-zoom": "^1.9.10", - "got": "^13.0.0", - "husky": "^8.0.3", - "markdownlint-cli": "^0.37.0", - "npm-check-updates": "^16.14.6", + "got": "^14.2.1", + "husky": "^9.0.11", + "markdownlint-cli": "^0.39.0", + "npm-check-updates": "^16.14.18", "plantuml-encoder": "^1.4.0", - "svgo": "^3.0.3", + "svgo": "^3.2.0", "vuepress": "^1.9.10", "vuepress-plugin-versioning": "git+https://github.com/mojaloop/vuepress-plugin-versioning.git#dcb14962a69b8e5aaf184d2d1a31ae4f43870bc1", "vuepress-theme-titanium": "^4.11.2" From 0f8d114674134554fbbca1f5b695cfd350586b50 Mon Sep 17 00:00:00 2001 From: Steven Oderayi Date: Tue, 2 Apr 2024 10:50:15 +0100 Subject: [PATCH 8/9] feat: update fx pages and sequence diagrams --- docs/.vuepress/config.js | 40 ++ .../sequence/seq-fx-fulfil-2.1.0.plantuml | 0 .../diagrams/sequence/seq-fx-fulfil-2.1.0.svg | 0 .../sequence/seq-fx-prepare-1.1.0.plantuml | 0 .../sequence/seq-fx-prepare-1.1.0.svg | 0 .../sequence/seq-fx-prepare-1.1.1.a.plantuml | 5 + .../sequence/seq-fx-prepare-1.1.1.a.svg | 469 +++++++++++++++++ .../sequence/seq-fx-prepare-1.1.2.a.plantuml | 6 +- .../sequence/seq-fx-prepare-1.1.2.a.svg | 481 +++++++++++++++++ .../sequence/seq-fx-reject-2.2.0.a.plantuml | 0 .../sequence/seq-fx-reject-2.2.0.a.svg | 0 .../seq-prepare-1.1.4.a-v2.0.plantuml | 110 ++++ .../sequence/seq-prepare-1.1.4.a-v2.0.svg | 164 ++++++ .../1.1.0-fx-prepare-transfer-request.md | 13 + .../1.1.1.a-fx-prepare-handler-consume.md | 7 + .../1.1.2.a-fx-position-handler-consume.md | 7 + ...a-send-notification-to-participant-v2.0.md | 7 + .../2.1.0-fx-fulfil-reject-transfer.md | 7 + .../2.1.0-fx-fulfil-transfer-request.md | 13 + .../central-fx-transfers/transfers/README.md | 8 + .../sequence/seq-fx-prepare-1.1.1.a.svg | 465 ----------------- .../sequence/seq-fx-prepare-1.1.2.a.svg | 484 ------------------ 22 files changed, 1335 insertions(+), 951 deletions(-) rename docs/technical/{central-ledger => central-fx-transfers}/assets/diagrams/sequence/seq-fx-fulfil-2.1.0.plantuml (100%) rename docs/technical/{central-ledger => central-fx-transfers}/assets/diagrams/sequence/seq-fx-fulfil-2.1.0.svg (100%) rename docs/technical/{central-ledger => central-fx-transfers}/assets/diagrams/sequence/seq-fx-prepare-1.1.0.plantuml (100%) rename docs/technical/{central-ledger => central-fx-transfers}/assets/diagrams/sequence/seq-fx-prepare-1.1.0.svg (100%) rename docs/technical/{central-ledger => central-fx-transfers}/assets/diagrams/sequence/seq-fx-prepare-1.1.1.a.plantuml (98%) create mode 100644 docs/technical/central-fx-transfers/assets/diagrams/sequence/seq-fx-prepare-1.1.1.a.svg rename docs/technical/{central-ledger => central-fx-transfers}/assets/diagrams/sequence/seq-fx-prepare-1.1.2.a.plantuml (99%) create mode 100644 docs/technical/central-fx-transfers/assets/diagrams/sequence/seq-fx-prepare-1.1.2.a.svg rename docs/technical/{central-ledger => central-fx-transfers}/assets/diagrams/sequence/seq-fx-reject-2.2.0.a.plantuml (100%) rename docs/technical/{central-ledger => central-fx-transfers}/assets/diagrams/sequence/seq-fx-reject-2.2.0.a.svg (100%) create mode 100644 docs/technical/central-fx-transfers/assets/diagrams/sequence/seq-prepare-1.1.4.a-v2.0.plantuml create mode 100644 docs/technical/central-fx-transfers/assets/diagrams/sequence/seq-prepare-1.1.4.a-v2.0.svg create mode 100644 docs/technical/central-fx-transfers/transfers/1.1.0-fx-prepare-transfer-request.md create mode 100644 docs/technical/central-fx-transfers/transfers/1.1.1.a-fx-prepare-handler-consume.md create mode 100644 docs/technical/central-fx-transfers/transfers/1.1.2.a-fx-position-handler-consume.md create mode 100644 docs/technical/central-fx-transfers/transfers/1.1.4.a-send-notification-to-participant-v2.0.md create mode 100644 docs/technical/central-fx-transfers/transfers/2.1.0-fx-fulfil-reject-transfer.md create mode 100644 docs/technical/central-fx-transfers/transfers/2.1.0-fx-fulfil-transfer-request.md create mode 100644 docs/technical/central-fx-transfers/transfers/README.md delete mode 100644 docs/technical/central-ledger/assets/diagrams/sequence/seq-fx-prepare-1.1.1.a.svg delete mode 100644 docs/technical/central-ledger/assets/diagrams/sequence/seq-fx-prepare-1.1.2.a.svg diff --git a/docs/.vuepress/config.js b/docs/.vuepress/config.js index 907cdea9..da57e33f 100644 --- a/docs/.vuepress/config.js +++ b/docs/.vuepress/config.js @@ -685,6 +685,46 @@ module.exports = { }, ] }, + { + title: "FX Transfer Operations", + collapsable: true, + children: [ + { + title: "Overview", + path: "central-fx-transfers/transfers/" + }, + { + title: "FX Prepare Handler", + collapsable: true, + children: [ + { + title: "Overview", + path: "central-fx-transfers/transfers/1.1.0-fx-prepare-transfer-request" + }, + { + title: "FX Prepare Handler Consume", + path: "central-fx-transfers/transfers/1.1.1.a-fx-prepare-handler-consume" + } + ] + }, + { + title: "FX Position Handler", + path: "central-fx-transfers/transfers/1.1.2.a-fx-position-handler-consume" + }, + { + title: "FX Fulfil Handler", + path: "central-fx-transfers/transfers/1.1.2.a-fx-fulfil-transfer-request" + }, + { + title: "Notifications process", + path: "central-fx-transfers/transfers/1.1.4.a-send-notification-to-participant-v2.0" + }, + { + title: "Reject/Abort", + path: "central-fx-transfers/transfers/2.1.0-fx-fulfil-reject-transfer" + } + ] + }, { title: "Bulk Transfers Operations", collapsable: true, diff --git a/docs/technical/central-ledger/assets/diagrams/sequence/seq-fx-fulfil-2.1.0.plantuml b/docs/technical/central-fx-transfers/assets/diagrams/sequence/seq-fx-fulfil-2.1.0.plantuml similarity index 100% rename from docs/technical/central-ledger/assets/diagrams/sequence/seq-fx-fulfil-2.1.0.plantuml rename to docs/technical/central-fx-transfers/assets/diagrams/sequence/seq-fx-fulfil-2.1.0.plantuml diff --git a/docs/technical/central-ledger/assets/diagrams/sequence/seq-fx-fulfil-2.1.0.svg b/docs/technical/central-fx-transfers/assets/diagrams/sequence/seq-fx-fulfil-2.1.0.svg similarity index 100% rename from docs/technical/central-ledger/assets/diagrams/sequence/seq-fx-fulfil-2.1.0.svg rename to docs/technical/central-fx-transfers/assets/diagrams/sequence/seq-fx-fulfil-2.1.0.svg diff --git a/docs/technical/central-ledger/assets/diagrams/sequence/seq-fx-prepare-1.1.0.plantuml b/docs/technical/central-fx-transfers/assets/diagrams/sequence/seq-fx-prepare-1.1.0.plantuml similarity index 100% rename from docs/technical/central-ledger/assets/diagrams/sequence/seq-fx-prepare-1.1.0.plantuml rename to docs/technical/central-fx-transfers/assets/diagrams/sequence/seq-fx-prepare-1.1.0.plantuml diff --git a/docs/technical/central-ledger/assets/diagrams/sequence/seq-fx-prepare-1.1.0.svg b/docs/technical/central-fx-transfers/assets/diagrams/sequence/seq-fx-prepare-1.1.0.svg similarity index 100% rename from docs/technical/central-ledger/assets/diagrams/sequence/seq-fx-prepare-1.1.0.svg rename to docs/technical/central-fx-transfers/assets/diagrams/sequence/seq-fx-prepare-1.1.0.svg diff --git a/docs/technical/central-ledger/assets/diagrams/sequence/seq-fx-prepare-1.1.1.a.plantuml b/docs/technical/central-fx-transfers/assets/diagrams/sequence/seq-fx-prepare-1.1.1.a.plantuml similarity index 98% rename from docs/technical/central-ledger/assets/diagrams/sequence/seq-fx-prepare-1.1.1.a.plantuml rename to docs/technical/central-fx-transfers/assets/diagrams/sequence/seq-fx-prepare-1.1.1.a.plantuml index f4ce2129..9ce0b942 100644 --- a/docs/technical/central-ledger/assets/diagrams/sequence/seq-fx-prepare-1.1.1.a.plantuml +++ b/docs/technical/central-fx-transfers/assets/diagrams/sequence/seq-fx-prepare-1.1.1.a.plantuml @@ -52,6 +52,11 @@ end box ' start flow activate PREP_HANDLER group Prepare Handler Consume + note left of PREP_HANDLER #lightgrey + Event is automatically replicated + to the events topic (topic-events) + end note + TOPIC_TRANSFER_PREPARE <- PREP_HANDLER: Consume Prepare event message activate TOPIC_TRANSFER_PREPARE deactivate TOPIC_TRANSFER_PREPARE diff --git a/docs/technical/central-fx-transfers/assets/diagrams/sequence/seq-fx-prepare-1.1.1.a.svg b/docs/technical/central-fx-transfers/assets/diagrams/sequence/seq-fx-prepare-1.1.1.a.svg new file mode 100644 index 00000000..06c43df7 --- /dev/null +++ b/docs/technical/central-fx-transfers/assets/diagrams/sequence/seq-fx-prepare-1.1.1.a.svg @@ -0,0 +1,469 @@ + + + + + + + + + + + + 1.1.1.a. FX Prepare Handler Consume (single message) + + Central Service + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + topic-transfer-prepare + + + topic-transfer-prepare + Prepare Event Handler + + + Prepare Event Handler + + + + + topic-transfer-position + + + topic-transfer-position + + + Notification-Topic + + + Notification-Topic + Position DAO + + + Position DAO + + + Participant DAO + + + Participant DAO + + + Central Store + + + Central Store + + + + + + + + + + + + + + + + + + Prepare Handler Consume + + + Event is automatically replicated + to the events topic (topic-events) + + + 1 + Consume Prepare event message + + + break + + + Filter Event + + + + + 2 + Filter event - Rules: type == 'prepare' && action == 'fx_prepare' + Error codes: + 2001 + + + Validate Prepare Transfer + + + + + 3 + Schema validation of the incoming message + + + + + 4 + Verify the message's signature (to be confirmed in future requirement) + + + The above validation steps are already handled by + the ML-Adapter for the open source implementation. + It may need to be added in future for custom adapters. + + + Duplicate Check + + + 5 + Request Duplicate Check + + + ref + Request Duplicate Check + + + + 6 + Return { hasDuplicateId: Boolean, hasDuplicateHash: Boolean } + + + alt + [hasDuplicateId == TRUE] + + + Process Duplication + + + alt + [hasDuplicateId == TRUE && hasDuplicateHash == FALSE] + + + Validate Prepare Transfer (failure) - Modified Request + + [hasDuplicateId == TRUE && hasDuplicateHash == TRUE] + + + break + + + 7 + stateRecord = await getFxTransferById(commitRequestId) + + fxTransferStateChange + + + 8 + Return stateRecord + + + alt + [[COMMITTED, ABORTED].includes(stateRecord.transferStateEnumeration)] + + + 9 + Produce message [functionality = TRANSFER, action = PREPAPE_DUPLICATE] + + + + Ignore - resend in progress + + [hasDuplicateId == FALSE] + + + Validate Prepare Request + + + Validate Payer + + + + + 10 + Validate FSPIOP-Source header matches initiatingFsp + + + + + 11 + Validate payload.sourceAmount and payload.targetAmount scale and precision + + + 12 + Request to retrieve Payer Participant details (if it exists) + + + 13 + Request Participant details + + participant + participantCurrency + + + 14 + Return Participant details if it exists + + + 15 + Return Participant details if it exists + + + + + 16 + Validate Payer participant is active + + + + + 17 + Validate Payer participant position account for the source currency [exists, active] + + + Validate Payee + + + 18 + Request to retrieve Payee Participant details (if it exists) + + + 19 + Request Participant details + + participant + participantCurrency + + + 20 + Return Participant details if it exists + + + 21 + Return Participant details if it exists + + + + + 22 + Validate Payee participant is active + + + + + 23 + Validate Payee participant position account for the target currency [exists, active] + + + Validate Condition and Expiration + + + + + 24 + Validate cryptographic condition + + + + + 25 + Validate expiration [payload.expiration is valid ISO date and not in the past] + + + Validate Different FSPs (if ENABLE_ON_US_TRANSFER == false) + + + + + 26 + Validate Payer and Payee FSPs are different + + + alt + [Validate Prepare Transfer (success)] + + + Persist Transfer State (with transferState='RECEIVED-PREPARE') + + + 27 + Request to persist transfer + Error codes: + 2003 + + fxTransfer + fxTransferParticipant + fxTransferStateChange + fxTransferExtension + + + 28 + Return success + + [Validate Prepare Transfer (failure)] + + + Persist Transfer State (with transferState='INVALID') (Introducing a new status INVALID to mark these entries) + + + 29 + Request to persist transfer + (when Payee/Payer/crypto-condition validation fails) + Error codes: + 2003 + + fxTransfer + fxTransferParticipant + fxTransferStateChange + fxTransferExtension + fxTransferError + + + 30 + Return success + + + alt + [Validate Prepare Transfer (success)] + + + Hydrate Transfer Prepare Message + + + 31 + Get participant and currency for FX transfer (with 'payload.determiningTransferId') + + + 32 + Request participant and currency + + participant + participantCurrency + + + 33 + Return participant and currency + + + 34 + Return participant and currency + + + Message: + { + id: <transferMessage.commitRequestId> + from: <transferMessage.initiatingFsp>, + to: <transferMessage.counterPartyFsp>, + type: application/json + content: { + headers: <transferHeaders>, + payload: <hydratedTransferMessage> + }, + metadata: { + event: { + id: <uuid>, + responseTo: <previous.uuid>, + type: position, + action: fx_prepare, + createdAt: <timestamp>, + state: { + status: "success", + code: 0 + } + } + } + } + + + 35 + Route & Publish Position event for Payer + Error codes: + 2003 + + [Validate Prepare Transfer (failure)] + + + Message: + { + id: <transferMessage.commitRequestId> + from: <ledgerName>, + to: <transferMessage.initiatingFsp>, + type: application/json + content: { + headers: <transferHeaders>, + payload: { + "errorInformation": { + "errorCode": <possible codes: [2003, 3100, 3105, 3106, 3202, 3203, 3300, 3301]> + "errorDescription": "<refer to section 35.1.3 for description>", + "extensionList": <transferMessage.extensionList> + } + }, + metadata: { + event: { + id: <uuid>, + responseTo: <previous.uuid>, + type: notification, + action: fx_prepare, + createdAt: <timestamp>, + state: { + status: 'error', + code: <errorInformation.errorCode> + description: <errorInformation.errorDescription> + } + } + } + } + + + 36 + Publish Notification (failure) event for Payer + Error codes: + 2003 + + diff --git a/docs/technical/central-ledger/assets/diagrams/sequence/seq-fx-prepare-1.1.2.a.plantuml b/docs/technical/central-fx-transfers/assets/diagrams/sequence/seq-fx-prepare-1.1.2.a.plantuml similarity index 99% rename from docs/technical/central-ledger/assets/diagrams/sequence/seq-fx-prepare-1.1.2.a.plantuml rename to docs/technical/central-fx-transfers/assets/diagrams/sequence/seq-fx-prepare-1.1.2.a.plantuml index ce7655e9..cd55802c 100644 --- a/docs/technical/central-ledger/assets/diagrams/sequence/seq-fx-prepare-1.1.2.a.plantuml +++ b/docs/technical/central-fx-transfers/assets/diagrams/sequence/seq-fx-prepare-1.1.2.a.plantuml @@ -35,7 +35,6 @@ collections "topic-transfer-position" as TOPIC_TRANSFER_POSITION control "Position Event Handler" as POS_HANDLER entity "Position DAO" as POS_DAO entity "Settlement DAO" as SETTLEMENT_DAO -collections "Event-Topic" as TOPIC_EVENTS collections "Notification-Topic" as TOPIC_NOTIFICATIONS entity "Participant DAO" as PARTICIPANT_DAO database "Central Store" as DB @@ -43,7 +42,6 @@ database "Central Store" as DB box "Central Service" #LightYellow participant TOPIC_TRANSFER_POSITION participant POS_HANDLER - participant TOPIC_EVENTS participant TOPIC_NOTIFICATIONS participant POS_DAO participant PARTICIPANT_DAO @@ -54,6 +52,10 @@ end box ' start flow activate POS_HANDLER group Position Handler Consume + note left of POS_HANDLER #lightgrey + Event is automatically replicated + to the events topic (topic-events) + end note TOPIC_TRANSFER_POSITION <- POS_HANDLER: Consume Position event message for Payer activate TOPIC_TRANSFER_POSITION deactivate TOPIC_TRANSFER_POSITION diff --git a/docs/technical/central-fx-transfers/assets/diagrams/sequence/seq-fx-prepare-1.1.2.a.svg b/docs/technical/central-fx-transfers/assets/diagrams/sequence/seq-fx-prepare-1.1.2.a.svg new file mode 100644 index 00000000..b814e89e --- /dev/null +++ b/docs/technical/central-fx-transfers/assets/diagrams/sequence/seq-fx-prepare-1.1.2.a.svg @@ -0,0 +1,481 @@ + + + + + + + + + + + + 1.1.2.a. Position Handler Consume (single message) + + Central Service + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + topic-transfer-position + + + topic-transfer-position + Position Event Handler + + + Position Event Handler + + + + + Notification-Topic + + + Notification-Topic + Position DAO + + + Position DAO + + + Participant DAO + + + Participant DAO + + + Settlement DAO + + + Settlement DAO + + + Central Store + + + Central Store + + + + + + + + + + + + + + + + + + + + + + + + + + + Position Handler Consume + + + Event is automatically replicated + to the events topic (topic-events) + + + 1 + Consume Position event message for Payer + + + break + + + Validate Event + + + + + 2 + Validate event - Rule: type == 'position' && action == 'fx_prepare' + + + + + 3 + Validate 'payload.commitRequestId' or 'message.value.content.uriParams.id' is not empty + Error code: + 2003 + + + alt + [Calulate & Validate Latest Position (success)] + + + Calculate position and persist change + + + 4 + Request active settlement models + + + 5 + Retrieve active settlement models + + settlementModel + + + 6 + Return active settlement models + + + 7 + Return active settlement models + + + + + 8 + Select currency matching or default settlement model for POSITION ledger account type + Error code: + 6000 + + + 9 + Request Payer Participant position account by name and currency + + + 10 + Retrieve Payer Participant position account by name and currency + + participant + participantCurrency + + + 11 + Return Payer Participant position account by name and currency + + + 12 + Return Payer Participant position account by name and currency + + + 13 + Retrieve transfer state from DB by 'commitRequestId' + + fxTransferStateChange + + + 14 + Retrieve transfer state from DB + + + 15 + Return transfer state + + + 16 + Request position limits for Payer Participant + + + 17 + Request position limits for Payer Participant + + participant + participantLimit + + + 18 + Return position limits + + + 19 + Return position limits + + + alt + [Validate transfer state (transferState='RECEIVED_PREPARE')] + + + + + 20 + Update transfer state to RESERVED + + + + + 21 + Calculate latest position for prepare + + + + + 22 + Validate calculated latest position (lpos) against the net-debit cap (netcap) - Rule: lpos < netcap + + + 23 + Request payer participant position for the transfer currency and settlement currency + + + 24 + Retrieve payer participant position for the transfer currency and settlement currency + + participantPosiiton + + + 25 + Return payer participant position for the transfer currency and settlement currency + + + + + 26 + Update participant position (increase reserved position by transfer amount) + + + 27 + Persist payer participant position in DB + + participantPosition + + + 28 + Return success + + + 29 + Request payer participant limit by currency + + + 30 + Retrieve payer participant limit by currency + + participant + participantCurrency + participantLimit + + + 31 + Return payer participant limit by currency + + + 32 + Return payer participant limit by currency + + + + + 33 + Calculate latest available position based on payer limit and payer liquidity cover + + + alt + [Validate position limits (success)] + + + + + 34 + Update transfer state to RESERVED + + + 35 + Update participant position + + participantPosition + + + 36 + Persist transfer state change (RESERVED) to DB + + fxTransferStateChange + + + 37 + Insert participant position change record + + participantPositionChange + + [Validate position limits (failure)] + + + 38 + Persist transfer state change (ABORTED_REJECTED) to DB, + Error codes: + 4001, 4200 + + fxTransferStateChange + + [transferState !='RECEIVED_PREPARE'] + + + + + 39 + Update transfer state to ABORTED_REJECTED + + + 40 + Persist aborted transfer state + + fxTransferStateChange + + + alt + [Transfer state is RESERVED] + + + Message: + { + id: <transferMessage.commitRequestId> + from: <transferMessage.initiatingFsp>, + to: <transferMessage.counterPartyFsp>, + type: application/json + content: { + headers: <transferHeaders>, + payload: <transferMessage> + }, + metadata: { + event: { + id: <uuid>, + responseTo: <previous.uuid>, + type: transfer, + action: prepare, + createdAt: <timestamp>, + state: { + status: "success", + code: 0 + } + } + } + } + + + 41 + Publish Notification event to FXP + + + + Message: + { + id: <transferMessage.commitRequestId> + from: <switch>, + to: <transferMessage.initiatingFsp>, + type: application/json + content: { + headers: <transferHeaders>, + payload: { + "errorInformation": { + "errorCode": <error code>, + "errorDescription": "<error description>", + "extensionList": <transferMessage.extensionList> + } + } + }, + metadata: { + event: { + id: <uuid>, + responseTo: <previous.uuid>, + type: notification, + action: prepare, + createdAt: <timestamp>, + state: { + status: 'error', + code: <errorInformation.errorCode> + description: <errorInformation.errorDescription> + } + } + } + } + + + 42 + Publish Notification (failure) event for Payer. + Error code: + 2001 + + [Calculate & Validate Latest Position (failure)] + + + Message: + { + id: <transferMessage.transferId> + from: <ledgerName>, + to: <transferMessage.payerFsp>, + type: application/json + content: { + headers: <transferHeaders>, + payload: { + "errorInformation": { + "errorCode": <error code>, + "errorDescription": "<error description>", + "extensionList": <transferMessage.extensionList> + } + }, + metadata: { + event: { + id: <uuid>, + responseTo: <previous.uuid>, + type: notification, + action: prepare, + createdAt: <timestamp>, + state: { + status: 'error', + code: <errorInformation.errorCode> + description: <errorInformation.errorDescription> + } + } + } + } + + + 43 + Publish Notification (failure) event for Payer + Error codes: + 4001, 4200 + + diff --git a/docs/technical/central-ledger/assets/diagrams/sequence/seq-fx-reject-2.2.0.a.plantuml b/docs/technical/central-fx-transfers/assets/diagrams/sequence/seq-fx-reject-2.2.0.a.plantuml similarity index 100% rename from docs/technical/central-ledger/assets/diagrams/sequence/seq-fx-reject-2.2.0.a.plantuml rename to docs/technical/central-fx-transfers/assets/diagrams/sequence/seq-fx-reject-2.2.0.a.plantuml diff --git a/docs/technical/central-ledger/assets/diagrams/sequence/seq-fx-reject-2.2.0.a.svg b/docs/technical/central-fx-transfers/assets/diagrams/sequence/seq-fx-reject-2.2.0.a.svg similarity index 100% rename from docs/technical/central-ledger/assets/diagrams/sequence/seq-fx-reject-2.2.0.a.svg rename to docs/technical/central-fx-transfers/assets/diagrams/sequence/seq-fx-reject-2.2.0.a.svg diff --git a/docs/technical/central-fx-transfers/assets/diagrams/sequence/seq-prepare-1.1.4.a-v2.0.plantuml b/docs/technical/central-fx-transfers/assets/diagrams/sequence/seq-prepare-1.1.4.a-v2.0.plantuml new file mode 100644 index 00000000..25171fc8 --- /dev/null +++ b/docs/technical/central-fx-transfers/assets/diagrams/sequence/seq-prepare-1.1.4.a-v2.0.plantuml @@ -0,0 +1,110 @@ +/'***** + 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 . + * Gates Foundation + - Name Surname + + * Steven Oderayi + -------------- + ******'/ + +@startuml send-notification-to-participant-single-message-v2_0 +' declate title +title 1.1.4.a. Send notification to Participant (Payer/Payee/FXP) (single message) v2.0 + +autonumber + +' Actor Keys: +' actor - Payer DFSP, Payee DFSP +' boundary - APIs/Interfaces, etc +' collections - Kafka Topics +' control - Kafka Consumers +' entity - Database Access Objects +' database - Database Persistance Store + +' declare actors +actor "Payer DFSP\nParticipant" as PAYER_DFSP +actor "Payee DFSP/FXP\nParticipant" as PAYEE_DFSP_OR_FXP +control "ML API Notification Event Handler" as NOTIFY_HANDLER +boundary "Central Service API" as CSAPI +collections "Notification-Topic" as TOPIC_NOTIFICATIONS +entity "Participant DAO" as PARTICIPANT_DAO +database "Central Store" as DB + +box "Financial Service Provider (Payer)" #lightGray + participant PAYER_DFSP +end box + +box "ML API Adapter Service" #LightBlue + participant NOTIFY_HANDLER +end box + +box "Central Service" #LightYellow + participant TOPIC_NOTIFICATIONS + participant CSAPI + participant PARTICIPANT_DAO + participant DB +end box + +box "Financial Service Provider (Payee or FXP)" #lightGray + participant PAYEE_DFSP_OR_FXP +end box + +' start flow +activate NOTIFY_HANDLER +group Send notification to Participants + note left of NOTIFY_HANDLER #lightgray + Event is automatically replicated + to the events topic (topic-events) + end note + TOPIC_NOTIFICATIONS <- NOTIFY_HANDLER: Consume Notification event + activate TOPIC_NOTIFICATIONS + deactivate TOPIC_NOTIFICATIONS + + note right of NOTIFY_HANDLER #lightgray + The endpoint details are cached, when the cache + expires, the details are fetched again + end note + NOTIFY_HANDLER -> CSAPI: Request Endpoint details for Participant - GET - /participants/{{fsp}}/endpoints\nError code: 2003 + + activate CSAPI + CSAPI -> PARTICIPANT_DAO: Fetch Endpoint details for Participant\nError code: 2003 + activate PARTICIPANT_DAO + PARTICIPANT_DAO -> DB: Fetch Endpoint details for Participant + activate DB + hnote over DB #lightyellow + participantEndpoint + end note + DB -> PARTICIPANT_DAO: Retrieved Endpoint details for Participant + deactivate DB + PARTICIPANT_DAO --> CSAPI: Return Endpoint details for Participant + deactivate PARTICIPANT_DAO + CSAPI --> NOTIFY_HANDLER: Return Endpoint details for Participant\nError codes: 3202, 3203 + deactivate CSAPI + NOTIFY_HANDLER -> PAYER_DFSP: Notification with Prepare/fulfil result/error to \nPayer DFSP to specified Endpoint - PUT \nError code: 1001 + NOTIFY_HANDLER <-- PAYER_DFSP: HTTP 200 OK + alt event.action === 'reserve' + alt event.status === 'success' + NOTIFY_HANDLER -> PAYEE_DFSP_OR_FXP: Notification to with succesful fulfil result (committed) to Payee DFSP/FXP to specified Endpoint - PATCH \nError code: 1001 + ||| + NOTIFY_HANDLER <-- PAYEE_DFSP_OR_FXP: HTTP 200 OK + end + end +end +deactivate NOTIFY_HANDLER +@enduml diff --git a/docs/technical/central-fx-transfers/assets/diagrams/sequence/seq-prepare-1.1.4.a-v2.0.svg b/docs/technical/central-fx-transfers/assets/diagrams/sequence/seq-prepare-1.1.4.a-v2.0.svg new file mode 100644 index 00000000..2d85604f --- /dev/null +++ b/docs/technical/central-fx-transfers/assets/diagrams/sequence/seq-prepare-1.1.4.a-v2.0.svg @@ -0,0 +1,164 @@ + + + + + + + + + + + + 1.1.4.a. Send notification to Participant (Payer/Payee/FXP) (single message) v2.0 + + Financial Service Provider (Payer) + + ML API Adapter Service + + Central Service + + Financial Service Provider (Payee or FXP) + + + + + + + + + + + + + + + + Payer DFSP + Participant + + + Payer DFSP + Participant + + + ML API Notification Event Handler + + + ML API Notification Event Handler + + + + + Notification-Topic + + + Notification-Topic + Central Service API + + + Central Service API + + + Participant DAO + + + Participant DAO + + + Central Store + + + Central Store + + + Payee DFSP/FXP + Participant + + + Payee DFSP/FXP + Participant + + + + + + + + + + Send notification to Participants + + + Event is automatically replicated + to the events topic (topic-events) + + + 1 + Consume Notification event + + + The endpoint details are cached, when the cache + expires, the details are fetched again + + + 2 + Request Endpoint details for Participant - GET - /participants/{{fsp}}/endpoints + Error code: + 2003 + + + 3 + Fetch Endpoint details for Participant + Error code: + 2003 + + + 4 + Fetch Endpoint details for Participant + + participantEndpoint + + + 5 + Retrieved Endpoint details for Participant + + + 6 + Return Endpoint details for Participant + + + 7 + Return Endpoint details for Participant + Error codes: + 3202, 3203 + + + 8 + Notification with Prepare/fulfil result/error to + Payer DFSP to specified Endpoint - PUT + Error code: + 1001 + + + 9 + HTTP 200 OK + + + alt + [event.action === 'reserve'] + + + alt + [event.status === 'success'] + + + 10 + Notification to with succesful fulfil result (committed) to Payee DFSP/FXP to specified Endpoint - PATCH + Error code: + 1001 + + + 11 + HTTP 200 OK + + diff --git a/docs/technical/central-fx-transfers/transfers/1.1.0-fx-prepare-transfer-request.md b/docs/technical/central-fx-transfers/transfers/1.1.0-fx-prepare-transfer-request.md new file mode 100644 index 00000000..c93519d3 --- /dev/null +++ b/docs/technical/central-fx-transfers/transfers/1.1.0-fx-prepare-transfer-request.md @@ -0,0 +1,13 @@ +# FX Prepare Transfer Request + +Sequence design diagram for FX Prepare Transfer Request process. + +## References within Sequence Diagram + +* [FX Prepare Handler Consume (1.1.1.a)](1.1.1.a-fx-prepare-handler-consume.md) +* [FX Position Handler Consume (1.1.2.a)](1.1.2.a-fx-position-handler-consume.md) +* [Send notification to Participant (1.1.4.a)](1.1.4.a-send-notification-to-participant-v2.0.md) + +## Sequence Diagram + +![seq-fx-prepare-1.1.0.svg](../assets/diagrams/sequence/seq-fx-prepare-1.1.0.svg) diff --git a/docs/technical/central-fx-transfers/transfers/1.1.1.a-fx-prepare-handler-consume.md b/docs/technical/central-fx-transfers/transfers/1.1.1.a-fx-prepare-handler-consume.md new file mode 100644 index 00000000..f494d566 --- /dev/null +++ b/docs/technical/central-fx-transfers/transfers/1.1.1.a-fx-prepare-handler-consume.md @@ -0,0 +1,7 @@ +# FX Prepare Handler Consume + +Sequence design diagram for FX Prepare Handler Consume process. + +## Sequence Diagram + +![seq-fx-prepare-1.1.1.a.svg](../assets/diagrams/sequence/seq-fx-prepare-1.1.1.a.svg) diff --git a/docs/technical/central-fx-transfers/transfers/1.1.2.a-fx-position-handler-consume.md b/docs/technical/central-fx-transfers/transfers/1.1.2.a-fx-position-handler-consume.md new file mode 100644 index 00000000..a23fc231 --- /dev/null +++ b/docs/technical/central-fx-transfers/transfers/1.1.2.a-fx-position-handler-consume.md @@ -0,0 +1,7 @@ +# FX Position Handler Consume + +Sequence design diagram for FX Position Handler Consume process. + +## Sequence Diagram + +![seq-fx-prepare-1.1.2.a.svg](../assets/diagrams/sequence/seq-fx-prepare-1.1.2.a.svg) diff --git a/docs/technical/central-fx-transfers/transfers/1.1.4.a-send-notification-to-participant-v2.0.md b/docs/technical/central-fx-transfers/transfers/1.1.4.a-send-notification-to-participant-v2.0.md new file mode 100644 index 00000000..c57569a2 --- /dev/null +++ b/docs/technical/central-fx-transfers/transfers/1.1.4.a-send-notification-to-participant-v2.0.md @@ -0,0 +1,7 @@ +# Send Notification to Participant v2.0 + +Sequence design diagram for the Send Notification to Participant request. + +## Sequence Diagram + +![seq-prepare-1.1.4.a-v2.0.svg](../assets/diagrams/sequence/seq-prepare-1.1.4.a-v2.0.svg) diff --git a/docs/technical/central-fx-transfers/transfers/2.1.0-fx-fulfil-reject-transfer.md b/docs/technical/central-fx-transfers/transfers/2.1.0-fx-fulfil-reject-transfer.md new file mode 100644 index 00000000..bbbbafd5 --- /dev/null +++ b/docs/technical/central-fx-transfers/transfers/2.1.0-fx-fulfil-reject-transfer.md @@ -0,0 +1,7 @@ +# FXP sends a Fulfil Abort FX Transfer request + +Sequence design diagram for the Fulfil Reject FX Transfer process. + +## Sequence Diagram + +![seq-fx-reject-2.2.0.a.svg](../assets/diagrams/sequence/seq-fx-reject-2.2.0.a.svg) diff --git a/docs/technical/central-fx-transfers/transfers/2.1.0-fx-fulfil-transfer-request.md b/docs/technical/central-fx-transfers/transfers/2.1.0-fx-fulfil-transfer-request.md new file mode 100644 index 00000000..018e242f --- /dev/null +++ b/docs/technical/central-fx-transfers/transfers/2.1.0-fx-fulfil-transfer-request.md @@ -0,0 +1,13 @@ +# Fulfil Transfer Request success + +Sequence design diagram for the Fulfil Success Transfer request. + +## References within Sequence Diagram + + +* [Send Notification to Participant (1.1.4.a)](1.1.4.a-send-notification-to-participant-v2.0.md) + +## Sequence Diagram + +![seq-fx-fulfil-2.1.0.svg](../assets/diagrams/sequence/seq-fx-fulfil-2.1.0.svg) diff --git a/docs/technical/central-fx-transfers/transfers/README.md b/docs/technical/central-fx-transfers/transfers/README.md new file mode 100644 index 00000000..3c6f261a --- /dev/null +++ b/docs/technical/central-fx-transfers/transfers/README.md @@ -0,0 +1,8 @@ +# Mojaloop FX Transfer Operations + +Operational processes that is the core of the FX transfer operational process: + +- FX Prepare process +- FX Fulfil process +- Notifications process +- FX Reject/Abort process diff --git a/docs/technical/central-ledger/assets/diagrams/sequence/seq-fx-prepare-1.1.1.a.svg b/docs/technical/central-ledger/assets/diagrams/sequence/seq-fx-prepare-1.1.1.a.svg deleted file mode 100644 index 9a2a23a0..00000000 --- a/docs/technical/central-ledger/assets/diagrams/sequence/seq-fx-prepare-1.1.1.a.svg +++ /dev/null @@ -1,465 +0,0 @@ - - - - - - - - - - - - 1.1.1.a. FX Prepare Handler Consume (single message) - - Central Service - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - topic-transfer-prepare - - - topic-transfer-prepare - Prepare Event Handler - - - Prepare Event Handler - - - - - topic-transfer-position - - - topic-transfer-position - - - Notification-Topic - - - Notification-Topic - Position DAO - - - Position DAO - - - Participant DAO - - - Participant DAO - - - Central Store - - - Central Store - - - - - - - - - - - - - - - - - - Prepare Handler Consume - - - 1 - Consume Prepare event message - - - break - - - Filter Event - - - - - 2 - Filter event - Rules: type == 'prepare' && action == 'fx_prepare' - Error codes: - 2001 - - - Validate Prepare Transfer - - - - - 3 - Schema validation of the incoming message - - - - - 4 - Verify the message's signature (to be confirmed in future requirement) - - - The above validation steps are already handled by - the ML-Adapter for the open source implementation. - It may need to be added in future for custom adapters. - - - Duplicate Check - - - 5 - Request Duplicate Check - - - ref - Request Duplicate Check - - - - 6 - Return { hasDuplicateId: Boolean, hasDuplicateHash: Boolean } - - - alt - [hasDuplicateId == TRUE] - - - Process Duplication - - - alt - [hasDuplicateId == TRUE && hasDuplicateHash == FALSE] - - - Validate Prepare Transfer (failure) - Modified Request - - [hasDuplicateId == TRUE && hasDuplicateHash == TRUE] - - - break - - - 7 - stateRecord = await getFxTransferById(commitRequestId) - - fxTransferStateChange - - - 8 - Return stateRecord - - - alt - [[COMMITTED, ABORTED].includes(stateRecord.transferStateEnumeration)] - - - 9 - Produce message [functionality = TRANSFER, action = PREPAPE_DUPLICATE] - - - - Ignore - resend in progress - - [hasDuplicateId == FALSE] - - - Validate Prepare Request - - - Validate Payer - - - - - 10 - Validate FSPIOP-Source header matches initiatingFsp - - - - - 11 - Validate payload.sourceAmount and payload.targetAmount scale and precision - - - 12 - Request to retrieve Payer Participant details (if it exists) - - - 13 - Request Participant details - - participant - participantCurrency - - - 14 - Return Participant details if it exists - - - 15 - Return Participant details if it exists - - - - - 16 - Validate Payer participant is active - - - - - 17 - Validate Payer participant position account for the source currency [exists, active] - - - Validate Payee - - - 18 - Request to retrieve Payee Participant details (if it exists) - - - 19 - Request Participant details - - participant - participantCurrency - - - 20 - Return Participant details if it exists - - - 21 - Return Participant details if it exists - - - - - 22 - Validate Payee participant is active - - - - - 23 - Validate Payee participant position account for the target currency [exists, active] - - - Validate Condition and Expiration - - - - - 24 - Validate cryptographic condition - - - - - 25 - Validate expiration [payload.expiration is valid ISO date and not in the past] - - - Validate Different FSPs (if ENABLE_ON_US_TRANSFER == false) - - - - - 26 - Validate Payer and Payee FSPs are different - - - alt - [Validate Prepare Transfer (success)] - - - Persist Transfer State (with transferState='RECEIVED-PREPARE') - - - 27 - Request to persist transfer - Error codes: - 2003 - - fxTransfer - fxTransferParticipant - fxTransferStateChange - fxTransferExtension - - - 28 - Return success - - [Validate Prepare Transfer (failure)] - - - Persist Transfer State (with transferState='INVALID') (Introducing a new status INVALID to mark these entries) - - - 29 - Request to persist transfer - (when Payee/Payer/crypto-condition validation fails) - Error codes: - 2003 - - fxTransfer - fxTransferParticipant - fxTransferStateChange - fxTransferExtension - fxTransferError - - - 30 - Return success - - - alt - [Validate Prepare Transfer (success)] - - - Hydrate Transfer Prepare Message - - - 31 - Get participant and currency for FX transfer (with 'payload.determiningTransferId') - - - 32 - Request participant and currency - - participant - participantCurrency - - - 33 - Return participant and currency - - - 34 - Return participant and currency - - - Message: - { - id: <transferMessage.commitRequestId> - from: <transferMessage.initiatingFsp>, - to: <transferMessage.counterPartyFsp>, - type: application/json - content: { - headers: <transferHeaders>, - payload: <hydratedTransferMessage> - }, - metadata: { - event: { - id: <uuid>, - responseTo: <previous.uuid>, - type: position, - action: fx_prepare, - createdAt: <timestamp>, - state: { - status: "success", - code: 0 - } - } - } - } - - - 35 - Route & Publish Position event for Payer - Error codes: - 2003 - - [Validate Prepare Transfer (failure)] - - - Message: - { - id: <transferMessage.commitRequestId> - from: <ledgerName>, - to: <transferMessage.initiatingFsp>, - type: application/json - content: { - headers: <transferHeaders>, - payload: { - "errorInformation": { - "errorCode": <possible codes: [2003, 3100, 3105, 3106, 3202, 3203, 3300, 3301]> - "errorDescription": "<refer to section 35.1.3 for description>", - "extensionList": <transferMessage.extensionList> - } - }, - metadata: { - event: { - id: <uuid>, - responseTo: <previous.uuid>, - type: notification, - action: fx_prepare, - createdAt: <timestamp>, - state: { - status: 'error', - code: <errorInformation.errorCode> - description: <errorInformation.errorDescription> - } - } - } - } - - - 36 - Publish Notification (failure) event for Payer - Error codes: - 2003 - - diff --git a/docs/technical/central-ledger/assets/diagrams/sequence/seq-fx-prepare-1.1.2.a.svg b/docs/technical/central-ledger/assets/diagrams/sequence/seq-fx-prepare-1.1.2.a.svg deleted file mode 100644 index 2ef69321..00000000 --- a/docs/technical/central-ledger/assets/diagrams/sequence/seq-fx-prepare-1.1.2.a.svg +++ /dev/null @@ -1,484 +0,0 @@ - - - - - - - - - - - - 1.1.2.a. Position Handler Consume (single message) - - Central Service - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - topic-transfer-position - - - topic-transfer-position - Position Event Handler - - - Position Event Handler - - - - - Event-Topic - - - Event-Topic - - - Notification-Topic - - - Notification-Topic - Position DAO - - - Position DAO - - - Participant DAO - - - Participant DAO - - - Settlement DAO - - - Settlement DAO - - - Central Store - - - Central Store - - - - - - - - - - - - - - - - - - - - - - - - - - - Position Handler Consume - - - 1 - Consume Position event message for Payer - - - break - - - Validate Event - - - - - 2 - Validate event - Rule: type == 'position' && action == 'fx_prepare' - - - - - 3 - Validate 'payload.commitRequestId' or 'message.value.content.uriParams.id' is not empty - Error code: - 2003 - - - alt - [Calulate & Validate Latest Position (success)] - - - Calculate position and persist change - - - 4 - Request active settlement models - - - 5 - Retrieve active settlement models - - settlementModel - - - 6 - Return active settlement models - - - 7 - Return active settlement models - - - - - 8 - Select currency matching or default settlement model for POSITION ledger account type - Error code: - 6000 - - - 9 - Request Payer Participant position account by name and currency - - - 10 - Retrieve Payer Participant position account by name and currency - - participant - participantCurrency - - - 11 - Return Payer Participant position account by name and currency - - - 12 - Return Payer Participant position account by name and currency - - - 13 - Retrieve transfer state from DB by 'commitRequestId' - - fxTransferStateChange - - - 14 - Retrieve transfer state from DB - - - 15 - Return transfer state - - - 16 - Request position limits for Payer Participant - - - 17 - Request position limits for Payer Participant - - participant - participantLimit - - - 18 - Return position limits - - - 19 - Return position limits - - - alt - [Validate transfer state (transferState='RECEIVED_PREPARE')] - - - - - 20 - Update transfer state to RESERVED - - - - - 21 - Calculate latest position for prepare - - - - - 22 - Validate calculated latest position (lpos) against the net-debit cap (netcap) - Rule: lpos < netcap - - - 23 - Request payer participant position for the transfer currency and settlement currency - - - 24 - Retrieve payer participant position for the transfer currency and settlement currency - - participantPosiiton - - - 25 - Return payer participant position for the transfer currency and settlement currency - - - - - 26 - Update participant position (increase reserved position by transfer amount) - - - 27 - Persist payer participant position in DB - - participantPosition - - - 28 - Return success - - - 29 - Request payer participant limit by currency - - - 30 - Retrieve payer participant limit by currency - - participant - participantCurrency - participantLimit - - - 31 - Return payer participant limit by currency - - - 32 - Return payer participant limit by currency - - - - - 33 - Calculate latest available position based on payer limit and payer liquidity cover - - - alt - [Validate position limits (success)] - - - - - 34 - Update transfer state to RESERVED - - - 35 - Update participant position - - participantPosition - - - 36 - Persist transfer state change (RESERVED) to DB - - fxTransferStateChange - - - 37 - Insert participant position change record - - participantPositionChange - - [Validate position limits (failure)] - - - 38 - Persist transfer state change (ABORTED_REJECTED) to DB, - Error codes: - 4001, 4200 - - fxTransferStateChange - - [transferState !='RECEIVED_PREPARE'] - - - - - 39 - Update transfer state to ABORTED_REJECTED - - - 40 - Persist aborted transfer state - - fxTransferStateChange - - - alt - [Transfer state is RESERVED] - - - Message: - { - id: <transferMessage.commitRequestId> - from: <transferMessage.initiatingFsp>, - to: <transferMessage.counterPartyFsp>, - type: application/json - content: { - headers: <transferHeaders>, - payload: <transferMessage> - }, - metadata: { - event: { - id: <uuid>, - responseTo: <previous.uuid>, - type: transfer, - action: prepare, - createdAt: <timestamp>, - state: { - status: "success", - code: 0 - } - } - } - } - - - 41 - Publish Notification event to FXP - - - - Message: - { - id: <transferMessage.commitRequestId> - from: <switch>, - to: <transferMessage.initiatingFsp>, - type: application/json - content: { - headers: <transferHeaders>, - payload: { - "errorInformation": { - "errorCode": <error code>, - "errorDescription": "<error description>", - "extensionList": <transferMessage.extensionList> - } - } - }, - metadata: { - event: { - id: <uuid>, - responseTo: <previous.uuid>, - type: notification, - action: prepare, - createdAt: <timestamp>, - state: { - status: 'error', - code: <errorInformation.errorCode> - description: <errorInformation.errorDescription> - } - } - } - } - - - 42 - Publish Notification (failure) event for Payer. - Error code: - 2001 - - [Calculate & Validate Latest Position (failure)] - - - Message: - { - id: <transferMessage.transferId> - from: <ledgerName>, - to: <transferMessage.payerFsp>, - type: application/json - content: { - headers: <transferHeaders>, - payload: { - "errorInformation": { - "errorCode": <error code>, - "errorDescription": "<error description>", - "extensionList": <transferMessage.extensionList> - } - }, - metadata: { - event: { - id: <uuid>, - responseTo: <previous.uuid>, - type: notification, - action: prepare, - createdAt: <timestamp>, - state: { - status: 'error', - code: <errorInformation.errorCode> - description: <errorInformation.errorDescription> - } - } - } - } - - - 43 - Publish Notification (failure) event for Payer - Error codes: - 4001, 4200 - - From 2c9aaf15b851dbb3f4daacb646c9d45c9aff3595 Mon Sep 17 00:00:00 2001 From: Steven Oderayi Date: Tue, 2 Apr 2024 10:59:36 +0100 Subject: [PATCH 9/9] fix: fix broken pages/links --- docs/.vuepress/config.js | 4 ++-- ...-reject-transfer.md => 2.2.0-fx-fulfil-reject-transfer.md} | 0 2 files changed, 2 insertions(+), 2 deletions(-) rename docs/technical/central-fx-transfers/transfers/{2.1.0-fx-fulfil-reject-transfer.md => 2.2.0-fx-fulfil-reject-transfer.md} (100%) diff --git a/docs/.vuepress/config.js b/docs/.vuepress/config.js index da57e33f..d32ce79f 100644 --- a/docs/.vuepress/config.js +++ b/docs/.vuepress/config.js @@ -713,7 +713,7 @@ module.exports = { }, { title: "FX Fulfil Handler", - path: "central-fx-transfers/transfers/1.1.2.a-fx-fulfil-transfer-request" + path: "central-fx-transfers/transfers/2.1.0-fx-fulfil-transfer-request" }, { title: "Notifications process", @@ -721,7 +721,7 @@ module.exports = { }, { title: "Reject/Abort", - path: "central-fx-transfers/transfers/2.1.0-fx-fulfil-reject-transfer" + path: "central-fx-transfers/transfers/2.2.0-fx-fulfil-reject-transfer" } ] }, diff --git a/docs/technical/central-fx-transfers/transfers/2.1.0-fx-fulfil-reject-transfer.md b/docs/technical/central-fx-transfers/transfers/2.2.0-fx-fulfil-reject-transfer.md similarity index 100% rename from docs/technical/central-fx-transfers/transfers/2.1.0-fx-fulfil-reject-transfer.md rename to docs/technical/central-fx-transfers/transfers/2.2.0-fx-fulfil-reject-transfer.md