├── docs ├── public_box.jpg ├── start_box.jpg ├── apache_x_box.jpg ├── config_file.jpg ├── consent_window.jpg ├── listen_8080_box.jpg ├── Document_Root_box.jpg ├── apache_start_box.jpg ├── localhost_8080_box.jpg ├── apache_installed_box.jpg ├── apache_installed_start_box.jpg ├── stripe_skip_account_form_link.png └── readme_xampp.md ├── public ├── assets │ ├── header.png │ ├── favicon.png │ └── site.js ├── demo_documents │ ├── Check_If_Approved.txt │ ├── TermsOfService.pdf │ ├── World_Wide_Corp_lorem.pdf │ ├── World_Wide_Corp_fields.docx │ ├── World_Wide_Corp_fields.pdf │ ├── World_Wide_Corp_salary.docx │ ├── World_Wide_Corp_Web_Form.pdf │ ├── Offer_Letter_Dynamic_Table.docx │ ├── World_Wide_Corp_fields_shown.docx │ ├── World_Wide_Corp_Battle_Plan_Trafalgar.docx │ ├── bulkimport.csv │ └── doc_1.html └── index.php ├── Quick_ACG ├── public │ ├── assets │ │ └── img.png │ └── index.php └── composer.json ├── templates ├── error_cfr.html ├── error_eg028.html ├── maestro │ └── eg001_publish_workflow.html ├── error.html ├── error_eg34.html ├── webforms │ ├── embed.html │ ├── eg001_embed_form.html │ └── eg002_create_remote_instance.html ├── ds_return.html ├── must_authenticate.html ├── example_done.html ├── esignature │ ├── eg045_restore_envelope.html │ ├── eg003_list_envelopes.html │ ├── eg008_create_template.html │ ├── eg033_unpause_signature_workflow.html │ ├── eg039_in_person_signing.html │ ├── eg004_envelope_info.html │ ├── eg005_envelope_recipients.html │ ├── eg006_envelope_docs.html │ ├── eg015_envelope_tab_data.html │ ├── eg026_permission_change_single_setting.html │ ├── eg024_permissions_creating.html │ ├── eg027_permissions_delete.html │ ├── eg045_delete_envelope.html │ └── eg018_envelope_custom_field_data.html ├── admin │ ├── eg002_bulk_export_user_data.html │ ├── eg004_bulk_import_user_data.html │ ├── eg005_audit_users.html │ ├── eg003_bulk_export_user_data.html │ ├── eg004a_check_import_request_status.html │ ├── eg003_check_request_status.html │ ├── eg003a_check_request_status.html │ ├── eg005_check_import_request_status.html │ ├── eg007_retrieve_profile_by_user_id.html │ ├── eg010_delete_user_data_from_organization.html │ ├── eg006_retrieve_profile_by_email_address.html │ └── eg011_delete_user_data_from_account.html ├── click │ ├── eg004_get_clickwraps.html │ └── eg001_create_clickwrap.html ├── monitor │ └── eg001_get_monitoring_data.html └── rooms │ ├── eg001_create_room_with_data.html │ └── eg007_create_form_group.html ├── src ├── HMACValidationUsageExample.php ├── Services │ ├── ApiTypes.php │ ├── IRouterService.php │ ├── Examples │ │ ├── Connect │ │ │ └── ValidateUsingHmacService.php │ │ ├── Admin │ │ │ ├── CheckRequestStatusService.php │ │ │ ├── RetrieveDocuSignProfileByUserId.php │ │ │ ├── CheckImportRequestStatusService.php │ │ │ ├── RetrieveDocuSignProfileByEmailAddress.php │ │ │ ├── DeleteUserDataFromAccountService.php │ │ │ ├── BulkImportUserDataService.php │ │ │ ├── DeleteUserProductPermissionProfileByIdService.php │ │ │ ├── DeleteUserDataFromOrganizationService.php │ │ │ ├── UpdateUserProductPermissionProfileByEmailService.php │ │ │ └── CreateNewUserService.php │ │ ├── eSignature │ │ │ ├── EnvelopeTabDataService.php │ │ │ ├── EnvelopeCustomFieldDataService.php │ │ │ ├── EnvelopeInfoService.php │ │ │ ├── EnvelopeRecipientsService.php │ │ │ ├── EnvelopeDocsService.php │ │ │ ├── PermissionDeleteService.php │ │ │ ├── PermissionCreateService.php │ │ │ ├── PermissionSetUserGroupService.php │ │ │ ├── EmbeddedConsoleService.php │ │ │ ├── UnpauseSignatureWorkflowService.php │ │ │ ├── PermissionChangeSingleSettingService.php │ │ │ ├── ListEnvelopesService.php │ │ │ ├── CreateBrandService.php │ │ │ ├── EnvelopeGetDocService.php │ │ │ └── CreateAnEnvelopeFunctionService.php │ │ ├── Rooms │ │ │ ├── CreateFormGroupService.php │ │ │ ├── ExportDataFromRoomService.php │ │ │ ├── GetRoomsWithFiltersService.php │ │ │ ├── CreateRoomsWithDataService.php │ │ │ └── GrantOfficeAccessToFormGroupService.php │ │ ├── Maestro │ │ │ ├── GetWorkflowStatusService.php │ │ │ └── CancelMaestroWorkflowService.php │ │ └── Click │ │ │ ├── GetClickwrapsService.php │ │ │ ├── GetClickwrapResponseService.php │ │ │ └── ActivateClickwrapService.php │ └── Utils.php ├── Controllers │ └── Examples │ │ ├── MustAuthenticate.php │ │ ├── DsReturn.php │ │ ├── Home.php │ │ ├── Click │ │ ├── EG004GetClickwraps.php │ │ ├── EG001CreateClickwrap.php │ │ └── EG005GetClickwrapResponses.php │ │ ├── eSignature │ │ ├── EG003ListEnvelopes.php │ │ ├── EG033UnpauseSignatureWorkflow.php │ │ ├── EG027PermissionDelete.php │ │ ├── EG012EmbeddedConsole.php │ │ ├── EG043EnvelopesListStatus.php │ │ ├── EG039InPersonSigning.php │ │ ├── EG032PauseSignatureWorkflow.php │ │ ├── EG038ResponsiveSigning.php │ │ └── EG025PermissionSetUserGroup.php │ │ ├── Monitor │ │ └── Eg001GetMonitoringData.php │ │ ├── Connect │ │ └── Eg001ValidateUsingHmac.php │ │ ├── Rooms │ │ ├── EG003ExportDataFromRoom.php │ │ ├── EG007CreateFormGroup.php │ │ └── EG001CreateRoomWithData.php │ │ └── Admin │ │ ├── EG005AuditUsers.php │ │ ├── EG007RetrieveDocuSignProfileByUserID.php │ │ ├── EG003aCheckRequestStatus.php │ │ ├── EG006RetrieveDocuSignProfileByEmailAddress.php │ │ ├── EG011DeleteUserDataFromAccount.php │ │ ├── EG004BulkImportUserData.php │ │ ├── EG010DeleteUserDataFromOrganization.php │ │ └── EG003BulkExportUserData.php └── ConnectWebhookHMACValidation.php ├── JWTConsoleApp ├── composer.json └── ds_config_jwt_mini_example.php ├── docker-compose.yml ├── vhost.conf ├── tests ├── eSignature │ └── CreateBrandTest.php └── Click │ ├── CreateClickwrapTest.php │ └── ActivateClickwrapTest.php ├── .gitignore ├── composer.json ├── PAYMENTS_INSTALLATION.md ├── LICENSE ├── phpcs.xml ├── .github └── workflows │ └── php.yml └── Dockerfile /docs/public_box.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/docusign/code-examples-php/master/docs/public_box.jpg -------------------------------------------------------------------------------- /docs/start_box.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/docusign/code-examples-php/master/docs/start_box.jpg -------------------------------------------------------------------------------- /docs/apache_x_box.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/docusign/code-examples-php/master/docs/apache_x_box.jpg -------------------------------------------------------------------------------- /docs/config_file.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/docusign/code-examples-php/master/docs/config_file.jpg -------------------------------------------------------------------------------- /docs/consent_window.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/docusign/code-examples-php/master/docs/consent_window.jpg -------------------------------------------------------------------------------- /docs/listen_8080_box.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/docusign/code-examples-php/master/docs/listen_8080_box.jpg -------------------------------------------------------------------------------- /public/assets/header.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/docusign/code-examples-php/master/public/assets/header.png -------------------------------------------------------------------------------- /docs/Document_Root_box.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/docusign/code-examples-php/master/docs/Document_Root_box.jpg -------------------------------------------------------------------------------- /docs/apache_start_box.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/docusign/code-examples-php/master/docs/apache_start_box.jpg -------------------------------------------------------------------------------- /docs/localhost_8080_box.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/docusign/code-examples-php/master/docs/localhost_8080_box.jpg -------------------------------------------------------------------------------- /public/assets/favicon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/docusign/code-examples-php/master/public/assets/favicon.png -------------------------------------------------------------------------------- /docs/apache_installed_box.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/docusign/code-examples-php/master/docs/apache_installed_box.jpg -------------------------------------------------------------------------------- /public/demo_documents/Check_If_Approved.txt: -------------------------------------------------------------------------------- 1 | Thanks for reviewing this! 2 | 3 | We'll move forward as soon as we hear back. -------------------------------------------------------------------------------- /Quick_ACG/public/assets/img.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/docusign/code-examples-php/master/Quick_ACG/public/assets/img.png -------------------------------------------------------------------------------- /docs/apache_installed_start_box.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/docusign/code-examples-php/master/docs/apache_installed_start_box.jpg -------------------------------------------------------------------------------- /docs/stripe_skip_account_form_link.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/docusign/code-examples-php/master/docs/stripe_skip_account_form_link.png -------------------------------------------------------------------------------- /public/demo_documents/TermsOfService.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/docusign/code-examples-php/master/public/demo_documents/TermsOfService.pdf -------------------------------------------------------------------------------- /public/demo_documents/World_Wide_Corp_lorem.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/docusign/code-examples-php/master/public/demo_documents/World_Wide_Corp_lorem.pdf -------------------------------------------------------------------------------- /public/demo_documents/World_Wide_Corp_fields.docx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/docusign/code-examples-php/master/public/demo_documents/World_Wide_Corp_fields.docx -------------------------------------------------------------------------------- /public/demo_documents/World_Wide_Corp_fields.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/docusign/code-examples-php/master/public/demo_documents/World_Wide_Corp_fields.pdf -------------------------------------------------------------------------------- /public/demo_documents/World_Wide_Corp_salary.docx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/docusign/code-examples-php/master/public/demo_documents/World_Wide_Corp_salary.docx -------------------------------------------------------------------------------- /public/demo_documents/World_Wide_Corp_Web_Form.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/docusign/code-examples-php/master/public/demo_documents/World_Wide_Corp_Web_Form.pdf -------------------------------------------------------------------------------- /public/demo_documents/Offer_Letter_Dynamic_Table.docx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/docusign/code-examples-php/master/public/demo_documents/Offer_Letter_Dynamic_Table.docx -------------------------------------------------------------------------------- /public/demo_documents/World_Wide_Corp_fields_shown.docx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/docusign/code-examples-php/master/public/demo_documents/World_Wide_Corp_fields_shown.docx -------------------------------------------------------------------------------- /public/demo_documents/World_Wide_Corp_Battle_Plan_Trafalgar.docx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/docusign/code-examples-php/master/public/demo_documents/World_Wide_Corp_Battle_Plan_Trafalgar.docx -------------------------------------------------------------------------------- /public/demo_documents/bulkimport.csv: -------------------------------------------------------------------------------- 1 | AccountID,UserName,UserEmail,PermissionSet 2 | ,FirstLast1,exampleuser1@example.com,DS Admin, 3 | ,FirstLast2,exampleuser2@example.com,DS Sender 4 | -------------------------------------------------------------------------------- /templates/error_cfr.html: -------------------------------------------------------------------------------- 1 | {% set title = "Error" %}{% extends "base.html" %} {% block content %} 2 | 3 |

Problem: an error occurred

4 |

Error information:

5 | 6 | 7 |

{{ common_texts["CFRError"] | raw }}

8 | 9 | 10 |

{{ common_texts["ContinueButton"] | raw }}

11 | 12 | {% endblock %} 13 | -------------------------------------------------------------------------------- /templates/error_eg028.html: -------------------------------------------------------------------------------- 1 | {% set title = "Error" %}{% extends "base.html" %} {% block content %} 2 | 3 |

Duplicate Brand Name

4 |

That brand name already exists in this account. Please choose a different name.

5 | 6 | 7 | 8 |

{{ common_texts["ContinueButton"] | raw }}

9 | 10 | {% endblock %} 11 | -------------------------------------------------------------------------------- /src/HMACValidationUsageExample.php: -------------------------------------------------------------------------------- 1 | {{ code_example_text['ExampleName'] | raw }} 4 |

{{ consent_url | raw }}

5 | 6 |
7 | 8 | 9 | {{ common_texts["ContinueButton"] | raw }} 10 | 11 |
Problem: an error occurred 4 |

Error information:

5 | 6 | {% if error_code %} 7 |

{{ error_code | raw }} {{ error_message | raw }}

8 | 9 | {% if fixing_instructions != null %} 10 |

{{ fixing_instructions | raw }}

11 | {% endif %} 12 | {% else %} 13 |

{{ err }}

14 | {% endif %} 15 | 16 | 17 |

{{ common_texts["ContinueButton"] | raw }}

18 | 19 | {% endblock %} 20 | -------------------------------------------------------------------------------- /templates/error_eg34.html: -------------------------------------------------------------------------------- 1 | 2 | {% extends "base.html" %} 3 | {% set title = "Error" %} 4 | {% block content %} 5 | 6 |

Use conditional recipients.

7 |

Update to the workflow with recipient routing is not allowed to your 8 | account!
9 | Please contact with our 11 | support team to resolve this issue.

12 | 13 |

{{ common_texts["ContinueButton"] | raw }}

