">
37 |
38 | In httpd.conf, use Ctrl-S to save your changes.
39 |
40 | 
41 |
42 | **Step 5.** On the XAMPP Control Panel, to the right of Apache, select the Start button.
43 |
44 | 
45 |
46 | Apache should run.
47 |
48 | 
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 | 
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 |
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 |
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 |
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 |
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 |
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 |
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 |
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 |
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 |
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 |
45 |
46 | {% else %}
47 |
48 | {{ code_example_text['RedirectsToOtherCodeExamples'][redirectNumber]['RedirectText']|replace({ ("{0}"): redirectToSecondCodeExample }) | raw }}
49 |
50 |
51 |
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 |
44 |
45 | {% else %}
46 |
47 | {{ code_example_text['RedirectsToOtherCodeExamples'][redirectNumber]['RedirectText']|replace({ ("{0}"): redirectToSecondCodeExample }) | raw }}
48 |
49 |
50 |
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 |
45 |
46 | {% else %}
47 |
48 | {{ code_example_text['RedirectsToOtherCodeExamples'][redirectNumber]['RedirectText']|replace({ ("{0}"): redirectToSecondCodeExample }) | raw }}
49 |
50 |
51 |
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 |
47 |
48 | {% else %}
49 |
50 | {{ code_example_text['RedirectsToOtherCodeExamples'][redirectNumber]['RedirectText']|replace({ ("{0}"): redirectToNinthCodeExample }) | raw }}
51 |
52 |
53 |
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 |
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 |
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 |
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 |
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 |
48 |
49 | {% else %}
50 |
51 | {{ code_example_text['RedirectsToOtherCodeExamples'][redirectNumber]['RedirectText']|replace({ ("{0}"): redirectTo16CodeExample }) | raw }}
52 |
53 |
54 |
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 |
--------------------------------------------------------------------------------