Skip to content

Commit de5bd74

Browse files
committed
Merge pull request #162 from rambo/issue-81
Implement importer for Holvi data
2 parents 141daff + e57bb1e commit de5bd74

File tree

30 files changed

+309
-50
lines changed

30 files changed

+309
-50
lines changed

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -121,6 +121,7 @@ Until we maybe decide on Celery for running various (timed or otherwise) tasks a
121121
SHELL=/bin/bash
122122
@daily cd /path/to/project ; source venv/bin/activate ; ./manage.py addrecurring
123123
@daily cd /path/to/project ; set -o allexport ; source .env; set +o allexport ; pg_dump -c $DATABASE_URL | gzip >database_backup.sql.gz
124+
@daily cd /path/to/project ; source venv/bin/activate ; ./manage.py import_holvidata # if using Holvi integrations
124125

125126
## Running in development mode
126127

@@ -145,5 +146,4 @@ For restore run ```zcat database_backup.sql.gz | psql $DATABASE_URL``` (you migh
145146

146147
## About the example handlers
147148

148-
Use these as example for building your own callbacks (though some might be rather useful as-is), you need to `pip install -r examples/requirements.txt` to install
149-
the additional requirements.
149+
Use these as example for building your own callbacks (though some might be rather useful as-is).

project/access/management/commands/generate_grants.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,4 +12,5 @@ def add_arguments(self, parser):
1212
def handle(self, *args, **options):
1313
for i in range(options['amount']):
1414
grant = GrantFactory()
15-
print("Generated grant %s" % grant)
15+
if options['verbosity'] > 0:
16+
print("Generated grant %s" % grant)

project/access/management/commands/generate_nonmembertokens.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,4 +12,5 @@ def add_arguments(self, parser):
1212
def handle(self, *args, **options):
1313
for i in range(options['amount']):
1414
token = NonMemberTokenFactory()
15-
print("Generated token %s" % token)
15+
if options['verbosity'] > 0:
16+
print("Generated token %s" % token)

project/access/management/commands/generate_tokens.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,4 +12,5 @@ def add_arguments(self, parser):
1212
def handle(self, *args, **options):
1313
for i in range(options['amount']):
1414
token = TokenFactory()
15-
print("Generated token %s" % token)
15+
if options['verbosity'] > 0:
16+
print("Generated token %s" % token)

project/config/settings/common.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,7 @@
6363
'access',
6464
'creditor',
6565
'ndaparser',
66+
'holviapp',
6667
)
6768

6869
# See: https://docs.djangoproject.com/en/dev/ref/settings/#installed-apps
@@ -266,7 +267,8 @@
266267
NORDEA_UPLOAD_ENABLED = env.bool('NORDEA_UPLOAD_ENABLED', default=False)
267268
ORGANIZATION_NAME=env('ORGANIZATION_NAME', default="hacklab.fi asylum for the inane")
268269
RECURRINGTRANSACTIONS_CALLBACKS_HANDLER=env('RECURRINGTRANSACTIONS_CALLBACKS_HANDLER', default=None)
269-
270+
HOLVI_POOL=env('HOLVI_POOL', default=None)
271+
HOLVI_APIKEY=env('HOLVI_APIKEY', default=None)
270272

271273
REST_FRAMEWORK = {
272274
'DEFAULT_AUTHENTICATION_CLASSES': [

project/creditor/handlers.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
class AbstractTransaction(models.Model):
88
stamp = models.DateTimeField(_("Datetime"), blank=False)
99
name = models.CharField(_("Name"), max_length=200, blank=False)
10+
email = models.EmailField(_("Name"), max_length=200, blank=True)
1011
reference = models.CharField(_("Reference"), max_length=200, blank=False)
1112
amount = models.DecimalField(verbose_name=_("Amount"), max_digits=6, decimal_places=2, blank=False, null=False)
1213
unique_id = models.CharField(_("Unique transaction id"), max_length=64, blank=False)

project/creditor/management/commands/addrecurring.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,4 +8,5 @@ def handle(self, *args, **options):
88
for t in RecurringTransaction.objects.all():
99
ret = t.conditional_add_transaction()
1010
if ret:
11-
print("Created transaction %s" % ret)
11+
if options['verbosity'] > 1:
12+
print("Created transaction %s" % ret)

project/creditor/management/commands/generate_membershipfees.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,4 +24,5 @@ def handle(self, *args, **options):
2424
rt.start = rt.end - datetime.timedelta(days=1)
2525
rt.save()
2626
newrt = MembershipfeeFactory.create(amount=options["amount"], start=today, end=None, owner=m)
27-
print("Generated RecurringTransaction %s" % newrt)
27+
if options['verbosity'] > 0:
28+
print("Generated RecurringTransaction %s" % newrt)

project/creditor/management/commands/generate_recurring.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,4 +18,5 @@ def handle(self, *args, **options):
1818
rt = MembershipfeeFactory()
1919
if options['mode'] == 'keyholder':
2020
rt = KeyholderfeeFactory()
21-
print("Generated RecurringTransaction %s" % rt)
21+
if options['verbosity'] > 0:
22+
print("Generated RecurringTransaction %s" % rt)

project/creditor/management/commands/generate_transactions.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,4 +12,5 @@ def add_arguments(self, parser):
1212
def handle(self, *args, **options):
1313
for i in range(options['amount']):
1414
trans = TransactionFactory()
15-
print("Generated transaction %s" % trans)
15+
if options['verbosity'] > 0:
16+
print("Generated transaction %s" % trans)

0 commit comments

Comments
 (0)