delfinance-python-sdk 0.0.4__tar.gz → 0.0.6__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (39) hide show
  1. delfinance_python_sdk-0.0.6/Dockerfile +11 -0
  2. {delfinance_python_sdk-0.0.4 → delfinance_python_sdk-0.0.6}/Jenkinsfile +1 -1
  3. {delfinance_python_sdk-0.0.4 → delfinance_python_sdk-0.0.6}/PKG-INFO +13 -1
  4. {delfinance_python_sdk-0.0.4 → delfinance_python_sdk-0.0.6}/README.md +12 -0
  5. {delfinance_python_sdk-0.0.4 → delfinance_python_sdk-0.0.6}/docker-compose.yml +1 -0
  6. {delfinance_python_sdk-0.0.4 → delfinance_python_sdk-0.0.6}/requirements.txt +2 -1
  7. delfinance_python_sdk-0.0.6/src/delfinance/transfers/interfaces/ipix_service.py +25 -0
  8. delfinance_python_sdk-0.0.6/src/delfinance/transfers/requests/decode_qr_code_request.py +10 -0
  9. delfinance_python_sdk-0.0.6/src/delfinance/transfers/requests/payment_initialization_request.py +12 -0
  10. delfinance_python_sdk-0.0.6/src/delfinance/transfers/responses/decode_qr_code_response.py +55 -0
  11. delfinance_python_sdk-0.0.4/src/delfinance/transfers/dto/transfer_dto.py → delfinance_python_sdk-0.0.6/src/delfinance/transfers/responses/get_transfer_response.py +3 -2
  12. delfinance_python_sdk-0.0.6/src/delfinance/transfers/responses/payment_initialization_response.py +15 -0
  13. delfinance_python_sdk-0.0.6/src/delfinance/transfers/services/pix_service.py +98 -0
  14. {delfinance_python_sdk-0.0.4 → delfinance_python_sdk-0.0.6}/src/delfinance/transfers/services/transfers_service.py +1 -3
  15. {delfinance_python_sdk-0.0.4 → delfinance_python_sdk-0.0.6}/src/delfinance_python_sdk.egg-info/PKG-INFO +13 -1
  16. {delfinance_python_sdk-0.0.4 → delfinance_python_sdk-0.0.6}/src/delfinance_python_sdk.egg-info/SOURCES.txt +7 -2
  17. delfinance_python_sdk-0.0.4/Dockerfile +0 -10
  18. delfinance_python_sdk-0.0.4/src/delfinance/transfers/responses/get_transfer_response.py +0 -8
  19. {delfinance_python_sdk-0.0.4 → delfinance_python_sdk-0.0.6}/.Jenkinsfiles/master.groovy +0 -0
  20. {delfinance_python_sdk-0.0.4 → delfinance_python_sdk-0.0.6}/.env.example +0 -0
  21. {delfinance_python_sdk-0.0.4 → delfinance_python_sdk-0.0.6}/.gitignore +0 -0
  22. {delfinance_python_sdk-0.0.4 → delfinance_python_sdk-0.0.6}/main.py +0 -0
  23. {delfinance_python_sdk-0.0.4 → delfinance_python_sdk-0.0.6}/openapi/openapi.yaml +0 -0
  24. {delfinance_python_sdk-0.0.4 → delfinance_python_sdk-0.0.6}/openapi/swagger.html +0 -0
  25. {delfinance_python_sdk-0.0.4 → delfinance_python_sdk-0.0.6}/setup.cfg +0 -0
  26. {delfinance_python_sdk-0.0.4 → delfinance_python_sdk-0.0.6}/setup.py +0 -0
  27. {delfinance_python_sdk-0.0.4 → delfinance_python_sdk-0.0.6}/src/delfinance/__init__.py +0 -0
  28. {delfinance_python_sdk-0.0.4 → delfinance_python_sdk-0.0.6}/src/delfinance/abstractions/enums/__init__.py +0 -0
  29. {delfinance_python_sdk-0.0.4 → delfinance_python_sdk-0.0.6}/src/delfinance/abstractions/enums/environment.py +0 -0
  30. {delfinance_python_sdk-0.0.4 → delfinance_python_sdk-0.0.6}/src/delfinance/abstractions/startup/__init__.py +0 -0
  31. {delfinance_python_sdk-0.0.4 → delfinance_python_sdk-0.0.6}/src/delfinance/abstractions/startup/delfinance_client.py +0 -0
  32. {delfinance_python_sdk-0.0.4/src/delfinance/transfers/dto → delfinance_python_sdk-0.0.6/src/delfinance/transfers/interfaces}/__init__.py +0 -0
  33. {delfinance_python_sdk-0.0.4 → delfinance_python_sdk-0.0.6}/src/delfinance/transfers/interfaces/itransfers_service.py +0 -0
  34. {delfinance_python_sdk-0.0.4/src/delfinance/transfers/interfaces → delfinance_python_sdk-0.0.6/src/delfinance/transfers/requests}/__init__.py +0 -0
  35. {delfinance_python_sdk-0.0.4 → delfinance_python_sdk-0.0.6}/src/delfinance/transfers/responses/__init__.py +0 -0
  36. {delfinance_python_sdk-0.0.4 → delfinance_python_sdk-0.0.6}/src/delfinance/transfers/services/__init__.py +0 -0
  37. {delfinance_python_sdk-0.0.4 → delfinance_python_sdk-0.0.6}/src/delfinance_python_sdk.egg-info/dependency_links.txt +0 -0
  38. {delfinance_python_sdk-0.0.4 → delfinance_python_sdk-0.0.6}/src/delfinance_python_sdk.egg-info/requires.txt +0 -0
  39. {delfinance_python_sdk-0.0.4 → delfinance_python_sdk-0.0.6}/src/delfinance_python_sdk.egg-info/top_level.txt +0 -0
