Sobes.tech
Senior

Draw a sequence diagram of the cash withdrawal process in an ATM with participants: client, ATM, account management service. Include successful and alternative scenarios.

sobes.tech AI

Answer from AI

mermaid sequenceDiagram participant Client participant ATM participant AccountManagementService

Client->>ATM: Inserts card and enters PIN
ATM->>AccountManagementService: Checks PIN
alt PIN correct
    AccountManagementService-->>ATM: Confirmation
    ATM->>Client: Requests withdrawal amount
    Client->>ATM: Enters amount
    ATM->>AccountManagementService: Requests to debit amount
    alt Sufficient funds
        AccountManagementService-->>ATM: Debit confirmation
        ATM->>Client: Dispenses cash
        ATM->>Client: Prints receipt
    else Insufficient funds
        AccountManagementService-->>ATM: Error - insufficient funds
        ATM->>Client: Error message
    end
else PIN incorrect
    AccountManagementService-->>ATM: PIN error
    ATM->>Client: Error message
end
Client->>ATM: Removes card