14 | 15 | {% endblock %} -------------------------------------------------------------------------------- /src/Controllers/Examples/MustAuthenticate.php: -------------------------------------------------------------------------------- 1 | display( 12 | 'must_authenticate.html', 13 | [ 14 | 'title' => 'Please authenticate with DocuSign', 15 | 'show_doc' => false, 16 | 'common_texts' => ManifestService::getCommonTexts() 17 | ] 18 | ); 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /vhost.conf: -------------------------------------------------------------------------------- 1 | server { 2 | listen 80 default_server; 3 | server_name docusign; 4 | 5 | root /var/www/html; 6 | 7 | location / { 8 | try_files $uri /public/index.php$is_args$args; 9 | } 10 | 11 | location ~ \.php$ { 12 | fastcgi_split_path_info ^(.+\.php)(/.*)$; 13 | include fastcgi_params; 14 | fastcgi_param SCRIPT_FILENAME $realpath_root$fastcgi_script_name; 15 | fastcgi_param DOCUMENT_ROOT $realpath_root; 16 | fastcgi_index index.php; 17 | send_timeout 1800; 18 | fastcgi_read_timeout 1800; 19 | fastcgi_pass php-fpm:9000; 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /src/Services/IRouterService.php: -------------------------------------------------------------------------------- 1 | {{ code_example_text['ExampleName'] | raw }} 8 | 9 |

{{ description | raw }}

10 | {% if show_doc %} 11 |

Documentation about this example.

12 | {% endif %} 13 | 14 | 15 |
16 |
17 | 18 | 19 | 20 | 21 | {% endblock %} 22 | 23 | -------------------------------------------------------------------------------- /tests/eSignature/CreateBrandTest.php: -------------------------------------------------------------------------------- 1 | setBrandId($brandId['brand_id']); 19 | 20 | // Assert 21 | $this->assertNotEmpty($brandId); 22 | $this->assertNotNull($brandId); 23 | } 24 | } -------------------------------------------------------------------------------- /src/ConnectWebhookHMACValidation.php: -------------------------------------------------------------------------------- 1 | bulkExportsAPI(); 20 | 21 | $organizationExportResponse = $bulkExportsApi->getUserListExport($organizationId, $exportId); 22 | 23 | return json_decode($organizationExportResponse->__toString()); 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /src/Services/Examples/eSignature/EnvelopeTabDataService.php: -------------------------------------------------------------------------------- 1 | getEnvelopeApi(); 23 | return $envelope_api->getFormData($args['account_id'], $args['envelope_id']); 24 | #ds-snippet-end:eSign15Step3 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /JWTConsoleApp/ds_config_jwt_mini_example.php: -------------------------------------------------------------------------------- 1 | '{INTEGRATION_KEY_JWT}', // The app's DocuSign integration key 5 | 'authorization_server' => 'account-d.docusign.com', 6 | "ds_impersonated_user_id" => '{IMPERSONATED_USER_ID}', // the id of the user 7 | "private_key_file" => "private.key", // path to private key file 8 | ]; 9 | 10 | $DS_CONFIG = [ 11 | 'demo_doc_path' => '../public/demo_documents/', 12 | 'doc_docx' => 'World_Wide_Corp_Battle_Plan_Trafalgar.docx', 13 | 'doc_pdf' => 'World_Wide_Corp_lorem.pdf', 14 | 'doc_txt' => 'Check_If_Approved.txt', 15 | 'quickACG' => '{QUICK_ACG_VALUE}', 16 | "CodeExamplesManifest" => "https://raw.githubusercontent.com/docusign/code-examples-csharp/master/manifest/CodeExamplesManifest.json" 17 | 18 | ]; 19 | $GLOBALS['DS_CONFIG'] = $DS_CONFIG; 20 | $GLOBALS['JWT_CONFIG'] = $JWT_CONFIG; 21 | -------------------------------------------------------------------------------- /src/Services/Examples/eSignature/EnvelopeCustomFieldDataService.php: -------------------------------------------------------------------------------- 1 | getEnvelopeApi(); 23 | return $envelope_api->listCustomFields($args['account_id'], $args['envelope_id']); 24 | #ds-snippet-end:eSign18Step3 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /src/Controllers/Examples/DsReturn.php: -------------------------------------------------------------------------------- 1 | routerService = new RouterService(); 27 | $this->getController(); 28 | } 29 | 30 | /** 31 | * Get the base controller for return action 32 | * 33 | * @return void 34 | */ 35 | public function getController(): void 36 | { 37 | } 38 | 39 | public function createController(): void 40 | { 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /src/Services/Examples/Rooms/CreateFormGroupService.php: -------------------------------------------------------------------------------- 1 | $args['form_group_name']]); 22 | #ds-snippet-end:Rooms7Step3 23 | 24 | #ds-snippet-start:Rooms7Step4 25 | return $clientService->createFormGroup($args["account_id"], $form_group); 26 | #ds-snippet-end:Rooms7Step4 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /templates/ds_return.html: -------------------------------------------------------------------------------- 1 | {% extends "base.html" %} {% block content %} 2 | 3 |

Returned data from DocuSign!

4 |

Data:

5 | 6 | {% if event %} 7 |

event: {{ event }}. This event parameter is supplied by DocuSign. 8 | Since it could have been spoofed, don't make business decisions based on 9 | its value. Instead, query DocuSign as appropriate.

10 | {% endif %} 11 | 12 | {% if envelope_id %} 13 |

envelopeId: {{ envelope_id }}. The envelopeId parameter is supplied by DocuSign. 14 | Since it could have been spoofed, don't make business decisions based on 15 | its value. Instead, query DocuSign as appropriate.

16 | {% endif %} 17 | 18 | {% if state %} 19 |

state: {{ state }}. This example state was sent to DocuSign and has now been received back. 20 | It is usually better to store state in your web framework's session.

21 | {% endif %} 22 | 23 |

{{ common_texts["ContinueButton"] | raw }}

24 | 25 | {% endblock %} 26 | -------------------------------------------------------------------------------- /public/assets/site.js: -------------------------------------------------------------------------------- 1 | $(document).ready(function () { 2 | $("#Products").on("change", function () { 3 | $list = $("#PermissionProfilesFiltered"); 4 | 5 | let json_raw = $("#PermissionProfilesData").attr("data-value"), 6 | json = json_raw ? JSON.parse(json_raw) : false; 7 | 8 | if (json) { 9 | $list.empty(); 10 | $.each(json, function (key, product) { 11 | if(key === $("#Products option:selected").html()){ 12 | $.each(product, function (i, permissionProfile) { 13 | $list.append( 14 | '' 19 | ); 20 | }); 21 | } 22 | }); 23 | } 24 | }); 25 | }); 26 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # CMake 2 | cmake-build-*/ 3 | 4 | # IntelliJ 5 | out/ 6 | 7 | # JIRA plugin 8 | atlassian-ide-plugin.xml 9 | 10 | # Crashlytics plugin (for Android Studio and IntelliJ) 11 | com_crashlytics_export_strings.xml 12 | crashlytics.properties 13 | crashlytics-build.properties 14 | fabric.properties 15 | 16 | # ignore IDE/hidden/OS cache files 17 | .* 18 | *~ 19 | nbproject 20 | nb-configuration.xml 21 | Session.vim 22 | *.tmproj 23 | *.tmproject 24 | tmtags 25 | Thumbs.db 26 | Desktop.ini 27 | 28 | # add exception for workflow folder 29 | !.github 30 | 31 | # ignore Composer downloads 32 | /vendor/* 33 | /Quick_ACG/vendor/* 34 | 35 | # keep some hiddens 36 | !.htaccess 37 | !/.gitignore 38 | !/.travis.yml 39 | 40 | # ignore twig cache 41 | /templates/twig_cache/* 42 | 43 | # do not check in secrets 44 | ds_config.php 45 | private.key 46 | debug.log 47 | public/demo_documents/ExportedUserData.csv 48 | JWTConsoleApp/vendor/* 49 | JWTConsoleApp/ds_config_jwt_mini.php 50 | Quick_ACG/vendor/* 51 | public/demo_documents/web-form-config.json -------------------------------------------------------------------------------- /src/Services/Examples/Admin/RetrieveDocuSignProfileByUserId.php: -------------------------------------------------------------------------------- 1 | getUsersApi(); 25 | 26 | $usersResponse = $usersApi->getUserDSProfile($organizationId, $userId); 27 | #ds-snippet-end:Admin7Step3 28 | 29 | return json_decode((string) $usersResponse, true); 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /composer.json: -------------------------------------------------------------------------------- 1 | { 2 | "autoload": { 3 | "psr-4": { 4 | "DocuSign\\": "src/" 5 | } 6 | }, 7 | "autoload-dev": { 8 | "psr-4": { 9 | "DocuSign\\Tests\\": "tests/" 10 | } 11 | }, 12 | "scripts": { 13 | "test": "./vendor/bin/phpunit tests" 14 | }, 15 | "config": { 16 | "process-timeout": 0 17 | }, 18 | "description": "DocuSign PHP launcher", 19 | "require": { 20 | "docusign/admin-client": "^2.0.0", 21 | "docusign/click-client": "^1.4.1", 22 | "docusign/esign-client": "^8.4.0", 23 | "docusign/rooms-client": "^2.1.1", 24 | "docusign/monitor-client": "^1.2.1", 25 | "docusign/webforms-client": "^2.1.0", 26 | "twig/twig": "^3.21.1", 27 | "league/oauth2-client": "^2.7.0", 28 | "ext-json": "*", 29 | "guzzlehttp/guzzle": "7.9.3", 30 | "firebase/php-jwt": "6.11.1", 31 | "mashape/unirest-php": "3.0.4", 32 | "squizlabs/php_codesniffer": "*", 33 | "phpunit/phpunit": "^11.4.3" 34 | }, 35 | "require-dev": { 36 | "squizlabs/php_codesniffer": "*" 37 | } 38 | } -------------------------------------------------------------------------------- /src/Services/Examples/Maestro/GetWorkflowStatusService.php: -------------------------------------------------------------------------------- 1 | getWorkflowInstance( 27 | $accountId, 28 | $workflowId, 29 | $instanceId 30 | ); 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /templates/must_authenticate.html: -------------------------------------------------------------------------------- 1 | {% extends "base.html" %} 2 | {% block content %} 3 | 4 |
5 |
6 |
7 | {{ common_texts["LoginPage"]["LoginHeader"] | raw }} 8 | 12 |
13 | 14 |
15 | 16 | 17 |
18 | 19 |
20 |
21 |

{{ common_texts["LoginPage"]["LoginHelperText"] | raw }}

22 |
23 | {% endblock %} 24 | -------------------------------------------------------------------------------- /src/Services/Examples/eSignature/EnvelopeInfoService.php: -------------------------------------------------------------------------------- 1 | getEnvelopeApi(); 24 | try { 25 | $envelopeId = $envelope_api->getEnvelope($args['account_id'], $args['envelope_id']); 26 | } catch (ApiException $e) { 27 | $clientService->showErrorTemplate($e); 28 | exit; 29 | } 30 | 31 | return $envelopeId; 32 | } 33 | #ds-snippet-end:eSign4Step2 34 | } 35 | -------------------------------------------------------------------------------- /src/Services/Utils.php: -------------------------------------------------------------------------------- 1 | setHost($base_path); 24 | $config->addDefaultHeader('Authorization', 'Bearer ' . $access_token); 25 | $this->api_client = new ApiClient($config); 26 | 27 | $accountsApi = new AccountsApi($this->api_client); 28 | $accountDetails = $accountsApi->getAccountInformation($account_id); 29 | return $accountDetails["status21_cfr_part11"]; 30 | } catch (ApiException $ex) { 31 | return null; 32 | } 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /PAYMENTS_INSTALLATION.md: -------------------------------------------------------------------------------- 1 | # Configure a payment gateway 2 | 3 | DocuSign offers built-in connections to multiple payment gateways. The payments code example uses a developer account via the Stripe gateway service. 4 | 5 | 6 | ## Create a Stripe payment gateway 7 | 8 | 1. Select the Stripe button on the [**Payments**](https://admindemo.docusign.com/authenticate?goTo=payments) page in your developer account. 9 | 10 | 1. For development, you can skip the Stripe account application by using the **Skip this account form** link at the top of the page.
11 | 12 | ![Skipping the Stripe account form](docs/stripe_skip_account_form_link.png) 13 | 14 | An enabled Stripe payment gateway is now associated with your DocuSign developer account and is shown under **Payment Gateway**. 15 | 16 | 1. Save the **Gateway Account ID** GUID to the code example launcher configuration file. 17 | 18 | 19 | ## Additional documentation 20 | * [Managing Payment Gateways](https://support.docusign.com/en/guides/managing-payment-gateways) 21 | * [How to send a request for payment](https://developers.docusign.com/docs/esign-rest-api/how-to/request-a-payment) 22 | -------------------------------------------------------------------------------- /src/Services/Examples/eSignature/EnvelopeRecipientsService.php: -------------------------------------------------------------------------------- 1 | getEnvelopeApi(); 25 | try { 26 | $listRecipients = $envelope_api->listRecipients($args['account_id'], $args['envelope_id']); 27 | } catch (ApiException $e) { 28 | $clientService->showErrorTemplate($e); 29 | exit; 30 | } 31 | 32 | return $listRecipients; 33 | #ds-snippet-end:eSign5Step2 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /src/Services/Examples/eSignature/EnvelopeDocsService.php: -------------------------------------------------------------------------------- 1 | getEnvelopeApi(); 25 | try { 26 | $listDocuments = $envelope_api->listDocuments($args['account_id'], $args['envelope_id']); 27 | } catch (ApiException $e) { 28 | $clientService->showErrorTemplate($e); 29 | exit; 30 | } 31 | #ds-snippet-end:eSign6Step3 32 | return $listDocuments; 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License 2 | 3 | Copyright (c) 2024 Docusign, Inc. (https://www.docusign.com) 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /src/Services/Examples/eSignature/PermissionDeleteService.php: -------------------------------------------------------------------------------- 1 | getAccountsApi(); 22 | 23 | try { 24 | # Call the eSignature REST API 25 | #ds-snippet-start:eSign27Step3 26 | $accounts_api->deletePermissionProfile( 27 | $args['account_id'], 28 | $args['permission_args']['permission_profile_id'] 29 | ); 30 | #ds-snippet-end:eSign27Step3 31 | } catch (ApiException $e) { 32 | $clientService->showErrorTemplate($e); 33 | exit; 34 | } 35 | 36 | return "The permission profile has been deleted!"; 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /src/Services/Examples/Click/GetClickwrapsService.php: -------------------------------------------------------------------------------- 1 | accountsApi(); 23 | $options = new GetClickwrapsOptions(); 24 | $clickwrapVersionsResponse = $accountsApi->getClickwraps($args['account_id'], $options); 25 | #ds-snippet-end:Click4Step3 26 | } catch (ApiException $e) { 27 | $clientService->showErrorTemplate($e); 28 | exit; 29 | } 30 | return $clickwrapVersionsResponse; 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /src/Services/Examples/Admin/CheckImportRequestStatusService.php: -------------------------------------------------------------------------------- 1 | bulkImportsApi(); 23 | 24 | # Step 4 start 25 | $response = $bulkImport->getBulkUserImportRequest( 26 | $organizationId, 27 | $importId 28 | ); 29 | 30 | if ($response->getStatus()== "queued") { 31 | return "Please refresh the page"; 32 | } else { 33 | unset($_SESSION['import_id']); 34 | return $response->__toString(); 35 | } 36 | 37 | # Step 4 end 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /templates/example_done.html: -------------------------------------------------------------------------------- 1 | {% extends "base.html" %} {% block content %} 2 | 3 | 4 |

{{ h1 }}

5 |

{{ message | raw }}

6 | 7 | {% if json %} 8 | 9 | 10 |

11 |

12 |

13 | 14 | {% endif %} 15 | 16 | 17 | 18 | {% if url %} 19 | 20 | 21 | {% endif %} 22 | 23 | 24 | {% if import_id == "refreshPage" %} 25 | 26 | {# We're on the refresh page, DO NOTHING, wait for a state other than 'queued' ;) #} 27 | 28 | 29 | {% elseif import_id %} 30 | 31 | 32 |
33 | 34 |

{{ common_texts["ContinueButton"] | raw }}

35 |
36 | {% elseif redirect != null %} 37 |

{{ common_texts["ContinueButton"] | raw }}

38 | {% else %} 39 |

{{ common_texts["ContinueButton"] | raw }}

40 | {% endif %} 41 | 42 | 43 | 44 | {% endblock %} -------------------------------------------------------------------------------- /src/Services/Examples/Admin/RetrieveDocuSignProfileByEmailAddress.php: -------------------------------------------------------------------------------- 1 | getUsersApi(); 26 | 27 | $userOptions = new GetUserDSProfilesByEmailOptions(); 28 | $userOptions->setEmail($email); 29 | 30 | $usersResponse = $usersApi->getUserDSProfilesByEmail($organizationId, $userOptions); 31 | #ds-snippet-end:Admin6Step3 32 | return json_decode((string) $usersResponse, true); 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /phpcs.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | src/Controllers 4 | src/Services 5 | src/EG001EmbeddedSigning.php 6 | public/index.php 7 | */docs/* 8 | */templates/* 9 | */public/assets/* 10 | */public/demo_documents/* 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | -------------------------------------------------------------------------------- /.github/workflows/php.yml: -------------------------------------------------------------------------------- 1 | name: PHP Composer 2 | 3 | on: 4 | push: 5 | branches: [ "master" ] 6 | pull_request: 7 | branches: [ "master" ] 8 | 9 | permissions: 10 | contents: read 11 | 12 | jobs: 13 | build: 14 | runs-on: ubuntu-latest 15 | 16 | steps: 17 | - uses: actions/checkout@v3 18 | 19 | - name: Set up PHP 20 | uses: shivammathur/setup-php@v2 21 | with: 22 | php-version: '8.2' 23 | 24 | - name: Cache Composer packages 25 | id: composer-cache 26 | uses: actions/cache@v3 27 | with: 28 | path: vendor 29 | key: ${{ runner.os }}-php-${{ hashFiles('**/composer.lock') }} 30 | restore-keys: | 31 | ${{ runner.os }}-php- 32 | 33 | - name: Install dependencies 34 | run: composer install --prefer-dist --no-progress 35 | 36 | - name: Run linter 37 | run: vendor/bin/phpcs --standard=phpcs.xml --report=checkstyle src/ -n 38 | 39 | - name: Run tests 40 | env: 41 | CLIENT_ID: ${{ secrets.CLIENT_ID }} 42 | IMPERSONATED_USER_ID: ${{ secrets.IMPERSONATED_USER_ID }} 43 | PRIVATE_KEY: ${{ secrets.PRIVATE_KEY }} 44 | SIGNER_EMAIL: ${{ secrets.SIGNER_EMAIL }} 45 | SIGNER_NAME: ${{ secrets.SIGNER_NAME }} 46 | run: composer run-script test -------------------------------------------------------------------------------- /src/Services/Examples/Admin/DeleteUserDataFromAccountService.php: -------------------------------------------------------------------------------- 1 | setUserId($userId); 29 | #ds-snippet-end:Admin11Step3 30 | 31 | #ds-snippet-start:Admin11Step4 32 | return $accountsApi->redactIndividualMembershipData($accountId, $membershipDataRedaction); 33 | #ds-snippet-end:Admin11Step4 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /src/Controllers/Examples/Home.php: -------------------------------------------------------------------------------- 1 | eg = 'home_esig'; 35 | 36 | if (empty($this->routerService)) { 37 | $this->routerService = $GLOBALS['DS_CONFIG']['quickACG'] === "true" ? new QuickRouterService(): new RouterService(); 38 | } 39 | parent::controller($this->eg); 40 | } 41 | 42 | public function createController(): void 43 | { 44 | } 45 | 46 | public function getTemplateArgs(): array 47 | { 48 | return []; 49 | } 50 | } 51 | -------------------------------------------------------------------------------- /templates/esignature/eg045_restore_envelope.html: -------------------------------------------------------------------------------- 1 | {% extends "base.html" %} {% block content %} 2 | 3 | {% set formNumber = 0 %} 4 | {% set folderNameInputNumber = 1 %} 5 | 6 |

{{ code_example_text['ExampleName'] | raw }}

7 |

{{ code_example_text["ExampleDescription"] | raw }}

8 | 9 |

{{ common_texts["HelpingTexts"]["EnvelopeWillBeRestored"]|replace({ ("{0}"):envelope_id }) | raw }}

10 | 11 |
12 |
13 | 16 | 17 | 21 |
22 | 23 | 24 | 27 |
28 | 29 | {% endblock %} -------------------------------------------------------------------------------- /public/demo_documents/doc_1.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 |

World Wide Corp

9 |

Order Processing Division

12 |

Ordered by {USER_FULLNAME}

13 |

Email: {USER_EMAIL}

14 |

Copy to: {CC_NAME}, {CC_EMAIL}

15 |

16 | Candy bonbon pastry jujubes lollipop wafer biscuit biscuit. Topping brownie sesame snaps sweet roll pie. Croissant danish biscuit soufflé caramels jujubes jelly. Dragée danish caramels lemon drops dragée. Gummi bears cupcake biscuit tiramisu sugar plum pastry. Dragée gummies applicake pudding liquorice. Donut jujubes oat cake jelly-o. Dessert bear claw chocolate cake gummies lollipop sugar plum ice cream gummies cheesecake. 17 |

18 | 19 |

Agreed: **signature_1**/

20 | 21 | 22 | -------------------------------------------------------------------------------- /templates/admin/eg002_bulk_export_user_data.html: -------------------------------------------------------------------------------- 1 | {% extends "base.html" %} 2 | {% block content %} 3 | 4 |

{{ code_example_text['ExampleName'] | raw }}

5 | 6 |

{{ code_example_text["ExampleDescription"] | raw }}

7 | 8 | {% if show_doc %} 9 |

Documentation about this example.

10 | {% endif %} 11 | 12 |

13 | {% if code_example_text["LinksToAPIMethod"] | length == 1 %} 14 | {{ common_texts["APIMethodUsed"] | raw }} 15 | {% else %} 16 | {{ common_texts["APIMethodUsedPlural"] | raw }} 17 | {% endif %} 18 | 19 | {% for i in 0..(code_example_text["LinksToAPIMethod"] | length - 1) %} 20 | 21 | {{ code_example_text['LinksToAPIMethod'][i]['PathName'] | raw}} 22 | 23 | 24 | {% if i + 1 == code_example_text["LinksToAPIMethod"] | length - 1 %} 25 | and 26 | {% elseif i + 1 != code_example_text["LinksToAPIMethod"] | length %} 27 | , 28 | {% endif %} 29 | {% endfor %} 30 |

31 | 32 |
33 | 34 | 35 |
36 | {% endblock %} 37 | -------------------------------------------------------------------------------- /src/Services/Examples/eSignature/PermissionCreateService.php: -------------------------------------------------------------------------------- 1 | getAccountsApi(); 26 | $permission_profile = new PermissionProfile($args['permission_args']); 27 | #ds-snippet-end:eSign24Step3 28 | try { 29 | # Step 4. Call the eSignature REST API 30 | #ds-snippet-start:eSign24Step4 31 | $permissionProfile = $accounts_api->createPermissionProfile( 32 | $args['account_id'], 33 | $permission_profile 34 | ); 35 | #ds-snippet-end:eSign24Step4 36 | } catch (ApiException $e) { 37 | $clientService->showErrorTemplate($e); 38 | exit; 39 | } 40 | 41 | return $permissionProfile; 42 | } 43 | # 44 | } 45 | -------------------------------------------------------------------------------- /src/Services/Examples/eSignature/PermissionSetUserGroupService.php: -------------------------------------------------------------------------------- 1 | getGroupsApi(); 25 | $group = new Group($args['permission_args']); 26 | $group_information = new GroupInformation(['groups' => [$group]]); 27 | #ds-snippet-end:eSign25Step3 28 | try { 29 | # Step 4. call the eSignature REST API 30 | #ds-snippet-start:eSign25Step4 31 | $updatedGroups = $groups_api->updateGroups( 32 | $args['account_id'], 33 | $group_information 34 | ); 35 | #ds-snippet-end:eSign25Step4 36 | } catch (ApiException $e) { 37 | $clientService->showErrorTemplate($e); 38 | exit; 39 | } 40 | 41 | return $updatedGroups; 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /src/Services/Examples/eSignature/EmbeddedConsoleService.php: -------------------------------------------------------------------------------- 1 | $args['ds_return_url']]); 26 | if ($args['starting_view'] == "envelope" && $args['envelope_id']) { 27 | $view_request->setEnvelopeId($args['envelope_id']); 28 | } 29 | 30 | # 2. Call the API method 31 | $envelope_api = $clientService->getEnvelopeApi(); 32 | $consoleView = $envelope_api->createConsoleView($args['account_id'], $view_request); 33 | $url = $consoleView['url']; 34 | #ds-snippet-end:eSign12Step2 35 | 36 | return ['redirect_url' => $url]; 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /src/Controllers/Examples/Click/EG004GetClickwraps.php: -------------------------------------------------------------------------------- 1 | checkDsToken(); 34 | $clickwrapResponse = GetClickwrapsService::getClickwraps($this->args, $this->clientService); 35 | 36 | if ($clickwrapResponse) { 37 | $clickwrapResponse = json_decode((string)$clickwrapResponse, true); 38 | $this->clientService->showDoneTemplateFromManifest( 39 | $this->codeExampleText, 40 | json_encode(json_encode($clickwrapResponse)) 41 | ); 42 | } 43 | } 44 | 45 | public function getTemplateArgs(): array 46 | { 47 | $default = $this->getDefaultTemplateArgs(); 48 | 49 | return $default; 50 | } 51 | } 52 | -------------------------------------------------------------------------------- /src/Services/Examples/Rooms/ExportDataFromRoomService.php: -------------------------------------------------------------------------------- 1 | getRoomsApi(); 21 | try { 22 | $room_details = $rooms_api->getRoomFieldData($args['room_id'], $args["account_id"]); 23 | } catch (ApiException $e) { 24 | error_log($e); 25 | $clientService->showErrorTemplate($e); 26 | exit; 27 | } 28 | #ds-snippet-end:Rooms3Step3 29 | return $room_details; 30 | } 31 | 32 | /** 33 | * Get available Rooms 34 | * 35 | * @param $routerService 36 | * @param $clientService 37 | * @param $args 38 | * @param $eg 39 | * @return array 40 | */ 41 | public static function getRooms($routerService, $clientService, $args, $eg): array 42 | { 43 | if ($routerService->dsTokenOk($GLOBALS['DS_CONFIG']['minimum_buffer_min'])) { 44 | return $clientService->getRooms($args); 45 | } else { 46 | $clientService->needToReAuth($eg); 47 | } 48 | } 49 | } 50 | -------------------------------------------------------------------------------- /templates/webforms/eg001_embed_form.html: -------------------------------------------------------------------------------- 1 | {% extends "base.html" %} 2 | {% block content %} 3 | 4 |

{{ code_example_text['ExampleName'] | raw }}

5 | 6 |

{{ code_example_text["ExampleDescription"] | raw }}

7 | {% if show_doc %} 8 |

Documentation about this example.

9 | {% endif %} 10 | 11 |

12 | {% if code_example_text["LinksToAPIMethod"] | length == 1 %} 13 | {{ common_texts["APIMethodUsed"] | raw }} 14 | {% else %} 15 | {{ common_texts["APIMethodUsedPlural"] | raw }} 16 | {% endif %} 17 | 18 | {% for i in 0..(code_example_text["LinksToAPIMethod"] | length - 1) %} 19 | 20 | {{ code_example_text['LinksToAPIMethod'][i]['PathName'] | raw}} 21 | 22 | 23 | {% if i + 1 == code_example_text["LinksToAPIMethod"] | length - 1 %} 24 | and 25 | {% elseif i + 1 != code_example_text["LinksToAPIMethod"] | length %} 26 | , 27 | {% endif %} 28 | {% endfor %} 29 |

30 | 31 |

32 | {{ common_texts["ViewSourceFile"]|replace({ ("{0}"): ("%s"|format(source_url, 33 | source_file)) })| raw }} 34 |

35 | 36 |
37 |
38 | 39 | 40 | 41 | 42 | {% endblock %} -------------------------------------------------------------------------------- /templates/admin/eg004_bulk_import_user_data.html: -------------------------------------------------------------------------------- 1 | {% extends "base.html" %} 2 | {% block content %} 3 | 4 |

{{ code_example_text['ExampleName'] | raw }}

5 | 6 |

{{ code_example_text["ExampleDescription"] | raw }}

7 | 8 | {% if show_doc %} 9 |

Documentation about this example.

10 | {% endif %} 11 | 12 |

13 | {% if code_example_text["LinksToAPIMethod"] | length == 1 %} 14 | {{ common_texts["APIMethodUsed"] | raw }} 15 | {% else %} 16 | {{ common_texts["APIMethodUsedPlural"] | raw }} 17 | {% endif %} 18 | 19 | {% for i in 0..(code_example_text["LinksToAPIMethod"] | length - 1) %} 20 | 21 | {{ code_example_text['LinksToAPIMethod'][i]['PathName'] | raw}} 22 | 23 | 24 | {% if i + 1 == code_example_text["LinksToAPIMethod"] | length - 1 %} 25 | and 26 | {% elseif i + 1 != code_example_text["LinksToAPIMethod"] | length %} 27 | , 28 | {% endif %} 29 | {% endfor %} 30 |

31 | 32 |

33 | {{ common_texts["ViewSourceFile"]|replace({ ("{0}"): ("%s"|format(source_url, source_file)) })| raw }} 34 |

35 | 36 |
37 | 38 | 39 |
40 | 41 | {% endblock %} 42 | -------------------------------------------------------------------------------- /templates/webforms/eg002_create_remote_instance.html: -------------------------------------------------------------------------------- 1 | {% extends "base.html" %} 2 | {% block content %} 3 | 4 |

{{ code_example_text['ExampleName'] | raw }}

5 | 6 |

{{ code_example_text["ExampleDescription"] | raw }}

7 | {% if show_doc %} 8 |

Documentation about this example.

9 | {% endif %} 10 | 11 |

12 | {% if code_example_text["LinksToAPIMethod"] | length == 1 %} 13 | {{ common_texts["APIMethodUsed"] | raw }} 14 | {% else %} 15 | {{ common_texts["APIMethodUsedPlural"] | raw }} 16 | {% endif %} 17 | 18 | {% for i in 0..(code_example_text["LinksToAPIMethod"] | length - 1) %} 19 | 20 | {{ code_example_text['LinksToAPIMethod'][i]['PathName'] | raw}} 21 | 22 | 23 | {% if i + 1 == code_example_text["LinksToAPIMethod"] | length - 1 %} 24 | and 25 | {% elseif i + 1 != code_example_text["LinksToAPIMethod"] | length %} 26 | , 27 | {% endif %} 28 | {% endfor %} 29 |

30 | 31 |

32 | {{ common_texts["ViewSourceFile"]|replace({ ("{0}"): ("%s"|format(source_url, 33 | source_file)) })| raw }} 34 |

35 | 36 |
37 |
38 | 39 | 40 | 41 | 42 | {% endblock %} -------------------------------------------------------------------------------- /templates/admin/eg005_audit_users.html: -------------------------------------------------------------------------------- 1 | {% extends "base.html" %} 2 | {% block content %} 3 | 4 |

{{ code_example_text['ExampleName'] | raw }}

5 | 6 |

{{ code_example_text["ExampleDescription"] | raw }}

7 | 8 | 9 | {% if show_doc %} 10 |

Documentation about this example.

11 | {% endif %} 12 | 13 |

14 | {% if code_example_text["LinksToAPIMethod"] | length == 1 %} 15 | {{ common_texts["APIMethodUsed"] | raw }} 16 | {% else %} 17 | {{ common_texts["APIMethodUsedPlural"] | raw }} 18 | {% endif %} 19 | 20 | {% for i in 0..(code_example_text["LinksToAPIMethod"] | length - 1) %} 21 | 22 | {{ code_example_text['LinksToAPIMethod'][i]['PathName'] | raw}} 23 | 24 | 25 | {% if i + 1 == code_example_text["LinksToAPIMethod"] | length - 1 %} 26 | and 27 | {% elseif i + 1 != code_example_text["LinksToAPIMethod"] | length %} 28 | , 29 | {% endif %} 30 | {% endfor %} 31 |

32 | 33 |

34 | {{ common_texts["ViewSourceFile"]|replace({ ("{0}"): ("%s"|format(source_url, source_file)) })| raw }} 35 |

36 | 37 |
38 | 39 | 40 |
41 | 42 | {% endblock %} 43 | -------------------------------------------------------------------------------- /templates/click/eg004_get_clickwraps.html: -------------------------------------------------------------------------------- 1 | {% extends "base.html" %} 2 | {% block content %} 3 | 4 |

{{ code_example_text['ExampleName'] | raw }}

5 | 6 |

{{ code_example_text["ExampleDescription"] | raw }}

7 | 8 | {% if show_doc %} 9 |

Documentation about this example.

10 | {% endif %} 11 | 12 |

13 | {% if code_example_text["LinksToAPIMethod"] | length == 1 %} 14 | {{ common_texts["APIMethodUsed"] | raw }} 15 | {% else %} 16 | {{ common_texts["APIMethodUsedPlural"] | raw }} 17 | {% endif %} 18 | 19 | {% for i in 0..(code_example_text["LinksToAPIMethod"] | length - 1) %} 20 | 21 | {{ code_example_text['LinksToAPIMethod'][i]['PathName'] | raw}} 22 | 23 | 24 | {% if i + 1 == code_example_text["LinksToAPIMethod"] | length - 1 %} 25 | and 26 | {% elseif i + 1 != code_example_text["LinksToAPIMethod"] | length %} 27 | , 28 | {% endif %} 29 | {% endfor %} 30 |

31 | 32 |

33 | {{ common_texts["ViewSourceFile"]|replace({ ("{0}"): ("%s"|format(source_url, source_file)) })| raw }} 34 |

35 | 36 |
37 | 38 | 39 |
40 | 41 | {% endblock %} 42 | -------------------------------------------------------------------------------- /templates/admin/eg003_bulk_export_user_data.html: -------------------------------------------------------------------------------- 1 | {% extends "base.html" %} 2 | {% block content %} 3 | 4 |

{{ code_example_text['ExampleName'] | raw }}

5 | 6 |

{{ code_example_text["ExampleDescription"] | raw }}

7 | 8 | {% if show_doc %} 9 |

Documentation about this example.

10 | {% endif %} 11 | 12 |

13 | {% if code_example_text["LinksToAPIMethod"] | length == 1 %} 14 | {{ common_texts["APIMethodUsed"] | raw }} 15 | {% else %} 16 | {{ common_texts["APIMethodUsedPlural"] | raw }} 17 | {% endif %} 18 | 19 | {% for i in 0..(code_example_text["LinksToAPIMethod"] | length - 1) %} 20 | 21 | {{ code_example_text['LinksToAPIMethod'][i]['PathName'] | raw}} 22 | 23 | 24 | {% if i + 1 == code_example_text["LinksToAPIMethod"] | length - 1 %} 25 | and 26 | {% elseif i + 1 != code_example_text["LinksToAPIMethod"] | length %} 27 | , 28 | {% endif %} 29 | {% endfor %} 30 |

31 | 32 |

33 | {{ common_texts["ViewSourceFile"]|replace({ ("{0}"): ("%s"|format(source_url, source_file)) })| raw }} 34 |

35 | 36 | 37 |
38 | 39 | 40 |
41 | {% endblock %} 42 | -------------------------------------------------------------------------------- /templates/esignature/eg003_list_envelopes.html: -------------------------------------------------------------------------------- 1 | {% extends "base.html" %} {% block content %} 2 | 3 |

{{ code_example_text['ExampleName'] | raw }}

4 |

{{ code_example_text["ExampleDescription"] | raw }}

5 | 6 | {% if show_doc %} 7 |

Documentation about this example.

8 | {% endif %} 9 | 10 |

11 | {% if code_example_text["LinksToAPIMethod"] | length == 1 %} 12 | {{ common_texts["APIMethodUsed"] | raw }} 13 | {% else %} 14 | {{ common_texts["APIMethodUsedPlural"] | raw }} 15 | {% endif %} 16 | 17 | {% for i in 0..(code_example_text["LinksToAPIMethod"] | length - 1) %} 18 | 19 | {{ code_example_text['LinksToAPIMethod'][i]['PathName'] | raw}} 20 | 21 | 22 | {% if i + 1 == code_example_text["LinksToAPIMethod"] | length - 1 %} 23 | and 24 | {% elseif i + 1 != code_example_text["LinksToAPIMethod"] | length %} 25 | , 26 | {% endif %} 27 | {% endfor %} 28 |

29 |

30 | {{ common_texts["ViewSourceFile"]|replace({ ("{0}"): ("%s"|format(source_url, source_file)) })| raw }} 31 |

32 | 33 |
34 | 35 | 36 |
37 | 38 | {% endblock %} 39 | -------------------------------------------------------------------------------- /src/Services/Examples/eSignature/UnpauseSignatureWorkflowService.php: -------------------------------------------------------------------------------- 1 | new Workflow(['workflow_status' => 'in_progress']) 27 | ]); 28 | $envelope_api = $clientService->getEnvelopeApi(); 29 | $envelope_option = new UpdateOptions(); 30 | 31 | # Update resend envelope parameter 32 | $envelope_option->setResendEnvelope('true'); 33 | #ds-snippet-end:eSign33Step3 34 | 35 | # Call Envelopes::update API method to unpause signature workflow 36 | #ds-snippet-start:eSign33Step4 37 | $envelope = $envelope_api->update( 38 | $args['account_id'], 39 | $args['pause_envelope_id'], 40 | $env, 41 | $envelope_option 42 | ); 43 | #ds-snippet-end:eSign33Step4 44 | 45 | return $envelope; 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /templates/esignature/eg008_create_template.html: -------------------------------------------------------------------------------- 1 | {% extends "base.html" %} {% block content %} 2 | 3 |

