Egon Payment compatibility
* EGON expects the payment amount to be a localized string instead of float * adds transformation for this
This commit is contained in:
parent
0f08071ca6
commit
2c493d33dc
@ -11,6 +11,7 @@ import json
|
|||||||
import pika
|
import pika
|
||||||
import xmltodict
|
import xmltodict
|
||||||
from django.db.models import Sum
|
from django.db.models import Sum
|
||||||
|
from django.utils import formats
|
||||||
|
|
||||||
from intervention.settings import EGON_RABBITMQ_HOST, EGON_RABBITMQ_USER, EGON_RABBITMQ_PW, EGON_RABBITMQ_PORT
|
from intervention.settings import EGON_RABBITMQ_HOST, EGON_RABBITMQ_USER, EGON_RABBITMQ_PW, EGON_RABBITMQ_PORT
|
||||||
from konova.sub_settings.django_settings import DEFAULT_DATE_FORMAT
|
from konova.sub_settings.django_settings import DEFAULT_DATE_FORMAT
|
||||||
@ -92,6 +93,9 @@ class EgonGmlBuilder:
|
|||||||
)["summed"]
|
)["summed"]
|
||||||
return all_payments
|
return all_payments
|
||||||
|
|
||||||
|
def _float_to_localized_string(self, value: float):
|
||||||
|
return formats.number_format(value, use_l10n=True, decimal_pos=2)
|
||||||
|
|
||||||
def _gen_kompensationsArt(self) -> (str, int):
|
def _gen_kompensationsArt(self) -> (str, int):
|
||||||
comp_type = "Ersatzzahlung"
|
comp_type = "Ersatzzahlung"
|
||||||
comp_type_code = 774898901
|
comp_type_code = 774898901
|
||||||
@ -191,7 +195,7 @@ class EgonGmlBuilder:
|
|||||||
"@xlink:href": f"http://register.naturschutz.rlp.de/repository/services/referenzliste/1053/{reg_office.atom_id if reg_office else None}",
|
"@xlink:href": f"http://register.naturschutz.rlp.de/repository/services/referenzliste/1053/{reg_office.atom_id if reg_office else None}",
|
||||||
"#text": reg_office.long_name if reg_office else None
|
"#text": reg_office.long_name if reg_office else None
|
||||||
},
|
},
|
||||||
"oneo:ersatzzahlung": self._sum_all_payments(),
|
"oneo:ersatzzahlung": self._float_to_localized_string(self._sum_all_payments()),
|
||||||
"oneo:kompensationsart": {
|
"oneo:kompensationsart": {
|
||||||
"@xlink:href": f"http://register.naturschutz.rlp.de/repository/services/referenzliste/88140/{comp_type_code}",
|
"@xlink:href": f"http://register.naturschutz.rlp.de/repository/services/referenzliste/88140/{comp_type_code}",
|
||||||
"#text": comp_type
|
"#text": comp_type
|
||||||
|
Loading…
Reference in New Issue
Block a user