TEST_NONEB_API_DOCS_UPDATED
This commit is contained in:
parent
ae34ba6daa
commit
2e873ccdef
@ -71,3 +71,41 @@ Old function copied as `uploadRequiredDoc_v1` (preserved for reference).
|
||||
### API Docs
|
||||
- `nonebapidocs.md`
|
||||
- `dev_logs/non_eb_claim_api.md`
|
||||
|
||||
---
|
||||
|
||||
## LeadsController — Bug Fix: `createClientWithLeadData` for Non-EB Leads
|
||||
|
||||
### 6. Fix: `prepareClientPolicyData` crashes on Non-EB leads
|
||||
|
||||
**Problem:** `proposel_data` is always `null` for Non-EB leads. The function unconditionally did:
|
||||
```php
|
||||
$proposel_data = json_decode($data['proposel_data'], true);
|
||||
list($insurer_branch_id, $insurer_id) = explode('-', $proposel_data['insurer'], 2);
|
||||
```
|
||||
This throws a PHP 8 TypeError (cannot access key on null) for any Non-EB lead, making `createClientWithLeadData` silently fail.
|
||||
|
||||
**Fix:** Split insurer resolution by `lead_form_type`:
|
||||
- **EB (`lead_form_type == 1`):** parse insurer from `proposel_data['insurer']` as `"{insurer_branch_id}-{insurer_id}"` — unchanged
|
||||
- **Non-EB:** read `insurer_id` and `insurer_branch_id` directly from lead row columns
|
||||
|
||||
### 7. Fix: `getPlacementJson` null-safety for Non-EB leads
|
||||
|
||||
**Problem:** Same null `proposel_data` issue — `json_decode($data['proposel_data'], true)` returned null, and downstream `$proposel_data['proposel_name']` access would crash if a Non-EB lead had QCR data.
|
||||
|
||||
**Fix:** `json_decode($data['proposel_data'] ?? '', true) ?? []` — `proposel_data` is now always an array, so all `??` key accesses are safe.
|
||||
|
||||
### Smoke Test Results
|
||||
|
||||
| Path | Step | Result |
|
||||
|---|---|---|
|
||||
| EB | `proposel_data` decode | ✅ decodes normally |
|
||||
| EB | `explode('-', proposel_data['insurer'])` | ✅ `insurer_branch_id` + `insurer_id` parsed correctly |
|
||||
| EB | `preparePolicyTermsFromRFQ` | ✅ unaffected |
|
||||
| Non-EB | `proposel_data` null → `[]` | ✅ safe |
|
||||
| Non-EB | insurer from lead row columns | ✅ `insurer_id` + `insurer_branch_id` read directly |
|
||||
| Non-EB | `getPlacementJson` — no QCR data | ✅ returns null safely, policy terms skipped |
|
||||
| Non-EB | `getPlacementJson` — QCR data exists | ⚠️ line 4356: `$proposel_data['proposel_name']` missing `??` — pending clarification on whether Non-EB leads can have QCR data |
|
||||
|
||||
### Files Changed
|
||||
- `app/Controllers/LeadsController.php`
|
||||
|
||||
Loading…
Reference in New Issue
Block a user