{{ code_example_text['ExampleName'] | raw }}

4 |

{{ code_example_text["ExampleDescription"] | raw }}

5 | 6 | {% if show_doc %} 7 |

Documentation about this example.

8 | {% endif %} 9 | 10 |

11 | {% if code_example_text["LinksToAPIMethod"] | length == 1 %} 12 | {{ common_texts["APIMethodUsed"] | raw }} 13 | {% else %} 14 | {{ common_texts["APIMethodUsedPlural"] | raw }} 15 | {% endif %} 16 | 17 | {% for i in 0..(code_example_text["LinksToAPIMethod"] | length - 1) %} 18 | 19 | {{ code_example_text['LinksToAPIMethod'][i]['PathName'] | raw}} 20 | 21 | 22 | {% if i + 1 == code_example_text["LinksToAPIMethod"] | length - 1 %} 23 | and 24 | {% elseif i + 1 != code_example_text["LinksToAPIMethod"] | length %} 25 | , 26 | {% endif %} 27 | {% endfor %} 28 |

29 | 30 |

31 | {{ common_texts["ViewSourceFile"]|replace({ ("{0}"): ("%s"|format(source_url, source_file)) })| raw }} 32 |

33 | 34 |
35 | 36 | 37 |
38 | 39 | {% endblock %} 40 | -------------------------------------------------------------------------------- /templates/admin/eg004a_check_import_request_status.html: -------------------------------------------------------------------------------- 1 | {% extends "base.html" %} 2 | {% block content %} 3 | 4 |

{{ code_example_text['ExampleName'] | raw }}

5 | 6 |

{{ code_example_text["ExampleDescription"] | raw }}

7 | 8 | {% if show_doc %} 9 |

Documentation about this example.

10 | {% endif %} 11 | 12 |

13 | {% if code_example_text["LinksToAPIMethod"] | length == 1 %} 14 | {{ common_texts["APIMethodUsed"] | raw }} 15 | {% else %} 16 | {{ common_texts["APIMethodUsedPlural"] | raw }} 17 | {% endif %} 18 | 19 | {% for i in 0..(code_example_text["LinksToAPIMethod"] | length - 1) %} 20 | 21 | {{ code_example_text['LinksToAPIMethod'][i]['PathName'] | raw}} 22 | 23 | 24 | {% if i + 1 == code_example_text["LinksToAPIMethod"] | length - 1 %} 25 | and 26 | {% elseif i + 1 != code_example_text["LinksToAPIMethod"] | length %} 27 | , 28 | {% endif %} 29 | {% endfor %} 30 |

31 | 32 | {% if import_id == 1 %} 33 |
34 | 35 | 36 |
37 | {% else %} 38 |

39 | Problem: please first bulk import user data using example 4.
40 | Thank you. 41 |

42 | {% endif %} 43 | 44 | {% endblock %} 45 | -------------------------------------------------------------------------------- /templates/monitor/eg001_get_monitoring_data.html: -------------------------------------------------------------------------------- 1 | {% extends "base.html" %} {% block content %} 2 | 3 |

{{ code_example_text['ExampleName'] | raw }}

4 | 5 |

{{ code_example_text["ExampleDescription"] | raw }}

6 | 7 | {% if show_doc %} 8 |

Documentation about this example.

9 | {% endif %} 10 | 11 |

12 | {% if code_example_text["LinksToAPIMethod"] | length == 1 %} 13 | {{ common_texts["APIMethodUsed"] | raw }} 14 | {% else %} 15 | {{ common_texts["APIMethodUsedPlural"] | raw }} 16 | {% endif %} 17 | 18 | {% for i in 0..(code_example_text["LinksToAPIMethod"] | length - 1) %} 19 | 20 | {{ code_example_text['LinksToAPIMethod'][i]['PathName'] | raw}} 21 | 22 | 23 | {% if i + 1 == code_example_text["LinksToAPIMethod"] | length - 1 %} 24 | and 25 | {% elseif i + 1 != code_example_text["LinksToAPIMethod"] | length %} 26 | , 27 | {% endif %} 28 | {% endfor %} 29 |

30 | 31 |

32 | {{ common_texts["ViewSourceFile"]|replace({ ("{0}"): ("%s"|format(source_url, source_file)) })| raw }} 33 |

34 | 35 |
36 | 37 | 38 |
39 | 40 | {% endblock %} 41 | -------------------------------------------------------------------------------- /src/Services/Examples/eSignature/PermissionChangeSingleSettingService.php: -------------------------------------------------------------------------------- 1 | getAccountsApi(); 24 | $permission_profile = new PermissionProfile(); 25 | $permission_profile->setSettings($args['permission_args']['settings']); 26 | #ds-snippet-end:eSign26Step3 27 | 28 | try { 29 | # Step 4. Call the eSignature REST API 30 | #ds-snippet-start:eSign26Step4 31 | $updateProfileResponse = $accounts_api->updatePermissionProfile( 32 | $args['account_id'], 33 | $args['permission_args']['permission_profile_id'], 34 | $permission_profile 35 | ); 36 | #ds-snippet-end:eSign26Step4 37 | } catch (ApiException $e) { 38 | $clientService->showErrorTemplate($e); 39 | exit; 40 | } 41 | 42 | return $updateProfileResponse; 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /templates/admin/eg003_check_request_status.html: -------------------------------------------------------------------------------- 1 | {% extends "base.html" %} 2 | {% block content %} 3 | 4 |

{{ code_example_text['ExampleName'] | raw }}

5 | 6 |

{{ code_example_text["ExampleDescription"] | raw }}

7 | 8 | {% if show_doc %} 9 |

Documentation about this example.

10 | {% endif %} 11 | 12 |

13 | {% if code_example_text["LinksToAPIMethod"] | length == 1 %} 14 | {{ common_texts["APIMethodUsed"] | raw }} 15 | {% else %} 16 | {{ common_texts["APIMethodUsedPlural"] | raw }} 17 | {% endif %} 18 | 19 | {% for i in 0..(code_example_text["LinksToAPIMethod"] | length - 1) %} 20 | 21 | {{ code_example_text['LinksToAPIMethod'][i]['PathName'] | raw}} 22 | 23 | 24 | {% if i + 1 == code_example_text["LinksToAPIMethod"] | length - 1 %} 25 | and 26 | {% elseif i + 1 != code_example_text["LinksToAPIMethod"] | length %} 27 | , 28 | {% endif %} 29 | {% endfor %} 30 |

31 | 32 | {% if export_id == 1 %} 33 |
34 | 35 | 36 |
37 | {% else %} 38 |

39 | Problem: please first bulk export user data using example 2.
40 | Thank you. 41 |

42 | {% endif %} 43 | 44 | {% endblock %} 45 | -------------------------------------------------------------------------------- /templates/admin/eg003a_check_request_status.html: -------------------------------------------------------------------------------- 1 | {% extends "base.html" %} 2 | {% block content %} 3 | 4 |