@@ -0,0 +1,11 @@
1
+ FROM python:3.7-slim
2
+
3
+ WORKDIR /app
4
+
5
+ COPY requirements.txt .
6
+ RUN pip install --no-cache-dir -r requirements.txt
7
+
8
+ COPY . .
9
+
10
+ # Iniciar com debugpy ouvindo na porta 5678 e aguardando conexão
11
+ CMD ["python", "-m", "debugpy", "--listen", "0.0.0.0:5678", "--wait-for-client", "main.py"]
@@ -24,7 +24,7 @@ pipeline {
24
24
  }
25
25
  agent {
26
26
  docker {
27
- image 'python:3.12-slim'
27
+ image 'python:3.7-slim'
28
28
  args '--entrypoint="" -u root'
29
29
  }
30
30
  }
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: delfinance-python-sdk
3
- Version: 0.0.4
3
+ Version: 0.0.6
4
4
  Summary: SDK oficial da Delfinance para Python
5
5
  Home-page: https://github.com/delfinance/python-sdk
6
6
  Author: Delfinance Team
@@ -124,3 +124,15 @@ Para testes e desenvolvimento local:
124
124
  docker-compose up --build
125
125
  ```
126
126
  Isso iniciará uma aplicação Flask simples que executa um teste de integração e exibe o resultado em `http://localhost:8080`.
127
+
128
+ ## 8. Depuração
129
+
130
+ O ambiente Docker está configurado para suportar depuração remota via `debugpy` na porta **5678**.
131
+
132
+ ### Usando VS Code
133
+
134
+ 1. Inicie o ambiente com `docker-compose up --build`.
135
+ 2. No VS Code, abra a aba "Run and Debug" (Ctrl+Shift+D).
136
+ 3. Selecione a configuração **"Docker: Remote Attach"**.
137
+ 4. Pressione **F5** para conectar o depurador ao container.
138
+ 5. Defina breakpoints no código e acesse `http://localhost:8080` para disparar a execução.
@@ -97,3 +97,15 @@ Para testes e desenvolvimento local:
97
97
  docker-compose up --build
98
98
  ```
99
99
  Isso iniciará uma aplicação Flask simples que executa um teste de integração e exibe o resultado em `http://localhost:8080`.
100
+
101
+ ## 8. Depuração
102
+
103
+ O ambiente Docker está configurado para suportar depuração remota via `debugpy` na porta **5678**.
104
+
105
+ ### Usando VS Code
106
+
107
+ 1. Inicie o ambiente com `docker-compose up --build`.
108
+ 2. No VS Code, abra a aba "Run and Debug" (Ctrl+Shift+D).
109
+ 3. Selecione a configuração **"Docker: Remote Attach"**.
110
+ 4. Pressione **F5** para conectar o depurador ao container.
111
+ 5. Defina breakpoints no código e acesse `http://localhost:8080` para disparar a execução.
@@ -8,5 +8,6 @@ services:
8
8
  - .:/app
9
9
  ports:
