Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
84 lines
4.5 KiB
Markdown
84 lines
4.5 KiB
Markdown
# CBS Nexora — Backend Schema & API Changes
|
|
|
|
## Files in this directory
|
|
|
|
| File | Purpose |
|
|
| ------------------------------------ | ----------------------------------------------- |
|
|
| `V1__client_schema_extensions.sql` | DB migration — run on Fineract MySQL/MariaDB |
|
|
| `ClientEntityKyc.java` | JPA Entity for `m_client_entity_kyc` table |
|
|
| `ClientAddressIndia.java` | JPA Entity for `m_client_address_india` table |
|
|
| `ClientEntityKycRepository.java` | Spring Data repository |
|
|
| `ClientAddressIndiaRepository.java` | Spring Data repository |
|
|
| `ClientEntityKycApiResource.java` | REST controller — `/clients/{id}/entity-kyc` |
|
|
| `ClientAddressIndiaApiResource.java` | REST controller — `/clients/{id}/india-address` |
|
|
|
|
## How to apply
|
|
|
|
### Step 1: Run SQL Migration
|
|
|
|
```bash
|
|
mysql -u root -p fineract_tenantdb < V1__client_schema_extensions.sql
|
|
```
|
|
|
|
### Step 2: Copy Java files to Fineract source
|
|
|
|
```
|
|
ClientEntityKyc.java → fineract-provider/src/main/java/org/apache/fineract/portfolio/client/domain/
|
|
ClientAddressIndia.java → fineract-provider/src/main/java/org/apache/fineract/portfolio/client/domain/
|
|
ClientEntityKycRepository.java → fineract-provider/src/main/java/org/apache/fineract/portfolio/client/domain/
|
|
ClientAddressIndiaRepository.java → fineract-provider/src/main/java/org/apache/fineract/portfolio/client/domain/
|
|
ClientEntityKycApiResource.java → fineract-provider/src/main/java/org/apache/fineract/portfolio/client/api/
|
|
ClientAddressIndiaApiResource.java → fineract-provider/src/main/java/org/apache/fineract/portfolio/client/api/
|
|
```
|
|
|
|
### Step 3: Update existing Fineract Client API
|
|
|
|
In `ClientApiResource.java`, the `POST /clients` endpoint needs to accept these additional fields in the request body:
|
|
|
|
- `nationality`, `annualTurnover`, `creditLimit`
|
|
- `isMinor`, `ageYears`, `ageMonths`, `ageDays`
|
|
- `guardianName`, `guardianRelation`, `guardianMobile`, `guardianIdNumber`, `guardianAddress`
|
|
|
|
In `ClientWritePlatformServiceJpaRepositoryImpl.java`, map these fields to the `m_client` entity during create/update.
|
|
|
|
### Step 4: Register new API resources
|
|
|
|
Add to `fineract-provider/src/main/java/org/apache/fineract/infrastructure/core/config/FineractWebMvcConfigurer.java` or equivalent Spring config.
|
|
|
|
### Step 5: Rebuild Fineract
|
|
|
|
```bash
|
|
./gradlew bootRun
|
|
```
|
|
|
|
## API Reference
|
|
|
|
### Entity KYC
|
|
|
|
| Method | Endpoint | Description |
|
|
| ------ | -------------------------------- | ------------------------------- |
|
|
| POST | `/clients/{clientId}/entity-kyc` | Create/update entity KYC + MSME |
|
|
| GET | `/clients/{clientId}/entity-kyc` | Retrieve entity KYC |
|
|
| DELETE | `/clients/{clientId}/entity-kyc` | Delete entity KYC |
|
|
|
|
### India Address
|
|
|
|
| Method | Endpoint | Description |
|
|
| ------ | ------------------------------------------ | ----------------------------------------------------------- |
|
|
| POST | `/clients/{clientId}/india-address` | Save all 4 address types |
|
|
| GET | `/clients/{clientId}/india-address` | Get all addresses |
|
|
| GET | `/clients/{clientId}/india-address/{type}` | Get specific type (PERMANENT/CURRENT/OFFICE/CORRESPONDENCE) |
|
|
| PUT | `/clients/{clientId}/india-address/{type}` | Update specific type |
|
|
| DELETE | `/clients/{clientId}/india-address` | Delete all addresses |
|
|
|
|
## Tables Summary
|
|
|
|
| Table | New/Modified | Records |
|
|
| ------------------------ | ------------------------- | ---------------------------------------------- |
|
|
| `m_client` | Modified — 12 new columns | Guardian, nationality, minor, turnover |
|
|
| `m_client_non_person` | Modified — 13 new columns | MSME, CIN, enterprise PAN, signatory |
|
|
| `m_client_kyc` | Modified — 19 new columns | AML, freeze, form60/61, form15G/H, KYC doc |
|
|
| `m_client_entity_kyc` | **New** | Entity-specific KYC, MSME, signatory, auth doc |
|
|
| `m_client_address_india` | **New** | 4-type India address with PIN lookup fields |
|
|
| `m_code_value` | Modified | Added Gender: Transgender, Other |
|