mirror of
https://github.com/pretix/pretix.git
synced 2026-05-10 16:04:02 +00:00
Add "is_implicit" attribute to payment providers
This commit is contained in:
@@ -50,6 +50,16 @@ class BasePaymentProvider:
|
|||||||
def __str__(self):
|
def __str__(self):
|
||||||
return self.identifier
|
return self.identifier
|
||||||
|
|
||||||
|
@property
|
||||||
|
def is_implicit(self) -> bool:
|
||||||
|
"""
|
||||||
|
Returns whether or whether not this payment provider is an "implicit" payment provider that will
|
||||||
|
*always* and unconditionally be used if is_allowed() returns True and does not require any input.
|
||||||
|
This is intended to be used by the FreePaymentProvider, which skips the payment choice page.
|
||||||
|
By default, this returns ``False``. Please do not set this if you don't know exactly what you are doing.
|
||||||
|
"""
|
||||||
|
return False
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def is_meta(self) -> bool:
|
def is_meta(self) -> bool:
|
||||||
"""
|
"""
|
||||||
@@ -552,6 +562,10 @@ class PaymentException(Exception):
|
|||||||
|
|
||||||
class FreeOrderProvider(BasePaymentProvider):
|
class FreeOrderProvider(BasePaymentProvider):
|
||||||
|
|
||||||
|
@property
|
||||||
|
def is_implicit(self) -> bool:
|
||||||
|
return True
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def is_enabled(self) -> bool:
|
def is_enabled(self) -> bool:
|
||||||
return True
|
return True
|
||||||
|
|||||||
@@ -487,9 +487,13 @@ class PaymentStep(QuestionsViewMixin, CartMixin, TemplateFlowStep):
|
|||||||
|
|
||||||
def is_applicable(self, request):
|
def is_applicable(self, request):
|
||||||
self.request = request
|
self.request = request
|
||||||
if self._total_order_value == 0:
|
|
||||||
self.cart_session['payment'] = 'free'
|
for p in self.request.event.get_payment_providers().values():
|
||||||
return False
|
if p.is_implicit:
|
||||||
|
if p.is_allowed(request):
|
||||||
|
self.cart_session['payment'] = p.identifier
|
||||||
|
return False
|
||||||
|
|
||||||
return True
|
return True
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user