Skip to content

Commit b49b059

Browse files
committed
2 parents 1a35cff + 41a208d commit b49b059

File tree

170 files changed

+4623
-2489
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

170 files changed

+4623
-2489
lines changed

Quick_ACG/src/RouterService.php

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
namespace QuickACG;
44

55
use Example\Services\CodeGrantService;
6+
use Example\Services\ManifestService;
67
use Example\Services\IRouterService;
78

89
class RouterService implements IRouterService
@@ -15,10 +16,6 @@ class RouterService implements IRouterService
1516
'eg001' => 'esignature/quickEmbeddedSigning.html'
1617
];
1718

18-
private const TITLES = [
19-
'eg001' => 'Use embedded signing'
20-
];
21-
2219
private const SESSION_VALUES = [
2320
'ds_access_token',
2421
'ds_refresh_token',
@@ -70,6 +67,7 @@ public function router(): void
7067
break;
7168
default:
7269
error_reporting(E_ALL & ~E_NOTICE & ~E_WARNING & ~E_DEPRECATED);
70+
$_SESSION['API_TEXT'] = ManifestService::loadManifestData(ManifestService::getLinkToManifestFile('eSignature'));
7371
$controller = '\Example\\' . $this->getController($page);
7472
new $controller($page);
7573
break;
@@ -177,6 +175,6 @@ public function getTemplate($eg): string
177175
*/
178176
public function getTitle($eg): string
179177
{
180-
return self::TITLES[$eg];
178+
return ManifestService::getPageText($eg)["ExampleName"];
181179
}
182180
}

README.md

Lines changed: 20 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -23,37 +23,41 @@ The OAuth library is used in the file [index.php](./public/index.php).
2323

2424
## eSignature API
2525

