Skip to content

Commit

Permalink
Merge pull request #4 from jurismarches/qn-extra-info
Browse files Browse the repository at this point in the history
Add extra info
  • Loading branch information
qnaud authored Mar 4, 2021
2 parents 9b33dfe + 075acf6 commit 8b054cd
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
2 changes: 1 addition & 1 deletion payzen/__init__.py
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
__version__ = '0.0.10'
__version__ = '0.0.11'
__version_info__ = tuple(__version__.split('.'))
9 changes: 6 additions & 3 deletions payzen/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ class SEPAMandateFormData:

def __init__(self, user, payzen_id, comeback_url, payzen_certificate,
payzen_shop_id, payzen_context, payzen_version, update=False,
redirect_timeout=None, allow_fragments=True):
redirect_timeout=None, allow_fragments=True, extra={}):

self._certificate = payzen_certificate

Expand All @@ -34,6 +34,9 @@ def __init__(self, user, payzen_id, comeback_url, payzen_certificate,
self.vads_version = payzen_version
self.vads_payment_cards = ''

for key, value in extra.items():
setattr(self, f"vads_ext_info_{key}", str(value))

query_param_name = 'payment'
if urlparse(comeback_url, allow_fragments=allow_fragments)[4]:
# already have query params
Expand Down Expand Up @@ -74,11 +77,11 @@ class SEPAMandateAndPayFormData(SEPAMandateFormData):
def __init__(self, user, payzen_id, comeback_url, payzen_certificate,
payzen_shop_id, payzen_context, payzen_version, amount,
trans_id, payment_config, update=False, redirect_timeout=None,
allow_fragments=True):
allow_fragments=True, extra={}):
super().__init__(
user, payzen_id, comeback_url, payzen_certificate,
payzen_shop_id, payzen_context, payzen_version, update, redirect_timeout,
allow_fragments)
allow_fragments, extra)
self.vads_page_action = 'REGISTER_PAY'
a = amount.quantize(Decimal('1.00'), rounding=ROUND_HALF_UP)
self.vads_amount = str(a).replace('.', '')
Expand Down

0 comments on commit 8b054cd

Please sign in to comment.