Skip to content

Commit 49aadcc

Browse files
authored
Merge pull request #1 from romatallinn/v0.0.2
v0.0.2
2 parents 9f8f355 + 560af02 commit 49aadcc

13 files changed

Lines changed: 60 additions & 73 deletions

File tree

CHANGELOG.md

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
## 0.0.2
2+
3+
The release mostly meant to improve project & code quality.
4+
5+
- Clean code
6+
- Remove unused dependencies
7+
- Add CHANGELOG
8+
9+
*Breaking change:*
10+
- Add missing arguments to EMV3DS access token generation (`establishment_code`, `merchant_name`, `mcc`)
11+
12+
## 0.0.1
13+
14+
The first public release of the package.
15+
It integrates the most basic features of Braspag.
16+
17+
#### Features
18+
- SDK's core initialization with options
19+
- Payments integration (`create_sale`, `get_sale`, `capture_sale`, `cancel_sale`)
20+
- Split Payments integration (`create_split_merchant`)
21+
- Silent Order Post (SOP) integration (`get_access_token`)
22+
- EMV3DS integration (`get_access_token`)

README.md

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
# Braspag SDK for Python
22
[![PyPi page link -- version](https://img.shields.io/pypi/v/braspag-sdk.svg)](https://pypi.python.org/pypi/braspag-sdk)
3+
[![License](https://img.shields.io/github/license/romatallinn/braspagSdk-python)](LICENSE)
4+
35

46
An unofficial Python SDK for [Braspag](https://braspag.github.io/).
57

@@ -182,7 +184,10 @@ braspagSdk.payments.cancel_sale(payment_id, amount=...)
182184

183185
# Generate access token for EMV 3DS.
184186
# Learn more: https://braspag.github.io//manual/emv3ds#1.-criando-o-token-de-acesso
185-
braspagSdk.emv3ds.get_access_token()
187+
establishment_code = ...
188+
merchant_name = ...
189+
mcc = ...
190+
braspagSdk.emv3ds.get_access_token(establishment_code, merchant_name, mcc)
186191

187192
# Generate access token for Silent Order Post.
188193
# Learn more: https://braspag.github.io//manualp/braspag-silent-order-post#2.-obtendo-accesstoken-sop
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
from .get_access_token import *
1+
from .get_access_token import *

braspag_sdk/apps/emv3ds/requests/get_access_token.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,13 +17,13 @@ def __init__(self, *, emv3ds_credentials: EMV3DSCredentials, environment: EMV3DS
1717
super().__init__(authorization_headers=authorization_headers)
1818
self._environment = environment
1919

20-
def execute(self):
20+
def execute(self, establishment_code: str, merchant_name: str, mcc: str):
2121

2222
uri = '%s/v2/auth/token' % self._environment.mpi
2323
data = {
24-
"EstablishmentCode": "1006993069",
25-
"MerchantName": "Loja Exemplo Ltda",
26-
"MCC": "5912"
24+
"EstablishmentCode": establishment_code,
25+
"MerchantName": merchant_name,
26+
"MCC": mcc,
2727
}
2828

2929
response = self.send_request("POST", uri, data=data)

braspag_sdk/apps/emv3ds/services.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
from .environment import EMV3DSEnvironment
2-
from .data import *
31
from .requests import *
42

53

@@ -17,10 +15,10 @@ def __init__(
1715
self._environment = EMV3DSEnvironment(is_sandbox)
1816
self._emv3ds_credentials = emv3ds_credentials
1917

20-
def get_access_token(self):
18+
def get_access_token(self, establishment_code: str, merchant_name: str, mcc: str):
2119
request = AccessToken(
2220
emv3ds_credentials=self._emv3ds_credentials,
2321
environment=self._environment,
2422
)
25-
return request.execute()
23+
return request.execute(establishment_code, merchant_name, mcc)
2624

braspag_sdk/apps/payments/data/credit_card.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@ def __init__(self, security_code, brand):
1414
self.card_token = None
1515
self.customer_name = None
1616

17-
1817
def update_return(self, response_return):
1918

2019
self.card_token = response_return['CardToken']

braspag_sdk/apps/payments/data/payment.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212

1313
class Payment(ObjectJSON):
1414

15-
def __init__(self, amount, installments = 1):
15+
def __init__(self, amount, installments=1):
1616

1717
self.amount = amount
1818
self.service_tax_amount = None

braspag_sdk/apps/payments/services.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
from .environment import PaymentsEnvironment
21
from .data import *
32
from .requests import *
43

braspag_sdk/apps/sop/services.py

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
from datetime import datetime, timedelta
2-
31
from .requests import *
42

53

@@ -35,4 +33,3 @@ def get_access_token(self):
3533
environment=self._environment,
3634
)
3735
return request.execute()
38-

braspag_sdk/utils/base_request.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,12 @@ def send_request(self, method, uri, data=None, params=None):
5151
data_send = body
5252
if not isinstance(data_send, dict):
5353
data_send = json.loads(data_send or 'null')
54-
raise_with_traceback(Exception('\r\n%s\r\nMethod: %s\r\nUri: %s\r\nData: %s' % (response.content, method, response.url, json.dumps(data_send, indent=2))))
54+
raise_with_traceback(Exception(
55+
'\r\n%s\r\n'
56+
'Method: %s\r\n'
57+
'Uri: %s\r\n'
58+
'Data: %s' % (response.content, method, response.url, json.dumps(data_send, indent=2))
59+
))
5560

5661
return answers
5762

0 commit comments

Comments
 (0)