django-orchestra-test/orchestra/apps/payments/methods/options.py

35 lines
888 B
Python
Raw Normal View History

from dateutil import relativedelta
from django import forms
2014-11-09 10:16:07 +00:00
from django.core.exceptions import ValidationError
from orchestra import plugins
2014-09-16 15:01:02 +00:00
from orchestra.utils.functional import cached
from orchestra.utils.python import import_class
from .. import settings
class PaymentMethod(plugins.Plugin):
label_field = 'label'
number_field = 'number'
process_credit = False
due_delta = relativedelta.relativedelta(months=1)
2015-03-23 15:36:51 +00:00
plugin_field = 'method'
2014-09-16 15:01:02 +00:00
@classmethod
@cached
def get_plugins(cls):
plugins = []
for cls in settings.PAYMENTS_ENABLED_METHODS:
plugins.append(import_class(cls))
return plugins
def get_label(self):
return self.instance.data[self.label_field]
def get_number(self):
return self.instance.data[self.number_field]
def get_bill_message(self):
2014-09-10 16:53:09 +00:00
return ''