python-terminusgps 53.1.0__tar.gz → 54.1.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.
Files changed (50) hide show
  1. {python_terminusgps-53.1.0 → python_terminusgps-54.1.0}/PKG-INFO +1 -1
  2. {python_terminusgps-53.1.0 → python_terminusgps-54.1.0}/pyproject.toml +1 -1
  3. {python_terminusgps-53.1.0 → python_terminusgps-54.1.0}/terminusgps/authorizenet/api/customer_profiles.py +1 -0
  4. {python_terminusgps-53.1.0 → python_terminusgps-54.1.0}/terminusgps/authorizenet/api/payment_profiles.py +8 -12
  5. {python_terminusgps-53.1.0 → python_terminusgps-54.1.0}/terminusgps/authorizenet/service.py +5 -13
  6. {python_terminusgps-53.1.0 → python_terminusgps-54.1.0}/terminusgps/default_settings.py +3 -3
  7. {python_terminusgps-53.1.0 → python_terminusgps-54.1.0}/tests/test_authorizenet.py +15 -19
  8. {python_terminusgps-53.1.0 → python_terminusgps-54.1.0}/uv.lock +1 -1
  9. python_terminusgps-53.1.0/terminusgps/authorizenet/constants.py +0 -104
  10. python_terminusgps-53.1.0/terminusgps/authorizenet/utils.py +0 -14
  11. {python_terminusgps-53.1.0 → python_terminusgps-54.1.0}/.github/workflows/python-test.yml +0 -0
  12. {python_terminusgps-53.1.0 → python_terminusgps-54.1.0}/.github/workflows/sphinx.yml +0 -0
  13. {python_terminusgps-53.1.0 → python_terminusgps-54.1.0}/.gitignore +0 -0
  14. {python_terminusgps-53.1.0 → python_terminusgps-54.1.0}/.python-version +0 -0
  15. {python_terminusgps-53.1.0 → python_terminusgps-54.1.0}/COPYING +0 -0
  16. {python_terminusgps-53.1.0 → python_terminusgps-54.1.0}/README.md +0 -0
  17. {python_terminusgps-53.1.0 → python_terminusgps-54.1.0}/dist/.gitignore +0 -0
  18. {python_terminusgps-53.1.0 → python_terminusgps-54.1.0}/docs/Makefile +0 -0
  19. {python_terminusgps-53.1.0 → python_terminusgps-54.1.0}/docs/make.bat +0 -0
  20. {python_terminusgps-53.1.0 → python_terminusgps-54.1.0}/docs/requirements.txt +0 -0
  21. {python_terminusgps-53.1.0 → python_terminusgps-54.1.0}/docs/source/authorizenet/api.rst +0 -0
  22. {python_terminusgps-53.1.0 → python_terminusgps-54.1.0}/docs/source/authorizenet/constants.rst +0 -0
  23. {python_terminusgps-53.1.0 → python_terminusgps-54.1.0}/docs/source/authorizenet/index.rst +0 -0
  24. {python_terminusgps-53.1.0 → python_terminusgps-54.1.0}/docs/source/authorizenet/service.rst +0 -0
  25. {python_terminusgps-53.1.0 → python_terminusgps-54.1.0}/docs/source/conf.py +0 -0
  26. {python_terminusgps-53.1.0 → python_terminusgps-54.1.0}/docs/source/index.rst +0 -0
  27. {python_terminusgps-53.1.0 → python_terminusgps-54.1.0}/docs/source/mixins.rst +0 -0
  28. {python_terminusgps-53.1.0 → python_terminusgps-54.1.0}/docs/source/validators.rst +0 -0
  29. {python_terminusgps-53.1.0 → python_terminusgps-54.1.0}/docs/source/wialon/constants.rst +0 -0
  30. {python_terminusgps-53.1.0 → python_terminusgps-54.1.0}/docs/source/wialon/exceptions.rst +0 -0
  31. {python_terminusgps-53.1.0 → python_terminusgps-54.1.0}/docs/source/wialon/index.rst +0 -0
  32. {python_terminusgps-53.1.0 → python_terminusgps-54.1.0}/docs/source/wialon/items.rst +0 -0
  33. {python_terminusgps-53.1.0 → python_terminusgps-54.1.0}/docs/source/wialon/session.rst +0 -0
  34. {python_terminusgps-53.1.0 → python_terminusgps-54.1.0}/docs/source/wialon/usage.rst +0 -0
  35. {python_terminusgps-53.1.0 → python_terminusgps-54.1.0}/docs/source/wialon/utils.rst +0 -0
  36. {python_terminusgps-53.1.0 → python_terminusgps-54.1.0}/htmlcov/.gitignore +0 -0
  37. {python_terminusgps-53.1.0 → python_terminusgps-54.1.0}/terminusgps/__init__.py +0 -0
  38. {python_terminusgps-53.1.0 → python_terminusgps-54.1.0}/terminusgps/authorizenet/__init__.py +0 -0
  39. {python_terminusgps-53.1.0 → python_terminusgps-54.1.0}/terminusgps/authorizenet/api/__init__.py +0 -0
  40. {python_terminusgps-53.1.0 → python_terminusgps-54.1.0}/terminusgps/authorizenet/api/address_profiles.py +0 -0
  41. {python_terminusgps-53.1.0 → python_terminusgps-54.1.0}/terminusgps/authorizenet/api/subscriptions.py +0 -0
  42. {python_terminusgps-53.1.0 → python_terminusgps-54.1.0}/terminusgps/authorizenet/api/transactions.py +0 -0
  43. {python_terminusgps-53.1.0 → python_terminusgps-54.1.0}/terminusgps/mixins.py +0 -0
  44. {python_terminusgps-53.1.0 → python_terminusgps-54.1.0}/terminusgps/validators.py +0 -0
  45. {python_terminusgps-53.1.0 → python_terminusgps-54.1.0}/terminusgps/wialon/__init__.py +0 -0
  46. {python_terminusgps-53.1.0 → python_terminusgps-54.1.0}/terminusgps/wialon/constants.py +0 -0
  47. {python_terminusgps-53.1.0 → python_terminusgps-54.1.0}/terminusgps/wialon/flags.py +0 -0
  48. {python_terminusgps-53.1.0 → python_terminusgps-54.1.0}/terminusgps/wialon/session.py +0 -0
  49. {python_terminusgps-53.1.0 → python_terminusgps-54.1.0}/terminusgps/wialon/utils.py +0 -0
  50. {python_terminusgps-53.1.0 → python_terminusgps-54.1.0}/tests/__init__.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: python-terminusgps
