connections-sdk 3.1.0__tar.gz → 3.2.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.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: connections_sdk
3
- Version: 3.1.0
3
+ Version: 3.2.0
4
4
  Summary: A Python SDK for payment processing
5
5
  Author: Basis Theory
6
6
  Author-email: support@basistheory.com
@@ -4,7 +4,7 @@ build-backend = "poetry.core.masonry.api"
4
4
 
5
5
  [tool.poetry]
6
6
  name = "connections_sdk"
7
- version = "3.1.0"
7
+ version = "3.2.0"
8
8
  description = "A Python SDK for payment processing"
9
9
  authors = ["Basis Theory <support@basistheory.com>"]
10
10
  readme = "README.md"
@@ -158,7 +158,7 @@ class AdyenClient:
158
158
  payment_method["holderName"] = request.source.holder_name
159
159
 
160
160
  if request.previous_network_transaction_id:
161
- payment_method["additionalData"]["networkTxReference"] = request. previous_network_transaction_id
161
+ payload["networkPaymentReference"] = request.previous_network_transaction_id
162
162
 
163
163
  payload["paymentMethod"] = payment_method
164
164
 
@@ -311,7 +311,7 @@ class AdyenClient:
311
311
  )
312
312
 
313
313
 
314
- def create_transaction(self, request_data: TransactionRequest) -> TransactionResponse:
314
+ def create_transaction(self, request_data: TransactionRequest, idempotency_key: Optional[str] = None) -> TransactionResponse:
315
315
  """Process a payment transaction through Adyen's API directly or via Basis Theory's proxy."""
316
316
  validate_required_fields(request_data)
317
317
 
@@ -323,6 +323,10 @@ class AdyenClient:
323
323
  "X-API-Key": self.api_key,
324
324
  "Content-Type": "application/json"
325
325
  }
326
+
327
+ # Add idempotency key if provided
328
+ if idempotency_key:
329
+ headers["idempotency-key"] = idempotency_key
326
330
 
327
331
  # Make the request (using proxy for BT tokens, direct for processor tokens)
328
332
  try:
@@ -348,7 +352,7 @@ class AdyenClient:
348
352
  raise TransactionError(self._transform_error_response(e.response, error_data, e.response.headers))
349
353
 
350
354
 
351
- def refund_transaction(self, refund_request: RefundRequest) -> RefundResponse:
355
+ def refund_transaction(self, refund_request: RefundRequest, idempotency_key: Optional[str] = None) -> RefundResponse:
352
356
  """
353
357
  Refund a payment transaction through Adyen's API.
354
358
 
@@ -364,6 +368,10 @@ class AdyenClient:
364
368
  "Content-Type": "application/json"
365
369
  }
366
370
 
371
+ # Add idempotency key if provided
372
+ if idempotency_key:
373
+ headers["idempotency-key"] = idempotency_key
374
+
367
375
  # Prepare the refund payload
368
376
  payload = {
369
377
  "merchantAccount": self.merchant_account,
@@ -395,8 +395,10 @@ class CheckoutClient:
395
395
  "expiry_month": f"{{{{ {token_prefix}: {request.source.id} | json: '$.data.expiration_month'}}}}",
396
396
  "expiry_year": f"{{{{ {token_prefix}: {request.source.id} | json: '$.data.expiration_year'}}}}",
397
397
  "cvv": f"{{{{ {token_prefix}: {request.source.id} | json: '$.data.cvc'}}}}",
398
- "store_for_future_use": request.source.store_with_provider
398
+ "store_for_future_use": request.source.store_with_provider,
399
+ "name": request.source.holder_name
399
400
  }
401
+
400
402
  payload["source"] = source_data
401
403
 
402
404
  # Add customer information if provided
@@ -564,7 +566,7 @@ class CheckoutClient:
564
566
  )
565
567
 
566
568
 
567
- def create_transaction(self, request_data: TransactionRequest) -> TransactionResponse:
569
+ def create_transaction(self, request_data: TransactionRequest, idempotency_key: Optional[str] = None) -> TransactionResponse:
568
570
  """Process a payment transaction through Checkout.com's API directly or via Basis Theory's proxy."""
569
571
  validate_required_fields(request_data)
570
572
  # Transform request to Checkout.com format
@@ -575,6 +577,10 @@ class CheckoutClient:
575
577
  "Authorization": f"Bearer {self.api_key}",
576
578
  "Content-Type": "application/json"
577
579
  }
580
+
581
+ # Add idempotency key if provided
582
+ if idempotency_key:
583
+ headers["cko-idempotency-key"] = idempotency_key
578
584
 
579
585
  try:
580
586
  # Make request to Checkout.com
@@ -588,8 +594,6 @@ class CheckoutClient:
588
594
 
589
595
  response_data = response.json()
590
596
 
591
- print(f"Response data: {response_data}")
592
-
593
597
  except requests.exceptions.HTTPError as e:
594
598
  # Check if this is a BT error
595
599
  if hasattr(e, 'bt_error_response'):
@@ -608,7 +612,7 @@ class CheckoutClient:
608
612
  # Transform response to SDK format
609
613
  return self._transform_checkout_response(response.json(), request_data, response.headers)
610
614
 
611
- def refund_transaction(self, refund_request: RefundRequest) -> RefundResponse:
615
+ def refund_transaction(self, refund_request: RefundRequest, idempotency_key: Optional[str] = None) -> RefundResponse:
612
616
  """
613
617
  Refund a payment transaction through Checkout.com's API.
614
618
 
@@ -623,6 +627,9 @@ class CheckoutClient:
623
627
  "Content-Type": "application/json"
624
628
  }
625
629
 
630
+ if idempotency_key:
631
+ headers["cko-idempotency-key"] = idempotency_key
632
+
626
633
  # Prepare the refund payload
627
634
  payload = {
628
635
  "reference": refund_request.reference,
File without changes