Commit Graph

6 Commits

Author SHA1 Message Date
Paul Huliganga 4211648e2a feat: add recipient resolution from Client_Case__c lookup fields
- Queries Client_Case__c for Service_Coordinator__c and Docusign_Recipient_1__c
- Resolves Contact/User name and email from lookup targets
- Maps recipients to Docusign template roles: 'Service Coordinator' and 'Docusign Recipient #1'
- Validates recipients exist and have email addresses
- Supports both Contact and User lookup types
- Role names and field names are configurable constants at top of class
- Clear error messages if recipients are missing or have no email
2026-02-25 12:28:08 -05:00
Paul Huliganga 4b1edd4d27 refactor: switch to dfsle Apex Toolkit - remove raw API code
BREAKING CHANGE: Now uses dfsle managed package for Docusign integration.
No separate credentials or Named Credentials needed.

Changes:
- Rewrote DocusignCompositeEnvelopeBuilder to use dfsle.EnvelopeService
  and dfsle.Document.fromTemplate() for composite envelopes
- Simplified DocusignEnvelopeRequestHandler to validation-only
- Updated all tests to use dfsle.TestUtils.setMock()
- 12 comprehensive test methods (success, validation, edge cases)

Deleted (no longer needed):
- DocusignAPIService.cls (raw HTTP callouts)
- DocusignAPIServiceTest.cls
- DocusignCredentials.cls (custom settings)
- DocusignCredentialsTest.cls

Benefits:
- Uses existing dfsle package authentication automatically
- No Named Credential or Custom Setting setup required
- ~95 lines of code vs ~380 lines before
- Fully supported by Docusign managed package
2026-02-25 11:29:38 -05:00
Paul Huliganga 7df62e06ca refactor: extract Request and Result as standalone global classes
- Created DocusignEnvelopeRequest.cls (separate global class for input)
- Created DocusignEnvelopeResult.cls (separate global class for output)
- Updated DocusignCompositeEnvelopeBuilder to use standalone classes
- Updated DocusignEnvelopeRequestHandler to reference standalone classes
- Updated all test classes to use new class references
- Fixes Flow Builder visibility issues with nested inner classes
- Better API design with clear input/output types
- Easier to extend and reuse across other classes
2026-02-25 10:05:36 -05:00
Paul Huliganga b00a930e8d fix: remove duplicate JSON builder test from main class
- Removed testJSONBuilder from DocusignCompositeEnvelopeBuilderTest
- JSON building logic tests now handled by DocusignEnvelopeRequestHandlerTest (10 comprehensive tests)
- Fixes deployment error: method buildCompositeEnvelopeJSON no longer exists in main class
- Eliminates code duplication between test classes
2026-02-25 09:39:18 -05:00
Paul Huliganga 2f7dcf3520 refactor: extract request handling to global DocusignEnvelopeRequestHandler class + deployment guide
Changes:
- Move validation logic to DocusignEnvelopeRequestHandler.validateRequest()
- Move envelope JSON building to DocusignEnvelopeRequestHandler.buildEnvelopeJSON()
- Add comprehensive test suite for handler (10 test methods)
- Simplify main invocable method - focus on orchestration
- Add DEPLOYMENT_AND_TESTING.md reference guide with all CLI commands
- Handler is reusable for future enhancements and integrations

Benefits:
- Single Responsibility Principle
- Reusable handler for other classes
- Better testability
- Clean separation of concerns
2026-02-25 09:32:55 -05:00
Paul Huliganga 4f734f0d17 Initial commit: Salesforce Composite Envelope Builder 2026-02-25 09:22:29 -05:00