Skip to content

Commit c779294

Browse files
DEVDOCS-10305 codeDepot tags
1 parent d81dc85 commit c779294

File tree

1 file changed

+13
-6
lines changed

1 file changed

+13
-6
lines changed

src/Services/Examples/eSignature/CFREmbeddedSigningService.php

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -31,29 +31,29 @@ class CFREmbeddedSigningService
3131
* @param SignatureClientService $clientService
3232
* @return array ['redirect_url']
3333
*/
34-
# ***DS.snippet.0.start
3534
public static function worker(array $args, SignatureClientService $clientService, string $demoPath): array
3635
{
3736

3837

3938
// Obtain your workflowID
40-
39+
#ds-snippet-start:eSign41Step2
4140
$accounts_api = $clientService->getAccountsApi();
4241
$accounts_response = $accounts_api->getAccountIdentityVerification($_SESSION['ds_account_id']);
4342
$workflows_data = $accounts_response->getIdentityVerification();
4443
foreach ($workflows_data as $workflow) {
45-
if ($workflow['default_name'] == 'SMS for access & signatures')
44+
if ($workflow['default_name'] == 'SMS for access & signatures')
4645
$args['envelope_args']['workflow_id'] = $workflow['workflow_id'];
4746
};
4847

4948
if(!isset($args['envelope_args']['workflow_id'])){
5049
$clientService->showErrorTemplate(new ApiException("IDENTITY_WORKFLOW_INVALID_ID"));
5150
}
51+
#ds-snippet-end:eSign41Step2
5252

5353
# Create the envelope request object
54+
#ds-snippet-start:eSign41Step4
5455
$envelope_definition = CFREmbeddedSigningService::make_envelope($args['envelope_args'], $demoPath);
5556

56-
5757
$envelope_api = $clientService->getEnvelopeApi();
5858

5959
# Call Envelopes::create API method
@@ -69,19 +69,25 @@ public static function worker(array $args, SignatureClientService $clientService
6969
exit;
7070
}
7171
$envelope_id = $envelopeSummary->getEnvelopeId();
72+
#ds-snippet-end:eSign41Step4
7273

73-
# 3. Create the Recipient View request object
74+
# Create the Recipient View request object
7475
$authentication_method = 'None'; # How is this application authenticating
7576
# the signer? See the `authentication_method' definition
7677
# https://developers.docusign.com/docs/esign-rest-api/reference/envelopes/envelopeviews/createrecipient/
78+
79+
#ds-snippet-start:eSign41Step5
7780
$recipient_view_request = $clientService->getRecipientViewRequest(
7881
$authentication_method,
7982
$args["envelope_args"]
8083
);
84+
#ds-snippet-end:eSign41Step5
8185

8286
# 4. Obtain the recipient_view_url for the embedded signing
8387
# Exceptions will be caught by the calling function
88+
#ds-snippet-start:eSign41Step6
8489
$viewUrl = $clientService->getRecipientView($args['account_id'], $envelope_id, $recipient_view_request);
90+
#ds-snippet-end:eSign41Step6
8591

8692
return ['envelope_id' => $envelope_id, 'redirect_url' => $viewUrl['url']];
8793
}
@@ -93,6 +99,7 @@ public static function worker(array $args, SignatureClientService $clientService
9399
* @param $args array
94100
* @return EnvelopeDefinition -- returns an envelope definition
95101
*/
102+
#ds-snippet-start:eSign41Step3
96103
private static function make_envelope(array $args, string $demoPath): EnvelopeDefinition
97104
{
98105
# document 1 (pdf) has tag /sn1/
@@ -173,5 +180,5 @@ private static function make_envelope(array $args, string $demoPath): EnvelopeDe
173180

174181
return $envelope_definition;
175182
}
176-
# ***DS.snippet.0.end
183+
#ds-snippet-end:eSign41Step3
177184
}

0 commit comments

Comments
 (0)