python-terminusgps 28.5.1__py3-none-any.whl → 28.7.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: 28.5.1
3
+ Version: 28.7.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://app.terminusgps.com/docs/apps/python-terminusgps/index.html
6
6
  Project-URL: Repository, https://github.com/terminusgps/python-terminusgps
@@ -9,7 +9,7 @@ terminusgps/authorizenet/profiles/addresses.py,sha256=7yrOrb9kIsiiazgWbeH8v_YUBi
9
9
  terminusgps/authorizenet/profiles/base.py,sha256=TOUHr22QRQBLErdysOkfcpJBusTjrUTqOmWEyNvMacA,2240
10
10
  terminusgps/authorizenet/profiles/customers.py,sha256=-F8IsQEn2CyHpfxyVZjKayHSuVe4ENNUj_ck7SE8LO0,8568
11
11
  terminusgps/authorizenet/profiles/payments.py,sha256=ohhZrs9MB7GkCi7jQvPVvELNKnR9BwzMd607jJmT4n4,11316
12
- terminusgps/authorizenet/profiles/subscriptions.py,sha256=eg64XiDg37Lv9J0lyYMCbj9WHNcYqztahPuChlvyCTs,12607
12
+ terminusgps/authorizenet/profiles/subscriptions.py,sha256=clI_ZvUeyDr_BIRLttUJ1E6wmzF2a5YNF-dY7nuxwBk,11081
13
13
  terminusgps/aws/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
14
14
  terminusgps/aws/connect.py,sha256=TWf2bVz6LqSNQfVD7FKRn3K71VuLOwBj05Gs-9BsROg,693
15
15
  terminusgps/aws/secrets.py,sha256=MxQEmmBLpMUQ2tYAsHdCYf-7RZ84LiogdKcTsACX5dw,361
@@ -30,7 +30,7 @@ terminusgps/wialon/items/route.py,sha256=8SzlqNmpYVdt-ZAY--B_KHoDIHgN0Zb7KBsBWAz
30
30
  terminusgps/wialon/items/unit.py,sha256=i7sQiRu3N0XxyTHVN2RnmjYy9X48KdnZLSB18ic37w8,9363
31
31
  terminusgps/wialon/items/unit_group.py,sha256=YsYh34l2DjSKcv5SIZkEVi5FSjveGB1gxU2fwdLyvl4,4101
32
32
  terminusgps/wialon/items/user.py,sha256=PFYBie04F16YE2B5364PLxkmlTmQr4sZXpItvRBxsDc,7143
33
- python_terminusgps-28.5.1.dist-info/METADATA,sha256=NjEa3mini_ON-oFC-sFa0gQ5IJ5yjwUkNGwZR_1otY4,946
34
- python_terminusgps-28.5.1.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
35
- python_terminusgps-28.5.1.dist-info/licenses/COPYING,sha256=OXLcl0T2SZ8Pmy2_dmlvKuetivmyPd5m1q-Gyd-zaYY,35149
36
- python_terminusgps-28.5.1.dist-info/RECORD,,
33
+ python_terminusgps-28.7.0.dist-info/METADATA,sha256=kj2hP8rPa4VTvsW7EL7DiEdMpIVXwQccUbMek8iwaBk,946
34
+ python_terminusgps-28.7.0.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
35
+ python_terminusgps-28.7.0.dist-info/licenses/COPYING,sha256=OXLcl0T2SZ8Pmy2_dmlvKuetivmyPd5m1q-Gyd-zaYY,35149
36
+ python_terminusgps-28.7.0.dist-info/RECORD,,
@@ -89,54 +89,17 @@ class SubscriptionProfile(ControllerExecutionMixin):
89
89
  """
90
90
  self._authorizenet_cancel_subscription()
91
91
 
92
- def update(
93
- self,
94
- name: str,
95
- amount: decimal.Decimal,
96
- profile_id: int | str,
97
- payment_id: int | str,
98
- address_id: int | str,
99
- ) -> None:
92
+ def update(self, subscription: apicontractsv1.ARBSubscriptionType) -> None:
100
93
  """
101
94
  Updates a subscription in Authorizenet.
102
95
 
