connections-sdk 2.0.0__py3-none-any.whl → 2.1.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.
connections_sdk/models.py CHANGED
@@ -1,6 +1,6 @@
1
1
  from dataclasses import dataclass
2
2
  from enum import Enum
3
- from typing import Optional, Any, Dict, List
3
+ from typing import Optional, Any, Dict, List, Literal
4
4
  from datetime import datetime
5
5
 
6
6
 
@@ -121,6 +121,7 @@ class Customer:
121
121
  last_name: Optional[str] = None
122
122
  email: Optional[str] = None
123
123
  address: Optional[Address] = None
124
+ channel: Optional[Literal['ios', 'android', 'web']] = 'web'
124
125
 
125
126
 
126
127
  @dataclass
@@ -133,8 +134,17 @@ class StatementDescription:
133
134
  class ThreeDS:
134
135
  eci: Optional[str] = None
135
136
  authentication_value: Optional[str] = None
136
- xid: Optional[str] = None
137
137
  version: Optional[str] = None
138
+ ds_transaction_id: Optional[str] = None
139
+ directory_status_code: Optional[str] = None
140
+ authentication_status_code: Optional[str] = None
141
+ challenge_cancel_reason_code: Optional[str] = None
142
+ challenge_preference_code: Optional[str] = None
143
+ authentication_status_reason_code: Optional[str] = None
144
+
145
+ # API aligned fields (preferred)
146
+ threeds_version: Optional[str] = None
147
+ authentication_status_reason: Optional[str] = None
138
148
 
139
149
 
140
150
  @dataclass
@@ -121,6 +121,7 @@ class AdyenClient:
121
121
  "merchantAccount": self.merchant_account,
122
122
  "shopperInteraction": "ContAuth" if request.merchant_initiated else "Ecommerce",
123
123
  "storePaymentMethod": request.source.store_with_provider,
124
+ "channel": request.customer.channel if request.customer else 'web'
124
125
  }
125
126
 
126
127
  if request.metadata:
@@ -206,22 +207,32 @@ class AdyenClient:
206
207
 
207
208
  # Map 3DS information
208
209
  if request.three_ds:
209
- three_ds_data: Dict[str, str] = {}
210
-
211
- if request.three_ds.eci:
212
- three_ds_data["eci"] = request.three_ds.eci
210
+ mpi_data: Dict[str, Any] = {}
211
+ three_ds_2_request_data: Dict[str, Any] = {}
213
212
 
214
213
  if request.three_ds.authentication_value:
215
- three_ds_data["authenticationValue"] = request.three_ds.authentication_value
216
-
217
- if request.three_ds.xid:
218
- three_ds_data["xid"] = request.three_ds.xid
214
+ mpi_data["cavv"] = request.three_ds.authentication_value
215
+ if request.three_ds.eci:
216
+ mpi_data["eci"] = request.three_ds.eci
217
+ if request.three_ds.ds_transaction_id:
218
+ mpi_data["dsTransID"] = request.three_ds.ds_transaction_id
219
+ if request.three_ds.directory_status_code:
220
+ mpi_data["directoryResponse"] = request.three_ds.directory_status_code
221
+ if request.three_ds.authentication_status_code:
222
+ mpi_data["authenticationResponse"] = request.three_ds.authentication_status_code
223
+ if request.three_ds.threeds_version or request.three_ds.version: # threeds_version from API, fallback to version
224
+ mpi_data["threeDSVersion"] = request.three_ds.threeds_version or request.three_ds.version
225
+ if request.three_ds.challenge_cancel_reason_code:
226
+ mpi_data["challengeCancel"] = request.three_ds.challenge_cancel_reason_code
227
+
228
+ if mpi_data:
229
+ payload["mpiData"] = mpi_data
219
230
 
220
- if request.three_ds.version:
221
- three_ds_data["threeDSVersion"] = request.three_ds.version
231
+ if request.three_ds.challenge_preference_code:
232
+ three_ds_2_request_data["threeDSRequestorChallengeInd"] = request.three_ds.challenge_preference_code
222
233
 
223
- if three_ds_data:
224
- payload["additionalData"] = {"threeDSecure": three_ds_data}
234
+ if three_ds_2_request_data:
235
+ payload["threeDS2RequestData"] = three_ds_2_request_data
225
236
 
226
237
  # Override/merge any provider properties if specified
227
238
  if request.override_provider_properties:
@@ -268,15 +268,34 @@ class CheckoutClient:
268
268
 
269
269
  # Add 3DS information if provided
270
270
  if request.three_ds:
271
- three_ds_data: Dict[str, str] = {}
272
- if request.three_ds.eci:
273
- three_ds_data["eci"] = request.three_ds.eci
271
+ three_ds_data: Dict[str, Any] = {
272
+ "enabled": True
273
+ }
274
+
274
275
  if request.three_ds.authentication_value:
275
276
  three_ds_data["cryptogram"] = request.three_ds.authentication_value
