Skip to content

Commit 526e1d0

Browse files
committed
duplicated section for easier readability: eSign13
1 parent 383ef16 commit 526e1d0

File tree

1 file changed

+29
-1
lines changed

1 file changed

+29
-1
lines changed

src/Services/Examples/eSignature/AddDocToTemplateService.php

Lines changed: 29 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ public static function addDocToTemplate(array $args, $clientService): array
3535
# 1. Create the envelope request object
3636
$envelope_definition = AddDocToTemplateService::make_envelope($envelope_args, $clientService);
3737

38-
return SetTemplateTabValuesService::sendEnvelopeFromCreatedTemplate($clientService, $args, $envelope_definition);
38+
return AddDocToTemplateService::sendCompositeTemplate($clientService, $args, $envelope_definition);
3939
}
4040

4141
/**
@@ -158,4 +158,32 @@ public static function make_envelope(array $args, $clientService): EnvelopeDefin
158158
);
159159
}
160160
#ds-snippet-end:eSign13Step2
161+
162+
public static function sendCompositeTemplate($clientService, $args, $envelope_definition): array
163+
{
164+
#ds-snippet-start:eSign13Step3
165+
# Call Envelopes::create API method
166+
# Exceptions will be caught by the calling function
167+
$envelope_api = $clientService->getEnvelopeApi();
168+
$envelopeResponse = $envelope_api->createEnvelope($args['account_id'], $envelope_definition);
169+
$envelope_id = $envelopeResponse->getEnvelopeId();
170+
#ds-snippet-end:eSign13Step3
171+
172+
#ds-snippet-start:eSign13Step4
173+
# Create the Recipient View request object
174+
$authentication_method = 'None'; # How is this application authenticating
175+
# the signer? See the `authentication_method' definition
176+
# https://developers.docusign.com/esign-rest-api/reference/Envelopes/EnvelopeViews/createRecipient
177+
$recipient_view_request = $clientService->getRecipientViewRequest(
178+
$authentication_method,
179+
$args["envelope_args"]
180+
);
181+
182+
# Obtain the recipient_view_url for the embedded signing
183+
# Exceptions will be caught by the calling function
184+
$recipientView = $clientService->getRecipientView($args['account_id'], $envelope_id, $recipient_view_request);
185+
186+
return ['envelope_id' => $envelope_id, 'redirect_url' => $recipientView['url']];
187+
#ds-snippet-end:eSign13Step4
188+
}
161189
}

0 commit comments

Comments
 (0)