From db0a0fb7ae5b8597e7c1a838728cdd0e28ec2a90 Mon Sep 17 00:00:00 2001 From: Harald Welte Date: Sun, 7 Mar 2021 14:07:39 +0100 Subject: [PATCH] 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" --- inema/wpint.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/inema/wpint.py b/inema/wpint.py index cd8788b..37faa4b 100644 --- a/inema/wpint.py +++ b/inema/wpint.py @@ -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',