Skip to content
This repository was archived by the owner on Oct 17, 2023. It is now read-only.

Commit 9aa29df

Browse files
authored
Merge pull request #75 from hellosign/SDK-Audit
PHP SDK Audit
2 parents 72723ec + 070b711 commit 9aa29df

33 files changed

+487
-232
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,3 +12,4 @@ phpunit_test_template_file.pdf
1212
test.php
1313
.idea
1414
*.swp
15+
vendor

CONTRIBUTING.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ We're excited you're considering contributing to our project! Your patches are e
66

77
* Make sure you have a [GitHub account](https://github.com/signup/free)
88
* Make sure you have a [HelloSign account](http://www.hellosign.com)
9-
* Submit a new [issue ticket](https://github.com/HelloFax/hellosign-php-sdk/issues), assuming one does not already exist.
9+
* Submit a new [issue ticket](https://github.com/hellosign/hellosign-php-sdk/issues), assuming one does not already exist.
1010
* Clearly describe the issue including steps to reproduce when it is a bug.
1111
* Make sure to include the version you are using which has the issue (and confirm that the issue you are having has not been fixed in a later version)
1212
* Fork the repository on GitHub

README.md

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
## HelloSign PHP SDK
22

3-
This is the official PHP SDK for HelloSign's API. [View api documentation and examples.](https://app.hellosign.com/api/documentation)
3+
This is the official PHP SDK for HelloSign's API. [View API Documentation and Examples.](https://app.hellosign.com/api/documentation)
44

55
## Installation
66

@@ -9,17 +9,17 @@ This is the official PHP SDK for HelloSign's API. [View api documentation and e
99
The latest version of the SDK requires PHP version 5.5 or higher.
1010

1111
You can import this SDK into your library two ways, either through including the base HelloSign.php file into your
12-
project or using Composer ([https://getcomposer.org/doc/00-intro.md](https://getcomposer.org/doc/00-intro.md)).
12+
project or using [Composer](https://getcomposer.org/doc/00-intro.md).
1313

14-
To use composer:
14+
To use Composer:
1515

1616
- First, install Composer if you don't have it already
1717

1818
```shell
1919
curl -sS https://getcomposer.org/installer | php
2020
```
2121

22-
- Create `composer.json` and add the following
22+
- Create a `composer.json` file and add the following:
2323

2424
```json
2525
{
@@ -53,22 +53,19 @@ $client = new HelloSign\Client($apikey);
5353

5454
### Email/Password Config
5555

56-
5756
```php
5857
$client = new HelloSign\Client($email_address, $password);
5958
```
6059

6160
### Oauth Config
6261

63-
6462
```php
6563
$client = new HelloSign\Client($oauth_token); //instance of HelloSign\OAuthToken
6664
```
6765

6866
Your app users are almost ready to start signing!
6967
See below for the most common use cases for this wrapper.
7068

71-
7269
## Usage
7370

7471
You can test your authentication by calling
@@ -147,6 +144,7 @@ if ($response->isComplete()) {
147144
```
148145
149146
### Creating an Embedded Signature Request to use for Embedded Signing
147+
Refer to the (Embedded Signing Walkthrough)[https://app.hellosign.com/api/embeddedSigningWalkthrough] for more details.
150148
151149
```php
152150
// Create the SignatureRequest or TemplateSignatureRequest object

library/HelloSign/AbstractList.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?php
22
/**
3-
* HelloSign PHP SDK (https://github.com/HelloFax/hellosign-php-sdk/)
3+
* HelloSign PHP SDK (https://github.com/hellosign/hellosign-php-sdk/)
44
*/
55

66
/**

library/HelloSign/AbstractObject.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?php
22
/**
3-
* HelloSign PHP SDK (https://github.com/HelloFax/hellosign-php-sdk/)
3+
* HelloSign PHP SDK (https://github.com/hellosign/hellosign-php-sdk/)
44
*/
55

66
/**

library/HelloSign/AbstractResource.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?php
22
/**
3-
* HelloSign PHP SDK (https://github.com/HelloFax/hellosign-php-sdk/)
3+
* HelloSign PHP SDK (https://github.com/hellosign/hellosign-php-sdk/)
44
*/
55

66
/**
@@ -56,7 +56,7 @@ abstract class AbstractResource extends AbstractObject
5656
* @var boolean
5757
*/
5858
protected $test_mode = false;
59-
59+
6060
/**
6161
* Whether the sender will allow the signer to decline to sign
6262
*
@@ -141,7 +141,7 @@ public function disableTestMode()
141141
$this->test_mode = false;
142142
return $this;
143143
}
144-
144+
145145
/**
146146
* @return SignatureRequest
147147
* @ignore

library/HelloSign/AbstractResourceList.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?php
22
/**
3-
* HelloSign PHP SDK (https://github.com/HelloFax/hellosign-php-sdk/)
3+
* HelloSign PHP SDK (https://github.com/hellosign/hellosign-php-sdk/)
44
*/
55

66
/**

library/HelloSign/AbstractSignatureRequest.php

Lines changed: 34 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?php
22
/**
3-
* HelloSign PHP SDK (https://github.com/HelloFax/hellosign-php-sdk/)
3+
* HelloSign PHP SDK (https://github.com/hellosign/hellosign-php-sdk/)
44
*/
55

66
/**
@@ -85,6 +85,13 @@ abstract class AbstractSignatureRequest extends AbstractResource
8585
*/
8686
protected $client_id = null;
8787

88+
/**
89+
* A JSON array of Custom Field objects
90+
*
91+
* @var string
92+
*/
93+
protected $custom_fields = null;
94+
8895
/**
8996
* Constructor
9097
*
@@ -215,6 +222,32 @@ public function setHideTextTags($hide_text_tags)
215222
return $this;
216223
}
217224

225+
/**
226+
* Set the value for a custom field with the given field name
227+
* and optionally define a Role allowed to edit it and if the field is required to be filled
228+
*
229+
* @param string $field_name field name to be filled in
230+
* @param string $value
231+
* @param string $editor
232+
* @param string $required
233+
* @return AbstractSignatureRequest
234+
*/
235+
public function setCustomFieldValue($field_name, $value, $editor = null, $required = null)
236+
{
237+
$custom_fields = isset($this->custom_fields) ? json_decode($this->custom_fields) : array();
238+
239+
$custom_fields[] = array(
240+
'name' => $field_name,
241+
'value' => $value,
242+
'editor' => $editor,
243+
'required' => $required
244+
);
245+
246+
$this->custom_fields = json_encode($custom_fields);
247+
248+
return $this;
249+
}
250+
218251
/**
219252
* @param string $id
220253
* @return SignatureRequest

library/HelloSign/AbstractSignatureRequestWrapper.php

Lines changed: 23 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?php
22
/**
3-
* HelloSign PHP SDK (https://github.com/HelloFax/hellosign-php-sdk/)
3+
* HelloSign PHP SDK (https://github.com/hellosign/hellosign-php-sdk/)
44
*/
55

66
/**
@@ -36,19 +36,26 @@
3636
abstract class AbstractSignatureRequestWrapper extends AbstractResource
3737
{
3838
/**
39-
* Client id of the app
39+
* Client ID of the API App
4040
*
4141
* @var string
4242
*/
4343
protected $client_id = null;
4444

4545
/**
46-
* Related signature request
46+
* Related SignatureRequest
4747
*
4848
* @var AbstractSignatureRequest
4949
*/
5050
protected $request = null;
5151

52+
/**
53+
* Disables the "Me (Now)" option for the person preparing the SignatureRequest.
54+
*
55+
* @var boolean
56+
*/
57+
protected $skip_me_now = false;
58+
5259
/**
5360
* Constructor
5461
*
@@ -82,7 +89,7 @@ public function getClientId()
8289
}
8390

8491
/**
85-
* include only if enabling embedded signing
92+
* Include only if enabling embedded signing
8693
* when using EmbeddedSignatureRequest
8794
* with createUnclaimedDraftEmbeddedWithTemplate
8895
* @return static
@@ -123,6 +130,18 @@ public function isUsingTemplate()
123130
return $this->request instanceof TemplateSignatureRequest;
124131
}
125132

133+
/**
134+
* @param boolean $skip_me_now Set to true to disable the "Me (Now)" option
135+
* for the preparer.
136+
* @return static
137+
* @ignore
138+
*/
139+
public function enableSkipMeNow()
140+
{
141+
$this->skip_me_now = true;
142+
return $this;
143+
}
144+
126145
/**
127146
* @return array
128147
* @ignore

library/HelloSign/Account.php

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?php
22
/**
3-
* HelloSign PHP SDK (https://github.com/HelloFax/hellosign-php-sdk/)
3+
* HelloSign PHP SDK (https://github.com/hellosign/hellosign-php-sdk/)
44
*/
55

66
/**
@@ -57,31 +57,31 @@ class Account extends AbstractResource
5757
protected $email_address = null;
5858

5959
/**
60-
* The URL that HelloSign events will be POSTed to
60+
* The URL that HelloSign Account events will be POSTed to
6161
*
6262
* @var string
6363
*/
6464
protected $callback_url = null;
6565

6666
/**
67-
* If the user has a paid HelloSign license will return true
67+
* If the user has a paid HelloSign subscription, will return true
6868
*
6969
* @var boolean
7070
*/
7171
protected $is_paid_hs = false;
7272

7373
/**
74-
* If the user has a paid HelloFax license will return true
74+
* If the user has a paid HelloFax subscription, will return true
7575
*
7676
* @var boolean
7777
*/
7878
protected $is_paid_hf = false;
7979

8080
/**
81-
* An object detailing remaining monthly quotas
81+
* An object detailing remaining quotas
8282
*
8383
* templates_left: API templates remaining
84-
* api_signature_requests_left: API signature requests remaining
84+
* api_signature_requests_left: API signature requests remaining for the month
8585
*
8686
* @var stdClass
8787
*/

0 commit comments

Comments
 (0)