- 
                Notifications
    You must be signed in to change notification settings 
- Fork 113
feat: migrate central settlement service docs #361
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
          
     Open
      
      
            meekg33k
  wants to merge
  1
  commit into
  master
  
    
      
        
          
  
    
      Choose a base branch
      
     
    
      
        
      
      
        
          
          
        
        
          
            
              
              
              
  
           
        
        
          
            
              
              
           
        
       
     
  
        
          
            
          
            
          
        
       
    
      
from
feat/migrate-tech-central-settlement-srv-docs
  
      
      
   
  
    
  
  
  
 
  
      
    base: master
Could not load branches
            
              
  
    Branch not found: {{ refName }}
  
            
                
      Loading
              
            Could not load tags
            
            
              Nothing to show
            
              
  
            
                
      Loading
              
            Are you sure you want to change the base?
            Some commits from the old base branch may be removed from the timeline,
            and old review comments may become outdated.
          
          
  
     Open
                    Changes from all commits
      Commits
    
    
  File filter
Filter by extension
Conversations
          Failed to load comments.   
        
        
          
      Loading
        
  Jump to
        
          Jump to file
        
      
      
          Failed to load files.   
        
        
          
      Loading
        
  Diff view
Diff view
There are no files selected for viewing
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
              
              Empty file.
          
    
        
          
  
    
      
          
            24 changes: 24 additions & 0 deletions
          
          24 
        
  website/versioned_docs/v1.0.1/technical/central-settlements/README.md
  
  
      
      
   
        
      
      
    
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
              | Original file line number | Diff line number | Diff line change | 