10
10
  - "8080:80"
11
+ - "5678:5678"
11
12
  tty: true
12
13
  stdin_open: true
@@ -1,4 +1,5 @@
1
1
  requests==2.31.0
2
2
  python-dotenv==0.21.1
3
3
  flask==2.2.5
4
- setuptools_scm==9.2.2
4
+ debugpy==1.7.0
5
+ setuptools_scm==7.1.0
@@ -0,0 +1,25 @@
1
+ from abc import ABC, abstractmethod
2
+
3
+ class IPixService(ABC):
4
+ """
5
+ Interface IPixService
6
+ """
7
+ @abstractmethod
8
+ def payment_initialization(self, request):
9
+ """
10
+ Initializes a Pix payment using a DICT key.
11
+
12
+ :param request: PaymentInitializationRequest
13
+ :return: PaymentInitializationResponse
14
+ """
15
+ pass
16
+
17
+ @abstractmethod
18
+ def decode_qr_code(self, request):
19
+ """
20
+ Initializes a Pix payment using a QR Code payload.
21
+
22
+ :param request: DecodeQrCodeRequest
23
+ :return: DecodeQrCodeResponse
24
+ """
25
+ pass
@@ -0,0 +1,10 @@
1
+ class DecodeQrCodeRequest:
2
+ """
3
+ Request payload for initializing a Pix payment via QR Code.
4
+ """
5
+ def __init__(self, payload: str):
6
+ """
7
+ DecodeQrCodeRequest constructor.
8
+ :param payload: The raw QR Code string
9
+ """
10
+ self.payload = payload
@@ -0,0 +1,12 @@
1
+ class PaymentInitializationRequest:
2
+ """
3
+ Request payload for initializing a Pix payment.
4
+ """
5
+ def __init__(self, key: str, holder_document: str = None):
6
+ """
7
+ PaymentInitializationRequest constructor.
8
+ :param key: The DICT key
9
+ :param holder_document: (Optional) The document of the key holder
10
+ """
11
+ self.key = key
12
+ self.holder_document = holder_document
@@ -0,0 +1,55 @@
1
+ class DecodeQrCodeResponse:
2
+ """
3
+ Response object for QR Code decoding.
4
+ """
5
+ def __init__(self, data: dict = None):
6
+ self.key = None
7
+ self.end_to_end_id = None
8
+ self.transaction_id = None
9
+ self.expiration_time = None
10
+ self.revision = None
11
+ self.allow_change_amount = None
12
+ self.category_code = None
13
+ self.created_at = None
14
+ self.captured_at = None
15
+ self.type = None
16
+ self.status = None
17
+ self.amount = None
18
+ self.original_amount = None
19
+ self.fine_amount = None
20
+ self.fees_amount = None
21
+ self.discount_amount = None
22
+ self.rebate_amount = None
23
+ self.due_date = None
24
+ self.payment_deadline = None
25
+ self.payer = None
26
+ self.bank_account_recipient = None
27
+ self.beneficiary = None
28
+ self.additional_infos = None
29
+ self.recurrence = None
30
+
31
+ if data:
32
+ self.key = data.get('key')
33
+ self.end_to_end_id = data.get('endToEndId')
34
+ self.transaction_id = data.get('transactionId')
35
+ self.expiration_time = data.get('expirationTime')
36
+ self.revision = data.get('revision')
37
+ self.allow_change_amount = data.get('allowChangeAmount')
38
+ self.category_code = data.get('categoryCode')
39
+ self.created_at = data.get('createdAt')
40
+ self.captured_at = data.get('capturedAt')
41
+ self.type = data.get('type')
42
+ self.status = data.get('status')
43
+ self.amount = data.get('amount')
44
+ self.original_amount = data.get('originalAmount')
45
+ self.fine_amount = data.get('fineAmount')
46
+ self.fees_amount = data.get('feesAmount')
47
+ self.discount_amount = data.get('discountAmount')
48
+ self.rebate_amount = data.get('rebateAmount')
49
+ self.due_date = data.get('dueDate')
50
+ self.payment_deadline = data.get('paymentDeadline')
51
+ self.payer = data.get('payer')
52
+ self.bank_account_recipient = data.get('bankAccountRecipient')
53
+ self.beneficiary = data.get('beneficiary')
54
+ self.additional_infos = data.get('additionalInfos')
55
+ self.recurrence = data.get('recurrence')
@@ -1,6 +1,7 @@
1
- class TransferDto:
1
+ class GetTransferResponse:
2
2
  """
3
- Represents the data of a transfer.
3
+ Response object for Get Transfer operation.
4
+ Represents the data of a transfer directly.
4
5
  """
