python-redsys 2.0.0__py3-none-any.whl → 2.2.0__py3-none-any.whl

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.
@@ -0,0 +1,290 @@
1
+ """Named ``Ds_Response`` codes; ``redsys.codes.describe()`` gives their meaning.
2
+
3
+ Responses carry the code as four digits (``'0195'``); ``Response.response_code`` is the integer.
4
+ """
5
+
6
+ AUTHORIZED = 0
7
+ """Approved payment or pre-authorization; any code from 0 to 99 means the same."""
8
+
9
+ AUTHORIZED_LAST = 99
10
+ """Last code of the authorized range: 0000 to 0099 all mean an authorized payment or preauthorization."""
11
+
12
+ CARD_EXPIRED = 101
13
+ """Card expired; do not retry."""
14
+
15
+ CARD_INVALID = 102
16
+ """Card invalid; do not retry."""
17
+
18
+ OPERATION_NOT_ALLOWED_FOR_CARD = 104
19
+ """Operation not allowed for this card; ask issuer."""
20
+
21
+ PIN_ATTEMPTS_EXCEEDED = 106
22
+ """Too many PIN attempts."""
23
+
24
+ CONTACT_ISSUER = 107
25
+ """Cardholder should contact the issuer."""
26
+
27
+ AMOUNT_NOT_ALLOWED = 110
28
+ """Amount not allowed for this operation; ask issuer."""
29
+
30
+ PIN_REQUIRED = 112
31
+ """PIN is required."""
32
+
33
+ CARD_NOT_VALID_FOR_OPERATION = 114
34
+ """Card cannot be used for this operation; ask issuer."""
35
+
36
+ CARD_INVALID_115 = 115
37
+ """Card invalid; do not retry."""
38
+
39
+ INSUFFICIENT_FUNDS = 116
40
+ """Insufficient funds."""
41
+
42
+ WRONG_PIN = 117
43
+ """Wrong PIN."""
44
+
45
+ CARD_NOT_REGISTERED = 118
46
+ """Card not registered; do not retry."""
47
+
48
+ TRANSACTION_LIMIT_EXCEEDED = 121
49
+ """Transaction limit exceeded; ask issuer."""
50
+
51
+ CARDHOLDER_AUTHENTICATION_FAILED_ASK_ISSUER = 123
52
+ """Cardholder authentication failed; ask issuer."""
53
+
54
+ CARD_NOT_ACTIVE = 125
55
+ """Card not active for use; do not retry."""
56
+
57
+ AUTHENTICATION_FORMAT_ERROR = 126
58
+ """Authentication format error; ask issuer."""
59
+
60
+ WRONG_SECURITY_CODE = 129
61
+ """Wrong security code (CVV2/CVC2)."""
62
+
63
+ CURRENCY_NOT_SUPPORTED = 130
64
+ """Currency not supported by the issuer."""
65
+
66
+ UNAUTHENTICATED_LIMIT_EXCEEDED = 162
67
+ """Limit of unauthenticated transactions exceeded."""
68
+
69
+ CARD_INACTIVE = 163
70
+ """Card inactive."""
71
+
72
+ CARD_INACTIVE_171 = 171
73
+ """Card inactive."""
74
+
75
+ DECLINED_DO_NOT_RETRY = 172
76
+ """Declined; brand says never retry."""
77
+
78
+ DECLINED_UPDATE_CARD_DATA = 173
79
+ """Declined; retry only with updated card data."""
80
+
81
+ DECLINED_RETRY_AFTER_72_HOURS = 174
82
+ """Declined; wait 72 hours before retrying."""
83
+
84
+ CARD_NOT_ACCEPTED = 180
85
+ """Card not accepted by this service."""
86
+
87
+ CARD_DEBIT_RESTRICTED = 181
88
+ """Card has debit restrictions."""
89
+
90
+ CARD_CREDIT_RESTRICTED = 182
91
+ """Card has credit restrictions."""
92
+
93
+ CARDHOLDER_AUTHENTICATION_FAILED = 184
94
+ """Cardholder authentication failed."""
95
+
96
+ AUTHENTICATION_FORMAT_ERROR_187 = 187
97
+ """Authentication format error; ask issuer."""
98
+
99
+ DECLINED_BY_ISSUER = 190
100
+ """Issuer declined without a stated reason."""
101
+
102
+ WRONG_EXPIRY_DATE = 191
103
+ """Wrong expiry date."""
104
+
105
+ AMOUNT_EXCEEDED = 193
106
+ """Amount exceeded."""
107
+
108
+ SCA_REQUIRED = 195
109
+ """Soft decline: SCA authentication required."""
110
+
111
+ CARD_INVALID_201 = 201
112
+ """Card invalid; do not retry."""
113
+
114
+ CARD_BLOCKED_RETAIN = 202
115
+ """Card under temporary block or fraud suspicion; retain."""
116
+
117
+ OPERATION_NOT_ALLOWED_FOR_CARD_OR_TERMINAL = 204
118
+ """Operation not allowed for this card or terminal."""
119
+
120
+ PIN_ATTEMPTS_EXCEEDED_DO_NOT_RETRY = 206
121
+ """Too many PIN attempts; do not retry."""
122
+
123
+ DECLINED = 290
124
+ """Declined without a stated reason."""
125
+
126
+ UPDATE_OR_QUERY_COMPLETED = 300
127
+ """Update or query completed."""
128
+
129
+ CANCELLATION_AUTHORIZED = 400
130
+ """Cancellation (void) approved."""
131
+
132
+ CANCELLATION_AUTHORIZED_LATE = 481
133
+ """Cancellation approved despite excessive delay."""
134
+
135
+ SIGN_OFF_WITHOUT_SESSION = 881
136
+ """Sign-off message without an open session."""
137
+
138
+ REFUND_OR_CONFIRMATION_AUTHORIZED = 900
139
+ """Refund or confirmation approved (also PUCE authentication)."""
140
+
141
+ MERCHANT_NOT_REGISTERED = 904
142
+ """Merchant not registered in FUC."""
143
+
144
+ SYSTEM_ERROR = 909
145
+ """System error."""
146
+
147
+ ISSUER_UNAVAILABLE = 912
148
+ """Issuer unavailable."""
149
+
150
+ DUPLICATE_ORDER = 913
151
+ """Duplicate order."""
152
+
153
+ ALREADY_CANCELED = 940
154
+ """Transaction already canceled."""
155
+
156
+ ORIGINAL_AUTHORIZATION_DECLINED = 941
157
+ """Original authorization was declined."""
158
+
159
+ INVALID_SESSION = 944
160
+ """Wrong session."""
161
+
162
+ DUPLICATE_SYSTEM_REFERENCE = 945
163
+ """Duplicate system transaction reference."""
164
+
165
+ REFUND_NOT_ALLOWED = 950
166
+ """Refund not allowed."""
167
+
168
+ RULES_BREACH = 965
169
+ """Breach of existing rules."""
170
+
171
+ SENT_FOR_EMV3DS_2_1_AUTHENTICATION = 8210
172
+ """Sent to issuer for EMV3DS 2.1 authentication."""
173
+
174
+ SENT_FOR_EMV3DS_2_2_AUTHENTICATION = 8220
175
+ """Sent to issuer for EMV3DS 2.2 authentication."""
176
+
177
+ WRONG_CARD_NUMBER_LENGTH = 9064
178
+ """Card number has the wrong length."""
179
+
180
+ TRANSACTION_TYPE_NOT_ALLOWED_FOR_CARD = 9078
181
+ """Transaction type not allowed for this card."""
182
+
183
+ CARD_DOES_NOT_EXIST = 9093
184
+ """Card does not exist."""
185
+
186
+ REJECTED_BY_INTERNATIONAL_SERVERS = 9094
187
+ """Rejected by international servers."""
188
+
189
+ CARDHOLDER_WITHOUT_SECURE_KEY = 9104
190
+ """Secure-only merchant, cardholder without secure purchase key."""
191
+
192
+ SECURE_OPERATIONS_NOT_ALLOWED = 9218
193
+ """Merchant forbids secure operations on this entry."""
194
+
195
+ CARD_CHECK_DIGIT_FAILED = 9253
196
+ """Card number fails the check digit."""
197
+
198
+ MERCHANT_CANNOT_PREAUTHORIZE = 9256
199
+ """Merchant cannot make pre-authorizations."""
200
+
201
+ CARD_CANNOT_PREAUTHORIZE = 9257
202
+ """Card does not allow pre-authorizations."""
203
+
204
+ ENTRY_RESTRICTION_STOP = 9261
205
+ """Stopped by SIS entry restriction controls."""
206
+
207
+ CANCELED_BY_USER = 9915
208
+ """Payment canceled by the user."""
209
+
210
+ CARD_OPERATION_IN_PROGRESS = 9997
211
+ """Another transaction with the same card in progress."""
212
+
213
+ WAITING_FOR_CARD_DATA = 9998
214
+ """Waiting for card data entry."""
215
+
216
+ SENT_FOR_AUTHENTICATION = 9999
217
+ """Sent to issuer for authentication."""
218
+
219
+ RESPONSE_CODES = (
220
+ AUTHORIZED,
221
+ CARD_EXPIRED,
222
+ CARD_INVALID,
223
+ OPERATION_NOT_ALLOWED_FOR_CARD,
224
+ PIN_ATTEMPTS_EXCEEDED,
225
+ CONTACT_ISSUER,
226
+ AMOUNT_NOT_ALLOWED,
227
+ PIN_REQUIRED,
228
+ CARD_NOT_VALID_FOR_OPERATION,
229
+ CARD_INVALID_115,
230
+ INSUFFICIENT_FUNDS,
231
+ WRONG_PIN,
232
+ CARD_NOT_REGISTERED,
233
+ TRANSACTION_LIMIT_EXCEEDED,
234
+ CARDHOLDER_AUTHENTICATION_FAILED_ASK_ISSUER,
235
+ CARD_NOT_ACTIVE,
236
+ AUTHENTICATION_FORMAT_ERROR,
237
+ WRONG_SECURITY_CODE,
238
+ CURRENCY_NOT_SUPPORTED,
239
+ UNAUTHENTICATED_LIMIT_EXCEEDED,
240
+ CARD_INACTIVE,
241
+ CARD_INACTIVE_171,
242
+ DECLINED_DO_NOT_RETRY,
243
+ DECLINED_UPDATE_CARD_DATA,
244
+ DECLINED_RETRY_AFTER_72_HOURS,
245
+ CARD_NOT_ACCEPTED,
246
+ CARD_DEBIT_RESTRICTED,
247
+ CARD_CREDIT_RESTRICTED,
248
+ CARDHOLDER_AUTHENTICATION_FAILED,
249
+ AUTHENTICATION_FORMAT_ERROR_187,
250
+ DECLINED_BY_ISSUER,
251
+ WRONG_EXPIRY_DATE,
252
+ AMOUNT_EXCEEDED,
253
+ SCA_REQUIRED,
254
+ CARD_INVALID_201,
255
+ CARD_BLOCKED_RETAIN,
256
+ OPERATION_NOT_ALLOWED_FOR_CARD_OR_TERMINAL,
257
+ PIN_ATTEMPTS_EXCEEDED_DO_NOT_RETRY,
258
+ DECLINED,
259
+ UPDATE_OR_QUERY_COMPLETED,
260
+ CANCELLATION_AUTHORIZED,
261
+ CANCELLATION_AUTHORIZED_LATE,
262
+ SIGN_OFF_WITHOUT_SESSION,
263
+ REFUND_OR_CONFIRMATION_AUTHORIZED,
264
+ MERCHANT_NOT_REGISTERED,
265
+ SYSTEM_ERROR,
266
+ ISSUER_UNAVAILABLE,
267
+ DUPLICATE_ORDER,
268
+ ALREADY_CANCELED,
269
+ ORIGINAL_AUTHORIZATION_DECLINED,
270
+ INVALID_SESSION,
271
+ DUPLICATE_SYSTEM_REFERENCE,
272
+ REFUND_NOT_ALLOWED,
273
+ RULES_BREACH,
274
+ SENT_FOR_EMV3DS_2_1_AUTHENTICATION,
275
+ SENT_FOR_EMV3DS_2_2_AUTHENTICATION,
276
+ WRONG_CARD_NUMBER_LENGTH,
277
+ TRANSACTION_TYPE_NOT_ALLOWED_FOR_CARD,
278
+ CARD_DOES_NOT_EXIST,
279
+ REJECTED_BY_INTERNATIONAL_SERVERS,
280
+ CARDHOLDER_WITHOUT_SECURE_KEY,
281
+ SECURE_OPERATIONS_NOT_ALLOWED,
282
+ CARD_CHECK_DIGIT_FAILED,
283
+ MERCHANT_CANNOT_PREAUTHORIZE,
284
+ CARD_CANNOT_PREAUTHORIZE,
285
+ ENTRY_RESTRICTION_STOP,
286
+ CANCELED_BY_USER,
287
+ CARD_OPERATION_IN_PROGRESS,
288
+ WAITING_FOR_CARD_DATA,
289
+ SENT_FOR_AUTHENTICATION,
290
+ )
redsys/api/sca.py CHANGED
@@ -1,4 +1,4 @@
1
- """PSD2 strong customer authentication (SCA) exemption codes for Ds_Merchant_Excep_SCA (REST guide 4.0.1)."""
1
+ """PSD2 strong customer authentication (SCA) exemption codes for ``Ds_Merchant_Excep_SCA`` (REST guide 4.0.1)."""
2
2
 
