Пример #1
0
def get_processor_backend(provider):
    if settings.PROCESSOR_BACKEND_CALLABLE:
        from saas.compat import import_string
        func = import_string(settings.PROCESSOR_BACKEND_CALLABLE)
        processor_backend = func(provider)
    else:
        processor_backend = load_backend(settings.PROCESSOR['BACKEND'])
    return processor_backend
Пример #2
0
def get_processor_backend(provider):
    if settings.PROCESSOR_BACKEND_CALLABLE:
        from saas.compat import import_string
        func = import_string(settings.PROCESSOR_BACKEND_CALLABLE)
        processor_backend = func(provider)
    else:
        processor_backend = load_backend(settings.PROCESSOR['BACKEND'])
    return processor_backend
Пример #3
0
def get_extra_field_class():
    extra_class = _SETTINGS.get('EXTRA_FIELD')
    if extra_class is None:
        from django.db.models import TextField
        extra_class = TextField
    elif isinstance(extra_class, str):
        from saas.compat import import_string
        extra_class = import_string(extra_class)
    return extra_class
 def get_redirect_url(self, *args, **kwargs):
     url = super(StripeProcessorRedirectView, self).get_redirect_url(
         *args, **kwargs)
     if settings.PROCESSOR_REDIRECT_CALLABLE:
         from saas.compat import import_string
         func = import_string(settings.PROCESSOR_REDIRECT_CALLABLE)
         redirect_url_end_point = func(kwargs.get(self.slug_url_kwarg))
         url = urljoin(redirect_url_end_point, url)
     return url
Пример #5
0
def get_extra_field_class():
    extra_class = _SETTINGS.get('EXTRA_FIELD')
    if extra_class is None:
        from django.db.models import TextField
        extra_class = TextField
    elif isinstance(extra_class, str):
        from saas.compat import import_string
        extra_class = import_string(extra_class)
    return extra_class
Пример #6
0
 def get_redirect_url(self, *args, **kwargs):
     if settings.PROCESSOR_REDIRECT_CALLABLE:
         from saas.compat import import_string
         func = import_string(settings.PROCESSOR_REDIRECT_CALLABLE)
         url = func(self.request, site=kwargs.get(self.slug_url_kwarg))
         args = self.request.META.get('QUERY_STRING', '')
         if args and self.query_string:
             url = "%s?%s" % (url, args)
     else:
         url = super(StripeProcessorRedirectView, self).get_redirect_url(
             *args, **kwargs)
     return url
Пример #7
0
 def get_redirect_url(self, *args, **kwargs):
     redirect_func_name = settings.PROCESSOR.get('REDIRECT_CALLABLE', None)
     if redirect_func_name:
         from saas.compat import import_string
         func = import_string(redirect_func_name)
         url = func(self.request, site=kwargs.get(self.slug_url_kwarg))
         args = self.request.META.get('QUERY_STRING', '')
         if args and self.query_string:
             url = "%s?%s" % (url, args)
     else:
         url = super(StripeProcessorRedirectView, self).get_redirect_url(
             *args, **kwargs)
     return url
Пример #8
0
def product_url(provider, subscriber=None):
    """
    We cannot use a basic ``reverse('product_default_start')`` here because
    *organization* and ``get_broker`` might be different.
    """
    current_uri = '/'
    if settings.PROVIDER_SITE_CALLABLE:
        from saas.compat import import_string
        site = import_string(settings.PROVIDER_SITE_CALLABLE)(str(provider))
        if site and site.domain:
            scheme = 'https' # Defaults to secure connection.
            current_uri = '%s://%s/' % (scheme, site.domain)
        else:
            current_uri += '%s/' % provider
    else:
        current_uri += '%s/' % provider
    current_uri += 'app/'
    if subscriber:
        current_uri += '%s/' % subscriber
    return current_uri
Пример #9
0
def product_url(provider, subscriber=None):
    """
    We cannot use a basic ``reverse('product_default_start')`` here because
    *organization* and ``get_current_provider`` might be different.
    """
    current_uri = '/'
    if settings.PROVIDER_SITE_CALLABLE:
        from saas.compat import import_string
        site = import_string(settings.PROVIDER_SITE_CALLABLE)(str(provider))
        if site.domain:
            scheme = 'https' # Defaults to secure connection.
            current_uri = '%s://%s/' % (scheme, site.domain)
        else:
            current_uri += '%s/' % provider
    else:
        current_uri += '%s/' % provider
    current_uri += 'app/'
    if subscriber:
        current_uri += '%s/' % subscriber
    return current_uri