MCPcopy Index your code
hub / github.com/simstudioai/sim / handleVoidEnvelope

Function handleVoidEnvelope

apps/sim/app/api/tools/docusign/route.ts:470–503  ·  view source on GitHub ↗
(
  apiBase: string,
  headers: Record<string, string>,
  params: Record<string, unknown>,
  signal?: AbortSignal
)

Source from the content-addressed store, hash-verified

468}
469
470async function handleVoidEnvelope(
471 apiBase: string,
472 headers: Record<string, string>,
473 params: Record<string, unknown>,
474 signal?: AbortSignal
475) {
476 const { envelopeId, voidedReason } = params
477 if (!envelopeId) {
478 return NextResponse.json({ success: false, error: 'envelopeId is required' }, { status: 400 })
479 }
480 if (!voidedReason) {
481 return NextResponse.json({ success: false, error: 'voidedReason is required' }, { status: 400 })
482 }
483
484 const response = await fetchDocusign(
485 `${apiBase}/envelopes/${(envelopeId as string).trim()}`,
486 {
487 method: 'PUT',
488 headers,
489 body: JSON.stringify({ status: 'voided', voidedReason }),
490 },
491 signal
492 )
493
494 const data = await readDocusignJson(response, 'DocuSign void envelope response')
495 if (!response.ok) {
496 return NextResponse.json(
497 { success: false, error: docusignError(data, 'Failed to void envelope') },
498 { status: response.status }
499 )
500 }
501
502 return NextResponse.json({ envelopeId, status: 'voided' })
503}
504
505async function handleDownloadDocument(
506 apiBase: string,

Callers 1

route.tsFile · 0.85

Calls 3

fetchDocusignFunction · 0.85
readDocusignJsonFunction · 0.85
docusignErrorFunction · 0.85

Tested by

no test coverage detected