3
3
  LWV = 'LWV'
4
4
  """Low-value transaction: up to 30 EUR, with issuer-side counters (5 operations or 100 EUR accumulated)."""
@@ -9,7 +9,7 @@ TRA = 'TRA'
9
9
  MIT = 'MIT'
10
10
  """Merchant-initiated transaction, no cardholder interaction (stored credentials, subscriptions).
11
11
 
12
- Sent together with direct_payment "true"."""
12
+ Sent with ``direct_payment=options.DIRECT_PAYMENT``."""
13
13
 
14
14
  COR = 'COR'
15
15
  """Secure corporate payment, business-to-business only."""
@@ -20,4 +20,12 @@ ATD = 'ATD'
20
20
  EXEMPTIONS = (LWV, TRA, MIT, COR, ATD)
21
21
 
22
22
  QUERY = 'Y'
23
- """Sent on the 3DS initialization to ask which exemptions the card allows; the answer comes back in Ds_Excep_SCA."""
23
+ """Sent on the 3DS initialization to ask which exemptions the card allows; the answer is ``Response.excep_sca``."""
24
+
25
+ NO_QUERY = 'N'
26
+ """Sent on the 3DS initialization to ask for no exemptions."""
27
+
28
+ QUERIES = (QUERY, NO_QUERY)
29
+
30
+ WHITELIST = 'WHL'
31
+ """In ``Ds_Excep_SCA`` only: the merchant is on the customer's trusted list, so no authentication is needed."""
@@ -0,0 +1,12 @@
1
+ """Values of ``Ds_SecurePayment`` in responses, as strings."""
2
+
3
+ NOT_SECURE = '0'
4
+ """Not authenticated."""
5
+
6
+ ATTEMPT = '1'
7
+ """Authentication attempt: merchant enrolled, cardholder not; Bizum uses it for an authenticated payment."""
8
+
9
+ SECURE = '2'
10
+ """Authenticated; only with the merchant option for more information, which otherwise reports it as ``1``."""
11
+
12
+ SECURE_PAYMENTS = (NOT_SECURE, ATTEMPT, SECURE)
@@ -1,3 +1,5 @@
1
+ """Values of ``Ds_Merchant_TransactionType``."""
2
+
1
3
  AUTHORIZATION = 0
