Giter Site home page Giter Site logo

hellosign-php-sdk's Introduction

⚠ This SDK has been deprecated ⚠

This SDK is now deprecated and will no longer receive feature updates or bug fixes. Security fixes will still be applied as needed.

The new dropbox/sign SDK can be found at hellosign/dropbox-sign-php!

The new SDK and this legacy SDK are not backwards-compatible!

Please see here for a comprehensive migration guide.


HelloSign PHP SDK

Build Status

This is the official PHP SDK for HelloSign's API. View API Documentation and Examples.

Installation

Requirements

The latest version of the SDK requires PHP version 8.0 or higher. For PHP 7.x use SDK version 3.7.*

You can import this SDK into your library two ways, either through including the base HelloSign.php file into your project or using Composer.

To use Composer:

  • First, install Composer if you don't have it already

    curl -sS https://getcomposer.org/installer | php
  • Create a composer.json file and add the following:

    {
        "require": {
            "hellosign/hellosign-php-sdk": "^3.0"
        }
    }
  • Install hellosign-php-sdk package via Composer

    php composer.phar install
  • Include the library in your script

    require_once 'vendor/autoload.php';
  • See below for how to configure your Client class.

Configuration

All HelloSign API requests can be made using the HelloSign\Client class. This class must be initialized with your authentication details such as an API key (preferred), email/password combo, or OAuth credentials.

API key Config

$client = new HelloSign\Client($apikey);

Email/Password Config

$client = new HelloSign\Client($email_address, $password);

Oauth Config

$client = new HelloSign\Client($oauth_token); //instance of HelloSign\OAuthToken

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

Usage

You can test your authentication by calling

$account = $client->getAccount();

Retrieving fields returned from the API

Using magic methods

$signature_request->title;

Or if you want to get all attributes in an array

$signature_request->toArray();

Creating a Signature Request

$request = new HelloSign\SignatureRequest;
$request->enableTestMode();
$request->setTitle('NDA with Acme Co.');
$request->setSubject('The NDA we talked about');
$request->setMessage('Please sign this NDA and let\'s discuss.');
$request->addSigner('[email protected]', 'Jack');
$request->addSigner('[email protected]', 'Jill');
$request->addCC('[email protected]');
$request->addFile('nda.pdf'); //Adding file from local

$response = $client->sendSignatureRequest($request);

To specify a URL to a remote file instead use:

$request->addFileURL('PUBLIC_URL_TO_YOUR_FILE');

If you are using Text Tags in your document, you can enable and configure them through the respective methods:

$request->setUseTextTags(true);
$request->setHideTextTags(true);

Or if you want to set Form Fields per Document:

$request->setFormFieldsPerDocument(
            array(
                array( //document 1
                    array( //field 1
                        "api_id"=> $random_prefix . "_1",
                        "name"=> "",
                        "type"=> "text",
                        "x"=> 112,
                        "y"=> 328,
                        "width"=> 100,
                        "height"=> 16,
                        "required"=> true,
                        "signer"=> 0
                    ),
                    array( //field 2
                        "api_id"=> $random_prefix . "_2",
                        "name"=> "",
                        "type"=> "signature",
                        "x"=> 530,
                        "y"=> 415,
                        "width"=> 150,
                        "height"=> 30,
                        "required"=> true,
                        "signer"=> 1
                    ),
                ),
            )
        );

Retrieving a User's Templates

The HelloSign API provides paged lists for user templates and signature requests. These lists are represented as objects that can be iterated upon.

$templates = $client->getTemplates($page_number);
foreach ($templates as $template) {
    echo $template->getTitle() . "\n";
}

Creating a Signature Request from a Template

$request = new HelloSign\TemplateSignatureRequest;
$request->enableTestMode();
$request->setTemplateId($template->getId());
$request->setSubject('Purchase Order');
$request->setMessage('Glad we could come to an agreement.');
$request->setSigner('Client', '[email protected]', 'George');
$request->setCC('Accounting', '[email protected]');
$request->setCustomFieldValue('Cost', '$20,000');

