Rental Approval Flow
Diagram v9.3.2024
Section titled “Diagram v9.3.2024”(click to open at actual size)
Source Code
Section titled “Source Code”Rental Approval Flow Diagram Source
-- render at https://sequencediagram.orgentryspacing 0.7frame #lightblue Rental Approval Flow 9/3/2024
participantspacing 2entryspacing 0.5bottomparticipants
actor "Customer" as customer #orangelifelinestyle customer #lightgray:1:solid
participant "Louvelle Backend" as backend #D35DC5lifelinestyle backend #lightgray:1:solid
participant "Stripe" as stripe #lightgreenlifelinestyle stripe #lightgray:1:solid
database "Rentals Table" as rentals #lightgreenlifelinestyle rentals #lightgray:1:solid
database "Items Table" as items #lightbluelifelinestyle items #lightgray:1:solid
participant "Rentals Logs" as rlogs #lightgreenlifelinestyle rlogs #lightgray:1:solid
actor "Owner" as owner #orangelifelinestyle owner #lightgray:1:solid
participant "Event Bus" as bus #lightbluelifelinestyle bus #lightgray:1:solid
customer -> backend:Request Rental<color #gray>Item ID, Dates, Price</color>
backend -> stripe:Request Authorization
# FAILURE
alt FAILUREstripe --#red> backend:<color #red>Denied</color>parallelbackend --> rlogs:Log Authorization Failurebackend --#red> customer:<color #red>Denied</color>parallel endactivate rlogsdeactivateafter rlogsbox over customer:<color #red>Error Message</color>
# SUCCESS
else SUCCESSstripe --#green> backend:<color #green>Success</color>parallelbackend --> rlogs:Log Authorization Successparallel endbackend -> rentals: Store Transaction Authorizationactivate rentalsdeactivateafter rentals
backend -> items:Request Item Detailsactivate itemsitems --> backend: Item Detailsdeactivateafter items
alt CONCIERGE ITEMbox over backend:<color #0273bb>CONCIERGE ITEMbackend -> rentals:Create Rental Record <color #gray>status: approved, NOT settled
activate rentalsdeactivateafter rentalsbackend --> rlogs:Log Rental Recordbackend -> stripe:Settle Payment
# settle payment
alt Settledparallelbox over stripe:<color #green>SETTLED</color>stripe -> backend:parallel endbackend -> rentals:Update Rental Record <color #gray>status: approved, settledactivate rentalsdeactivateafter rentals
backend --> rlogs:Log Payment Settled
backend --#green> customer:<color #green>Rental Approved</color>box over customer:<color #green>Rental Approved</color>backend -> bus:Create Timed Rental Event <color #gray>( Date / Time, item ID, rental ID )aboxright over bus:<color #0273bb>NEW RENTAL:<color #gray>Start Date, Rental ID,Item ID, Destinationbackend --> rlogs:Log Rental Event Created
else Not Settledparallelbox over stripe:<color #red>NOT SETTLED</color>stripe -> backend:parallel endbackend --> rlogs:Log Payment Not Settled
backend -#red> customer:<color #red>Payment Issue</color>rbox over customer:<color #red>Payment Issue</color>end
else PEER TO PEER ITEMbox over backend:<color #0273bb>PEER-TO-PEER ITEMbackend -> rentals:Create Rental Record <color #gray>status: pendingactivate rentalsdeactivateafter rentalsbackend --#gray> customer:<color #gray>Rental Pending</color>box over customer:<color #gray>Rental Waiting For Approval</color>backend -> owner:NOTIFICATION: Pending Rentalsnote over owner:<color #0273bb>"You have rentalswaiting for approval!"alt APPROVEDparallelrbox over owner:<color #green>APPROVED</color>owner -> backend:parallel endbackend --> rlogs:Log Rental Approved
backend -> rentals:Request Rental Recordactivate rentalsrentals --> backend: Rental Recorddeactivateafter rentalsspacebackend -> stripe:Settle Payment <color #gray>Transaction ID, Amount, etcspace
# settle payment
alt SETTLEDparallelbox over stripe:<color #green>SETTLED</color>stripe -> backend:parallel endbackend --> rlogs:Log Payment Settledbackend -> rentals:Update Rental Record <color #gray>status: approved, settledactivate rentalsdeactivateafter rentalsbackend -#green> customer:<color #green>NOTIFICATION: Rental Approved</color>note over customer:<color #green>"Rental of Item 123has been approved"</color>backend -> bus:Create Timed Rental Event <color #gray>( Date / Time, item ID, rental ID )aboxright over bus:<color #0273bb>NEW RENTAL:<color #gray>Start Date, Rental ID,Item ID, Destinationbackend --> rlogs:Log Rental Event Created
else NOT SETTLEDparallelbox over stripe:<color #red>NOT SETTLED</color>stripe -> backend:parallel endbackend --> rlogs:Log Payment Not Settled
backend -#red> customer:<color #red>NOTIFICATION: Payment Issue</color>note over customer:<color #red>"Payment Issue"<color #gray>Link to Support</color>end
backend -> rentals
else NOT APPROVEDparallelrbox over owner:<color #red>NOT APPROVED</color>owner -> backend:parallel endbackend --> rlogs:Log Rental Not Approved
backend -#red> customer:<color #red>NOTIFICATION: Not Approved</color>note over customer:<color #red>"Not Approved"<color #gray>Link to Support</color>endendend