Files
android/docs/mibapi/08-transfer.md
T
shihaam ec879ad7ca
Auto Tag on Version Change / check-version (push) Successful in 3s
bml to fahipay and MIB to fahipay support
2026-12-05 22:58:03 +05:00

367 lines
11 KiB
Markdown

# Account Lookup & Transfer
Two-step process: look up the recipient to validate the account and get the holder name, then execute the transfer.
All endpoints are on the encrypted API (`sfunc=n`, session key). See [README](README.md) for the request format. The source account must belong to the **currently selected** profile — call `P47` for its profile first (see [03-accounts.md](03-accounts.md)).
---
## Step 1 — Account Lookup — `routePath: B40`
One route resolves every supported input:
| Input format | Example | Resolves to |
|---|---|---|
| Starts with `7`, exactly 13 digits | `7700000000000` | BML / local bank account |
| Starts with `9`, exactly 17 digits | `90100000000000000` | MIB account |
| Starts with `7` or `9`, exactly 7 digits | `9600001` | Favara mobile alias |
| `A` followed by 6 digits | `A000001` | Favara National ID alias |
| Contains `@` | `user@example.com` | Favara email alias |
**Request**:
```json
{
"sfunc": "n",
"xxid": "<session xxid>",
"data": {
"search": "7700000000000",
"nonce": "<computed nonce>",
"appId": "<appId>",
"sodium": "<random 20-bit int>",
"routePath": "B40",
"xxid": "<session xxid>"
}
}
```
### Input Rules
- **Mobile aliases** must be the bare 7 digits. `+960 9600001` and `+9609600001` return no match.
- **National ID aliases** need an uppercase `A` — `a000001` returns no match, `A000001` resolves. The client uppercases the prefix before sending (`MibTransferClient.kt`).
- Partial input (e.g. `9600`) returns an empty `data` array.
### Response
**BML account**:
```json
{
"success": true,
"data": [
{
"benefName": "ACCOUNT HOLDER NAME",
"benefAccount": "7700000000000",
"bankCode": "MALBMVMV",
"benefBankName": "Bank of Maldives"
}
]
}
```
**MIB account**:
```json
{
"success": true,
"data": [
{
"benefName": "ACCOUNT HOLDER NAME",
"benefAccount": "90100000000000000",
"bankCode": "MIB",
"benefBankName": "MIB",
"transferCy": "462",
"transferCyDesc": "MVR"
}
]
}
```
**Favara alias** (resolving to an MIB account):
```json
{
"success": true,
"data": [
{
"benefName": "Account Holder Name ",
"benefAccount": "90100000000000000",
"bankCode": "MADVMVMV",
"benefBankName": "Maldives Islamic Bank PLC."
}
]
}
```
| Field | Description |
|---|---|
| `benefName` | Account holder name — trim whitespace |
| `benefAccount` | Resolved account number to use for the transfer |
| `bankCode` | `"MIB"` or a bank BIC (`MADVMVMV` = MIB, `MALBMVMV` = BML). Normalize `"MIB"` to `MADVMVMV`. |
| `benefBankName` | Bank display name |
| `transferCy` / `transferCyDesc` | Account currency — present for MIB account lookups only |
### Lookup Errors
No match returns `success: true` with an empty `data` array:
```json
{ "success": true, "data": [] }
```
Show "account not found" in that case.
### Currency
| Lookup | Currency |
|---|---|
| MIB account | From `transferCyDesc` (`"MVR"` / `"USD"`) |
| Favara alias → MIB | Not returned — unknown |
| BML / local | `"MVR"` — cross-bank lookups only resolve MVR accounts |
> **USD cross-bank accounts**: a BML account denominated in USD cannot be resolved here. For USD BML→MIB transfers the user must first save a BML contact (see Notes below).
---
## Step 2 — Execute Transfer
Two routes depending on the destination bank:
| `bankNo` | `routePath` | Destination |
|---|---|---|
| `2` | `T50` | MIB internal account |
| `3` | `T51` | BML or other local bank (via Favara) |
**Request**:
```json
{
"sfunc": "n",
"xxid": "<session xxid>",
"data": {
"benefName": "ACCOUNT HOLDER NAME",
"benefNo": "0",
"fromAccountNo": "90101000000001000",
"benefAccountNo": "7700000000000",
"transferCy": "462",
"benefCurrencyCode": "462",
"amount": "100.00",
"bankNo": "3",
"purpose": "",
"otp": "123456",
"otpType": "3",
"nonce": "<computed nonce>",
"appId": "<appId>",
"sodium": "<random 20-bit int>",
"routePath": "T51",
"xxid": "<session xxid>"
}
}
```
| Field | Description |
|---|---|
| `benefName` | Recipient name (from lookup) |
| `benefNo` | `"0"` (not a saved contact) |
| `fromAccountNo` | Source account number |
| `benefAccountNo` | Destination account number |
| `transferCy` | Currency numeric code (`"462"` = MVR, `"840"` = USD) |
| `benefCurrencyCode` | Same as `transferCy` |
| `amount` | Amount as string (e.g. `"100.00"`, `".01"`) |
| `bankNo` | `"2"` = MIB internal, `"3"` = local/BML |
| `purpose` | Transfer remarks; may be empty |
| `otp` | Current TOTP code |
| `otpType` | `"3"` (authenticator OTP) |
### Response — Success
**`T50`** (internal):
```json
{
"success": true,
"responseCode": "2",
"reasonCode": "2011",
"reasonText": "Internal transfer success",
"data": [
{ "date": "2026-05-16 15:10:25", "trxId": "97999863", "availableBalance": "37.41" }
],
"accountBalance": [ ... ]
}
```
**`T51`** (local):
```json
{
"success": true,
"responseCode": "2",
"reasonCode": "2011",
"reasonText": "Local transfer completed successfully via Favara",
"data": [
{ "date": "2026-05-16 15:10:25", "trxId": "817054125" }
]
}
```
| Field | Description |
|---|---|
| `trxId` | Transaction ID |
| `date` | Completion timestamp |
| `availableBalance` | `T50` only — source account balance after the transfer |
| `accountBalance` | `T50` only — refreshed balances for the selected profile (same shape as in [03-accounts.md](03-accounts.md)) |
### Response — Failure
Failures return HTTP `400` with an encrypted body:
```json
{
"success": false,
"responseCode": "1",
"reasonCode": "213",
"reasonText": "Invalid OTP",
"data": [ { "otpId": "50487016" } ]
}
```
| `reasonCode` | `reasonText` | Meaning |
|---|---|---|
| `213` | `Invalid OTP` | Wrong or stale OTP |
| `707` | `That OTP is already used!` | The OTP was already accepted for an earlier request |
| `201` | `Transaction currency does not match From Account currency!` | `transferCy` doesn't match the source account |
Show `reasonText` to the user.
### OTP Retry
On `213` or `707` the client waits for the next 30-second TOTP window (plus 1 second for clock skew), generates a new code and resends the transfer **once**. A second failure of any kind is shown to the user (`MibTransferHandler.kt`).
---
## Transfer Type Summary
| Recipient | Lookup | `bankNo` | Transfer |
|---|---|---|---|
| MIB (17-digit `9…`) | `B40` | `2` | `T50` |
| BML (13-digit `7…`) | `B40` | `3` | `T51` |
| Favara alias → MIB | `B40` | `2` | `T50` |
| Favara alias → BML | `B40` | `3` | `T51` |
---
## Currency Codes
| `transferCy` | Currency |
|---|---|
| `"462"` | MVR (Maldivian Rufiyaa) |
| `"840"` | USD |
---
## Other Transfer-Screen Routes
Called by the official app when opening the transfer screen. Not consumed by thijooree.
| `routePath` | Request | Returns |
|---|---|---|
| `T63` | — | Currencies with rates (`numericCode`, `code`, `name`, `rate`) |
| `T66` | `currencyCode` | Sell rate for a currency (`sellRate`) |
| `T70` | — | Upload settings (`numFiles`, `fileSize`) |
| `T71` | optional `transferCy` | AML thresholds (`eddAmount`, `cddAmount`, `currencyCode`) |
---
## WebView IPS Transfer (Fahipay)
The MIB app pays **Fahipay** accounts (12 digits starting with `5`) from its WebView "Quick Transfer" page, not through `B40`/`T51`. Both calls are plain form posts on the WebView host with the usual session cookies and AJAX headers (see [README](README.md)), plus `Referer: https://faisamobilex-wv-v2.mib.com.mv/transferIps/quick?dashurl=1`. Loading the page itself (`GET /transferIps/quick?dashurl=1`) isn't needed: the AJAX calls carry no token from it. HTTP `419` means the session has expired. Client: `MibIpsWebClient.kt`.
The page picks the destination bank explicitly from a dropdown. Each option has a BIC and a **bank list ID**, which is sent as `bankNo`. This is not the same `bankNo` as T50/T51, where `3` means "local bank":
| Bank | BIC | Bank list ID |
|---|---|---|
| Bank of Maldives (BML) | `MALBMVMV` | `1` |
| State Bank of India (SBI) | `SBINMVMV` | `2` |
| Maldives Islamic Bank (MIB) | `MADVMVMV` | `3` |
| Bank of Ceylon (BOC) | `BCEYMVMV` | `4` |
| The Mauritius Commercial Bank (MCB) | `MCBLMVMV` | `7` |
| Dhiraagu Fintech (DHI) | `DHIRMVMV` | `8` |
| Habib Bank Limited (HBL) | `HABBMVMV` | `9` |
| Commercial Bank of Maldives (CBMV) | `CBMVMVMV` | `10` |
| FahiPay (FHI) | `FAHIMVMV` | `13` |
Only Fahipay goes through this page in the app. Other banks still use `B40`/`T51`.
### Lookup
```
POST https://faisamobilex-wv-v2.mib.com.mv/AjaxAlias/getIPSAccount
Content-Type: application/x-www-form-urlencoded; charset=UTF-8
benefBank=FAHIMVMV&benefAccount=500000000000
```
```json
{"success":true,"responseCode":"2","reasonCode":"201","reasonText":"Request Successful. Account Found","accountName":"Account Holder Name","bankBic":"FAHIMVMV"}
```
No currency is returned: the page fixes the transfer currency to MVR (`462`). Errors come back as a non-2xx status with the same JSON shape; `reasonText` explains why. `reasonCode` `220` makes the page let the user type the name.
### Transfer
```
POST https://faisamobilex-wv-v2.mib.com.mv/ajaxIPSTransfer/transferIPSLocal
Content-Type: application/x-www-form-urlencoded; charset=UTF-8
benefName=Account+Holder+Name&benefNo=0&fromAccountNo=90100000000001000&fromAccountName=Sender+Name
&benefAccountNo=500000000000&transferCy=462&benefCurrencyCode=&amount=1&bankNo=13&purpose=-
&otp=123456&otpType=3&bankBic=FAHIMVMV
```
| Field | Value |
|---|---|
| `benefNo` | `0`: no saved contact needed |
| `fromAccountName` | Sender's name |
| `transferCy` | `462` (MVR) |
| `benefCurrencyCode` | Empty |
| `bankNo` | Bank list ID (`13`) |
| `purpose` | `-` when empty |
| `otpType` | `3` (TOTP) |
| `bankBic` | `FAHIMVMV` |
```json
{"success":true,"responseCode":"2","reasonText":"Favara request transfer completed","reasonCode":"2011","data":[{"date":"2026-01-01 12:00:00","trxId":"800000000"}]}
```
How the page reads a `success: true` response:
| Condition | Meaning |
|---|---|
| `data[0].trxId == 0` or `data[0].date == null` | Being processed |
| `reasonCode` `2011` / `2012` | Completed |
| `reasonCode` `2091` | Submitted, not completed yet |
| Any other `reasonCode` | Awaiting approval |
All of these mean the transfer was accepted, so the client reports success for every one of them. It never shows a failure that would invite the user to send again.
---
## `MibIpsAccountInfo` (client model)
`B40` and WebView IPS lookups are mapped into this structure (`MibModels.kt`):
| Field | Description |
|---|---|
| `accountName` | Account holder name (trimmed) |
| `accountNumber` | Resolved account number |
| `bankId` | Bank BIC (`MADVMVMV` = MIB, `MALBMVMV` = BML, etc.) |
| `currency` | `"MVR"`, `"USD"`, or `""` (unknown) — see Currency above |
---
## Notes
- **BML → MIB USD transfers** require a saved BML contact first. Because USD BML accounts can't be resolved via `B40`, the app cannot validate the account number directly. The workaround in `TransferFragment.kt` is to add the BML account as a beneficiary (see [09-contacts.md](09-contacts.md)), then transfer to that beneficiary.
- **Session expiry**: see [README](README.md) for the unified expiry detection rules.
---
&nbsp;
---
[← Personal Profile](07-profile.md) &nbsp;&nbsp;&nbsp; **Next →** [Contacts](09-contacts.md)