103
- :param name: A name for the subscription.
104
- :type name: :py:obj:`str`
105
- :param amount: An amount of money paid per occurrence of the subscription.
106
- :type amount: :py:obj:`~decimal.Decimal`
107
- :param profile_id: An Authorizenet customer profile id.
108
- :type profile_id: :py:obj:`int` | :py:obj:`str`
109
- :param payment_id: An Authorizenet customer payment profile id.
110
- :type payment_id: :py:obj:`int` | :py:obj:`str`
111
- :param address_id: An Authorizenet customer address profile id.
112
- :type address_id: :py:obj:`int` | :py:obj:`str`
96
+ :param subscription: A new subscription object.
97
+ :type subscription: :py:obj:`authorizenet.apicontractsv1.ARBSubscriptionType`
113
98
  :raises ControllerExecutionError: If something goes wrong during an Authorizenet API call.
114
- :raises ValueError: If ``profile_id`` wasn't a digit.
115
- :raises ValueError: If ``payment_id`` wasn't a digit.
116
- :raises ValueError: If ``address_id`` wasn't a digit.
117
- :raises ValueError: If the Authorizenet API response was not retrieved.
118
- :returns: An Authorizenet subscription id.
119
- :rtype: :py:obj:`int`
99
+ :returns: Nothing.
100
+ :rtype: :py:obj:`None`
120
101
 
121
102
  """
122
- if isinstance(profile_id, str) and not profile_id.isdigit():
123
- raise ValueError(f"'profile_id' must be a digit, got '{profile_id}'.")
124
- if isinstance(payment_id, str) and not payment_id.isdigit():
125
- raise ValueError(f"'payment_id' must be a digit, got '{payment_id}'.")
126
- if isinstance(address_id, str) and not address_id.isdigit():
127
- raise ValueError(f"'address_id' must be a digit, got '{address_id}'.")
128
-
129
- subscription: apicontractsv1.ARBSubscriptionType = (
130
- apicontractsv1.ARBSubscriptionType(
131
- name=name,
132
- amount=amount,
133
- profile=apicontractsv1.customerProfileIdType(
134
- customerProfileId=str(profile_id),
135
- customerPaymentProfileId=str(payment_id),
136
- customerAddressId=str(address_id),
137
- ),
138
- )
139
- )
140
103
  self._authorizenet_update_subscription(subscription)
141
104
 
142
105
  @property
@@ -147,14 +110,19 @@ class SubscriptionProfile(ControllerExecutionMixin):
147
110
  @property
148
111
  def status(self) -> str | None:
149
112
  """Current status of the subscription."""
150
- response: dict | None = self._authorizenet_get_subscription_status()
151
- return (
152
- str(response.status) if response and response.status is not None else None
153
- )
113
+ if not self.id:
114
+ return
115
+
116
+ response = self._authorizenet_get_subscription_status()
117
+ if response is not None and "status" in response.getchildren():
118
+ return response.status
154
119
 
155
120
  @property
156
121
  def transactions(self) -> list | None:
157
122
  """Transactions for the subscription."""
123
+ if not self.id:
124
+ return
125
+
158
126
  response = self._authorizenet_get_subscription(include_transactions=True)
159
127
  if response is not None and "arbTransactions" in response.getchildren():
160
128
  return [t for t in response.arbTransactions]
@@ -164,16 +132,20 @@ class SubscriptionProfile(ControllerExecutionMixin):
164
132
  """Customer payment profile id for the subscription."""
165
133
  if not self.id:
166
134
  return
135
+
167
136
  response = self._authorizenet_get_subscription()
168
- return int(response.profile.paymentProfile.customerPaymentProfileId)
137
+ if response is not None and "profile" in response.getchildren():
138
+ return int(response.profile.paymentProfile.customerPaymentProfileId)
169
139
 
170
140
  @property
171
141
  def address_id(self) -> int | None:
172
142
  """Customer address profile id for the subscription."""
173
143
  if not self.id:
174
144
  return
145
+
175
146
  response = self._authorizenet_get_subscription()
176
- return int(response.profile.shippingProfile.customerAddressId)
147
+ if response is not None and "profile" in response.getchildren():
148
+ return int(response.profile.shippingProfile.customerAddressId)
177
149
 
178
150
  def _authorizenet_create_subscription(
179
151
  self, subscription: apicontractsv1.ARBSubscriptionType