{{ code_example_text['ExampleName'] | raw }}

5 | 6 |

{{ code_example_text["ExampleDescription"] | raw }}

7 | 8 | {% if show_doc %} 9 |

Documentation about this example.

10 | {% endif %} 11 | 12 |

13 | {% if code_example_text["LinksToAPIMethod"] | length == 1 %} 14 | {{ common_texts["APIMethodUsed"] | raw }} 15 | {% else %} 16 | {{ common_texts["APIMethodUsedPlural"] | raw }} 17 | {% endif %} 18 | 19 | {% for i in 0..(code_example_text["LinksToAPIMethod"] | length - 1) %} 20 | 21 | {{ code_example_text['LinksToAPIMethod'][i]['PathName'] | raw}} 22 | 23 | 24 | {% if i + 1 == code_example_text["LinksToAPIMethod"] | length - 1 %} 25 | and 26 | {% elseif i + 1 != code_example_text["LinksToAPIMethod"] | length %} 27 | , 28 | {% endif %} 29 | {% endfor %} 30 |

31 | 32 | {% if export_id == 1 %} 33 |
34 | 35 | 36 |
37 | {% else %} 38 |

39 | Problem: please first bulk export user data using example 3.
40 | Thank you. 41 |

42 | {% endif %} 43 | 44 | {% endblock %} 45 | -------------------------------------------------------------------------------- /templates/admin/eg005_check_import_request_status.html: -------------------------------------------------------------------------------- 1 | {% extends "base.html" %} 2 | {% block content %} 3 | 4 |

{{ code_example_text['ExampleName'] | raw }}

5 | 6 |

{{ code_example_text["ExampleDescription"] | raw }}

7 | 8 | {% if show_doc %} 9 |

Documentation about this example.

10 | {% endif %} 11 | 12 |

13 | {% if code_example_text["LinksToAPIMethod"] | length == 1 %} 14 | {{ common_texts["APIMethodUsed"] | raw }} 15 | {% else %} 16 | {{ common_texts["APIMethodUsedPlural"] | raw }} 17 | {% endif %} 18 | 19 | {% for i in 0..(code_example_text["LinksToAPIMethod"] | length - 1) %} 20 | 21 | {{ code_example_text['LinksToAPIMethod'][i]['PathName'] | raw}} 22 | 23 | 24 | {% if i + 1 == code_example_text["LinksToAPIMethod"] | length - 1 %} 25 | and 26 | {% elseif i + 1 != code_example_text["LinksToAPIMethod"] | length %} 27 | , 28 | {% endif %} 29 | {% endfor %} 30 |

31 | 32 | {% if import_id == 1 %} 33 |
34 | 35 | 36 |
37 | {% else %} 38 |

39 | Problem: please first bulk import user data using example 4.
40 | Thank you. 41 |

