Skip to content

Commit 6118761

Browse files
author
Robert Knight
authored
Merge pull request docusign#16 from docusign/private
Moved examples under eSignature, added private.key to .gitignore, add…
2 parents 6ea9012 + 1d9d331 commit 6118761

File tree

100 files changed

+222
-202
lines changed

Some content is hidden

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

100 files changed

+222
-202
lines changed

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -113,3 +113,6 @@ crashlytics.properties
113113
crashlytics-build.properties
114114
fabric.properties
115115
.vscode/settings.json
116+
117+
# Security key files
118+
private.key

README.md

Lines changed: 31 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -6,108 +6,108 @@ This repo is a Python 3 application that demonstrates:
66

77

88
1. **Embedded Signing Ceremony.**
9-
[Source.](./app/examples/eg001_embedded_signing/controller.py)
9+
[Source.](./app/eg001_embedded_signing/controller.py)
1010
This example sends an envelope, and then uses an embedded signing ceremony for the first signer.
1111
With embedded signing, the DocuSign signing ceremony is initiated from your website.
1212
1. **Send an envelope with a remote (email) signer and cc recipient.**
13-
[Source.](./app/examples/eg002_signing_via_email/controller.py)
13+
[Source.](./app/eSignature/examples/eg002_signing_via_email/controller.py)
1414
The envelope includes a pdf, Word, and HTML document.
1515
Anchor text ([AutoPlace](https://support.docusign.com/en/guides/AutoPlace-New-DocuSign-Experience)) is used to position the signing fields in the documents.
1616
1. **List envelopes in the user's account.**
17-
[Source.](./app/examples/eg003_list_envelopes/controller.py)
17+
[Source.](./app/eSignature/examples/eg003_list_envelopes/controller.py)
1818
The envelopes' current status is included.
1919
1. **Get an envelope's basic information.**
20-
[Source.](./app/examples/eg004_envelope_info/controller.py)
20+
[Source.](./app/eSignature/examples/eg004_envelope_info/controller.py)
2121
The example lists the basic information about an envelope, including its overall status.
2222
1. **List an envelope's recipients**
23-
[Source.](./app/examples/eg005_envelope_recipients/controller.py)
23+
[Source.](./app/eSignature/examples/eg005_envelope_recipients/controller.py)
2424
Includes current recipient status.
2525
1. **List an envelope's documents.**
26-
[Source.](./app/examples/eg006_envelope_docs/controller.py)
26+
[Source.](./app/eSignature/examples/eg006_envelope_docs/controller.py)
2727
1. **Download an envelope's documents.**
28-
[Source.](./app/examples/eg007_envelope_get_doc/controller.py)
28+
[Source.](./app/eSignature/examples/eg007_envelope_get_doc/controller.py)
2929
The example can download individual
3030
documents, the documents concatenated together, or a zip file of the documents.
3131
1. **Programmatically create a template.**
32-
[Source.](./app/examples/eg008_create_template/controller.py)
32+
[Source.](./app/eSignature/examples/eg008_create_template/controller.py)
3333
1. **Send an envelope using a template.**
34-
[Source.](./app/examples/eg009_use_template/controller.py)
34+
[Source.](./app/eSignature/examples/eg009_use_template/controller.py)
3535
1. **Send an envelope and upload its documents with multipart binary transfer.**
36-
[Source.](./app/examples/eg010_send_binary_docs/controller.py)
36+
[Source.](./app/eSignature/examples/eg010_send_binary_docs/controller.py)
3737
Binary transfer is 33% more efficient than using Base64 encoding.
3838
1. **Embedded sending.**
39-
[Source.](./app/examples/eg011_embedded_sending/controller.py)
39+
[Source.](./app/eSignature/examples/eg011_embedded_sending/controller.py)
4040
Embeds the DocuSign web tool (NDSE) in your web app to finalize or update
4141
the envelope and documents before they are sent.
4242
1. **Embedded DocuSign web tool (NDSE).**
43-
[Source.](./app/examples/eg012_embedded_console/controller.py)
43+
[Source.](./app/eSignature/examples/eg012_embedded_console/controller.py)
4444
1. **Embedded Signing Ceremony from a template with an added document.**
45-
[Source.](./app/examples/eg013_add_doc_to_template/controller.py)
45+
[Source.](./app/eSignature/examples/eg013_add_doc_to_template/controller.py)
4646
This example sends an envelope based on a template.
4747
In addition to the template's document(s), the example adds an
4848
additional document to the envelope by using the
4949
[Composite Templates](https://developers.docusign.com/esign-rest-api/guides/features/templates#composite-templates)
5050
feature.
5151
1. **Payments example: an order form, with online payment by credit card.**
52-
[Source.](./app/examples/eg014_collect_payment/controller.py)
52+
[Source.](./app/eSignature/examples/eg014_collect_payment/controller.py)
5353
1. **Get the envelope tab data.**
5454
Retrieve the tab (field) values for all of the envelope's recipients.
55-
[Source.](./app/examples/eg015_envelope_tab_data/controller.py)
55+
[Source.](./app/eSignature/examples/eg015_envelope_tab_data/controller.py)
5656
1. **Set envelope tab values.**
5757
The example creates an envelope and sets the initial values for its tabs (fields). Some of the tabs
5858
are set to be read-only, others can be updated by the recipient. The example also stores
5959
metadata with the envelope.
60-
[Source.](./app/examples/eg016_set_tab_values/controller.py)
60+
[Source.](./app/eSignature/examples/eg016_set_tab_values/controller.py)
6161
1. **Set template tab values.**
6262
The example creates an envelope using a template and sets the initial values for its tabs (fields).
6363
The example also stores metadata with the envelope.
64-
[Source.](./app/examples/eg017_set_template_tab_values/controller.py)
64+
[Source.](./app/eSignature/examples/eg017_set_template_tab_values/controller.py)
6565
1. **Get the envelope custom field data (metadata).**
6666
The example retrieves the custom metadata (custom data fields) stored with the envelope.
67-
[Source.](./app/examples/eg018_envelope_custom_field_data/controller.py)
67+
[Source.](./app/eSignature/examples/eg018_envelope_custom_field_data/controller.py)
6868
1. **Requiring an Access Code for a Recipient**
69-
[Source.](./app/examples/eg019_access_code_authentication/controller.py)
69+
[Source.](./app/eSignature/examples/eg019_access_code_authentication/controller.py)
7070
This example sends an envelope that requires an access-code for the purpose of multi-factor authentication.
7171
1. **Requiring SMS authentication for a recipient**
72-
[Source.](./app/examples/eg020_sms_authentication/controller.py)
72+
[Source.](./app/eSignature/examples/eg020_sms_authentication/controller.py)
7373
This example sends an envelope that requires entering in a six digit code from an text message for the purpose of multi-factor authentication.
7474
1. **Requiring Phone authentication for a recipient**
75-
[Source.](./app/examples/eg021_phone_authentication/controller.py)
75+
[Source.](./app/eSignature/examples/eg021_phone_authentication/controller.py)
7676
This example sends an envelope that requires entering in a voice-based response code for the purpose of multi-factor authentication.
7777
1. **Requiring Knowledge-Based Authentication (KBA) for a Recipient**
78-
[Source.](./app/examples/eg022_kba_authentication/controller.py)
78+
[Source.](./app/eSignature/examples/eg022_kba_authentication/controller.py)
7979
This example sends an envelope that requires passing a Public records check to validate identity for the purpose of multi-factor authentication.
8080
1. **Requiring ID Verification (IDV) for a recipient**
81-
[Source.](./app/examples/eg023_idv_authentication/controller.py)
81+
[Source.](./app/eSignature/examples/eg023_idv_authentication/controller.py)
8282
This example sends an envelope that requires submitting a photo of a government issued id for the purpose of multi-factor authentication.
8383
1. **Creating a permission profile**
84-
[Source.](./app/examples/eg024_permissions_creating/controller.py)
84+
[Source.](./app/eSignature/examples/eg024_permissions_creating/controller.py)
8585
This code example demonstrates how to create a permission profile using the [Create Permission Profile](https://developers.docusign.com/esign-rest-api/reference/Accounts/AccountPermissionProfiles/create) method.
8686
1. **Setting a permission profile**
87-
[Source.](./app/examples/eg025_permissions_set_user_group/controller.py)
87+
[Source.](./app/eSignature/examples/eg025_permissions_set_user_group/controller.py)
8888
This code example demonstrates how to set a user group’s permission profile using the [Update Group](https://developers.docusign.com/esign-rest-api/reference/UserGroups/Groups/update) method.
8989
You must have already created the permissions profile and the group of users.
9090
1. **Updating individual permission settings**
91-
[Source.](./app/examples/eg026_permissions_change_single_setting/controller.py)
91+
[Source.](./app/eSignature/examples/eg026_permissions_change_single_setting/controller.py)
9292
This code example demonstrates how to edit individual permission settings on a permissions profile using the [Update Permission Profile](https://developers.docusign.com/esign-rest-api/reference/Accounts/AccountPermissionProfiles/update) method.
9393
1. **Deleting a permission profile**
94-
[Source.](./app/examples/eg027_permissions_delete/controller.py)
94+
[Source.](./app/eSignature/examples/eg027_permissions_delete/controller.py)
9595
This code example demonstrates how to delete a permission profile using the [Delete Permission Profile](https://developers.docusign.com/esign-rest-api/reference/Accounts/AccountPermissionProfiles/create) method.
9696
1. **Creating a brand**
97-
[Source.](./app/examples/eg028_brand_creating/controller.py)
97+
[Source.](./app/eSignature/examples/eg028_brand_creating/controller.py)
9898
This example creates brand profile for an account using the [Create Brand](https://developers.docusign.com/esign-rest-api/reference/Accounts/AccountBrands/create) method.
9999
1. **Applying a brand to an envelope**
100-
[Source.](./app/examples/eg029_brands_apply_to_envelope/controller.py)
100+
[Source.](./app/eSignature/examples/eg029_brands_apply_to_envelope/controller.py)
101101
This code example demonstrates how to apply a brand you've created to an envelope using the [Create Envelope](https://developers.docusign.com/esign-rest-api/reference/Envelopes/Envelopes/create) method.
102102
First, creates the envelope and then applies the brand to it.
103103
Anchor text ([AutoPlace](https://support.docusign.com/en/guides/AutoPlace-New-DocuSign-Experience)) is used to position the signing fields in the documents.
104104
1. **Applying a brand to a template**
105-
[Source.](./app/examples/eg030_brands_apply_to_template/controller.py)
105+
[Source.](./app/eSignature/examples/eg030_brands_apply_to_template/controller.py)
106106
This code example demonstrates how to apply a brand you've created to a template using using the [Create Envelope](https://developers.docusign.com/esign-rest-api/reference/Envelopes/Envelopes/create) method.
107107
You must have already created the template and the brand.
108108
Anchor text ([AutoPlace](https://support.docusign.com/en/guides/AutoPlace-New-DocuSign-Experience)) is used to position the signing fields in the documents.
109109
1. **Bulk sending envelopes to multiple recipients**
110-
[Source.](./app/examples/eg031_bulk_send/controller.py)
110+
[Source.](./app/eSignature/examples/eg031_bulk_send/controller.py)
111111
This code example demonstrates how to send envelopes in bulk to multiple recipients using these methods:
112112
[Create Bulk Send List](https://developers.docusign.com/esign-rest-api/reference/BulkEnvelopes/BulkSend/createBulkSendList),
113113
[Create Bulk Send Request](https://developers.docusign.com/esign-rest-api/reference/BulkEnvelopes/BulkSend/createBulkSendRequest).

app/__init__.py

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,8 @@
33
from flask import Flask
44
from flask_wtf.csrf import CSRFProtect
55

6-
from . import examples
6+
from .ds_config import DS_CONFIG
7+
from .eSignature import examples
78
from .docusign.views import ds
89
from .views import core
910

@@ -14,6 +15,12 @@
1415
# See https://flask-wtf.readthedocs.io/en/stable/csrf.html
1516
csrf = CSRFProtect(app)
1617

18+
# Set whether this is a quickstart in config
19+
app.config["quickstart"] = DS_CONFIG["quickstart"]
20+
21+
# Set whether user has logged in
22+
app.config["isLoggedIn"] = False
23+
1724
# Register home page
1825
app.register_blueprint(core)
1926
# Register OAuth

app/docusign/views.py

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
from datetime import datetime, timedelta
22

3-
from flask import redirect, request, url_for, flash, render_template, Blueprint, session
3+
from flask import redirect, request, url_for, flash, render_template, Blueprint, session, current_app as app
44

55
from .ds_client import DSClient
66
from .utils import ds_logout_internal
@@ -14,13 +14,17 @@
1414
def ds_login():
1515
if not session.get("auth_type"):
1616
session["auth_type"] = request.form.get("auth_type")
17+
app.config["isLoggedIn"] = True
18+
app.config["quickstart"] = DS_CONFIG["quickstart"]
1719
return DSClient.login(session["auth_type"])
1820

1921

2022
@ds.route("/logout")
2123
def ds_logout():
2224
ds_logout_internal()
2325
flash("You have logged out from DocuSign.")
26+
app.config["isLoggedIn"] = False
27+
app.config["quickstart"] = False
2428
return redirect(url_for("core.index"))
2529

2630

@@ -52,12 +56,12 @@ def ds_callback():
5256
if target_account_id:
5357
account = next((a for a in accounts if a["account_id"] == target_account_id), None)
5458
if not account:
55-
# Panic! The user does not have the targeted account. They should not log in!
59+
# The user does not have the targeted account. They should not log in!
5660
raise Exception("No access to target account")
5761
else: # get the default account
5862
account = next((a for a in accounts if a["is_default"]), None)
5963
if not account:
60-
# Panic! Every user should always have a default account
64+
# Every user should always have a default account
6165
raise Exception("No default account")
6266

6367
# Save the account information

app/ds_config_sample.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,8 @@
2424
"gateway_name": "stripe",
2525
"gateway_display_name": "Stripe",
2626
"github_example_url": "https://github.com/docusign/code-examples-python/tree/master/app/",
27-
"documentation": "" # Use an empty string to indicate no documentation path.
27+
"documentation": "", # Use an empty string to indicate no documentation path.
28+
"quickstart": "{QUICKSTART_VALUE}"
2829
}
2930

3031
DS_JWT = {

app/examples/__init__.py renamed to app/eSignature/examples/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
from .eg001_embedded_signing import eg001
1+
from ...eg001_embedded_signing import eg001
22
from .eg002_signing_via_email import eg002
33
from .eg003_list_envelopes import eg003
44
from .eg004_envelope_info import eg004
File renamed without changes.

app/examples/eg002_signing_via_email/controller.py renamed to app/eSignature/examples/eg002_signing_via_email/controller.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,9 @@
44
from docusign_esign import EnvelopesApi, EnvelopeDefinition, Document, Signer, CarbonCopy, SignHere, Tabs, Recipients
55
from flask import session, request
66

7-
from ...consts import demo_docs_path, pattern
8-
from ...docusign import create_api_client
9-
from ...ds_config import DS_CONFIG
7+
from ....consts import demo_docs_path, pattern
8+
from ....docusign import create_api_client
9+
from ....ds_config import DS_CONFIG
1010

1111

1212
class Eg002Controller:

app/examples/eg002_signing_via_email/views.py renamed to app/eSignature/examples/eg002_signing_via_email/views.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,9 @@
66
from flask import render_template, session, Blueprint
77

88
from .controller import Eg002Controller
9-
from ...docusign import authenticate
10-
from ...ds_config import DS_CONFIG
11-
from ...error_handlers import process_error
9+
from ....docusign import authenticate
10+
from ....ds_config import DS_CONFIG
11+
from ....error_handlers import process_error
1212

1313
eg = "eg002" # reference (and url) for this example
1414
eg002 = Blueprint("eg002", __name__)
File renamed without changes.

0 commit comments

Comments
 (0)