feat(eoi): dual-path generateAndSign (inapp + documenso-template)
generateAndSign now accepts a `pathway` parameter:
- `inapp` (existing): resolve in-app template -> pdfme -> MinIO -> Documenso
createDocument + sendDocument.
- `documenso-template` (new): build EOI context from interestId, assemble
the Documenso template payload, and call Documenso's
/api/v1/templates/{id}/generate-document. Documenso owns the PDF; we
still record a documents row for tracking.
Adds generateDocumentFromTemplate helper to the Documenso client and new
env vars (DOCUMENSO_TEMPLATE_ID_EOI + client/developer/approval recipient
IDs) with defaults matching the legacy flow. Covered by 6 new integration
tests (637/637 green).
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -56,6 +56,16 @@ export async function createDocument(
|
||||
}) as Promise<DocumensoDocument>;
|
||||
}
|
||||
|
||||
export async function generateDocumentFromTemplate(
|
||||
templateId: number,
|
||||
payload: Record<string, unknown>,
|
||||
): Promise<DocumensoDocument> {
|
||||
return documensoFetch(`/api/v1/templates/${templateId}/generate-document`, {
|
||||
method: 'POST',
|
||||
body: JSON.stringify(payload),
|
||||
}) as Promise<DocumensoDocument>;
|
||||
}
|
||||
|
||||
export async function sendDocument(docId: string): Promise<DocumensoDocument> {
|
||||
return documensoFetch(`/api/v1/documents/${docId}/send`, {
|
||||
method: 'POST',
|
||||
|
||||
Reference in New Issue
Block a user