# Ooredoo Ibiza - Technical Documentation (Sequences)
## Changelog
| Version | Date | Prepared By |
| -------- | -------- | -------- |
| 0.1 | 2020/05/14 | Indika W. |
## E001. User Onboarding
### 1.1 - User Authentication with OTP
<details>
<summary>Plant UML - Click to expand!</summary>
```javascript
@startuml
actor IbizaUser
participant App
participant KeyCloak #8EB2EE
participant Ibiza
participant OoredooAPI #orange
IbizaUser -> App : Enter MSISDN
App -> KeyCloak : Authenticate
KeyCloak -> OoredooAPI : Send OTP
OoredooAPI --> KeyCloak : Success
KeyCloak --> App : Prompt OTP Page
App -> IbizaUser : Request OTP
IbizaUser -> App : OTP
App -> KeyCloak : OTP
KeyCloak --> App : Access Token
App -> Ibiza : Request Information (Access Token)
Ibiza --> App : Respond Information
App --> IbizaUser : Show Dashboard
@enduml
```
</details>

---
### 1.2 - Obtaining User Type
The user type can be
* **Registered User**
* **Non-registered Ibiza User**
* **Non-registered Non Ibiza User**
* **Non-registered Non Ooredoo User**
Also, here the system cross checks the number with a table in the database for the eligibility of Migration. This will only happen if the number is non-ibiza ooredoo.
<details>
<summary>Plant UML - Click to expand!</summary>
```javascript
@startuml
actor IbizaUser
participant App
participant KeyCloak #8EB2EE
participant Ibiza
participant OoredooAPI #orange
IbizaUser -> App : Enter MSISDN
App -> KeyCloak : Authenticate
KeyCloak -> OoredooAPI : Send OTP
alt Non-Ooredoo Case
OoredooAPI --> KeyCloak : Fail
KeyCloak --> App : Non-Ooredoo User
App --> IbizaUser : Prompt Onboarding Video Page
end
OoredooAPI --> KeyCloak : Success
KeyCloak --> App : Prompt OTP Page
App -> IbizaUser : Request OTP
IbizaUser -> App : OTP
App -> KeyCloak : OTP
KeyCloak --> App : Access Token
App -> Ibiza : Request Information (Access Token)
Ibiza -> OoredooAPI : Request MSISDN info
alt Registerd User Case
OoredooAPI --> Ibiza : Registered Ibiza User (Dashboard info)
Ibiza --> App : Registered Ibiza User (Dashboard info)
App --> IbizaUser : Prompt Dashboard
else Ibiza Unregistered Case
alt Ibiza User
OoredooAPI --> Ibiza : Ibiza User (Dashboard Info)
Ibiza --> App : Ibiza User (Dashboard Info)
App --> IbizaUser : Prompt Dashboard
else Non-Ibiza User
OoredooAPI --> Ibiza : Non-Ibiza User
alt Migration Pending
Ibiza --> App : Non-Ibiza User (Pending)
App --> IbizaUser : Migration Pending, Check later
else Migration Eligible
Ibiza --> App : Non-Ibiza User (Eligible to Migrate)
App --> IbizaUser : Prompt Onboarding Video (Eligible to Migrate)
else Migration Not-Eligible
Ibiza --> App : Non-Ibiza User (Not eligible to Migrate)
App --> IbizaUser : Prompt Onboarding Video (New Number view)
end
end
end
```
</details>

---
### 1.3 - Showing Onboarding Video
<details>
<summary>Plant UML - Click to expand!</summary>
```javascript
@startuml
actor IbizaUser
participant App
participant Ibiza
IbizaUser -> App : Load Onboarding Video Page
App -> Ibiza : Request onboarding video link
Ibiza --> App : Onboarding video link
App --> IbizaUser : Play Onboarding video
@enduml
```
</details>

