Skip to content

Commit

Permalink
Cleanup/fixes related to Web Forms API
Browse files Browse the repository at this point in the history
  • Loading branch information
InbarGazit committed Feb 14, 2024
1 parent 8a94b3b commit ef51924
Show file tree
Hide file tree
Showing 8 changed files with 24 additions and 29 deletions.
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -47,4 +47,5 @@ debug.log
public/demo_documents/ExportedUserData.csv
JWTConsoleApp/vendor/*
JWTConsoleApp/ds_config_jwt_mini.php
Quick_ACG/vendor/*
Quick_ACG/vendor/*
public/demo_documents/web-form-config.json
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
"docusign/esign-client": "^6.15.0-rc",
"docusign/rooms-client": "^2.1.0",
"docusign/monitor-client": "^1.1.0",
"docusign/webforms-client": "^v1.0.1-rc10",
"docusign/webforms-client": "^1.0.0",
"twig/twig": "^3.5.1",
"league/oauth2-client": "^2.6.1",
"ext-json": "*",
Expand Down
17 changes: 8 additions & 9 deletions composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions src/Controllers/Examples/WebForms/EG001CreateAndEmbedForm.php
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ protected function createController(): void
$_SESSION['can_embed_form'] = null;

$formList = CreateAndEmbedFormService::getForms(
$this->clientService->FormManagementApi(),
$this->clientService->formManagementApi(),
$accountId
);

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

$webFormInstance = CreateAndEmbedFormService::createInstance(
$this->clientService->FormInstanceManagementApi(),
$this->clientService->formInstanceManagementApi(),
$accountId,
$formId
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ public function createController(): void
public function getTemplateArgs(): array
{
$form_data = [
'candidate_email' => $this->checkInputValues($_POST['candidate_email']),
'candidate_email' => $this->checkEmailInputValue($_POST['candidate_email']),
'candidate_name' => $this->checkInputValues($_POST['candidate_name']),
'manager_name' => $this->checkInputValues($_POST['manager_name']),
'job_title' => $_POST['job_title'],
Expand Down
19 changes: 7 additions & 12 deletions src/Services/Examples/WebForms/CreateAndEmbedFormService.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,7 @@ class CreateAndEmbedFormService
public static function getForms(
FormManagementApi $formManagementApi,
string $accountId
): WebFormSummaryList
{
): WebFormSummaryList {
$formName = "Web Form Example Template";

$listFormsOptions = new FormManagementApi\ListFormsOptions();
Expand All @@ -53,7 +52,7 @@ public static function getForms(
* @return void
*/
#ds-snippet-start:WebForms1Step3
public static function addTemplateIdToForm(string $fileLocation, string $templateId): void
public static function addTemplateIdToForm(string $fileLocation, string $templateId): void
{
$targetString = "template-id";

Expand All @@ -74,12 +73,11 @@ public static function addTemplateIdToForm(string $fileLocation, string $templat
* @return WebFormInstance
* @throws ApiException
*/
public static function createInstance(
public static function createInstance(
FormInstanceManagementApi $formInstanceApi,
string $accountId,
string $formId
): WebFormInstance
{
): WebFormInstance {
#ds-snippet-start:WebForms1Step4
$formValues = new WebFormValues([
["PhoneNumber" => "555-555-5555"],
Expand Down Expand Up @@ -110,8 +108,7 @@ public static function getTemplatesByName(
TemplatesApi $templatesApi,
string $templateName,
string $accountId
): mixed
{
): mixed {
$listTemplateOptions = new ListTemplatesOptions();
$listTemplateOptions->setSearchText($templateName);

Expand Down Expand Up @@ -142,8 +139,7 @@ public static function createTemplate(
string $template_name,
string $demoDocsPath,
SignatureClientService $clientService
): array
{
): array {
$templatesApi = $clientService->getTemplatesApi();
$options = new ListTemplatesOptions();
$options->setSearchText($template_name);
Expand Down Expand Up @@ -186,8 +182,7 @@ public static function createTemplate(
public static function makeTemplateRequest(
string $template_name,
string $demoDocsPath
): EnvelopeTemplate
{
): EnvelopeTemplate {
$docName = 'World_Wide_Corp_Web_Form.pdf';
$contentBytes = file_get_contents($demoDocsPath . $docName);
$base64FileContent = base64_encode($contentBytes);
Expand Down
4 changes: 2 additions & 2 deletions src/Services/WebFormsApiClientService.php
Original file line number Diff line number Diff line change
Expand Up @@ -45,15 +45,15 @@ public function __construct($args)
/**
* Getter for the FormManagementApi
*/
public function FormManagementApi(): FormManagementApi
public function formManagementApi(): FormManagementApi
{
return new FormManagementApi($this->apiClient);
}

/**
* Getter for the FormInstanceManagementApi
*/
public function FormInstanceManagementApi(): FormInstanceManagementApi
public function formInstanceManagementApi(): FormInstanceManagementApi
{
return new FormInstanceManagementApi($this->apiClient);
}
Expand Down
2 changes: 1 addition & 1 deletion tests/JWTLoginMethod.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ public static function jwtAuthenticationMethod(string $apiType, TestConfig $test
$scopes = "signature user_write group_read organization_read permission_read user_read "
. "account_read domain_read identity_provider_read user_data_redact"
. "asset_group_account_read asset_group_account_clone_write asset_group_account_clone_read";
} elseif ($_SESSION['api_type'] == ApiTypes::WEBFORMS) {
} elseif ($apiType == ApiTypes::WEBFORMS) {
$scopes = "signature webforms_read webforms_instance_read webforms_instance_write";
} else {
$scopes = "signature";
Expand Down

0 comments on commit ef51924

Please sign in to comment.