3
- Version: 53.1.0
3
+ Version: 54.1.0
4
4
  Summary: Provides abstractions/utilities for working with Wialon API, Authorize.NET API, AWS API, and more.
5
5
  Project-URL: Documentation, https://terminusgps.github.io/python-terminusgps
6
6
  Project-URL: Repository, https://github.com/terminusgps/python-terminusgps
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "python-terminusgps"
3
- version = "53.1.0"
3
+ version = "54.1.0"
4
4
  description = "Provides abstractions/utilities for working with Wialon API, Authorize.NET API, AWS API, and more."
5
5
  readme = "README.md"
6
6
  authors = [ {name = "Blake Nall", email = "blake@terminusgps.com" } ]
@@ -30,6 +30,7 @@ def create_customer_profile(
30
30
  raise ValueError(
31
31
  "At least one of 'email', 'merchantCustomerId' or 'description' is required in contract"
32
32
  )
33
+
33
34
  request = apicontractsv1.createCustomerProfileRequest()
34
35
  request.profile = contract
35
36
  return request, apicontrollers.createCustomerProfileController
@@ -14,8 +14,7 @@ __all__ = [
14
14
  def create_customer_payment_profile(
15
15
  customer_profile_id: int,
16
16
  contract: apicontractsv1.customerPaymentProfileType,
17
- default: bool = False,
18
- validation: str = "liveMode",
17
+ validation: str = apicontractsv1.validationModeEnum.liveMode,
19
18
  ) -> tuple[ObjectifiedElement, type[APIOperationBase]]:
20
19
  """
21
20
  `createCustomerPaymentProfileRequest <https://developer.authorize.net/api/reference/index.html#customer-profiles-create-customer-payment-profile>`_.
@@ -24,10 +23,10 @@ def create_customer_payment_profile(
24
23
  :type customer_profile_id: int
25
24
  :param contract: A customer payment profile element.
26
25
  :type contract: ~authorizenet.apicontractsv1.customerPaymentProfileType
27
- :param default: Whether to set the payment profile as default. Default is :py:obj:`False`.
28
- :type default: bool
29
26
  :param validation: Validation mode. Default is :py:obj:`"liveMode"`.
30
27
  :type validation: str
28
+ :raises ValueError: If :py:attr:`payment` wasn't in the contract.
29
+ :raises ValueError: If :py:attr:`billTo` wasn't in the contract.
31
30
  :returns: A tuple containing an Authorizenet API request element and controller class.
32
31
  :rtype: tuple[~lxml.objectify.ObjectifiedElement, type[~authorizenet.apicontrollersbase.APIOperationBase]]
33
32
 
@@ -40,7 +39,6 @@ def create_customer_payment_profile(
40
39
  request.customerProfileId = str(customer_profile_id)
41
40
  request.validationMode = validation
42
41
  request.paymentProfile = contract
43
- request.paymentProfile.defaultPaymentProfile = int(default)
44
42
  return request, apicontrollers.createCustomerPaymentProfileController
45
43
 
46
44
 
@@ -72,7 +70,7 @@ def get_customer_payment_profile(
72
70
  def validate_customer_payment_profile(
73
71
  customer_profile_id: int,
74
72
  payment_profile_id: int,
75
- validation: str = "liveMode",
73
+ validation: str = apicontractsv1.validationModeEnum.liveMode,
76
74
  ) -> tuple[ObjectifiedElement, type[APIOperationBase]]:
77
75
  """
78
76
  `validateCustomerPaymentProfileRequest <https://developer.authorize.net/api/reference/index.html#customer-profiles-validate-customer-payment-profile>`_.
@@ -97,8 +95,7 @@ def validate_customer_payment_profile(
97
95
  def update_customer_payment_profile(
98
96
  customer_profile_id: int,
99
97
  contract: apicontractsv1.customerPaymentProfileExType,
100
- default: bool,
101
- validation: str = "liveMode",
98
+ validation: str = apicontractsv1.validationModeEnum.liveMode,
102
99
  ) -> tuple[ObjectifiedElement, type[APIOperationBase]]:
103
100
  """
104
101
  `updateCustomerPaymentProfileRequest <https://developer.authorize.net/api/reference/index.html#customer-profiles-update-customer-payment-profile>`_.
@@ -107,11 +104,11 @@ def update_customer_payment_profile(
107
104
  :type customer_profile_id: int
108
105
  :param contract: A customer payment profile ex element.
109
106
  :type contract: ~authorizenet.apicontractsv1.customerPaymentProfileExType
110
- :param default: Whether to set the payment profile as default.
111
- :type default: bool
112
107
  :param validation: Validation mode. Default is :py:obj:`"liveMode"`.
113
108
  :type validation: str
114
- :raises ValueError: If neither payment nor address was provided.
109
+ :raises ValueError: If :py:attr:`payment` wasn't in the contract.
110
+ :raises ValueError: If :py:attr:`billTo` wasn't in the contract.
111
+ :raises ValueError: If :py:attr:`customerProfileId` wasn't in the contract.
115
112
  :returns: A tuple containing an Authorizenet API request element and controller class.
116
113
  :rtype: tuple[~lxml.objectify.ObjectifiedElement, type[~authorizenet.apicontrollersbase.APIOperationBase]]
117
114
 
@@ -126,7 +123,6 @@ def update_customer_payment_profile(
126
123
  request.customerProfileId = str(customer_profile_id)
127
124
  request.validationMode = validation
128
125
  request.paymentProfile = contract
129
- request.paymentProfile.defaultPaymentProfile = int(default)
130
126
  return request, apicontrollers.updateCustomerPaymentProfileController
131
127
 
132
128
 
@@ -6,7 +6,7 @@ from django.conf import settings
6
6
  from lxml.objectify import ObjectifiedElement
7
7
 
8
8
 
9
- class AuthorizenetControllerExecutionError(Exception):
9
+ class AuthorizenetError(Exception):
10
10
  """Raised when an Authorizenet API controller fails to execute."""
11
11
 
12
12
  def __init__(self, message: str, code: str, *args, **kwargs) -> None:
@@ -14,9 +14,6 @@ class AuthorizenetControllerExecutionError(Exception):
14
14
  self._message: str = message
15
15
  self._code: str = code
16
16
 
17
- def __str__(self) -> str:
18
- return f"{self.code}: {self.message}"
19
-
20
17
  @property
21
18
  def message(self) -> str:
22
19
  """An Authorizenet API error message."""
@@ -45,7 +42,7 @@ class AuthorizenetService:
45
42
  :type request_tuple: tuple[~lxml.objectify.ObjectifiedElement, type[~authorizenet.apicontrollersbase.APIOperationBase]]
46
43
  :param reference_id: An optional reference id string for the API call. Default is :py:obj:`None`.
47
44
  :type reference_id: str | None
48
- :raises AuthorizenetControllerExecutionError: If the API call failed.
45
+ :raises AuthorizenetError: If the API call failed.
49
46
  :returns: An Authorizenet API response.
50
47
  :rtype: ~lxml.objectify.ObjectifiedElement
51
48
 
@@ -60,13 +57,13 @@ class AuthorizenetService:
60
57
  controller.execute()
61
58
  response = controller.getresponse()
62
59
 
63
- if not response:
64
- raise AuthorizenetControllerExecutionError(
60
+ if response is None:
61
+ raise AuthorizenetError(
65
62
  message="No response from the Authorizenet API controller.",
66
63
  code="1",
67
64
  )
68
65
  elif response is not None and response.messages.resultCode != "Ok":
69
- raise AuthorizenetControllerExecutionError(
66
+ raise AuthorizenetError(
70
67
  message=response.messages.message[0]["text"].text,
71
68
  code=response.messages.message[0]["code"].text,
72
69
  )
@@ -84,8 +81,3 @@ class AuthorizenetService:
84
81
  def environment(self) -> str:
85
82
  """Environment for Authorizenet API requests."""
86
83
  return str(settings.MERCHANT_AUTH_ENVIRONMENT)
87
-
88
- @cached_property
89
- def validationMode(self) -> str:
90
- """Validation mode for Authorizenet API requests."""
91
- return str(settings.MERCHANT_AUTH_VALIDATION_MODE)
@@ -1,7 +1,7 @@
1
1
  import os
2
2
  import pathlib
3
3
 
4
- from terminusgps.authorizenet.constants import Environment, ValidationMode
4
+ from authorizenet.constants import constants as anet_constants
5
5
 
6
6
  BASE_DIR = pathlib.Path(__file__).resolve().parent
7
7
 
@@ -10,8 +10,8 @@ SECRET_KEY = "xem*6no%8d9%^qzt2f3x3ar-uq4_+7h9myc$t0!+4%bj5us6f)"
10
10
  USE_TZ = False
11
11
  USE_I18N = False
12
12
 
13
- MERCHANT_AUTH_ENVIRONMENT = Environment.SANDBOX
14
- MERCHANT_AUTH_VALIDATION_MODE = ValidationMode.TEST
13
+ MERCHANT_AUTH_ENVIRONMENT = anet_constants.SANDBOX
14
+ MERCHANT_AUTH_VALIDATION_MODE = "testMode"
15
15
 
16
16
  # Secrets
17
17
  MERCHANT_AUTH_LOGIN_ID = os.getenv("MERCHANT_AUTH_LOGIN_ID")
@@ -316,8 +316,8 @@ class CreateCustomerPaymentProfileFunctionTestCase(unittest.TestCase):
316
316
  "contract": apicontractsv1.customerPaymentProfileType(
317
317
  billTo=apicontractsv1.customerAddressType(),
318
318
  payment=apicontractsv1.paymentType(),
319
+ defaultPaymentProfile="1",
319
320
  ),
320
- "default": False,
321
321
  "validation": "testMode",
322
322
  }
323
323
  expected = apicontrollers.createCustomerPaymentProfileController
@@ -330,9 +330,10 @@ class CreateCustomerPaymentProfileFunctionTestCase(unittest.TestCase):
330
330
  kwargs = {
331
331
  "customer_profile_id": 1,
332
332
  "contract": apicontractsv1.customerPaymentProfileType(
333
- billTo=None, payment=apicontractsv1.paymentType()
333
+ billTo=None,
334
+ payment=apicontractsv1.paymentType(),
335
+ defaultPaymentProfile="1",
334
336
  ),
335
- "default": False,
336
337
  "validation": "testMode",
337
338
  }
338
339
  self.func(**kwargs)
@@ -340,9 +341,10 @@ class CreateCustomerPaymentProfileFunctionTestCase(unittest.TestCase):
340
341
  kwargs = {
341
342
  "customer_profile_id": 1,
342
343
  "contract": apicontractsv1.customerPaymentProfileType(
343
- billTo=apicontractsv1.customerAddressType(), payment=None
344
+ billTo=apicontractsv1.customerAddressType(),
345
+ payment=None,
346
+ defaultPaymentProfile="1",
344
347
  ),
345
- "default": False,
346
348
  "validation": "testMode",
347
349
  }
348
350
  self.func(**kwargs)
@@ -354,8 +356,8 @@ class CreateCustomerPaymentProfileFunctionTestCase(unittest.TestCase):
354
356
  "contract": apicontractsv1.customerPaymentProfileType(
355
357
  billTo=apicontractsv1.customerAddressType(),
356
358
  payment=apicontractsv1.paymentType(),
359
+ defaultPaymentProfile="1",
357
360
  ),
358
- "default": True,
359
361
  "validation": "testMode",
360
362
  }
361
363
 
@@ -365,10 +367,7 @@ class CreateCustomerPaymentProfileFunctionTestCase(unittest.TestCase):
365
367
  self.assertEqual(
366
368
  request.customerProfileId, str(kwargs["customer_profile_id"])
367
369
  )
368
- self.assertEqual(
369
- request.paymentProfile.defaultPaymentProfile,
370
- int(kwargs["default"]),
371
- )
370
+ self.assertEqual(request.paymentProfile.defaultPaymentProfile, 1)
372
371
 
373
372
 
374
373
  class GetCustomerPaymentProfileFunctionTestCase(unittest.TestCase):
@@ -450,8 +449,8 @@ class UpdateCustomerPaymentProfileFunctionTestCase(unittest.TestCase):
450
449
  payment=apicontractsv1.paymentType(),
451
450
  billTo=apicontractsv1.customerAddressType(),
452
451
  customerPaymentProfileId="1",
452
+ defaultPaymentProfile="1",
453
453
  ),
454
- "default": False,
455
454
  "validation": "testMode",
456
455
  }
457
456
  expected = apicontrollers.updateCustomerPaymentProfileController
@@ -466,8 +465,8 @@ class UpdateCustomerPaymentProfileFunctionTestCase(unittest.TestCase):
466
465
  payment=apicontractsv1.paymentType(),
467
466
  billTo=apicontractsv1.customerAddressType(),
468
467
  customerPaymentProfileId="1",
468
+ defaultPaymentProfile="1",
469
469
  ),
470
- "default": True,
471
470
  "validation": "testMode",
472
471
  }
473
472
 
@@ -477,10 +476,7 @@ class UpdateCustomerPaymentProfileFunctionTestCase(unittest.TestCase):
477
476
  )
478
477
  self.assertEqual(request.paymentProfile, kwargs["contract"])
479
478
  self.assertEqual(request.validationMode, kwargs["validation"])
480
- self.assertEqual(
481
- request.paymentProfile.defaultPaymentProfile,
482
- int(kwargs["default"]),
483
- )
479
+ self.assertEqual(request.paymentProfile.defaultPaymentProfile, 1)
484
480
 
485
481
  def test_invalid_contract_values_raises_valueerror(self):
486
482
  """Fails if :py:exec:`ValueError` wasn't raised when calling the function with a contract with invalid values."""
@@ -491,8 +487,8 @@ class UpdateCustomerPaymentProfileFunctionTestCase(unittest.TestCase):
491
487
  payment=apicontractsv1.paymentType(),
492
488
  billTo=apicontractsv1.customerAddressType(),
493
489
  customerPaymentProfileId=None,
490
+ defaultPaymentProfile="1",
494
491
  ),
495
- "default": True,
496
492
  "validation": "testMode",
497
493
  }
498
494
  self.func(**kwargs)
@@ -503,8 +499,8 @@ class UpdateCustomerPaymentProfileFunctionTestCase(unittest.TestCase):
503
499
  payment=None,
504
500
  billTo=apicontractsv1.customerAddressType(),
505
501
  customerPaymentProfileId="1",
502
+ defaultPaymentProfile="1",
506
503
  ),
