Commit Graph

2 Commits

Author SHA1 Message Date
paulh 207358fa7d feat(clm-admin): add persistEnvelopeResult() and extend CaseContext with eSignature fields
- Add 5 eSignature fields to CaseContext DTO (FR-004)
- Extend getCaseContext() SOQL to include all 5 envelope tracking fields
- Add @AuraEnabled persistEnvelopeResult() following persistDocGenResult pattern (FR-003)
  - Writes ESignature_Envelope_Id__c, ESignature_Envelope_Status__c, ESignature_Sent_At__c
  - Writes ESignature_Envelope_Url__c when non-blank; does NOT touch ESignature_Completed_At__c

Agent: claude-sonnet-4-6
Tests: 7/7 passing | CLMAdminServiceTest
Tests-Added: 0
TypeScript: N/A (Apex project)
2026-04-09 22:21:29 -04:00
paulh 45814dc2d5 Add CLMAdminService, DocusignESignatureService, and fix code review issues
New classes:
- CLMAdminService: UI-facing orchestration — account/letter settings from
  metadata, document generation, task status polling, file attachment,
  folder browsing; persists all CLM results to Appraiser_Case__c
- DocusignESignatureService: eSignature API browsing (accounts, templates,
  envelopes, login info, user info)
- CLMAdminServiceTest, CLMDocGenCalloutTest, DocusignESignatureServiceTest

Updated classes (AppraiserCasePayloadBuilder, CLMDocGenCallout):
- CLMDocGenCallout: full XML merge callout stack, task status polling,
  document download, recursive document href discovery, account-based
  endpoint building; HTTP_TIMEOUT made public
- AppraiserCasePayloadBuilder: formatMailingAddress made public so
  CLMAdminService can reuse it rather than duplicating the logic

Code review bug fixes:
- Fix null fields emitting literal "null" in generated XML — add safeValue()
  helper; String.valueOf(null) returns "null" so escapeXml's null guard
  never fired
- Fix unguarded inline SOQL in getCaseContext and getDocGenPreview — throws
  QueryException for missing records instead of AuraHandledException; now
  uses list query with isEmpty guard
- Remove duplicate formatAddress in CLMAdminService; delegate to
  AppraiserCasePayloadBuilder.formatMailingAddress
- Replace hardcoded 30000 timeout in performGet with CLMDocGenCallout.HTTP_TIMEOUT
- Remove duplicate JSDoc on getTaskStatus

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-09 20:36:16 -04:00