Selaa lähdekoodia

fix(donation): remove whitespace from IBAN in Jameica file

With IBAN containing whitespace, Jameica will refuse to import.
Nils Wisiol 7 vuotta sitten
vanhempi
commit
a6ff79453b

+ 2 - 2
api/desecapi/templates/emails/donation/desec-attachment-jameica.txt

@@ -18,7 +18,7 @@
     <empfaenger_name type="java.lang.String">{{ donation.name | clean }}</empfaenger_name>
 
     {# IBAN of the account that will be charged [sic!] #}
-    <empfaenger_konto type="java.lang.String">{{ complete_iban | clean }}</empfaenger_konto>
+    <empfaenger_konto type="java.lang.String">{{ complete_iban | clean | remove_whitespaces }}</empfaenger_konto>
 
     {# 0 means this transaction was not yet executed #}
     <ausgefuehrt type="java.lang.Integer">0</ausgefuehrt>
@@ -39,7 +39,7 @@
     <sequencetype type="java.lang.String">OOFF</sequencetype>
 
     {# BIC of the account that will be charged #}
-    <empfaenger_bic type="java.lang.String">{{ donation.bic | clean }}</empfaenger_bic>
+    <empfaenger_bic type="java.lang.String">{{ donation.bic | clean | remove_whitespaces }}</empfaenger_bic>
 
     {# Jameica account id (this likely needs to be changed after import) #}
     <konto_id type="java.lang.Integer">1</konto_id>

+ 6 - 0
api/desecapi/templatetags/sepa_extras.py

@@ -11,4 +11,10 @@ def clean(value):
     cleaned = re.sub(r'[^A-Za-z0-9 ]','',normalized)
     return cleaned
 
+def remove_whitespaces(value):
+    """removes whitespace from the string"""
+    cleaned = re.sub(r'[\s]','',value)
+    return cleaned
+
 register.filter('clean', clean)
+register.filter('remove_whitespaces', remove_whitespaces)