42 | {% endif %} 43 | 44 | {% endblock %} 45 | -------------------------------------------------------------------------------- /tests/Click/CreateClickwrapTest.php: -------------------------------------------------------------------------------- 1 | templateName, $testConfig); 23 | $testConfig->setTemplateId($templateInformation["template_id"]); 24 | 25 | JWTLoginMethod::jwtAuthenticationMethod(ApiTypes::CLICK, $testConfig); 26 | 27 | // Act 28 | $clickwrapVersionSummaryResponse = DocuSignHelpers::createClickwrapMethod($this->clickwrapName, $testConfig); 29 | 30 | $testConfig->setClickwrapId($clickwrapVersionSummaryResponse["clickwrap_id"]); 31 | $testConfig->setClickwrapVersionNumber($clickwrapVersionSummaryResponse["version_number"]); 32 | 33 | // Assert 34 | $this->assertNotEmpty($clickwrapVersionSummaryResponse); 35 | $this->assertNotNull($clickwrapVersionSummaryResponse); 36 | $this->assertEquals($this->clickwrapName, $clickwrapVersionSummaryResponse["clickwrap_name"]); 37 | } 38 | } -------------------------------------------------------------------------------- /Dockerfile: -------------------------------------------------------------------------------- 1 | FROM composer:2 as composer_stage 2 | 3 | RUN rm -rf /var/www && mkdir -p /var/www/html 4 | WORKDIR /var/www/html 5 | 6 | FROM php:8.2-fpm-alpine 7 | 8 | # Install dev dependencies 9 | RUN apk add --no-cache --virtual .build-deps \ 10 | $PHPIZE_DEPS \ 11 | curl-dev \ 12 | imagemagick-dev \ 13 | libtool \ 14 | libxml2-dev \ 15 | linux-headers # Add linux-headers here 16 | 17 | # Install production dependencies 18 | RUN apk add --no-cache \ 19 | bash \ 20 | curl \ 21 | g++ \ 22 | gcc \ 23 | git \ 24 | imagemagick \ 25 | libc-dev \ 26 | libpng-dev \ 27 | make \ 28 | yarn \ 29 | openssh-client \ 30 | rsync \ 31 | zlib-dev \ 32 | libzip-dev 33 | 34 | # Install PECL and PEAR extensions 35 | RUN pecl install \ 36 | imagick \ 37 | xdebug 38 | 39 | # Workaround for iconv with PHP8 40 | RUN apk add gnu-libiconv=1.15-r3 --update-cache --repository http://dl-cdn.alpinelinux.org/alpine/v3.13/community/ --allow-untrusted 41 | ENV LD_PRELOAD /usr/lib/preloadable_libiconv.so 42 | 43 | # Install and enable PHP extensions 44 | RUN docker-php-ext-enable \ 45 | imagick \ 46 | xdebug 47 | RUN docker-php-ext-configure zip 48 | RUN docker-php-ext-install \ 49 | curl \ 50 | pdo \ 51 | pdo_mysql \ 52 | pcntl \ 53 | xml \ 54 | gd \ 55 | zip \ 56 | bcmath 57 | 58 | WORKDIR /var/www/html 59 | COPY src src/ 60 | COPY --from=composer_stage /usr/bin/composer /usr/bin/composer 61 | COPY composer.json /var/www/html/ 62 | # Install composer dependencies 63 | RUN composer install --no-dev --optimize-autoloader 64 | 65 | CMD ["php-fpm"] 66 | 67 | EXPOSE 9000 68 | -------------------------------------------------------------------------------- /src/Services/Examples/Admin/BulkImportUserDataService.php: -------------------------------------------------------------------------------- 1 | getAccountId($emailAddress); 22 | $accountId = $_SESSION["ds_account_id"]; 23 | $csvFile = dirname(__DIR__, 4) . "/public/demo_documents/bulkimport.csv"; 24 | $str = file_get_contents($csvFile); 25 | $str = str_replace("", $accountId, $str); 26 | 27 | 28 | 29 | file_put_contents($csvFile, $str); 30 | 31 | #ds-snippet-start:Admin4Step3 32 | $bulkImport = $clientService->bulkImportsApi(); 33 | $organizationImportResponse = $bulkImport->createBulkImportAddUsersRequest( 34 | $organizationId, 35 | new SplFileObject($csvFile) 36 | ); 37 | #ds-snippet-end:Admin4Step3 38 | 39 | $str = str_replace($accountId, "", $str); 40 | file_put_contents($csvFile, $str); 41 | 42 | $_SESSION['import_id'] = strval($organizationImportResponse->getId()); 43 | 44 | return json_decode($organizationImportResponse->__toString()); 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /Quick_ACG/public/index.php: -------------------------------------------------------------------------------- 1 | addGlobal('app_url', $GLOBALS['app_url']); 18 | $twig->addGlobal('session', $_SESSION); 19 | 20 | $twig_function = new Twig\TwigFunction('get_flash', function () { 21 | if (!isset($_SESSION['flash'])) { 22 | $_SESSION['flash'] = []; 23 | } 24 | 25 | $msgs = $_SESSION['flash']; 26 | $_SESSION['flash'] = []; 27 | 28 | return $msgs; 29 | }); 30 | 31 | $twig->addFunction($twig_function); 32 | 33 | # Add csrf_token func. See https://stackoverflow.com/a/31683058/64904 34 | $twig_function = new Twig\TwigFunction('csrf_token', function ($lock_to = null) { 35 | if (empty($_SESSION['csrf_token'])) { 36 | $_SESSION['csrf_token'] = bin2hex(random_bytes(32)); 37 | } 38 | 39 | if (empty($_SESSION['csrf_token2'])) { 40 | $_SESSION['csrf_token2'] = random_bytes(32); 41 | } 42 | 43 | if (empty($lock_to)) { 44 | return $_SESSION['csrf_token']; 45 | } 46 | 47 | return hash_hmac('sha256', $lock_to, $_SESSION['csrf_token2']); 48 | }); 49 | 50 | $twig->addFunction($twig_function); 51 | $GLOBALS['twig'] = $twig; 52 | $router = new RouterService(); 53 | 54 | $router->router(); 55 | -------------------------------------------------------------------------------- /public/index.php: -------------------------------------------------------------------------------- 1 | addGlobal('app_url', $GLOBALS['app_url']); 23 | $twig->addGlobal('session', $_SESSION); 24 | $twig_function = new Twig\TwigFunction('get_flash', function () { 25 | if (! isset($_SESSION['flash'])) { 26 | $_SESSION['flash'] = []; 27 | } 28 | $msgs = $_SESSION['flash']; 29 | $_SESSION['flash'] = []; 30 | return $msgs; 31 | }); 32 | $twig->addFunction($twig_function); 33 | # Add csrf_token func. See https://stackoverflow.com/a/31683058/64904 34 | $twig_function = new Twig\TwigFunction('csrf_token', function ($lock_to = null) { 35 | if (empty($_SESSION['csrf_token'])) { 36 | $_SESSION['csrf_token'] = bin2hex(random_bytes(32)); 37 | } 38 | if (empty($_SESSION['csrf_token2'])) { 39 | $_SESSION['csrf_token2'] = random_bytes(32); 40 | } 41 | if (empty($lock_to)) { 42 | return $_SESSION['csrf_token']; 43 | } 44 | return hash_hmac('sha256', $lock_to, $_SESSION['csrf_token2']); 45 | }); 46 | $twig->addFunction($twig_function); 47 | $GLOBALS['twig'] = $twig; 48 | $router = new RouterService(); 49 | 50 | $router->router(); 51 | -------------------------------------------------------------------------------- /src/Services/Examples/Admin/DeleteUserProductPermissionProfileByIdService.php: -------------------------------------------------------------------------------- 1 | $emailAddress, 33 | 'product_ids' => [$productId], 34 | ]); 35 | #ds-snippet-end:Admin9Step4 36 | 37 | #ds-snippet-start:Admin9Step5 38 | return $productPermissionProfilesApi->removeUserProductPermission( 39 | $organizationId, 40 | $accountId, 41 | $userProductProfileDeleteRequest 42 | ); 43 | #ds-snippet-end:Admin9Step5 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /src/Controllers/Examples/eSignature/EG003ListEnvelopes.php: -------------------------------------------------------------------------------- 1 | checkDsToken(); 37 | # 2. Call the worker method 38 | $envelopesInformation = ListEnvelopesService::listEnvelopes($this->args, $this->clientService); 39 | 40 | if ($envelopesInformation) { 41 | # results is an object that implements ArrayAccess. Convert to a regular array: 42 | $envelopesInformation = json_decode((string)$envelopesInformation, true); 43 | $this->clientService->showDoneTemplateFromManifest( 44 | $this->codeExampleText, 45 | json_encode(json_encode($envelopesInformation)) 46 | ); 47 | } 48 | } 49 | 50 | /** 51 | * Get specific template arguments 52 | * 53 | * @return array 54 | */ 55 | public function getTemplateArgs(): array 56 | { 57 | return $this->getDefaultTemplateArgs(); 58 | } 59 | } 60 | -------------------------------------------------------------------------------- /src/Services/Examples/eSignature/ListEnvelopesService.php: -------------------------------------------------------------------------------- 1 | getEnvelopeApi(); 32 | $from_date = date("c", (time() - (30 * 24 * 60 * 60))); 33 | $options = new ListStatusChangesOptions(); 34 | $options->setFromDate($from_date); 35 | try { 36 | $statusChanges = $envelope_api->listStatusChanges($args['account_id'], $options); 37 | } catch (ApiException $e) { 38 | $clientService->showErrorTemplate($e); 39 | exit; 40 | } 41 | #ds-snippet-end:eSign3Step2 42 | return $statusChanges; 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /src/Services/Examples/Click/GetClickwrapResponseService.php: -------------------------------------------------------------------------------- 1 | accountsApi(); 23 | $response = $accounts_api->getClickwrapAgreements($args['account_id'], $args['clickwrap_id']); 24 | #ds-snippet-end:Click5Step3 25 | } catch (ApiException $e) { 26 | error_log($e); 27 | $clientService->showErrorTemplate($e); 28 | exit; 29 | } 30 | 31 | return $response; 32 | } 33 | 34 | public static function getClickwraps( 35 | RouterService $routerService, 36 | ClickApiClientService $clientService, 37 | array $args, 38 | string $eg 39 | ): array { 40 | if ($routerService->dsTokenOk($GLOBALS['DS_CONFIG']['minimum_buffer_min'])) { 41 | try { 42 | $apiClient = $clientService->accountsApi(); 43 | return $apiClient->getClickwraps($args['account_id'])['clickwraps']; 44 | } catch (ApiException $e) { 45 | error_log($e); 46 | return []; 47 | } 48 | } else { 49 | $clientService->needToReAuth($eg); 50 | } 51 | } 52 | } 53 | -------------------------------------------------------------------------------- /src/Services/Examples/Maestro/CancelMaestroWorkflowService.php: -------------------------------------------------------------------------------- 1 | getWorkflowInstance( 27 | $accountId, 28 | $workflowId, 29 | $instanceId 30 | ); 31 | 32 | if ($instance->getInstanceState() != "In progress") { 33 | return true; 34 | } 35 | 36 | return false; 37 | } catch (ApiException $exception) { 38 | return true; 39 | } 40 | } 41 | 42 | /** 43 | * Cancel workflow instance 44 | * @param WorkflowInstanceManagementApi $workflowInstanceApi 45 | * @param string $accountId 46 | * @param string $instanceId 47 | * @return CancelResponse 48 | */ 49 | public static function cancelWorkflowInstance( 50 | WorkflowInstanceManagementApi $workflowInstanceApi, 51 | string $accountId, 52 | string $instanceId 53 | ): CancelResponse { 54 | return $workflowInstanceApi->cancelWorkflowInstance($accountId, $instanceId); 55 | } 56 | } 57 | -------------------------------------------------------------------------------- /src/Controllers/Examples/Monitor/Eg001GetMonitoringData.php: -------------------------------------------------------------------------------- 1 | $tokenExpirationTime 35 | ) { 36 | $auth = new JWTService(); 37 | $auth->login(); 38 | } else { 39 | // Call the worker method 40 | $monitoringData = GetMonitoringDataService::getMonitoringData($this->clientService); 41 | 42 | if ($monitoringData) { 43 | $this->clientService->showDoneTemplateFromManifest( 44 | $this->codeExampleText, 45 | json_encode(json_encode($monitoringData)) 46 | ); 47 | } 48 | } 49 | } 50 | 51 | /** 52 | * Get specific template arguments 53 | * 54 | * @return array 55 | */ 56 | public function getTemplateArgs(): array 57 | { 58 | $default_args = $this->getDefaultTemplateArgs(); 59 | 60 | return $default_args; 61 | } 62 | } 63 | -------------------------------------------------------------------------------- /src/Controllers/Examples/eSignature/EG033UnpauseSignatureWorkflow.php: -------------------------------------------------------------------------------- 1 | checkDsToken(); 33 | # 1. Call the worker method 34 | # More data validation would be a good idea here 35 | # Strip anything other than characters listed 36 | $envelope = UnpauseSignatureWorkflowService::unpauseSignatureWorkflow($this->args, $this->clientService); 37 | 38 | if ($envelope) { 39 | $_SESSION['pause_envelope_id'] = false; 40 | $this->clientService->showDoneTemplateFromManifest( 41 | $this->codeExampleText, 42 | json_encode($envelope->__toString()) 43 | ); 44 | } 45 | } 46 | 47 | /** 48 | * Get specific template arguments 49 | * 50 | * @return array 51 | */ 52 | public function getTemplateArgs(): array 53 | { 54 | return [ 55 | 'account_id' => $_SESSION['ds_account_id'], 56 | 'base_path' => $_SESSION['ds_base_path'], 57 | 'ds_access_token' => $_SESSION['ds_access_token'], 58 | 'pause_envelope_id' => $_SESSION['pause_envelope_id'] 59 | ]; 60 | } 61 | } 62 | -------------------------------------------------------------------------------- /src/Controllers/Examples/Connect/Eg001ValidateUsingHmac.php: -------------------------------------------------------------------------------- 1 | getTemplateArgs(); 33 | $hashedOutput = ValidateUsingHmacService::computeHash( 34 | $args['envelope_args']['HmacSecret'], 35 | $args['envelope_args']['JsonPayload'] 36 | ); 37 | 38 | $this->clientService->showDoneTemplateFromManifest( 39 | $this->codeExampleText, 40 | null, 41 | ManifestService::replacePlaceholders('{0}', $hashedOutput, $this->codeExampleText['ResultsPageText']) 42 | ); 43 | } 44 | 45 | /** 46 | * Get specific template arguments 47 | * @return array 48 | */ 49 | public function getTemplateArgs(): array 50 | { 51 | $envelope_args = [ 52 | 'HmacSecret' => $_POST['HmacSecret'], 53 | 'JsonPayload' => $_POST['JsonPayload'], 54 | ]; 55 | return [ 56 | 'account_id' => $_SESSION['ds_account_id'], 57 | 'base_path' => $_SESSION['ds_base_path'], 58 | 'ds_access_token' => $_SESSION['ds_access_token'], 59 | 'envelope_args' => $envelope_args 60 | ]; 61 | } 62 | } 63 | -------------------------------------------------------------------------------- /docs/readme_xampp.md: -------------------------------------------------------------------------------- 1 | ## XAMPP/Apache web server installation 2 | 3 | XAMPP/Apache can be configured to run the PHP launcher. 4 | 5 | **Step 1.** Download [XAMPP](https://www.apachefriends.org/download.html). 6 | 7 | **Step 2.** Run XAMPP as administrator. 8 | 9 | **Step 3.** On the XAMPP Control Panel, to the left of Apache, select the red "X" to install Apache. 10 | 11 | ![Install Apache](apache_x_box.jpg) 12 | 13 | The red "X" should become a green checkmark. 14 | 15 | ![Install Apache](apache_installed_box.jpg) 16 | 17 | ## Apache web server configuration 18 | 19 | **Step 1.** On the XAMPP Control Panel, to the right of Apache, select the Config button > Apache (httpd.conf). The httpd.conf file should open. 20 | 21 | ![Apache_config](config_file.jpg) 22 | 23 | **Step 2.** In httpd.conf, change the default "Listen 80" to "Listen 8080". 24 | 25 | ![httpd_listen](listen_8080_box.jpg) 26 | 27 | **Step 3.** In httpd.conf, change the default "ServerName localhost:80" to "ServerName localhost:8080". 28 | 29 | ![httpd_localhost](localhost_8080_box.jpg) 30 | 31 | **Step 4.** In httpd.conf, change the default
32 | DocumentRoot "C:/xampp/htdocs"
33 |
34 | to
35 | DocumentRoot "C:/xampp/htdocs/"
36 | ">
37 | 38 | In httpd.conf, use Ctrl-S to save your changes. 39 | 40 | ![httpd_DocumentRoot](Document_Root_box.jpg) 41 | 42 | **Step 5.** On the XAMPP Control Panel, to the right of Apache, select the Start button. 43 | 44 | ![Apache_start](apache_start_box.jpg) 45 | 46 | Apache should run. 47 | 48 | ![Apache_run](start_box.jpg) 49 | 50 | **Step 6.** Open [http://localhost:8080/public](http://localhost:8080/public). 51 | 52 | If this is your first time opening the PHP Quickstart launcher, you should see the DocuSign OAuth consent window. Select the Accept button and continue to the embedded signing code example. 53 | 54 | ![Consent_window](consent_window.jpg) 55 | -------------------------------------------------------------------------------- /src/Controllers/Examples/Rooms/EG003ExportDataFromRoom.php: -------------------------------------------------------------------------------- 1 | routerService, 23 | $this->clientService, 24 | $this->args, 25 | $this::EG 26 | ); 27 | parent::controller(null, $rooms); 28 | } 29 | 30 | /** 31 | * 1. Check the token 32 | * 2. Call the worker method 33 | * 3. Return RoomFormFieldData for selected room 34 | * 35 | * @return void 36 | */ 37 | protected function createController(): void 38 | { 39 | $this->checkDsToken(); 40 | $fieldData = ExportDataFromRoomService::exportDataFromRoom($this->args, $this->clientService); 41 | 42 | if ($fieldData) { 43 | $fieldData = json_decode((string)$fieldData, true); 44 | $this->clientService->showDoneTemplateFromManifest( 45 | $this->codeExampleText, 46 | json_encode(json_encode($fieldData)) 47 | ); 48 | } 49 | } 50 | 51 | /** 52 | * Get specific template arguments 53 | * 54 | * @return array 55 | */ 56 | public function getTemplateArgs(): array 57 | { 58 | return [ 59 | 'account_id' => $_SESSION['ds_account_id'], 60 | 'ds_access_token' => $_SESSION['ds_access_token'], 61 | 'room_id' => $this->checkInputValues($_POST['room_id']) 62 | ]; 63 | } 64 | } 65 | -------------------------------------------------------------------------------- /src/Controllers/Examples/Admin/EG005AuditUsers.php: -------------------------------------------------------------------------------- 1 | checkDsToken(); 36 | 37 | # Call the worker method 38 | # More data validation would be a good idea here 39 | # Strip anything other than characters listed 40 | try { 41 | $organizationId = $this->clientService->getOrgAdminId(); 42 | $auditedUsers = AuditUsersService::auditUsers($this->clientService, $this->args, $organizationId); 43 | 44 | if ($auditedUsers) { 45 | $this->clientService->showDoneTemplateFromManifest( 46 | $this->codeExampleText, 47 | json_encode(json_encode($auditedUsers)) 48 | ); 49 | } 50 | } catch (ApiException $e) { 51 | $this->clientService->showErrorTemplate($e); 52 | } 53 | } 54 | 55 | /** 56 | * Get specific template arguments 57 | * 58 | * @return array 59 | */ 60 | public function getTemplateArgs(): array 61 | { 62 | return [ 63 | 'account_id' => $_SESSION['ds_account_id'], 64 | 'ds_access_token' => $_SESSION['ds_access_token'] 65 | ]; 66 | } 67 | } 68 | -------------------------------------------------------------------------------- /src/Controllers/Examples/Rooms/EG007CreateFormGroup.php: -------------------------------------------------------------------------------- 1 | checkDsToken(); 35 | $formGroup = CreateFormGroupService::createFormGroup($this->args, $this->clientService); 36 | if ($formGroup) { 37 | $formGroup = json_decode((string)$formGroup, true); 38 | $this->clientService->showDoneTemplateFromManifest( 39 | $this->codeExampleText, 40 | json_encode(json_encode($formGroup)), 41 | ManifestService::replacePlaceholders( 42 | "{0}", 43 | $this->args["form_group_name"], 44 | $this->codeExampleText["ResultsPageText"] 45 | ) 46 | ); 47 | } 48 | } 49 | 50 | /** 51 | * Get specific template arguments 52 | * 53 | * @return array 54 | */ 55 | public function getTemplateArgs(): array 56 | { 57 | return [ 58 | 'account_id' => $_SESSION['ds_account_id'], 59 | 'ds_access_token' => $_SESSION['ds_access_token'], 60 | 'form_group_name' => $this->checkInputValues($_POST['form_group_name']), 61 | ]; 62 | } 63 | } 64 | -------------------------------------------------------------------------------- /src/Controllers/Examples/Admin/EG007RetrieveDocuSignProfileByUserID.php: -------------------------------------------------------------------------------- 1 | checkDsToken(); 36 | 37 | try { 38 | $organizationId = $this->clientService->getOrgAdminId(); 39 | $usersResponse = RetrieveDocuSignProfileByUserId::getDocuSignProfileByUserId( 40 | $organizationId, 41 | $this->args["user_id"], 42 | $this->clientService 43 | ); 44 | 45 | $this->clientService->showDoneTemplateFromManifest( 46 | $this->codeExampleText, 47 | json_encode(json_encode($usersResponse)) 48 | ); 49 | } catch (ApiException $e) { 50 | $this->clientService->showErrorTemplate($e); 51 | } 52 | } 53 | 54 | /** 55 | * Get specific template arguments 56 | * 57 | * @return array 58 | */ 59 | public function getTemplateArgs(): array 60 | { 61 | return [ 62 | 'user_id' => $this->checkInputValues($_POST['user_id']), 63 | 'account_id' => $_SESSION['ds_account_id'], 64 | 'ds_access_token' => $_SESSION['ds_access_token'] 65 | ]; 66 | } 67 | } 68 | -------------------------------------------------------------------------------- /src/Controllers/Examples/Admin/EG003aCheckRequestStatus.php: -------------------------------------------------------------------------------- 1 | checkDsToken(); 33 | 34 | // Call the worker method 35 | $results = $this->checkRequestStatus(); 36 | 37 | if ($results) { 38 | $this->clientService->showDoneTemplateFromManifest( 39 | $this->codeExampleText, 40 | json_encode(json_encode($results)) 41 | ); 42 | } 43 | } 44 | 45 | /** 46 | * Method to get a request status for bulk-export. 47 | * @throws ApiException 48 | */ 49 | private function checkRequestStatus() 50 | { 51 | $bulkExportsApi = $this->clientService->bulkExportsAPI(); 52 | 53 | $exportId = $_SESSION['export_id']; 54 | 55 | # Step 4 start 56 | $result = $bulkExportsApi->getUserListExport($this->clientService->getOrgAdminId($this->args), $exportId); 57 | # Step 4 end 58 | 59 | return json_decode($result->__toString()); 60 | } 61 | 62 | /** 63 | * Get specific template arguments 64 | * @return array 65 | */ 66 | public function getTemplateArgs(): array 67 | { 68 | $default_args = $this->getDefaultTemplateArgs(); 69 | 70 | return $default_args; 71 | } 72 | } 73 | -------------------------------------------------------------------------------- /src/Controllers/Examples/Admin/EG006RetrieveDocuSignProfileByEmailAddress.php: -------------------------------------------------------------------------------- 1 | checkDsToken(); 36 | 37 | try { 38 | $organizationId = $this->clientService->getOrgAdminId(); 39 | 40 | $usersResponse = RetrieveDocuSignProfileByEmailAddress::getDocuSignProfileByEmailAddress( 41 | $organizationId, 42 | $this->args["email"], 43 | $this->clientService 44 | ); 45 | 46 | $this->clientService->showDoneTemplateFromManifest( 47 | $this->codeExampleText, 48 | json_encode(json_encode($usersResponse)) 49 | ); 50 | } catch (ApiException $e) { 51 | $this->clientService->showErrorTemplate($e); 52 | } 53 | } 54 | 55 | /** 56 | * Get specific template arguments 57 | * 58 | * @return array 59 | */ 60 | public function getTemplateArgs(): array 61 | { 62 | return [ 63 | 'email' => $this->checkInputValues($_POST['email']), 64 | 'account_id' => $_SESSION['ds_account_id'], 65 | 'ds_access_token' => $_SESSION['ds_access_token'] 66 | ]; 67 | } 68 | } 69 | -------------------------------------------------------------------------------- /src/Services/Examples/Rooms/GetRoomsWithFiltersService.php: -------------------------------------------------------------------------------- 1 | getRoomsApi(); 24 | #ds-snippet-end:Rooms5Step4 25 | 26 | try { 27 | #ds-snippet-start:Rooms5Step3 28 | $options = new GetRoomsOptions(); 29 | $options->setFieldDataChangedStartDate($args['start_date']); 30 | $options->setFieldDataChangedEndDate($args['end_date']); 31 | #ds-snippet-end:Rooms5Step3 32 | #ds-snippet-start:Rooms5Step4 33 | $rooms = $rooms_api->getRooms($args['account_id'], $options); 34 | #ds-snippet-end:Rooms5Step4 35 | } catch (ApiException $e) { 36 | error_log($e); 37 | $clientService->showErrorTemplate($e); 38 | exit; 39 | } 40 | return $rooms; 41 | } 42 | 43 | /** 44 | * Get available Rooms 45 | * 46 | * @param $routerService 47 | * @param $args 48 | * @param $clientService 49 | * @param $eg 50 | * @return array 51 | */ 52 | public static function getRooms($routerService, $args, $clientService, $eg): array 53 | { 54 | if ($routerService->dsTokenOk($GLOBALS['DS_CONFIG']['minimum_buffer_min'])) { 55 | return $clientService->getRooms($args); 56 | } else { 57 | $clientService->needToReAuth($eg); 58 | } 59 | } 60 | } 61 | -------------------------------------------------------------------------------- /src/Services/Examples/eSignature/CreateBrandService.php: -------------------------------------------------------------------------------- 1 | getAccountsApi(); 25 | $brand = new Brand([ 26 | 'brand_name' => $args['brand_args']['brand_name'], 27 | 'default_brand_language' => $args['brand_args']['default_language'] 28 | ]); 29 | #ds-snippet-end:eSign28Step3 30 | 31 | try { 32 | # Step 4 Call the eSignature REST API 33 | #ds-snippet-start:eSign28Step4 34 | $createdBrand = $accounts_api->createBrand($args['account_id'], $brand); 35 | #ds-snippet-end:eSign28Step4 36 | } catch (ApiException $e) { 37 | $error_code = $e->getResponseBody()->errorCode; 38 | $error_message = $e->getResponseBody()->message; 39 | if ($error_message == "Invalid brand name. Duplicate brand names are not allowed.") { 40 | return ['brand_id' => null]; 41 | } else { 42 | $GLOBALS['twig']->display('error.html', [ 43 | 'error_code' => $error_code, 44 | 'error_message' => $error_message, 45 | 'common_texts' => ManifestService::getCommonTexts() 46 | ]); 47 | exit; 48 | } 49 | } 50 | 51 | return ['brand_id' => $createdBrand->getBrands()[0]->getBrandId()]; 52 | } 53 | } 54 | -------------------------------------------------------------------------------- /src/Controllers/Examples/Admin/EG011DeleteUserDataFromAccount.php: -------------------------------------------------------------------------------- 1 | checkDsToken(); 35 | 36 | try { 37 | $accountApi = $this->clientService->getAccountsApi(); 38 | 39 | $individualUserDataRedactionResponse = DeleteUserDataFromAccountService::deleteUserDataFromAccount( 40 | $accountApi, 41 | $this->args['account_id'], 42 | $this->args['user_id'] 43 | ); 44 | 45 | $this->clientService->showDoneTemplateFromManifest( 46 | $this->codeExampleText, 47 | json_encode($individualUserDataRedactionResponse->__toString()) 48 | ); 49 | } catch (ApiException $e) { 50 | $this->clientService->showErrorTemplate($e); 51 | } 52 | } 53 | 54 | /** 55 | * Get specific template arguments 56 | * 57 | * @return array 58 | */ 59 | public function getTemplateArgs(): array 60 | { 61 | return [ 62 | 'account_id' => $_SESSION['ds_account_id'], 63 | 'ds_access_token' => $_SESSION['ds_access_token'], 64 | 'user_id' => $this->checkInputValues($_POST['userId']), 65 | ]; 66 | } 67 | } 68 | -------------------------------------------------------------------------------- /templates/esignature/eg033_unpause_signature_workflow.html: -------------------------------------------------------------------------------- 1 | {% extends "base.html" %} {% block content %} 2 | 3 | {% set redirectTo32CodeExample = "href='" ~ app_url ~ "index.php?page=eg032'" %} 4 | {% set redirectNumber = 0 %} 5 | 6 |

{{ code_example_text['ExampleName'] | raw }}

7 | 8 |

{{ code_example_text["ExampleDescription"] | raw }}

9 | 10 | 11 | {% if show_doc %} 12 |

Documentation about this example.

13 | {% endif %} 14 | 15 |

16 | {% if code_example_text["LinksToAPIMethod"] | length == 1 %} 17 | {{ common_texts["APIMethodUsed"] | raw }} 18 | {% else %} 19 | {{ common_texts["APIMethodUsedPlural"] | raw }} 20 | {% endif %} 21 | 22 | {% for i in 0..(code_example_text["LinksToAPIMethod"] | length - 1) %} 23 | 24 | {{ code_example_text['LinksToAPIMethod'][i]['PathName'] | raw}} 25 | 26 | 27 | {% if i + 1 == code_example_text["LinksToAPIMethod"] | length - 1 %} 28 | and 29 | {% elseif i + 1 != code_example_text["LinksToAPIMethod"] | length %} 30 | , 31 | {% endif %} 32 | {% endfor %} 33 |

34 | 35 |

36 | {{ common_texts["ViewSourceFile"]|replace({ ("{0}"): ("%s"|format(source_url, source_file)) })| raw }} 37 |

38 | 39 | {% if pause_envelope_ok %} 40 |
41 | 42 | 43 |
44 | {% else %} 45 |

46 | {{ code_example_text['RedirectsToOtherCodeExamples'][redirectNumber]['RedirectText']|replace({ ("{0}"): redirectTo32CodeExample }) | raw }} 47 |

48 | 49 | {{ common_texts["ContinueButton"] | raw }} 50 | {% endif %} 51 | 52 | {% endblock %} -------------------------------------------------------------------------------- /templates/esignature/eg039_in_person_signing.html: -------------------------------------------------------------------------------- 1 | {% extends "base.html" %} {% block content %} 2 | 3 | {% set formNumber = 0 %} 4 | {% set nameInputNumber = 0 %} 5 | 6 |

{{ code_example_text['ExampleName'] | raw }}

7 | 8 | 9 | {% if show_doc %} 10 |

Documentation about this example.

11 | {% endif %} 12 | 13 |

14 | {% if code_example_text["LinksToAPIMethod"] | length == 1 %} 15 | {{ common_texts["APIMethodUsed"] | raw }} 16 | {% else %} 17 | {{ common_texts["APIMethodUsedPlural"] | raw }} 18 | {% endif %} 19 | 20 | {% for i in 0..(code_example_text["LinksToAPIMethod"] | length - 1) %} 21 | 22 | {{ code_example_text['LinksToAPIMethod'][i]['PathName'] | raw}} 23 | 24 | 25 | {% if i + 1 == code_example_text["LinksToAPIMethod"] | length - 1 %} 26 | and 27 | {% elseif i + 1 != code_example_text["LinksToAPIMethod"] | length %} 28 | , 29 | {% endif %} 30 | {% endfor %} 31 |

32 |

33 | {{ common_texts["ViewSourceFile"]|replace({ ("{0}"): ("%s"|format(source_url, source_file)) })| raw }} 34 |

35 | 36 |
37 |
38 | 41 | 42 | 48 |
49 | 50 | 51 |
52 | 53 | {% endblock %} 54 | -------------------------------------------------------------------------------- /src/Services/Examples/Admin/DeleteUserDataFromOrganizationService.php: -------------------------------------------------------------------------------- 1 | setEmail($emailAddress); 33 | 34 | $profiles = $usersApi->getUserDSProfilesByEmail($organizationId, $getProfilesOptions); 35 | $user = $profiles->getUsers()[0]; 36 | 37 | #ds-snippet-start:Admin10Step3 38 | $userRedactionRequest = new IndividualUserDataRedactionRequest(); 39 | $userRedactionRequest->setUserId($user->getId()); 40 | $userRedactionRequest->setMemberships([ 41 | new MembershipDataRedactionRequest([ 42 | "account_id" => $user->getMemberships()[0]->getAccountId() 43 | ]) 44 | ]); 45 | #ds-snippet-end:Admin10Step3 46 | 47 | #ds-snippet-start:Admin10Step4 48 | return $organizationsApi->redactIndividualUserData($organizationId, $userRedactionRequest); 49 | #ds-snippet-end:Admin10Step4 50 | } 51 | } 52 | -------------------------------------------------------------------------------- /templates/rooms/eg001_create_room_with_data.html: -------------------------------------------------------------------------------- 1 | {% extends "base.html" %} 2 | {% block content %} 3 | 4 | {% set formNumber = 0 %} 5 | {% set roomNameInputNumber = 0 %} 6 | 7 |

{{ code_example_text['ExampleName'] | raw }}

8 | 9 |

{{ code_example_text["ExampleDescription"] | raw }}

10 | {% if show_doc %} 11 |

Documentation about this example.

12 | {% endif %} 13 | 14 |

15 | {% if code_example_text["LinksToAPIMethod"] | length == 1 %} 16 | {{ common_texts["APIMethodUsed"] | raw }} 17 | {% else %} 18 | {{ common_texts["APIMethodUsedPlural"] | raw }} 19 | {% endif %} 20 | 21 | {% for i in 0..(code_example_text["LinksToAPIMethod"] | length - 1) %} 22 | 23 | {{ code_example_text['LinksToAPIMethod'][i]['PathName'] | raw}} 24 | 25 | 26 | {% if i + 1 == code_example_text["LinksToAPIMethod"] | length - 1 %} 27 | and 28 | {% elseif i + 1 != code_example_text["LinksToAPIMethod"] | length %} 29 | , 30 | {% endif %} 31 | {% endfor %} 32 |

33 | 34 |

35 | {{ common_texts["ViewSourceFile"]|replace({ ("{0}"): ("%s"|format(source_url, source_file)) })| raw }} 36 |

37 | 38 |
39 |
40 | 43 | 44 | 50 |
51 | 52 | 53 |
54 | 55 | {% endblock %} 56 | 57 | -------------------------------------------------------------------------------- /src/Controllers/Examples/Rooms/EG001CreateRoomWithData.php: -------------------------------------------------------------------------------- 1 | checkDsToken(); 35 | $room = CreateRoomsWithDataService::createRoomsWithData($this->args, $this->clientService); 36 | 37 | if ($room) { 38 | $room_name = $room['name']; 39 | $room_id = $room['room_id']; 40 | $room = json_decode((string)$room, true); 41 | $this->clientService->showDoneTemplateFromManifest( 42 | $this->codeExampleText, 43 | json_encode(json_encode($room)), 44 | ManifestService::replacePlaceholders( 45 | "{1}", 46 | $room_id, 47 | ManifestService::replacePlaceholders("{0}", $room_name, $this->codeExampleText["ResultsPageText"]) 48 | ) 49 | ); 50 | } 51 | } 52 | 53 | /** 54 | * Get specific template arguments 55 | * 56 | * @return array 57 | */ 58 | public function getTemplateArgs(): array 59 | { 60 | return [ 61 | 'account_id' => $_SESSION['ds_account_id'], 62 | 'ds_access_token' => $_SESSION['ds_access_token'], 63 | 'room_name' => $this->checkInputValues($_POST['room_name']) 64 | ]; 65 | } 66 | } 67 | -------------------------------------------------------------------------------- /src/Services/Examples/Admin/UpdateUserProductPermissionProfileByEmailService.php: -------------------------------------------------------------------------------- 1 | $emailAddress, 36 | 'product_permission_profiles' => [new ProductPermissionProfileRequest([ 37 | 'product_id' => $productId, 38 | 'permission_profile_id' => $permissionProfileId, 39 | ])], 40 | ]); 41 | #ds-snippet-end:Admin8Step3 42 | 43 | #ds-snippet-start:Admin8Step4 44 | return $productPermissionProfilesApi->addUserProductPermissionProfilesByEmail( 45 | $organizationId, 46 | $accountId, 47 | $userProductPermissionProfilesRequest 48 | ); 49 | #ds-snippet-end:Admin8Step4 50 | } 51 | } 52 | -------------------------------------------------------------------------------- /templates/click/eg001_create_clickwrap.html: -------------------------------------------------------------------------------- 1 | {% extends "base.html" %} 2 | {% block content %} 3 | 4 | {% set formNumber = 0 %} 5 | {% set clickwrapInputNumber = 0 %} 6 | 7 |

