# Unblock Integration

## Use Cases

### KYC Verification

@startuml  
skinparam ParticipantPadding 30  
skinparam BoxPadding 30  
skinparam noteFontColor #FFFFFF  
skinparam noteBackgroundColor #1C1E3F  
skinparam noteBorderColor #1C1E3F  
skinparam noteBorderThickness 1  
skinparam sequence {  
ArrowColor #1C1E3F  
ArrowFontColor #1C1E3F  
ActorBorderColor #1C1E3F  
ActorBackgroundColor #FFFFFF  
ActorFontStyle bold  
ParticipantBorderColor #1C1E3F  
ParticipantBackgroundColor #1C1E3F  
ParticipantFontColor #FFFFFF  
ParticipantFontStyle bold  
LifeLineBackgroundColor #1C1E3F  
LifeLineBorderColor #1C1E3F  
}  
autonumber  
actor "Partner-User" as user  
participant Verestro as ver  
participant Unblock as unblock  
user -&gt; ver: perform KYC  
note left: Process not fully described\\nshows only where unique code comes from  
ver -&gt; unblock: POST /user/create  
unblock --&gt; ver: response(uniqueCode)  
ver -&gt; ver: storeUniqueCode  
@enduml


<span style="text-decoration: underline;">**Key information:**</span>

- Unblock creates uniqueCode for user
- Verestro will strore this uniqueCode to provide later for partner's users
- At this stage there is only one uniqueCode created on Unblock side and stored on Verestro
- To distinguish verification and normal transfers Verestro and Unblock agreed to following: 
    - Verestro will add **<span style="color: rgb(224, 62, 45);">-VERIF</span>** postfix to uniqueCode and provide it to partner's users
- **<span style="color: rgb(224, 62, 45);">Format of uniqueCode is V-UB-U-000001 which means following regexp ^V-UB-U-\\d{6}$</span>**

###   
Transfer

@startuml  
skinparam ParticipantPadding 30  
skinparam BoxPadding 30  
skinparam noteFontColor #FFFFFF  
skinparam noteBackgroundColor #1C1E3F  
skinparam noteBorderColor #1C1E3F  
skinparam noteBorderThickness 1  
skinparam sequence {  
ArrowColor #1C1E3F  
ArrowFontColor #1C1E3F  
ActorBorderColor #1C1E3F  
ActorBackgroundColor #FFFFFF  
ActorFontStyle bold  
ParticipantBorderColor #1C1E3F  
ParticipantBackgroundColor #1C1E3F  
ParticipantFontColor #FFFFFF  
ParticipantFontStyle bold  
LifeLineBackgroundColor #1C1E3F  
LifeLineBorderColor #1C1E3F  
}  
autonumber  
actor "Partner-User" as user  
participant Verestro as ver  
participant Unblock as unblock  
participant "Unblock-Bank" as unbank  
...Make transfer...  
user -&gt; ver: getTransferInfo  
ver --&gt; user: response:\\n(accountNumber\\ntransferCode=V-UB-U-000001\\nverificationCode=V-UB-U-000001-verif)  
user -&gt; unbank: transfer  
unblock-&gt;unbank: getTransfers  
unblock -&gt; unblock: creditMB  
unblock -&gt; unblock: recognizeDestination\\nVERIFICATION: recognized by postfix -verif\\nINDIVIDUAL: has unique code\\nMASTER\_BALANCE: other  
unblock -&gt; ver: notify:\\n/secure/financial-institution/notifications/receivings  
ver -&gt; ver: queueGetTransfers  
ver --&gt; unblock: response  
...Get Transfers...  
ver -&gt; unblock: getTransfers(accountNumber, lastId?)  
unblock --&gt;ver: response(transfers)  
...Process transfer...  
ver -&gt; ver: recognizeTransfer  
alt hasUniqueCode  
ver -&gt; ver:checkAml  
alt accepted  
ver -&gt; ver: creditMBAndUserBalance  
note right: Verestro will take first balance in given currency for credit user balance  
ver -&gt; unblock: notify(type=masterBalanceCredit)  
unblock -&gt; unblock: ignoreMBCredit  
else rejected  
ver -&gt; unblock: refund  
unblock -&gt; unblock: debitMB  
note right: Someone from unblock manually refund transfer to user  
end  
else  
alt isForMasterBalance  
ver -&gt; ver: creditMB  
ver -&gt; unblock: notify(type=masterBalanceCredit)  
unblock -&gt; unblock: ignoreMBCredit  
else unrecognized destination  
ver -&gt; unblock: refund  
unblock -&gt; unblock: debitMB  
note right: Someone from unblock manually refund transfer to user  
end  
end  
@enduml

### Key Information

- Verestro exposes transferCode=uniqueCode and verificationCode=uniqueCode-verif with accountNumber to partner's users
- Unblock gets transfer from account number dedicated for partner
- Every deposit transfer will be credited on MB on Unblock side  
    
    - In scenario when Verestro will be processing this transfer there will be difference between MB on Verestro side and Unblock side(Unblock will have grater MB). This is acceptable because Verestro check MB on own side before sending request to Unblock so there is no risk that someone will withdraw money that can be refunded in some time
- Unblock will send notification to Verestro after every transfer. Will call api described in [Transfer Notification](https://developer.verestro.com/books/unblock-GlM/page/verestro-notification)
- Verestro will call [Proposed Get Transfers](#bkmrk-proposed-get-transfe) and retrieve transfers 
    - **<span style="color: rgb(224, 62, 45);">IMPORTANT: Transfers from Unblock are returned in order from oldest to newest. This will allow to incrementally download next transfers which are not stored on Verestro side</span> <span style="color: rgb(224, 62, 45);">E.g:</span>**
        - GET /transfers - first call. Sample response:  
            
            - <table border="1" style="border-collapse: collapse; width: 100.026%; height: 59.5938px;"><colgroup><col style="width: 49.9244%;"></col><col style="width: 49.9244%;"></col></colgroup><tbody><tr style="height: 29.7969px;"><td style="height: 29.7969px;">**id - transfer id**</td><td style="height: 29.7969px;">timestamp - transfer timestamp</td></tr><tr style="height: 29.7969px;"><td style="height: 29.7969px;">1</td><td style="height: 29.7969px;">14.06.2026</td></tr></tbody></table>
        - Get /transfers?lastId=1 - next call will return only newer transfers than lastId=1. Sample response: 
            - <table border="1" style="border-collapse: collapse; width: 100.026%;"><colgroup><col style="width: 49.9244%;"></col><col style="width: 49.9244%;"></col></colgroup><tbody><tr><td>**id - transfer id**</td><td>timestamp - transfer timestamp</td></tr><tr><td>2</td><td>15.06.2026</td></tr></tbody></table>
- In case where transfer has to returned to sender. Verestro will call proper api which will be prepared by Unblock 
    - The refund will debit MB on Unblock side since previously it was credited
    - Some employee from Unblock will make proper refund using bank
- Unblock will ignore transactionType from notificai

## Documentations

### Unblock 

#### Received

Documentation received from Unblock is:

- [Users](https://developer.verestro.com/books/unblock-GlM/page/unblock-documentation)
- [Transfers](https://developer.verestro.com/books/unblock-GlM/page/unblock-transfers-documentation)
- [Signature](https://developer.verestro.com/books/unblock-GlM/page/unblock-signature-generation)

#### Proposed Get Transfers

@swagger="https://s3.verestro.com/products-documentation-public/unblock/unblock\_get\_transfers.yaml"

<div id="bkmrk--1"></div>