python-terminusgps 33.2.0__py3-none-any.whl → 33.3.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.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: python-terminusgps
3
- Version: 33.2.0
3
+ Version: 33.3.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://docs.terminusgps.com
6
6
  Project-URL: Repository, https://github.com/terminusgps/python-terminusgps
@@ -3,7 +3,7 @@ terminusgps/authorizenet/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZ
3
3
  terminusgps/authorizenet/auth.py,sha256=umNpOXObDrIt2K40padWBedQl7tVAmEg2alBWhGk-qQ,1238
4
4
  terminusgps/authorizenet/constants.py,sha256=xmulPmiBLhFfZoc7Il3l-DZA9Nq5HSaJmJKU-v-5X-Y,420
5
5
  terminusgps/authorizenet/controllers.py,sha256=9t62qdGpmAkP4tNyPefd7vBRutXvMWsxql6z_pg52Bg,2146
6
- terminusgps/authorizenet/utils.py,sha256=zmBVqRamCmxEO6tZWRaGPn5uvL_Lr0yO36Lgc954m8k,2930
6
+ terminusgps/authorizenet/utils.py,sha256=FrKqXWrplcgiET1rDTmUaqmN_ze7j93jWgfFeJR8rlg,7073
7
7
  terminusgps/authorizenet/profiles/__init__.py,sha256=IG4XCEEYtHKqXOatlZlob6J3ukAgF7cFR-RXxOSMS1c,161
8
8
  terminusgps/authorizenet/profiles/addresses.py,sha256=xDlnFlIjuR7NVXwfj5aJT9E_GolnYFuYASkfenvWfm8,6292
9
9
  terminusgps/authorizenet/profiles/base.py,sha256=lPc8Pugp5EcXtZmeBpeqicij7l0ROGvMYTV8J0fLLmQ,3768
@@ -12,7 +12,7 @@ terminusgps/authorizenet/profiles/payments.py,sha256=MmjvE4ZSfgyGPRUzeREB_dX_n6Q
12
12
  terminusgps/authorizenet/profiles/subscriptions.py,sha256=m_jb9GqeD1tLmeqSnaGwJrzPcQOulEkF8K1wCaqKR24,7924
13
13
  terminusgps/authorizenet/tests/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
14
14
  terminusgps/authorizenet/tests/test_auth.py,sha256=sdByYrcv8RKjcJckOHbyHH1z_M4qrATFI3qj_XDQXbk,1624
15
- terminusgps/authorizenet/tests/test_profiles.py,sha256=24lo71F5MWOUNdB2MwTAstPUkyfZ58aOiIxiRwyWcd0,7476
15
+ terminusgps/authorizenet/tests/test_profiles.py,sha256=tvLBY0iSAC33RlWiBP_NSnPskUQBjfrf0YHMpR-m22k,7566
16
16
  terminusgps/authorizenet/tests/test_utils.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
17
17
  terminusgps/aws/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
18
18
  terminusgps/aws/connect.py,sha256=TWf2bVz6LqSNQfVD7FKRn3K71VuLOwBj05Gs-9BsROg,693
@@ -53,7 +53,7 @@ terminusgps/wialon/tests/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZ
53
53
  terminusgps/wialon/tests/test_items.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
54
54
  terminusgps/wialon/tests/test_session.py,sha256=9mBlYchMo9NeqRIZsmxYzrM1zBHorqu4ooxqSNppLpI,1336
55
55
  terminusgps/wialon/tests/test_utils.py,sha256=SK4PxJQGECFnzx_EQeRAQfsQ5_3FLaVcis2W9u_ibuI,1730
