Skip to content

Commit

Permalink
#786: Update sequence diagram for Bulk Prepare and GET Bulk Transfer (#…
Browse files Browse the repository at this point in the history
…234)

* Update bulk transfers prepare sequence diagram. Fix error with abort sequence diagram

* Remove commented lines

* Bump version

* Add page and sequence diagram for GET bulk transfer operation

* Bump version to 10.6.0

* PR review updates

* PR review updates

* PR review updates

* Minor tweak to SD

* Update mojaloop-technical-overview/central-bulk-transfers/assets/diagrams/sequence/seq-bulk-5.1.0-get-overview.plantuml

Co-authored-by: Sam <10507686+elnyry-sam-k@users.noreply.github.com>

* Update mojaloop-technical-overview/central-bulk-transfers/assets/diagrams/sequence/seq-bulk-5.1.0-get-overview.plantuml

Co-authored-by: Sam <10507686+elnyry-sam-k@users.noreply.github.com>

* GET Bulk Transfers diagram: add participants validation step

* Rename CACHE to MLOS

* Make MLOS a collection

* Make MLOS a collection

Co-authored-by: Sam <10507686+elnyry-sam-k@users.noreply.github.com>
  • Loading branch information
oderayi and elnyry-sam-k authored Jul 8, 2020
1 parent 6dbf236 commit 6b8c243
Show file tree
Hide file tree
Showing 8 changed files with 1,566 additions and 1,332 deletions.
1 change: 1 addition & 0 deletions SUMMARY.md
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,7 @@
* [Timeout Overview](mojaloop-technical-overview/central-bulk-transfers/transfers/3.1.0-transfer-timeout-overview-for-bulk.md)
* [Timeout Handler Consume](mojaloop-technical-overview/central-bulk-transfers/transfers/3.1.1-transfer-timeout-handler-consume.md)
* [Bulk Abort Overview](mojaloop-technical-overview/central-bulk-transfers/transfers/4.1.0-transfer-abort-overview-for-bulk.md)
* [Get Bulk Transfer Overview](mojaloop-technical-overview/central-bulk-transfers/transfers/5.1.0-transfer-get-overview-for-bulk.md)
* [Central-Settlements Service](mojaloop-technical-overview/central-settlements/README.md)
* [Settlement Process](mojaloop-technical-overview/central-settlements/settlement-process/README.md)
* [Settlement Windows By Params](mojaloop-technical-overview/central-settlements/settlement-process/get-settlement-windows-by-params.md)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,8 @@ autonumber
' declare actors
actor "DFSP1\nPayer" as DFSP1
actor "DFSP2\nPayee" as DFSP2
boundary "ML API Adapter" as MLAPI
control "ML API Notification \nHandler" as NOTIFY_HANDLER
boundary "Bulk API Adapter" as BULK_API
control "Bulk API Notification \nHandler" as NOTIFY_HANDLER
collections "mojaloop-\nobject-store\n(**MLOS**)" as OBJECT_STORE
boundary "Central Service API" as CSAPI
collections "topic-\nbulk-prepare" as TOPIC_BULK_PREPARE
Expand All @@ -57,8 +57,8 @@ box "Financial Service Providers" #lightGray
participant DFSP2
end box

box "ML API Adapter Service" #LightBlue
participant MLAPI
box "Bulk API Adapter Service" #LightBlue
participant BULK_API
participant NOTIFY_HANDLER
end box

