mirror of
https://github.com/pretix/pretix.git
synced 2026-05-09 15:54:03 +00:00
Bank transfer: Allow CAMT import (#5601)
This commit is contained in:
@@ -66,7 +66,7 @@ from pretix.control.permissions import (
|
||||
)
|
||||
from pretix.control.views.organizer import OrganizerDetailViewMixin
|
||||
from pretix.helpers.json import CustomJSONEncoder
|
||||
from pretix.plugins.banktransfer import csvimport, mt940import
|
||||
from pretix.plugins.banktransfer import camtimport, csvimport, mt940import
|
||||
from pretix.plugins.banktransfer.models import (
|
||||
BankImportJob, BankTransaction, RefundExport,
|
||||
)
|
||||
@@ -419,6 +419,9 @@ class ImportView(ListView):
|
||||
):
|
||||
return self.process_mt940()
|
||||
|
||||
elif 'file' in self.request.FILES and '.xml' in self.request.FILES.get('file').name.lower():
|
||||
return self.process_camt()
|
||||
|
||||
elif self.request.FILES.get('file') is None:
|
||||
messages.error(self.request, _('You must choose a file to import.'))
|
||||
return self.redirect_back()
|
||||
@@ -432,6 +435,14 @@ class ImportView(ListView):
|
||||
def settings(self):
|
||||
return SettingsSandbox('payment', 'banktransfer', getattr(self.request, 'event', self.request.organizer))
|
||||
|
||||
def process_camt(self):
|
||||
try:
|
||||
return self.start_processing(camtimport.parse(self.request.FILES.get('file')))
|
||||
except:
|
||||
logger.exception('Failed to import CAMT file')
|
||||
messages.error(self.request, _('We were unable to process your input.'))
|
||||
return self.redirect_back()
|
||||
|
||||
def process_mt940(self):
|
||||
try:
|
||||
return self.start_processing(mt940import.parse(self.request.FILES.get('file')))
|
||||
|
||||
Reference in New Issue
Block a user