Browse Source

_ItemCollection: added attr 'debitor_comment'

Fabian Peter Hammerle 4 years ago
parent
commit
65eafca56c
2 changed files with 11 additions and 0 deletions
  1. 4 0
      finoex/__init__.py
  2. 7 0
      tests/test_yaml.py

+ 4 - 0
finoex/__init__.py

@@ -136,11 +136,15 @@ class _ItemCollection():
     def __init__(
             self,
             debitor_address=None,
+            debitor_comment=None,
             items=None
             ):
         if debitor_address is not None:
             assert isinstance(debitor_address, str)
             self.debitor_address = debitor_address
+        if debitor_comment is not None:
+            assert isinstance(debitor_comment, str)
+            self.debitor_comment = debitor_comment
         if items is not None:
             assert isinstance(items, list)
             assert all([isinstance(i, Item) for i in items])

+ 7 - 0
tests/test_yaml.py

@@ -227,6 +227,7 @@ def get_order_a(items = True, discounts = True):
     order = finoex.Order(
             customer_id = u'customer',
             debitor_address='@home',
+            debitor_comment='important note',
             order_date = datetime.datetime(2016, 5, 8, 0, 18, 17),
             order_id = u'id',
             platform = u'platformπ',
@@ -265,6 +266,7 @@ def get_invoice(items = True, discounts = True):
             creditor = u'platformπ',
             debitor_id = u'customer',
             debitor_address='@home',
+            debitor_comment='important note',
             invoice_date = datetime.datetime(2016, 5, 8, 0, 18, 17),
             invoice_id = u'id',
             invoice_url = 'http://example.com/invoice.pdf',
@@ -394,6 +396,7 @@ reward: product
     [get_order_a(), u"""!order
 customer_id: customer
 debitor_address: '@home'
+debitor_comment: important note
 discounts:
 - !discount
   amount: !sum '1.23 EUR'
@@ -416,6 +419,7 @@ platform_view_url: http://i.dont.know
     [get_order_a(discounts = False), u"""!order
 customer_id: customer
 debitor_address: '@home'
+debitor_comment: important note
 items:
 - !item
   name: item a
@@ -501,6 +505,7 @@ price_brutto: !sum '1.23 EUR'
     [get_invoice(), u"""!invoice
 creditor: platformπ
 debitor_address: '@home'
+debitor_comment: important note
 debitor_id: customer
 discounts:
 - !discount
@@ -665,6 +670,7 @@ tracking_number: LX123456789CN
     [get_order_a(), u"""!order
 customer_id: customer
 debitor_address: '@home'
+debitor_comment: important note
 discounts:
 - !discount
   amount: !sum '1.23 EUR'
@@ -718,6 +724,7 @@ route_map: null
     [get_invoice(), u"""!invoice
 creditor: platformπ
 debitor_address: '@home'
+debitor_comment: important note
 debitor_id: customer
 invoice_date: 2016-05-08T00:18:17
 invoice_id: id