Namur : keep historical bad id value (0.74 and 1.13) and return a dictionary with a good FEE key to datasource instead of list with a 'bad' id (id was the fee value)

This commit is contained in:
Christophe Boulanger 2018-03-07 13:36:08 +01:00
parent a402ea4d51
commit 16c3a201fd
1 changed files with 8 additions and 1 deletions

View File

@ -81,7 +81,7 @@ class ExtraFees(BaseResource):
max_doc_in_letter = 5
nb_documents = 0
nb_letter = 0
postage_fee = Decimal('0.74')
postage_fee = Decimal(self.belgium_postage_fee)
# Balaie chaque elem du panier pour gerer les exceptions.
for basket_item in data['data']:
if 'demande-de-changement-d-adresse-domicile' in basket_item['request_data']['form_slug']:
@ -118,6 +118,13 @@ class ExtraFees(BaseResource):
data = self.default_compute(request, **kwargs)
return data
# Namur : historical Namur datasource use id like fees value.
# So, we need to keep 0.74 and 1.13 like id and use fee key to get real fee value.
@endpoint()
def namur_fees(self, request):
return {'data':[{'id':'0.74','fee':self.belgium_postage_fee,'text':'En Belgique'},
{'id':'1.13','fee':self.europe_postage_fee,'text':' l\'étranger'}]}
# wcs : new webservice call : https://[COMMUNE]-passerelle.guichet-citoyen.be/extra-fees/[CONNECTOR-SLUG]/fees
# datasources : webservice.fees.get('belgium')
@endpoint()