connections-sdk 3.0.0__py3-none-any.whl → 3.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.
- connections_sdk/providers/adyen.py +13 -4
- connections_sdk/providers/checkout.py +12 -5
- {connections_sdk-3.0.0.dist-info → connections_sdk-3.2.0.dist-info}/METADATA +1 -1
- {connections_sdk-3.0.0.dist-info → connections_sdk-3.2.0.dist-info}/RECORD +6 -6
- {connections_sdk-3.0.0.dist-info → connections_sdk-3.2.0.dist-info}/LICENSE +0 -0
- {connections_sdk-3.0.0.dist-info → connections_sdk-3.2.0.dist-info}/WHEEL +0 -0
|
@@ -123,7 +123,8 @@ class AdyenClient:
|
|
|
123
123
|
"merchantAccount": self.merchant_account,
|
|
124
124
|
"shopperInteraction": "ContAuth" if request.merchant_initiated else "Ecommerce",
|
|
125
125
|
"storePaymentMethod": request.source.store_with_provider,
|
|
126
|
-
"channel": request.customer.channel if request.customer else 'web'
|
|
126
|
+
"channel": request.customer.channel if request.customer else 'web',
|
|
127
|
+
"additionalData": {}
|
|
127
128
|
}
|
|
128
129
|
|
|
129
130
|
if request.metadata:
|
|
@@ -157,7 +158,7 @@ class AdyenClient:
|
|
|
157
158
|
payment_method["holderName"] = request.source.holder_name
|
|
158
159
|
|
|
159
160
|
if request.previous_network_transaction_id:
|
|
160
|
-
|
|
161
|
+
payload["networkPaymentReference"] = request.previous_network_transaction_id
|
|
161
162
|
|
|
162
163
|
payload["paymentMethod"] = payment_method
|
|
163
164
|
|
|
@@ -310,7 +311,7 @@ class AdyenClient:
|
|
|
310
311
|
)
|
|
311
312
|
|
|
312
313
|
|
|
313
|
-
def create_transaction(self, request_data: TransactionRequest) -> TransactionResponse:
|
|
314
|
+
def create_transaction(self, request_data: TransactionRequest, idempotency_key: Optional[str] = None) -> TransactionResponse:
|
|
314
315
|
"""Process a payment transaction through Adyen's API directly or via Basis Theory's proxy."""
|
|
315
316
|
validate_required_fields(request_data)
|
|
316
317
|
|
|
@@ -322,6 +323,10 @@ class AdyenClient:
|
|
|
322
323
|
"X-API-Key": self.api_key,
|
|
323
324
|
"Content-Type": "application/json"
|
|
324
325
|
}
|
|
326
|
+
|
|
327
|
+
# Add idempotency key if provided
|
|
328
|
+
if idempotency_key:
|
|
329
|
+
headers["idempotency-key"] = idempotency_key
|
|
325
330
|
|
|
326
331
|
# Make the request (using proxy for BT tokens, direct for processor tokens)
|
|
327
332
|
try:
|
|
@@ -347,7 +352,7 @@ class AdyenClient:
|
|
|
347
352
|
raise TransactionError(self._transform_error_response(e.response, error_data, e.response.headers))
|
|
348
353
|
|
|
349
354
|
|
|
350
|
-
def refund_transaction(self, refund_request: RefundRequest) -> RefundResponse:
|
|
355
|
+
def refund_transaction(self, refund_request: RefundRequest, idempotency_key: Optional[str] = None) -> RefundResponse:
|
|
351
356
|
"""
|
|
352
357
|
Refund a payment transaction through Adyen's API.
|
|
353
358
|
|
|
@@ -363,6 +368,10 @@ class AdyenClient:
|
|
|
363
368
|
"Content-Type": "application/json"
|
|
364
369
|
}
|
|
365
370
|
|
|
371
|
+
# Add idempotency key if provided
|
|
372
|
+
if idempotency_key:
|
|
373
|
+
headers["idempotency-key"] = idempotency_key
|
|
374
|
+
|
|
366
375
|
# Prepare the refund payload
|
|
367
376
|
payload = {
|
|
368
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,
|
|
@@ -3,12 +3,12 @@ connections_sdk/client.py,sha256=FkZq68S_syvaJTVRSVPtpA4FwsybRdC9FivRi2SOkoI,316
|
|
|
3
3
|
connections_sdk/config.py,sha256=OPH-J11ecQYP17ubtIXuB_VVuso3t-Ym9V8f5j-G1Xk,398
|
|
4
4
|
connections_sdk/exceptions.py,sha256=AuLet9gpV6OmQrKLO9ozgyrWw1KCPuUxV8Own7gTEmk,761
|
|
5
5
|
connections_sdk/models.py,sha256=L_AntoEFsD9I3TeAi8j-h7HGQK1mNXsHnwZOT5vn7iI,7414
|
|
6
|
-
connections_sdk/providers/adyen.py,sha256=
|
|
7
|
-
connections_sdk/providers/checkout.py,sha256=
|
|
6
|
+
connections_sdk/providers/adyen.py,sha256=qezLG_JL964jZI-k2mI5GQLhj2V-Gup6nx-hGPr4cyk,18889
|
|
7
|
+
connections_sdk/providers/checkout.py,sha256=Mst82u5OR9HpeqQQN5FDGREYytpO5gewJAI9xwjlmtU,35460
|
|
8
8
|
connections_sdk/utils/__init__.py,sha256=iKwqW2egmbc_LO0oQoNLiP5-RBXUd9OpMW6sdEVB_Fs,153
|
|
9
9
|
connections_sdk/utils/model_utils.py,sha256=FB6Cf-dMFr52gi-F6yMEAPJU413Sjv_8zx3IUNBI-Q8,4015
|
|
10
10
|
connections_sdk/utils/request_client.py,sha256=M9eqEpRVoIFUMS51jGJ-C2R1L9_NWw3v3saAq31hVoI,3251
|
|
11
|
-
connections_sdk-3.
|
|
12
|
-
connections_sdk-3.
|
|
13
|
-
connections_sdk-3.
|
|
14
|
-
connections_sdk-3.
|
|
11
|
+
connections_sdk-3.2.0.dist-info/LICENSE,sha256=OJSDpWNs9gHwRBdHonZIkQ2-rUpFMxn0V8xxjfz4UQQ,11342
|
|
12
|
+
connections_sdk-3.2.0.dist-info/METADATA,sha256=vlrqzU1YM2lmO00grzjAVukJhuJMSCX8QxA2qVK7I-4,2821
|
|
13
|
+
connections_sdk-3.2.0.dist-info/WHEEL,sha256=Nq82e9rUAnEjt98J6MlVmMCZb-t9cYE2Ir1kpBmnWfs,88
|
|
14
|
+
connections_sdk-3.2.0.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|