GithubHelp home page GithubHelp logo

gregoirehebert / docusign-bundle Goto Github PK

View Code? Open in Web Editor NEW
33.0 6.0 12.0 11.1 MB

Symfony bundle to create electronic signatures with DocuSign

Home Page: https://github.com/GregoireHebert/docusign-bundle

License: MIT License

PHP 98.59% Twig 1.41%
docusign docusign-bundle flysystem-bundle symfony-bundle electronic-signatures hacktoberfest

docusign-bundle's People

Contributors

chalasr avatar chris53897 avatar dependabot[bot] avatar gregoirehebert avatar jmarmin avatar ramonabejan avatar toofff avatar vincentchalamon avatar wenkz avatar wluijt-endertech 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

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

docusign-bundle's Issues

Revamp storage configuration key

  • storage can accept a string (for an existing service) or an array
  • Create the storage service if the configuration value is an array

Add grant_type option to switch consent uri

Depending on the grant type (Authorization Grant vs Implicit Grant), the consent.response_type must be code or token.

To allow this dynamic value, the grant_type must be declared in the configuration

V5 roadmap

To handle multiple type of signature per file handled We need mostly to change the configuration. This is the configuration we should aim for.

Single signature definition

Example with a click signature

docusign:
      mode: click # mode used to sign
      demo: %kernel.debug% # default value: false. when kernel.debug is true then the api_uri is forced to `https://demo.docusign.net/restapi`
      auth_click:
          integration_id: "YourIntegrationId"
          wrap_id: "YourWrapId" # create a wrap https://support.docusign.com/en/guides/click-user-guide
      account_id: "yourAccountId"
      default_signer_name: "Grégoire Hébert"
      default_signer_email: "[email protected]"
      api_uri: "https://www.docusign.net/restapi"

Multiple signatures definition

Example with a remote and embedded signature

docusign:
    my_remote_signature: # Name of the signature configuration
        mode: remote # Mode used to sign
        demo: %kernel.debug%  # Default value: false

        auth_jwt:
            private_key: "YourPrivateKey"
            integration_id: "YourIntegrationId"
            user_guid: "YourUserId"

        # No account_id required for remote mode

        default_signer_name: "Grégoire Hébert" # Name of the person that will be notified and will sign the document if none is sent to the url.
        default_signer_email: "[email protected]" # Mail of the person that will be notified and will sign the document if none is sent to the url.

        api_uri: "https://www.docusign.net/restapi" # Docusign api uri

        callback_route_name: "docusign_callback" # Your route where to redirect the user after signature

        # To sign you need to generate a route to call.
        # The route name will be formated `docusign.sign.{signaturename}` for this one it will be `docusign.sign.my_embedded_signature` and will have `my_embedded_signature` as attribute type
        # By defining this, you have a full control over the security applied to this route. see https://symfony.com/doc/current/security/access_control.html
        sign_path: '/my/embedded/sign/path'

        signatures_overridable: false # When set to true, you can define the pages and positions through the url as query parameters.

        # Where to position the signature
        signatures:
            # this is an array of positions, you can have multiple signatures locations per document and pages
            -
                page: 1 # Default
                x_position: 200 # Top left corner in pixels
                y_position: 400 # Top left corner in pixels

        # Define the storage to use to get the file to sign
        storage: 'docusign.storage' # if you set a string, it will look for an already defined storage. It could be defined with league/flysystem-bundle or by another signature definition when the storage key is an array of values
        # when the storage key is an array it will declare a new storage as if it was using the league/flysystem-bundle it's name will be `docusign.storage.my_remote_signature`
        # Do not use this format you do have `league/flysystem-bundle` installed, use the bundle configuration.
        storage:
            adapter: 'local'
            options:
                directory: '%kernel.project_dir%/var/storage/default'

    my_embedded_signature:
        mode: embedded
        demo: %kernel.debug%
        auth_authorization_code:
            integration_id: "YourIntegrationId"
            user_guid: "YourUserId"

        account_id: "yourAccountId"
        default_signer_name: "Grégoire Hébert"
        default_signer_email: "[email protected]"

        api_uri: "https://www.docusign.net/restapi" # default

        callback_route_name: "docusign_callback"
        sign_path: '/my/embedded/sign/path/{document_type}'

        signatures_overridable: false # default

        # Where to position the signatures
        signatures:
            # Here you can use the same signature definition but sometime you have some variations in your document, by setting a name you can inject the document_type as a query parameter to select the positions.
            document_type:
                -
                    page: 1 # default
                    x_position: 200 # top left corner in pixels
                    y_position: 400 # top left corner in pixels
            document_type_variation:
                -
                    page: 1 # default
                    x_position: 200 # top left corner in pixels
                    y_position: 400 # top left corner in pixels

        # league/flysystem-bundle storage usage
        storage: 'docusign.storage'

        # Storage declared by a previous signature definition
        storage: 'docusign.storage.my_remote_signature'

        # storage declared for this signature when not using league/flysystem-bundle
        storage:
            adapter: 'local'
            options:
                directory: '%kernel.project_dir%/var/storage/default'

Multiple signers

Hello,

Need help on adding multiple signers, it throws an error duplicate recipients found whenever I set signer on the event subscriber preSign function.

Implement functional tests

Maybe using Panther...

DOM is available on DocuSign, the following (jquery-like) selector allows to click on the sign button:

$('#documents > section > div.page-loaded').each(page => {
    $('.page-tabs .signature-tab > button', page).click();
});

Scenarios to write:

  • As admin, I can sign an embedded document, the signed document is updated on the storage
  • As user, I can sign a remote document received by email, the signed document is updated on the storage
  • As anonymous, I can sign the TOS document by a click

Symfony 5 Bundle Route Not loaded