{{ code_example_text['ExampleName'] | raw }}

8 | 9 |

{{ code_example_text["ExampleDescription"] | raw }}

10 | 11 | {% if show_doc %} 12 |

Documentation about this example.

13 | {% endif %} 14 | 15 |

16 | {% if code_example_text["LinksToAPIMethod"] | length == 1 %} 17 | {{ common_texts["APIMethodUsed"] | raw }} 18 | {% else %} 19 | {{ common_texts["APIMethodUsedPlural"] | raw }} 20 | {% endif %} 21 | 22 | {% for i in 0..(code_example_text["LinksToAPIMethod"] | length - 1) %} 23 | 24 | {{ code_example_text['LinksToAPIMethod'][i]['PathName'] | raw}} 25 | 26 | 27 | {% if i + 1 == code_example_text["LinksToAPIMethod"] | length - 1 %} 28 | and 29 | {% elseif i + 1 != code_example_text["LinksToAPIMethod"] | length %} 30 | , 31 | {% endif %} 32 | {% endfor %} 33 |

34 | 35 |

36 | {{ common_texts["ViewSourceFile"]|replace({ ("{0}"): ("%s"|format(source_url, source_file)) })| raw }} 37 |

38 | 39 |
40 |
41 | 44 | 45 | 51 |
52 | 53 | 54 |
55 | 56 | {% endblock %} 57 | -------------------------------------------------------------------------------- /templates/rooms/eg007_create_form_group.html: -------------------------------------------------------------------------------- 1 | {% extends "base.html" %} 2 | {% block content %} 3 | 4 | {% set formNumber = 0 %} 5 | {% set roomNameInputNumber = 0 %} 6 | 7 |

{{ code_example_text['ExampleName'] | raw }}

8 | 9 |

{{ code_example_text["ExampleDescription"] | raw }}

10 | 11 | {% if show_doc %} 12 |

Documentation about this example.

13 | {% endif %} 14 | 15 |

16 | {% if code_example_text["LinksToAPIMethod"] | length == 1 %} 17 | {{ common_texts["APIMethodUsed"] | raw }} 18 | {% else %} 19 | {{ common_texts["APIMethodUsedPlural"] | raw }} 20 | {% endif %} 21 | 22 | {% for i in 0..(code_example_text["LinksToAPIMethod"] | length - 1) %} 23 | 24 | {{ code_example_text['LinksToAPIMethod'][i]['PathName'] | raw}} 25 | 26 | 27 | {% if i + 1 == code_example_text["LinksToAPIMethod"] | length - 1 %} 28 | and 29 | {% elseif i + 1 != code_example_text["LinksToAPIMethod"] | length %} 30 | , 31 | {% endif %} 32 | {% endfor %} 33 |

34 | 35 |

36 | {{ common_texts["ViewSourceFile"]|replace({ ("{0}"): ("%s"|format(source_url, source_file)) })| raw }} 37 |

38 | 39 |
40 |
41 | 44 | 45 | 51 |
52 | 53 | 54 | 55 |
56 | 57 | {% endblock %} 58 | 59 | -------------------------------------------------------------------------------- /src/Services/Examples/Rooms/CreateRoomsWithDataService.php: -------------------------------------------------------------------------------- 1 | getRoles($args); 24 | 25 | $admin_roles = array_values(array_filter($roles, function ($r) { 26 | return $r['is_default_for_admin'] === true; 27 | })); 28 | $role_id = $admin_roles[0]['role_id']; 29 | # Step 2. Create RoomForCreate object 30 | #ds-snippet-start:Rooms1Step3 31 | $room = new RoomForCreate( 32 | [ 33 | 'name' => $args["room_name"], 34 | 'role_id' => $role_id, 35 | 'transaction_side_id' => "listbuy", 36 | 'field_data' => new FieldDataForCreate( 37 | ['data' => [ 38 | 'address1' => '111', 39 | 'address2' => 'unit 10', 40 | 'city' => 'Galaxian', 41 | 'state' => 'US-HI', 42 | 'postalCode' => '88888', 43 | 'companyRoomStatus' => '5', 44 | 'comments' => 'Lorem ipsum dolor sit amet, consectetur adipiscin', 45 | ] 46 | ] 47 | ) 48 | ] 49 | ); 50 | #ds-snippet-end:Rooms1Step3 51 | 52 | # Step 3. Post new room using SDK 53 | #ds-snippet-start:Rooms1Step4 54 | return $clientService->createRoom($args, $room); 55 | #ds-snippet-end:Rooms1Step4 56 | } 57 | } 58 | -------------------------------------------------------------------------------- /templates/admin/eg007_retrieve_profile_by_user_id.html: -------------------------------------------------------------------------------- 1 | {% extends "base.html" %} 2 | {% block content %} 3 | 4 | {% set formNumber = 0 %} 5 | {% set userIdInputNumber = 0 %} 6 | 7 |

{{ code_example_text['ExampleName'] | raw }}

8 | 9 |

{{ code_example_text["ExampleDescription"] | raw }}

10 | 11 | {% if show_doc %} 12 |

Documentation about this example.

13 | {% endif %} 14 | 15 |

16 | {% if code_example_text["LinksToAPIMethod"] | length == 1 %} 17 | {{ common_texts["APIMethodUsed"] | raw }} 18 | {% else %} 19 | {{ common_texts["APIMethodUsedPlural"] | raw }} 20 | {% endif %} 21 | 22 | {% for i in 0..(code_example_text["LinksToAPIMethod"] | length - 1) %} 23 | 24 | {{ code_example_text['LinksToAPIMethod'][i]['PathName'] | raw}} 25 | 26 | 27 | {% if i + 1 == code_example_text["LinksToAPIMethod"] | length - 1 %} 28 | and 29 | {% elseif i + 1 != code_example_text["LinksToAPIMethod"] | length %} 30 | , 31 | {% endif %} 32 | {% endfor %} 33 |

34 | 35 |

36 | {{ common_texts["ViewSourceFile"]|replace({ ("{0}"): ("%s"|format(source_url, source_file)) })| raw }} 37 |

38 | 39 |
40 |
41 | 44 | 45 | 52 |
53 | 54 | 55 | 56 |
57 | {% endblock %} 58 | -------------------------------------------------------------------------------- /templates/admin/eg010_delete_user_data_from_organization.html: -------------------------------------------------------------------------------- 1 | {% extends "base.html" %} 2 | {% block content %} 3 | 4 | {% set formNumber = 0 %} 5 | {% set emailInputNumber = 0 %} 6 | 7 |

{{ code_example_text['ExampleName'] | raw }}

8 | 9 |

{{ code_example_text["ExampleDescription"] | raw }}

10 | 11 | 12 | {% if show_doc %} 13 |

Documentation about this example.

14 | {% endif %} 15 | 16 |

17 | {% if code_example_text["LinksToAPIMethod"] | length == 1 %} 18 | {{ common_texts["APIMethodUsed"] | raw }} 19 | {% else %} 20 | {{ common_texts["APIMethodUsedPlural"] | raw }} 21 | {% endif %} 22 | 23 | {% for i in 0..(code_example_text["LinksToAPIMethod"] | length - 1) %} 24 | 25 | {{ code_example_text['LinksToAPIMethod'][i]['PathName'] | raw}} 26 | 27 | 28 | {% if i + 1 == code_example_text["LinksToAPIMethod"] | length - 1 %} 29 | and 30 | {% elseif i + 1 != code_example_text["LinksToAPIMethod"] | length %} 31 | , 32 | {% endif %} 33 | {% endfor %} 34 |

35 | 36 |

37 | {{ common_texts["ViewSourceFile"]|replace({ ("{0}"): ("%s"|format(source_url, source_file)) })| raw }} 38 |

39 | 40 |
41 |
42 | 45 | 46 | 48 | 49 | 50 | {{ common_texts["HelpingTexts"]["EmailAddressOfUserToDelete"] | raw }} 51 | 52 |
53 | 54 | 55 | 56 |
57 | 58 | {% endblock %} 59 | -------------------------------------------------------------------------------- /src/Controllers/Examples/eSignature/EG027PermissionDelete.php: -------------------------------------------------------------------------------- 1 | clientService->getPermissionsProfiles($this->args); 22 | parent::controller( 23 | null, 24 | null, 25 | null, 26 | $permission_profiles 27 | ); 28 | } 29 | 30 | /** 31 | * 1. Check the token 32 | * 2. Call the worker method 33 | * 34 | * @return void 35 | */ 36 | public function createController(): void 37 | { 38 | $this->checkDsToken(); 39 | # 1. Call the worker method 40 | # More data validation would be a good idea here 41 | # Strip anything other than characters listed 42 | $deleteResponse = PermissionDeleteService::permissionDelete($this->args, $this->clientService); 43 | 44 | if ($deleteResponse) { 45 | # That need an envelope_id 46 | $this->clientService->showDoneTemplateFromManifest( 47 | $this->codeExampleText, 48 | $deleteResponse 49 | ); 50 | } 51 | } 52 | 53 | /** 54 | * Get specific template arguments 55 | * 56 | * @return array 57 | */ 58 | public function getTemplateArgs(): array 59 | { 60 | $permissions_args = [ 61 | 'permission_profile_id' => $this->checkInputValues($_POST['permission_profile_id']), 62 | ]; 63 | return [ 64 | 'account_id' => $_SESSION['ds_account_id'], 65 | 'base_path' => $_SESSION['ds_base_path'], 66 | 'ds_access_token' => $_SESSION['ds_access_token'], 67 | 'permission_args' => $permissions_args 68 | ]; 69 | } 70 | } 71 | -------------------------------------------------------------------------------- /src/Services/Examples/eSignature/EnvelopeGetDocService.php: -------------------------------------------------------------------------------- 1 | getEnvelopeApi(); 21 | 22 | # An SplFileObject is returned. See http://php.net/manual/en/class.splfileobject.php 23 | $temp_file = $envelope_api->getDocument($args['account_id'], $args['document_id'], $args['envelope_id']); 24 | #ds-snippet-end:eSign7Step3 25 | # find the matching document information item 26 | $doc_item = false; 27 | foreach ($args['envelope_documents']['documents'] as $item) { 28 | if ($item['document_id'] == $args['document_id']) { 29 | $doc_item = $item; 30 | break; 31 | } 32 | } 33 | $doc_name = $doc_item['name']; 34 | $has_pdf_suffix = strtoupper(substr($doc_name, -4)) == '.PDF'; 35 | $pdf_file = $has_pdf_suffix; 36 | # Add ".pdf" if it's a content or summary doc and doesn't already end in .pdf 37 | if ($doc_item["type"] == "content" || ($doc_item["type"] == "summary" && ! $has_pdf_suffix)) { 38 | $doc_name .= ".pdf"; 39 | $pdf_file = true; 40 | } 41 | # Add .zip as appropriate 42 | if ($doc_item["type"] == "zip") { 43 | $doc_name .= ".zip"; 44 | } 45 | # Return the file information 46 | if ($pdf_file) { 47 | $mimetype = 'application/pdf'; 48 | } elseif ($doc_item["type"] == 'zip') { 49 | $mimetype = 'application/zip'; 50 | } else { 51 | $mimetype = 'application/octet-stream'; 52 | } 53 | 54 | return ['mimetype' => $mimetype, 'doc_name' => $doc_name, 'data' => $temp_file]; 55 | } 56 | } 57 | -------------------------------------------------------------------------------- /src/Controllers/Examples/Admin/EG004BulkImportUserData.php: -------------------------------------------------------------------------------- 1 | checkDsToken(); 34 | 35 | try { 36 | $organizationId = $this->clientService->getOrgAdminId(); 37 | 38 | // Call the worker method 39 | $bulkImport = BulkImportUserDataService::bulkImportUserData( 40 | $this->clientService, 41 | $organizationId, 42 | $GLOBALS["DS_CONFIG"]["signer_email"] 43 | ); 44 | if ($bulkImport) { 45 | $this->clientService->showDoneTemplateFromManifest( 46 | $this->codeExampleText, 47 | json_encode(json_encode($bulkImport)), 48 | $_SESSION['import_id'] 49 | ); 50 | 51 | // skip the response page and just forward to aeg004a 52 | // $_SERVER["REQUEST_METHOD"] = 'POST'; 53 | // header('Location: ' . $GLOBALS['app_url'] . 'index.php?page=aeg004a'); 54 | } 55 | } catch (ApiException $e) { 56 | $this->clientService->showErrorTemplate($e); 57 | } 58 | } 59 | 60 | /** 61 | * Get specific template arguments 62 | * @return array 63 | */ 64 | public function getTemplateArgs(): array 65 | { 66 | return $this->getDefaultTemplateArgs(); 67 | } 68 | } 69 | -------------------------------------------------------------------------------- /src/Controllers/Examples/eSignature/EG012EmbeddedConsole.php: -------------------------------------------------------------------------------- 1 | checkDsToken(); 37 | # 2. Call the worker method 38 | # More data validation would be a good idea here 39 | # Strip anything other than characters listed 40 | $redirectUrl = EmbeddedConsoleService::embeddedConsole($this->args, $this->clientService); 41 | 42 | if ($redirectUrl) { 43 | # Redirect the user to the NDSE view 44 | # Don't use an iFrame! 45 | # State can be stored/recovered using the framework's session or a 46 | # query parameter on the returnUrl 47 | header('Location: ' . $redirectUrl["redirect_url"]); 48 | exit; 49 | } 50 | } 51 | 52 | /** 53 | * Get specific template arguments 54 | * 55 | * @return array 56 | */ 57 | public function getTemplateArgs(): array 58 | { 59 | $envelope_id = $_SESSION['envelope_id'] ?? false; 60 | return [ 61 | 'envelope_id' => $envelope_id, 62 | 'account_id' => $_SESSION['ds_account_id'], 63 | 'base_path' => $_SESSION['ds_base_path'], 64 | 'ds_access_token' => $_SESSION['ds_access_token'], 65 | 'starting_view' => $this->checkInputValues($_POST['starting_view']), 66 | 'ds_return_url' => $GLOBALS['app_url'] . 'index.php?page=ds_return' 67 | ]; 68 | } 69 | } 70 | -------------------------------------------------------------------------------- /templates/admin/eg006_retrieve_profile_by_email_address.html: -------------------------------------------------------------------------------- 1 | {% extends "base.html" %} 2 | {% block content %} 3 | 4 | {% set formNumber = 0 %} 5 | {% set emailInputNumber = 0 %} 6 | 7 |

{{ code_example_text['ExampleName'] | raw }}

8 | 9 |

{{ code_example_text["ExampleDescription"] | raw }}

10 | 11 | {% if show_doc %} 12 |

Documentation about this example.

13 | {% endif %} 14 | 15 |

16 | {% if code_example_text["LinksToAPIMethod"] | length == 1 %} 17 | {{ common_texts["APIMethodUsed"] | raw }} 18 | {% else %} 19 | {{ common_texts["APIMethodUsedPlural"] | raw }} 20 | {% endif %} 21 | 22 | {% for i in 0..(code_example_text["LinksToAPIMethod"] | length - 1) %} 23 | 24 | {{ code_example_text['LinksToAPIMethod'][i]['PathName'] | raw}} 25 | 26 | 27 | {% if i + 1 == code_example_text["LinksToAPIMethod"] | length - 1 %} 28 | and 29 | {% elseif i + 1 != code_example_text["LinksToAPIMethod"] | length %} 30 | , 31 | {% endif %} 32 | {% endfor %} 33 |

34 | 35 |

36 | {{ common_texts["ViewSourceFile"]|replace({ ("{0}"): ("%s"|format(source_url, source_file)) })| raw }} 37 |

38 | 39 |
40 |
41 | 44 | 45 | 51 | 52 | 53 | {{ common_texts["HelpingTexts"]["EmailWontBeShared"] | raw }} 54 | 55 |
56 | 57 | 58 | 59 |
60 | 61 | {% endblock %} 62 | -------------------------------------------------------------------------------- /src/Controllers/Examples/Click/EG001CreateClickwrap.php: -------------------------------------------------------------------------------- 1 | checkDsToken(); 35 | $clickwrapSummaryResponse = CreateClickwrapService::createClickwrap( 36 | $this->args, 37 | self::DEMO_DOCS_PATH, 38 | $this->clientService 39 | ); 40 | 41 | if ($clickwrapSummaryResponse) { 42 | $clickwrap_name = $clickwrapSummaryResponse['clickwrap_name']; 43 | $clickwrapSummaryResponse = json_decode((string)$clickwrapSummaryResponse, true); 44 | $this->clientService->showDoneTemplateFromManifest( 45 | $this->codeExampleText, 46 | json_encode(json_encode($clickwrapSummaryResponse)), 47 | ManifestService::replacePlaceholders( 48 | "{0}", 49 | $clickwrap_name, 50 | $this->codeExampleText["ResultsPageText"] 51 | ) 52 | ); 53 | } 54 | } 55 | 56 | /** 57 | * Get specific template arguments 58 | * 59 | * @return array 60 | */ 61 | public function getTemplateArgs(): array 62 | { 63 | return [ 64 | 'account_id' => $_SESSION['ds_account_id'], 65 | 'ds_access_token' => $_SESSION['ds_access_token'], 66 | 'clickwrap_name' => $this->checkInputValues($_POST['clickwrap_name']) 67 | ]; 68 | } 69 | } 70 | -------------------------------------------------------------------------------- /src/Services/Examples/Rooms/GrantOfficeAccessToFormGroupService.php: -------------------------------------------------------------------------------- 1 | getFromGroupsApi(); 21 | $form_api->grantOfficeAccessToFormGroup($args['form_group_id'], $args['office_id'], $args["account_id"]); 22 | #ds-snippet-end:Rooms8Step5 23 | } catch (ApiException $e) { 24 | error_log($e); 25 | $clientService->showErrorTemplate($e); 26 | exit; 27 | } 28 | } 29 | 30 | /** 31 | * Get available offices 32 | * 33 | * @param $routerService 34 | * @param $clientService 35 | * @param $args 36 | * @param $eg 37 | * @return array 38 | */ 39 | public static function getOffices($routerService, $clientService, $args, $eg): array 40 | { 41 | $offices = []; 42 | if ($routerService->dsTokenOk($GLOBALS['DS_CONFIG']['minimum_buffer_min'])) { 43 | $offices = $clientService->getOffices($args['account_id']); 44 | } else { 45 | $clientService->needToReAuth($eg); 46 | } 47 | return $offices; 48 | } 49 | 50 | /** 51 | * Get available form groups 52 | * 53 | * @param $routerService 54 | * @param $clientService 55 | * @param $args 56 | * @param $eg 57 | * @return array 58 | */ 59 | public static function getFormGroups($routerService, $clientService, $args, $eg): array 60 | { 61 | $formGroups = []; 62 | if ($routerService->dsTokenOk($GLOBALS['DS_CONFIG']['minimum_buffer_min'])) { 63 | $formGroups = $clientService->getFormGroups($args['account_id']); 64 | } else { 65 | $clientService->needToReAuth($eg); 66 | } 67 | return $formGroups; 68 | } 69 | } 70 | -------------------------------------------------------------------------------- /src/Controllers/Examples/eSignature/EG043EnvelopesListStatus.php: -------------------------------------------------------------------------------- 1 | codeExampleText = $this->getPageText(static::EG); 25 | $this->checkDsToken(); 26 | 27 | $listStatus = SharedAccessService::listEnvelopes( 28 | $this->clientService->apiClient, 29 | $_SESSION['ds_account_id'], 30 | $_SESSION['principal_user_id'] 31 | ); 32 | 33 | if ($listStatus != null && $listStatus->getEnvelopes() != null) { 34 | $this->clientService->showDoneTemplate( 35 | $this->codeExampleText["ExampleName"], 36 | $this->codeExampleText["ExampleName"], 37 | $this->codeExampleText["AdditionalPage"][1]["ResultsPageText"], 38 | json_encode($listStatus->__toString()) 39 | ); 40 | } 41 | 42 | $this->clientService->showDoneTemplate( 43 | $this->codeExampleText["ExampleName"], 44 | $this->codeExampleText["ExampleName"], 45 | $this->codeExampleText["AdditionalPage"][2]["ResultsPageText"] 46 | ); 47 | } 48 | 49 | /** 50 | * 1. Check the token 51 | * 2. Call the worker method 52 | * 3. Redirect the user to the signing 53 | * 54 | * @return void 55 | * @throws \DocuSign\eSign\Client\ApiException 56 | */ 57 | public function createController(): void 58 | { 59 | } 60 | 61 | /** 62 | * Get specific template arguments 63 | * 64 | * @return array 65 | */ 66 | public function getTemplateArgs(): array 67 | { 68 | return $this->getDefaultTemplateArgs(); 69 | } 70 | } 71 | -------------------------------------------------------------------------------- /src/Controllers/Examples/Admin/EG010DeleteUserDataFromOrganization.php: -------------------------------------------------------------------------------- 1 | checkDsToken(); 35 | 36 | try { 37 | $organizationId = $this->clientService->getOrgAdminId(); 38 | $usersApi = $this->clientService->getUsersApi(); 39 | $organizationsApi = $this->clientService->getOrganizationsApi(); 40 | 41 | $individualUserDataRedactionResponse = DeleteUserDataFromOrganizationService::deleteUserDataFromOrganization( 42 | $usersApi, 43 | $organizationsApi, 44 | $organizationId, 45 | $this->args['email'] 46 | ); 47 | 48 | $this->clientService->showDoneTemplateFromManifest( 49 | $this->codeExampleText, 50 | json_encode($individualUserDataRedactionResponse->__toString()) 51 | ); 52 | } catch (ApiException $e) { 53 | $this->clientService->showErrorTemplate($e); 54 | } 55 | } 56 | 57 | /** 58 | * Get specific template arguments 59 | * 60 | * @return array 61 | */ 62 | public function getTemplateArgs(): array 63 | { 64 | return [ 65 | 'account_id' => $_SESSION['ds_account_id'], 66 | 'ds_access_token' => $_SESSION['ds_access_token'], 67 | 'email' => $this->checkInputValues($_POST['email']), 68 | ]; 69 | } 70 | } 71 | -------------------------------------------------------------------------------- /templates/admin/eg011_delete_user_data_from_account.html: -------------------------------------------------------------------------------- 1 | {% extends "base.html" %} 2 | {% block content %} 3 | 4 | {% set formNumber = 0 %} 5 | {% set userIdInputNumber = 0 %} 6 | 7 |

