forked from thijooree/android
update docs
This commit is contained in:
@@ -2,9 +2,9 @@
|
||||
|
||||
## Overview
|
||||
|
||||
Each bank's API returns account data in different formats and uses different field names for balances, product types, and status. To keep screens bank-agnostic, each bank has a dedicated parser that translates raw `MibAccount` model data into a standard `AccountListDisplay` object. Screens consume only `AccountListDisplay` — they never inspect `bank` or `profileType` or apply bank-specific logic.
|
||||
Each bank's API returns account data in different formats and uses different field names for balances, product types, and status. To keep screens bank-agnostic, each bank has a dedicated parser that translates raw `BankAccount` (in `api/models/BankModels.kt`) into a standard `AccountListDisplay` object. Screens consume only `AccountListDisplay` — they never inspect `bank` or `profileType` or apply bank-specific logic.
|
||||
|
||||
## Bank Discriminator — `MibAccount.bank`
|
||||
## Bank Discriminator — `BankAccount.bank`
|
||||
|
||||
All dispatchers route by `account.bank`, a string set explicitly by each login flow at account creation time:
|
||||
|
||||
@@ -14,9 +14,9 @@ All dispatchers route by `account.bank`, a string set explicitly by each login f
|
||||
| `"BML"` | `BmlLoginFlow` |
|
||||
| `"FAHIPAY"` | `FahipayLoginFlow`|
|
||||
|
||||
`profileType` is a bank-internal value (e.g. MIB's numeric profile ID, or BML's `"BML_PREPAID"`) and is **never** used for bank routing. Card-type checks within BML still use `profileType` (`"BML_PREPAID"` / `"BML_CREDIT"`).
|
||||
`profileType` is a bank-internal value (e.g. MIB's numeric profile ID, or BML's `"BML_PREPAID"`) and is **never** used for bank routing. Card-type checks within BML still use `profileType` (`"BML_PREPAID"` / `"BML_CREDIT"` / `"BML_DEBIT"`).
|
||||
|
||||
`cifType` (MIB only) is the human-readable profile category name returned by the `operatingProfiles` API (e.g. `"Individual"`, `"Sole Propr"`). It is stored on `MibAccount` and surfaced in the accounts list section header and settings. It is **never hardcoded** in the app.
|
||||
`cifType` (MIB only) is the human-readable profile category name returned by the `operatingProfiles` API (e.g. `"Individual"`, `"Sole Propr"`). It is stored on `BankAccount` and surfaced in the accounts list section header and settings. It is **never hardcoded** in the app.
|
||||
|
||||
## Standard Output Model
|
||||
|
||||
@@ -37,7 +37,7 @@ data class AccountListDisplay(
|
||||
|
||||
```kotlin
|
||||
// util/AccountListParser.kt
|
||||
AccountListParser.from(account: MibAccount): AccountListDisplay?
|
||||
AccountListParser.from(account: BankAccount): AccountListDisplay?
|
||||
```
|
||||
|
||||
Routes to the correct parser based on `account.bank`. Returns `null` for unknown banks — never falls back to a specific bank.
|
||||
@@ -46,7 +46,7 @@ Routes to the correct parser based on `account.bank`. Returns `null` for unknown
|
||||
|----------------|-------------------------|
|
||||
| `"BML"` | `BmlDashboardParser` |
|
||||
| `"FAHIPAY"` | `FahipayAccountParser` |
|
||||
| `"MIB"` | `MibAccountParser` |
|
||||
| `"MIB"` | `MibAccountParser` |
|
||||
| anything else | `null` |
|
||||
|
||||
## Bank Parsers
|
||||
@@ -64,7 +64,7 @@ Handles both CASA accounts and prepaid/credit cards.
|
||||
|
||||
- **Balance**: `availableBalance` from the MIB API directly
|
||||
- Known product names (`SAVING ACCOUNT`, `CURRENT ACCOUNT`) mapped to short labels
|
||||
- `cifType` (e.g. `"Individual"`, `"Sole Propr"`) comes from `MibProfile.cifType`, stored on `MibAccount`, displayed in section headers
|
||||
- `cifType` (e.g. `"Individual"`, `"Sole Propr"`) comes from `MibProfile.cifType`, stored on `BankAccount`, displayed in section headers
|
||||
|
||||
### Fahipay — `util/fahipayapi/FahipayAccountParser`
|
||||
|
||||
@@ -73,8 +73,8 @@ Handles both CASA accounts and prepaid/credit cards.
|
||||
|
||||
## Adding a New Bank
|
||||
|
||||
1. Create `util/<bankname>api/<Bank>AccountParser.kt` with a `displayData(account: MibAccount): AccountListDisplay` function
|
||||
2. Set `bank = "<BANKNAME>"` in the new login flow when creating `MibAccount` objects
|
||||
1. Create `util/<bankname>api/<Bank>AccountParser.kt` with a `displayData(account: BankAccount): AccountListDisplay` function
|
||||
2. Set `bank = "<BANKNAME>"` in the new login flow when creating `BankAccount` objects
|
||||
3. Add a `when` branch in `AccountListParser.from()` (and other dispatchers) for the new bank value
|
||||
4. No changes needed in any screen or adapter
|
||||
|
||||
|
||||
Reference in New Issue
Block a user