forked from shihaam/thijooree
update docs
This commit is contained in:
@@ -1,112 +1,43 @@
|
||||
# Profile Picture
|
||||
|
||||
Fetch the authenticated user's profile picture. The endpoint redirects to the actual image URL.
|
||||
Fahipay profile pictures are **stored locally** by the app. There is no Fahipay endpoint involved.
|
||||
|
||||
The official Fahipay app exposes `GET https://fahipay.mv/images/profiles/picture/?t={timestamp}` (a 302 redirect to the actual image), but this client never calls it — Fahipay accounts get a user-set picture saved on the device only.
|
||||
|
||||
---
|
||||
|
||||
## Endpoint
|
||||
## Storage
|
||||
|
||||
```
|
||||
GET https://fahipay.mv/images/profiles/picture/?t={timestamp}
|
||||
```
|
||||
`util/ProfileImageStore.kt` — keyed file storage under `filesDir/profile_images/`.
|
||||
|
||||
---
|
||||
|
||||
## Prerequisites
|
||||
|
||||
- Valid `authID` from [login](01-login.md) or [OTP](02-otp.md)
|
||||
- Valid `__Secure-sess` session cookie
|
||||
|
||||
---
|
||||
|
||||
## Request
|
||||
|
||||
### Headers
|
||||
|
||||
| Header | Value |
|
||||
| Bank | Key |
|
||||
|---|---|
|
||||
| `authid` | `xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx` |
|
||||
| `User-Agent` | `okhttp/4.12.0` |
|
||||
| `Accept-Encoding` | `gzip` |
|
||||
| `Connection` | `Keep-Alive` |
|
||||
| `Cookie` | `__Secure-sess=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx` |
|
||||
| Fahipay | `fahipay_{loginId}` |
|
||||
| BML | `bml_{profileId}` |
|
||||
| MIB | (n/a — fetched from server via [P41](../mibapi/02-login.md)) |
|
||||
|
||||
### Query Parameters
|
||||
Helpers:
|
||||
|
||||
| Parameter | Description | Example |
|
||||
|---|---|---|
|
||||
| `t` | Cache-busting timestamp string | `Sat May 16 2026 14:57:52 GMT+0500` |
|
||||
```kotlin
|
||||
ProfileImageStore.fahipayKey(loginId) // "fahipay_abc123"
|
||||
ProfileImageStore.save(context, key, bitmap)
|
||||
ProfileImageStore.load(context, key) // Bitmap?
|
||||
ProfileImageStore.delete(context, key)
|
||||
```
|
||||
|
||||
The `t` parameter is a URL-encoded timestamp used to prevent browser caching. The value can be any string — the server ignores it for routing purposes.
|
||||
Files are JPEGs at quality 90. The filename is the key with non-alphanumerics replaced by `_`.
|
||||
|
||||
---
|
||||
|
||||
## curl Example
|
||||
## UI entry points
|
||||
|
||||
```bash
|
||||
curl --request GET \
|
||||
--url 'https://fahipay.mv/images/profiles/picture/?t=Sat%20Jan%2001%202026%2012:00:00%20GMT+0500' \
|
||||
--compressed \
|
||||
--header 'Accept-Encoding: gzip' \
|
||||
--header 'Connection: Keep-Alive' \
|
||||
--header 'Cookie: __Secure-sess=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx' \
|
||||
--header 'User-Agent: okhttp/4.12.0' \
|
||||
--header 'authid: xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx'
|
||||
```
|
||||
Set/replace/remove a Fahipay profile picture from **Settings → Logins** (`ui/home/SettingsLoginsFragment.kt`). The pencil icon next to a Fahipay login opens a chooser:
|
||||
|
||||
---
|
||||
- Pick from gallery (`ACTION_OPEN_DOCUMENT` image/*)
|
||||
- Take a photo (camera launcher, temp file at `cacheDir/profile_photo_tmp.jpg`)
|
||||
- Remove current picture
|
||||
|
||||
## Response
|
||||
|
||||
### Success
|
||||
|
||||
The server responds with `HTTP 302` and a `Location` header pointing to the actual image URL.
|
||||
|
||||
```
|
||||
HTTP/1.1 302 Found
|
||||
Location: https://fahipay.mv/images/profiles/0000/avatar.jpg?v=0000000000
|
||||
```
|
||||
|
||||
Follow the redirect to download the image. The final response is the raw image bytes (`image/jpeg` or `image/png`).
|
||||
|
||||
---
|
||||
|
||||
### No Picture Set
|
||||
|
||||
If the user has not uploaded a profile picture, the redirect points to a default placeholder image:
|
||||
|
||||
```
|
||||
Location: https://fahipay.mv/images/profiles/default.png
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
### Error
|
||||
|
||||
If the session is invalid, the server returns `HTTP 401` or redirects to an error page.
|
||||
|
||||
---
|
||||
|
||||
## Implementation Notes
|
||||
|
||||
- HTTP clients that follow redirects automatically (e.g. `OkHttpClient` with `followRedirects(true)`) will return the image bytes directly.
|
||||
- Use `followRedirects(false)` and read the `Location` header if you need the resolved image URL separately.
|
||||
- The image URL contains the user's `profileID` in the path — this matches the `profileID` field from the [profile response](03-profile.md).
|
||||
- The `v=` query parameter in the image URL is a version/cache key. It changes when the user updates their picture.
|
||||
|
||||
---
|
||||
|
||||
## Suggested Usage
|
||||
|
||||
```
|
||||
timestamp = current time formatted as URL-safe string
|
||||
GET /images/profiles/picture/?t={timestamp}
|
||||
→ 302 Location: <image URL>
|
||||
→ GET <image URL>
|
||||
→ image bytes
|
||||
```
|
||||
|
||||
Cache the downloaded image by `profileID` and re-fetch when the user explicitly refreshes, rather than on every app launch.
|
||||
Saved images are surfaced anywhere the account is shown — accounts list, contact picker, receipts — via a `localProfileImageLoader` that resolves the key with `ProfileImageStore.load`.
|
||||
|
||||
---
|
||||
|
||||
|
||||
@@ -42,14 +42,14 @@ GET https://fahipay.mv/api/app/favs/?page={serviceName}&lang=en
|
||||
|
||||
## Service Groups
|
||||
|
||||
Call this endpoint once per service group:
|
||||
Call this endpoint once per service group. Labels shown are the ones the app surfaces in the UI (`FahipayContactsClient.kt:22-25`):
|
||||
|
||||
| `page` value | Service | Description |
|
||||
|---|---|---|
|
||||
| `ooredooraastas` | Ooredoo Raastas | Ooredoo mobile top-up |
|
||||
| `dhiraagureload` | Dhiraagu Reload | Dhiraagu mobile top-up |
|
||||
| `ooredoobillpay` | Ooredoo Bill | Ooredoo bill payment |
|
||||
| `dhiraagubillpay` | Dhiraagu Bill | Dhiraagu bill payment |
|
||||
| `page` value | Group label | `benefCategoryId` | Description |
|
||||
|---|---|---|---|
|
||||
| `ooredooraastas` | `Raastas` | `FAHIPAY_RAASTAS` | Ooredoo mobile top-up |
|
||||
| `dhiraagureload` | `Reload` | `FAHIPAY_RELOAD` | Dhiraagu mobile top-up |
|
||||
| `ooredoobillpay` | `Ooredoo Bill` | `FAHIPAY_OOREDOO_BILL` | Ooredoo bill payment |
|
||||
| `dhiraagubillpay` | `Dhiraagu Bill` | `FAHIPAY_DHIRAAGU_BILL` | Dhiraagu bill payment |
|
||||
|
||||
---
|
||||
|
||||
|
||||
@@ -125,7 +125,7 @@ Client Server
|
||||
| 3 | [Profile](03-profile.md) | Fetch user profile and linked bank accounts |
|
||||
| 4 | [Balance](04-balance.md) | Fetch wallet balance |
|
||||
| 5 | [Transaction History](05-history.md) | Paginated activity/transaction history |
|
||||
| 6 | [Profile Picture](06-profile-picture.md) | Fetch user profile picture |
|
||||
| 6 | [Profile Picture](06-profile-picture.md) | Local-only profile picture storage (no Fahipay endpoint) |
|
||||
| 7 | [Saved Favourites](07-contacts.md) | Fetch saved contacts per payment service |
|
||||
|
||||
---
|
||||
|
||||
Reference in New Issue
Block a user