---
### 1.4 - Request Mobile Numbers
<details>
<summary>Plant UML - Click to expand!</summary>
```javascript
@startuml
actor IbizaUser
participant App
participant Ibiza
participant OoredooAPI #orange
IbizaUser -> App : Prompt Number Reservation
App -> Ibiza : Request avalable MSISDN (Device ID)
alt If already requested
Ibiza --> App : List of MSISDN
else New request
Ibiza -> OoredooAPI : Request MSISDN
OoredooAPI --> Ibiza : MSISDN[5]
Ibiza --> App : List of MSISDN
end
App --> IbizaUser : Prompt list of Numbers
@enduml
```
</details>

---
### 1.5 - Plan Selection and Migration
<details>
<summary>Plant UML - Click to expand!</summary>
```javascript
@startuml
actor IbizaUser
participant App
participant Ibiza
participant OoredooAPI #orange
IbizaUser -> App : Open Plan Selection Page
App -> Ibiza : Request Available Plans
Ibiza --> App : Plans list
App --> IbizaUser : Prompt list of plans
IbizaUser -> App : Choose Plan
App -> Ibiza : Request plan infomration
Ibiza -> OoredooAPI : Request Personal info (MSISDN)
OoredooAPI --> Ibiza : Personal info
Ibiza --> App : Personal info, Plan info
App --> IbizaUser : Show conversion summary
IbizaUser -> App : Confirm Migration
App -> Ibiza : Confirm Migration
Ibiza -> OoredooAPI : Initiate Migration
alt Migration Initiation Successful
OoredooAPI --> Ibiza : Success
Ibiza -> Ibiza : Wait for an interval
Ibiza -> OoredooAPI : Request MSISDN Info (Plan name)
alt Non-Ibiza Plan
OoredooAPI --> Ibiza : Non-Ibiza Plan name
Ibiza --> App : Migration processing
App --> IbizaUser : Migration processing, login later
else Ibiza Plan
OoredooAPI --> Ibiza : Ibiza Plan name
Ibiza --> App : Migration Successful
App --> IbizaUser : Prompt Dashboard
end
else Migration Initiation Failed
OoredooAPI --> Ibiza : Fail
Ibiza --> App : Migration failed
App --> IbizaUser : Migration failed, try again
end
@enduml
```
</details>

---
### 1.6 - Reserve new MSISDN
<details>
<summary>Plant UML - Click to expand!</summary>
```javascript
@startuml
actor IbizaUser
participant App
participant Ibiza
participant OoredooAPI #orange
IbizaUser -> App : Choose MSISDN, Ibiza Plan
IbizaUser -> App : Provide personal infomation
App -> Ibiza : MSISDN, Plan, Personal info
Ibiza -> OoredooAPI : Release 4 non-selected MSISDN
Ibiza --> App : MSISDN Reservation info
App --> IbizaUser : Reservation code and time
@enduml
```
</details>

---
### 1.7 - Expire MSISDN
<details>
<summary>Plant UML - Click to expand!</summary>
```javascript
@startuml
actor IbizaUser
participant App
participant Ibiza
participant OoredooAPI #orange
IbizaUser -> App : Choose MSISDN
App -> Ibiza : Reserve MSISDN
Ibiza -> Ibiza : Timeout
Ibiza -> OoredooAPI : Release MSISDN[x]
OoredooAPI --> Ibiza : Success
Ibiza --> App : MSISDN expired
App --> IbizaUser : Time expired
@enduml
```
</details>

---
### 1.8 - Obtain MSISDN Info (Ooredoo Outlet)
<details>
<summary>Plant UML - Click to expand!</summary>
```javascript
@startuml
actor IbizaUser
participant App
participant Ibiza
participant IbizaAdminPanel #96f2da
actor IbizaAdmin #red
IbizaUser -> App : Open MSISDN reserve page
App -> Ibiza : Request MSISDN reservation info
Ibiza --> App : MSISDN reservation code
App --> IbizaUser : Reservation code, QR
IbizaAdmin -> IbizaAdminPanel : Request user info (reservation code)
IbizaAdminPanel -> Ibiza : Request user info (code)
Ibiza --> IbizaAdminPanel : Personal info
IbizaAdminPanel --> IbizaAdmin : Customer information
@enduml
```
</details>

---
###### tags: `Ooredoo-Ibiza`