507
- "default": True,
508
504
  "validation": "testMode",
509
505
  }
510
506
  self.func(**kwargs)
@@ -515,8 +511,8 @@ class UpdateCustomerPaymentProfileFunctionTestCase(unittest.TestCase):
515
511
  payment=apicontractsv1.paymentType(),
516
512
  billTo=None,
517
513
  customerPaymentProfileId="1",
514
+ defaultPaymentProfile="1",
518
515
  ),
519
- "default": True,
520
516
  "validation": "testMode",
521
517
  }
522
518
  self.func(**kwargs)
@@ -833,7 +833,7 @@ wheels = [
833
833
 
834
834
  [[package]]
835
835
  name = "python-terminusgps"
836
- version = "53.1.0"
836
+ version = "54.1.0"
837
837
  source = { editable = "." }
838
838
  dependencies = [
839
839
  { name = "authorizenet" },
@@ -1,104 +0,0 @@
1
- from authorizenet import apicontractsv1
2
- from authorizenet.constants import constants as anet_constants
3
- from django.db import models
4
- from django.utils.translation import gettext_lazy as _
5
-
6
-
7
- class BankAccountType(models.TextChoices):
8
- CHECKING = "checking", _("Checking account")
9
- """Checking account."""
10
- SAVINGS = "savings", _("Savings account")
11
- """Savings account."""
12
- BUSINESS_CHECKING = "businessChecking", _("Business checking account")
13
- """Business checking account."""
14
-
15
-
16
- class ECheckType(models.TextChoices):
17
- PPD = "PPD", _("Prearranged Payment and Deposit Entry")
18
- """Prearranged Payment and Deposit Entry."""
19
- TEL = "TEL", _("Telephone-Initiated Entry")
20
- """Telephone-Initiated Entry."""
21
- WEB = "WEB", _("Web-Initiated Entry")
22
- """Web-Initiated Entry."""
23
-
24
-
25
- class CreditCardType(models.TextChoices):
26
- AMEX = apicontractsv1.cardTypeEnum.AmericanExpress, _("American Express")
27
- """American express card."""
28
- DINERS = apicontractsv1.cardTypeEnum.DinersClub, _("Diners Club")
29
- """Diners club card."""
30
- DISCOVER = apicontractsv1.cardTypeEnum.Discover, _("Discover")
31
- """Disover card."""
32
- JCB = apicontractsv1.cardTypeEnum.JCB, _("JCB")
33
- """JCB card."""
34
- MASTERCARD = apicontractsv1.cardTypeEnum.MasterCard, _("Mastercard")
35
- """Mastercard card."""
36
- VISA = apicontractsv1.cardTypeEnum.Visa, _("Visa")
37
- """Visa card."""
38
-
39
-
40
- class CurrencyCode(models.TextChoices):
41
- USD = "USD", _("United States Dollar")
42
- """US dollar."""
43
- CAD = "CAD", _("Canadian Dollar")
44
- """Canadian dollar."""
45
- GBP = "GBP", _("Great British Pound")
46
- """Great British pound."""
47
- DKK = "DKK", _("Danish Krone")
48
- """Danish krone."""
49
- NOK = "NOK", _("Norwegian Krone")
50
- """Norwegian krone."""
51
- PLN = "PLN", _("Polish Złoty")
52
- """Polish zloty."""
53
- SEK = "SEK", _("Swedish Krona")
54
- """Swedish krona."""
55
- EUR = "EUR", _("Euro")
56
- """Euro."""
57
- AUD = "AUD", _("Australian Dollar")
58
- """Australian dollar."""
59
- NZD = "NZD", _("New Zealand Dollar")
60
- """New Zealand dollar."""
61
-
62
-
63
- class SubscriptionStatus(models.TextChoices):
64
- """An Authorizenet subscription status."""
65
-
66
- ACTIVE = "active", _("Active")
67
- """Active status."""
68
- EXPIRED = "expired", _("Expired")
69
- """Expired status."""
70
- SUSPENDED = "suspended", _("Suspended")
71
- """Suspended status."""
72
- CANCELED = "canceled", _("Canceled")
73
- """Canceled status."""
74
- TERMINATED = "terminated", _("Terminated")
75
- """Terminated status."""
76
- UNKNOWN = "unknown", _("Unknown")
77
- """Unknown status."""
78
-
79
-
80
- class SubscriptionIntervalUnit(models.TextChoices):
81
- """An Authorizenet subscription interval unit."""
82
-
83
- DAYS = apicontractsv1.ARBSubscriptionUnitEnum.days, _("Days")
84
- """Days interval unit."""
85
- MONTHS = apicontractsv1.ARBSubscriptionUnitEnum.months, _("Months")
86
- """Months interval unit."""
87
-
88
-
89
- class Environment(models.TextChoices):
90
- """An Authorizenet execution environment."""
91
-
92
- SANDBOX = anet_constants.SANDBOX, _("Sandbox Environment")
93
- """Sandbox environment."""
94
- PRODUCTION = anet_constants.PRODUCTION, _("Production Environment")
95
- """Production environment."""
96
-
97
-
98
- class ValidationMode(models.TextChoices):
99
- """An Authorizenet validation mode."""
100
-
101
- TEST = "testMode", _("Test Mode")
102
- """Test mode."""
103
- LIVE = "liveMode", _("Live Mode")
104
- """Live mode."""
@@ -1,14 +0,0 @@
1
- import typing
2
-
3
- T_contract = typing.TypeVar("T_contract")
4
-
5
-
6
- class AuthorizenetContractBuilder(typing.Generic[T_contract]):
7
- def __init__(self, contract_cls: type[T_contract]) -> None:
8
- self.contract_cls = contract_cls
9
-
10
- def build(self, fields: dict[str, typing.Any]) -> T_contract:
11
- contract = self.contract_cls()
12
- for field, value in fields.items():
13
- setattr(contract, field, value)
14
- return contract