fnp
/
wolnelektury.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
unify book list fields in api
[wolnelektury.git]
/
src
/
paypal
/
rest.py
diff --git
a/src/paypal/rest.py
b/src/paypal/rest.py
index
a2e2232
..
1e0811b
100644
(file)
--- a/
src/paypal/rest.py
+++ b/
src/paypal/rest.py
@@
-65,7
+65,7
@@
def get_link(links, rel):
return link.href
return link.href
-def create_agreement(amount):
+def create_agreement(amount
, app=False
):
try:
plan = BillingPlanModel.objects.get(amount=amount)
except BillingPlanModel.DoesNotExist:
try:
plan = BillingPlanModel.objects.get(amount=amount)
except BillingPlanModel.DoesNotExist:
@@
-84,6
+84,10
@@
def create_agreement(amount):
"payment_method": "paypal"
},
})
"payment_method": "paypal"
},
})
+ if app:
+ billing_agreement['override_merchant_preferences'] = {
+ 'return_url': absolute_url('paypal_app_return'),
+ }
response = billing_agreement.create()
if response:
response = billing_agreement.create()
if response:
@@
-92,8
+96,8
@@
def create_agreement(amount):
raise PaypalError(billing_agreement.error)
raise PaypalError(billing_agreement.error)
-def agreement_approval_url(amount):
- agreement = create_agreement(amount)
+def agreement_approval_url(amount
, app=False
):
+ agreement = create_agreement(amount
, app=app
)
return get_link(agreement.links, 'approval_url')
return get_link(agreement.links, 'approval_url')