---
# System prepended metadata

title: TIR GROUPE - new flow

---

## TIR GROUPE - new flow
```mermaid
sequenceDiagram

participant USER
participant WSRG
participant TIR GROUPE(TG)
participant DB

USER ->> WSRG: Redeem
note over WSRG: input:barcode
WSRG ->> WSRG: Check if it is a TG card
alt Is TG card
    WSRG ->> TIR GROUPE(TG): Check if it is redeemable
    TIR GROUPE(TG) -->> WSRG: API response
    alt Is redeemable
        alt Card does not exist
            WSRG ->> DB: Import Card
            DB -->> WSRG: Import card sucessfully?
            alt fail
                WSRG -->> USER: err
            end
        end
        WSRG ->> DB : Redeem (retry 3 times if fail)
        DB -->> WSRG: Redeem response
        alt sucess
            WSRG -->> USER: Sucess message
        else fail
            WSRG -->> USER: err
            WSRG ->> DB: Void redeem (retry 3 times if fail)
            DB -->> WSRG: Void response
            alt fail
                WSRG ->> DB: Send alert
            end
        end
    end
end

