Skip to content

Commit 056a43e

Browse files
committed
add substitution
1 parent d8875ce commit 056a43e

File tree

2 files changed

+6
-3
lines changed

2 files changed

+6
-3
lines changed

facturapi/resources/invoices.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -182,7 +182,7 @@ def create(cls, data: InvoiceRequest) -> 'Invoice':
182182
return cast('Invoice', cls._create(**cleaned_data))
183183

184184
@classmethod
185-
def cancel(cls, invoice_id: str, motive: str) -> 'Invoice':
185+
def cancel(cls, invoice_id: str, motive: str, substitution: Optional[str] = None) -> 'Invoice':
186186
"""Cancel an invoice.
187187
188188
Calls a DELETE request on invoice resource.
@@ -194,7 +194,10 @@ def cancel(cls, invoice_id: str, motive: str) -> 'Invoice':
194194
Invoice: The cancelled invoice resource.
195195
196196
"""
197-
return cast('Invoice', cls._delete(invoice_id, **dict(motive=motive)))
197+
data = dict(motive=motive)
198+
if substitution:
199+
data['substitution'] = substitution
200+
return cast('Invoice', cls._delete(invoice_id, **data))
198201

199202
@property
200203
def customer(self) -> Customer:

facturapi/version.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
__version__ = '0.1.2.dev0' # pragma: no cover
1+
__version__ = '0.1.2.dev1' # pragma: no cover
22
CLIENT_VERSION = __version__

0 commit comments

Comments
 (0)