spei-python 0.12.1__tar.gz → 0.12.3__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.
- {spei_python-0.12.1 → spei_python-0.12.3}/PKG-INFO +41 -1
- spei_python-0.12.3/README.md +72 -0
- {spei_python-0.12.1 → spei_python-0.12.3}/pyproject.toml +2 -2
- spei_python-0.12.3/spei/README.md +181 -0
- spei_python-0.12.3/spei/errors.py +452 -0
- spei_python-0.12.3/spei/resources/__init__.py +2 -0
- {spei_python-0.12.1 → spei_python-0.12.3}/spei/resources/orden.py +56 -3
- {spei_python-0.12.1 → spei_python-0.12.3}/spei/types.py +9 -0
- spei_python-0.12.1/README.md +0 -32
- spei_python-0.12.1/spei/errors.py +0 -447
- spei_python-0.12.1/spei/resources/__init__.py +0 -2
- {spei_python-0.12.1 → spei_python-0.12.3}/spei/__init__.py +0 -0
- {spei_python-0.12.1 → spei_python-0.12.3}/spei/client.py +0 -0
- {spei_python-0.12.1 → spei_python-0.12.3}/spei/requests/__init__.py +0 -0
- {spei_python-0.12.1 → spei_python-0.12.3}/spei/requests/orden.py +0 -0
- {spei_python-0.12.1 → spei_python-0.12.3}/spei/requests/respuesta.py +0 -0
- {spei_python-0.12.1 → spei_python-0.12.3}/spei/resources/respuesta.py +0 -0
- {spei_python-0.12.1 → spei_python-0.12.3}/spei/utils.py +0 -0
- {spei_python-0.12.1 → spei_python-0.12.3}/spei/validators.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: spei-python
|
|
3
|
-
Version: 0.12.
|
|
3
|
+
Version: 0.12.3
|
|
4
4
|
Summary:
|
|
5
5
|
Author: gonz
|
|
6
6
|
Author-email: gonzasestopal@gmail.com
|
|
@@ -30,6 +30,46 @@ Use the package manager [poetry](https://pypi.org/project/poetry/) to install.
|
|
|
30
30
|
|
|
31
31
|
poetry install spei-python
|
|
32
32
|
|
|
33
|
+
## Usage
|
|
34
|
+
Use our client to send orders to SPEI.
|
|
35
|
+
```python
|
|
36
|
+
from spei.client import BaseClient
|
|
37
|
+
|
|
38
|
+
client = BaseClient(
|
|
39
|
+
host='karpay-beta.intfondeadora.app',
|
|
40
|
+
username='karpay',
|
|
41
|
+
password='password',
|
|
42
|
+
priv_key='private_key',
|
|
43
|
+
priv_key_passphrase='passphrase',
|
|
44
|
+
)
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
## Methods
|
|
48
|
+
- [registra_orden](/spei/README.md)
|
|
49
|
+
|
|
50
|
+
## Resources
|
|
51
|
+
There are two main resources.
|
|
52
|
+
|
|
53
|
+
- [Orden](spei/resources/orden.py) our abstraction of order, this goes through SPEI as XML.
|
|
54
|
+
- [Respuesta](spei/resources/respuesta.py) our abstraction of received SPEI messages and response to SPEI orders.
|
|
55
|
+
|
|
56
|
+
## Types
|
|
57
|
+
- [TipoPagoOrdenPago](/spei/types.py#6) Order payment type.
|
|
58
|
+
- [TipoOrdenPago](/spei/types.py#33) Order type.
|
|
59
|
+
- [TipoCuentaOrdenPago](/spei/types.py#38) Account type.
|
|
60
|
+
- [PrioridadOrdenPago](/spei/types.py#58) Order priority.
|
|
61
|
+
- [CategoriaOrdenPago](/spei/types.py#63) Order Category.
|
|
62
|
+
- [EstadoOrdenPago](/spei/types.py#76) Order status.
|
|
63
|
+
- [ClaveOrdenanteOrdenPago](/spei/types.py#83) Root Institution Code.
|
|
64
|
+
- [FolioOrdenPago](/spei/types.py#87) Order invoice identifier.
|
|
65
|
+
- [MedioEntregaOrdenPago](/spei/types.py#91) Order transmission method.
|
|
66
|
+
- [TopologiaOrdenPago](/spei/types.py#107) Order notification method.
|
|
67
|
+
|
|
68
|
+
## Errors
|
|
69
|
+
You may use any of the generic errors in [errors](/spei/errors.py) to return as response to SPEI. (?) Need to ask karpay.
|
|
70
|
+
|
|
71
|
+
These errors are included inside respuesta.
|
|
72
|
+
|
|
33
73
|
## Test
|
|
34
74
|
Tested with [mamba](https://mamba-framework.readthedocs.io/en/latest/), install poetry dev packages and then run tests.
|
|
35
75
|
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
[](https://github.com/wemake-services/wemake-python-styleguide)
|
|
2
|
+
|
|
3
|
+
spei-python
|
|
4
|
+
===========
|
|
5
|
+
|
|
6
|
+
A library for accessing the SPEI API for python.
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
## Installation
|
|
10
|
+
Use the package manager [poetry](https://pypi.org/project/poetry/) to install.
|
|
11
|
+
|
|
12
|
+
poetry install spei-python
|
|
13
|
+
|
|
14
|
+
## Usage
|
|
15
|
+
Use our client to send orders to SPEI.
|
|
16
|
+
```python
|
|
17
|
+
from spei.client import BaseClient
|
|
18
|
+
|
|
19
|
+
client = BaseClient(
|
|
20
|
+
host='karpay-beta.intfondeadora.app',
|
|
21
|
+
username='karpay',
|
|
22
|
+
password='password',
|
|
23
|
+
priv_key='private_key',
|
|
24
|
+
priv_key_passphrase='passphrase',
|
|
25
|
+
)
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
## Methods
|
|
29
|
+
- [registra_orden](/spei/README.md)
|
|
30
|
+
|
|
31
|
+
## Resources
|
|
32
|
+
There are two main resources.
|
|
33
|
+
|
|
34
|
+
- [Orden](spei/resources/orden.py) our abstraction of order, this goes through SPEI as XML.
|
|
35
|
+
- [Respuesta](spei/resources/respuesta.py) our abstraction of received SPEI messages and response to SPEI orders.
|
|
36
|
+
|
|
37
|
+
## Types
|
|
38
|
+
- [TipoPagoOrdenPago](/spei/types.py#6) Order payment type.
|
|
39
|
+
- [TipoOrdenPago](/spei/types.py#33) Order type.
|
|
40
|
+
- [TipoCuentaOrdenPago](/spei/types.py#38) Account type.
|
|
41
|
+
- [PrioridadOrdenPago](/spei/types.py#58) Order priority.
|
|
42
|
+
- [CategoriaOrdenPago](/spei/types.py#63) Order Category.
|
|
43
|
+
- [EstadoOrdenPago](/spei/types.py#76) Order status.
|
|
44
|
+
- [ClaveOrdenanteOrdenPago](/spei/types.py#83) Root Institution Code.
|
|
45
|
+
- [FolioOrdenPago](/spei/types.py#87) Order invoice identifier.
|
|
46
|
+
- [MedioEntregaOrdenPago](/spei/types.py#91) Order transmission method.
|
|
47
|
+
- [TopologiaOrdenPago](/spei/types.py#107) Order notification method.
|
|
48
|
+
|
|
49
|
+
## Errors
|
|
50
|
+
You may use any of the generic errors in [errors](/spei/errors.py) to return as response to SPEI. (?) Need to ask karpay.
|
|
51
|
+
|
|
52
|
+
These errors are included inside respuesta.
|
|
53
|
+
|
|
54
|
+
## Test
|
|
55
|
+
Tested with [mamba](https://mamba-framework.readthedocs.io/en/latest/), install poetry dev packages and then run tests.
|
|
56
|
+
|
|
57
|
+
poetry run make test
|
|
58
|
+
|
|
59
|
+
## Contributing
|
|
60
|
+
Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.
|
|
61
|
+
|
|
62
|
+
Please make sure to update tests as appropriate.
|
|
63
|
+
|
|
64
|
+
## License
|
|
65
|
+
[MIT](https://choosealicense.com/licenses/mit/)
|
|
66
|
+
|
|
67
|
+
## Checksum Generator
|
|
68
|
+
This repo includes a utility to generate [firma digital aplicada](https://www.notion.so/fondeadoraroot/Algoritmo-de-Firma-e-Karpay-SPEI-02e6c25b7c5943bea054ae37c9605bdc)
|
|
69
|
+
|
|
70
|
+
```sh
|
|
71
|
+
python bin/generate_checksum.py bin/message.json
|
|
72
|
+
```
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
[tool.poetry]
|
|
2
2
|
name = "spei-python"
|
|
3
|
-
version = "0.12.
|
|
3
|
+
version = "0.12.3"
|
|
4
4
|
description = ""
|
|
5
5
|
authors = ["gonz <gonzasestopal@gmail.com>"]
|
|
6
6
|
readme = "README.md"
|
|
@@ -32,7 +32,7 @@ build-backend = "poetry.core.masonry.api"
|
|
|
32
32
|
|
|
33
33
|
[tool.commitizen]
|
|
34
34
|
name = "cz_conventional_commits"
|
|
35
|
-
version = "0.12.
|
|
35
|
+
version = "0.12.3"
|
|
36
36
|
tag_format = "v$version"
|
|
37
37
|
bump_message = "bump: Semantic Release Bot: Release Version: $new_version 🤖🚀 [skip ci]"
|
|
38
38
|
version_files = [
|
|
@@ -0,0 +1,181 @@
|
|
|
1
|
+
# RegistraOrden
|
|
2
|
+
Create a new order in SPEI as XML based on [mensaje.xsd](https://drive.google.com/file/d/1bf28_MmSRywfCvIwcPO2IyaEOwPFvKlJ/view?usp=sharing) and returns a response XML.
|
|
3
|
+
|
|
4
|
+
**op_fecha_oper** - int **_required_** This should match karpay date of operation.
|
|
5
|
+
|
|
6
|
+
**op_folio** - str **_required_** This should be -1 when category is CARGAR_ODP.
|
|
7
|
+
|
|
8
|
+
**op_monto** - str **_required_** Order amount as **string**.
|
|
9
|
+
|
|
10
|
+
**op_tp_clave** [int](/spei/types.py#4) **_required_** This should be **1** for third to third payments.
|
|
11
|
+
|
|
12
|
+
**op_cve_rastreo** - str **_required_** Unique transfer tracking code. (?)
|
|
13
|
+
|
|
14
|
+
**op_estado** - [int](/spei/types.py#74) **_required_** Order status.
|
|
15
|
+
|
|
16
|
+
**op_tipo_orden** - [int](/spei/types.py#31) **_required_** Order type.
|
|
17
|
+
|
|
18
|
+
**op_prioridad** - [int](/spei/types.py#56) **_required_** Order priority.
|
|
19
|
+
|
|
20
|
+
**op_me_clave** - [int](/spei/types.py#89) **_required_** Order transmission method
|
|
21
|
+
|
|
22
|
+
**op_topologia** - str **_required_** Order SPEI notification mechanism.
|
|
23
|
+
|
|
24
|
+
**op_usu_clave** - str **_required_** Username who generated the order and should be defined in karpay catalog.
|
|
25
|
+
|
|
26
|
+
**op_ins_clave** - digits(5, 5) **_required_** Registered institution code, this is provided by BANXICO
|
|
27
|
+
|
|
28
|
+
**op_fecha_cap** - int Order captured timestamp inside E-Karpay (yyyymmdd)
|
|
29
|
+
|
|
30
|
+
Optional depending on order type
|
|
31
|
+
|
|
32
|
+
**op_clave** - int Unique E-Karpay identifier
|
|
33
|
+
|
|
34
|
+
**op_nom_ord** - str Payer full name.
|
|
35
|
+
|
|
36
|
+
**op_ord_clave** - [int](/spei/types.py#81) Payer account institution code
|
|
37
|
+
|
|
38
|
+
**op_tc_clave_ord** - [int](/spei/types.py#36) Payer account type.
|
|
39
|
+
|
|
40
|
+
**op_cuenta_ord** - int Payer account number
|
|
41
|
+
|
|
42
|
+
**op_rfc_curp_ord** - str Payer identification number
|
|
43
|
+
|
|
44
|
+
**op_nom_ben** - str Beneficiary full name
|
|
45
|
+
|
|
46
|
+
**op_tc_clave_ben** - [int](/spei/types.py#36) Beneficiary account type
|
|
47
|
+
|
|
48
|
+
**op_cuenta_ben** - str Beneficiary Account number
|
|
49
|
+
|
|
50
|
+
**op_rfc_curp_ben** str Beneficiary identification number
|
|
51
|
+
|
|
52
|
+
**op_nom_ben_2** - str Additional beneficiary name
|
|
53
|
+
|
|
54
|
+
**op_tc_clave_ben_2** - [int](/spei/types.py#36) Additional beneficiary account type
|
|
55
|
+
|
|
56
|
+
**op_cuenta_ben_2** - str Additional beneficiary Account number
|
|
57
|
+
|
|
58
|
+
**op_rfc_curp_ben_2** - str Additional beneficiary identification number
|
|
59
|
+
|
|
60
|
+
**op_concepto_pago** - str Used when op_tp_clave requires a concept of maximum length of 210.
|
|
61
|
+
|
|
62
|
+
**op_concepto_pag_2** - str Used when op_tp_clave requires a concept of maximum length of 40.
|
|
63
|
+
|
|
64
|
+
**op_iva** float - Order correspinding taxes (if applicable)
|
|
65
|
+
|
|
66
|
+
**op_ref_numerica** str Order reference number
|
|
67
|
+
|
|
68
|
+
**op_ref_cobranza** - str Only used for root account payments reference.
|
|
69
|
+
|
|
70
|
+
**op_to_clave** - [int](/spei/types.py#4) Operation type that the ordering client wishes to settle with the bank.
|
|
71
|
+
|
|
72
|
+
**op_cd_clave** - [int] Devolution cause
|
|
73
|
+
|
|
74
|
+
**op_folio_servidor** - int Server invoice number
|
|
75
|
+
|
|
76
|
+
**op_usu_autoriza** - str Order's user authorization name
|
|
77
|
+
|
|
78
|
+
**op_err_clave** - [int](/spei/errors.py) Order error code
|
|
79
|
+
|
|
80
|
+
**op_razon_rechazo** - str Order rejection description
|
|
81
|
+
|
|
82
|
+
**op_hora_cap** - int Order captured hour timestamp (hhmmss)
|
|
83
|
+
|
|
84
|
+
**op_hora_liq_bm** - int Order settlement hour timestamp on BANXICO (hhmmss)
|
|
85
|
+
|
|
86
|
+
**op_hora_liq_sist** - int Order settlement hour timestamp on E-Karpay
|
|
87
|
+
|
|
88
|
+
**op_cde** - string ODP Original encryption code
|
|
89
|
+
|
|
90
|
+
**op_cuenta_dev** - string Property only used by scotiaBank
|
|
91
|
+
|
|
92
|
+
**op_hora_lecturaHost** - int Order read at hour timestamp on E-Karpay (hhmmss)
|
|
93
|
+
|
|
94
|
+
**op_hora_insercion** - int Order saved at hour timestamp on E-Karpay (hhmmss)
|
|
95
|
+
|
|
96
|
+
**hr_deposito_acuse_banxico** - int Order settled at hour timestamp on E-Karpay (hhmmss)
|
|
97
|
+
|
|
98
|
+
**paq_folio** - int Invoice package number
|
|
99
|
+
|
|
100
|
+
**ah_ar_clave** - int Area code
|
|
101
|
+
|
|
102
|
+
**emp_clave** - int Company code
|
|
103
|
+
|
|
104
|
+
**paq_folio_ori** - int Original invoice package number
|
|
105
|
+
|
|
106
|
+
**op_folio_ori** - int Original invoice number
|
|
107
|
+
|
|
108
|
+
**op_rastreo_ori** - str Original tracking code
|
|
109
|
+
|
|
110
|
+
**op_monto_intereses** - float Gross order amount
|
|
111
|
+
|
|
112
|
+
**op_info_factura** - str Bill information
|
|
113
|
+
|
|
114
|
+
**op_indica_ben_rec** - str Beneficiary name
|
|
115
|
+
|
|
116
|
+
**op_firma_dig** - str Order signature generated through algorithm.
|
|
117
|
+
|
|
118
|
+
<--- CODI --->
|
|
119
|
+
|
|
120
|
+
**op_num_cel_ord** - int Payer phone number
|
|
121
|
+
|
|
122
|
+
**op_digito_ver_ord** - int Payer verification digit number
|
|
123
|
+
|
|
124
|
+
**op_num_cel_ben** - int Beneficiary phone number
|
|
125
|
+
|
|
126
|
+
**op_digito_ver_ben** - int Beneficiary verification digit number
|
|
127
|
+
|
|
128
|
+
**op_folio_codi** - str Digital invoice scheme
|
|
129
|
+
|
|
130
|
+
**op_comision_trans** - int Operation comission
|
|
131
|
+
|
|
132
|
+
**op_monto_comision** - float Comission Amount
|
|
133
|
+
|
|
134
|
+
**op_cert_comer_env** - int certificate serial number
|
|
135
|
+
|
|
136
|
+
**op_digito_ver_comer** - int Merchant verification digit number
|
|
137
|
+
|
|
138
|
+
|
|
139
|
+
## Order Types
|
|
140
|
+
You must use one of our available order types.
|
|
141
|
+
|
|
142
|
+
- [Tercero A Tercero](/spei/resources/orden.py#107)
|
|
143
|
+
|
|
144
|
+
## Request
|
|
145
|
+
|
|
146
|
+
```python
|
|
147
|
+
order = client.registra_orden({
|
|
148
|
+
'op_fecha_oper': 20230309,
|
|
149
|
+
'op_folio': 1
|
|
150
|
+
'op_ins_clave': 90699,
|
|
151
|
+
'op_monto': 1000,
|
|
152
|
+
'op_tp_clave': 1,
|
|
153
|
+
'op_cve_rastreo': 'TERCERO001',
|
|
154
|
+
'op_estado': 'A',
|
|
155
|
+
'op_tipo_orden': 'E',
|
|
156
|
+
'op_prioridad': 0,
|
|
157
|
+
'op_me_clave': 2,
|
|
158
|
+
'op_topologia': 'V'
|
|
159
|
+
'op_usu_clave': 'ADMIN',
|
|
160
|
+
'op_ord_clave': '90699',
|
|
161
|
+
'op_nom_ord': 'ORDENANTE',
|
|
162
|
+
'op_tc_clave_ord': '40',
|
|
163
|
+
'op_cuenta_ord': '646731258600008291',
|
|
164
|
+
'op_rfc_curp_ord': 'HEHJ891212MOCRRB04',
|
|
165
|
+
'op_nom_ben': 'BENEFICIARIO',
|
|
166
|
+
'op_tc_clave_ben': '40',
|
|
167
|
+
'op_cuenta_ben': '519526509743147521',
|
|
168
|
+
'op_concepto_pag_2': 'servicios',
|
|
169
|
+
'op_ref_numerica': '567',
|
|
170
|
+
'op_firma_dig': 'FIRMADIGITAL001'
|
|
171
|
+
})
|
|
172
|
+
```
|
|
173
|
+
|
|
174
|
+
The actual payload will look something like this.
|
|
175
|
+
|
|
176
|
+
[Order XML](../tests/fixtures/orden.xml)
|
|
177
|
+
|
|
178
|
+
## Response
|
|
179
|
+
We **must** always return XML as defined in [respuesta](/spei/resources/respuesta.py#8).
|
|
180
|
+
|
|
181
|
+
[Respuesta XML](../tests/fixtures/respuesta.xml)
|