276
- if request.three_ds.xid:
277
- three_ds_data["xid"] = request.three_ds.xid
278
- if request.three_ds.version:
279
- three_ds_data["version"] = request.three_ds.version
277
+ if request.three_ds.eci:
278
+ three_ds_data["eci"] = request.three_ds.eci
279
+ if request.three_ds.threeds_version or request.three_ds.version: # threeds_version from API, fallback to version
280
+ three_ds_data["version"] = request.three_ds.threeds_version or request.three_ds.version
281
+ if request.three_ds.ds_transaction_id: # ds_transaction_id in BT, xid in Checkout
282
+ three_ds_data["xid"] = request.three_ds.ds_transaction_id
283
+ if request.three_ds.authentication_status_code:
284
+ three_ds_data["status"] = request.three_ds.authentication_status_code
285
+ if request.three_ds.authentication_status_reason_code:
286
+ three_ds_data["status_reason_code"] = request.three_ds.authentication_status_reason_code
287
+
288
+ if request.three_ds.challenge_preference_code:
289
+ challenge_indicator_mapping = {
290
+ "no-preference": "no_preference",
291
+ "no-challenge": "no_challenge_requested",
292
+ "challenge-requested": "challenge_requested",
293
+ "challenge-mandated": "challenge_requested_mandate"
294
+ }
295
+ checkout_challenge_indicator = challenge_indicator_mapping.get(request.three_ds.challenge_preference_code)
296
+ if checkout_challenge_indicator: # Only add if a valid mapping exists
297
+ three_ds_data["challenge_indicator"] = checkout_challenge_indicator
298
+
280
299
  payload["3ds"] = three_ds_data
281
300
 
282
301
  # Override/merge any provider properties if specified
@@ -352,7 +371,7 @@ class CheckoutClient:
352
371
  validate_required_fields(request_data)
353
372
  # Transform request to Checkout.com format
354
373
  payload = self._transform_to_checkout_payload(request_data)
355
-
374
+
356
375
  # Set up common headers
357
376
  headers = {
358
377
  "Authorization": f"Bearer {self.api_key}",
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: connections_sdk
3
- Version: 2.0.0
3
+ Version: 2.1.0
4
4
  Summary: A Python SDK for payment processing
5
5
  Author: Basis Theory
6
6
  Author-email: support@basistheory.com
@@ -2,13 +2,13 @@ connections_sdk/__init__.py,sha256=IYYzlDWAgIeJs_1Ly2_SNsUYtMjGexysfY3Q9-L1Pn8,1
2
2
  connections_sdk/client.py,sha256=FkZq68S_syvaJTVRSVPtpA4FwsybRdC9FivRi2SOkoI,3165
3
3
  connections_sdk/config.py,sha256=OPH-J11ecQYP17ubtIXuB_VVuso3t-Ym9V8f5j-G1Xk,398
4
4
  connections_sdk/exceptions.py,sha256=3L3X1OCp7EIPg5l4NPfcEUrPPahfEft-qnZ5QfxXR0k,805
5
- connections_sdk/models.py,sha256=slAgi-v9qZjWNGvHrJc8myXcN-v1X2lP5gXFjj6fUCQ,6650
6
- connections_sdk/providers/adyen.py,sha256=6iOyy_7Sh1cZTaV9Lu4MHaazDcL0aUtgYnYluIAMIk4,17458
7
- connections_sdk/providers/checkout.py,sha256=2hTWkZwnMazlQn4MpICoQ5GZDfGOEhrjYp5QknbuCG4,19543
5
+ connections_sdk/models.py,sha256=nfJH8UXW67bgq2NrKm4b5KIshUApyBfm7Ky6nY7KMuM,7140
6
+ connections_sdk/providers/adyen.py,sha256=HReXv3KxtrFPkIV8SZ2FtyvuJ61h48nLGwdOcHWUalA,18426
7
+ connections_sdk/providers/checkout.py,sha256=pVdu5-vFKM7BhE3_XC7MKIf-QZRnNs-8AmRdCSNfU-U,20780
8
8
  connections_sdk/utils/__init__.py,sha256=iKwqW2egmbc_LO0oQoNLiP5-RBXUd9OpMW6sdEVB_Fs,153
9
9
  connections_sdk/utils/model_utils.py,sha256=B1lIam4Ctajnhi1H9eB7hpM4IVbemHgpHzBVruoPKcU,3159
10
10
  connections_sdk/utils/request_client.py,sha256=zbCGoJajAQ9RUNUb5x5edSaqdxJxPhoedAwUBT0S3ek,3261
11
- connections_sdk-2.0.0.dist-info/LICENSE,sha256=OJSDpWNs9gHwRBdHonZIkQ2-rUpFMxn0V8xxjfz4UQQ,11342
12
- connections_sdk-2.0.0.dist-info/METADATA,sha256=bcoDDC_r3AhbyIKend4Zylkw7Pup1RvALske8rGKIN4,2821
13
- connections_sdk-2.0.0.dist-info/WHEEL,sha256=Nq82e9rUAnEjt98J6MlVmMCZb-t9cYE2Ir1kpBmnWfs,88
14
- connections_sdk-2.0.0.dist-info/RECORD,,
11
+ connections_sdk-2.1.0.dist-info/LICENSE,sha256=OJSDpWNs9gHwRBdHonZIkQ2-rUpFMxn0V8xxjfz4UQQ,11342
12
+ connections_sdk-2.1.0.dist-info/METADATA,sha256=OtRpo8f4pWpNHPajKdDZ9VOvjSFJOMeXBsDrwrgX_FQ,2821
13
+ connections_sdk-2.1.0.dist-info/WHEEL,sha256=Nq82e9rUAnEjt98J6MlVmMCZb-t9cYE2Ir1kpBmnWfs,88
14
+ connections_sdk-2.1.0.dist-info/RECORD,,