gsmainclusivetechlab / token-backend

Tokenisation Project - Backend Services
https://token.gsmainclusivetechlab.io
MIT License
0 stars 0 forks source link

UC5 - Customer Initiated Merchant Payment #32

Closed claudiotx closed 7 months ago

claudiotx commented 2 years ago

https://momodeveloper.mtn.com/api-documentation/use-cases/

Create sequence diagram

participant Customer
participant Agent
participant Engine
participant MMO
participant Token Generator

Customer->Engine: SMS/USSD CASH_IN \nSMS/USSD CASH_OUT

Engine->MMO:GET accounts/msisdn/:phoneNumber/accountname
alt Account exists
Engine<--MMO:HTTP 200 (user info)
Engine->Token Generator:GET tokens/:phoneNumber
Engine<--Token Generator:HTTP 200 (token)
Agent<-Engine:POST /operations/notification
Agent->Engine:POST /operation
Agent<--Engine:HTTP 200
alt Operation accepted
Engine->MMO:POST transactions/type/deposit \nPOST transactions/type/withdraw
MMO->Customer:REQUEST PIN 
Customer->MMO:SEND PIN 
Engine<--MMO:HTTP 200
MMO->Engine:PUT /hooks/mmo/cash-in \nPUT /hooks/mmo/cash-out
Agent<-Engine:NOTIFICATION
Customer<-Engine:NOTIFICATION
else Operation denied
Agent<-Engine:NOTIFICATION
Customer<-Engine:NOTIFICATION
end

else Account doesn't exist
Engine<--Token Generator:HTTP 404
Customer<--Engine:HTTP 404
RuiDevAltar commented 2 years ago

UC5

participant Customer
participant Merchant
participant Engine
participant MMO

Customer->Engine: SMS/USSD PAYMENT

Engine->MMO:GET accounts/msisdn/:phoneNumber/accountname
alt Account exists
Engine<--MMO:HTTP 200 (user info)
Engine->MMO:POST transactions/type/merchantpay

alt Without open payment 
Engine<--MMO:HTTP 200
Engine->Customer:Notification - Request PIN
Engine<-Customer:SMS - Send PIN
Engine->MMO:POST Validate PIN

alt Valid PIN

MMO->Engine:PUT /hooks/mmo/merchantpay
Merchant<-Engine:NOTIFICATION
Customer<-Engine:NOTIFICATION

else Invalid PIN
Customer<-Engine:NOTIFICATION - Wrong Pin
end

else With open payment
Engine<--MMO:HTTP ERROR
Customer<-Engine:NOTIFICATION - Can't have more than one open payment
end

else Account doesn't exist
Engine<--MMO:HTTP 404
Customer<--Engine:HTTP 404
end