[TELE-695] use json_loads function to deal with encoding (#46833)

This commit is contained in:
Daniel Muyshond 2020-09-22 16:21:11 +02:00
parent 647aac8563
commit 9ff47a0387
1 changed files with 4 additions and 3 deletions

View File

@ -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)