{{ code_example_text['ExampleName'] | raw }}

8 | 9 |

{{ code_example_text["ExampleDescription"] | raw }}

10 | 11 | 12 | {% if show_doc %} 13 |

Documentation about this example.

14 | {% endif %} 15 | 16 |

17 | {% if code_example_text["LinksToAPIMethod"] | length == 1 %} 18 | {{ common_texts["APIMethodUsed"] | raw }} 19 | {% else %} 20 | {{ common_texts["APIMethodUsedPlural"] | raw }} 21 | {% endif %} 22 | 23 | {% for i in 0..(code_example_text["LinksToAPIMethod"] | length - 1) %} 24 | 25 | {{ code_example_text['LinksToAPIMethod'][i]['PathName'] | raw}} 26 | 27 | 28 | {% if i + 1 == code_example_text["LinksToAPIMethod"] | length - 1 %} 29 | and 30 | {% elseif i + 1 != code_example_text["LinksToAPIMethod"] | length %} 31 | , 32 | {% endif %} 33 | {% endfor %} 34 |

35 | 36 |

37 | {{ common_texts["ViewSourceFile"]|replace({ ("{0}"): ("%s"|format(source_url, source_file)) })| raw }} 38 |

39 | 40 |
41 |
42 | 45 | 46 | 49 | 50 | 51 | {{ common_texts["HelpingTexts"]["UserIDOfUserToDelete"] | raw }} 52 | 53 |
54 | 55 | 56 | 57 |
58 | 59 | {% endblock %} 60 | -------------------------------------------------------------------------------- /templates/esignature/eg004_envelope_info.html: -------------------------------------------------------------------------------- 1 | {% extends "base.html" %} {% block content %} 2 | 3 | {% set formNumber = 0 %} 4 | {% set redirectToSecondCodeExample = "href='" ~ app_url ~ "index.php?page=eg002'" %} 5 | {% set redirectNumber = 0 %} 6 | 7 |

{{ code_example_text['ExampleName'] | raw }}

8 |

{{ code_example_text["ExampleDescription"] | raw }}

9 | 10 | {% if show_doc %} 11 |

Documentation about this example.

12 | {% endif %} 13 | 14 |

15 | {% if code_example_text["LinksToAPIMethod"] | length == 1 %} 16 | {{ common_texts["APIMethodUsed"] | raw }} 17 | {% else %} 18 | {{ common_texts["APIMethodUsedPlural"] | raw }} 19 | {% endif %} 20 | 21 | {% for i in 0..(code_example_text["LinksToAPIMethod"] | length - 1) %} 22 | 23 | {{ code_example_text['LinksToAPIMethod'][i]['PathName'] | raw}} 24 | 25 | 26 | {% if i + 1 == code_example_text["LinksToAPIMethod"] | length - 1 %} 27 | and 28 | {% elseif i + 1 != code_example_text["LinksToAPIMethod"] | length %} 29 | , 30 | {% endif %} 31 | {% endfor %} 32 |

33 | 34 |

35 | {{ common_texts["ViewSourceFile"]|replace({ ("{0}"): ("%s"|format(source_url, source_file)) })| raw }} 36 |

37 | 38 | {% if envelope_ok %} 39 |

{{ code_example_text['Forms'][formNumber]['FormName'] | raw }}

40 | 41 |
42 | 43 | 44 |
45 | 46 | {% else %} 47 |

48 | {{ code_example_text['RedirectsToOtherCodeExamples'][redirectNumber]['RedirectText']|replace({ ("{0}"): redirectToSecondCodeExample }) | raw }} 49 |

50 | 51 |
52 | 53 | 54 |
55 | {% endif %} 56 | 57 | {% endblock %} 58 | -------------------------------------------------------------------------------- /templates/esignature/eg005_envelope_recipients.html: -------------------------------------------------------------------------------- 1 | {% extends "base.html" %} {% block content %} 2 | 3 | {% set formNumber = 0 %} 4 | {% set redirectToSecondCodeExample = "href='" ~ app_url ~ "index.php?page=eg002'" %} 5 | {% set redirectNumber = 0 %} 6 | 7 |

{{ code_example_text['ExampleName'] | raw }}

8 |

{{ code_example_text["ExampleDescription"] | raw }}

9 | 10 | {% if show_doc %} 11 |

Documentation about this example.

12 | {% endif %} 13 | 14 |

15 | {% if code_example_text["LinksToAPIMethod"] | length == 1 %} 16 | {{ common_texts["APIMethodUsed"] | raw }} 17 | {% else %} 18 | {{ common_texts["APIMethodUsedPlural"] | raw }} 19 | {% endif %} 20 | 21 | {% for i in 0..(code_example_text["LinksToAPIMethod"] | length - 1) %} 22 | 23 | {{ code_example_text['LinksToAPIMethod'][i]['PathName'] | raw}} 24 | 25 | 26 | {% if i + 1 == code_example_text["LinksToAPIMethod"] | length - 1 %} 27 | and 28 | {% elseif i + 1 != code_example_text["LinksToAPIMethod"] | length %} 29 | , 30 | {% endif %} 31 | {% endfor %} 32 |

33 |

34 | {{ common_texts["ViewSourceFile"]|replace({ ("{0}"): ("%s"|format(source_url, source_file)) })| raw }} 35 |

36 | 37 | {% if envelope_ok %} 38 |

{{ code_example_text['Forms'][formNumber]['FormName'] | raw }}

39 | 40 |
41 | 42 | 43 |
44 | 45 | {% else %} 46 |

47 | {{ code_example_text['RedirectsToOtherCodeExamples'][redirectNumber]['RedirectText']|replace({ ("{0}"): redirectToSecondCodeExample }) | raw }} 48 |

49 | 50 |
51 | 52 | 53 |
54 | {% endif %} 55 | 56 | {% endblock %} 57 | -------------------------------------------------------------------------------- /templates/esignature/eg006_envelope_docs.html: -------------------------------------------------------------------------------- 1 | {% extends "base.html" %} {% block content %} 2 | 3 | {% set formNumber = 0 %} 4 | {% set redirectToSecondCodeExample = "href='" ~ app_url ~ "index.php?page=eg002'" %} 5 | {% set redirectNumber = 0 %} 6 | 7 |

{{ code_example_text['ExampleName'] | raw }}

8 |

{{ code_example_text["ExampleDescription"] | raw }}

9 | 10 | {% if show_doc %} 11 |

Documentation about this example.

12 | {% endif %} 13 | 14 |

15 | {% if code_example_text["LinksToAPIMethod"] | length == 1 %} 16 | {{ common_texts["APIMethodUsed"] | raw }} 17 | {% else %} 18 | {{ common_texts["APIMethodUsedPlural"] | raw }} 19 | {% endif %} 20 | 21 | {% for i in 0..(code_example_text["LinksToAPIMethod"] | length - 1) %} 22 | 23 | {{ code_example_text['LinksToAPIMethod'][i]['PathName'] | raw}} 24 | 25 | 26 | {% if i + 1 == code_example_text["LinksToAPIMethod"] | length - 1 %} 27 | and 28 | {% elseif i + 1 != code_example_text["LinksToAPIMethod"] | length %} 29 | , 30 | {% endif %} 31 | {% endfor %} 32 |

33 | 34 |

35 | {{ common_texts["ViewSourceFile"]|replace({ ("{0}"): ("%s"|format(source_url, source_file)) })| raw }} 36 |

37 | 38 | {% if envelope_ok %} 39 |

{{ code_example_text['Forms'][formNumber]['FormName'] | raw }}

40 | 41 |
42 | 43 | 44 |
45 | 46 | {% else %} 47 |

48 | {{ code_example_text['RedirectsToOtherCodeExamples'][redirectNumber]['RedirectText']|replace({ ("{0}"): redirectToSecondCodeExample }) | raw }} 49 |

50 | 51 |
52 | 53 | 54 |
55 | {% endif %} 56 | 57 | {% endblock %} 58 | -------------------------------------------------------------------------------- /tests/Click/ActivateClickwrapTest.php: -------------------------------------------------------------------------------- 1 | templateName, $testConfig); 25 | $testConfig->setTemplateId($templateInformation["template_id"]); 26 | 27 | JWTLoginMethod::jwtAuthenticationMethod(ApiTypes::CLICK, $testConfig); 28 | 29 | $clickwrapVersionSummaryResponse = DocuSignHelpers::createClickwrapMethod($this->clickwrapName, $testConfig); 30 | 31 | $testConfig->setClickwrapId($clickwrapVersionSummaryResponse["clickwrap_id"]); 32 | $testConfig->setClickwrapVersionNumber($clickwrapVersionSummaryResponse["version_number"]); 33 | 34 | $activeStatus = "active"; 35 | $requestArguments = [ 36 | 'account_id' => $testConfig->getAccountId(), 37 | 'base_path' => $testConfig->getBasePath(), 38 | 'ds_access_token' => $testConfig->getAccessToken(), 39 | 'clickwrap_id' => $testConfig->getClickwrapId(), 40 | 'version_number' => $testConfig->getClickwrapVersionNumber() 41 | ]; 42 | 43 | $clientService = new ClickApiClientService($requestArguments); 44 | 45 | // Act 46 | $clickwrapSummaryResponse = ActivateClickwrapService::activateClickwrap($requestArguments, $clientService); 47 | 48 | // Assert 49 | $this->assertNotEmpty($clickwrapSummaryResponse); 50 | $this->assertNotNull($clickwrapSummaryResponse); 51 | $this->assertEquals($clickwrapSummaryResponse["status"], $activeStatus); 52 | } 53 | } -------------------------------------------------------------------------------- /templates/esignature/eg015_envelope_tab_data.html: -------------------------------------------------------------------------------- 1 | {% extends "base.html" %} {% block content %} 2 | 3 | {% set formNumber = 0 %} 4 | {% set redirectToNinthCodeExample = "href='" ~ app_url ~ "index.php?page=eg009'" %} 5 | {% set redirectNumber = 0 %} 6 | 7 |

{{ code_example_text['ExampleName'] | raw }}

8 | 9 |

{{ code_example_text["ExampleDescription"] | raw }}

10 | 11 | 12 | {% if show_doc %} 13 |

Documentation about this example.

14 | {% endif %} 15 | 16 |

17 | {% if code_example_text["LinksToAPIMethod"] | length == 1 %} 18 | {{ common_texts["APIMethodUsed"] | raw }} 19 | {% else %} 20 | {{ common_texts["APIMethodUsedPlural"] | raw }} 21 | {% endif %} 22 | 23 | {% for i in 0..(code_example_text["LinksToAPIMethod"] | length - 1) %} 24 | 25 | {{ code_example_text['LinksToAPIMethod'][i]['PathName'] | raw}} 26 | 27 | 28 | {% if i + 1 == code_example_text["LinksToAPIMethod"] | length - 1 %} 29 | and 30 | {% elseif i + 1 != code_example_text["LinksToAPIMethod"] | length %} 31 | , 32 | {% endif %} 33 | {% endfor %} 34 |

35 | 36 |

37 | {{ common_texts["ViewSourceFile"]|replace({ ("{0}"): ("%s"|format(source_url, source_file)) })| raw }} 38 |

39 | 40 | {% if envelope_ok %} 41 |

{{ code_example_text['Forms'][formNumber]['FormName'] | raw }}

42 | 43 |
44 | 45 | 46 |
47 | 48 | {% else %} 49 |

50 | {{ code_example_text['RedirectsToOtherCodeExamples'][redirectNumber]['RedirectText']|replace({ ("{0}"): redirectToNinthCodeExample }) | raw }} 51 |

52 | 53 |
54 | 55 | 56 |
57 | {% endif %} 58 | 59 | {% endblock %} 60 | -------------------------------------------------------------------------------- /src/Controllers/Examples/Admin/EG003BulkExportUserData.php: -------------------------------------------------------------------------------- 1 | checkDsToken(); 35 | 36 | try { 37 | $organizationId = $this->clientService->getOrgAdminId(); 38 | 39 | $bulkExports = BulkExportUserDataService::getExportsData( 40 | $this->clientService, 41 | $this->args, 42 | $organizationId 43 | ); 44 | $filePath = realpath( 45 | $_SERVER["DOCUMENT_ROOT"] 46 | ) . DIRECTORY_SEPARATOR . "public" . DIRECTORY_SEPARATOR . "demo_documents" 47 | . DIRECTORY_SEPARATOR . "ExportedUserData.csv"; 48 | if ($bulkExports) { 49 | $this->clientService->showDoneTemplateFromManifest( 50 | $this->codeExampleText, 51 | json_encode(json_encode($bulkExports)), 52 | null, 53 | ManifestService::replacePlaceholders("{0}", $filePath, $this->codeExampleText["ResultsPageText"]) 54 | ); 55 | } 56 | } catch (ApiException $e) { 57 | $this->clientService->showErrorTemplate($e); 58 | } 59 | } 60 | 61 | /** 62 | * Get specific template arguments 63 | * @return array 64 | */ 65 | public function getTemplateArgs(): array 66 | { 67 | return $this->getDefaultTemplateArgs(); 68 | } 69 | } 70 | -------------------------------------------------------------------------------- /templates/esignature/eg026_permission_change_single_setting.html: -------------------------------------------------------------------------------- 1 | {% extends "base.html" %} {% block content %} 2 | 3 | {% set formNumber = 0 %} 4 | {% set profileNameInputNumber = 0 %} 5 | 6 |

{{ code_example_text['ExampleName'] | raw }}

7 | 8 |

{{ code_example_text["ExampleDescription"] | raw }}

9 | 10 | 11 | {% if show_doc %} 12 |

Documentation about this example.

13 | {% endif %} 14 | 15 |

16 | {% if code_example_text["LinksToAPIMethod"] | length == 1 %} 17 | {{ common_texts["APIMethodUsed"] | raw }} 18 | {% else %} 19 | {{ common_texts["APIMethodUsedPlural"] | raw }} 20 | {% endif %} 21 | 22 | {% for i in 0..(code_example_text["LinksToAPIMethod"] | length - 1) %} 23 | 24 | {{ code_example_text['LinksToAPIMethod'][i]['PathName'] | raw}} 25 | 26 | 27 | {% if i + 1 == code_example_text["LinksToAPIMethod"] | length - 1 %} 28 | and 29 | {% elseif i + 1 != code_example_text["LinksToAPIMethod"] | length %} 30 | , 31 | {% endif %} 32 | {% endfor %} 33 |

34 | 35 |

36 | {{ common_texts["ViewSourceFile"]|replace({ ("{0}"): ("%s"|format(source_url, source_file)) })| raw }} 37 |

38 | 39 |
40 |
41 | 44 | 45 |
46 | 47 | 52 |
53 | 54 |
55 | 56 | 57 |
58 |
59 | 60 | {% endblock %} -------------------------------------------------------------------------------- /src/Controllers/Examples/eSignature/EG039InPersonSigning.php: -------------------------------------------------------------------------------- 1 | checkDsToken(); 39 | 40 | // Perhaps these can help with a use case? 41 | // $hostEmail = $this->clientService->getAuthenticatedUserEmail($this->args["ds_access_token"]); 42 | // $hostName = $this->clientService->getAuthenticatedUserName($this->args["ds_access_token"]); 43 | try { 44 | $returnUrl = InPersonSigningService::worker( 45 | $this->args["account_id"], 46 | $this->args["signer_name"], 47 | $this->clientService, 48 | self::DEMO_DOCS_PATH 49 | ); 50 | 51 | if ($returnUrl) { 52 | header('Location: ' . $returnUrl); 53 | exit; 54 | } 55 | } catch (ApiException $e) { 56 | $this->clientService->showErrorTemplate($e); 57 | } 58 | } 59 | 60 | /** 61 | * Get specific template arguments 62 | * @return array 63 | */ 64 | public function getTemplateArgs(): array 65 | { 66 | return [ 67 | 'account_id' => $_SESSION['ds_account_id'], 68 | 'base_path' => $_SESSION['ds_base_path'], 69 | 'ds_access_token' => $_SESSION['ds_access_token'], 70 | 'signer_name' => $this->checkInputValues($_POST['signer_name']), 71 | 'ds_return_url' => $GLOBALS['app_url'] . 'index.php?page=ds_return' 72 | ]; 73 | } 74 | } 75 | -------------------------------------------------------------------------------- /templates/esignature/eg024_permissions_creating.html: -------------------------------------------------------------------------------- 1 | {% extends "base.html" %} {% block content %} 2 | 3 | {% set formNumber = 0 %} 4 | {% set profileNameInputNumber = 0 %} 5 | 6 |

