summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDaniel Muyshond <daniel.muyshond@gmail.com>2020-09-22 14:21:11 (GMT)
committerDaniel Muyshond <daniel.muyshond@gmail.com>2020-09-22 14:21:11 (GMT)
commit9ff47a03878cccd4eaac306d9a37483c9fc16ceb (patch)
tree3664d1126f21d6709598d92a7fc4b69bf1783ac4
parent647aac856340247b3511b0423d3c61f035fdad42 (diff)
downloadpasserelle-imio-extra-fees-9ff47a03878cccd4eaac306d9a37483c9fc16ceb.zip
passerelle-imio-extra-fees-9ff47a03878cccd4eaac306d9a37483c9fc16ceb.tar.gz
passerelle-imio-extra-fees-9ff47a03878cccd4eaac306d9a37483c9fc16ceb.tar.bz2
[TELE-695] use json_loads function to deal with encoding (#46833)
-rw-r--r--passerelle_imio_extra_fees/models.py7
1 files changed, 4 insertions, 3 deletions
diff --git a/passerelle_imio_extra_fees/models.py b/passerelle_imio_extra_fees/models.py
index a460c0b..80d3dbc 100644
--- a/passerelle_imio_extra_fees/models.py
+++ b/passerelle_imio_extra_fees/models.py
@@ -16,7 +16,7 @@
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
-import json
+
from django.core.validators import MaxValueValidator, MinValueValidator
from django.db import models
@@ -24,6 +24,7 @@ from django.utils.encoding import force_text
from django.utils.translation import ugettext_lazy as _
from passerelle.base.models import BaseResource
+from passerelle.compat import json_loads
from passerelle.utils.api import endpoint
from decimal import Decimal
@@ -57,7 +58,7 @@ class ExtraFees(BaseResource):
def default_compute(self, request, **kwargs):
nb_documents = 0
nb_letter = 0
- data = json.loads(request.body.decode('utf-8'))
+ data = json_loads(request.body.decode('utf-8'))
postage_fee = Decimal(self.belgium_postage_fee)
for basket_item in data['data']:
try:
@@ -72,7 +73,7 @@ class ExtraFees(BaseResource):
return {'data': [{'subject': force_text(_('Postage')), 'amount': str(postage_fee)}]}
def namur_compute(self, request, **kwargs):
- data = json.loads(request.body)
+ data = json_loads(request.body)
# EXCEPTIONS :
# duplicata-de-livret-de-mariage (frais port 8 ou 13)
# demande-de-changement-d-adresse-domicile (frais port 0)