sincpro-payments-sdk 0.2.1__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.
- sincpro_payments_sdk-0.2.1/LICENSE.md +61 -0
- sincpro_payments_sdk-0.2.1/PKG-INFO +19 -0
- sincpro_payments_sdk-0.2.1/README.md +3 -0
- sincpro_payments_sdk-0.2.1/pyproject.toml +44 -0
- sincpro_payments_sdk-0.2.1/sincpro_payments_sdk/__init__.py +0 -0
- sincpro_payments_sdk-0.2.1/sincpro_payments_sdk/apps/__init__.py +0 -0
- sincpro_payments_sdk-0.2.1/sincpro_payments_sdk/apps/cybersource/__init__.py +0 -0
- sincpro_payments_sdk-0.2.1/sincpro_payments_sdk/apps/cybersource/adapters/__init__.py +0 -0
- sincpro_payments_sdk-0.2.1/sincpro_payments_sdk/apps/cybersource/adapters/cybersource_rest_api/__init__.py +0 -0
- sincpro_payments_sdk-0.2.1/sincpro_payments_sdk/apps/cybersource/adapters/cybersource_rest_api/common.py +25 -0
- sincpro_payments_sdk-0.2.1/sincpro_payments_sdk/apps/cybersource/adapters/cybersource_rest_api/payer_auth_adapter.py +228 -0
- sincpro_payments_sdk-0.2.1/sincpro_payments_sdk/apps/cybersource/adapters/cybersource_rest_api/payment_adapter.py +392 -0
- sincpro_payments_sdk-0.2.1/sincpro_payments_sdk/apps/cybersource/adapters/cybersource_rest_api/tokenization_adapter.py +116 -0
- sincpro_payments_sdk-0.2.1/sincpro_payments_sdk/apps/cybersource/domain/__init__.py +23 -0
- sincpro_payments_sdk-0.2.1/sincpro_payments_sdk/apps/cybersource/domain/card.py +59 -0
- sincpro_payments_sdk-0.2.1/sincpro_payments_sdk/apps/cybersource/domain/country_codes.py +3721 -0
- sincpro_payments_sdk-0.2.1/sincpro_payments_sdk/apps/cybersource/domain/credentials.py +12 -0
- sincpro_payments_sdk-0.2.1/sincpro_payments_sdk/apps/cybersource/domain/customer.py +33 -0
- sincpro_payments_sdk-0.2.1/sincpro_payments_sdk/apps/cybersource/domain/payments.py +95 -0
- sincpro_payments_sdk-0.2.1/sincpro_payments_sdk/apps/cybersource/infrastructure/__init__.py +2 -0
- sincpro_payments_sdk-0.2.1/sincpro_payments_sdk/apps/cybersource/infrastructure/http_signature.py +140 -0
- sincpro_payments_sdk-0.2.1/sincpro_payments_sdk/apps/cybersource/infrastructure/loader_credencials.py +19 -0
- sincpro_payments_sdk-0.2.1/sincpro_payments_sdk/apps/cybersource/use_cases/__init__.py +45 -0
- sincpro_payments_sdk-0.2.1/sincpro_payments_sdk/apps/cybersource/use_cases/payments/__init__.py +7 -0
- sincpro_payments_sdk-0.2.1/sincpro_payments_sdk/apps/cybersource/use_cases/payments/consume_link.py +29 -0
- sincpro_payments_sdk-0.2.1/sincpro_payments_sdk/apps/cybersource/use_cases/payments/direct_payment.py +234 -0
- sincpro_payments_sdk-0.2.1/sincpro_payments_sdk/apps/cybersource/use_cases/payments/direct_payment_with_token.py +175 -0
- sincpro_payments_sdk-0.2.1/sincpro_payments_sdk/apps/cybersource/use_cases/payments/recurrent_payment.py +0 -0
- sincpro_payments_sdk-0.2.1/sincpro_payments_sdk/apps/cybersource/use_cases/payments/refund_payment.py +60 -0
- sincpro_payments_sdk-0.2.1/sincpro_payments_sdk/apps/cybersource/use_cases/pre_payment/__init__.py +3 -0
- sincpro_payments_sdk-0.2.1/sincpro_payments_sdk/apps/cybersource/use_cases/pre_payment/step_1.py +49 -0
- sincpro_payments_sdk-0.2.1/sincpro_payments_sdk/apps/cybersource/use_cases/pre_payment/step_2.py +99 -0
- sincpro_payments_sdk-0.2.1/sincpro_payments_sdk/apps/cybersource/use_cases/pre_payment/step_3_optional.py +62 -0
- sincpro_payments_sdk-0.2.1/sincpro_payments_sdk/apps/cybersource/use_cases/tokenization/__init__.py +1 -0
- sincpro_payments_sdk-0.2.1/sincpro_payments_sdk/apps/cybersource/use_cases/tokenization/create_customer_payment_method.py +33 -0
- sincpro_payments_sdk-0.2.1/sincpro_payments_sdk/apps/cybersource/use_cases/tokenization/create_payment_method.py +65 -0
- sincpro_payments_sdk-0.2.1/sincpro_payments_sdk/apps/qr/__init__.py +0 -0
- sincpro_payments_sdk-0.2.1/sincpro_payments_sdk/infrastructure/__init__.py +0 -0
- sincpro_payments_sdk-0.2.1/sincpro_payments_sdk/infrastructure/client_api.py +120 -0
- sincpro_payments_sdk-0.2.1/sincpro_payments_sdk/infrastructure/domain/__init__.py +1 -0
- sincpro_payments_sdk-0.2.1/sincpro_payments_sdk/infrastructure/domain/value_object.py +33 -0
- sincpro_payments_sdk-0.2.1/sincpro_payments_sdk/infrastructure/pydantic.py +9 -0
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
Copyright (c) 2024 Sincpro S.R.L
|
|
2
|
+
LICENCIA EMPRESARIAL DE USO DE SOFTWARE
|
|
3
|
+
|
|
4
|
+
Términos y Condiciones
|
|
5
|
+
|
|
6
|
+
1. Definiciones
|
|
7
|
+
|
|
8
|
+
1.1. "Software" hace referencia a cualquier programa de computadora y su documentación relacionada desarrollados
|
|
9
|
+
por Sincpro Developers.
|
|
10
|
+
|
|
11
|
+
1.2. "Cliente" se refiere a cualquier entidad o individuo que obtiene una licencia para utilizar el Software bajo
|
|
12
|
+
los términos y condiciones establecidos en este documento.
|
|
13
|
+
|
|
14
|
+
2. Concesión de Licencia
|
|
15
|
+
Sincpro Developers otorga al Cliente una licencia no exclusiva, no transferible y limitada para utilizar el Software
|
|
16
|
+
de acuerdo con los términos y condiciones establecidos en este documento.
|
|
17
|
+
|
|
18
|
+
3. Propiedad y Derechos de Autor
|
|
19
|
+
|
|
20
|
+
3.1. El Software es propiedad exclusiva de Sincpro Developers y está protegido por leyes de derechos de autor y otras
|
|
21
|
+
leyes de propiedad intelectual.
|
|
22
|
+
|
|
23
|
+
3.2. El Cliente reconoce y acepta que no adquiere ningún derecho de propiedad sobre el Software, excepto los derechos
|
|
24
|
+
limitados otorgados por esta licencia.
|
|
25
|
+
|
|
26
|
+
4. Alcance de Uso
|
|
27
|
+
|
|
28
|
+
4.1. El Cliente está autorizado a utilizar el Software únicamente para los fines y en la forma especificados en la
|
|
29
|
+
documentación proporcionada por Sincpro Developers.
|
|
30
|
+
|
|
31
|
+
4.2. El uso del Software por parte del Cliente está limitado al número de usuarios y ubicaciones geográficas
|
|
32
|
+
especificados en la documentación.
|
|
33
|
+
|
|
34
|
+
5. Restricciones
|
|
35
|
+
|
|
36
|
+
5.1. Queda estrictamente prohibido al Cliente: (a) copiar, modificar o crear trabajos derivados del Software;
|
|
37
|
+
(b) sublicenciar, transferir o distribuir el Software a terceros;
|
|
38
|
+
(c) utilizar el Software de manera que infrinja las leyes aplicables.
|
|
39
|
+
|
|
40
|
+
6. Sanciones y Consecuencias
|
|
41
|
+
|
|
42
|
+
6.1. El uso no autorizado o en violación de los términos de esta licencia puede resultar en acciones legales y
|
|
43
|
+
sanciones que Sincpro Developers considera necesarias y apropiadas.
|
|
44
|
+
|
|
45
|
+
7. Protección Legal
|
|
46
|
+
|
|
47
|
+
7.1. Estos términos y condiciones están sujetos a las leyes y regulaciones aplicables. El Cliente acepta someterse
|
|
48
|
+
a la jurisdicción de los tribunales competentes en caso de disputa relacionada con el uso del Software.
|
|
49
|
+
|
|
50
|
+
8. Cambios y Actualizaciones
|
|
51
|
+
|
|
52
|
+
8.1. Sincpro Developers se reserva el derecho de actualizar o modificar estos términos y condiciones en cualquier
|
|
53
|
+
momento. Dichos cambios serán efectivos a partir de la fecha de notificación al Cliente.
|
|
54
|
+
|
|
55
|
+
9. Aceptación
|
|
56
|
+
|
|
57
|
+
9.1. Al utilizar el Software, el Cliente acepta y se compromete a cumplir con los términos y condiciones establecidos
|
|
58
|
+
en este documento.
|
|
59
|
+
|
|
60
|
+
Para cualquier consulta sobre esta licencia o para solicitar permisos adicionales, comuníquese con Sincpro Developers
|
|
61
|
+
en Bolivia, Cochabamba Mayor rocha #161 y ayacucho o informacion@sincpro.com.bo
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
Metadata-Version: 2.1
|
|
2
|
+
Name: sincpro-payments-sdk
|
|
3
|
+
Version: 0.2.1
|
|
4
|
+
Summary: Agnostic SDK for payments like cybersource, Paypal and local payments
|
|
5
|
+
License: Sincpro S.R.L.
|
|
6
|
+
Author: Gutierrez, Andres
|
|
7
|
+
Author-email: andru1236@gmail.com
|
|
8
|
+
Requires-Python: >=3.12,<4.0
|
|
9
|
+
Classifier: License :: Other/Proprietary License
|
|
10
|
+
Classifier: Programming Language :: Python :: 3
|
|
11
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
12
|
+
Requires-Dist: pydantic (>=2.9.2,<3.0.0)
|
|
13
|
+
Requires-Dist: requests (>=2.32.3,<3.0.0)
|
|
14
|
+
Requires-Dist: sincpro-framework (>=1.2.0,<2.0.0)
|
|
15
|
+
Description-Content-Type: text/markdown
|
|
16
|
+
|
|
17
|
+
## Sincpro payments
|
|
18
|
+
|
|
19
|
+
> Allow easy interface to interact with the payment gateway
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
[tool.poetry]
|
|
2
|
+
name = "sincpro-payments-sdk"
|
|
3
|
+
version = "0.2.1"
|
|
4
|
+
description = "Agnostic SDK for payments like cybersource, Paypal and local payments"
|
|
5
|
+
authors = ["Gutierrez, Andres <andru1236@gmail.com>"]
|
|
6
|
+
license = "Sincpro S.R.L."
|
|
7
|
+
readme = "README.md"
|
|
8
|
+
|
|
9
|
+
[tool.poetry.dependencies]
|
|
10
|
+
python = "^3.12"
|
|
11
|
+
requests = "^2.32.3"
|
|
12
|
+
pydantic = "^2.9.2"
|
|
13
|
+
sincpro-framework = "^1.2.0"
|
|
14
|
+
|
|
15
|
+
[tool.poetry.group.dev.dependencies]
|
|
16
|
+
isort = "^5.12.0"
|
|
17
|
+
black = "^24.8.0"
|
|
18
|
+
pytest = "^8.3.3"
|
|
19
|
+
ipython = "^8.28.0"
|
|
20
|
+
autoflake = "^2.3.1"
|
|
21
|
+
jupyterlab = "^4.2.5"
|
|
22
|
+
icecream = "^2.1.3"
|
|
23
|
+
|
|
24
|
+
[build-system]
|
|
25
|
+
requires = ["poetry-core"]
|
|
26
|
+
build-backend = "poetry.core.masonry.api"
|
|
27
|
+
|
|
28
|
+
[tool.pylint]
|
|
29
|
+
disable = [
|
|
30
|
+
"missing-docstring",
|
|
31
|
+
"fixme",
|
|
32
|
+
"C0103",
|
|
33
|
+
"C0301",
|
|
34
|
+
"R0903",
|
|
35
|
+
"C0413",
|
|
36
|
+
"W1203",
|
|
37
|
+
"I1101",
|
|
38
|
+
"W1309",
|
|
39
|
+
"R0902",
|
|
40
|
+
"C0415",
|
|
41
|
+
]
|
|
42
|
+
|
|
43
|
+
[tool.black]
|
|
44
|
+
line-length = 94
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
"""Common DTOs for CyberSource REST API."""
|
|
2
|
+
|
|
3
|
+
from sincpro_payments_sdk.apps.cybersource.domain import LinkSerMMDRequired
|
|
4
|
+
from sincpro_payments_sdk.infrastructure.client_api import ApiResponse
|
|
5
|
+
from sincpro_payments_sdk.infrastructure.pydantic import BaseModel
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
class CyberSourceBaseResponse(ApiResponse):
|
|
9
|
+
id: str
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
class LinkResponse(BaseModel):
|
|
13
|
+
"""Link response."""
|
|
14
|
+
|
|
15
|
+
href: str
|
|
16
|
+
method: str
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
def create_merchant_def_map(merchant_defined_data: LinkSerMMDRequired) -> list[dict]:
|
|
20
|
+
"""Create a map of merchant defined data."""
|
|
21
|
+
format_merchant_defined_data = list()
|
|
22
|
+
for key, value in merchant_defined_data.model_dump().items():
|
|
23
|
+
last_word = key.split("_")[-1]
|
|
24
|
+
format_merchant_defined_data.append({"key": last_word, "value": value})
|
|
25
|
+
return format_merchant_defined_data
|
|
@@ -0,0 +1,228 @@
|
|
|
1
|
+
"""Payer Auth API adapter."""
|
|
2
|
+
|
|
3
|
+
from typing import Literal
|
|
4
|
+
|
|
5
|
+
from sincpro_payments_sdk.apps.cybersource.domain import (
|
|
6
|
+
CardMonthOrDay,
|
|
7
|
+
CardNumber,
|
|
8
|
+
CardType,
|
|
9
|
+
CardYear4Digits,
|
|
10
|
+
LinkSerMMDRequired,
|
|
11
|
+
)
|
|
12
|
+
from sincpro_payments_sdk.infrastructure.client_api import ClientAPI
|
|
13
|
+
|
|
14
|
+
# isort: off
|
|
15
|
+
from sincpro_payments_sdk.apps.cybersource.infrastructure import (
|
|
16
|
+
CyberSourceAuth,
|
|
17
|
+
get_credential,
|
|
18
|
+
)
|
|
19
|
+
from .common import CyberSourceBaseResponse, create_merchant_def_map
|
|
20
|
+
|
|
21
|
+
# isort: on
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
class SetupAuthenticationResponse(CyberSourceBaseResponse):
|
|
25
|
+
client_ref_info: str
|
|
26
|
+
access_token: str
|
|
27
|
+
device_data_collection_url: str
|
|
28
|
+
reference_id: str
|
|
29
|
+
token: str
|
|
30
|
+
status: Literal["COMPLETED", "FAILED"]
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
class AuthenticationResponse(CyberSourceBaseResponse):
|
|
34
|
+
status: Literal[
|
|
35
|
+
"AUTHENTICATION_SUCCESSFUL", "PENDING_AUTHENTICATION", "PENDING_AUTHENTICATION"
|
|
36
|
+
]
|
|
37
|
+
auth_transaction_id: str
|
|
38
|
+
client_ref_info: str
|
|
39
|
+
cavv: str | None = None
|
|
40
|
+
challenge_required: str | None = None
|
|
41
|
+
access_token: str | None = None
|
|
42
|
+
step_up_url: str | None = None
|
|
43
|
+
token: str | None = None
|
|
44
|
+
|
|
45
|
+
|
|
46
|
+
class PayerAuthenticationAdapter(ClientAPI):
|
|
47
|
+
"""Adapter for CyberSource Payer Authentication API requests.
|
|
48
|
+
|
|
49
|
+
Steps to execute the process Payer Authentication:
|
|
50
|
+
- Setup Payer Authentication
|
|
51
|
+
- Authenticate Enrollment
|
|
52
|
+
- Validate Authentication
|
|
53
|
+
"""
|
|
54
|
+
|
|
55
|
+
ROUTE_SETUP_PAYER_AUTH = "/risk/v1/authentication-setups"
|
|
56
|
+
ROUTE_AUTH_ENROLLMENT = "/risk/v1/authentications"
|
|
57
|
+
ROUTE_VALIDATE_AUTH = "/risk/v1/authentication-results"
|
|
58
|
+
|
|
59
|
+
def __init__(self):
|
|
60
|
+
"""Initialize with a CyberSource client."""
|
|
61
|
+
self.ssl = "https://"
|
|
62
|
+
self.host = "apitest.cybersource.com"
|
|
63
|
+
super().__init__(self.base_url, auth=CyberSourceAuth(get_credential()))
|
|
64
|
+
|
|
65
|
+
@property
|
|
66
|
+
def base_url(self):
|
|
67
|
+
"""Get the base URL for the CyberSource API."""
|
|
68
|
+
return f"{self.ssl}{self.host}"
|
|
69
|
+
|
|
70
|
+
def setup_payer_auth(
|
|
71
|
+
self,
|
|
72
|
+
card_number: CardNumber,
|
|
73
|
+
month: CardMonthOrDay,
|
|
74
|
+
year: CardYear4Digits,
|
|
75
|
+
card_type: CardType,
|
|
76
|
+
transaction_ref: str,
|
|
77
|
+
) -> SetupAuthenticationResponse:
|
|
78
|
+
"""Setup Payer Authentication with CyberSource."""
|
|
79
|
+
payload = {
|
|
80
|
+
"clientReferenceInformation": {"code": transaction_ref},
|
|
81
|
+
"paymentInformation": {
|
|
82
|
+
"card": {
|
|
83
|
+
"type": card_type,
|
|
84
|
+
"expirationMonth": month,
|
|
85
|
+
"expirationYear": year,
|
|
86
|
+
"number": card_number,
|
|
87
|
+
}
|
|
88
|
+
},
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
response = self.execute_request(
|
|
92
|
+
self.ROUTE_SETUP_PAYER_AUTH,
|
|
93
|
+
"POST",
|
|
94
|
+
data=payload,
|
|
95
|
+
)
|
|
96
|
+
dict_response = response.json()
|
|
97
|
+
if "errorInformation" in dict_response:
|
|
98
|
+
raise Exception(str(dict_response["errorInformation"]))
|
|
99
|
+
|
|
100
|
+
return SetupAuthenticationResponse(
|
|
101
|
+
raw_response=dict_response,
|
|
102
|
+
id=dict_response.get("id"),
|
|
103
|
+
client_ref_info=dict_response["clientReferenceInformation"]["code"],
|
|
104
|
+
access_token=dict_response["consumerAuthenticationInformation"]["accessToken"],
|
|
105
|
+
device_data_collection_url=dict_response["consumerAuthenticationInformation"][
|
|
106
|
+
"deviceDataCollectionUrl"
|
|
107
|
+
],
|
|
108
|
+
reference_id=dict_response["consumerAuthenticationInformation"]["referenceId"],
|
|
109
|
+
token=dict_response["consumerAuthenticationInformation"]["token"],
|
|
110
|
+
status=dict_response.get("status"),
|
|
111
|
+
)
|
|
112
|
+
|
|
113
|
+
def auth_enrollment(
|
|
114
|
+
self,
|
|
115
|
+
card_number: CardNumber,
|
|
116
|
+
month: CardMonthOrDay,
|
|
117
|
+
year: CardYear4Digits,
|
|
118
|
+
card_type: CardType,
|
|
119
|
+
transaction_ref: str,
|
|
120
|
+
reference_id: str,
|
|
121
|
+
amount: str | float,
|
|
122
|
+
currency: str,
|
|
123
|
+
linkser_merchant_def: LinkSerMMDRequired | None = None,
|
|
124
|
+
) -> AuthenticationResponse:
|
|
125
|
+
"""Authenticate enrollment with CyberSource."""
|
|
126
|
+
payload = {
|
|
127
|
+
"paymentInformation": {
|
|
128
|
+
"card": {
|
|
129
|
+
"type": card_type,
|
|
130
|
+
"expirationMonth": month,
|
|
131
|
+
"expirationYear": year,
|
|
132
|
+
"number": card_number,
|
|
133
|
+
}
|
|
134
|
+
},
|
|
135
|
+
"clientReferenceInformation": {"code": transaction_ref},
|
|
136
|
+
"consumerAuthenticationInformation": {
|
|
137
|
+
"referenceId": reference_id,
|
|
138
|
+
"deviceChannel": "Browser",
|
|
139
|
+
},
|
|
140
|
+
"orderInformation": {
|
|
141
|
+
"amountDetails": {
|
|
142
|
+
"totalAmount": amount,
|
|
143
|
+
"currency": currency,
|
|
144
|
+
},
|
|
145
|
+
},
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
if linkser_merchant_def:
|
|
149
|
+
payload["merchantDefinedInformation"] = create_merchant_def_map(
|
|
150
|
+
linkser_merchant_def
|
|
151
|
+
)
|
|
152
|
+
|
|
153
|
+
response = self.execute_request(
|
|
154
|
+
self.ROUTE_AUTH_ENROLLMENT,
|
|
155
|
+
"POST",
|
|
156
|
+
data=payload,
|
|
157
|
+
)
|
|
158
|
+
dict_response = response.json()
|
|
159
|
+
|
|
160
|
+
return AuthenticationResponse(
|
|
161
|
+
raw_response=dict_response,
|
|
162
|
+
id=dict_response.get("id"),
|
|
163
|
+
status=dict_response.get("status"),
|
|
164
|
+
auth_transaction_id=dict_response["consumerAuthenticationInformation"][
|
|
165
|
+
"authenticationTransactionId"
|
|
166
|
+
],
|
|
167
|
+
client_ref_info=dict_response["clientReferenceInformation"]["code"],
|
|
168
|
+
cavv=dict_response["consumerAuthenticationInformation"].get("cavv", None),
|
|
169
|
+
challenge_required=dict_response["consumerAuthenticationInformation"].get(
|
|
170
|
+
"challengeRequired", None
|
|
171
|
+
),
|
|
172
|
+
access_token=dict_response["consumerAuthenticationInformation"].get(
|
|
173
|
+
"accessToken", None
|
|
174
|
+
),
|
|
175
|
+
step_up_url=dict_response["consumerAuthenticationInformation"].get(
|
|
176
|
+
"stepUpUrl", None
|
|
177
|
+
),
|
|
178
|
+
token=dict_response["consumerAuthenticationInformation"].get("token", None),
|
|
179
|
+
)
|
|
180
|
+
|
|
181
|
+
def validate_auth(
|
|
182
|
+
self,
|
|
183
|
+
card_number: CardNumber,
|
|
184
|
+
month: CardMonthOrDay,
|
|
185
|
+
year: CardMonthOrDay,
|
|
186
|
+
card_type: CardType,
|
|
187
|
+
auth_transaction_id: str,
|
|
188
|
+
amount: str | float,
|
|
189
|
+
currency: str,
|
|
190
|
+
) -> AuthenticationResponse:
|
|
191
|
+
"""Validate authentication with CyberSource."""
|
|
192
|
+
response = self.execute_request(
|
|
193
|
+
self.ROUTE_AUTH_ENROLLMENT,
|
|
194
|
+
"POST",
|
|
195
|
+
data={
|
|
196
|
+
"paymentInformation": {
|
|
197
|
+
"card": {
|
|
198
|
+
"type": card_type,
|
|
199
|
+
"expirationMonth": month,
|
|
200
|
+
"expirationYear": year,
|
|
201
|
+
"number": card_number,
|
|
202
|
+
}
|
|
203
|
+
},
|
|
204
|
+
"consumerAuthenticationInformation": {
|
|
205
|
+
"authenticationTransactionId": auth_transaction_id
|
|
206
|
+
},
|
|
207
|
+
"orderInformation": {
|
|
208
|
+
"amountDetails": {
|
|
209
|
+
"totalAmount": amount,
|
|
210
|
+
"currency": currency,
|
|
211
|
+
},
|
|
212
|
+
},
|
|
213
|
+
},
|
|
214
|
+
)
|
|
215
|
+
|
|
216
|
+
dict_response = response.json()
|
|
217
|
+
if "errorInformation" in dict_response:
|
|
218
|
+
raise Exception(str(dict_response["errorInformation"]))
|
|
219
|
+
|
|
220
|
+
return AuthenticationResponse(
|
|
221
|
+
raw_response=dict_response,
|
|
222
|
+
id=dict_response.get("id"),
|
|
223
|
+
status=dict_response.get("status"),
|
|
224
|
+
auth_transaction_id=dict_response["consumerAuthenticationInformation"][
|
|
225
|
+
"authenticationTransactionId"
|
|
226
|
+
],
|
|
227
|
+
client_ref_info=dict_response["clientReferenceInformation"]["code"],
|
|
228
|
+
)
|