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)
This commit is contained in:
parent
6fe75d8ab3
commit
207358fa7d
|
|
@ -14,7 +14,7 @@
|
|||
|
||||
- [x] **Task 3 — Tests for createEnvelope():** Add test coverage in `DocusignESignatureServiceTest` — success path (mock 201), failure path (mock 400), blank email guard. (NFR-001, TC-001, TC-002)
|
||||
|
||||
- [ ] **Task 4 — persistEnvelopeResult() + CaseContext extension:** Add `persistEnvelopeResult()` to `CLMAdminService`. Extend `CaseContext` inner class and `getCaseContext()` SOQL to include the 5 eSignature fields. (FR-003, FR-004)
|
||||
- [x] **Task 4 — persistEnvelopeResult() + CaseContext extension:** Add `persistEnvelopeResult()` to `CLMAdminService`. Extend `CaseContext` inner class and `getCaseContext()` SOQL to include the 5 eSignature fields. (FR-003, FR-004)
|
||||
|
||||
- [ ] **Task 5 — Tests for persistEnvelopeResult():** Add test coverage in `CLMAdminServiceTest` — verify fields written correctly, `ESignature_Sent_At__c` is set, `ESignature_Completed_At__c` is NOT written on a "sent" result. (NFR-001, TC-003)
|
||||
|
||||
|
|
|
|||
|
|
@ -22,6 +22,11 @@ public with sharing class CLMAdminService {
|
|||
@AuraEnabled public String attachedFileUrl;
|
||||
@AuraEnabled public Datetime lastDocGenRequestedAt;
|
||||
@AuraEnabled public Datetime lastDocGenCompletedAt;
|
||||
@AuraEnabled public String eSignatureEnvelopeId;
|
||||
@AuraEnabled public String eSignatureEnvelopeStatus;
|
||||
@AuraEnabled public String eSignatureEnvelopeUrl;
|
||||
@AuraEnabled public Datetime eSignatureSentAt;
|
||||
@AuraEnabled public Datetime eSignatureCompletedAt;
|
||||
@AuraEnabled public List<CaseDeficiencyItem> deficiencies;
|
||||
}
|
||||
|
||||
|
|
@ -313,6 +318,11 @@ public with sharing class CLMAdminService {
|
|||
Attached_File_Url__c,
|
||||
Last_DocGen_Requested_At__c,
|
||||
Last_DocGen_Completed_At__c,
|
||||
ESignature_Envelope_Id__c,
|
||||
ESignature_Envelope_Status__c,
|
||||
ESignature_Sent_At__c,
|
||||
ESignature_Completed_At__c,
|
||||
ESignature_Envelope_Url__c,
|
||||
(SELECT Id,
|
||||
Deficiency_Number__c,
|
||||
Description__c,
|
||||
|
|
@ -344,6 +354,11 @@ public with sharing class CLMAdminService {
|
|||
context.attachedFileUrl = appraiserCase.Attached_File_Url__c;
|
||||
context.lastDocGenRequestedAt = appraiserCase.Last_DocGen_Requested_At__c;
|
||||
context.lastDocGenCompletedAt = appraiserCase.Last_DocGen_Completed_At__c;
|
||||
context.eSignatureEnvelopeId = appraiserCase.ESignature_Envelope_Id__c;
|
||||
context.eSignatureEnvelopeStatus = appraiserCase.ESignature_Envelope_Status__c;
|
||||
context.eSignatureEnvelopeUrl = appraiserCase.ESignature_Envelope_Url__c;
|
||||
context.eSignatureSentAt = appraiserCase.ESignature_Sent_At__c;
|
||||
context.eSignatureCompletedAt = appraiserCase.ESignature_Completed_At__c;
|
||||
context.deficiencies = new List<CaseDeficiencyItem>();
|
||||
|
||||
if (appraiserCase.Deficiencies__r != null) {
|
||||
|
|
@ -433,6 +448,29 @@ public with sharing class CLMAdminService {
|
|||
return result;
|
||||
}
|
||||
|
||||
@AuraEnabled(cacheable=false)
|
||||
public static void persistEnvelopeResult(
|
||||
Id caseId,
|
||||
String envelopeId,
|
||||
String envelopeStatus,
|
||||
String envelopeUri
|
||||
) {
|
||||
if (caseId == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
Appraiser_Case__c updateCase = new Appraiser_Case__c(Id = caseId);
|
||||
updateCase.ESignature_Envelope_Id__c = envelopeId;
|
||||
updateCase.ESignature_Envelope_Status__c = envelopeStatus;
|
||||
updateCase.ESignature_Sent_At__c = System.now();
|
||||
|
||||
if (String.isNotBlank(envelopeUri)) {
|
||||
updateCase.ESignature_Envelope_Url__c = envelopeUri;
|
||||
}
|
||||
|
||||
update updateCase;
|
||||
}
|
||||
|
||||
private static String formatAddress(Appraiser_Case__c appraiserCase) {
|
||||
return AppraiserCasePayloadBuilder.formatMailingAddress(
|
||||
appraiserCase.Property_Street__c,
|
||||
|
|
|
|||
Loading…
Reference in New Issue