```mermaid sequenceDiagram participant User participant PaymentService participant PaymentGateway participant Database %% Normal Flow User->>PaymentService: Initiate Payment PaymentService->>Database: Store Transaction Database-->>PaymentService: Transaction Stored PaymentService->>PaymentGateway: Process Payment PaymentGateway-->>PaymentService: Payment Success PaymentService->>Database: Update Transaction Status Database-->>PaymentService: Transaction Updated PaymentService-->>User: Payment Success %% External Failure Flow User->>PaymentService: Initiate Payment PaymentService->>Database: Store Transaction Database-->>PaymentService: Transaction Stored PaymentService->>PaymentGateway: Process Payment PaymentGateway-->>PaymentService: Payment Failure PaymentService->>Database: Rollback Transaction Database-->>PaymentService: Transaction Rolled Back PaymentService-->>User: Payment Failure %% DB Failure Flow User->>PaymentService: Initiate Payment PaymentService->>Database: Store Transaction Database-->>PaymentService: Transaction Store Failure PaymentService-->>User: Payment Failure %% Commit & Rollback Note over User, PaymentService: commit --> PaymentService rollback --> PaymentService ```