Skip to content

Commit da40530

Browse files
authored
Merge pull request #139 from docusign/bugfix-fixing-document-generation-example
Fixing document genaration code example
2 parents 8a94b3b + 23e84fa commit da40530

File tree

8 files changed

+24
-29
lines changed

8 files changed

+24
-29
lines changed

.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,4 +47,5 @@ debug.log
4747
public/demo_documents/ExportedUserData.csv
4848
JWTConsoleApp/vendor/*
4949
JWTConsoleApp/ds_config_jwt_mini.php
50-
Quick_ACG/vendor/*
50+
Quick_ACG/vendor/*
51+
public/demo_documents/web-form-config.json

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
"docusign/esign-client": "^6.15.0-rc",
2121
"docusign/rooms-client": "^2.1.0",
2222
"docusign/monitor-client": "^1.1.0",
23-
"docusign/webforms-client": "^v1.0.1-rc10",
23+
"docusign/webforms-client": "^1.0.0",
2424
"twig/twig": "^3.5.1",
2525
"league/oauth2-client": "^2.6.1",
2626
"ext-json": "*",

composer.lock

Lines changed: 8 additions & 9 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/Controllers/Examples/WebForms/EG001CreateAndEmbedForm.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ protected function createController(): void
8484
$_SESSION['can_embed_form'] = null;
8585

8686
$formList = CreateAndEmbedFormService::getForms(
87-
$this->clientService->FormManagementApi(),
87+
$this->clientService->formManagementApi(),
8888
$accountId
8989
);
9090

@@ -95,7 +95,7 @@ protected function createController(): void
9595
$formId = $formList->getItems()[0]->getId();
9696

9797
$webFormInstance = CreateAndEmbedFormService::createInstance(
98-
$this->clientService->FormInstanceManagementApi(),
98+
$this->clientService->formInstanceManagementApi(),
9999
$accountId,
100100
$formId
101101
);

src/Controllers/Examples/eSignature/EG042DocumentGeneration.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ public function createController(): void
6363
public function getTemplateArgs(): array
6464
{
6565
$form_data = [
66-
'candidate_email' => $this->checkInputValues($_POST['candidate_email']),
66+
'candidate_email' => $this->checkEmailInputValue($_POST['candidate_email']),
6767
'candidate_name' => $this->checkInputValues($_POST['candidate_name']),
6868
'manager_name' => $this->checkInputValues($_POST['manager_name']),
6969
'job_title' => $_POST['job_title'],

src/Services/Examples/WebForms/CreateAndEmbedFormService.php

Lines changed: 7 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,7 @@ class CreateAndEmbedFormService
3636
public static function getForms(
3737
FormManagementApi $formManagementApi,
3838
string $accountId
39-
): WebFormSummaryList
40-
{
39+
): WebFormSummaryList {
4140
$formName = "Web Form Example Template";
4241

4342
$listFormsOptions = new FormManagementApi\ListFormsOptions();
@@ -53,7 +52,7 @@ public static function getForms(
5352
* @return void
5453
*/
5554
#ds-snippet-start:WebForms1Step3
56-
public static function addTemplateIdToForm(string $fileLocation, string $templateId): void
55+
public static function addTemplateIdToForm(string $fileLocation, string $templateId): void
5756
{
5857
$targetString = "template-id";
5958

@@ -74,12 +73,11 @@ public static function addTemplateIdToForm(string $fileLocation, string $templat
7473
* @return WebFormInstance
7574
* @throws ApiException
7675
*/
77-
public static function createInstance(
76+
public static function createInstance(
7877
FormInstanceManagementApi $formInstanceApi,
7978
string $accountId,
8079
string $formId
81-
): WebFormInstance
82-
{
80+
): WebFormInstance {
8381
#ds-snippet-start:WebForms1Step4
8482
$formValues = new WebFormValues([
8583
["PhoneNumber" => "555-555-5555"],
@@ -110,8 +108,7 @@ public static function getTemplatesByName(
110108
TemplatesApi $templatesApi,
111109
string $templateName,
112110
string $accountId
113-
): mixed
114-
{
111+
): mixed {
115112
$listTemplateOptions = new ListTemplatesOptions();
116113
$listTemplateOptions->setSearchText($templateName);
117114

@@ -142,8 +139,7 @@ public static function createTemplate(
142139
string $template_name,
143140
string $demoDocsPath,
144141
SignatureClientService $clientService
145-
): array
146-
{
142+
): array {
147143
$templatesApi = $clientService->getTemplatesApi();
148144
$options = new ListTemplatesOptions();
149145
$options->setSearchText($template_name);
@@ -186,8 +182,7 @@ public static function createTemplate(
186182
public static function makeTemplateRequest(
187183
string $template_name,
188184
string $demoDocsPath
189-
): EnvelopeTemplate
190-
{
185+
): EnvelopeTemplate {
191186
$docName = 'World_Wide_Corp_Web_Form.pdf';
192187
$contentBytes = file_get_contents($demoDocsPath . $docName);
193188
$base64FileContent = base64_encode($contentBytes);

src/Services/WebFormsApiClientService.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,15 +45,15 @@ public function __construct($args)
4545
/**
4646
* Getter for the FormManagementApi
4747
*/
48-
public function FormManagementApi(): FormManagementApi
48+
public function formManagementApi(): FormManagementApi
4949
{
5050
return new FormManagementApi($this->apiClient);
5151
}
5252

5353
/**
5454
* Getter for the FormInstanceManagementApi
5555
*/
56-
public function FormInstanceManagementApi(): FormInstanceManagementApi
56+
public function formInstanceManagementApi(): FormInstanceManagementApi
5757
{
5858
return new FormInstanceManagementApi($this->apiClient);
5959
}

tests/JWTLoginMethod.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ public static function jwtAuthenticationMethod(string $apiType, TestConfig $test
3535
$scopes = "signature user_write group_read organization_read permission_read user_read "
3636
. "account_read domain_read identity_provider_read user_data_redact"
3737
. "asset_group_account_read asset_group_account_clone_write asset_group_account_clone_read";
38-
} elseif ($_SESSION['api_type'] == ApiTypes::WEBFORMS) {
38+
} elseif ($apiType == ApiTypes::WEBFORMS) {
3939
$scopes = "signature webforms_read webforms_instance_read webforms_instance_write";
4040
} else {
4141
$scopes = "signature";

0 commit comments

Comments
 (0)