Skip to content
This repository has been archived by the owner on Feb 10, 2022. It is now read-only.

Commit

Permalink
Restructure package. Add flask adapter
Browse files Browse the repository at this point in the history
  • Loading branch information
victor-baumann committed Apr 22, 2016
1 parent 45ab068 commit fd73a0b
Show file tree
Hide file tree
Showing 6 changed files with 24 additions and 0 deletions.
1 change: 1 addition & 0 deletions payu/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from payu.payu import PayU
Empty file added payu/adapters/__init__.py
Empty file.
17 changes: 17 additions & 0 deletions payu/adapters/flask_payu.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
from payu import PayU as PayUBase

class PayU(PayUBase):

def __init__(self, app, **config):
super(PayU, self).__init__(**config)
self.app = app
if app is not None:
self.init_app(app)


def init_app(self, app):
for key, value in self.app.config.items():
if not key.startswith('PAYU_'):
continue
k = key.split('PAYU_')[-1]
self.config[k] = value
6 changes: 6 additions & 0 deletions helpers.py → payu/helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,9 @@ def generate_reference_code(id=None, prefix='payment_test_'):
s = string.ascii_lowercase + string.digits
id = ''.join(random.sample(s,10))
return prefix + id


def mask_credit_card_number(number):
""" Mask credit card, keeping the first 6 (Issuer Identification Number)
and last 4 digits visible """
return number[:6] + 'X' * 6 + number[-4:]
File renamed without changes.
File renamed without changes.

0 comments on commit fd73a0b

Please sign in to comment.