|---|---|---|
| @@ -0,0 +1,24 @@ | ||
| # Central-Settlements Service | ||
|  | ||
| The Central Settlements service is part of the Mojaloop project and deployment. | ||
|  | ||
| * The central settlements service exposes Settlement API to manage the settlements between FSPs and the Central Hub. | ||
| * The service manages Settlement Windows and Settlements Event Triggers and provides information about FSPs accounts and settlements. | ||
|  | ||
| ## 1. Settlement Process Design | ||
|  | ||
| ### 1.1. Architecture overview | ||
|  | ||
|  | ||
|  | ||
| ## 2. Funds In/Out | ||
|  | ||
| Record Funds In and Record Funds Out operations are used respectively to deposit and withdraw funds into participant SETTLEMENT ledgers. The balance of the SETTLEMENT account relates to the NET_DEBIT_CAP set by the switch for every participant of the scheme. NET_DEBIT_CAP value is always lower or equal to the SETTLEMENT value. On the other side, the balance of the participant's POSITION account is limited to the value of the NET_DEBIT_CAP. | ||
|  | ||
| ## 3. API Specification | ||
|  | ||
| Refer to **Central Settlements API** in the [API Specifications](../../api/README.md#central-settlements-api) section. | ||
|  | ||
| ## 4. Rules Engine | ||
|  | ||
| The rules engine is separate handler within the Central-Settlement handler, that can be deployed if needed. Rules format and way of operation can be found on [Rules Handler . Interchange fees example. File format.](./settlement-process/rules-handler-consume.md) | ||
              Empty file.
          
    
        
          
  
    
      
          Binary file added
          
            BIN
              
                +180 KB
              
          
        
  ...ed_docs/v1.0.1/technical/central-settlements/assets/diagrams/Settlement_ERD.png
  
  
      
      
   
        
      
      
    
      
      Loading
      
  Sorry, something went wrong. Reload?
      Sorry, we cannot display this file.
      Sorry, this file is invalid so it cannot be displayed.
      
    
        
          
  
    
      
          
            3 changes: 3 additions & 0 deletions
          
          3 
        
  ...tral-settlements/assets/diagrams/architecture/Arch-Mojaloop-Settlements-PI4.svg
  
  
      
      
   
        
      
      
    
      
      Loading
      
  Sorry, something went wrong. Reload?
      Sorry, we cannot display this file.
      Sorry, this file is invalid so it cannot be displayed.
      
    
        
          
  
    
      
          
            27 changes: 27 additions & 0 deletions
          
          27 
        
  website/versioned_docs/v1.0.1/technical/central-settlements/funds-in-out/README.md
  
  
      
      
   
        
      
      
    
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
              | Original file line number | Diff line number | Diff line change | 
|---|---|---|
| @@ -0,0 +1,27 @@ | ||
| # Funds In / Out | ||
|  | ||
| ## 1. Sequence diagrams | ||
|  | ||
| ### 1.1. Reconciliation Transfer Prepare | ||
|  | ||
| - [Sequence Diagram for Reconciliation Transfer Prepare sub-process](reconciliation-transfer-prepare.md) | ||
|  | ||
| ### 1.2. Transfer State and Position Change | ||
|  | ||
| - [Sequence Diagram for Transfer State and Position Change Prepare sub-process](transfer-state-and-position-change.md) | ||
|  | ||
| ### 1.3. Funds In - Prepare, Reserve, Commit | ||
|  | ||
| - [Sequence Diagram for Funds In](funds-in-prepare-reserve-commit.md) | ||
|  | ||
| ### 1.4. Funds Out - Prepare & Reserve | ||
|  | ||
| - [Sequence Diagram for Funds Out Prepare & Reserve](funds-out-prepare-reserve.md) | ||
|  | ||
| ### 1.5. Funds Out - Commit | ||
|  | ||
| - [Sequence Diagram for Funds Out Commit](funds-out-commit.md) | ||
|  | ||
| ### 1.6. Funds Out - Abort | ||
|  | ||
| - [Sequence Diagram for Funds Out Abort](funds-out-abort.md) | 
        
          
  
    
      
          
            127 changes: 127 additions & 0 deletions
          
          127 
        
  ...-out/assets/diagrams/sequence/seq-recfunds-5.1.0.a-reconciliationTransferPrepare.plantuml
  
  
      
      
   
        
      
      
    
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
              | Original file line number | Diff line number | Diff line change | 
|---|---|---|
| @@ -0,0 +1,127 @@ | ||
| /'***** | ||
| 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 <email>. | ||
| * Gates Foundation | ||
| - Name Surname <[email protected]> | ||
|  | ||
| * Georgi Georgiev <[email protected]> | ||
| -------------- | ||
| ******'/ | ||
|  | ||
| @startuml | ||
| ' declate title | ||
| title 5.1.0.a. Reconciliation transfer prepare (reconciliationTransferPrepare) | ||
|  | ||
| autonumber | ||
|  | ||
| ' Actor Keys: | ||
| ' boundary - APIs/Interfaces, etc | ||
| ' collections - Kafka Topics | ||
| ' control - Kafka Consumers | ||
| ' entity - Database Access Objects | ||
| ' database - Database Persistance Store | ||
|  | ||
| ' declare actors | ||
| entity "Transfer DAO" as TRANSFER_DAO | ||
| database "Central Store" as DB | ||
|  | ||
| box "Central Service" #LightYellow | ||
| participant TRANSFER_DAO | ||
| participant DB | ||
| end box | ||
|  | ||
| ' start flow | ||
| group reconciliationTransferPrepare (payload, trx) | ||
| TRANSFER_DAO -> DB: Insert transferDuplicateCheck | ||
| activate DB | ||
| deactivate DB | ||
| hnote over DB #lightyellow | ||
| INSERT INTO **transferDuplicateCheck** (transferId, hash, createdDate) | ||
| VALUES ({payload.transferId}, hashCode({payload.transferId}), {transactionTimestamp}) | ||
| end hnote | ||
|  | ||
| TRANSFER_DAO -> DB: Insert transfer | ||
| activate DB | ||
| deactivate DB | ||
| hnote over DB #lightyellow | ||
| INSERT INTO **transfer** (transferId, amount, currencyId, | ||
| ilpCondition, expirationDate, createdDate) | ||
| VALUES ({payload.transferId}, {payload.amount.amount}, | ||
| {payload.amount.curency}, 0, | ||
| {new Date()+Config.INTERNAL_TRANSFER_VALIDITY_SECONDS}, | ||
| {transactionTimestamp}) | ||
| end hnote | ||
|  | ||
| TRANSFER_DAO -> DB: Retrieve hub reconciliation account | ||
| activate DB | ||
| hnote over DB #lightyellow | ||
| SELECT participantCurrencyId AS reconciliationAccountId | ||
| FROM **participantCurrency** | ||
| WHERE participantId = 1 | ||
| AND currencyId = {payload.amount.currency} | ||
| LIMIT 1 | ||
| end hnote | ||
| deactivate DB | ||
| TRANSFER_DAO <-- DB: Return **reconciliationAccountId** | ||
|  | ||
| alt payload.action == 'RECORD_FUNDS_IN' | ||
| note right of TRANSFER_DAO #lightgray | ||
| **ledgerEntryTypeId** = 'RECORD_FUNDS_IN' | ||
| **amount** = <color #blue>payload.amount.amount</color> | ||
| end note | ||
| else payload.action == 'RECORD_FUNDS_OUT_PREPARE' | ||
| note right of TRANSFER_DAO #lightgray | ||
| **ledgerEntryTypeId** = 'RECORD_FUNDS_OUT' | ||
| **amount** = <color #red>-payload.amount.amount</color> | ||
| end note | ||
| end | ||
|  | ||
| TRANSFER_DAO -> DB: Insert transferParticipant records | ||
| activate DB | ||
| deactivate DB | ||
| hnote over DB #lightyellow | ||
| INSERT INTO **transferParticipant** | ||
| (transferId, participantCurrencyId, transferParticipantRoleTypeId, | ||
| ledgerEntryTypeId, amount, createdDate) | ||
| VALUES (payload.transferId, reconciliationAccountId, 'HUB', | ||
| {ledgerEntryTypeId}, {amount}, {transactionTimestamp}) | ||
|  | ||
| INSERT INTO **transferParticipant** | ||
| (transferId, participantCurrencyId, transferParticipantRoleTypeId, | ||
| ledgerEntryTypeId, amount, createdDate) | ||
| VALUES ({payload.transferId}, {payload.participantCurrencyId}, 'DFSP_SETTLEMENT', | ||
| {ledgerEntryTypeId}, {-amount}, {transactionTimestamp}) | ||
| end hnote | ||
|  | ||
| TRANSFER_DAO -> DB: Insert transferStateChange record | ||
| activate DB | ||
| deactivate DB | ||
| hnote over DB #lightyellow | ||
| INSERT INTO **transferStateChange** | ||
| (transferId, transferStateId, reason, createdDate) | ||
| VALUES ({payload.transferId}, 'RECEIVED_PREPARE', | ||
| {payload.reason}, {transactionTimestamp}) | ||
| end hnote | ||
|  | ||
| TRANSFER_DAO -> DB: Save externalReference and extensions | ||
| activate DB | ||
| deactivate DB | ||
| hnote over DB #lightyellow | ||
| transferExtension | ||
| end hnote | ||
| end | ||
| @enduml | 
      
      Oops, something went wrong.
        
    
  
  Add this suggestion to a batch that can be applied as a single commit.
  This suggestion is invalid because no changes were made to the code.
  Suggestions cannot be applied while the pull request is closed.
  Suggestions cannot be applied while viewing a subset of changes.
  Only one suggestion per line can be applied in a batch.
  Add this suggestion to a batch that can be applied as a single commit.
  Applying suggestions on deleted lines is not supported.
  You must change the existing code in this line in order to create a valid suggestion.
  Outdated suggestions cannot be applied.
  This suggestion has been applied or marked resolved.
  Suggestions cannot be applied from pending reviews.
  Suggestions cannot be applied on multi-line comments.
  Suggestions cannot be applied while the pull request is queued to merge.
  Suggestion cannot be applied right now. Please check back later.
  
    
  
    
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.