Expand Down Expand Up @@ -123,14 +123,16 @@ group DFSP1 sends a Bulk Prepare Transfer request to DFSP2
expiration: <string>
}
end note
DFSP1 ->> MLAPI: POST - /bulkTransfers
activate MLAPI
MLAPI -> MLAPI: Validate incoming message\n<color #FF0000><b>Error codes:</b> 3000-3002, 3100-3107</color>
MLAPI -> OBJECT_STORE: Persist incoming bulk message to\nobject store: **MLOS.individualTransfers**
activate OBJECT_STORE
OBJECT_STORE --> MLAPI: Return messageId reference to the stored object(s)
deactivate OBJECT_STORE
note right of MLAPI #yellow
DFSP1 ->> BULK_API: POST - /bulkTransfers
activate BULK_API
BULK_API -> BULK_API: Validate incoming message\n<color #FF0000><b>Error codes:</b> 3000-3002, 3100-3107</color>
loop
BULK_API -> OBJECT_STORE: Persist individual transfers in the bulk to\nobject store: **MLOS.individualTransfers**
activate OBJECT_STORE
OBJECT_STORE --> BULK_API: Return messageId reference to the stored object(s)
deactivate OBJECT_STORE
end
note right of BULK_API #yellow
Message:
{
id: <messageId>
Expand Down Expand Up @@ -162,19 +164,15 @@ group DFSP1 sends a Bulk Prepare Transfer request to DFSP2
}
}
end note
MLAPI -> TOPIC_BULK_PREPARE: Route & Publish Bulk Prepare event \nfor Payer\n<color #FF0000><b>Error code:</b> 2003</color>
BULK_API -> TOPIC_BULK_PREPARE: Route & Publish Bulk Prepare event \nfor Payer\n<color #FF0000><b>Error code:</b> 2003</color>
activate TOPIC_BULK_PREPARE
TOPIC_BULK_PREPARE <-> TOPIC_BULK_PREPARE: Ensure event is replicated \nas configured (ACKS=all)\n<color #FF0000><b>Error code:</b> 2003</color>
TOPIC_BULK_PREPARE --> MLAPI: Respond replication acknowledgements \nhave been received
TOPIC_BULK_PREPARE --> BULK_API: Respond replication acknowledgements \nhave been received
deactivate TOPIC_BULK_PREPARE
MLAPI -->> DFSP1: Respond HTTP - 202 (Accepted)
deactivate MLAPI
BULK_API -->> DFSP1: Respond HTTP - 202 (Accepted)
deactivate BULK_API
|||
TOPIC_BULK_PREPARE <- BULK_PREP_HANDLER: Consume message
BULK_PREP_HANDLER -> OBJECT_STORE: Retrieve individual transfers by key:\n**MLOS.individualTransfers.messageId**
activate OBJECT_STORE
OBJECT_STORE --> BULK_PREP_HANDLER: Stream bulk's individual transfers
deactivate OBJECT_STORE
ref over TOPIC_BULK_PREPARE, BULK_PREP_HANDLER, TOPIC_TRANSFER_PREPARE: Bulk Prepare Handler Consume \n
alt Success
BULK_PREP_HANDLER -> TOPIC_TRANSFER_PREPARE: Produce (stream) single transfer message\nfor each individual transfer [loop]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,30 +66,8 @@ group Bulk Prepare Handler Consume
TOPIC_BULK_PREPARE <- BULK_PREP_HANDLER: Consume Bulk Prepare message
activate TOPIC_BULK_PREPARE
deactivate TOPIC_BULK_PREPARE

break
group Validate Event
BULK_PREP_HANDLER <-> BULK_PREP_HANDLER: Validate event - Rule: type == 'bulk-prepare' && action == 'bulk-prepare'\n<color #FF0000><b>Error codes:</b> 2001</color>
end
end

group Persist Event Information
|||
BULK_PREP_HANDLER -> TOPIC_EVENTS: Publish event information
ref over BULK_PREP_HANDLER, TOPIC_EVENTS : Event Handler Consume\n
|||
end

group Validate Bulk Prepare Transfer
BULK_PREP_HANDLER <-> BULK_PREP_HANDLER: <color #gray>Schema validation of the incoming message</color>
BULK_PREP_HANDLER <-> BULK_PREP_HANDLER: <color #gray>Verify the message's signature (to be confirmed in future requirement)</color>
note right of BULK_PREP_HANDLER #lightgrey
The above validation steps are already handled by the
Bulk-API-Adapter for the open source implementation.
It may need to be added in future for custom adapters.
end note

group Validate Duplicate Check
group Duplicate Check
note right of BULK_PREP_HANDLER #cyan
The Specification doesn't touch on the duplicate handling
of bulk transfers, so the current design mostly follows the
Expand All @@ -104,58 +82,12 @@ group Bulk Prepare Handler Consume
end note
|||
BULK_PREP_HANDLER -> DB: Request Duplicate Check
ref over BULK_PREP_HANDLER, DB: Request Duplicate Check (using message.content.payload.hash)\n
ref over BULK_PREP_HANDLER, DB: Request Duplicate Check (using message.content.payload)\n
DB --> BULK_PREP_HANDLER: Return { hasDuplicateId: Boolean, hasDuplicateHash: Boolean }
end

alt hasDuplicateId == TRUE && hasDuplicateHash == TRUE
break
BULK_PREP_HANDLER -> BULK_DAO: Request to retrieve Bulk Transfer state & completedTimestamp\n<color #FF0000><b>Error code:</b> 2003</color>
activate BULK_DAO
BULK_DAO -> DB: Query database
hnote over DB #lightyellow
bulkTransfer
bulkTransferFulfilment
bulkTransferStateChange
end note
activate DB
BULK_DAO <-- DB: Return resultset
deactivate DB
BULK_DAO --> BULK_PREP_HANDLER: Return **bulkTransferStateId** & **completedTimestamp** (not null when completed)
deactivate BULK_DAO

