Browse Source

wpint: Allow user to specify shipment_nature and customer_reference

master
Harald Welte 5 months ago
parent
commit
dd8b8d7320
  1. 9
      inema/wpint.py

9
inema/wpint.py

@ -215,7 +215,7 @@ class WarenpostInt(object):
return ret
def build_item(self, product, sender, recipient, weight_grams, amount=0, currency='EUR',
contents=None):
shipment_nature='SALE_GOODS', customer_reference=None, contents=None):
"""Build an 'item' in the language of the WaPoInt API. Represents one shipment."""
weight_grams = int(weight_grams)
if weight_grams > 2000:
@ -228,13 +228,18 @@ class WarenpostInt(object):
'shipmentAmount': int(amount),
'shipmentCurrency': currency,
'shipmentGrossWeight': weight_grams,
'shipmentNaturetype': 'SALE_GOODS',
'shipmentNaturetype': shipment_nature,
}
# merge in the sender and recipient fields
ret.update(sender.as_sender())
ret.update(recipient.as_recipient())
if contents:
ret['contents'] = contents
if customer_reference:
customer_reference = str(customer_reference)
if len(customer_reference) > 20:
raise ValueError('Maximum length of customer reference is 20 chars')
ret['custRef'] = customer_reference
return ret
def build_order(self, items, contact_name, order_status='FINALIZE'):

Loading…
Cancel
Save