delfinance-python-sdk 0.0.4__tar.gz → 0.6.0__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.
- delfinance_python_sdk-0.6.0/.Jenkinsfiles/master.groovy +73 -0
- delfinance_python_sdk-0.6.0/Dockerfile +11 -0
- {delfinance_python_sdk-0.0.4 → delfinance_python_sdk-0.6.0}/Jenkinsfile +29 -12
- {delfinance_python_sdk-0.0.4 → delfinance_python_sdk-0.6.0}/PKG-INFO +13 -1
- {delfinance_python_sdk-0.0.4 → delfinance_python_sdk-0.6.0}/README.md +12 -0
- {delfinance_python_sdk-0.0.4 → delfinance_python_sdk-0.6.0}/docker-compose.yml +1 -0
- {delfinance_python_sdk-0.0.4 → delfinance_python_sdk-0.6.0}/requirements.txt +2 -1
- delfinance_python_sdk-0.6.0/src/delfinance/charges/__init__.py +11 -0
- delfinance_python_sdk-0.6.0/src/delfinance/charges/interfaces/icharges_service.py +45 -0
- delfinance_python_sdk-0.6.0/src/delfinance/charges/requests/__init__.py +3 -0
- delfinance_python_sdk-0.6.0/src/delfinance/charges/requests/bill_payments_request.py +38 -0
- delfinance_python_sdk-0.6.0/src/delfinance/charges/requests/create_charge_request.py +89 -0
- delfinance_python_sdk-0.6.0/src/delfinance/charges/requests/list_charges_by_period_request.py +32 -0
- delfinance_python_sdk-0.6.0/src/delfinance/charges/responses/__init__.py +3 -0
- delfinance_python_sdk-0.6.0/src/delfinance/charges/responses/bill_payment_response.py +28 -0
- delfinance_python_sdk-0.6.0/src/delfinance/charges/responses/charge_response.py +32 -0
- delfinance_python_sdk-0.6.0/src/delfinance/charges/responses/validate_payment_details_response.py +23 -0
- delfinance_python_sdk-0.6.0/src/delfinance/charges/services/__init__.py +1 -0
- delfinance_python_sdk-0.6.0/src/delfinance/charges/services/charges_service.py +160 -0
- delfinance_python_sdk-0.6.0/src/delfinance/qrcode/__init__.py +14 -0
- delfinance_python_sdk-0.6.0/src/delfinance/qrcode/dtos/__init__.py +2 -0
- delfinance_python_sdk-0.6.0/src/delfinance/qrcode/dtos/address_dto.py +25 -0
- delfinance_python_sdk-0.6.0/src/delfinance/qrcode/dtos/qr_code_payment_dto.py +30 -0
- delfinance_python_sdk-0.6.0/src/delfinance/qrcode/interfaces/iqr_code_service.py +54 -0
- delfinance_python_sdk-0.6.0/src/delfinance/qrcode/requests/__init__.py +3 -0
- delfinance_python_sdk-0.6.0/src/delfinance/qrcode/requests/due_date_qr_code_request.py +60 -0
- delfinance_python_sdk-0.6.0/src/delfinance/qrcode/requests/immediate_qr_code_request.py +68 -0
- delfinance_python_sdk-0.6.0/src/delfinance/qrcode/requests/static_qr_code_request.py +48 -0
- delfinance_python_sdk-0.6.0/src/delfinance/qrcode/responses/__init__.py +5 -0
- delfinance_python_sdk-0.6.0/src/delfinance/qrcode/responses/create_due_date_qr_code_response.py +30 -0
- delfinance_python_sdk-0.6.0/src/delfinance/qrcode/responses/create_immediate_qr_code_response.py +20 -0
- delfinance_python_sdk-0.6.0/src/delfinance/qrcode/responses/create_static_qr_code_response.py +25 -0
- delfinance_python_sdk-0.6.0/src/delfinance/qrcode/responses/get_qr_code_response.py +30 -0
- delfinance_python_sdk-0.6.0/src/delfinance/qrcode/responses/qr_code_payment_response.py +3 -0
- delfinance_python_sdk-0.6.0/src/delfinance/qrcode/services/__init__.py +1 -0
- delfinance_python_sdk-0.6.0/src/delfinance/qrcode/services/qr_code_service.py +201 -0
- delfinance_python_sdk-0.6.0/src/delfinance/transfers/dto/balance.py +7 -0
- delfinance_python_sdk-0.6.0/src/delfinance/transfers/dto/beneficiary.py +36 -0
- delfinance_python_sdk-0.6.0/src/delfinance/transfers/interfaces/ipix_service.py +66 -0
- delfinance_python_sdk-0.6.0/src/delfinance/transfers/interfaces/itransfers_service.py +21 -0
- delfinance_python_sdk-0.6.0/src/delfinance/transfers/requests/__init__.py +4 -0
- delfinance_python_sdk-0.6.0/src/delfinance/transfers/requests/create_pix_key_request.py +31 -0
- delfinance_python_sdk-0.6.0/src/delfinance/transfers/requests/create_ted_transfer_request.py +24 -0
- delfinance_python_sdk-0.6.0/src/delfinance/transfers/requests/create_transfer_request.py +87 -0
- delfinance_python_sdk-0.6.0/src/delfinance/transfers/requests/decode_qr_code_request.py +10 -0
- delfinance_python_sdk-0.6.0/src/delfinance/transfers/requests/delete_pix_key_request.py +23 -0
- delfinance_python_sdk-0.6.0/src/delfinance/transfers/requests/generate_auth_code_request.py +27 -0
- delfinance_python_sdk-0.6.0/src/delfinance/transfers/requests/payment_initialization_request.py +12 -0
- delfinance_python_sdk-0.6.0/src/delfinance/transfers/responses/create_pix_key_response.py +20 -0
- delfinance_python_sdk-0.6.0/src/delfinance/transfers/responses/create_ted_transfer_response.py +9 -0
- delfinance_python_sdk-0.6.0/src/delfinance/transfers/responses/create_transfer_response.py +42 -0
- delfinance_python_sdk-0.6.0/src/delfinance/transfers/responses/decode_qr_code_response.py +55 -0
- delfinance_python_sdk-0.6.0/src/delfinance/transfers/responses/generate_auth_code_response.py +12 -0
- delfinance_python_sdk-0.6.0/src/delfinance/transfers/responses/get_pix_keys_response.py +8 -0
- delfinance_python_sdk-0.0.4/src/delfinance/transfers/dto/transfer_dto.py → delfinance_python_sdk-0.6.0/src/delfinance/transfers/responses/get_transfer_response.py +3 -2
- delfinance_python_sdk-0.6.0/src/delfinance/transfers/responses/payment_initialization_response.py +15 -0
- delfinance_python_sdk-0.6.0/src/delfinance/transfers/services/__init__.py +0 -0
- delfinance_python_sdk-0.6.0/src/delfinance/transfers/services/pix_service.py +260 -0
- delfinance_python_sdk-0.6.0/src/delfinance/transfers/services/transfers_service.py +95 -0
- delfinance_python_sdk-0.6.0/src/delfinance/webhooks/__init__.py +0 -0
- delfinance_python_sdk-0.6.0/src/delfinance/webhooks/interfaces/__init__.py +0 -0
- delfinance_python_sdk-0.6.0/src/delfinance/webhooks/interfaces/iwebhook_service.py +41 -0
- delfinance_python_sdk-0.6.0/src/delfinance/webhooks/requests/__init__.py +0 -0
- delfinance_python_sdk-0.6.0/src/delfinance/webhooks/requests/create_webhook_request.py +34 -0
- delfinance_python_sdk-0.6.0/src/delfinance/webhooks/responses/__init__.py +0 -0
- delfinance_python_sdk-0.6.0/src/delfinance/webhooks/responses/webhook_response.py +15 -0
- delfinance_python_sdk-0.6.0/src/delfinance/webhooks/services/__init__.py +0 -0
- delfinance_python_sdk-0.6.0/src/delfinance/webhooks/services/webhook_service.py +123 -0
- {delfinance_python_sdk-0.0.4 → delfinance_python_sdk-0.6.0}/src/delfinance_python_sdk.egg-info/PKG-INFO +13 -1
- delfinance_python_sdk-0.6.0/src/delfinance_python_sdk.egg-info/SOURCES.txt +87 -0
- delfinance_python_sdk-0.0.4/.Jenkinsfiles/master.groovy +0 -69
- delfinance_python_sdk-0.0.4/Dockerfile +0 -10
- delfinance_python_sdk-0.0.4/src/delfinance/transfers/interfaces/itransfers_service.py +0 -6
- delfinance_python_sdk-0.0.4/src/delfinance/transfers/responses/get_transfer_response.py +0 -8
- delfinance_python_sdk-0.0.4/src/delfinance/transfers/services/transfers_service.py +0 -43
- delfinance_python_sdk-0.0.4/src/delfinance_python_sdk.egg-info/SOURCES.txt +0 -30
- {delfinance_python_sdk-0.0.4 → delfinance_python_sdk-0.6.0}/.env.example +0 -0
- {delfinance_python_sdk-0.0.4 → delfinance_python_sdk-0.6.0}/.gitignore +0 -0
- {delfinance_python_sdk-0.0.4 → delfinance_python_sdk-0.6.0}/main.py +0 -0
- {delfinance_python_sdk-0.0.4 → delfinance_python_sdk-0.6.0}/openapi/openapi.yaml +0 -0
- {delfinance_python_sdk-0.0.4 → delfinance_python_sdk-0.6.0}/openapi/swagger.html +0 -0
- {delfinance_python_sdk-0.0.4 → delfinance_python_sdk-0.6.0}/setup.cfg +0 -0
- {delfinance_python_sdk-0.0.4 → delfinance_python_sdk-0.6.0}/setup.py +0 -0
- {delfinance_python_sdk-0.0.4 → delfinance_python_sdk-0.6.0}/src/delfinance/__init__.py +0 -0
- {delfinance_python_sdk-0.0.4 → delfinance_python_sdk-0.6.0}/src/delfinance/abstractions/enums/__init__.py +0 -0
- {delfinance_python_sdk-0.0.4 → delfinance_python_sdk-0.6.0}/src/delfinance/abstractions/enums/environment.py +0 -0
- {delfinance_python_sdk-0.0.4 → delfinance_python_sdk-0.6.0}/src/delfinance/abstractions/startup/__init__.py +0 -0
- {delfinance_python_sdk-0.0.4 → delfinance_python_sdk-0.6.0}/src/delfinance/abstractions/startup/delfinance_client.py +0 -0
- {delfinance_python_sdk-0.0.4/src/delfinance/transfers/dto → delfinance_python_sdk-0.6.0/src/delfinance/transfers}/__init__.py +0 -0
- {delfinance_python_sdk-0.0.4/src/delfinance/transfers/interfaces → delfinance_python_sdk-0.6.0/src/delfinance/transfers/dto}/__init__.py +0 -0
- {delfinance_python_sdk-0.0.4/src/delfinance/transfers/responses → delfinance_python_sdk-0.6.0/src/delfinance/transfers/interfaces}/__init__.py +0 -0
- {delfinance_python_sdk-0.0.4/src/delfinance/transfers/services → delfinance_python_sdk-0.6.0/src/delfinance/transfers/responses}/__init__.py +0 -0
- {delfinance_python_sdk-0.0.4 → delfinance_python_sdk-0.6.0}/src/delfinance_python_sdk.egg-info/dependency_links.txt +0 -0
- {delfinance_python_sdk-0.0.4 → delfinance_python_sdk-0.6.0}/src/delfinance_python_sdk.egg-info/requires.txt +0 -0
- {delfinance_python_sdk-0.0.4 → delfinance_python_sdk-0.6.0}/src/delfinance_python_sdk.egg-info/top_level.txt +0 -0
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
def pipelineRoll() {
|
|
2
|
+
|
|
3
|
+
stage('Checkout') {
|
|
4
|
+
withCredentials([usernamePassword(credentialsId: 'giteauth', usernameVariable: 'GIT_USERNAME', passwordVariable: 'GIT_PASSWORD')]) {
|
|
5
|
+
echo '---------------------GitHub Checkout started!----------------------'
|
|
6
|
+
sh '''
|
|
7
|
+
apt-get update
|
|
8
|
+
apt-get install -y git ca-certificates
|
|
9
|
+
'''
|
|
10
|
+
sh 'rm -rf ${GIT_REPO_NAME}'
|
|
11
|
+
sh 'git clone https://${GIT_USERNAME}:${GIT_PASSWORD}@git.delbank.srv.br/DelbankDev/${GIT_REPO_NAME}.git'
|
|
12
|
+
|
|
13
|
+
dir("${GIT_REPO_NAME}") {
|
|
14
|
+
sh 'git fetch --all --tags'
|
|
15
|
+
sh "git checkout ${env.BRANCH_NAME}"
|
|
16
|
+
|
|
17
|
+
def tagged = sh(
|
|
18
|
+
script: 'git tag --points-at HEAD',
|
|
19
|
+
returnStdout: true
|
|
20
|
+
).trim()
|
|
21
|
+
|
|
22
|
+
// Remove o prefixo 'v' da tag para garantir compatibilidade com PEP 440
|
|
23
|
+
def tag = sh(
|
|
24
|
+
script: 'git describe --tags --abbrev=0 2>/dev/null | sed "s/^v//" || echo 0.0.0',
|
|
25
|
+
returnStdout: true
|
|
26
|
+
).trim()
|
|
27
|
+
|
|
28
|
+
if (tagged) {
|
|
29
|
+
env.VERSION = "${tag}"
|
|
30
|
+
} else {
|
|
31
|
+
env.VERSION = "${tag}b${TAG}"
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
echo "---------------------GitHub Checkout finished! VERSION=${env.VERSION}---------------------"
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
stage('Generating Artifact') {
|
|
39
|
+
echo "Python artifact will be generated for version ${env.VERSION}"
|
|
40
|
+
sh 'rm -rf /dist'
|
|
41
|
+
sh 'pip install -U pip setuptools wheel'
|
|
42
|
+
|
|
43
|
+
dir("${GIT_REPO_NAME}") {
|
|
44
|
+
sh 'pip install -r requirements.txt'
|
|
45
|
+
|
|
46
|
+
// withEnv garante que a variável chegue corretamente ao setuptools_scm
|
|
47
|
+
// evitando que ele tente parsear a tag do git (que vem como 'origin/v0.6.0' e falha)
|
|
48
|
+
withEnv(["SETUPTOOLS_SCM_PRETEND_VERSION=${env.VERSION}"]) {
|
|
49
|
+
sh 'python setup.py sdist bdist_wheel'
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
sh 'pip install -U pip twine'
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
stage('Publish to Gitea') {
|
|
57
|
+
withCredentials([
|
|
58
|
+
string(credentialsId: 'gitea-package-publisher', variable: 'GITEA_TOKEN')
|
|
59
|
+
]) {
|
|
60
|
+
dir("${GIT_REPO_NAME}") {
|
|
61
|
+
sh """
|
|
62
|
+
export TWINE_USERNAME=__token__
|
|
63
|
+
export TWINE_PASSWORD=${GITEA_TOKEN}
|
|
64
|
+
|
|
65
|
+
twine upload --repository-url ${GITEA_PYPI_SOURCE} dist/delfinance_python_sdk-${env.VERSION}*
|
|
66
|
+
"""
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
return this
|
|
@@ -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"]
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
pipeline {
|
|
2
|
-
agent any
|
|
2
|
+
agent any
|
|
3
3
|
|
|
4
4
|
environment {
|
|
5
5
|
REGISTRY = 'https://registry.digitalocean.com/delbank-1/internet-banking'
|
|
@@ -8,14 +8,18 @@ pipeline {
|
|
|
8
8
|
PYPI_API_SOURCE = "https://upload.pypi.org/legacy/"
|
|
9
9
|
GITEA_PYPI_SOURCE = 'https://git.delbank.srv.br/api/packages/DelbankDev/pypi'
|
|
10
10
|
}
|
|
11
|
-
|
|
11
|
+
|
|
12
12
|
options {
|
|
13
13
|
disableConcurrentBuilds()
|
|
14
14
|
timestamps()
|
|
15
15
|
}
|
|
16
16
|
|
|
17
|
-
|
|
18
17
|
stages {
|
|
18
|
+
|
|
19
|
+
// ---------------------------------------------------------------
|
|
20
|
+
// Build por BRANCH (não tag): envia apenas para o Gitea
|
|
21
|
+
// Versão gerada: <ultima-tag>b<BUILD_ID> ex: 0.6.0b47
|
|
22
|
+
// ---------------------------------------------------------------
|
|
19
23
|
stage('Check Branch') {
|
|
20
24
|
when {
|
|
21
25
|
not {
|
|
@@ -32,6 +36,7 @@ pipeline {
|
|
|
32
36
|
script {
|
|
33
37
|
env.SAFE_BRANCH = env.BRANCH_NAME.replaceAll('/', '_')
|
|
34
38
|
env.TARGET_FILE_PATH = ".Jenkinsfiles/${env.SAFE_BRANCH}.groovy"
|
|
39
|
+
|
|
35
40
|
if (fileExists(env.TARGET_FILE_PATH)) {
|
|
36
41
|
currentBuild.result = 'SUCCESS'
|
|
37
42
|
def myScript = load(env.TARGET_FILE_PATH)
|
|
@@ -44,11 +49,14 @@ pipeline {
|
|
|
44
49
|
}
|
|
45
50
|
}
|
|
46
51
|
|
|
52
|
+
// ---------------------------------------------------------------
|
|
53
|
+
// Build por TAG: envia para o Gitea E para o PyPI
|
|
54
|
+
// Versão gerada: <tag-sem-prefixo-v> ex: 0.6.0 (PEP 440)
|
|
55
|
+
// ---------------------------------------------------------------
|
|
47
56
|
stage('Publish to PyPI') {
|
|
48
57
|
when {
|
|
49
58
|
buildingTag()
|
|
50
59
|
}
|
|
51
|
-
|
|
52
60
|
agent {
|
|
53
61
|
docker {
|
|
54
62
|
image 'python:3.12-slim'
|
|
@@ -56,17 +64,26 @@ pipeline {
|
|
|
56
64
|
}
|
|
57
65
|
}
|
|
58
66
|
steps {
|
|
59
|
-
script{
|
|
67
|
+
script {
|
|
68
|
+
// pipelineRoll() do master.groovy já faz:
|
|
69
|
+
// - Checkout + cálculo de VERSION (sem prefixo 'v')
|
|
70
|
+
// - Build do artefato com SETUPTOOLS_SCM_PRETEND_VERSION
|
|
71
|
+
// - Publish no Gitea
|
|
60
72
|
def myScript = load(".Jenkinsfiles/master.groovy")
|
|
61
73
|
myScript.pipelineRoll()
|
|
74
|
+
|
|
75
|
+
// Após o Gitea, envia também para o PyPI oficial
|
|
62
76
|
withCredentials([
|
|
63
|
-
|
|
64
|
-
]){
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
77
|
+
string(credentialsId: 'PYPI_API_KEY', variable: 'PYPI_API_KEY')
|
|
78
|
+
]) {
|
|
79
|
+
dir("${GIT_REPO_NAME}") {
|
|
80
|
+
sh """
|
|
81
|
+
export TWINE_USERNAME=__token__
|
|
82
|
+
export TWINE_PASSWORD=${PYPI_API_KEY}
|
|
83
|
+
|
|
84
|
+
twine upload --repository-url ${PYPI_API_SOURCE} dist/delfinance_python_sdk-${env.VERSION}*
|
|
85
|
+
"""
|
|
86
|
+
}
|
|
70
87
|
}
|
|
71
88
|
}
|
|
72
89
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: delfinance-python-sdk
|
|
3
|
-
Version: 0.0
|
|
3
|
+
Version: 0.6.0
|
|
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.
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
from abc import ABC, abstractmethod
|
|
2
|
+
from typing import List
|
|
3
|
+
from io import BytesIO
|
|
4
|
+
from ..requests.create_charge_request import CreateChargeRequest
|
|
5
|
+
from ..requests.bill_payments_request import BillPaymentsRequest
|
|
6
|
+
from ..requests.list_charges_by_period_request import ListChargesByPeriodRequest
|
|
7
|
+
from ..responses.charge_response import ChargeResponse
|
|
8
|
+
from ..responses.bill_payment_response import BillPaymentResponse
|
|
9
|
+
from ..responses.validate_payment_details_response import ValidatePaymentDetailsResponse
|
|
10
|
+
|
|
11
|
+
class IChargesService(ABC):
|
|
12
|
+
"""
|
|
13
|
+
Interface IChargesService
|
|
14
|
+
"""
|
|
15
|
+
@abstractmethod
|
|
16
|
+
def create_charge(self, request: CreateChargeRequest) -> ChargeResponse:
|
|
17
|
+
pass
|
|
18
|
+
|
|
19
|
+
@abstractmethod
|
|
20
|
+
def get_charge_by_id(self, correlation_id: str) -> ChargeResponse:
|
|
21
|
+
pass
|
|
22
|
+
|
|
23
|
+
@abstractmethod
|
|
24
|
+
def list_charges_by_period(self, request: ListChargesByPeriodRequest) -> List[ChargeResponse]:
|
|
25
|
+
pass
|
|
26
|
+
|
|
27
|
+
@abstractmethod
|
|
28
|
+
def download_charge_pdf(self, id: str) -> BytesIO:
|
|
29
|
+
pass
|
|
30
|
+
|
|
31
|
+
@abstractmethod
|
|
32
|
+
def update_charge(self, correlation_id: str, request: CreateChargeRequest):
|
|
33
|
+
pass
|
|
34
|
+
|
|
35
|
+
@abstractmethod
|
|
36
|
+
def void_charge(self, correlation_id: str):
|
|
37
|
+
pass
|
|
38
|
+
|
|
39
|
+
@abstractmethod
|
|
40
|
+
def validate_payment_details(self, barcode_or_digitable_line: str) -> ValidatePaymentDetailsResponse:
|
|
41
|
+
pass
|
|
42
|
+
|
|
43
|
+
@abstractmethod
|
|
44
|
+
def bill_payment(self, request: BillPaymentsRequest, idempotency_key: str) -> BillPaymentResponse:
|
|
45
|
+
pass
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
from typing import Optional, Dict, Any
|
|
2
|
+
|
|
3
|
+
class BillPaymentsRequest:
|
|
4
|
+
def __init__(
|
|
5
|
+
self,
|
|
6
|
+
bar_code: Optional[str] = None,
|
|
7
|
+
digitable_line: Optional[str] = None,
|
|
8
|
+
amount: Optional[float] = None,
|
|
9
|
+
pay_at: Optional[str] = None,
|
|
10
|
+
category: Optional[str] = None,
|
|
11
|
+
**kwargs
|
|
12
|
+
):
|
|
13
|
+
self.bar_code = bar_code
|
|
14
|
+
self.digitable_line = digitable_line
|
|
15
|
+
self.amount = amount
|
|
16
|
+
self.pay_at = pay_at
|
|
17
|
+
self.category = category
|
|
18
|
+
|
|
19
|
+
def to_body_request(self) -> Dict[str, Any]:
|
|
20
|
+
data = {}
|
|
21
|
+
|
|
22
|
+
if self.bar_code is not None:
|
|
23
|
+
data['barCode'] = self.bar_code
|
|
24
|
+
|
|
25
|
+
if self.digitable_line is not None:
|
|
26
|
+
data['digitableLine'] = self.digitable_line
|
|
27
|
+
|
|
28
|
+
if self.amount is not None:
|
|
29
|
+
data['amount'] = self.amount
|
|
30
|
+
|
|
31
|
+
if self.pay_at is not None:
|
|
32
|
+
data['payAt'] = self.pay_at
|
|
33
|
+
|
|
34
|
+
if self.category is not None:
|
|
35
|
+
data['category'] = self.category
|
|
36
|
+
|
|
37
|
+
return data
|
|
38
|
+
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
from typing import Optional, Dict, Any
|
|
2
|
+
|
|
3
|
+
class CreateChargeRequest:
|
|
4
|
+
def __init__(
|
|
5
|
+
self,
|
|
6
|
+
type: Optional[str] = None,
|
|
7
|
+
correlation_id: Optional[str] = None,
|
|
8
|
+
amount: Optional[float] = None,
|
|
9
|
+
rebate_amount: Optional[float] = None,
|
|
10
|
+
your_number: Optional[str] = None,
|
|
11
|
+
our_number: Optional[str] = None,
|
|
12
|
+
description: Optional[str] = None,
|
|
13
|
+
due_date: Optional[str] = None,
|
|
14
|
+
void_date: Optional[str] = None,
|
|
15
|
+
payer: Optional[Dict[str, Any]] = None,
|
|
16
|
+
final_beneficiary: Optional[Dict[str, Any]] = None,
|
|
17
|
+
discount: Optional[Dict[str, Any]] = None,
|
|
18
|
+
late_fine: Optional[Dict[str, Any]] = None,
|
|
19
|
+
late_payment: Optional[Dict[str, Any]] = None,
|
|
20
|
+
notify_payer_of_creation: Optional[bool] = None,
|
|
21
|
+
**kwargs
|
|
22
|
+
):
|
|
23
|
+
self.type = type
|
|
24
|
+
self.correlation_id = correlation_id
|
|
25
|
+
self.amount = amount
|
|
26
|
+
self.rebate_amount = rebate_amount
|
|
27
|
+
self.your_number = your_number
|
|
28
|
+
self.our_number = our_number
|
|
29
|
+
self.description = description
|
|
30
|
+
self.due_date = due_date
|
|
31
|
+
self.void_date = void_date
|
|
32
|
+
self.payer = payer
|
|
33
|
+
self.final_beneficiary = final_beneficiary
|
|
34
|
+
self.discount = discount
|
|
35
|
+
self.late_fine = late_fine
|
|
36
|
+
self.late_payment = late_payment
|
|
37
|
+
self.notify_payer_of_creation = notify_payer_of_creation
|
|
38
|
+
|
|
39
|
+
def to_body_request(self) -> Dict[str, Any]:
|
|
40
|
+
data = {}
|
|
41
|
+
|
|
42
|
+
if self.type is not None:
|
|
43
|
+
data['type'] = self.type
|
|
44
|
+
|
|
45
|
+
if self.correlation_id is not None:
|
|
46
|
+
data['correlationId'] = self.correlation_id
|
|
47
|
+
|
|
48
|
+
if self.amount is not None:
|
|
49
|
+
data['amount'] = self.amount
|
|
50
|
+
|
|
51
|
+
if self.rebate_amount is not None:
|
|
52
|
+
data['rebateAmount'] = self.rebate_amount
|
|
53
|
+
|
|
54
|
+
if self.your_number is not None:
|
|
55
|
+
data['yourNumber'] = self.your_number
|
|
56
|
+
|
|
57
|
+
if self.our_number is not None:
|
|
58
|
+
data['ourNumber'] = self.our_number
|
|
59
|
+
|
|
60
|
+
if self.description is not None:
|
|
61
|
+
data['description'] = self.description
|
|
62
|
+
|
|
63
|
+
if self.due_date is not None:
|
|
64
|
+
data['dueDate'] = self.due_date
|
|
65
|
+
|
|
66
|
+
if self.void_date is not None:
|
|
67
|
+
data['voidDate'] = self.void_date
|
|
68
|
+
|
|
69
|
+
if self.payer is not None:
|
|
70
|
+
data['payer'] = self.payer
|
|
71
|
+
|
|
72
|
+
if self.final_beneficiary is not None:
|
|
73
|
+
data['finalBeneficiary'] = self.final_beneficiary
|
|
74
|
+
|
|
75
|
+
if self.discount is not None:
|
|
76
|
+
data['discount'] = self.discount
|
|
77
|
+
|
|
78
|
+
if self.late_fine is not None:
|
|
79
|
+
data['lateFine'] = self.late_fine
|
|
80
|
+
|
|
81
|
+
if self.late_payment is not None:
|
|
82
|
+
data['latePayment'] = self.late_payment
|
|
83
|
+
|
|
84
|
+
if self.notify_payer_of_creation is not None:
|
|
85
|
+
data['notifyPayerOfCreation'] = self.notify_payer_of_creation
|
|
86
|
+
|
|
87
|
+
return data
|
|
88
|
+
|
|
89
|
+
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
from typing import Optional, Dict, Any
|
|
2
|
+
|
|
3
|
+
class ListChargesByPeriodRequest:
|
|
4
|
+
def __init__(
|
|
5
|
+
self,
|
|
6
|
+
page: Optional[int] = None,
|
|
7
|
+
limit: Optional[int] = None,
|
|
8
|
+
start_date: Optional[str] = None,
|
|
9
|
+
end_date: Optional[str] = None,
|
|
10
|
+
**kwargs
|
|
11
|
+
):
|
|
12
|
+
self.page = page
|
|
13
|
+
self.limit = limit
|
|
14
|
+
self.start_date = start_date
|
|
15
|
+
self.end_date = end_date
|
|
16
|
+
|
|
17
|
+
def to_body_request(self) -> Dict[str, Any]:
|
|
18
|
+
data = {}
|
|
19
|
+
|
|
20
|
+
if self.page is not None:
|
|
21
|
+
data['page'] = self.page
|
|
22
|
+
|
|
23
|
+
if self.limit is not None:
|
|
24
|
+
data['limit'] = self.limit
|
|
25
|
+
|
|
26
|
+
if self.start_date is not None:
|
|
27
|
+
data['startDate'] = self.start_date
|
|
28
|
+
|
|
29
|
+
if self.end_date is not None:
|
|
30
|
+
data['endDate'] = self.end_date
|
|
31
|
+
|
|
32
|
+
return data
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
from typing import Optional, Dict, Any
|
|
2
|
+
|
|
3
|
+
class BillPaymentResponse:
|
|
4
|
+
def __init__(self, data: Dict[str, Any]):
|
|
5
|
+
self.id: Optional[str] = data.get('id')
|
|
6
|
+
self.bar_code: Optional[str] = data.get('barCode')
|
|
7
|
+
self.digitable_line: Optional[str] = data.get('digitableLine')
|
|
8
|
+
self.identifier_number: Optional[str] = data.get('identifierNumber')
|
|
9
|
+
self.bankslip_amount: Optional[float] = data.get('bankslipAmount')
|
|
10
|
+
self.status: Optional[str] = data.get('status')
|
|
11
|
+
self.due_date: Optional[str] = data.get('dueDate')
|
|
12
|
+
self.payment_deadline: Optional[str] = data.get('paymentDeadline')
|
|
13
|
+
self.total_to_be_charged_amount: Optional[float] = data.get('totalToBeChargedAmount')
|
|
14
|
+
self.fee_amount: Optional[float] = data.get('feeAmount')
|
|
15
|
+
self.fine_amount: Optional[float] = data.get('fineAmount')
|
|
16
|
+
self.discount_amount: Optional[float] = data.get('discountAmount')
|
|
17
|
+
self.rebate_amount: Optional[float] = data.get('rebateAmount')
|
|
18
|
+
self.paid_amount: Optional[float] = data.get('paidAmount')
|
|
19
|
+
self.created_at: Optional[str] = data.get('createdAt')
|
|
20
|
+
self.paid_at: Optional[str] = data.get('paidAt')
|
|
21
|
+
self.pay_at: Optional[str] = data.get('payAt')
|
|
22
|
+
self.beneficiary: Optional[Dict[str, Any]] = data.get('beneficiary')
|
|
23
|
+
self.payer: Optional[Dict[str, Any]] = data.get('payer')
|
|
24
|
+
self.bank_issuer: Optional[Dict[str, Any]] = data.get('bankIssuer')
|
|
25
|
+
self.payment_cancellation: Optional[Dict[str, Any]] = data.get('paymentCancellation')
|
|
26
|
+
self.calculation: Optional[Dict[str, Any]] = data.get('calculation')
|
|
27
|
+
self.category: Optional[Dict[str, Any]] = data.get('category')
|
|
28
|
+
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
from typing import Optional, Dict, Any, List
|
|
2
|
+
|
|
3
|
+
class ChargeResponse:
|
|
4
|
+
def __init__(self, data: Dict[str, Any]):
|
|
5
|
+
self.bank_account: Optional[str] = data.get('bankAccount')
|
|
6
|
+
self.type: Optional[str] = data.get('type')
|
|
7
|
+
self.correlation_id: Optional[str] = data.get('correlationId')
|
|
8
|
+
self.amount: Optional[float] = data.get('amount')
|
|
9
|
+
self.rebate_amount: Optional[float] = data.get('rebateAmount')
|
|
10
|
+
self.wallet_number: Optional[str] = data.get('walletNumber')
|
|
11
|
+
self.your_number: Optional[str] = data.get('yourNumber')
|
|
12
|
+
self.our_number: Optional[str] = data.get('ourNumber')
|
|
13
|
+
self.description: Optional[str] = data.get('description')
|
|
14
|
+
self.due_date: Optional[str] = data.get('dueDate')
|
|
15
|
+
self.void_date: Optional[str] = data.get('voidDate')
|
|
16
|
+
self.qr_code: Optional[str] = data.get('qrCode')
|
|
17
|
+
self.qr_code_image_base64: Optional[str] = data.get('qrCodeImageBase64')
|
|
18
|
+
self.bar_code: Optional[str] = data.get('barCode')
|
|
19
|
+
self.digitable_line: Optional[str] = data.get('digitableLine')
|
|
20
|
+
self.payer: Optional[Dict[str, Any]] = data.get('payer')
|
|
21
|
+
self.beneficiary: Optional[Dict[str, Any]] = data.get('beneficiary')
|
|
22
|
+
self.final_beneficiary: Optional[Dict[str, Any]] = data.get('finalBeneficiary')
|
|
23
|
+
self.discount: Optional[Dict[str, Any]] = data.get('discount')
|
|
24
|
+
self.late_fine: Optional[Dict[str, Any]] = data.get('lateFine')
|
|
25
|
+
self.late_payment: Optional[Dict[str, Any]] = data.get('latePayment')
|
|
26
|
+
self.status: Optional[str] = data.get('status')
|
|
27
|
+
self.payments: Optional[List[Dict[str, Any]]] = data.get('payments')
|
|
28
|
+
self.additional_info: Optional[List[Dict[str, str]]] = data.get('additionalInfo')
|
|
29
|
+
self.notify_payer_of_creation: Optional[bool] = data.get('notifyPayerOfCreation')
|
|
30
|
+
self.updated_at: Optional[str] = data.get('updatedAt')
|
|
31
|
+
self.created_at: Optional[str] = data.get('createdAt')
|
|
32
|
+
|
delfinance_python_sdk-0.6.0/src/delfinance/charges/responses/validate_payment_details_response.py
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
from typing import Optional, Dict, Any, List
|
|
2
|
+
|
|
3
|
+
class ValidatePaymentDetailsResponse:
|
|
4
|
+
def __init__(self, data: Dict[str, Any]):
|
|
5
|
+
self.identifier_number: Optional[str] = data.get('identifierNumber')
|
|
6
|
+
self.type: Optional[str] = data.get('type')
|
|
7
|
+
self.is_paid: Optional[bool] = data.get('isPaid')
|
|
8
|
+
self.status: Optional[str] = data.get('status')
|
|
9
|
+
self.amount: Optional[float] = data.get('amount')
|
|
10
|
+
self.due_date: Optional[str] = data.get('dueDate')
|
|
11
|
+
self.payment_deadline: Optional[str] = data.get('paymentDeadline')
|
|
12
|
+
self.bar_code: Optional[str] = data.get('barCode')
|
|
13
|
+
self.digitable_line: Optional[str] = data.get('digitableLine')
|
|
14
|
+
self.is_allow_partial_payment: Optional[bool] = data.get('isAllowPartialPayment')
|
|
15
|
+
self.is_payment_blocked: Optional[bool] = data.get('isPaymentBlocked')
|
|
16
|
+
self.payment_calculation: Optional[Dict[str, Any]] = data.get('paymentCalculation')
|
|
17
|
+
self.payer: Optional[Dict[str, Any]] = data.get('payer')
|
|
18
|
+
self.overdue_payment_interest: Optional[Dict[str, Any]] = data.get('overduePaymentInterest')
|
|
19
|
+
self.overdue_payment_fine: Optional[Dict[str, Any]] = data.get('overduePaymentFine')
|
|
20
|
+
self.discounts: Optional[List[Dict[str, Any]]] = data.get('discounts')
|
|
21
|
+
self.beneficiary: Optional[Dict[str, Any]] = data.get('beneficiary')
|
|
22
|
+
self.issuer: Optional[Dict[str, Any]] = data.get('issuer')
|
|
23
|
+
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
from .charges_service import ChargesService
|