note right of BULK_PREP_HANDLER #yellow
Message:
{
id: <messageId>
from: <ledgerName>,
to: <payerFspName>,
type: application/json
content: {
headers: <bulkTransferHeaders>,
payload: {
bulkTransferState: <string>,
completedTimestamp: <optional>
}
},
metadata: {
event: {
id: <uuid>,
responseTo: <previous.uuid>,
type: "notification",
action: "bulk-prepare-duplicate",
createdAt: <timestamp>,
state: {
status: "success",
code: 0
}
}
}
}
end note
BULK_PREP_HANDLER -> TOPIC_NOTIFICATIONS: Publish Notification event for Payer
activate TOPIC_NOTIFICATIONS
deactivate TOPIC_NOTIFICATIONS
break Return TRUE & Log ('Not implemented')
end
else hasDuplicateId == TRUE && hasDuplicateHash == FALSE
note right of BULK_PREP_HANDLER #yellow
Expand Down Expand Up @@ -205,39 +137,43 @@ group Bulk Prepare Handler Consume
activate TOPIC_NOTIFICATIONS
deactivate TOPIC_NOTIFICATIONS
else hasDuplicateId == FALSE
group Validate Payer
BULK_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 --> BULK_PREP_HANDLER: Return Participant details if it exists
deactivate PARTICIPANT_DAO
BULK_PREP_HANDLER <-> BULK_PREP_HANDLER: Validate Payer\n<color #FF0000><b>Error codes:</b> 3202</color>
end
group Validate Payee
BULK_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 --> BULK_PREP_HANDLER: Return Participant details if it exists
deactivate PARTICIPANT_DAO
BULK_PREP_HANDLER <-> BULK_PREP_HANDLER: Validate Payee\n<color #FF0000><b>Error codes:</b> 3203</color>
group Validate Bulk Transfer Prepare Request
BULK_PREP_HANDLER <-> BULK_PREP_HANDLER: FSPIOP Source matches Payer
BULK_PREP_HANDLER <-> BULK_PREP_HANDLER: Check expiration
BULK_PREP_HANDLER <-> BULK_PREP_HANDLER: Payer and Payee FSP's are different
group Validate Payer
BULK_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 --> BULK_PREP_HANDLER: Return Participant details if it exists
deactivate PARTICIPANT_DAO
BULK_PREP_HANDLER <-> BULK_PREP_HANDLER: Validate Payer\n<color #FF0000><b>Error codes:</b> 3202</color>
end
group Validate Payee
BULK_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 --> BULK_PREP_HANDLER: Return Participant details if it exists
deactivate PARTICIPANT_DAO
BULK_PREP_HANDLER <-> BULK_PREP_HANDLER: Validate Payee\n<color #FF0000><b>Error codes:</b> 3203</color>
end
end
BULK_PREP_HANDLER <-> BULK_PREP_HANDLER: Validate crypto-condition\n<color #FF0000><b>Error codes:</b> 3100</color>

alt Validate Bulk Prepare Transfer (success)
|||
alt Validate Bulk Transfer Prepare Request (success)
group Persist Bulk Transfer State (with bulkTransferState='RECEIVED')
BULK_PREP_HANDLER -> BULK_DAO: Request to persist bulk transfer\n<color #FF0000><b>Error codes:</b> 2003</color>
activate BULK_DAO
Expand All @@ -249,10 +185,10 @@ group Bulk Prepare Handler Consume
end note
activate DB
deactivate DB
BULK_DAO --> BULK_PREP_HANDLER: Return success
BULK_DAO --> BULK_PREP_HANDLER: Return state
deactivate BULK_DAO
end
else Validate Bulk Prepare Transfer (failure)
else Validate Bulk Transfer Prepare Request (failure)
group Persist Bulk Transfer State (with bulkTransferState='INVALID') (Introducing a new status INVALID to mark these entries)
BULK_PREP_HANDLER -> BULK_DAO: Request to persist bulk transfer\n(when Payee/Payer/crypto-condition validation fails)\n<color #FF0000><b>Error codes:</b> 2003</color>
activate BULK_DAO
Expand All @@ -265,7 +201,7 @@ group Bulk Prepare Handler Consume
end note
activate DB
deactivate DB
BULK_DAO --> BULK_PREP_HANDLER: Return success
BULK_DAO --> BULK_PREP_HANDLER: Return state
deactivate BULK_DAO
end
end
Expand All @@ -288,10 +224,11 @@ group Bulk Prepare Handler Consume
BULK_DAO -> DB: Insert bulkTransferAssociation
hnote over DB #lightyellow
bulkTransferAssociation
bulkTransferStateChange
end note
activate DB
deactivate DB
BULK_DAO --> BULK_PREP_HANDLER: Return success
BULK_DAO --> BULK_PREP_HANDLER: Return state
deactivate BULK_DAO
end

