---
# System prepended metadata

title: Popaket CMS

---

# Popaket CMS

## Register with Phone Number

```plantuml
actor user
participant "CMS" as cms
participant "Auth Service" as auth
participant "User Service" as userService
database "popaket_auth" as dbAuth
database "popaket_user" as dbUser

user -> cms : Register
cms -> auth : check account by msisdn
auth -> dbAuth: select users by msisdn & deleted_at is null

alt account not found
    dbAuth --> auth: null
    auth --> cms : account not found
    cms -> auth : v1/register
    auth -> auth : is user verified?
    alt user verified
        auth --> cms : user_id verified & registered
    else
        auth -> dbAuth: insert into **users**
        dbAuth --> auth: new user_id
        auth -> dbAuth: insert into **user_authentications**
        auth -> userService : create user `/v1/create`
        userService -> dbUser : insert into **user**
        dbUser --> userService : sucess insert
        userService -> auth : status: 201
        auth -> cms : Success register new user
        cms -> user : show dialog OTP method
        alt "Send OTP Miscall"
            user -> cms : Choose Miscall
            cms -> auth : send miscall OTP - `v1/send/miscall`
            auth -> auth : encrypt msisdn
            auth -> dbAuth : get **users** by msisdn
            dbAuth --> auth : return `id, name, msisdn, etc`
            auth --> cms : success request miscall
            cms --> user: Miscall telah dikirimkan
            user -> cms : Input OTP
            cms -> auth : v1/login-otp
            cms -> auth : send WA OTP - `/v1/send/wa-otp`
            
            cms -> auth : send SMS OTP - `/v1/send/sms-otp`

            alt invalid otp code
                auth --> cms : invalid otp code 
            else valid otp
                cms -> auth: login-otp `v1/login-otp`
                auth -> cms: Success login
                cms -> user: Dashboard opened
            end
        else "Send OTP SMS"
            user -> cms : Choose SMS
            cms -> auth : send SMS OTP - `/v1/send/sms-otp`
            auth --> cms : success request sms
            cms --> user: SMS telah dikirimkan
            user -> cms : Input OTP
            cms -> auth : v1/login-otp
            
            
            alt invalid otp code
                auth --> cms : invalid otp code 
            else valid otp
                cms -> auth: login-otp `v1/login-otp`
                auth -> cms: Success login
                cms -> user: Dashboard opened
            end
        else "Send OTP WA"
            user -> cms : Choose WA
            cms -> auth : send WA OTP - `/v1/send/wa-otp`
            auth --> cms : success request sms
            cms --> user: WA telah dikirimkan
            user -> cms : Input OTP
            cms -> auth : v1/login-otp
            
            
            alt invalid otp code
                auth --> cms : invalid otp code 
            else valid otp
                cms -> auth: login-otp `v1/login-otp`
                auth -> cms: Success login
                cms -> user: Dashboard opened
            end
        end
    end
else account found
    dbAuth --> auth: return exist user with msisdn
    auth --> cms: account found
    cms --> user: Nomor HP sudah terdaftar
end

```

## Register With Email
```plantuml
actor user
participant "CMS" as cms
participant "Auth Service" as auth
participant "User Service" as userService

user -> cms : Register
cms -> auth : register email `/v1/register-email`
alt account not found
    
else email already exists
    auth --> cms : "your email has been verified"
    cms --> user: empty response
    
end
```

## Login

## Update PopCash
