mirror of
https://github.com/pretix/pretix.git
synced 2026-05-06 15:24:02 +00:00
Payment plugin API: Add payment_presale_render
This commit is contained in:
@@ -6,7 +6,7 @@ from django import forms
|
||||
from django.core.exceptions import ValidationError
|
||||
from django.http import HttpRequest
|
||||
from django.template.loader import get_template
|
||||
from django.utils.translation import gettext_lazy as _
|
||||
from django.utils.translation import gettext, gettext_lazy as _
|
||||
from i18nfield.fields import I18nFormField, I18nTextarea
|
||||
from i18nfield.forms import I18nTextInput
|
||||
from i18nfield.strings import LazyI18nString
|
||||
@@ -282,6 +282,18 @@ class BankTransfer(BasePaymentProvider):
|
||||
def payment_partial_refund_supported(self, payment: OrderPayment) -> bool:
|
||||
return self.payment_refund_supported(payment)
|
||||
|
||||
def payment_presale_render(self, payment: OrderPayment) -> str:
|
||||
pi = payment.info_data or {}
|
||||
if self.payment_refund_supported(payment):
|
||||
try:
|
||||
iban = self.norm(pi['iban'])
|
||||
return gettext('Bank account {iban}').format(
|
||||
iban=iban[0:2] + '****' + iban[-4:]
|
||||
)
|
||||
except:
|
||||
pass
|
||||
return super().payment_presale_render(payment)
|
||||
|
||||
def execute_refund(self, refund: OrderRefund):
|
||||
"""
|
||||
We just keep a created refund object. It will be marked as done using the control view
|
||||
|
||||
Reference in New Issue
Block a user