From ef51924d3af3cd8bf4e9db621a664d0494aae523 Mon Sep 17 00:00:00 2001 From: inbargazit Date: Wed, 14 Feb 2024 12:47:12 -0800 Subject: [PATCH] Cleanup/fixes related to Web Forms API --- .gitignore | 3 ++- composer.json | 2 +- composer.lock | 17 ++++++++--------- .../WebForms/EG001CreateAndEmbedForm.php | 4 ++-- .../eSignature/EG042DocumentGeneration.php | 2 +- .../WebForms/CreateAndEmbedFormService.php | 19 +++++++------------ src/Services/WebFormsApiClientService.php | 4 ++-- tests/JWTLoginMethod.php | 2 +- 8 files changed, 24 insertions(+), 29 deletions(-) diff --git a/.gitignore b/.gitignore index 49d880c..06095cc 100644 --- a/.gitignore +++ b/.gitignore @@ -47,4 +47,5 @@ debug.log public/demo_documents/ExportedUserData.csv JWTConsoleApp/vendor/* JWTConsoleApp/ds_config_jwt_mini.php -Quick_ACG/vendor/* \ No newline at end of file +Quick_ACG/vendor/* +public/demo_documents/web-form-config.json \ No newline at end of file diff --git a/composer.json b/composer.json index c31824d..0c99dc1 100644 --- a/composer.json +++ b/composer.json @@ -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": "*", diff --git a/composer.lock b/composer.lock index 63e3568..d4e3936 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "fdd1ca4a4205d8f7b564e0e4919b12bd", + "content-hash": "34bfa1fe97606526b1ac6ce341873821", "packages": [ { "name": "doctrine/instantiator", @@ -369,16 +369,16 @@ }, { "name": "docusign/webforms-client", - "version": "v1.0.2-rc11", + "version": "v1.0.0", "source": { "type": "git", "url": "https://github.com/docusign/docusign-webforms-php-client.git", - "reference": "a270a5c129613459b5a6b26e22cd58305c188403" + "reference": "2a24e5e04b6cdeb82fc60531d079539eb37e17e1" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/docusign/docusign-webforms-php-client/zipball/a270a5c129613459b5a6b26e22cd58305c188403", - "reference": "a270a5c129613459b5a6b26e22cd58305c188403", + "url": "https://api.github.com/repos/docusign/docusign-webforms-php-client/zipball/2a24e5e04b6cdeb82fc60531d079539eb37e17e1", + "reference": "2a24e5e04b6cdeb82fc60531d079539eb37e17e1", "shasum": "" }, "require": { @@ -421,9 +421,9 @@ ], "support": { "issues": "https://github.com/docusign/docusign-webforms-php-client/issues", - "source": "https://github.com/docusign/docusign-webforms-php-client/tree/v1.0.2-rc11" + "source": "https://github.com/docusign/docusign-webforms-php-client/tree/v1.0.0" }, - "time": "2024-02-09T17:26:04+00:00" + "time": "2024-02-14T12:32:10+00:00" }, { "name": "firebase/php-jwt", @@ -3308,8 +3308,7 @@ "minimum-stability": "stable", "stability-flags": { "docusign/click-client": 5, - "docusign/esign-client": 5, - "docusign/webforms-client": 5 + "docusign/esign-client": 5 }, "prefer-stable": false, "prefer-lowest": false, diff --git a/src/Controllers/Examples/WebForms/EG001CreateAndEmbedForm.php b/src/Controllers/Examples/WebForms/EG001CreateAndEmbedForm.php index 5030b1f..28fa626 100644 --- a/src/Controllers/Examples/WebForms/EG001CreateAndEmbedForm.php +++ b/src/Controllers/Examples/WebForms/EG001CreateAndEmbedForm.php @@ -84,7 +84,7 @@ protected function createController(): void $_SESSION['can_embed_form'] = null; $formList = CreateAndEmbedFormService::getForms( - $this->clientService->FormManagementApi(), + $this->clientService->formManagementApi(), $accountId ); @@ -95,7 +95,7 @@ protected function createController(): void $formId = $formList->getItems()[0]->getId(); $webFormInstance = CreateAndEmbedFormService::createInstance( - $this->clientService->FormInstanceManagementApi(), + $this->clientService->formInstanceManagementApi(), $accountId, $formId ); diff --git a/src/Controllers/Examples/eSignature/EG042DocumentGeneration.php b/src/Controllers/Examples/eSignature/EG042DocumentGeneration.php index d5c61f5..739725f 100644 --- a/src/Controllers/Examples/eSignature/EG042DocumentGeneration.php +++ b/src/Controllers/Examples/eSignature/EG042DocumentGeneration.php @@ -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'], diff --git a/src/Services/Examples/WebForms/CreateAndEmbedFormService.php b/src/Services/Examples/WebForms/CreateAndEmbedFormService.php index 9688221..7c2acba 100644 --- a/src/Services/Examples/WebForms/CreateAndEmbedFormService.php +++ b/src/Services/Examples/WebForms/CreateAndEmbedFormService.php @@ -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(); @@ -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"; @@ -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"], @@ -110,8 +108,7 @@ public static function getTemplatesByName( TemplatesApi $templatesApi, string $templateName, string $accountId - ): mixed - { + ): mixed { $listTemplateOptions = new ListTemplatesOptions(); $listTemplateOptions->setSearchText($templateName); @@ -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); @@ -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); diff --git a/src/Services/WebFormsApiClientService.php b/src/Services/WebFormsApiClientService.php index 4d03c15..248e2cd 100644 --- a/src/Services/WebFormsApiClientService.php +++ b/src/Services/WebFormsApiClientService.php @@ -45,7 +45,7 @@ public function __construct($args) /** * Getter for the FormManagementApi */ - public function FormManagementApi(): FormManagementApi + public function formManagementApi(): FormManagementApi { return new FormManagementApi($this->apiClient); } @@ -53,7 +53,7 @@ public function FormManagementApi(): FormManagementApi /** * Getter for the FormInstanceManagementApi */ - public function FormInstanceManagementApi(): FormInstanceManagementApi + public function formInstanceManagementApi(): FormInstanceManagementApi { return new FormInstanceManagementApi($this->apiClient); } diff --git a/tests/JWTLoginMethod.php b/tests/JWTLoginMethod.php index f9a02d8..246da1d 100644 --- a/tests/JWTLoginMethod.php +++ b/tests/JWTLoginMethod.php @@ -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";