Skip to content

Commit 28e1111

Browse files
committed
change data to recipients
1 parent 53db6a8 commit 28e1111

File tree

2 files changed

+10
-6
lines changed

2 files changed

+10
-6
lines changed

facturapi/resources/invoices.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -194,7 +194,9 @@ def cancel(cls, invoice_id: str, motive: str) -> 'Invoice':
194194

195195
@classmethod
196196
def send_by_email(
197-
cls, invoice_id: str, data: Optional[Union[str, List[str]]] = None
197+
cls,
198+
invoice_id: str,
199+
recipients: Optional[Union[str, List[str]]] = None,
198200
) -> bool:
199201
"""Send an invoice by email.
200202
@@ -203,7 +205,7 @@ def send_by_email(
203205
204206
Args:
205207
invoice_id: The ID of the invoice to send.
206-
data: The email addresses to send the invoice to.
208+
recipients: The email addresses to send the invoice to.
207209
If not provided, the invoice will be sent to the customer's
208210
registered email.
209211
@@ -219,8 +221,8 @@ def send_by_email(
219221

220222
endpoint = f"{cls._resource}/{invoice_id}/email"
221223
payload = {}
222-
if isinstance(data, (str, list)):
223-
payload["email"] = data
224+
if isinstance(recipients, (str, list)):
225+
payload["email"] = recipients
224226
response = client.post(endpoint, payload)
225227
return response.get("ok", False)
226228

tests/resources/test_invoices.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -116,8 +116,10 @@ def test_send_invoice_by_email_without_email():
116116
def test_send_invoice_by_email_with_email():
117117
invoice_id = "67e59a55f4f823d3d978f3cb"
118118
email = "frida_kahlo@test.com"
119-
data = [email]
120-
resp = facturapi.Invoice.send_by_email(invoice_id=invoice_id, data=data)
119+
recipients = [email]
120+
resp = facturapi.Invoice.send_by_email(
121+
invoice_id=invoice_id, recipients=recipients
122+
)
121123

122124
assert resp is True
123125

0 commit comments

Comments
 (0)