Skip to content

Commit

Permalink
DEVDOCS-10283 codeDepot tags
Browse files Browse the repository at this point in the history
  • Loading branch information
karissarjacobsen committed Sep 29, 2023
1 parent a4b96b7 commit 16121ac
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -59,11 +59,9 @@ protected Object doWork(WorkArguments args, ModelMap model,
String phoneNumber = args.getPhoneNumber();
String accountId = session.getAccountId();

// Step 2 start
//ds-snippet-start:eSign41Step2
ApiClient apiClient = createApiClient(session.getBasePath(), user.getAccessToken());
// Step 2 end

// Step 3 start
AccountsApi workflowDetails = new AccountsApi(apiClient);
AccountIdentityVerificationResponse workflowRes = workflowDetails.getAccountIdentityVerification(session.getAccountId());
List<AccountIdentityVerificationWorkflow> identityVerification = workflowRes.getIdentityVerification();
Expand All @@ -75,15 +73,16 @@ protected Object doWork(WorkArguments args, ModelMap model,
workflowId = identityVerification.get(i).getWorkflowId();
}
}
// Step 3 end
//ds-snippet-end:eSign41Step2

logger.info("workflowId = " + workflowId);
if (workflowId.equals(""))
{
throw new ApiException(0, getTextForCodeExample().CustomErrorTexts.get(0).ErrorMessage);
}


// Step 1. Create the envelope definition
// Create the envelope definition
//ds-snippet-start:eSign41Step4
EnvelopeDefinition envelope = CfrEmbeddedSigningService.makeEnvelope(
signerName,
signerEmail,
Expand All @@ -96,26 +95,33 @@ protected Object doWork(WorkArguments args, ModelMap model,
DOCUMENT_FILE_NAME,
DOCUMENT_NAME);

// Step 2. Call DocuSign to create the envelope
// Call DocuSign to create the envelope
EnvelopesApi envelopesApi = new EnvelopesApi(apiClient);
EnvelopeSummary envelopeSummary = envelopesApi.createEnvelope(accountId, envelope);

String envelopeId = envelopeSummary.getEnvelopeId();
//ds-snippet-end:eSign41Step4

session.setEnvelopeId(envelopeId);

// Step 3. create the recipient view, the embedded signing
// create the recipient view, the embedded signing
//ds-snippet-start:eSign41Step5
RecipientViewRequest viewRequest = CfrEmbeddedSigningService.makeRecipientViewRequest(
signerEmail,
signerName,
config,
signerClientId);

//ds-snippet-end:eSign41Step5

//ds-snippet-start:eSign41Step6
ViewUrl viewUrl = CfrEmbeddedSigningService.embeddedSigning(
envelopesApi,
accountId,
envelopeId,
viewRequest
);
//ds-snippet-end:eSign41Step6

// Step 4. Redirect the user to the embedded signing
// Don't use an iFrame!
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
import java.util.Collections;

public final class CfrEmbeddedSigningService {
//ds-snippet-start:eSign41Step6
public static ViewUrl embeddedSigning(
EnvelopesApi envelopesApi,
String accountId,
Expand All @@ -19,7 +20,9 @@ public static ViewUrl embeddedSigning(
) throws ApiException {
return envelopesApi.createRecipientView(accountId, envelopeId, viewRequest);
}
//ds-snippet-end:eSign41Step6

//ds-snippet-start:eSign41Step5
public static RecipientViewRequest makeRecipientViewRequest(
String signerEmail,
String signerName,
Expand Down Expand Up @@ -61,7 +64,9 @@ public static RecipientViewRequest makeRecipientViewRequest(

return viewRequest;
}
//ds-snippet-end:eSign41Step5

//ds-snippet-start:eSign41Step3
public static EnvelopeDefinition makeEnvelope(
String signerName,
String signerEmail,
Expand Down Expand Up @@ -115,4 +120,5 @@ public static EnvelopeDefinition makeEnvelope(

return envelopeDefinition;
}
//ds-snippet-end:eSign41Step3
}

0 comments on commit 16121ac

Please sign in to comment.