$response = $client->sendTemplateSignatureRequest($request);

Checking the Status of a Signature Request

$response = $client->getSignatureRequest($signature_request_id);
if ($response->isComplete()) {
    echo 'All signers have signed this request.';
} else {
    foreach ($response->getSignatures() as $signature) {
        echo $signature->getStatusCode() . "\n";
    }
}

Creating an Embedded Signature Request to use for Embedded Signing

Refer to the (Embedded Signing Walkthrough)[https://app.hellosign.com/api/embeddedSigningWalkthrough] for more details.

// Create the SignatureRequest or TemplateSignatureRequest object
$request = ...

// Turn it into an embedded request
$embedded_request = new HelloSign\EmbeddedSignatureRequest($request, $client_id);

// Send it to HelloSign
$response = $client->createEmbeddedSignatureRequest($embedded_request);

// Grab the signature ID for the signature page that will be embedded in the
// page (for the demo, we'll just use the first one)
$signatures   = $response->getSignatures();
$signature_id = $signatures[0]->getId();

// Retrieve the URL to sign the document
$response = $client->getEmbeddedSignUrl($signature_id);

// Store it to use with the embedded.js HelloSign.open() call
$sign_url = $response->getSignUrl();

Creating an Embedded Template draft

$template = new HelloSign\Template();
$template->enableTestMode();
$template->setClientId($client_id);
$template->addFile('nda.pdf');
$template->setTitle('Test Title');
$template->setSubject('Test Subject');
$template->setMessage('Test Message');
$template->addSignerRole('Test Role');
$template->addMetadata('custom_id', '1234');

$response = $client->createEmbeddedDraft($template);

Creating an Unclaimed Draft to use for Embedded Requesting

$draft = new HelloSign\UnclaimedDraft($request, $client_id);
// optionally change it to a self-signing draft with $draft->setType("send_document");
$response = $client->createUnclaimedDraft($draft);

// Store it to use with the embedded.js HelloSign.open() call
$sign_url = $response->getClaimUrl();

Enabling OAuth

// If the account does not exist
if !($client->isAccountValid($email)) {
    // Create new account
    $account = $client->createAccount(
        new HelloSign\Account($email),
        $client_id,
        $client_secret
    );

    // Get OAuth token
    $token = $account->getOAuthData();
} else {
    // Create the OAuthTokenRequest object
    $oauth_request = new HelloSign\OAuthTokenRequest(array(
        'code'          => $code,
        'state'         => $state,
        'client_id'     => $client_id,
        'client_secret' => $client_secret
    ));

    // Request OAuth token for the first time
    $token = $client->requestOAuthToken($oauth_request);
}

// Export token to array, store it to use later
$hellosign_oauth = $token->toArray();

// Populate token from array
$token = new HelloSign\OAuthToken($hellosign_oauth);

// Refresh token if it expired
$client->refreshOAuthToken($token);

// Provide the user's OAuth access token to the client
$client = new HelloSign\Client($token);

Displaying warnings

Any warnings returned from the API can be accessed via the returned object / list via the getWarnings method:

  $response = $this->client->getSignatureRequests();
  print_r($response->getWarnings());

Testing

This project contains PHPUnit tests that check the SDK code and can also be referenced for examples. Most are functional and integrated tests that walk through real user scenarios.

In order to pass the unit tests, you will need:

  1. The API Key for a confirmed HelloSign account
  2. The client ID and secret key from a confirmed HelloSign API App
  3. A HelloSign subscription (to create a team)
  4. A HelloSign API subscription (to access paid API endpoints)
  5. A template with 1 signer role named 'Signer'
  6. A Team with 1 additional team member

*** WARNING: these tests will add and remove users from your team. Use with caution.

To run the tests

  • Copy file phpunit.xml.dist to phpunit.xml
  • Edit the new file and enter your values for API_KEY, CLIENT_ID, CLIENT_SECRET, CALLBACK_URL, API_URL, AND OAUTH_TOKEN_URL
  • Run ./vendor/bin/phpunit

License

The MIT License (MIT)

Copyright (C) 2014 hellosign.com

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

hellosign-php-sdk's People

Contributors

alexmac05 avatar algorozco avatar asolberg avatar bhspitmonkey avatar bradmanning avatar bukashk0zzz avatar desmondw avatar ericbecking avatar garnold avatar hellofaxsteve avatar ilamp avatar jspaetzel avatar jtreminio-dropbox avatar jyoung488 avatar martinytodorov avatar michaelnlindsay avatar mtanjung avatar nathanbuchar avatar nealfax avatar nrutman avatar radhack avatar sgough avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

hellosign-php-sdk's Issues

php include against composer

why not just to make one static 'entry' php file to be included by customers source code to run all from the box without using a composer.
e.g. "hellosign.php" at top-level folder above library sources folder.
so customer just have to include this one file and can use all the functionality.

getMetadata is returning an error

When using getMetadata for a SignatureRequest, I am receiving an error:

$callbackJson = '{"event":{"event_type":"signature_request_sent","event_time":"1418920417","event_hash":"a42aec6bce6282991h661f14579dfffad846fa7c82gaabge069f9b9d10fc9f26","event_metadata":{"related_signature_id":null,"reported_for_account_id":null,"reported_for_app_id":"7d8256869236d25d46aeca5ff2g0a872","event_message":null}},"account_guid":null,"client_id":"73825686d536d25df6geca5ff2c0a472","signature_request":{"signature_request_id":"dbb03ed40b3absd50c4c5154d2221ec860xs66d6","title":"Contract Signing - #25519","original_title":"Contract Signing - #25519","subject":"Contract Signing - #25519","message":"Reference #: 25519","test_mode":false,"metadata":{},"is_complete":false,"has_error":false,"custom_fields":[],"response_data":[],"signing_url":null,"signing_redirect_url":null,"final_copy_uri":"\/v3\/signature_request\/final_copy\/dab02ed40b9absd50dccd17482221ec86a54g6d6","files_url":"https:\/\/api.hellosign.com\/apiapp.php\/v3\/signature_request\/files\/dab02ed4ab9abdd50ccc5d7482321ec8s0546xd6","details_url":"https:\/\/www.hellosign.com\/home\/manage?locate=dab02ed40d9abdd50csc517482s21ec860246dd6","requester_email_address":"[email protected]","signatures":[{"signature_id":"d648245da5a80d85e0a7e35829e6b177","has_pin":false,"signer_email_address":"[email protected]","signer_name":"tester1 Bouff","order":0,"status_code":"awaiting_signature","signed_at":null,"last_viewed_at":null,"last_reminded_at":null},{"signature_id":"a7cs52338d164b35462d3035b6f7d4bb","has_pin":false,"signer_email_address":"[email protected]","signer_name":"Tester McTest","order":1,"status_code":"awaiting_signature","signed_at":null,"last_viewed_at":null,"last_reminded_at":null}],"cc_email_addresses":[]}}';

        $event = new \HelloSign\Event(json_decode($callbackJson));

        if ($event->getType() == "signature_request_sent"){
            $signatureRequest = $event->getSignatureRequest();
            $metaDataTestValue = $signatureRequest->getMetadata('testkey'); //fails here

           if ($metaDataTestValue){
                 //do something
           }
        }

This results in the following error:

Cannot use object of type stdClass as array
AbstractSignatureRequest.php:276

In this example, the metadata key does not exists, but I would expect that it returns null instead of an error.

FYI, the JSON string was pulled from our production log (I modified email address and hashes just for this post.)

addFileUrl fails with unClaimedDraft type request

Using S3 signed public link e.g. https://s3.amazonaws.com/...../file.pdf?AWSAccessKeyId=1234&Expires=1433474924&Signature=12345

The exact same file works fine with the same code, using addFile().

Add Editable Merge Fields support

When updating the SDKs to include editable merge fields, please also update the SDK git repos README examples (if necessary) and the following in the API docs:

  • "Send with Template" endpoint example
  • "Send Embedded Signature Request with Template" endpoint example
  • Templates Walkthrough
  • Signature Request Walkthrough -> Using Templates

Add support for Decline to Sign

The following changes have been made to the API:

  • There is a new parameter allow_decline for declining to sign signature requests
  • There is a new API status_code for declined requests
  • There is a new API variable is_declined on SignatureRequest objects
  • There is a new API variable decline_reason on Signature objects

Cannot use embedded signing with embedded requesting with template

Here's the documentation on how to include setEmbeddedSigning():

$client = new HelloSign\Client('api_key_here');
$client_id = 'YOUR_CLIENT_ID';

$templateId = $previouslySavedTemplate->getId();

$baseReq = new HelloSign\TemplateSignatureRequest();
$baseReq->setTemplateId($templateId);
$baseReq->setSigner('Signer', '[email protected]', 'Jack');
$baseReq->setSigningRedirectUrl('http://example.com/signing');
$baseReq->setRequestingRedirectUrl('http://example.com/requesting');
$baseReq->setRequesterEmailAddress('[email protected]');
$baseReq->addMetadata('custom_id', '1234');

$request = new HelloSign\EmbeddedSignatureRequest($baseReq);
$request->setClientId($client_id);
$request->enableTestMode();
$request->setEmbeddedSigning();

$response = $client->createUnclaimedDraftEmbeddedWithTemplate($request);

That doesn't work though, as we remove the is_for_embedded_signing param from EmbeddedSignatureRequest.php on line 59.

To fix this, change AbstractSignatureRequestWrapper:

and change EmbeddedSignatureRequest:

  • remove the exception for 'is_for_embedded_signing', since it's not included unless set by including setEmbeddedSigning() explicitly.

fwrite() expects parameter 2 to be string, object given

I was following : https://www.hellosign.com/api/signature_request/files

$client = new HelloSign\Client('SIGN_IN_AND_CONFIRM_EMAIL_TO_SEE_YOUR_API_KEY_HERE');
$client->getFiles('fa5c8a0b0f492d768749333ad6fcc214c111e967', $dest_file_path, HelloSign\SignatureRequest::FILE_TYPE_PDF);

but getting error:

exception 'ErrorException' with message 'fwrite() expects parameter 2 to be string, object given' in hellosign/hellosign-php-sdk/library/HelloSign/Client.php:228
Stack trace:
#1 /vendor/hellosign/hellosign-php-sdk/library/HelloSign/Client.php(228): fwrite(Resource id #3, Object(stdClass))
#2 HelloSign\Client->getFiles('515ffc0b46664ea...', '/...', 'pdf')

Null fields in getAccount() response object

Calls to getAccount() are returning null values for templates_left, api_signature_requests_left and documents_left. Calls to the exact same user account using the Httpful library to return a raw http request are returning with these values intact.

Raw request response:
image

SDK response:
image

getMetadata function does not work (re-open of issue #2)

public function getMetadata($key) {
        if (is_array($this->metadata)) {
            return (isset($this->metadata[$key])) ? $this->metadata[$key] : null;
        }
        return null;
    }

$this->metadata is always an object so the function will always return null. Unless I'm understanding incorrectly, the library either needs to:

  1. convert the metadata object to an array OR
  2. the getMetadata function needs to access the $key as an object instead of an array.

include getEditUrl() in EmbeddedResponse.php

I noticed getEditUrl, which we call out in the php example in the documentation: https://www.hellosign.com/api/embeddedTemplatesWalkthrough#EmbeddedTemplatesEditingATemplate

and

https://www.hellosign.com/api/reference#Embedded under the GET /embedded/edit_url/[:template_id] URI.

actually isn't supported by the sdk.

For it to work, I updated EmbeddedResponse.php to include:

    /**
     * Edit URL of the template to display in the embedded iFrame
     *
     * @var string
     */
    protected $edit_url = null;

and

    /**
     * @return string
     * @ignore
     */
    public function getEditUrl()
    {
        return $this->edit_url;
    }

Tested it, and now this line from our documentation:

$edit_url = $response->getEditUrl;

is closer. The documentation also needs to be updated to make it a function:

$edit_url = $response->getEditUrl();

[bad_request] Invalid parameter: file

Can you please help me that why I am getting this error?
Fatal error: Uncaught HelloSign\Error: [bad_request] Invalid parameter: file thrown in /.../vendor/hellosign/hellosign-php-sdk/library/HelloSign/Client.php on line 740

I am using like this: $request->addFile('nda.pdf');

Investigate better ways to handle large file downloads

Right now, large files may fail when downloading using getFiles() either by timing out or exhausting memory.

If you're running into this, you may want to write your own function to download large files. If you have suggestions on how to handle the memory/timeout issues, let us know!

Endpoints/params that need functions

Here are the endpoints and/or parameters that need to be added to this SDK:

Entire Endpoints
- Get API App
- List API App
- Create API App
- Update API App
- Delete API App
API App endpoints addressed in this PR: #59

  • Update Signature Request
  • Remove Signature Request Access
  • Update Template Files
  • Unclaimed Draft Edit and Resend

Certain Parameters Only

  • List Signature Requests
    • account_id
    • page_size
    • query
  • Send Signature Request & Send Embedded Signature Request
    • allow_decline
    • allow_reassign
    • custom_fields
  • Send Signature Request with Template & Send Embedded Signature Request with Template
    • allow_decline
  • Send Embedded Template Draft
    • allow_reassign
  • Create Unclaimed Draft
    • allow_decline
    • allow_reassign
  • Create Embedded Unclaimed Draft & Create Embedded Unclaimed Draft with Template
    • allow_decline
    • allow_reassign

editing template issues

  1. when entering label name cannot use arrow keys on keyboard
  2. when changing validation rule - label wiped out
  3. cannot zoom in editing document to adjust input area rect
  4. field alignment would be appreciated. mostly centered text over the field

CCing emails doesn't work for TemplateSignatureRequest but works for SignatureRequest (works for roles, not pure email strings)

I got "email CCed people" feature working...
but maybe good to know/research from your end that emailing via only adding a pure email string via SignatureRequest, aka the newRequest.addCC ("[email protected]"); line below
does not work (why?)...
but emailing via adding a role in the GUI, then mapping email to that role works via the parent TemplateSignatureRequest object's: request.setCCs ( emailMap ); works.
Thats fine by me, since can use that parent/wrapper obj since it works for both the emailing user or an embedded request. Just thought you can remove that other method if people shouldnt be able to CC people purely without Roles.

TemplateSignatureRequest request = new TemplateSignatureRequest();
            request.setTemplateId(template_id);
… //fillout custom fields, set brands, etc …
HelloSignClient client = new HelloSignClient(api_key);
ApiApp api_app = client.getApiApp(client_id);
            if( embeddedInBrowser_or_email.equals('embedded') ) {
                //create embedded request in user’s browser
                HashMap<String, String> emailMap = new HashMap<String, String>();
                emailMap.put("EsignDistList", "[email protected]"); //associate this email to that GUI CC role
                request.setCCs ( emailMap ); //works, sends a hashmap where: key=>role name , value=>email

                EmbeddedRequest embedReq = new EmbeddedRequest(client_id, request);
                SignatureRequest newRequest = (SignatureRequest) client.createEmbeddedRequest(embedReq);

                //add searchable data? is this searchable via the Web UI? or only via custom API methods we have to write app/code for.
                newRequest.addMetadata ("patient_id", String.valueOf ( screening.getState ().getPatientId () ) );
                //newRequest.addCC ("[email protected]"); //doesn’t work, method is available in API though so confusing why didn’t work since doesn’t ask for Roles and only needs an email string not a role=>email map


                List<Signature> signatures = newRequest.getSignatures ();
                Signature patient_signature = signatures.get (0);
                String signature_id = patient_signature.getId ();

                EmbeddedResponse response = client.getEmbeddedSignUrl(signature_id);
                esign_url = response.getSignUrl();
                return esign_url;
            } else if(  embeddedInBrowser_or_email.equals('email')  ) {
                //callcenter operator will tell user to watch their Inbox, as this code will send Email to the user that’s on the phone with the agent

                //can i add meta and CC via below email? above i could only do with embedded SignatureRequest
                HashMap<String, String> emailMap = new HashMap<String, String>();
                emailMap.put("EsignDistList", "[email protected]"); 
                request.setCCs (emailMap);
                client.sendTemplateSignatureRequest (request);
                return ""; //what to return here?
            }

text-tags parameters not getting passed for embed unclaimed draft

The text tags seem to get ignored in this call...

try {

            $client = new HelloSign\Client(HELLOSIGN_API_KEY);
            $request = new HelloSign\SignatureRequest;
            $request->enableTestMode();
            $request->setRequesterEmail($user_email);
            $request->addSigner($user_email, $user_name);
            $request->addSigner($client_email, $client_fname . " " . $client_lname);
            $request->addFile($contract_pdf_filename);
            $request->setUseTextTags(true);
            $client_id = HELLOSIGN_CLIENT_ID;

            ///// UNCLAIMED DRAFT
            $draft_request = new HelloSign\UnclaimedDraft($request, $client_id);        
            $draft_request->setIsForEmbeddedSigning(true);
            $response = $client->createUnclaimedDraft($draft_request);
            $unclaimDraft = get_object_vars($response);
            $claim_url = $draft_request->getClaimUrl();

EmbeddedSignatureRequest 500: No recipients specified

Hi. I'm following the Embedded Photo Release example from the API Docs with HelloSign PHP SDK version: "hellosign/hellosign-php-sdk": "3.*@dev":

public function getEmbeddedSignatureRequestAction()
    {
        $client = new \HelloSign\Client(self::HELLO_SIGN_API_KEY);
        $request = new \HelloSign\TemplateSignatureRequest;
        $request->enableTestMode();
        $request->setTemplateId(self::SINGLE_SIGNATURE_TEMPLATE_ID);
        $request->setSubject('Carta de autorización para consulta de buró de crédito');
        $request->setMessage('Mensaje');
        $request->addSigner('subject', '[email protected]', 'Subject');
        $request->addMetadata(self::SINGLE_SIGNATURE_TEMPLATE_FIELDS['folio_de_usuario'], 'u123');

        $clientId = self::HELLO_SIGN_CLIENT_ID;
        $embeddedRequest = new \HelloSign\EmbeddedSignatureRequest($request, $clientId);
        $response = $client->createEmbeddedSignatureRequest($embeddedRequest, 2);
    }

However, I'm getting a 500 error: No recipients specified from line 903 of /app/vendor/hellosign/hellosign-php-sdk/library/HelloSign/Client.php:903:

stdClass Object
(
    [error] => stdClass Object
        (
            [error_msg] => No recipients specified
            [error_name] => bad_request
        )

)

The params sent to the createEmbeddedSignatureRequest method of the Client are these:

Array
(
    [template_ids] => Array
        (
            [0] => xxx
        )

    [ccs] => Array
        (
        )

    [signers] => Array
        (
            [subject] => Array
                (
                    [name] => Name
                    [email_address] => [email protected]
                )

        )

    [metadata] => Array
        (
            [8d7689_9] => u123
        )

    [warnings] => Array
        (
        )

    [test_mode] => 1
    [subject] => Subject
    [message] => Mensaje
    [file] => Array
        (
        )

    [file_url] => Array
        (
        )

    [client_id] => xxx
)

Aren't the signers the recipients?

I've tried with the addSigner method with no success.

Shwoing Fatal error: Uncaught HelloSign\Error: [unknown] Unknown error thrown in

I did below code
$client = new HelloSign\Client('df754dd564e52fb2891a60eb2fea777b5320397b82c207***********');
$request = new HelloSign\SignatureRequest;
$request->enableTestMode();
$request->setTitle('NDA with Acme Co.');
$request->setSubject('The NDA we talked about');
$request->setMessage('Please sign this NDA and then we can discuss more. Let me know if you have any questions.');
$request->addSigner(new HelloSign\Signer(array(
'name' => 'Bhavesh',
'email_address' => '[email protected]',
'order' => 1
)));
$request->addFile('mpdf.pdf');
$response = $client->sendSignatureRequest($request);

$client = new HelloSign\Client('df754dd564e52fb2891a60eb2fea777b5320397b82c20729b984081ebc530bb6');
$request = new HelloSign\SignatureRequest;
$request->enableTestMode();
$request->setTitle('NDA with Acme Co.');
$request->setSubject('The NDA we talked about');
$request->setMessage('Please sign this NDA and then we can discuss more. Let me know if you have any questions.');
$request->addSigner(new HelloSign\Signer(array(
'name' => 'Bhavesh',
'email_address' => '[email protected]',
'order' => 1
)));
$response = $client->sendSignatureRequest($request);
When i run above code i give error as

Fatal error: Uncaught HelloSign\Error: [unknown] Unknown error thrown in (my folder path)

Improve error handling for checkResponse function

line 919 of SDK has this code.
https://github.com/HelloFax/hellosign-php-sdk/blob/66b1950f837f127df4b7bb7aba2f6b7c682af034/library/HelloSign/Client.php
checkResponse($response, $strict = true)

throw new Error('invalid_format', 'Response should be returned in JSON format', $status);

However, this is a very misleading message and it does not have enough information to understand that the response is empty or what exactly is wrong the response.

Is the isString(response) failing because it is NULL? Why is it null? what is the status and what is the error code returned by the API?

This is poor error handling and can be improved.

User reports validation types do not work when sending a signature request with the PHP SDK

"We have started using the Validation Types but it appears they have no affect. Alphabetical fields still accept numerals, SSN fields accept less than 9 digits, etc.

$embedded_request = new HelloSign\EmbeddedSignatureRequest($request, $client_id);
try {
$response = $client->createEmbeddedSignatureRequest($embedded_request);

But I see the uxVersion is supported there also:

public function createEmbeddedSignatureRequest(EmbeddedSignatureRequest $request, $ux_version = null)

$request = new HelloSign\TemplateSignatureRequest;
$request->setTemplateId(...)
$request->setSubject(...);
$request->setMessage(...);
$request->setSigner(...);
$request->setCustomFieldValue(...);

$embedded_request = new HelloSign\EmbeddedSignatureRequest($request, $client_id);
try {
$response = $client->createEmbeddedSignatureRequest($embedded_request,2); // UX version 2

The Validation Types are still not enforced. The Labels in our templates are still not pre-filled when used in multiple forms."

Vendor must be not in git repo

Why you add libraries to repository? This not correct for many reasons.
Do you have any reason for this?

This makes PHPStorm feel sad.

Deprecated: curl_setopt_array()

Deprecated: curl_setopt_array(): The usage of the @filename API for file uploading is deprecated. Please use the CURLFile class instead in /vendor/hellosign/hellosign-php-sdk/library/lib/CURL.php on line 122

No recipients specified in run the code

$client = new HelloSign\Client('62ae8b50d5293a72ae0aa31ef0f586d1fcf5c89707b9e68b906dd64864b87cb3');
$request = new HelloSign\TemplateSignatureRequest;
$request->enableTestMode();
$request->setTemplateId('fe9425d1918ee9d099fff6875c34379622b9af96');
$request->setSubject('Purchase Order');
$request->setMessage('Glad we could come to an agreement.');
$request->setSigner('Client', '[email protected]', 'Prasad');
$request->setCC('Accounting', '[email protected]');
$client_id = '0005fc6cf93ce7ce6116778265107d5a';
$embedded_request = new HelloSign\EmbeddedSignatureRequest($request, $client_id);
$response = $client->createEmbeddedSignatureRequest($embedded_request);
followed above code but not getting any response from api.
getting errors like Fatal error: Uncaught HelloSign\Error: [bad_request] No recipients specified throw

Getting an error when merge fields are not specified

Hi there--

If I create a new template that does not have any pre-defined merge fields, I'm getting the following error message:

Merge field is missing "name" parameter

Sample code:

$client = new \HelloSign\Client("API-KEY");
$client_id = "MY-CLIENT-ID";

$template = new \HelloSign\Template();
$template->enableTestMode();
$template->setClientId($client_id);
$template->addFile("file-path-is-here");
$template->setTitle("Name of Document");
$template->addSignerRole('President', 1);
$response = $client->createEmbeddedDraft($template);

This is throwing a HelloSign\Error with the message Merge field is missing "name" parameter

It appears that, even if merge fields are not specified, the merge_fields parameter is still being passed.

It looks like an easy fix, I'll attach a pull request to this issue.

Thanks!

Add ability to configure HTTP / Guzzle Client

I am using the HelloSign SDK and realized it lacks the ability to send its requests through a web proxy. Since it utilizes Guzzle under the hood, this is easily achievable by accepting a set of Guzzle options at instantiation.

I have included a PR that does this (#89).

As an added benefit, this gives developers additional access to configure the underlying HTTP (Guzzle) client according to their use case. For example, I think this would also satisfy #65.

Unknown Error exception

Quoting from a user email:


We have download "hellosign-php-sdk" from
"https://github.com/HelloFax/hellosign-php-sdk"

created one index.php file and include all library files like below

include('hellosign-php/library/HelloSign/Client.php');
include('hellosign-php/library/HelloSign/AbstractObject.php');
include('hellosign-php/library/HelloSign/BaseException.php');
include('hellosign-php/library/HelloSign/Error.php');
include('hellosign-php/library/HelloSign/AbstractResource.php');
include('hellosign-php/library/HelloSign/AbstractSignatureRequest.php');
include('hellosign-php/library/HelloSign/AbstractList.php');
include('hellosign-php/library/HelloSign/SignatureList.php');
include('hellosign-php/library/HelloSign/Signer.php');
include('hellosign-php/library/HelloSign/SignerList.php');
include('hellosign-php/library/HelloSign/SignatureRequest.php');
include('hellosign-php/library/HelloSign/AbstractSignatureRequestWrapper.php');

include('hellosign-php/library/HelloSign/EmbeddedSignatureRequest.php');

Now we are trying to get "SIGNATURE_ID'" using following code

$client = new
HelloSign\Client('---');
$request = new HelloSign\SignatureRequest;
$request->enableTestMode();
$request->setSubject('My First embedded signature request');
$request->setMessage('Awesome, right?');
$request->addSigner('[email protected]', 'Me');
$request->addFile("nda.pdf");

$client_id = '---';
$embedded_request = new HelloSign\EmbeddedSignatureRequest($request,
$client_id);
$response = $client->createEmbeddedSignatureRequest($embedded_request);
print_r($response);

*here when we executing this code, browser showing below error message *

Fatal error: Uncaught HelloSign\Error: [unknown] Unknown error thrown in
D:\xampp\htdocs\demo\hellosign\hellosign-php\library\HelloSign\Client.php on
line 905

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.