Commit Graph

7 Commits

Author SHA1 Message Date
paulh 6fe75d8ab3 test(esignature): add createEnvelope() test coverage — TC-001, TC-002, blank email guard
Three new test methods in DocusignESignatureServiceTest:
- createEnvelopeReturnsSuccessResultOnHttp201 (TC-001): mocks 201, asserts success=true, envelopeId, status
- createEnvelopeReturnsFailureResultOnHttp400 (TC-002): mocks 400, asserts success=false, errorMessage non-null
- createEnvelopeReturnsEarlyWhenEmailIsBlank: asserts early return with errorMessage when Appraiser_Email__c is blank

All 11 tests pass (11/11). Satisfies NFR-001 for createEnvelope().

Agent: claude-sonnet-4-6
Tests: 11/11 passing
Tests-Added: +3
TypeScript: N/A (Apex project)
2026-04-09 22:19:38 -04:00
paulh c3421e858f feat(esignature): add EnvelopeCreateResult class and createEnvelope() method
Adds EnvelopeCreateResult inner DTO and createEnvelope(Id, String, String)
to DocusignESignatureService. Option A (template-based): POSTs to
/v2.1/accounts/{accountId}/envelopes with templateId, templateRoles
(Signer), and status=sent. Guards blank templateId and blank appraiser
email; catches all exceptions and wraps in result. Named credential
sourced from CLM_Account_Setting__mdt per ADR-002.

Agent: claude-sonnet-4-6
Tests: 8/8 passing | N/A (no new test methods — Task 3 covers test coverage)
Tests-Added: 0
TypeScript: N/A (Apex project)
2026-04-09 22:17:08 -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
paulh 703fb0c0ba Remove legacy Appraiser_Deficiency__c object and AppraiserCaseDocGenService
Replaced by Appraiser_Case_Deficiency__c (master-detail, with Reference__c
field) and the XML-merge-based CLMDocGenCallout/CLMAdminService stack.
Also removes placeholder named credentials CLMNamedCred and CLMuatDownloadNamedCreds
superseded by the account-specific credential set.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-09 20:35:42 -04:00
paulh e058dedb82 Create Appraiser Case custom record and DocGen service 2026-04-05 14:31:51 -04:00
paulh 1e532029fa Add Appraiser Review Letter template and XML merge data 2026-04-05 14:22:57 -04:00
paulh 63b1bfd758 Initial commit: Salesforce Appraiser Review Letter with DocuSign CLM integration 2026-04-03 12:13:59 -04:00