Skip to content

Commit 83681b2

Browse files
authored
Merge pull request #5 from romatallinn/v0.0.6
V0.0.6
2 parents 496636c + ef198e7 commit 83681b2

8 files changed

Lines changed: 32 additions & 24 deletions

File tree

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
## 0.0.6
2+
3+
Quickfix: fix data argument in Payment's capture_sale method for passing split data.
4+
15
## 0.0.5
26

37
Quickfix: fix circular import in `base_request.py` introduced in v0.0.4.

braspag_sdk/apps/payments/requests/update_sale.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,4 +34,4 @@ def execute(self, payment_id):
3434
if self.data:
3535
data = self.data
3636

37-
return self.send_request('PUT', uri, params=params, data=data)
37+
return self.send_request('PUT', uri, data, params)

braspag_sdk/apps/payments/services.py

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -16,16 +16,11 @@ def create_sale(self, sale: Sale):
1616
request = CreateSale(self.merchant_credentials, self._environment)
1717
return request.execute(sale)
1818

19-
def capture_sale(self, payment_id: str, amount=None, service_tax_amount=None, **kwargs):
19+
def capture_sale(self, payment_id: str, amount=None, service_tax_amount=None, data=None):
2020
request = UpdateSale('capture', self.merchant_credentials, self._environment)
2121
request.amount = amount
2222
request.service_tax_amount = service_tax_amount
23-
24-
data = None
25-
if kwargs:
26-
data = json.dumps(kwargs)
2723
request.data = data
28-
2924
return request.execute(payment_id)
3025

3126
def cancel_sale(self, payment_id: str, amount=None):

braspag_sdk/apps/split/data/split_payment.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
from typing import List
2+
13
from braspag_sdk.utils import ObjectJSON
24

35

@@ -14,3 +16,10 @@ def __init__(self, subordinate_merchant_id, amount, mdr=None, fee=None):
1416
self.subordinate_merchant_id = subordinate_merchant_id
1517
self.amount = amount
1618
self.fares = SplitPaymentFares(mdr, fee)
19+
20+
21+
class SplitPaymentsCapture(ObjectJSON):
22+
""" Data model for when capturing payment with a split. """
23+
24+
def __init__(self, split_payments: List[SplitPayment]):
25+
self.split_payments = split_payments

braspag_sdk/utils/base_request.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,8 @@ def send_request(self, method, uri, data=None, params=None):
3030
headers['Content-Length'] = '0'
3131
elif isinstance(data, ObjectJSON):
3232
body = body.toJSON()
33+
else:
34+
body = json.dumps(body)
3335

3436
if 'Content-Type' not in headers:
3537
headers["Content-Type"] = "application/json"

poetry.lock

Lines changed: 7 additions & 6 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pyproject.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[tool.poetry]
22
name = "braspag-sdk"
3-
version = "0.0.5"
3+
version = "0.0.6"
44
description = "An unofficial Python SDK for Braspag"
55
authors = [
66
"Roman Sirokov <sirokov@dizconto.com>",
@@ -26,7 +26,7 @@ classifiers = [
2626

2727
[tool.poetry.dependencies]
2828
python = ">=3.7,<4.0"
29-
future = "^0.18.3"
29+
future = "^1.0.0"
3030
requests = "^2.31.0"
3131

3232

requirements.txt

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,6 @@
1-
appdirs==1.4.4 ; python_version >= "3.12" and python_version < "4.0"
2-
certifi==2023.11.17 ; python_version >= "3.12" and python_version < "4.0"
3-
charset-normalizer==3.3.2 ; python_version >= "3.12" and python_version < "4.0"
4-
future==0.18.3 ; python_version >= "3.12" and python_version < "4.0"
5-
idna==3.6 ; python_version >= "3.12" and python_version < "4.0"
6-
packaging==23.2 ; python_version >= "3.12" and python_version < "4.0"
7-
pyparsing==3.1.1 ; python_version >= "3.12" and python_version < "4.0"
8-
requests==2.31.0 ; python_version >= "3.12" and python_version < "4.0"
9-
urllib3==2.1.0 ; python_version >= "3.12" and python_version < "4.0"
1+
certifi==2024.2.2 ; python_version >= "3.7" and python_version < "4.0"
2+
charset-normalizer==3.3.2 ; python_version >= "3.7" and python_version < "4.0"
3+
future==1.0.0 ; python_version >= "3.7" and python_version < "4.0"
4+
idna==3.6 ; python_version >= "3.7" and python_version < "4.0"
5+
requests==2.31.0 ; python_version >= "3.7" and python_version < "4.0"
6+
urllib3==2.0.7 ; python_version >= "3.7" and python_version < "4.0"

0 commit comments

Comments
 (0)