5
6
  def __init__(self, data: dict = None):
6
7
  self.id = None
@@ -0,0 +1,15 @@
1
+ class PaymentInitializationResponse:
2
+ """
3
+ Response object for Pix payment initialization.
4
+ """
5
+ def __init__(self, data: dict = None):
6
+ self.end_to_end_id = None
7
+ self.key = None
8
+ self.beneficiary = None
9
+ self.key_belongs_holder = None
10
+
11
+ if data:
12
+ self.end_to_end_id = data.get('endToEndId')
13
+ self.key = data.get('key')
14
+ self.beneficiary = data.get('beneficiary')
15
+ self.key_belongs_holder = data.get('keyBelongsHolder')
@@ -0,0 +1,98 @@
1
+ import requests
2
+ import json
3
+ from ...abstractions.startup.delfinance_client import DelfinanceClient
4
+ from ..interfaces.ipix_service import IPixService
5
+ from ..requests.payment_initialization_request import PaymentInitializationRequest
6
+ from ..requests.decode_qr_code_request import DecodeQrCodeRequest
7
+ from ..responses.payment_initialization_response import PaymentInitializationResponse
8
+ from ..responses.decode_qr_code_response import DecodeQrCodeResponse
9
+
10
+ class PixService(IPixService):
11
+ """
12
+ Class PixService
13
+ """
14
+ def __init__(self, client: DelfinanceClient):
15
+ self.client = client
16
+
17
+ def payment_initialization(self, request: PaymentInitializationRequest) -> PaymentInitializationResponse:
18
+ """
19
+ Initializes a Pix payment using a DICT key.
20
+ """
21
+ url = f"{self.client.get_base_url()}/baas/api/v2/pix/dict/payment-initialization"
22
+
23
+ payload = {
24
+ 'key': request.key
25
+ }
26
+
27
+ if request.holder_document:
28
+ payload['holderDocument'] = request.holder_document
29
+
30
+ headers = {
31
+ 'Content-Type': 'application/json',
32
+ 'Accept': 'application/json',
33
+ 'x-delbank-api-key': self.client.get_api_key(),
34
+ 'x-delfinance-account-id': self.client.get_account_id(),
35
+ }
36
+
37
+ # Setup mTLS if configured
38
+ cert = None
39
+ if self.client.get_certificate_path() and self.client.get_private_key_path():
40
+ cert = (self.client.get_certificate_path(), self.client.get_private_key_path())
41
+
42
+ try:
43
+ response = requests.post(
44
+ url,
45
+ json=payload,
46
+ headers=headers,
47
+ cert=cert,
48
+ timeout=30
49
+ )
50
+
51
+ if response.status_code >= 400:
52
+ raise Exception(f"API Error: {response.text}", response.status_code)
53
+
54
+ data = response.json()
55
+ return PaymentInitializationResponse(data)
56
+
57
+ except requests.exceptions.RequestException as e:
58
+ raise Exception(f"Request Error: {str(e)}")
59
+
60
+ def decode_qr_code(self, request: DecodeQrCodeRequest) -> DecodeQrCodeResponse:
61
+ """
62
+ Initializes a Pix payment using a QR Code payload (decoding the QrCode).
63
+ """
64
+ url = f"{self.client.get_base_url()}/baas/api/v2/pix/qrcode/payment-initialization"
65
+
66
+ payload = {
67
+ 'payload': request.payload
68
+ }
69
+
70
+ headers = {
71
+ 'Content-Type': 'application/json',
72
+ 'Accept': 'application/json',
73
+ 'x-delbank-api-key': self.client.get_api_key(),
74
+ 'x-delfinance-account-id': self.client.get_account_id(),
75
+ }
76
+
77
+ # Setup mTLS if configured
78
+ cert = None
79
+ if self.client.get_certificate_path() and self.client.get_private_key_path():
80
+ cert = (self.client.get_certificate_path(), self.client.get_private_key_path())
81
+
82
+ try:
83
+ response = requests.post(
84
+ url,
85
+ json=payload,
86
+ headers=headers,
87
+ cert=cert,
88
+ timeout=30
89
+ )
90
+
91
+ if response.status_code >= 400:
92
+ raise Exception(f"API Error: {response.text}", response.status_code)
93
+
94
+ data = response.json()
95
+ return DecodeQrCodeResponse(data)
96
+
97
+ except requests.exceptions.RequestException as e:
98
+ raise Exception(f"Request Error: {str(e)}")
@@ -2,7 +2,6 @@ import requests
2
2
  import json
