wpint: No more than 5 line items on the CN22 declaration allowed

Otherwise the API will generate the following error:
        "items[0].contents: size must be between 0 and 5"
This commit is contained in:
Harald Welte 2021-03-07 14:07:39 +01:00
parent dd8b8d7320
commit db0a0fb7ae
1 changed files with 2 additions and 0 deletions

View File

@ -222,6 +222,8 @@ class WarenpostInt(object):
raise ValueError('Maximum item gross weight is 2000g')
if len(currency) != 3:
raise ValueError('Currency must be expressed as 3-digit ISO-4217 code')
if contents and len(contents) > 5:
raise ValueError('Custom Contents must not contain more than 5 lines')
ret = {
'product': str(product),
'serviceLevel': 'STANDARD',