connections-sdk 1.0.0__py3-none-any.whl → 2.0.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/client.py CHANGED
@@ -25,19 +25,12 @@ class ProviderConfig:
25
25
 
26
26
 
27
27
  class Connections:
28
- _instance: Optional['Connections'] = None
29
-
30
- def __init__(self) -> None:
28
+ def __init__(self, config: Dict[str, Any]) -> None:
29
+ """Initialize the Connections SDK with the provided configuration."""
31
30
  self.is_test: bool = False
32
31
  self.bt_api_key: str = ""
33
32
  self.provider_config: Optional[ProviderConfig] = None
34
33
 
35
- @classmethod
36
- def init(cls, config: Dict[str, Any]) -> 'Connections':
37
- """Initialize the Connections SDK with the provided configuration."""
38
- if cls._instance is None:
39
- cls._instance = cls()
40
-
41
34
  if 'is_test' not in config:
42
35
  config['is_test'] = False
43
36
  if 'bt_api_key' not in config:
@@ -45,17 +38,16 @@ class Connections:
45
38
  if 'provider_config' not in config:
46
39
  raise ConfigurationError("'provider_config' parameter is required")
47
40
 
48
- instance = cast(Connections, cls._instance)
49
- instance.is_test = config['is_test']
50
- instance.bt_api_key = config['bt_api_key']
41
+ self.is_test = config['is_test']
42
+ self.bt_api_key = config['bt_api_key']
51
43
 
52
44
  provider_config = config['provider_config']
53
- instance.provider_config = ProviderConfig()
45
+ self.provider_config = ProviderConfig()
54
46
 
55
47
  # Initialize Adyen configuration if provided
56
48
  if 'adyen' in provider_config:
57
49
  adyen_config = provider_config.get('adyen')
58
- instance.provider_config.adyen = AdyenConfig(
50
+ self.provider_config.adyen = AdyenConfig(
59
51
  api_key=adyen_config.get('api_key'),
60
52
  merchant_account=adyen_config.get('merchant_account'),
61
53
  production_prefix=adyen_config.get('production_prefix', "")
@@ -64,20 +56,11 @@ class Connections:
64
56
  # Initialize Checkout.com configuration if provided
65
57
  if 'checkout' in provider_config:
66
58
  checkout_config = provider_config.get('checkout')
67
- instance.provider_config.checkout = CheckoutConfig(
59
+ self.provider_config.checkout = CheckoutConfig(
68
60
  private_key=checkout_config.get('private_key'),
69
61
  processing_channel=checkout_config.get('processing_channel')
70
62
  )
71
63
 
72
- return instance
73
-
74
- @classmethod
75
- def get_instance(cls) -> 'Connections':
76
- """Get the initialized SDK instance."""
77
- if cls._instance is None:
78
- raise ConfigurationError("Connections must be initialized with init() before use")
79
- return cls._instance
80
-
81
64
  @property
82
65
  def adyen(self) -> AdyenClient:
83
66
  """Get the Adyen client instance."""
@@ -283,8 +283,6 @@ class CheckoutClient:
283
283
  if request.override_provider_properties:
284
284
  payload = always_merger.merge(payload, request.override_provider_properties)
285
285
 
286
- print(f"Payload: {json.dumps(payload, indent=2)}")
287
-
288
286
  return payload
289
287
 
290
288
  def _transform_checkout_response(self, response_data: Dict[str, Any], request: TransactionRequest) -> TransactionResponse:
@@ -23,7 +23,7 @@ def validate_required_fields(data: TransactionRequest) -> None:
23
23
  Raises:
24
24
  ValidationError: If required fields are missing
25
25
  """
26
- if not data.amount or not data.amount.value:
26
+ if data.amount is None or data.amount.value is None:
27
27
  raise ValidationError("amount.value is required")
28
28
  if not data.source or not data.source.type or not data.source.id:
29
29
  raise ValidationError("source.type and source.id are required")
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: connections_sdk
3
- Version: 1.0.0
3
+ Version: 2.0.0
4
4
  Summary: A Python SDK for payment processing
5
5
  Author: Basis Theory
6
6
  Author-email: support@basistheory.com
@@ -43,7 +43,7 @@ from connections_sdk import Connections
43
43
  from connections_sdk.models import RecurringType
44
44
 
45
45
  # Initialize the SDK with your chosen provider
46
- sdk = Connections.init({
46
+ sdk = Connections({
47
47
  'is_test': True, # Use test environment
48
48
  'bt_api_key': 'YOUR_BASIS_THEORY_API_KEY',
49
49
  'provider_config': {
@@ -1,14 +1,14 @@
1
1
  connections_sdk/__init__.py,sha256=IYYzlDWAgIeJs_1Ly2_SNsUYtMjGexysfY3Q9-L1Pn8,174
2
- connections_sdk/client.py,sha256=qMAURS0QT2httdrm2COugWCdUIGtPNrUf8A8AHGkxMg,3699
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
5
  connections_sdk/models.py,sha256=slAgi-v9qZjWNGvHrJc8myXcN-v1X2lP5gXFjj6fUCQ,6650
6
6
  connections_sdk/providers/adyen.py,sha256=6iOyy_7Sh1cZTaV9Lu4MHaazDcL0aUtgYnYluIAMIk4,17458
7
- connections_sdk/providers/checkout.py,sha256=1fXb6Lc5j-sTVmN_aW9BQtGTvZNeI39b_qKmZ392A_c,19603
7
+ connections_sdk/providers/checkout.py,sha256=2hTWkZwnMazlQn4MpICoQ5GZDfGOEhrjYp5QknbuCG4,19543
8
8
  connections_sdk/utils/__init__.py,sha256=iKwqW2egmbc_LO0oQoNLiP5-RBXUd9OpMW6sdEVB_Fs,153
9
- connections_sdk/utils/model_utils.py,sha256=Z_OKZg20sac0e6ltoynCy9LcI1Yto1HTJ56Vzdjxn2I,3151
9
+ connections_sdk/utils/model_utils.py,sha256=B1lIam4Ctajnhi1H9eB7hpM4IVbemHgpHzBVruoPKcU,3159
10
10
  connections_sdk/utils/request_client.py,sha256=zbCGoJajAQ9RUNUb5x5edSaqdxJxPhoedAwUBT0S3ek,3261
11
- connections_sdk-1.0.0.dist-info/LICENSE,sha256=OJSDpWNs9gHwRBdHonZIkQ2-rUpFMxn0V8xxjfz4UQQ,11342
12
- connections_sdk-1.0.0.dist-info/METADATA,sha256=cuQnpx7aHzrJ_NSP-bhYPPf1eu9odxg5mEQhUVgpKcE,2826
13
- connections_sdk-1.0.0.dist-info/WHEEL,sha256=Nq82e9rUAnEjt98J6MlVmMCZb-t9cYE2Ir1kpBmnWfs,88
14
- connections_sdk-1.0.0.dist-info/RECORD,,
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,,