3
3
  from ...abstractions.startup.delfinance_client import DelfinanceClient
4
4
  from ..interfaces.itransfers_service import ITransfersService
5
- from ..dto.transfer_dto import TransferDto
6
5
  from ..responses.get_transfer_response import GetTransferResponse
7
6
 
8
7
  class TransfersService(ITransfersService):
@@ -36,8 +35,7 @@ class TransfersService(ITransfersService):
36
35
  raise Exception(f"API Error: {response.text}", response.status_code)
37
36
 
38
37
  data = response.json()
39
- dto = TransferDto(data)
40
- return GetTransferResponse(dto)
38
+ return GetTransferResponse(data)
41
39
 
42
40
  except requests.exceptions.RequestException as e:
43
41
  raise Exception(f"Request Error: {str(e)}")
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: delfinance-python-sdk
3
- Version: 0.0.4
3
+ Version: 0.0.6
4
4
  Summary: SDK oficial da Delfinance para Python
5
5
  Home-page: https://github.com/delfinance/python-sdk
6
6
  Author: Delfinance Team
@@ -124,3 +124,15 @@ Para testes e desenvolvimento local:
124
124
  docker-compose up --build
125
125
  ```
126
126
  Isso iniciará uma aplicação Flask simples que executa um teste de integração e exibe o resultado em `http://localhost:8080`.
127
+
128
+ ## 8. Depuração
129
+
130
+ O ambiente Docker está configurado para suportar depuração remota via `debugpy` na porta **5678**.
131
+
132
+ ### Usando VS Code
133
+
134
+ 1. Inicie o ambiente com `docker-compose up --build`.
135
+ 2. No VS Code, abra a aba "Run and Debug" (Ctrl+Shift+D).
136
+ 3. Selecione a configuração **"Docker: Remote Attach"**.
137
+ 4. Pressione **F5** para conectar o depurador ao container.
138
+ 5. Defina breakpoints no código e acesse `http://localhost:8080` para disparar a execução.
@@ -15,13 +15,18 @@ src/delfinance/abstractions/enums/__init__.py
15
15
  src/delfinance/abstractions/enums/environment.py
16
16
  src/delfinance/abstractions/startup/__init__.py
17
17
  src/delfinance/abstractions/startup/delfinance_client.py
18
- src/delfinance/transfers/dto/__init__.py
19
- src/delfinance/transfers/dto/transfer_dto.py
20
18
  src/delfinance/transfers/interfaces/__init__.py
19
+ src/delfinance/transfers/interfaces/ipix_service.py
21
20
  src/delfinance/transfers/interfaces/itransfers_service.py
21
+ src/delfinance/transfers/requests/__init__.py
22
+ src/delfinance/transfers/requests/decode_qr_code_request.py
23
+ src/delfinance/transfers/requests/payment_initialization_request.py
22
24
  src/delfinance/transfers/responses/__init__.py
25
+ src/delfinance/transfers/responses/decode_qr_code_response.py
23
26
  src/delfinance/transfers/responses/get_transfer_response.py
27
+ src/delfinance/transfers/responses/payment_initialization_response.py
24
28
  src/delfinance/transfers/services/__init__.py
29
+ src/delfinance/transfers/services/pix_service.py
25
30
  src/delfinance/transfers/services/transfers_service.py
26
31
  src/delfinance_python_sdk.egg-info/PKG-INFO
27
32
  src/delfinance_python_sdk.egg-info/SOURCES.txt
@@ -1,10 +0,0 @@
1
- FROM python:3.7-slim
2
-
3
- WORKDIR /app
4
-
5
- COPY requirements.txt .
6
- RUN pip install --no-cache-dir -r requirements.txt
7
-
8
- COPY . .
9
-
10
- CMD ["python", "main.py"]
@@ -1,8 +0,0 @@
1
- from ..dto.transfer_dto import TransferDto
2
-
3
- class GetTransferResponse:
4
- """
5
- Response wrapper for Get Transfer operation.
6
- """
7
- def __init__(self, transfer: TransferDto):
8
- self.transfer = transfer