{{ code_example_text['ExampleName'] | raw }}

7 | 8 |

{{ code_example_text["ExampleDescription"] | raw }}

9 | 10 | 11 | {% if show_doc %} 12 |

Documentation about this example.

13 | {% endif %} 14 | 15 |

16 | {% if code_example_text["LinksToAPIMethod"] | length == 1 %} 17 | {{ common_texts["APIMethodUsed"] | raw }} 18 | {% else %} 19 | {{ common_texts["APIMethodUsedPlural"] | raw }} 20 | {% endif %} 21 | 22 | {% for i in 0..(code_example_text["LinksToAPIMethod"] | length - 1) %} 23 | 24 | {{ code_example_text['LinksToAPIMethod'][i]['PathName'] | raw}} 25 | 26 | 27 | {% if i + 1 == code_example_text["LinksToAPIMethod"] | length - 1 %} 28 | and 29 | {% elseif i + 1 != code_example_text["LinksToAPIMethod"] | length %} 30 | , 31 | {% endif %} 32 | {% endfor %} 33 |

34 | 35 |

36 | {{ common_texts["ViewSourceFile"]|replace({ ("{0}"): ("%s"|format(source_url, source_file)) })| raw }} 37 |

38 | 39 |
40 |
41 | 44 | 45 | 52 |
53 | 54 |
55 | 56 | 57 |
58 |
59 | {% endblock %} 60 | 61 | -------------------------------------------------------------------------------- /templates/esignature/eg027_permissions_delete.html: -------------------------------------------------------------------------------- 1 | {% extends "base.html" %} {% block content %} 2 | 3 | {% set formNumber = 0 %} 4 | {% set permissionInputNumber = 0 %} 5 | 6 |

{{ code_example_text['ExampleName'] | raw }}

7 | 8 |

{{ code_example_text["ExampleDescription"] | raw }}

9 | 10 |

{{ code_example_text["Notes"] | raw }}

11 | 12 | {% if show_doc %} 13 |

Documentation about this example.

14 | {% endif %} 15 | 16 |

17 | {% if code_example_text["LinksToAPIMethod"] | length == 1 %} 18 | {{ common_texts["APIMethodUsed"] | raw }} 19 | {% else %} 20 | {{ common_texts["APIMethodUsedPlural"] | raw }} 21 | {% endif %} 22 | 23 | {% for i in 0..(code_example_text["LinksToAPIMethod"] | length - 1) %} 24 | 25 | {{ code_example_text['LinksToAPIMethod'][i]['PathName'] | raw}} 26 | 27 | 28 | {% if i + 1 == code_example_text["LinksToAPIMethod"] | length - 1 %} 29 | and 30 | {% elseif i + 1 != code_example_text["LinksToAPIMethod"] | length %} 31 | , 32 | {% endif %} 33 | {% endfor %} 34 |

35 | 36 |

37 | {{ common_texts["ViewSourceFile"]|replace({ ("{0}"): ("%s"|format(source_url, source_file)) })| raw }} 38 |

39 | 40 |
41 |
42 | 45 | 46 |
47 | 48 | 53 |
54 | 55 |
56 | 57 | 58 |
59 |
60 | {% endblock %} -------------------------------------------------------------------------------- /src/Controllers/Examples/Click/EG005GetClickwrapResponses.php: -------------------------------------------------------------------------------- 1 | routerService, 25 | $this->clientService, 26 | $this->args, 27 | $this::EG 28 | ); 29 | parent::controller(['clickwraps' => $clickwraps]); 30 | } 31 | 32 | /** 33 | * 1. Check the token 34 | * 2. Call the worker method 35 | * 3. Display clickwrap responses data 36 | * 37 | * @return void 38 | */ 39 | protected function createController(): void 40 | { 41 | $this->checkDsToken(); 42 | $clickwrapResponse = GetClickwrapResponseService::getClickwrapResponse($this->args, $this->clientService); 43 | 44 | if ($clickwrapResponse) { 45 | $clickwrapResponse = json_decode((string)$clickwrapResponse, true); 46 | array_walk_recursive( 47 | $clickwrapResponse, 48 | function (&$v) { 49 | if (gettype($v) == 'string' && strlen($v) > 500) { 50 | $v = 'String (Length = ' . strlen($v) . ')..'; 51 | } 52 | } 53 | ); 54 | $this->clientService->showDoneTemplateFromManifest( 55 | $this->codeExampleText, 56 | json_encode(json_encode($clickwrapResponse)) 57 | ); 58 | } 59 | } 60 | 61 | public function getTemplateArgs(): array 62 | { 63 | return [ 64 | 'account_id' => $_SESSION['ds_account_id'], 65 | 'ds_access_token' => $_SESSION['ds_access_token'], 66 | 'clickwrap_id' => $this->checkInputValues($_POST['clickwrap_id']), 67 | ]; 68 | } 69 | } 70 | -------------------------------------------------------------------------------- /templates/esignature/eg045_delete_envelope.html: -------------------------------------------------------------------------------- 1 | {% extends "base.html" %} {% block content %} 2 | 3 | {% set formNumber = 0 %} 4 | {% set envelopeIdInputNumber = 0 %} 5 | 6 |

{{ code_example_text['ExampleName'] | raw }}

7 |

{{ code_example_text["ExampleDescription"] | raw }}

8 | 9 | {% if show_doc %} 10 |

Documentation about this example.

11 | {% endif %} 12 | 13 |

14 | {% if code_example_text["LinksToAPIMethod"] | length == 1 %} 15 | {{ common_texts["APIMethodUsed"] | raw }} 16 | {% else %} 17 | {{ common_texts["APIMethodUsedPlural"] | raw }} 18 | {% endif %} 19 | 20 | {% for i in 0..(code_example_text["LinksToAPIMethod"] | length - 1) %} 21 | 22 | {{ code_example_text['LinksToAPIMethod'][i]['PathName'] | raw}} 23 | 24 | 25 | {% if i + 1 == code_example_text["LinksToAPIMethod"] | length - 1 %} 26 | and 27 | {% elseif i + 1 != code_example_text["LinksToAPIMethod"] | length %} 28 | , 29 | {% endif %} 30 | {% endfor %} 31 |

32 | 33 |

34 | {{ common_texts["ViewSourceFile"]|replace({ ("{0}"): ("%s"|format(source_url, 35 | source_file)) })| raw }} 36 |

37 | 38 |
39 |
40 | 43 | 44 | 47 | 48 | 49 | {{ common_texts["HelpingTexts"]["DefaultEnvelopeId"] | raw }} 50 | 51 |
52 | 53 | 54 | 57 |
58 | 59 | {% endblock %} -------------------------------------------------------------------------------- /src/Services/Examples/Click/ActivateClickwrapService.php: -------------------------------------------------------------------------------- 1 | 'active']); 23 | #ds-snippet-end:Click2Step3 24 | 25 | try { 26 | #ds-snippet-start:Click2Step4 27 | $accounts_api = $clientService->accountsApi(); 28 | $response = $accounts_api -> updateClickwrapVersion( 29 | $args['account_id'], 30 | $args['clickwrap_id'], 31 | $args['version_number'], 32 | $clickwrap_request 33 | ); 34 | #ds-snippet-end:Click2Step4 35 | } catch (ApiException $e) { 36 | $clientService->showErrorTemplate($e); 37 | exit; 38 | } 39 | 40 | return $response; 41 | } 42 | 43 | public static function getClickwrapsByStatus( 44 | RouterService $routerService, 45 | ClickApiClientService $clientService, 46 | array $args, 47 | string $eg, 48 | string $status 49 | ): array { 50 | $minimum_buffer_min = 3; 51 | if ($routerService->dsTokenOk($minimum_buffer_min)) { 52 | try { 53 | $apiClient = $clientService->accountsApi(); 54 | $options = new GetClickwrapsOptions(); 55 | $options -> setStatus($status); 56 | return $apiClient->getClickwraps($args['account_id'], $options)['clickwraps']; 57 | } catch (ApiException $e) { 58 | error_log($e); 59 | return []; 60 | } 61 | } else { 62 | $clientService->needToReAuth($eg); 63 | } 64 | } 65 | } 66 | -------------------------------------------------------------------------------- /src/Services/Examples/Admin/CreateNewUserService.php: -------------------------------------------------------------------------------- 1 | getUsersApi(); 29 | $accountId = $_SESSION['ds_account_id']; 30 | #ds-snippet-start:Admin1Step3 31 | $permissionProfile = new PermissionProfileRequest([ 32 | 'id' => $userData['permission_profile_id'] 33 | ]); 34 | #ds-snippet-end:Admin1Step3 35 | 36 | #ds-snippet-start:Admin1Step4 37 | $group = new GroupRequest([ 38 | 'id' => (int) $userData['group_id'] 39 | ]); 40 | #ds-snippet-end:Admin1Step4 41 | 42 | #ds-snippet-start:Admin1Step5 43 | $accountInfo = new NewUserRequestAccountProperties([ 44 | 'id' => $accountId, 45 | 'permission_profile' => $permissionProfile, 46 | 'groups' => [ $group ] 47 | ]); 48 | 49 | $request = new GlobalNewUserRequest([ 50 | 'user_name' => $userData['Name'], 51 | 'first_name' => $userData['FirstName'], 52 | 'last_name' => $userData['LastName'], 53 | 'email' => $userData['Email'], 54 | 'default_account_id' => $accountId, 55 | 'accounts' => array($accountInfo), 56 | 'auto_activate_memberships' => true 57 | ]); 58 | #ds-snippet-end:Admin1Step5 59 | 60 | #ds-snippet-start:Admin1Step6 61 | return $usersApi->createUser($organizationId, $request); 62 | #ds-snippet-end:Admin1Step6 63 | } 64 | } 65 | -------------------------------------------------------------------------------- /templates/esignature/eg018_envelope_custom_field_data.html: -------------------------------------------------------------------------------- 1 | {% extends "base.html" %} {% block content %} 2 | 3 | {% set formNumber = 0 %} 4 | {% set redirectTo16CodeExample = "href='" ~ app_url ~ "index.php?page=eg016'" %} 5 | {% set redirectToCodeExample = app_url ~ "index.php?page=eg016" %} 6 | {% set redirectNumber = 0 %} 7 | 8 |

{{ code_example_text['ExampleName'] | raw }}

9 | 10 |

{{ code_example_text["ExampleDescription"] | raw }}

11 | 12 | 13 | {% if show_doc %} 14 |

Documentation about this example.

15 | {% endif %} 16 | 17 |

18 | {% if code_example_text["LinksToAPIMethod"] | length == 1 %} 19 | {{ common_texts["APIMethodUsed"] | raw }} 20 | {% else %} 21 | {{ common_texts["APIMethodUsedPlural"] | raw }} 22 | {% endif %} 23 | 24 | {% for i in 0..(code_example_text["LinksToAPIMethod"] | length - 1) %} 25 | 26 | {{ code_example_text['LinksToAPIMethod'][i]['PathName'] | raw}} 27 | 28 | 29 | {% if i + 1 == code_example_text["LinksToAPIMethod"] | length - 1 %} 30 | and 31 | {% elseif i + 1 != code_example_text["LinksToAPIMethod"] | length %} 32 | , 33 | {% endif %} 34 | {% endfor %} 35 |

36 | 37 |

38 | {{ common_texts["ViewSourceFile"]|replace({ ("{0}"): ("%s"|format(source_url, source_file)) })| raw }} 39 |

40 | 41 | {% if envelope_ok %} 42 |

{{ code_example_text['Forms'][formNumber]['FormName']|replace({ ("{0}"): redirectToCodeExample }) | raw }}

43 | 44 |
45 | 46 | 47 |
48 | 49 | {% else %} 50 |

51 | {{ code_example_text['RedirectsToOtherCodeExamples'][redirectNumber]['RedirectText']|replace({ ("{0}"): redirectTo16CodeExample }) | raw }} 52 |

53 | 54 |
55 | 56 | 57 |
58 | {% endif %} 59 | 60 | {% endblock %} 61 | -------------------------------------------------------------------------------- /src/Controllers/Examples/eSignature/EG032PauseSignatureWorkflow.php: -------------------------------------------------------------------------------- 1 | checkDsToken(); 33 | # 1. Call the worker method 34 | # More data validation would be a good idea here 35 | # Strip anything other than characters listed 36 | $envelope = PauseSignatureWorkflowService::pauseSignatureWorkflow( 37 | $this->args, 38 | $this->clientService, 39 | $this::DEMO_DOCS_PATH 40 | ); 41 | 42 | if ($envelope) { 43 | $_SESSION["pause_envelope_id"] = $envelope["envelope_id"]; 44 | $this->clientService->showDoneTemplateFromManifest( 45 | $this->codeExampleText, 46 | json_encode($envelope->__toString()) 47 | ); 48 | } 49 | } 50 | 51 | /** 52 | * Get specific template arguments 53 | * 54 | * @return array 55 | */ 56 | public function getTemplateArgs(): array 57 | { 58 | $envelope_args = [ 59 | 'signer1_email' => $this->checkEmailInputValue($_POST['signer1_email']), 60 | 'signer1_name' => $this->checkInputValues($_POST['signer1_name']), 61 | 'signer2_email' => $this->checkEmailInputValue($_POST['signer2_email']), 62 | 'signer2_name' => $this->checkInputValues($_POST['signer2_name']), 63 | 'status' => "Sent", 64 | ]; 65 | return [ 66 | 'account_id' => $_SESSION['ds_account_id'], 67 | 'base_path' => $_SESSION['ds_base_path'], 68 | 'ds_access_token' => $_SESSION['ds_access_token'], 69 | 'envelope_args' => $envelope_args 70 | ]; 71 | } 72 | } 73 | -------------------------------------------------------------------------------- /src/Services/Examples/eSignature/CreateAnEnvelopeFunctionService.php: -------------------------------------------------------------------------------- 1 | 'Please sign this document set' 14 | ]); 15 | $doc1_b64 = base64_encode($clientService->createDocumentForEnvelope($args)); 16 | # read files 2 and 3 from a local directory 17 | # The reads could raise an exception if the file is not available! 18 | $content_bytes = file_get_contents($demoDocsPath . $docDocx); 19 | $doc2_b64 = base64_encode($content_bytes); 20 | $content_bytes = file_get_contents($demoDocsPath . $docPDF); 21 | $doc3_b64 = base64_encode($content_bytes); 22 | 23 | # Create the document models 24 | $document1 = new Document([ # create the DocuSign document object 25 | 'document_base64' => $doc1_b64, 26 | 'name' => 'Order acknowledgement', # can be different from actual file name 27 | 'file_extension' => 'html', # many different document types are accepted 28 | 'document_id' => '1' # a label used to reference the doc 29 | ]); 30 | $document2 = new Document([ # create the DocuSign document object 31 | 'document_base64' => $doc2_b64, 32 | 'name' => 'Battle Plan', # can be different from actual file name 33 | 'file_extension' => 'docx', # many different document types are accepted 34 | 'document_id' => '2' # a label used to reference the doc 35 | ]); 36 | $document3 = new Document([ # create the DocuSign document object 37 | 'document_base64' => $doc3_b64, 38 | 'name' => 'Lorem Ipsum', # can be different from actual file name 39 | 'file_extension' => 'pdf', # many different document types are accepted 40 | 'document_id' => '3' # a label used to reference the doc 41 | ]); 42 | # The order in the docs array determines the order in the envelope 43 | $envelope_definition->setDocuments([$document1, $document2, $document3]); 44 | return $envelope_definition; 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /src/Controllers/Examples/eSignature/EG038ResponsiveSigning.php: -------------------------------------------------------------------------------- 1 | checkDsToken(); 39 | 40 | try { 41 | $returnUrl = ResponsiveSigningService::worker( 42 | $this->args, 43 | $this->clientService, 44 | self::DEMO_DOCS_PATH 45 | ); 46 | 47 | if ($returnUrl) { 48 | header('Location: ' . $returnUrl); 49 | exit; 50 | } 51 | } catch (ApiException $e) { 52 | $this->clientService->showErrorTemplate($e); 53 | } 54 | } 55 | 56 | /** 57 | * Get specific template arguments 58 | * @return array 59 | */ 60 | public function getTemplateArgs(): array 61 | { 62 | $envelopeArgs = [ 63 | 'signer_email' => $this->checkEmailInputValue($_POST['signer_email']), 64 | 'signer_name' => $this->checkInputValues($_POST['signer_name']), 65 | 'cc_email' => $this->checkEmailInputValue($_POST['cc_email']), 66 | 'cc_name' => $this->checkInputValues($_POST['cc_name']), 67 | 'signer_client_id' => 1000, 68 | 'ds_return_url' => $GLOBALS['app_url'] . 'index.php?page=ds_return' 69 | ]; 70 | return [ 71 | 'account_id' => $_SESSION['ds_account_id'], 72 | 'base_path' => $_SESSION['ds_base_path'], 73 | 'ds_access_token' => $_SESSION['ds_access_token'], 74 | 'envelope_args' => $envelopeArgs 75 | ]; 76 | } 77 | } 78 | -------------------------------------------------------------------------------- /src/Controllers/Examples/eSignature/EG025PermissionSetUserGroup.php: -------------------------------------------------------------------------------- 1 | clientService->getPermissionsProfiles($this->args); 22 | $groups = $this->clientService->getGroups($this->args); 23 | parent::controller( 24 | null, 25 | null, 26 | null, 27 | $permission_profiles, 28 | $groups 29 | ); 30 | } 31 | 32 | /** 33 | * 1. Check the token 34 | * 2. Call the worker method 35 | * 36 | * @return void 37 | */ 38 | public function createController(): void 39 | { 40 | $this->checkDsToken(); 41 | 42 | # 1. Call the worker method 43 | # More data validation would be a good idea here 44 | # Strip anything other than characters listed 45 | $updatedGroups = json_decode( 46 | PermissionSetUserGroupService::permissionSetUserGroup($this->args, $this->clientService), 47 | true 48 | ); 49 | 50 | if ($updatedGroups) { 51 | # That need an envelope_id 52 | $this->clientService->showDoneTemplateFromManifest( 53 | $this->codeExampleText 54 | ); 55 | } 56 | } 57 | 58 | /** 59 | * Get specific template arguments 60 | * 61 | * @return array 62 | */ 63 | public function getTemplateArgs(): array 64 | { 65 | $permissions_args = [ 66 | 'permission_profile_id' => $this->checkInputValues($_POST['permission_profile_id']), 67 | 'group_id' => $this->checkInputValues($_POST['group_id']), 68 | ]; 69 | return [ 70 | 'account_id' => $_SESSION['ds_account_id'], 71 | 'base_path' => $_SESSION['ds_base_path'], 72 | 'ds_access_token' => $_SESSION['ds_access_token'], 73 | 'permission_args' => $permissions_args 74 | ]; 75 | } 76 | } 77 | --------------------------------------------------------------------------------