56
- python_terminusgps-33.2.0.dist-info/METADATA,sha256=zRen2hb6Tb8T0FM81XTAcRPElynhCVAPPt4hoN4hVJY,1581
57
- python_terminusgps-33.2.0.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
58
- python_terminusgps-33.2.0.dist-info/licenses/COPYING,sha256=OXLcl0T2SZ8Pmy2_dmlvKuetivmyPd5m1q-Gyd-zaYY,35149
59
- python_terminusgps-33.2.0.dist-info/RECORD,,
56
+ python_terminusgps-33.3.0.dist-info/METADATA,sha256=CMGz4nsoWA7NjUaj9BPHN8WVudEFlyYj_UwqUH0T8R8,1581
57
+ python_terminusgps-33.3.0.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
58
+ python_terminusgps-33.3.0.dist-info/licenses/COPYING,sha256=OXLcl0T2SZ8Pmy2_dmlvKuetivmyPd5m1q-Gyd-zaYY,35149
59
+ python_terminusgps-33.3.0.dist-info/RECORD,,
@@ -149,7 +149,9 @@ class PaymentProfileTestCase(TestCase):
149
149
  def test_payment_profile_create(self) -> None:
150
150
  """Fails if a payment profile is not properly created in Authorizenet."""
151
151
  test_payment_profile = PaymentProfile(
152
- id=None, customer_profile_id=self.test_customer_profile.id, default=True
152
+ id=None,
153
+ customer_profile_id=str(self.test_customer_profile.id),
154
+ default=True,
153
155
  )
