Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions tests/test_api_client/test_repeating_invoice.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
from xero_python.accounting.models.repeating_invoice import RepeatingInvoice


def test_repeating_invoice_exposes_total_discount():
invoice = RepeatingInvoice(total_discount=12.5)

assert RepeatingInvoice.attribute_map["total_discount"] == "TotalDiscount"
assert RepeatingInvoice.openapi_types["total_discount"] == "float"
assert invoice.total_discount == 12.5
29 changes: 29 additions & 0 deletions xero_python/accounting/models/repeating_invoice.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ class RepeatingInvoice(BaseModel):
"sub_total": "float",
"total_tax": "float",
"total": "float",
"total_discount": "float",
"repeating_invoice_id": "str",
"id": "str",
"has_attachments": "bool",
Expand All @@ -65,6 +66,7 @@ class RepeatingInvoice(BaseModel):
"sub_total": "SubTotal",
"total_tax": "TotalTax",
"total": "Total",
"total_discount": "TotalDiscount",
"repeating_invoice_id": "RepeatingInvoiceID",
"id": "ID",
"has_attachments": "HasAttachments",
Expand All @@ -89,6 +91,7 @@ def __init__(
sub_total=None,
total_tax=None,
total=None,
total_discount=None,
repeating_invoice_id=None,
id=None,
has_attachments=False,
Expand All @@ -112,6 +115,7 @@ def __init__(
self._sub_total = None
self._total_tax = None
self._total = None
self._total_discount = None
self._repeating_invoice_id = None
self._id = None
self._has_attachments = None
Expand Down Expand Up @@ -146,6 +150,8 @@ def __init__(
self.total_tax = total_tax
if total is not None:
self.total = total
if total_discount is not None:
self.total_discount = total_discount
if repeating_invoice_id is not None:
self.repeating_invoice_id = repeating_invoice_id
if id is not None:
Expand Down Expand Up @@ -449,6 +455,29 @@ def total(self, total):

self._total = total

@property
def total_discount(self):
"""Gets the total_discount of this RepeatingInvoice. # noqa: E501

Total of discounts applied on the invoice line items # noqa: E501

:return: The total_discount of this RepeatingInvoice. # noqa: E501
:rtype: float
"""
return self._total_discount

@total_discount.setter
def total_discount(self, total_discount):
"""Sets the total_discount of this RepeatingInvoice.

Total of discounts applied on the invoice line items # noqa: E501

:param total_discount: The total_discount of this RepeatingInvoice. # noqa: E501
:type: float
"""

self._total_discount = total_discount

@property
def repeating_invoice_id(self):
"""Gets the repeating_invoice_id of this RepeatingInvoice. # noqa: E501
Expand Down