gregoirehebert / docusign-bundle Goto Github PK
View Code? Open in Web Editor NEWSymfony bundle to create electronic signatures with DocuSign
Home Page: https://github.com/GregoireHebert/docusign-bundle
License: MIT License
Symfony bundle to create electronic signatures with DocuSign
Home Page: https://github.com/GregoireHebert/docusign-bundle
License: MIT License
This PR will facilitate using this bundle through command line or to perform bulk actions
storage
can accept a string (for an existing service) or an arrayDepending 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
in DefineEnvelope, it uses a constant as email subject to sign the document.
It should be translated.
To handle multiple type of signature per file handled We need mostly to change the configuration. This is the configuration we should aim for.
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"
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'
Hello,
Need help on adding multiple signers, it throws an error duplicate recipients found whenever I set signer on the event subscriber preSign function.
And don't forget to update php-cs-fixer configuration
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:
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 .
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
docusign.envelope_builder.foo
)default
)webhook_route_name
useless configuration keymode
configuration key: embedded, remote, clickdocusign.envelope_builder.foo
) with required arguments: storage, mode, etc.is_bool
on Configuration by is_string
If route is default (i.e.: /docusign/consent/default
), it should be /docusign/consent
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
sign_path
configuration keydocusign.sign.foo
)my_embedded_signature
) as request attribute in routeIn 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.
It would be nice to add support for flysystem ^2.
There is a guide for this
https://flysystem.thephpleague.com/v2/docs/advanced/upgrade-to-2.0.0/
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.
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)
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]; })
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.
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
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.
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.
Decorate each action with a TraceableAction including the stopwatch process
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.