Skip to content

Commit

Permalink
Merge pull request #5 from romatallinn/v0.0.6
Browse files Browse the repository at this point in the history
V0.0.6
  • Loading branch information
MrLightful authored Mar 8, 2024
2 parents 496636c + ef198e7 commit 83681b2
Show file tree
Hide file tree
Showing 8 changed files with 32 additions and 24 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
## 0.0.6

Quickfix: fix data argument in Payment's capture_sale method for passing split data.

## 0.0.5

Quickfix: fix circular import in `base_request.py` introduced in v0.0.4.
Expand Down
2 changes: 1 addition & 1 deletion braspag_sdk/apps/payments/requests/update_sale.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,4 +34,4 @@ def execute(self, payment_id):
if self.data:
data = self.data

return self.send_request('PUT', uri, params=params, data=data)
return self.send_request('PUT', uri, data, params)
7 changes: 1 addition & 6 deletions braspag_sdk/apps/payments/services.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,16 +16,11 @@ def create_sale(self, sale: Sale):
request = CreateSale(self.merchant_credentials, self._environment)
return request.execute(sale)

def capture_sale(self, payment_id: str, amount=None, service_tax_amount=None, **kwargs):
def capture_sale(self, payment_id: str, amount=None, service_tax_amount=None, data=None):
request = UpdateSale('capture', self.merchant_credentials, self._environment)
request.amount = amount
request.service_tax_amount = service_tax_amount

data = None
if kwargs:
data = json.dumps(kwargs)
request.data = data

return request.execute(payment_id)

def cancel_sale(self, payment_id: str, amount=None):
Expand Down
9 changes: 9 additions & 0 deletions braspag_sdk/apps/split/data/split_payment.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
from typing import List

from braspag_sdk.utils import ObjectJSON


Expand All @@ -14,3 +16,10 @@ def __init__(self, subordinate_merchant_id, amount, mdr=None, fee=None):
self.subordinate_merchant_id = subordinate_merchant_id
self.amount = amount
self.fares = SplitPaymentFares(mdr, fee)


class SplitPaymentsCapture(ObjectJSON):
""" Data model for when capturing payment with a split. """

def __init__(self, split_payments: List[SplitPayment]):
self.split_payments = split_payments
2 changes: 2 additions & 0 deletions braspag_sdk/utils/base_request.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@ def send_request(self, method, uri, data=None, params=None):
headers['Content-Length'] = '0'
elif isinstance(data, ObjectJSON):
body = body.toJSON()
else:
body = json.dumps(body)

if 'Content-Type' not in headers:
headers["Content-Type"] = "application/json"
Expand Down
13 changes: 7 additions & 6 deletions poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.poetry]
name = "braspag-sdk"
version = "0.0.5"
version = "0.0.6"
description = "An unofficial Python SDK for Braspag"
authors = [
"Roman Sirokov <[email protected]>",
Expand All @@ -26,7 +26,7 @@ classifiers = [

[tool.poetry.dependencies]
python = ">=3.7,<4.0"
future = "^0.18.3"
future = "^1.0.0"
requests = "^2.31.0"


Expand Down
15 changes: 6 additions & 9 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
appdirs==1.4.4 ; python_version >= "3.12" and python_version < "4.0"
certifi==2023.11.17 ; python_version >= "3.12" and python_version < "4.0"
charset-normalizer==3.3.2 ; python_version >= "3.12" and python_version < "4.0"
future==0.18.3 ; python_version >= "3.12" and python_version < "4.0"
idna==3.6 ; python_version >= "3.12" and python_version < "4.0"
packaging==23.2 ; python_version >= "3.12" and python_version < "4.0"
pyparsing==3.1.1 ; python_version >= "3.12" and python_version < "4.0"
requests==2.31.0 ; python_version >= "3.12" and python_version < "4.0"
urllib3==2.1.0 ; python_version >= "3.12" and python_version < "4.0"
certifi==2024.2.2 ; python_version >= "3.7" and python_version < "4.0"
charset-normalizer==3.3.2 ; python_version >= "3.7" and python_version < "4.0"
future==1.0.0 ; python_version >= "3.7" and python_version < "4.0"
idna==3.6 ; python_version >= "3.7" and python_version < "4.0"
requests==2.31.0 ; python_version >= "3.7" and python_version < "4.0"
urllib3==2.0.7 ; python_version >= "3.7" and python_version < "4.0"

0 comments on commit 83681b2

Please sign in to comment.