# Path: ccvpn/common.py
# def get_price():
#     return config.MONTHLY_PRICE_EUR
# 
# Path: payments/backends/base.py
# class BackendBase:
#     backend_id = None
#     backend_verbose_name = ""
#     backend_display_name = ""
#     backend_enabled = False
#     backend_has_recurring = False
# 
#     def __init__(self, settings):
#         pass
# 
#     def new_payment(self, payment):
#         """ Initialize a payment and returns an URL to redirect the user.
#         Can return a HTML string that will be sent back to the user in a
#         default template (like a form) or a HTTP response (like a redirect).
#         """
#         raise NotImplementedError()
# 
#     def callback(self, payment, request):
#         """ Handle a callback """
#         raise NotImplementedError()
# 
#     def callback_subscr(self, payment, request):
#         """ Handle a callback (recurring payments) """
#         raise NotImplementedError()
# 
#     def cancel_subscription(self, subscr):
#         """ Cancel a subscription """
#         raise NotImplementedError()
# 
#     def get_info(self):
#         """ Returns some status (key, value) list """
#         return ()
# 
#     def get_ext_url(self, payment):
#         """ Returns URL to external payment view, or None """
#         return None
# 
#     def get_subscr_ext_url(self, subscr):
#         """ Returns URL to external payment view, or None """
#         return None


from django.db import models
from django.conf import settings
from django.utils.translation import ugettext_lazy as _
from jsonfield import JSONField
from datetime import timedelta
from ccvpn.common import get_price
from .backends import BackendBase
        return CURRENCY_CODE

    @property
    def currency_name(self):
        return CURRENCY_NAME

    @property
    def backend(self):
        """ Returns a global instance of the backend
        :rtype: BackendBase
        """
        return BACKENDS[self.backend_id]

    def get_amount_display(self):
        return '%.2f %s' % (self.amount / 100, CURRENCY_NAME)

    @property
    def is_confirmed(self):
        return self.status == 'confirmed'

    class Meta:
        ordering = ('-created', )

    @classmethod
    def create_payment(self, backend_id, user, months):
        payment = Payment(
            user=user,
            backend_id=backend_id,
            status='new',
            time=timedelta(days=30 * months),

# Path: ccvpn/common.py
# def get_price():
#     return config.MONTHLY_PRICE_EUR
# 
# Path: payments/backends/base.py
# class BackendBase:
#     backend_id = None
#     backend_verbose_name = ""
#     backend_display_name = ""
#     backend_enabled = False
#     backend_has_recurring = False
# 
#     def __init__(self, settings):
#         pass
# 
#     def new_payment(self, payment):
#         """ Initialize a payment and returns an URL to redirect the user.
#         Can return a HTML string that will be sent back to the user in a
#         default template (like a form) or a HTTP response (like a redirect).
#         """
#         raise NotImplementedError()
# 
#     def callback(self, payment, request):
#         """ Handle a callback """
#         raise NotImplementedError()
# 
#     def callback_subscr(self, payment, request):
#         """ Handle a callback (recurring payments) """
#         raise NotImplementedError()
# 
#     def cancel_subscription(self, subscr):
#         """ Cancel a subscription """
#         raise NotImplementedError()
# 
#     def get_info(self):
#         """ Returns some status (key, value) list """
#         return ()
# 
#     def get_ext_url(self, payment):
#         """ Returns URL to external payment view, or None """
#         return None
# 
#     def get_subscr_ext_url(self, subscr):
#         """ Returns URL to external payment view, or None """
#         return None


# Path: payments/models.py
from django.db import models
from django.conf import settings
from django.utils.translation import ugettext_lazy as _
from jsonfield import JSONField
from datetime import timedelta
from ccvpn.common import get_price
from .backends import BackendBase

        return CURRENCY_CODE

    @property
    def currency_name(self):
        return CURRENCY_NAME

    @property
    def backend(self):
        """ Returns a global instance of the backend
        :rtype: BackendBase
        """
        return BACKENDS[self.backend_id]

    def get_amount_display(self):
        return '%.2f %s' % (self.amount / 100, CURRENCY_NAME)

    @property
    def is_confirmed(self):
        return self.status == 'confirmed'

    class Meta:
        ordering = ('-created', )

    @classmethod
    def create_payment(self, backend_id, user, months):
        payment = Payment(
            user=user,
            backend_id=backend_id,
            status='new',
            time=timedelta(days=30 * months),

            amount=get_price() * months