26-
For more information about the scopes used for obtaining authorization to use the eSignature API, see [Required scopes](https://developers.docusign.com/docs/esign-rest-api/esign101/auth#required-scopes).
26+
For more information about the scopes used for obtaining authorization to use the eSignature API, see [Required scopes](https://developers.docusign.com/docs/esign-rest-api/esign101/auth#required-scopes).
2727

28-
For a list of code examples that use the eSignature API, select the PHP tab under [Examples and languages](https://developers.docusign.com/docs/esign-rest-api/how-to/code-launchers#examples-and-languages) on the DocuSign Developer Center.
28+
For a list of code examples that use the eSignature API, see the [How-to guides overview](https://developers.docusign.com/docs/esign-rest-api/how-to/) on the DocuSign Developer Center.
2929

30-
## Rooms API
3130

32-
**Note:** To use the Rooms API you must also [create your Rooms developer account](https://developers.docusign.com/docs/rooms-api/rooms101/create-account). Examples 4 and 6 require that you have the DocuSign Forms feature enabled in your Rooms for Real Estate account.
33-
For more information about the scopes used for obtaining authorization to use the Rooms API, see [Required scopes](https://developers.docusign.com/docs/rooms-api/rooms101/auth/).
31+
## Rooms API
3432

35-
For a list of code examples that use the Rooms API, select the PHP tab under [Examples and languages](https://developers.docusign.com/docs/rooms-api/how-to/code-launchers#examples-and-languages) on the DocuSign Developer Center.
36-
37-
## Click API
33+
**Note:** To use the Rooms API, you must also [create your Rooms developer account](https://developers.docusign.com/docs/rooms-api/rooms101/create-account). Examples 4 and 6 require that you have the DocuSign Forms feature enabled in your Rooms for Real Estate account.
34+
For more information about the scopes used for obtaining authorization to use the Rooms API, see [Required scopes](https://developers.docusign.com/docs/rooms-api/rooms101/auth/).
3835

39-
For more information about the scopes used for obtaining authorization to use the Click API, see [Required scopes](https://developers.docusign.com/docs/click-api/click101/auth/#required-scopes).
36+
For a list of code examples that use the Rooms API, see the [How-to guides overview](https://developers.docusign.com/docs/rooms-api/how-to/) on the DocuSign Developer Center.
37+
38+
39+
## Click API
40+
For more information about the scopes used for obtaining authorization to use the Click API, see [Required scopes](https://developers.docusign.com/docs/click-api/click101/auth/#required-scopes)
41+
42+
For a list of code examples that use the Click API, see the [How-to guides overview](https://developers.docusign.com/docs/click-api/how-to/) on the DocuSign Developer Center.
4043

41-
For a list of code examples that use the Click API, select the PHP tab under [Examples and languages](https://developers.docusign.com/docs/click-api/how-to/code-launchers#examples-and-languages) on the DocuSign Developer Center.
4244

4345
## Monitor API
44-
**Note:** To use the Monitor API, you must also [enable DocuSign Monitor for your organization](https://developers.docusign.com/docs/monitor-api/how-to/enable-monitor/).
45-
For information about the scopes used for obtaining authorization to use the Monitor API, see the [scopes section](https://developers.docusign.com/docs/monitor-api/monitor101/auth/).
4646

47-
For a list of code examples that use the Monitor API, select the PHP tab under [Examples and languages](https://developers.docusign.com/docs/monitor-api/how-to/code-launchers/#examples-and-languages) on the DocuSign Developer Center.
47+
**Note:** To use the Monitor API, you must also [enable DocuSign Monitor for your organization](https://developers.docusign.com/docs/monitor-api/how-to/enable-monitor/).
48+
49+
For information about the scopes used for obtaining authorization to use the Monitor API, see the [scopes section](https://developers.docusign.com/docs/monitor-api/monitor101/auth/).
50+
51+
For a list of code examples that use the Monitor API, see the [How-to guides overview](https://developers.docusign.com/docs/monitor-api/how-to/) on the DocuSign Developer Center.
4852

4953

5054
## Admin API
51-
**Note:** To use the Admin API, you must [create an organization](https://support.docusign.com/en/guides/org-admin-guide-create-org) in your DocuSign developer account. Also, to run the DocuSign CLM code example, [CLM must be enabled for your organization](https://support.docusign.com/en/articles/DocuSign-and-SpringCM).
5255

53-
For more information about the scopes used for obtaining authorization to use the Admin API, see the [scopes section](https://developers.docusign.com/docs/admin-api/admin101/auth/).
56+
**Note:** To use the Admin API, you must [create an organization](https://support.docusign.com/en/guides/org-admin-guide-create-org) in your DocuSign developer account. Also, to run the DocuSign CLM code example, [CLM must be enabled for your organization](https://support.docusign.com/en/articles/DocuSign-and-SpringCM).
5457

55-
For a list of code examples that use the Admin API, select the PHP tab under [Examples and languages](https://developers.docusign.com/docs/admin-api/how-to/code-launchers/#examples-and-languages) on the DocuSign Developer Center.
58+
For information about the scopes used for obtaining authorization to use the Admin API, see the [scopes section](https://developers.docusign.com/docs/admin-api/admin101/auth/).
5659

60+
For a list of code examples that use the Admin API, see the [How-to guides overview](https://developers.docusign.com/docs/admin-api/how-to/) on the DocuSign Developer Center.
5761

5862
## Installation
5963

composer.json

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,14 @@
44
"DocuSign\\OAuth2\\Client\\Provider\\": "src/"
55
}
66
},
7-
7+
"scripts": {
8+
"post-install-cmd": [
9+
"@code-sniffer"
10+
],
11+
"post-update-cmd": [
12+
"@code-sniffer"
13+
]
14+
},
815
"require": {
916
"docusign/admin-client": "1.1.0",
1017
"docusign/click-client": "1.1.0",
@@ -16,6 +23,7 @@
1623
"ext-json": "*",
1724
"guzzlehttp/guzzle": "7.4.5",
1825
"firebase/php-jwt": "5.5.1",
19-
"mashape/unirest-php": "3.0.4"
26+
"mashape/unirest-php": "3.0.4",
27+
"squizlabs/php_codesniffer": "*"
2028
}
2129
}

ds_config_example.php

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,13 @@
2929
'gateway_name' => "stripe",
3030
'gateway_display_name' => "Stripe",
3131
'github_example_url' => 'https://github.com/docusign/code-examples-php/tree/master/src/Controllers/Examples',
32-
'documentation' => false
32+
'documentation' => false,
33+
// Manifest files
34+
"ESignatureManifest" => "https://raw.githubusercontent.com/docusign/code-examples-csharp/master/manifest/eSignatureManifest.json",
35+
"ClickManifest" => "https://raw.githubusercontent.com/docusign/code-examples-csharp/master/manifest/ClickManifest.json",
36+
"RoomsManifest" => "https://raw.githubusercontent.com/docusign/code-examples-csharp/master/manifest/RoomsManifest.json",
37+
"MonitorManifest" => "https://raw.githubusercontent.com/docusign/code-examples-csharp/master/manifest/MonitorManifest.json",
38+
"AdminManifest" => "https://raw.githubusercontent.com/docusign/code-examples-csharp/master/manifest/AdminManifest.json"
3339
];
3440

3541
$JWT_CONFIG = [

phpcs.xml

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
<?xml version="1.0"?>
2+
<ruleset name="igmaDev">
3+
<file>src/Controllers</file>
4+
<file>src/Services</file>
5+
<file>src/EG001EmbeddedSigning.php</file>
6+
<file>public/index.php</file>
7+
<exclude-pattern>*/docs/*</exclude-pattern>
8+
<exclude-pattern>*/templates/*</exclude-pattern>
9+
<exclude-pattern>*/public/assets/*</exclude-pattern>
10+
<exclude-pattern>*/public/demo_documents/*</exclude-pattern>
11+
<arg name="extensions" value="php" />
12+
<rule ref="PEAR">
13+
<exclude name="PEAR.Commenting.FunctionCallSignature.CloseBracketLine" />
14+
<exclude name="PEAR.Files.IncludingFile.UseInclude" />
15+
<exclude name="PEAR.Functions.FunctionCallSignature.ContentAfterOpenBracket" />
16+
<exclude name="PEAR.Functions.FunctionCallSignature.CloseBracketLine" />
17+
<exclude name="PEAR.Functions.FunctionCallSignature.Indent" />
18+
<exclude name="PEAR.NamingConventions.ValidVariableName.PrivateNoUnderscore" />
19+
<exclude name="PEAR.WhiteSpace.ObjectOperatorIndent.Incorrect" />
20+
</rule>
21+
<rule ref="PSR2">
22+
<exclude name="PSR2.Methods.FunctionCallSignature.CloseBracketLine" />
23+
<exclude name="PSR2.Methods.FunctionCallSignature.ContentAfterOpenBracket" />
24+
<exclude name="PSR2.Methods.FunctionCallSignature.Indent" />
25+
</rule>
26+
<rule ref="PSR2.Namespaces.NamespaceDeclaration.BlankLineAfter" />
27+
<rule ref="Generic.Files.LineLength">
28+
<properties>
29+
<property name="lineLimit" value="90"/>
30+
<property name="absoluteLineLimit" value="130"/>
31+
</properties>
32+
</rule>
33+
<rule ref="Generic.Commenting.DocComment.MissingShort">
34+
<severity>0</severity>
35+
</rule>
36+
<rule ref="Generic.Commenting.DocComment.TagValueIndent">
37+
<severity>0</severity>
38+
</rule>
39+
<rule ref="Generic.Commenting.DocComment.ContentAfterOpen">
40+
<severity>0</severity>
41+
</rule>
42+
<rule ref="Generic.Commenting.DocComment.ContentBeforeClose">
43+
<severity>0</severity>
44+
</rule>
45+
<rule ref="Generic.Arrays.DisallowLongArraySyntax" />
46+
</ruleset>

public/assets/css.css

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -144,4 +144,8 @@ pre.json-display {
144144
.your-class div{
145145
float:left;
146146
margin-left: 10px;
147+
}
148+
149+
.chooseApiTypeStyle {
150+
padding-left: 0;
147151
}

src/Controllers/AdminApiBaseController.php

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,8 @@ public function controller(
3232
{
3333
$method = $_SERVER['REQUEST_METHOD'];
3434

35+
$this->codeExampleText = $this->getPageText(static::EG);
36+
3537
if (!$this->routerService) {
3638
$this->routerService = new RouterService();
3739
}
@@ -67,7 +69,8 @@ private function getController(
6769
if ($this->isHomePage(static::EG)) {
6870
$GLOBALS['twig']->display(static::EG . '.html', [
6971
'title' => $this->homePageTitle(static::EG),
70-
'show_doc' => false
72+
'show_doc' => false,
73+
'common_texts' => $this->getCommonText()
7174
]);
7275
}
7376
else
@@ -83,6 +86,8 @@ private function getController(
8386
'permission_profiles' => $permission_profiles,
8487
'export_id' => isset($_SESSION['export_id']),
8588
'import_id' => isset($_SESSION['import_id']),
89+
'code_example_text' => $this->codeExampleText,
90+
'common_texts' => $this->getCommonText()
8691
]);
8792
}
8893
else {

src/Controllers/BaseController.php

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,14 @@
22

33
namespace Example\Controllers;
44

5+
use Example\Services\ManifestService;
6+
57
abstract class BaseController
68
{
79

810
protected const DEMO_DOCS_PATH = __DIR__ . '/../../public/demo_documents/';
11+
12+
protected array $codeExampleText;
913

1014
/**
1115
* Save the current operation so it will be resumed after authentication
@@ -39,6 +43,16 @@ protected function isHomePage(string $eg): bool
3943
return in_array($eg, ["home_esig", "home_rooms", "home_click", "home_monitor", "home_admin"]);
4044
}
4145

46+
protected function getPageText(string $eg): array
47+
{
48+
return ManifestService::getPageText($eg);
49+
}
50+
51+
protected function getCommonText(): array
52+
{
53+
return ManifestService::getCommonTexts();
54+
}
55+
4256
protected function homePageTitle($eg=''): string
4357
{
4458
$title = '';

src/Controllers/ClickApiBaseController.php

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,8 @@ abstract function getTemplateArgs(): array;
2929
*/
3030
public function controller(array $args = null): void
3131
{
32+
$this->codeExampleText = $this->getPageText(static::EG);
33+
3234
$method = $_SERVER['REQUEST_METHOD'];
3335
if ($method == 'GET') {
3436
$this->getController($this->routerService, basename(static::FILE), $args);
@@ -57,19 +59,21 @@ private function getController(
5759
static::EG . '.html',
5860
[
5961
'title' => $this->homePageTitle(static::EG),
60-
'show_doc' => false
62+
'show_doc' => false,
63+
'common_texts' => $this->getCommonText()
6164
]
6265
);
6366
} else {
64-
if ($routerService->ds_token_ok()) {
65-
67+
if ($routerService->ds_token_ok()) {
6668
$GLOBALS['twig']->display($routerService->getTemplate(static::EG), [
6769
'title' => $routerService->getTitle(static::EG),
6870
'source_file' => $basename,
6971
'source_url' => $GLOBALS['DS_CONFIG']['github_example_url'] . "/Click/" . $basename,
7072
'documentation' => $GLOBALS['DS_CONFIG']['documentation'] . static::EG,
7173
'show_doc' => $GLOBALS['DS_CONFIG']['documentation'],
7274
'args' => $args,
75+
'code_example_text' => $this->codeExampleText,
76+
'common_texts' => $this->getCommonText()
7377
]);
7478
}
7579
else {

src/Controllers/Examples/Admin/EG002CreateActiveCLMESignUser.php

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,11 @@ public function __construct()
4747
$dsgReq = $this->clientService->adminGroupsApi();
4848
$dsgRes = $dsgReq->getDSGroups($this->orgId, $this->args["account_id"]);
4949
$dsGroups = $dsgRes["ds_groups"];
50+
if ($dsgRes["ds_groups"] == null) {
51+
throw new ApiException(
52+
$this->codeExampleText["CustomErrorTexts"][0]["ErrorMessage"]
53+
);
54+
}
5055
// Step 4 end
5156

5257
$preFill = [
@@ -88,10 +93,8 @@ public function createController(): void
8893
$_SESSION['email_address'] = strval($addUsersResponse->getEmail());
8994

9095
$addUsersResponse = json_decode((string)$addUsersResponse, true);
91-
$this->clientService->showDoneTemplate(
92-
"Create a new active user for CLM and eSignature",
93-
"Create a new active user for CLM and eSignature",
94-
"Results from MultiProductUserManagement:addOrUpdateUser method:",
96+
$this->clientService->showDoneTemplateFromManifest(
97+
$this->codeExampleText,
9598
json_encode(json_encode($addUsersResponse))
9699
);
97100
}

0 commit comments

Comments
 (0)