2
4
  """Authorization."""
3
5
 
@@ -14,22 +16,49 @@ AUTHENTICATION = 7
14
16
  """Authentication."""
15
17
 
16
18
  AUTHENTICATION_CONFIRMATION = 8
17
- """Authentication confirmation"""
19
+ """Authentication confirmation."""
20
+
21
+ VOID = 9
22
+ """Void of a preauthorization ("Anulación de preautorización")."""
18
23
 
19
- CANCELLATION = 9
20
- """Cancellation"""
24
+ CANCELLATION = VOID
25
+ """Former name of ``VOID``."""
26
+
27
+ REPLACEMENT_PREAUTHORIZATION = 11
28
+ """Replacement preauthorization: extends an existing preauthorization."""
21
29
 
22
30
  PAY_GOLD = 15
23
- """Pay gold"""
31
+ """PayGold request: a payment link sent by SMS or e-mail."""
24
32
 
25
33
  AUTHENTICATION_PUCE = 17
26
- """PUCE authentication"""
34
+ """PUCE authentication."""
27
35
 
28
36
  REFUND_WITHOUT_ORIGINAL = 34
29
- """Refund without original"""
37
+ """Refund without original."""
30
38
 
31
39
  BETTING_PRICE = 37
32
- """Betting price"""
40
+ """Betting prize."""
41
+
42
+ PAY_GOLD_AUTHORIZATION = 38
43
+ """PayGold authorization: the cardholder completes a PayGold request (type 15); sent by RedSys, not the merchant."""
44
+
45
+ DELETE_REFERENCE = 44
46
+ """Delete a stored card reference (token)."""
47
+
48
+ PAYMENT_CANCELLATION = 45
49
+ """Payment cancellation ("Anulación de pago"), for merchant time-outs or technical errors."""
50
+
51
+ REFUND_CANCELLATION = 46
52
+ """Refund cancellation, within 48 hours of the refund."""
53
+
54
+ AUTHENTICATION_CONFIRMATION_CANCELLATION = 47
55
+ """Cancellation of an authentication confirmation (type 8)."""
56
+
57
+ PARTIAL_CONFIRMATION = 48
58
+ """Partial confirmation of a preauthorization."""
59
+
60
+ PAY_GOLD_EXPIRY_CHANGE = 51
61
+ """Change of the expiry of a PayGold link (type 15); needs ``amount``."""
33
62
 
