summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDaniel Muyshond <daniel.muyshond@gmail.com>2020-10-05 14:23:55 (GMT)
committerDaniel Muyshond <daniel.muyshond@gmail.com>2020-10-05 14:23:55 (GMT)
commit6d59e18defeca58b4c2097d4c1f5626fff0179c7 (patch)
tree02da5e25c84deaa52e340eb797366384ff9a5686
parentea7e0e3faa3fd617b3d9e0f4855b143f6834bb51 (diff)
downloadpasserelle-imio-extra-fees-6d59e18defeca58b4c2097d4c1f5626fff0179c7.zip
passerelle-imio-extra-fees-6d59e18defeca58b4c2097d4c1f5626fff0179c7.tar.gz
passerelle-imio-extra-fees-6d59e18defeca58b4c2097d4c1f5626fff0179c7.tar.bz2
[TELE-694] fix postage fees is sended by mail
-rw-r--r--passerelle_imio_extra_fees/models.py4
1 files changed, 4 insertions, 0 deletions
diff --git a/passerelle_imio_extra_fees/models.py b/passerelle_imio_extra_fees/models.py
index c1a61f2..23a8590 100644
--- a/passerelle_imio_extra_fees/models.py
+++ b/passerelle_imio_extra_fees/models.py
@@ -69,6 +69,10 @@ class ExtraFees(BaseResource):
# basket item not associated with any document, no fee
pass
nb_letter = int(nb_documents / int(self.max_doc_in_letter)) + (((nb_documents % int(self.max_doc_in_letter)) > 0) and 1 or 0)
+ # Check is the item in send by mail and if so there is no postage_fee
+ destination = basket_item["request_data"]["form_var_destinations_raw"]
+ if destination and "mail" in destination:
+ postage_fee = 0
postage_fee = nb_letter * postage_fee
return {'data': [{'subject': force_text(_('Postage')), 'amount': str(postage_fee)}]}