@startuml P2P - Receive Non-Disclosing

'--------------------Skin Parameters----------------------'
skinparam SequenceMessageAlign center
skinparam ArrowFontSize 8
skinparam NoteFontSize 9
skinparam Style strictuml
skinparam ArrowColor Black
skinparam ParticipantPadding 20

!define MMAPICOLOR Red
!define SWITCHAPICOLOR Orange
!define SPAPICOLOR Green
!define USSDAPICOLOR Blue
!define FPXAPICOLOR Purple

skinparam sequence {
'ParticipantBackgroundColor DodgerBlue
ParticipantFontSize 12
ActorFontSize 12
ParticipantBorderColor Black
ParticipantBackgroundColor Gainsboro
ActorBorderColor Black
ActorBackgroundColor Gainsboro
LifeLineBorderColor Black
LifeLineBackgroundColor Gray
EntityBorderColor Black
EntityBackgroundColor White
}

'----------------Constant String Values-------------------'
!$postq = "**POST/quotes**"
!$putq = "**PUT/quotes**"
!$postt = "**POST/transfers**"
!$putt = "**PUT/transfers**"
!$http202 = "**HTTP 202** (Accepted)"
!$http200 = "**HTTP 200** (OK)"
!$am = "amount"
!$amType = "amountType"
!$transAm ="transferAmount"
!$payeeRA = "payeeReceiveAmount"
!$mmo2com = "mmo2Commission"

'----------------Participant Parameters-------------------'
actor Payer order 1
participant "MMO 1" as mmo1 order 2
participant "Mojaloop" as Switch order 3
participant "MMO 2" as mmo2 order 5
actor Payee order 6

'------------------Sequence Messages----------------------'
'---------------------------------------------------------'

Payer -> mmo1: I would like Payee \n to receive 100 USD
activate mmo1
mmo1 -> Switch: $postq\n$amType=RECEIVE,\n$am=100)
activate Switch
mmo1 <-- Switch: $http202
Switch -> mmo2: $postq\n($amType=RECEIVE,\n$am=100)
activate mmo2
Switch <-- mmo2: $http202
mmo2 -> mmo2: Commission is 1 USD in\nPayee FSP for P2P
Switch <- mmo2: $putq///<ID>//\n$transAm=99 USD,\n$payeeRA=100 USD,\n$mmo2com=1 USD)
Switch --> mmo2: $http200
deactivate mmo2
mmo1 <-- Switch: $putq///<ID>//\n$transAm=99 USD,\n$payeeRA=100 USD,\n$mmo2com=1 USD)
mmo1 --> Switch: $http200
deactivate Switch 
mmo1 -> mmo1: Payer FSP keeps commission\nas fee, Payer should also pay\nfee of 1 USD
Payer <- mmo1: Transferirg 100USD to Payee \n will cost you 101 USD \n including fees        
deactivate mmo1


Payer -> mmo1: Perform Transaction
activate mmo1
mmo1 -> mmo1: Reserve 99 USD from Payer FSP\naccount to Payee FSP account
mmo1 -> Switch: $postt\n($am=99 USD)
activate Switch
mmo1 <-- Switch: $http202
Switch -> Switch: Reserve 99 USD from Payer FSP\naccount to Payee FSP account
Switch -> mmo2: $postt\n($am=99 USD)
activate mmo2
Switch <-- mmo2:  $http202
mmo2 -> mmo2: Transfer 99 USD from Switch\naccount and 1 USD from\ncomission account\nto Payee account
mmo2 -> Payee: You have received 100 USD\nfrom Payer
Switch <- mmo2: $putt///<ID>//
Switch --> mmo2: $http200
deactivate mmo2
Switch -> Switch: Commit reserved transfer
mmo1 <- Switch: $putt///<ID>//
mmo1 --> Switch: $http200
deactivate Switch
Payer <- mmo1: Transaction successful,\nyou have paid 1 USD in fee
deactivate mmo1


@enduml