diff --git a/docs/.vuepress/config.js b/docs/.vuepress/config.js index a89707e1..ae21ecc9 100644 --- a/docs/.vuepress/config.js +++ b/docs/.vuepress/config.js @@ -551,6 +551,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/2.1.0-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.2.0-fx-fulfil-reject-transfer" + } + ] + }, { title: "Bulk Transfers Operations", collapsable: true, 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/api/thirdparty/assets/diagrams/transfer/1-2-1-agreement.svg b/docs/technical/api/thirdparty/assets/diagrams/transfer/1-2-1-agreement.svg index 8beee78f..6a74a58b 100644 --- a/docs/technical/api/thirdparty/assets/diagrams/transfer/1-2-1-agreement.svg +++ b/docs/technical/api/thirdparty/assets/diagrams/transfer/1-2-1-agreement.svg @@ -1,114 +1,114 @@ - - + + Transfer: 1.2.1 Agreement - Transfer: 1.2.1 Agreement - - PISP - - Mojaloop - - DFSP A - - - - - PISP Server - - Switch - - DFSP A - (Payer) - - - - - Agreement Phase - - POST /thirdpartyRequests/transactions - FSPIOP-Source: pispa - FSPIOP-Destination: dfspa - { - "transactionRequestId": "00000000-0000-0000-0000-000000000000", - "payee": { - "partyIdInfo": { - "partyIdType": "MSISDN", - "partyIdentifier": "+4412345678", - "fspId": "dfspb" - } - }, - "payer": { - "partyIdType": "THIRD_PARTY_LINK", - "partyIdentifier": "qwerty-56789", - "fspId": "dfspa" - }, - "amountType": "SEND", - "amount": { - "amount": "100", - "currency": "USD" - }, - "transactionType": { - "scenario": "TRANSFER", - "initiator": "PAYER", - "initiatorType": "CONSUMER" - }, - "expiration": "2020-06-15T22:17:28.985-01:00" - } - - - POST /thirdpartyRequests/transactions - - - 202 Accepted - - - POST /thirdpartyRequests/transactions - - - 202 Accepted - - - - - Lookup the consent for this - payer - , verify that they exist, and consent - is granted with a valid credential - - - - - Store a referece to the - consentId - with the - transactionRequestId - - - - - Generate a unique transactionId for this transaction request: - 11111111-0000-0000-0000-000000000000 - - PUT /thirdpartyRequests/transactions - /00000000-0000-0000-0000-000000000000 - FSPIOP-Source: dfspa - FSPIOP-Destination: pispa - { - "transactionRequestState": "RECEIVED" - } - - - PUT /thirdpartyRequests/transactions - /00000000-0000-0000-0000-000000000000 - - - 200 OK - - - PUT /thirdpartyRequests/transactions - /00000000-0000-0000-0000-000000000000 - - - 200 OK + Transfer: 1.2.1 Agreement + + PISP + + Mojaloop + + DFSP A + + + + + PISP Server + + Switch + + DFSP A + (Payer) + + + + + Agreement Phase + + POST /thirdpartyRequests/transactions + FSPIOP-Source: pispa + FSPIOP-Destination: dfspa + { + "transactionRequestId": "00000000-0000-0000-0000-000000000000", + "payee": { + "partyIdInfo": { + "partyIdType": "MSISDN", + "partyIdentifier": "+4412345678", + "fspId": "dfspb" + } + }, + "payer": { + "partyIdType": "THIRD_PARTY_LINK", + "partyIdentifier": "qwerty-56789", + "fspId": "dfspa" + }, + "amountType": "SEND", + "amount": { + "amount": "100", + "currency": "USD" + }, + "transactionType": { + "scenario": "TRANSFER", + "initiator": "PAYER", + "initiatorType": "CONSUMER" + }, + "expiration": "2020-06-15T22:17:28.985-01:00" + } + + + POST /thirdpartyRequests/transactions + + + 202 Accepted + + + POST /thirdpartyRequests/transactions + + + 202 Accepted + + + + + Lookup the consent for this + payer + , verify that they exist, and consent + is granted with a valid credential + + + + + Store a referece to the + consentId + with the + transactionRequestId + + + + + Generate a unique transactionId for this transaction request: + 11111111-0000-0000-0000-000000000000 + + PUT /thirdpartyRequests/transactions + /00000000-0000-0000-0000-000000000000 + FSPIOP-Source: dfspa + FSPIOP-Destination: pispa + { + "transactionRequestState": "RECEIVED" + } + + + PUT /thirdpartyRequests/transactions + /00000000-0000-0000-0000-000000000000 + + + 200 OK + + + PUT /thirdpartyRequests/transactions + /00000000-0000-0000-0000-000000000000 + + + 200 OK diff --git a/docs/technical/api/thirdparty/assets/diagrams/transfer/1-2-2-authorization.svg b/docs/technical/api/thirdparty/assets/diagrams/transfer/1-2-2-authorization.svg index 1a5b816e..cbaf79e3 100644 --- a/docs/technical/api/thirdparty/assets/diagrams/transfer/1-2-2-authorization.svg +++ b/docs/technical/api/thirdparty/assets/diagrams/transfer/1-2-2-authorization.svg @@ -1,175 +1,175 @@ - - + + Transfer: 1.2.2 Authorization - Transfer: 1.2.2 Authorization - - PISP - - Mojaloop - - DFSP A - - DFSP B - - - - - - PISP Server - - Switch - - DFSP A - (Payer) - - DFSP B - (Payee) - - POST /quotes - FSPIOP-Source: dfspa - FSPIOP-Destination: dfspb - { - "quoteId": "22222222-0000-0000-0000-000000000000", - "transactionId": "11111111-0000-0000-0000-000000000000", - "transactionRequestId": "00000000-0000-0000-0000-000000000000", - "payee": { - "partyIdInfo": { - "partyIdType": "MSISDN", - "partyIdentifier": "+4412345678", - "fspId": "dfspb" - } - }, - "payer": { - "personalInfo": { - "complexName": { - "firstName": "Ayesha", - "lastName": "Takia" - } - }, - "partyIdInfo": { - "partyIdType": "MSISDN", - "partyIdentifier": "123456789", - "fspId": "dfspa" - }, - }, - "amountType": "SEND", - "amount": { - "amount": "100", - "currency": "USD" - }, - "transactionType": { - "scenario": "TRANSFER", - "initiator": "PAYER", - "initiatorType": "CONSUMER" - }, - "note": "quote note" - } - - - POST /quotes - - - 202 Accepted - - - POST /quotes - - - 202 Accepted - - PUT /quotes/22222222-0000-0000-0000-000000000000 - FSPIOP-Source: dfspb - FSPIOP-Destination: dfspa - { - "transferAmount": { - "amount": "100", - "currency": "USD" - }, - "payeeReceiveAmount": { - "amount": "99", - "currency": "USD" - }, - "payeeFspFee": { - "amount": "1", - "currency": "USD" - }, - "expiration": "2020-06-15T12:00:00.000", - "ilpPacket": "...", - "condition": "...", - } - - - PUT /quotes/22222222-0000-0000-0000-000000000000 - - - 200 OK - - - PUT /quotes/22222222-0000-0000-0000-000000000000 - - - 200 OK - - - DFSP A has the quote, they can now ask - the PISP for authorization - - - - - Generate a UUID for the authorization Request: - 33333333-0000-0000-0000-000000000000 - - - - - Derive the challenge based - on - PUT /quotes/{ID} - - POST /thirdpartyRequests/authorizations - FSPIOP-Source: dfspa - FSPIOP-Destination: pispa - { - "authorizationRequestId": "33333333-0000-0000-0000-000000000000", - "transactionRequestId": "00000000-0000-0000-0000-000000000000", - "challenge": - <base64 encoded binary - the encoded challenge> - , - "transferAmount": {"amount": "100", "currency": "USD"}, - "payeeReceiveAmount": {"amount": "99", "currency": "USD"}, - "fees": {"amount": "1", "currency": "USD"}, - "payer": { - "partyIdType": "THIRD_PARTY_LINK", - "partyIdentifier": "qwerty-56789", - "fspId": "dfspa" - }, - "payee": { - "partyIdInfo": { - "partyIdType": "MSISDN", - "partyIdentifier": "+4412345678", - "fspId": "dfspb" - } - }, - "transactionType": { - "scenario": "TRANSFER", - "initiator": "PAYER", - "initiatorType": "CONSUMER" - }, - "expiration": "2020-06-15T12:00:00.000", - } - - - POST /thirdpartyRequests/authorizations - - - 202 Accepted - - - POST /thirdpartyRequests/authorizations - - - 202 Accepted + Transfer: 1.2.2 Authorization + + PISP + + Mojaloop + + DFSP A + + DFSP B + + + + + + PISP Server + + Switch + + DFSP A + (Payer) + + DFSP B + (Payee) + + POST /quotes + FSPIOP-Source: dfspa + FSPIOP-Destination: dfspb + { + "quoteId": "22222222-0000-0000-0000-000000000000", + "transactionId": "11111111-0000-0000-0000-000000000000", + "transactionRequestId": "00000000-0000-0000-0000-000000000000", + "payee": { + "partyIdInfo": { + "partyIdType": "MSISDN", + "partyIdentifier": "+4412345678", + "fspId": "dfspb" + } + }, + "payer": { + "personalInfo": { + "complexName": { + "firstName": "Ayesha", + "lastName": "Takia" + } + }, + "partyIdInfo": { + "partyIdType": "MSISDN", + "partyIdentifier": "123456789", + "fspId": "dfspa" + }, + }, + "amountType": "SEND", + "amount": { + "amount": "100", + "currency": "USD" + }, + "transactionType": { + "scenario": "TRANSFER", + "initiator": "PAYER", + "initiatorType": "CONSUMER" + }, + "note": "quote note" + } + + + POST /quotes + + + 202 Accepted + + + POST /quotes + + + 202 Accepted + + PUT /quotes/22222222-0000-0000-0000-000000000000 + FSPIOP-Source: dfspb + FSPIOP-Destination: dfspa + { + "transferAmount": { + "amount": "100", + "currency": "USD" + }, + "payeeReceiveAmount": { + "amount": "99", + "currency": "USD" + }, + "payeeFspFee": { + "amount": "1", + "currency": "USD" + }, + "expiration": "2020-06-15T12:00:00.000", + "ilpPacket": "...", + "condition": "...", + } + + + PUT /quotes/22222222-0000-0000-0000-000000000000 + + + 200 OK + + + PUT /quotes/22222222-0000-0000-0000-000000000000 + + + 200 OK + + + DFSP A has the quote, they can now ask + the PISP for authorization + + + + + Generate a UUID for the authorization Request: + 33333333-0000-0000-0000-000000000000 + + + + + Derive the challenge based + on + PUT /quotes/{ID} + + POST /thirdpartyRequests/authorizations + FSPIOP-Source: dfspa + FSPIOP-Destination: pispa + { + "authorizationRequestId": "33333333-0000-0000-0000-000000000000", + "transactionRequestId": "00000000-0000-0000-0000-000000000000", + "challenge": + <base64 encoded binary - the encoded challenge> + , + "transferAmount": {"amount": "100", "currency": "USD"}, + "payeeReceiveAmount": {"amount": "99", "currency": "USD"}, + "fees": {"amount": "1", "currency": "USD"}, + "payer": { + "partyIdType": "THIRD_PARTY_LINK", + "partyIdentifier": "qwerty-56789", + "fspId": "dfspa" + }, + "payee": { + "partyIdInfo": { + "partyIdType": "MSISDN", + "partyIdentifier": "+4412345678", + "fspId": "dfspb" + } + }, + "transactionType": { + "scenario": "TRANSFER", + "initiator": "PAYER", + "initiatorType": "CONSUMER" + }, + "expiration": "2020-06-15T12:00:00.000", + } + + + POST /thirdpartyRequests/authorizations + + + 202 Accepted + + + POST /thirdpartyRequests/authorizations + + + 202 Accepted diff --git a/docs/technical/api/thirdparty/assets/diagrams/transfer/1-2-3-rejected-authorization.svg b/docs/technical/api/thirdparty/assets/diagrams/transfer/1-2-3-rejected-authorization.svg index 315d8ba7..deaaa05c 100644 --- a/docs/technical/api/thirdparty/assets/diagrams/transfer/1-2-3-rejected-authorization.svg +++ b/docs/technical/api/thirdparty/assets/diagrams/transfer/1-2-3-rejected-authorization.svg @@ -1,93 +1,93 @@ - - + + Transfer: 1.2.3 Rejected Authorization - Transfer: 1.2.3 Rejected Authorization - - PISP - - Mojaloop - - DFSP A - - - - - PISP Server - - Switch - - DFSP A - (Payer) - - - - - Agreement Phase - - - PISP looks up the - transactionRequestId - and - checks the quote with the user, - - - User rejects the terms of the transcationRequest - - PUT /thirdpartyRequests/authorizations/33333333-0000-0000-0000-000000000000 - FSPIOP-Source: pispa - FSPIOP-Destination: dfspa - { - "responseType": "REJECTED" - } - - - PUT /thirdpartyRequests/authorizations/33333333-0000-0000-0000-000000000000 - - - 200 OK - - - PUT /thirdpartyRequests/authorizations - /33333333-0000-0000-0000-000000000000 - - - 200 OK - - - - - Look up the - transactionRequestId - for this - authorizationId - - - User has rejected the transaction request. - - PATCH /thirdpartyRequests/transactions/00000000-0000-0000-0000-000000000000 - FSPIOP-Source: dfspa - FSPIOP-Destination: pispa - { - "transactionRequestState": "REJECTED", - "transactionId": "11111111-0000-0000-0000-000000000000", - } - - - PATCH /thirdpartyRequests/transactions - /00000000-0000-0000-0000-000000000000 - - - 200 OK - - - PATCH /thirdpartyRequests/transactions - /00000000-0000-0000-0000-000000000000 - - - 200 OK - - - PISP can inform the user the transaction did not proceed + Transfer: 1.2.3 Rejected Authorization + + PISP + + Mojaloop + + DFSP A + + + + + PISP Server + + Switch + + DFSP A + (Payer) + + + + + Agreement Phase + + + PISP looks up the + transactionRequestId + and + checks the quote with the user, +   +   + User rejects the terms of the transcationRequest + + PUT /thirdpartyRequests/authorizations/33333333-0000-0000-0000-000000000000 + FSPIOP-Source: pispa + FSPIOP-Destination: dfspa + { + "responseType": "REJECTED" + } + + + PUT /thirdpartyRequests/authorizations/33333333-0000-0000-0000-000000000000 + + + 200 OK + + + PUT /thirdpartyRequests/authorizations + /33333333-0000-0000-0000-000000000000 + + + 200 OK + + + + + Look up the + transactionRequestId + for this + authorizationId + + + User has rejected the transaction request. + + PATCH /thirdpartyRequests/transactions/00000000-0000-0000-0000-000000000000 + FSPIOP-Source: dfspa + FSPIOP-Destination: pispa + { + "transactionRequestState": "REJECTED", + "transactionId": "11111111-0000-0000-0000-000000000000", + } + + + PATCH /thirdpartyRequests/transactions + /00000000-0000-0000-0000-000000000000 + + + 200 OK + + + PATCH /thirdpartyRequests/transactions + /00000000-0000-0000-0000-000000000000 + + + 200 OK + + + PISP can inform the user the transaction did not proceed diff --git a/docs/technical/api/thirdparty/assets/diagrams/transfer/1-2-3-signed-authorization-fido.svg b/docs/technical/api/thirdparty/assets/diagrams/transfer/1-2-3-signed-authorization-fido.svg index 7848c4b4..4b635512 100644 --- a/docs/technical/api/thirdparty/assets/diagrams/transfer/1-2-3-signed-authorization-fido.svg +++ b/docs/technical/api/thirdparty/assets/diagrams/transfer/1-2-3-signed-authorization-fido.svg @@ -1,95 +1,95 @@ - - + + Transfer: 1.2.3 Signed Authorization FIDO - Transfer: 1.2.3 Signed Authorization FIDO - - PISP - - Mojaloop - - DFSP A - - - - - PISP Server - - Switch - - DFSP A - (Payer) - - - - - Agreement Phase - - - PISP looks up the - transactionRequestId - and - checks the terms with the user. - - If the user agrees to the terms, the PISP - uses the FIDO API on the user's device to sign the - the - challenge - string - - PUT /thirdpartyRequests/authorizations/33333333-0000-0000-0000-000000000000 - FSPIOP-Source: pispa - FSPIOP-Destination: dfspa - { - "responseType": "ACCEPTED" - "signedPayload": { - "signedPayloadType": "FIDO", - "fidoSignedPayload": { - "id": "string", - "rawId": "string - base64 encoded utf-8", - "response": { - "authenticatorData": "string - base64 encoded utf-8", - "clientDataJSON": "string - base64 encoded utf-8", - "signature": "string - base64 encoded utf-8", - "userHandle": "string - base64 encoded utf-8", - }, - "type": "public-key" - } - } - } - - - PUT /thirdpartyRequests/authorizations/33333333-0000-0000-0000-000000000000 - - - 200 OK - - - PUT /thirdpartyRequests/authorizations - /33333333-0000-0000-0000-000000000000 - - - 200 OK - - - - - Look up the - transactionRequestId - for this - authorizationId - - - - - Look up the - consentId - for this - transactionRequestId - - - DFSP has the signed challenge. - It now needs to ask the Auth-Service to verify - the signed challenge. + Transfer: 1.2.3 Signed Authorization FIDO + + PISP + + Mojaloop + + DFSP A + + + + + PISP Server + + Switch + + DFSP A + (Payer) + + + + + Agreement Phase + + + PISP looks up the + transactionRequestId + and + checks the terms with the user. +   + If the user agrees to the terms, the PISP + uses the FIDO API on the user's device to sign the + the + challenge + string + + PUT /thirdpartyRequests/authorizations/33333333-0000-0000-0000-000000000000 + FSPIOP-Source: pispa + FSPIOP-Destination: dfspa + { + "responseType": "ACCEPTED" + "signedPayload": { + "signedPayloadType": "FIDO", + "fidoSignedPayload": { + "id": "string", + "rawId": "string - base64 encoded utf-8", + "response": { + "authenticatorData": "string - base64 encoded utf-8", + "clientDataJSON": "string - base64 encoded utf-8", + "signature": "string - base64 encoded utf-8", + "userHandle": "string - base64 encoded utf-8", + }, + "type": "public-key" + } + } + } + + + PUT /thirdpartyRequests/authorizations/33333333-0000-0000-0000-000000000000 + + + 200 OK + + + PUT /thirdpartyRequests/authorizations + /33333333-0000-0000-0000-000000000000 + + + 200 OK + + + + + Look up the + transactionRequestId + for this + authorizationId + + + + + Look up the + consentId + for this + transactionRequestId + + + DFSP has the signed challenge. + It now needs to ask the Auth-Service to verify + the signed challenge. diff --git a/docs/technical/api/thirdparty/assets/diagrams/transfer/1-2-3-signed-authorization-generic.svg b/docs/technical/api/thirdparty/assets/diagrams/transfer/1-2-3-signed-authorization-generic.svg index 0139bf2f..58ab5023 100644 --- a/docs/technical/api/thirdparty/assets/diagrams/transfer/1-2-3-signed-authorization-generic.svg +++ b/docs/technical/api/thirdparty/assets/diagrams/transfer/1-2-3-signed-authorization-generic.svg @@ -1,82 +1,82 @@ - - + + Transfer: 1.2.3 Signed Authorization - Transfer: 1.2.3 Signed Authorization - - PISP - - Mojaloop - - DFSP A - - - - - PISP Server - - Switch - - DFSP A - (Payer) - - - - - Agreement Phase - - - PISP looks up the - transactionRequestId - and - checks the quote with the user. - - If the user agrees to the terms, the PISP uses - the Credential's privateKey to sign the challenge - - PUT /thirdpartyRequests/authorizations/33333333-0000-0000-0000-000000000000 - FSPIOP-Source: pispa - FSPIOP-Destination: dfspa - { - "responseType": "ACCEPTED" - "signedPayload": { - "signedPayloadType": "GENERIC", - "genericSignedPayload": "utf-8 base64 encoded signature" - } - } - - - PUT /thirdpartyRequests/authorizations/33333333-0000-0000-0000-000000000000 - - - 200 OK - - - PUT /thirdpartyRequests/authorizations - /33333333-0000-0000-0000-000000000000 - - - 200 OK - - - - - Look up the - transactionRequestId - for this - authorizationId - - - - - Look up the - consentId - for this - transactionRequestId - - - DFSP has the signed challenge. - It now needs to ask the Auth-Service to verify - the signed challenge. + Transfer: 1.2.3 Signed Authorization + + PISP + + Mojaloop + + DFSP A + + + + + PISP Server + + Switch + + DFSP A + (Payer) + + + + + Agreement Phase + + + PISP looks up the + transactionRequestId + and + checks the quote with the user. +   + If the user agrees to the terms, the PISP uses + the Credential's privateKey to sign the challenge + + PUT /thirdpartyRequests/authorizations/33333333-0000-0000-0000-000000000000 + FSPIOP-Source: pispa + FSPIOP-Destination: dfspa + { + "responseType": "ACCEPTED" + "signedPayload": { + "signedPayloadType": "GENERIC", + "genericSignedPayload": "utf-8 base64 encoded signature" + } + } + + + PUT /thirdpartyRequests/authorizations/33333333-0000-0000-0000-000000000000 + + + 200 OK + + + PUT /thirdpartyRequests/authorizations + /33333333-0000-0000-0000-000000000000 + + + 200 OK + + + + + Look up the + transactionRequestId + for this + authorizationId + + + + + Look up the + consentId + for this + transactionRequestId + + + DFSP has the signed challenge. + It now needs to ask the Auth-Service to verify + the signed challenge. diff --git a/docs/technical/api/thirdparty/assets/diagrams/transfer/1-2-4-verify-authorization.svg b/docs/technical/api/thirdparty/assets/diagrams/transfer/1-2-4-verify-authorization.svg index 1d77b6ce..ec93b340 100644 --- a/docs/technical/api/thirdparty/assets/diagrams/transfer/1-2-4-verify-authorization.svg +++ b/docs/technical/api/thirdparty/assets/diagrams/transfer/1-2-4-verify-authorization.svg @@ -1,106 +1,106 @@ - - + + Transfer: 1.2.4 Verify Authorization - Transfer: 1.2.4 Verify Authorization - - Mojaloop - - DFSP A - - - - - Switch - - Auth-Service - - DFSP A - (Payer) - - - - - Generate a new - verificationRequestId - , and associate - it with the - thirdpartyTransactionRequestId - - POST /thirdpartyRequests/verifications - FSPIOP-Source: dfspa - FSPIOP-Destination: central-auth - { - "verificationRequestId": "44444444-0000-0000-0000-000000000000", - "challenge": - <base64 encoded binary - the encoded challenge> - , - "consentId": "123", - "signedPayloadType": "FIDO", - "fidoValue": { - "id": "string", - "rawId": "string - base64 encoded utf-8", - "response": { - "authenticatorData": "string - base64 encoded utf-8", - "clientDataJSON": "string - base64 encoded utf-8", - "signature": "string - base64 encoded utf-8", - "userHandle": "string - base64 encoded utf-8", - }, - "type": "public-key" - } - } - - - POST /thirdpartyRequests/verifications - - - 202 Accepted - - - POST /thirdpartyRequests/verifications - - - 202 Accepted - - - - - Lookup this consent based on consentId - - - - - Ensure the accountAddress matches what is in Consent - - - - - Check that the signed bytes match the - publickey we have stored for the consent - - PUT /thirdpartyRequests/verifications/44444444-0000-0000-0000-000000000000 - FSPIOP-Source: central-auth - FSPIOP-Destination: dfspa - { - "authenticationResponse": "VERIFIED" - } - - - PUT /thirdpartyRequests/verifications - /44444444-0000-0000-0000-000000000000 - - - 200 OK - - - PUT /thirdpartyRequests/verifications - /44444444-0000-0000-0000-000000000000 - - - 200 OK - - - DFSPA now knows that the user signed this transaction - and can go ahead and initiate the transfer + Transfer: 1.2.4 Verify Authorization + + Mojaloop + + DFSP A + + + + + Switch + + Auth-Service + + DFSP A + (Payer) + + + + + Generate a new + verificationRequestId + , and associate + it with the + thirdpartyTransactionRequestId + + POST /thirdpartyRequests/verifications + FSPIOP-Source: dfspa + FSPIOP-Destination: central-auth + { + "verificationRequestId": "44444444-0000-0000-0000-000000000000", + "challenge": + <base64 encoded binary - the encoded challenge> + , + "consentId": "123", + "signedPayloadType": "FIDO", + "fidoValue": { + "id": "string", + "rawId": "string - base64 encoded utf-8", + "response": { + "authenticatorData": "string - base64 encoded utf-8", + "clientDataJSON": "string - base64 encoded utf-8", + "signature": "string - base64 encoded utf-8", + "userHandle": "string - base64 encoded utf-8", + }, + "type": "public-key" + } + } + + + POST /thirdpartyRequests/verifications + + + 202 Accepted + + + POST /thirdpartyRequests/verifications + + + 202 Accepted + + + + + Lookup this consent based on consentId + + + + + Ensure the accountAddress matches what is in Consent + + + + + Check that the signed bytes match the + publickey we have stored for the consent + + PUT /thirdpartyRequests/verifications/44444444-0000-0000-0000-000000000000 + FSPIOP-Source: central-auth + FSPIOP-Destination: dfspa + { + "authenticationResponse": "VERIFIED" + } + + + PUT /thirdpartyRequests/verifications + /44444444-0000-0000-0000-000000000000 + + + 200 OK + + + PUT /thirdpartyRequests/verifications + /44444444-0000-0000-0000-000000000000 + + + 200 OK + + + DFSPA now knows that the user signed this transaction + and can go ahead and initiate the transfer diff --git a/docs/technical/api/thirdparty/assets/diagrams/transfer/1-3-transfer.svg b/docs/technical/api/thirdparty/assets/diagrams/transfer/1-3-transfer.svg index e844dffc..3c037e93 100644 --- a/docs/technical/api/thirdparty/assets/diagrams/transfer/1-3-transfer.svg +++ b/docs/technical/api/thirdparty/assets/diagrams/transfer/1-3-transfer.svg @@ -1,161 +1,161 @@ - - + + Transfer: 1.3 Final transfer - Transfer: 1.3 Final transfer - - PISP - - Mojaloop - - DFSP A - - DFSP B - - - - - - - - - - - - - - - - - PISP Server - - Switch - - DFSP A - (Payer) - - DFSP B - (Payee) - - Payee - - - - - - - Transfer Phase - DFSP A initiates a normal Mojaloop P2P Transfer - - - - - Generate a new - transferId - , and associate - it with the - transactionRequestId - - POST /transfers - FSPIOP-Source: dfspa - FSPIOP-Destination: dfspb - { - "transferId": "55555555-0000-0000-0000-000000000000", - "payerFsp": "dfspa", - "payeeFsp": "dfspb", - "amount": { - "amount": "100", - "currency": "USD" - }, - "expiration": "2020-06-15T13:00:00.000", - "ilpPacket": "...", - "condition": "...", - } - - - POST /transfers - - - 202 Accepted - - POST /transfers - FSPIOP-Source: dfspa - FSPIOP-Destination: dfspb - { - "transferId": "55555555-0000-0000-0000-000000000000", - "payerFsp": "dfspa", - "payeeFsp": "dfspb", - "amount": { - "amount": "100", - "currency": "USD" - }, - "expiration": "2020-06-15T13:00:00.000", - "ilpPacket": "...", - "condition": "...", - } - - - POST /transfers - - - 202 Accepted - - PUT /transfers/55555555-0000-0000-0000-000000000000 - FSPIOP-Source: dfspb - FSPIOP-Destination: dfspa - { - "fulfilment": "...", - "completedTimestamp": "2020-06-15T12:01:00.000", - "transferState": "COMMITTED" - } - - - PUT /transfers/55555555-0000-0000-0000-000000000000 - - - 200 OK - - - You have received funds! - - - PUT /transfers/55555555-0000-0000-0000-000000000000 - - - 200 OK - - - - - Look up - transactionRequestId - from the - transferId - - PATCH /thirdpartyRequests/transactions/00000000-0000-0000-0000-000000000000 - FSPIOP-Source: dfspa - FSPIOP-Destination: pispa - { - "transactionRequestState": "ACCEPTED", - "transactionState": "COMMITTED" - } - - - PATCH /thirdpartyRequests/transactions - /00000000-0000-0000-0000-000000000000 - - - 200 OK - - - PATCH /thirdpartyRequests/transactions - /00000000-0000-0000-0000-000000000000 - - - 200 OK - - - PISP can now inform the user the - funds have been sent + Transfer: 1.3 Final transfer + + PISP + + Mojaloop + + DFSP A + + DFSP B + + + + + + + + + + + + + + + + + PISP Server + + Switch + + DFSP A + (Payer) + + DFSP B + (Payee) + + Payee + + + + + + + Transfer Phase + DFSP A initiates a normal Mojaloop P2P Transfer + + + + + Generate a new + transferId + , and associate + it with the + transactionRequestId + + POST /transfers + FSPIOP-Source: dfspa + FSPIOP-Destination: dfspb + { + "transferId": "55555555-0000-0000-0000-000000000000", + "payerFsp": "dfspa", + "payeeFsp": "dfspb", + "amount": { + "amount": "100", + "currency": "USD" + }, + "expiration": "2020-06-15T13:00:00.000", + "ilpPacket": "...", + "condition": "...", + } + + + POST /transfers + + + 202 Accepted + + POST /transfers + FSPIOP-Source: dfspa + FSPIOP-Destination: dfspb + { + "transferId": "55555555-0000-0000-0000-000000000000", + "payerFsp": "dfspa", + "payeeFsp": "dfspb", + "amount": { + "amount": "100", + "currency": "USD" + }, + "expiration": "2020-06-15T13:00:00.000", + "ilpPacket": "...", + "condition": "...", + } + + + POST /transfers + + + 202 Accepted + + PUT /transfers/55555555-0000-0000-0000-000000000000 + FSPIOP-Source: dfspb + FSPIOP-Destination: dfspa + { + "fulfilment": "...", + "completedTimestamp": "2020-06-15T12:01:00.000", + "transferState": "COMMITTED" + } + + + PUT /transfers/55555555-0000-0000-0000-000000000000 + + + 200 OK + + + You have received funds! + + + PUT /transfers/55555555-0000-0000-0000-000000000000 + + + 200 OK + + + + + Look up + transactionRequestId + from the + transferId + + PATCH /thirdpartyRequests/transactions/00000000-0000-0000-0000-000000000000 + FSPIOP-Source: dfspa + FSPIOP-Destination: pispa + { + "transactionRequestState": "ACCEPTED", + "transactionState": "COMMITTED" + } + + + PATCH /thirdpartyRequests/transactions + /00000000-0000-0000-0000-000000000000 + + + 200 OK + + + PATCH /thirdpartyRequests/transactions + /00000000-0000-0000-0000-000000000000 + + + 200 OK + + + PISP can now inform the user the + funds have been sent diff --git a/docs/technical/api/thirdparty/assets/diagrams/transfer/3-2-1-bad-tx-request.svg b/docs/technical/api/thirdparty/assets/diagrams/transfer/3-2-1-bad-tx-request.svg index 7895e4ed..3c48a8ee 100644 --- a/docs/technical/api/thirdparty/assets/diagrams/transfer/3-2-1-bad-tx-request.svg +++ b/docs/technical/api/thirdparty/assets/diagrams/transfer/3-2-1-bad-tx-request.svg @@ -1,101 +1,101 @@ - - + + Transfer: 3.2.1 Bad Thirdparty Transaction Request - Transfer: 3.2.1 Bad Thirdparty Transaction Request - - PISP - - Mojaloop - - DFSP A - - - - - PISP Server - - Switch - - DFSP A - (Payer) - - - - - Agreement Phase - - POST /thirdpartyRequests/transactions - FSPIOP-Source: pispa - FSPIOP-Destination: dfspa - { - "transactionRequestId": "00000000-0000-0000-0000-000000000000", - "payee": { - "partyIdInfo": { - "partyIdType": "MSISDN", - "partyIdentifier": "+4412345678", - "fspId": "dfspb" - } - }, - "payer": { - "partyIdType": "THIRD_PARTY_LINK", - "partyIdentifier": "qwerty-56789", - "fspId": "dfspa" - }, - "amountType": "SEND", - "amount": { - "amount": "100", - "currency": "USD" - }, - "transactionType": { - "scenario": "TRANSFER", - "initiator": "PAYER", - "initiatorType": "CONSUMER" - }, - "expiration": "2020-06-15T22:17:28.985-01:00" - } - - - POST /thirdpartyRequests/transactions - - - 202 Accepted - - - POST /thirdpartyRequests/transactions - - - 202 Accepted - - - - - DFSP finds something wrong with this transaction request. - - PUT /thirdpartyRequests/transactions - /00000000-0000-0000-0000-000000000000/error - FSPIOP-Source: dfspa - FSPIOP-Destination: pispa - { - "errorInformation": { - "errorCode": "6104", - "errorDescription": "Thirdparty request rejection", - "extensionList": [] - } - } - - - PUT /thirdpartyRequests/transactions - /00000000-0000-0000-0000-000000000000/error - - - 200 OK - - - PUT /thirdpartyRequests/transactions - /00000000-0000-0000-0000-000000000000/error - - - 200 OK + Transfer: 3.2.1 Bad Thirdparty Transaction Request + + PISP + + Mojaloop + + DFSP A + + + + + PISP Server + + Switch + + DFSP A + (Payer) + + + + + Agreement Phase + + POST /thirdpartyRequests/transactions + FSPIOP-Source: pispa + FSPIOP-Destination: dfspa + { + "transactionRequestId": "00000000-0000-0000-0000-000000000000", + "payee": { + "partyIdInfo": { + "partyIdType": "MSISDN", + "partyIdentifier": "+4412345678", + "fspId": "dfspb" + } + }, + "payer": { + "partyIdType": "THIRD_PARTY_LINK", + "partyIdentifier": "qwerty-56789", + "fspId": "dfspa" + }, + "amountType": "SEND", + "amount": { + "amount": "100", + "currency": "USD" + }, + "transactionType": { + "scenario": "TRANSFER", + "initiator": "PAYER", + "initiatorType": "CONSUMER" + }, + "expiration": "2020-06-15T22:17:28.985-01:00" + } + + + POST /thirdpartyRequests/transactions + + + 202 Accepted + + + POST /thirdpartyRequests/transactions + + + 202 Accepted + + + + + DFSP finds something wrong with this transaction request. + + PUT /thirdpartyRequests/transactions + /00000000-0000-0000-0000-000000000000/error + FSPIOP-Source: dfspa + FSPIOP-Destination: pispa + { + "errorInformation": { + "errorCode": "6104", + "errorDescription": "Thirdparty request rejection", + "extensionList": [] + } + } + + + PUT /thirdpartyRequests/transactions + /00000000-0000-0000-0000-000000000000/error + + + 200 OK + + + PUT /thirdpartyRequests/transactions + /00000000-0000-0000-0000-000000000000/error + + + 200 OK diff --git a/docs/technical/api/thirdparty/assets/diagrams/transfer/3-3-1-bad-quote-request.svg b/docs/technical/api/thirdparty/assets/diagrams/transfer/3-3-1-bad-quote-request.svg index c76cf22e..7c1471c2 100644 --- a/docs/technical/api/thirdparty/assets/diagrams/transfer/3-3-1-bad-quote-request.svg +++ b/docs/technical/api/thirdparty/assets/diagrams/transfer/3-3-1-bad-quote-request.svg @@ -1,178 +1,177 @@ - - + + Transfer: 3.3.1 Bad Quote Request - Transfer: 3.3.1 Bad Quote Request - - PISP - - Mojaloop - - DFSP A - - DFSP B - - - - - - - - - - - - - - PISP Server - - Switch - - DFSP A - (Payer) - - DFSP B - (Payee) - PISP has initiated Thirdparty Transaction Request with - POST /thirdpartyRequests/transactions - - - - - Generate a unique transactionId for this transaction request: - 11111111-0000-0000-0000-000000000000 - - PUT /thirdpartyRequests/transactions - /00000000-0000-0000-0000-000000000000 - FSPIOP-Source: dfspa - FSPIOP-Destination: pispa - { - "transactionId": "11111111-0000-0000-0000-000000000000", - "transactionRequestState": "RECEIVED" - } - - - PUT /thirdpartyRequests/transactions - /00000000-0000-0000-0000-000000000000 - - - 200 OK - - - PUT /thirdpartyRequests/transactions - /00000000-0000-0000-0000-000000000000 - - - 200 OK - - POST /quotes - FSPIOP-Source: dfspa - FSPIOP-Destination: dfspb - { - "quoteId": "22222222-0000-0000-0000-000000000000", - "transactionId": "11111111-0000-0000-0000-000000000000", - "transactionRequestId": "00000000-0000-0000-0000-000000000000", - "payee": { - "partyIdInfo": { - "partyIdType": "MSISDN", - "partyIdentifier": "+4412345678", - "fspId": "dfspb" - } - }, - "payer": { - "personalInfo": { - "complexName": { - "firstName": "Ayesha", - "lastName": "Takia" - } - }, - "partyIdInfo": { - "partyIdType": "THIRD_PARTY_LINK", - "partyIdentifier": "qwerty-56789", - "fspId": "dfspa" - }, - }, - }, - "amountType": "SEND", - "amount": { - "amount": "100", - "currency": "USD" - }, - "transactionType": { - "scenario": "TRANSFER", - "initiator": "PAYER", - "initiatorType": "CONSUMER" - }, - "note": "quote note" - } - - - POST /quotes - - - 202 Accepted - - - POST /quotes - - - 202 Accepted - - - - - Quote fails for some reason. - - PUT /quotes/22222222-0000-0000-0000-000000000000/error - FSPIOP-Source: dfspb - FSPIOP-Destination: dfspa - { - "errorInformation": { - "errorCode": "XXXX", - "errorDescription": "XXXX", - "extensionList": [] - } - } - - - PUT /quotes/22222222-0000-0000-0000-000000000000/error - - - 200 OK - - - PUT /quotes/22222222-0000-0000-0000-000000000000/error - - - 200 OK - - - Quote failed, DFSP needs to inform PISP - - PUT /thirdpartyRequests/transactions - /00000000-0000-0000-0000-000000000000/error - FSPIOP-Source: dfspa - FSPIOP-Destination: pispa - { - "errorInformation": { - "errorCode": "6003", - "errorDescription": "Downstream Failure", - "extensionList": [] - } - } - - - PUT /thirdpartyRequests/transactions - /00000000-0000-0000-0000-000000000000/error - - - 200 OK - - - PUT /thirdpartyRequests/transactions - /00000000-0000-0000-0000-000000000000/error - - - 200 OK + Transfer: 3.3.1 Bad Quote Request + + PISP + + Mojaloop + + DFSP A + + DFSP B + + + + + + + + + + + + + + PISP Server + + Switch + + DFSP A + (Payer) + + DFSP B + (Payee) + PISP has initiated Thirdparty Transaction Request with + POST /thirdpartyRequests/transactions + + + + + Generate a unique transactionId for this transaction request: + 11111111-0000-0000-0000-000000000000 + + PUT /thirdpartyRequests/transactions + /00000000-0000-0000-0000-000000000000 + FSPIOP-Source: dfspa + FSPIOP-Destination: pispa + { + "transactionId": "11111111-0000-0000-0000-000000000000", + "transactionRequestState": "RECEIVED" + } + + + PUT /thirdpartyRequests/transactions + /00000000-0000-0000-0000-000000000000 + + + 200 OK + + + PUT /thirdpartyRequests/transactions + /00000000-0000-0000-0000-000000000000 + + + 200 OK + + POST /quotes + FSPIOP-Source: dfspa + FSPIOP-Destination: dfspb + { + "quoteId": "22222222-0000-0000-0000-000000000000", + "transactionId": "11111111-0000-0000-0000-000000000000", + "transactionRequestId": "00000000-0000-0000-0000-000000000000", + "payee": { + "partyIdInfo": { + "partyIdType": "MSISDN", + "partyIdentifier": "+4412345678", + "fspId": "dfspb" + } + }, + "payer": { + "personalInfo": { + "complexName": { + "firstName": "Ayesha", + "lastName": "Takia" + } + }, + "partyIdInfo": { + "partyIdType": "THIRD_PARTY_LINK", + "partyIdentifier": "qwerty-56789", + "fspId": "dfspa" + }, + }, + "amountType": "SEND", + "amount": { + "amount": "100", + "currency": "USD" + }, + "transactionType": { + "scenario": "TRANSFER", + "initiator": "PAYER", + "initiatorType": "CONSUMER" + }, + "note": "quote note" + } + + + POST /quotes + + + 202 Accepted + + + POST /quotes + + + 202 Accepted + + + + + Quote fails for some reason. + + PUT /quotes/22222222-0000-0000-0000-000000000000/error + FSPIOP-Source: dfspb + FSPIOP-Destination: dfspa + { + "errorInformation": { + "errorCode": "XXXX", + "errorDescription": "XXXX", + "extensionList": [] + } + } + + + PUT /quotes/22222222-0000-0000-0000-000000000000/error + + + 200 OK + + + PUT /quotes/22222222-0000-0000-0000-000000000000/error + + + 200 OK + + + Quote failed, DFSP needs to inform PISP + + PUT /thirdpartyRequests/transactions + /00000000-0000-0000-0000-000000000000/error + FSPIOP-Source: dfspa + FSPIOP-Destination: pispa + { + "errorInformation": { + "errorCode": "6003", + "errorDescription": "Downstream Failure", + "extensionList": [] + } + } + + + PUT /thirdpartyRequests/transactions + /00000000-0000-0000-0000-000000000000/error + + + 200 OK + + + PUT /thirdpartyRequests/transactions + /00000000-0000-0000-0000-000000000000/error + + + 200 OK diff --git a/docs/technical/api/thirdparty/assets/diagrams/transfer/3-3-2-bad-transfer-request.svg b/docs/technical/api/thirdparty/assets/diagrams/transfer/3-3-2-bad-transfer-request.svg index 1b215954..3aa23dd2 100644 --- a/docs/technical/api/thirdparty/assets/diagrams/transfer/3-3-2-bad-transfer-request.svg +++ b/docs/technical/api/thirdparty/assets/diagrams/transfer/3-3-2-bad-transfer-request.svg @@ -1,172 +1,172 @@ - - + + Transfer: 3.3.2 Bad Transfer Request - Transfer: 3.3.2 Bad Transfer Request - - PISP - - Mojaloop - - DFSP A - - DFSP B - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - PISP Server - - Switch - - DFSP A - (Payer) - - DFSP B - (Payee) - PISP has initiated Thirdparty Transaction Request with - POST /thirdpartyRequests/transactions - DFSP A has received quote, and asked PISP to verify - DFSP A has received - PUT /thirdpartyRequests/verifications from Auth-Service - DFSP A initiates a normal Mojaloop P2P Transfer - - - - - Generate a new - transferId - , and associate - it with the - transactionRequestId - - POST /transfers - FSPIOP-Source: dfspa - FSPIOP-Destination: dfspb - { - "transferId": "55555555-0000-0000-0000-000000000000", - "payerFsp": "dfspa", - "payeeFsp": "dfspb", - "amount": { - "amount": "100", - "currency": "USD" - }, - "expiration": "2020-06-15T13:00:00.000", - "ilpPacket": "...", - "condition": "...", - } - - - POST /transfers - - - 202 Accepted - - POST /transfers - FSPIOP-Source: dfspa - FSPIOP-Destination: dfspb - { - "transferId": "55555555-0000-0000-0000-000000000000", - "payerFsp": "dfspa", - "payeeFsp": "dfspb", - "amount": { - "amount": "100", - "currency": "USD" - }, - "expiration": "2020-06-15T13:00:00.000", - "ilpPacket": "...", - "condition": "...", - } - - - POST /transfers - - - 202 Accepted - - PUT /transfers/55555555-0000-0000-0000-000000000000/error - FSPIOP-Source: dfspb - FSPIOP-Destination: dfspa - { - "errorInformation": { - "errorCode": "XXXX", - "errorDescription": "XXXX", - "extensionList": [] - } - } - - - PUT /transfers/55555555-0000-0000-0000-000000000000/error - - - 200 OK - - - PUT /transfers/55555555-0000-0000-0000-000000000000/error - - - 200 OK - - - Transfer failed, DFSP needs to inform PISP - - PUT /thirdpartyRequests/transactions - /00000000-0000-0000-0000-000000000000/error - FSPIOP-Source: dfspa - FSPIOP-Destination: pispa - { - "errorInformation": { - "errorCode": "6003", - "errorDescription": "Downstream failure", - "extensionList": [] - } - } - - - PUT /thirdpartyRequests/transactions - /00000000-0000-0000-0000-000000000000/error - - - 200 OK - - - PUT /thirdpartyRequests/transactions - /00000000-0000-0000-0000-000000000000/error - - - 200 OK + Transfer: 3.3.2 Bad Transfer Request + + PISP + + Mojaloop + + DFSP A + + DFSP B + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + PISP Server + + Switch + + DFSP A + (Payer) + + DFSP B + (Payee) + PISP has initiated Thirdparty Transaction Request with + POST /thirdpartyRequests/transactions + DFSP A has received quote, and asked PISP to verify + DFSP A has received + PUT /thirdpartyRequests/verifications from Auth-Service + DFSP A initiates a normal Mojaloop P2P Transfer + + + + + Generate a new + transferId + , and associate + it with the + transactionRequestId + + POST /transfers + FSPIOP-Source: dfspa + FSPIOP-Destination: dfspb + { + "transferId": "55555555-0000-0000-0000-000000000000", + "payerFsp": "dfspa", + "payeeFsp": "dfspb", + "amount": { + "amount": "100", + "currency": "USD" + }, + "expiration": "2020-06-15T13:00:00.000", + "ilpPacket": "...", + "condition": "...", + } + + + POST /transfers + + + 202 Accepted + + POST /transfers + FSPIOP-Source: dfspa + FSPIOP-Destination: dfspb + { + "transferId": "55555555-0000-0000-0000-000000000000", + "payerFsp": "dfspa", + "payeeFsp": "dfspb", + "amount": { + "amount": "100", + "currency": "USD" + }, + "expiration": "2020-06-15T13:00:00.000", + "ilpPacket": "...", + "condition": "...", + } + + + POST /transfers + + + 202 Accepted + + PUT /transfers/55555555-0000-0000-0000-000000000000/error + FSPIOP-Source: dfspb + FSPIOP-Destination: dfspa + { + "errorInformation": { + "errorCode": "XXXX", + "errorDescription": "XXXX", + "extensionList": [] + } + } + + + PUT /transfers/55555555-0000-0000-0000-000000000000/error + + + 200 OK + + + PUT /transfers/55555555-0000-0000-0000-000000000000/error + + + 200 OK + + + Transfer failed, DFSP needs to inform PISP + + PUT /thirdpartyRequests/transactions + /00000000-0000-0000-0000-000000000000/error + FSPIOP-Source: dfspa + FSPIOP-Destination: pispa + { + "errorInformation": { + "errorCode": "6003", + "errorDescription": "Downstream failure", + "extensionList": [] + } + } + + + PUT /thirdpartyRequests/transactions + /00000000-0000-0000-0000-000000000000/error + + + 200 OK + + + PUT /thirdpartyRequests/transactions + /00000000-0000-0000-0000-000000000000/error + + + 200 OK diff --git a/docs/technical/api/thirdparty/assets/diagrams/transfer/3-4-1-bad-signed-challenge-self-hosted.svg b/docs/technical/api/thirdparty/assets/diagrams/transfer/3-4-1-bad-signed-challenge-self-hosted.svg index 0fefd31c..fd5f91fa 100644 --- a/docs/technical/api/thirdparty/assets/diagrams/transfer/3-4-1-bad-signed-challenge-self-hosted.svg +++ b/docs/technical/api/thirdparty/assets/diagrams/transfer/3-4-1-bad-signed-challenge-self-hosted.svg @@ -1,134 +1,134 @@ - - + + Transfer: 3.4.1 Bad Signed Challenge - Self Hosted Auth-Service - Transfer: 3.4.1 Bad Signed Challenge - Self Hosted Auth-Service - - PISP - - Mojaloop - - DFSP A - - - - - - - - - - - - - - - - - PISP Server - - Switch - - DFSP A - (Payer) - PISP has initiated Thirdparty Transaction Request with - POST /thirdpartyRequests/transactions - DFSP A has received quote, and asked PISP to verify - - - PISP looks up the - transactionRequestId - and - checks the quote with the user, - and uses the FIDO API to sign the - the - challenge - string - - PUT /thirdpartyRequests/authorizations/33333333-0000-0000-0000-000000000000 - FSPIOP-Source: pispa - FSPIOP-Destination: dfspa - { - "responseType": "ACCEPTED" - "signedPayload": { - "signedPayloadType": "FIDO", - "fidoSignedPayload": { - "id": "string", - "rawId": "string - base64 encoded utf-8", - "response": { - "authenticatorData": "string - base64 encoded utf-8", - "clientDataJSON": "string - base64 encoded utf-8", - "signature": "string - base64 encoded utf-8", - "userHandle": "string - base64 encoded utf-8", - }, - "type": "public-key" - } - } - } - - - PUT /thirdpartyRequests/authorizations/33333333-0000-0000-0000-000000000000 - - - 200 OK - - - PUT /thirdpartyRequests/authorizations - /33333333-0000-0000-0000-000000000000 - - - 200 OK - - - - - Look up the - transactionRequestId - for this - authorizationId - - - - - Look up the - consentId - for this - transactionRequestId - - - - - Look up the - publicKey - for this ConsentId. Check the signing of the signed challenge - - - Signed challenge is invalid. Transaction Request failed. - - PUT /thirdpartyRequests/transactions - /00000000-0000-0000-0000-000000000000/error - FSPIOP-Source: dfspa - FSPIOP-Destination: pispa - { - "errorInformation": { - "errorCode": "6201", - "errorDescription": "Invalid transaction signature", - "extensionList": [] - } - } - - - PUT /thirdpartyRequests/transactions - /00000000-0000-0000-0000-000000000000/error - - - 200 OK - - - PUT /thirdpartyRequests/transactions - /00000000-0000-0000-0000-000000000000/error - - - 200 OK + Transfer: 3.4.1 Bad Signed Challenge - Self Hosted Auth-Service + + PISP + + Mojaloop + + DFSP A + + + + + + + + + + + + + + + + + PISP Server + + Switch + + DFSP A + (Payer) + PISP has initiated Thirdparty Transaction Request with + POST /thirdpartyRequests/transactions + DFSP A has received quote, and asked PISP to verify + + + PISP looks up the + transactionRequestId + and + checks the quote with the user, + and uses the FIDO API to sign the + the + challenge + string + + PUT /thirdpartyRequests/authorizations/33333333-0000-0000-0000-000000000000 + FSPIOP-Source: pispa + FSPIOP-Destination: dfspa + { + "responseType": "ACCEPTED" + "signedPayload": { + "signedPayloadType": "FIDO", + "fidoSignedPayload": { + "id": "string", + "rawId": "string - base64 encoded utf-8", + "response": { + "authenticatorData": "string - base64 encoded utf-8", + "clientDataJSON": "string - base64 encoded utf-8", + "signature": "string - base64 encoded utf-8", + "userHandle": "string - base64 encoded utf-8", + }, + "type": "public-key" + } + } + } + + + PUT /thirdpartyRequests/authorizations/33333333-0000-0000-0000-000000000000 + + + 200 OK + + + PUT /thirdpartyRequests/authorizations + /33333333-0000-0000-0000-000000000000 + + + 200 OK + + + + + Look up the + transactionRequestId + for this + authorizationId + + + + + Look up the + consentId + for this + transactionRequestId + + + + + Look up the + publicKey + for this ConsentId. Check the signing of the signed challenge + + + Signed challenge is invalid. Transaction Request failed. + + PUT /thirdpartyRequests/transactions + /00000000-0000-0000-0000-000000000000/error + FSPIOP-Source: dfspa + FSPIOP-Destination: pispa + { + "errorInformation": { + "errorCode": "6201", + "errorDescription": "Invalid transaction signature", + "extensionList": [] + } + } + + + PUT /thirdpartyRequests/transactions + /00000000-0000-0000-0000-000000000000/error + + + 200 OK + + + PUT /thirdpartyRequests/transactions + /00000000-0000-0000-0000-000000000000/error + + + 200 OK diff --git a/docs/technical/api/thirdparty/assets/diagrams/transfer/3-4-2-bad-signed-challenge-auth-service.svg b/docs/technical/api/thirdparty/assets/diagrams/transfer/3-4-2-bad-signed-challenge-auth-service.svg index f212cbef..9789b477 100644 --- a/docs/technical/api/thirdparty/assets/diagrams/transfer/3-4-2-bad-signed-challenge-auth-service.svg +++ b/docs/technical/api/thirdparty/assets/diagrams/transfer/3-4-2-bad-signed-challenge-auth-service.svg @@ -1,222 +1,222 @@ - - + + Transfer: 3.4.2 Bad Signed Challenge - Hub Hosted Auth-Service - Transfer: 3.4.2 Bad Signed Challenge - Hub Hosted Auth-Service - - PISP - - Mojaloop - - DFSP A - - - - - - - - - - - - - - - - - - - - - - PISP Server - - Switch - - Auth-Service - - DFSP A - (Payer) - PISP has initiated Thirdparty Transaction Request with - POST /thirdpartyRequests/transactions - DFSP A has received quote, and asked PISP to verify - - - PISP looks up the - transactionRequestId - and - checks the quote with the user, - and uses the FIDO API to sign the - the - challenge - string - - PUT /thirdpartyRequests/authorizations - /33333333-0000-0000-0000-000000000000 - FSPIOP-Source: pispa - FSPIOP-Destination: dfspa - { - "responseType": "ACCEPTED" - "signedPayload": { - "signedPayloadType": "FIDO", - "fidoSignedPayload": { - "id": "string", - "rawId": "string - base64 encoded utf-8", - "response": { - "authenticatorData": "string - base64 encoded utf-8", - "clientDataJSON": "string - base64 encoded utf-8", - "signature": "string - base64 encoded utf-8", - "userHandle": "string - base64 encoded utf-8", - }, - "type": "public-key" - } - } - } - - - PUT /thirdpartyRequests/authorizations - /33333333-0000-0000-0000-000000000000 - - - 200 OK - - - PUT /thirdpartyRequests/authorizations - /33333333-0000-0000-0000-000000000000 - - - 200 OK - - - - - Lookup - transactionRequestId - for this - authorizationId - - - - - Lookup - consentId - for this - transactionRequestId - - - - - Generate a new - verificationRequestId - , and associate - it with the - thirdpartyTransactionRequestId - - POST /thirdpartyRequests/verifications - FSPIOP-Source: dfspa - FSPIOP-Destination: central-auth - { - "verificationRequestId": "44444444-0000-0000-0000-000000000000", - "challenge": - <base64 encoded binary - the encoded challenge> - , - "consentId": "123", - "signedPayloadType": "FIDO", - "fidoValue": { - "id": "string", - "rawId": "string - base64 encoded utf-8", - "response": { - "authenticatorData": "string - base64 encoded utf-8", - "clientDataJSON": "string - base64 encoded utf-8", - "signature": "string - base64 encoded utf-8", - "userHandle": "string - base64 encoded utf-8", - }, - "type": "public-key" - } - } - - - POST /thirdpartyRequests/verifications - - - 202 Accepted - - - POST /thirdpartyRequests/verifications - - - 202 Accepted - - - - - Lookup this consent based on consentId - - - - - Ensure the accountAddress matches what is in Consent - - - - - Check that the signed bytes match the - publickey we have stored for the consent - - PUT /thirdpartyRequests/verifications - /44444444-0000-0000-0000-000000000000/error - FSPIOP-Source: central-auth - FSPIOP-Destination: dfspa - { - "errorInformation": { - "errorCode": "6201", - "errorDescription": "Invalid transaction signature", - "extensionList": [] - } - } - - - PUT /thirdpartyRequests/verifications - /44444444-0000-0000-0000-000000000000/error - - - 200 OK - - - PUT /thirdpartyRequests/verifications - /44444444-0000-0000-0000-000000000000/error - - - 200 OK - - - Signed challenge is invalid. Transaction Request failed. - - PUT /thirdpartyRequests/transactions - /00000000-0000-0000-0000-000000000000/error - FSPIOP-Source: dfspa - FSPIOP-Destination: pispa - { - "errorInformation": { - "errorCode": "6201", - "errorDescription": "Invalid transaction signature", - "extensionList": [] - } - } - - - PUT /thirdpartyRequests/transactions - /00000000-0000-0000-0000-000000000000/error - - - 200 OK - - - PUT /thirdpartyRequests/transactions - /00000000-0000-0000-0000-000000000000/error - - - 200 OK + Transfer: 3.4.2 Bad Signed Challenge - Hub Hosted Auth-Service + + PISP + + Mojaloop + + DFSP A + + + + + + + + + + + + + + + + + + + + + + PISP Server + + Switch + + Auth-Service + + DFSP A + (Payer) + PISP has initiated Thirdparty Transaction Request with + POST /thirdpartyRequests/transactions + DFSP A has received quote, and asked PISP to verify + + + PISP looks up the + transactionRequestId + and + checks the quote with the user, + and uses the FIDO API to sign the + the + challenge + string + + PUT /thirdpartyRequests/authorizations + /33333333-0000-0000-0000-000000000000 + FSPIOP-Source: pispa + FSPIOP-Destination: dfspa + { + "responseType": "ACCEPTED" + "signedPayload": { + "signedPayloadType": "FIDO", + "fidoSignedPayload": { + "id": "string", + "rawId": "string - base64 encoded utf-8", + "response": { + "authenticatorData": "string - base64 encoded utf-8", + "clientDataJSON": "string - base64 encoded utf-8", + "signature": "string - base64 encoded utf-8", + "userHandle": "string - base64 encoded utf-8", + }, + "type": "public-key" + } + } + } + + + PUT /thirdpartyRequests/authorizations + /33333333-0000-0000-0000-000000000000 + + + 200 OK + + + PUT /thirdpartyRequests/authorizations + /33333333-0000-0000-0000-000000000000 + + + 200 OK + + + + + Lookup + transactionRequestId + for this + authorizationId + + + + + Lookup + consentId + for this + transactionRequestId + + + + + Generate a new + verificationRequestId + , and associate + it with the + thirdpartyTransactionRequestId + + POST /thirdpartyRequests/verifications + FSPIOP-Source: dfspa + FSPIOP-Destination: central-auth + { + "verificationRequestId": "44444444-0000-0000-0000-000000000000", + "challenge": + <base64 encoded binary - the encoded challenge> + , + "consentId": "123", + "signedPayloadType": "FIDO", + "fidoValue": { + "id": "string", + "rawId": "string - base64 encoded utf-8", + "response": { + "authenticatorData": "string - base64 encoded utf-8", + "clientDataJSON": "string - base64 encoded utf-8", + "signature": "string - base64 encoded utf-8", + "userHandle": "string - base64 encoded utf-8", + }, + "type": "public-key" + } + } + + + POST /thirdpartyRequests/verifications + + + 202 Accepted + + + POST /thirdpartyRequests/verifications + + + 202 Accepted + + + + + Lookup this consent based on consentId + + + + + Ensure the accountAddress matches what is in Consent + + + + + Check that the signed bytes match the + publickey we have stored for the consent + + PUT /thirdpartyRequests/verifications + /44444444-0000-0000-0000-000000000000/error + FSPIOP-Source: central-auth + FSPIOP-Destination: dfspa + { + "errorInformation": { + "errorCode": "6201", + "errorDescription": "Invalid transaction signature", + "extensionList": [] + } + } + + + PUT /thirdpartyRequests/verifications + /44444444-0000-0000-0000-000000000000/error + + + 200 OK + + + PUT /thirdpartyRequests/verifications + /44444444-0000-0000-0000-000000000000/error + + + 200 OK + + + Signed challenge is invalid. Transaction Request failed. + + PUT /thirdpartyRequests/transactions + /00000000-0000-0000-0000-000000000000/error + FSPIOP-Source: dfspa + FSPIOP-Destination: pispa + { + "errorInformation": { + "errorCode": "6201", + "errorDescription": "Invalid transaction signature", + "extensionList": [] + } + } + + + PUT /thirdpartyRequests/transactions + /00000000-0000-0000-0000-000000000000/error + + + 200 OK + + + PUT /thirdpartyRequests/transactions + /00000000-0000-0000-0000-000000000000/error + + + 200 OK diff --git a/docs/technical/api/thirdparty/assets/diagrams/transfer/3-6-tpr-timeout.svg b/docs/technical/api/thirdparty/assets/diagrams/transfer/3-6-tpr-timeout.svg index e744f5b9..3767c779 100644 --- a/docs/technical/api/thirdparty/assets/diagrams/transfer/3-6-tpr-timeout.svg +++ b/docs/technical/api/thirdparty/assets/diagrams/transfer/3-6-tpr-timeout.svg @@ -1,81 +1,81 @@ - - + + Transfer: 3.Thirdparty Transaction Request Times Out - Transfer: 3.Thirdparty Transaction Request Times Out - - PISP - - Mojaloop - - DFSP A - - - - - - - - - - - PISP Server - - Switch - - DFSP A - (Payer) - - POST /thirdpartyRequests/transactions - FSPIOP-Source: pispa - FSPIOP-Destination: dfspa - { - "transactionRequestId": "00000000-0000-0000-0000-000000000000", - "payee": { - "partyIdInfo": { - "partyIdType": "MSISDN", - "partyIdentifier": "+4412345678", - "fspId": "dfspb" - } - }, - "payer": { - "partyIdType": "THIRD_PARTY_LINK", - "partyIdentifier": "qwerty-56789", - "fspId": "dfspa" - }, - "amountType": "SEND", - "amount": { - "amount": "100", - "currency": "USD" - }, - "transactionType": { - "scenario": "TRANSFER", - "initiator": "PAYER", - "initiatorType": "CONSUMER" - }, - "expiration": "2020-06-15T22:17:28.985-01:00" - } - - - POST /thirdpartyRequests/transactions - - - 202 Accepted - - - POST /thirdpartyRequests/transactions - - - 202 Accepted - DFSP doesn't respond for some reason - - - - - Thirdparty Transaction Request expiration reached - - - PISP informs their user that the transaction failed. - + Transfer: 3.Thirdparty Transaction Request Times Out + + PISP + + Mojaloop + + DFSP A + + + + + + + + + + + PISP Server + + Switch + + DFSP A + (Payer) + + POST /thirdpartyRequests/transactions + FSPIOP-Source: pispa + FSPIOP-Destination: dfspa + { + "transactionRequestId": "00000000-0000-0000-0000-000000000000", + "payee": { + "partyIdInfo": { + "partyIdType": "MSISDN", + "partyIdentifier": "+4412345678", + "fspId": "dfspb" + } + }, + "payer": { + "partyIdType": "THIRD_PARTY_LINK", + "partyIdentifier": "qwerty-56789", + "fspId": "dfspa" + }, + "amountType": "SEND", + "amount": { + "amount": "100", + "currency": "USD" + }, + "transactionType": { + "scenario": "TRANSFER", + "initiator": "PAYER", + "initiatorType": "CONSUMER" + }, + "expiration": "2020-06-15T22:17:28.985-01:00" + } + + + POST /thirdpartyRequests/transactions + + + 202 Accepted + + + POST /thirdpartyRequests/transactions + + + 202 Accepted + DFSP doesn't respond for some reason + + + + + Thirdparty Transaction Request expiration reached + + + PISP informs their user that the transaction failed. +   diff --git a/docs/technical/api/thirdparty/assets/diagrams/transfer/get_transaction_request.svg b/docs/technical/api/thirdparty/assets/diagrams/transfer/get_transaction_request.svg index 280ba075..3ba41a63 100644 --- a/docs/technical/api/thirdparty/assets/diagrams/transfer/get_transaction_request.svg +++ b/docs/technical/api/thirdparty/assets/diagrams/transfer/get_transaction_request.svg @@ -1,86 +1,86 @@ - - + + PISPGetTransactionRequest - PISPGetTransactionRequest - - PISP - - Mojaloop - - DFSP A - - - - - PISP Server - - Switch - - DFSP A - (Payer) - - - Assuming a previously created thirdparty transaction request with id: - 00000000-0000-0000-0000-000000000000 - - - GET /thirdpartyRequests/transactions/00000000-0000-0000-0000-000000000000 - FSPIOP-Source: pispa - FSPIOP-Destination: dfspa - - - GTR-1 - GET /thirdpartyRequests/transactions/00000000-0000-0000-0000-000000000000 - - - GTR-2 - 202 Accepted - - - GTR-3 - GET /thirdpartyRequests/transactions/00000000-0000-0000-0000-000000000000 - - - GTR-4 - 202 Accepted - - - - - GTR-5 - DFSP looks up already created - thirdparty transaction request - - - - - GTR-6 - DFSP ensures that the FSPIOP-Source (pisp) - is the same as the original sender of - POST /thirdpartyRequests/transactions/00000000-0000-0000-0000-000000000000 - - PUT /thirdpartyRequests/transactions/00000000-0000-0000-0000-000000000000 - FSPIOP-Source: dfspa - FSPIOP-Destination: pispa - { - "transactionRequestState": "ACCEPTED", - } - - - GTR-7 - PUT /thirdpartyRequests/transactions/00000000-0000-0000-0000-000000000000 - - - GTR-8 - 200 OK - - - GTR-9 - PUT /thirdpartyRequests/transactions/00000000-0000-0000-0000-000000000000 - - - GTR-10 - 200 OK + PISPGetTransactionRequest + + PISP + + Mojaloop + + DFSP A + + + + + PISP Server + + Switch + + DFSP A + (Payer) + + + Assuming a previously created thirdparty transaction request with id: + 00000000-0000-0000-0000-000000000000 +   + + GET /thirdpartyRequests/transactions/00000000-0000-0000-0000-000000000000 + FSPIOP-Source: pispa + FSPIOP-Destination: dfspa + + + GTR-1 + GET /thirdpartyRequests/transactions/00000000-0000-0000-0000-000000000000 + + + GTR-2 + 202 Accepted + + + GTR-3 + GET /thirdpartyRequests/transactions/00000000-0000-0000-0000-000000000000 + + + GTR-4 + 202 Accepted + + + + + GTR-5 + DFSP looks up already created + thirdparty transaction request + + + + + GTR-6 + DFSP ensures that the FSPIOP-Source (pisp) + is the same as the original sender of + POST /thirdpartyRequests/transactions/00000000-0000-0000-0000-000000000000 + + PUT /thirdpartyRequests/transactions/00000000-0000-0000-0000-000000000000 + FSPIOP-Source: dfspa + FSPIOP-Destination: pispa + { + "transactionRequestState": "ACCEPTED", + } + + + GTR-7 + PUT /thirdpartyRequests/transactions/00000000-0000-0000-0000-000000000000 + + + GTR-8 + 200 OK + + + GTR-9 + PUT /thirdpartyRequests/transactions/00000000-0000-0000-0000-000000000000 + + + GTR-10 + 200 OK diff --git a/docs/technical/central-fx-transfers/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 new file mode 100644 index 00000000..1939a92d --- /dev/null +++ b/docs/technical/central-fx-transfers/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 +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 +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-fx-transfers/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 new file mode 100644 index 00000000..c338b9c1 --- /dev/null +++ b/docs/technical/central-fx-transfers/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-fx-transfers/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 new file mode 100644 index 00000000..0f0fb701 --- /dev/null +++ b/docs/technical/central-fx-transfers/assets/diagrams/sequence/seq-fx-prepare-1.1.0.plantuml @@ -0,0 +1,186 @@ +/'***** + 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 PayerFSP-fx-conversion-prepare-request + +!$payerCurrency = "" +!$payeeCurrency = "" +!$dfsp1Id = "" +!$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. DFSP1 sends an FX Conversion prepare request to FXP1 + +autonumber + +' declare actors +actor "DFSP1\nPayer" as DFSP1 +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 +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 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_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 DFSP1 sends an FX Conversion request to FXP1 + note right of DFSP1 #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": "$dfsp1Id", + "counterPartyFsp": "$fxpID", + "amountType": "SEND", + "sourceAmount": { + "currency": "$payerCurrency", + "amount": "$fxpSourceAmount" + }, + "targetAmount": { + "currency": "$payeeCurrency", + "amount": "$fxpTargetAmount" + }, + "condition": "$fxCondition" + } + end note + DFSP1 ->> MLAPI: POST - /fxTransfers + activate MLAPI + MLAPI -->> DFSP1: Respond HTTP - 202 (Accepted) + alt Schema validation error + MLAPI-->>DFSP1: 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-->>DFSP1: 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 FXP1, TOPIC_NOTIFICATIONS : Send notification to Participant (FXP)\n + NOTIFY_HANDLER -> FXP1: Send callback notification + ||| +end +deactivate POS_HANDLER +deactivate PREP_HANDLER +deactivate NOTIFY_HANDLER +@enduml diff --git a/docs/technical/central-fx-transfers/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 new file mode 100644 index 00000000..d5d22010 --- /dev/null +++ b/docs/technical/central-fx-transfers/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-fx-transfers/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 new file mode 100644 index 00000000..9ce0b942 --- /dev/null +++ b/docs/technical/central-fx-transfers/assets/diagrams/sequence/seq-fx-prepare-1.1.1.a.plantuml @@ -0,0 +1,273 @@ +/'***** + 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 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 "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_NOTIFICATIONS + participant POS_DAO + participant PARTICIPANT_DAO + participant DB +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 + + break + group Filter Event + PREP_HANDLER <-> PREP_HANDLER: Filter event - Rules: type == 'prepare' && action == 'fx_prepare'\nError codes: 2001 + end + 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 -> 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) + ||| + + 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 -> DB: Request to persist transfer\nError codes: 2003 + activate DB + hnote over DB #lightyellow + fxTransfer + fxTransferParticipant + fxTransferStateChange + fxTransferExtension + end note + DB --> PREP_HANDLER: Return success + deactivate DB + end + else Validate Prepare Transfer (failure) + group Persist Transfer State (with transferState='INVALID') (Introducing a new status INVALID to mark these entries) + 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 + fxTransferStateChange + fxTransferExtension + fxTransferError + end note + DB --> PREP_HANDLER: Return success + deactivate DB + 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-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-fx-transfers/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 new file mode 100644 index 00000000..cd55802c --- /dev/null +++ b/docs/technical/central-fx-transfers/assets/diagrams/sequence/seq-fx-prepare-1.1.2.a.plantuml @@ -0,0 +1,312 @@ +/'***** + 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 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 "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_NOTIFICATIONS + participant POS_DAO + participant PARTICIPANT_DAO + participant SETTLEMENT_DAO + participant DB +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 + + 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 + + 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 -> DB: Retrieve transfer state from DB by 'commitRequestId' + activate DB + hnote over DB #lightyellow + fxTransferStateChange + end note + DB --> POS_HANDLER: Retrieve transfer state from DB + deactivate DB + 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 + 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 + + POS_HANDLER <-> POS_HANDLER: Update participant position (increase reserved position by transfer amount) + 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 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-fx-transfers/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 new file mode 100644 index 00000000..ae16da1c --- /dev/null +++ b/docs/technical/central-fx-transfers/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 +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 +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 diff --git a/docs/technical/central-fx-transfers/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 new file mode 100644 index 00000000..208a3245 --- /dev/null +++ b/docs/technical/central-fx-transfers/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 + + 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-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/2.2.0-fx-fulfil-reject-transfer.md b/docs/technical/central-fx-transfers/transfers/2.2.0-fx-fulfil-reject-transfer.md new file mode 100644 index 00000000..bbbbafd5 --- /dev/null +++ b/docs/technical/central-fx-transfers/transfers/2.2.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/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/technical/account-lookup-service/assets/diagrams/sequence/seq-acct-lookup-admin-delete-oracle-7.3.4.svg b/docs/technical/technical/account-lookup-service/assets/diagrams/sequence/seq-acct-lookup-admin-delete-oracle-7.3.4.svg index 5adb5ff5..c15d79f0 100644 --- a/docs/technical/technical/account-lookup-service/assets/diagrams/sequence/seq-acct-lookup-admin-delete-oracle-7.3.4.svg +++ b/docs/technical/technical/account-lookup-service/assets/diagrams/sequence/seq-acct-lookup-admin-delete-oracle-7.3.4.svg @@ -1,118 +1,111 @@ - - - - - - - - - - + + 7.3.4 Delete Oracle Endpoint + - 7.3.4 Delete Oracle Endpoint - - Account Lookup Service - - - - - - - - - - - - HUB OPERATOR - - - HUB OPERATOR - - - Account Lookup Service Admin API - - - Account Lookup Service Admin API - - - DELETE Oracle Handler - - - DELETE Oracle Handler - - - ALS Store - - - ALS Store - - - - - - - - - Get Oracle Endpoint - - - 1 - Request to Delete Oracle Endpoint - - DELETE /oracles/{ID} - - - 2 - Delete Oracle Endpoint - - - 3 - Update existing Oracle Endpoint By ID - - Update isActive = false - - - alt - [Delete existing Oracle Endpoint (success)] - - - 4 - Return Success - - - 5 - Return success response - - - 6 - Return - HTTP Status: - 204 - - - alt - [Delete existing Oracle Endpoint (failure)] - - - 7 - Throws Error (Not Found) - - - 8 - Throw Error - - - Message: - { - "errorInformation": { - "errorCode": <Error Code>, - "errorDescription": <Msg>, - } - } - - - 9 - Return - HTTP Status: - 502 + 7.3.4 Delete Oracle Endpoint + + Account Lookup Service + + + + + + + + + + + + HUB OPERATOR + + + HUB OPERATOR + + + Account Lookup Service Admin API + + + Account Lookup Service Admin API + + + DELETE Oracle Handler + + + DELETE Oracle Handler + + + ALS Store + + + ALS Store + + + + + + + + + Get Oracle Endpoint + + + 1 + Request to Delete Oracle Endpoint - + DELETE /oracles/{ID} + + + 2 + Delete Oracle Endpoint + + + 3 + Update existing Oracle Endpoint By ID + + Update isActive = false + + + alt + [Delete existing Oracle Endpoint (success)] + + + 4 + Return Success + + + 5 + Return success response + + + 6 + Return + HTTP Status: + 204 + + + alt + [Delete existing Oracle Endpoint (failure)] + + + 7 + Throws Error (Not Found) + + + 8 + Throw Error + + + Message: + { + "errorInformation": { + "errorCode": <Error Code>, + "errorDescription": <Msg>, + } + } + + + 9 + Return + HTTP Status: + 502 diff --git a/docs/technical/technical/account-lookup-service/assets/diagrams/sequence/seq-acct-lookup-admin-get-oracle-7.3.1.svg b/docs/technical/technical/account-lookup-service/assets/diagrams/sequence/seq-acct-lookup-admin-get-oracle-7.3.1.svg index 37ed269f..9a1ab464 100644 --- a/docs/technical/technical/account-lookup-service/assets/diagrams/sequence/seq-acct-lookup-admin-get-oracle-7.3.1.svg +++ b/docs/technical/technical/account-lookup-service/assets/diagrams/sequence/seq-acct-lookup-admin-get-oracle-7.3.1.svg @@ -1,133 +1,126 @@ - - - - - - - - - - + + 7.3.1 Get All Oracle Endpoints + - 7.3.1 Get All Oracle Endpoints - - Account Lookup Service - - - - - - - - - - - - HUB OPERATOR - - - HUB OPERATOR - - - Account Lookup Service Admin API - - - Account Lookup Service Admin API - - - Get Oracles Handler - - - Get Oracles Handler - - - ALS Store - - - ALS Store - - - - - - - - - Get Oracle Endpoints - - - 1 - Request to GET all Oracle Endpoints - - GET /oracles?currency=USD&type=MSISDN - - - 2 - Get Oracle Endpoints - - - 3 - Get oracle endpoints - - - alt - [Get Oracle Endpoints (success)] - - - 4 - Return Oracle Endpoints - - - 5 - Return Oracle Endpoints - - - Message: - { - [ - { - "oracleId": <string>, - "oracleIdType": <PartyIdType>, - "endpoint": { - "value": <string>, - "endpointType": <EndpointType> - }, - "currency": <Currency>, - "isDefault": <boolean> - } - ] - } - - - 6 - Return - HTTP Status: - 200 - - - alt - [Get Oracle Endpoints (failure)] - - - 7 - Throw Error - - - 8 - Throw Error - - - Message: - { - "errorInformation": { - "errorCode": <Error Code>, - "errorDescription": <Msg>, - } - } - - - 9 - Return - HTTP Status: - 502 + 7.3.1 Get All Oracle Endpoints + + Account Lookup Service + + + + + + + + + + + + HUB OPERATOR + + + HUB OPERATOR + + + Account Lookup Service Admin API + + + Account Lookup Service Admin API + + + Get Oracles Handler + + + Get Oracles Handler + + + ALS Store + + + ALS Store + + + + + + + + + Get Oracle Endpoints + + + 1 + Request to GET all Oracle Endpoints - + GET /oracles?currency=USD&type=MSISDN + + + 2 + Get Oracle Endpoints + + + 3 + Get oracle endpoints + + + alt + [Get Oracle Endpoints (success)] + + + 4 + Return Oracle Endpoints + + + 5 + Return Oracle Endpoints + + + Message: + { + [ + { + "oracleId": <string>, + "oracleIdType": <PartyIdType>, + "endpoint": { + "value": <string>, + "endpointType": <EndpointType> + }, + "currency": <Currency>, + "isDefault": <boolean> + } + ] + } + + + 6 + Return + HTTP Status: + 200 + + + alt + [Get Oracle Endpoints (failure)] + + + 7 + Throw Error + + + 8 + Throw Error + + + Message: + { + "errorInformation": { + "errorCode": <Error Code>, + "errorDescription": <Msg>, + } + } + + + 9 + Return + HTTP Status: + 502 diff --git a/docs/technical/technical/account-lookup-service/assets/diagrams/sequence/seq-acct-lookup-admin-post-oracle-7.3.2.svg b/docs/technical/technical/account-lookup-service/assets/diagrams/sequence/seq-acct-lookup-admin-post-oracle-7.3.2.svg index bd1fefe0..07b6a444 100644 --- a/docs/technical/technical/account-lookup-service/assets/diagrams/sequence/seq-acct-lookup-admin-post-oracle-7.3.2.svg +++ b/docs/technical/technical/account-lookup-service/assets/diagrams/sequence/seq-acct-lookup-admin-post-oracle-7.3.2.svg @@ -1,134 +1,127 @@ - - - - - - - - - - + + 7.3.2 Create Oracle Endpoints + - 7.3.2 Create Oracle Endpoints - - Account Lookup Service - - - - - - - - - - - - HUB OPERATOR - - - HUB OPERATOR - - - Account Lookup Service Admin API - - - Account Lookup Service Admin API - - - POST Oracle Handler - - - POST Oracle Handler - - - ALS Store - - - ALS Store - - - - - - - - - Get Oracle Endpoint - - - 1 - Request to Create Oracle Endpoint - - POST /oracles - - - Message: - { - "oracleIdType": <PartyIdType>, - "endpoint": { - "value": <string>, - "endpointType": <EndpointType> - }, - "currency": <Currency>, - "isDefault": <boolean> - } - - - 2 - Create Oracle Endpoint - - - - - 3 - Build Oracle Endpoint Data Object - - - 4 - Insert Oracle Endpoint Data Object - - - alt - [Create Oracle Entry (success)] - - - 5 - Return success response - - - 6 - Return success response - - - 7 - Return - HTTP Status: - 201 - - - alt - [Create Oracle Entry (failure)] - - - 8 - Throw Error - - - 9 - Throw Error - - - Message: - { - "errorInformation": { - "errorCode": <Error Code>, - "errorDescription": <Msg>, - } - } - - - 10 - Return - HTTP Status: - 502 + 7.3.2 Create Oracle Endpoints + + Account Lookup Service + + + + + + + + + + + + HUB OPERATOR + + + HUB OPERATOR + + + Account Lookup Service Admin API + + + Account Lookup Service Admin API + + + POST Oracle Handler + + + POST Oracle Handler + + + ALS Store + + + ALS Store + + + + + + + + + Get Oracle Endpoint + + + 1 + Request to Create Oracle Endpoint - + POST /oracles + + + Message: + { + "oracleIdType": <PartyIdType>, + "endpoint": { + "value": <string>, + "endpointType": <EndpointType> + }, + "currency": <Currency>, + "isDefault": <boolean> + } + + + 2 + Create Oracle Endpoint + + + + + 3 + Build Oracle Endpoint Data Object + + + 4 + Insert Oracle Endpoint Data Object + + + alt + [Create Oracle Entry (success)] + + + 5 + Return success response + + + 6 + Return success response + + + 7 + Return + HTTP Status: + 201 + + + alt + [Create Oracle Entry (failure)] + + + 8 + Throw Error + + + 9 + Throw Error + + + Message: + { + "errorInformation": { + "errorCode": <Error Code>, + "errorDescription": <Msg>, + } + } + + + 10 + Return + HTTP Status: + 502 diff --git a/docs/technical/technical/account-lookup-service/assets/diagrams/sequence/seq-acct-lookup-admin-put-oracle-7.3.3.svg b/docs/technical/technical/account-lookup-service/assets/diagrams/sequence/seq-acct-lookup-admin-put-oracle-7.3.3.svg index 28e3ffb3..44954235 100644 --- a/docs/technical/technical/account-lookup-service/assets/diagrams/sequence/seq-acct-lookup-admin-put-oracle-7.3.3.svg +++ b/docs/technical/technical/account-lookup-service/assets/diagrams/sequence/seq-acct-lookup-admin-put-oracle-7.3.3.svg @@ -1,177 +1,170 @@ - - - - - - - - - - + + 7.3.3 Update Oracle Endpoint + - 7.3.3 Update Oracle Endpoint - - Account Lookup Service - - - - - - - - - - - - - - - HUB OPERATOR - - - HUB OPERATOR - - - Account Lookup Service Admin API - - - Account Lookup Service Admin API - - - PUT Oracle Handler - - - PUT Oracle Handler - - - ALS Store - - - ALS Store - - - - - - - - - - Get Oracle Endpoint - - - 1 - Request to Update Oracle Endpoint - - PUT /oracles/{ID} - - - Message: - { - "oracleIdType": <PartyIdType>, - "endpoint": { - "value": <string>, - "endpointType": <EndpointType> - }, - "currency": <Currency>, - "isDefault": <boolean> - } - - - 2 - Update Oracle Endpoint - - - 3 - Find existing Oracle Endpoint - - - alt - [Find existing Oracle Endpoint (success)] - - - 4 - Return Oracle Endpoint Result - - - - - 5 - Update Returned Oracle Data Object - - - 6 - Update Oracle Data Object - - - alt - [Update Oracle Entry (success)] - - - 7 - Return success response - - - 8 - Return success response - - - 9 - Return - HTTP Status: - 204 - - - alt - [Update Oracle Entry (failure)] - - - 10 - Throw Error - - - 11 - Throw Error - - - Message: - { - "errorInformation": { - "errorCode": <Error Code>, - "errorDescription": <Msg>, - } - } - - - 12 - Return - HTTP Status: - 502 - - - alt - [Find existing Oracle Endpoint (failure)] - - - 13 - Returns Empty Object - - - 14 - Throw Error - - - Message: - { - "errorInformation": { - "errorCode": <Error Code>, - "errorDescription": <Msg>, - } - } - - - 15 - Return - HTTP Status: - 502 + 7.3.3 Update Oracle Endpoint + + Account Lookup Service + + + + + + + + + + + + + + + HUB OPERATOR + + + HUB OPERATOR + + + Account Lookup Service Admin API + + + Account Lookup Service Admin API + + + PUT Oracle Handler + + + PUT Oracle Handler + + + ALS Store + + + ALS Store + + + + + + + + + + Get Oracle Endpoint + + + 1 + Request to Update Oracle Endpoint - + PUT /oracles/{ID} + + + Message: + { + "oracleIdType": <PartyIdType>, + "endpoint": { + "value": <string>, + "endpointType": <EndpointType> + }, + "currency": <Currency>, + "isDefault": <boolean> + } + + + 2 + Update Oracle Endpoint + + + 3 + Find existing Oracle Endpoint + + + alt + [Find existing Oracle Endpoint (success)] + + + 4 + Return Oracle Endpoint Result + + + + + 5 + Update Returned Oracle Data Object + + + 6 + Update Oracle Data Object + + + alt + [Update Oracle Entry (success)] + + + 7 + Return success response + + + 8 + Return success response + + + 9 + Return + HTTP Status: + 204 + + + alt + [Update Oracle Entry (failure)] + + + 10 + Throw Error + + + 11 + Throw Error + + + Message: + { + "errorInformation": { + "errorCode": <Error Code>, + "errorDescription": <Msg>, + } + } + + + 12 + Return + HTTP Status: + 502 + + + alt + [Find existing Oracle Endpoint (failure)] + + + 13 + Returns Empty Object + + + 14 + Throw Error + + + Message: + { + "errorInformation": { + "errorCode": <Error Code>, + "errorDescription": <Msg>, + } + } + + + 15 + Return + HTTP Status: + 502 diff --git a/docs/technical/technical/account-lookup-service/assets/diagrams/sequence/seq-acct-lookup-del-endpoint-cache-7.3.0.svg b/docs/technical/technical/account-lookup-service/assets/diagrams/sequence/seq-acct-lookup-del-endpoint-cache-7.3.0.svg index 3875ed9d..916884be 100644 --- a/docs/technical/technical/account-lookup-service/assets/diagrams/sequence/seq-acct-lookup-del-endpoint-cache-7.3.0.svg +++ b/docs/technical/technical/account-lookup-service/assets/diagrams/sequence/seq-acct-lookup-del-endpoint-cache-7.3.0.svg @@ -1,127 +1,120 @@ - - - - - - - - - - + + 7.3.0 Delete Endpoint Cache + - 7.3.0 Delete Endpoint Cache - - Account Lookup Service - - - - - - - - - - - - - - HUB OPERATOR - - - HUB OPERATOR - - - Account Lookup Service API - - - Account Lookup Service API - - - Delete Endpoint Cache Handler - - - Delete Endpoint Cache Handler - - - Cache - - - Cache - - - - - - - - - - - Delete Endpoint Cache - - - 1 - Request to DELETE Endpoint Cache - DELETE /endpointcache - - - 2 - Delete Cache - - - 3 - Stop Cache - - - alt - [Stop Cache Status (success)] - - - 4 - Return status - - - 5 - Initialize Cache - - - 6 - Return Status - - - 7 - Return Status - - - 8 - Return - HTTP Status: - 202 - - - alt - [Validate Status (service failure)] - - - 9 - Throw Error - - - 10 - Throw Error - - - Message: - { - "errorInformation": { - "errorCode": <Error Code>, - "errorDescription": <Msg>, - } - } - - - 11 - Return - HTTP Status: - 502 + 7.3.0 Delete Endpoint Cache + + Account Lookup Service + + + + + + + + + + + + + + HUB OPERATOR + + + HUB OPERATOR + + + Account Lookup Service API + + + Account Lookup Service API + + + Delete Endpoint Cache Handler + + + Delete Endpoint Cache Handler + + + Cache + + + Cache + + + + + + + + + + + Delete Endpoint Cache + + + 1 + Request to DELETE Endpoint Cache - DELETE /endpointcache + + + 2 + Delete Cache + + + 3 + Stop Cache + + + alt + [Stop Cache Status (success)] + + + 4 + Return status + + + 5 + Initialize Cache + + + 6 + Return Status + + + 7 + Return Status + + + 8 + Return + HTTP Status: + 202 + + + alt + [Validate Status (service failure)] + + + 9 + Throw Error + + + 10 + Throw Error + + + Message: + { + "errorInformation": { + "errorCode": <Error Code>, + "errorDescription": <Msg>, + } + } + + + 11 + Return + HTTP Status: + 502 diff --git a/docs/technical/technical/account-lookup-service/assets/diagrams/sequence/seq-acct-lookup-del-participants-7.1.2.svg b/docs/technical/technical/account-lookup-service/assets/diagrams/sequence/seq-acct-lookup-del-participants-7.1.2.svg index e29d0bfd..47aa3646 100644 --- a/docs/technical/technical/account-lookup-service/assets/diagrams/sequence/seq-acct-lookup-del-participants-7.1.2.svg +++ b/docs/technical/technical/account-lookup-service/assets/diagrams/sequence/seq-acct-lookup-del-participants-7.1.2.svg @@ -1,366 +1,357 @@ - - - - - - - - - - + + 7.1.2. Delete Participant Details + - 7.1.2. Delete Participant Details - - Financial Service Provider - - Account Lookup Service - - Central Services - - ALS Oracle Service/Adapter - - Financial Service Provider - - - - - - - - - - - - - - - - - - - - - - - - - - - - Payer FSP - - - Payer FSP - - - Account Lookup - Service (ALS) - - - Account Lookup - Service (ALS) - - - ALS Participant - Handler - - - ALS Participant - Handler - - - ALS Participant Endpoint - Oracle DAO - - - ALS Participant Endpoint - Oracle DAO - - - ALS Database - - - ALS Database - - - ALS CentralService - Endpoint DAO - - - ALS CentralService - Endpoint DAO - - - ALS CentralService - Participant DAO - - - ALS CentralService - Participant DAO - - - ALS Parties - FSP DAO - - - ALS Parties - FSP DAO - - - Central Service API - - - Central Service API - - - Oracle Service API - - - Oracle Service API - - - Payee FSP - - - Payee FSP - - - - - - - - - - - - - - - Get Party Details - - - - 1 - Request to delete Participant details - DEL - /participants/{TYPE}/{ID}?currency={CURRENCY} - Response code: - 202 - Error code: - 200x, 300x, 310x, 320x - - - Validate request against - Mojaloop Interface Specification. - Error code: - 300x, 310x - - - 2 - Request to delete Participant details - - - alt - [oracleEndpoint match found & parties information retrieved] - - - - 3 - Get Oracle Routing Config - Error code: - 200x, 310x, 320x - - - ref - GET Participants - + 7.1.2. Delete Participant Details + + Financial Service Provider + + Account Lookup Service + + Central Services + + ALS Oracle Service/Adapter + + Financial Service Provider + + + + + + + + + + + + + + + + + + + + + + + + + + Payer FSP + + + Payer FSP + + + Account Lookup + Service (ALS) + + + Account Lookup + Service (ALS) + + + ALS Participant + Handler + + + ALS Participant + Handler + + + ALS Participant Endpoint + Oracle DAO + + + ALS Participant Endpoint + Oracle DAO + + + ALS Database + + + ALS Database + + + ALS CentralService + Endpoint DAO + + + ALS CentralService + Endpoint DAO + + + ALS CentralService + Participant DAO + + + ALS CentralService + Participant DAO + + + ALS Parties + FSP DAO + + + ALS Parties + FSP DAO + + + Central Service API + + + Central Service API + + + Oracle Service API + + + Oracle Service API + + + Payee FSP + + + Payee FSP + + + + + + + + + + + + + + + Get Party Details + + + + 1 + Request to delete Participant details + DEL - /participants/{TYPE}/{ID}?currency={CURRENCY} + Response code: + 202 + Error code: + 200x, 300x, 310x, 320x + + + Validate request against + Mojaloop Interface Specification. + Error code: + 300x, 310x + + + 2 + Request to delete Participant details + + + alt + [oracleEndpoint match found & parties information retrieved] + + + + 3 + Get Oracle Routing Config + Error code: + 200x, 310x, 320x + + + ref + GET Participants - - Get Oracle Routing Config Sequence + Get Oracle Routing Config Sequence - - - - - - Validate FSPIOP-Source Participant - - - 4 - Request FSPIOP-Source participant information - Error code: - 200x - - - 5 - GET - /participants/{FSPIOP-Source} - Error code: - 200x, 310x, 320x - - - 6 - Return FSPIOP-Source participant information - - - 7 - Return FSPIOP-Source participant information - - - - - 8 - Validate FSPIOP-Source participant - Error code: - 320x - - - - - 9 - Validate that PARTICIPANT.fspId == FSPIOP-Source - Error code: - 3100 - - - - 10 - Get Participant Information for PayerFSP - Error code: - 200x, 310x, 320x - - - ref - GET Participants - + + + + + + Validate FSPIOP-Source Participant + + + 4 + Request FSPIOP-Source participant information + Error code: + 200x + + + 5 + GET - /participants/{FSPIOP-Source} + Error code: + 200x, 310x, 320x + + + 6 + Return FSPIOP-Source participant information + + + 7 + Return FSPIOP-Source participant information + + + + + 8 + Validate FSPIOP-Source participant + Error code: + 320x + + + + + 9 + Validate that PARTICIPANT.fspId == FSPIOP-Source + Error code: + 3100 + + + + 10 + Get Participant Information for PayerFSP + Error code: + 200x, 310x, 320x + + + ref + GET Participants - - Request Participant Information from Oracle Sequence + Request Participant Information from Oracle Sequence - - - - - - Validate Participant Ownership - - - - - 11 - Validate that PARTICIPANT.fspId matches Participant Information retrieved from Oracle. - Error code: - 3100 - - - 12 - Request to delete Participant's FSP details DEL - /participants/{TYPE}/{ID}?currency={CURRENCY} - Error code: - 200x, 310x, 320x - - - 13 - Request to delete Participant's FSP details DEL - /participants/{TYPE}/{ID}?currency={CURRENCY} - Response code: - 200 - - Error code: - 200x, 310x, 320x - - - 14 - Return result - - - 15 - Return result - - - 16 - Retrieve the PayerFSP Participant Callback Endpoint - Error code: - 200x - - - 17 - Retrieve the PayerFSP Participant Callback Endpoint - GET - /participants/{FSPIOP-Source}/endpoints - Error code: - 200x, 310x, 320x - - - 18 - List of PayerFSP Participant Callback Endpoints - - - 19 - List of PayerFSP Participant Callback Endpoints - - - - - 20 - Match PayerFSP Participant Callback Endpoints for - FSPIOP_CALLBACK_URL_PARTICIPANT_PUT - - - 21 - Return delete request result - - - - 22 - Callback indiciating success: - PUT - /participants/{TYPE}/{ID}?currency={CURRENCY} - - [Validation failure or Oracle was unable process delete request] - - - 23 - Retrieve the PayerFSP Participant Callback Endpoint - Error code: - 200x, 310x, 320x - - - 24 - Retrieve the PayerFSP Participant Callback Endpoint - GET - /participants/{FSPIOP-Source}/endpoints - Response code: - 200 - Error code: - 200x, 310x, 320x - - - 25 - List of PayerFSP Participant Callback Endpoints - - - 26 - List of PayerFSP Participant Callback Endpoints - - - - - 27 - Match PayerFSP Participant Callback Endpoints for - FSPIOP_CALLBACK_URL_PARTICIPANT_PUT_ERROR - - - 28 - Handle error - Error code: - 200x, 310x, 320x - - - - 29 - Callback: PUT - /participants/{TYPE}/{ID}/error - - [Empty list of switchEndpoint results returned] - - - - - 30 - Handle error - Error code: - 200x - - Error Handling Framework + + + + + + Validate Participant Ownership + + + + + 11 + Validate that PARTICIPANT.fspId matches Participant Information retrieved from Oracle. + Error code: + 3100 + + + 12 + Request to delete Participant's FSP details DEL - /participants/{TYPE}/{ID}?currency={CURRENCY} + Error code: + 200x, 310x, 320x + + + 13 + Request to delete Participant's FSP details DEL - /participants/{TYPE}/{ID}?currency={CURRENCY} + Response code: + 200 +   + Error code: + 200x, 310x, 320x + + + 14 + Return result + + + 15 + Return result + + + 16 + Retrieve the PayerFSP Participant Callback Endpoint + Error code: + 200x + + + 17 + Retrieve the PayerFSP Participant Callback Endpoint + GET - /participants/{FSPIOP-Source}/endpoints + Error code: + 200x, 310x, 320x + + + 18 + List of PayerFSP Participant Callback Endpoints + + + 19 + List of PayerFSP Participant Callback Endpoints + + + + + 20 + Match PayerFSP Participant Callback Endpoints for + FSPIOP_CALLBACK_URL_PARTICIPANT_PUT + + + 21 + Return delete request result + + + + 22 + Callback indiciating success: + PUT - /participants/{TYPE}/{ID}?currency={CURRENCY} + + [Validation failure or Oracle was unable process delete request] + + + 23 + Retrieve the PayerFSP Participant Callback Endpoint + Error code: + 200x, 310x, 320x + + + 24 + Retrieve the PayerFSP Participant Callback Endpoint + GET - /participants/{FSPIOP-Source}/endpoints + Response code: + 200 + Error code: + 200x, 310x, 320x + + + 25 + List of PayerFSP Participant Callback Endpoints + + + 26 + List of PayerFSP Participant Callback Endpoints + + + + + 27 + Match PayerFSP Participant Callback Endpoints for + FSPIOP_CALLBACK_URL_PARTICIPANT_PUT_ERROR + + + 28 + Handle error + Error code: + 200x, 310x, 320x + + + + 29 + Callback: PUT - /participants/{TYPE}/{ID}/error + + [Empty list of switchEndpoint results returned] + + + + + 30 + Handle error + Error code: + 200x + + Error Handling Framework diff --git a/docs/technical/technical/account-lookup-service/assets/diagrams/sequence/seq-acct-lookup-get-participants-7.1.0.svg b/docs/technical/technical/account-lookup-service/assets/diagrams/sequence/seq-acct-lookup-get-participants-7.1.0.svg index f27165b5..70592a76 100644 --- a/docs/technical/technical/account-lookup-service/assets/diagrams/sequence/seq-acct-lookup-get-participants-7.1.0.svg +++ b/docs/technical/technical/account-lookup-service/assets/diagrams/sequence/seq-acct-lookup-get-participants-7.1.0.svg @@ -1,317 +1,308 @@ - - - - - - - - - - + + 7.1.0. Get Participant Details + - 7.1.0. Get Participant Details - - Financial Service Provider - - Account Lookup Service - - Central Services - - ALS Oracle Service/Adapter - - - - - - - - - - - - - - - - - - - - - - - - - - - Payer FSP - - - Payer FSP - - - Account Lookup - Service (ALS) - - - Account Lookup - Service (ALS) - - - ALS Participant - Handler - - - ALS Participant - Handler - - - ALS Endpoint Type - Config DAO - - - ALS Endpoint Type - Config DAO - - - ALS Participant - Oracle DAO - - - ALS Participant - Oracle DAO - - - ALS Database - - - ALS Database - - - ALS CentralService - Endpoint DAO - - - ALS CentralService - Endpoint DAO - - - Central Service API - - - Central Service API - - - Oracle Service API - - - Oracle Service API - - - - - - - - - - - - - - - Get Participant's FSP Details - - - - 1 - Request to get participant's FSP details - GET - /participants/{TYPE}/{ID}?currency={CURRENCY} - Response code: - 202 - - Error code: - 200x, 300x, 310x, 320x - - - Validate request against - Mojaloop Interface Specification. - Error code: - 300x, 310x - - - 2 - Request to get participant's FSP details - - - alt - [oracleEndpoint match found] - - - IMPLEMENTATION: Get Oracle Routing Config Sequence - [CACHED] - - - 3 - Fetch Oracle Routing information based on - {TYPE} and {CURRENCY} if provided - Error code: - 200x - - - 4 - Retrieve oracleEndpoint - Error code: - 200x - - oracleEndpoint - endpointType - partyIdType - currency (optional) - - - 5 - Return oracleEndpoint result set - - - 6 - List of - oracleEndpoint - for the Participant - - - opt - [oracleEndpoint IS NULL] - - - - - 7 - Error code: - 3200 - - - IMPLEMENTATION: Request Participant Information from Oracle Sequence - - - 8 - Request to get participant's FSP details - GET - /participants/{TYPE}/{ID}?currency={CURRENCY} - Error code: - 200x, 310x, 320x - - - 9 - Request to get participant's FSP details - GET - /participants/{TYPE}/{ID}?currency={CURRENCY} - Response code: - 200 - - Error code: - 200x, 310x, 320x - - - 10 - Return list of Participant information - - - 11 - Return list of Participant information - - - 12 - Retrieve the PayerFSP Participant Callback Endpoint - Error code: - 200x, 310x, 320x - - - 13 - Retrieve the PayerFSP Participant Callback Endpoint - GET - /participants/{FSPIOP-Source}/endpoints - Response code: - 200 - - Error code: - 200x, 310x, 320x - - - 14 - List of PayerFSP Participant Callback Endpoints - - - 15 - List of PayerFSP Participant Callback Endpoints - - - - - 16 - Match PayerFSP Participant Callback Endpoints for - FSPIOP_CALLBACK_URL_PARTICIPANT_PUT - - - 17 - Return list of Participant information - - - - 18 - Callback: PUT - /participants/{TYPE}/{ID}?currency={CURRENCY} - - [oracleEndpoint IS NULL OR error occurred] - - - 19 - Retrieve the Participant Callback Endpoint - Error code: - 200x, 310x, 320x - - - 20 - Retrieve the Participant Callback Endpoint - GET - /participants/{FSPIOP-Source}/endpoints. - Response code: - 200 - - Error code: - 200x, 310x, 320x - - - 21 - List of Participant Callback Endpoints - - - 22 - List of Participant Callback Endpoints - - - - - 23 - Match Participant Callback Endpoints for - FSPIOP_CALLBACK_URL_PARTICIPANT_PUT_ERROR - - - 24 - Handle error - Error code: - 200x, 310x, 320x - - - - 25 - Callback: PUT - /participants/{TYPE}/{ID}/error - - [switchEndpoint IS NULL] - - - - - 26 - Handle error - Error code: - 200x - - Error Handling Framework + 7.1.0. Get Participant Details + + Financial Service Provider + + Account Lookup Service + + Central Services + + ALS Oracle Service/Adapter + + + + + + + + + + + + + + + + + + + + + + + + + Payer FSP + + + Payer FSP + + + Account Lookup + Service (ALS) + + + Account Lookup + Service (ALS) + + + ALS Participant + Handler + + + ALS Participant + Handler + + + ALS Endpoint Type + Config DAO + + + ALS Endpoint Type + Config DAO + + + ALS Participant + Oracle DAO + + + ALS Participant + Oracle DAO + + + ALS Database + + + ALS Database + + + ALS CentralService + Endpoint DAO + + + ALS CentralService + Endpoint DAO + + + Central Service API + + + Central Service API + + + Oracle Service API + + + Oracle Service API + + + + + + + + + + + + + + + Get Participant's FSP Details + + + + 1 + Request to get participant's FSP details + GET - /participants/{TYPE}/{ID}?currency={CURRENCY} + Response code: + 202 +   + Error code: + 200x, 300x, 310x, 320x + + + Validate request against + Mojaloop Interface Specification. + Error code: + 300x, 310x + + + 2 + Request to get participant's FSP details + + + alt + [oracleEndpoint match found] + + + IMPLEMENTATION: Get Oracle Routing Config Sequence + [CACHED] + + + 3 + Fetch Oracle Routing information based on + {TYPE} and {CURRENCY} if provided + Error code: + 200x + + + 4 + Retrieve oracleEndpoint + Error code: + 200x + + oracleEndpoint + endpointType + partyIdType + currency (optional) + + + 5 + Return oracleEndpoint result set + + + 6 + List of + oracleEndpoint + for the Participant + + + opt + [oracleEndpoint IS NULL] + + + + + 7 + Error code: + 3200 + + + IMPLEMENTATION: Request Participant Information from Oracle Sequence + + + 8 + Request to get participant's FSP details + GET - /participants/{TYPE}/{ID}?currency={CURRENCY} + Error code: + 200x, 310x, 320x + + + 9 + Request to get participant's FSP details + GET - /participants/{TYPE}/{ID}?currency={CURRENCY} + Response code: + 200 +   + Error code: + 200x, 310x, 320x + + + 10 + Return list of Participant information + + + 11 + Return list of Participant information + + + 12 + Retrieve the PayerFSP Participant Callback Endpoint + Error code: + 200x, 310x, 320x + + + 13 + Retrieve the PayerFSP Participant Callback Endpoint + GET - /participants/{FSPIOP-Source}/endpoints + Response code: + 200 +   + Error code: + 200x, 310x, 320x + + + 14 + List of PayerFSP Participant Callback Endpoints + + + 15 + List of PayerFSP Participant Callback Endpoints + + + + + 16 + Match PayerFSP Participant Callback Endpoints for + FSPIOP_CALLBACK_URL_PARTICIPANT_PUT + + + 17 + Return list of Participant information + + + + 18 + Callback: PUT - /participants/{TYPE}/{ID}?currency={CURRENCY} + + [oracleEndpoint IS NULL OR error occurred] + + + 19 + Retrieve the Participant Callback Endpoint + Error code: + 200x, 310x, 320x + + + 20 + Retrieve the Participant Callback Endpoint + GET - /participants/{FSPIOP-Source}/endpoints. + Response code: + 200 +   + Error code: + 200x, 310x, 320x + + + 21 + List of Participant Callback Endpoints + + + 22 + List of Participant Callback Endpoints + + + + + 23 + Match Participant Callback Endpoints for + FSPIOP_CALLBACK_URL_PARTICIPANT_PUT_ERROR + + + 24 + Handle error + Error code: + 200x, 310x, 320x + + + + 25 + Callback: PUT - /participants/{TYPE}/{ID}/error + + [switchEndpoint IS NULL] + + + + + 26 + Handle error + Error code: + 200x + + Error Handling Framework diff --git a/docs/technical/technical/account-lookup-service/assets/diagrams/sequence/seq-acct-lookup-get-parties-7.2.0.svg b/docs/technical/technical/account-lookup-service/assets/diagrams/sequence/seq-acct-lookup-get-parties-7.2.0.svg index 7ec87e63..6c1cfad7 100644 --- a/docs/technical/technical/account-lookup-service/assets/diagrams/sequence/seq-acct-lookup-get-parties-7.2.0.svg +++ b/docs/technical/technical/account-lookup-service/assets/diagrams/sequence/seq-acct-lookup-get-parties-7.2.0.svg @@ -1,399 +1,389 @@ - - - - - - - - - - + + 7.2.0. Get Party Details + - 7.2.0. Get Party Details - - Financial Service Provider - - Account Lookup Service - - Central Services - - ALS Oracle Service/Adapter - - Financial Service Provider - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Payer FSP - - - Payer FSP - - - Account Lookup - Service (ALS) - - - Account Lookup - Service (ALS) - - - ALS Participant - Handler - - - ALS Participant - Handler - - - ALS Database - - - ALS Database - - - ALS CentralService - Endpoint DAO - - - ALS CentralService - Endpoint DAO - - - ALS CentralService - Participant DAO - - - ALS CentralService - Participant DAO - - - ALS Parties - FSP DAO - - - ALS Parties - FSP DAO - - - Central Service API - - - Central Service API - - - Oracle Service API - - - Oracle Service API - - - Payee FSP - - - Payee FSP - - - - - - - - - - - - - - - - - Get Party Details - - - - 1 - Request to get parties's FSP details - GET - /parties/{TYPE}/{ID}?currency={CURRENCY} - Response code: - 202 - Error code: - 200x, 300x, 310x, 320x - - - Validate request against - Mojaloop Interface Specification. - Error code: - 300x, 310x - - - 2 - Request to get parties's FSP details - - - alt - [oracleEndpoint match found & parties information retrieved] - - - - 3 - Get Oracle Routing Config - Error code: - 200x, 310x, 320x - - - ref - GET Participants - + 7.2.0. Get Party Details + + Financial Service Provider + + Account Lookup Service + + Central Services + + ALS Oracle Service/Adapter + + Financial Service Provider + + + + + + + + + + + + + + + + + + + + + + + + + + Payer FSP + + + Payer FSP + + + Account Lookup + Service (ALS) + + + Account Lookup + Service (ALS) + + + ALS Participant + Handler + + + ALS Participant + Handler + + + ALS Database + + + ALS Database + + + ALS CentralService + Endpoint DAO + + + ALS CentralService + Endpoint DAO + + + ALS CentralService + Participant DAO + + + ALS CentralService + Participant DAO + + + ALS Parties + FSP DAO + + + ALS Parties + FSP DAO + + + Central Service API + + + Central Service API + + + Oracle Service API + + + Oracle Service API + + + Payee FSP + + + Payee FSP + + + + + + + + + + + + + + + + + Get Party Details + + + + 1 + Request to get parties's FSP details + GET - /parties/{TYPE}/{ID}?currency={CURRENCY} + Response code: + 202 + Error code: + 200x, 300x, 310x, 320x + + + Validate request against + Mojaloop Interface Specification. + Error code: + 300x, 310x + + + 2 + Request to get parties's FSP details + + + alt + [oracleEndpoint match found & parties information retrieved] + + + + 3 + Get Oracle Routing Config + Error code: + 200x, 310x, 320x + + + ref + GET Participants - - Get Oracle Routing Config Sequence + Get Oracle Routing Config Sequence - - - - - - Validate FSPIOP-Source Participant - - - 4 - Request FSPIOP-Source participant information - Error code: - 200x - - - 5 - GET - /participants/{FSPIOP-Source} - Error code: - 200x, 310x, 320x - - - 6 - Return FSPIOP-Source participant information - - - 7 - Return FSPIOP-Source participant information - - - - - 8 - Validate FSPIOP-Source participant - Error code: - 320x - - - - 9 - Get Participant Information for PayeeFSP - Error code: - 200x, 310x, 320x - - - ref - GET Participants - + + + + + + Validate FSPIOP-Source Participant + + + 4 + Request FSPIOP-Source participant information + Error code: + 200x + + + 5 + GET - /participants/{FSPIOP-Source} + Error code: + 200x, 310x, 320x + + + 6 + Return FSPIOP-Source participant information + + + 7 + Return FSPIOP-Source participant information + + + + + 8 + Validate FSPIOP-Source participant + Error code: + 320x + + + + 9 + Get Participant Information for PayeeFSP + Error code: + 200x, 310x, 320x + + + ref + GET Participants - - Request Participant Information from Oracle Sequence + Request Participant Information from Oracle Sequence - - - - - - 10 - Request Parties information from FSP. - Error code: - 200x - - - - 11 - Parties Callback to Destination: - GET - /parties/{TYPE}/{ID}?currency={CURRENCY} - Response code: - 202 - Error code: - 200x, 310x, 320x - - - - 12 - Callback with Participant Information: - PUT - /parties/{TYPE}/{ID}?currency={CURRENCY} - Error code: - 200x, 300x, 310x, 320x - - - - - 13 - Validate request against - Mojaloop Interface Specification - Error code: - 300x, 310x - - - 14 - Process Participant Callback Information for PUT - - - 15 - Retrieve the PayerFSP Participant Callback Endpoint - Error code: - 200x - - - 16 - Retrieve the PayerFSP Participant Callback Endpoint - GET - /participants/{FSPIOP-Source}/endpoints - Error code: - 200x, 310x, 320x - - - 17 - List of PayerFSP Participant Callback Endpoints - - - 18 - List of PayerFSP Participant Callback Endpoints - - - - - 19 - Match PayerFSP Participant Callback Endpoints for - FSPIOP_CALLBACK_URL_PARTIES_PUT - - - 20 - Return Participant Information to PayerFSP - - - - 21 - Callback with Parties Information: - PUT - /parties/{TYPE}/{ID}?currency={CURRENCY} - - [Empty list of End-Points returned for either (PayeeFSP or Oracle) config information or Error occurred for PayerFSP] - - - 22 - Retrieve the PayerFSP Participant Callback Endpoint - Error code: - 200x, 310x, 320x - - - 23 - Retrieve the PayerFSP Participant Callback Endpoint - GET - /participants/{FSPIOP-Source}/endpoints - Response code: - 200 - Error code: - 200x, 310x, 320x - - - 24 - List of PayerFSP Participant Callback Endpoints - - - 25 - List of PayerFSP Participant Callback Endpoints - - - - - 26 - Match PayerFSP Participant Callback Endpoints for - FSPIOP_CALLBACK_URL_PARTIES_PUT_ERROR - - - 27 - Handle error - Error code: - 200x, 310x, 320x - - - - 28 - Callback: PUT - /participants/{TYPE}/{ID}/error - - [Empty list of End-Points returned for PayerFSP config information or Error occurred for PayeeFSP] - - - 29 - Retrieve the PayeeFSP Participant Callback Endpoint - Error code: - 200x, 310x, 320x - - - 30 - Retrieve the PayeeFSP Participant Callback Endpoint - GET - /participants/{FSPIOP-Source}/endpoints - Response code: - 200 - Error code: - 200x, 310x, 320x - - - 31 - List of PayeeFSP Participant Callback Endpoints - - - 32 - List of PayeeFSP Participant Callback Endpoints - - - - - 33 - Match PayeeFSP Participant Callback Endpoints for - FSPIOP_CALLBACK_URL_PARTIES_PUT_ERROR - - - 34 - Handle error - Error code: - 200x, 310x, 320x - - - - 35 - Callback: PUT - /participants/{TYPE}/{ID}/error - - [Empty list of switchEndpoint results returned] - - - - - 36 - Handle error - Error code: - 200x - - Error Handling Framework + + + + + + 10 + Request Parties information from FSP. + Error code: + 200x + + + + 11 + Parties Callback to Destination: + GET - /parties/{TYPE}/{ID}?currency={CURRENCY} + Response code: + 202 + Error code: + 200x, 310x, 320x + + + + 12 + Callback with Participant Information: + PUT - /parties/{TYPE}/{ID}?currency={CURRENCY} + Error code: + 200x, 300x, 310x, 320x + + + + + 13 + Validate request against + Mojaloop Interface Specification + Error code: + 300x, 310x + + + 14 + Process Participant Callback Information for PUT + + + 15 + Retrieve the PayerFSP Participant Callback Endpoint + Error code: + 200x + + + 16 + Retrieve the PayerFSP Participant Callback Endpoint + GET - /participants/{FSPIOP-Source}/endpoints + Error code: + 200x, 310x, 320x + + + 17 + List of PayerFSP Participant Callback Endpoints + + + 18 + List of PayerFSP Participant Callback Endpoints + + + + + 19 + Match PayerFSP Participant Callback Endpoints for + FSPIOP_CALLBACK_URL_PARTIES_PUT + + + 20 + Return Participant Information to PayerFSP + + + + 21 + Callback with Parties Information: + PUT - /parties/{TYPE}/{ID}?currency={CURRENCY} + + [Empty list of End-Points returned for either (PayeeFSP or Oracle) config information or Error occurred for PayerFSP] + + + 22 + Retrieve the PayerFSP Participant Callback Endpoint + Error code: + 200x, 310x, 320x + + + 23 + Retrieve the PayerFSP Participant Callback Endpoint + GET - /participants/{FSPIOP-Source}/endpoints + Response code: + 200 + Error code: + 200x, 310x, 320x + + + 24 + List of PayerFSP Participant Callback Endpoints + + + 25 + List of PayerFSP Participant Callback Endpoints + + + + + 26 + Match PayerFSP Participant Callback Endpoints for + FSPIOP_CALLBACK_URL_PARTIES_PUT_ERROR + + + 27 + Handle error + Error code: + 200x, 310x, 320x + + + + 28 + Callback: PUT - /participants/{TYPE}/{ID}/error + + [Empty list of End-Points returned for PayerFSP config information or Error occurred for PayeeFSP] + + + 29 + Retrieve the PayeeFSP Participant Callback Endpoint + Error code: + 200x, 310x, 320x + + + 30 + Retrieve the PayeeFSP Participant Callback Endpoint + GET - /participants/{FSPIOP-Source}/endpoints + Response code: + 200 + Error code: + 200x, 310x, 320x + + + 31 + List of PayeeFSP Participant Callback Endpoints + + + 32 + List of PayeeFSP Participant Callback Endpoints + + + + + 33 + Match PayeeFSP Participant Callback Endpoints for + FSPIOP_CALLBACK_URL_PARTIES_PUT_ERROR + + + 34 + Handle error + Error code: + 200x, 310x, 320x + + + + 35 + Callback: PUT - /participants/{TYPE}/{ID}/error + + [Empty list of switchEndpoint results returned] + + + + + 36 + Handle error + Error code: + 200x + + Error Handling Framework diff --git a/docs/technical/technical/account-lookup-service/assets/diagrams/sequence/seq-acct-lookup-post-participants-7.1.3.svg b/docs/technical/technical/account-lookup-service/assets/diagrams/sequence/seq-acct-lookup-post-participants-7.1.3.svg index 72a8f74b..b38dcc95 100644 --- a/docs/technical/technical/account-lookup-service/assets/diagrams/sequence/seq-acct-lookup-post-participants-7.1.3.svg +++ b/docs/technical/technical/account-lookup-service/assets/diagrams/sequence/seq-acct-lookup-post-participants-7.1.3.svg @@ -1,334 +1,326 @@ - - - - - - - - - - + + 7.1.3 Post Participant Details by Type and ID + - 7.1.3 Post Participant Details by Type and ID - - Financial Service Provider - - Account Lookup Service - - Central Services - - ALS Oracle Service/Adapter - - - - - - - - - - - - - - - - - - - - - - - - Payer FSP - - - Payer FSP - - - Account Lookup - Service (ALS) - - - Account Lookup - Service (ALS) - - - ALS Participant - Handler - - - ALS Participant - Handler - - - ALS Participant - Oracle DAO - - - ALS Participant - Oracle DAO - - - ALS Database - - - ALS Database - - - ALS CentralService - Endpoint DAO - - - ALS CentralService - Endpoint DAO - - - ALS CentralService - Participant DAO - - - ALS CentralService - Participant DAO - - - Central Service API - - - Central Service API - - - Oracle Service API - - - Oracle Service API - - - - - - - - - - - - - - - Post Participant's FSP Details - - - Headers - postParticipantsByTypeIDHeaders: { - 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 - postParticipantsByTypeIDMessage: - { - "fspId": "string" - } - - - - 1 - Request to add participant's FSP details - POST - /participants/{Type}/{ID} - Response code: - 202 - - Error code: - 200x, 300x, 310x, 320x - - - Validate request against - Mojaloop Interface Specification. - Error code: - 300x, 310x - - - 2 - Process create participant's FSP details - - - - - 3 - Validate that PARTICIPANT.fspId == FSPIOP-Source - Error code: - 3100 - - - alt - [Validation passed] - - - - 4 - Get Oracle Routing Config based on Type (and optional Currency) - Error code: - 300x, 310x - - - ref - GET Participants - + 7.1.3 Post Participant Details by Type and ID + + Financial Service Provider + + Account Lookup Service + + Central Services + + ALS Oracle Service/Adapter + + + + + + + + + + + + + + + + + + + + + + + Payer FSP + + + Payer FSP + + + Account Lookup + Service (ALS) + + + Account Lookup + Service (ALS) + + + ALS Participant + Handler + + + ALS Participant + Handler + + + ALS Participant + Oracle DAO + + + ALS Participant + Oracle DAO + + + ALS Database + + + ALS Database + + + ALS CentralService + Endpoint DAO + + + ALS CentralService + Endpoint DAO + + + ALS CentralService + Participant DAO + + + ALS CentralService + Participant DAO + + + Central Service API + + + Central Service API + + + Oracle Service API + + + Oracle Service API + + + + + + + + + + + + + + + Post Participant's FSP Details + + + Headers - postParticipantsByTypeIDHeaders: { + 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 - postParticipantsByTypeIDMessage: + { + "fspId": "string" + } + + + + 1 + Request to add participant's FSP details + POST - /participants/{Type}/{ID} + Response code: + 202 +   + Error code: + 200x, 300x, 310x, 320x + + + Validate request against + Mojaloop Interface Specification. + Error code: + 300x, 310x + + + 2 + Process create participant's FSP details + + + + + 3 + Validate that PARTICIPANT.fspId == FSPIOP-Source + Error code: + 3100 + + + alt + [Validation passed] + + + + 4 + Get Oracle Routing Config based on Type (and optional Currency) + Error code: + 300x, 310x + + + ref + GET Participants - - Get Oracle Routing Config Sequence + Get Oracle Routing Config Sequence - - - - - - Validate Participant's FSP - - - 5 - Request participant (PARTICIPANT.fspId) information for {Type} - Error code: - 200x - - - 6 - GET - /participants/{PARTICIPANT.fspId} - Response code: - 200 - - Error code: - 200x, 310x, 320x - - - 7 - Return participant information - - - 8 - Return participant information - - - - - 9 - Validate participant - Error code: - 320x - - - 10 - Create participant's FSP details - POST - /participants - Error code: - 200x, 310x, 320x - - - 11 - Create participant's FSP details - POST - /participants - Response code: - 204 - - Error code: - 200x, 310x, 320x - - - 12 - Return result of Participant Create request - - - 13 - Return result of Participant Create request - - - 14 - Retrieve the PayerFSP (FSPIOP-Source) Participant Callback Endpoint - Error code: - 200x, 310x, 320x - - - 15 - Retrieve the PayerFSP Participant Callback Endpoint - GET - /participants/{FSPIOP-Source}/endpoints - Response code: - 200 - - Error code: - 200x, 310x, 320x - - - 16 - List of PayerFSP Participant Callback Endpoints - - - 17 - List of PayerFSP Participant Callback Endpoints - - - - - 18 - Match PayerFSP Participant Callback Endpoints for - FSPIOP_CALLBACK_URL_PARTICIPANT_PUT - - - 19 - Return list of Participant information from ParticipantResult - - - - 20 - Callback: PUT - /participants/{Type}/{ID} - - [Validation failure] - - - 21 - Retrieve the PayerFSP (FSPIOP-Source) Participant Callback Endpoint - Error code: - 200x, 310x, 320x - - - 22 - Retrieve the PayerFSP Participant Callback Endpoint - GET - /participants/{FSPIOP-Source}/endpoints - Response code: - 200 - - Error code: - 200x, 310x, 320x - - - 23 - List of PayerFSP Participant Callback Endpoints - - - 24 - List of PayerFSP Participant Callback Endpoints - - - - - 25 - Match Participant Callback Endpoints for - FSPIOP_CALLBACK_URL_PARTICIPANT_PUT_ERROR - - - 26 - Handle error - Error code: - 200x, 310x, 320x - - - - 27 - Callback: PUT - /participants/{Type}/{ID}/error + + + + + + Validate Participant's FSP + + + 5 + Request participant (PARTICIPANT.fspId) information for {Type} + Error code: + 200x + + + 6 + GET - /participants/{PARTICIPANT.fspId} + Response code: + 200 +   + Error code: + 200x, 310x, 320x + + + 7 + Return participant information + + + 8 + Return participant information + + + + + 9 + Validate participant + Error code: + 320x + + + 10 + Create participant's FSP details + POST - /participants + Error code: + 200x, 310x, 320x + + + 11 + Create participant's FSP details + POST - /participants + Response code: + 204 +   + Error code: + 200x, 310x, 320x + + + 12 + Return result of Participant Create request + + + 13 + Return result of Participant Create request + + + 14 + Retrieve the PayerFSP (FSPIOP-Source) Participant Callback Endpoint + Error code: + 200x, 310x, 320x + + + 15 + Retrieve the PayerFSP Participant Callback Endpoint + GET - /participants/{FSPIOP-Source}/endpoints + Response code: + 200 +   + Error code: + 200x, 310x, 320x + + + 16 + List of PayerFSP Participant Callback Endpoints + + + 17 + List of PayerFSP Participant Callback Endpoints + + + + + 18 + Match PayerFSP Participant Callback Endpoints for + FSPIOP_CALLBACK_URL_PARTICIPANT_PUT + + + 19 + Return list of Participant information from ParticipantResult + + + + 20 + Callback: PUT - /participants/{Type}/{ID} + + [Validation failure] + + + 21 + Retrieve the PayerFSP (FSPIOP-Source) Participant Callback Endpoint + Error code: + 200x, 310x, 320x + + + 22 + Retrieve the PayerFSP Participant Callback Endpoint + GET - /participants/{FSPIOP-Source}/endpoints + Response code: + 200 +   + Error code: + 200x, 310x, 320x + + + 23 + List of PayerFSP Participant Callback Endpoints + + + 24 + List of PayerFSP Participant Callback Endpoints + + + + + 25 + Match Participant Callback Endpoints for + FSPIOP_CALLBACK_URL_PARTICIPANT_PUT_ERROR + + + 26 + Handle error + Error code: + 200x, 310x, 320x + + + + 27 + Callback: PUT - /participants/{Type}/{ID}/error diff --git a/docs/technical/technical/account-lookup-service/assets/diagrams/sequence/seq-acct-lookup-post-participants-batch-7.1.1.svg b/docs/technical/technical/account-lookup-service/assets/diagrams/sequence/seq-acct-lookup-post-participants-batch-7.1.1.svg index 6c7f609c..aed0ef55 100644 --- a/docs/technical/technical/account-lookup-service/assets/diagrams/sequence/seq-acct-lookup-post-participants-batch-7.1.1.svg +++ b/docs/technical/technical/account-lookup-service/assets/diagrams/sequence/seq-acct-lookup-post-participants-batch-7.1.1.svg @@ -1,376 +1,368 @@ - - - - - - - - - - + + 7.1.1. Post Participant (Batch) Details + - 7.1.1. Post Participant (Batch) Details - - Financial Service Provider - - Account Lookup Service - - Central Services - - ALS Oracle Service/Adapter - - - - - - - - - - - - - - - - - - - - - - - - - - - Payer FSP - - - Payer FSP - - - Account Lookup - Service (ALS) - - - Account Lookup - Service (ALS) - - - ALS Participant - Handler - - - ALS Participant - Handler - - - ALS Participant - Oracle DAO - - - ALS Participant - Oracle DAO - - - ALS Database - - - ALS Database - - - ALS CentralService - Endpoint DAO - - - ALS CentralService - Endpoint DAO - - - ALS CentralService - Participant DAO - - - ALS CentralService - Participant DAO - - - Central Service API - - - Central Service API - - - Oracle Service API - - - Oracle Service API - - - - - - - - - - - - - - - Post Participant's FSP Details - - - Headers - postParticipantsHeaders: { - 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 - postParticipantsMessage: - { - "requestId": "string", - "partyList": [ - { - "partyIdType": "string", - "partyIdentifier": "string", - "partySubIdOrType": "string", - "fspId": "string" - } - ], - "currency": "string" - } - - - - 1 - Request to add participant's FSP details - POST - /participants - Response code: - 202 - - Error code: - 200x, 300x, 310x, 320x - - - Validate request against - Mojaloop Interface Specification. - Error code: - 300x, 310x - - - 2 - Process create participant's FSP details - - - loop - [for Participant in ParticipantList] - - - - - 3 - Validate that PARTICIPANT.fspId == FSPIOP-Source - Error code: - 3100 - - - - - 4 - Group Participant lists into a Map (ParticipantMap) based on {TYPE} - - - alt - [Validation passed and the ParticipantMap was created successfully] - - - loop - [for keys in ParticipantMap -> TypeKey] - - - - 5 - Get Oracle Routing Config based on TypeKey (and optional Currency) - Error code: - 300x, 310x - - - ref - GET Participants - + 7.1.1. Post Participant (Batch) Details + + Financial Service Provider + + Account Lookup Service + + Central Services + + ALS Oracle Service/Adapter + + + + + + + + + + + + + + + + + + + + + + + + + + Payer FSP + + + Payer FSP + + + Account Lookup + Service (ALS) + + + Account Lookup + Service (ALS) + + + ALS Participant + Handler + + + ALS Participant + Handler + + + ALS Participant + Oracle DAO + + + ALS Participant + Oracle DAO + + + ALS Database + + + ALS Database + + + ALS CentralService + Endpoint DAO + + + ALS CentralService + Endpoint DAO + + + ALS CentralService + Participant DAO + + + ALS CentralService + Participant DAO + + + Central Service API + + + Central Service API + + + Oracle Service API + + + Oracle Service API + + + + + + + + + + + + + + + Post Participant's FSP Details + + + Headers - postParticipantsHeaders: { + 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 - postParticipantsMessage: + { + "requestId": "string", + "partyList": [ + { + "partyIdType": "string", + "partyIdentifier": "string", + "partySubIdOrType": "string", + "fspId": "string" + } + ], + "currency": "string" + } + + + + 1 + Request to add participant's FSP details + POST - /participants + Response code: + 202 +   + Error code: + 200x, 300x, 310x, 320x + + + Validate request against + Mojaloop Interface Specification. + Error code: + 300x, 310x + + + 2 + Process create participant's FSP details + + + loop + [for Participant in ParticipantList] + + + + + 3 + Validate that PARTICIPANT.fspId == FSPIOP-Source + Error code: + 3100 + + + + + 4 + Group Participant lists into a Map (ParticipantMap) based on {TYPE} + + + alt + [Validation passed and the ParticipantMap was created successfully] + + + loop + [for keys in ParticipantMap -> TypeKey] + + + + 5 + Get Oracle Routing Config based on TypeKey (and optional Currency) + Error code: + 300x, 310x + + + ref + GET Participants - - Get Oracle Routing Config Sequence + Get Oracle Routing Config Sequence - - - - - - Validate Participant's FSP - - - 6 - Request participant (PARTICIPANT.fspId) information for {TypeKey} - Error code: - 200x - - - 7 - GET - /participants/{PARTICIPANT.fspId} - Response code: - 200 - - Error code: - 200x, 310x, 320x - - - 8 - Return participant information - - - 9 - Return participant information - - - - - 10 - Validate participant - Error code: - 320x - - - 11 - Create participant's FSP details - POST - /participants - Error code: - 200x, 310x, 320x - - - 12 - Create participant's FSP details - POST - /participants - Response code: - 204 - - Error code: - 200x, 310x, 320x - - - 13 - Return result of Participant Create request - - - 14 - Return result of Participant Create request - - - - - 15 - Store results in ParticipantResultMap[TypeKey] - - - loop - [for keys in ParticipantResultMap -> TypeKey] - - - - - 16 - Combine ParticipantResultMap[TypeKey] results into ParticipantResult - - - 17 - Retrieve the PayerFSP (FSPIOP-Source) Participant Callback Endpoint - Error code: - 200x, 310x, 320x - - - 18 - Retrieve the PayerFSP Participant Callback Endpoint - GET - /participants/{FSPIOP-Source}/endpoints - Response code: - 200 - - Error code: - 200x, 310x, 320x - - - 19 - List of PayerFSP Participant Callback Endpoints - - - 20 - List of PayerFSP Participant Callback Endpoints - - - - - 21 - Match PayerFSP Participant Callback Endpoints for - FSPIOP_CALLBACK_URL_PARTICIPANT_BATCH_PUT - - - 22 - Return list of Participant information from ParticipantResult - - - - 23 - Callback: PUT - /participants/{requestId} - - [Validation failure and/or the ParticipantMap was not created successfully] - - - 24 - Retrieve the PayerFSP (FSPIOP-Source) Participant Callback Endpoint - Error code: - 200x, 310x, 320x - - - 25 - Retrieve the PayerFSP Participant Callback Endpoint - GET - /participants/{FSPIOP-Source}/endpoints - Response code: - 200 - - Error code: - 200x, 310x, 320x - - - 26 - List of PayerFSP Participant Callback Endpoints - - - 27 - List of PayerFSP Participant Callback Endpoints - - - - - 28 - Match Participant Callback Endpoints for - FSPIOP_CALLBACK_URL_PARTICIPANT_BATCH_PUT_ERROR - - - 29 - Handle error - Error code: - 200x, 310x, 320x - - - - 30 - Callback: PUT - /participants/{requestId}/error + + + + + + Validate Participant's FSP + + + 6 + Request participant (PARTICIPANT.fspId) information for {TypeKey} + Error code: + 200x + + + 7 + GET - /participants/{PARTICIPANT.fspId} + Response code: + 200 +   + Error code: + 200x, 310x, 320x + + + 8 + Return participant information + + + 9 + Return participant information + + + + + 10 + Validate participant + Error code: + 320x + + + 11 + Create participant's FSP details + POST - /participants + Error code: + 200x, 310x, 320x + + + 12 + Create participant's FSP details + POST - /participants + Response code: + 204 +   + Error code: + 200x, 310x, 320x + + + 13 + Return result of Participant Create request + + + 14 + Return result of Participant Create request + + + + + 15 + Store results in ParticipantResultMap[TypeKey] + + + loop + [for keys in ParticipantResultMap -> TypeKey] + + + + + 16 + Combine ParticipantResultMap[TypeKey] results into ParticipantResult + + + 17 + Retrieve the PayerFSP (FSPIOP-Source) Participant Callback Endpoint + Error code: + 200x, 310x, 320x + + + 18 + Retrieve the PayerFSP Participant Callback Endpoint + GET - /participants/{FSPIOP-Source}/endpoints + Response code: + 200 +   + Error code: + 200x, 310x, 320x + + + 19 + List of PayerFSP Participant Callback Endpoints + + + 20 + List of PayerFSP Participant Callback Endpoints + + + + + 21 + Match PayerFSP Participant Callback Endpoints for + FSPIOP_CALLBACK_URL_PARTICIPANT_BATCH_PUT + + + 22 + Return list of Participant information from ParticipantResult + + + + 23 + Callback: PUT - /participants/{requestId} + + [Validation failure and/or the ParticipantMap was not created successfully] + + + 24 + Retrieve the PayerFSP (FSPIOP-Source) Participant Callback Endpoint + Error code: + 200x, 310x, 320x + + + 25 + Retrieve the PayerFSP Participant Callback Endpoint + GET - /participants/{FSPIOP-Source}/endpoints + Response code: + 200 +   + Error code: + 200x, 310x, 320x + + + 26 + List of PayerFSP Participant Callback Endpoints + + + 27 + List of PayerFSP Participant Callback Endpoints + + + + + 28 + Match Participant Callback Endpoints for + FSPIOP_CALLBACK_URL_PARTICIPANT_BATCH_PUT_ERROR + + + 29 + Handle error + Error code: + 200x, 310x, 320x + + + + 30 + Callback: PUT - /participants/{requestId}/error diff --git a/docs/technical/technical/central-bulk-transfers/assets/diagrams/sequence/seq-bulk-1.1.0-bulk-prepare-overview.svg b/docs/technical/technical/central-bulk-transfers/assets/diagrams/sequence/seq-bulk-1.1.0-bulk-prepare-overview.svg index b24804c1..9c52a416 100644 --- a/docs/technical/technical/central-bulk-transfers/assets/diagrams/sequence/seq-bulk-1.1.0-bulk-prepare-overview.svg +++ b/docs/technical/technical/central-bulk-transfers/assets/diagrams/sequence/seq-bulk-1.1.0-bulk-prepare-overview.svg @@ -1,788 +1,405 @@ - - - - - - - - - - - 1.1.0. DFSP1 sends a Bulk Prepare Transfer request to DFSP2 - - - - Financial Service Providers - - - - Bulk API Adapter Service - - - - Central Service - - - - - - - - - - DFSP1 - - - Payer - - - - - DFSP1 - - - Payer - - - - - DFSP2 - - - Payee - - - - - DFSP2 - - - Payee - - - - - Bulk API Adapter - - - - - Bulk API Adapter - - - - - Bulk API Notification - - - Handler - - - - - Bulk API Notification - - - Handler - - - - - - - mojaloop- - - - object-store - - - ( - - - MLOS - - - ) - - - - - mojaloop- - - - object-store - - - ( - - - MLOS - - - ) - - - Central Service API - - - - - Central Service API - - - - - - - topic- - - - bulk-prepare - - - - - topic- - - - bulk-prepare - - - Bulk Prepare - - - Handler - - - - - Bulk Prepare - - - Handler - - - - - - - topic- - - - transfer-prepare - - - - - topic- - - - transfer-prepare - - - Prepare Handler - - - - - Prepare Handler - - - - - - - topic- - - - transfer-position - - - - - topic- - - - transfer-position - - - Position Handler - - - - - Position Handler - - - - - - - topic- - - - bulk-processing - - - - - topic- - - - bulk-processing - - - Bulk Processing - - - Handler - - - - - Bulk Processing - - - Handler - - - - - - - topic- - - - notifications - - - - - topic- - - - notifications - - - - - - DFSP1 sends a Bulk Prepare Transfer request to DFSP2 - - - - - Headers - transferHeaders: { - - - Content-Length: <int>, - - - Content-Type: <string>, - - - Date: <date>, - - - FSPIOP-Source: <string>, - - - FSPIOP-Destination: <string>, - - - FSPIOP-Encryption: <string>, - - - FSPIOP-Signature: <string>, - - - FSPIOP-URI: <uri>, - - - FSPIOP-HTTP-Method: <string> - - - } - - - Payload - bulkTransferMessage: - - - { - - - bulkTransferId: <uuid>, - - - bulkQuoteId: <uuid>, - - - payeeFsp: <string>, - - - payerFsp: <string>, - - - individualTransfers: [ - - - { - - - transferId: <uuid>, - - - transferAmount: - - - { - - - currency: <string>, - - - amount: <string> - - - }, - - - ilpPacket: <string>, - - - condition: <string>, - - - extensionList: { extension: [ - - - { key: <string>, value: <string> } - - - ] } - - - } - - - ], - - - extensionList: { extension: [ - - - { key: <string>, value: <string> } - - - ] }, - - - expiration: <string> - - - } - - - - 1 - - - POST - /bulkTransfers - - - - - 2 - - - Validate incoming message - - - Error codes: - - - 3000-3002, 3100-3107 - - - - - loop - - - - - 3 - - - Persist individual transfers in the bulk to - - - object store: - - - MLOS.individualTransfers - - - - - 4 - - - Return messageId reference to the stored object(s) - - - - - Message: - - - { - - - id: <messageId> - - - to: <payeeFspName>, - - - from: <payerFspName>, - - - type: "application/json" - - - content: { - - - headers: <bulkTransferHeaders>, - - - payload: { - - - bulkTransferId: <uuid>, - - - bulkQuoteId": <uuid>, - - - payerFsp: <string>, - - - payeeFsp: <string>, - - - expiration: <timestamp>, - - - hash: <string> - - - } - - - }, - - - metadata: { - - - event: { - - - id: <uuid>, - - - type: "bulk-prepare", - - - action: "bulk-prepare", - - - createdAt: <timestamp>, - - - state: { - - - status: "success", - - - code: 0 - - - } - - - } - - - } - - - } - - - - - 5 - - - Route & Publish Bulk Prepare event - - - for Payer - - - Error code: - - - 2003 - - - - - 6 - - - Ensure event is replicated - - - as configured (ACKS=all) - - - Error code: - - - 2003 - - - - - 7 - - - Respond replication acknowledgements - - - have been received - - - - - 8 - - - Respond HTTP - 202 (Accepted) - - - - - 9 - - - Consume message - - - - - ref - - - Bulk Prepare Handler Consume - - - - - alt - - - [Success] - - - - - 10 - - - Produce (stream) single transfer message - - - for each individual transfer [loop] - - - - [Failure] - - - - - 11 - - - Produce single message for the entire bulk - - - - - 12 - - - Consume message - - - - - ref - - - Prepare Handler Consume - - - - - alt - - - [Success] - - - - - 13 - - - Produce message - - - - [Failure] - - - - - 14 - - - Produce message - - - - - 15 - - - Consume message - - - - - ref - - - Position Handler Consume - - - - - 16 - - - Produce message - - - - - 17 - - - Consume message - - - - - ref - - - Bulk Processing Handler Consume - - - - - 18 - - - Persist bulk message by destination to the - - - object store: - - - MLOS.bulkTransferResults - - - - - 19 - - - Return the reference to the stored - - - notification object(s): - - - messageId - - - - - 20 - - - Send Bulk Prepare notification - - - - - 21 - - - Consume message - - - - - 22 - - - Retrieve bulk notification(s) by reference & destination: - - - MLOS.bulkTransferResults.messageId + destination - - - - - 23 - - - Return notification(s) payload - - - - - ref - - - Send notification to Participant (Payee) - - - - - 24 - - - Send Bulk Prepare notification to Payee - + + 1.1.0. DFSP1 sends a Bulk Prepare Transfer request to DFSP2 + + + 1.1.0. DFSP1 sends a Bulk Prepare Transfer request to DFSP2 + + Financial Service Providers + + Bulk API Adapter Service + + Central Service + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + DFSP1 + Payer + + + DFSP1 + Payer + + + DFSP2 + Payee + + + DFSP2 + Payee + + + Bulk API Adapter + + + Bulk API Adapter + + + Bulk API Notification + Handler + + + Bulk API Notification + Handler + + + + + mojaloop- + object-store + ( + MLOS + ) + + + mojaloop- + object-store + ( + MLOS + ) + Central Service API + + + Central Service API + + + + + topic- + bulk-prepare + + + topic- + bulk-prepare + Bulk Prepare + Handler + + + Bulk Prepare + Handler + + + + + topic- + transfer-prepare + + + topic- + transfer-prepare + Prepare Handler + + + Prepare Handler + + + + + topic- + transfer-position + + + topic- + transfer-position + Position Handler + + + Position Handler + + + + + topic- + bulk-processing + + + topic- + bulk-processing + Bulk Processing + Handler + + + Bulk Processing + Handler + + + + + topic- + notifications + + + topic- + notifications + + + + + + + + + + + + + DFSP1 sends a Bulk Prepare Transfer request to DFSP2 + + + Headers - transferHeaders: { + Content-Length: <int>, + Content-Type: <string>, + Date: <date>, + FSPIOP-Source: <string>, + FSPIOP-Destination: <string>, + FSPIOP-Encryption: <string>, + FSPIOP-Signature: <string>, + FSPIOP-URI: <uri>, + FSPIOP-HTTP-Method: <string> + } +   + Payload - bulkTransferMessage: + { + bulkTransferId: <uuid>, + bulkQuoteId: <uuid>, + payeeFsp: <string>, + payerFsp: <string>, + individualTransfers: [ + { + transferId: <uuid>, + transferAmount: + { + currency: <string>, + amount: <string> + }, + ilpPacket: <string>, + condition: <string>, + extensionList: { extension: [ + { key: <string>, value: <string> } + ] } + } + ], + extensionList: { extension: [ + { key: <string>, value: <string> } + ] }, + expiration: <string> + } + + + + 1 + POST - /bulkTransfers + + + + + 2 + Validate incoming message + Error codes: + 3000-3002, 3100-3107 + + + loop + + + 3 + Persist individual transfers in the bulk to + object store: + MLOS.individualTransfers + + + 4 + Return messageId reference to the stored object(s) + + + Message: + { + id: <messageId> + to: <payeeFspName>, + from: <payerFspName>, + type: "application/json" + content: { + headers: <bulkTransferHeaders>, + payload: { + bulkTransferId: <uuid>, + bulkQuoteId": <uuid>, + payerFsp: <string>, + payeeFsp: <string>, + expiration: <timestamp>, + hash: <string> + } + }, + metadata: { + event: { + id: <uuid>, + type: "bulk-prepare", + action: "bulk-prepare", + createdAt: <timestamp>, + state: { + status: "success", + code: 0 + } + } + } + } + + + 5 + Route & Publish Bulk Prepare event + for Payer + Error code: + 2003 + + + + + + 6 + Ensure event is replicated + as configured (ACKS=all) + Error code: + 2003 + + + 7 + Respond replication acknowledgements + have been received + + + + 8 + Respond HTTP - 202 (Accepted) + + + 9 + Consume message + + + ref + Bulk Prepare Handler Consume +   + + + alt + [Success] + + + 10 + Produce (stream) single transfer message + for each individual transfer [loop] + + [Failure] + + + 11 + Produce single message for the entire bulk + + + 12 + Consume message + + + ref + Prepare Handler Consume +   + + + alt + [Success] + + + 13 + Produce message + + [Failure] + + + 14 + Produce message + + + 15 + Consume message + + + ref + Position Handler Consume +   + + + 16 + Produce message + + + 17 + Consume message + + + ref + Bulk Processing Handler Consume +   + + + 18 + Persist bulk message by destination to the + object store: + MLOS.bulkTransferResults + + + 19 + Return the reference to the stored + notification object(s): + messageId + + + 20 + Send Bulk Prepare notification + + + 21 + Consume message + + + 22 + Retrieve bulk notification(s) by reference & destination: + MLOS.bulkTransferResults.messageId + destination + + + 23 + Return notification(s) payload + + + ref + Send notification to Participant (Payee) +   + + + 24 + Send Bulk Prepare notification to Payee + diff --git a/docs/technical/technical/central-bulk-transfers/assets/diagrams/sequence/seq-bulk-1.1.1-bulk-prepare-handler.svg b/docs/technical/technical/central-bulk-transfers/assets/diagrams/sequence/seq-bulk-1.1.1-bulk-prepare-handler.svg index eb4b20b4..ac272e01 100644 --- a/docs/technical/technical/central-bulk-transfers/assets/diagrams/sequence/seq-bulk-1.1.1-bulk-prepare-handler.svg +++ b/docs/technical/technical/central-bulk-transfers/assets/diagrams/sequence/seq-bulk-1.1.1-bulk-prepare-handler.svg @@ -1,1009 +1,518 @@ - - - - - - - - - - - 1.1.1. Bulk Prepare Handler Consume - - - - Central Service - - - - - - - - - - - - - - - - - - - - - - mojaloop- - - - object-store - - - ( - - - MLOS - - - ) - - - - - mojaloop- - - - object-store - - - ( - - - MLOS - - - ) - - - - - topic- - - - bulk-prepare - - - - - topic- - - - bulk-prepare - - - Bulk Prepare - - - Handler - - - - - Bulk Prepare - - - Handler - - - - - - - topic- - - - transfer-prepare - - - - - topic- - - - transfer-prepare - - - - - topic-event - - - - - topic-event - - - - - topic- - - - notification - - - - - topic- - - - notification - - - - - topic-bulk- - - - processing - - - - - topic-bulk- - - - processing - - - Bulk DAO - - - - - Bulk DAO - - - - - Participant DAO - - - - - Participant DAO - - - - - Central Store - - - - - Central Store - - - - - - - - Bulk Prepare Handler Consume - - - - - 1 - - - Consume Bulk Prepare message - - - - - Validate Bulk Prepare Transfer - - - - - Duplicate Check - - - - - The Specification doesn't touch on the duplicate handling - - - of bulk transfers, so the current design mostly follows the - - - strategy used for individual transfers, except in two places: - - - 1. For duplicate requests where hash matches, the current design - - - includes only the status of the bulk & timestamp (if completed), - - - but not the individual transfers (for which a GET should be used). - - - 2. For duplicate requests where hash matches, but are not in a - - - finalized state, only the state of the bulkTransfer is sent. - - - - - 2 - - - Request Duplicate Check - - - - - ref - - - Request Duplicate Check (using message.content.payload) - - - - - 3 - - - Return { hasDuplicateId: Boolean, hasDuplicateHash: Boolean } - - - - - alt - - - [hasDuplicateId == TRUE && hasDuplicateHash == TRUE] - - - - - break - - - [Return TRUE & Log ('Not implemented')] - - - - [hasDuplicateId == TRUE && hasDuplicateHash == FALSE] - - - - - { - - - id: <messageId>, - - - from: <ledgerName>, - - - to: <payerFspName>, - - - type: "application/json", - - - content: { - - - headers: <bulkTransferHeaders>, - - - payload: { - - - errorInformation: { - - - errorCode: "3106", - - - errorDescription: "Modified request", - - - extensionList: { - - - extension: [ - - - { - - - key: "_cause", - - - value: <FSPIOPError> - - - } - - - ] - - - } - - - }, - - - uriParams: { - - - id: <bulkTransferId> - - - } - - - } - - - }, - - - metadata: { - - - correlationId: <uuid>, - - - event: { - - - id: <uuid>, - - - type: "notification", - - - action: "bulk-prepare", - - - createdAt: <timestamp>, - - - state: { - - - status: "error", - - - code: "3106", - - - description: "Modified request" - - - }, - - - responseTo: <uuid> - - - } - - - } - - - } - - - - - 4 - - - Publish Notification (failure) event for Payer - - - Error codes: - - - 3106 - - - - [hasDuplicateId == FALSE] - - - - - Validate Bulk Transfer Prepare Request - - - - - 5 - - - FSPIOP Source matches Payer - - - - - 6 - - - Check expiration - - - - - 7 - - - Payer and Payee FSP's are different - - - - - Validate Payer - - - - - 8 - - - Request to retrieve Payer Participant details (if it exists) - - - - - 9 - - - Request Participant details - - - - participant - - - participantCurrency - - - - - 10 - - - Return Participant details if it exists - - - - - 11 - - - Return Participant details if it exists - - - - - 12 - - - Validate Payer - - - Error codes: - - - 3202 - - - - - Validate Payee - - - - - 13 - - - Request to retrieve Payee Participant details (if it exists) - - - - - 14 - - - Request Participant details - - - - participant - - - participantCurrency - - - - - 15 - - - Return Participant details if it exists - - - - - 16 - - - Return Participant details if it exists - - - - - 17 - - - Validate Payee - - - Error codes: - - - 3203 - - - - - alt - - - [Validate Bulk Transfer Prepare Request (success)] - - - - - Persist Bulk Transfer State (with bulkTransferState='RECEIVED') - - - - - 18 - - - Request to persist bulk transfer - - - Error codes: - - - 2003 - - - - - 19 - - - Persist bulkTransfer - - - - bulkTransfer - - - bulkTransferExtension - - - bulkTransferStateChange - - - - - 20 - - - Return state - - - - [Validate Bulk Transfer Prepare Request (failure)] - - - - - Persist Bulk Transfer State (with bulkTransferState='INVALID') (Introducing a new status INVALID to mark these entries) - - - - - 21 - - - Request to persist bulk transfer - - - (when Payee/Payer/crypto-condition validation fails) - - - Error codes: - - - 2003 - - - - - 22 - - - Persist transfer - - - - bulkTransfer - - - bulkTransferExtension - - - bulkTransferStateChange - - - bulkTransferError - - - - - 23 - - - Return state - - - - - alt - - - [Validate Bulk Prepare Transfer (success)] - - - - - loop - - - [for each individual transfer in the bulk] - - - - - 24 - - - Retrieve individual transfers from the bulk using - - - reference: - - - MLOS.individualTransfers.messageId - - - - - Add elements such as Expiry time, Payer FSP, Payee FSP, etc. to each - - - transfer to make their format similar to a single transfer - - - - - 25 - - - Stream bulk's individual transfers - - - - - Insert Bulk Transfer Association (with bulkProcessingState='RECEIVED') - - - - - 26 - - - Request to persist bulk transfer association - - - Error codes: - - - 2003 - - - - - 27 - - - Insert bulkTransferAssociation - - - - bulkTransferAssociation - - - bulkTransferStateChange - - - - - 28 - - - Return state - - - - - Message: - - - { - - - id: <messageId> - - - from: <payerFspName>, - - - to: <payeeFspName>, - - - type: application/json - - - content: { - - - headers: <transferHeaders>, - - - payload: <transferMessage> - - - }, - - - metadata: { - - - event: { - - - id: <uuid>, - - - responseTo: <previous.uuid>, - - - type: "prepare", - - - action: "bulk-prepare", - - - createdAt: <timestamp>, - - - state: { - - - status: "success", - - - code: 0, - - - description:"action successful" - - - } - - - } - - - } - - - } - - - - - 29 - - - Route & Publish Prepare event to the Payee for the Individual Transfer - - - Error codes: - - - 2003 - - - - [Validate Bulk Prepare Transfer (failure)] - - - - - Message: - - - { - - - id: <messageId> - - - from: <ledgerName>, - - - to: <bulkTransferMessage.payerFsp>, - - - type: "application/json", - - - content: { - - - headers: <bulkTransferHeaders>, - - - payload: { - - - "errorInformation": { - - - "errorCode": <possible codes: [2003, 3100, 3105, 3106, 3202, 3203, 3300, 3301]> - - - "errorDescription": "<refer to section 7.6 for description>", - - - "extensionList": <transferMessage.extensionList> - - - } - - - }, - - - metadata: { - - - event: { - - - id: <uuid>, - - - responseTo: <previous.uuid>, - - - type: "bulk-processing", - - - action: "bulk-abort", - - - createdAt: <timestamp>, - - - state: { - - - status: "error", - - - code: <errorInformation.errorCode> - - - description: <errorInformation.errorDescription> - - - } - - - } - - - } - - - } - - - - - 30 - - - Publish Processing (failure) event for Payer - - - Error codes: - - - 2003 - - - - - Insert Bulk Transfer Association (with bulkProcessingState='INVALID') - - - - - 31 - - - Request to persist bulk transfer association - - - Error codes: - - - 2003 - - - - - 32 - - - Insert bulkTransferAssociation - - - - bulkTransferAssociation - - - bulkTransferStateChange - - - - - 33 - - - Return state - + + 1.1.1. Bulk Prepare Handler Consume + + + 1.1.1. Bulk Prepare Handler Consume + + Central Service + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + mojaloop- + object-store + ( + MLOS + ) + + + mojaloop- + object-store + ( + MLOS + ) + + + topic- + bulk-prepare + + + topic- + bulk-prepare + Bulk Prepare + Handler + + + Bulk Prepare + Handler + + + + + topic- + transfer-prepare + + + topic- + transfer-prepare + + + topic-event + + + topic-event + + + topic- + notification + + + topic- + notification + + + topic-bulk- + processing + + + topic-bulk- + processing + Bulk DAO + + + Bulk DAO + + + Participant DAO + + + Participant DAO + + + Central Store + + + Central Store + + + + + + + + + + + + + + + + + + + + + + + Bulk Prepare Handler Consume + + + 1 + Consume Bulk Prepare message + + + Validate Bulk Prepare Transfer + + + Duplicate Check + + + The Specification doesn't touch on the duplicate handling + of bulk transfers, so the current design mostly follows the + strategy used for individual transfers, except in two places: +   + 1. For duplicate requests where hash matches, the current design + includes only the status of the bulk & timestamp (if completed), + but not the individual transfers (for which a GET should be used). +   + 2. For duplicate requests where hash matches, but are not in a + finalized state, only the state of the bulkTransfer is sent. + + + 2 + Request Duplicate Check + + + ref + Request Duplicate Check (using message.content.payload) +   + + + 3 + Return { hasDuplicateId: Boolean, hasDuplicateHash: Boolean } + + + alt + [hasDuplicateId == TRUE && hasDuplicateHash == TRUE] + + + break + [Return TRUE & Log ('Not implemented')] + + [hasDuplicateId == TRUE && hasDuplicateHash == FALSE] + + + { + id: <messageId>, + from: <ledgerName>, + to: <payerFspName>, + type: "application/json", + content: { + headers: <bulkTransferHeaders>, + payload: { + errorInformation: { + errorCode: "3106", + errorDescription: "Modified request", + extensionList: { + extension: [ + { + key: "_cause", + value: <FSPIOPError> + } + ] + } + }, + uriParams: { + id: <bulkTransferId> + } + } + }, + metadata: { + correlationId: <uuid>, + event: { + id: <uuid>, + type: "notification", + action: "bulk-prepare", + createdAt: <timestamp>, + state: { + status: "error", + code: "3106", + description: "Modified request" + }, + responseTo: <uuid> + } + } + } + + + 4 + Publish Notification (failure) event for Payer + Error codes: + 3106 + + [hasDuplicateId == FALSE] + + + Validate Bulk Transfer Prepare Request + + + + + + 5 + FSPIOP Source matches Payer + + + + + + 6 + Check expiration + + + + + + 7 + Payer and Payee FSP's are different + + + Validate Payer + + + 8 + Request to retrieve Payer Participant details (if it exists) + + + 9 + Request Participant details + + participant + participantCurrency + + + 10 + Return Participant details if it exists + + + 11 + Return Participant details if it exists + + + + + + 12 + Validate Payer + Error codes: + 3202 + + + Validate Payee + + + 13 + Request to retrieve Payee Participant details (if it exists) + + + 14 + Request Participant details + + participant + participantCurrency + + + 15 + Return Participant details if it exists + + + 16 + Return Participant details if it exists + + + + + + 17 + Validate Payee + Error codes: + 3203 + + + alt + [Validate Bulk Transfer Prepare Request (success)] + + + Persist Bulk Transfer State (with bulkTransferState='RECEIVED') + + + 18 + Request to persist bulk transfer + Error codes: + 2003 + + + 19 + Persist bulkTransfer + + bulkTransfer + bulkTransferExtension + bulkTransferStateChange + + + 20 + Return state + + [Validate Bulk Transfer Prepare Request (failure)] + + + Persist Bulk Transfer State (with bulkTransferState='INVALID') (Introducing a new status INVALID to mark these entries) + + + 21 + Request to persist bulk transfer + (when Payee/Payer/crypto-condition validation fails) + Error codes: + 2003 + + + 22 + Persist transfer + + bulkTransfer + bulkTransferExtension + bulkTransferStateChange + bulkTransferError + + + 23 + Return state + + + alt + [Validate Bulk Prepare Transfer (success)] + + + loop + [for each individual transfer in the bulk] + + + 24 + Retrieve individual transfers from the bulk using + reference: + MLOS.individualTransfers.messageId + + + Add elements such as Expiry time, Payer FSP, Payee FSP, etc. to each + transfer to make their format similar to a single transfer + + + 25 + Stream bulk's individual transfers + + + Insert Bulk Transfer Association (with bulkProcessingState='RECEIVED') + + + 26 + Request to persist bulk transfer association + Error codes: + 2003 + + + 27 + Insert bulkTransferAssociation + + bulkTransferAssociation + bulkTransferStateChange + + + 28 + Return state + + + Message: + { + id: <messageId> + from: <payerFspName>, + to: <payeeFspName>, + type: application/json + content: { + headers: <transferHeaders>, + payload: <transferMessage> + }, + metadata: { + event: { + id: <uuid>, + responseTo: <previous.uuid>, + type: "prepare", + action: "bulk-prepare", + createdAt: <timestamp>, + state: { + status: "success", + code: 0, + description:"action successful" + } + } + } + } + + + 29 + Route & Publish Prepare event to the Payee for the Individual Transfer + Error codes: + 2003 + + [Validate Bulk Prepare Transfer (failure)] + + + Message: + { + id: <messageId> + from: <ledgerName>, + to: <bulkTransferMessage.payerFsp>, + type: "application/json", + content: { + headers: <bulkTransferHeaders>, + payload: { + "errorInformation": { + "errorCode": <possible codes: [2003, 3100, 3105, 3106, 3202, 3203, 3300, 3301]> + "errorDescription": "<refer to section 7.6 for description>", + "extensionList": <transferMessage.extensionList> + } + }, + metadata: { + event: { + id: <uuid>, + responseTo: <previous.uuid>, + type: "bulk-processing", + action: "bulk-abort", + createdAt: <timestamp>, + state: { + status: "error", + code: <errorInformation.errorCode> + description: <errorInformation.errorDescription> + } + } + } + } + + + 30 + Publish Processing (failure) event for Payer + Error codes: + 2003 + + + Insert Bulk Transfer Association (with bulkProcessingState='INVALID') + + + 31 + Request to persist bulk transfer association + Error codes: + 2003 + + + 32 + Insert bulkTransferAssociation + + bulkTransferAssociation + bulkTransferStateChange + + + 33 + Return state + diff --git a/docs/technical/technical/central-bulk-transfers/assets/diagrams/sequence/seq-bulk-1.2.1-prepare-handler.svg b/docs/technical/technical/central-bulk-transfers/assets/diagrams/sequence/seq-bulk-1.2.1-prepare-handler.svg index af0e4479..21038865 100644 --- a/docs/technical/technical/central-bulk-transfers/assets/diagrams/sequence/seq-bulk-1.2.1-prepare-handler.svg +++ b/docs/technical/technical/central-bulk-transfers/assets/diagrams/sequence/seq-bulk-1.2.1-prepare-handler.svg @@ -1,975 +1,484 @@ - - - - - - - - - - - 1.2.1. Prepare Handler Consume individual transfers from Bulk - - - - Central Service - - - - - - - - - - - - - - - - - - - - topic- - - - transfer-prepare - - - - - topic- - - - transfer-prepare - - - Prepare Handler - - - - - Prepare Handler - - - - - - - topic- - - - transfer-position - - - - - topic- - - - transfer-position - - - - - topic- - - - event - - - - - topic- - - - event - - - - - topic- - - - notification - - - - - topic- - - - notification - - - - - topic- - - - bulk-processing - - - - - topic- - - - bulk-processing - - - Position DAO - - - - - Position DAO - - - - - Participant DAO - - - - - Participant DAO - - - - - Central Store - - - - - Central Store - - - - - - - - Prepare Handler Consume - - - - - 1 - - - Consume Prepare event message - - - - - break - - - - - Validate Event - - - - - 2 - - - Validate event - Rule: type == 'prepare' && action == 'bulk-prepare' - - - Error codes: - - - 2001 - - - - - Persist Event Information - - - - - 3 - - - Publish event information - - - - - ref - - - Event Handler Consume - - - - - Validate Prepare Transfer - - - - - 4 - - - Schema validation of the incoming message - - - - - 5 - - - Verify the message's signature (to be confirmed in future requirement) - - - - - Validate Duplicate Check - - - - - 6 - - - Request Duplicate Check - - - - - ref - - - Request Duplicate Check - - - - - 7 - - - Return { hasDuplicateId: Boolean, hasDuplicateHash: Boolean } - - - - - alt - - - [hasDuplicateId == TRUE && hasDuplicateHash == TRUE] - - - - - In the context of a bulk (when compared to regular transfers), duplicate - - - individual transfers are now considered and reported with Modified Request, - - - because they could have already been handled for another bulk. - - - - - break - - - - - { - - - id: <messageId> - - - from: <ledgerName>, - - - to: <payerFspName>, - - - type: "application/json", - - - content: { - - - headers: <transferHeaders>, - - - payload: { - - - errorInformation: { - - - errorCode: "3106", - - - errorDescription: "Modified request - Individual transfer prepare duplicate", - - - extensionList: { extension: [ { key: "_cause", value: <FSPIOPError> } ] } - - - } - - - }, - - - uriParams: { id: <transferId> } - - - }, - - - metadata: { - - - correlationId: <uuid>, - - - event: { - - - type: "bulk-processing", - - - action: "prepare-duplicate", - - - createdAt: <timestamp>, - - - state: { - - - code: "3106", - - - status: "error", - - - description: "Modified request - Individual transfer prepare duplicate" - - - }, - - - id: <uuid>, - - - responseTo: <uuid> - - - } - - - } - - - - - 8 - - - Publish Processing (failure) event for Payer - - - Error codes: - - - 2003 - - - - [hasDuplicateId == TRUE && hasDuplicateHash == FALSE] - - - - - break - - - - - { - - - id: <messageId> - - - from: <ledgerName>, - - - to: <payerFspName>, - - - type: "application/json", - - - content: { - - - headers: <transferHeaders>, - - - payload: { - - - errorInformation: { - - - errorCode: "3106", - - - errorDescription: "Modified request", - - - extensionList: { extension: [ { key: "_cause", value: <FSPIOPError> } ] } - - - } - - - }, - - - uriParams: { id: <transferId> } - - - }, - - - metadata: { - - - correlationId: <uuid>, - - - event: { - - - type: "bulk-processing", - - - action: "prepare-duplicate", - - - createdAt: <timestamp>, - - - state: { - - - code: "3106", - - - status: "error", - - - description: "Modified request" - - - }, - - - id: <uuid>, - - - responseTo: <uuid> - - - } - - - } - - - - - 9 - - - Publish Processing (failure) event for Payer - - - Error codes: - - - 2003 - - - - [hasDuplicateId == FALSE] - - - - - The validation of Payer, Payee can be skipped for individual transfers in Bulk - - - as they should've/would've been validated already in the bulk prepare part. - - - However, leaving it here for now, as in the future, this can be leveraged - - - when bulk transfers to multiple Payees are supported by the Specification. - - - - - Validate Payer - - - - - 10 - - - Request to retrieve Payer Participant details (if it exists) - - - - - 11 - - - Request Participant details - - - - participant - - - participantCurrency - - - - - 12 - - - Return Participant details if it exists - - - - - 13 - - - Return Participant details if it exists - - - - - 14 - - - Validate Payer - - - Error codes: - - - 3202 - - - - - Validate Payee - - - - - 15 - - - Request to retrieve Payee Participant details (if it exists) - - - - - 16 - - - Request Participant details - - - - participant - - - participantCurrency - - - - - 17 - - - Return Participant details if it exists - - - - - 18 - - - Return Participant details if it exists - - - - - 19 - - - Validate Payee - - - Error codes: - - - 3203 - - - - - alt - - - [Validate Prepare Transfer (success)] - - - - - Persist Transfer State (with transferState='RECEIVED-PREPARE') - - - - - 20 - - - Request to persist transfer - - - Error codes: - - - 2003 - - - - - 21 - - - Persist transfer - - - - transfer - - - transferParticipant - - - transferStateChange - - - transferExtension - - - ilpPacket - - - - - 22 - - - Return success - - - - [Validate Prepare Transfer (failure)] - - - - - Persist Transfer State (with transferState='INVALID') (Introducing a new status INVALID to mark these entries) - - - - - 23 - - - Request to persist transfer - - - (when Payee/Payer/crypto-condition validation fails) - - - Error codes: - - - 2003 - - - - - 24 - - - Persist transfer - - - - transfer - - - transferParticipant - - - transferStateChange - - - transferExtension - - - transferError - - - ilpPacket - - - - - 25 - - - Return success - - - - - alt - - - [Validate Prepare Transfer (success)] - - - - - Message: - - - { - - - id: <messageId> - - - from: <payerFspName>, - - - to: <payeeFspName>, - - - type: "application/json", - - - content: { - - - headers: <transferHeaders>, - - - payload: <transferMessage> - - - }, - - - metadata: { - - - event: { - - - id: <uuid>, - - - responseTo: <previous.uuid>, - - - type: "position", - - - action: "bulk-prepare", - - - createdAt: <timestamp>, - - - state: { - - - status: "success", - - - code: 0, - - - description:"action successful" - - - } - - - } - - - } - - - } - - - - - 26 - - - Route & Publish Position event for Payer - - - Error codes: - - - 2003 - - - - [Validate Prepare Transfer (failure)] - - - - - Message: - - - { - - - id: <messageId> - - - from: <ledgerName>, - - - to: <payerFspName>, - - - 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: "bulk-processing", - - - action: "prepare", - - - createdAt: <timestamp>, - - - state: { - - - status: 'error', - - - code: <errorInformation.errorCode> - - - description: <errorInformation.errorDescription> - - - } - - - } - - - } - - - } - - - - - 27 - - - Publish Prepare failure event to Bulk Processing Topic (for Payer) - - - Error codes: - - - 2003 - + + 1.2.1. Prepare Handler Consume individual transfers from Bulk + + + 1.2.1. Prepare Handler Consume individual transfers from Bulk + + Central Service + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + topic- + transfer-prepare + + + topic- + transfer-prepare + Prepare Handler + + + Prepare Handler + + + + + topic- + transfer-position + + + topic- + transfer-position + + + topic- + event + + + topic- + event + + + topic- + notification + + + topic- + notification + + + topic- + bulk-processing + + + topic- + bulk-processing + Position DAO + + + Position DAO + + + Participant DAO + + + Participant DAO + + + Central Store + + + Central Store + + + + + + + + + + + + + + + + + Prepare Handler Consume + + + 1 + Consume Prepare event message + + + break + + + Validate Event + + + + + + 2 + Validate event - Rule: type == 'prepare' && action == 'bulk-prepare' + Error codes: + 2001 + + + Persist Event Information + + + 3 + Publish event information + + + ref + Event Handler Consume +   + + + Validate Prepare Transfer + + + + + + 4 + Schema validation of the incoming message + + + + + + 5 + Verify the message's signature (to be confirmed in future requirement) + + + Validate Duplicate Check + + + 6 + Request Duplicate Check + + + ref + Request Duplicate Check +   + + + 7 + Return { hasDuplicateId: Boolean, hasDuplicateHash: Boolean } + + + alt + [hasDuplicateId == TRUE && hasDuplicateHash == TRUE] + + + In the context of a bulk (when compared to regular transfers), duplicate + individual transfers are now considered and reported with Modified Request, + because they could have already been handled for another bulk. + + + break + + + { + id: <messageId> + from: <ledgerName>, + to: <payerFspName>, + type: "application/json", + content: { + headers: <transferHeaders>, + payload: { + errorInformation: { + errorCode: "3106", + errorDescription: "Modified request - Individual transfer prepare duplicate", + extensionList: { extension: [ { key: "_cause", value: <FSPIOPError> } ] } + } + }, + uriParams: { id: <transferId> } + }, + metadata: { + correlationId: <uuid>, + event: { + type: "bulk-processing", + action: "prepare-duplicate", + createdAt: <timestamp>, + state: { + code: "3106", + status: "error", + description: "Modified request - Individual transfer prepare duplicate" + }, + id: <uuid>, + responseTo: <uuid> + } + } + + + 8 + Publish Processing (failure) event for Payer + Error codes: + 2003 + + [hasDuplicateId == TRUE && hasDuplicateHash == FALSE] + + + break + + + { + id: <messageId> + from: <ledgerName>, + to: <payerFspName>, + type: "application/json", + content: { + headers: <transferHeaders>, + payload: { + errorInformation: { + errorCode: "3106", + errorDescription: "Modified request", + extensionList: { extension: [ { key: "_cause", value: <FSPIOPError> } ] } + } + }, + uriParams: { id: <transferId> } + }, + metadata: { + correlationId: <uuid>, + event: { + type: "bulk-processing", + action: "prepare-duplicate", + createdAt: <timestamp>, + state: { + code: "3106", + status: "error", + description: "Modified request" + }, + id: <uuid>, + responseTo: <uuid> + } + } + + + 9 + Publish Processing (failure) event for Payer + Error codes: + 2003 + + [hasDuplicateId == FALSE] + + + The validation of Payer, Payee can be skipped for individual transfers in Bulk + as they should've/would've been validated already in the bulk prepare part. + However, leaving it here for now, as in the future, this can be leveraged + when bulk transfers to multiple Payees are supported by the Specification. + + + Validate Payer + + + 10 + Request to retrieve Payer Participant details (if it exists) + + + 11 + Request Participant details + + participant + participantCurrency + + + 12 + Return Participant details if it exists + + + 13 + Return Participant details if it exists + + + + + + 14 + Validate Payer + Error codes: + 3202 + + + Validate Payee + + + 15 + Request to retrieve Payee Participant details (if it exists) + + + 16 + Request Participant details + + participant + participantCurrency + + + 17 + Return Participant details if it exists + + + 18 + Return Participant details if it exists + + + + + + 19 + Validate Payee + Error codes: + 3203 + + + alt + [Validate Prepare Transfer (success)] + + + Persist Transfer State (with transferState='RECEIVED-PREPARE') + + + 20 + Request to persist transfer + Error codes: + 2003 + + + 21 + Persist transfer + + transfer + transferParticipant + transferStateChange + transferExtension + ilpPacket + + + 22 + Return success + + [Validate Prepare Transfer (failure)] + + + Persist Transfer State (with transferState='INVALID') (Introducing a new status INVALID to mark these entries) + + + 23 + Request to persist transfer + (when Payee/Payer/crypto-condition validation fails) + Error codes: + 2003 + + + 24 + Persist transfer + + transfer + transferParticipant + transferStateChange + transferExtension + transferError + ilpPacket + + + 25 + Return success + + + alt + [Validate Prepare Transfer (success)] + + + Message: + { + id: <messageId> + from: <payerFspName>, + to: <payeeFspName>, + type: "application/json", + content: { + headers: <transferHeaders>, + payload: <transferMessage> + }, + metadata: { + event: { + id: <uuid>, + responseTo: <previous.uuid>, + type: "position", + action: "bulk-prepare", + createdAt: <timestamp>, + state: { + status: "success", + code: 0, + description:"action successful" + } + } + } + } + + + 26 + Route & Publish Position event for Payer + Error codes: + 2003 + + [Validate Prepare Transfer (failure)] + + + Message: + { + id: <messageId> + from: <ledgerName>, + to: <payerFspName>, + 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: "bulk-processing", + action: "prepare", + createdAt: <timestamp>, + state: { + status: 'error', + code: <errorInformation.errorCode> + description: <errorInformation.errorDescription> + } + } + } + } + + + 27 + Publish Prepare failure event to Bulk Processing Topic (for Payer) + Error codes: + 2003 + diff --git a/docs/technical/technical/central-bulk-transfers/assets/diagrams/sequence/seq-bulk-1.3.0-position-overview.svg b/docs/technical/technical/central-bulk-transfers/assets/diagrams/sequence/seq-bulk-1.3.0-position-overview.svg index a6c1ce04..ee9d9ac7 100644 --- a/docs/technical/technical/central-bulk-transfers/assets/diagrams/sequence/seq-bulk-1.3.0-position-overview.svg +++ b/docs/technical/technical/central-bulk-transfers/assets/diagrams/sequence/seq-bulk-1.3.0-position-overview.svg @@ -1,298 +1,187 @@ - - - - - - - - - - - 1.3.0. Position Handler Consume individual transfers from Bulk - - - - Central Service - - - - - - - - - - - - - - - - - topic-transfer-position - - - - - topic-transfer-position - - - Position Handler - - - - - Position Handler - - - - - - - Event-Topic - - - - - Event-Topic - - - - - Notification-Topic - - - - - Notification-Topic - - - - - - Position Handler Consume - - - - - alt - - - [Consume Prepare message for Payer] - - - - - 1 - - - Consume Position event message for Payer - - - - - break - - - - - Validate Event - - - - - 2 - - - Validate event - Rule: type == 'position' && action == 'bulk-prepare' - - - Error codes: - - - 2001 - - - - - Persist Event Information - - - - - 3 - - - Publish event information - - - - - ref - - - Event Handler Consume - - - - - ref - - - Prepare Position Handler Consume - - - - - 4 - - - Produce message - - - - [Consume Fulfil message for Payee] - - - - - 5 - - - Consume Position event message for Payee - - - - - break - - - - - Validate Event - - - - - 6 - - - Validate event - Rule: type == 'position' && action == 'bulk-commit' - - - Error codes: - - - 2001 - - - - - Persist Event Information - - - - - 7 - - - Publish event information - - - - - ref - - - Event Handler Consume - - - - - ref - - - Fulfil Position Handler Consume - - - - - 8 - - - Produce message - - - - [Consume Abort message] - - - - - 9 - - - Consume Position event message - - - - - break - - - - - Validate Event - - - - - 10 - - - Validate event - Rule: type == 'position' && action == 'timeout-reserved' - - - Error codes: - - - 2001 - - - - - Persist Event Information - - - - - 11 - - - Publish event information - - - - - ref - - - Event Handler Consume - - - - - ref - - - Abort Position Handler Consume - - - - - 12 - - - Produce message - + + 1.3.0. Position Handler Consume individual transfers from Bulk + + + 1.3.0. Position Handler Consume individual transfers from Bulk + + Central Service + + + + + + + + + + + + + + + + + + + + + + topic-transfer-position + + + topic-transfer-position + Position Handler + + + Position Handler + + + + + Event-Topic + + + Event-Topic + + + Notification-Topic + + + Notification-Topic + + + + + + + Position Handler Consume + + + alt + [Consume Prepare message for Payer] + + + 1 + Consume Position event message for Payer + + + break + + + Validate Event + + + + + + 2 + Validate event - Rule: type == 'position' && action == 'bulk-prepare' + Error codes: + 2001 + + + Persist Event Information + + + 3 + Publish event information + + + ref + Event Handler Consume +   + + + ref + Prepare Position Handler Consume +   + + + 4 + Produce message + + [Consume Fulfil message for Payee] + + + 5 + Consume Position event message for Payee + + + break + + + Validate Event + + + + + + 6 + Validate event - Rule: type == 'position' && action == 'bulk-commit' + Error codes: + 2001 + + + Persist Event Information + + + 7 + Publish event information + + + ref + Event Handler Consume +   + + + ref + Fulfil Position Handler Consume +   + + + 8 + Produce message + + [Consume Abort message] + + + 9 + Consume Position event message + + + break + + + Validate Event + + + + + + 10 + Validate event - Rule: type == 'position' && action == 'timeout-reserved' + Error codes: + 2001 + + + Persist Event Information + + + 11 + Publish event information + + + ref + Event Handler Consume +   + + + ref + Abort Position Handler Consume +   + + + 12 + Produce message + diff --git a/docs/technical/technical/central-bulk-transfers/assets/diagrams/sequence/seq-bulk-1.3.1-position-prepare.svg b/docs/technical/technical/central-bulk-transfers/assets/diagrams/sequence/seq-bulk-1.3.1-position-prepare.svg index 1403dc6a..bbf658e1 100644 --- a/docs/technical/technical/central-bulk-transfers/assets/diagrams/sequence/seq-bulk-1.3.1-position-prepare.svg +++ b/docs/technical/technical/central-bulk-transfers/assets/diagrams/sequence/seq-bulk-1.3.1-position-prepare.svg @@ -1,1092 +1,522 @@ - - - - - - - - - - - 1.3.1. Prepare Position Handler Consume (single message, includes individual transfers from Bulk) - - - - Central Service - - - - - - - - - - - - - - Position Handler - - - - - Position Handler - - - - - - - topic- - - - notification - - - - - topic- - - - notification - - - - - topic- - - - bulk-processing - - - - - topic- - - - bulk-processing - - - Position - - - Management - - - Facade - - - - - Position - - - Management - - - Facade - - - - - Position DAO - - - - - Position DAO - - - - - Central Store - - - - - Central Store - - - - - - - - Prepare Position Handler Consume - - - - - 1 - - - Request transfers to be processed - - - - - 2 - - - Check 1st transfer to select the Participant and Currency - - - - - DB TRANSACTION - - - - - 3 - - - Loop through batch and build list of transferIds and calculate sumTransfersInBatch, - - - checking all in Batch are for the correct Paricipant and Currency - - - Error code: - - - 2001, 3100 - - - - - 4 - - - Retrieve current state of all transfers in array from DB with select whereIn - - - (FYI: The two DB transaction model needs to add a mini-state step here (RECEIVED_PREPARE => RECEIVDED_PREPARE_PROCESSING) so that the transfers are left alone if processing has started) - - - - transferStateChange - - - transferParticipant - - - - - 5 - - - Return current state of all selected transfers from DB - - - - - 6 - - - Validate current state (transferStateChange.transferStateId == 'RECEIVED_PREPARE') - - - Error code: - - - 2001 - - - against failing transfers - - - Batch is not rejected as a whole. - - - - - List of transfers used during processing - - - reservedTransfers - - - is list of transfers to be processed in the batch - - - abortedTransfers - - - is the list of transfers in the incorrect state going into the process. Currently the transferStateChange is set to ABORTED - this should only be done if not already in a final state (idempotency) - - - processedTransfers - - - is the list of transfers that have gone through the position management algorithm. Both successful and failed trasnfers appear here as the order and "running position" against each is necessary for reconciliation - - - Scalar intermidate values used in the algorithm - - - transferAmount - - - = payload.amount.amount - - - sumTransfersInBatch - - - = SUM amount against each Transfer in batch - - - currentPosition - - - = participantPosition.value - - - reservedPosition - - - = participantPosition.{original}reservedValue - - - effectivePosition - - - = currentPosition + reservedPosition - - - heldPosition - - - = effectivePosition + sumTransfersInBatch - - - availablePosition - - - = participantLimit(NetDebitCap) - effectivePosition - - - sumReserved - - - = SUM of transfers that have met rule criteria and processed - - - - - Going to reserve the sum of the valid transfers in the batch against the Participants Positon in the Currency of this batch - - - and calculate the available position for the Participant to use - - - - - 7 - - - Select effectivePosition FOR UPDATE from DB for Payer - - - - participantPosition - - - - - 8 - - - Return effectivePosition (currentPosition and reservedPosition) from DB for Payer - - - - - 9 - - - Increment reservedValue to heldPosition - - - (reservedValue = reservedPosition + sumTransfersInBatch) - - - - - 10 - - - Persist reservedValue - - - - UPDATE - - - participantPosition - - - SET reservedValue += sumTransfersInBatch - - - - - 11 - - - Request position limits for Payer Participant - - - - FROM - - - participantLimit - - - WHERE participantLimit.limitTypeId = 'NET-DEBIT-CAP' - - - AND participantLimit.participantId = payload.payerFsp - - - AND participantLimit.currencyId = payload.amount.currency - - - - - 12 - - - Return position limits - - - - - 13 - - - availablePosition - - - = participantLimit(netDebitCap) - effectivePosition (same as = netDebitCap - currentPosition - reservedPosition) - - - - - For each transfer in the batch, validate the availablility of position to meet the transfer amount - - - this will be as per the position algorithm documented below - - - - - 14 - - - Validate availablePosition for each tranfser (see algorithm below) - - - Error code: - - - 4001 - - - - - 01: sumReserved = 0 // Record the sum of the transfers we allow to progress to RESERVED - - - 02: sumProcessed =0 // Record the sum of the transfers already processed in this batch - - - 03: processedTransfers = {} // The list of processed transfers - so that we can store the additional information around the decision. Most importantly the "running" position - - - 04: foreach transfer in reservedTransfers - - - 05: sumProcessed += transfer.amount // the total processed so far - - - (NEED TO UPDATE IN CODE) - - - 06: if availablePosition >= transfer.amount - - - 07: transfer.state = "RESERVED" - - - 08: availablePosition -= preparedTransfer.amount - - - 09: sumRESERVED += preparedTransfer.amount - - - 10: else - - - 11: preparedTransfer.state = "ABORTED" - - - 12: preparedTransfer.reason = "Net Debit Cap exceeded by this request at this time, please try again later" - - - 13: end if - - - 14: runningPosition = currentPosition + sumReserved // the initial value of the Participants position plus the total value that has been accepted in the batch so far - - - 15: runningReservedValue = sumTransfersInBatch - sumProcessed + reservedPosition - - - (NEED TO UPDATE IN CODE) - - - // the running down of the total reserved value at the begining of the batch. - - - 16: Add transfer to the processedTransfer list recording the transfer state and running position and reserved values { transferState, transfer, rawMessage, transferAmount, runningPosition, runningReservedValue } - - - 16: end foreach - - - - - Once the outcome for all transfers is known,update the Participant's position and remove the reserved amount associated with the batch - - - (If there are any alarm limits, process those returning limits in which the threshold has been breached) - - - Do a bulk insert of the trasnferStateChanges associated with processing, using the result to complete the participantPositionChange and bulk insert of these to persist the running position - - - - - 15 - - - Assess any limit thresholds on the final position - - - adding to alarm list if triggered - - - - - 16 - - - Persist latest position - - - value - - - and - - - reservedValue - - - to DB for Payer - - - - UPDATE - - - participantPosition - - - SET value += sumRESERVED, - - - reservedValue -= sumTransfersInBatch - - - - - 17 - - - Bulk persist transferStateChange for all processedTransfers - - - - batch INSERT - - - transferStateChange - - - select for update from transfer table where transferId in ([transferBatch.transferId,...]) - - - build list of transferStateChanges from transferBatch - - - - - 18 - - - Populate batchParticipantPositionChange from the resultant transferStateChange and the earlier processedTransfer list - - - - - Effectively: - - - SET transferStateChangeId = processedTransfer.transferStateChangeId, - - - participantPositionId = preparedTransfer.participantPositionId, - - - value = preparedTransfer.positionValue, - - - reservedValue = preparedTransfer.positionReservedValue - - - - - 19 - - - Bulk persist the participant position change for all processedTransfers - - - - batch INSERT - - - participantPositionChange - - - - - 20 - - - Return a map of transferIds and their transferStateChanges - - - - - alt - - - [Calculate & Validate Latest Position Prepare (success)] - - - - - 21 - - - Notifications for Position Validation Success - - - Reference: Position Validation Success case (Prepare) - - - - [Calculate & Validate Latest Position Prepare (failure)] - - - - - Validation failure! - - - - - Persist Transfer State (with transferState='ABORTED' on position check fail) - - - - - 22 - - - Request to persist transfer - - - Error code: - - - 2003 - - - - - transferStateChange.state = "ABORTED", - - - transferStateChange.reason = "Net Debit Cap exceeded by this request at this time, please try again later" - - - - - 23 - - - Persist transfer state - - - - transferStateChange - - - - - 24 - - - Return success - - - - - 25 - - - Notifications for failures - - - Reference: Failure in Position Validation (Prepare) - - - - - Reference: Failure in Position Validation (Prepare) - - - - - alt - - - [If action == 'bulk-prepare'] - - - - - Message: - - - { - - - id: "<messageId>" - - - from: <ledgerName>, - - - to: <transferMessage.payerFsp>, - - - type: "application/json" - - - content: { - - - headers: <transferHeaders>, - - - payload: { - - - "errorInformation": { - - - "errorCode": 4001, - - - "errorDescription": "Payer FSP insufficient liquidity", - - - "extensionList": <transferMessage.extensionList> - - - } - - - }, - - - metadata: { - - - event: { - - - id: <uuid>, - - - responseTo: <previous.uuid>, - - - type: "bulk-processing", - - - action: "bulk-prepare", - - - createdAt: <timestamp>, - - - state: { - - - status: "error", - - - code: <errorInformation.errorCode> - - - description: <errorInformation.errorDescription> - - - } - - - } - - - } - - - } - - - - - 26 - - - Publish Position failure event (in Prepare) to Bulk Processing Topic (for Payer) - - - Error codes: - - - 2003 - - - - [If action == 'prepare'] - - - - - Message: - - - { - - - id: "<messageId>" - - - from: <ledgerName>, - - - to: <transferMessage.payerFsp>, - - - type: "application/json" - - - content: { - - - headers: <transferHeaders>, - - - payload: { - - - "errorInformation": { - - - "errorCode": 4001, - - - "errorDescription": "Payer FSP insufficient liquidity", - - - "extensionList": <transferMessage.extensionList> - - - } - - - }, - - - metadata: { - - - event: { - - - id: <uuid>, - - - responseTo: <previous.uuid>, - - - type: "notification", - - - action: "position", - - - createdAt: <timestamp>, - - - state: { - - - status: "error", - - - code: <errorInformation.errorCode> - - - description: <errorInformation.errorDescription> - - - } - - - } - - - } - - - } - - - - - 27 - - - Publish Notification (failure) event for Payer - - - Error code: - - - 2003 - - - - - Reference: Position Validation Success case (Prepare) - - - - - alt - - - [If action == 'bulk-prepare'] - - - - - Message: - - - { - - - id: "<messageId>" - - - from: <transferMessage.payerFsp>, - - - to: <transferMessage.payeeFsp>, - - - type: "application/json" - - - content: { - - - headers: <transferHeaders>, - - - payload: <transferMessage> - - - }, - - - metadata: { - - - event: { - - - id: <uuid>, - - - responseTo: <previous.uuid>, - - - type: "bulk-processing", - - - action: "bulk-prepare", - - - createdAt: <timestamp>, - - - state: { - - - status: "success", - - - code: 0 - - - } - - - } - - - } - - - } - - - - - 28 - - - Publish Position Success event (in Prepare) to Bulk Processing Topic - - - Error codes: - - - 2003 - - - - [If action == 'prepare'] - - - - - Message: - - - { - - - id: "<messageId>" - - - from: <transferMessage.payerFsp>, - - - to: <transferMessage.payeeFsp>, - - - type: "application/json" - - - content: { - - - headers: <transferHeaders>, - - - payload: <transferMessage> - - - }, - - - metadata: { - - - event: { - - - id: <uuid>, - - - responseTo: <previous.uuid>, - - - type: "notification", - - - action: "abort", - - - createdAt: <timestamp>, - - - state: { - - - status: "success", - - - code: 0 - - - } - - - } - - - } - - - } - - - - - 29 - - - Publish Notification event - - - Error code: - - - 2003 - + + 1.3.1. Prepare Position Handler Consume (single message, includes individual transfers from Bulk) + + + 1.3.1. Prepare Position Handler Consume (single message, includes individual transfers from Bulk) + + Central Service + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Position Handler + + + Position Handler + + + + + topic- + notification + + + topic- + notification + + + topic- + bulk-processing + + + topic- + bulk-processing + Position + Management + Facade + + + Position + Management + Facade + + + Position DAO + + + Position DAO + + + Central Store + + + Central Store + + + + + + + + + + + + + + + + + + + + Prepare Position Handler Consume + + + 1 + Request transfers to be processed + + + + + 2 + Check 1st transfer to select the Participant and Currency + + + DB TRANSACTION + + + + + 3 + Loop through batch and build list of transferIds and calculate sumTransfersInBatch, + checking all in Batch are for the correct Paricipant and Currency + Error code: + 2001, 3100 + + + 4 + Retrieve current state of all transfers in array from DB with select whereIn + (FYI: The two DB transaction model needs to add a mini-state step here (RECEIVED_PREPARE => RECEIVDED_PREPARE_PROCESSING) so that the transfers are left alone if processing has started) + + transferStateChange + transferParticipant + + + 5 + Return current state of all selected transfers from DB + + + + + + 6 + Validate current state (transferStateChange.transferStateId == 'RECEIVED_PREPARE') + Error code: + 2001 + against failing transfers + Batch is not rejected as a whole. + + + List of transfers used during processing + reservedTransfers + is list of transfers to be processed in the batch + abortedTransfers + is the list of transfers in the incorrect state going into the process. Currently the transferStateChange is set to ABORTED - this should only be done if not already in a final state (idempotency) + processedTransfers + is the list of transfers that have gone through the position management algorithm. Both successful and failed trasnfers appear here as the order and "running position" against each is necessary for reconciliation +   + Scalar intermidate values used in the algorithm + transferAmount + = payload.amount.amount + sumTransfersInBatch + = SUM amount against each Transfer in batch + currentPosition + = participantPosition.value + reservedPosition + = participantPosition.{original}reservedValue + effectivePosition + = currentPosition + reservedPosition + heldPosition + = effectivePosition + sumTransfersInBatch + availablePosition + = participantLimit(NetDebitCap) - effectivePosition + sumReserved + = SUM of transfers that have met rule criteria and processed + + + Going to reserve the sum of the valid transfers in the batch against the Participants Positon in the Currency of this batch + and calculate the available position for the Participant to use + + + 7 + Select effectivePosition FOR UPDATE from DB for Payer + + participantPosition + + + 8 + Return effectivePosition (currentPosition and reservedPosition) from DB for Payer + + + + + 9 + Increment reservedValue to heldPosition + (reservedValue = reservedPosition + sumTransfersInBatch) + + + 10 + Persist reservedValue + + UPDATE + participantPosition + SET reservedValue += sumTransfersInBatch + + + 11 + Request position limits for Payer Participant + + FROM + participantLimit + WHERE participantLimit.limitTypeId = 'NET-DEBIT-CAP' + AND participantLimit.participantId = payload.payerFsp + AND participantLimit.currencyId = payload.amount.currency + + + 12 + Return position limits + + + + + + 13 + availablePosition + = participantLimit(netDebitCap) - effectivePosition (same as = netDebitCap - currentPosition - reservedPosition) + + + For each transfer in the batch, validate the availablility of position to meet the transfer amount + this will be as per the position algorithm documented below + + + + + + 14 + Validate availablePosition for each tranfser (see algorithm below) + Error code: + 4001 + + + 01: sumReserved = 0 // Record the sum of the transfers we allow to progress to RESERVED + 02: sumProcessed =0 // Record the sum of the transfers already processed in this batch + 03: processedTransfers = {} // The list of processed transfers - so that we can store the additional information around the decision. Most importantly the "running" position + 04: foreach transfer in reservedTransfers + 05: sumProcessed += transfer.amount // the total processed so far + (NEED TO UPDATE IN CODE) + 06: if availablePosition >= transfer.amount + 07: transfer.state = "RESERVED" + 08: availablePosition -= preparedTransfer.amount + 09: sumRESERVED += preparedTransfer.amount + 10: else + 11: preparedTransfer.state = "ABORTED" + 12: preparedTransfer.reason = "Net Debit Cap exceeded by this request at this time, please try again later" + 13: end if + 14: runningPosition = currentPosition + sumReserved // the initial value of the Participants position plus the total value that has been accepted in the batch so far + 15: runningReservedValue = sumTransfersInBatch - sumProcessed + reservedPosition + (NEED TO UPDATE IN CODE) + // the running down of the total reserved value at the begining of the batch. + 16: Add transfer to the processedTransfer list recording the transfer state and running position and reserved values { transferState, transfer, rawMessage, transferAmount, runningPosition, runningReservedValue } + 16: end foreach + + + Once the outcome for all transfers is known,update the Participant's position and remove the reserved amount associated with the batch + (If there are any alarm limits, process those returning limits in which the threshold has been breached) + Do a bulk insert of the trasnferStateChanges associated with processing, using the result to complete the participantPositionChange and bulk insert of these to persist the running position + + + + + 15 + Assess any limit thresholds on the final position + adding to alarm list if triggered + + + 16 + Persist latest position + value + and + reservedValue + to DB for Payer + + UPDATE + participantPosition + SET value += sumRESERVED, + reservedValue -= sumTransfersInBatch + + + 17 + Bulk persist transferStateChange for all processedTransfers + + batch INSERT + transferStateChange + select for update from transfer table where transferId in ([transferBatch.transferId,...]) + build list of transferStateChanges from transferBatch +   + + + + + 18 + Populate batchParticipantPositionChange from the resultant transferStateChange and the earlier processedTransfer list + + + Effectively: + SET transferStateChangeId = processedTransfer.transferStateChangeId, + participantPositionId = preparedTransfer.participantPositionId, + value = preparedTransfer.positionValue, + reservedValue = preparedTransfer.positionReservedValue + + + 19 + Bulk persist the participant position change for all processedTransfers + + batch INSERT + participantPositionChange +              + + + 20 + Return a map of transferIds and their transferStateChanges + + + alt + [Calculate & Validate Latest Position Prepare (success)] + + + + + 21 + Notifications for Position Validation Success + Reference: Position Validation Success case (Prepare) + + [Calculate & Validate Latest Position Prepare (failure)] + + + Validation failure! + + + Persist Transfer State (with transferState='ABORTED' on position check fail) + + + 22 + Request to persist transfer + Error code: + 2003 + + + transferStateChange.state = "ABORTED", + transferStateChange.reason = "Net Debit Cap exceeded by this request at this time, please try again later" + + + 23 + Persist transfer state + + transferStateChange + + + 24 + Return success + + + + + 25 + Notifications for failures + Reference: Failure in Position Validation (Prepare) + + + Reference: Failure in Position Validation (Prepare) + + + alt + [If action == 'bulk-prepare'] + + + Message: + { + id: "<messageId>" + from: <ledgerName>, + to: <transferMessage.payerFsp>, + type: "application/json" + content: { + headers: <transferHeaders>, + payload: { + "errorInformation": { + "errorCode": 4001, + "errorDescription": "Payer FSP insufficient liquidity", + "extensionList": <transferMessage.extensionList> + } + }, + metadata: { + event: { + id: <uuid>, + responseTo: <previous.uuid>, + type: "bulk-processing", + action: "bulk-prepare", + createdAt: <timestamp>, + state: { + status: "error", + code: <errorInformation.errorCode> + description: <errorInformation.errorDescription> + } + } + } + } + + + 26 + Publish Position failure event (in Prepare) to Bulk Processing Topic (for Payer) + Error codes: + 2003 + + [If action == 'prepare'] + + + Message: + { + id: "<messageId>" + from: <ledgerName>, + to: <transferMessage.payerFsp>, + type: "application/json" + content: { + headers: <transferHeaders>, + payload: { + "errorInformation": { + "errorCode": 4001, + "errorDescription": "Payer FSP insufficient liquidity", + "extensionList": <transferMessage.extensionList> + } + }, + metadata: { + event: { + id: <uuid>, + responseTo: <previous.uuid>, + type: "notification", + action: "position", + createdAt: <timestamp>, + state: { + status: "error", + code: <errorInformation.errorCode> + description: <errorInformation.errorDescription> + } + } + } + } + + + 27 + Publish Notification (failure) event for Payer + Error code: + 2003 + + + Reference: Position Validation Success case (Prepare) + + + alt + [If action == 'bulk-prepare'] + + + Message: + { + id: "<messageId>" + from: <transferMessage.payerFsp>, + to: <transferMessage.payeeFsp>, + type: "application/json" + content: { + headers: <transferHeaders>, + payload: <transferMessage> + }, + metadata: { + event: { + id: <uuid>, + responseTo: <previous.uuid>, + type: "bulk-processing", + action: "bulk-prepare", + createdAt: <timestamp>, + state: { + status: "success", + code: 0 + } + } + } + } + + + 28 + Publish Position Success event (in Prepare) to Bulk Processing Topic + Error codes: + 2003 + + [If action == 'prepare'] + + + Message: + { + id: "<messageId>" + from: <transferMessage.payerFsp>, + to: <transferMessage.payeeFsp>, + type: "application/json" + content: { + headers: <transferHeaders>, + payload: <transferMessage> + }, + metadata: { + event: { + id: <uuid>, + responseTo: <previous.uuid>, + type: "notification", + action: "abort", + createdAt: <timestamp>, + state: { + status: "success", + code: 0 + } + } + } + } + + + 29 + Publish Notification event + Error code: + 2003 + diff --git a/docs/technical/technical/central-bulk-transfers/assets/diagrams/sequence/seq-bulk-1.4.1-bulk-processing-handler.svg b/docs/technical/technical/central-bulk-transfers/assets/diagrams/sequence/seq-bulk-1.4.1-bulk-processing-handler.svg index d1127684..9d756ff4 100644 --- a/docs/technical/technical/central-bulk-transfers/assets/diagrams/sequence/seq-bulk-1.4.1-bulk-processing-handler.svg +++ b/docs/technical/technical/central-bulk-transfers/assets/diagrams/sequence/seq-bulk-1.4.1-bulk-processing-handler.svg @@ -1,491 +1,468 @@ - - - - - - - - - - + + 1.4.0. Bulk Processing Handler Consume + - 1.4.0. Bulk Processing Handler Consume - - Central Service - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - topic-bulk- - processing - - - topic-bulk- - processing - Bulk Processing - Handler - - - Bulk Processing - Handler - - - - - topic-event - - - topic-event - - - mojaloop- - object-store - ( - MLOS - ) - - - mojaloop- - object-store - ( - MLOS - ) - - - topic-notification - - - topic-notification - Bulk DAO - - - Bulk DAO - - - Central Store - - - Central Store - - - - - - - - - - - - - - - - - - - Bulk Processing Handler Consume - - - 1 - Consume message - - - break - - - Validate Event - - - - - 2 - Validate event - Rule: - type == 'bulk-processing' && action IN - ['prepare-duplicate', 'bulk-prepare', - 'bulk-timeout-received', 'fulfil-duplicate', - 'bulk-commit', 'bulk-timeout-reserved'] - Error codes: - 2001 - - - Persist Event Information - - - 3 - Publish event information - - - ref - Event Handler Consume - - - - Process Message - - - 4 - Retrieve current state of Bulk Transfer - - - 5 - Retrieve current state of Bulk Transfer - - bulkTransfer - bulkTransferStateChange - - - 6 - Return - bulkTransferInfo - - - 7 - Return - bulkTransferInfo - - - Validate Bulk Transfer State - - - Initialize variables - : - let criteriaState - let incompleteBulkState - let completedBulkState - let bulkTransferState - let processingState - let errorCode, errorMessage - let produceNotification = false - - - alt - [bulkTransferInfo.bulkTransferState IN ['RECEIVED', 'PENDING_PREPARE']] - - - criteriaState = 'RECEIVED' - incompleteBulkState = 'PENDING_PREPARE' - completedBulkState = 'ACCEPTED' - - - alt - [action == 'prepare-duplicate' AND state.status == 'error'] - - - processingState = 'RECEIVED_DUPLICATE' - errorCode = payload.errorInformation.errorCode - errorDescription = payload.errorInformation.errorDescription - - [action == 'bulk-prepare' AND state.status == 'error'] - - - processingState = 'RECEIVED_INVALID' - errorCode = payload.errorInformation.errorCode - errorDescription = payload.errorInformation.errorDescription - - [action == 'bulk-prepare' AND state.status == 'success'] - - - processingState = 'ACCEPTED' - - [action IN ['bulk-timeout-received', 'bulk-timeout-reserved']] - - - incompleteBulkState = 'EXPIRING' - completedBulkState = 'COMPLETED' - processingState = 'EXPIRED' - errorCode = payload.errorInformation.errorCode - errorDescription = payload.errorInformation.errorDescription - - [all other actions] - - - throw - ErrorHandler.Factory.createFSPIOPError(INTERNAL_SERVER_ERROR) - - [bulkTransferInfo.bulkTransferState IN ['ACCEPTED']] - - - alt - [action == 'bulk-timeout-reserved'] - - - criteriaState = 'ACCEPTED' - incompleteBulkState = 'EXPIRING' - completedBulkState = 'COMPLETED' - processingState = 'EXPIRED' - - [all other actions] - - - throw - ErrorHandler.Factory.createFSPIOPError(INTERNAL_SERVER_ERROR) - - [bulkTransferInfo.bulkTransferState IN ['PROCESSING', 'PENDING_FULFIL', 'EXPIRING']] - - - criteriaState = 'PROCESSING' - incompleteBulkState = 'PENDING_FULFIL' - completedBulkState = 'COMPLETED' - - - alt - [action == 'fulfil-duplicate'] - - - processingState = 'FULFIL_DUPLICATE' - - [action == 'bulk-commit' AND state.status == 'success'] - - - processingState = 'COMPLETED' - - [action == 'reject' AND state.status == 'success'] - - - processingState = 'REJECTED' - - [action IN ['commit', 'abort'] AND state.status == 'error'] - - - processingState = 'FULFIL_INVALID' - - [action == 'bulk-timeout-reserved'] - - - incompleteBulkState = 'EXPIRING' - completedBulkState = 'COMPLETED' - processingState = 'EXPIRED' - errorCode = payload.errorInformation.errorCode - errorDescription = payload.errorInformation.errorDescription - - [all other actions] - - - throw - ErrorHandler.Factory.createFSPIOPError(INTERNAL_SERVER_ERROR) - - [bulkTransferInfo.bulkTransferState IN ['ABORTING']] - - - alt - [action == 'bulk-abort'] - - - criteriaState = 'ABORTING' - processingState = 'FULFIL_INVALID' - completedBulkState = 'REJECTED' - incompleteBulkState = 'ABORTING' - errorCode = payload.errorInformation.errorCode - errorDescription = payload.errorInformation.errorDescription - - [all other actions] - - - throw - ErrorHandler.Factory.createFSPIOPError(INTERNAL_SERVER_ERROR) - - [all other ['PENDING_INVALID', 'COMPLETED', 'REJECTED', 'INVALID']] - - - throw - ErrorHandler.Factory.createFSPIOPError(INTERNAL_SERVER_ERROR) - - - 8 - Persist individual transfer processing state - - - 9 - Persist individual transfer processing state - -- store errorCode/errorMessage when - state.status == 'error' - - bulkTransferAssociation - - - 10 - Return success - - - 11 - Check previously defined completion criteria - - - 12 - Select EXISTS (LIMIT 1) in criteriaState - - bulkTransferAssociation - - - 13 - Return - existingIndividualTransfer - - - 14 - Return - existingIndividualTransfer - - - alt - [individual transfer exists] - - - bulkTransferState = incompleteBulkState - - [no transfer in criteriaState exists] - - - bulkTransferState = completedBulkState - produceNotification = true - - - 15 - Persist bulkTransferState from previous step - - - 16 - Persist bulkTransferState - - bulkTransferStateChange - - - 17 - Return success - - - alt - [produceNotification == true] - - - 18 - Request to retrieve all bulk transfer and individual transfer results - - - 19 - Get bulkTransferResult - - bulkTransfer - bulkTransferStateChange - bulkTransferAssociation - - - 20 - Return - bulkTransferResult - - - 21 - Return - bulkTransferResult - - - Send Bulk Notification(s) - - - Depending on the action decide where to - send notification: payer, payee OR both - - - 22 - Generate & Persist bulk message to object store: - MLOS.bulkTransferResults - by destination - - - 23 - Return reference to the stored object(s) - MLOS.bulkTransferResults.messageId - - - Message: - { - id: <messageId> - from: <source>, - to: <destination>, - type: "application/json" - content: { - headers: <bulkTransferHeaders>, - payload: { - bulkTransferId: <uuid>, - bulkTransferState: <string> - } - }, - metadata: { - event: { - id: <uuid>, - responseTo: <previous.uuid>, - type: "notification", - action: "bulk-[prepare | commit | abort | processing]", - createdAt: <timestamp>, - state: { - status: state.status, - code: state.code - } - } - } - } - - - 24 - Publish Notification event for Payer/Payee - Error codes: - 2003 - - [produceNotification == false] - - - Do nothing (awaitAllTransfers) + 1.4.0. Bulk Processing Handler Consume + + Central Service + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + topic-bulk- + processing + + + topic-bulk- + processing + Bulk Processing + Handler + + + Bulk Processing + Handler + + + + + topic-event + + + topic-event + + + mojaloop- + object-store + ( + MLOS + ) + + + mojaloop- + object-store + ( + MLOS + ) + + + topic-notification + + + topic-notification + Bulk DAO + + + Bulk DAO + + + Central Store + + + Central Store + + + + + + + + + + + + + + + + + + + Bulk Processing Handler Consume + + + 1 + Consume message + + + break + + + Validate Event + + + + + + 2 + Validate event - Rule: + type == 'bulk-processing' && action IN + ['prepare-duplicate', 'bulk-prepare', + 'bulk-timeout-received', 'fulfil-duplicate', + 'bulk-commit', 'bulk-timeout-reserved'] + Error codes: + 2001 + + + Persist Event Information + + + 3 + Publish event information + + + ref + Event Handler Consume +   + + + Process Message + + + 4 + Retrieve current state of Bulk Transfer + + + 5 + Retrieve current state of Bulk Transfer + + bulkTransfer + bulkTransferStateChange + + + 6 + Return + bulkTransferInfo + + + 7 + Return + bulkTransferInfo + + + Validate Bulk Transfer State + + + Initialize variables + : + let criteriaState + let incompleteBulkState + let completedBulkState + let bulkTransferState + let processingState + let errorCode, errorMessage + let produceNotification = false + + + alt + [bulkTransferInfo.bulkTransferState IN ['RECEIVED', 'PENDING_PREPARE']] + + + criteriaState = 'RECEIVED' + incompleteBulkState = 'PENDING_PREPARE' + completedBulkState = 'ACCEPTED' + + + alt + [action == 'prepare-duplicate' AND state.status == 'error'] + + + processingState = 'RECEIVED_DUPLICATE' + errorCode = payload.errorInformation.errorCode + errorDescription = payload.errorInformation.errorDescription + + [action == 'bulk-prepare' AND state.status == 'error'] + + + processingState = 'RECEIVED_INVALID' + errorCode = payload.errorInformation.errorCode + errorDescription = payload.errorInformation.errorDescription + + [action == 'bulk-prepare' AND state.status == 'success'] + + + processingState = 'ACCEPTED' + + [action IN ['bulk-timeout-received', 'bulk-timeout-reserved']] + + + incompleteBulkState = 'EXPIRING' + completedBulkState = 'COMPLETED' + processingState = 'EXPIRED' + errorCode = payload.errorInformation.errorCode + errorDescription = payload.errorInformation.errorDescription + + [all other actions] + + + throw + ErrorHandler.Factory.createFSPIOPError(INTERNAL_SERVER_ERROR) + + [bulkTransferInfo.bulkTransferState IN ['ACCEPTED']] + + + alt + [action == 'bulk-timeout-reserved'] + + + criteriaState = 'ACCEPTED' + incompleteBulkState = 'EXPIRING' + completedBulkState = 'COMPLETED' + processingState = 'EXPIRED' + + [all other actions] + + + throw + ErrorHandler.Factory.createFSPIOPError(INTERNAL_SERVER_ERROR) + + [bulkTransferInfo.bulkTransferState IN ['PROCESSING', 'PENDING_FULFIL', 'EXPIRING']] + + + criteriaState = 'PROCESSING' + incompleteBulkState = 'PENDING_FULFIL' + completedBulkState = 'COMPLETED' + + + alt + [action == 'fulfil-duplicate'] + + + processingState = 'FULFIL_DUPLICATE' + + [action == 'bulk-commit' AND state.status == 'success'] + + + processingState = 'COMPLETED' + + [action == 'reject' AND state.status == 'success'] + + + processingState = 'REJECTED' + + [action IN ['commit', 'abort'] AND state.status == 'error'] + + + processingState = 'FULFIL_INVALID' + + [action == 'bulk-timeout-reserved'] + + + incompleteBulkState = 'EXPIRING' + completedBulkState = 'COMPLETED' + processingState = 'EXPIRED' + errorCode = payload.errorInformation.errorCode + errorDescription = payload.errorInformation.errorDescription + + [all other actions] + + + throw + ErrorHandler.Factory.createFSPIOPError(INTERNAL_SERVER_ERROR) + + [bulkTransferInfo.bulkTransferState IN ['ABORTING']] + + + alt + [action == 'bulk-abort'] + + + criteriaState = 'ABORTING' + processingState = 'FULFIL_INVALID' + completedBulkState = 'REJECTED' + incompleteBulkState = 'ABORTING' + errorCode = payload.errorInformation.errorCode + errorDescription = payload.errorInformation.errorDescription + + [all other actions] + + + throw + ErrorHandler.Factory.createFSPIOPError(INTERNAL_SERVER_ERROR) + + [all other ['PENDING_INVALID', 'COMPLETED', 'REJECTED', 'INVALID']] + + + throw + ErrorHandler.Factory.createFSPIOPError(INTERNAL_SERVER_ERROR) + + + 8 + Persist individual transfer processing state + + + 9 + Persist individual transfer processing state + -- store errorCode/errorMessage when + state.status == 'error' + + bulkTransferAssociation + + + 10 + Return success + + + 11 + Check previously defined completion criteria + + + 12 + Select EXISTS (LIMIT 1) in criteriaState + + bulkTransferAssociation + + + 13 + Return + existingIndividualTransfer + + + 14 + Return + existingIndividualTransfer + + + alt + [individual transfer exists] + + + bulkTransferState = incompleteBulkState + + [no transfer in criteriaState exists] + + + bulkTransferState = completedBulkState + produceNotification = true + + + 15 + Persist bulkTransferState from previous step + + + 16 + Persist bulkTransferState + + bulkTransferStateChange + + + 17 + Return success + + + alt + [produceNotification == true] + + + 18 + Request to retrieve all bulk transfer and individual transfer results + + + 19 + Get bulkTransferResult + + bulkTransfer + bulkTransferStateChange + bulkTransferAssociation + + + 20 + Return + bulkTransferResult + + + 21 + Return + bulkTransferResult + + + Send Bulk Notification(s) + + + Depending on the action decide where to + send notification: payer, payee OR both + + + 22 + Generate & Persist bulk message to object store: + MLOS.bulkTransferResults + by destination + + + 23 + Return reference to the stored object(s) + MLOS.bulkTransferResults.messageId + + + Message: + { + id: <messageId> + from: <source>, + to: <destination>, + type: "application/json" + content: { + headers: <bulkTransferHeaders>, + payload: { + bulkTransferId: <uuid>, + bulkTransferState: <string> + } + }, + metadata: { + event: { + id: <uuid>, + responseTo: <previous.uuid>, + type: "notification", + action: "bulk-[prepare | commit | abort | processing]", + createdAt: <timestamp>, + state: { + status: state.status, + code: state.code + } + } + } + } + + + 24 + Publish Notification event for Payer/Payee + Error codes: + 2003 + + [produceNotification == false] + + + Do nothing (awaitAllTransfers) diff --git a/docs/technical/technical/central-bulk-transfers/assets/diagrams/sequence/seq-bulk-2.1.0-bulk-fulfil-overview.svg b/docs/technical/technical/central-bulk-transfers/assets/diagrams/sequence/seq-bulk-2.1.0-bulk-fulfil-overview.svg index 49c5eb72..22310960 100644 --- a/docs/technical/technical/central-bulk-transfers/assets/diagrams/sequence/seq-bulk-2.1.0-bulk-fulfil-overview.svg +++ b/docs/technical/technical/central-bulk-transfers/assets/diagrams/sequence/seq-bulk-2.1.0-bulk-fulfil-overview.svg @@ -1,437 +1,429 @@ - - - - - - - - - - + + 2.1.0. DFSP2 sends a Bulk Fulfil Success Transfer request + - 2.1.0. DFSP2 sends a Bulk Fulfil Success Transfer request - - Financial Service Providers - - ML API Adapter Service - - Central Service - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - DFSP1 - Payer - - - DFSP1 - Payer - - - DFSP2 - Payee - - - DFSP2 - Payee - - - ML API Adapter - - - ML API Adapter - - - ML API - Notification Handler - - - ML API - Notification Handler - - - - - mongo- - object-store - - - mongo- - object-store - Central Service API - - - Central Service API - - - - - topic- - bulk-fulfil - - - topic- - bulk-fulfil - Bulk Fulfil - Handler - - - Bulk Fulfil - Handler - - - - - topic- - fulfil - - - topic- - fulfil - Fulfil - Handler - - - Fulfil - Handler - - - - - topic- - transfer-position - - - topic- - transfer-position - Position - Handler - - - Position - Handler - - - - - topic- - bulk-processing - - - topic- - bulk-processing - Bulk Processing - Handler - - - Bulk Processing - Handler - - - - - topic- - notification - - - topic- - notification - - - - - - - - - - - - - - - DFSP2 sends a Bulk Fulfil Success Transfer request to DFSP1 - - - Headers - transferHeaders: { - Content-Length: <int>, - Content-Type: <string>, - Date: <date>, - FSPIOP-Source: <string>, - FSPIOP-Destination: <string>, - FSPIOP-Encryption: <string>, - FSPIOP-Signature: <string>, - FSPIOP-URI: <uri>, - FSPIOP-HTTP-Method: <string> - } - - Payload - bulkTransferMessage: - { - bulkTransferState: <bulkTransferState>, - completedTimestamp: <completedTimeStamp>, - individualTransferResults: - [ - { - transferId: <uuid>, - fulfilment: <ilpCondition>, - extensionList: { extension: [ - { key: <string>, value: <string> } - ] } - } - ], - extensionList: { extension: [ - { key: <string>, value: <string> } - ] } - } - - - - 1 - PUT - /bulkTransfers/<ID> - - - 2 - Persist incoming bulk message to - object store: - MLOS.individualTransferFulfils - - - 3 - Return messageId reference to the stored object(s) - - - Message: - { - id: <messageId>, - from: <payeeFspName>, - to: <payerFspName>, - type: "application/json", - content: { - headers: <bulkTransferHeaders>, - payload: { - bulkTransferId: <uuid>, - bulkTransferState: "COMPLETED", - completedTimestamp: <timestamp>, - extensionList: { extension: [ - { key: <string>, value: <string> } - ] }, - count: <int>, - hash: <string> - } - }, - metadata: { - event: { - id: <uuid>, - type: "bulk-fulfil", - action: "bulk-commit", - createdAt: <timestamp>, - state: { - status: "success", - code: 0 - } - } - } - } - - - 4 - Route & Publish Bulk Fulfil event for Payee - Error code: - 2003 - - - - - 5 - Ensure event is replicated - as configured (ACKS=all) - Error code: - 2003 - - - 6 - Respond replication acknowledgements - have been received - - - - 7 - Respond HTTP - 200 (OK) - - - 8 - Consume message - - - 9 - Retrieve individual transfers by key: - MLOS.individualTransferFulfils.messageId - - - 10 - Stream bulk's individual transfers - - - ref - Bulk Prepare Handler Consume - - - - alt - [Success] - - - 11 - Produce (stream) single transfer message - for each individual transfer [loop] - - [Failure] - - - 12 - Produce single message for the entire bulk - - - 13 - Consume message - - - ref - Fulfil Handler Consume (Success) - - - - alt - [Success] - - - 14 - Produce message - - [Failure] - - - 15 - Produce message - - - 16 - Consume message - - - ref - Position Handler Consume (Success) - - - - 17 - Produce message - - - 18 - Consume message - - - ref - Bulk Processing Handler Consume (Success) - - - - 19 - Persist bulk message by destination to the - object store: - MLOS.bulkTransferResults - - - 20 - Return the reference to the stored - notification object(s): - messageId - - - 21 - Send Bulk Commit notification - - - 22 - Consume message - - - 23 - Retrieve bulk notification(s) by reference & destination: - MLOS.bulkTransferResults.messageId + destination - - - 24 - Return notification payload - - - opt - [action == 'bulk-commit'] - - - ref - Send notification to Participant (Payer) - - - - 25 - Send callback notification - - - 26 - Consume message - - - 27 - Retrieve bulk notification(s) by reference & destination: - MLOS.bulkTransferResults.messageId + destination - - - 28 - Return notification payload - - - opt - [action == 'bulk-commit'] - - - ref - Send notification to Participant (Payee) - - - - 29 - Send callback notification + 2.1.0. DFSP2 sends a Bulk Fulfil Success Transfer request + + Financial Service Providers + + ML API Adapter Service + + Central Service + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + DFSP1 + Payer + + + DFSP1 + Payer + + + DFSP2 + Payee + + + DFSP2 + Payee + + + ML API Adapter + + + ML API Adapter + + + ML API + Notification Handler + + + ML API + Notification Handler + + + + + mongo- + object-store + + + mongo- + object-store + Central Service API + + + Central Service API + + + + + topic- + bulk-fulfil + + + topic- + bulk-fulfil + Bulk Fulfil + Handler + + + Bulk Fulfil + Handler + + + + + topic- + fulfil + + + topic- + fulfil + Fulfil + Handler + + + Fulfil + Handler + + + + + topic- + transfer-position + + + topic- + transfer-position + Position + Handler + + + Position + Handler + + + + + topic- + bulk-processing + + + topic- + bulk-processing + Bulk Processing + Handler + + + Bulk Processing + Handler + + + + + topic- + notification + + + topic- + notification + + + + + + + + + + + + + + + DFSP2 sends a Bulk Fulfil Success Transfer request to DFSP1 + + + Headers - transferHeaders: { + Content-Length: <int>, + Content-Type: <string>, + Date: <date>, + FSPIOP-Source: <string>, + FSPIOP-Destination: <string>, + FSPIOP-Encryption: <string>, + FSPIOP-Signature: <string>, + FSPIOP-URI: <uri>, + FSPIOP-HTTP-Method: <string> + } +   + Payload - bulkTransferMessage: + { + bulkTransferState: <bulkTransferState>, + completedTimestamp: <completedTimeStamp>, + individualTransferResults: + [ + { + transferId: <uuid>, + fulfilment: <ilpCondition>, + extensionList: { extension: [ + { key: <string>, value: <string> } + ] } + } + ], + extensionList: { extension: [ + { key: <string>, value: <string> } + ] } + } + + + + 1 + PUT - /bulkTransfers/<ID> + + + 2 + Persist incoming bulk message to + object store: + MLOS.individualTransferFulfils + + + 3 + Return messageId reference to the stored object(s) + + + Message: + { + id: <messageId>, + from: <payeeFspName>, + to: <payerFspName>, + type: "application/json", + content: { + headers: <bulkTransferHeaders>, + payload: { + bulkTransferId: <uuid>, + bulkTransferState: "COMPLETED", + completedTimestamp: <timestamp>, + extensionList: { extension: [ + { key: <string>, value: <string> } + ] }, + count: <int>, + hash: <string> + } + }, + metadata: { + event: { + id: <uuid>, + type: "bulk-fulfil", + action: "bulk-commit", + createdAt: <timestamp>, + state: { + status: "success", + code: 0 + } + } + } + } + + + 4 + Route & Publish Bulk Fulfil event for Payee + Error code: + 2003 + + + + + + 5 + Ensure event is replicated + as configured (ACKS=all) + Error code: + 2003 + + + 6 + Respond replication acknowledgements + have been received + + + + 7 + Respond HTTP - 200 (OK) + + + 8 + Consume message + + + 9 + Retrieve individual transfers by key: + MLOS.individualTransferFulfils.messageId + + + 10 + Stream bulk's individual transfers + + + ref + Bulk Prepare Handler Consume +   + + + alt + [Success] + + + 11 + Produce (stream) single transfer message + for each individual transfer [loop] + + [Failure] + + + 12 + Produce single message for the entire bulk + + + 13 + Consume message + + + ref + Fulfil Handler Consume (Success) +   + + + alt + [Success] + + + 14 + Produce message + + [Failure] + + + 15 + Produce message + + + 16 + Consume message + + + ref + Position Handler Consume (Success) +   + + + 17 + Produce message + + + 18 + Consume message + + + ref + Bulk Processing Handler Consume (Success) +   + + + 19 + Persist bulk message by destination to the + object store: + MLOS.bulkTransferResults + + + 20 + Return the reference to the stored + notification object(s): + messageId + + + 21 + Send Bulk Commit notification + + + 22 + Consume message + + + 23 + Retrieve bulk notification(s) by reference & destination: + MLOS.bulkTransferResults.messageId + destination + + + 24 + Return notification payload + + + opt + [action == 'bulk-commit'] + + + ref + Send notification to Participant (Payer) +   + + + 25 + Send callback notification + + + 26 + Consume message + + + 27 + Retrieve bulk notification(s) by reference & destination: + MLOS.bulkTransferResults.messageId + destination + + + 28 + Return notification payload + + + opt + [action == 'bulk-commit'] + + + ref + Send notification to Participant (Payee) +   + + + 29 + Send callback notification diff --git a/docs/technical/technical/central-bulk-transfers/assets/diagrams/sequence/seq-bulk-2.1.1-bulk-fulfil-handler.svg b/docs/technical/technical/central-bulk-transfers/assets/diagrams/sequence/seq-bulk-2.1.1-bulk-fulfil-handler.svg index 1a090947..7ab28f05 100644 --- a/docs/technical/technical/central-bulk-transfers/assets/diagrams/sequence/seq-bulk-2.1.1-bulk-fulfil-handler.svg +++ b/docs/technical/technical/central-bulk-transfers/assets/diagrams/sequence/seq-bulk-2.1.1-bulk-fulfil-handler.svg @@ -1,504 +1,496 @@ - - - - - - - - - - + + 2.1.1. Bulk Fulfil Handler Consume + - 2.1.1. Bulk Fulfil Handler Consume - - Central Service - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - mongo- - object-store - - - mongo- - object-store - - - topic-bulk- - fulfil - - - topic-bulk- - fulfil - Bulk Fulfil - Handler - - - Bulk Fulfil - Handler - - - - - topic-transfer- - fulfil - - - topic-transfer- - fulfil - - - topic-bulk- - processing - - - topic-bulk- - processing - - - topic-event - - - topic-event - - - topic-notification - - - topic-notification - Bulk DAO - - - Bulk DAO - - - Central Store - - - Central Store - - - - - - - - - - - - - - - - - - - - - 1 - Consume message - - - break - - - Validate Event - - - - - 2 - Validate event - Rule: - type == 'bulk-fulfil' && action == 'bulk-commit' - Error codes: - 2001 - - - Persist Event Information - - - 3 - Publish event information - - - ref - Event Handler Consume - - - - Validate FSPIOP-Signature - - - ref - Validate message.content.headers. - FSPIOP-Signature - Error codes: - 3105/3106 - - - - Validate Bulk Fulfil Transfer - - - - - 4 - Schema validation of the incoming message - - - - - 5 - Verify the message's signature - (to be confirmed in future requirement) - - - 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. - - - Validate Duplicate Check - - - 6 - Request Duplicate Check - - - ref - Request Duplicate Check - - - - 7 - Return { hasDuplicateId: Boolean, hasDuplicateHash: Boolean } - - - alt - [hasDuplicateId == TRUE && hasDuplicateHash == TRUE] - - - break - - - 8 - Request to retrieve Bulk Transfer state & completedTimestamp - Error code: - 2003 - - - 9 - Query database - - bulkTransfer - bulkTransferFulfilment - bulkTransferStateChange - - - 10 - Return resultset - - - 11 - Return - bulkTransferStateId - & - completedTimestamp - (not null when completed) - - - Message: - { - id: <messageId> - from: <ledgerName>, - to: <payeeFspName>, - type: application/json - content: { - headers: <bulkTransferHeaders>, - payload: { - bulkTransferState: <string>, - completedTimestamp: <optional> - } - }, - metadata: { - event: { - id: <uuid>, - responseTo: <previous.uuid>, - type: "notification", - action: "bulk-fulfil-duplicate", - createdAt: <timestamp>, - state: { - status: "success", - code: 0 - } - } - } - } - - - 12 - Publish Notification event for Payee - - [hasDuplicateId == TRUE && hasDuplicateHash == FALSE] - - - { - id: <messageId>, - from: <ledgerName", - to: <payeeFspName>, - type: "application/json", - content: { - headers: <bulkTransferHeaders>, - payload: { - errorInformation: { - errorCode: "3106", - errorDescription: "Modified request", - extensionList: { - extension: [ - { - key: "_cause", - value: <FSPIOPError> - } - ] - } - }, - uriParams: { - id: <bulkTransferId> - } - } - }, - metadata: { - correlationId: <uuid>, - event: { - id: <uuid>, - type: "notification", - action: "bulk-commit", - createdAt: <timestamp>, - state: { - status: "error", - code: "3106", - description: "Modified request" - }, - responseTo: <uuid> - } - } - } - - - 13 - Publish Notification (failure) event for Payer - Error codes: - 3106 - - [hasDuplicateId == FALSE] - - - alt - [Validate Bulk Transfer Fulfil (success)] - - - Persist Bulk Transfer State (with bulktransferState='PROCESSING') - - - 14 - Request to persist bulk transfer fulfil - Error codes: - 2003 - - - 15 - Persist bulkTransferFulfilment - - bulkTransferFulfilment - bulkTransferStateChange - bulkTransferExtension - - - 16 - Return success - - [Validate Bulk Transfer Fulfil (failure)] - - - Persist Bulk Transfer State (with bulkTransferState='ABORTING') - - - 17 - Request to persist bulk - transfer fulfil failure - Error codes: - 2003 - - - 18 - Persist transfer - - bulkTransferFulfilment - bulkTransferStateChange - bulkTransferExtension - bulkTransferError - - - 19 - Return success - - - alt - [Validate Bulk Transfer Fulfil (success)] - - - loop - [for every individual transfer in the bulk fulfil list] - - - 20 - Retrieve individual transfers from the bulk using - reference: - MLOS.individualTransferFulfils.messageId - - - 21 - Return stored bulk transfer containing individual transfers - - - 22 - Update bulk transfer association record to bulk transfer processing state 'PROCESSING' - - - 23 - Bulk transfer association record commited - - - Message: - { - id: <messageId> - from: <payeeFspName>, - to: <payerFspName>, - type: "application/json" - content: { - headers: <transferHeaders>, - payload: <transferMessage> - }, - metadata: { - event: { - id: <uuid>, - responseTo: <previous.uuid>, - type: "fulfil", - action: "bulk-commit", - createdAt: <timestamp>, - state: { - status: "success", - code: 0 - } - } - } - } - - - 24 - Route & Publish fulfil bulk commit events to the Payer for the Individual Transfer - Error codes: - 2003 - - [Validate Bulk Transfer Fulfil (failure)] - - - loop - [for every individual transfer in the bulk fulfil list] - - - 25 - Retrieve individual transfers from the bulk using - reference: - MLOS.individualTransferFulfils.messageId - - - 26 - Stream bulk's individual transfer fulfils - - - 27 - Update bulk transfer association record to bulk transfer processing state 'ABORTING' - - - 28 - Bulk transfer association record commited - - - Message: - { - id: <messageId> - from: <payeeFspName>, - to: <payerFspName>, - type: "application/json" - content: { - headers: <transferHeaders>, - payload: "errorInformation": { - "errorCode": <possible codes: [3100]> - "errorDescription": "<description>", - } - }, - metadata: { - event: { - id: <uuid>, - responseTo: <previous.uuid>, - type: "fulfil", - action: "bulk-abort", - createdAt: <timestamp>, - state: { - status: "success", - code: 0 - } - } - } - } - - - 29 - Route & Publish fulfil bulk abort events to the Payer for the Individual Transfer - Error codes: - 2003 + 2.1.1. Bulk Fulfil Handler Consume + + Central Service + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + mongo- + object-store + + + mongo- + object-store + + + topic-bulk- + fulfil + + + topic-bulk- + fulfil + Bulk Fulfil + Handler + + + Bulk Fulfil + Handler + + + + + topic-transfer- + fulfil + + + topic-transfer- + fulfil + + + topic-bulk- + processing + + + topic-bulk- + processing + + + topic-event + + + topic-event + + + topic-notification + + + topic-notification + Bulk DAO + + + Bulk DAO + + + Central Store + + + Central Store + + + + + + + + + + + + + + + + + + + + + 1 + Consume message + + + break + + + Validate Event + + + + + + 2 + Validate event - Rule: + type == 'bulk-fulfil' && action == 'bulk-commit' + Error codes: + 2001 + + + Persist Event Information + + + 3 + Publish event information + + + ref + Event Handler Consume +   + + + Validate FSPIOP-Signature + + + ref + Validate message.content.headers. + FSPIOP-Signature + Error codes: + 3105/3106 +   + + + Validate Bulk Fulfil Transfer + + + + + + 4 + Schema validation of the incoming message + + + + + + 5 + Verify the message's signature + (to be confirmed in future requirement) + + + 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. + + + Validate Duplicate Check + + + 6 + Request Duplicate Check + + + ref + Request Duplicate Check +   + + + 7 + Return { hasDuplicateId: Boolean, hasDuplicateHash: Boolean } + + + alt + [hasDuplicateId == TRUE && hasDuplicateHash == TRUE] + + + break + + + 8 + Request to retrieve Bulk Transfer state & completedTimestamp + Error code: + 2003 + + + 9 + Query database + + bulkTransfer + bulkTransferFulfilment + bulkTransferStateChange + + + 10 + Return resultset + + + 11 + Return + bulkTransferStateId + & + completedTimestamp + (not null when completed) + + + Message: + { + id: <messageId> + from: <ledgerName>, + to: <payeeFspName>, + type: application/json + content: { + headers: <bulkTransferHeaders>, + payload: { + bulkTransferState: <string>, + completedTimestamp: <optional> + } + }, + metadata: { + event: { + id: <uuid>, + responseTo: <previous.uuid>, + type: "notification", + action: "bulk-fulfil-duplicate", + createdAt: <timestamp>, + state: { + status: "success", + code: 0 + } + } + } + } + + + 12 + Publish Notification event for Payee + + [hasDuplicateId == TRUE && hasDuplicateHash == FALSE] + + + { + id: <messageId>, + from: <ledgerName", + to: <payeeFspName>, + type: "application/json", + content: { + headers: <bulkTransferHeaders>, + payload: { + errorInformation: { + errorCode: "3106", + errorDescription: "Modified request", + extensionList: { + extension: [ + { + key: "_cause", + value: <FSPIOPError> + } + ] + } + }, + uriParams: { + id: <bulkTransferId> + } + } + }, + metadata: { + correlationId: <uuid>, + event: { + id: <uuid>, + type: "notification", + action: "bulk-commit", + createdAt: <timestamp>, + state: { + status: "error", + code: "3106", + description: "Modified request" + }, + responseTo: <uuid> + } + } + } + + + 13 + Publish Notification (failure) event for Payer + Error codes: + 3106 + + [hasDuplicateId == FALSE] + + + alt + [Validate Bulk Transfer Fulfil (success)] + + + Persist Bulk Transfer State (with bulktransferState='PROCESSING') + + + 14 + Request to persist bulk transfer fulfil + Error codes: + 2003 + + + 15 + Persist bulkTransferFulfilment + + bulkTransferFulfilment + bulkTransferStateChange + bulkTransferExtension + + + 16 + Return success + + [Validate Bulk Transfer Fulfil (failure)] + + + Persist Bulk Transfer State (with bulkTransferState='ABORTING') + + + 17 + Request to persist bulk + transfer fulfil failure + Error codes: + 2003 + + + 18 + Persist transfer + + bulkTransferFulfilment + bulkTransferStateChange + bulkTransferExtension + bulkTransferError + + + 19 + Return success + + + alt + [Validate Bulk Transfer Fulfil (success)] + + + loop + [for every individual transfer in the bulk fulfil list] + + + 20 + Retrieve individual transfers from the bulk using + reference: + MLOS.individualTransferFulfils.messageId + + + 21 + Return stored bulk transfer containing individual transfers + + + 22 + Update bulk transfer association record to bulk transfer processing state 'PROCESSING' + + + 23 + Bulk transfer association record commited + + + Message: + { + id: <messageId> + from: <payeeFspName>, + to: <payerFspName>, + type: "application/json" + content: { + headers: <transferHeaders>, + payload: <transferMessage> + }, + metadata: { + event: { + id: <uuid>, + responseTo: <previous.uuid>, + type: "fulfil", + action: "bulk-commit", + createdAt: <timestamp>, + state: { + status: "success", + code: 0 + } + } + } + } + + + 24 + Route & Publish fulfil bulk commit events to the Payer for the Individual Transfer + Error codes: + 2003 + + [Validate Bulk Transfer Fulfil (failure)] + + + loop + [for every individual transfer in the bulk fulfil list] + + + 25 + Retrieve individual transfers from the bulk using + reference: + MLOS.individualTransferFulfils.messageId + + + 26 + Stream bulk's individual transfer fulfils + + + 27 + Update bulk transfer association record to bulk transfer processing state 'ABORTING' + + + 28 + Bulk transfer association record commited + + + Message: + { + id: <messageId> + from: <payeeFspName>, + to: <payerFspName>, + type: "application/json" + content: { + headers: <transferHeaders>, + payload: "errorInformation": { + "errorCode": <possible codes: [3100]> + "errorDescription": "<description>", + } + }, + metadata: { + event: { + id: <uuid>, + responseTo: <previous.uuid>, + type: "fulfil", + action: "bulk-abort", + createdAt: <timestamp>, + state: { + status: "success", + code: 0 + } + } + } + } + + + 29 + Route & Publish fulfil bulk abort events to the Payer for the Individual Transfer + Error codes: + 2003 diff --git a/docs/technical/technical/central-bulk-transfers/assets/diagrams/sequence/seq-bulk-2.2.1-fulfil-handler-commit.svg b/docs/technical/technical/central-bulk-transfers/assets/diagrams/sequence/seq-bulk-2.2.1-fulfil-handler-commit.svg index b8982497..6dccfb80 100644 --- a/docs/technical/technical/central-bulk-transfers/assets/diagrams/sequence/seq-bulk-2.2.1-fulfil-handler-commit.svg +++ b/docs/technical/technical/central-bulk-transfers/assets/diagrams/sequence/seq-bulk-2.2.1-fulfil-handler-commit.svg @@ -1,726 +1,401 @@ - - - - - - - - - - - 2.2.1. Fulfil Handler Consume (Success) individual transfers from Bulk - - - - Central Service - - - - - - - - - - - - - - - - - - - Fulfil-Topic - - - - - Fulfil-Topic - - - Fulfil Handler - - - - - Fulfil Handler - - - - - - - topic- - - - transfer-position - - - - - topic- - - - transfer-position - - - - - topic- - - - event - - - - - topic- - - - event - - - - - topic- - - - bulk-processing - - - - - topic- - - - bulk-processing - - - - - topic- - - - notification - - - - - topic- - - - notification - - - Position DAO - - - - - Position DAO - - - - - Central Store - - - - - Central Store - - - - - - - - Fulfil Handler Consume (Success) - - - - - 1 - - - Consume Fulfil event message for Payer - - - - - break - - - - - Validate Event - - - - - 2 - - - Validate event - Rule: type == 'fulfil' && action == 'bulk-commit' - - - Error codes: - - - 2001 - - - - - Persist Event Information - - - - - 3 - - - Publish event information - - - - - ref - - - Event Handler Consume - - - - - Validate FSPIOP-Signature - - - - - ref - - - Validate message.content.headers. - - - FSPIOP-Signature - - - Error codes: - - - 3105/3106 - - - - - Validate Duplicate Check - - - - - 4 - - - Request Duplicate Check - - - - - ref - - - Request Duplicate Check - - - - - 5 - - - Return { hasDuplicateId: Boolean, hasDuplicateHash: Boolean } - - - - - alt - - - [hasDuplicateId == TRUE && hasDuplicateHash == TRUE] - - - - - break - - - - - 6 - - - stateRecord = await getTransferState(transferId) - - - - - alt - - - [endStateList.includes(stateRecord.transferStateId)] - - - - - ref - - - getTransfer callback - - - - - 7 - - - Produce message - - - - - - Ignore - resend in progress - - - - [hasDuplicateId == TRUE && hasDuplicateHash == FALSE] - - - - - Validate Prepare Transfer (failure) - Modified Request - - - - [hasDuplicateId == FALSE] - - - - - Validate and persist Transfer Fulfilment - - - - - 8 - - - Request information for the validate checks - - - Error code: - - - 2003 - - - - - 9 - - - Fetch from database - - - - transfer - - - - - 10 - - - - - 11 - - - Return transfer - - - - - 12 - - - Validate that Transfer.ilpCondition = SHA-256 (content.payload.fulfilment) - - - Error code: - - - 2001 - - - - - 13 - - - Validate expirationDate - - - Error code: - - - 3303 - - - - - opt - - - [Transfer.ilpCondition validate successful] - - - - - Request current Settlement Window - - - - - 14 - - - Request to retrieve current/latest transfer settlement window - - - Error code: - - - 2003 - - - - - 15 - - - Fetch settlementWindowId - - - - settlementWindow - - - - - 16 - - - - - 17 - - - Return settlementWindowId to be appended during transferFulfilment insert - - - TODO - - - : During settlement design make sure transfers in 'RECEIVED-FULFIL' - - - state are updated to the next settlement window - - - - - Persist fulfilment - - - - - 18 - - - Persist fulfilment with the result of the above check (transferFulfilment.isValid) - - - Error code: - - - 2003 - - - - - 19 - - - Persist to database - - - - transferFulfilment - - - transferExtension - - - - - 20 - - - Return success - - - - - alt - - - [Transfer.ilpCondition validate successful] - - - - - Persist Transfer State (with transferState='RECEIVED-FULFIL') - - - - - 21 - - - Request to persist transfer state - - - Error code: - - - 2003 - - - - - 22 - - - Persist transfer state - - - - transferStateChange - - - - - 23 - - - Return success - - - - - Message: - - - { - - - id: <messageId>, - - - from: <payeeFspName>, - - - to: <payerFspName>, - - - type: "application/json", - - - content: { - - - headers: <transferHeaders>, - - - payload: <transferMessage> - - - }, - - - metadata: { - - - event: { - - - id: <uuid>, - - - responseTo: <previous.uuid>, - - - type: "position", - - - action: "bulk-commit", - - - createdAt: <timestamp>, - - - state: { - - - status: "success", - - - code: 0 - - - } - - - } - - - } - - - } - - - - - 24 - - - Route & Publish Position event for Payee - - - - [Validate Fulfil Transfer not successful] - - - - - break - - - - - 25 - - - Route & Publish Notification event for Payee - - - Reference: Failure in validation - - - - - Reference: Failure in validation - - - - - Message: - - - { - - - id: <messageId>, - - - from: <ledgerName>, - - - to: <payeeFspName>, - - - type: "application/json", - - - content: { - - - headers: <transferHeaders>, - - - payload: <transferMessage> - - - }, - - - metadata: { - - - event: { - - - id: <uuid>, - - - responseTo: <previous.uuid>, - - - type: "bulk-processing", - - - action: "bulk-commit", - - - createdAt: <timestamp>, - - - state: { - - - status: "error", - - - code: 1 - - - } - - - } - - - } - - - } - - - - - 26 - - - Publish Notification event for Payee to Bulk Processing Topic - - - Error codes: - - - 2003 - + + 2.2.1. Fulfil Handler Consume (Success) individual transfers from Bulk + + + 2.2.1. Fulfil Handler Consume (Success) individual transfers from Bulk + + Central Service + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Fulfil-Topic + + + Fulfil-Topic + Fulfil Handler + + + Fulfil Handler + + + + + topic- + transfer-position + + + topic- + transfer-position + + + topic- + event + + + topic- + event + + + topic- + bulk-processing + + + topic- + bulk-processing + + + topic- + notification + + + topic- + notification + Position DAO + + + Position DAO + + + Central Store + + + Central Store + + + + + + + + + + + + + + + + + Fulfil Handler Consume (Success) + + + 1 + Consume Fulfil event message for Payer + + + break + + + Validate Event + + + + + + 2 + Validate event - Rule: type == 'fulfil' && action == 'bulk-commit' + Error codes: + 2001 + + + Persist Event Information + + + 3 + Publish event information + + + ref + Event Handler Consume +   + + + Validate FSPIOP-Signature + + + ref + Validate message.content.headers. + FSPIOP-Signature + Error codes: + 3105/3106 +   + + + Validate Duplicate Check + + + 4 + Request Duplicate Check + + + ref + Request Duplicate Check +   + + + 5 + Return { hasDuplicateId: Boolean, hasDuplicateHash: Boolean } + + + alt + [hasDuplicateId == TRUE && hasDuplicateHash == TRUE] + + + break + + + + + 6 + stateRecord = await getTransferState(transferId) + + + alt + [endStateList.includes(stateRecord.transferStateId)] + + + ref + getTransfer callback +   + + + 7 + Produce message + + + + Ignore - resend in progress + + [hasDuplicateId == TRUE && hasDuplicateHash == FALSE] + + + Validate Prepare Transfer (failure) - Modified Request + + [hasDuplicateId == FALSE] + + + Validate and persist Transfer Fulfilment + + + 8 + Request information for the validate checks + Error code: + 2003 + + + 9 + Fetch from database + + transfer + + + 10 +   + + + 11 + Return transfer + + + + + 12 + Validate that Transfer.ilpCondition = SHA-256 (content.payload.fulfilment) + Error code: + 2001 + + + + + 13 + Validate expirationDate + Error code: + 3303 + + + opt + [Transfer.ilpCondition validate successful] + + + Request current Settlement Window + + + 14 + Request to retrieve current/latest transfer settlement window + Error code: + 2003 + + + 15 + Fetch settlementWindowId + + settlementWindow + + + 16 +   + + + 17 + Return settlementWindowId to be appended during transferFulfilment insert + TODO + : During settlement design make sure transfers in 'RECEIVED-FULFIL' + state are updated to the next settlement window + + + Persist fulfilment + + + 18 + Persist fulfilment with the result of the above check (transferFulfilment.isValid) + Error code: + 2003 + + + 19 + Persist to database + + transferFulfilment + transferExtension + + + 20 + Return success + + + alt + [Transfer.ilpCondition validate successful] + + + Persist Transfer State (with transferState='RECEIVED-FULFIL') + + + 21 + Request to persist transfer state + Error code: + 2003 + + + 22 + Persist transfer state + + transferStateChange + + + 23 + Return success + + + Message: + { + id: <messageId>, + from: <payeeFspName>, + to: <payerFspName>, + type: "application/json", + content: { + headers: <transferHeaders>, + payload: <transferMessage> + }, + metadata: { + event: { + id: <uuid>, + responseTo: <previous.uuid>, + type: "position", + action: "bulk-commit", + createdAt: <timestamp>, + state: { + status: "success", + code: 0 + } + } + } + } + + + 24 + Route & Publish Position event for Payee + + [Validate Fulfil Transfer not successful] + + + break + + + + + 25 + Route & Publish Notification event for Payee + Reference: Failure in validation + + + Reference: Failure in validation + + + Message: + { + id: <messageId>, + from: <ledgerName>, + to: <payeeFspName>, + type: "application/json", + content: { + headers: <transferHeaders>, + payload: <transferMessage> + }, + metadata: { + event: { + id: <uuid>, + responseTo: <previous.uuid>, + type: "bulk-processing", + action: "bulk-commit", + createdAt: <timestamp>, + state: { + status: "error", + code: 1 + } + } + } + } + + + 26 + Publish Notification event for Payee to Bulk Processing Topic + Error codes: + 2003 + diff --git a/docs/technical/technical/central-bulk-transfers/assets/diagrams/sequence/seq-bulk-2.2.2-fulfil-handler-abort.svg b/docs/technical/technical/central-bulk-transfers/assets/diagrams/sequence/seq-bulk-2.2.2-fulfil-handler-abort.svg index 1b64285d..6cb06df4 100644 --- a/docs/technical/technical/central-bulk-transfers/assets/diagrams/sequence/seq-bulk-2.2.2-fulfil-handler-abort.svg +++ b/docs/technical/technical/central-bulk-transfers/assets/diagrams/sequence/seq-bulk-2.2.2-fulfil-handler-abort.svg @@ -1,1975 +1,949 @@ - - - - - - - - - - - 2.2.2. Fulfil Handler Consume (Reject/Abort) (single message, includes individual transfers from Bulk) - - - - Central Service - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - topic- - - - fulfil - - - - - topic- - - - fulfil - - - Fulfil Handler - - - - - Fulfil Handler - - - - - - - topic- - - - transfer-position - - - - - topic- - - - transfer-position - - - - - topic- - - - event - - - - - topic- - - - event - - - - - topic- - - - bulk-processing - - - - - topic- - - - bulk-processing - - - - - topic- - - - notification - - - - - topic- - - - notification - - - Transfer DAO - - - - - Transfer DAO - - - - - Central Store - - - - - Central Store - - - - - - - - - Fulfil Handler Consume (Failure) - - - - - alt - - - [Consume Single Message] - - - - - 1 - - - Consume Fulfil event message for Payer - - - - - break - - - - - Validate Event - - - - - 2 - - - Validate event - Rule: type IN ['fulfil','bulk-fulfil'] && ( action IN ['reject','abort'] ) - - - Error codes: - - - 2001 - - - - - Persist Event Information - - - - - 3 - - - Publish event information - - - - - ref - - - Event Handler Consume - - - - - Validate FSPIOP-Signature - - - - - ref - - - Validate message.content.headers. - - - FSPIOP-Signature - - - Error codes: - - - 2001 - - - - - Validate Transfer Fulfil Duplicate Check - - - - - 4 - - - Generate transferFulfilmentId uuid - - - - - 5 - - - Request to retrieve transfer fulfilment hashes by transferId - - - Error code: - - - 2003 - - - - - 6 - - - Request Transfer fulfilment - - - duplicate message hashes - - - - SELET transferId, hash - - - FROM - - - transferFulfilmentDuplicateCheck - - - WHERE transferId = request.params.id - - - - - 7 - - - Return existing hashes - - - - - 8 - - - Return (list of) transfer fulfil messages hash(es) - - - - - 9 - - - Loop the list of returned hashes & compare - - - each entry with the calculated message hash - - - - - alt - - - [Hash matched] - - - - - 10 - - - Request to retrieve Transfer Fulfilment & Transfer state - - - Error code: - - - 2003 - - - - - 11 - - - Request to retrieve - - - transferFulfilment & transferState - - - - transferFulfilment - - - transferStateChange - - - - - 12 - - - Return transferFulfilment & - - - transferState - - - - - 13 - - - Return Transfer Fulfilment & Transfer state - - - - - alt - - - [transferFulfilment.isValid == 0] - - - - - break - - - - - alt - - - [If type == 'fulfil'] - - - - - Message: - - - { - - - id: <ID>, - - - from: <transferHeaders.FSPIOP-Source>, - - - to: <transferHeaders.FSPIOP-Destination>, - - - type: application/json, - - - content: { - - - headers: <transferHeaders>, - - - payload: <transferMessage> - - - }, - - - metadata: { - - - event: { - - - id: <uuid>, - - - responseTo: <previous.uuid>, - - - type: notification, - - - action: fulfil-duplicate, - - - createdAt: <timestamp>, - - - state: { - - - status: "error", - - - code: 1 - - - } - - - } - - - } - - - } - - - - - 14 - - - Publish Notification event for Payee - Modified Request - - - Error codes: - - - 3106 - - - - [If type == 'bulk-fulfil'] - - - - - Message: - - - { - - - id: <ID>, - - - from: <transferHeaders.FSPIOP-Source>, - - - to: <transferHeaders.FSPIOP-Destination>, - - - type: application/json, - - - content: { - - - headers: <transferHeaders>, - - - payload: <transferMessage> - - - }, - - - metadata: { - - - event: { - - - id: <uuid>, - - - responseTo: <previous.uuid>, - - - type: bulk-processing, - - - action: fulfil-duplicate, - - - createdAt: <timestamp>, - - - state: { - - - status: "error", - - - code: 1 - - - } - - - } - - - } - - - } - - - - - 15 - - - Publish Notification event for Payee - Modified Request - - - 3106 to Bulk Processing Topic - - - Error codes: - - - 3106 - - - - [transferState IN ['COMMITTED', 'ABORTED']] - - - - - break - - - - - alt - - - [If type == 'fulfil'] - - - - - ref - - - Send notification to Participant (Payee) - - - - [If type == 'bulk-fulfil'] - - - - - Message: - - - { - - - id: <ID>, - - - from: <transferHeaders.FSPIOP-Source>, - - - to: <transferHeaders.FSPIOP-Destination>, - - - type: application/json, - - - content: { - - - headers: <transferHeaders>, - - - payload: <transferMessage> - - - }, - - - metadata: { - - - event: { - - - id: <uuid>, - - - responseTo: <previous.uuid>, - - - type: bulk-processing, - - - action: fulfil-duplicate, - - - createdAt: <timestamp>, - - - state: { - - - status: "success", - - - code: 0 - - - } - - - } - - - } - - - } - - - - - 16 - - - Publish Notification event for Payee to Bulk Processing Topic - - - Error codes: - - - 2003 - - - - [transferState NOT 'RESERVED'] - - - - - break - - - - - 17 - - - Reference: Failure in validation - - - Error code: - - - 2001 - - - - - - break - - - - - alt - - - [If type == 'fulfil'] - - - - - 18 - - - Allow previous request to complete - - - - [If type == 'bulk-fulfil'] - - - - - Message: - - - { - - - id: <ID>, - - - from: <transferHeaders.FSPIOP-Source>, - - - to: <transferHeaders.FSPIOP-Destination>, - - - type: application/json, - - - content: { - - - headers: <transferHeaders>, - - - payload: <transferMessage> - - - }, - - - metadata: { - - - event: { - - - id: <uuid>, - - - responseTo: <previous.uuid>, - - - type: bulk-processing, - - - action: fulfil-duplicate, - - - createdAt: <timestamp>, - - - state: { - - - status: "success", - - - code: 0 - - - } - - - } - - - } - - - } - - - - - 19 - - - Publish Notification event for Payee to Bulk Processing Topic - - - Error codes: - - - 2003 - - - - [Hash not matched] - - - - - 20 - - - Request to persist transfer hash - - - Error codes: - - - 2003 - - - - - 21 - - - Persist hash - - - - transferFulfilmentDuplicateCheck - - - - - 22 - - - Return success - - - - - alt - - - [action=='reject' call made on PUT /transfers/{ID}] - - - - - 23 - - - Request information for the validate checks - - - Error code: - - - 2003 - - - - - 24 - - - Fetch from database - - - - transfer - - - - - 25 - - - - - 26 - - - Return transfer - - - - - alt - - - [Fulfilment present in the PUT /transfers/{ID} message] - - - - - 27 - - - Validate that Transfer.ilpCondition = SHA-256 (content.payload.fulfilment) - - - Error code: - - - 2001 - - - - - Persist fulfilment - - - - - 28 - - - Persist fulfilment with the result of the above check (transferFulfilment.isValid) - - - Error code: - - - 2003 - - - - - 29 - - - Persist to database - - - - transferFulfilment - - - transferExtension - - - - - 30 - - - Return success - - - - [Fulfilment NOT present in the PUT /transfers/{ID} message] - - - - - 31 - - - Validate that transfer fulfilment message to Abort is valid - - - Error code: - - - 2001 - - - - - Persist extensions - - - - - 32 - - - Persist extensionList elements - - - Error code: - - - 2003 - - - - - 33 - - - Persist to database - - - - transferExtension - - - - - 34 - - - Return success - - - - - alt - - - [Transfer.ilpCondition validate successful OR generic validation successful] - - - - - Persist Transfer State (with transferState='RECEIVED_REJECT') - - - - - 35 - - - Request to persist transfer state - - - Error code: - - - 2003 - - - - - 36 - - - Persist transfer state - - - - transferStateChange - - - - - 37 - - - Return success - - - - - 38 - - - Route & Publish Position event for Payer - - - Reference: Publish Position Reject event for Payer - - - - [Validate Fulfil Transfer not successful or Generic validation failed] - - - - - break - - - - - 39 - - - Publish event for Payee - - - Reference: Failure in validation - - - - [action=='abort' Error callback] - - - - - alt - - - [Validation successful] - - - - - Persist Transfer State (with transferState='RECEIVED_ERROR') - - - - - 40 - - - Request to persist transfer state & Error - - - Error code: - - - 2003 - - - - - 41 - - - Persist transfer state & Error - - - - transferStateChange - - - transferError - - - transferExtension - - - - - 42 - - - Return success - - - - - 43 - - - Error callback validated - - - Reference: Produce message for validated error callback - - - - [Validate Transfer Error Message not successful] - - - - - break - - - - - 44 - - - Notifications for failures - - - Reference: Validate Transfer Error Message not successful - - - - [Consume Batch Messages] - - - - - To be delivered by future story - - - - - Reference: Validate Transfer Error Message not successful - - - - - alt - - - [If type == 'bulk-fulfil'] - - - - - Message: - - - { - - - id: <ID>, - - - from: <transferHeaders.FSPIOP-Source>, - - - to: <transferHeaders.FSPIOP-Destination>, - - - type: application/json, - - - content: { - - - headers: <transferHeaders>, - - - payload: <transferMessage> - - - }, - - - metadata: { - - - event: { - - - id: <uuid>, - - - responseTo: <previous.uuid>, - - - type: bulk-processing, - - - action: abort, - - - createdAt: <timestamp>, - - - state: { - - - status: "error", - - - code: 1 - - - } - - - } - - - } - - - } - - - - - 45 - - - Publish Processing event for Payee to Bulk Processing Topic - - - Error codes: - - - 2003 - - - - [If type == 'fulfil'] - - - - - Message: - - - { - - - id: <ID>, - - - from: <transferHeaders.FSPIOP-Source>, - - - to: <transferHeaders.FSPIOP-Destination>, - - - type: application/json, - - - content: { - - - headers: <transferHeaders>, - - - payload: <transferMessage> - - - }, - - - metadata: { - - - event: { - - - id: <uuid>, - - - responseTo: <previous.uuid>, - - - type: fulfil, - - - action: abort, - - - createdAt: <timestamp>, - - - state: { - - - status: "error", - - - code: 1 - - - } - - - } - - - } - - - } - - - - - 46 - - - Route & Publish Notification event for Payee - - - - - Reference: Produce message for validated error callback - - - - - alt - - - [If type == 'bulk-fulfil'] - - - - - Message: - - - { - - - id: <ID>, - - - from: <transferHeaders.FSPIOP-Source>, - - - to: <transferHeaders.FSPIOP-Destination>, - - - type: application/json, - - - content: { - - - headers: <transferHeaders>, - - - payload: <transferMessage> - - - }, - - - metadata: { - - - event: { - - - id: <uuid>, - - - responseTo: <previous.uuid>, - - - type: bulk-position, - - - action: abort, - - - createdAt: <timestamp>, - - - state: { - - - status: "success", - - - code: 0 - - - } - - - } - - - } - - - } - - - - - 47 - - - Route & Publish Position event for Payer - - - - [If type == 'fulfil'] - - - - - Message: - - - { - - - id: <ID>, - - - from: <transferHeaders.FSPIOP-Source>, - - - to: <transferHeaders.FSPIOP-Destination>, - - - type: application/json, - - - content: { - - - headers: <transferHeaders>, - - - payload: <transferMessage> - - - }, - - - metadata: { - - - event: { - - - id: <uuid>, - - - responseTo: <previous.uuid>, - - - type: position, - - - action: abort, - - - createdAt: <timestamp>, - - - state: { - - - status: "success", - - - code: 0 - - - } - - - } - - - } - - - } - - - - - 48 - - - Route & Publish Position event for Payer - - - - - Reference: Failure in validation - - - - - alt - - - [If type == 'bulk-fulfil'] - - - - - Message: - - - { - - - id: <ID>, - - - from: <transferHeaders.FSPIOP-Source>, - - - to: <transferHeaders.FSPIOP-Destination>, - - - type: application/json, - - - content: { - - - headers: <transferHeaders>, - - - payload: <transferMessage> - - - }, - - - metadata: { - - - event: { - - - id: <uuid>, - - - responseTo: <previous.uuid>, - - - type: bulk-processing, - - - action: reject, - - - createdAt: <timestamp>, - - - state: { - - - status: "error", - - - code: 1 - - - } - - - } - - - } - - - } - - - - - 49 - - - Publish processing event to the Bulk Processing Topic - - - Error codes: - - - 2003 - - - - [If type == 'fulfil'] - - - - - Message: - - - { - - - id: <ID>, - - - from: <transferHeaders.FSPIOP-Source>, - - - to: <transferHeaders.FSPIOP-Destination>, - - - type: application/json, - - - content: { - - - headers: <transferHeaders>, - - - payload: <transferMessage> - - - }, - - - metadata: { - - - event: { - - - id: <uuid>, - - - responseTo: <previous.uuid>, - - - type: fulfil, - - - action: reject, - - - createdAt: <timestamp>, - - - state: { - - - status: "error", - - - code: 1 - - - } - - - } - - - } - - - } - - - - - 50 - - - Route & Publish Notification event for Payee - - - - - Reference: Publish Position Reject event for Payer - - - - - alt - - - [If type == 'bulk-fulfil'] - - - - - Message: - - - { - - - id: <ID>, - - - from: <transferHeaders.FSPIOP-Source>, - - - to: <transferHeaders.FSPIOP-Destination>, - - - type: application/json, - - - content: { - - - headers: <transferHeaders>, - - - payload: <transferMessage> - - - }, - - - metadata: { - - - event: { - - - id: <uuid>, - - - responseTo: <previous.uuid>, - - - type: bulk-position, - - - action: reject, - - - createdAt: <timestamp>, - - - state: { - - - status: "success", - - - code: 0 - - - } - - - } - - - } - - - } - - - - - 51 - - - Route & Publish Position event for Payer - - - - [If type == 'fulfil'] - - - - - Message: - - - { - - - id: <ID>, - - - from: <transferHeaders.FSPIOP-Source>, - - - to: <transferHeaders.FSPIOP-Destination>, - - - type: application/json, - - - content: { - - - headers: <transferHeaders>, - - - payload: <transferMessage> - - - }, - - - metadata: { - - - event: { - - - id: <uuid>, - - - responseTo: <previous.uuid>, - - - type: position, - - - action: reject, - - - createdAt: <timestamp>, - - - state: { - - - status: "success", - - - code: 0 - - - } - - - } - - - } - - - } - - - - - 52 - - - Route & Publish Position event for Payer - + + 2.2.2. Fulfil Handler Consume (Reject/Abort) (single message, includes individual transfers from Bulk) + + + 2.2.2. Fulfil Handler Consume (Reject/Abort) (single message, includes individual transfers from Bulk) + + Central Service + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + topic- + fulfil + + + topic- + fulfil + Fulfil Handler + + + Fulfil Handler + + + + + topic- + transfer-position + + + topic- + transfer-position + + + topic- + event + + + topic- + event + + + topic- + bulk-processing + + + topic- + bulk-processing + + + topic- + notification + + + topic- + notification + Transfer DAO + + + Transfer DAO + + + Central Store + + + Central Store + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Fulfil Handler Consume (Failure) + + + alt + [Consume Single Message] + + + 1 + Consume Fulfil event message for Payer + + + break + + + Validate Event + + + + + + 2 + Validate event - Rule: type IN ['fulfil','bulk-fulfil'] && ( action IN ['reject','abort'] ) + Error codes: + 2001 + + + Persist Event Information + + + 3 + Publish event information + + + ref + Event Handler Consume +   + + + Validate FSPIOP-Signature + + + ref + Validate message.content.headers. + FSPIOP-Signature + Error codes: + 2001 + + + Validate Transfer Fulfil Duplicate Check + + + + + 4 + Generate transferFulfilmentId uuid + + + 5 + Request to retrieve transfer fulfilment hashes by transferId + Error code: + 2003 + + + 6 + Request Transfer fulfilment + duplicate message hashes + + SELET transferId, hash + FROM + transferFulfilmentDuplicateCheck + WHERE transferId = request.params.id + + + 7 + Return existing hashes + + + 8 + Return (list of) transfer fulfil messages hash(es) + + + + + 9 + Loop the list of returned hashes & compare + each entry with the calculated message hash + + + alt + [Hash matched] + + + 10 + Request to retrieve Transfer Fulfilment & Transfer state + Error code: + 2003 + + + 11 + Request to retrieve + transferFulfilment & transferState + + transferFulfilment + transferStateChange + + + 12 + Return transferFulfilment & + transferState + + + 13 + Return Transfer Fulfilment & Transfer state + + + alt + [transferFulfilment.isValid == 0] + + + break + + + alt + [If type == 'fulfil'] + + + Message: + { + id: <ID>, + from: <transferHeaders.FSPIOP-Source>, + to: <transferHeaders.FSPIOP-Destination>, + type: application/json, + content: { + headers: <transferHeaders>, + payload: <transferMessage> + }, + metadata: { + event: { + id: <uuid>, + responseTo: <previous.uuid>, + type: notification, + action: fulfil-duplicate, + createdAt: <timestamp>, + state: { + status: "error", + code: 1 + } + } + } + } + + + 14 + Publish Notification event for Payee - Modified Request + Error codes: + 3106 + + [If type == 'bulk-fulfil'] + + + Message: + { + id: <ID>, + from: <transferHeaders.FSPIOP-Source>, + to: <transferHeaders.FSPIOP-Destination>, + type: application/json, + content: { + headers: <transferHeaders>, + payload: <transferMessage> + }, + metadata: { + event: { + id: <uuid>, + responseTo: <previous.uuid>, + type: bulk-processing, + action: fulfil-duplicate, + createdAt: <timestamp>, + state: { + status: "error", + code: 1 + } + } + } + } + + + 15 + Publish Notification event for Payee - Modified Request + 3106 to Bulk Processing Topic + Error codes: + 3106 + + [transferState IN ['COMMITTED', 'ABORTED']] + + + break + + + alt + [If type == 'fulfil'] + + + ref + Send notification to Participant (Payee) +   + + [If type == 'bulk-fulfil'] + + + Message: + { + id: <ID>, + from: <transferHeaders.FSPIOP-Source>, + to: <transferHeaders.FSPIOP-Destination>, + type: application/json, + content: { + headers: <transferHeaders>, + payload: <transferMessage> + }, + metadata: { + event: { + id: <uuid>, + responseTo: <previous.uuid>, + type: bulk-processing, + action: fulfil-duplicate, + createdAt: <timestamp>, + state: { + status: "success", + code: 0 + } + } + } + } + + + 16 + Publish Notification event for Payee to Bulk Processing Topic + Error codes: + 2003 + + [transferState NOT 'RESERVED'] + + + break + + + + + + 17 + Reference: Failure in validation + Error code: + 2001 + + + + break + + + alt + [If type == 'fulfil'] + + + + + + 18 + Allow previous request to complete + + [If type == 'bulk-fulfil'] + + + Message: + { + id: <ID>, + from: <transferHeaders.FSPIOP-Source>, + to: <transferHeaders.FSPIOP-Destination>, + type: application/json, + content: { + headers: <transferHeaders>, + payload: <transferMessage> + }, + metadata: { + event: { + id: <uuid>, + responseTo: <previous.uuid>, + type: bulk-processing, + action: fulfil-duplicate, + createdAt: <timestamp>, + state: { + status: "success", + code: 0 + } + } + } + } + + + 19 + Publish Notification event for Payee to Bulk Processing Topic + Error codes: + 2003 + + [Hash not matched] + + + 20 + Request to persist transfer hash + Error codes: + 2003 + + + 21 + Persist hash + + transferFulfilmentDuplicateCheck + + + 22 + Return success + + + alt + [action=='reject' call made on PUT /transfers/{ID}] + + + 23 + Request information for the validate checks + Error code: + 2003 + + + 24 + Fetch from database + + transfer + + + 25 +   + + + 26 + Return transfer + + + alt + [Fulfilment present in the PUT /transfers/{ID} message] + + + + + 27 + Validate that Transfer.ilpCondition = SHA-256 (content.payload.fulfilment) + Error code: + 2001 + + + Persist fulfilment + + + 28 + Persist fulfilment with the result of the above check (transferFulfilment.isValid) + Error code: + 2003 + + + 29 + Persist to database + + transferFulfilment + transferExtension + + + 30 + Return success + + [Fulfilment NOT present in the PUT /transfers/{ID} message] + + + + + 31 + Validate that transfer fulfilment message to Abort is valid + Error code: + 2001 + + + Persist extensions + + + 32 + Persist extensionList elements + Error code: + 2003 + + + 33 + Persist to database + + transferExtension + + + 34 + Return success + + + alt + [Transfer.ilpCondition validate successful OR generic validation successful] + + + Persist Transfer State (with transferState='RECEIVED_REJECT') + + + 35 + Request to persist transfer state + Error code: + 2003 + + + 36 + Persist transfer state + + transferStateChange + + + 37 + Return success + + + + + 38 + Route & Publish Position event for Payer + Reference: Publish Position Reject event for Payer + + [Validate Fulfil Transfer not successful or Generic validation failed] + + + break + + + + + 39 + Publish event for Payee + Reference: Failure in validation + + [action=='abort' Error callback] + + + alt + [Validation successful] + + + Persist Transfer State (with transferState='RECEIVED_ERROR') + + + 40 + Request to persist transfer state & Error + Error code: + 2003 + + + 41 + Persist transfer state & Error + + transferStateChange + transferError + transferExtension + + + 42 + Return success + + + + + 43 + Error callback validated + Reference: Produce message for validated error callback + + [Validate Transfer Error Message not successful] + + + break + + + + + 44 + Notifications for failures + Reference: Validate Transfer Error Message not successful + + [Consume Batch Messages] + + + To be delivered by future story + + + Reference: Validate Transfer Error Message not successful + + + alt + [If type == 'bulk-fulfil'] + + + Message: + { + id: <ID>, + from: <transferHeaders.FSPIOP-Source>, + to: <transferHeaders.FSPIOP-Destination>, + type: application/json, + content: { + headers: <transferHeaders>, + payload: <transferMessage> + }, + metadata: { + event: { + id: <uuid>, + responseTo: <previous.uuid>, + type: bulk-processing, + action: abort, + createdAt: <timestamp>, + state: { + status: "error", + code: 1 + } + } + } + } + + + 45 + Publish Processing event for Payee to Bulk Processing Topic + Error codes: + 2003 + + [If type == 'fulfil'] + + + Message: + { + id: <ID>, + from: <transferHeaders.FSPIOP-Source>, + to: <transferHeaders.FSPIOP-Destination>, + type: application/json, + content: { + headers: <transferHeaders>, + payload: <transferMessage> + }, + metadata: { + event: { + id: <uuid>, + responseTo: <previous.uuid>, + type: fulfil, + action: abort, + createdAt: <timestamp>, + state: { + status: "error", + code: 1 + } + } + } + } + + + 46 + Route & Publish Notification event for Payee + + + Reference: Produce message for validated error callback + + + alt + [If type == 'bulk-fulfil'] + + + Message: + { + id: <ID>, + from: <transferHeaders.FSPIOP-Source>, + to: <transferHeaders.FSPIOP-Destination>, + type: application/json, + content: { + headers: <transferHeaders>, + payload: <transferMessage> + }, + metadata: { + event: { + id: <uuid>, + responseTo: <previous.uuid>, + type: bulk-position, + action: abort, + createdAt: <timestamp>, + state: { + status: "success", + code: 0 + } + } + } + } + + + 47 + Route & Publish Position event for Payer + + [If type == 'fulfil'] + + + Message: + { + id: <ID>, + from: <transferHeaders.FSPIOP-Source>, + to: <transferHeaders.FSPIOP-Destination>, + type: application/json, + content: { + headers: <transferHeaders>, + payload: <transferMessage> + }, + metadata: { + event: { + id: <uuid>, + responseTo: <previous.uuid>, + type: position, + action: abort, + createdAt: <timestamp>, + state: { + status: "success", + code: 0 + } + } + } + } + + + 48 + Route & Publish Position event for Payer + + + Reference: Failure in validation + + + alt + [If type == 'bulk-fulfil'] + + + Message: + { + id: <ID>, + from: <transferHeaders.FSPIOP-Source>, + to: <transferHeaders.FSPIOP-Destination>, + type: application/json, + content: { + headers: <transferHeaders>, + payload: <transferMessage> + }, + metadata: { + event: { + id: <uuid>, + responseTo: <previous.uuid>, + type: bulk-processing, + action: reject, + createdAt: <timestamp>, + state: { + status: "error", + code: 1 + } + } + } + } + + + 49 + Publish processing event to the Bulk Processing Topic + Error codes: + 2003 + + [If type == 'fulfil'] + + + Message: + { + id: <ID>, + from: <transferHeaders.FSPIOP-Source>, + to: <transferHeaders.FSPIOP-Destination>, + type: application/json, + content: { + headers: <transferHeaders>, + payload: <transferMessage> + }, + metadata: { + event: { + id: <uuid>, + responseTo: <previous.uuid>, + type: fulfil, + action: reject, + createdAt: <timestamp>, + state: { + status: "error", + code: 1 + } + } + } + } + + + 50 + Route & Publish Notification event for Payee + + + Reference: Publish Position Reject event for Payer + + + alt + [If type == 'bulk-fulfil'] + + + Message: + { + id: <ID>, + from: <transferHeaders.FSPIOP-Source>, + to: <transferHeaders.FSPIOP-Destination>, + type: application/json, + content: { + headers: <transferHeaders>, + payload: <transferMessage> + }, + metadata: { + event: { + id: <uuid>, + responseTo: <previous.uuid>, + type: bulk-position, + action: reject, + createdAt: <timestamp>, + state: { + status: "success", + code: 0 + } + } + } + } + + + 51 + Route & Publish Position event for Payer + + [If type == 'fulfil'] + + + Message: + { + id: <ID>, + from: <transferHeaders.FSPIOP-Source>, + to: <transferHeaders.FSPIOP-Destination>, + type: application/json, + content: { + headers: <transferHeaders>, + payload: <transferMessage> + }, + metadata: { + event: { + id: <uuid>, + responseTo: <previous.uuid>, + type: position, + action: reject, + createdAt: <timestamp>, + state: { + status: "success", + code: 0 + } + } + } + } + + + 52 + Route & Publish Position event for Payer + diff --git a/docs/technical/technical/central-bulk-transfers/assets/diagrams/sequence/seq-bulk-2.3.1-position-fulfil.svg b/docs/technical/technical/central-bulk-transfers/assets/diagrams/sequence/seq-bulk-2.3.1-position-fulfil.svg index a50bd3d5..750ea14e 100644 --- a/docs/technical/technical/central-bulk-transfers/assets/diagrams/sequence/seq-bulk-2.3.1-position-fulfil.svg +++ b/docs/technical/technical/central-bulk-transfers/assets/diagrams/sequence/seq-bulk-2.3.1-position-fulfil.svg @@ -1,468 +1,238 @@ - - - - - - - - - - - 2.3.1. Fulfil Position Handler Consume (single message, includes individual transfers from Bulk) - - - - Central Service - - - - - - - - - Position Handler - - - - - Position Handler - - - - - - - topic- - - - notifications - - - - - topic- - - - notifications - - - - - topic- - - - bulk-processing - - - - - topic- - - - bulk-processing - - - Position DAO - - - - - Position DAO - - - - - Position Facade - - - - - Position Facade - - - - - Central Store - - - - - Central Store - - - - - - - - Fulfil Position Handler Consume - - - - - 1 - - - Request current state of transfer from DB - - - Error code: - - - 2003 - - - - - 2 - - - Retrieve current state of transfer from DB - - - - transferStateChange - - - transferParticipant - - - - - 3 - - - Return current state of transfer from DB - - - - - 4 - - - Return current state of transfer from DB - - - - - 5 - - - Validate current state (transferState is 'RECEIVED-FULFIL') - - - Error code: - - - 2001 - - - - - Persist Position change and Transfer State (with transferState='COMMITTED' on position check pass) - - - - - 6 - - - Request to persist latest position and state to DB - - - Error code: - - - 2003 - - - - - DB TRANSACTION - - - - - 7 - - - Select participantPosition.value FOR UPDATE from DB for Payee - - - - participantPosition - - - - - 8 - - - Return participantPosition.value from DB for Payee - - - - - 9 - - - latestPosition - - - = participantPosition.value - payload.amount.amount - - - - - 10 - - - Persist latestPosition to DB for Payee - - - - UPDATE - - - participantPosition - - - SET value = latestPosition - - - - - 11 - - - Persist transfer state and participant position change - - - - INSERT - - - transferStateChange - - - transferStateId = 'COMMITTED' - - - INSERT - - - participantPositionChange - - - SET participantPositionId = participantPosition.participantPositionId, - - - transferStateChangeId = transferStateChange.transferStateChangeId, - - - value = latestPosition, - - - reservedValue = participantPosition.reservedValue - - - createdDate = new Date() - - - - - 12 - - - Return success - - - - - alt - - - [If type == 'bulk-position'] - - - - - Message: - - - { - - - id: <transferMessage.transferId> - - - from: <transferMessage.payerFsp>, - - - to: <transferMessage.payeeFsp>, - - - type: application/json - - - content: { - - - headers: <transferHeaders>, - - - payload: <transferMessage> - - - }, - - - metadata: { - - - event: { - - - id: <uuid>, - - - responseTo: <previous.uuid>, - - - type: bulk-processing, - - - action: bulk-commit, - - - createdAt: <timestamp>, - - - state: { - - - status: "success", - - - code: 0 - - - } - - - } - - - } - - - } - - - - - 13 - - - Publish Transfer event to Bulk Processing Topic - - - Error codes: - - - 2003 - - - - [If type == 'position'] - - - - - Message: - - - { - - - id: <transferMessage.transferId> - - - from: <transferMessage.payerFsp>, - - - to: <transferMessage.payeeFsp>, - - - type: application/json - - - content: { - - - headers: <transferHeaders>, - - - payload: <transferMessage> - - - }, - - - metadata: { - - - event: { - - - id: <uuid>, - - - responseTo: <previous.uuid>, - - - type: notification, - - - action: commit, - - - createdAt: <timestamp>, - - - state: { - - - status: "success", - - - code: 0 - - - } - - - } - - - } - - - } - - - - - 14 - - - Publish Transfer event - - - Error code: - - - 2003 - + + 2.3.1. Fulfil Position Handler Consume (single message, includes individual transfers from Bulk) + + + 2.3.1. Fulfil Position Handler Consume (single message, includes individual transfers from Bulk) + + Central Service + + + + + + + + + + + + + + + + + + + + Position Handler + + + Position Handler + + + + + topic- + notifications + + + topic- + notifications + + + topic- + bulk-processing + + + topic- + bulk-processing + Position DAO + + + Position DAO + + + Position Facade + + + Position Facade + + + Central Store + + + Central Store + + + + + + + + + + + + + + Fulfil Position Handler Consume + + + 1 + Request current state of transfer from DB + Error code: + 2003 + + + 2 + Retrieve current state of transfer from DB + + transferStateChange + transferParticipant + + + 3 + Return current state of transfer from DB + + + 4 + Return current state of transfer from DB + + + + + + 5 + Validate current state (transferState is 'RECEIVED-FULFIL') + Error code: + 2001 + + + Persist Position change and Transfer State (with transferState='COMMITTED' on position check pass) + + + 6 + Request to persist latest position and state to DB + Error code: + 2003 + + + DB TRANSACTION + + + 7 + Select participantPosition.value FOR UPDATE from DB for Payee + + participantPosition + + + 8 + Return participantPosition.value from DB for Payee + + + + + + 9 + latestPosition + = participantPosition.value - payload.amount.amount + + + 10 + Persist latestPosition to DB for Payee + + UPDATE + participantPosition + SET value = latestPosition + + + 11 + Persist transfer state and participant position change + + INSERT + transferStateChange + transferStateId = 'COMMITTED' +   + INSERT + participantPositionChange + SET participantPositionId = participantPosition.participantPositionId, + transferStateChangeId = transferStateChange.transferStateChangeId, + value = latestPosition, + reservedValue = participantPosition.reservedValue + createdDate = new Date() + + + 12 + Return success + + + alt + [If type == 'bulk-position'] + + + Message: + { + id: <transferMessage.transferId> + from: <transferMessage.payerFsp>, + to: <transferMessage.payeeFsp>, + type: application/json + content: { + headers: <transferHeaders>, + payload: <transferMessage> + }, + metadata: { + event: { + id: <uuid>, + responseTo: <previous.uuid>, + type: bulk-processing, + action: bulk-commit, + createdAt: <timestamp>, + state: { + status: "success", + code: 0 + } + } + } + } + + + 13 + Publish Transfer event to Bulk Processing Topic + Error codes: + 2003 + + [If type == 'position'] + + + Message: + { + id: <transferMessage.transferId> + from: <transferMessage.payerFsp>, + to: <transferMessage.payeeFsp>, + type: application/json + content: { + headers: <transferHeaders>, + payload: <transferMessage> + }, + metadata: { + event: { + id: <uuid>, + responseTo: <previous.uuid>, + type: notification, + action: commit, + createdAt: <timestamp>, + state: { + status: "success", + code: 0 + } + } + } + } + + + 14 + Publish Transfer event + Error code: + 2003 + diff --git a/docs/technical/technical/central-bulk-transfers/assets/diagrams/sequence/seq-bulk-2.3.2-position-abort.svg b/docs/technical/technical/central-bulk-transfers/assets/diagrams/sequence/seq-bulk-2.3.2-position-abort.svg index 9ebfd3c2..038eaff5 100644 --- a/docs/technical/technical/central-bulk-transfers/assets/diagrams/sequence/seq-bulk-2.3.2-position-abort.svg +++ b/docs/technical/technical/central-bulk-transfers/assets/diagrams/sequence/seq-bulk-2.3.2-position-abort.svg @@ -1,1297 +1,613 @@ - - - - - - - - - - - 2.3.2. Abort Position Handler Consume (single message, includes individual transfers from Bulk) - - - - Central Service - - - - - - - - - - - - - - - - - - - Position Handler - - - - - Position Handler - - - - - - - topic- - - - notification - - - - - topic- - - - notification - - - - - topic- - - - bulk-processing - - - - - topic- - - - bulk-processing - - - Position DAO - - - - - Position DAO - - - - - Central Store - - - - - Central Store - - - - - - - - Abort Position Handler Consume - - - - - opt - - - [type IN ['position','bulk-position'] && action == 'timeout-reserved'] - - - - - 1 - - - Request current state of transfer from DB - - - Error code: - - - 2003 - - - - - 2 - - - Retrieve current state of transfer from DB - - - - transferStateChange - - - transferParticipant - - - - - 3 - - - Return current state of transfer from DB - - - - - 4 - - - Return current state of transfer from DB - - - - - 5 - - - Validate current state - - - (transferStateChange.transferStateId == 'RESERVED_TIMEOUT') - - - Error code: - - - 2001 - - - - - Persist Position change and Transfer state - - - - - 6 - - - transferStateId - - - = 'EXPIRED_RESERVED' - - - - - 7 - - - Request to persist latest position and state to DB - - - Error code: - - - 2003 - - - - - DB TRANSACTION IMPLEMENTATION - - - - - 8 - - - Select participantPosition.value FOR UPDATE for payerCurrencyId - - - - participantPosition - - - - - 9 - - - Return participantPosition - - - - - 10 - - - latestPosition - - - = participantPosition - payload.amount.amount - - - - - 11 - - - Persist latestPosition to DB for Payer - - - - UPDATE - - - participantPosition - - - SET value = latestPosition - - - - - 12 - - - Persist participant position change and state change - - - - INSERT - - - transferStateChange - - - VALUES (transferStateId) - - - INSERT - - - participantPositionChange - - - SET participantPositionId = participantPosition.participantPositionId, - - - transferStateChangeId = transferStateChange.transferStateChangeId, - - - value = latestPosition, - - - reservedValue = participantPosition.reservedValue - - - createdDate = new Date() - - - - - 13 - - - Return success - - - - - alt - - - [If type == 'bulk-position'] - - - - - Message: { - - - id: <transferMessage.transferId> - - - from: <transferMessage.payerFsp>, - - - to: <transferMessage.payeeFsp>, - - - type: application/json - - - content: { - - - headers: <transferHeaders>, - - - payload: { - - - "errorInformation": { - - - "errorCode": 3300, - - - "errorDescription": "Transfer expired", - - - "extensionList": <transferMessage.extensionList> - - - } - - - } - - - }, - - - metadata: { - - - event: { - - - id: <uuid>, - - - responseTo: <previous.uuid>, - - - type: bulk-processing, - - - action: abort, - - - createdAt: <timestamp>, - - - state: { - - - status: 'error', - - - code: <errorInformation.errorCode> - - - description: <errorInformation.errorDescription> - - - } - - - } - - - } - - - } - - - - - 14 - - - Publish Transfer event to Bulk Processing Topic (for Payer) - - - Error codes: - - - 2003 - - - - [If type == 'position'] - - - - - Message: { - - - id: <transferMessage.transferId> - - - from: <transferMessage.payerFsp>, - - - to: <transferMessage.payeeFsp>, - - - type: application/json - - - content: { - - - headers: <transferHeaders>, - - - payload: { - - - "errorInformation": { - - - "errorCode": 3300, - - - "errorDescription": "Transfer expired", - - - "extensionList": <transferMessage.extensionList> - - - } - - - } - - - }, - - - metadata: { - - - event: { - - - id: <uuid>, - - - responseTo: <previous.uuid>, - - - type: notification, - - - action: abort, - - - createdAt: <timestamp>, - - - state: { - - - status: 'error', - - - code: <errorInformation.errorCode> - - - description: <errorInformation.errorDescription> - - - } - - - } - - - } - - - } - - - - - 15 - - - Publish Notification event - - - Error code: - - - 2003 - - - - - opt - - - [type IN ['position','bulk-position'] && (action IN ['reject', 'abort'])] - - - - - 16 - - - Request current state of transfer from DB - - - Error code: - - - 2003 - - - - - 17 - - - Retrieve current state of transfer from DB - - - - transferStateChange - - - - - 18 - - - Return current state of transfer from DB - - - - - 19 - - - Return current state of transfer from DB - - - - - 20 - - - Validate current state - - - (transferStateChange.transferStateId IN ['RECEIVED_REJECT', 'RECEIVED_ERROR']) - - - Error code: - - - 2001 - - - - - Persist Position change and Transfer state - - - - - 21 - - - transferStateId - - - = (action == 'reject' ? 'ABORTED_REJECTED' : 'ABORTED_ERROR' ) - - - - - 22 - - - Request to persist latest position and state to DB - - - Error code: - - - 2003 - - - - - Refer to - - - DB TRANSACTION IMPLEMENTATION - - - above - - - - - 23 - - - Persist to database - - - - participantPosition - - - transferStateChange - - - participantPositionChange - - - - - 24 - - - Return success - - - - - alt - - - [If action == 'reject'] - - - - - alt - - - [If type == 'position'] - - - - - Message: { - - - id: <transferMessage.transferId> - - - from: <transferMessage.payerFsp>, - - - to: <transferMessage.payeeFsp>, - - - type: application/json - - - content: { - - - headers: <transferHeaders>, - - - payload: <transferMessage> - - - }, - - - metadata: { - - - event: { - - - id: <uuid>, - - - responseTo: <previous.uuid>, - - - type: notification, - - - action: reject, - - - createdAt: <timestamp>, - - - state: { - - - status: "success", - - - code: 0, - - - description: "action successful" - - - } - - - } - - - } - - - } - - - - - 25 - - - Publish Notification event - - - Error code: - - - 2003 - - - - [If type == 'bulk-position'] - - - - - Message: { - - - id: <transferMessage.transferId> - - - from: <transferMessage.payerFsp>, - - - to: <transferMessage.payeeFsp>, - - - type: application/json - - - content: { - - - headers: <transferHeaders>, - - - payload: <transferMessage> - - - }, - - - metadata: { - - - event: { - - - id: <uuid>, - - - responseTo: <previous.uuid>, - - - type: bulk-processing, - - - action: reject, - - - createdAt: <timestamp>, - - - state: { - - - status: "success", - - - code: 0, - - - description: "action successful" - - - } - - - } - - - } - - - } - - - - - 26 - - - Publish Notification event - - - Error code: - - - 2003 - - - - [action == 'abort'] - - - - - Message: { - - - id: <transferMessage.transferId> - - - from: <transferMessage.payerFsp>, - - - to: <transferMessage.payeeFsp>, - - - type: application/json - - - content: { - - - headers: <transferHeaders>, - - - payload: <transferMessage> - - - }, - - - metadata: { - - - event: { - - - id: <uuid>, - - - responseTo: <previous.uuid>, - - - type: notification, - - - action: abort, - - - createdAt: <timestamp>, - - - state: { - - - status: 'error', - - - code: <payload.errorInformation.errorCode || 5000> - - - description: <payload.errorInformation.errorDescription> - - - } - - - } - - - } - - - } - - - - - 27 - - - Publish Notification event - - - Error code: - - - 2003 - - - - - opt - - - [type IN ['position','bulk-position'] && action == 'fail' (Unable to currently trigger this scenario)] - - - - - 28 - - - Request current state of transfer from DB - - - Error code: - - - 2003 - - - - - 29 - - - Retrieve current state of transfer from DB - - - - transferStateChange - - - - - 30 - - - Return current state of transfer from DB - - - - - 31 - - - Return current state of transfer from DB - - - - - 32 - - - Validate current state (transferStateChange.transferStateId == 'FAILED') - - - - - Persist Position change and Transfer state - - - - - 33 - - - transferStateId - - - = 'FAILED' - - - - - 34 - - - Request to persist latest position and state to DB - - - Error code: - - - 2003 - - - - - Refer to - - - DB TRANSACTION IMPLEMENTATION - - - above - - - - - 35 - - - Persist to database - - - - participantPosition - - - transferStateChange - - - participantPositionChange - - - - - 36 - - - Return success - - - - - alt - - - [If type =='position'] - - - - - Message: { - - - id: <transferMessage.transferId> - - - from: <transferMessage.payerFsp>, - - - to: <transferMessage.payeeFsp>, - - - type: application/json - - - content: { - - - headers: <transferHeaders>, - - - payload: { - - - "errorInformation": { - - - "errorCode": 3100, - - - "errorDescription": "Transfer failed", - - - "extensionList": <transferMessage.extensionList> - - - } - - - } - - - }, - - - metadata: { - - - event: { - - - id: <uuid>, - - - responseTo: <previous.uuid>, - - - type: notification, - - - action: abort, - - - createdAt: <timestamp>, - - - state: { - - - status: 'error', - - - code: <errorInformation.errorCode> - - - description: <errorInformation.errorDescription> - - - } - - - } - - - } - - - } - - - - - 37 - - - Publish Notification event - - - Error code: - - - 2003 - - - - [If type =='bulk-position'] - - - - - Message: { - - - id: <transferMessage.transferId> - - - from: <transferMessage.payerFsp>, - - - to: <transferMessage.payeeFsp>, - - - type: application/json - - - content: { - - - headers: <transferHeaders>, - - - payload: { - - - "errorInformation": { - - - "errorCode": 3100, - - - "errorDescription": "Transfer failed", - - - "extensionList": <transferMessage.extensionList> - - - } - - - } - - - }, - - - metadata: { - - - event: { - - - id: <uuid>, - - - responseTo: <previous.uuid>, - - - type: bulk-processing, - - - action: abort, - - - createdAt: <timestamp>, - - - state: { - - - status: 'error', - - - code: <errorInformation.errorCode> - - - description: <errorInformation.errorDescription> - - - } - - - } - - - } - - - } - - - - - 38 - - - Publish Notification event - - - Error code: - - - 2003 - + + 2.3.2. Abort Position Handler Consume (single message, includes individual transfers from Bulk) + + + 2.3.2. Abort Position Handler Consume (single message, includes individual transfers from Bulk) + + Central Service + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Position Handler + + + Position Handler + + + + + topic- + notification + + + topic- + notification + + + topic- + bulk-processing + + + topic- + bulk-processing + Position DAO + + + Position DAO + + + Central Store + + + Central Store + + + + + + + + + + + + + + + + + + + + + + + + + + + Abort Position Handler Consume + + + opt + [type IN ['position','bulk-position'] && action == 'timeout-reserved'] + + + 1 + Request current state of transfer from DB + Error code: + 2003 + + + 2 + Retrieve current state of transfer from DB + + transferStateChange + transferParticipant + + + 3 + Return current state of transfer from DB + + + 4 + Return current state of transfer from DB + + + + + + 5 + Validate current state + (transferStateChange.transferStateId == 'RESERVED_TIMEOUT') + Error code: + 2001 + + + Persist Position change and Transfer state + + + + + 6 + transferStateId + = 'EXPIRED_RESERVED' + + + 7 + Request to persist latest position and state to DB + Error code: + 2003 + + + DB TRANSACTION IMPLEMENTATION + + + 8 + Select participantPosition.value FOR UPDATE for payerCurrencyId + + participantPosition + + + 9 + Return participantPosition + + + + + + 10 + latestPosition + = participantPosition - payload.amount.amount + + + 11 + Persist latestPosition to DB for Payer + + UPDATE + participantPosition + SET value = latestPosition + + + 12 + Persist participant position change and state change + + INSERT + transferStateChange +   + VALUES (transferStateId) +   + INSERT + participantPositionChange + SET participantPositionId = participantPosition.participantPositionId, + transferStateChangeId = transferStateChange.transferStateChangeId, + value = latestPosition, + reservedValue = participantPosition.reservedValue + createdDate = new Date() + + + 13 + Return success + + + alt + [If type == 'bulk-position'] + + + Message: { + id: <transferMessage.transferId> + from: <transferMessage.payerFsp>, + to: <transferMessage.payeeFsp>, + type: application/json + content: { + headers: <transferHeaders>, + payload: { + "errorInformation": { + "errorCode": 3300, + "errorDescription": "Transfer expired", + "extensionList": <transferMessage.extensionList> + } + } + }, + metadata: { + event: { + id: <uuid>, + responseTo: <previous.uuid>, + type: bulk-processing, + action: abort, + createdAt: <timestamp>, + state: { + status: 'error', + code: <errorInformation.errorCode> + description: <errorInformation.errorDescription> + } + } + } + } + + + 14 + Publish Transfer event to Bulk Processing Topic (for Payer) + Error codes: + 2003 + + [If type == 'position'] + + + Message: { + id: <transferMessage.transferId> + from: <transferMessage.payerFsp>, + to: <transferMessage.payeeFsp>, + type: application/json + content: { + headers: <transferHeaders>, + payload: { + "errorInformation": { + "errorCode": 3300, + "errorDescription": "Transfer expired", + "extensionList": <transferMessage.extensionList> + } + } + }, + metadata: { + event: { + id: <uuid>, + responseTo: <previous.uuid>, + type: notification, + action: abort, + createdAt: <timestamp>, + state: { + status: 'error', + code: <errorInformation.errorCode> + description: <errorInformation.errorDescription> + } + } + } + } + + + 15 + Publish Notification event + Error code: + 2003 + + + opt + [type IN ['position','bulk-position'] && (action IN ['reject', 'abort'])] + + + 16 + Request current state of transfer from DB + Error code: + 2003 + + + 17 + Retrieve current state of transfer from DB + + transferStateChange + + + 18 + Return current state of transfer from DB + + + 19 + Return current state of transfer from DB + + + + + + 20 + Validate current state + (transferStateChange.transferStateId IN ['RECEIVED_REJECT', 'RECEIVED_ERROR']) + Error code: + 2001 + + + Persist Position change and Transfer state + + + + + 21 + transferStateId + = (action == 'reject' ? 'ABORTED_REJECTED' : 'ABORTED_ERROR' ) + + + 22 + Request to persist latest position and state to DB + Error code: + 2003 + + + Refer to + DB TRANSACTION IMPLEMENTATION + above + + + 23 + Persist to database + + participantPosition + transferStateChange + participantPositionChange + + + 24 + Return success + + + alt + [If action == 'reject'] + + + alt + [If type == 'position'] + + + Message: { + id: <transferMessage.transferId> + from: <transferMessage.payerFsp>, + to: <transferMessage.payeeFsp>, + type: application/json + content: { + headers: <transferHeaders>, + payload: <transferMessage> + }, + metadata: { + event: { + id: <uuid>, + responseTo: <previous.uuid>, + type: notification, + action: reject, + createdAt: <timestamp>, + state: { + status: "success", + code: 0, + description: "action successful" + } + } + } + } + + + 25 + Publish Notification event + Error code: + 2003 + + [If type == 'bulk-position'] + + + Message: { + id: <transferMessage.transferId> + from: <transferMessage.payerFsp>, + to: <transferMessage.payeeFsp>, + type: application/json + content: { + headers: <transferHeaders>, + payload: <transferMessage> + }, + metadata: { + event: { + id: <uuid>, + responseTo: <previous.uuid>, + type: bulk-processing, + action: reject, + createdAt: <timestamp>, + state: { + status: "success", + code: 0, + description: "action successful" + } + } + } + } + + + 26 + Publish Notification event + Error code: + 2003 + + [action == 'abort'] + + + Message: { + id: <transferMessage.transferId> + from: <transferMessage.payerFsp>, + to: <transferMessage.payeeFsp>, + type: application/json + content: { + headers: <transferHeaders>, + payload: <transferMessage> + }, + metadata: { + event: { + id: <uuid>, + responseTo: <previous.uuid>, + type: notification, + action: abort, + createdAt: <timestamp>, + state: { + status: 'error', + code: <payload.errorInformation.errorCode || 5000> + description: <payload.errorInformation.errorDescription> + } + } + } + } + + + 27 + Publish Notification event + Error code: + 2003 + + + opt + [type IN ['position','bulk-position'] && action == 'fail' (Unable to currently trigger this scenario)] + + + 28 + Request current state of transfer from DB + Error code: + 2003 + + + 29 + Retrieve current state of transfer from DB + + transferStateChange + + + 30 + Return current state of transfer from DB + + + 31 + Return current state of transfer from DB + + + + + + 32 + Validate current state (transferStateChange.transferStateId == 'FAILED') + + + Persist Position change and Transfer state + + + + + 33 + transferStateId + = 'FAILED' + + + 34 + Request to persist latest position and state to DB + Error code: + 2003 + + + Refer to + DB TRANSACTION IMPLEMENTATION + above + + + 35 + Persist to database + + participantPosition + transferStateChange + participantPositionChange + + + 36 + Return success + + + alt + [If type =='position'] + + + Message: { + id: <transferMessage.transferId> + from: <transferMessage.payerFsp>, + to: <transferMessage.payeeFsp>, + type: application/json + content: { + headers: <transferHeaders>, + payload: { + "errorInformation": { + "errorCode": 3100, + "errorDescription": "Transfer failed", + "extensionList": <transferMessage.extensionList> + } + } + }, + metadata: { + event: { + id: <uuid>, + responseTo: <previous.uuid>, + type: notification, + action: abort, + createdAt: <timestamp>, + state: { + status: 'error', + code: <errorInformation.errorCode> + description: <errorInformation.errorDescription> + } + } + } + } + + + 37 + Publish Notification event + Error code: + 2003 + + [If type =='bulk-position'] + + + Message: { + id: <transferMessage.transferId> + from: <transferMessage.payerFsp>, + to: <transferMessage.payeeFsp>, + type: application/json + content: { + headers: <transferHeaders>, + payload: { + "errorInformation": { + "errorCode": 3100, + "errorDescription": "Transfer failed", + "extensionList": <transferMessage.extensionList> + } + } + }, + metadata: { + event: { + id: <uuid>, + responseTo: <previous.uuid>, + type: bulk-processing, + action: abort, + createdAt: <timestamp>, + state: { + status: 'error', + code: <errorInformation.errorCode> + description: <errorInformation.errorDescription> + } + } + } + } + + + 38 + Publish Notification event + Error code: + 2003 + diff --git a/docs/technical/technical/central-bulk-transfers/assets/diagrams/sequence/seq-bulk-3.1.0-timeout-overview.svg b/docs/technical/technical/central-bulk-transfers/assets/diagrams/sequence/seq-bulk-3.1.0-timeout-overview.svg index b6ec0462..e9424fc6 100644 --- a/docs/technical/technical/central-bulk-transfers/assets/diagrams/sequence/seq-bulk-3.1.0-timeout-overview.svg +++ b/docs/technical/technical/central-bulk-transfers/assets/diagrams/sequence/seq-bulk-3.1.0-timeout-overview.svg @@ -1,361 +1,349 @@ - - - - - - - - - - + + 3.1.0. Transfer Timeout (incl. Bulk Transfer) + - 3.1.0. Transfer Timeout (incl. Bulk Transfer) - - Financial Service Providers - - ML API Adapter Service - - Central Service - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - DFSP1 - Payer - - - DFSP1 - Payer - - - DFSP2 - Payee - - - DFSP2 - Payee - - - ML API - Adapter - - - ML API - Adapter - - - ML API Notification - Event Handler - - - ML API Notification - Event Handler - - - Transfer Timeout - Handler - - - Transfer Timeout - Handler - - - - - topic- - transfer-position - - - topic- - transfer-position - - - topic-event - - - topic-event - Position Event - Handler - - - Position Event - Handler - - - - - topic- - notification - - - topic- - notification - Bulk Processing - Handler - - - Bulk Processing - Handler - - - - - topic- - bulk-processing - - - topic- - bulk-processing - - - - - - - Transfer Expiry - - - ref - Timeout Handler Consume - - - - alt - [transferStateId == 'RECEIVED_PREPARE'] - - - alt - [Regular Transfer] - - - 1 - Produce message - - [Individual Transfer from a Bulk] - - - 2 - Produce message - - [transferStateId == 'RESERVED'] - - - 3 - Produce message - - - 4 - Consume message - - - ref - Position Hander Consume (Timeout) - - - - alt - [Regular Transfer] - - - 5 - Produce message - - [Individual Transfer from a Bulk] - - - 6 - Produce message - - - opt - [action IN ['bulk-timeout-received', 'bulk-timeout-reserved']] - - - 7 - Consume message - - - ref - Bulk Processing Consume - - - - 8 - Produce message - - - opt - [action IN ['timeout-received', 'timeout-reserved', 'bulk-timeout-received', 'bulk-timeout-reserved']] - - - 9 - Consume message - - - ref - Send notification to Participant (Payer) - - - - alt - [Timeout before any processing] - - - PUT /bulkTransfers/<ID> - { - headers: <bulkTransferHeaders>, - body: { - "bulkTransferState": "COMPLETED", - "completedTimestamp": "2022-08-18T01:00:24.407Z", - "individualTransferResults": [ - { - "errorInformation": { - "errorCode": "3303", - "errorDescription": "Transfer expired", - "extensionList": <transferMessage.extensionList> - } - "transferId": <ID> - }, - { - "errorInformation": { - "errorCode": "3303", - "errorDescription": "Transfer expired", - "extensionList": <transferMessage.extensionList> - } - "transferId": <ID> - }, - ] - } - } - - [Timeout in middle of processing] - - - PUT /bulkTransfers/<ID> - { - headers: <bulkTransferHeaders>, - body: { - "bulkTransferState": "COMPLETED", - "completedTimestamp": "2022-08-18T01:00:24.407Z", - "individualTransferResults": [ - { - "transferId": <ID>, - "fulfilment": <fulfilment> - }, - { - "errorInformation": { - "errorCode": "3303", - "errorDescription": "Transfer expired", - "extensionList": <transferMessage.extensionList> - } - "transferId": <ID> - }, - ] - } - } - - - 10 - Send callback notification - - - opt - [action IN ['timeout-reserved', 'bulk-timeout-reserved']] - - - 11 - Consume message - - - ref - Send notification to Participant (Payee) - - - - alt - [Timeout before any processing] - - - PUT /bulkTransfers/<ID> - { - headers: <bulkTransferHeaders>, - body: { - "bulkTransferState": "COMPLETED", - "completedTimestamp": "2022-08-18T01:00:24.407Z", - "individualTransferResults": [ - { - "errorInformation": { - "errorCode": "3303", - "errorDescription": "Transfer expired", - "extensionList": <transferMessage.extensionList> - } - "transferId": <ID> - }, - { - "errorInformation": { - "errorCode": "3303", - "errorDescription": "Transfer expired", - "extensionList": <transferMessage.extensionList> - } - "transferId": <ID> - }, - ] - } - } - - [Timeout in middle of processing] - - - PUT /bulkTransfers/<ID> - { - headers: <bulkTransferHeaders>, - body: { - "bulkTransferState": "COMPLETED", - "completedTimestamp": "2022-08-18T01:00:24.407Z", - "individualTransferResults": [ - { - "transferId": <ID>, - "fulfilment": <fulfilment> - }, - { - "errorInformation": { - "errorCode": "3303", - "errorDescription": "Transfer expired", - "extensionList": <transferMessage.extensionList> - } - "transferId": <ID> - }, - ] - } - } - - - 12 - Send callback notification + 3.1.0. Transfer Timeout (incl. Bulk Transfer) + + Financial Service Providers + + ML API Adapter Service + + Central Service + + + + + + + + + + + + + + + + + + + + + + + + + DFSP1 + Payer + + + DFSP1 + Payer + + + DFSP2 + Payee + + + DFSP2 + Payee + + + ML API + Adapter + + + ML API + Adapter + + + ML API Notification + Event Handler + + + ML API Notification + Event Handler + + + Transfer Timeout + Handler + + + Transfer Timeout + Handler + + + + + topic- + transfer-position + + + topic- + transfer-position + + + topic-event + + + topic-event + Position Event + Handler + + + Position Event + Handler + + + + + topic- + notification + + + topic- + notification + Bulk Processing + Handler + + + Bulk Processing + Handler + + + + + topic- + bulk-processing + + + topic- + bulk-processing + + + + + + + Transfer Expiry + + + ref + Timeout Handler Consume +   + + + alt + [transferStateId == 'RECEIVED_PREPARE'] + + + alt + [Regular Transfer] + + + 1 + Produce message + + [Individual Transfer from a Bulk] + + + 2 + Produce message + + [transferStateId == 'RESERVED'] + + + 3 + Produce message + + + 4 + Consume message + + + ref + Position Hander Consume (Timeout) +   + + + alt + [Regular Transfer] + + + 5 + Produce message + + [Individual Transfer from a Bulk] + + + 6 + Produce message + + + opt + [action IN ['bulk-timeout-received', 'bulk-timeout-reserved']] + + + 7 + Consume message + + + ref + Bulk Processing Consume +   + + + 8 + Produce message + + + opt + [action IN ['timeout-received', 'timeout-reserved', 'bulk-timeout-received', 'bulk-timeout-reserved']] + + + 9 + Consume message + + + ref + Send notification to Participant (Payer) +   + + + alt + [Timeout before any processing] + + + PUT /bulkTransfers/<ID> + { + headers: <bulkTransferHeaders>, + body: { + "bulkTransferState": "COMPLETED", + "completedTimestamp": "2022-08-18T01:00:24.407Z", + "individualTransferResults": [ + { + "errorInformation": { + "errorCode": "3303", + "errorDescription": "Transfer expired", + "extensionList": <transferMessage.extensionList> + } + "transferId": <ID> + }, + { + "errorInformation": { + "errorCode": "3303", + "errorDescription": "Transfer expired", + "extensionList": <transferMessage.extensionList> + } + "transferId": <ID> + }, + ] + } + } + + [Timeout in middle of processing] + + + PUT /bulkTransfers/<ID> + { + headers: <bulkTransferHeaders>, + body: { + "bulkTransferState": "COMPLETED", + "completedTimestamp": "2022-08-18T01:00:24.407Z", + "individualTransferResults": [ + { + "transferId": <ID>, + "fulfilment": <fulfilment> + }, + { + "errorInformation": { + "errorCode": "3303", + "errorDescription": "Transfer expired", + "extensionList": <transferMessage.extensionList> + } + "transferId": <ID> + }, + ] + } + } + + + 10 + Send callback notification + + + opt + [action IN ['timeout-reserved', 'bulk-timeout-reserved']] + + + 11 + Consume message + + + ref + Send notification to Participant (Payee) +   + + + alt + [Timeout before any processing] + + + PUT /bulkTransfers/<ID> + { + headers: <bulkTransferHeaders>, + body: { + "bulkTransferState": "COMPLETED", + "completedTimestamp": "2022-08-18T01:00:24.407Z", + "individualTransferResults": [ + { + "errorInformation": { + "errorCode": "3303", + "errorDescription": "Transfer expired", + "extensionList": <transferMessage.extensionList> + } + "transferId": <ID> + }, + { + "errorInformation": { + "errorCode": "3303", + "errorDescription": "Transfer expired", + "extensionList": <transferMessage.extensionList> + } + "transferId": <ID> + }, + ] + } + } + + [Timeout in middle of processing] + + + PUT /bulkTransfers/<ID> + { + headers: <bulkTransferHeaders>, + body: { + "bulkTransferState": "COMPLETED", + "completedTimestamp": "2022-08-18T01:00:24.407Z", + "individualTransferResults": [ + { + "transferId": <ID>, + "fulfilment": <fulfilment> + }, + { + "errorInformation": { + "errorCode": "3303", + "errorDescription": "Transfer expired", + "extensionList": <transferMessage.extensionList> + } + "transferId": <ID> + }, + ] + } + } + + + 12 + Send callback notification diff --git a/docs/technical/technical/central-bulk-transfers/assets/diagrams/sequence/seq-bulk-3.1.1-timeout-handler.svg b/docs/technical/technical/central-bulk-transfers/assets/diagrams/sequence/seq-bulk-3.1.1-timeout-handler.svg index fc0c4635..5d241117 100644 --- a/docs/technical/technical/central-bulk-transfers/assets/diagrams/sequence/seq-bulk-3.1.1-timeout-handler.svg +++ b/docs/technical/technical/central-bulk-transfers/assets/diagrams/sequence/seq-bulk-3.1.1-timeout-handler.svg @@ -1,605 +1,596 @@ - - - - - - - - - - + + 3.1.1. Timeout Handler Consume (incl. Bulk Transfer) + - 3.1.1. Timeout Handler Consume (incl. Bulk Transfer) - - Central Service - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Transfer Timeout - Handler - - - Transfer Timeout - Handler - - - - - topic- - transfer-position - - - topic- - transfer-position - - - topic- - notification - - - topic- - notification - - - topic-event - - - topic-event - - - topic- - bulk-processing - - - topic- - bulk-processing - Position DAO - - - Position DAO - - - Segment DAO - - - Segment DAO - - - Central Store - - - Central Store - - - - - - - - - - - - - - - - - - - - - - Timeout Handler Consume - - - Persist Event Information - - - 1 - Publish event information - - - ref - Event Handler Consume - - - - Get previous checkpoint of last record processed (Lower limit for inclusion) - - - 2 - Get last segment as @intervalMin - - - 3 - Get last segment as @intervalMin - - SELECT value INTO @intervalMin - FROM - segment - WHERE segmentType = 'timeout' - AND enumeration = 0 - AND tableName = 'transferStateChange' - - - 4 - Return @intervalMin - - - 5 - Return @intervalMin - - - opt - [@intervalMin IS NULL => segment record NOT FOUND] - - - - - 6 - Set @intervalMin = 0 - - - Do Cleanup - - - 7 - Clean up transferTimeout from finalised transfers - - - 8 - Clean up transferTimeout from finalised transfers - - DELETE tt - FROM - transferTimeout - AS tt - JOIN (SELECT tsc.transferId, MAX(tsc.transferStateChangeId) maxTransferStateChangeId - FROM - transferTimeout - tt1 - JOIN - transferStateChange - tsc - ON tsc.transferId = tt1.transferId - GROUP BY transferId) ts - ON ts.transferId = tt.transferId - JOIN - transferStateChange - tsc - ON tsc.transferStateChangeId = ts.maxTransferStateChangeId - WHERE tsc.transferStateId IN ('RECEIVED_FULFIL', 'COMMITTED', 'FAILED' - , 'EXPIRED', 'REJECTED', 'EXPIRED_PREPARED', 'EXPIRED_RESERVED', 'ABORTED') - - - 9 - Return success - - - Determine IntervalMax (Upper limit for inclusion) - - - 10 - Get last transferStateChangeId as @intervalMax - - - 11 - Get last transferStateChangeId as @intervalMax - - SELECT MAX(transferStateChangeId) INTO @intervalMax - FROM - transferStateChange - - - 12 - Return @intervalMax - - - 13 - Return @intervalMax - - - Prepare data and return the list for expiration - - - 14 - Prepare data and get transfers to be expired - - - DB TRANSACTION - - - - - 15 - transactionTimestamp - = now() - - - 16 - Insert all new transfers still in processing state - - INSERT INTO - transferTimeout - (transferId, expirationDate) - SELECT t.transferId, t.expirationDate - FROM - transfer - t - JOIN (SELECT transferId, MAX(transferStateChangeId) maxTransferStateChangeId - FROM - transferStateChange - WHERE transferStateChangeId > @intervalMin - AND transferStateChangeId <= @intervalMax - GROUP BY transferId) ts - ON ts.transferId = t.transferId - JOIN - transferStateChange - tsc - ON tsc.transferStateChangeId = ts.maxTransferStateChangeId - WHERE tsc.transferStateId IN ('RECEIVED_PREPARE', 'RESERVED') - - - 17 - Insert transfer state ABORTED for - expired RECEIVED_PREPARE transfers - - INSERT INTO - transferStateChange - SELECT tt.transferId, 'EXPIRED_PREPARED' AS transferStateId, 'Aborted by Timeout Handler' AS reason - FROM - transferTimeout - tt - JOIN ( - -- Following subquery is reused 3 times and may be optimized if needed - SELECT tsc1.transferId, MAX(tsc1.transferStateChangeId) maxTransferStateChangeId - FROM - transferStateChange - tsc1 - JOIN - transferTimeout - tt1 - ON tt1.transferId = tsc1.transferId - GROUP BY tsc1.transferId) ts - ON ts.transferId = tt.transferId - JOIN - transferStateChange - tsc - ON tsc.transferStateChangeId = ts.maxTransferStateChangeId - WHERE tt.expirationDate < {transactionTimestamp} - AND tsc.transferStateId = 'RECEIVED_PREPARE' - - - 18 - Insert transfer state EXPIRED for - expired RESERVED transfers - - INSERT INTO - transferStateChange - SELECT tt.transferId, 'RESERVED_TIMEOUT' AS transferStateId, 'Expired by Timeout Handler' AS reason - FROM - transferTimeout - tt - JOIN (SELECT tsc1.transferId, MAX(tsc1.transferStateChangeId) maxTransferStateChangeId - FROM - transferStateChange - tsc1 - JOIN - transferTimeout - tt1 - ON tt1.transferId = tsc1.transferId - GROUP BY tsc1.transferId) ts - ON ts.transferId = tt.transferId - JOIN - transferStateChange - tsc - ON tsc.transferStateChangeId = ts.maxTransferStateChangeId - WHERE tt.expirationDate < {transactionTimestamp} - AND tsc.transferStateId = 'RESERVED' - - - 19 - Update segment table to be used for the next run - - IF @intervalMin = 0 - INSERT - INTO - segment - (segmentType, enumeration, tableName, value) - VALUES ('timeout', 0, 'transferStateChange', @intervalMax) - ELSE - UPDATE - segment - SET value = @intervalMax - WHERE segmentType = 'timeout' - AND enumeration = 0 - AND tableName = 'transferStateChange' - - - 20 - Get list of transfers to be expired with current state - - SELECT tt.*, tsc.transferStateId, tp1.participantCurrencyId payerParticipantId, - tp2.participantCurrencyId payeeParticipantId, bta.bulkTransferId - FROM - transferTimeout - tt - JOIN (SELECT tsc1.transferId, MAX(tsc1.transferStateChangeId) maxTransferStateChangeId - FROM - transferStateChange - tsc1 - JOIN - transferTimeout - tt1 - ON tt1.transferId = tsc1.transferId - GROUP BY tsc1.transferId) ts - ON ts.transferId = tt.transferId - JOIN - transferStateChange - tsc - ON tsc.transferStateChangeId = ts.maxTransferStateChangeId - JOIN - transferParticipant - tp1 - ON tp1.transferId = tt.transferId - AND tp1.transferParticipantRoleTypeId = {PAYER_DFSP} - AND tp1.ledgerEntryTypeId = {PRINCIPLE_VALUE} - JOIN - transferParticipant - tp2 - ON tp2.transferId = tt.transferId - AND tp2.transferParticipantRoleTypeId = {PAYEE_DFSP} - AND tp2.ledgerEntryTypeId = {PRINCIPLE_VALUE} - LEFT JOIN - bulkTransferAssociation - bta - ON bta.transferId = tt.transferId - WHERE tt.expirationDate < {transactionTimestamp} - - - 21 - Return - transferTimeoutList - - - 22 - Return - transferTimeoutList - - - loop - [for each transfer in the list] - - - alt - [transferTimeoutList.bulkTransferId == NULL (Regular Transfer)] - - - alt - [transferStateId == 'RECEIVED_PREPARE'] - - - Message: - { - id: <transferId>, - from: <payerParticipantId>, - to: <payeeParticipantId>, - type: application/json, - content: { - headers: { - 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: { - "errorInformation": { - "errorCode": 3303, - "errorDescription": "Transfer expired", - "extensionList": <transferMessage.extensionList> - } - } - }, - metadata: { - event: { - id: <uuid>, - type: notification, - action: timeout-received, - createdAt: <timestamp>, - state: { - status: 'error', - code: <errorInformation.errorCode> - description: <errorInformation.errorDescription> - } - } - } - } - - - 23 - Publish Notification event - - [transferStateId == 'RESERVED'] - - - Message: - { - id: <transferId>, - from: <payerParticipantId>, - to: <payeeParticipantId>, - type: application/json, - content: { - headers: { - 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: { - "errorInformation": { - "errorCode": 3303, - "errorDescription": "Transfer expired", - "extensionList": <transferMessage.extensionList> - } - } - }, - metadata: { - event: { - id: <uuid>, - type: position, - action: timeout-reserved, - createdAt: <timestamp>, - state: { - status: 'error', - code: <errorInformation.errorCode> - description: <errorInformation.errorDescription> - } - } - } - } - - - 24 - Route & Publish Position event - - [Individual Transfer from a Bulk] - - - alt - [transferStateId == 'RECEIVED_PREPARE'] - - - Message: - { - - id - : <transferTimeoutList.bulkTransferId>, - - transferId - : <transferTimeoutList.transferId>, - from: <payerParticipantId>, - to: <payeeParticipantId>, - type: application/json, - content: { - headers: <bulkTransferHeaders>, - payload: { - "errorInformation": { - "errorCode": 3303, - "errorDescription": "Transfer expired", - "extensionList": <transferMessage.extensionList> - } - } - }, - metadata: { - event: { - id: <uuid>, - type: bulk-processing, - action: bulk-timeout-received, - createdAt: <timestamp>, - state: { - status: 'error', - code: <errorInformation.errorCode> - description: <errorInformation.errorDescription> - } - } - } - } - - - 25 - Publish to Bulk Processing topic - - [transferStateId == 'RESERVED'] - - - Message: - { - - id - : <transferTimeoutList.bulkTransferId>, - - transferId - : <transferTimeoutList.transferId>, - from: <payerParticipantId>, - to: <payeeParticipantId>, - type: application/json, - content: { - headers: <bulkTransferHeaders>,, - payload: { - "errorInformation": { - "errorCode": 3303, - "errorDescription": "Transfer expired", - "extensionList": <transferMessage.extensionList> - } - } - }, - metadata: { - event: { - id: <uuid>, - type: position, - action: bulk-timeout-reserved, - createdAt: <timestamp>, - state: { - status: 'error', - code: <errorInformation.errorCode> - description: <errorInformation.errorDescription> - } - } - } - } - - - 26 - Route & Publish Position event + 3.1.1. Timeout Handler Consume (incl. Bulk Transfer) + + Central Service + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Transfer Timeout + Handler + + + Transfer Timeout + Handler + + + + + topic- + transfer-position + + + topic- + transfer-position + + + topic- + notification + + + topic- + notification + + + topic-event + + + topic-event + + + topic- + bulk-processing + + + topic- + bulk-processing + Position DAO + + + Position DAO + + + Segment DAO + + + Segment DAO + + + Central Store + + + Central Store + + + + + + + + + + + + + + + + + + + + + + Timeout Handler Consume + + + Persist Event Information + + + 1 + Publish event information + + + ref + Event Handler Consume +   + + + Get previous checkpoint of last record processed (Lower limit for inclusion) + + + 2 + Get last segment as @intervalMin + + + 3 + Get last segment as @intervalMin + + SELECT value INTO @intervalMin + FROM + segment + WHERE segmentType = 'timeout' + AND enumeration = 0 + AND tableName = 'transferStateChange' + + + 4 + Return @intervalMin + + + 5 + Return @intervalMin + + + opt + [@intervalMin IS NULL => segment record NOT FOUND] + + + + + 6 + Set @intervalMin = 0 + + + Do Cleanup + + + 7 + Clean up transferTimeout from finalised transfers + + + 8 + Clean up transferTimeout from finalised transfers + + DELETE tt + FROM + transferTimeout + AS tt + JOIN (SELECT tsc.transferId, MAX(tsc.transferStateChangeId) maxTransferStateChangeId + FROM + transferTimeout + tt1 + JOIN + transferStateChange + tsc + ON tsc.transferId = tt1.transferId + GROUP BY transferId) ts + ON ts.transferId = tt.transferId + JOIN + transferStateChange + tsc + ON tsc.transferStateChangeId = ts.maxTransferStateChangeId + WHERE tsc.transferStateId IN ('RECEIVED_FULFIL', 'COMMITTED', 'FAILED' + , 'EXPIRED', 'REJECTED', 'EXPIRED_PREPARED', 'EXPIRED_RESERVED', 'ABORTED') + + + 9 + Return success + + + Determine IntervalMax (Upper limit for inclusion) + + + 10 + Get last transferStateChangeId as @intervalMax + + + 11 + Get last transferStateChangeId as @intervalMax + + SELECT MAX(transferStateChangeId) INTO @intervalMax + FROM + transferStateChange + + + 12 + Return @intervalMax + + + 13 + Return @intervalMax + + + Prepare data and return the list for expiration + + + 14 + Prepare data and get transfers to be expired + + + DB TRANSACTION + + + + + + 15 + transactionTimestamp + = now() + + + 16 + Insert all new transfers still in processing state + + INSERT INTO + transferTimeout + (transferId, expirationDate) + SELECT t.transferId, t.expirationDate + FROM + transfer + t + JOIN (SELECT transferId, MAX(transferStateChangeId) maxTransferStateChangeId + FROM + transferStateChange + WHERE transferStateChangeId > @intervalMin + AND transferStateChangeId <= @intervalMax + GROUP BY transferId) ts + ON ts.transferId = t.transferId + JOIN + transferStateChange + tsc + ON tsc.transferStateChangeId = ts.maxTransferStateChangeId + WHERE tsc.transferStateId IN ('RECEIVED_PREPARE', 'RESERVED') + + + 17 + Insert transfer state ABORTED for + expired RECEIVED_PREPARE transfers + + INSERT INTO + transferStateChange + SELECT tt.transferId, 'EXPIRED_PREPARED' AS transferStateId, 'Aborted by Timeout Handler' AS reason + FROM + transferTimeout + tt + JOIN ( + -- Following subquery is reused 3 times and may be optimized if needed + SELECT tsc1.transferId, MAX(tsc1.transferStateChangeId) maxTransferStateChangeId + FROM + transferStateChange + tsc1 + JOIN + transferTimeout + tt1 + ON tt1.transferId = tsc1.transferId + GROUP BY tsc1.transferId) ts + ON ts.transferId = tt.transferId + JOIN + transferStateChange + tsc + ON tsc.transferStateChangeId = ts.maxTransferStateChangeId + WHERE tt.expirationDate < {transactionTimestamp} + AND tsc.transferStateId = 'RECEIVED_PREPARE' + + + 18 + Insert transfer state EXPIRED for + expired RESERVED transfers + + INSERT INTO + transferStateChange + SELECT tt.transferId, 'RESERVED_TIMEOUT' AS transferStateId, 'Expired by Timeout Handler' AS reason + FROM + transferTimeout + tt + JOIN (SELECT tsc1.transferId, MAX(tsc1.transferStateChangeId) maxTransferStateChangeId + FROM + transferStateChange + tsc1 + JOIN + transferTimeout + tt1 + ON tt1.transferId = tsc1.transferId + GROUP BY tsc1.transferId) ts + ON ts.transferId = tt.transferId + JOIN + transferStateChange + tsc + ON tsc.transferStateChangeId = ts.maxTransferStateChangeId + WHERE tt.expirationDate < {transactionTimestamp} + AND tsc.transferStateId = 'RESERVED' + + + 19 + Update segment table to be used for the next run + + IF @intervalMin = 0 + INSERT + INTO + segment + (segmentType, enumeration, tableName, value) + VALUES ('timeout', 0, 'transferStateChange', @intervalMax) + ELSE + UPDATE + segment + SET value = @intervalMax + WHERE segmentType = 'timeout' + AND enumeration = 0 + AND tableName = 'transferStateChange' + + + 20 + Get list of transfers to be expired with current state + + SELECT tt.*, tsc.transferStateId, tp1.participantCurrencyId payerParticipantId, + tp2.participantCurrencyId payeeParticipantId, bta.bulkTransferId + FROM + transferTimeout + tt + JOIN (SELECT tsc1.transferId, MAX(tsc1.transferStateChangeId) maxTransferStateChangeId + FROM + transferStateChange + tsc1 + JOIN + transferTimeout + tt1 + ON tt1.transferId = tsc1.transferId + GROUP BY tsc1.transferId) ts + ON ts.transferId = tt.transferId + JOIN + transferStateChange + tsc + ON tsc.transferStateChangeId = ts.maxTransferStateChangeId + JOIN + transferParticipant + tp1 + ON tp1.transferId = tt.transferId + AND tp1.transferParticipantRoleTypeId = {PAYER_DFSP} + AND tp1.ledgerEntryTypeId = {PRINCIPLE_VALUE} + JOIN + transferParticipant + tp2 + ON tp2.transferId = tt.transferId + AND tp2.transferParticipantRoleTypeId = {PAYEE_DFSP} + AND tp2.ledgerEntryTypeId = {PRINCIPLE_VALUE} + LEFT JOIN + bulkTransferAssociation + bta + ON bta.transferId = tt.transferId + WHERE tt.expirationDate < {transactionTimestamp} + + + 21 + Return + transferTimeoutList + + + 22 + Return + transferTimeoutList + + + loop + [for each transfer in the list] + + + alt + [transferTimeoutList.bulkTransferId == NULL (Regular Transfer)] + + + alt + [transferStateId == 'RECEIVED_PREPARE'] + + + Message: + { + id: <transferId>, + from: <payerParticipantId>, + to: <payeeParticipantId>, + type: application/json, + content: { + headers: { + 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: { + "errorInformation": { + "errorCode": 3303, + "errorDescription": "Transfer expired", + "extensionList": <transferMessage.extensionList> + } + } + }, + metadata: { + event: { + id: <uuid>, + type: notification, + action: timeout-received, + createdAt: <timestamp>, + state: { + status: 'error', + code: <errorInformation.errorCode> + description: <errorInformation.errorDescription> + } + } + } + } + + + 23 + Publish Notification event + + [transferStateId == 'RESERVED'] + + + Message: + { + id: <transferId>, + from: <payerParticipantId>, + to: <payeeParticipantId>, + type: application/json, + content: { + headers: { + 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: { + "errorInformation": { + "errorCode": 3303, + "errorDescription": "Transfer expired", + "extensionList": <transferMessage.extensionList> + } + } + }, + metadata: { + event: { + id: <uuid>, + type: position, + action: timeout-reserved, + createdAt: <timestamp>, + state: { + status: 'error', + code: <errorInformation.errorCode> + description: <errorInformation.errorDescription> + } + } + } + } + + + 24 + Route & Publish Position event + + [Individual Transfer from a Bulk] + + + alt + [transferStateId == 'RECEIVED_PREPARE'] + + + Message: + { +      + id + : <transferTimeoutList.bulkTransferId>, +      + transferId + : <transferTimeoutList.transferId>, + from: <payerParticipantId>, + to: <payeeParticipantId>, + type: application/json, + content: { + headers: <bulkTransferHeaders>, + payload: { + "errorInformation": { + "errorCode": 3303, + "errorDescription": "Transfer expired", + "extensionList": <transferMessage.extensionList> + } + } + }, + metadata: { + event: { + id: <uuid>, + type: bulk-processing, + action: bulk-timeout-received, + createdAt: <timestamp>, + state: { + status: 'error', + code: <errorInformation.errorCode> + description: <errorInformation.errorDescription> + } + } + } + } + + + 25 + Publish to Bulk Processing topic + + [transferStateId == 'RESERVED'] + + + Message: + { +      + id + : <transferTimeoutList.bulkTransferId>, +      + transferId + : <transferTimeoutList.transferId>, + from: <payerParticipantId>, + to: <payeeParticipantId>, + type: application/json, + content: { + headers: <bulkTransferHeaders>,, + payload: { + "errorInformation": { + "errorCode": 3303, + "errorDescription": "Transfer expired", + "extensionList": <transferMessage.extensionList> + } + } + }, + metadata: { + event: { + id: <uuid>, + type: position, + action: bulk-timeout-reserved, + createdAt: <timestamp>, + state: { + status: 'error', + code: <errorInformation.errorCode> + description: <errorInformation.errorDescription> + } + } + } + } + + + 26 + Route & Publish Position event diff --git a/docs/technical/technical/central-bulk-transfers/assets/diagrams/sequence/seq-bulk-4.1.0-abort-overview.svg b/docs/technical/technical/central-bulk-transfers/assets/diagrams/sequence/seq-bulk-4.1.0-abort-overview.svg index 65d6a65a..51eae958 100644 --- a/docs/technical/technical/central-bulk-transfers/assets/diagrams/sequence/seq-bulk-4.1.0-abort-overview.svg +++ b/docs/technical/technical/central-bulk-transfers/assets/diagrams/sequence/seq-bulk-4.1.0-abort-overview.svg @@ -1,732 +1,397 @@ - - - - - - - - - - - 4.1.0. Bulk Transfer Abort - - - - Financial Service Providers - - - - Bulk API Adapter Service - - - - Central Service - - - - - - - - DFSP1 - - - Payer - - - - - DFSP1 - - - Payer - - - - - DFSP2 - - - Payee - - - - - DFSP2 - - - Payee - - - - - Bulk API Adapter - - - - - Bulk API Adapter - - - - - Bulk API Notification Event Handler - - - - - Bulk API Notification Event Handler - - - - - Central Service API - - - - - Central Service API - - - - - - - Bulk-Fulfil-Topic - - - - - Bulk-Fulfil-Topic - - - - - Fulfil-Topic - - - - - Fulfil-Topic - - - Bulk Fulfil Event Handler - - - - - Bulk Fulfil Event Handler - - - - - Fulfil Event Handler - - - - - Fulfil Event Handler - - - - - - - topic-transfer-position - - - - - topic-transfer-position - - - - - Event-Topic - - - - - Event-Topic - - - Position Event Handler - - - - - Position Event Handler - - - - - - - topic-bulk-processing - - - - - topic-bulk-processing - - - Bulk Processing Event Handler - - - - - Bulk Processing Event Handler - - - - - - - Notification-Topic - - - - - Notification-Topic - - - - - mojaloop- - - - object-store - - - ( - - - MLOS - - - ) - - - - - mojaloop- - - - object-store - - - ( - - - MLOS - - - ) - - - Central Services DB - - - - - Central Services DB - - - - - - - - - DFSP2 sends a Fulfil Abort Transfer request - - - - - Note - - - : In the payload for PUT /bulkTransfers/<ID>/error - - - only the - - - errorInformation - - - field is - - - required - - - - - 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": <string>, - - - "errorDescription": <string>, - - - "extensionList": { - - - "extension": [ - - - { - - - "key": <string>, - - - "value": <string> - - - } - - - ] - - - } - - - } - - - } - - - - 1 - - - PUT - /bulkTransfers/<ID>/error - - - - - 2 - - - Persist request payload with messageId in cache - - - - - Message: { - - - messageId: <string>, - - - bulkTransferId: <string>, - - - payload: <object> - - - } - - - - individualTransferFulfils - - - - - 3 - - - Response of save operation - - - - - 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: reject, - - - createdAt: <timestamp>, - - - state: { - - - status: "success", - - - code: 0 - - - } - - - } - - - } - - - } - - - - - 4 - - - Produce bulk-fulfil message - - - - - 5 - - - Respond HTTP - 200 (OK) - - - - - 6 - - - Consume bulk-fulfil message - - - - - 7 - - - Perform duplicate check - - - - - 8 - - - Validate request - - - - - loop - - - [n times, n = number of individual transfers] - - - - - Message: { - - - transferId: <string>, - - - bulkTransferId< <string>, - - - bulkTransferAssociationRecord: { - - - transferId: <string>, - - - bulkTransferId: <string>, - - - bulkProcessingStateId: <string>, - - - errorCode: <string>, - - - errorDescription: <string> - - - } - - - } - - - - - 9 - - - Update bulkTransferAssociation table - - - - bulkTransferAssociation - - - - - 10 - - - Produce fulfil message with action bulk-abort for each individual transfer - - - - - loop - - - [n times, n = number of individual transfers] - - - - - 11 - - - Consume message - - - - - ref - - - Fulfil Handler Consume (bulk-abort) - - - - - 12 - - - Produce message - - - - - loop - - - [n times, n = number of individual transfers] - - - - - 13 - - - Consume message - - - - - ref - - - Position Handler Consume (bulk-abort) - - - - - 14 - - - Produce message - - - - - loop - - - [n times, n = number of individual transfers] - - - - - 15 - - - Consume individual transfer message - - - - - ref - - - Bulk Processing Handler Consume (bulk-abort) - - - - - 16 - - - Produce message (Payer) - - - - - 17 - - - Produce message (Payee) - - - - - 18 - - - Consume message (Payer) - - - - - 19 - - - Consume message (Payee) - - - - - opt - - - [action == 'bulk-abort'] - - - - - ref - - - Notification Handler (Payer) - - - - - 20 - - - Send callback notification - - - - - opt - - - [action == 'bulk-abort'] - - - - - ref - - - Notification Handler (Payee) - - - - - 21 - - - Send callback notification - + + 4.1.0. Bulk Transfer Abort + + + 4.1.0. Bulk Transfer Abort + + Financial Service Providers + + Bulk API Adapter Service + + Central Service + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + DFSP1 + Payer + + + DFSP1 + Payer + + + DFSP2 + Payee + + + DFSP2 + Payee + + + Bulk API Adapter + + + Bulk API Adapter + + + Bulk API Notification Event Handler + + + Bulk API Notification Event Handler + + + Central Service API + + + Central Service API + + + + + Bulk-Fulfil-Topic + + + Bulk-Fulfil-Topic + + + Fulfil-Topic + + + Fulfil-Topic + Bulk Fulfil Event Handler + + + Bulk Fulfil Event Handler + + + Fulfil Event Handler + + + Fulfil Event Handler + + + + + topic-transfer-position + + + topic-transfer-position + + + Event-Topic + + + Event-Topic + Position Event Handler + + + Position Event Handler + + + + + topic-bulk-processing + + + topic-bulk-processing + Bulk Processing Event Handler + + + Bulk Processing Event Handler + + + + + Notification-Topic + + + Notification-Topic + + + mojaloop- + object-store + ( + MLOS + ) + + + mojaloop- + object-store + ( + MLOS + ) + Central Services DB + + + Central Services DB + + + + + + + + + + + + + + DFSP2 sends a Fulfil Abort Transfer request + + + Note + : In the payload for PUT /bulkTransfers/<ID>/error + only the + errorInformation + field is + required + + + 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": <string>, + "errorDescription": <string>, + "extensionList": { + "extension": [ + { + "key": <string>, + "value": <string> + } + ] + } + } + } + + + + 1 + PUT - /bulkTransfers/<ID>/error + + + 2 + Persist request payload with messageId in cache + + + Message: { + messageId: <string>, + bulkTransferId: <string>, + payload: <object> + } + + individualTransferFulfils + + + 3 + Response of save operation + + + 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: reject, + createdAt: <timestamp>, + state: { + status: "success", + code: 0 + } + } + } + } + + + 4 + Produce bulk-fulfil message + + + + 5 + Respond HTTP - 200 (OK) + + + 6 + Consume bulk-fulfil message + + + + + 7 + Perform duplicate check + + + + + 8 + Validate request + + + loop + [n times, n = number of individual transfers] + + + Message: { + transferId: <string>, + bulkTransferId< <string>, + bulkTransferAssociationRecord: { + transferId: <string>, + bulkTransferId: <string>, + bulkProcessingStateId: <string>, + errorCode: <string>, + errorDescription: <string> + } + } + + + 9 + Update bulkTransferAssociation table + + bulkTransferAssociation + + + 10 + Produce fulfil message with action bulk-abort for each individual transfer + + + loop + [n times, n = number of individual transfers] + + + 11 + Consume message + + + ref + Fulfil Handler Consume (bulk-abort) +   + + + 12 + Produce message + + + loop + [n times, n = number of individual transfers] + + + 13 + Consume message + + + ref + Position Handler Consume (bulk-abort) +   + + + 14 + Produce message + + + loop + [n times, n = number of individual transfers] + + + 15 + Consume individual transfer message + + + ref + Bulk Processing Handler Consume (bulk-abort) +   + + + 16 + Produce message (Payer) + + + 17 + Produce message (Payee) + + + 18 + Consume message (Payer) + + + 19 + Consume message (Payee) + + + opt + [action == 'bulk-abort'] + + + ref + Notification Handler (Payer) +   + + + 20 + Send callback notification + + + opt + [action == 'bulk-abort'] + + + ref + Notification Handler (Payee) +   + + + 21 + Send callback notification + diff --git a/docs/technical/technical/central-bulk-transfers/assets/diagrams/sequence/seq-bulk-5.1.0-get-overview.svg b/docs/technical/technical/central-bulk-transfers/assets/diagrams/sequence/seq-bulk-5.1.0-get-overview.svg index 0c0bb595..9b520a21 100644 --- a/docs/technical/technical/central-bulk-transfers/assets/diagrams/sequence/seq-bulk-5.1.0-get-overview.svg +++ b/docs/technical/technical/central-bulk-transfers/assets/diagrams/sequence/seq-bulk-5.1.0-get-overview.svg @@ -1,552 +1,295 @@ - - - - - - - - - - - 5.1.0. Request Bulk Transfer Status - - - - Financial Service Provider - - - - Bulk API Adapter Service - - - - Central Ledger - - - - - - - - - DFSP(n) - - - Participant - - - - - DFSP(n) - - - Participant - - - - - Bulk API Adapter - - - - - Bulk API Adapter - - - - - Bulk API Notification Event Handler - - - - - Bulk API Notification Event Handler - - - - - - - Topic-Transfer-Get - - - - - Topic-Transfer-Get - - - GET Event Handler - - - - - GET Event Handler - - - - - Bulk Transfer DAO - - - - - Bulk Transfer DAO - - - - - Central Store - - - - - Central Store - - - - - - - - Request Bulk transfer status - - - - - 1 - - - Request bulk transfer status - GET - /bulkTransfers/{ID} - - - - - 2 - - - Publish event information - - - - - 3 - - - Respond HTTP - 200 (OK) - - - - - 4 - - - Consume message - - - - - ref - - - GET Handler Consume - - - - - 5 - - - Request bulk transfer participants - - - - - 6 - - - Fetch bulk transfer participants - - - - bulkTransfer - - - participant - - - - - 7 - - - Return query result - - - - - 8 - - - Return bulk transfer participants - - - - - alt - - - [Is request not from bulk transfer Payer or Payee FSP?] - - - - - { - - - "errorInformation": { - - - "errorCode": 3210, - - - "errorDescription": "Bulk transfer ID not found" - - - } - - - } - - - - - 9 - - - Publish notification event (404) - - - - - 10 - - - callback PUT on /bulkTransfers/{ID}/error - - - - - 11 - - - Request bulk transfer status - - - - - 12 - - - Fetch bulk transfer status - - - - bulkTransferStateChange - - - bulkTransferState - - - bulkTransferError - - - bulkTransferExtension - - - transferStateChange - - - transferState - - - transferFulfilment - - - transferError - - - transferExtension - - - ilpPacket - - - - - 13 - - - Return query result - - - - - 14 - - - Return bulk transfer status - - - - - alt - - - [Is there a bulk transfer with the given ID recorded in the system?] - - - - - alt - - - [Bulk Transfer state is - - - "PROCESSING" - - - ] - - - - - { - - - "bulkTransferState": "PROCESSING" - - - } - - - - - 15 - - - Publish notification event - - - - - 16 - - - Send callback - PUT /bulkTransfers/{ID} - - - - - alt - - - [Request is from Payee FSP?] - - - - - 17 - - - Exclude transfers with - - - transferStateId - - - not in - - - [ - - - COMMITTED - - - , - - - ABORTED_REJECTED - - - , - - - EXPIRED_RESERVED - - - ] - - - - - { - - - "bulkTransferState": "<BulkTransferState>", - - - "individualTransferResults": [ - - - { - - - "transferId": "<TransferId>", - - - "fulfilment": "WLctttbu2HvTsa1XWvUoGRcQozHsqeu9Ahl2JW9Bsu8", - - - "errorInformation": <ErrorInformationObject>, - - - "extensionList": { - - - "extension": - - - [ - - - { - - - "key": "Description", - - - "value": "This is a more detailed description" - - - } - - - ] - - - } - - - } - - - ], - - - "completedTimestamp": "2018-09-24T08:38:08.699-04:00", - - - "extensionList": - - - { - - - "extension": - - - [ - - - { - - - "key": "Description", - - - "value": "This is a more detailed description" - - - } - - - ] - - - } - - - } - - - - - NOTE: If transfer is REJECTED, error information may be provided. - - - Either fulfilment or errorInformation should be set, not both. - - - - - 18 - - - Publish notification event - - - - - 19 - - - callback PUT on /bulkTransfers/{ID} - - - - - Log ERROR event - - - - [A bulk transfer with the given ID is not present in the System or this is an invalid request] - - - - - { - - - "errorInformation": { - - - "errorCode": 3210, - - - "errorDescription": "Bulk transfer ID not found" - - - } - - - } - - - - - 20 - - - Publish notification event (404) - - - - - 21 - - - callback PUT on /bulkTransfers/{ID}/error - + + 5.1.0. Request Bulk Transfer Status + + + 5.1.0. Request Bulk Transfer Status + + Financial Service Provider + + Bulk API Adapter Service + + Central Ledger + + + + + + + + + + + + + + + + + + + + + + + + + + + DFSP(n) + Participant + + + DFSP(n) + Participant + + + Bulk API Adapter + + + Bulk API Adapter + + + Bulk API Notification Event Handler + + + Bulk API Notification Event Handler + + + + + Topic-Transfer-Get + + + Topic-Transfer-Get + GET Event Handler + + + GET Event Handler + + + Bulk Transfer DAO + + + Bulk Transfer DAO + + + Central Store + + + Central Store + + + + + + + + + + + + + + + + + + + Request Bulk transfer status + + + 1 + Request bulk transfer status - GET - /bulkTransfers/{ID} + + + 2 + Publish event information + + + 3 + Respond HTTP - 200 (OK) + + + 4 + Consume message + + + ref + GET Handler Consume +   + + + 5 + Request bulk transfer participants + + + 6 + Fetch bulk transfer participants + + bulkTransfer + participant + + + 7 + Return query result + + + 8 + Return bulk transfer participants + + + alt + [Is request not from bulk transfer Payer or Payee FSP?] + + + { + "errorInformation": { + "errorCode": 3210, + "errorDescription": "Bulk transfer ID not found" + } + } + + + 9 + Publish notification event (404) + + + 10 + callback PUT on /bulkTransfers/{ID}/error + + + 11 + Request bulk transfer status + + + 12 + Fetch bulk transfer status + + bulkTransferStateChange + bulkTransferState + bulkTransferError + bulkTransferExtension + transferStateChange + transferState + transferFulfilment + transferError + transferExtension + ilpPacket + + + 13 + Return query result + + + 14 + Return bulk transfer status + + + alt + [Is there a bulk transfer with the given ID recorded in the system?] + + + alt + [Bulk Transfer state is + "PROCESSING" + ] + + + { + "bulkTransferState": "PROCESSING" + } + + + 15 + Publish notification event + + + 16 + Send callback - PUT /bulkTransfers/{ID} + + + alt + [Request is from Payee FSP?] + + + + + + 17 + Exclude transfers with + transferStateId + not in + [ + COMMITTED + , + ABORTED_REJECTED + , + EXPIRED_RESERVED + ] + + + { + "bulkTransferState": "<BulkTransferState>", + "individualTransferResults": [ + { + "transferId": "<TransferId>", + "fulfilment": "WLctttbu2HvTsa1XWvUoGRcQozHsqeu9Ahl2JW9Bsu8", + "errorInformation": <ErrorInformationObject>, + "extensionList": { + "extension": + [ + { + "key": "Description", + "value": "This is a more detailed description" + } + ] + } + } + ], + "completedTimestamp": "2018-09-24T08:38:08.699-04:00", + "extensionList": + { + "extension": + [ + { + "key": "Description", + "value": "This is a more detailed description" + } + ] + } + } + + + NOTE: If transfer is REJECTED, error information may be provided. + Either fulfilment or errorInformation should be set, not both. + + + 18 + Publish notification event + + + 19 + callback PUT on /bulkTransfers/{ID} + + + Log ERROR event + + [A bulk transfer with the given ID is not present in the System or this is an invalid request] + + + { + "errorInformation": { + "errorCode": 3210, + "errorDescription": "Bulk transfer ID not found" + } + } + + + 20 + Publish notification event (404) + + + 21 + callback PUT on /bulkTransfers/{ID}/error + diff --git a/docs/technical/technical/central-event-processor/assets/diagrams/sequence/seq-event-9.1.0.svg b/docs/technical/technical/central-event-processor/assets/diagrams/sequence/seq-event-9.1.0.svg index 3467bfa8..37ea1f2b 100644 --- a/docs/technical/technical/central-event-processor/assets/diagrams/sequence/seq-event-9.1.0.svg +++ b/docs/technical/technical/central-event-processor/assets/diagrams/sequence/seq-event-9.1.0.svg @@ -1,90 +1,83 @@ - - - - - - - - - - + + 9.1.0. Event Handler Placeholder + - 9.1.0. Event Handler Placeholder - - Event Handler Placeholder - - - - - - Event Handler Placeholder - - - Event Handler Placeholder - - - - - Event-Topic - - - Event-Topic - - - - - Event Handler Placeholder - - - 1 - Consume Event message - - Error code: - 2001 - - - Message: - { - from: <transferHeaders.FSPIOP-Source>, - to: <transferHeaders.FSPIOP-Destination>, - type: application/json, - content: { - headers: <transferHeaders>, - payload: <transferMessage> - }, - metadata: { - event: { - id: <uuid>, - type: INFO, - action: AUDIT, - createdAt: <timestamp>, - state: { - status: "success", - code: 0 - } - } - } - } - - - The type would be an ENUM with values: - [INFO, DEBUG, ERROR, WARN, FATAL, TRACE] - Possible values for "action" would be - [AUDIT, EXCEPTION] - The event messages can be handled based on the values of these two variables - (when the placeholder is extended). - - - - - 2 - Auto-commit - - Error code: - 2001 - - - Currently events to only be published as part of the placeholder. - This can be evolved to add relevant functionality. + 9.1.0. Event Handler Placeholder + + Event Handler Placeholder + + + + + + Event Handler Placeholder + + + Event Handler Placeholder + + + + + Event-Topic + + + Event-Topic + + + + + Event Handler Placeholder + + + 1 + Consume Event message +   + Error code: + 2001 + + + Message: + { + from: <transferHeaders.FSPIOP-Source>, + to: <transferHeaders.FSPIOP-Destination>, + type: application/json, + content: { + headers: <transferHeaders>, + payload: <transferMessage> + }, + metadata: { + event: { + id: <uuid>, + type: INFO, + action: AUDIT, + createdAt: <timestamp>, + state: { + status: "success", + code: 0 + } + } + } + } + + + The type would be an ENUM with values: + [INFO, DEBUG, ERROR, WARN, FATAL, TRACE] + Possible values for "action" would be + [AUDIT, EXCEPTION] + The event messages can be handled based on the values of these two variables + (when the placeholder is extended). + + + + + 2 + Auto-commit +   + Error code: + 2001 + + + Currently events to only be published as part of the placeholder. + This can be evolved to add relevant functionality. diff --git a/docs/technical/technical/central-event-processor/assets/diagrams/sequence/seq-notification-reject-5.1.1.svg b/docs/technical/technical/central-event-processor/assets/diagrams/sequence/seq-notification-reject-5.1.1.svg index 9f61317b..3dfc4a19 100644 --- a/docs/technical/technical/central-event-processor/assets/diagrams/sequence/seq-notification-reject-5.1.1.svg +++ b/docs/technical/technical/central-event-processor/assets/diagrams/sequence/seq-notification-reject-5.1.1.svg @@ -1,167 +1,160 @@ - - - - - - - - - - + + 5.1.1. Notification Handler for Rejections + - 5.1.1. Notification Handler for Rejections - - Financial Service Providers - - ML API Adapter Service - - Central Service - - - - - - - - - - - - - - - DFSP1 - Payer - - - DFSP1 - Payer - - - ML API Notification Event Handler - - - ML API Notification Event Handler - - - Central Service API - - - Central Service API - - - - - Event-Topic - - - Event-Topic - - - Notification-Topic - - - Notification-Topic - - - - - - - DFSP Notified of Rejection - - - 1 - Consume Notification event message - - Error code: - 2001 - - - Persist Event Information - - - 2 - Publish event information - - Error code: - 3201 - - - ref - Event Handler - - - alt - [consume a single messages] - - - Validate Event - - - - - 3 - Validate event - Rule: type == 'notification' && [action IN ['reject', 'timeout-received', 'timeout-reserved']] - - - 4 - Request Participant Callback details - - Error code: - 3201 - - - ref - Get Participant Callback Details - - - 5 - Return Participant Callback details - - - Message: - { - id: <ID>, - from: <transferHeaders.FSPIOP-Source>, - to: <transferHeaders.FSPIOP-Destination>, - type: application/json, - content: { - payload: <transferMessage> - }, - } - - - 6 - Send Callback Notification - - Error code: - 1000, 1001, 3002 - - [Validate rule type != 'notification' / Error] - - - Message: - { - "errorInformation": { - "errorCode": <errorCode>, - "errorDescription": <ErrorMessage>, - } - } - - - 7 - Invalid messages retrieved from the Notification Topic - - Error code: - 3201 - - - ref - Event Handler - - - Log ERROR Messages - Update Event log upon ERROR notification + 5.1.1. Notification Handler for Rejections + + Financial Service Providers + + ML API Adapter Service + + Central Service + + + + + + + + + + + + + + DFSP1 + Payer + + + DFSP1 + Payer + + + ML API Notification Event Handler + + + ML API Notification Event Handler + + + Central Service API + + + Central Service API + + + + + Event-Topic + + + Event-Topic + + + Notification-Topic + + + Notification-Topic + + + + + + + DFSP Notified of Rejection + + + 1 + Consume Notification event message +   + Error code: + 2001 + + + Persist Event Information + + + 2 + Publish event information +   + Error code: + 3201 + + + ref + Event Handler + + + alt + [consume a single messages] + + + Validate Event + + + + + + 3 + Validate event - Rule: type == 'notification' && [action IN ['reject', 'timeout-received', 'timeout-reserved']] + + + 4 + Request Participant Callback details +   + Error code: + 3201 + + + ref + Get Participant Callback Details + + + 5 + Return Participant Callback details + + + Message: + { + id: <ID>, + from: <transferHeaders.FSPIOP-Source>, + to: <transferHeaders.FSPIOP-Destination>, + type: application/json, + content: { + payload: <transferMessage> + }, + } + + + 6 + Send Callback Notification +   + Error code: + 1000, 1001, 3002 + + [Validate rule type != 'notification' / Error] + + + Message: + { + "errorInformation": { + "errorCode": <errorCode>, + "errorDescription": <ErrorMessage>, + } + } + + + 7 + Invalid messages retrieved from the Notification Topic +   + Error code: + 3201 + + + ref + Event Handler + + + Log ERROR Messages + Update Event log upon ERROR notification diff --git a/docs/technical/technical/central-event-processor/assets/diagrams/sequence/seq-signature-validation.svg b/docs/technical/technical/central-event-processor/assets/diagrams/sequence/seq-signature-validation.svg index c5146cbb..86939d30 100644 --- a/docs/technical/technical/central-event-processor/assets/diagrams/sequence/seq-signature-validation.svg +++ b/docs/technical/technical/central-event-processor/assets/diagrams/sequence/seq-signature-validation.svg @@ -1,36 +1,29 @@ - - - - - - - - - - + + Signature Validation + - Signature Validation - - - - Alice - - Alice - - Bob - - Bob - - - Authentication Request - - - Authentication Response - - - Another authentication Request - - - another authentication Response + Signature Validation + + + + Alice + + Alice + + Bob + + Bob + + + Authentication Request + + + Authentication Response + + + Another authentication Request + + + another authentication Response diff --git a/docs/technical/technical/central-ledger/assets/diagrams/sequence/seq-callback-3.1.0.svg b/docs/technical/technical/central-ledger/assets/diagrams/sequence/seq-callback-3.1.0.svg index c7acd7bd..108afd9d 100644 --- a/docs/technical/technical/central-ledger/assets/diagrams/sequence/seq-callback-3.1.0.svg +++ b/docs/technical/technical/central-ledger/assets/diagrams/sequence/seq-callback-3.1.0.svg @@ -1,409 +1,228 @@ - - - - - - - - - - - 3.1.0 Get Participant Callback Details - - - - ML API Adapter Service - - - - Central Services - - - - - - - - - ML-API-ADAPTER - - - - - ML-API-ADAPTER - - - - - Central Service API - - - - - Central Service API - - - - - Participant Handler - - - - - Participant Handler - - - - - Participant DAO - - - - - Participant DAO - - - - - Central Store - - - - - Central Store - - - - - - - - Get Callback Details - - - - - 1 - - - Request to get callback details - GET - /participants/{name}/endpoints?type={typeValue} - - - - - 2 - - - Fetch Callback details for Participant - - - - - 3 - - - Fetch Participant - - - Error code: - - - 3200 - - - - - 4 - - - Fetch Participant - - - - participant - - - - - 5 - - - Retrieved Participant - - - - - 6 - - - Return Participant - - - - - 7 - - - Validate DFSP - - - - - alt - - - [Validate participant (success)] - - - - - 8 - - - check if "type" parameter is sent - - - - - alt - - - [Check if "type" parameter is sent (Sent)] - - - - - 9 - - - Fetch Callback details for Participant and type - - - Error code: - - - 3000 - - - - - 10 - - - Fetch Callback details for Participant and type - - - - - Condition: - - - isActive = 1 - - - [endpointTypeId = <type>] - - - - participantEndpoint - - - - - 11 - - - Retrieved Callback details for Participant and type - - - - - 12 - - - Return Callback details for Participant and type - - - - - Message: - - - { - - - endpoints: {type: <type>, value: <value>} - - - } - - - - - 13 - - - Return Callback details for Participant - - - - - 14 - - - Return Callback details for Participant - - - - [Check if "type" parameter is sent (Not Sent)] - - - - - 15 - - - Fetch Callback details for Participant - - - Error code: - - - 3000 - - - - - 16 - - - Fetch Callback details for Participant - - - - - Condition: - - - isActive = 1 - - - - participantEndpoint - - - - - 17 - - - Retrieved Callback details for Participant - - - - - 18 - - - Return Callback details for Participant - - - - - Message: - - - { - - - endpoints: [ - - - {type: <type>, value: <value>}, - - - {type: <type>, value: <value>} - - - ] - - - } - - - - - 19 - - - Return Callback details for Participant - - - - - 20 - - - Return Callback details for Participant - - - - [Validate participant (failure)/ Error] - - - - - Validation failure/ Error! - - - - - Message: - - - { - - - "errorInformation": { - - - "errorCode": <errorCode>, - - - "errorDescription": <ErrorMessage>, - - - } - - - } - - - - - 21 - - - Return - - - Error code: - - - 3000, 3200 - - - - - 22 - - - Return - - - Error code: - - - 3000, 3200 - + + 3.1.0 Get Participant Callback Details + + + 3.1.0 Get Participant Callback Details + + ML API Adapter Service + + Central Services + + + + + + + + + + + + + + + + + + + ML-API-ADAPTER + + + ML-API-ADAPTER + + + Central Service API + + + Central Service API + + + Participant Handler + + + Participant Handler + + + Participant DAO + + + Participant DAO + + + Central Store + + + Central Store + + + + + + + + + + + + + + + Get Callback Details + + + 1 + Request to get callback details - GET - /participants/{name}/endpoints?type={typeValue} + + + 2 + Fetch Callback details for Participant + + + 3 + Fetch Participant + Error code: + 3200 + + + 4 + Fetch Participant + + participant + + + 5 + Retrieved Participant + + + 6 + Return Participant + + + + + 7 + Validate DFSP + + + alt + [Validate participant (success)] + + + + + 8 + check if "type" parameter is sent + + + alt + [Check if "type" parameter is sent (Sent)] + + + 9 + Fetch Callback details for Participant and type + Error code: + 3000 + + + 10 + Fetch Callback details for Participant and type + + + Condition: + isActive = 1 + [endpointTypeId = <type>] + + participantEndpoint + + + 11 + Retrieved Callback details for Participant and type + + + 12 + Return Callback details for Participant and type + + + Message: + { + endpoints: {type: <type>, value: <value>} + } + + + 13 + Return Callback details for Participant + + + 14 + Return Callback details for Participant + + [Check if "type" parameter is sent (Not Sent)] + + + 15 + Fetch Callback details for Participant + Error code: + 3000 + + + 16 + Fetch Callback details for Participant + + + Condition: + isActive = 1 + + participantEndpoint + + + 17 + Retrieved Callback details for Participant + + + 18 + Return Callback details for Participant + + + Message: + { + endpoints: [ + {type: <type>, value: <value>}, + {type: <type>, value: <value>} + ] + } + + + 19 + Return Callback details for Participant + + + 20 + Return Callback details for Participant + + [Validate participant (failure)/ Error] + + + Validation failure/ Error! + + + Message: + { + "errorInformation": { + "errorCode": <errorCode>, + "errorDescription": <ErrorMessage>, + } + } + + + 21 + Return + Error code: + 3000, 3200 + + + 22 + Return + Error code: + 3000, 3200 + diff --git a/docs/technical/technical/central-ledger/assets/diagrams/sequence/seq-callback-add-3.1.0.svg b/docs/technical/technical/central-ledger/assets/diagrams/sequence/seq-callback-add-3.1.0.svg index 975978dd..e214ffaf 100644 --- a/docs/technical/technical/central-ledger/assets/diagrams/sequence/seq-callback-add-3.1.0.svg +++ b/docs/technical/technical/central-ledger/assets/diagrams/sequence/seq-callback-add-3.1.0.svg @@ -1,400 +1,215 @@ - - - - - - - - - - - 3.1.0 Add Participant Callback Details - - - - Central Services - - - - - - - - - HUB OPERATOR - - - - - HUB OPERATOR - - - - - Central Service API - - - - - Central Service API - - - - - Participant Handler - - - - - Participant Handler - - - - - Participant DAO - - - - - Participant DAO - - - - - Central Store - - - - - Central Store - - - - - - - - Add Callback Details - - - - - 1 - - - Request to add callback details - POST - /paticipants/{name}/endpoints - - - - - Message: - - - { - - - payload: { - - - endpoint: { - - - type: <typeValue>, - - - value: <endpointValue> - - - } - - - } - - - } - - - - - 2 - - - Add Callback details for Participant - - - - - 3 - - - Fetch Participant - - - Error code: - - - 3200 - - - - - 4 - - - Fetch Participant - - - - participant - - - - - 5 - - - Retrieved Participant - - - - - 6 - - - Return Participant - - - - - 7 - - - Validate DFSP - - - - - alt - - - [Validate participant (success)] - - - - - 8 - - - Add Callback details for Participant - - - Error code: - - - 2003/ - - - Msg: - - - Service unavailable - - - Error code: - - - 2001/ - - - Msg: - - - Internal Server Error - - - - - 9 - - - Persist Participant Endpoint - - - - participantEndpoint - - - - - If (endpoint exists && isActive = 1) - - - oldEndpoint.isActive = 0 - - - insert endpoint - - - Else - - - insert endpoint - - - End - - - - - 10 - - - Return status - - - - - 11 - - - Validate status - - - - - alt - - - [Validate status (success)] - - - - - 12 - - - Return Status Code 201 - - - - - 13 - - - Return Status Code 201 - - - - [Validate status (failure) / Error] - - - - - Error! - - - - - Message: - - - { - - - "errorInformation": { - - - "errorCode": <Error Code>, - - - "errorDescription": <Msg>, - - - } - - - } - - - - - 14 - - - Return - - - Error code - - - - - 15 - - - Return - - - Error code - - - - [Validate participant (failure)] - - - - - Validation failure! - - - - - Message: - - - { - - - "errorInformation": { - - - "errorCode": 3200, - - - "errorDescription": "FSP id Not Found", - - - } - - - } - - - - - 16 - - - Return - - - Error code: - - - 3200 - - - - - 17 - - - Return - - - Error code: - - - 3200 - + + 3.1.0 Add Participant Callback Details + + + 3.1.0 Add Participant Callback Details + + Central Services + + + + + + + + + + + + + + + + + HUB OPERATOR + + + HUB OPERATOR + + + Central Service API + + + Central Service API + + + Participant Handler + + + Participant Handler + + + Participant DAO + + + Participant DAO + + + Central Store + + + Central Store + + + + + + + + + + + + + Add Callback Details + + + 1 + Request to add callback details - POST - /paticipants/{name}/endpoints + + + Message: + { + payload: { + endpoint: { + type: <typeValue>, + value: <endpointValue> + } + } + } + + + 2 + Add Callback details for Participant + + + 3 + Fetch Participant + Error code: + 3200 + + + 4 + Fetch Participant + + participant + + + 5 + Retrieved Participant + + + 6 + Return Participant + + + + + 7 + Validate DFSP + + + alt + [Validate participant (success)] + + + 8 + Add Callback details for Participant + Error code: + 2003/ + Msg: + Service unavailable +   + Error code: + 2001/ + Msg: + Internal Server Error + + + 9 + Persist Participant Endpoint + + participantEndpoint + + + If (endpoint exists && isActive = 1) + oldEndpoint.isActive = 0 + insert endpoint + Else + insert endpoint + End +      + + + 10 + Return status + + + + + 11 + Validate status + + + alt + [Validate status (success)] + + + 12 + Return Status Code 201 + + + 13 + Return Status Code 201 + + [Validate status (failure) / Error] + + + Error! + + + Message: + { + "errorInformation": { + "errorCode": <Error Code>, + "errorDescription": <Msg>, + } + } + + + 14 + Return + Error code + + + 15 + Return + Error code + + [Validate participant (failure)] + + + Validation failure! + + + Message: + { + "errorInformation": { + "errorCode": 3200, + "errorDescription": "FSP id Not Found", + } + } + + + 16 + Return + Error code: + 3200 + + + 17 + Return + Error code: + 3200 + diff --git a/docs/technical/technical/central-ledger/assets/diagrams/sequence/seq-fulfil-2.1.0-v1.1.svg b/docs/technical/technical/central-ledger/assets/diagrams/sequence/seq-fulfil-2.1.0-v1.1.svg index 1a04bdb4..63ae6110 100644 --- a/docs/technical/technical/central-ledger/assets/diagrams/sequence/seq-fulfil-2.1.0-v1.1.svg +++ b/docs/technical/technical/central-ledger/assets/diagrams/sequence/seq-fulfil-2.1.0-v1.1.svg @@ -1,665 +1,342 @@ - - - - - - - - - - - 2.1.0. DFSP2 sends a Fulfil Success Transfer request v1.1 - - - - Financial Service Providers - - - - ML API Adapter Service - - - - Central Service - - - - - - - - - DFSP1 - - - Payer - - - - - DFSP1 - - - Payer - - - - - DFSP2 - - - Payee - - - - - DFSP2 - - - Payee - - - - - ML API Adapter - - - - - ML API Adapter - - - - - ML API Notification Event Handler - - - - - ML API Notification Event Handler - - - - - Central Service API - - - - - Central Service API - - - - - - - topic-fulfil - - - - - topic-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 - - - - - - DFSP2 sends a request for notification after tranfer is being committed in the Switch - - - - - 1 - - - Retrieve fulfilment string generated during - - - the quoting process or regenerate it using - - - Local secret - - - and - - - ILP Packet - - - as inputs - - - - - alt - - - [Send back notification reserve request] - - - - - 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: - - - { - - - "fulfilment": <IlpFulfilment>, - - - "transferState": "RESERVED" - - - "extensionList": { - - - "extension": [ - - - { - - - "key": <string>, - - - "value": <string> - - - } - - - ] - - - } - - - } - - - - [Send back commit request] - - - - - 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: - - - { - - - "fulfilment": <IlpFulfilment>, - - - "completedTimestamp": <DateTime>, - - - "transferState": "COMMITTED" - - - "extensionList": { - - - "extension": [ - - - { - - - "key": <string>, - - - "value": <string> - - - } - - - ] - - - } - - - } - - - - 2 - - - PUT - /transfers/<ID> - - - - - 3 - - - Validate incoming token and originator matching Payee - - - Error codes: - - - 3000-3002, 3100-3107 - - - - - 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: reserve || commit, - - - createdAt: <timestamp>, - - - state: { - - - status: "success", - - - code: 0 - - - } - - - } - - - } - - - } - - - - - 4 - - - Route & Publish Fulfil event for Payee - - - Error code: - - - 2003 - - - - - 5 - - - Ensure event is replicated as configured (ACKS=all) - - - Error code: - - - 2003 - - - - - 6 - - - Respond replication acknowledgements have been received - - - - - 7 - - - Respond HTTP - 200 (OK) - - - - - 8 - - - Consume message - - - - - ref - - - Fulfil Handler Consume (Success) { - - - - 2.1.1-v1.1 - - - - } - - - - - 9 - - - Produce message - - - - - 10 - - - Produce message - - - - - 11 - - - Consume message - - - - - ref - - - Settlement Model Handler Consume (Success) - - - - - 12 - - - Consume message - - - - - ref - - - Position Handler Consume (Success) - - - - - 13 - - - Produce message - - - - - 14 - - - Consume message - - - - - opt - - - [action == 'commit'] - - - - - ref - - - Send notification to Participant (Payer) - - - - - 15 - - - Send callback notification - - - - - 16 - - - Consume message - - - - - opt - - - [action == 'reserve'] - - - - - ref - - - Send notification to Participant (Payee) - - - - - 17 - - - Send callback notification - + + 2.1.0. DFSP2 sends a Fulfil Success Transfer request v1.1 + + + 2.1.0. DFSP2 sends a Fulfil Success Transfer request v1.1 + + Financial Service Providers + + ML API Adapter Service + + Central Service + + + + + + + + + + + + + + + + + + + + + + + DFSP1 + Payer + + + DFSP1 + Payer + + + DFSP2 + Payee + + + DFSP2 + Payee + + + ML API Adapter + + + ML API Adapter + + + ML API Notification Event Handler + + + ML API Notification Event Handler + + + Central Service API + + + Central Service API + + + + + topic-fulfil + + + topic-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 + + + + + + + + + DFSP2 sends a request for notification after tranfer is being committed in the Switch + + + + + + 1 + Retrieve fulfilment string generated during + the quoting process or regenerate it using + Local secret + and + ILP Packet + as inputs + + + alt + [Send back notification reserve request] + + + 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: + { + "fulfilment": <IlpFulfilment>, + "transferState": "RESERVED" + "extensionList": { + "extension": [ + { + "key": <string>, + "value": <string> + } + ] + } + } + + [Send back commit request] + + + 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: + { + "fulfilment": <IlpFulfilment>, + "completedTimestamp": <DateTime>, + "transferState": "COMMITTED" + "extensionList": { + "extension": [ + { + "key": <string>, + "value": <string> + } + ] + } + } + + + + 2 + PUT - /transfers/<ID> + + + + + 3 + Validate incoming token and originator matching Payee + Error codes: + 3000-3002, 3100-3107 + + + 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: reserve || commit, + createdAt: <timestamp>, + state: { + status: "success", + code: 0 + } + } + } + } + + + 4 + Route & Publish Fulfil event for Payee + Error code: + 2003 + + + + + + 5 + Ensure event is replicated as configured (ACKS=all) + Error code: + 2003 + + + 6 + Respond replication acknowledgements have been received + + + + 7 + Respond HTTP - 200 (OK) + + + 8 + Consume message + + + ref + Fulfil Handler Consume (Success) { + + 2.1.1-v1.1 + + } +   + + + 9 + Produce message + + + 10 + Produce message + + + 11 + Consume message + + + ref + Settlement Model Handler Consume (Success) +   + + + 12 + Consume message + + + ref + Position Handler Consume (Success) +   + + + 13 + Produce message + + + 14 + Consume message + + + opt + [action == 'commit'] + + + ref + Send notification to Participant (Payer) +   + + + 15 + Send callback notification + + + 16 + Consume message + + + opt + [action == 'reserve'] + + + ref + Send notification to Participant (Payee) +   + + + 17 + Send callback notification + diff --git a/docs/technical/technical/central-ledger/assets/diagrams/sequence/seq-fulfil-2.1.0.svg b/docs/technical/technical/central-ledger/assets/diagrams/sequence/seq-fulfil-2.1.0.svg index 052c4089..abe0d547 100644 --- a/docs/technical/technical/central-ledger/assets/diagrams/sequence/seq-fulfil-2.1.0.svg +++ b/docs/technical/technical/central-ledger/assets/diagrams/sequence/seq-fulfil-2.1.0.svg @@ -1,574 +1,307 @@ - - - - - - - - - - - 2.1.0. DFSP2 sends a Fulfil Success Transfer request - - - - Financial Service Providers - - - - ML API Adapter Service - - - - Central Service - - - - - - - DFSP1 - - - Payer - - - - - DFSP1 - - - Payer - - - - - DFSP2 - - - Payee - - - - - DFSP2 - - - Payee - - - - - ML API Adapter - - - - - ML API Adapter - - - - - ML API Notification Event Handler - - - - - ML API Notification Event Handler - - - - - Central Service API - - - - - Central Service API - - - - - - - topic-fulfil - - - - - topic-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 - - - - - - DFSP2 sends a Fulfil Success Transfer request - - - - - 1 - - - Retrieve fulfilment string generated during - - - the 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: - - - { - - - "fulfilment": <IlpFulfilment>, - - - "completedTimestamp": <DateTime>, - - - "transferState": "COMMITTED", - - - "extensionList": { - - - "extension": [ - - - { - - - "key": <string>, - - - "value": <string> - - - } - - - ] - - - } - - - } - - - - 2 - - - PUT - /transfers/<ID> - - - - - 3 - - - Validate incoming token and originator matching Payee - - - Error codes: - - - 3000-3002, 3100-3107 - - - - - 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: commit, - - - createdAt: <timestamp>, - - - state: { - - - status: "success", - - - code: 0 - - - } - - - } - - - } - - - } - - - - - 4 - - - Route & Publish Fulfil event for Payee - - - Error code: - - - 2003 - - - - - 5 - - - Ensure event is replicated as configured (ACKS=all) - - - Error code: - - - 2003 - - - - - 6 - - - Respond replication acknowledgements have been received - - - - - 7 - - - Respond HTTP - 200 (OK) - - - - - 8 - - - Consume message - - - - - ref - - - Fulfil Handler Consume (Success) { - - - - 2.1.1 - - - - } - - - - - 9 - - - Produce message - - - - - 10 - - - Produce message - - - - - 11 - - - Consume message - - - - - ref - - - Settlement Model Handler Consume (Success) - - - - - 12 - - - Consume message - - - - - ref - - - Position Handler Consume (Success) - - - - - 13 - - - Produce message - - - - - 14 - - - Consume message - - - - - opt - - - [action == 'commit'] - - - - - ref - - - Send notification to Participant (Payer) - - - - - 15 - - - Send callback notification - - - - - 16 - - - Consume message - - - - - opt - - - [action == 'commit'] - - - - - ref - - - Send notification to Participant (Payee) - - - - - 17 - - - Send callback notification - + + 2.1.0. DFSP2 sends a Fulfil Success Transfer request + + + 2.1.0. DFSP2 sends a Fulfil Success Transfer request + + Financial Service Providers + + ML API Adapter Service + + Central Service + + + + + + + + + + + + + + + + + + + + + + DFSP1 + Payer + + + DFSP1 + Payer + + + DFSP2 + Payee + + + DFSP2 + Payee + + + ML API Adapter + + + ML API Adapter + + + ML API Notification Event Handler + + + ML API Notification Event Handler + + + Central Service API + + + Central Service API + + + + + topic-fulfil + + + topic-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 + + + + + + + + + DFSP2 sends a Fulfil Success Transfer request + + + + + + 1 + Retrieve fulfilment string generated during + the 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: + { + "fulfilment": <IlpFulfilment>, + "completedTimestamp": <DateTime>, + "transferState": "COMMITTED", + "extensionList": { + "extension": [ + { + "key": <string>, + "value": <string> + } + ] + } + } + + + + 2 + PUT - /transfers/<ID> + + + + + 3 + Validate incoming token and originator matching Payee + Error codes: + 3000-3002, 3100-3107 + + + 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: commit, + createdAt: <timestamp>, + state: { + status: "success", + code: 0 + } + } + } + } + + + 4 + Route & Publish Fulfil event for Payee + Error code: + 2003 + + + + + + 5 + Ensure event is replicated as configured (ACKS=all) + Error code: + 2003 + + + 6 + Respond replication acknowledgements have been received + + + + 7 + Respond HTTP - 200 (OK) + + + 8 + Consume message + + + ref + Fulfil Handler Consume (Success) { + + 2.1.1 + + } +   + + + 9 + Produce message + + + 10 + Produce message + + + 11 + Consume message + + + ref + Settlement Model Handler Consume (Success) +   + + + 12 + Consume message + + + ref + Position Handler Consume (Success) +   + + + 13 + Produce message + + + 14 + Consume message + + + opt + [action == 'commit'] + + + ref + Send notification to Participant (Payer) +   + + + 15 + Send callback notification + + + 16 + Consume message + + + opt + [action == 'commit'] + + + ref + Send notification to Participant (Payee) +   + + + 17 + Send callback notification + diff --git a/docs/technical/technical/central-ledger/assets/diagrams/sequence/seq-fulfil-2.1.1-v1.1.svg b/docs/technical/technical/central-ledger/assets/diagrams/sequence/seq-fulfil-2.1.1-v1.1.svg index 9d931dc0..ad91cb1e 100644 --- a/docs/technical/technical/central-ledger/assets/diagrams/sequence/seq-fulfil-2.1.1-v1.1.svg +++ b/docs/technical/technical/central-ledger/assets/diagrams/sequence/seq-fulfil-2.1.1-v1.1.svg @@ -1,821 +1,439 @@ - - - - - - - - - - - 2.1.1. Fulfil Handler Consume (Success) v1.1 - - - - Central Service - - - - - - - - - - - - - - - - - - - - - - topic-fulfil - - - - - topic-fulfil - - - Fulfil Event - - - Handler - - - - - Fulfil Event - - - Handler - - - - - - - topic- - - - transfer-position - - - - - topic- - - - transfer-position - - - - - topic-event - - - - - topic-event - - - - - topic- - - - settlement-model - - - - - topic- - - - settlement-model - - - - - topic- - - - notification - - - - - topic- - - - notification - - - Position DAO - - - - - Position DAO - - - - - Central Store - - - - - Central Store - - - - - - - - Fulfil Handler Consume (Success) - - - - - alt - - - [Consume Single Message] - - - - - 1 - - - Consume Fulfil event message for Payer - - - - - break - - - - - Validate Event - - - - - 2 - - - Validate event - Rule: type == 'fulfil' && action IN ['commit', 'reserve'] - - - Error codes: - - - 2001 - - - - - Persist Event Information - - - - - 3 - - - Publish event information - - - - - ref - - - Event Handler Consume - - - - - Validate Duplicate Check - - - - - 4 - - - Request Duplicate Check - - - - - ref - - - Request Duplicate Check - - - - - 5 - - - Return { hasDuplicateId: Boolean, hasDuplicateHash: Boolean } - - - - - alt - - - [hasDuplicateId == TRUE && hasDuplicateHash == TRUE] - - - - - break - - - - - 6 - - - stateRecord = await getTransferState(transferId) - - - - - alt - - - [endStateList.includes(stateRecord.transferStateId)] - - - - - ref - - - getTransfer callback - - - - - 7 - - - Produce message - - - - - - Ignore - resend in progress - - - - [hasDuplicateId == TRUE && hasDuplicateHash == FALSE] - - - - - Validate Prepare Transfer (failure) - Modified Request - - - - [hasDuplicateId == FALSE] - - - - - Validate and persist Transfer Fulfilment - - - - - 8 - - - Request information for the validate checks - - - Error code: - - - 2003 - - - - - 9 - - - Fetch from database - - - - transfer - - - - - 10 - - - - - 11 - - - Return transfer - - - - - 12 - - - Validate that Transfer.ilpCondition = SHA-256 (content.payload.fulfilment) - - - Error code: - - - 2001 - - - - - 13 - - - Validate expirationDate - - - Error code: - - - 3303 - - - - - opt - - - [Transfer.ilpCondition validate successful] - - - - - Request current Settlement Window - - - - - 14 - - - Request to retrieve current/latest transfer settlement window - - - Error code: - - - 2003 - - - - - 15 - - - Fetch settlementWindowId - - - - settlementWindow - - - - - 16 - - - - - 17 - - - Return settlementWindowId to be appended during transferFulfilment insert - - - TODO - - - : During settlement design make sure transfers in 'RECEIVED-FULFIL' - - - state are updated to the next settlement window - - - - - Persist fulfilment - - - - - 18 - - - Persist fulfilment with the result of the above check (transferFulfilment.isValid) - - - Error code: - - - 2003 - - - - - 19 - - - Persist to database - - - - transferFulfilment - - - transferExtension - - - - - 20 - - - Return success - - - - - alt - - - [Transfer.ilpCondition validate successful] - - - - - Persist Transfer State (with transferState='RECEIVED-FULFIL') - - - - - 21 - - - Request to persist transfer state - - - Error code: - - - 2003 - - - - - 22 - - - Persist transfer state - - - - transferStateChange - - - - - 23 - - - Return success - - - - - Message: - - - { - - - id: <id>, - - - from: switch, - - - to: switch, - - - type: application/json - - - content: { - - - payload: { - - - transferId: {id} - - - } - - - }, - - - metadata: { - - - event: { - - - id: <uuid>, - - - responseTo: <previous.uuid>, - - - type: setmodel, - - - action: commit, - - - createdAt: <timestamp>, - - - state: { - - - status: "success", - - - code: 0 - - - } - - - } - - - } - - - } - - - - - 24 - - - Route & Publish settlement model event - - - - - Message: - - - { - - - id: <id>, - - - from: <transferHeaders.FSPIOP-Source>, - - - to: <transferHeaders.FSPIOP-Destination>, - - - type: application/json, - - - content: { - - - headers: <transferHeaders>, - - - payload: <transferMessage> - - - }, - - - metadata: { - - - event: { - - - id: <uuid>, - - - responseTo: <previous.uuid>, - - - type: position, - - - action: commit || reserve, - - - createdAt: <timestamp>, - - - state: { - - - status: "success", - - - code: 0 - - - } - - - } - - - } - - - } - - - - - 25 - - - Route & Publish Position event for Payee - - - - [Validate Fulfil Transfer not successful] - - - - - Persist Transfer State (with transferState='ABORTED') - - - - - 26 - - - Request to persist transfer state - - - Error code: - - - 2003 - - - - - 27 - - - Persist transfer state - - - - transferStateChange - - - - - 28 - - - Return success - - - - - Message: - - - { - - - id: <id>, - - - from: <transferHeaders.FSPIOP-Source>, - - - to: <transferHeaders.FSPIOP-Destination>, - - - type: application/json, - - - content: { - - - headers: <transferHeaders>, - - - payload: <transferMessage> - - - }, - - - metadata: { - - - event: { - - - id: <uuid>, - - - responseTo: <previous.uuid>, - - - type: position, - - - action: abort, - - - createdAt: <timestamp>, - - - state: { - - - status: "error", - - - code: 1 - - - } - - - } - - - } - - - } - - - - - 29 - - - Route & Publish Position event for Payer - - - - [Consume Batch Messages] - - - - - To be delivered by future story - + + 2.1.1. Fulfil Handler Consume (Success) v1.1 + + + 2.1.1. Fulfil Handler Consume (Success) v1.1 + + Central Service + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + topic-fulfil + + + topic-fulfil + Fulfil Event + Handler + + + Fulfil Event + Handler + + + + + topic- + transfer-position + + + topic- + transfer-position + + + topic-event + + + topic-event + + + topic- + settlement-model + + + topic- + settlement-model + + + topic- + notification + + + topic- + notification + Position DAO + + + Position DAO + + + Central Store + + + Central Store + + + + + + + + + + + + + + + + + + + + Fulfil Handler Consume (Success) + + + alt + [Consume Single Message] + + + 1 + Consume Fulfil event message for Payer + + + break + + + Validate Event + + + + + + 2 + Validate event - Rule: type == 'fulfil' && action IN ['commit', 'reserve'] + Error codes: + 2001 + + + Persist Event Information + + + 3 + Publish event information + + + ref + Event Handler Consume +   + + + Validate Duplicate Check + + + 4 + Request Duplicate Check + + + ref + Request Duplicate Check +   + + + 5 + Return { hasDuplicateId: Boolean, hasDuplicateHash: Boolean } + + + alt + [hasDuplicateId == TRUE && hasDuplicateHash == TRUE] + + + break + + + + + 6 + stateRecord = await getTransferState(transferId) + + + alt + [endStateList.includes(stateRecord.transferStateId)] + + + ref + getTransfer callback +   + + + 7 + Produce message + + + + Ignore - resend in progress + + [hasDuplicateId == TRUE && hasDuplicateHash == FALSE] + + + Validate Prepare Transfer (failure) - Modified Request + + [hasDuplicateId == FALSE] + + + Validate and persist Transfer Fulfilment + + + 8 + Request information for the validate checks + Error code: + 2003 + + + 9 + Fetch from database + + transfer + + + 10 +   + + + 11 + Return transfer + + + + + 12 + Validate that Transfer.ilpCondition = SHA-256 (content.payload.fulfilment) + Error code: + 2001 + + + + + 13 + Validate expirationDate + Error code: + 3303 + + + opt + [Transfer.ilpCondition validate successful] + + + Request current Settlement Window + + + 14 + Request to retrieve current/latest transfer settlement window + Error code: + 2003 + + + 15 + Fetch settlementWindowId + + settlementWindow + + + 16 +   + + + 17 + Return settlementWindowId to be appended during transferFulfilment insert + TODO + : During settlement design make sure transfers in 'RECEIVED-FULFIL' + state are updated to the next settlement window + + + Persist fulfilment + + + 18 + Persist fulfilment with the result of the above check (transferFulfilment.isValid) + Error code: + 2003 + + + 19 + Persist to database + + transferFulfilment + transferExtension + + + 20 + Return success + + + alt + [Transfer.ilpCondition validate successful] + + + Persist Transfer State (with transferState='RECEIVED-FULFIL') + + + 21 + Request to persist transfer state + Error code: + 2003 + + + 22 + Persist transfer state + + transferStateChange + + + 23 + Return success + + + Message: + { + id: <id>, + from: switch, + to: switch, + type: application/json + content: { + payload: { + transferId: {id} + } + }, + metadata: { + event: { + id: <uuid>, + responseTo: <previous.uuid>, + type: setmodel, + action: commit, + createdAt: <timestamp>, + state: { + status: "success", + code: 0 + } + } + } + } + + + 24 + Route & Publish settlement model event + + + Message: + { + id: <id>, + from: <transferHeaders.FSPIOP-Source>, + to: <transferHeaders.FSPIOP-Destination>, + type: application/json, + content: { + headers: <transferHeaders>, + payload: <transferMessage> + }, + metadata: { + event: { + id: <uuid>, + responseTo: <previous.uuid>, + type: position, + action: commit || reserve, + createdAt: <timestamp>, + state: { + status: "success", + code: 0 + } + } + } + } + + + 25 + Route & Publish Position event for Payee + + [Validate Fulfil Transfer not successful] + + + Persist Transfer State (with transferState='ABORTED') + + + 26 + Request to persist transfer state + Error code: + 2003 + + + 27 + Persist transfer state + + transferStateChange + + + 28 + Return success + + + Message: + { + id: <id>, + from: <transferHeaders.FSPIOP-Source>, + to: <transferHeaders.FSPIOP-Destination>, + type: application/json, + content: { + headers: <transferHeaders>, + payload: <transferMessage> + }, + metadata: { + event: { + id: <uuid>, + responseTo: <previous.uuid>, + type: position, + action: abort, + createdAt: <timestamp>, + state: { + status: "error", + code: 1 + } + } + } + } + + + 29 + Route & Publish Position event for Payer + + [Consume Batch Messages] + + + To be delivered by future story + diff --git a/docs/technical/technical/central-ledger/assets/diagrams/sequence/seq-fulfil-2.1.1.svg b/docs/technical/technical/central-ledger/assets/diagrams/sequence/seq-fulfil-2.1.1.svg index de1888f4..aa745728 100644 --- a/docs/technical/technical/central-ledger/assets/diagrams/sequence/seq-fulfil-2.1.1.svg +++ b/docs/technical/technical/central-ledger/assets/diagrams/sequence/seq-fulfil-2.1.1.svg @@ -1,821 +1,439 @@ - - - - - - - - - - - 2.1.1. Fulfil Handler Consume (Success) - - - - Central Service - - - - - - - - - - - - - - - - - - - - - - topic-fulfil - - - - - topic-fulfil - - - Fulfil Event - - - Handler - - - - - Fulfil Event - - - Handler - - - - - - - topic- - - - transfer-position - - - - - topic- - - - transfer-position - - - - - topic-event - - - - - topic-event - - - - - topic- - - - settlement-model - - - - - topic- - - - settlement-model - - - - - topic- - - - notification - - - - - topic- - - - notification - - - Position DAO - - - - - Position DAO - - - - - Central Store - - - - - Central Store - - - - - - - - Fulfil Handler Consume (Success) - - - - - alt - - - [Consume Single Message] - - - - - 1 - - - Consume Fulfil event message for Payer - - - - - break - - - - - Validate Event - - - - - 2 - - - Validate event - Rule: type == 'fulfil' && action == 'commit' - - - Error codes: - - - 2001 - - - - - Persist Event Information - - - - - 3 - - - Publish event information - - - - - ref - - - Event Handler Consume - - - - - Validate Duplicate Check - - - - - 4 - - - Request Duplicate Check - - - - - ref - - - Request Duplicate Check - - - - - 5 - - - Return { hasDuplicateId: Boolean, hasDuplicateHash: Boolean } - - - - - alt - - - [hasDuplicateId == TRUE && hasDuplicateHash == TRUE] - - - - - break - - - - - 6 - - - stateRecord = await getTransferState(transferId) - - - - - alt - - - [endStateList.includes(stateRecord.transferStateId)] - - - - - ref - - - getTransfer callback - - - - - 7 - - - Produce message - - - - - - Ignore - resend in progress - - - - [hasDuplicateId == TRUE && hasDuplicateHash == FALSE] - - - - - Validate Prepare Transfer (failure) - Modified Request - - - - [hasDuplicateId == FALSE] - - - - - Validate and persist Transfer Fulfilment - - - - - 8 - - - Request information for the validate checks - - - Error code: - - - 2003 - - - - - 9 - - - Fetch from database - - - - transfer - - - - - 10 - - - - - 11 - - - Return transfer - - - - - 12 - - - Validate that Transfer.ilpCondition = SHA-256 (content.payload.fulfilment) - - - Error code: - - - 2001 - - - - - 13 - - - Validate expirationDate - - - Error code: - - - 3303 - - - - - opt - - - [Transfer.ilpCondition validate successful] - - - - - Request current Settlement Window - - - - - 14 - - - Request to retrieve current/latest transfer settlement window - - - Error code: - - - 2003 - - - - - 15 - - - Fetch settlementWindowId - - - - settlementWindow - - - - - 16 - - - - - 17 - - - Return settlementWindowId to be appended during transferFulfilment insert - - - TODO - - - : During settlement design make sure transfers in 'RECEIVED-FULFIL' - - - state are updated to the next settlement window - - - - - Persist fulfilment - - - - - 18 - - - Persist fulfilment with the result of the above check (transferFulfilment.isValid) - - - Error code: - - - 2003 - - - - - 19 - - - Persist to database - - - - transferFulfilment - - - transferExtension - - - - - 20 - - - Return success - - - - - alt - - - [Transfer.ilpCondition validate successful] - - - - - Persist Transfer State (with transferState='RECEIVED-FULFIL') - - - - - 21 - - - Request to persist transfer state - - - Error code: - - - 2003 - - - - - 22 - - - Persist transfer state - - - - transferStateChange - - - - - 23 - - - Return success - - - - - Message: - - - { - - - id: <id>, - - - from: switch, - - - to: switch, - - - type: application/json - - - content: { - - - payload: { - - - transferId: {id} - - - } - - - }, - - - metadata: { - - - event: { - - - id: <uuid>, - - - responseTo: <previous.uuid>, - - - type: setmodel, - - - action: commit, - - - createdAt: <timestamp>, - - - state: { - - - status: "success", - - - code: 0 - - - } - - - } - - - } - - - } - - - - - 24 - - - Route & Publish settlement model event - - - - - Message: - - - { - - - id: <id>, - - - from: <transferHeaders.FSPIOP-Source>, - - - to: <transferHeaders.FSPIOP-Destination>, - - - type: application/json, - - - content: { - - - headers: <transferHeaders>, - - - payload: <transferMessage> - - - }, - - - metadata: { - - - event: { - - - id: <uuid>, - - - responseTo: <previous.uuid>, - - - type: position, - - - action: commit, - - - createdAt: <timestamp>, - - - state: { - - - status: "success", - - - code: 0 - - - } - - - } - - - } - - - } - - - - - 25 - - - Route & Publish Position event for Payee - - - - [Validate Fulfil Transfer not successful] - - - - - Persist Transfer State (with transferState='ABORTED') - - - - - 26 - - - Request to persist transfer state - - - Error code: - - - 2003 - - - - - 27 - - - Persist transfer state - - - - transferStateChange - - - - - 28 - - - Return success - - - - - Message: - - - { - - - id: <id>, - - - from: <transferHeaders.FSPIOP-Source>, - - - to: <transferHeaders.FSPIOP-Destination>, - - - type: application/json, - - - content: { - - - headers: <transferHeaders>, - - - payload: <transferMessage> - - - }, - - - metadata: { - - - event: { - - - id: <uuid>, - - - responseTo: <previous.uuid>, - - - type: position, - - - action: abort, - - - createdAt: <timestamp>, - - - state: { - - - status: "error", - - - code: 1 - - - } - - - } - - - } - - - } - - - - - 29 - - - Route & Publish Position event for Payer - - - - [Consume Batch Messages] - - - - - To be delivered by future story - + + 2.1.1. Fulfil Handler Consume (Success) + + + 2.1.1. Fulfil Handler Consume (Success) + + Central Service + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + topic-fulfil + + + topic-fulfil + Fulfil Event + Handler + + + Fulfil Event + Handler + + + + + topic- + transfer-position + + + topic- + transfer-position + + + topic-event + + + topic-event + + + topic- + settlement-model + + + topic- + settlement-model + + + topic- + notification + + + topic- + notification + Position DAO + + + Position DAO + + + Central Store + + + Central Store + + + + + + + + + + + + + + + + + + + + Fulfil Handler Consume (Success) + + + alt + [Consume Single Message] + + + 1 + Consume Fulfil event message for Payer + + + break + + + Validate Event + + + + + + 2 + Validate event - Rule: type == 'fulfil' && action == 'commit' + Error codes: + 2001 + + + Persist Event Information + + + 3 + Publish event information + + + ref + Event Handler Consume +   + + + Validate Duplicate Check + + + 4 + Request Duplicate Check + + + ref + Request Duplicate Check +   + + + 5 + Return { hasDuplicateId: Boolean, hasDuplicateHash: Boolean } + + + alt + [hasDuplicateId == TRUE && hasDuplicateHash == TRUE] + + + break + + + + + 6 + stateRecord = await getTransferState(transferId) + + + alt + [endStateList.includes(stateRecord.transferStateId)] + + + ref + getTransfer callback +   + + + 7 + Produce message + + + + Ignore - resend in progress + + [hasDuplicateId == TRUE && hasDuplicateHash == FALSE] + + + Validate Prepare Transfer (failure) - Modified Request + + [hasDuplicateId == FALSE] + + + Validate and persist Transfer Fulfilment + + + 8 + Request information for the validate checks + Error code: + 2003 + + + 9 + Fetch from database + + transfer + + + 10 +   + + + 11 + Return transfer + + + + + 12 + Validate that Transfer.ilpCondition = SHA-256 (content.payload.fulfilment) + Error code: + 2001 + + + + + 13 + Validate expirationDate + Error code: + 3303 + + + opt + [Transfer.ilpCondition validate successful] + + + Request current Settlement Window + + + 14 + Request to retrieve current/latest transfer settlement window + Error code: + 2003 + + + 15 + Fetch settlementWindowId + + settlementWindow + + + 16 +   + + + 17 + Return settlementWindowId to be appended during transferFulfilment insert + TODO + : During settlement design make sure transfers in 'RECEIVED-FULFIL' + state are updated to the next settlement window + + + Persist fulfilment + + + 18 + Persist fulfilment with the result of the above check (transferFulfilment.isValid) + Error code: + 2003 + + + 19 + Persist to database + + transferFulfilment + transferExtension + + + 20 + Return success + + + alt + [Transfer.ilpCondition validate successful] + + + Persist Transfer State (with transferState='RECEIVED-FULFIL') + + + 21 + Request to persist transfer state + Error code: + 2003 + + + 22 + Persist transfer state + + transferStateChange + + + 23 + Return success + + + Message: + { + id: <id>, + from: switch, + to: switch, + type: application/json + content: { + payload: { + transferId: {id} + } + }, + metadata: { + event: { + id: <uuid>, + responseTo: <previous.uuid>, + type: setmodel, + action: commit, + createdAt: <timestamp>, + state: { + status: "success", + code: 0 + } + } + } + } + + + 24 + Route & Publish settlement model event + + + Message: + { + id: <id>, + from: <transferHeaders.FSPIOP-Source>, + to: <transferHeaders.FSPIOP-Destination>, + type: application/json, + content: { + headers: <transferHeaders>, + payload: <transferMessage> + }, + metadata: { + event: { + id: <uuid>, + responseTo: <previous.uuid>, + type: position, + action: commit, + createdAt: <timestamp>, + state: { + status: "success", + code: 0 + } + } + } + } + + + 25 + Route & Publish Position event for Payee + + [Validate Fulfil Transfer not successful] + + + Persist Transfer State (with transferState='ABORTED') + + + 26 + Request to persist transfer state + Error code: + 2003 + + + 27 + Persist transfer state + + transferStateChange + + + 28 + Return success + + + Message: + { + id: <id>, + from: <transferHeaders.FSPIOP-Source>, + to: <transferHeaders.FSPIOP-Destination>, + type: application/json, + content: { + headers: <transferHeaders>, + payload: <transferMessage> + }, + metadata: { + event: { + id: <uuid>, + responseTo: <previous.uuid>, + type: position, + action: abort, + createdAt: <timestamp>, + state: { + status: "error", + code: 1 + } + } + } + } + + + 29 + Route & Publish Position event for Payer + + [Consume Batch Messages] + + + To be delivered by future story + diff --git a/docs/technical/technical/central-ledger/assets/diagrams/sequence/seq-get-all-participant-limit-1.0.0.svg b/docs/technical/technical/central-ledger/assets/diagrams/sequence/seq-get-all-participant-limit-1.0.0.svg index 3f24665c..1e1d5309 100644 --- a/docs/technical/technical/central-ledger/assets/diagrams/sequence/seq-get-all-participant-limit-1.0.0.svg +++ b/docs/technical/technical/central-ledger/assets/diagrams/sequence/seq-get-all-participant-limit-1.0.0.svg @@ -1,241 +1,127 @@ - - - - - - - - - - - 1.0.0 Get Participant Limit Details For All Participants - - - - Central Services - - - - - - HUB OPERATOR - - - - - HUB OPERATOR - - - - - Central Service API - - - - - Central Service API - - - - - Participant Handler - - - - - Participant Handler - - - - - Participant Facade - - - - - Participant Facade - - - - - Central Store - - - - - Central Store - - - - - - - - Get Limits for all Participants - - - - - 1 - - - Request to get Limits - GET - /participants/limits?type={typeValue}&currency={currencyType} - - - - - 2 - - - Fetch Limits for all Participants - - - - - 3 - - - Fetch Limits for all participants with currency and type - - - Error code: - - - 3000 - - - - - 4 - - - Fetch Limits for currencyId and type(if passed) - - - - - Condition: - - - participantCurrency.participantCurrencyId = participant.participantCurrencyId - - - participantLimit.isActive = 1 - - - participantLimit.participantCurrencyId = participantCurrency.participantCurrencyId - - - [ - - - participantLimit.participantLimitTypeId = participantLimitType.participantLimitTypeId - - - participantLimit.participantCurrencyId = <currencyId> - - - participantLimitType.name = <type> - - - ] - - - - participant - - - participantCurrency - - - participantLimit - - - participantLimitType - - - - - 5 - - - Retrieved Participant Limits for currencyId and type - - - - - 6 - - - Return Limits for all participants - - - - - Message: - - - [ - - - { - - - name: <fsp> - - - currency: <currencyId>, - - - limit: {type: <type>, value: <value>} - - - }, - - - { - - - name: <fsp> - - - currency: <currencyId>, - - - limit: {type: <type>, value: <value>} - - - } - - - ] - - - - - 7 - - - Return Limits for all participants - - - Error code: - - - 3000 - - - - - 8 - - - Return Limits for all participants - - - Error code: - - - 3000 - + + 1.0.0 Get Participant Limit Details For All Participants + + + 1.0.0 Get Participant Limit Details For All Participants + + Central Services + + + + + + + + + + + + HUB OPERATOR + + + HUB OPERATOR + + + Central Service API + + + Central Service API + + + Participant Handler + + + Participant Handler + + + Participant Facade + + + Participant Facade + + + Central Store + + + Central Store + + + + + + + + + + Get Limits for all Participants + + + 1 + Request to get Limits - GET - /participants/limits?type={typeValue}&currency={currencyType} + + + 2 + Fetch Limits for all Participants + + + 3 + Fetch Limits for all participants with currency and type + Error code: + 3000 + + + 4 + Fetch Limits for currencyId and type(if passed) + + + Condition: + participantCurrency.participantCurrencyId = participant.participantCurrencyId + participantLimit.isActive = 1 + participantLimit.participantCurrencyId = participantCurrency.participantCurrencyId + [ + participantLimit.participantLimitTypeId = participantLimitType.participantLimitTypeId + participantLimit.participantCurrencyId = <currencyId> + participantLimitType.name = <type> + ] + + participant + participantCurrency + participantLimit + participantLimitType + + + 5 + Retrieved Participant Limits for currencyId and type + + + 6 + Return Limits for all participants + + + Message: + [ + { + name: <fsp> + currency: <currencyId>, + limit: {type: <type>, value: <value>} + }, + { + name: <fsp> + currency: <currencyId>, + limit: {type: <type>, value: <value>} + } + ] + + + 7 + Return Limits for all participants + Error code: + 3000 + + + 8 + Return Limits for all participants + Error code: + 3000 + diff --git a/docs/technical/technical/central-ledger/assets/diagrams/sequence/seq-get-health-1.0.0.svg b/docs/technical/technical/central-ledger/assets/diagrams/sequence/seq-get-health-1.0.0.svg index aff440cd..053316d8 100644 --- a/docs/technical/technical/central-ledger/assets/diagrams/sequence/seq-get-health-1.0.0.svg +++ b/docs/technical/technical/central-ledger/assets/diagrams/sequence/seq-get-health-1.0.0.svg @@ -1,324 +1,174 @@ - - - - - - - - - - - 1.0.0 Get Health Check - - - - Central Services - - - - - - - HUB OPERATOR - - - - - HUB OPERATOR - - - - - Central Service API - - - - - Central Service API - - - - - Metadata Handler - - - - - Metadata Handler - - - - - Central Store - - - - - Central Store - - - - - - - Kafka Store - - - - - Kafka Store - - - - - Logging Sidecar - - - - - Logging Sidecar - - - - - - Get Detailed Health Check - - - - - 1 - - - Request to getHealth - GET /health?detailed=true - - - - - 2 - - - Fetch health status for all sub services - - - - - 3 - - - Fetch Service Metadata - - - - - - versionNumber - - - - uptime - - - - time service started - - - - - 4 - - - Check connection status - - - - - 5 - - - Report connection status - - - - - 6 - - - Check connection status - - - - - 7 - - - Report connection status - - - - - 8 - - - Check connection status - - - - - 9 - - - Report connection status - - - - - alt - - - [Validate Status (success)] - - - - - 10 - - - Return status response - - - - - Example Message: - - - 200 Success - - - { - - - "status": "UP", - - - "uptime": 1234, - - - "started": "2019-05-31T05:09:25.409Z", - - - "versionNumber": "5.2.3", - - - "services": [ - - - { - - - "name": "kafka", - - - "status": "UP", - - - "latency": 10 - - - } - - - ] - - - } - - - - - 11 - - - Return - - - HTTP Status: - - - 200 - - - - - alt - - - [Validate Status (service failure)] - - - - - 12 - - - Return status response - - - - - Example Message: - - - 502 Bad Gateway - - - { - - - "status": "DOWN", - - - "uptime": 1234, - - - "started": "2019-05-31T05:09:25.409Z", - - - "versionNumber": "5.2.3", - - - "services": [ - - - { - - - "name": "kafka", - - - "status": "DOWN", - - - "latency": 1111111 - - - } - - - ] - - - } - - - - - 13 - - - Return - - - HTTP Status: - - - 502 - + + 1.0.0 Get Health Check + + + 1.0.0 Get Health Check + + Central Services + + + + + + + + + + + + + + + + HUB OPERATOR + + + HUB OPERATOR + + + Central Service API + + + Central Service API + + + Metadata Handler + + + Metadata Handler + + + Central Store + + + Central Store + + + + + Kafka Store + + + Kafka Store + + + Logging Sidecar + + + Logging Sidecar + + + + + + + + + Get Detailed Health Check + + + 1 + Request to getHealth - GET /health?detailed=true + + + 2 + Fetch health status for all sub services + + + + + 3 + Fetch Service Metadata + + + - versionNumber + - uptime + - time service started + + + 4 + Check connection status + + + 5 + Report connection status + + + 6 + Check connection status + + + 7 + Report connection status + + + 8 + Check connection status + + + 9 + Report connection status + + + alt + [Validate Status (success)] + + + 10 + Return status response + + + Example Message: + 200 Success + { + "status": "UP", + "uptime": 1234, + "started": "2019-05-31T05:09:25.409Z", + "versionNumber": "5.2.3", + "services": [ + { + "name": "kafka", + "status": "UP", + "latency": 10 + } + ] + } + + + 11 + Return + HTTP Status: + 200 + + + alt + [Validate Status (service failure)] + + + 12 + Return status response + + + Example Message: + 502 Bad Gateway + { + "status": "DOWN", + "uptime": 1234, + "started": "2019-05-31T05:09:25.409Z", + "versionNumber": "5.2.3", + "services": [ + { + "name": "kafka", + "status": "DOWN", + "latency": 1111111 + } + ] + } + + + 13 + Return + HTTP Status: + 502 + diff --git a/docs/technical/technical/central-ledger/assets/diagrams/sequence/seq-get-participant-position-limit-1.1.0.svg b/docs/technical/technical/central-ledger/assets/diagrams/sequence/seq-get-participant-position-limit-1.1.0.svg index e017a501..acbd9b09 100644 --- a/docs/technical/technical/central-ledger/assets/diagrams/sequence/seq-get-participant-position-limit-1.1.0.svg +++ b/docs/technical/technical/central-ledger/assets/diagrams/sequence/seq-get-participant-position-limit-1.1.0.svg @@ -1,568 +1,306 @@ - - - - - - - - - - - 1.1.0 Request Participant Position and Limit Details - - - - Central Services - - - - - - - - - - - - - HUB OPERATOR - - - - - HUB OPERATOR - - - - - Central Service API - - - - - Central Service API - - - - - Participant Handler - - - - - Participant Handler - - - - - Participant Facade - - - - - Participant Facade - - - - - Central Store - - - - - Central Store - - - - - - - - - - Get Callback Details - - - - - 1 - - - Request to get Limits - GET - /participants/{name}/limits?type={typeValue}&currency={currencyValue} - - - - - 2 - - - Fetch Limits for Participant - - - - - 3 - - - check if "currency" parameter is sent - - - - - alt - - - [Check if "currency" parameter is sent (Sent)] - - - - - 4 - - - Fetch Participant/currency id - - - Error code: - - - 3200 - - - - - 5 - - - Fetch Participant/currency id - - - - participant - - - participantCurrency - - - - - 6 - - - Retrieved Participant - - - - - 7 - - - Return Participant/currency id - - - - - 8 - - - Validate DFSP - - - - - alt - - - [Validate participant (success)] - - - - - 9 - - - Fetch Participant Limits for currency and type - - - Error code: - - - 3000 - - - - - 10 - - - Fetch Participant Limit for currencyId and type(if passed) - - - - - Condition: - - - participantLimit.isActive = 1 - - - participantLimit.participantCurrencyId = <currencyId> - - - [ participantLimit.participantLimitTypeId = participantLimitType.participantLimitTypeId - - - participantLimitType.name = <type> - - - ] - - - - participantLimit - - - participantLimitType - - - - - 11 - - - Retrieved Participant Limits for currencyId and type - - - - - 12 - - - Return Participant Limits for currencyId and type - - - - - Message: - - - [ - - - { currency: <currencyId>, - - - limit: {type: <type>, value: <value>} - - - } - - - ] - - - - - 13 - - - Return Participant Limits - - - - - 14 - - - Return Participant Limits - - - - [Validate participant (failure)/ Error] - - - - - Validation failure/ Error! - - - - - Message: - - - { - - - "errorInformation": { - - - "errorCode": <errorCode>, - - - "errorDescription": <ErrorMessage>, - - - } - - - } - - - - - 15 - - - Return - - - Error code: - - - 3000, 3200 - - - - - 16 - - - Return - - - Error code: - - - 3000, 3200 - - - - [Check if "currency" parameter is sent (Not Sent)] - - - - - 17 - - - Fetch Participant - - - Error code: - - - 3200 - - - - - 18 - - - Fetch Participant - - - - participant - - - - - 19 - - - Retrieved Participant - - - - - 20 - - - Return Participant - - - - - 21 - - - Validate DFSP - - - - - alt - - - [Validate participant (success)] - - - - - 22 - - - Fetch Participant Limits for all currencies and type - - - Error code: - - - 3000 - - - - - 23 - - - Fetch Participant Limit for all currencies and type(if passed) - - - - - Condition: - - - participantCurrency.participantId = <participantId> - - - participantLimit.participantCurrencyId = participantCurrency.participantCurrencyId - - - participantLimit.isActive = 1 - - - [ participantLimit.participantLimitTypeId = participantLimitType.participantLimitTypeId - - - participantLimitType.name = <type> - - - ] - - - - participantCurrency - - - participantLimit - - - participantLimitType - - - - - 24 - - - Retrieved Participant Limits for all currencies and type - - - - - 25 - - - Return Participant Limits for all currencies and type - - - - - Message: - - - [ - - - { currency: <currencyId>, - - - limit: {type: <type>, value: <value>} - - - } - - - ] - - - - - 26 - - - Return Participant Limits - - - - - 27 - - - Return Participant Limits - - - - [Validate participant (failure)/ Error] - - - - - Validation failure/ Error! - - - - - Message: - - - { - - - "errorInformation": { - - - "errorCode": <errorCode>, - - - "errorDescription": <ErrorMessage>, - - - } - - - } - - - - - 28 - - - Return - - - Error code: - - - 3000, 3200 - - - - - 29 - - - Return - - - Error code: - - - 3000, 3200 - + + 1.1.0 Request Participant Position and Limit Details + + + 1.1.0 Request Participant Position and Limit Details + + Central Services + + + + + + + + + + + + + + + + + + + + + + + + + HUB OPERATOR + + + HUB OPERATOR + + + Central Service API + + + Central Service API + + + Participant Handler + + + Participant Handler + + + Participant Facade + + + Participant Facade + + + Central Store + + + Central Store + + + + + + + + + + + + + + + + + + + + Get Callback Details + + + 1 + Request to get Limits - GET - /participants/{name}/limits?type={typeValue}&currency={currencyValue} + + + 2 + Fetch Limits for Participant + + + + + 3 + check if "currency" parameter is sent + + + alt + [Check if "currency" parameter is sent (Sent)] + + + 4 + Fetch Participant/currency id + Error code: + 3200 + + + 5 + Fetch Participant/currency id + + participant + participantCurrency + + + 6 + Retrieved Participant + + + 7 + Return Participant/currency id + + + + + 8 + Validate DFSP + + + alt + [Validate participant (success)] + + + 9 + Fetch Participant Limits for currency and type + Error code: + 3000 + + + 10 + Fetch Participant Limit for currencyId and type(if passed) + + + Condition: + participantLimit.isActive = 1 + participantLimit.participantCurrencyId = <currencyId> + [ participantLimit.participantLimitTypeId = participantLimitType.participantLimitTypeId + participantLimitType.name = <type> + ] + + participantLimit + participantLimitType + + + 11 + Retrieved Participant Limits for currencyId and type + + + 12 + Return Participant Limits for currencyId and type + + + Message: + [ + { currency: <currencyId>, + limit: {type: <type>, value: <value>} + } + ] + + + 13 + Return Participant Limits + + + 14 + Return Participant Limits + + [Validate participant (failure)/ Error] + + + Validation failure/ Error! + + + Message: + { + "errorInformation": { + "errorCode": <errorCode>, + "errorDescription": <ErrorMessage>, + } + } + + + 15 + Return + Error code: + 3000, 3200 + + + 16 + Return + Error code: + 3000, 3200 + + [Check if "currency" parameter is sent (Not Sent)] + + + 17 + Fetch Participant + Error code: + 3200 + + + 18 + Fetch Participant + + participant + + + 19 + Retrieved Participant + + + 20 + Return Participant + + + + + 21 + Validate DFSP + + + alt + [Validate participant (success)] + + + 22 + Fetch Participant Limits for all currencies and type + Error code: + 3000 + + + 23 + Fetch Participant Limit for all currencies and type(if passed) + + + Condition: + participantCurrency.participantId = <participantId> + participantLimit.participantCurrencyId = participantCurrency.participantCurrencyId + participantLimit.isActive = 1 + [ participantLimit.participantLimitTypeId = participantLimitType.participantLimitTypeId + participantLimitType.name = <type> + ] + + participantCurrency + participantLimit + participantLimitType + + + 24 + Retrieved Participant Limits for all currencies and type + + + 25 + Return Participant Limits for all currencies and type + + + Message: + [ + { currency: <currencyId>, + limit: {type: <type>, value: <value>} + } + ] + + + 26 + Return Participant Limits + + + 27 + Return Participant Limits + + [Validate participant (failure)/ Error] + + + Validation failure/ Error! + + + Message: + { + "errorInformation": { + "errorCode": <errorCode>, + "errorDescription": <ErrorMessage>, + } + } + + + 28 + Return + Error code: + 3000, 3200 + + + 29 + Return + Error code: + 3000, 3200 + diff --git a/docs/technical/technical/central-ledger/assets/diagrams/sequence/seq-get-transfer-1.1.5-phase2.svg b/docs/technical/technical/central-ledger/assets/diagrams/sequence/seq-get-transfer-1.1.5-phase2.svg index 8ad873bd..801226ab 100644 --- a/docs/technical/technical/central-ledger/assets/diagrams/sequence/seq-get-transfer-1.1.5-phase2.svg +++ b/docs/technical/technical/central-ledger/assets/diagrams/sequence/seq-get-transfer-1.1.5-phase2.svg @@ -1,402 +1,208 @@ - - - - - - - - - - - 1.1.5. Request transfer status (getTransferStatusById) - Phase2 version - - - - Financial Service Provider - - - - ML API Adapter Service - - - - Central Service - - - - - - - - - DFSP(n) - - - Participant - - - - - DFSP(n) - - - Participant - - - - - ML API Notification Event Handler - - - - - ML API Notification Event Handler - - - - - Central Service API - - - - - Central Service API - - - - - - - Event-Topic - - - - - Event-Topic - - - Transfer-DAO - - - - - Transfer-DAO - - - - - Central Store - - - - - Central Store - - - - - - - - Request transfer status - - - - - 1 - - - Callback transfer status request URL - GET - /transfers/{ID} - - - - - Persist Event Information - - - - - 2 - - - Request transfer information - GET - /transfers/{ID} - - - - - 3 - - - Publish event information - - - - - ref - - - Event Handler Consume - - - - - 4 - - - Return success - - - - - 5 - - - Return success - - - - - 6 - - - Respond HTTP - 200 (OK) - - - - - 7 - - - Request details for Transfer - GET - /transfers/{ID} - - - Error code: - - - 2003 - - - - - 8 - - - Request transfer status - - - Error code: - - - 2003 - - - - - 9 - - - Fetch transfer status - - - - SELECT transferId, transferStateId - - - FROM - - - transferStateChange - - - WHERE transferId = {ID} - - - ORDER BY transferStateChangeId desc limit 1 - - - - - 10 - - - Return transfer status - - - - - 11 - - - Return transfer status - - - Error codes: - - - 3202, 3203 - - - - - alt - - - [Is there a transfer with the given ID recorded in the system?] - - - - - alt - - - [Yes AND transferState is COMMITTED - - - This implies that a succesful transfer with the given ID is recorded in the system] - - - - - { - - - "fulfilment": "WLctttbu2HvTsa1XWvUoGRcQozHsqeu9Ahl2JW9Bsu8", - - - "completedTimestamp": "2018-09-24T08:38:08.699-04:00", - - - "transferState": "COMMITTED", - - - extensionList: - - - { - - - extension: - - - [ - - - { - - - "key": "Description", - - - "value": "This is a more detailed description" - - - } - - - ] - - - } - - - } - - - - - 12 - - - callback PUT on /transfers/{ID} - - - - [transferState in [RECEIVED, RESERVED, ABORTED]] - - - - - { - - - "transferState": "RECEIVED", - - - extensionList: - - - { - - - extension: - - - [ - - - { - - - "key": "Description", - - - "value": "This is a more detailed description" - - - } - - - ] - - - } - - - } - - - - - 13 - - - callback PUT on /transfers/{ID} - - - - - Log ERROR event - - - - [A transfer with the given ID is not present in the System or this is an invalid request] - - - - - { - - - "errorInformation": { - - - "errorCode": <integer>, - - - "errorDescription": "Client error description" - - - } - - - } - - - - - 14 - - - callback PUT on /transfers/{ID}/error - + + 1.1.5. Request transfer status (getTransferStatusById) - Phase2 version + + + 1.1.5. Request transfer status (getTransferStatusById) - Phase2 version + + Financial Service Provider + + ML API Adapter Service + + Central Service + + + + + + + + + + + + + + + + + DFSP(n) + Participant + + + DFSP(n) + Participant + + + ML API Notification Event Handler + + + ML API Notification Event Handler + + + Central Service API + + + Central Service API + + + + + Event-Topic + + + Event-Topic + Transfer-DAO + + + Transfer-DAO + + + Central Store + + + Central Store + + + + + + + + + + + Request transfer status + + + 1 + Callback transfer status request URL - GET - /transfers/{ID} + + + Persist Event Information + + + 2 + Request transfer information - GET - /transfers/{ID} + + + 3 + Publish event information + + + ref + Event Handler Consume +   + + + 4 + Return success + + + 5 + Return success + + + 6 + Respond HTTP - 200 (OK) + + + 7 + Request details for Transfer - GET - /transfers/{ID} + Error code: + 2003 + + + 8 + Request transfer status + Error code: + 2003 + + + 9 + Fetch transfer status + + SELECT transferId, transferStateId + FROM + transferStateChange + WHERE transferId = {ID} + ORDER BY transferStateChangeId desc limit 1 + + + 10 + Return transfer status + + + 11 + Return transfer status + Error codes: + 3202, 3203 + + + alt + [Is there a transfer with the given ID recorded in the system?] + + + alt + [Yes AND transferState is COMMITTED + This implies that a succesful transfer with the given ID is recorded in the system] + + + { + "fulfilment": "WLctttbu2HvTsa1XWvUoGRcQozHsqeu9Ahl2JW9Bsu8", + "completedTimestamp": "2018-09-24T08:38:08.699-04:00", + "transferState": "COMMITTED", + extensionList: + { + extension: + [ + { + "key": "Description", + "value": "This is a more detailed description" + } + ] + } + } + + + 12 + callback PUT on /transfers/{ID} + + [transferState in [RECEIVED, RESERVED, ABORTED]] + + + { + "transferState": "RECEIVED", + extensionList: + { + extension: + [ + { + "key": "Description", + "value": "This is a more detailed description" + } + ] + } + } + + + 13 + callback PUT on /transfers/{ID} + + + Log ERROR event + + [A transfer with the given ID is not present in the System or this is an invalid request] + + + { + "errorInformation": { + "errorCode": <integer>, + "errorDescription": "Client error description" + } + } + + + 14 + callback PUT on /transfers/{ID}/error + diff --git a/docs/technical/technical/central-ledger/assets/diagrams/sequence/seq-manage-participant-limit-1.1.0.svg b/docs/technical/technical/central-ledger/assets/diagrams/sequence/seq-manage-participant-limit-1.1.0.svg index a640cdb0..7ed0d712 100644 --- a/docs/technical/technical/central-ledger/assets/diagrams/sequence/seq-manage-participant-limit-1.1.0.svg +++ b/docs/technical/technical/central-ledger/assets/diagrams/sequence/seq-manage-participant-limit-1.1.0.svg @@ -1,457 +1,243 @@ - - - - - - - - - - - 1.1.0 Manage Participant Limits - - - - Central Services - - - - - - - - - - HUB OPERATOR - - - - - HUB OPERATOR - - - - - Central Service API - - - - - Central Service API - - - - - Participant Handler - - - - - Participant Handler - - - - - Participant DAO - - - - - Participant DAO - - - - - Central Store - - - - - Central Store - - - - - - - - Manage Net Debit Cap - - - - - 1 - - - Request to adjust Participant Limit for a certain Currency - POST - /participants/{name}/limits - - - - - Message: - - - { - - - payload: { - - - currency: <string>, - - - limit: { - - - type: <string>, - - - value: <Id> - - - } - - - } - - - } - - - - - 2 - - - Adjust Limit for Participant - - - - - 3 - - - Fetch Participant/currency - - - Error code: - - - 3200 - - - - - 4 - - - Fetch Participant/currency - - - - participant - - - participantCurrency - - - - - 5 - - - Retrieved Participant/currency - - - - - 6 - - - Return Participant/currency - - - - - 7 - - - Validate DFSP - - - - - alt - - - [Validate participant (success)] - - - - - 8 - - - (for ParticipantCurrency) Fetch ParticipantLimit - - - Error code: - - - 3200 - - - - - 9 - - - Fetch ParticipantLimit - - - - participantLimit - - - - - 10 - - - Retrieved ParticipantLimit - - - - - 11 - - - Return ParticipantLimit - - - - - 12 - - - Validate ParticipantLimit - - - - - alt - - - [Validate participantLimit (success)] - - - - - DB TRANSACTION IMPLEMENTATION - Lock on ParticipantLimit table with UPDATE - - - - - If (record exists && isActive = 1) - - - oldIsActive.isActive = 0 - - - insert Record - - - Else - - - insert Record - - - End - - - - - 13 - - - (for ParticipantLimit) Insert new ParticipantLimit - - - Error code: - - - 3200 - - - - - 14 - - - Insert ParticipantLimit - - - - participantLimit - - - - - 15 - - - Inserted ParticipantLimit - - - - - 16 - - - Return ParticipantLimit - - - - [Validate participantLimit (failure)] - - - - - Validation failure! - - - - - Message: - - - { - - - "errorInformation": { - - - "errorCode": 3200, - - - "errorDescription": "ParticipantLimit Not Found", - - - } - - - } - - - - - 17 - - - Return new Limit values and status 200 - - - - - Message: - - - { - - - "currency": "EUR", - - - "limit": { - - - "participantLimitId": <number>, - - - "participantLimitTypeId": <number>, - - - "type": <string>, - - - "value": <string>, - - - "isActive": 1 - - - } - - - } - - - - - 18 - - - Return new Limit values and status 200 - - - - [Validate participant (failure)] - - - - - Validation failure! - - - - - Message: - - - { - - - "errorInformation": { - - - "errorCode": 3200, - - - "errorDescription": "FSP id Not Found", - - - } - - - } - - - - - 19 - - - Return - - - Error code: - - - 3200 - - - - - 20 - - - Return - - - Error code: - - - 3200 - + + 1.1.0 Manage Participant Limits + + + 1.1.0 Manage Participant Limits + + Central Services + + + + + + + + + + + + + + + + + + + HUB OPERATOR + + + HUB OPERATOR + + + Central Service API + + + Central Service API + + + Participant Handler + + + Participant Handler + + + Participant DAO + + + Participant DAO + + + Central Store + + + Central Store + + + + + + + + + + + + + + Manage Net Debit Cap + + + 1 + Request to adjust Participant Limit for a certain Currency - POST - /participants/{name}/limits + + + Message: + { + payload: { + currency: <string>, + limit: { + type: <string>, + value: <Id> + } + } + } + + + 2 + Adjust Limit for Participant + + + 3 + Fetch Participant/currency + Error code: + 3200 + + + 4 + Fetch Participant/currency + + participant + participantCurrency + + + 5 + Retrieved Participant/currency + + + 6 + Return Participant/currency + + + + + 7 + Validate DFSP + + + alt + [Validate participant (success)] + + + 8 + (for ParticipantCurrency) Fetch ParticipantLimit + Error code: + 3200 + + + 9 + Fetch ParticipantLimit + + participantLimit + + + 10 + Retrieved ParticipantLimit + + + 11 + Return ParticipantLimit + + + + + 12 + Validate ParticipantLimit + + + alt + [Validate participantLimit (success)] + + + DB TRANSACTION IMPLEMENTATION - Lock on ParticipantLimit table with UPDATE + + + If (record exists && isActive = 1) + oldIsActive.isActive = 0 + insert Record + Else + insert Record + End +   + + + 13 + (for ParticipantLimit) Insert new ParticipantLimit + Error code: + 3200 + + + 14 + Insert ParticipantLimit + + participantLimit + + + 15 + Inserted ParticipantLimit + + + 16 + Return ParticipantLimit + + [Validate participantLimit (failure)] + + + Validation failure! + + + Message: + { + "errorInformation": { + "errorCode": 3200, + "errorDescription": "ParticipantLimit Not Found", + } + } + + + 17 + Return new Limit values and status 200 + + + Message: + { + "currency": "EUR", + "limit": { + "participantLimitId": <number>, + "participantLimitTypeId": <number>, + "type": <string>, + "value": <string>, + "isActive": 1 + } + } + + + 18 + Return new Limit values and status 200 + + [Validate participant (failure)] + + + Validation failure! + + + Message: + { + "errorInformation": { + "errorCode": 3200, + "errorDescription": "FSP id Not Found", + } + } + + + 19 + Return + Error code: + 3200 + + + 20 + Return + Error code: + 3200 + diff --git a/docs/technical/technical/central-ledger/assets/diagrams/sequence/seq-participant-position-limits-1.0.0.svg b/docs/technical/technical/central-ledger/assets/diagrams/sequence/seq-participant-position-limits-1.0.0.svg index fcfca97c..2b4da73f 100644 --- a/docs/technical/technical/central-ledger/assets/diagrams/sequence/seq-participant-position-limits-1.0.0.svg +++ b/docs/technical/technical/central-ledger/assets/diagrams/sequence/seq-participant-position-limits-1.0.0.svg @@ -1,527 +1,283 @@ - - - - - - - - - - - 1.0.0 Create initial position and limits for Participant - - - - Central Services - - - - - - - - - - HUB OPERATOR - - - - - HUB OPERATOR - - - - - Central Service API - - - - - Central Service API - - - - - Participant Handler - - - - - Participant Handler - - - - - Participant FACADE - - - - - Participant FACADE - - - - - Central Store - - - - - Central Store - - - - - - - - Create initial position and limits - - - - - 1 - - - Request to Create initial position and limits - POST - /paticipants/{name}/initialPositionAndLimits - - - - - Message: - - - { - - - currency: <currencyId>, - - - limit: { - - - type: <limitType>, - - - value: <limitValue> - - - }, - - - initialPosition: <positionValue> - - - } - - - - - 2 - - - Create initial position and limits for Participant - - - - - 3 - - - Fetch Participant/ Currency Id - - - Error code: - - - 3200 - - - - - 4 - - - Fetch Participant/Currency Id - - - - participant - - - participantCurrency - - - - - 5 - - - Retrieved Participant/Currency Id - - - - - 6 - - - Return Participant/Currency Id - - - - - 7 - - - Validate DFSP - - - - - alt - - - [Validate participant (success)] - - - - - 8 - - - Fetch limit for participantCurrencyId - - - - - 9 - - - Fetch limit for participantCurrencyId - - - - participantLimit - - - - - 10 - - - Retrieved participant limit - - - - - 11 - - - Return participant limit - - - - - 12 - - - Fetch position for participantCurrencyId - - - - - 13 - - - Fetch position for participantCurrencyId - - - - participantPosition - - - - - 14 - - - Retrieved participant position - - - - - 15 - - - Return participant position - - - - - 16 - - - Participant position or limit exists check - - - - - alt - - - [position or limit does not exist (success)] - - - - - 17 - - - create initial position and limits for Participantt - - - Error code: - - - 2003/ - - - Msg: - - - Service unavailable - - - Error code: - - - 2001/ - - - Msg: - - - Internal Server Error - - - - - 18 - - - Persist Participant limits/position - - - - participantPosition - - - participantLimit - - - - - 19 - - - Return status - - - - - alt - - - [Details persisted successfully] - - - - - 20 - - - Return Status Code 201 - - - - - 21 - - - Return Status Code 201 - - - - [Details not persisted/Error] - - - - - Error! - - - - - Message: - - - { - - - "errorInformation": { - - - "errorCode": <Error Code>, - - - "errorDescription": <Msg>, - - - } - - - } - - - - - 22 - - - Return - - - Error code - - - - - 23 - - - Return - - - Error code - - - - [position or limit exists (failure)] - - - - - Error! - - - - - Message: - - - { - - - "errorInformation": { - - - "errorCode": 3200, - - - "errorDescription": "Participant Limit or Initial Position already set", - - - } - - - } - - - - - 24 - - - Return - - - Error code: - - - 3200 - - - - - 25 - - - Return - - - Error code: - - - 3200 - - - - [Validate participant (failure)] - - - - - Validation failure! - - - - - Message: - - - { - - - "errorInformation": { - - - "errorCode": 3200, - - - "errorDescription": "FSP id Not Found", - - - } - - - } - - - - - 26 - - - Return - - - Error code: - - - 3200 - - - - - 27 - - - Return - - - Error code: - - - 3200 - + + 1.0.0 Create initial position and limits for Participant + + + 1.0.0 Create initial position and limits for Participant + + Central Services + + + + + + + + + + + + + + + + + + + + + + HUB OPERATOR + + + HUB OPERATOR + + + Central Service API + + + Central Service API + + + Participant Handler + + + Participant Handler + + + Participant FACADE + + + Participant FACADE + + + Central Store + + + Central Store + + + + + + + + + + + + + + + + + Create initial position and limits + + + 1 + Request to Create initial position and limits - POST - /paticipants/{name}/initialPositionAndLimits + + + Message: + { + currency: <currencyId>, + limit: { + type: <limitType>, + value: <limitValue> + }, + initialPosition: <positionValue> + } + + + 2 + Create initial position and limits for Participant + + + 3 + Fetch Participant/ Currency Id + Error code: + 3200 + + + 4 + Fetch Participant/Currency Id + + participant + participantCurrency + + + 5 + Retrieved Participant/Currency Id + + + 6 + Return Participant/Currency Id + + + + + 7 + Validate DFSP + + + alt + [Validate participant (success)] + + + 8 + Fetch limit for participantCurrencyId + + + 9 + Fetch limit for participantCurrencyId + + participantLimit + + + 10 + Retrieved participant limit + + + 11 + Return participant limit + + + 12 + Fetch position for participantCurrencyId + + + 13 + Fetch position for participantCurrencyId + + participantPosition + + + 14 + Retrieved participant position + + + 15 + Return participant position + + + + + 16 + Participant position or limit exists check + + + alt + [position or limit does not exist (success)] + + + 17 + create initial position and limits for Participantt + Error code: + 2003/ + Msg: + Service unavailable +   + Error code: + 2001/ + Msg: + Internal Server Error + + + 18 + Persist Participant limits/position + + participantPosition + participantLimit + + + 19 + Return status + + + alt + [Details persisted successfully] + + + 20 + Return Status Code 201 + + + 21 + Return Status Code 201 + + [Details not persisted/Error] + + + Error! + + + Message: + { + "errorInformation": { + "errorCode": <Error Code>, + "errorDescription": <Msg>, + } + } + + + 22 + Return + Error code + + + 23 + Return + Error code + + [position or limit exists (failure)] + + + Error! + + + Message: + { + "errorInformation": { + "errorCode": 3200, + "errorDescription": "Participant Limit or Initial Position already set", + } + } + + + 24 + Return + Error code: + 3200 + + + 25 + Return + Error code: + 3200 + + [Validate participant (failure)] + + + Validation failure! + + + Message: + { + "errorInformation": { + "errorCode": 3200, + "errorDescription": "FSP id Not Found", + } + } + + + 26 + Return + Error code: + 3200 + + + 27 + Return + Error code: + 3200 + diff --git a/docs/technical/technical/central-ledger/assets/diagrams/sequence/seq-participants-positions-query-4.1.0.svg b/docs/technical/technical/central-ledger/assets/diagrams/sequence/seq-participants-positions-query-4.1.0.svg index b623ef95..effa4555 100644 --- a/docs/technical/technical/central-ledger/assets/diagrams/sequence/seq-participants-positions-query-4.1.0.svg +++ b/docs/technical/technical/central-ledger/assets/diagrams/sequence/seq-participants-positions-query-4.1.0.svg @@ -1,448 +1,240 @@ - - - - - - - - - - - 4.1.0 Get Participant Position Details - - - - HUB Operator - - - - Central Service - - - - - - - - - HUB OPERATOR - - - - - HUB OPERATOR - - - - - Central Service API - - - - - Central Service API - - - - - Participant Handler - - - - - Participant Handler - - - - - Participant DAO - - - - - Participant DAO - - - - - Position Facade - - - - - Position Facade - - - - - Central Store - - - - - Central Store - - - - - - - - Get Position Details - - - - - 1 - - - Request to get positions - GET - /participants/{name}/positions?currency={currencyId} - - - - - 2 - - - Fetch Positions for Participant - - - - - 3 - - - Fetch Participant - - - Error code: - - - 2003,3201 - - - - - 4 - - - Fetch Participant - - - - participant - - - - - 5 - - - Retrieved Participant - - - - - 6 - - - Return Participant - - - - - 7 - - - Validate DFSP - - - Error code: - - - 3201 - - - - - alt - - - [Validate participant (success)] - - - - - 8 - - - currency parameter passed ? - - - - - alt - - - [currency parameter passed] - - - - - 9 - - - Fetch Participant position for a currency id - - - Error code: - - - 2003 - - - - - 10 - - - Fetch Participant position for a currency id - - - - participantCurrency - - - participantPosition - - - - - 11 - - - Retrieved Participant position for a currency id - - - - - 12 - - - Return Positions for Participant - - - - - Message: - - - { - - - { - - - currency: <currencyId>, - - - value: <positionValue>, - - - updatedTime: <timeStamp1> - - - } - - - } - - - - - 13 - - - Return Participant position for a currency id - - - - - 14 - - - Return Participant position for a currency id - - - - [currency parameter not passed] - - - - - 15 - - - Fetch Participant Positions for all currencies - - - Error code: - - - 2003 - - - - - 16 - - - Fetch Participant Positions for all currencies - - - - participantCurrency - - - participantPosition - - - - - 17 - - - Retrieved Participant Positions for all currencies - - - - - 18 - - - Return Participant Positions for all currencies - - - - - Message: - - - { - - - [ - - - { - - - currency: <currencyId1>, - - - value: <positionValue1>, - - - updatedTime: <timeStamp1> - - - }, - - - { - - - currency: <currencyId2>, - - - value: <positionValue2>, - - - updatedTime: <timeStamp2> - - - } - - - ] - - - } - - - - - 19 - - - Return Participant Positions for all currencies - - - - - 20 - - - Return Participant Positions for all currencies - - - - [Validate participant (failure)] - - - - - Validation failure! - - - - - Message: - - - { - - - "errorInformation": { - - - "errorCode": 3201, - - - "errorDescription": "FSP id does not exist or not found", - - - } - - - } - - - - - 21 - - - Return - - - Error code: - - - 3201 - - - - - 22 - - - Return - - - Error code: - - - 3201 - + + 4.1.0 Get Participant Position Details + + + 4.1.0 Get Participant Position Details + + HUB Operator + + Central Service + + + + + + + + + + + + + + + + + + + HUB OPERATOR + + + HUB OPERATOR + + + Central Service API + + + Central Service API + + + Participant Handler + + + Participant Handler + + + Participant DAO + + + Participant DAO + + + Position Facade + + + Position Facade + + + Central Store + + + Central Store + + + + + + + + + + + + + + Get Position Details + + + 1 + Request to get positions - GET - /participants/{name}/positions?currency={currencyId} + + + 2 + Fetch Positions for Participant + + + 3 + Fetch Participant + Error code: + 2003,3201 + + + 4 + Fetch Participant + + participant + + + 5 + Retrieved Participant + + + 6 + Return Participant + + + + + 7 + Validate DFSP + Error code: + 3201 + + + alt + [Validate participant (success)] + + + + + 8 + currency parameter passed ? + + + alt + [currency parameter passed] + + + 9 + Fetch Participant position for a currency id + Error code: + 2003 + + + 10 + Fetch Participant position for a currency id + + participantCurrency + participantPosition + + + 11 + Retrieved Participant position for a currency id + + + 12 + Return Positions for Participant + + + Message: + { + { + currency: <currencyId>, + value: <positionValue>, + updatedTime: <timeStamp1> + } + } + + + 13 + Return Participant position for a currency id + + + 14 + Return Participant position for a currency id + + [currency parameter not passed] + + + 15 + Fetch Participant Positions for all currencies + Error code: + 2003 + + + 16 + Fetch Participant Positions for all currencies + + participantCurrency + participantPosition + + + 17 + Retrieved Participant Positions for all currencies + + + 18 + Return Participant Positions for all currencies + + + Message: + { + [ + { + currency: <currencyId1>, + value: <positionValue1>, + updatedTime: <timeStamp1> + }, + { + currency: <currencyId2>, + value: <positionValue2>, + updatedTime: <timeStamp2> + } + ] + } + + + 19 + Return Participant Positions for all currencies + + + 20 + Return Participant Positions for all currencies + + [Validate participant (failure)] + + + Validation failure! + + + Message: + { + "errorInformation": { + "errorCode": 3201, + "errorDescription": "FSP id does not exist or not found", + } + } + + + 21 + Return + Error code: + 3201 + + + 22 + Return + Error code: + 3201 + diff --git a/docs/technical/technical/central-ledger/assets/diagrams/sequence/seq-participants-positions-query-all-4.2.0.svg b/docs/technical/technical/central-ledger/assets/diagrams/sequence/seq-participants-positions-query-all-4.2.0.svg index 76b9e95a..fc37d05c 100644 --- a/docs/technical/technical/central-ledger/assets/diagrams/sequence/seq-participants-positions-query-all-4.2.0.svg +++ b/docs/technical/technical/central-ledger/assets/diagrams/sequence/seq-participants-positions-query-all-4.2.0.svg @@ -1,321 +1,153 @@ - - - - - - - - - - - 4.2.0 Get Positions of all Participants - - - - ML API Adapter Service - - - - Central Service - - - - - - ML-API-ADAPTER - - - - - ML-API-ADAPTER - - - - - Central Service API - - - - - Central Service API - - - - - Participant Handler - - - - - Participant Handler - - - - - Participant DAO - - - - - Participant DAO - - - - - Central Store - - - - - Central Store - - - - - - - - Get Position Details - - - - - 1 - - - Request to get positions - GET - /participants/positions - - - - - 2 - - - Fetch Positions for all Participants - - - - - 3 - - - Fetch Positions for all active Participants - - - Error code: - - - 2003,3200 - - - - - 4 - - - Fetch Positions for: - - - all active Participants - - - with all active Currencies for each Participant - - - - participant - - - participantPosition - - - participantCurrency - - - - - 5 - - - Retrieved Positions for Participants - - - - - 6 - - - Return Positions for Participants - - - - - Message: - - - { - - - snapshotAt: <timestamp0>, - - - positions: - - - [ - - - { - - - participantId: <dfsp1>, - - - participantPositions: - - - [ - - - { - - - currentPosition: { - - - currency: <currency1>, - - - value: <amount1>, - - - reservedValue: <amount2>, - - - lastUpdated: <timeStamp1> - - - } - - - }, - - - { - - - currentPosition: { - - - currency: <currency2>, - - - value: <amount3>, - - - reservedValue: <amount4>, - - - lastUpdated: <timeStamp2> - - - } - - - } - - - ] - - - }, - - - { - - - participantId: <dfsp2>, - - - participantPositions: - - - [ - - - { - - - currentPosition: { - - - currency: <currency1>, - - - value: <amount1>, - - - reservedValue: <amount2>, - - - lastUpdated: <timeStamp1> - - - } - - - }, - - - { - - - currentPosition: { - - - currency: <currency2>, - - - value: <amount3>, - - - reservedValue: <amount4>, - - - lastUpdated: <timeStamp2> - - - } - - - } - - - ] - - - } - - - ] - - - } - - - - - 7 - - - Return Positions for Participants - - - - - 8 - - - Return Positions for Participants - + + 4.2.0 Get Positions of all Participants + + + 4.2.0 Get Positions of all Participants + + ML API Adapter Service + + Central Service + + + + + + + + + + + + ML-API-ADAPTER + + + ML-API-ADAPTER + + + Central Service API + + + Central Service API + + + Participant Handler + + + Participant Handler + + + Participant DAO + + + Participant DAO + + + Central Store + + + Central Store + + + + + + + + + + Get Position Details + + + 1 + Request to get positions - GET - /participants/positions + + + 2 + Fetch Positions for all Participants + + + 3 + Fetch Positions for all active Participants + Error code: + 2003,3200 + + + 4 + Fetch Positions for: + all active Participants + with all active Currencies for each Participant + + participant + participantPosition + participantCurrency + + + 5 + Retrieved Positions for Participants + + + 6 + Return Positions for Participants + + + Message: + { + snapshotAt: <timestamp0>, + positions: + [ + { + participantId: <dfsp1>, + participantPositions: + [ + { + currentPosition: { + currency: <currency1>, + value: <amount1>, + reservedValue: <amount2>, + lastUpdated: <timeStamp1> + } + }, + { + currentPosition: { + currency: <currency2>, + value: <amount3>, + reservedValue: <amount4>, + lastUpdated: <timeStamp2> + } + } + ] + }, + { + participantId: <dfsp2>, + participantPositions: + [ + { + currentPosition: { + currency: <currency1>, + value: <amount1>, + reservedValue: <amount2>, + lastUpdated: <timeStamp1> + } + }, + { + currentPosition: { + currency: <currency2>, + value: <amount3>, + reservedValue: <amount4>, + lastUpdated: <timeStamp2> + } + } + ] + } + ] + } + + + 7 + Return Positions for Participants + + + 8 + Return Positions for Participants + diff --git a/docs/technical/technical/central-ledger/assets/diagrams/sequence/seq-position-1.3.0-v1.1.svg b/docs/technical/technical/central-ledger/assets/diagrams/sequence/seq-position-1.3.0-v1.1.svg index 6829d68f..d1915c8b 100644 --- a/docs/technical/technical/central-ledger/assets/diagrams/sequence/seq-position-1.3.0-v1.1.svg +++ b/docs/technical/technical/central-ledger/assets/diagrams/sequence/seq-position-1.3.0-v1.1.svg @@ -1,301 +1,188 @@ - - - - - - - - - - - 1.3.0. Position Handler Consume (single message) v1.1 - - - - Central Service - - - - - - - - - - - - - - - - - topic-transfer-position - - - - - topic-transfer-position - - - Position Handler - - - - - Position Handler - - - - - - - Event-Topic - - - - - Event-Topic - - - - - Notification-Topic - - - - - Notification-Topic - - - - - - Position Handler Consume - - - - - alt - - - [Consume Prepare message for Payer] - - - - - 1 - - - Consume Position event message for Payer - - - - - break - - - - - Validate Event - - - - - 2 - - - Validate event - Rule: type == 'position' && action == 'prepare' - - - Error codes: - - - 2001 - - - - - Persist Event Information - - - - - 3 - - - Publish event information - - - - - ref - - - Event Handler Consume - - - - - ref - - - Prepare Position Handler Consume - - - - - 4 - - - Produce message - - - - [Consume Fulfil message for Payee] - - - - - 5 - - - Consume Position event message for Payee - - - - - break - - - - - Validate Event - - - - - 6 - - - Validate event - Rule: type == 'position' && action IN ['commit', 'reserve'] - - - Error codes: - - - 2001 - - - - - Persist Event Information - - - - - 7 - - - Publish event information - - - - - ref - - - Event Handler Consume - - - - - ref - - - Fulfil Position Handler Consume - - - - - 8 - - - Produce message - - - - [Consume Abort message] - - - - - 9 - - - Consume Position event message - - - - - break - - - - - Validate Event - - - - - 10 - - - Validate event - Rule: type == 'position' && - - - action IN ['timeout-reserved', 'reject', 'fail'] - - - Error codes: - - - 2001 - - - - - Persist Event Information - - - - - 11 - - - Publish event information - - - - - ref - - - Event Handler Consume - - - - - ref - - - Abort Position Handler Consume - - - - - 12 - - - Produce message - + + 1.3.0. Position Handler Consume (single message) v1.1 + + + 1.3.0. Position Handler Consume (single message) v1.1 + + Central Service + + + + + + + + + + + + + + + + + + + + + + topic-transfer-position + + + topic-transfer-position + Position Handler + + + Position Handler + + + + + Event-Topic + + + Event-Topic + + + Notification-Topic + + + Notification-Topic + + + + + + + Position Handler Consume + + + alt + [Consume Prepare message for Payer] + + + 1 + Consume Position event message for Payer + + + break + + + Validate Event + + + + + + 2 + Validate event - Rule: type == 'position' && action == 'prepare' + Error codes: + 2001 + + + Persist Event Information + + + 3 + Publish event information + + + ref + Event Handler Consume +   + + + ref + Prepare Position Handler Consume +   + + + 4 + Produce message + + [Consume Fulfil message for Payee] + + + 5 + Consume Position event message for Payee + + + break + + + Validate Event + + + + + + 6 + Validate event - Rule: type == 'position' && action IN ['commit', 'reserve'] + Error codes: + 2001 + + + Persist Event Information + + + 7 + Publish event information + + + ref + Event Handler Consume +   + + + ref + Fulfil Position Handler Consume +   + + + 8 + Produce message + + [Consume Abort message] + + + 9 + Consume Position event message + + + break + + + Validate Event + + + + + + 10 + Validate event - Rule: type == 'position' && + action IN ['timeout-reserved', 'reject', 'fail'] + Error codes: + 2001 + + + Persist Event Information + + + 11 + Publish event information + + + ref + Event Handler Consume +   + + + ref + Abort Position Handler Consume +   + + + 12 + Produce message + diff --git a/docs/technical/technical/central-ledger/assets/diagrams/sequence/seq-position-1.3.0.svg b/docs/technical/technical/central-ledger/assets/diagrams/sequence/seq-position-1.3.0.svg index f03e043a..295295ed 100644 --- a/docs/technical/technical/central-ledger/assets/diagrams/sequence/seq-position-1.3.0.svg +++ b/docs/technical/technical/central-ledger/assets/diagrams/sequence/seq-position-1.3.0.svg @@ -1,301 +1,188 @@ - - - - - - - - - - - 1.3.0. Position Handler Consume (single message) - - - - Central Service - - - - - - - - - - - - - - - - - topic-transfer-position - - - - - topic-transfer-position - - - Position Handler - - - - - Position Handler - - - - - - - Event-Topic - - - - - Event-Topic - - - - - Notification-Topic - - - - - Notification-Topic - - - - - - Position Handler Consume - - - - - alt - - - [Consume Prepare message for Payer] - - - - - 1 - - - Consume Position event message for Payer - - - - - break - - - - - Validate Event - - - - - 2 - - - Validate event - Rule: type == 'position' && action == 'prepare' - - - Error codes: - - - 2001 - - - - - Persist Event Information - - - - - 3 - - - Publish event information - - - - - ref - - - Event Handler Consume - - - - - ref - - - Prepare Position Handler Consume - - - - - 4 - - - Produce message - - - - [Consume Fulfil message for Payee] - - - - - 5 - - - Consume Position event message for Payee - - - - - break - - - - - Validate Event - - - - - 6 - - - Validate event - Rule: type == 'position' && action == 'commit' - - - Error codes: - - - 2001 - - - - - Persist Event Information - - - - - 7 - - - Publish event information - - - - - ref - - - Event Handler Consume - - - - - ref - - - Fulfil Position Handler Consume - - - - - 8 - - - Produce message - - - - [Consume Abort message] - - - - - 9 - - - Consume Position event message - - - - - break - - - - - Validate Event - - - - - 10 - - - Validate event - Rule: type == 'position' && - - - action IN ['timeout-reserved', 'reject', 'fail'] - - - Error codes: - - - 2001 - - - - - Persist Event Information - - - - - 11 - - - Publish event information - - - - - ref - - - Event Handler Consume - - - - - ref - - - Abort Position Handler Consume - - - - - 12 - - - Produce message - + + 1.3.0. Position Handler Consume (single message) + + + 1.3.0. Position Handler Consume (single message) + + Central Service + + + + + + + + + + + + + + + + + + + + + + topic-transfer-position + + + topic-transfer-position + Position Handler + + + Position Handler + + + + + Event-Topic + + + Event-Topic + + + Notification-Topic + + + Notification-Topic + + + + + + + Position Handler Consume + + + alt + [Consume Prepare message for Payer] + + + 1 + Consume Position event message for Payer + + + break + + + Validate Event + + + + + + 2 + Validate event - Rule: type == 'position' && action == 'prepare' + Error codes: + 2001 + + + Persist Event Information + + + 3 + Publish event information + + + ref + Event Handler Consume +   + + + ref + Prepare Position Handler Consume +   + + + 4 + Produce message + + [Consume Fulfil message for Payee] + + + 5 + Consume Position event message for Payee + + + break + + + Validate Event + + + + + + 6 + Validate event - Rule: type == 'position' && action == 'commit' + Error codes: + 2001 + + + Persist Event Information + + + 7 + Publish event information + + + ref + Event Handler Consume +   + + + ref + Fulfil Position Handler Consume +   + + + 8 + Produce message + + [Consume Abort message] + + + 9 + Consume Position event message + + + break + + + Validate Event + + + + + + 10 + Validate event - Rule: type == 'position' && + action IN ['timeout-reserved', 'reject', 'fail'] + Error codes: + 2001 + + + Persist Event Information + + + 11 + Publish event information + + + ref + Event Handler Consume +   + + + ref + Abort Position Handler Consume +   + + + 12 + Produce message + diff --git a/docs/technical/technical/central-ledger/assets/diagrams/sequence/seq-position-1.3.1-prepare.svg b/docs/technical/technical/central-ledger/assets/diagrams/sequence/seq-position-1.3.1-prepare.svg index 0e6b46ec..83f1209b 100644 --- a/docs/technical/technical/central-ledger/assets/diagrams/sequence/seq-position-1.3.1-prepare.svg +++ b/docs/technical/technical/central-ledger/assets/diagrams/sequence/seq-position-1.3.1-prepare.svg @@ -1,842 +1,410 @@ - - - - - - - - - - - 1.3.1. Prepare Position Handler Consume - - - - Central Service - - - - - - - - - Position Handler - - - - - Position Handler - - - - - - - Notification-Topic - - - - - Notification-Topic - - - Position - - - Management - - - Facade - - - - - Position - - - Management - - - Facade - - - - - Position DAO - - - - - Position DAO - - - - - Central Store - - - - - Central Store - - - - - - - - Prepare Position Handler Consume - - - - - 1 - - - Request transfers to be processed - - - - - 2 - - - Check 1st transfer to select the Participant and Currency - - - - - DB TRANSACTION - - - - - 3 - - - Loop through batch and build list of transferIds and calculate sumTransfersInBatch, - - - checking all in Batch are for the correct Paricipant and Currency - - - Error code: - - - 2001, 3100 - - - - - 4 - - - Retrieve current state of all transfers in array from DB with select whereIn - - - (FYI: The two DB transaction model needs to add a mini-state step here (RECEIVED_PREPARE => RECEIVDED_PREPARE_PROCESSING) so that the transfers are left alone if processing has started) - - - - transferStateChange - - - transferParticipant - - - - - 5 - - - Return current state of all selected transfers from DB - - - - - 6 - - - Validate current state (transferStateChange.transferStateId == 'RECEIVED_PREPARE') - - - Error code: - - - 2001 - - - against failing transfers - - - Batch is not rejected as a whole. - - - - - List of transfers used during processing - - - reservedTransfers - - - is list of transfers to be processed in the batch - - - abortedTransfers - - - is the list of transfers in the incorrect state going into the process. Currently the transferStateChange is set to ABORTED - this should only be done if not already in a final state (idempotency) - - - processedTransfers - - - is the list of transfers that have gone through the position management algorithm. Both successful and failed trasnfers appear here as the order and "running position" against each is necessary for reconciliation - - - Scalar intermidate values used in the algorithm - - - transferAmount - - - = payload.amount.amount - - - sumTransfersInBatch - - - = SUM amount against each Transfer in batch - - - currentPosition - - - = participantPosition.value - - - reservedPosition - - - = participantPosition.{original}reservedValue - - - effectivePosition - - - = currentPosition + reservedPosition - - - heldPosition - - - = effectivePosition + sumTransfersInBatch - - - availablePosition - - - = - - - if settlement model delay is IMMEDIATE then: - - - settlementBalance + participantLimit(NetDebitCap) - effectivePosition, - - - otherwise: - - - participantLimit(NetDebitCap) - effectivePosition - - - sumReserved - - - = SUM of transfers that have met rule criteria and processed - - - - - Going to reserve the sum of the valid transfers in the batch against the Participants Positon in the Currency of this batch - - - and calculate the available position for the Participant to use - - - - - 7 - - - Select effectivePosition FOR UPDATE from DB for Payer - - - - participantPosition - - - - - 8 - - - Return effectivePosition (currentPosition and reservedPosition) from DB for Payer - - - - - 9 - - - Increment reservedValue to heldPosition - - - (reservedValue = reservedPosition + sumTransfersInBatch) - - - - - 10 - - - Persist reservedValue - - - - UPDATE - - - participantPosition - - - SET reservedValue += sumTransfersInBatch - - - - - 11 - - - Request position limits for Payer Participant - - - - FROM - - - participantLimit - - - WHERE participantLimit.limitTypeId = 'NET-DEBIT-CAP' - - - AND participantLimit.participantId = payload.payerFsp - - - AND participantLimit.currencyId = payload.amount.currency - - - - - 12 - - - Return position limits - - - - - 13 - - - availablePosition - - - = - - - if settlement model delay is IMMEDIATE then: - - - settlementBalance + participantLimit(NetDebitCap) - effectivePosition - - - otherwise: - - - participantLimit(NetDebitCap) - effectivePosition - - - (same as = (settlementBalance?) + netDebitCap - currentPosition - reservedPosition) - - - - - For each transfer in the batch, validate the availablility of position to meet the transfer amount - - - this will be as per the position algorithm documented below - - - - - 14 - - - Validate availablePosition for each tranfser (see algorithm below) - - - Error code: - - - 4001 - - - - - 01: sumReserved = 0 // Record the sum of the transfers we allow to progress to RESERVED - - - 02: sumProcessed =0 // Record the sum of the transfers already processed in this batch - - - 03: processedTransfers = {} // The list of processed transfers - so that we can store the additional information around the decision. Most importantly the "running" position - - - 04: foreach transfer in reservedTransfers - - - 05: sumProcessed += transfer.amount // the total processed so far - - - (NEED TO UPDATE IN CODE) - - - 06: if availablePosition >= transfer.amount - - - 07: transfer.state = "RESERVED" - - - 08: availablePosition -= preparedTransfer.amount - - - 09: sumRESERVED += preparedTransfer.amount - - - 10: else - - - 11: preparedTransfer.state = "ABORTED" - - - 12: preparedTransfer.reason = "Net Debit Cap exceeded by this request at this time, please try again later" - - - 13: end if - - - 14: runningPosition = currentPosition + sumReserved // the initial value of the Participants position plus the total value that has been accepted in the batch so far - - - 15: runningReservedValue = sumTransfersInBatch - sumProcessed + reservedPosition - - - (NEED TO UPDATE IN CODE) - - - // the running down of the total reserved value at the begining of the batch. - - - 16: Add transfer to the processedTransfer list recording the transfer state and running position and reserved values { transferState, transfer, rawMessage, transferAmount, runningPosition, runningReservedValue } - - - 16: end foreach - - - - - Once the outcome for all transfers is known,update the Participant's position and remove the reserved amount associated with the batch - - - (If there are any alarm limits, process those returning limits in which the threshold has been breached) - - - Do a bulk insert of the trasnferStateChanges associated with processing, using the result to complete the participantPositionChange and bulk insert of these to persist the running position - - - - - 15 - - - Assess any limit thresholds on the final position - - - adding to alarm list if triggered - - - - - 16 - - - Persist latest position - - - value - - - and - - - reservedValue - - - to DB for Payer - - - - UPDATE - - - participantPosition - - - SET value += sumRESERVED, - - - reservedValue -= sumTransfersInBatch - - - - - 17 - - - Bulk persist transferStateChange for all processedTransfers - - - - batch INSERT - - - transferStateChange - - - select for update from transfer table where transferId in ([transferBatch.transferId,...]) - - - build list of transferStateChanges from transferBatch - - - - - 18 - - - Populate batchParticipantPositionChange from the resultant transferStateChange and the earlier processedTransfer list - - - - - Effectively: - - - SET transferStateChangeId = processedTransfer.transferStateChangeId, - - - participantPositionId = preparedTransfer.participantPositionId, - - - value = preparedTransfer.positionValue, - - - reservedValue = preparedTransfer.positionReservedValue - - - - - 19 - - - Bulk persist the participant position change for all processedTransfers - - - - batch INSERT - - - participantPositionChange - - - - - 20 - - - Return a map of transferIds and their transferStateChanges - - - - - alt - - - [Calculate & Validate Latest Position Prepare (success)] - - - - - Message: - - - { - - - id: <transferMessage.transferId> - - - from: <transferMessage.payerFsp>, - - - to: <transferMessage.payeeFsp>, - - - 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 - - - } - - - } - - - } - - - } - - - - - 21 - - - Publish Notification event - - - Error code: - - - 2003 - - - - [Calculate & Validate Latest Position Prepare (failure)] - - - - - Validation failure! - - - - - Persist Transfer State (with transferState='ABORTED' on position check fail) - - - - - 22 - - - Request to persist transfer - - - Error code: - - - 2003 - - - - - transferStateChange.state = "ABORTED", - - - transferStateChange.reason = "Net Debit Cap exceeded by this request at this time, please try again later" - - - - - 23 - - - Persist transfer state - - - - transferStateChange - - - - - 24 - - - Return success - - - - - Message: - - - { - - - id: <transferMessage.transferId> - - - from: <ledgerName>, - - - to: <transferMessage.payerFsp>, - - - type: application/json - - - content: { - - - headers: <transferHeaders>, - - - payload: { - - - "errorInformation": { - - - "errorCode": 4001, - - - "errorDescription": "Payer FSP insufficient liquidity", - - - "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> - - - } - - - } - - - } - - - } - - - - - 25 - - - Publish Notification (failure) event for Payer - - - Error code: - - - 2003 - + + 1.3.1. Prepare Position Handler Consume + + + 1.3.1. Prepare Position Handler Consume + + Central Service + + + + + + + + + + + + + + + + + + + + + + + Position Handler + + + Position Handler + + + + + Notification-Topic + + + Notification-Topic + Position + Management + Facade + + + Position + Management + Facade + + + Position DAO + + + Position DAO + + + Central Store + + + Central Store + + + + + + + + + + + + + + + + + + Prepare Position Handler Consume + + + 1 + Request transfers to be processed + + + + + 2 + Check 1st transfer to select the Participant and Currency + + + DB TRANSACTION + + + + + 3 + Loop through batch and build list of transferIds and calculate sumTransfersInBatch, + checking all in Batch are for the correct Paricipant and Currency + Error code: + 2001, 3100 + + + 4 + Retrieve current state of all transfers in array from DB with select whereIn + (FYI: The two DB transaction model needs to add a mini-state step here (RECEIVED_PREPARE => RECEIVDED_PREPARE_PROCESSING) so that the transfers are left alone if processing has started) + + transferStateChange + transferParticipant + + + 5 + Return current state of all selected transfers from DB + + + + + + 6 + Validate current state (transferStateChange.transferStateId == 'RECEIVED_PREPARE') + Error code: + 2001 + against failing transfers + Batch is not rejected as a whole. + + + List of transfers used during processing + reservedTransfers + is list of transfers to be processed in the batch + abortedTransfers + is the list of transfers in the incorrect state going into the process. Currently the transferStateChange is set to ABORTED - this should only be done if not already in a final state (idempotency) + processedTransfers + is the list of transfers that have gone through the position management algorithm. Both successful and failed trasnfers appear here as the order and "running position" against each is necessary for reconciliation +   + Scalar intermidate values used in the algorithm + transferAmount + = payload.amount.amount + sumTransfersInBatch + = SUM amount against each Transfer in batch + currentPosition + = participantPosition.value + reservedPosition + = participantPosition.{original}reservedValue + effectivePosition + = currentPosition + reservedPosition + heldPosition + = effectivePosition + sumTransfersInBatch + availablePosition + = + if settlement model delay is IMMEDIATE then: + settlementBalance + participantLimit(NetDebitCap) - effectivePosition, + otherwise: + participantLimit(NetDebitCap) - effectivePosition + sumReserved + = SUM of transfers that have met rule criteria and processed + + + Going to reserve the sum of the valid transfers in the batch against the Participants Positon in the Currency of this batch + and calculate the available position for the Participant to use + + + 7 + Select effectivePosition FOR UPDATE from DB for Payer + + participantPosition + + + 8 + Return effectivePosition (currentPosition and reservedPosition) from DB for Payer + + + + + 9 + Increment reservedValue to heldPosition + (reservedValue = reservedPosition + sumTransfersInBatch) + + + 10 + Persist reservedValue + + UPDATE + participantPosition + SET reservedValue += sumTransfersInBatch + + + 11 + Request position limits for Payer Participant + + FROM + participantLimit + WHERE participantLimit.limitTypeId = 'NET-DEBIT-CAP' + AND participantLimit.participantId = payload.payerFsp + AND participantLimit.currencyId = payload.amount.currency + + + 12 + Return position limits + + + + + + 13 + availablePosition + = + if settlement model delay is IMMEDIATE then: + settlementBalance + participantLimit(NetDebitCap) - effectivePosition +   + otherwise: + participantLimit(NetDebitCap) - effectivePosition + (same as = (settlementBalance?) + netDebitCap - currentPosition - reservedPosition) + + + For each transfer in the batch, validate the availablility of position to meet the transfer amount + this will be as per the position algorithm documented below + + + + + + 14 + Validate availablePosition for each tranfser (see algorithm below) + Error code: + 4001 + + + 01: sumReserved = 0 // Record the sum of the transfers we allow to progress to RESERVED + 02: sumProcessed =0 // Record the sum of the transfers already processed in this batch + 03: processedTransfers = {} // The list of processed transfers - so that we can store the additional information around the decision. Most importantly the "running" position + 04: foreach transfer in reservedTransfers + 05: sumProcessed += transfer.amount // the total processed so far + (NEED TO UPDATE IN CODE) + 06: if availablePosition >= transfer.amount + 07: transfer.state = "RESERVED" + 08: availablePosition -= preparedTransfer.amount + 09: sumRESERVED += preparedTransfer.amount + 10: else + 11: preparedTransfer.state = "ABORTED" + 12: preparedTransfer.reason = "Net Debit Cap exceeded by this request at this time, please try again later" + 13: end if + 14: runningPosition = currentPosition + sumReserved // the initial value of the Participants position plus the total value that has been accepted in the batch so far + 15: runningReservedValue = sumTransfersInBatch - sumProcessed + reservedPosition + (NEED TO UPDATE IN CODE) + // the running down of the total reserved value at the begining of the batch. + 16: Add transfer to the processedTransfer list recording the transfer state and running position and reserved values { transferState, transfer, rawMessage, transferAmount, runningPosition, runningReservedValue } + 16: end foreach + + + Once the outcome for all transfers is known,update the Participant's position and remove the reserved amount associated with the batch + (If there are any alarm limits, process those returning limits in which the threshold has been breached) + Do a bulk insert of the trasnferStateChanges associated with processing, using the result to complete the participantPositionChange and bulk insert of these to persist the running position + + + + + 15 + Assess any limit thresholds on the final position + adding to alarm list if triggered + + + 16 + Persist latest position + value + and + reservedValue + to DB for Payer + + UPDATE + participantPosition + SET value += sumRESERVED, + reservedValue -= sumTransfersInBatch + + + 17 + Bulk persist transferStateChange for all processedTransfers + + batch INSERT + transferStateChange + select for update from transfer table where transferId in ([transferBatch.transferId,...]) + build list of transferStateChanges from transferBatch +   + + + + + 18 + Populate batchParticipantPositionChange from the resultant transferStateChange and the earlier processedTransfer list + + + Effectively: + SET transferStateChangeId = processedTransfer.transferStateChangeId, + participantPositionId = preparedTransfer.participantPositionId, + value = preparedTransfer.positionValue, + reservedValue = preparedTransfer.positionReservedValue + + + 19 + Bulk persist the participant position change for all processedTransfers + + batch INSERT + participantPositionChange + + + 20 + Return a map of transferIds and their transferStateChanges + + + alt + [Calculate & Validate Latest Position Prepare (success)] + + + Message: + { + id: <transferMessage.transferId> + from: <transferMessage.payerFsp>, + to: <transferMessage.payeeFsp>, + 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 + } + } + } + } + + + 21 + Publish Notification event + Error code: + 2003 + + [Calculate & Validate Latest Position Prepare (failure)] + + + Validation failure! + + + Persist Transfer State (with transferState='ABORTED' on position check fail) + + + 22 + Request to persist transfer + Error code: + 2003 + + + transferStateChange.state = "ABORTED", + transferStateChange.reason = "Net Debit Cap exceeded by this request at this time, please try again later" + + + 23 + Persist transfer state + + transferStateChange + + + 24 + Return success + + + Message: + { + id: <transferMessage.transferId> + from: <ledgerName>, + to: <transferMessage.payerFsp>, + type: application/json + content: { + headers: <transferHeaders>, + payload: { + "errorInformation": { + "errorCode": 4001, + "errorDescription": "Payer FSP insufficient liquidity", + "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> + } + } + } + } + + + 25 + Publish Notification (failure) event for Payer + Error code: + 2003 + diff --git a/docs/technical/technical/central-ledger/assets/diagrams/sequence/seq-position-1.3.2-fulfil-v1.1.svg b/docs/technical/technical/central-ledger/assets/diagrams/sequence/seq-position-1.3.2-fulfil-v1.1.svg index de29ad2c..f7fc9c3c 100644 --- a/docs/technical/technical/central-ledger/assets/diagrams/sequence/seq-position-1.3.2-fulfil-v1.1.svg +++ b/docs/technical/technical/central-ledger/assets/diagrams/sequence/seq-position-1.3.2-fulfil-v1.1.svg @@ -1,345 +1,186 @@ - - - - - - - - - - - 1.3.2. Fulfil Position Handler Consume v1.1 - - - - Central Service - - - - - - - - Position Handler - - - - - Position Handler - - - - - - - Notifications-Topic - - - - - Notifications-Topic - - - Position DAO - - - - - Position DAO - - - - - Position Facade - - - - - Position Facade - - - - - Central Store - - - - - Central Store - - - - - - - - Fulfil Position Handler Consume - - - - - 1 - - - Request current state of transfer from DB - - - Error code: - - - 2003 - - - - - 2 - - - Retrieve current state of transfer from DB - - - - transferStateChange - - - transferParticipant - - - - - 3 - - - Return current state of transfer from DB - - - - - 4 - - - Return current state of transfer from DB - - - - - 5 - - - Validate current state (transferState is 'RECEIVED-FULFIL') - - - Error code: - - - 2001 - - - - - Persist Position change and Transfer State (with transferState='COMMITTED' on position check pass) - - - - - 6 - - - Request to persist latest position and state to DB - - - Error code: - - - 2003 - - - - - DB TRANSACTION - - - - - 7 - - - Select participantPosition.value FOR UPDATE from DB for Payee - - - - participantPosition - - - - - 8 - - - Return participantPosition.value from DB for Payee - - - - - 9 - - - latestPosition - - - = participantPosition.value - payload.amount.amount - - - - - 10 - - - Persist latestPosition to DB for Payee - - - - UPDATE - - - participantPosition - - - SET value = latestPosition - - - - - 11 - - - Persist transfer state and participant position change - - - - INSERT - - - transferStateChange - - - transferStateId = 'COMMITTED' - - - INSERT - - - participantPositionChange - - - SET participantPositionId = participantPosition.participantPositionId, - - - transferStateChangeId = transferStateChange.transferStateChangeId, - - - value = latestPosition, - - - reservedValue = participantPosition.reservedValue - - - createdDate = new Date() - - - - - 12 - - - Return success - - - - - Message: - - - { - - - id: <transferMessage.transferId> - - - from: <transferMessage.payerFsp>, - - - to: <transferMessage.payeeFsp>, - - - type: application/json - - - content: { - - - headers: <transferHeaders>, - - - payload: <transferMessage> - - - }, - - - metadata: { - - - event: { - - - id: <uuid>, - - - responseTo: <previous.uuid>, - - - type: transfer, - - - action: commit || reserve, - - - createdAt: <timestamp>, - - - state: { - - - status: "success", - - - code: 0 - - - } - - - } - - - } - - - } - - - - - 13 - - - Publish Transfer event - - - Error code: - - - 2003 - + + 1.3.2. Fulfil Position Handler Consume v1.1 + + + 1.3.2. Fulfil Position Handler Consume v1.1 + + Central Service + + + + + + + + + + + + + + + + + Position Handler + + + Position Handler + + + + + Notifications-Topic + + + Notifications-Topic + Position DAO + + + Position DAO + + + Position Facade + + + Position Facade + + + Central Store + + + Central Store + + + + + + + + + + + + + Fulfil Position Handler Consume + + + 1 + Request current state of transfer from DB + Error code: + 2003 + + + 2 + Retrieve current state of transfer from DB + + transferStateChange + transferParticipant + + + 3 + Return current state of transfer from DB + + + 4 + Return current state of transfer from DB + + + + + + 5 + Validate current state (transferState is 'RECEIVED-FULFIL') + Error code: + 2001 + + + Persist Position change and Transfer State (with transferState='COMMITTED' on position check pass) + + + 6 + Request to persist latest position and state to DB + Error code: + 2003 + + + DB TRANSACTION + + + 7 + Select participantPosition.value FOR UPDATE from DB for Payee + + participantPosition + + + 8 + Return participantPosition.value from DB for Payee + + + + + + 9 + latestPosition + = participantPosition.value - payload.amount.amount + + + 10 + Persist latestPosition to DB for Payee + + UPDATE + participantPosition + SET value = latestPosition + + + 11 + Persist transfer state and participant position change + + INSERT + transferStateChange + transferStateId = 'COMMITTED' +   + INSERT + participantPositionChange + SET participantPositionId = participantPosition.participantPositionId, + transferStateChangeId = transferStateChange.transferStateChangeId, + value = latestPosition, + reservedValue = participantPosition.reservedValue + createdDate = new Date() + + + 12 + Return success + + + Message: + { + id: <transferMessage.transferId> + from: <transferMessage.payerFsp>, + to: <transferMessage.payeeFsp>, + type: application/json + content: { + headers: <transferHeaders>, + payload: <transferMessage> + }, + metadata: { + event: { + id: <uuid>, + responseTo: <previous.uuid>, + type: transfer, + action: commit || reserve, + createdAt: <timestamp>, + state: { + status: "success", + code: 0 + } + } + } + } + + + 13 + Publish Transfer event + Error code: + 2003 + diff --git a/docs/technical/technical/central-ledger/assets/diagrams/sequence/seq-position-1.3.2-fulfil.svg b/docs/technical/technical/central-ledger/assets/diagrams/sequence/seq-position-1.3.2-fulfil.svg index 89ddaffd..d95894bd 100644 --- a/docs/technical/technical/central-ledger/assets/diagrams/sequence/seq-position-1.3.2-fulfil.svg +++ b/docs/technical/technical/central-ledger/assets/diagrams/sequence/seq-position-1.3.2-fulfil.svg @@ -1,345 +1,186 @@ - - - - - - - - - - - 1.3.2. Fulfil Position Handler Consume - - - - Central Service - - - - - - - - Position Handler - - - - - Position Handler - - - - - - - Notifications-Topic - - - - - Notifications-Topic - - - Position DAO - - - - - Position DAO - - - - - Position Facade - - - - - Position Facade - - - - - Central Store - - - - - Central Store - - - - - - - - Fulfil Position Handler Consume - - - - - 1 - - - Request current state of transfer from DB - - - Error code: - - - 2003 - - - - - 2 - - - Retrieve current state of transfer from DB - - - - transferStateChange - - - transferParticipant - - - - - 3 - - - Return current state of transfer from DB - - - - - 4 - - - Return current state of transfer from DB - - - - - 5 - - - Validate current state (transferState is 'RECEIVED-FULFIL') - - - Error code: - - - 2001 - - - - - Persist Position change and Transfer State (with transferState='COMMITTED' on position check pass) - - - - - 6 - - - Request to persist latest position and state to DB - - - Error code: - - - 2003 - - - - - DB TRANSACTION - - - - - 7 - - - Select participantPosition.value FOR UPDATE from DB for Payee - - - - participantPosition - - - - - 8 - - - Return participantPosition.value from DB for Payee - - - - - 9 - - - latestPosition - - - = participantPosition.value - payload.amount.amount - - - - - 10 - - - Persist latestPosition to DB for Payee - - - - UPDATE - - - participantPosition - - - SET value = latestPosition - - - - - 11 - - - Persist transfer state and participant position change - - - - INSERT - - - transferStateChange - - - transferStateId = 'COMMITTED' - - - INSERT - - - participantPositionChange - - - SET participantPositionId = participantPosition.participantPositionId, - - - transferStateChangeId = transferStateChange.transferStateChangeId, - - - value = latestPosition, - - - reservedValue = participantPosition.reservedValue - - - createdDate = new Date() - - - - - 12 - - - Return success - - - - - Message: - - - { - - - id: <transferMessage.transferId> - - - from: <transferMessage.payerFsp>, - - - to: <transferMessage.payeeFsp>, - - - type: application/json - - - content: { - - - headers: <transferHeaders>, - - - payload: <transferMessage> - - - }, - - - metadata: { - - - event: { - - - id: <uuid>, - - - responseTo: <previous.uuid>, - - - type: transfer, - - - action: commit, - - - createdAt: <timestamp>, - - - state: { - - - status: "success", - - - code: 0 - - - } - - - } - - - } - - - } - - - - - 13 - - - Publish Transfer event - - - Error code: - - - 2003 - + + 1.3.2. Fulfil Position Handler Consume + + + 1.3.2. Fulfil Position Handler Consume + + Central Service + + + + + + + + + + + + + + + + + Position Handler + + + Position Handler + + + + + Notifications-Topic + + + Notifications-Topic + Position DAO + + + Position DAO + + + Position Facade + + + Position Facade + + + Central Store + + + Central Store + + + + + + + + + + + + + Fulfil Position Handler Consume + + + 1 + Request current state of transfer from DB + Error code: + 2003 + + + 2 + Retrieve current state of transfer from DB + + transferStateChange + transferParticipant + + + 3 + Return current state of transfer from DB + + + 4 + Return current state of transfer from DB + + + + + + 5 + Validate current state (transferState is 'RECEIVED-FULFIL') + Error code: + 2001 + + + Persist Position change and Transfer State (with transferState='COMMITTED' on position check pass) + + + 6 + Request to persist latest position and state to DB + Error code: + 2003 + + + DB TRANSACTION + + + 7 + Select participantPosition.value FOR UPDATE from DB for Payee + + participantPosition + + + 8 + Return participantPosition.value from DB for Payee + + + + + + 9 + latestPosition + = participantPosition.value - payload.amount.amount + + + 10 + Persist latestPosition to DB for Payee + + UPDATE + participantPosition + SET value = latestPosition + + + 11 + Persist transfer state and participant position change + + INSERT + transferStateChange + transferStateId = 'COMMITTED' +   + INSERT + participantPositionChange + SET participantPositionId = participantPosition.participantPositionId, + transferStateChangeId = transferStateChange.transferStateChangeId, + value = latestPosition, + reservedValue = participantPosition.reservedValue + createdDate = new Date() + + + 12 + Return success + + + Message: + { + id: <transferMessage.transferId> + from: <transferMessage.payerFsp>, + to: <transferMessage.payeeFsp>, + type: application/json + content: { + headers: <transferHeaders>, + payload: <transferMessage> + }, + metadata: { + event: { + id: <uuid>, + responseTo: <previous.uuid>, + type: transfer, + action: commit, + createdAt: <timestamp>, + state: { + status: "success", + code: 0 + } + } + } + } + + + 13 + Publish Transfer event + Error code: + 2003 + diff --git a/docs/technical/technical/central-ledger/assets/diagrams/sequence/seq-position-1.3.3-abort.svg b/docs/technical/technical/central-ledger/assets/diagrams/sequence/seq-position-1.3.3-abort.svg index 57c541a8..82d02319 100644 --- a/docs/technical/technical/central-ledger/assets/diagrams/sequence/seq-position-1.3.3-abort.svg +++ b/docs/technical/technical/central-ledger/assets/diagrams/sequence/seq-position-1.3.3-abort.svg @@ -1,915 +1,457 @@ - - - - - - - - - - - 1.3.3. Abort Position Handler Consume - - - - Central Service - - - - - - - - - - - - - - - Position Handler - - - - - Position Handler - - - - - - - Notification-Topic - - - - - Notification-Topic - - - Position DAO - - - - - Position DAO - - - - - Central Store - - - - - Central Store - - - - - - - - Abort Position Handler Consume - - - - - opt - - - [type == 'position' && action == 'timeout-reserved'] - - - - - 1 - - - Request current state of transfer from DB - - - Error code: - - - 2003 - - - - - 2 - - - Retrieve current state of transfer from DB - - - - transferStateChange - - - transferParticipant - - - - - 3 - - - Return current state of transfer from DB - - - - - 4 - - - Return current state of transfer from DB - - - - - 5 - - - Validate current state (transferStateChange.transferStateId == 'RESERVED_TIMEOUT') - - - Error code: - - - 2001 - - - - - Persist Position change and Transfer state - - - - - 6 - - - transferStateId - - - = 'EXPIRED_RESERVED' - - - - - 7 - - - Request to persist latest position and state to DB - - - Error code: - - - 2003 - - - - - DB TRANSACTION IMPLEMENTATION - - - - - 8 - - - Select participantPosition.value FOR UPDATE for payerCurrencyId - - - - participantPosition - - - - - 9 - - - Return participantPosition - - - - - 10 - - - latestPosition - - - = participantPosition - payload.amount.amount - - - - - 11 - - - Persist latestPosition to DB for Payer - - - - UPDATE - - - participantPosition - - - SET value = latestPosition - - - - - 12 - - - Persist participant position change and state change - - - - INSERT - - - transferStateChange - - - VALUES (transferStateId) - - - INSERT - - - participantPositionChange - - - SET participantPositionId = participantPosition.participantPositionId, - - - transferStateChangeId = transferStateChange.transferStateChangeId, - - - value = latestPosition, - - - reservedValue = participantPosition.reservedValue - - - createdDate = new Date() - - - - - 13 - - - Return success - - - - - Message: { - - - id: <transferMessage.transferId> - - - from: <transferMessage.payerFsp>, - - - to: <transferMessage.payeeFsp>, - - - type: application/json - - - content: { - - - headers: <transferHeaders>, - - - payload: { - - - "errorInformation": { - - - "errorCode": 3300, - - - "errorDescription": "Transfer expired", - - - "extensionList": <transferMessage.extensionList> - - - } - - - } - - - }, - - - metadata: { - - - event: { - - - id: <uuid>, - - - responseTo: <previous.uuid>, - - - type: notification, - - - action: abort, - - - createdAt: <timestamp>, - - - state: { - - - status: 'error', - - - code: <errorInformation.errorCode> - - - description: <errorInformation.errorDescription> - - - } - - - } - - - } - - - } - - - - - 14 - - - Publish Notification event - - - Error code: - - - 2003 - - - - - opt - - - [type == 'position' && (action IN ['reject', 'abort'])] - - - - - 15 - - - Request current state of transfer from DB - - - Error code: - - - 2003 - - - - - 16 - - - Retrieve current state of transfer from DB - - - - transferStateChange - - - - - 17 - - - Return current state of transfer from DB - - - - - 18 - - - Return current state of transfer from DB - - - - - 19 - - - Validate current state (transferStateChange.transferStateId IN ['RECEIVED_REJECT', 'RECEIVED_ERROR']) - - - Error code: - - - 2001 - - - - - Persist Position change and Transfer state - - - - - 20 - - - transferStateId - - - = (action == 'reject' ? 'ABORTED_REJECTED' : 'ABORTED_ERROR' ) - - - - - 21 - - - Request to persist latest position and state to DB - - - Error code: - - - 2003 - - - - - Refer to - - - DB TRANSACTION IMPLEMENTATION - - - above - - - - - 22 - - - Persist to database - - - - participantPosition - - - transferStateChange - - - participantPositionChange - - - - - 23 - - - Return success - - - - - alt - - - [action == 'reject'] - - - - - Message: { - - - id: <transferMessage.transferId> - - - from: <transferMessage.payerFsp>, - - - to: <transferMessage.payeeFsp>, - - - type: application/json - - - content: { - - - headers: <transferHeaders>, - - - payload: <transferMessage> - - - }, - - - metadata: { - - - event: { - - - id: <uuid>, - - - responseTo: <previous.uuid>, - - - type: notification, - - - action: reject, - - - createdAt: <timestamp>, - - - state: { - - - status: "success", - - - code: 0, - - - description: "action successful" - - - } - - - } - - - } - - - } - - - - [action == 'abort'] - - - - - Message: { - - - id: <transferMessage.transferId> - - - from: <transferMessage.payerFsp>, - - - to: <transferMessage.payeeFsp>, - - - type: application/json - - - content: { - - - headers: <transferHeaders>, - - - payload: <transferMessage> - - - }, - - - metadata: { - - - event: { - - - id: <uuid>, - - - responseTo: <previous.uuid>, - - - type: notification, - - - action: abort, - - - createdAt: <timestamp>, - - - state: { - - - status: 'error', - - - code: <payload.errorInformation.errorCode || 5000> - - - description: <payload.errorInformation.errorDescription> - - - } - - - } - - - } - - - } - - - - - 24 - - - Publish Notification event - - - Error code: - - - 2003 - - - - - opt - - - [type == 'position' && action == 'fail' (Unable to currently trigger this scenario)] - - - - - 25 - - - Request current state of transfer from DB - - - Error code: - - - 2003 - - - - - 26 - - - Retrieve current state of transfer from DB - - - - transferStateChange - - - - - 27 - - - Return current state of transfer from DB - - - - - 28 - - - Return current state of transfer from DB - - - - - 29 - - - Validate current state (transferStateChange.transferStateId == 'FAILED') - - - - - Persist Position change and Transfer state - - - - - 30 - - - transferStateId - - - = 'FAILED' - - - - - 31 - - - Request to persist latest position and state to DB - - - Error code: - - - 2003 - - - - - Refer to - - - DB TRANSACTION IMPLEMENTATION - - - above - - - - - 32 - - - Persist to database - - - - participantPosition - - - transferStateChange - - - participantPositionChange - - - - - 33 - - - Return success - - - - - Message: { - - - id: <transferMessage.transferId> - - - from: <transferMessage.payerFsp>, - - - to: <transferMessage.payeeFsp>, - - - type: application/json - - - content: { - - - headers: <transferHeaders>, - - - payload: { - - - "errorInformation": { - - - "errorCode": 3100, - - - "errorDescription": "Transfer failed", - - - "extensionList": <transferMessage.extensionList> - - - } - - - } - - - }, - - - metadata: { - - - event: { - - - id: <uuid>, - - - responseTo: <previous.uuid>, - - - type: notification, - - - action: abort, - - - createdAt: <timestamp>, - - - state: { - - - status: 'error', - - - code: <errorInformation.errorCode> - - - description: <errorInformation.errorDescription> - - - } - - - } - - - } - - - } - - - - - 34 - - - Publish Notification event - - - Error code: - - - 2003 - + + 1.3.3. Abort Position Handler Consume + + + 1.3.3. Abort Position Handler Consume + + Central Service + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Position Handler + + + Position Handler + + + + + Notification-Topic + + + Notification-Topic + Position DAO + + + Position DAO + + + Central Store + + + Central Store + + + + + + + + + + + + + + + + + + + + + + + Abort Position Handler Consume + + + opt + [type == 'position' && action == 'timeout-reserved'] + + + 1 + Request current state of transfer from DB + Error code: + 2003 + + + 2 + Retrieve current state of transfer from DB + + transferStateChange + transferParticipant + + + 3 + Return current state of transfer from DB + + + 4 + Return current state of transfer from DB + + + + + + 5 + Validate current state (transferStateChange.transferStateId == 'RESERVED_TIMEOUT') + Error code: + 2001 + + + Persist Position change and Transfer state + + + + + 6 + transferStateId + = 'EXPIRED_RESERVED' + + + 7 + Request to persist latest position and state to DB + Error code: + 2003 + + + DB TRANSACTION IMPLEMENTATION + + + 8 + Select participantPosition.value FOR UPDATE for payerCurrencyId + + participantPosition + + + 9 + Return participantPosition + + + + + + 10 + latestPosition + = participantPosition - payload.amount.amount + + + 11 + Persist latestPosition to DB for Payer + + UPDATE + participantPosition + SET value = latestPosition + + + 12 + Persist participant position change and state change + + INSERT + transferStateChange +   + VALUES (transferStateId) +   + INSERT + participantPositionChange + SET participantPositionId = participantPosition.participantPositionId, + transferStateChangeId = transferStateChange.transferStateChangeId, + value = latestPosition, + reservedValue = participantPosition.reservedValue + createdDate = new Date() + + + 13 + Return success + + + Message: { + id: <transferMessage.transferId> + from: <transferMessage.payerFsp>, + to: <transferMessage.payeeFsp>, + type: application/json + content: { + headers: <transferHeaders>, + payload: { + "errorInformation": { + "errorCode": 3300, + "errorDescription": "Transfer expired", + "extensionList": <transferMessage.extensionList> + } + } + }, + metadata: { + event: { + id: <uuid>, + responseTo: <previous.uuid>, + type: notification, + action: abort, + createdAt: <timestamp>, + state: { + status: 'error', + code: <errorInformation.errorCode> + description: <errorInformation.errorDescription> + } + } + } + } + + + 14 + Publish Notification event + Error code: + 2003 + + + opt + [type == 'position' && (action IN ['reject', 'abort'])] + + + 15 + Request current state of transfer from DB + Error code: + 2003 + + + 16 + Retrieve current state of transfer from DB + + transferStateChange + + + 17 + Return current state of transfer from DB + + + 18 + Return current state of transfer from DB + + + + + + 19 + Validate current state (transferStateChange.transferStateId IN ['RECEIVED_REJECT', 'RECEIVED_ERROR']) + Error code: + 2001 + + + Persist Position change and Transfer state + + + + + 20 + transferStateId + = (action == 'reject' ? 'ABORTED_REJECTED' : 'ABORTED_ERROR' ) + + + 21 + Request to persist latest position and state to DB + Error code: + 2003 + + + Refer to + DB TRANSACTION IMPLEMENTATION + above + + + 22 + Persist to database + + participantPosition + transferStateChange + participantPositionChange + + + 23 + Return success + + + alt + [action == 'reject'] + + + Message: { + id: <transferMessage.transferId> + from: <transferMessage.payerFsp>, + to: <transferMessage.payeeFsp>, + type: application/json + content: { + headers: <transferHeaders>, + payload: <transferMessage> + }, + metadata: { + event: { + id: <uuid>, + responseTo: <previous.uuid>, + type: notification, + action: reject, + createdAt: <timestamp>, + state: { + status: "success", + code: 0, + description: "action successful" + } + } + } + } + + [action == 'abort'] + + + Message: { + id: <transferMessage.transferId> + from: <transferMessage.payerFsp>, + to: <transferMessage.payeeFsp>, + type: application/json + content: { + headers: <transferHeaders>, + payload: <transferMessage> + }, + metadata: { + event: { + id: <uuid>, + responseTo: <previous.uuid>, + type: notification, + action: abort, + createdAt: <timestamp>, + state: { + status: 'error', + code: <payload.errorInformation.errorCode || 5000> + description: <payload.errorInformation.errorDescription> + } + } + } + } + + + 24 + Publish Notification event + Error code: + 2003 + + + opt + [type == 'position' && action == 'fail' (Unable to currently trigger this scenario)] + + + 25 + Request current state of transfer from DB + Error code: + 2003 + + + 26 + Retrieve current state of transfer from DB + + transferStateChange + + + 27 + Return current state of transfer from DB + + + 28 + Return current state of transfer from DB + + + + + + 29 + Validate current state (transferStateChange.transferStateId == 'FAILED') + + + Persist Position change and Transfer state + + + + + 30 + transferStateId + = 'FAILED' + + + 31 + Request to persist latest position and state to DB + Error code: + 2003 + + + Refer to + DB TRANSACTION IMPLEMENTATION + above + + + 32 + Persist to database + + participantPosition + transferStateChange + participantPositionChange + + + 33 + Return success + + + Message: { + id: <transferMessage.transferId> + from: <transferMessage.payerFsp>, + to: <transferMessage.payeeFsp>, + type: application/json + content: { + headers: <transferHeaders>, + payload: { + "errorInformation": { + "errorCode": 3100, + "errorDescription": "Transfer failed", + "extensionList": <transferMessage.extensionList> + } + } + }, + metadata: { + event: { + id: <uuid>, + responseTo: <previous.uuid>, + type: notification, + action: abort, + createdAt: <timestamp>, + state: { + status: 'error', + code: <errorInformation.errorCode> + description: <errorInformation.errorDescription> + } + } + } + } + + + 34 + Publish Notification event + Error code: + 2003 + diff --git a/docs/technical/technical/central-ledger/assets/diagrams/sequence/seq-prepare-1.1.0.svg b/docs/technical/technical/central-ledger/assets/diagrams/sequence/seq-prepare-1.1.0.svg index 597c20f7..fb6c0955 100644 --- a/docs/technical/technical/central-ledger/assets/diagrams/sequence/seq-prepare-1.1.0.svg +++ b/docs/technical/technical/central-ledger/assets/diagrams/sequence/seq-prepare-1.1.0.svg @@ -1,455 +1,238 @@ - - - - - - - - - - - 1.1.0. DFSP1 sends a Prepare Transfer request to DFSP2 - - - - Financial Service Providers - - - - ML API Adapter Service - - - - Central Service - - - - - - DFSP1 - - - Payer - - - - - DFSP1 - - - Payer - - - - - DFSP2 - - - Payee - - - - - DFSP2 - - - Payee - - - - - 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 a Prepare Transfer request to DFSP2 - - - - - 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: - - - { - - - "transferId": <uuid>, - - - "payeeFsp": dfsp2, - - - "payerFsp": dfsp1, - - - "amount": { - - - "currency": "AED", - - - "amount": "string" - - - }, - - - "ilpPacket": "string", - - - "condition": "string", - - - "expiration": "string", - - - "extensionList": { - - - "extension": [ - - - { - - - "key": "string", - - - "value": "string" - - - } - - - ] - - - } - - - } - - - - 1 - - - POST - /transfers - - - - - 2 - - - Validate incoming token and originator matching Payer - - - Error codes: - - - 3000-3002, 3100-3107 - - - - - Message: - - - { - - - id: <transferMessage.transferId> - - - from: <transferMessage.payerFsp>, - - - to: <transferMessage.payeeFsp>, - - - type: application/json - - - content: { - - - headers: <transferHeaders>, - - - payload: <transferMessage> - - - }, - - - metadata: { - - - event: { - - - id: <uuid>, - - - type: prepare, - - - action: prepare, - - - createdAt: <timestamp>, - - - state: { - - - status: "success", - - - code: 0 - - - } - - - } - - - } - - - } - - - - - 3 - - - Route & Publish Prepare event for Payer - - - Error code: - - - 2003 - - - - - 4 - - - Ensure event is replicated as configured (ACKS=all) - - - Error code: - - - 2003 - - - - - 5 - - - Respond replication acknowledgements have been received - - - - - 6 - - - Respond HTTP - 202 (Accepted) - - - - - 7 - - - Consume message - - - - - ref - - - Prepare Handler Consume - - - - - 8 - - - Produce message - - - - - 9 - - - Consume message - - - - - ref - - - Position Handler Consume - - - - - 10 - - - Produce message - - - - - 11 - - - Consume message - - - - - ref - - - Send notification to Participant (Payee) - - - - - 12 - - - Send callback notification - + + 1.1.0. DFSP1 sends a Prepare Transfer request to DFSP2 + + + 1.1.0. DFSP1 sends a Prepare Transfer request to DFSP2 + + Financial Service Providers + + ML API Adapter Service + + Central Service + + + + + + + + + + + + + + + + + DFSP1 + Payer + + + DFSP1 + Payer + + + DFSP2 + Payee + + + DFSP2 + Payee + + + 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 a Prepare Transfer request to DFSP2 + + + 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: + { + "transferId": <uuid>, + "payeeFsp": dfsp2, + "payerFsp": dfsp1, + "amount": { + "currency": "AED", + "amount": "string" + }, + "ilpPacket": "string", + "condition": "string", + "expiration": "string", + "extensionList": { + "extension": [ + { + "key": "string", + "value": "string" + } + ] + } + } + + + + 1 + POST - /transfers + + + + + 2 + Validate incoming token and originator matching Payer + Error codes: + 3000-3002, 3100-3107 + + + Message: + { + id: <transferMessage.transferId> + from: <transferMessage.payerFsp>, + to: <transferMessage.payeeFsp>, + type: application/json + content: { + headers: <transferHeaders>, + payload: <transferMessage> + }, + metadata: { + event: { + id: <uuid>, + type: prepare, + action: prepare, + createdAt: <timestamp>, + state: { + status: "success", + code: 0 + } + } + } + } + + + 3 + Route & Publish Prepare event for Payer + Error code: + 2003 + + + + + + 4 + Ensure event is replicated as configured (ACKS=all) + Error code: + 2003 + + + 5 + Respond replication acknowledgements have been received + + + + 6 + Respond HTTP - 202 (Accepted) + + + 7 + Consume message + + + ref + Prepare Handler Consume +   + + + 8 + Produce message + + + 9 + Consume message + + + ref + Position Handler Consume +   + + + 10 + Produce message + + + 11 + Consume message + + + ref + Send notification to Participant (Payee) +   + + + 12 + Send callback notification + diff --git a/docs/technical/technical/central-ledger/assets/diagrams/sequence/seq-prepare-1.1.1.a.svg b/docs/technical/technical/central-ledger/assets/diagrams/sequence/seq-prepare-1.1.1.a.svg index 65895c97..a5e14b37 100644 --- a/docs/technical/technical/central-ledger/assets/diagrams/sequence/seq-prepare-1.1.1.a.svg +++ b/docs/technical/technical/central-ledger/assets/diagrams/sequence/seq-prepare-1.1.1.a.svg @@ -1,738 +1,405 @@ - - - - - - - - - - - 1.1.1.a. 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 - - - - - Event-Topic - - - - - Event-Topic - - - - - 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 - - - - - Validate Event - - - - - 2 - - - Validate event - Rule: type == 'prepare' && action == 'prepare' - - - Error codes: - - - 2001 - - - - - Persist Event Information - - - - - 3 - - - Publish event information - - - - - ref - - - Event Handler Consume - - - - - Validate Prepare Transfer - - - - - 4 - - - Schema validation of the incoming message - - - - - 5 - - - 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. - - - - - Validate Duplicate Check - - - - - 6 - - - Request Duplicate Check - - - - - ref - - - Request Duplicate Check - - - - - 7 - - - Return { hasDuplicateId: Boolean, hasDuplicateHash: Boolean } - - - - - alt - - - [hasDuplicateId == TRUE && hasDuplicateHash == TRUE] - - - - - break - - - - - 8 - - - stateRecord = await getTransferState(transferId) - - - - - alt - - - [endStateList.includes(stateRecord.transferStateId)] - - - - - ref - - - getTransfer callback - - - - - 9 - - - Produce message - - - - - - Ignore - resend in progress - - - - [hasDuplicateId == TRUE && hasDuplicateHash == FALSE] - - - - - Validate Prepare Transfer (failure) - Modified Request - - - - [hasDuplicateId == FALSE] - - - - - Validate Payer - - - - - 10 - - - Request to retrieve Payer Participant details (if it exists) - - - - - 11 - - - Request Participant details - - - - participant - - - participantCurrency - - - - - 12 - - - Return Participant details if it exists - - - - - 13 - - - Return Participant details if it exists - - - - - 14 - - - Validate Payer - - - Error codes: - - - 3202 - - - - - Validate Payee - - - - - 15 - - - Request to retrieve Payee Participant details (if it exists) - - - - - 16 - - - Request Participant details - - - - participant - - - participantCurrency - - - - - 17 - - - Return Participant details if it exists - - - - - 18 - - - Return Participant details if it exists - - - - - 19 - - - Validate Payee - - - Error codes: - - - 3203 - - - - - alt - - - [Validate Prepare Transfer (success)] - - - - - Persist Transfer State (with transferState='RECEIVED-PREPARE') - - - - - 20 - - - Request to persist transfer - - - Error codes: - - - 2003 - - - - - 21 - - - Persist transfer - - - - transfer - - - transferParticipant - - - transferStateChange - - - transferExtension - - - ilpPacket - - - - - 22 - - - Return success - - - - [Validate Prepare Transfer (failure)] - - - - - Persist Transfer State (with transferState='INVALID') (Introducing a new status INVALID to mark these entries) - - - - - 23 - - - Request to persist transfer - - - (when Payee/Payer/crypto-condition validation fails) - - - Error codes: - - - 2003 - - - - - 24 - - - Persist transfer - - - - transfer - - - transferParticipant - - - transferStateChange - - - transferExtension - - - transferError - - - ilpPacket - - - - - 25 - - - Return success - - - - - alt - - - [Validate Prepare Transfer (success)] - - - - - Message: - - - { - - - id: <transferMessage.transferId> - - - from: <transferMessage.payerFsp>, - - - to: <transferMessage.payeeFsp>, - - - type: application/json - - - content: { - - - headers: <transferHeaders>, - - - payload: <transferMessage> - - - }, - - - metadata: { - - - event: { - - - id: <uuid>, - - - responseTo: <previous.uuid>, - - - type: position, - - - action: prepare, - - - createdAt: <timestamp>, - - - state: { - - - status: "success", - - - code: 0 - - - } - - - } - - - } - - - } - - - - - 26 - - - Route & Publish Position event for Payer - - - Error codes: - - - 2003 - - - - [Validate Prepare Transfer (failure)] - - - - - Message: - - - { - - - id: <transferMessage.transferId> - - - from: <ledgerName>, - - - to: <transferMessage.payerFsp>, - - - 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: prepare, - - - createdAt: <timestamp>, - - - state: { - - - status: 'error', - - - code: <errorInformation.errorCode> - - - description: <errorInformation.errorDescription> - - - } - - - } - - - } - - - } - - - - - 27 - - - Publish Notification (failure) event for Payer - - - Error codes: - - - 2003 - + + 1.1.1.a. Prepare Handler Consume (single message) + + + 1.1.1.a. 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 + + + Event-Topic + + + Event-Topic + + + 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 + + + Validate Event + + + + + + 2 + Validate event - Rule: type == 'prepare' && action == 'prepare' + Error codes: + 2001 + + + Persist Event Information + + + 3 + Publish event information + + + ref + Event Handler Consume +   + + + Validate Prepare Transfer + + + + + + 4 + Schema validation of the incoming message + + + + + + 5 + 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. + + + Validate Duplicate Check + + + 6 + Request Duplicate Check + + + ref + Request Duplicate Check +   + + + 7 + Return { hasDuplicateId: Boolean, hasDuplicateHash: Boolean } + + + alt + [hasDuplicateId == TRUE && hasDuplicateHash == TRUE] + + + break + + + + + 8 + stateRecord = await getTransferState(transferId) + + + alt + [endStateList.includes(stateRecord.transferStateId)] + + + ref + getTransfer callback +   + + + 9 + Produce message + + + + Ignore - resend in progress + + [hasDuplicateId == TRUE && hasDuplicateHash == FALSE] + + + Validate Prepare Transfer (failure) - Modified Request + + [hasDuplicateId == FALSE] + + + Validate Payer + + + 10 + Request to retrieve Payer Participant details (if it exists) + + + 11 + Request Participant details + + participant + participantCurrency + + + 12 + Return Participant details if it exists + + + 13 + Return Participant details if it exists + + + + + + 14 + Validate Payer + Error codes: + 3202 + + + Validate Payee + + + 15 + Request to retrieve Payee Participant details (if it exists) + + + 16 + Request Participant details + + participant + participantCurrency + + + 17 + Return Participant details if it exists + + + 18 + Return Participant details if it exists + + + + + + 19 + Validate Payee + Error codes: + 3203 + + + alt + [Validate Prepare Transfer (success)] + + + Persist Transfer State (with transferState='RECEIVED-PREPARE') + + + 20 + Request to persist transfer + Error codes: + 2003 + + + 21 + Persist transfer + + transfer + transferParticipant + transferStateChange + transferExtension + ilpPacket + + + 22 + Return success + + [Validate Prepare Transfer (failure)] + + + Persist Transfer State (with transferState='INVALID') (Introducing a new status INVALID to mark these entries) + + + 23 + Request to persist transfer + (when Payee/Payer/crypto-condition validation fails) + Error codes: + 2003 + + + 24 + Persist transfer + + transfer + transferParticipant + transferStateChange + transferExtension + transferError + ilpPacket + + + 25 + Return success + + + alt + [Validate Prepare Transfer (success)] + + + Message: + { + id: <transferMessage.transferId> + from: <transferMessage.payerFsp>, + to: <transferMessage.payeeFsp>, + type: application/json + content: { + headers: <transferHeaders>, + payload: <transferMessage> + }, + metadata: { + event: { + id: <uuid>, + responseTo: <previous.uuid>, + type: position, + action: prepare, + createdAt: <timestamp>, + state: { + status: "success", + code: 0 + } + } + } + } + + + 26 + Route & Publish Position event for Payer + Error codes: + 2003 + + [Validate Prepare Transfer (failure)] + + + Message: + { + id: <transferMessage.transferId> + from: <ledgerName>, + to: <transferMessage.payerFsp>, + 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: prepare, + createdAt: <timestamp>, + state: { + status: 'error', + code: <errorInformation.errorCode> + description: <errorInformation.errorDescription> + } + } + } + } + + + 27 + Publish Notification (failure) event for Payer + Error codes: + 2003 + diff --git a/docs/technical/technical/central-ledger/assets/diagrams/sequence/seq-prepare-1.1.1.b.svg b/docs/technical/technical/central-ledger/assets/diagrams/sequence/seq-prepare-1.1.1.b.svg index 13489faa..548fbff8 100644 --- a/docs/technical/technical/central-ledger/assets/diagrams/sequence/seq-prepare-1.1.1.b.svg +++ b/docs/technical/technical/central-ledger/assets/diagrams/sequence/seq-prepare-1.1.1.b.svg @@ -1,497 +1,320 @@ - - - - - - - - - - - 1.1.1.b. Prepare Handler Consume (batch messages) - - - - Central Service - - - - - - - - - - - topic-transfer-prepare - - - - - topic-transfer-prepare - - - Prepare Event Handler - - - - - Prepare Event Handler - - - - - - - topic-transfer-position - - - - - topic-transfer-position - - - - - Event-Topic - - - - - Event-Topic - - - - - Notification-Topic - - - - - Notification-Topic - - - Position DAO - - - - - Position DAO - - - - - Participant DAO - - - - - Participant DAO - - - - - Central Store - - - - - Central Store - - - - - - - - Prepare Handler Consume - - - - - This flow has not been implemented - - - - - 1 - - - Consume Prepare event batch of messages for Payer - - - - - Persist Event Information - - - - - 2 - - - Publish event information - - - - - ref - - - Event Handler Consume - - - - - Fetch batch Payer information - - - - - 3 - - - Request to retrieve batch of Payer Participant details (if it exists) - - - - - 4 - - - Request Participant details - - - - participant - - - - - 5 - - - Return Participant details if it exists - - - - - 6 - - - Return Participant details if it exists - - - - - 7 - - - Validate Payer - - - - - 8 - - - store result set in var: $LIST_PARTICIPANTS_DETAILS_PAYER - - - - - Fetch batch Payee information - - - - - 9 - - - Request to retrieve batch of Payee Participant details (if it exists) - - - - - 10 - - - Request Participant details - - - - participant - - - - - 11 - - - Return Participant details if it exists - - - - - 12 - - - Return Participant details if it exists - - - - - 13 - - - Validate Payee - - - - - 14 - - - store result set in var: $LIST_PARTICIPANTS_DETAILS_PAYEE - - - - - Fetch batch of transfers - - - - - 15 - - - Request to retrieve batch of Transfers (if it exists) - - - - - 16 - - - Request batch of Transfers - - - - transfer - - - - - 17 - - - Return batch of Transfers (if it exists) - - - - - 18 - - - Return batch of Transfer (if it exists) - - - - - 19 - - - store result set in var: $LIST_TRANSFERS - - - - - loop - - - [for each message in batch] - - - - - Validate Prepare Transfer - - - - - Validate Payer - - - - - 20 - - - Validate Payer against in-memory var $LIST_PARTICIPANTS_DETAILS_PAYER - - - - - Validate Payee - - - - - 21 - - - Validate Payee against in-memory var $LIST_PARTICIPANTS_DETAILS_PAYEE - - - - - Duplicate check - - - - - 22 - - - Validate duplicate Check against in-memory var $LIST_TRANSFERS - - - - - 23 - - - Validate amount - - - - - 24 - - - Validate crypto-condition - - - - - 25 - - - Validate message signature (to be confirmed in future requirement) - - - - - Persist Transfer State (with transferState='RECEIVED' on validation pass) - - - - - 26 - - - Request to persist transfer - - - - - 27 - - - Persist transfer - - - - transferStateChange - - - - - 28 - - - Return success - - - - - Message: - - - { - - - id: <transferMessage.transferId> - - - from: <transferMessage.payerFsp>, - - - to: <transferMessage.payeeFsp>, - - - type: application/json - - - content: { - - - headers: <transferHeaders>, - - - payload: <transferMessage> - - - }, - - - metadata: { - - - event: { - - - id: <uuid>, - - - responseTo: <previous.uuid>, - - - type: position, - - - action: prepare, - - - createdAt: <timestamp>, - - - state: { - - - status: "success", - - - code: 0 - - - } - - - } - - - } - - - } - - - - - 29 - - - Route & Publish Position event for Payer - + + 1.1.1.b. Prepare Handler Consume (batch messages) + + + 1.1.1.b. Prepare Handler Consume (batch messages) + + Central Service + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + topic-transfer-prepare + + + topic-transfer-prepare + Prepare Event Handler + + + Prepare Event Handler + + + + + topic-transfer-position + + + topic-transfer-position + + + Event-Topic + + + Event-Topic + + + Notification-Topic + + + Notification-Topic + Position DAO + + + Position DAO + + + Participant DAO + + + Participant DAO + + + Central Store + + + Central Store + + + + + + + + + + + + + + + + Prepare Handler Consume + + + This flow has not been implemented + + + 1 + Consume Prepare event batch of messages for Payer + + + Persist Event Information + + + 2 + Publish event information + + + ref + Event Handler Consume +   + + + Fetch batch Payer information + + + 3 + Request to retrieve batch of Payer Participant details (if it exists) + + + 4 + Request Participant details + + participant + + + 5 + Return Participant details if it exists + + + 6 + Return Participant details if it exists + + + + + + 7 + Validate Payer + + + + + 8 + store result set in var: $LIST_PARTICIPANTS_DETAILS_PAYER + + + Fetch batch Payee information + + + 9 + Request to retrieve batch of Payee Participant details (if it exists) + + + 10 + Request Participant details + + participant + + + 11 + Return Participant details if it exists + + + 12 + Return Participant details if it exists + + + + + + 13 + Validate Payee + + + + + 14 + store result set in var: $LIST_PARTICIPANTS_DETAILS_PAYEE + + + Fetch batch of transfers + + + 15 + Request to retrieve batch of Transfers (if it exists) + + + 16 + Request batch of Transfers + + transfer + + + 17 + Return batch of Transfers (if it exists) + + + 18 + Return batch of Transfer (if it exists) + + + + + 19 + store result set in var: $LIST_TRANSFERS + + + loop + [for each message in batch] + + + Validate Prepare Transfer + + + Validate Payer + + + + + + 20 + Validate Payer against in-memory var $LIST_PARTICIPANTS_DETAILS_PAYER + + + Validate Payee + + + + + + 21 + Validate Payee against in-memory var $LIST_PARTICIPANTS_DETAILS_PAYEE + + + Duplicate check + + + + + + 22 + Validate duplicate Check against in-memory var $LIST_TRANSFERS + + + + + + 23 + Validate amount + + + + + + 24 + Validate crypto-condition + + + + + + 25 + Validate message signature (to be confirmed in future requirement) + + + Persist Transfer State (with transferState='RECEIVED' on validation pass) + + + 26 + Request to persist transfer + + + 27 + Persist transfer + + transferStateChange + + + 28 + Return success + + + Message: + { + id: <transferMessage.transferId> + from: <transferMessage.payerFsp>, + to: <transferMessage.payeeFsp>, + type: application/json + content: { + headers: <transferHeaders>, + payload: <transferMessage> + }, + metadata: { + event: { + id: <uuid>, + responseTo: <previous.uuid>, + type: position, + action: prepare, + createdAt: <timestamp>, + state: { + status: "success", + code: 0 + } + } + } + } + + + 29 + Route & Publish Position event for Payer + diff --git a/docs/technical/technical/central-ledger/assets/diagrams/sequence/seq-prepare-1.1.2.a.svg b/docs/technical/technical/central-ledger/assets/diagrams/sequence/seq-prepare-1.1.2.a.svg index 2a0857ac..f6eae8d3 100644 --- a/docs/technical/technical/central-ledger/assets/diagrams/sequence/seq-prepare-1.1.2.a.svg +++ b/docs/technical/technical/central-ledger/assets/diagrams/sequence/seq-prepare-1.1.2.a.svg @@ -1,633 +1,366 @@ - - - - - - - - - - - 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 - - - - - Central Store - - - - - Central Store - - - - - - - - Position Handler Consume - - - - - 1 - - - Consume Position event message for Payer - - - - - break - - - - - Validate Event - - - - - 2 - - - Validate event - Rule: type == 'position' && action == 'prepare' - - - - - Persist Event Information - - - - - 3 - - - Publish event information - - - - - ref - - - Event Handler Consume - - - - - alt - - - [Calulate & Validate Latest Position (success)] - - - - - Calculate position and persist change - - - - - 4 - - - Request latest position from DB for Payer - - - - - 5 - - - Retrieve latest position from DB for Payer - - - - transferPosition - - - - - 6 - - - Retrieve latest position from DB for Payer - - - - - 7 - - - Return latest position - - - - - 8 - - - Request position limits for Payer Participant - - - - - 9 - - - Request position limits for Payer Participant - - - - participant - - - participantLimit - - - - - 10 - - - Return position limits - - - - - 11 - - - Return position limits - - - - - 12 - - - Calculate latest position (lpos) for prepare - - - - - 13 - - - Validate Calculated latest position against the net-debit cap (netcap) - Rule: lpos < netcap - - - - - 14 - - - Request to persist latest position for Payer - - - - - 15 - - - Persist latest position to DB for Payer - - - - transferPosition - - - - - 16 - - - Return success - - - - - Persist Transfer State (with transferState='RESERVED' on position check pass) - - - - - 17 - - - Request to persist transfer - - - - - 18 - - - Persist transfer state - - - - transferStateChange - - - - - 19 - - - Return success - - - - - Message: - - - { - - - id: <transferMessage.transferId> - - - from: <transferMessage.payerFsp>, - - - to: <transferMessage.payeeFsp>, - - - 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 - - - } - - - } - - - } - - - } - - - - - 20 - - - Publish Notification event to Payee - - - - [Calculate & Validate Latest Position (failure)] - - - - - Calculate position and persist change - - - - - 21 - - - Request latest position from DB for Payer - - - - - 22 - - - Retrieve latest position from DB for Payer - - - - transferPosition - - - - - 23 - - - Retrieve latest position from DB for Payer - - - - - 24 - - - Return latest position - - - - - 25 - - - Request position limits for Payer Participant - - - - - 26 - - - Request position limits for Payer Participant - - - - participant - - - participantLimit - - - - - 27 - - - Return position limits - - - - - 28 - - - Return position limits - - - - - 29 - - - Calculate latest position (lpos) for prepare - - - - - 30 - - - Validate Calculated latest position against the net-debit cap (netcap) - Rule: lpos < netcap - - - - - Validation failure! - - - - - Persist Transfer State (with transferState='ABORTED' on position check pass) - - - - - 31 - - - Request to persist transfer - - - - - 32 - - - Persist transfer state - - - - transferStateChange - - - - - 33 - - - Return success - - - - - Message: - - - { - - - id: <transferMessage.transferId> - - - from: <ledgerName>, - - - to: <transferMessage.payerFsp>, - - - type: application/json - - - content: { - - - headers: <transferHeaders>, - - - payload: { - - - "errorInformation": { - - - "errorCode": 4001, - - - "errorDescription": "Payer FSP insufficient liquidity", - - - "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> - - - } - - - } - - - } - - - } - - - - - 34 - - - Publish Notification (failure) event for Payer - + + 1.1.2.a. Position Handler Consume (single message) + + + 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 + + + Central Store + + + Central Store + + + + + + + + + + + + + + + + + + + + + + + Position Handler Consume + + + 1 + Consume Position event message for Payer + + + break + + + Validate Event + + + + + + 2 + Validate event - Rule: type == 'position' && action == 'prepare' + + + Persist Event Information + + + 3 + Publish event information + + + ref + Event Handler Consume +   + + + alt + [Calulate & Validate Latest Position (success)] + + + Calculate position and persist change + + + 4 + Request latest position from DB for Payer + + + 5 + Retrieve latest position from DB for Payer + + transferPosition + + + 6 + Retrieve latest position from DB for Payer + + + 7 + Return latest position + + + 8 + Request position limits for Payer Participant + + + 9 + Request position limits for Payer Participant + + participant + participantLimit + + + 10 + Return position limits + + + 11 + Return position limits + + + + + + 12 + Calculate latest position (lpos) for prepare + + + + + + 13 + Validate Calculated latest position against the net-debit cap (netcap) - Rule: lpos < netcap + + + 14 + Request to persist latest position for Payer + + + 15 + Persist latest position to DB for Payer + + transferPosition + + + 16 + Return success + + + Persist Transfer State (with transferState='RESERVED' on position check pass) + + + 17 + Request to persist transfer + + + 18 + Persist transfer state + + transferStateChange + + + 19 + Return success + + + Message: + { + id: <transferMessage.transferId> + from: <transferMessage.payerFsp>, + to: <transferMessage.payeeFsp>, + 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 + } + } + } + } + + + 20 + Publish Notification event to Payee + + [Calculate & Validate Latest Position (failure)] + + + Calculate position and persist change + + + 21 + Request latest position from DB for Payer + + + 22 + Retrieve latest position from DB for Payer + + transferPosition + + + 23 + Retrieve latest position from DB for Payer + + + 24 + Return latest position + + + 25 + Request position limits for Payer Participant + + + 26 + Request position limits for Payer Participant + + participant + participantLimit + + + 27 + Return position limits + + + 28 + Return position limits + + + + + + 29 + Calculate latest position (lpos) for prepare + + + + + + 30 + Validate Calculated latest position against the net-debit cap (netcap) - Rule: lpos < netcap + + + Validation failure! + + + Persist Transfer State (with transferState='ABORTED' on position check pass) + + + 31 + Request to persist transfer + + + 32 + Persist transfer state + + transferStateChange + + + 33 + Return success + + + Message: + { + id: <transferMessage.transferId> + from: <ledgerName>, + to: <transferMessage.payerFsp>, + type: application/json + content: { + headers: <transferHeaders>, + payload: { + "errorInformation": { + "errorCode": 4001, + "errorDescription": "Payer FSP insufficient liquidity", + "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> + } + } + } + } + + + 34 + Publish Notification (failure) event for Payer + diff --git a/docs/technical/technical/central-ledger/assets/diagrams/sequence/seq-prepare-1.1.2.b.svg b/docs/technical/technical/central-ledger/assets/diagrams/sequence/seq-prepare-1.1.2.b.svg index 3b1dd63b..bba2e599 100644 --- a/docs/technical/technical/central-ledger/assets/diagrams/sequence/seq-prepare-1.1.2.b.svg +++ b/docs/technical/technical/central-ledger/assets/diagrams/sequence/seq-prepare-1.1.2.b.svg @@ -1,342 +1,206 @@ - - - - - - - - - - - 1.1.2.b. Position Handler Consume (batch messages) - - - - Central Service - - - - - - - - - - topic-transfer-position - - - - - topic-transfer-position - - - Position Event Handler - - - - - Position Event Handler - - - - - - - Transfer-Topic - - - - - Transfer-Topic - - - Event-Topic - - - - - Event-Topic - - - - - - - Notification-Topic - - - - - Notification-Topic - - - Position DAO - - - - - Position DAO - - - - - Transfer DAO - - - - - Transfer DAO - - - - - Central Store - - - - - Central Store - - - - - - - - Position Handler Consume - - - - - This flow has not been implemented - - - - - 1 - - - Consume Position event batch of messages for Payer - - - - - Persist Event Information - - - - - 2 - - - Publish event information - - - - - ref - - - Event Handler Consume - - - - - loop - - - [for each message in batch] - - - - - Calculate position and persist change - - - - - 3 - - - Request latest position from DB for Payer - - - - - 4 - - - Retrieve latest position from DB for Payer - - - - transferPosition - - - - - 5 - - - Return latest position - - - - - 6 - - - Calculate latest position (lpos) by incrementing transfer for prepare - - - - - 7 - - - Validate Calculated latest position against the net-debit cap (netcap) - Rule: lpos < netcap - - - - - 8 - - - Request to persist latest position for Payer - - - - - 9 - - - Persist latest position to DB for Payer - - - - transferPosition - - - - - 10 - - - Return success - - - - - Persist Transfer State (with transferState='RESERVED' on position check pass) - - - - - 11 - - - Request to persist batch transfer - - - - - 12 - - - Persist batch transfer - - - - transferStateChange - - - - - 13 - - - Return success - - - - - Message: - - - { - - - id: <transferMessage.transferId> - - - from: <transferMessage.payerFsp>, - - - to: <transferMessage.payeeFsp>, - - - 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 - - - } - - - } - - - } - - - } - - - - - 14 - - - Publish Transfer event - + + 1.1.2.b. Position Handler Consume (batch messages) + + + 1.1.2.b. Position Handler Consume (batch messages) + + Central Service + + + + + + + + + + + + + + + + + + + + + + + + + topic-transfer-position + + + topic-transfer-position + Position Event Handler + + + Position Event Handler + + + + + Transfer-Topic + + + Transfer-Topic + Event-Topic + + + Event-Topic + + + + + Notification-Topic + + + Notification-Topic + Position DAO + + + Position DAO + + + Transfer DAO + + + Transfer DAO + + + Central Store + + + Central Store + + + + + + + + + + + + + + Position Handler Consume + + + This flow has not been implemented + + + 1 + Consume Position event batch of messages for Payer + + + Persist Event Information + + + 2 + Publish event information + + + ref + Event Handler Consume +   + + + loop + [for each message in batch] + + + Calculate position and persist change + + + 3 + Request latest position from DB for Payer + + + 4 + Retrieve latest position from DB for Payer + + transferPosition + + + 5 + Return latest position + + + + + + 6 + Calculate latest position (lpos) by incrementing transfer for prepare + + + + + + 7 + Validate Calculated latest position against the net-debit cap (netcap) - Rule: lpos < netcap + + + 8 + Request to persist latest position for Payer + + + 9 + Persist latest position to DB for Payer + + transferPosition + + + 10 + Return success + + + Persist Transfer State (with transferState='RESERVED' on position check pass) + + + 11 + Request to persist batch transfer + + + 12 + Persist batch transfer + + transferStateChange + + + 13 + Return success + + + Message: + { + id: <transferMessage.transferId> + from: <transferMessage.payerFsp>, + to: <transferMessage.payeeFsp>, + 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 + } + } + } + } + + + 14 + Publish Transfer event + diff --git a/docs/technical/technical/central-ledger/assets/diagrams/sequence/seq-prepare-1.1.4.a-v1.1.svg b/docs/technical/technical/central-ledger/assets/diagrams/sequence/seq-prepare-1.1.4.a-v1.1.svg index 7461e0ab..a6f26da7 100644 --- a/docs/technical/technical/central-ledger/assets/diagrams/sequence/seq-prepare-1.1.4.a-v1.1.svg +++ b/docs/technical/technical/central-ledger/assets/diagrams/sequence/seq-prepare-1.1.4.a-v1.1.svg @@ -1,326 +1,189 @@ - - - - - - - - - - - 1.1.4.a. Send notification to Participant (Payer/Payee) (single message) v1.1 - - - - Financial Service Provider (Payer) - - - - ML API Adapter Service - - - - Central Service - - - - Financial Service Provider (Payee) - - - - - - - - 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 - - - - - - - Event-Topic - - - - - Event-Topic - - - Participant DAO - - - - - Participant DAO - - - - - Central Store - - - - - Central Store - - - - - Payee DFSP - - - Participant - - - - - Payee DFSP - - - Participant - - - - - - - - Send notification to Participants - - - - - 1 - - - Consume Notification event - - - - - Persist Event Information - - - - - 2 - - - Request to persist event information - POST - /events - - - - - 3 - - - Publish event information - - - - - ref - - - Event Handler Consume - - - - - 4 - - - Return success - - - - - 5 - - - Return success - - - - - The endpoint details are cached, when the cache - - - expires, the details are fetched again - - - - - 6 - - - Request Endpoint details for Participant - GET - /participants/{{fsp}}/endpoints - - - Error code: - - - 2003 - - - - - 7 - - - Fetch Endpoint details for Participant - - - Error code: - - - 2003 - - - - - 8 - - - Fetch Endpoint details for Participant - - - - participantEndpoint - - - - - 9 - - - Retrieved Endpoint details for Participant - - - - - 10 - - - Return Endpoint details for Participant - - - - - 11 - - - Return Endpoint details for Participant - - - Error codes: - - - 3202, 3203 - - - - - 12 - - - Notification with Prepare/fulfil result/error to - - - Payer DFSP to specified Endpoint - PUT - - - Error code: - - - 1001 - - - - - 13 - - - HTTP 200 OK - - - - - alt - - - [event.action === 'reserve'] - - - - - alt - - - [event.status === 'success'] - - - - - 14 - - - Notification to with succesful fulfil result (committed) to Payee DFSP to specified Endpoint - PATCH - - - Error code: - - - 1001 - - - - - 15 - - - HTTP 200 OK - + + 1.1.4.a. Send notification to Participant (Payer/Payee) (single message) v1.1 + + + 1.1.4.a. Send notification to Participant (Payer/Payee) (single message) v1.1 + + Financial Service Provider (Payer) + + ML API Adapter Service + + Central Service + + Financial Service Provider (Payee) + + + + + + + + + + + + + + + + + + + + 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 + + + + + Event-Topic + + + Event-Topic + Participant DAO + + + Participant DAO + + + Central Store + + + Central Store + + + Payee DFSP + Participant + + + Payee DFSP + Participant + + + + + + + + + + + + Send notification to Participants + + + 1 + Consume Notification event + + + Persist Event Information + + + 2 + Request to persist event information - POST - /events + + + 3 + Publish event information + + + ref + Event Handler Consume +   + + + 4 + Return success + + + 5 + Return success + + + The endpoint details are cached, when the cache + expires, the details are fetched again + + + 6 + Request Endpoint details for Participant - GET - /participants/{{fsp}}/endpoints + Error code: + 2003 + + + 7 + Fetch Endpoint details for Participant + Error code: + 2003 + + + 8 + Fetch Endpoint details for Participant + + participantEndpoint + + + 9 + Retrieved Endpoint details for Participant + + + 10 + Return Endpoint details for Participant + + + 11 + Return Endpoint details for Participant + Error codes: + 3202, 3203 + + + 12 + Notification with Prepare/fulfil result/error to + Payer DFSP to specified Endpoint - PUT + Error code: + 1001 + + + 13 + HTTP 200 OK + + + alt + [event.action === 'reserve'] + + + alt + [event.status === 'success'] + + + 14 + Notification to with succesful fulfil result (committed) to Payee DFSP to specified Endpoint - PATCH + Error code: + 1001 + + + 15 + HTTP 200 OK + diff --git a/docs/technical/technical/central-ledger/assets/diagrams/sequence/seq-prepare-1.1.4.a.svg b/docs/technical/technical/central-ledger/assets/diagrams/sequence/seq-prepare-1.1.4.a.svg index de654e47..7f31b736 100644 --- a/docs/technical/technical/central-ledger/assets/diagrams/sequence/seq-prepare-1.1.4.a.svg +++ b/docs/technical/technical/central-ledger/assets/diagrams/sequence/seq-prepare-1.1.4.a.svg @@ -1,317 +1,184 @@ - - - - - - - - - - - 1.1.4.a. Send notification to Participant (Payer/Payee) (single message) - - - - Financial Service Provider (Payer) - - - - ML API Adapter Service - - - - Central Service - - - - Financial Service Provider (Payee) - - - - - - - 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 - - - - - - - Event-Topic - - - - - Event-Topic - - - Participant DAO - - - - - Participant DAO - - - - - Central Store - - - - - Central Store - - - - - Payee DFSP - - - Participant - - - - - Payee DFSP - - - Participant - - - - - - - - Send notification to Participants - - - - - 1 - - - Consume Notification event - - - - - Persist Event Information - - - - - 2 - - - Request to persist event information - POST - /events - - - - - 3 - - - Publish event information - - - - - ref - - - Event Handler Consume - - - - - 4 - - - Return success - - - - - 5 - - - Return success - - - - - The endpoint details are cached, when the cache - - - expires, the details are fetched again - - - - - 6 - - - Request Endpoint details for Participant - GET - /participants/{{fsp}}/endpoints - - - Error code: - - - 2003 - - - - - 7 - - - Fetch Endpoint details for Participant - - - Error code: - - - 2003 - - - - - 8 - - - Fetch Endpoint details for Participant - - - - participantEndpoint - - - - - 9 - - - Retrieved Endpoint details for Participant - - - - - 10 - - - Return Endpoint details for Participant - - - - - 11 - - - Return Endpoint details for Participant - - - Error codes: - - - 3202, 3203 - - - - - 12 - - - Notification with Prepare/fulfil result/error to - - - Payer DFSP to specified Endpoint - PUT - - - Error code: - - - 1001 - - - - - 13 - - - HTTP 200 OK - - - - - alt - - - [Config.SEND_TRANSFER_CONFIRMATION_TO_PAYEE === true] - - - - - 14 - - - Notification to with fulfil result (committed/aborted/rejected) to Payee DFSP to specified Endpoint - PUT - - - Error code: - - - 1001 - - - - - 15 - - - HTTP 200 OK - + + 1.1.4.a. Send notification to Participant (Payer/Payee) (single message) + + + 1.1.4.a. Send notification to Participant (Payer/Payee) (single message) + + Financial Service Provider (Payer) + + ML API Adapter Service + + Central Service + + Financial Service Provider (Payee) + + + + + + + + + + + + + + + + + + + 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 + + + + + Event-Topic + + + Event-Topic + Participant DAO + + + Participant DAO + + + Central Store + + + Central Store + + + Payee DFSP + Participant + + + Payee DFSP + Participant + + + + + + + + + + + + Send notification to Participants + + + 1 + Consume Notification event + + + Persist Event Information + + + 2 + Request to persist event information - POST - /events + + + 3 + Publish event information + + + ref + Event Handler Consume +   + + + 4 + Return success + + + 5 + Return success + + + The endpoint details are cached, when the cache + expires, the details are fetched again + + + 6 + Request Endpoint details for Participant - GET - /participants/{{fsp}}/endpoints + Error code: + 2003 + + + 7 + Fetch Endpoint details for Participant + Error code: + 2003 + + + 8 + Fetch Endpoint details for Participant + + participantEndpoint + + + 9 + Retrieved Endpoint details for Participant + + + 10 + Return Endpoint details for Participant + + + 11 + Return Endpoint details for Participant + Error codes: + 3202, 3203 + + + 12 + Notification with Prepare/fulfil result/error to + Payer DFSP to specified Endpoint - PUT + Error code: + 1001 + + + 13 + HTTP 200 OK + + + alt + [Config.SEND_TRANSFER_CONFIRMATION_TO_PAYEE === true] + + + 14 + Notification to with fulfil result (committed/aborted/rejected) to Payee DFSP to specified Endpoint - PUT + Error code: + 1001 + + + 15 + HTTP 200 OK + diff --git a/docs/technical/technical/central-ledger/assets/diagrams/sequence/seq-prepare-1.1.4.b.svg b/docs/technical/technical/central-ledger/assets/diagrams/sequence/seq-prepare-1.1.4.b.svg index 6e972084..b7adfc72 100644 --- a/docs/technical/technical/central-ledger/assets/diagrams/sequence/seq-prepare-1.1.4.b.svg +++ b/docs/technical/technical/central-ledger/assets/diagrams/sequence/seq-prepare-1.1.4.b.svg @@ -1,246 +1,154 @@ - - - - - - - - - - - 1.1.4.b. Send notification to Participant (Payer/Payee) (batch messages) - - - - Financial Service Provider - - - - ML API Adapter Service - - - - Central Service - - - - - - - - DFSP(n) - - - Participant - - - - - DFSP(n) - - - Participant - - - - - ML API Notification Event Handler - - - - - ML API Notification Event Handler - - - - - - - Notification-Topic - - - - - Notification-Topic - - - Central Service API - - - - - Central Service API - - - - - - - Event-Topic - - - - - Event-Topic - - - - EVENT_DAO - - - - EVENT_DAO - - - Notification DAO - - - - - Notification DAO - - - - - Central Store - - - - - Central Store - - - - - - - - Send notification to Participant - - - - - This flow has not been implemented - - - - - 1 - - - Consume Notifications event batch of messages for Participant - - - - - loop - - - [for each message in batch] - - - - - Persist Event Information - - - - - 2 - - - Request to persist event information - POST - /events - - - - - 3 - - - Publish event information - - - - - ref - - - Event Handler Consume - - - - - 4 - - - Return success - - - - - 5 - - - Return success - - - - - 6 - - - Request Notifications details for Participant - GET - /notifications/DFPS(n) - - - - - 7 - - - Fetch Notifications details for Participant - - - - - 8 - - - Fetch Notifications details for Participant - - - - transferPosition - - - - - 9 - - - Retrieved Notification details for Participant - - - - - 10 - - - Return Notifications details for Participant - - - - - 11 - - - Return Notifications details for Participant - - - - - 12 - - - Callback with Prepare result to Participant to specified URL - PUT - /<dfsp-host>>/transfers - + + 1.1.4.b. Send notification to Participant (Payer/Payee) (batch messages) + + + 1.1.4.b. Send notification to Participant (Payer/Payee) (batch messages) + + Financial Service Provider + + ML API Adapter Service + + Central Service + + + + + + + + + + + + + + + + + + + DFSP(n) + Participant + + + DFSP(n) + Participant + + + ML API Notification Event Handler + + + ML API Notification Event Handler + + + + + Notification-Topic + + + Notification-Topic + Central Service API + + + Central Service API + + + + + Event-Topic + + + Event-Topic + + EVENT_DAO + + EVENT_DAO + Notification DAO + + + Notification DAO + + + Central Store + + + Central Store + + + + + + + + + + + + Send notification to Participant + + + This flow has not been implemented + + + 1 + Consume Notifications event batch of messages for Participant + + + loop + [for each message in batch] + + + Persist Event Information + + + 2 + Request to persist event information - POST - /events + + + 3 + Publish event information + + + ref + Event Handler Consume +   + + + 4 + Return success + + + 5 + Return success + + + 6 + Request Notifications details for Participant - GET - /notifications/DFPS(n) + + + 7 + Fetch Notifications details for Participant + + + 8 + Fetch Notifications details for Participant + + transferPosition + + + 9 + Retrieved Notification details for Participant + + + 10 + Return Notifications details for Participant + + + 11 + Return Notifications details for Participant + + + 12 + Callback with Prepare result to Participant to specified URL - PUT - /<dfsp-host>>/transfers + diff --git a/docs/technical/technical/central-ledger/assets/diagrams/sequence/seq-reject-2.2.0-v1.1.svg b/docs/technical/technical/central-ledger/assets/diagrams/sequence/seq-reject-2.2.0-v1.1.svg index d00bef23..5cbfe019 100644 --- a/docs/technical/technical/central-ledger/assets/diagrams/sequence/seq-reject-2.2.0-v1.1.svg +++ b/docs/technical/technical/central-ledger/assets/diagrams/sequence/seq-reject-2.2.0-v1.1.svg @@ -1,341 +1,178 @@ - - - - - - - - - - - 2.2.0. DFSP2 sends a Fulfil Reject Transfer request - - - - Financial Service Providers - - - - ML API Adapter Service - - - - Central Service - - - - - - DFSP1 - - - Payer - - - - - DFSP1 - - - Payer - - - - - DFSP2 - - - Payee - - - - - DFSP2 - - - Payee - - - - - ML API Adapter - - - - - ML API Adapter - - - - - ML API Notification Event Handler - - - - - ML API Notification Event Handler - - - - - Central Service API - - - - - Central Service API - - - - - - - Fulfil-Topic - - - - - Fulfil-Topic - - - Fulfil Event Handler - - - - - Fulfil Event Handler - - - - - - - - DFSP2 sends an error callback to reject a transfer with an errorCode and description - - - - - 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: - - - { - - - "errorInformation": { - - - "errorCode": <errorCode>, - - - "errorDescription": <errorDescription>, - - - "extensionList": { - - - "extension": [ - - - { - - - "key": <string>, - - - "value": <string> - - - } - - - ] - - - } - - - } - - - } - - - - 1 - - - PUT - /transfers/<ID>/error - - - - - 2 - - - Validate incoming token and originator matching Payee - - - - - 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: reject, - - - createdAt: <timestamp>, - - - state: { - - - status: "success", - - - code: 0 - - - } - - - } - - - } - - - } - - - - - 3 - - - Route & Publish Fulfil event for Payee - - - - - 4 - - - Ensure event is replicated as configured (ACKS=all) - - - - - 5 - - - Respond replication acknowledgements have been received - - - - - 6 - - - Respond HTTP - 200 (OK) - - - - - 7 - - - Consume message - - - - - 8 - - - Log error message - - - - - (corresponding to a Fulfil message with transferState='ABORTED') - - - action REJECT is not allowed into fulfil handler - + + 2.2.0. DFSP2 sends a Fulfil Reject Transfer request + + + 2.2.0. DFSP2 sends a Fulfil Reject Transfer request + + Financial Service Providers + + ML API Adapter Service + + Central Service + + + + + + + + + + + + + DFSP1 + Payer + + + DFSP1 + Payer + + + DFSP2 + Payee + + + DFSP2 + Payee + + + ML API Adapter + + + ML API Adapter + + + ML API Notification Event Handler + + + ML API Notification Event Handler + + + Central Service API + + + Central Service API + + + + + Fulfil-Topic + + + Fulfil-Topic + Fulfil Event Handler + + + Fulfil Event Handler + + + + + + + + + DFSP2 sends an error callback to reject a transfer with an errorCode and description + + + 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: + { + "errorInformation": { + "errorCode": <errorCode>, + "errorDescription": <errorDescription>, + "extensionList": { + "extension": [ + { + "key": <string>, + "value": <string> + } + ] + } + } + } + + + + 1 + PUT - /transfers/<ID>/error + + + + + 2 + Validate incoming token and originator matching Payee + + + 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: reject, + createdAt: <timestamp>, + state: { + status: "success", + code: 0 + } + } + } + } + + + 3 + Route & Publish Fulfil event for Payee + + + + + + 4 + Ensure event is replicated as configured (ACKS=all) + + + 5 + Respond replication acknowledgements have been received + + + + 6 + Respond HTTP - 200 (OK) + + + 7 + Consume message + + + + + 8 + Log error message + + + (corresponding to a Fulfil message with transferState='ABORTED') + action REJECT is not allowed into fulfil handler + diff --git a/docs/technical/technical/central-ledger/assets/diagrams/sequence/seq-reject-2.2.0.a-v1.1.svg b/docs/technical/technical/central-ledger/assets/diagrams/sequence/seq-reject-2.2.0.a-v1.1.svg index dd1fc306..fb382991 100644 --- a/docs/technical/technical/central-ledger/assets/diagrams/sequence/seq-reject-2.2.0.a-v1.1.svg +++ b/docs/technical/technical/central-ledger/assets/diagrams/sequence/seq-reject-2.2.0.a-v1.1.svg @@ -1,495 +1,265 @@ - - - - - - - - - - - 2.2.0.a. DFSP2 sends a PUT call on /error end-point for a Transfer request - - - - Financial Service Providers - - - - ML API Adapter Service - - - - Central Service - - - - - - - DFSP1 - - - Payer - - - - - DFSP1 - - - Payer - - - - - DFSP2 - - - Payee - - - - - DFSP2 - - - Payee - - - - - ML API Adapter - - - - - ML API Adapter - - - - - ML API Notification Event Handler - - - - - ML API Notification Event Handler - - - - - Central Service API - - - - - Central Service API - - - - - - - Fulfil-Topic - - - - - Fulfil-Topic - - - Fulfil Event Handler - - - - - Fulfil Event Handler - - - - - - - topic-transfer-position - - - - - topic-transfer-position - - - Position Event Handler - - - - - Position Event Handler - - - - - - - Notification-Topic - - - - - Notification-Topic - - - - - - DFSP2 sends a Fulfil Success Transfer request - - - - - 1 - - - During processing of an incoming - - - POST /transfers 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 - /transfers/<ID>/error - - - - - 3 - - - Validate incoming originator matching Payee - - - Error codes: - - - 3000-3002, 3100-3107 - - - - - 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: abort, - - - createdAt: <timestamp>, - - - state: { - - - status: "success", - - - code: 0 - - - } - - - } - - - } - - - } - - - - - 4 - - - Route & Publish Abort event for Payee - - - Error code: - - - 2003 - - - - - 5 - - - Ensure event is replicated as configured (ACKS=all) - - - Error code: - - - 2003 - - - - - 6 - - - Respond replication acknowledgements have been received - - - - - 7 - - - Respond HTTP - 200 (OK) - - - - - 8 - - - Consume message - - - - - ref - - - Fulfil Handler Consume (Abort) - - - - - 9 - - - Produce message - - - - - 10 - - - Consume message - - - - - ref - - - Position Handler Consume (Abort) - - - - - 11 - - - Produce message - - - - - 12 - - - Consume message - - - - - opt - - - [action == 'abort'] - - - - - ref - - - Send notification to Participant (Payer) - - - - - 13 - - - Send callback notification - - - - - 14 - - - Consume message - - - - - opt - - - [action == 'abort'] - - - - - ref - - - Send notification to Participant (Payee) - - - - - 15 - - - Send callback notification - + + 2.2.0.a. DFSP2 sends a PUT call on /error end-point for a Transfer request + + + 2.2.0.a. DFSP2 sends a PUT call on /error end-point for a Transfer request + + Financial Service Providers + + ML API Adapter Service + + Central Service + + + + + + + + + + + + + + + + + + + DFSP1 + Payer + + + DFSP1 + Payer + + + DFSP2 + Payee + + + DFSP2 + Payee + + + ML API Adapter + + + ML API Adapter + + + ML API Notification Event Handler + + + ML API Notification Event Handler + + + Central Service API + + + Central Service API + + + + + Fulfil-Topic + + + Fulfil-Topic + Fulfil Event Handler + + + Fulfil Event Handler + + + + + topic-transfer-position + + + topic-transfer-position + Position Event Handler + + + Position Event Handler + + + + + Notification-Topic + + + Notification-Topic + + + + + + + + DFSP2 sends a Fulfil Success Transfer request + + + + + + 1 + During processing of an incoming + POST /transfers 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 - /transfers/<ID>/error + + + + + 3 + Validate incoming originator matching Payee + Error codes: + 3000-3002, 3100-3107 + + + 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: abort, + createdAt: <timestamp>, + state: { + status: "success", + code: 0 + } + } + } + } + + + 4 + Route & Publish Abort event for Payee + Error code: + 2003 + + + + + + 5 + Ensure event is replicated as configured (ACKS=all) + Error code: + 2003 + + + 6 + Respond replication acknowledgements have been received + + + + 7 + Respond HTTP - 200 (OK) + + + 8 + Consume message + + + ref + Fulfil Handler Consume (Abort) +   + + + 9 + Produce message + + + 10 + Consume message + + + ref + Position Handler Consume (Abort) +   + + + 11 + Produce message + + + 12 + Consume message + + + opt + [action == 'abort'] + + + ref + Send notification to Participant (Payer) +   + + + 13 + Send callback notification + + + 14 + Consume message + + + opt + [action == 'abort'] + + + ref + Send notification to Participant (Payee) +   + + + 15 + Send callback notification + diff --git a/docs/technical/technical/central-ledger/assets/diagrams/sequence/seq-reject-2.2.0.a.svg b/docs/technical/technical/central-ledger/assets/diagrams/sequence/seq-reject-2.2.0.a.svg index 7ac9606f..07a2af94 100644 --- a/docs/technical/technical/central-ledger/assets/diagrams/sequence/seq-reject-2.2.0.a.svg +++ b/docs/technical/technical/central-ledger/assets/diagrams/sequence/seq-reject-2.2.0.a.svg @@ -1,495 +1,265 @@ - - - - - - - - - - - 2.2.0.a. DFSP2 sends a PUT call on /error end-point for a Transfer request - - - - Financial Service Providers - - - - ML API Adapter Service - - - - Central Service - - - - - - - DFSP1 - - - Payer - - - - - DFSP1 - - - Payer - - - - - DFSP2 - - - Payee - - - - - DFSP2 - - - Payee - - - - - ML API Adapter - - - - - ML API Adapter - - - - - ML API Notification Event Handler - - - - - ML API Notification Event Handler - - - - - Central Service API - - - - - Central Service API - - - - - - - Fulfil-Topic - - - - - Fulfil-Topic - - - Fulfil Event Handler - - - - - Fulfil Event Handler - - - - - - - topic-transfer-position - - - - - topic-transfer-position - - - Position Event Handler - - - - - Position Event Handler - - - - - - - Notification-Topic - - - - - Notification-Topic - - - - - - DFSP2 sends a Fulfil Success Transfer request - - - - - 1 - - - During processing of an incoming - - - POST /transfers 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 - /transfers/<ID>/error - - - - - 3 - - - Validate incoming originator matching Payee - - - Error codes: - - - 3000-3002, 3100-3107 - - - - - 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: abort, - - - createdAt: <timestamp>, - - - state: { - - - status: "success", - - - code: 0 - - - } - - - } - - - } - - - } - - - - - 4 - - - Route & Publish Abort/Reject event for Payee - - - Error code: - - - 2003 - - - - - 5 - - - Ensure event is replicated as configured (ACKS=all) - - - Error code: - - - 2003 - - - - - 6 - - - Respond replication acknowledgements have been received - - - - - 7 - - - Respond HTTP - 200 (OK) - - - - - 8 - - - Consume message - - - - - ref - - - Fulfil Handler Consume (Reject/Abort) - - - - - 9 - - - Produce message - - - - - 10 - - - Consume message - - - - - ref - - - Position Handler Consume (Abort) - - - - - 11 - - - Produce message - - - - - 12 - - - Consume message - - - - - opt - - - [action == 'abort'] - - - - - ref - - - Send notification to Participant (Payer) - - - - - 13 - - - Send callback notification - - - - - 14 - - - Consume message - - - - - opt - - - [action == 'abort'] - - - - - ref - - - Send notification to Participant (Payee) - - - - - 15 - - - Send callback notification - + + 2.2.0.a. DFSP2 sends a PUT call on /error end-point for a Transfer request + + + 2.2.0.a. DFSP2 sends a PUT call on /error end-point for a Transfer request + + Financial Service Providers + + ML API Adapter Service + + Central Service + + + + + + + + + + + + + + + + + + + DFSP1 + Payer + + + DFSP1 + Payer + + + DFSP2 + Payee + + + DFSP2 + Payee + + + ML API Adapter + + + ML API Adapter + + + ML API Notification Event Handler + + + ML API Notification Event Handler + + + Central Service API + + + Central Service API + + + + + Fulfil-Topic + + + Fulfil-Topic + Fulfil Event Handler + + + Fulfil Event Handler + + + + + topic-transfer-position + + + topic-transfer-position + Position Event Handler + + + Position Event Handler + + + + + Notification-Topic + + + Notification-Topic + + + + + + + + DFSP2 sends a Fulfil Success Transfer request + + + + + + 1 + During processing of an incoming + POST /transfers 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 - /transfers/<ID>/error + + + + + 3 + Validate incoming originator matching Payee + Error codes: + 3000-3002, 3100-3107 + + + 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: abort, + createdAt: <timestamp>, + state: { + status: "success", + code: 0 + } + } + } + } + + + 4 + Route & Publish Abort/Reject event for Payee + Error code: + 2003 + + + + + + 5 + Ensure event is replicated as configured (ACKS=all) + Error code: + 2003 + + + 6 + Respond replication acknowledgements have been received + + + + 7 + Respond HTTP - 200 (OK) + + + 8 + Consume message + + + ref + Fulfil Handler Consume (Reject/Abort) +   + + + 9 + Produce message + + + 10 + Consume message + + + ref + Position Handler Consume (Abort) +   + + + 11 + Produce message + + + 12 + Consume message + + + opt + [action == 'abort'] + + + ref + Send notification to Participant (Payer) +   + + + 13 + Send callback notification + + + 14 + Consume message + + + opt + [action == 'abort'] + + + ref + Send notification to Participant (Payee) +   + + + 15 + Send callback notification + diff --git a/docs/technical/technical/central-ledger/assets/diagrams/sequence/seq-reject-2.2.0.svg b/docs/technical/technical/central-ledger/assets/diagrams/sequence/seq-reject-2.2.0.svg index a2cbf762..10a77439 100644 --- a/docs/technical/technical/central-ledger/assets/diagrams/sequence/seq-reject-2.2.0.svg +++ b/docs/technical/technical/central-ledger/assets/diagrams/sequence/seq-reject-2.2.0.svg @@ -1,489 +1,262 @@ - - - - - - - - - - - 2.2.0. DFSP2 sends a Fulfil Reject Transfer request - - - - Financial Service Providers - - - - ML API Adapter Service - - - - Central Service - - - - - - - DFSP1 - - - Payer - - - - - DFSP1 - - - Payer - - - - - DFSP2 - - - Payee - - - - - DFSP2 - - - Payee - - - - - ML API Adapter - - - - - ML API Adapter - - - - - ML API Notification Event Handler - - - - - ML API Notification Event Handler - - - - - Central Service API - - - - - Central Service API - - - - - - - Fulfil-Topic - - - - - Fulfil-Topic - - - Fulfil Event Handler - - - - - Fulfil Event Handler - - - - - - - topic-transfer-position - - - - - topic-transfer-position - - - - - Event-Topic - - - - - Event-Topic - - - Position Event Handler - - - - - Position Event Handler - - - - - - - Notification-Topic - - - - - Notification-Topic - - - - - - DFSP2 sends a Fulfil Reject Transfer request - - - - - 1 - - - Retrieve fulfilment string generated during - - - the quoting process or regenerate it using - - - Local secret - - - and - - - ILP Packet - - - as inputs - - - - - Note - - - : In the payload for PUT /transfers/<ID> - - - only the - - - transferState - - - field is - - - required - - - - - 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: - - - { - - - "fulfilment": <IlpFulfilment>, - - - "completedTimestamp": <DateTime>, - - - "transferState": "ABORTED", - - - "extensionList": { - - - "extension": [ - - - { - - - "key": <string>, - - - "value": <string> - - - } - - - ] - - - } - - - } - - - - - Note - - - : Payee rejection reason should be captured - - - in the extensionList within the payload. - - - - 2 - - - PUT - /transfers/<ID> - - - - - 3 - - - Validate incoming token and originator matching Payee - - - - - 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: reject, - - - createdAt: <timestamp>, - - - state: { - - - status: "success", - - - code: 0 - - - } - - - } - - - } - - - } - - - - - 4 - - - Route & Publish Fulfil event for Payee - - - - - 5 - - - Ensure event is replicated as configured (ACKS=all) - - - - - 6 - - - Respond replication acknowledgements have been received - - - - - 7 - - - Respond HTTP - 200 (OK) - - - - - 8 - - - Consume message - - - - - ref - - - Fulfil Handler Consume (Reject/Abort) - - - - - 9 - - - Produce message - - - - - 10 - - - Consume message - - - - - ref - - - Position Handler Consume (Reject) - - - - - 11 - - - Produce message - - - - - 12 - - - Consume message - - - - - opt - - - [action == 'reject'] - - - - - ref - - - Send notification to Participant (Payer) - - - - - 13 - - - Send callback notification - + + 2.2.0. DFSP2 sends a Fulfil Reject Transfer request + + + 2.2.0. DFSP2 sends a Fulfil Reject Transfer request + + Financial Service Providers + + ML API Adapter Service + + Central Service + + + + + + + + + + + + + + + + + + + DFSP1 + Payer + + + DFSP1 + Payer + + + DFSP2 + Payee + + + DFSP2 + Payee + + + ML API Adapter + + + ML API Adapter + + + ML API Notification Event Handler + + + ML API Notification Event Handler + + + Central Service API + + + Central Service API + + + + + Fulfil-Topic + + + Fulfil-Topic + Fulfil Event Handler + + + Fulfil Event Handler + + + + + topic-transfer-position + + + topic-transfer-position + + + Event-Topic + + + Event-Topic + Position Event Handler + + + Position Event Handler + + + + + Notification-Topic + + + Notification-Topic + + + + + + + + DFSP2 sends a Fulfil Reject Transfer request + + + + + + 1 + Retrieve fulfilment string generated during + the quoting process or regenerate it using + Local secret + and + ILP Packet + as inputs + + + Note + : In the payload for PUT /transfers/<ID> + only the + transferState + field is + required + + + 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: + { + "fulfilment": <IlpFulfilment>, + "completedTimestamp": <DateTime>, + "transferState": "ABORTED", + "extensionList": { + "extension": [ + { + "key": <string>, + "value": <string> + } + ] + } + } + + + Note + : Payee rejection reason should be captured + in the extensionList within the payload. + + + + 2 + PUT - /transfers/<ID> + + + + + 3 + Validate incoming token and originator matching Payee + + + 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: reject, + createdAt: <timestamp>, + state: { + status: "success", + code: 0 + } + } + } + } + + + 4 + Route & Publish Fulfil event for Payee + + + + + + 5 + Ensure event is replicated as configured (ACKS=all) + + + 6 + Respond replication acknowledgements have been received + + + + 7 + Respond HTTP - 200 (OK) + + + 8 + Consume message + + + ref + Fulfil Handler Consume (Reject/Abort) +   + + + 9 + Produce message + + + 10 + Consume message + + + ref + Position Handler Consume (Reject) +   + + + 11 + Produce message + + + 12 + Consume message + + + opt + [action == 'reject'] + + + ref + Send notification to Participant (Payer) +   + + + 13 + Send callback notification + diff --git a/docs/technical/technical/central-ledger/assets/diagrams/sequence/seq-reject-2.2.1-v1.1.svg b/docs/technical/technical/central-ledger/assets/diagrams/sequence/seq-reject-2.2.1-v1.1.svg index 7b61b671..517355e0 100644 --- a/docs/technical/technical/central-ledger/assets/diagrams/sequence/seq-reject-2.2.1-v1.1.svg +++ b/docs/technical/technical/central-ledger/assets/diagrams/sequence/seq-reject-2.2.1-v1.1.svg @@ -1,697 +1,386 @@ - - - - - - - - - - - 2.2.1. Fulfil Handler Consume (Abort/Reject) - - - - Central Service - - - - - - - - - - - - - - - - - - - - - - - - - - - - Fulfil-Topic - - - - - Fulfil-Topic - - - Fulfil Event Handler - - - - - Fulfil Event Handler - - - - - - - topic-transfer-position - - - - - topic-transfer-position - - - - - Event-Topic - - - - - Event-Topic - - - - - Notification-Topic - - - - - Notification-Topic - - - Transfer DAO - - - - - Transfer DAO - - - - - Central Store - - - - - Central Store - - - - - - - - Fulfil Handler Consume (Failure) - - - - - alt - - - [Consume Single Message] - - - - - 1 - - - Consume Fulfil event message for Payer - - - - - break - - - - - Validate Event - - - - - 2 - - - Validate event - Rule: type == 'fulfil' && ( action IN ['reject','abort'] ) - - - Error codes: - - - 2001 - - - - - Persist Event Information - - - - - 3 - - - Publish event information - - - - - ref - - - Event Handler Consume - - - - - Validate FSPIOP-Signature - - - - - ref - - - Validate message.content.headers. - - - FSPIOP-Signature - - - Error codes: - - - 2001 - - - - - Validate Transfer Fulfil Duplicate Check - - - - - 4 - - - Generate transferFulfilmentId uuid - - - - - 5 - - - Request to retrieve transfer fulfilment hashes by transferId - - - Error code: - - - 2003 - - - - - 6 - - - Request Transfer fulfilment duplicate message hashes - - - - SELET transferId, hash - - - FROM - - - transferFulfilmentDuplicateCheck - - - WHERE transferId = request.params.id - - - - - 7 - - - Return existing hashes - - - - - 8 - - - Return (list of) transfer fulfil messages hash(es) - - - - - 9 - - - Loop the list of returned hashes and compare each entry with the calculated message hash - - - - - alt - - - [Hash matched] - - - - - 10 - - - Request to retrieve Transfer Fulfilment and Transfer state - - - Error code: - - - 2003 - - - - - 11 - - - Request to retrieve Transfer Fulfilment and Transfer state - - - - transferFulfilment - - - transferStateChange - - - - - 12 - - - Return Transfer Fulfilment and Transfer state - - - - - 13 - - - Return Transfer Fulfilment and Transfer state - - - - - alt - - - [transferFulfilment.isValid == 0] - - - - - break - - - - - 14 - - - Error handling: - - - 3105 - - - - [transferState IN ['COMMITTED', 'ABORTED']] - - - - - break - - - - - ref - - - Send notification to Participant (Payee) - - - - [transferState NOT 'RESERVED'] - - - - - break - - - - - 15 - - - Error code: - - - 2001 - - - - - - break - - - - - 16 - - - Allow previous request to complete - - - - [Hash not matched] - - - - - 17 - - - Request to persist transfer hash - - - Error codes: - - - 2003 - - - - - 18 - - - Persist hash - - - - transferFulfilmentDuplicateCheck - - - - - 19 - - - Return success - - - - - alt - - - [action=='reject' call made on PUT /transfers/{ID}] - - - - - 20 - - - Log error message - - - - - action REJECT is not allowed into fulfil handler - - - - [action=='abort' Error callback] - - - - - alt - - - [Validation successful] - - - - - Persist Transfer State (with transferState='RECEIVED_ERROR') - - - - - 21 - - - Request to persist transfer state and Error - - - Error code: - - - 2003 - - - - - 22 - - - Persist transfer state and error information - - - - transferStateChange - - - transferError - - - transferExtension - - - - - 23 - - - Return success - - - - - Message: - - - { - - - id: <ID>, - - - from: <transferHeaders.FSPIOP-Source>, - - - to: <transferHeaders.FSPIOP-Destination>, - - - type: application/json, - - - content: { - - - headers: <transferHeaders>, - - - payload: <transferMessage> - - - }, - - - metadata: { - - - event: { - - - id: <uuid>, - - - responseTo: <previous.uuid>, - - - type: position, - - - action: abort, - - - createdAt: <timestamp>, - - - state: { - - - status: "success", - - - code: 0 - - - } - - - } - - - } - - - } - - - - - 24 - - - Route & Publish Position event for Payer - - - - [Validate Transfer Error Message not successful] - - - - - break - - - - - Message: - - - { - - - id: <ID>, - - - from: <transferHeaders.FSPIOP-Source>, - - - to: <transferHeaders.FSPIOP-Destination>, - - - type: application/json, - - - content: { - - - headers: <transferHeaders>, - - - payload: <transferMessage> - - - }, - - - metadata: { - - - event: { - - - id: <uuid>, - - - responseTo: <previous.uuid>, - - - type: position, - - - action: abort, - - - createdAt: <timestamp>, - - - state: { - - - status: "error", - - - code: 1 - - - } - - - } - - - } - - - } - - - - - 25 - - - Route & Publish Notification event for Payee - - - - [Consume Batch Messages] - - - - - To be delivered by future story - + + 2.2.1. Fulfil Handler Consume (Abort/Reject) + + + 2.2.1. Fulfil Handler Consume (Abort/Reject) + + Central Service + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Fulfil-Topic + + + Fulfil-Topic + Fulfil Event Handler + + + Fulfil Event Handler + + + + + topic-transfer-position + + + topic-transfer-position + + + Event-Topic + + + Event-Topic + + + Notification-Topic + + + Notification-Topic + Transfer DAO + + + Transfer DAO + + + Central Store + + + Central Store + + + + + + + + + + + + + + + + + Fulfil Handler Consume (Failure) + + + alt + [Consume Single Message] + + + 1 + Consume Fulfil event message for Payer + + + break + + + Validate Event + + + + + + 2 + Validate event - Rule: type == 'fulfil' && ( action IN ['reject','abort'] ) + Error codes: + 2001 + + + Persist Event Information + + + 3 + Publish event information + + + ref + Event Handler Consume + + + Validate FSPIOP-Signature + + + ref + Validate message.content.headers. + FSPIOP-Signature + Error codes: + 2001 + + + Validate Transfer Fulfil Duplicate Check + + + + + 4 + Generate transferFulfilmentId uuid + + + 5 + Request to retrieve transfer fulfilment hashes by transferId + Error code: + 2003 + + + 6 + Request Transfer fulfilment duplicate message hashes + + SELET transferId, hash + FROM + transferFulfilmentDuplicateCheck + WHERE transferId = request.params.id + + + 7 + Return existing hashes + + + 8 + Return (list of) transfer fulfil messages hash(es) + + + + + 9 + Loop the list of returned hashes and compare each entry with the calculated message hash + + + alt + [Hash matched] + + + 10 + Request to retrieve Transfer Fulfilment and Transfer state + Error code: + 2003 + + + 11 + Request to retrieve Transfer Fulfilment and Transfer state + + transferFulfilment + transferStateChange + + + 12 + Return Transfer Fulfilment and Transfer state + + + 13 + Return Transfer Fulfilment and Transfer state + + + alt + [transferFulfilment.isValid == 0] + + + break + + + + + + 14 + Error handling: + 3105 + + [transferState IN ['COMMITTED', 'ABORTED']] + + + break + + + ref + Send notification to Participant (Payee) +   + + [transferState NOT 'RESERVED'] + + + break + + + + + + 15 + Error code: + 2001 + + + + break + + + + + + 16 + Allow previous request to complete + + [Hash not matched] + + + 17 + Request to persist transfer hash + Error codes: + 2003 + + + 18 + Persist hash + + transferFulfilmentDuplicateCheck + + + 19 + Return success + + + alt + [action=='reject' call made on PUT /transfers/{ID}] + + + + + 20 + Log error message + + + action REJECT is not allowed into fulfil handler + + [action=='abort' Error callback] + + + alt + [Validation successful] + + + Persist Transfer State (with transferState='RECEIVED_ERROR') + + + 21 + Request to persist transfer state and Error + Error code: + 2003 + + + 22 + Persist transfer state and error information + + transferStateChange + transferError + transferExtension + + + 23 + Return success + + + Message: + { + id: <ID>, + from: <transferHeaders.FSPIOP-Source>, + to: <transferHeaders.FSPIOP-Destination>, + type: application/json, + content: { + headers: <transferHeaders>, + payload: <transferMessage> + }, + metadata: { + event: { + id: <uuid>, + responseTo: <previous.uuid>, + type: position, + action: abort, + createdAt: <timestamp>, + state: { + status: "success", + code: 0 + } + } + } + } + + + 24 + Route & Publish Position event for Payer + + [Validate Transfer Error Message not successful] + + + break + + + Message: + { + id: <ID>, + from: <transferHeaders.FSPIOP-Source>, + to: <transferHeaders.FSPIOP-Destination>, + type: application/json, + content: { + headers: <transferHeaders>, + payload: <transferMessage> + }, + metadata: { + event: { + id: <uuid>, + responseTo: <previous.uuid>, + type: position, + action: abort, + createdAt: <timestamp>, + state: { + status: "error", + code: 1 + } + } + } + } + + + 25 + Route & Publish Notification event for Payee + + [Consume Batch Messages] + + + To be delivered by future story + diff --git a/docs/technical/technical/central-ledger/assets/diagrams/sequence/seq-reject-2.2.1.svg b/docs/technical/technical/central-ledger/assets/diagrams/sequence/seq-reject-2.2.1.svg index ad8d40a0..97665dec 100644 --- a/docs/technical/technical/central-ledger/assets/diagrams/sequence/seq-reject-2.2.1.svg +++ b/docs/technical/technical/central-ledger/assets/diagrams/sequence/seq-reject-2.2.1.svg @@ -1,1073 +1,572 @@ - - - - - - - - - - - 2.2.1. Fulfil Handler Consume (Reject/Abort) - - - - Central Service - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Fulfil-Topic - - - - - Fulfil-Topic - - - Fulfil Event Handler - - - - - Fulfil Event Handler - - - - - - - topic-transfer-position - - - - - topic-transfer-position - - - - - Event-Topic - - - - - Event-Topic - - - - - Notification-Topic - - - - - Notification-Topic - - - Transfer DAO - - - - - Transfer DAO - - - - - Central Store - - - - - Central Store - - - - - - - - - Fulfil Handler Consume (Failure) - - - - - alt - - - [Consume Single Message] - - - - - 1 - - - Consume Fulfil event message for Payer - - - - - break - - - - - Validate Event - - - - - 2 - - - Validate event - Rule: type == 'fulfil' && ( action IN ['reject','abort'] ) - - - Error codes: - - - 2001 - - - - - Persist Event Information - - - - - 3 - - - Publish event information - - - - - ref - - - Event Handler Consume - - - - - Validate FSPIOP-Signature - - - - - ref - - - Validate message.content.headers. - - - FSPIOP-Signature - - - Error codes: - - - 2001 - - - - - Validate Transfer Fulfil Duplicate Check - - - - - 4 - - - Generate transferFulfilmentId uuid - - - - - 5 - - - Request to retrieve transfer fulfilment hashes by transferId - - - Error code: - - - 2003 - - - - - 6 - - - Request Transfer fulfilment duplicate message hashes - - - - SELET transferId, hash - - - FROM - - - transferFulfilmentDuplicateCheck - - - WHERE transferId = request.params.id - - - - - 7 - - - Return existing hashes - - - - - 8 - - - Return (list of) transfer fulfil messages hash(es) - - - - - 9 - - - Loop the list of returned hashes and compare each entry with the calculated message hash - - - - - alt - - - [Hash matched] - - - - - 10 - - - Request to retrieve Transfer Fulfilment and Transfer state - - - Error code: - - - 2003 - - - - - 11 - - - Request to retrieve Transfer Fulfilment and Transfer state - - - - transferFulfilment - - - transferStateChange - - - - - 12 - - - Return Transfer Fulfilment and Transfer state - - - - - 13 - - - Return Transfer Fulfilment and Transfer state - - - - - alt - - - [transferFulfilment.isValid == 0] - - - - - break - - - - - 14 - - - Error handling: - - - 3105 - - - - [transferState IN ['COMMITTED', 'ABORTED']] - - - - - break - - - - - ref - - - Send notification to Participant (Payee) - - - - [transferState NOT 'RESERVED'] - - - - - break - - - - - 15 - - - Error code: - - - 2001 - - - - - - break - - - - - 16 - - - Allow previous request to complete - - - - [Hash not matched] - - - - - 17 - - - Request to persist transfer hash - - - Error codes: - - - 2003 - - - - - 18 - - - Persist hash - - - - transferFulfilmentDuplicateCheck - - - - - 19 - - - Return success - - - - - alt - - - [action=='reject' call made on PUT /transfers/{ID}] - - - - - 20 - - - Request information for the validate checks - - - Error code: - - - 2003 - - - - - 21 - - - Fetch from database - - - - transfer - - - - - 22 - - - - - 23 - - - Return transfer - - - - - alt - - - [Fulfilment present in the PUT /transfers/{ID} message] - - - - - 24 - - - Validate that Transfer.ilpCondition = SHA-256 (content.payload.fulfilment) - - - Error code: - - - 2001 - - - - - Persist fulfilment - - - - - 25 - - - Persist fulfilment with the result of the above check (transferFulfilment.isValid) - - - Error code: - - - 2003 - - - - - 26 - - - Persist to database - - - - transferFulfilment - - - transferExtension - - - - - 27 - - - Return success - - - - [Fulfilment NOT present in the PUT /transfers/{ID} message] - - - - - 28 - - - Validate that transfer fulfilment message to Abort is valid - - - Error code: - - - 2001 - - - - - Persist extensions - - - - - 29 - - - Persist extensionList elements - - - Error code: - - - 2003 - - - - - 30 - - - Persist to database - - - - transferExtension - - - - - 31 - - - Return success - - - - - alt - - - [Transfer.ilpCondition validate successful OR generic validation successful] - - - - - Persist Transfer State (with transferState='RECEIVED_REJECT') - - - - - 32 - - - Request to persist transfer state - - - Error code: - - - 2003 - - - - - 33 - - - Persist transfer state - - - - transferStateChange - - - - - 34 - - - Return success - - - - - Message: - - - { - - - id: <ID>, - - - from: <transferHeaders.FSPIOP-Source>, - - - to: <transferHeaders.FSPIOP-Destination>, - - - type: application/json, - - - content: { - - - headers: <transferHeaders>, - - - payload: <transferMessage> - - - }, - - - metadata: { - - - event: { - - - id: <uuid>, - - - responseTo: <previous.uuid>, - - - type: position, - - - action: reject, - - - createdAt: <timestamp>, - - - state: { - - - status: "success", - - - code: 0 - - - } - - - } - - - } - - - } - - - - - 35 - - - Route & Publish Position event for Payer - - - - [Validate Fulfil Transfer not successful or Generic validation failed] - - - - - break - - - - - Message: - - - { - - - id: <ID>, - - - from: <transferHeaders.FSPIOP-Source>, - - - to: <transferHeaders.FSPIOP-Destination>, - - - type: application/json, - - - content: { - - - headers: <transferHeaders>, - - - payload: <transferMessage> - - - }, - - - metadata: { - - - event: { - - - id: <uuid>, - - - responseTo: <previous.uuid>, - - - type: position, - - - action: reject, - - - createdAt: <timestamp>, - - - state: { - - - status: "error", - - - code: 1 - - - } - - - } - - - } - - - } - - - - - 36 - - - Route & Publish Notification event for Payee - - - - [action=='abort' Error callback] - - - - - alt - - - [Validation successful] - - - - - Persist Transfer State (with transferState='RECEIVED_ERROR') - - - - - 37 - - - Request to persist transfer state and Error - - - Error code: - - - 2003 - - - - - 38 - - - Persist transfer state and error information - - - - transferStateChange - - - transferError - - - transferExtension - - - - - 39 - - - Return success - - - - - Message: - - - { - - - id: <ID>, - - - from: <transferHeaders.FSPIOP-Source>, - - - to: <transferHeaders.FSPIOP-Destination>, - - - type: application/json, - - - content: { - - - headers: <transferHeaders>, - - - payload: <transferMessage> - - - }, - - - metadata: { - - - event: { - - - id: <uuid>, - - - responseTo: <previous.uuid>, - - - type: position, - - - action: abort, - - - createdAt: <timestamp>, - - - state: { - - - status: "success", - - - code: 0 - - - } - - - } - - - } - - - } - - - - - 40 - - - Route & Publish Position event for Payer - - - - [Validate Transfer Error Message not successful] - - - - - break - - - - - Message: - - - { - - - id: <ID>, - - - from: <transferHeaders.FSPIOP-Source>, - - - to: <transferHeaders.FSPIOP-Destination>, - - - type: application/json, - - - content: { - - - headers: <transferHeaders>, - - - payload: <transferMessage> - - - }, - - - metadata: { - - - event: { - - - id: <uuid>, - - - responseTo: <previous.uuid>, - - - type: position, - - - action: abort, - - - createdAt: <timestamp>, - - - state: { - - - status: "error", - - - code: 1 - - - } - - - } - - - } - - - } - - - - - 41 - - - Route & Publish Notification event for Payee - - - - [Consume Batch Messages] - - - - - To be delivered by future story - + + 2.2.1. Fulfil Handler Consume (Reject/Abort) + + + 2.2.1. Fulfil Handler Consume (Reject/Abort) + + Central Service + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Fulfil-Topic + + + Fulfil-Topic + Fulfil Event Handler + + + Fulfil Event Handler + + + + + topic-transfer-position + + + topic-transfer-position + + + Event-Topic + + + Event-Topic + + + Notification-Topic + + + Notification-Topic + Transfer DAO + + + Transfer DAO + + + Central Store + + + Central Store + + + + + + + + + + + + + + + + + + + + + + + + + + + Fulfil Handler Consume (Failure) + + + alt + [Consume Single Message] + + + 1 + Consume Fulfil event message for Payer + + + break + + + Validate Event + + + + + + 2 + Validate event - Rule: type == 'fulfil' && ( action IN ['reject','abort'] ) + Error codes: + 2001 + + + Persist Event Information + + + 3 + Publish event information + + + ref + Event Handler Consume + + + Validate FSPIOP-Signature + + + ref + Validate message.content.headers. + FSPIOP-Signature + Error codes: + 2001 + + + Validate Transfer Fulfil Duplicate Check + + + + + 4 + Generate transferFulfilmentId uuid + + + 5 + Request to retrieve transfer fulfilment hashes by transferId + Error code: + 2003 + + + 6 + Request Transfer fulfilment duplicate message hashes + + SELET transferId, hash + FROM + transferFulfilmentDuplicateCheck + WHERE transferId = request.params.id + + + 7 + Return existing hashes + + + 8 + Return (list of) transfer fulfil messages hash(es) + + + + + 9 + Loop the list of returned hashes and compare each entry with the calculated message hash + + + alt + [Hash matched] + + + 10 + Request to retrieve Transfer Fulfilment and Transfer state + Error code: + 2003 + + + 11 + Request to retrieve Transfer Fulfilment and Transfer state + + transferFulfilment + transferStateChange + + + 12 + Return Transfer Fulfilment and Transfer state + + + 13 + Return Transfer Fulfilment and Transfer state + + + alt + [transferFulfilment.isValid == 0] + + + break + + + + + + 14 + Error handling: + 3105 + + [transferState IN ['COMMITTED', 'ABORTED']] + + + break + + + ref + Send notification to Participant (Payee) +   + + [transferState NOT 'RESERVED'] + + + break + + + + + + 15 + Error code: + 2001 + + + + break + + + + + + 16 + Allow previous request to complete + + [Hash not matched] + + + 17 + Request to persist transfer hash + Error codes: + 2003 + + + 18 + Persist hash + + transferFulfilmentDuplicateCheck + + + 19 + Return success + + + alt + [action=='reject' call made on PUT /transfers/{ID}] + + + 20 + Request information for the validate checks + Error code: + 2003 + + + 21 + Fetch from database + + transfer + + + 22 +   + + + 23 + Return transfer + + + alt + [Fulfilment present in the PUT /transfers/{ID} message] + + + + + 24 + Validate that Transfer.ilpCondition = SHA-256 (content.payload.fulfilment) + Error code: + 2001 + + + Persist fulfilment + + + 25 + Persist fulfilment with the result of the above check (transferFulfilment.isValid) + Error code: + 2003 + + + 26 + Persist to database + + transferFulfilment + transferExtension + + + 27 + Return success + + [Fulfilment NOT present in the PUT /transfers/{ID} message] + + + + + 28 + Validate that transfer fulfilment message to Abort is valid + Error code: + 2001 + + + Persist extensions + + + 29 + Persist extensionList elements + Error code: + 2003 + + + 30 + Persist to database + + transferExtension + + + 31 + Return success + + + alt + [Transfer.ilpCondition validate successful OR generic validation successful] + + + Persist Transfer State (with transferState='RECEIVED_REJECT') + + + 32 + Request to persist transfer state + Error code: + 2003 + + + 33 + Persist transfer state + + transferStateChange + + + 34 + Return success + + + Message: + { + id: <ID>, + from: <transferHeaders.FSPIOP-Source>, + to: <transferHeaders.FSPIOP-Destination>, + type: application/json, + content: { + headers: <transferHeaders>, + payload: <transferMessage> + }, + metadata: { + event: { + id: <uuid>, + responseTo: <previous.uuid>, + type: position, + action: reject, + createdAt: <timestamp>, + state: { + status: "success", + code: 0 + } + } + } + } + + + 35 + Route & Publish Position event for Payer + + [Validate Fulfil Transfer not successful or Generic validation failed] + + + break + + + Message: + { + id: <ID>, + from: <transferHeaders.FSPIOP-Source>, + to: <transferHeaders.FSPIOP-Destination>, + type: application/json, + content: { + headers: <transferHeaders>, + payload: <transferMessage> + }, + metadata: { + event: { + id: <uuid>, + responseTo: <previous.uuid>, + type: position, + action: reject, + createdAt: <timestamp>, + state: { + status: "error", + code: 1 + } + } + } + } + + + 36 + Route & Publish Notification event for Payee + + [action=='abort' Error callback] + + + alt + [Validation successful] + + + Persist Transfer State (with transferState='RECEIVED_ERROR') + + + 37 + Request to persist transfer state and Error + Error code: + 2003 + + + 38 + Persist transfer state and error information + + transferStateChange + transferError + transferExtension + + + 39 + Return success + + + Message: + { + id: <ID>, + from: <transferHeaders.FSPIOP-Source>, + to: <transferHeaders.FSPIOP-Destination>, + type: application/json, + content: { + headers: <transferHeaders>, + payload: <transferMessage> + }, + metadata: { + event: { + id: <uuid>, + responseTo: <previous.uuid>, + type: position, + action: abort, + createdAt: <timestamp>, + state: { + status: "success", + code: 0 + } + } + } + } + + + 40 + Route & Publish Position event for Payer + + [Validate Transfer Error Message not successful] + + + break + + + Message: + { + id: <ID>, + from: <transferHeaders.FSPIOP-Source>, + to: <transferHeaders.FSPIOP-Destination>, + type: application/json, + content: { + headers: <transferHeaders>, + payload: <transferMessage> + }, + metadata: { + event: { + id: <uuid>, + responseTo: <previous.uuid>, + type: position, + action: abort, + createdAt: <timestamp>, + state: { + status: "error", + code: 1 + } + } + } + } + + + 41 + Route & Publish Notification event for Payee + + [Consume Batch Messages] + + + To be delivered by future story + diff --git a/docs/technical/technical/central-ledger/assets/diagrams/sequence/seq-request-dup-check-9.1.1.svg b/docs/technical/technical/central-ledger/assets/diagrams/sequence/seq-request-dup-check-9.1.1.svg index 988ffd39..9799da8c 100644 --- a/docs/technical/technical/central-ledger/assets/diagrams/sequence/seq-request-dup-check-9.1.1.svg +++ b/docs/technical/technical/central-ledger/assets/diagrams/sequence/seq-request-dup-check-9.1.1.svg @@ -1,292 +1,167 @@ - - - - - - - - - - - 9.1.1. Request Duplicate Check (incl. Transfers, Quotes, Bulk Transfers, Bulk Quotes) - - - - Central Service - - - - - - - - - - - - topic-source - - - - - topic-source - - - Processing - - - Handler - - - - - Processing - - - Handler - - - - - - - topic-event - - - - - topic-event - - - - - topic-notifcation - - - - - topic-notifcation - - - Request DAO - - - - - Request DAO - - - - - Central Store - - - - - Central Store - - - - - - - - Request Duplicate Check - - - - - 1 - - - Consume message - - - - - 2 - - - Generate hash: - - - generatedHash - - - - - UUID Check (compareById) - - - - - 3 - - - Query hash using getDuplicateDataFuncOverride(id) - - - Error code: - - - 2003 - - - - - request - - - keyword to be replaced by - - - transfer - - - , - - - transferFulfilment - - - , - - - bulkTransfer - - - or other depending - - - on the override - - - - - 4 - - - getDuplicateDataFuncOverride - - - - request - - - DuplicateCheck - - - - - 5 - - - Return - - - duplicateHashRecord - - - - - 6 - - - Return - - - hasDuplicateId - - - - - alt - - - [hasDuplicateId == TRUE] - - - - - Hash Check (compareByHash) - - - - - generatedHash == duplicateHashRecord.hash - - - - - 7 - - - Return - - - hasDuplicateHash - - - - [hasDuplicateId == FALSE] - - - - - Store Message Hash - - - - - 8 - - - Persist hash using saveHashFuncOverride(id, generatedHash) - - - Error code: - - - 2003 - - - - - 9 - - - Persist - - - generatedHash - - - - request - - - DuplicateCheck - - - - - 10 - - - Return success - - - - - return { - - - hasDuplicateId: Boolean, - - - hasDuplicateHash: Boolean - - - } - + + 9.1.1. Request Duplicate Check (incl. Transfers, Quotes, Bulk Transfers, Bulk Quotes) + + + 9.1.1. Request Duplicate Check (incl. Transfers, Quotes, Bulk Transfers, Bulk Quotes) + + Central Service + + + + + + + + + + + + + + + + + + + + topic-source + + + topic-source + Processing + Handler + + + Processing + Handler + + + + + topic-event + + + topic-event + + + topic-notifcation + + + topic-notifcation + Request DAO + + + Request DAO + + + Central Store + + + Central Store + + + + + + + + + + + Request Duplicate Check + + + 1 + Consume message + + + + + 2 + Generate hash: + generatedHash + + + UUID Check (compareById) + + + 3 + Query hash using getDuplicateDataFuncOverride(id) + Error code: + 2003 + + + request + keyword to be replaced by + transfer + , + transferFulfilment + , + bulkTransfer + or other depending + on the override + + + 4 + getDuplicateDataFuncOverride + + request + DuplicateCheck + + + 5 + Return + duplicateHashRecord + + + 6 + Return + hasDuplicateId + + + alt + [hasDuplicateId == TRUE] + + + Hash Check (compareByHash) + + + generatedHash == duplicateHashRecord.hash + + + + + 7 + Return + hasDuplicateHash + + [hasDuplicateId == FALSE] + + + Store Message Hash + + + 8 + Persist hash using saveHashFuncOverride(id, generatedHash) + Error code: + 2003 + + + 9 + Persist + generatedHash + + request + DuplicateCheck + + + 10 + Return success + + + return { + hasDuplicateId: Boolean, + hasDuplicateHash: Boolean + } + diff --git a/docs/technical/technical/central-ledger/assets/diagrams/sequence/seq-setmodel-2.1.2.svg b/docs/technical/technical/central-ledger/assets/diagrams/sequence/seq-setmodel-2.1.2.svg index 50323963..a3e2de88 100644 --- a/docs/technical/technical/central-ledger/assets/diagrams/sequence/seq-setmodel-2.1.2.svg +++ b/docs/technical/technical/central-ledger/assets/diagrams/sequence/seq-setmodel-2.1.2.svg @@ -1,292 +1,175 @@ - - - - - - - - - - - 2.1.2. Settlement Model Handler Consume - - - - Central Service - - - - - - - - - - - - - - topic- - - - settlement-model - - - - - topic- - - - settlement-model - - - Settlement Model - - - Handler - - - - - Settlement Model - - - Handler - - - - - - - topic-event - - - - - topic-event - - - Settlement DAO - - - - - Settlement DAO - - - - - Central Store - - - - - Central Store - - - - - - - - Settlement Model Handler Consume - - - - - alt - - - [Consume Single Message] - - - - - 1 - - - Consume settlement model - - - event message - - - - - break - - - - - Validate Event - - - - - 2 - - - Validate event - Rule: type == 'setmodel' && action == 'commit' - - - Error codes: - - - 2001 - - - - - Persist Event Information - - - - - 3 - - - Publish event information - - - - - ref - - - Event Handler Consume - - - - - 4 - - - Assign transferParicipant state(s) - - - Error code: - - - 2003 - - - - - DB TRANSACTION - - - - - 5 - - - Fetch transfer participant entries - - - - transferParticipant - - - - - 6 - - - Return - - - transferParticipantRecords - - - - - loop - - - [for each transferParticipant] - - - - - Settlement models caching to be considered - - - - - 7 - - - Get settlement model by currency and ledger entry - - - - settlementModel - - - - - 8 - - - Return - - - settlementModel - - - - - opt - - - [settlementModel.delay == 'IMMEDIATE' && settlementModel.granularity == 'GROSS'] - - - - - 9 - - - Set states: CLOSED->PENDING_SETTLEMENT->SETTLED - - - - transferParticipantStateChange - - - transferParticipant - - - - - - 10 - - - Set state: OPEN - - - - transferParticipantStateChange - - - transferParticipant - - - - - 11 - - - Return success - - - - [Consume Batch Messages] - - - - - To be delivered by future story - + + 2.1.2. Settlement Model Handler Consume + + + 2.1.2. Settlement Model Handler Consume + + Central Service + + + + + + + + + + + + + + + + + + + + + + + topic- + settlement-model + + + topic- + settlement-model + Settlement Model + Handler + + + Settlement Model + Handler + + + + + topic-event + + + topic-event + Settlement DAO + + + Settlement DAO + + + Central Store + + + Central Store + + + + + + + + + + + + Settlement Model Handler Consume + + + alt + [Consume Single Message] + + + 1 + Consume settlement model + event message + + + break + + + Validate Event + + + + + + 2 + Validate event - Rule: type == 'setmodel' && action == 'commit' + Error codes: + 2001 + + + Persist Event Information + + + 3 + Publish event information + + + ref + Event Handler Consume +   + + + 4 + Assign transferParicipant state(s) + Error code: + 2003 + + + DB TRANSACTION + + + 5 + Fetch transfer participant entries + + transferParticipant + + + 6 + Return + transferParticipantRecords + + + loop + [for each transferParticipant] + + + Settlement models caching to be considered + + + 7 + Get settlement model by currency and ledger entry + + settlementModel + + + 8 + Return + settlementModel + + + opt + [settlementModel.delay == 'IMMEDIATE' && settlementModel.granularity == 'GROSS'] + + + 9 + Set states: CLOSED->PENDING_SETTLEMENT->SETTLED + + transferParticipantStateChange + transferParticipant + + + + 10 + Set state: OPEN + + transferParticipantStateChange + transferParticipant + + + 11 + Return success + + [Consume Batch Messages] + + + To be delivered by future story + diff --git a/docs/technical/technical/central-ledger/assets/diagrams/sequence/seq-timeout-2.3.0.svg b/docs/technical/technical/central-ledger/assets/diagrams/sequence/seq-timeout-2.3.0.svg index b35a9668..e4440f48 100644 --- a/docs/technical/technical/central-ledger/assets/diagrams/sequence/seq-timeout-2.3.0.svg +++ b/docs/technical/technical/central-ledger/assets/diagrams/sequence/seq-timeout-2.3.0.svg @@ -1,339 +1,195 @@ - - - - - - - - - - - 2.3.0. Transfer Timeout - - - - Financial Service Providers - - - - ML API Adapter Service - - - - Central Service - - - - - - - - - DFSP1 - - - Payer - - - - - DFSP1 - - - Payer - - - - - DFSP2 - - - Payee - - - - - DFSP2 - - - Payee - - - - - ML API - - - Adapter - - - - - ML API - - - Adapter - - - - - Notification - - - Handler - - - - - Notification - - - Handler - - - - - Timeout Prepare - - - Handler - - - - - Timeout Prepare - - - Handler - - - - - - - topic- - - - transfer-timeout - - - - - topic- - - - transfer-timeout - - - Timeout - - - Handler - - - - - Timeout - - - Handler - - - - - - - topic- - - - transfer-position - - - - - topic- - - - transfer-position - - - Position - - - Handler - - - - - Position - - - Handler - - - - - - - topic-notification - - - - - topic-notification - - - - - - Transfer Expiry - - - - - ref - - - Timeout Processing Handler Consume - - - - - 1 - - - Produce message - - - - - 2 - - - Consume message - - - - - ref - - - Timeout Processing Handler Consume - - - - - alt - - - [transferStateId == 'RECEIVED_PREPARE'] - - - - - 3 - - - Produce message - - - - [transferStateId == 'RESERVED'] - - - - - 4 - - - Produce message - - - - - 5 - - - Consume message - - - - - ref - - - Position Hander Consume (Timeout) - - - - - 6 - - - Produce message - - - - - opt - - - [action IN ['timeout-received', 'timeout-reserved']] - - - - - 7 - - - Consume message - - - - - ref - - - Send notification to Participant (Payer) - - - - - 8 - - - Send callback notification - - - - - 9 - - - Consume message - - - - - opt - - - [action == 'timeout-reserved'] - - - - - ref - - - Send notification to Participant (Payee) - - - - - 10 - - - Send callback notification - + + 2.3.0. Transfer Timeout + + + 2.3.0. Transfer Timeout + + Financial Service Providers + + ML API Adapter Service + + Central Service + + + + + + + + + + + + + + + + + + + DFSP1 + Payer + + + DFSP1 + Payer + + + DFSP2 + Payee + + + DFSP2 + Payee + + + ML API + Adapter + + + ML API + Adapter + + + Notification + Handler + + + Notification + Handler + + + Timeout Prepare + Handler + + + Timeout Prepare + Handler + + + + + topic- + transfer-timeout + + + topic- + transfer-timeout + Timeout + Handler + + + Timeout + Handler + + + + + topic- + transfer-position + + + topic- + transfer-position + Position + Handler + + + Position + Handler + + + + + topic-notification + + + topic-notification + + + + + + + Transfer Expiry + + + ref + Timeout Processing Handler Consume +   + + + 1 + Produce message + + + 2 + Consume message + + + ref + Timeout Processing Handler Consume +   + + + alt + [transferStateId == 'RECEIVED_PREPARE'] + + + 3 + Produce message + + [transferStateId == 'RESERVED'] + + + 4 + Produce message + + + 5 + Consume message + + + ref + Position Hander Consume (Timeout) +   + + + 6 + Produce message + + + opt + [action IN ['timeout-received', 'timeout-reserved']] + + + 7 + Consume message + + + ref + Send notification to Participant (Payer) +   + + + 8 + Send callback notification + + + 9 + Consume message + + + opt + [action == 'timeout-reserved'] + + + ref + Send notification to Participant (Payee) +   + + + 10 + Send callback notification + diff --git a/docs/technical/technical/central-ledger/assets/diagrams/sequence/seq-timeout-2.3.1.svg b/docs/technical/technical/central-ledger/assets/diagrams/sequence/seq-timeout-2.3.1.svg index 08083d7e..7a554e86 100644 --- a/docs/technical/technical/central-ledger/assets/diagrams/sequence/seq-timeout-2.3.1.svg +++ b/docs/technical/technical/central-ledger/assets/diagrams/sequence/seq-timeout-2.3.1.svg @@ -1,325 +1,169 @@ - - - - - - - - - - - 2.3.1. Timeout Prepare Handler - - - - Central Service - - - - - - - Timeout Prepare - - - Handler - - - - - Timeout Prepare - - - Handler - - - - - - - topic- - - - transfer-timeout - - - - - topic- - - - transfer-timeout - - - - - topic-event - - - - - topic-event - - - Timeout DAO - - - - - Timeout DAO - - - - - Central Store - - - - - Central Store - - - - - - - - Timeout Prepare Handler - - - - - Persist Event Information - - - - - 1 - - - Publish event information - - - - - ref - - - Event Handler Consume - - - - - Cleanup - - - - - 2 - - - Cleanup Fulfilled Transfers - - - Error code: - - - 2003 - - - - - 3 - - - Delete fuflfilled transfers records - - - - DELETE et - - - FROM - - - expiringTransfer - - - et - - - JOIN - - - transferFulfilment - - - tf - - - ON tf.transferId = et.transferId - - - - - 4 - - - Return success - - - - - List Expired - - - - - 5 - - - Retrieve Expired Transfers - - - Error code: - - - 2003 - - - - - 6 - - - Select using index - - - - SELECT * - - - FROM - - - expiringTransfer - - - WHERE expirationDate < currentTimestamp - - - - - 7 - - - Return expired transfers - - - - - 8 - - - Return - - - expiredTransfersList - - - - - loop - - - [for each transfer in the list] - - - - - Message: - - - { - - - id: <uuid> - - - from: <switch>, - - - to: <payerFsp>, - - - type: application/json - - - content: { - - - headers: null, - - - payload: <transfer> - - - }, - - - metadata: { - - - event: { - - - id: <uuid>, - - - responseTo: null, - - - type: transfer, - - - action: timeout, - - - createdAt: <timestamp>, - - - state: { - - - status: "success", - - - code: 0 - - - } - - - } - - - } - - - } - - - - - 9 - - - Publish Timeout event - - - Error code: - - - 2003 - + + 2.3.1. Timeout Prepare Handler + + + 2.3.1. Timeout Prepare Handler + + Central Service + + + + + + + + + + + + + + + + + Timeout Prepare + Handler + + + Timeout Prepare + Handler + + + + + topic- + transfer-timeout + + + topic- + transfer-timeout + + + topic-event + + + topic-event + Timeout DAO + + + Timeout DAO + + + Central Store + + + Central Store + + + + + + + + + + + Timeout Prepare Handler + + + Persist Event Information + + + 1 + Publish event information + + + ref + Event Handler Consume +   + + + Cleanup + + + 2 + Cleanup Fulfilled Transfers + Error code: + 2003 + + + 3 + Delete fuflfilled transfers records + + DELETE et + FROM + expiringTransfer + et + JOIN + transferFulfilment + tf + ON tf.transferId = et.transferId + + + 4 + Return success + + + List Expired + + + 5 + Retrieve Expired Transfers + Error code: + 2003 + + + 6 + Select using index + + SELECT * + FROM + expiringTransfer + WHERE expirationDate < currentTimestamp + + + 7 + Return expired transfers + + + 8 + Return + expiredTransfersList + + + loop + [for each transfer in the list] + + + Message: + { + id: <uuid> + from: <switch>, + to: <payerFsp>, + type: application/json + content: { + headers: null, + payload: <transfer> + }, + metadata: { + event: { + id: <uuid>, + responseTo: null, + type: transfer, + action: timeout, + createdAt: <timestamp>, + state: { + status: "success", + code: 0 + } + } + } + } + + + 9 + Publish Timeout event + Error code: + 2003 + diff --git a/docs/technical/technical/central-ledger/assets/diagrams/sequence/seq-timeout-2.3.2.svg b/docs/technical/technical/central-ledger/assets/diagrams/sequence/seq-timeout-2.3.2.svg index 0103f7ba..8c79f9df 100644 --- a/docs/technical/technical/central-ledger/assets/diagrams/sequence/seq-timeout-2.3.2.svg +++ b/docs/technical/technical/central-ledger/assets/diagrams/sequence/seq-timeout-2.3.2.svg @@ -1,614 +1,302 @@ - - - - - - - - - - - 2.3.2. Timeout Handler - - - - Central Service - - - - - - - - - - - topic- - - - transfer-timeout - - - - - topic- - - - transfer-timeout - - - Transfer Timeout Handler - - - - - Transfer Timeout Handler - - - - - - - topic- - - - transfer-position - - - - - topic- - - - transfer-position - - - - - topic- - - - notification - - - - - topic- - - - notification - - - - - topic-event - - - - - topic-event - - - Timeout DAO - - - - - Timeout DAO - - - - - Central Store - - - - - Central Store - - - - - - - - Timeout Handler Consume - - - - - 1 - - - Consume message - - - - - Persist Event Information - - - - - 2 - - - Publish event information - - - - - ref - - - Event Handler Consume - - - - - Get transfer info - - - - - 3 - - - Acquire transfer information - - - Error code: - - - 2003 - - - - - 4 - - - Get transfer data and state - - - - transfer - - - transferParticipant - - - participantCurrency - - - participant - - - transferStateChange - - - - - 5 - - - Return - - - transferInfo - - - - - 6 - - - Return - - - transferInfo - - - - - alt - - - [transferInfo.transferStateId == 'RECEIVED_PREPARE'] - - - - - 7 - - - Set EXPIRED_PREPARED state - - - Error code: - - - 2003 - - - - - 8 - - - Insert state change - - - - transferStateChange - - - - - 9 - - - Return success - - - - - Message: - - - { - - - id: <transferId>, - - - from: <payerParticipantId>, - - - to: <payeeParticipantId>, - - - type: application/json, - - - content: { - - - headers: - - - { - - - 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: { - - - "errorInformation": { - - - "errorCode": 3303, - - - "errorDescription": "Transfer expired", - - - "extensionList": <transferMessage.extensionList> - - - } - - - } - - - }, - - - metadata: { - - - event: { - - - id: <uuid>, - - - type: notification, - - - action: timeout-received, - - - createdAt: <timestamp>, - - - state: { - - - status: 'error', - - - code: <errorInformation.errorCode> - - - description: <errorInformation.errorDescription> - - - } - - - } - - - } - - - } - - - - - 10 - - - Publish Notification event - - - - [transferInfo.transferStateId == 'RESERVED'] - - - - - 11 - - - Set RESERVED_TIMEOUT state - - - Error code: - - - 2003 - - - - - 12 - - - Insert state change - - - - transferStateChange - - - - - 13 - - - Return success - - - - - Message: - - - { - - - id: <transferId>, - - - from: <payerParticipantId>, - - - to: <payeeParticipantId>, - - - type: application/json, - - - content: { - - - headers: - - - { - - - 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: { - - - "errorInformation": { - - - "errorCode": 3303, - - - "errorDescription": "Transfer expired", - - - "extensionList": <transferMessage.extensionList> - - - } - - - } - - - }, - - - metadata: { - - - event: { - - - id: <uuid>, - - - type: position, - - - action: timeout-reserved, - - - createdAt: <timestamp>, - - - state: { - - - status: 'error', - - - code: <errorInformation.errorCode> - - - description: <errorInformation.errorDescription> - - - } - - - } - - - } - - - } - - - - - 14 - - - Route & Publish Position event - - - Error code: - - - 2003 - - - - - - Any other state is ignored - - - - - Cleanup - - - - - 15 - - - Cleanup handled expiring transfer - - - Error code: - - - 2003 - - - - - 16 - - - Delete record - - - - expiringTransfer - - - - - 17 - - - Return success - + + 2.3.2. Timeout Handler + + + 2.3.2. Timeout Handler + + Central Service + + + + + + + + + + + + + + + + + + + + + + + + + + + topic- + transfer-timeout + + + topic- + transfer-timeout + Transfer Timeout Handler + + + Transfer Timeout Handler + + + + + topic- + transfer-position + + + topic- + transfer-position + + + topic- + notification + + + topic- + notification + + + topic-event + + + topic-event + Timeout DAO + + + Timeout DAO + + + Central Store + + + Central Store + + + + + + + + + + + + + + + + + Timeout Handler Consume + + + 1 + Consume message + + + Persist Event Information + + + 2 + Publish event information + + + ref + Event Handler Consume +   + + + Get transfer info + + + 3 + Acquire transfer information + Error code: + 2003 + + + 4 + Get transfer data and state + + transfer + transferParticipant + participantCurrency + participant + transferStateChange + + + 5 + Return + transferInfo + + + 6 + Return + transferInfo + + + alt + [transferInfo.transferStateId == 'RECEIVED_PREPARE'] + + + 7 + Set EXPIRED_PREPARED state + Error code: + 2003 + + + 8 + Insert state change + + transferStateChange + + + 9 + Return success + + + Message: + { + id: <transferId>, + from: <payerParticipantId>, + to: <payeeParticipantId>, + type: application/json, + content: { +          + headers: + { + 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: { + "errorInformation": { + "errorCode": 3303, + "errorDescription": "Transfer expired", + "extensionList": <transferMessage.extensionList> + } + } + }, + metadata: { + event: { + id: <uuid>, + type: notification, + action: timeout-received, + createdAt: <timestamp>, + state: { + status: 'error', + code: <errorInformation.errorCode> + description: <errorInformation.errorDescription> + } + } + } + } + + + 10 + Publish Notification event + + [transferInfo.transferStateId == 'RESERVED'] + + + 11 + Set RESERVED_TIMEOUT state + Error code: + 2003 + + + 12 + Insert state change + + transferStateChange + + + 13 + Return success + + + Message: + { + id: <transferId>, + from: <payerParticipantId>, + to: <payeeParticipantId>, + type: application/json, + content: { +          + headers: + { + 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: { + "errorInformation": { + "errorCode": 3303, + "errorDescription": "Transfer expired", + "extensionList": <transferMessage.extensionList> + } + } + }, + metadata: { + event: { + id: <uuid>, + type: position, + action: timeout-reserved, + createdAt: <timestamp>, + state: { + status: 'error', + code: <errorInformation.errorCode> + description: <errorInformation.errorDescription> + } + } + } + } + + + 14 + Route & Publish Position event + Error code: + 2003 + + + + Any other state is ignored + + + Cleanup + + + 15 + Cleanup handled expiring transfer + Error code: + 2003 + + + 16 + Delete record + + expiringTransfer + + + 17 + Return success + diff --git a/docs/technical/technical/event-stream-processor/assets/diagrams/sequence/process-flow.svg b/docs/technical/technical/event-stream-processor/assets/diagrams/sequence/process-flow.svg index 130b3dce..a85cf2bb 100644 --- a/docs/technical/technical/event-stream-processor/assets/diagrams/sequence/process-flow.svg +++ b/docs/technical/technical/event-stream-processor/assets/diagrams/sequence/process-flow.svg @@ -1,579 +1,577 @@ - - - - - - - - - - + + Event Streaming Processor flow + - Event Streaming Processor flow - - Central Services - - Event Stream Processor - - Cache - - Elasticsearch - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Notification topic - - - Notification topic - Topic Observable - - - Topic Observable - - - Tracing Observable - - - Tracing Observable - - - Caching Observable - - - Caching Observable - - - Check For Last Span Observable - - - Check For Last Span Observable - - - Create Trace Observable - - - Create Trace Observable - - - Send Trace Handler - - - Send Trace Handler - - - Send Span Handler - - - Send Span Handler - - - Cache Handler - - - Cache Handler - - - Cache Storage - - - Cache Storage - - - APM - - - APM - - - Elasticsearch API - - - Elasticsearch API - - - - - - - - - - - - New Event Message Received - - - 1 - Consume Event Message - - - Message: - { - "from": "payeefsp", - "to": "payerfsp", - "id": "659ee338-c8f8-4c06-8aff-944e6c5cd694", - "content": { - "headers": { - "content-type": "applicationvnd.interoperability.transfers+json;version=1.0", - "date": "2019-05-28T16:34:41.000Z", - "fspiop-source": "payeefsp", - "fspiop-destination": "payerfsp" - }, - "payload": <payload> - }, - "type": "application/json", - "metadata": { - "event": { - "id": "3920382d-f78c-4023-adf9-0d7a4a2a3a2f", - "type": "trace", - "action": "span", - "createdAt": "2019-05-29T23:18:32.935Z", - "state": { - "status": "success", - "code": 0, - "description": "action successful" - }, - "responseTo": "1a396c07-47ab-4d68-a7a0-7a1ea36f0012" - }, - "trace": { - "service": "central-ledger-prepare-handler", - "traceId": "bbd7b2c7bbd7b2c7", - "parentSpanId": "44ba9bbc5840", - "spanId": "2aa9cd0a7e87", - "startTimestamp": "2015-08-29T11:22:09.815479Z", - "finishTimestamp": "2015-08-29T11:22:09.815479Z", - "tags": { - "transctionId": "659ee338-c8f8-4c06-8aff-944e6c5cd694", - "transctionType": "transfer", - "parentEventType": "bulk-prepare", - "parentEventAction": "prepare" - } - } - } - } - - - 2 - Send message for log purposes to custom index - - - - - 3 - Verify its tracing event Message - - - 4 - Send Message to Tracing Observable - - - Cache Span - - - 5 - Send Span Context, - metadata.State and Content - from Message - - - { - spanContext: { - service: "central-ledger-prepare-handler", - traceId: "bbd7b2c7bbd7b2c7", - parentSpanId: "44ba9bbc5840", - spanId: "2aa9cd0a7e87", - startTimestamp: "2015-08-29T11:22:09.815479Z", - finishTimestamp: "2015-08-29T11:22:09.815479Z", - tags: { - transctionId: "659ee338-c8f8-4c06-8aff-944e6c5cd694", - transctionType: "transfer", - parentEventType: "bulk-prepare", - parentEventAction: "prepare" - }, - state: metadata.state, - content - } - - - 6 - Get cachedTrace by traceId - - - alt - [the span should not be cached] - - - 7 - currentSpan - - - 8 - store to APM - - - - - 9 - Complete - - - - - - 10 - Validate transactionType, TransactionAction and service to match Config.START_CRITERIA && !parentSpandId - - - alt - [!cachedTrace] - - - - - 11 - Create new cachedTrace - - - { - spans: {}, - masterSpan: null, - lastSpan: null - } - - - alt - [!parentSpan] - - - - - 12 - Generate MasterSpanId - - - - - 13 - Make received span child of masterSpan - merge({ parentSpanId: MasterSpanId }, { ...spanContext }) - - - - - 14 - Create MasterSpanContext merge({ tags: { ...tags, masterSpan: MasterSpanId } }, - { ...spanContext }, - { spanId: MasterSpanId, service: `master-${tags.transactionType}` }) - - - - - 15 - Add masterSpan to cachedTrace - - - - 16 - Add span to cachedTrace - - - { - spans: { - 2aa9cd0a7e87: { - state, - content - spanContext: { - "service": "central-ledger-prepare-handler", - "traceId": "bbd7b2c7bbd7b2c7", - "parentSpanId": - MasterSpanId - , - "spanId": "2aa9cd0a7e87", - "startTimestamp": "2015-08-29T11:22:09.815479Z", - "finishTimestamp": "2015-08-29T11:22:09.815479Z", - "tags": { - "transctionId": "659ee338-c8f8-4c06-8aff-944e6c5cd694", - "transctionType": "transfer", - "parentEventType": "bulk-prepare", - "parentEventAction": "prepare" - } - } - }, - - MasterSpanId: - { - state, - content, - MasterSpanContext - } - }, - masterSpan: - MasterSpanContext - , - lastSpan: null - } - - - 17 - Update cachedTrace to Cache - - - alt - [cachedTrace not staled or expired] - - - - - 18 - unsubscribe from Scheduler - - - 19 - record cachedTrace - - - - - 20 - Reschedule scheduler for handling stale traces - - - 21 - Send traceId to check if last span has been received - and cached - - - Check for last span - - - 22 - Get cachedTrace by traceId - - - - - 23 - Sort spans by startTimestamp - - - loop - [for currentSpan of SortedSpans] - - - alt - [parentSpan] - - - - - 24 - isError = (errorCode in parentSpan - OR parentSpan status === failed - OR status === failed) - - - - - 25 - apply masterSpan and error tags from parent to current span in cachedTrace - - - alt - [!isLastSpan] - - - 26 - Update cachedTrace to Cache - - - alt - [cachedTrace not staled or expired] - - - - - 27 - unsubscribe from Scheduler - - - 28 - record cachedTrace - - - - - 29 - Reschedule scheduler for handling stale traces - - - - - - 30 - Validate transactionType, TransactionAction, service and isError - to match Config.START_CRITERIA && !parentSpandId - - - - - 31 - cachedTrace.lastSpan = currentSpan.spanContext - - - 32 - Update cachedTrace to Cache - - - alt - [cachedTrace not staled or expired] - - - - - 33 - unsubscribe from Scheduler - - - 34 - record cachedTrace - - - - - 35 - Reschedule scheduler for handling stale traces - - - 36 - Send traceId - - - Recreate Trace from Cached Trace - - - 37 - get cachedTrace by TraceId - - - alt - [cachedTrace.lastSpan AND cachedTrace.masterSpan] - - - - - 38 - currentSpan = lastSpan - - - - - 39 - resultTrace = [lastSpan] - - - loop - [for i = 0; i < cachedTrace.spans.length; i++] - - - - - 40 - get parentSpan of currentSpan - - - alt - [parentSpan] - - - - - 41 - insert parent span in resultTrace in front - - - - - - 42 - break loop - - - alt - [cachedTrace.masterSpan === currentSpan.spanId] - - - - - 43 - masterSpan.finishTimestamp = resultTrace[resultTrace.length - 1].finishTimestamp - - - 44 - send resultTrace - - - send Trace - - - loop - [trace elements] - - - 45 - send each span - - - 46 - send span to APM - - - - - 47 - unsubscribe scheduler for traceId - - - 48 - drop cachedTrace + Event Streaming Processor flow + + Central Services + + Event Stream Processor + + Cache + + Elasticsearch + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Notification topic + + + Notification topic + Topic Observable + + + Topic Observable + + + Tracing Observable + + + Tracing Observable + + + Caching Observable + + + Caching Observable + + + Check For Last Span Observable + + + Check For Last Span Observable + + + Create Trace Observable + + + Create Trace Observable + + + Send Trace Handler + + + Send Trace Handler + + + Send Span Handler + + + Send Span Handler + + + Cache Handler + + + Cache Handler + + + Cache Storage + + + Cache Storage + + + APM + + + APM + + + Elasticsearch API + + + Elasticsearch API + + + + + + + + + + + + New Event Message Received + + + 1 + Consume Event Message + + + Message: + { + "from": "payeefsp", + "to": "payerfsp", + "id": "659ee338-c8f8-4c06-8aff-944e6c5cd694", + "content": { + "headers": { + "content-type": "applicationvnd.interoperability.transfers+json;version=1.0", + "date": "2019-05-28T16:34:41.000Z", + "fspiop-source": "payeefsp", + "fspiop-destination": "payerfsp" + }, + "payload": <payload> + }, + "type": "application/json", + "metadata": { + "event": { + "id": "3920382d-f78c-4023-adf9-0d7a4a2a3a2f", + "type": "trace", + "action": "span", + "createdAt": "2019-05-29T23:18:32.935Z", + "state": { + "status": "success", + "code": 0, + "description": "action successful" + }, + "responseTo": "1a396c07-47ab-4d68-a7a0-7a1ea36f0012" + }, + "trace": { + "service": "central-ledger-prepare-handler", + "traceId": "bbd7b2c7bbd7b2c7", + "parentSpanId": "44ba9bbc5840", + "spanId": "2aa9cd0a7e87", + "startTimestamp": "2015-08-29T11:22:09.815479Z", + "finishTimestamp": "2015-08-29T11:22:09.815479Z", + "tags": { + "transctionId": "659ee338-c8f8-4c06-8aff-944e6c5cd694", + "transctionType": "transfer", + "parentEventType": "bulk-prepare", + "parentEventAction": "prepare" + } + } + } + } + + + 2 + Send message for log purposes to custom index + + + + + 3 + Verify its tracing event Message + + + 4 + Send Message to Tracing Observable + + + Cache Span + + + 5 + Send Span Context, + metadata.State and Content + from Message + + + { + spanContext: { + service: "central-ledger-prepare-handler", + traceId: "bbd7b2c7bbd7b2c7", + parentSpanId: "44ba9bbc5840", + spanId: "2aa9cd0a7e87", + startTimestamp: "2015-08-29T11:22:09.815479Z", + finishTimestamp: "2015-08-29T11:22:09.815479Z", + tags: { + transctionId: "659ee338-c8f8-4c06-8aff-944e6c5cd694", + transctionType: "transfer", + parentEventType: "bulk-prepare", + parentEventAction: "prepare" + }, + state: metadata.state, + content + } + + + 6 + Get cachedTrace by traceId + + + alt + [the span should not be cached] + + + 7 + currentSpan + + + 8 + store to APM + + + + + 9 + Complete + + + + + + + 10 + Validate transactionType, TransactionAction and service to match Config.START_CRITERIA && !parentSpandId + + + alt + [!cachedTrace] + + + + + 11 + Create new cachedTrace + + + { + spans: {}, + masterSpan: null, + lastSpan: null + } + + + alt + [!parentSpan] + + + + + + 12 + Generate MasterSpanId + + + + + + 13 + Make received span child of masterSpan + merge({ parentSpanId: MasterSpanId }, { ...spanContext }) + + + + + + 14 + Create MasterSpanContext merge({ tags: { ...tags, masterSpan: MasterSpanId } }, + { ...spanContext }, + { spanId: MasterSpanId, service: `master-${tags.transactionType}` }) + + + + + + 15 + Add masterSpan to cachedTrace + + + + 16 + Add span to cachedTrace + + + { + spans: { + 2aa9cd0a7e87: { + state, + content + spanContext: { + "service": "central-ledger-prepare-handler", + "traceId": "bbd7b2c7bbd7b2c7", + "parentSpanId": + MasterSpanId + , + "spanId": "2aa9cd0a7e87", + "startTimestamp": "2015-08-29T11:22:09.815479Z", + "finishTimestamp": "2015-08-29T11:22:09.815479Z", + "tags": { + "transctionId": "659ee338-c8f8-4c06-8aff-944e6c5cd694", + "transctionType": "transfer", + "parentEventType": "bulk-prepare", + "parentEventAction": "prepare" + } + } + }, +    + MasterSpanId: + { + state, + content, + MasterSpanContext + } + }, + masterSpan: + MasterSpanContext + , + lastSpan: null + } + + + 17 + Update cachedTrace to Cache + + + alt + [cachedTrace not staled or expired] + + + + + 18 + unsubscribe from Scheduler + + + 19 + record cachedTrace + + + + + + 20 + Reschedule scheduler for handling stale traces + + + 21 + Send traceId to check if last span has been received + and cached + + + Check for last span + + + 22 + Get cachedTrace by traceId + + + + + 23 + Sort spans by startTimestamp + + + loop + [for currentSpan of SortedSpans] + + + alt + [parentSpan] + + + + + 24 + isError = (errorCode in parentSpan + OR parentSpan status === failed + OR status === failed) + + + + + 25 + apply masterSpan and error tags from parent to current span in cachedTrace + + + alt + [!isLastSpan] + + + 26 + Update cachedTrace to Cache + + + alt + [cachedTrace not staled or expired] + + + + + 27 + unsubscribe from Scheduler + + + 28 + record cachedTrace + + + + + + 29 + Reschedule scheduler for handling stale traces + + + + + + 30 + Validate transactionType, TransactionAction, service and isError + to match Config.START_CRITERIA && !parentSpandId + + + + + 31 + cachedTrace.lastSpan = currentSpan.spanContext + + + 32 + Update cachedTrace to Cache + + + alt + [cachedTrace not staled or expired] + + + + + 33 + unsubscribe from Scheduler + + + 34 + record cachedTrace + + + + + + 35 + Reschedule scheduler for handling stale traces + + + 36 + Send traceId + + + Recreate Trace from Cached Trace + + + 37 + get cachedTrace by TraceId + + + alt + [cachedTrace.lastSpan AND cachedTrace.masterSpan] + + + + + 38 + currentSpan = lastSpan + + + + + 39 + resultTrace = [lastSpan] + + + loop + [for i = 0; i < cachedTrace.spans.length; i++] + + + + + 40 + get parentSpan of currentSpan + + + alt + [parentSpan] + + + + + 41 + insert parent span in resultTrace in front + + + + + + 42 + break loop + + + alt + [cachedTrace.masterSpan === currentSpan.spanId] + + + + + 43 + masterSpan.finishTimestamp = resultTrace[resultTrace.length - 1].finishTimestamp + + + 44 + send resultTrace + + + send Trace + + + loop + [trace elements] + + + 45 + send each span + + + 46 + send span to APM + + + + + 47 + unsubscribe scheduler for traceId + + + 48 + drop cachedTrace diff --git a/docs/technical/technical/quoting-service/assets/diagrams/sequence/seq-get-bulk-quotes-2.1.0.svg b/docs/technical/technical/quoting-service/assets/diagrams/sequence/seq-get-bulk-quotes-2.1.0.svg index ba4eba8c..5048df7d 100644 --- a/docs/technical/technical/quoting-service/assets/diagrams/sequence/seq-get-bulk-quotes-2.1.0.svg +++ b/docs/technical/technical/quoting-service/assets/diagrams/sequence/seq-get-bulk-quotes-2.1.0.svg @@ -1,209 +1,198 @@ - - - - - - - - - - + + Retrieve Bulk Quote Information + - Retrieve Bulk Quote Information - - - - - - - - - - - - - Payer FSP - - Payer FSP - - Switch - [Quoting Service] - - Switch - [Quoting Service] - - Payee FSP - - Payee FSP - - - Payer FSP sends request to get bulk quote details - to Payee FSP via the Switch - - - 1 - GET /bulkQuotes/{ID} - - - Validate request against - Mojaloop interface specification - Error code: 300x, 310x - HTTP error response code: 4xx - - - - - 2 - Schema validation - - - 3 - 202 Accepted - - - - - 4 - Retrieve bulk quotes endpoint for Payee FSP - - - alt - [Payee FSP quotes endpoint is found] - - - Switch forwards request to Payee FSP (pass-through mode) - - - 5 - GET /bulkQuotes/{ID} - - - 6 - 202 Accepted - - - - - 7 - Payee FSP retireves bulk quote - - - alt - [Payee FSP successfully retieves quote] - - - Payee FSP responds to quote request - - - 8 - PUT /quotes/{ID} - - - Validate request against - Mojaloop interface specification - Error code: 300x, 310x - HTTP error response code: 4xx - - - 9 - 200 Ok - - - alt - [Response is ok] - - - - - 10 - Retrieve bulk quotes endpoint for the Payer FSP - - - alt - [Bulk Quotes callback endpoint found] - - - Switch forwards bulk quote response to Payer FSP - - - 11 - PUT /bulkQuotes/{ID} - - - 12 - 200 Ok - - [Bulk Quotes callback endpoint not found] - - - Switch returns error to Payee FSP - - - 13 - PUT /bulkQuotes/{ID}/error - - - 14 - 200 Ok - - [Response is invalid] - - - Switch returns error to Payee FSP - - - 15 - PUT /bulkQuotes/{ID}/error - - - 16 - 200 Ok - - - Note that under this - scenario the Payer FSP - may not receive a response - - [bulkQuote not found] - - - Payee FSP returns error to Switch - - Error code: 3205 - - - 17 - PUT /bulkQuotes/{ID}/error - - - 18 - 200 OK - - - Switch returns error to Payer FSP - - Error code: 3205 - - - 19 - PUT /bulkQuotes/{ID}/error - - - 20 - 200 OK - - [Payee FSP Bulk quotes endpoint is not found] - - - Switch returns error to Payer FSP - Error code: 3201 - - - 21 - PUT /bulkQuotes/{ID}error - - - 22 - 200 OK + Retrieve Bulk Quote Information + + + + + + + + + Payer FSP + + Payer FSP + + Switch + [Quoting Service] + + Switch + [Quoting Service] + + Payee FSP + + Payee FSP + + + Payer FSP sends request to get bulk quote details + to Payee FSP via the Switch + + + 1 + GET /bulkQuotes/{ID} + + + Validate request against + Mojaloop interface specification + Error code: 300x, 310x + HTTP error response code: 4xx + + + + + 2 + Schema validation + + + 3 + 202 Accepted + + + + + 4 + Retrieve bulk quotes endpoint for Payee FSP + + + alt + [Payee FSP quotes endpoint is found] + + + Switch forwards request to Payee FSP (pass-through mode) + + + 5 + GET /bulkQuotes/{ID} + + + 6 + 202 Accepted + + + + + 7 + Payee FSP retireves bulk quote + + + alt + [Payee FSP successfully retieves quote] + + + Payee FSP responds to quote request + + + 8 + PUT /quotes/{ID} + + + Validate request against + Mojaloop interface specification + Error code: 300x, 310x + HTTP error response code: 4xx + + + 9 + 200 Ok + + + alt + [Response is ok] + + + + + 10 + Retrieve bulk quotes endpoint for the Payer FSP + + + alt + [Bulk Quotes callback endpoint found] + + + Switch forwards bulk quote response to Payer FSP + + + 11 + PUT /bulkQuotes/{ID} + + + 12 + 200 Ok + + [Bulk Quotes callback endpoint not found] + + + Switch returns error to Payee FSP + + + 13 + PUT /bulkQuotes/{ID}/error + + + 14 + 200 Ok + + [Response is invalid] + + + Switch returns error to Payee FSP + + + 15 + PUT /bulkQuotes/{ID}/error + + + 16 + 200 Ok + + + Note that under this + scenario the Payer FSP + may not receive a response + + [bulkQuote not found] + + + Payee FSP returns error to Switch +   + Error code: 3205 + + + 17 + PUT /bulkQuotes/{ID}/error + + + 18 + 200 OK + + + Switch returns error to Payer FSP +   + Error code: 3205 + + + 19 + PUT /bulkQuotes/{ID}/error + + + 20 + 200 OK + + [Payee FSP Bulk quotes endpoint is not found] + + + Switch returns error to Payer FSP + Error code: 3201 + + + 21 + PUT /bulkQuotes/{ID}error + + + 22 + 200 OK diff --git a/docs/technical/technical/quoting-service/assets/diagrams/sequence/seq-get-quotes-1.1.0.svg b/docs/technical/technical/quoting-service/assets/diagrams/sequence/seq-get-quotes-1.1.0.svg index 5b2a0510..d413d449 100644 --- a/docs/technical/technical/quoting-service/assets/diagrams/sequence/seq-get-quotes-1.1.0.svg +++ b/docs/technical/technical/quoting-service/assets/diagrams/sequence/seq-get-quotes-1.1.0.svg @@ -1,281 +1,269 @@ - - - - - - - - - - + + Retrieve Quote Information + - Retrieve Quote Information - - - - - - - - - - - - - - - - - - - - Payer FSP - - Payer FSP - - Switch - [Quoting - Service] - - Switch - [Quoting - Service] - Central Store - - - Central Store - - - - Payee FSP - - Payee FSP - - - - Payer FSP sends request to get quote details - to Payee FSP via the Switch - - - 1 - GET /quotes/{ID} - - - Validate request against - Mojaloop interface specification - Error code: 300x, 310x - HTTP error response code: 4xx - - - - - 2 - Schema validation - - - 3 - 202 Accepted - - - - - 4 - Retrieve quotes endpoint for Payee FSP - - - alt - [Payee FSP quotes endpoint is found] - - - Switch forwards request to Payee FSP (pass-through mode) - <Payer based Rules> - - - 5 - GET /quotes/{ID} - - - 6 - 202 Accepted - - - - - 7 - Payee FSP retireves quote - - - alt - [Payee FSP successfully retieves quote] - - - Payee FSP responds to quote request - - - 8 - PUT /quotes/{ID} - - - 9 - 200 Ok - - - - - 10 - Validate response (schema, headers ( - Error code: 3100 - )) - - - alt - [Response is ok] - - - alt - [SimpleRoutingMode is FALSE] - - - - - 11 - Validate response (duplicate response check, handle resend scenario ( - Error code: 3106 - )) - - - alt - [Validation passed] - - - 12 - Persist quote response - - quoteResponse - quoteResponseDuplicateCheck - quoteResponseIlpPacket - quoteExtensions - geoCode - - - 13 - Quote response saved - - - alt - [SimpleRoutingMode is TRUE] - - - - - 14 - Retrieve quotes endpoint for the Payer FSP - - [SimpleRoutingMode is FALSE] - - - - - 15 - Retrieve quote party endpoint (PAYER) - - - alt - [Quotes callback endpoint found] - - - Switch forwards quote response to Payer FSP - <Payee whole request Rule> - - - 16 - PUT /quotes/{ID} - - - 17 - 200 Ok - - [Quotes callback endpoint not found] - - - Switch returns error to Payee FSP - - - 18 - PUT /quotes/{ID}/error - - - 19 - 200 Ok - - [Response is invalid] - - - Switch returns error to Payee FSP - - - 20 - PUT /quotes/{ID}/error - - - 21 - 200 Ok - - - Note that under this - scenario the Payer FSP - may not receive a response - - [Quote not found] - - - Payee FSP returns error to Switch - - Error code: 3205 - - - 22 - PUT quotes/{ID}/error - - - 23 - 200 OK - - - alt - [SimpleRoutingMode is FALSE] - - - - - 24 - Persist error data - - - Switch returns error to Payer FSP - - Error code: 3205 - - - 25 - PUT quotes/{ID}/error - - - 26 - 200 OK - - [Payee FSP quotes endpoint is not found] - - - Switch returns error to Payer FSP - Error code: 3201 - - - 27 - PUT quotes/{ID}error - - - 28 - 200 OK + Retrieve Quote Information + + + + + + + + + + + + + + + Payer FSP + + Payer FSP + + Switch + [Quoting + Service] + + Switch + [Quoting + Service] + Central Store + + + Central Store + + + + Payee FSP + + Payee FSP + + + + Payer FSP sends request to get quote details + to Payee FSP via the Switch + + + 1 + GET /quotes/{ID} + + + Validate request against + Mojaloop interface specification + Error code: 300x, 310x + HTTP error response code: 4xx + + + + + 2 + Schema validation + + + 3 + 202 Accepted + + + + + 4 + Retrieve quotes endpoint for Payee FSP + + + alt + [Payee FSP quotes endpoint is found] + + + Switch forwards request to Payee FSP (pass-through mode) + <Payer based Rules> + + + 5 + GET /quotes/{ID} + + + 6 + 202 Accepted + + + + + 7 + Payee FSP retireves quote + + + alt + [Payee FSP successfully retieves quote] + + + Payee FSP responds to quote request + + + 8 + PUT /quotes/{ID} + + + 9 + 200 Ok + + + + + 10 + Validate response (schema, headers ( + Error code: 3100 + )) + + + alt + [Response is ok] + + + alt + [SimpleRoutingMode is FALSE] + + + + + 11 + Validate response (duplicate response check, handle resend scenario ( + Error code: 3106 + )) + + + alt + [Validation passed] + + + 12 + Persist quote response + + quoteResponse + quoteResponseDuplicateCheck + quoteResponseIlpPacket + quoteExtensions + geoCode + + + 13 + Quote response saved + + + alt + [SimpleRoutingMode is TRUE] + + + + + 14 + Retrieve quotes endpoint for the Payer FSP + + [SimpleRoutingMode is FALSE] + + + + + 15 + Retrieve quote party endpoint (PAYER) + + + alt + [Quotes callback endpoint found] + + + Switch forwards quote response to Payer FSP + <Payee whole request Rule> + + + 16 + PUT /quotes/{ID} + + + 17 + 200 Ok + + [Quotes callback endpoint not found] + + + Switch returns error to Payee FSP + + + 18 + PUT /quotes/{ID}/error + + + 19 + 200 Ok + + [Response is invalid] + + + Switch returns error to Payee FSP + + + 20 + PUT /quotes/{ID}/error + + + 21 + 200 Ok + + + Note that under this + scenario the Payer FSP + may not receive a response + + [Quote not found] + + + Payee FSP returns error to Switch +   + Error code: 3205 + + + 22 + PUT quotes/{ID}/error + + + 23 + 200 OK + + + alt + [SimpleRoutingMode is FALSE] + + + + + 24 + Persist error data + + + Switch returns error to Payer FSP +   + Error code: 3205 + + + 25 + PUT quotes/{ID}/error + + + 26 + 200 OK + + [Payee FSP quotes endpoint is not found] + + + Switch returns error to Payer FSP + Error code: 3201 + + + 27 + PUT quotes/{ID}error + + + 28 + 200 OK diff --git a/docs/technical/technical/quoting-service/assets/diagrams/sequence/seq-post-bulk-quotes-2.2.0.svg b/docs/technical/technical/quoting-service/assets/diagrams/sequence/seq-post-bulk-quotes-2.2.0.svg index 93daf45b..d855d1f1 100644 --- a/docs/technical/technical/quoting-service/assets/diagrams/sequence/seq-post-bulk-quotes-2.2.0.svg +++ b/docs/technical/technical/quoting-service/assets/diagrams/sequence/seq-post-bulk-quotes-2.2.0.svg @@ -1,227 +1,217 @@ - - - - - - - - - - + + Request Bulk Quote Creation + - Request Bulk Quote Creation - - - - - - - - - - - - - Payer FSP - - Payer FSP - - Switch - [Quoting Service] - - Switch - [Quoting Service] - - Payee FSP - - Payee FSP - - - Payer FSP sends bulk quote request - to Payee FSP via the Switch - - - 1 - POST /bulkQuotes - - - Validate request against - Mojaloop interface specification - Error code: 300x, 310x - HTTP error response code: 4xx - - - - - 2 - Schema validation - - - 3 - 202 Accepted - - - - - 4 - Bulk Quote request validation (rules engine etc.) - - - - - 5 - Duplicate check - - - alt - [Request is a duplicate but not a resend] - - - Switch returns error back to Payer FSP - Error code: 3106 - - - 6 - PUT /bulkQuotes/{ID}/error - - - 7 - 200 OK - - [Request is a duplicate and a resend] - - - - - 8 - Switch handles resend scenario - - - - - 9 - Use fspiop-destination header to retrieve - bulk quotes endpoint for Payee DFSP - - - alt - [Payee bulk quotes endpoint found] - - - Switch forwards bulk quote request to Payee FSP - - - 10 - POST /bulkQuotes - - - 11 - 202 OK - - - - - 12 - Payee FSP calculates individual quotes - and responds with a bulk quote result - - - alt - [Payee bulkQuotes processing successful] - - - Payee FSP sends bulk quote response back to Payer FSP via the Switch - - - 13 - PUT /bulkQuotes/{ID} - - - 14 - 200 OK - - - - - 15 - Validate bulk quote response - - - - - 16 - Duplicate check - - - alt - [Response is duplicate but not a resend] - - - 17 - PUT /bulkQuotes/{ID}/error - - - 18 - 200 OK - - - alt - [Response is a duplicate and a resend] - - - - - 19 - Switch handles resend scenario - - - Switch forwards quote response to Payer FSP - - - 20 - PUT /bulkQuotes/{ID} - - - 21 - 200 OK - - [Payee rejects bulk quote or encounters an error] - - - Payee FSP sends error callback to Payer FSP via the Switch - - - 22 - PUT /bulkQuotes/{ID}/error - - - 23 - 200 OK - - - Switch forwards error callback to Payer FSP - - - 24 - PUT /bulkQuotes/{ID}/error - - - 25 - 200 OK - - [Payee FSP quotes endpoint not found] - - - Switch sends an error callback to Payer FSP - - Error code: 3201 - - - 26 - PUT /bulkQuotes/{ID}/error - - - 27 - 200 OK + Request Bulk Quote Creation + + + + + + + + + + Payer FSP + + Payer FSP + + Switch + [Quoting Service] + + Switch + [Quoting Service] + + Payee FSP + + Payee FSP + + + Payer FSP sends bulk quote request + to Payee FSP via the Switch + + + 1 + POST /bulkQuotes + + + Validate request against + Mojaloop interface specification + Error code: 300x, 310x + HTTP error response code: 4xx + + + + + 2 + Schema validation + + + 3 + 202 Accepted + + + + + 4 + Bulk Quote request validation (rules engine etc.) + + + + + 5 + Duplicate check + + + alt + [Request is a duplicate but not a resend] + + + Switch returns error back to Payer FSP + Error code: 3106 + + + 6 + PUT /bulkQuotes/{ID}/error + + + 7 + 200 OK + + [Request is a duplicate and a resend] + + + + + 8 + Switch handles resend scenario + + + + + 9 + Use fspiop-destination header to retrieve + bulk quotes endpoint for Payee DFSP + + + alt + [Payee bulk quotes endpoint found] + + + Switch forwards bulk quote request to Payee FSP + + + 10 + POST /bulkQuotes + + + 11 + 202 OK + + + + + 12 + Payee FSP calculates individual quotes + and responds with a bulk quote result + + + alt + [Payee bulkQuotes processing successful] + + + Payee FSP sends bulk quote response back to Payer FSP via the Switch + + + 13 + PUT /bulkQuotes/{ID} + + + 14 + 200 OK + + + + + 15 + Validate bulk quote response + + + + + 16 + Duplicate check + + + alt + [Response is duplicate but not a resend] + + + 17 + PUT /bulkQuotes/{ID}/error + + + 18 + 200 OK + + + alt + [Response is a duplicate and a resend] + + + + + 19 + Switch handles resend scenario + + + Switch forwards quote response to Payer FSP + + + 20 + PUT /bulkQuotes/{ID} + + + 21 + 200 OK + + [Payee rejects bulk quote or encounters an error] + + + Payee FSP sends error callback to Payer FSP via the Switch + + + 22 + PUT /bulkQuotes/{ID}/error + + + 23 + 200 OK + + + Switch forwards error callback to Payer FSP + + + 24 + PUT /bulkQuotes/{ID}/error + + + 25 + 200 OK + + [Payee FSP quotes endpoint not found] + + + Switch sends an error callback to Payer FSP +   + Error code: 3201 + + + 26 + PUT /bulkQuotes/{ID}/error + + + 27 + 200 OK diff --git a/docs/technical/technical/quoting-service/assets/diagrams/sequence/seq-post-quotes-1.2.0.svg b/docs/technical/technical/quoting-service/assets/diagrams/sequence/seq-post-quotes-1.2.0.svg index c7fee5b9..963594b4 100644 --- a/docs/technical/technical/quoting-service/assets/diagrams/sequence/seq-post-quotes-1.2.0.svg +++ b/docs/technical/technical/quoting-service/assets/diagrams/sequence/seq-post-quotes-1.2.0.svg @@ -1,308 +1,297 @@ - - - - - - - - - - + + Request Quote Creation + - Request Quote Creation - - - - - - - - - - - - - - - - - - - - - - Payer FSP - - Payer FSP - - Switch - [Quoting - Service] - - Switch - [Quoting - Service] - Central Store - - - Central Store - - - - Payee FSP - - Payee FSP - - - - - - Payer FSP sends request for quote - to Payee FSP via the Switch - - - 1 - POST /quotes - - - Validate request against - Mojaloop interface specification - Error code: 300x, 310x - HTTP error response code: 4xx - - - - - 2 - Schema validation - - - 3 - 202 Accepted - - - - - 4 - Quote request validation (rules engine etc.) - - - alt - [SimpleRoutingMode === FALSE] - - - - - 5 - Duplicate check - - - alt - [Request is a duplicate but not a resend] - - - Switch returns error back to Payer FSP - Error code: 3106 - - - 6 - PUT /quotes/{ID}/error - - - 7 - 200 OK - - [Request is a duplicate and a resend] - - - - - 8 - Switch handles resend scenario - - - 9 - Persist quote request - - quoteDuplicateCheck - transactionReference - quote - quoteParty - quoteExtension - geoCode - - - 10 - Quote request saved - - - alt - [SimpleRoutingMode === TRUE] - - - - - 11 - Use fspiop-destination header to retrieve quotes endpoint for Payee FSP - - [SimpleRoutingMode === FALSE] - - - - - 12 - Retireve Payee FSP endpoint using quote party information - - - alt - [Payee quotes endpoint found] - - - Switch forwards quote request to Payee FSP - - - 13 - POST /quotes - - - 14 - 202 OK - - - - - 15 - Payee FSP presists and calculates quote - - - alt - [Payee quotes processing successful] - - - Payee FSP sends quote response back to Payer FSP via the Switch - - - 16 - PUT /quotes/{ID} - - - 17 - 200 OK - - - - - 18 - Validate quote response - - - alt - [SimpleRoutingMode === FALSE] - - - - - 19 - Duplicate check - - - alt - [Response is duplicate but not a resend] - - - 20 - PUT /quotes/{ID}/error - - - 21 - 200 OK - - - alt - [Response is a duplicate and a resend] - - - - - 22 - Switch handles resend scenario - - - 23 - Persist quote response - - quoteResponse - quoteDuplicateCheck - quoteResponseIlpPacket - geoCode - quoteExtension - - - 24 - Quote response saved - - - Switch forwards quote response to Payer FSP - - - 25 - PUT /quotes/{ID} - - - 26 - 200 OK - - [Payee rejects quotes or encounters and error] - - - Payee FSP sends error callback to Payer FSP via the Switch - - - 27 - PUT /quotes/{ID}/error - - - 28 - 200 OK - - - alt - [SimpleRoutingMode === FALSE] - - - 29 - Store quote error - - quoteError - - - 30 - Quote error saved - - - Switch forwards error callback to Payer FSP - - - 31 - PUT /quotes/{ID}/error - - - 32 - 200 OK - - [Payee FSP quotes endpoint not found] - - - Switch sends an error callback to Payer FSP - - Error code: 3201 - - - 33 - PUT /quotes/{ID}/error - - - 34 - 200 OK + Request Quote Creation + + + + + + + + + + + + + + + + + + Payer FSP + + Payer FSP + + Switch + [Quoting + Service] + + Switch + [Quoting + Service] + Central Store + + + Central Store + + + + Payee FSP + + Payee FSP + + + + + + Payer FSP sends request for quote + to Payee FSP via the Switch + + + 1 + POST /quotes + + + Validate request against + Mojaloop interface specification + Error code: 300x, 310x + HTTP error response code: 4xx + + + + + 2 + Schema validation + + + 3 + 202 Accepted + + + + + 4 + Quote request validation (rules engine etc.) + + + alt + [SimpleRoutingMode === FALSE] + + + + + 5 + Duplicate check + + + alt + [Request is a duplicate but not a resend] + + + Switch returns error back to Payer FSP + Error code: 3106 + + + 6 + PUT /quotes/{ID}/error + + + 7 + 200 OK + + [Request is a duplicate and a resend] + + + + + 8 + Switch handles resend scenario + + + 9 + Persist quote request + + quoteDuplicateCheck + transactionReference + quote + quoteParty + quoteExtension + geoCode + + + 10 + Quote request saved + + + alt + [SimpleRoutingMode === TRUE] + + + + + 11 + Use fspiop-destination header to retrieve quotes endpoint for Payee FSP + + [SimpleRoutingMode === FALSE] + + + + + 12 + Retireve Payee FSP endpoint using quote party information + + + alt + [Payee quotes endpoint found] + + + Switch forwards quote request to Payee FSP + + + 13 + POST /quotes + + + 14 + 202 OK + + + + + 15 + Payee FSP presists and calculates quote + + + alt + [Payee quotes processing successful] + + + Payee FSP sends quote response back to Payer FSP via the Switch + + + 16 + PUT /quotes/{ID} + + + 17 + 200 OK + + + + + 18 + Validate quote response + + + alt + [SimpleRoutingMode === FALSE] + + + + + 19 + Duplicate check + + + alt + [Response is duplicate but not a resend] + + + 20 + PUT /quotes/{ID}/error + + + 21 + 200 OK + + + alt + [Response is a duplicate and a resend] + + + + + 22 + Switch handles resend scenario + + + 23 + Persist quote response + + quoteResponse + quoteDuplicateCheck + quoteResponseIlpPacket + geoCode + quoteExtension + + + 24 + Quote response saved + + + Switch forwards quote response to Payer FSP + + + 25 + PUT /quotes/{ID} + + + 26 + 200 OK + + [Payee rejects quotes or encounters and error] + + + Payee FSP sends error callback to Payer FSP via the Switch + + + 27 + PUT /quotes/{ID}/error + + + 28 + 200 OK + + + alt + [SimpleRoutingMode === FALSE] + + + 29 + Store quote error + + quoteError + + + 30 + Quote error saved + + + Switch forwards error callback to Payer FSP + + + 31 + PUT /quotes/{ID}/error + + + 32 + 200 OK + + [Payee FSP quotes endpoint not found] + + + Switch sends an error callback to Payer FSP +   + Error code: 3201 + + + 33 + PUT /quotes/{ID}/error + + + 34 + 200 OK diff --git a/docs/technical/technical/quoting-service/assets/diagrams/sequence/seq-quotes-1.0.0.svg b/docs/technical/technical/quoting-service/assets/diagrams/sequence/seq-quotes-1.0.0.svg index 1eeb5351..bff0f162 100644 --- a/docs/technical/technical/quoting-service/assets/diagrams/sequence/seq-quotes-1.0.0.svg +++ b/docs/technical/technical/quoting-service/assets/diagrams/sequence/seq-quotes-1.0.0.svg @@ -1,193 +1,183 @@ - - - - - - - - - - + + Quoting Service Sequences + - Quoting Service Sequences - - - - - - - - - - - Payer DFSP - - Payer DFSP - - Switch - Quoting - Service - - Switch - Quoting - Service - - Payee DFSP - - Payee DFSP - - - Payer DFSP requests quote from Payee DFSP - - - 1 - POST /quotes - - - 2 - 202 Accepted - - - - - 3 - Validate Quote Request - - - alt - [quote is valid] - - - - - 4 - Persist Quote Data - - - Switch forwards quote request to Payee DFSP - <Payer based Rules> - - - 5 - POST /quotes - - - 6 - 202 Accepted - - - - - 7 - Calculate Fees/Charges - - - alt - [Payee DFSP successfully calculates quote] - - - Payee DFSP responds to quote request - - - 8 - PUT /quotes/{ID} - - - 9 - 200 Ok - - - - - 10 - Validate Quote Response - - - alt - [response is ok] - - - - - 11 - Persist Response Data - - - Switch forwards quote response to Payer DFSP - <Payee whole request Rule> - - - 12 - PUT /quotes/{ID} - - - 13 - 200 Ok - - - Payer DFSP continues - with transfer if quote - is acceptable... - - [response invalid] - - - Switch returns error to Payee DFSP - - - 14 - PUT /quotes/{ID}/error - - - 15 - 200 Ok - - - Note that under this - scenario the Payer DFSP - may not receive a response - - [Payee DFSP calculation fails or rejects the request] - - - Payee DFSP returns error to Switch - - - 16 - PUT quotes/{ID}/error - - - 17 - 200 OK - - - - - 18 - Persist error data - - - Switch returns error to Payer DFSP - - - 19 - PUT quotes/{ID}/error - - - 20 - 200 OK - - [quote invalid] - - - Switch returns error to Payer DFSP - - - 21 - PUT quotes/{ID}/error - - - 22 - 200 OK + Quoting Service Sequences + + + + + + + + Payer DFSP + + Payer DFSP + + Switch + Quoting + Service + + Switch + Quoting + Service + + Payee DFSP + + Payee DFSP + + + Payer DFSP requests quote from Payee DFSP + + + 1 + POST /quotes + + + 2 + 202 Accepted + + + + + 3 + Validate Quote Request + + + alt + [quote is valid] + + + + + 4 + Persist Quote Data + + + Switch forwards quote request to Payee DFSP + <Payer based Rules> + + + 5 + POST /quotes + + + 6 + 202 Accepted + + + + + 7 + Calculate Fees/Charges + + + alt + [Payee DFSP successfully calculates quote] + + + Payee DFSP responds to quote request + + + 8 + PUT /quotes/{ID} + + + 9 + 200 Ok + + + + + 10 + Validate Quote Response + + + alt + [response is ok] + + + + + 11 + Persist Response Data + + + Switch forwards quote response to Payer DFSP + <Payee whole request Rule> + + + 12 + PUT /quotes/{ID} + + + 13 + 200 Ok + + + Payer DFSP continues + with transfer if quote + is acceptable... + + [response invalid] + + + Switch returns error to Payee DFSP + + + 14 + PUT /quotes/{ID}/error + + + 15 + 200 Ok + + + Note that under this + scenario the Payer DFSP + may not receive a response + + [Payee DFSP calculation fails or rejects the request] + + + Payee DFSP returns error to Switch + + + 16 + PUT quotes/{ID}/error + + + 17 + 200 OK + + + + + 18 + Persist error data + + + Switch returns error to Payer DFSP + + + 19 + PUT quotes/{ID}/error + + + 20 + 200 OK + + [quote invalid] + + + Switch returns error to Payer DFSP + + + 21 + PUT quotes/{ID}/error + + + 22 + 200 OK diff --git a/docs/technical/technical/quoting-service/assets/diagrams/sequence/seq-quotes-overview-1.0.0.svg b/docs/technical/technical/quoting-service/assets/diagrams/sequence/seq-quotes-overview-1.0.0.svg index 8dc8bf93..43af29f8 100644 --- a/docs/technical/technical/quoting-service/assets/diagrams/sequence/seq-quotes-overview-1.0.0.svg +++ b/docs/technical/technical/quoting-service/assets/diagrams/sequence/seq-quotes-overview-1.0.0.svg @@ -1,193 +1,183 @@ - - - - - - - - - - + + Quoting Service Sequences + - Quoting Service Sequences - - - - - - - - - - - Payer FSP - - Payer FSP - - Switch - Quoting - Service - - Switch - Quoting - Service - - Payee FSP - - Payee FSP - - - Payer FSP requests quote from Payee FSP - - - 1 - POST /quotes - - - 2 - 202 Accepted - - - - - 3 - Validate Quote Request - - - alt - [quote is valid] - - - - - 4 - Persist Quote Data - - - Switch forwards quote request to Payee FSP - <Payer based Rules> - - - 5 - POST /quotes - - - 6 - 202 Accepted - - - - - 7 - Calculate Fees/Charges - - - alt - [Payee FSP successfully calculates quote] - - - Payee FSP responds to quote request - - - 8 - PUT /quotes/{ID} - - - 9 - 200 Ok - - - - - 10 - Validate Quote Response - - - alt - [response is ok] - - - - - 11 - Persist Response Data - - - Switch forwards quote response to Payer FSP - <Payee whole request Rule> - - - 12 - PUT /quotes/{ID} - - - 13 - 200 Ok - - - Payer FSP continues - with transfer if quote - is acceptable... - - [response invalid] - - - Switch returns error to Payee FSP - - - 14 - PUT /quotes/{ID}/error - - - 15 - 200 Ok - - - Note that under this - scenario the Payer FSP - may not receive a response - - [Payee FSP calculation fails or rejects the request] - - - Payee FSP returns error to Switch - - - 16 - PUT quotes/{ID}/error - - - 17 - 200 OK - - - - - 18 - Persist error data - - - Switch returns error to Payer FSP - - - 19 - PUT quotes/{ID}/error - - - 20 - 200 OK - - [quote invalid] - - - Switch returns error to Payer FSP - - - 21 - PUT quotes/{ID}/error - - - 22 - 200 OK + Quoting Service Sequences + + + + + + + + Payer FSP + + Payer FSP + + Switch + Quoting + Service + + Switch + Quoting + Service + + Payee FSP + + Payee FSP + + + Payer FSP requests quote from Payee FSP + + + 1 + POST /quotes + + + 2 + 202 Accepted + + + + + 3 + Validate Quote Request + + + alt + [quote is valid] + + + + + 4 + Persist Quote Data + + + Switch forwards quote request to Payee FSP + <Payer based Rules> + + + 5 + POST /quotes + + + 6 + 202 Accepted + + + + + 7 + Calculate Fees/Charges + + + alt + [Payee FSP successfully calculates quote] + + + Payee FSP responds to quote request + + + 8 + PUT /quotes/{ID} + + + 9 + 200 Ok + + + + + 10 + Validate Quote Response + + + alt + [response is ok] + + + + + 11 + Persist Response Data + + + Switch forwards quote response to Payer FSP + <Payee whole request Rule> + + + 12 + PUT /quotes/{ID} + + + 13 + 200 Ok + + + Payer FSP continues + with transfer if quote + is acceptable... + + [response invalid] + + + Switch returns error to Payee FSP + + + 14 + PUT /quotes/{ID}/error + + + 15 + 200 Ok + + + Note that under this + scenario the Payer FSP + may not receive a response + + [Payee FSP calculation fails or rejects the request] + + + Payee FSP returns error to Switch + + + 16 + PUT quotes/{ID}/error + + + 17 + 200 OK + + + + + 18 + Persist error data + + + Switch returns error to Payer FSP + + + 19 + PUT quotes/{ID}/error + + + 20 + 200 OK + + [quote invalid] + + + Switch returns error to Payer FSP + + + 21 + PUT quotes/{ID}/error + + + 22 + 200 OK diff --git a/docs/technical/technical/sdk-scheme-adapter/assets/sequence/SDKBulkSequenceDiagram.svg b/docs/technical/technical/sdk-scheme-adapter/assets/sequence/SDKBulkSequenceDiagram.svg index 8954f92c..a6fc96ca 100644 --- a/docs/technical/technical/sdk-scheme-adapter/assets/sequence/SDKBulkSequenceDiagram.svg +++ b/docs/technical/technical/sdk-scheme-adapter/assets/sequence/SDKBulkSequenceDiagram.svg @@ -1,305 +1,295 @@ - - - - - - - - - - + + - - Payer DFSP - - Payee DFSP - - - - - - - - - - - - - - - - - - - Backend System - - Backend System - - sdk-scheme-adapter - - sdk-scheme-adapter - - Mojaloop - Switch - - Mojaloop - Switch - - sdk-scheme-adapter - - sdk-scheme-adapter - - Backend System - - Backend System - - - - - - - - MVP Bulk Transfers using SDK-Scheme-Adapter - - - - [1] - POST - /bulkTransactions - - - Bulk Disbursement is triggerd - by beneficiary management sub-system - - - loop - [Discovery Processing: For each individualTransfer in bulk message] - - Resolving all potential recipients - which might be at any of the DFSPs - on the service. - - - - [2] - GET - /parties/* - - - - - [3] - query oracle to - determine Payee DFSP - - - - [4] - GET - /parties/* - - - [5] - GET - /parties/* - - - Lookup / validate party information - - - - [6] - PUT - /parties/{type}/{id} - - - - [7] - PUT - /parties/{type}/{id} - - - - [8] - PUT - /bulkTransactions/{bulkTransactionId} - - - - [9] - PUT - /bulkTransactions/{bulkTransactionId} - - - Confirmation of party integration - - - - - [10] - Group Valid Transfers into batches - - - loop - [Agreement Processing: For each batch in bulk message] - - Each DFSP is provided the opportunity to - perform AML checks and add costs - or discounts to each transfer. - - - - [11] - POST - /bulkquotes - - - - [12] - POST - /bulkquotes - - - alt - [if (HasSupportForBulkQuotes)] - - - [13] - POST - /bulkquotes - - - Bulk AML checks - Bulk Fee calculations - - [if (!HasSupportForBulkQuotes)] - - - loop - [X times for each transfer in bulk message] - - - [14] - POST - /quoterequests - - - AML checks - Fee calculations - - - - [15] - PUT - /bulkquotes/{id) - - - - [16] - PUT - /bulkquotes/{id) - - - - [17] - PUT - /bulkTransactions/{bulkTransactionId} - - - - [18] - PUT - /bulkTransactions/{bulkTransactionId} - - - confirmation of quote integration - - - loop - [Transfer Processing: For each batch in bulk message] - - Each DFSP is messaged to proceed - with the transfer. Results - are captured and returned. - - - - [19] - POST - /bulktransfers - - - - - [20] - Perform liquidity(NDC) check - at individual transfer level - - - - - [21] - Reserve Funds - - - - [22] - POST - /bulktransfers - - - alt - [if (HasSupportForBulkTransfers)] - - - [23] - POST - /bulktransfers - - - Bulk Transfer integration - - [if (!HasSupportForBulkTransfers)] - - - loop - [X times for each transfer in bulk message] - - - [24] - POST - /transfers - - - Single Transfer integration - - - - [25] - PUT - /bulktransfers/{id} (BulkStatus) - - - - - [26] - Commit funds at indivial transfer level - - - - [27] - PUT - /bulktransfers/{id} - - - - [28] - Callback Response - PUT - /bulkTransactions/{bulkTransactionId} - Transfer Response (success & fail) - - - Result of bulk disbursement received. + + Payer DFSP + + Payee DFSP + + + + + + + + + + + + + + + + + Backend System + + Backend System + + sdk-scheme-adapter + + sdk-scheme-adapter + + Mojaloop + Switch + + Mojaloop + Switch + + sdk-scheme-adapter + + sdk-scheme-adapter + + Backend System + + Backend System + + + + + + + + MVP Bulk Transfers using SDK-Scheme-Adapter + + + + [1] + POST + /bulkTransactions + + + Bulk Disbursement is triggerd + by beneficiary management sub-system + + + loop + [Discovery Processing: For each individualTransfer in bulk message] + + Resolving all potential recipients + which might be at any of the DFSPs + on the service. + + + + [2] + GET + /parties/* + + + + + [3] + query oracle to + determine Payee DFSP + + + + [4] + GET + /parties/* + + + [5] + GET + /parties/* + + + Lookup / validate party information + + + + [6] + PUT + /parties/{type}/{id} + + + + [7] + PUT + /parties/{type}/{id} + + + + [8] + PUT + /bulkTransactions/{bulkTransactionId} + + + + [9] + PUT + /bulkTransactions/{bulkTransactionId} + + + Confirmation of party integration + + + + + [10] + Group Valid Transfers into batches + + + loop + [Agreement Processing: For each batch in bulk message] + + Each DFSP is provided the opportunity to + perform AML checks and add costs + or discounts to each transfer. + + + + [11] + POST + /bulkquotes + + + + [12] + POST + /bulkquotes + + + alt + [if (HasSupportForBulkQuotes)] + + + [13] + POST + /bulkquotes + + + Bulk AML checks + Bulk Fee calculations + + [if (!HasSupportForBulkQuotes)] + + + loop + [X times for each transfer in bulk message] + + + [14] + POST + /quoterequests + + + AML checks + Fee calculations + + + + [15] + PUT + /bulkquotes/{id) + + + + [16] + PUT + /bulkquotes/{id) + + + + [17] + PUT + /bulkTransactions/{bulkTransactionId} + + + + [18] + PUT + /bulkTransactions/{bulkTransactionId} + + + confirmation of quote integration + + + loop + [Transfer Processing: For each batch in bulk message] + + Each DFSP is messaged to proceed + with the transfer. Results + are captured and returned. + + + + [19] + POST + /bulktransfers + + + + + [20] + Perform liquidity(NDC) check + at individual transfer level + + + + + [21] + Reserve Funds + + + + [22] + POST + /bulktransfers + + + alt + [if (HasSupportForBulkTransfers)] + + + [23] + POST + /bulktransfers + + + Bulk Transfer integration + + [if (!HasSupportForBulkTransfers)] + + + loop + [X times for each transfer in bulk message] + + + [24] + POST + /transfers + + + Single Transfer integration + + + + [25] + PUT + /bulktransfers/{id} (BulkStatus) + + + + + [26] + Commit funds at indivial transfer level + + + + [27] + PUT + /bulktransfers/{id} + + + + [28] + Callback Response + PUT + /bulkTransactions/{bulkTransactionId} + Transfer Response (success & fail) + + + Result of bulk disbursement received. diff --git a/docs/technical/technical/sdk-scheme-adapter/assets/sequence/SDKrequestToPay.svg b/docs/technical/technical/sdk-scheme-adapter/assets/sequence/SDKrequestToPay.svg index 33268cca..f734170e 100644 --- a/docs/technical/technical/sdk-scheme-adapter/assets/sequence/SDKrequestToPay.svg +++ b/docs/technical/technical/sdk-scheme-adapter/assets/sequence/SDKrequestToPay.svg @@ -1,202 +1,532 @@ -Payer DFSPPayee DFSPPayerPayerCore Banking SystemCore Banking SystemSDKSDKMojaloopMojaloopSDKSDKCore Banking SystemCore Banking SystemPayeePayeealt[if (OTP)][1]Generate an OTP for me[2]Generate[3]Here is your OTPPayee initiated request to pay (R2P)[4]I would liketo receive 1000 TZSfrom +1234567890[5]Payer not within Payee System[6]POST/requestToPayTransfer{"requestToPayTransactionId": "string","from": {"type": "CONSUMER","idType": "MSISDN","idValue": "+1234567890","idSubValue": "string"},"to": {...},"amountType": "RECEIVE","currency": "TZS","amount": "1000.0","scenario": {...},"initiator": "PAYEE","initiatorType": "CONSUMER","note": "Note sent to Payee."}[7]GET/parties[8]GET/parties[9]GET/parties[10]Lookup Validate Payer Account[11]return Payer informationPayer information[12]PUT/parties[13]PUT/partiesalt[If AutoAcceptParty = false][14]POST/requestToPayTransfer(synchronous return){"requestToPayTransactionId": "string","from": {"type": "CONSUMER","idType": "MSISDN","idValue": "1234567890","idSubValue": "string","displayName": "ryZ037pWP'lHu,Tu9,Tjl MRMbdMSpRGAHt4m6 2jk5L4'ePRWT","firstName": "Henrik","middleName": "Johannes","lastName": "Karlsson","dateOfBirth": "1966-06-16","fspId": "string","extensionList": []},"to": {...},"amountType": "RECEIVE","currency": "TZS","amount": "1000.0","transactionType": "TRANSFER","note": "Note sent to Payee.","currentState": "WAITING_FOR_PARTY_ACCEPTANCE",}[15]PUT/requestToPay/{requestToPayId}{acceptParty: true}[16]AutomaticallyAcceptParty by updatingstatus[17]POST/transactionRequests[18]POST/transactionRequests[19]POST/transactionRequests[20]Validate requestto pay request[21]return[22]PUT/transactionRequests/{ID}{"transactionId": "b51ec534-ee48-4575-b6a9-ead2955b8069","transactionRequestState": "RECEIVED","AuthenticationType": {}"extensionList": {extension:[]}}[23]PUT/transactionRequests[24]returnPayer DFSP executes R2P request[25]POST/RequestToPayTransferInitiate R2P with AuthType[26]POST/quotes[27]POST/quotes[28]POST/quoterequest[29]return quote[30]PUT/quotes[31]PUT/quotes[32]return(POST/RequestToPayTransfer)alt[if AuthenticateType is null][33]Present payment termsto Payer for acceptance[34]I accept the payment terms[if AuthenticateType is OTP][35]Generate OTP (optional)[36]Present OTP to Payer (optional)loop[x retries][37]PUT/RequestToPayTransferaccept quote = trueretries left = x[38]GET /authorizations/{transactionRequestID}[39]GET /authorizations/{transactionRequestID}[40]GET /auth/{authtype}/{requestToPayId}[41]Get Payee to getPayer to enter OTPon POS[42]Enter OTP[43]return OTP{"otpValue": "string"}[44]PUT/authorizations/{ID}[45]PUT/authorizations/{ID}[46]synchronous return POST/requestToPayTransfer/{requestToPayTransactionId}[47]Validate OTPalt[if can proceed with transfer][48]Reserve funds againstPayer's account[49]PUT /requestToPayTransfer/{requestToPayTransactionId}[50]POST/transfers[51]POST/transfers[52]PUT/POST/requestToPayTransfer/{requestToPayTransactionId}return[53]Notify user[54]PUT/transfersreturn fulfilment[55]PUT/transfers[56]POST /newAPINotify payer of transfer[57]Commit transferto Payer's account[58]Notify Payer[if rejected][59]return[60]PUT /requestToPayTransfer/{requestToPayTransactionId}rejected[61]PUT/requestToPayTransfer/{requestToPayTransactionId}rejected[62]return rejected \ No newline at end of file + + + + + Payer DFSP + + Payee DFSP + + + + + + + + + + + + + + + + + Payer + + + Payer + + + + Core Banking System + + Core Banking System + + SDK + + SDK + + Mojaloop + + Mojaloop + + SDK + + SDK + + Core Banking System + + Core Banking System + Payee + + + Payee + + + + + + + + alt + [if (User Initiated OTP)] + + + [1] + Generate an OTP for me + + + + + [2] + Generate + + + [3] + Here is your OTP + + + + + Payee initiated request to pay (R2P) + + + [4] + I would like + to receive 1000 TZS + from +1234567890 + + + + + [5] + Payer not within Payee System + + + [6] + POST + /requestToPayTransfer + + + { + "requestToPayTransactionId": "string", + "from": { + "type": "CONSUMER", + "idType": "MSISDN", + "idValue": "+1234567890", + "idSubValue": "string" + }, + "to": {...}, + "amountType": "RECEIVE", + "currency": "TZS", + "amount": "1000.0", + "scenario": {...}, + "initiator": "PAYEE", + "initiatorType": "CONSUMER", + "note": "Note sent to Payee." + } + + + + [7] + GET + /parties + + + + [8] + GET + /parties + + + [9] + GET + /parties + + + + + [10] + Lookup Validate Payer Account + + + [11] + return Payer information + + + Payer information + + + + [12] + PUT + /parties + + + + [13] + PUT + /parties + + + alt + [If AutoAcceptParty = false] + + + [14] + POST + /requestToPayTransfer + (synchronous return) + + + { + "requestToPayTransactionId": "string", + "from": { + "type": "CONSUMER", + "idType": "MSISDN", + "idValue": "1234567890", + "idSubValue": "string", + "displayName": "ryZ037pWP'lHu,Tu9,Tjl MRMbdMSpRGAHt4m6 2jk5L4'ePRWT", + "firstName": "Henrik", + "middleName": "Johannes", + "lastName": "Karlsson", + "dateOfBirth": "1966-06-16", + "fspId": "string", + "extensionList": [] + }, + "to": {...}, + "amountType": "RECEIVE", + "currency": "TZS", + "amount": "1000.0", + "transactionType": "TRANSFER", + "note": "Note sent to Payee.", + "currentState": "WAITING_FOR_PARTY_ACCEPTANCE", + } + + + [15] + PUT + /requestToPay/ + {requestToPayId} + + + { + acceptParty: true + } + + + + + + [16] + Automatically + AcceptParty by updating + status + + + + [17] + POST + /transactionRequests + + + + [18] + POST + /transactionRequests + + + [19] + POST + /transactionRequests + + + + + [20] + Validate request + to pay request + + + [21] + return + + + + [22] + PUT + /transactionRequests/{ID} + + + { + "transactionId": "b51ec534-ee48-4575-b6a9-ead2955b8069", + "transactionRequestState": "RECEIVED", + "AuthenticationType": {} + "extensionList": {extension:[]} + } + + + + [23] + PUT + /transactionRequests + + + [24] + return + + + + + Payer DFSP executes R2P request + + + [25] + POST + /RequestToPayTransfer + + + Initiate R2P with AuthType + + + + [26] + POST + /quotes + + + + [27] + POST + /quotes + + + [28] + POST + /quoterequest + + + [29] + return quote + + + + [30] + PUT + /quotes + + + + [31] + PUT + /quotes + + + [32] + return + ( + POST + /RequestToPayTransfer) + + + alt + [if AuthenticateType is null] + + + [33] + Present payment terms + to Payer for acceptance + + + [34] + I accept the payment terms + + [if AuthenticateType is OTP] + + + alt + [if (Automatic generated OTP)] + + + + + [35] + Generate OTP + + + [36] + Present OTP to Payer + + + loop + [x retries] + + + [37] + PUT + /RequestToPayTransfer + + + accept quote = true + retries left = x + + + + [38] + GET +   + /authorizations/ + {transactionRequestID} + + + + [39] + GET +   + /authorizations/ + {transactionRequestID} + + + [40] + GET +   + /auth/{authtype}/{requestToPayId} + + + [41] + Get Payee to get + Payer to enter OTP + on POS + + + [42] + Enter OTP + + + [43] + return OTP + + + { + "otpValue": "string" + } + + + + [44] + PUT + /authorizations/{ID} + + + + [45] + PUT + /authorizations/{ID} + + + [46] + synchronous return +   + POST + /requestToPayTransfer/ + {requestToPayTransactionId} + + + + + [47] + Validate OTP + + + alt + [if can proceed with transfer] + + + + + [48] + Reserve funds against + Payer's account + + + [49] + PUT +   + /requestToPayTransfer/ + {requestToPayTransactionId} + + + + [50] + POST + /transfers + + + + [51] + POST + /transfers + + + [52] + PUT + / + POST + /requestToPayTransfer/ + {requestToPayTransactionId} + return + + + [53] + Notify user + + + + [54] + PUT + /transfers + return fulfilment + + + + [55] + PUT + /transfers + + + [56] + POST +   + /newAPI + Notify payer of transfer + + + + + [57] + Commit transfer + to Payer's account + + + [58] + Notify Payer + + [if rejected] + + + [59] + return + + + + [60] + PUT +   + /requestToPayTransfer/ + {requestToPayTransactionId} + rejected + + + + [61] + PUT + /requestToPayTransfer/ + {requestToPayTransactionId} + rejected + + + + [62] + return rejected + + diff --git a/docs/technical/technical/transaction-requests-service/assets/diagrams/sequence/seq-trx-req-authorizations-3.0.0.svg b/docs/technical/technical/transaction-requests-service/assets/diagrams/sequence/seq-trx-req-authorizations-3.0.0.svg index bd7ec4e8..58173614 100644 --- a/docs/technical/technical/transaction-requests-service/assets/diagrams/sequence/seq-trx-req-authorizations-3.0.0.svg +++ b/docs/technical/technical/transaction-requests-service/assets/diagrams/sequence/seq-trx-req-authorizations-3.0.0.svg @@ -1,140 +1,132 @@ - - - - - - - - - - + + Transaction Requests Service - Authorizations + - Transaction Requests Service - Authorizations - - - - - - - Payer FSP - - Payer FSP - - Switch - transaction-requests-service - - Switch - transaction-requests-service - - Payee FSP - - Payee FSP - - - - - 1 - Lookup, Transaction request, - processing not shown here - - - Payee FSP generates a transaction-request to the Payer FSP - - - - - 2 - Do quote, generate OTP - notify user (not shown here) - - - 3 - GET /authorizations/{TransactionRequestID} - - - 4 - 202 Accepted - - - alt - [authorization request is valid] - - - - - 5 - Validate GET /authorizations/{TransactionRequestID} (internal validation) - - - - - 6 - Retrieve corresponding end-points for Payee FSP - - - Switch forwards GET /authorizations request to Payee FSP - - - 7 - GET /authorizations/{TransactionRequestID} - - - 8 - 202 Accepted - - - - - 9 - Process authorization request - (Payer approves/rejects transaction - using OTP) - - - Payee FSP responds with PUT /authorizations//{TransactionRequestID} - - - 10 - PUT /authorizations//{TransactionRequestID} - - - 11 - 200 Ok - - - Switch forwards PUT /authorizations//{TransactionRequestID} to Payer FSP - - - - - 12 - Retrieve corresponding end-points for Payer FSP - - - 13 - PUT /authorizations//{TransactionRequestID} - - - 14 - 200 Ok - - [authorization request is invalid] - - - Switch returns error callback to Payer FSP - - - 15 - PUT /authorizations/{TransactionRequestID}/error - - - 16 - 200 OK - - - - - 17 - Validate OTP sent by Payee FSP + Transaction Requests Service - Authorizations + + + + + + Payer FSP + + Payer FSP + + Switch + transaction-requests-service + + Switch + transaction-requests-service + + Payee FSP + + Payee FSP + + + + + 1 + Lookup, Transaction request, + processing not shown here + + + Payee FSP generates a transaction-request to the Payer FSP + + + + + 2 + Do quote, generate OTP + notify user (not shown here) + + + 3 + GET /authorizations/{TransactionRequestID} + + + 4 + 202 Accepted + + + alt + [authorization request is valid] + + + + + 5 + Validate GET /authorizations/{TransactionRequestID} (internal validation) + + + + + 6 + Retrieve corresponding end-points for Payee FSP + + + Switch forwards GET /authorizations request to Payee FSP + + + 7 + GET /authorizations/{TransactionRequestID} + + + 8 + 202 Accepted + + + + + 9 + Process authorization request + (Payer approves/rejects transaction + using OTP) + + + Payee FSP responds with PUT /authorizations//{TransactionRequestID} + + + 10 + PUT /authorizations//{TransactionRequestID} + + + 11 + 200 Ok + + + Switch forwards PUT /authorizations//{TransactionRequestID} to Payer FSP + + + + + 12 + Retrieve corresponding end-points for Payer FSP + + + 13 + PUT /authorizations//{TransactionRequestID} + + + 14 + 200 Ok + + [authorization request is invalid] + + + Switch returns error callback to Payer FSP + + + 15 + PUT /authorizations/{TransactionRequestID}/error + + + 16 + 200 OK + + + + + 17 + Validate OTP sent by Payee FSP diff --git a/docs/technical/technical/transaction-requests-service/assets/diagrams/sequence/seq-trx-req-service-1.0.0.svg b/docs/technical/technical/transaction-requests-service/assets/diagrams/sequence/seq-trx-req-service-1.0.0.svg index ff408d65..c602dd78 100644 --- a/docs/technical/technical/transaction-requests-service/assets/diagrams/sequence/seq-trx-req-service-1.0.0.svg +++ b/docs/technical/technical/transaction-requests-service/assets/diagrams/sequence/seq-trx-req-service-1.0.0.svg @@ -1,195 +1,185 @@ - - - - - - - - - - + + Transaction Requests Service - Create + - Transaction Requests Service - Create - - - - - - - - - - - Payer FSP - - Payer FSP - - Switch - transaction-requests-service - - Switch - transaction-requests-service - - Payee FSP - - Payee FSP - - - - - 1 - Lookup process - (not shown here) - - - Payee FSP generates a transaction-request to the Payer FSP - - - 2 - POST /transactionRequests - - - - - 3 - Validate POST /transactionRequests schema - - - 4 - 202 Accepted - - - alt - [transaction-request is valid] - - - - - 5 - Validate POST /transactionRequests (internal validation) - - - - - 6 - Retrieve corresponding end-points for Payer FSP - - - Switch forwards POST /transactionRequests request to Payer FSP - - - 7 - POST /transactionRequests - - - 8 - 202 Accepted - - - - - 9 - Process transaction-request - - - alt - [Payer FSP successfully processes transaction-request] - - - Payer FSP responds to POST /transactionRequests - - - 10 - PUT /transactionRequests/{ID} - - - 11 - 200 Ok - - - - - 12 - Validate PUT /transactionRequests/{ID} - - - alt - [response is ok] - - - Switch forwards transaction-request response to Payee FSP - - - - - 13 - Retrieve corresponding end-points for Payee FSP - - - 14 - PUT /transactionRequests/{ID} - - - 15 - 200 Ok - - - Wait for a quote, transfer by Payer FSP - or a rejected transaction-request - - [response invalid] - - - Switch returns error to Payer FSP - - - 16 - PUT /transactionRequests/{ID}/error - - - 17 - 200 Ok - - - Note that under this - scenario the Payee FSP - may not receive a response - - [Payer FSP calculation fails or rejects the request] - - - Payer FSP returns error to Switch - - - 18 - PUT /transactionRequests/{ID}/error - - - 19 - 200 OK - - - Switch returns error to Payee FSP - - - 20 - PUT /transactionRequests/{ID}/error - - - 21 - 200 OK - - [transaction-request is invalid] - - - Switch returns error to Payee FSP - - - 22 - PUT /transactionRequests/{ID}/error - - - 23 - 200 OK + Transaction Requests Service - Create + + + + + + + + Payer FSP + + Payer FSP + + Switch + transaction-requests-service + + Switch + transaction-requests-service + + Payee FSP + + Payee FSP + + + + + 1 + Lookup process + (not shown here) + + + Payee FSP generates a transaction-request to the Payer FSP + + + 2 + POST /transactionRequests + + + + + 3 + Validate POST /transactionRequests schema + + + 4 + 202 Accepted + + + alt + [transaction-request is valid] + + + + + 5 + Validate POST /transactionRequests (internal validation) + + + + + 6 + Retrieve corresponding end-points for Payer FSP + + + Switch forwards POST /transactionRequests request to Payer FSP + + + 7 + POST /transactionRequests + + + 8 + 202 Accepted + + + + + 9 + Process transaction-request + + + alt + [Payer FSP successfully processes transaction-request] + + + Payer FSP responds to POST /transactionRequests + + + 10 + PUT /transactionRequests/{ID} + + + 11 + 200 Ok + + + + + 12 + Validate PUT /transactionRequests/{ID} + + + alt + [response is ok] + + + Switch forwards transaction-request response to Payee FSP + + + + + 13 + Retrieve corresponding end-points for Payee FSP + + + 14 + PUT /transactionRequests/{ID} + + + 15 + 200 Ok + + + Wait for a quote, transfer by Payer FSP + or a rejected transaction-request + + [response invalid] + + + Switch returns error to Payer FSP + + + 16 + PUT /transactionRequests/{ID}/error + + + 17 + 200 Ok + + + Note that under this + scenario the Payee FSP + may not receive a response + + [Payer FSP calculation fails or rejects the request] + + + Payer FSP returns error to Switch + + + 18 + PUT /transactionRequests/{ID}/error + + + 19 + 200 OK + + + Switch returns error to Payee FSP + + + 20 + PUT /transactionRequests/{ID}/error + + + 21 + 200 OK + + [transaction-request is invalid] + + + Switch returns error to Payee FSP + + + 22 + PUT /transactionRequests/{ID}/error + + + 23 + 200 OK diff --git a/docs/technical/technical/transaction-requests-service/assets/diagrams/sequence/seq-trx-req-service-get-2.0.0.svg b/docs/technical/technical/transaction-requests-service/assets/diagrams/sequence/seq-trx-req-service-get-2.0.0.svg index 20ced5d9..c2f12614 100644 --- a/docs/technical/technical/transaction-requests-service/assets/diagrams/sequence/seq-trx-req-service-get-2.0.0.svg +++ b/docs/technical/technical/transaction-requests-service/assets/diagrams/sequence/seq-trx-req-service-get-2.0.0.svg @@ -1,180 +1,170 @@ - - - - - - - - - - + + Transaction Requests Service - Query + - Transaction Requests Service - Query - - - - - - - - - - - Payer FSP - - Payer FSP - - Switch - transaction-requests-service - - Switch - transaction-requests-service - - Payee FSP - - Payee FSP - - - Payee FSP requests the status of a transaction-request at the Payer FSP. - ID here is the ID of prevoiusly created transaction-request - - - 1 - GET /transactionRequests/{ID} - - - - - 2 - Validate GET /transactionRequests/{ID} - - - 3 - 202 Accepted - - - alt - [transaction-request query is valid] - - - - - 4 - Retrieve corresponding end-points for Payer FSP - - - Switch forwards GET /transactionRequests/{ID} request to Payer FSP - - - 5 - GET /transactionRequests/{ID} - - - 6 - 202 Accepted - - - - - 7 - Retrieve transaction-request - - - alt - [Payer FSP successfully retrieves transaction-request] - - - Payer FSP responds with the - PUT /transactionRequests/{ID} callback - - - 8 - PUT /transactionRequests/{ID} - - - 9 - 200 Ok - - - - - 10 - Validate PUT /transactionRequests/{ID} - - - alt - [response is ok] - - - Switch forwards transaction-request response to Payee FSP - - - - - 11 - Retrieve corresponding end-points for Payee FSP - - - 12 - PUT /transactionRequests/{ID} - - - 13 - 200 Ok - - [response invalid] - - - Switch returns error to Payer FSP - - - 14 - PUT /transactionRequests/{ID}/error - - - 15 - 200 Ok - - - Note that under this - scenario the Payee FSP - may not receive a response - - [Payer FSP is unable to retrieve the transaction-request] - - - Payer FSP returns error to Switch - - - 16 - PUT /transactionRequests/{ID}/error - - - 17 - 200 OK - - - Switch returns error to Payee FSP - - - 18 - PUT /transactionRequests/{ID}/error - - - 19 - 200 OK - - [transaction-request is invalid] - - - Switch returns error to Payee FSP - - - 20 - PUT /transactionRequests/{ID}/error - - - 21 - 200 OK + Transaction Requests Service - Query + + + + + + + + Payer FSP + + Payer FSP + + Switch + transaction-requests-service + + Switch + transaction-requests-service + + Payee FSP + + Payee FSP + + + Payee FSP requests the status of a transaction-request at the Payer FSP. + ID here is the ID of prevoiusly created transaction-request + + + 1 + GET /transactionRequests/{ID} + + + + + 2 + Validate GET /transactionRequests/{ID} + + + 3 + 202 Accepted + + + alt + [transaction-request query is valid] + + + + + 4 + Retrieve corresponding end-points for Payer FSP + + + Switch forwards GET /transactionRequests/{ID} request to Payer FSP + + + 5 + GET /transactionRequests/{ID} + + + 6 + 202 Accepted + + + + + 7 + Retrieve transaction-request + + + alt + [Payer FSP successfully retrieves transaction-request] + + + Payer FSP responds with the + PUT /transactionRequests/{ID} callback + + + 8 + PUT /transactionRequests/{ID} + + + 9 + 200 Ok + + + + + 10 + Validate PUT /transactionRequests/{ID} + + + alt + [response is ok] + + + Switch forwards transaction-request response to Payee FSP + + + + + 11 + Retrieve corresponding end-points for Payee FSP + + + 12 + PUT /transactionRequests/{ID} + + + 13 + 200 Ok + + [response invalid] + + + Switch returns error to Payer FSP + + + 14 + PUT /transactionRequests/{ID}/error + + + 15 + 200 Ok + + + Note that under this + scenario the Payee FSP + may not receive a response + + [Payer FSP is unable to retrieve the transaction-request] + + + Payer FSP returns error to Switch + + + 16 + PUT /transactionRequests/{ID}/error + + + 17 + 200 OK + + + Switch returns error to Payee FSP + + + 18 + PUT /transactionRequests/{ID}/error + + + 19 + 200 OK + + [transaction-request is invalid] + + + Switch returns error to Payee FSP + + + 20 + PUT /transactionRequests/{ID}/error + + + 21 + 200 OK diff --git a/docs/technical/technical/transaction-requests-service/assets/diagrams/sequence/trx-service-overview-spec.svg b/docs/technical/technical/transaction-requests-service/assets/diagrams/sequence/trx-service-overview-spec.svg index f2c99dbf..81ddcf16 100644 --- a/docs/technical/technical/transaction-requests-service/assets/diagrams/sequence/trx-service-overview-spec.svg +++ b/docs/technical/technical/transaction-requests-service/assets/diagrams/sequence/trx-service-overview-spec.svg @@ -1,7 +1,6 @@ - - + - + @@ -9,94 +8,94 @@ - - - - - - - - - Payer - FSP - - Optional - Switch - - Payee - FSP - - Payee - - - - - - - - I would like to receive - funds from +123456789 - - - - - Lookup +123456789 - (process not shown here) - - - - POST /transactionRequest/ - (Payee information, - transaction details) - - - - HTTP 202 - (Accepted) - - - - POST /transactionRequests/ - (Payee information, - transaction details) - - - - HTTP 202 - (Accepted) - - - - - Perform optional validation - - - - PUT /transactionRequests/ - <ID> - (Received status) - - - - HTTP 200 - (OK) - - - - PUT /transactionRequests/ - <ID> - (Received status) - - - - HTTP 200 - (OK) - - - - - Wait for either quote and - transfer, or rejected - transaction request by Payer + + + + + + + + + Payer + FSP + + Optional + Switch + + Payee + FSP + + Payee + + + + + + + + I would like to receive + funds from +123456789 + + + + + Lookup +123456789 + (process not shown here) + + + + POST /transactionRequest/ + (Payee information, + transaction details) + + + + HTTP 202 + (Accepted) + + + + POST /transactionRequests/ + (Payee information, + transaction details) + + + + HTTP 202 + (Accepted) + + + + + Perform optional validation + + + + PUT /transactionRequests/ + <ID> + (Received status) + + + + HTTP 200 + (OK) + + + + PUT /transactionRequests/ + <ID> + (Received status) + + + + HTTP 200 + (OK) + + + + + Wait for either quote and + transfer, or rejected + transaction request by Payer diff --git a/package-lock.json b/package-lock.json index a2bb540c..61a7096b 100644 --- a/package-lock.json +++ b/package-lock.json @@ -11,10 +11,10 @@ "devDependencies": { "@vuepress/plugin-back-to-top": "^1.9.10", "@vuepress/plugin-medium-zoom": "^1.9.10", - "got": "^14.4.4", - "husky": "^9.1.6", - "markdownlint-cli": "^0.42.0", - "npm-check-updates": "^17.1.10", + "got": "^14.4.5", + "husky": "^9.1.7", + "markdownlint-cli": "^0.43.0", + "npm-check-updates": "^17.1.14", "plantuml-encoder": "^1.4.0", "svgo": "^3.3.2", "vuepress": "^1.9.10", @@ -8769,18 +8769,6 @@ "url": "https://github.com/sponsors/ljharb" } }, - "node_modules/get-stdin": { - "version": "9.0.0", - "resolved": "https://registry.npmjs.org/get-stdin/-/get-stdin-9.0.0.tgz", - "integrity": "sha512-dVKBjfWisLAicarI2Sf+JuBE/DghV4UzNAVe9yhEJuzeREd3JhOTE9cUaJTeSa77fsbQUK3pcOpJfM59+VKZaA==", - "dev": true, - "engines": { - "node": ">=12" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, "node_modules/get-stream": { "version": "9.0.1", "resolved": "https://registry.npmjs.org/get-stream/-/get-stream-9.0.1.tgz", @@ -9011,11 +8999,10 @@ } }, "node_modules/got": { - "version": "14.4.4", - "resolved": "https://registry.npmjs.org/got/-/got-14.4.4.tgz", - "integrity": "sha512-tqiF7eSgTBwQkxb1LxsEpva8TaMYVisbhplrFVmw9GQE3855Z+MH/mnsXLLOkDxR6hZJRFMj5VTAZ8lmTF8ZOA==", + "version": "14.4.5", + "resolved": "https://registry.npmjs.org/got/-/got-14.4.5.tgz", + "integrity": "sha512-sq+uET8TnNKRNnjEOPJzMcxeI0irT8BBNmf+GtZcJpmhYsQM1DSKmCROUjPWKsXZ5HzwD5Cf5/RV+QD9BSTxJg==", "dev": true, - "license": "MIT", "dependencies": { "@sindresorhus/is": "^7.0.1", "@szmarczak/http-timer": "^5.0.1", @@ -9675,11 +9662,10 @@ "dev": true }, "node_modules/husky": { - "version": "9.1.6", - "resolved": "https://registry.npmjs.org/husky/-/husky-9.1.6.tgz", - "integrity": "sha512-sqbjZKK7kf44hfdE94EoX8MZNk0n7HeW37O4YrVGCF4wzgQjp+akPAkfUK5LZ6KuR/6sqeAVuXHji+RzQgOn5A==", + "version": "9.1.7", + "resolved": "https://registry.npmjs.org/husky/-/husky-9.1.7.tgz", + "integrity": "sha512-5gs5ytaNjBrh5Ow3zrvdUUY+0VxIuWVL4i9irt6friV+BqdCfmV11CQTWMiBYWHbXhco+J1kHfTOUkePhCDvMA==", "dev": true, - "license": "MIT", "bin": { "husky": "bin.js" }, @@ -10983,14 +10969,13 @@ "dev": true }, "node_modules/markdownlint": { - "version": "0.35.0", - "resolved": "https://registry.npmjs.org/markdownlint/-/markdownlint-0.35.0.tgz", - "integrity": "sha512-wgp8yesWjFBL7bycA3hxwHRdsZGJhjhyP1dSxKVKrza0EPFYtn+mHtkVy6dvP1kGSjovyG5B8yNP6Frj0UFUJg==", + "version": "0.36.1", + "resolved": "https://registry.npmjs.org/markdownlint/-/markdownlint-0.36.1.tgz", + "integrity": "sha512-s73fU2CQN7WCgjhaQUQ8wYESQNzGRNOKDd+3xgVqu8kuTEhmwepd/mxOv1LR2oV046ONrTLBFsM7IoKWNvmy5g==", "dev": true, - "license": "MIT", "dependencies": { "markdown-it": "14.1.0", - "markdownlint-micromark": "0.1.10" + "markdownlint-micromark": "0.1.12" }, "engines": { "node": ">=18" @@ -11000,23 +10985,21 @@ } }, "node_modules/markdownlint-cli": { - "version": "0.42.0", - "resolved": "https://registry.npmjs.org/markdownlint-cli/-/markdownlint-cli-0.42.0.tgz", - "integrity": "sha512-AjkzhhZa3TmEGi/CE2Wpmny69x1IrzqK2gPB0k8SmNMRgnSAJfyEO5FgZdWTHtJ6Nrdv5FWt5c4C5pkG6Dk30A==", + "version": "0.43.0", + "resolved": "https://registry.npmjs.org/markdownlint-cli/-/markdownlint-cli-0.43.0.tgz", + "integrity": "sha512-6vwurKK4B21eyYzwgX6ph13cZS7hE6LZfcS8QyD722CyxVD2RtAvbZK2p7k+FZbbKORulEuwl+hJaEq1l6/hoQ==", "dev": true, - "license": "MIT", "dependencies": { "commander": "~12.1.0", - "get-stdin": "~9.0.0", "glob": "~11.0.0", "ignore": "~6.0.2", "js-yaml": "^4.1.0", "jsonc-parser": "~3.3.1", "jsonpointer": "5.0.1", - "markdownlint": "~0.35.0", + "markdownlint": "~0.36.1", "minimatch": "~10.0.1", "run-con": "~1.3.2", - "smol-toml": "~1.3.0" + "smol-toml": "~1.3.1" }, "bin": { "markdownlint": "markdownlint.js" @@ -11119,11 +11102,10 @@ } }, "node_modules/markdownlint-micromark": { - "version": "0.1.10", - "resolved": "https://registry.npmjs.org/markdownlint-micromark/-/markdownlint-micromark-0.1.10.tgz", - "integrity": "sha512-no5ZfdqAdWGxftCLlySHSgddEjyW4kui4z7amQcGsSKfYC5v/ou+8mIQVyg9KQMeEZLNtz9OPDTj7nnTnoR4FQ==", + "version": "0.1.12", + "resolved": "https://registry.npmjs.org/markdownlint-micromark/-/markdownlint-micromark-0.1.12.tgz", + "integrity": "sha512-RlB6EwMGgc0sxcIhOQ2+aq7Zw1V2fBnzbXKGgYK/mVWdT7cz34fteKSwfYeo4rL6+L/q2tyC9QtD/PgZbkdyJQ==", "dev": true, - "license": "MIT", "engines": { "node": ">=18" }, @@ -11821,11 +11803,10 @@ } }, "node_modules/npm-check-updates": { - "version": "17.1.10", - "resolved": "https://registry.npmjs.org/npm-check-updates/-/npm-check-updates-17.1.10.tgz", - "integrity": "sha512-GnN6KbUzC8BpwsRYJntuumgCiagZ0+xxorvUJM9m06d7AlyK9lm3iFsAsnXF3VAZZzpD5QjZvWBwNze61Vywkw==", + "version": "17.1.14", + "resolved": "https://registry.npmjs.org/npm-check-updates/-/npm-check-updates-17.1.14.tgz", + "integrity": "sha512-dr4bXIxETubLI1tFGeock5hN8yVjahvaVpx+lPO4/O2md3zJuxB7FgH3MIoTvQSCgsgkIRpe0skti01IEAA5tA==", "dev": true, - "license": "Apache-2.0", "bin": { "ncu": "build/cli.js", "npm-check-updates": "build/cli.js" @@ -15180,11 +15161,10 @@ } }, "node_modules/smol-toml": { - "version": "1.3.0", - "resolved": "https://registry.npmjs.org/smol-toml/-/smol-toml-1.3.0.tgz", - "integrity": "sha512-tWpi2TsODPScmi48b/OQZGi2lgUmBCHy6SZrhi/FdnnHiU1GwebbCfuQuxsC3nHaLwtYeJGPrDZDIeodDOc4pA==", + "version": "1.3.1", + "resolved": "https://registry.npmjs.org/smol-toml/-/smol-toml-1.3.1.tgz", + "integrity": "sha512-tEYNll18pPKHroYSmLLrksq233j021G0giwW7P3D24jC54pQ5W5BXMsQ/Mvw1OJCmEYDgY+lrzT+3nNUtoNfXQ==", "dev": true, - "license": "BSD-3-Clause", "engines": { "node": ">= 18" }, diff --git a/package.json b/package.json index a43f2a51..d23ca409 100644 --- a/package.json +++ b/package.json @@ -5,7 +5,8 @@ "license": "Apache-2.0", "contributors": [ "Sam Kummary ", - "Uduak Obong-Eren " + "Uduak Obong-Eren ", + "Steven Oderayi " ], "repository": "https://www.github.com/mojaloop/documentation", "scripts": { @@ -22,10 +23,10 @@ "devDependencies": { "@vuepress/plugin-back-to-top": "^1.9.10", "@vuepress/plugin-medium-zoom": "^1.9.10", - "got": "^14.4.4", - "husky": "^9.1.6", - "markdownlint-cli": "^0.42.0", - "npm-check-updates": "^17.1.10", + "got": "^14.4.5", + "husky": "^9.1.7", + "markdownlint-cli": "^0.43.0", + "npm-check-updates": "^17.1.14", "plantuml-encoder": "^1.4.0", "svgo": "^3.3.2", "vuepress": "^1.9.10",