Expand Down Expand Up @@ -322,7 +259,7 @@ group Bulk Prepare Handler Consume
}
}
end note
BULK_PREP_HANDLER -> TOPIC_TRANSFER_PREPARE: Route & Publish Prepare event to the Payer for the Individual Transfer\n<color #FF0000><b>Error codes:</b> 2003</color>
BULK_PREP_HANDLER -> TOPIC_TRANSFER_PREPARE: Route & Publish Prepare event to the Payee for the Individual Transfer\n<color #FF0000><b>Error codes:</b> 2003</color>
activate TOPIC_TRANSFER_PREPARE
deactivate TOPIC_TRANSFER_PREPARE
end
Expand Down Expand Up @@ -362,6 +299,20 @@ group Bulk Prepare Handler Consume
BULK_PREP_HANDLER -> TOPIC_BULK_PROCESSING: Publish Processing (failure) event for Payer\n<color #FF0000><b>Error codes:</b> 2003</color>
activate TOPIC_BULK_PROCESSING
deactivate TOPIC_BULK_PROCESSING
group Insert Bulk Transfer Association (with bulkProcessingState='INVALID')
BULK_PREP_HANDLER -> BULK_DAO: Request to persist bulk transfer association\n<color #FF0000><b>Error codes:</b> 2003</color>
activate BULK_DAO
BULK_DAO -> DB: Insert bulkTransferAssociation
hnote over DB #lightyellow
bulkTransferAssociation
bulkTransferStateChange
end note
activate DB
deactivate DB
BULK_DAO --> BULK_PREP_HANDLER: Return state
deactivate BULK_DAO
end

end
end
deactivate BULK_PREP_HANDLER
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ collections "topic-bulk-processing" as TOPIC_BULK_PROCESSING
control "Bulk Processing Event Handler" as BULK_PROCESSING_HANDLER
collections "Event-Topic" as TOPIC_EVENTS
collections "Notification-Topic" as TOPIC_NOTIFICATIONS
database "Cache" as CACHE
collections "mojaloop-\nobject-store\n(**MLOS**)" as OBJECT_STORE
database "Central Services DB" as DB

box "Financial Service Providers" #lightGray
Expand All @@ -76,7 +76,7 @@ box "Central Service" #LightYellow
participant TOPIC_BULK_PROCESSING
participant BULK_PROCESSING_HANDLER
participant TOPIC_NOTIFICATIONS
participant CACHE
participant OBJECT_STORE
participant DB
end box

Expand Down Expand Up @@ -124,6 +124,21 @@ group DFSP2 sends a Fulfil Abort Transfer request
end note
DFSP2 ->> BULKAPI: **PUT - /bulkTransfers/<ID>/error**
activate BULKAPI

BULKAPI -> OBJECT_STORE: Persist request payload with messageId in cache
activate OBJECT_STORE
note right of BULKAPI #yellow
Message: {
messageId: <string>,
bulkTransferId: <string>,
payload: <object>
}
end note
hnote over OBJECT_STORE #lightyellow
individualTransferFulfils
end hnote
BULKAPI <- OBJECT_STORE: Response of save operation
deactivate OBJECT_STORE
note right of BULKAPI #yellow
Message:
{
Expand All @@ -149,19 +164,6 @@ group DFSP2 sends a Fulfil Abort Transfer request
}
}
end note
BULKAPI -> CACHE: Persist request payload with messageId in cache
activate CACHE
note right of BULKAPI #yellow
Message: {
messageId: <string>,
bulkTransferId: <string>,
payload: <object>
}
end note
hnote over CACHE #lightyellow
individualTransferFulfils
end hnote
deactivate CACHE
BULKAPI -> TOPIC_BULK_FULFIL: Produce bulk-fulfil message
BULKAPI -->> DFSP2: Respond HTTP - 200 (OK)
TOPIC_BULK_FULFIL <- BULK_FULFIL_HANDLER: Consume bulk-fulfil message
Expand Down
Loading

0 comments on commit 6b8c243

Please sign in to comment.