Hi !

I tried to implement this bundle in my Symfony 5 application, but the bundle's routes seem to doesn't loaded

So when i follow instruction, like going to the route /docusign/consent/default the route doesn't exist.

I tried to clear cache .

[Help] Change Signer Name and Email

Hi !

I would like to change the default Signer Name / Email.

What's the best way to do this ?
On PreSign ?

My goal is to have only One signer for the document
Thanks for you reply

Add mode configuration key

  • Add mode configuration key: embedded, remote, click
  • Create an EnvelopeBuilder object per document (docusign.envelope_builder.foo) with required arguments: storage, mode, etc.
  • Replace is_bool on Configuration by is_string

Refacto routes

If route is default (i.e.: /docusign/consent/default), it should be /docusign/consent

[Help] - Need help/documentation on creating a remote signature

Hi,

I am currently trying to integrate and use this bundle with a new Symfony project but I am stuck trying to figure out how to create a remote signature.

What are the steps to creating an envelope and adding a pdf with two signers. I couldnt find any examples in the documentation. Can anyone provide me with a little guidance? I am happy to write up an example in the documentation once I get mine working.

Kind Regards

[RFC][DISCUSSION] making things Final

In this bundle as for any other code really.
When following the open closed principle, we have the tendency to mark as much classes as possible in a final state.

If most of the time it might signal the end user that this is part of the internals, not opened, please do not touch that, part of the library / bundle we are working on, it really is a burden when you need to extends them. Of course thanks to Symfony and the fact that almost everything is made as a service,
Which can be an error at some point, since you load tons of stuff, asking the internals of Symfony to get rid off, when not used. Especially when you try to load something that might or might not be called. Anyway this is another discussion.

When you want to let someone extends your work, at some point you might need to take a risk. Let say the class you want to extends is marked as final and is not a service. Then you are screwed (from a php PoV).
Since a long time now, Symfony is able to detect any class/method having the @final annotation and raise an error you can find in the deprecation panel.

I would like this to be the beginning of a reflexion to set a guiding rule to express when you should or should not make a class final or annotated as @final

For reference there is this discussion here.
There might be already a discussion, or a guiding rule about that, but
I did not find it yet.

Flysystem v2 LocalFilesystemAdapter error

With a Flysystem v2 vendor and the DocusignBundle v5.5.1, the following error occured:

Argument 2 passed to League\Flysystem\Local\LocalFilesystemAdapter::__construct() must be an instance of League\Flysystem\UnixVisibility\VisibilityConverter or null, int given

The src/Adapter/Builder/LocalAdapterDefinitionBuilder.php configureDefinition() method seems like it needs a little bit more work to be compatible.

Multiple signature default configuration

Describe the bug
When several signature zones are defined in the config, only the first one is extracted in the DocusignBundle\DependencyInjection\Configuration.php

To Reproduce
Install and configuret the bundle, setting 2 signature zones

Expected behavior
See all configured signatures in the processed configuration

Screenshots

Screenshot of an xdebug breakpoint in DocusignExtension.php line 63, right after $config = $this->processConfiguration($configuration, $configs)

Screenshot from 2021-02-14 13-27-14

Additional context
I am by no means a configuration expert, so I am not sure how and what the change could impact and that's why I prefer posting an issue rather than a pull request directly, but I'm guessing there is something to fix in the Configuration.php file, around the line 121:123.
A fix I found was simply changing the line 123 from:
->then(static function ($v) { return ['default' => [$v[0]]]; }) to ->then(static function ($v) { return ['default' => $v]; })

Cannot use an environment variable for secrets

One cannot use an environment variable for secrets.

Some configuration checks are done for variables that are secrets.
One must be able to declare these secrets in environment variable BUT
during the compilation process, the parameters are evaluated but not the
environment variable. They are evaluated at runtime. Therefor when using environment variable the
configuration validation always fails.
While a work-around is possible by using .env.local.php file, this is
not the average usage of environment variables.

Flysystem adapter definition error message in 5.5.0

After upgrading to 5.5.0, this error message appeared when clearing the Symfony cache:

$ php bin/console cache:clear

 // Clearing the cache for the dev environment with debug true                                                          


In DefinitionErrorExceptionPass.php line 54:
                                                                                                                                             
  Invalid constructor argument 3 for service "flysystem.adapter.default": argument 1 must be defined before. Check your service definition.  
                                                                                                                                             

cache:clear [--no-warmup] [--no-optional-warmers] [-h|--help] [-q|--quiet] [-v|vv|vvv|--verbose] [-V|--version] [--ansi] [--no-ansi] [-n|--no-interaction] [-e|--env ENV] [--no-debug] [--] <command>

Looking at the code, it seems like it is related to https://github.com/GregoireHebert/docusign-bundle/blob/5.5.0/src/Adapter/Builder/LocalAdapterDefinitionBuilder.php#L69 where arguments 0, 1, and 3 are defined after argument 2 in the conditional statements. I suppose the argument 0 and argument 1 lines should be before the argument 2 conditional statements.

related #115
@GregoireHebert @vincentchalamon

Handle callback route as path

At the moment the callback_route_name only target a route name
but it might be an url. As soon at it starts with https?:// we should not try to generate a route. but just use it.

Declare abstract services from services.xml

Some of the services declared in DocusignExtension are generic, and some (declared dynamically) could extend an abstract one.

The IDE could easily detect services declared from services.xml file (for instance), but not the ones declared dynamically from the Extension class.

To improve this, I would recommend to move generic services in a services.xml file, and declare some services as abstract to just extend them from the dynamic declaration in the Extension class.

Update documentation

  • Revamp documentation for installation & configuration
  • Add use cases: embedded, remote, click

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.