Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: add batch_id as optional argument when creating invoice payment #31

Open
wants to merge 1 commit into
base: dev
Choose a base branch
from
Open
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
8 changes: 6 additions & 2 deletions trolley/invoice_payment_gateway.py
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down