34
63
  TRANSACTION_TYPES = (
35
64
  AUTHORIZATION,
@@ -38,9 +67,25 @@ TRANSACTION_TYPES = (
38
67
  REFUND,
39
68
  AUTHENTICATION,
40
69
  AUTHENTICATION_CONFIRMATION,
41
- CANCELLATION,
70
+ VOID,
71
+ REPLACEMENT_PREAUTHORIZATION,
42
72
  PAY_GOLD,
43
73
  AUTHENTICATION_PUCE,
44
74
  REFUND_WITHOUT_ORIGINAL,
45
75
  BETTING_PRICE,
76
+ PAY_GOLD_AUTHORIZATION,
77
+ DELETE_REFERENCE,
78
+ PAYMENT_CANCELLATION,
79
+ REFUND_CANCELLATION,
80
+ AUTHENTICATION_CONFIRMATION_CANCELLATION,
81
+ PARTIAL_CONFIRMATION,
82
+ PAY_GOLD_EXPIRY_CHANGE,
83
+ )
84
+
85
+ REDIRECT_TRANSACTION_TYPES = (
86
+ AUTHORIZATION,
87
+ PREAUTHORIZATION,
88
+ AUTHENTICATION,
89
+ REFUND_WITHOUT_ORIGINAL,
46
90
  )
91
+ """The types the redirect connection accepts."""
redsys/api/xpay.py ADDED
@@ -0,0 +1,25 @@
1
+ """Google Pay and Apple Pay values for ``DS_XPAYTYPE``, ``DS_XPAYORIGEN`` and ``DS_XPAYDECODEDDATA``."""
2
+
3
+ GOOGLE = 'Google'
4
+ """``DS_XPAYTYPE``: Google Pay."""
5
+
6
+ APPLE = 'Apple'
7
+ """``DS_XPAYTYPE``: Apple Pay."""
8
+
9
+ TYPES = (GOOGLE, APPLE)
10
+
11
+ WEB = 'WEB'
12
+ """``DS_XPAYORIGEN``: the wallet was used on a website."""
13
+
14
+ IN_APP = 'InApp'
15
+ """``DS_XPAYORIGEN``: the wallet was used in a mobile app."""
16
+
17
+ ORIGINS = (WEB, IN_APP)
18
+
19
+ CARD = 'CARD'
20
+ """``paymentMethod`` in ``DS_XPAYDECODEDDATA`` (Google Pay): a card without cryptogram."""
21
+
22
+ TOKENIZED_CARD = 'TOKENIZED_CARD'
23
+ """``paymentMethod`` in ``DS_XPAYDECODEDDATA`` (Google Pay): a tokenized card with cryptogram."""
24
+
25
+ PAYMENT_METHODS = (CARD, TOKENIZED_CARD)