From 319c67ecfde694cfe871761ccd06d3c1f8b95a47 Mon Sep 17 00:00:00 2001 From: Russell Pollari Date: Tue, 10 Sep 2024 21:22:02 -0400 Subject: [PATCH] Add batch_id as optional argument when creating invoce payment --- trolley/invoice_payment_gateway.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/trolley/invoice_payment_gateway.py b/trolley/invoice_payment_gateway.py index 87acd39..e1dd2c6 100644 --- a/trolley/invoice_payment_gateway.py +++ b/trolley/invoice_payment_gateway.py @@ -14,15 +14,19 @@ def __init__(self, gateway, config): self.config = config """ Creates a new Invoice Payment. """ - def create(self, body): + def create(self, body, batch_id=None): if body is None: raise InvalidFieldException("Body cannot be None.") if not isinstance(body, list): raise InvalidFieldException("Body must be of type list") - + if batch_id is not None and not isinstance(batch_id, str): + raise InvalidFieldException("Batch ID must be of type str") + payload = { 'ids' : body } + if batch_id is not None: + payload['batchId'] = batch_id endpoint = f'/v1/invoices/payment/create' response = trolley.Configuration.client(