Skip to content

Commit

Permalink
Scope braintree Configuration inside func
Browse files Browse the repository at this point in the history
  • Loading branch information
pH-7 committed Oct 26, 2017
1 parent e65ed4d commit 43f118c
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 6 deletions.
13 changes: 7 additions & 6 deletions marketplaceapp/braintree_config.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
import braintree

braintree.Configuration.configure(
braintree.Environment.Sandbox,
merchant_id="nnrdhv8jcbptkj6z",
public_key="xjyj3dtj8w3x8kxq",
private_key="59b5b4248dcd13be8ff29e4f4ade559a"
)
def braintree_init():
braintree.Configuration.configure(
braintree.Environment.Sandbox,
merchant_id="nnrdhv8jcbptkj6z",
public_key="xjyj3dtj8w3x8kxq",
private_key="59b5b4248dcd13be8ff29e4f4ade559a"
)
2 changes: 2 additions & 0 deletions marketplaceapp/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,8 @@ def profile(request, username):
@login_required(login_url=home)
def create_purchase(request):
if request.method == 'POST':
braintree_init()

try:
gig_id = request.POST.get('gig_id')
gig = Gig.objects.get(id=gig_id)
Expand Down

0 comments on commit 43f118c

Please sign in to comment.