154
156
  test_payment_profile.id = test_payment_profile.create(
155
157
  address=self.test_address_obj, payment=self.test_payment_obj
@@ -159,7 +161,9 @@ class PaymentProfileTestCase(TestCase):
159
161
  def test_payment_profile_delete(self) -> None:
160
162
  """Fails if a payment profile is not properly deleted in Authorizenet."""
161
163
  test_payment_profile = PaymentProfile(
162
- id=None, customer_profile_id=self.test_customer_profile.id, default=True
164
+ id=None,
165
+ customer_profile_id=str(self.test_customer_profile.id),
166
+ default=True,
163
167
  )
164
168
  test_payment_profile.id = test_payment_profile.create(
165
169
  address=self.test_address_obj, payment=self.test_payment_obj
@@ -170,7 +174,9 @@ class PaymentProfileTestCase(TestCase):
170
174
  def test_payment_profile_last_4(self) -> None:
171
175
  """Fails if a payment profile's last 4 credit card digits are not properly retrieved."""
172
176
  test_payment_profile = PaymentProfile(
173
- id=None, customer_profile_id=self.test_customer_profile.id, default=True
177
+ id=None,
178
+ customer_profile_id=str(self.test_customer_profile.id),
179
+ default=True,
174
180
  )
175
181
  test_payment_profile.id = test_payment_profile.create(
176
182
  address=self.test_address_obj, payment=self.test_payment_obj
@@ -5,11 +5,107 @@ from .auth import get_merchant_auth
5
5
  from .controllers import AuthorizenetControllerExecutor
6
6
 
7
7
 
8
+ def get_payment_profile_transactions(
9
+ customer_profile_id: int | str,
10
+ payment_profile_id: int | str,
11
+ descending: bool = False,
12
+ limit: int = 100,
13
+ offset: int = 0,
14
+ ) -> dict | None:
15
+ """
16
+ Returns a transaction list for a customer payment profile.
17
+
18
+ `getTransactionListForCustomerRequest <https://developer.authorize.net/api/reference/index.html#transaction-reporting-get-customer-profile-transaction-list>`_
19
+
20
+ :param customer_profile_id: A customer profile id.
21
+ :type customer_profile_id: :py:obj:`int` | :py:obj:`str`
22
+ :param payment_profile_id: A customer payment profile id.
23
+ :type payment_profile_id: :py:obj:`int` | :py:obj:`str`
24
+ :param descending: Whether or not to sort the response in descending order. Default is :py:obj:`False`.
25
+ :type descending: :py:obj:`bool`
26
+ :param limit: Maximum amount of transactions to return in the response. Default is :py:obj:`100` .
27
+ :type limit: :py:obj:`int`
28
+ :param offset: Offsets the response for pagination. Default is :py:obj:`0` for page 0.
29
+ :type offset: :py:obj:`int`
30
+ :raises ValueError: If ``customer_profile_id`` was provided as a string containing non-digits.
31
+ :raises ValueError: If ``payment_profile_id`` was provided as a string containing non-digits.
32
+ :raises AuthorizenetControllerExecutionError: If the API call fails.
33
+ :returns: A merchant details object, if found.
34
+ :rtype: :py:obj:`dict` | :py:obj:`None`
35
+
36
+ """
37
+ raise NotImplementedError
38
+
39
+ if isinstance(customer_profile_id, str) and not customer_profile_id.isdigit():
40
+ raise ValueError(
41
+ f"'customer_profile_id' can only contain digits, got '{customer_profile_id}'."
42
+ )
43
+ if isinstance(payment_profile_id, str) and not payment_profile_id.isdigit():
44
+ raise ValueError(
45
+ f"'payment_profile_id' can only contain digits, got '{payment_profile_id}'."
46
+ )
47
+
48
+ request = apicontractsv1.getTransactionListForCustomerRequest(
49
+ merchantAuthentication=get_merchant_auth(),
50
+ customerProfileId=str(customer_profile_id),
51
+ customerPaymentProfileId=str(payment_profile_id),
52
+ sorting={
53
+ "orderBy": "submitTimeUTC",
54
+ "orderDescending": str(descending).lower(),
55
+ },
56
+ paging={"limit": limit, "offset": offset},
57
+ )
58
+ controller = apicontrollers.getTransactionListForCustomerController(request)
59
+ return AuthorizenetControllerExecutor.execute_controller(controller)
60
+
61
+
62
+ def get_merchant_details() -> dict | None:
63
+ """
64
+ Returns Authorizenet merchant details.
65
+
66
+ `getMerchantDetailsRequest <http://developer.authorize.net/api/reference/index.html#transaction-reporting-get-merchant-details>`_
67
+
68
+ :raises AuthorizenetControllerExecutionError: If the API call fails.
69
+ :returns: A merchant details object, if found.
70
+ :rtype: :py:obj:`dict` | :py:obj:`None`
71
+
72
+ """
73
+ request = apicontractsv1.getMerchantDetailsRequest(
74
+ merchantAuthentication=get_merchant_auth()
75
+ )
76
+ controller = apicontrollers.getMerchantDetailsController(request)
77
+ return AuthorizenetControllerExecutor.execute_controller(controller)
78
+
79
+
80
+ def get_transaction(id: int | str) -> dict | None:
81
+ """
82
+ Returns Authorizenet transaction details by id.
83
+
84
+ `getTransactionDetailsRequest <https://developer.authorize.net/api/reference/index.html#transaction-reporting-get-transaction-details>`_
85
+
86
+ :param id: An Authorizenet transaction id.
87
+ :type id: :py:obj:`int` | :py:obj:`str`
88
+ :raises ValueError: If ``id`` was provided as a string containing non-digits.
89
+ :raises AuthorizenetControllerExecutionError: If the API call fails.
90
+ :returns: A transaction object, if found.
91
+ :rtype: :py:obj:`dict` | :py:obj:`None`
92
+
93
+ """
94
+ if isinstance(id, str) and not id.isdigit():
95
+ raise ValueError(f"'id' can only contain digits, got '{id}'.")
96
+
97
+ request = apicontractsv1.getTransactionDetailsRequest(
98
+ merchantAuthentication=get_merchant_auth(), transId=str(id)
99
+ )
100
+ controller = apicontrollers.getTransactionDetailsController(request)
101
+ return AuthorizenetControllerExecutor.execute_controller(controller)
102
+
103
+
8
104
  def get_customer_profile_ids() -> list[int]:
9
105
  """
10
106
  Returns a list of all customer profile ids in Authorizenet.
11
107
 
12
- :raises ControllerExecutionError: If the API call fails.
108
+ :raises AuthorizenetControllerExecutionError: If the API call fails.
13
109
  :returns: A list of all customer profile ids in Authorizenet.
14
110
  :rtype: :py:obj:`list`
15
111