python-terminusgps 28.6.0__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.6.0
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=MtinTBTtbCmzYcE30emF_Dvd1BkEp_koZf89K11Dwnw,13113
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.6.0.dist-info/METADATA,sha256=yVsNBGbxWlPjLRFo7I7rjfmVGSQqXi2NsCynF2okGx4,946
34
- python_terminusgps-28.6.0.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
35
- python_terminusgps-28.6.0.dist-info/licenses/COPYING,sha256=OXLcl0T2SZ8Pmy2_dmlvKuetivmyPd5m1q-Gyd-zaYY,35149
36
- python_terminusgps-28.6.0.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,62 +89,17 @@ class SubscriptionProfile(ControllerExecutionMixin):
89
89
  """
90
90
  self._authorizenet_cancel_subscription()
91
91
 
92
- def update(
93
- self,
94
- name: str | None = None,
95
- amount: decimal.Decimal | None = None,
96
- profile_id: int | str | None = None,
97
- payment_id: int | str | None = None,
98
- address_id: int | str | None = None,
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` | :py:obj:`None`
105
- :param amount: An amount of money paid per occurrence of the subscription.
106
- :type amount: :py:obj:`~decimal.Decimal` | :py:obj:`None`
107
- :param profile_id: An Authorizenet customer profile id.
108
- :type profile_id: :py:obj:`int` | :py:obj:`str` | :py:obj:`None`
109
- :param payment_id: An Authorizenet customer payment profile id.
110
- :type payment_id: :py:obj:`int` | :py:obj:`str` | :py:obj:`None`
111
- :param address_id: An Authorizenet customer address profile id.
112
- :type address_id: :py:obj:`int` | :py:obj:`str` | :py:obj:`None`
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 no arguments were provided.
115
- :raises ValueError: If ``profile_id`` was provided but wasn't a digit.
116
- :raises ValueError: If ``payment_id`` was provided but wasn't a digit.
117
- :raises ValueError: If ``address_id`` was provided but wasn't a digit.
118
99
  :returns: Nothing.
119
100
  :rtype: :py:obj:`None`
120
101
 
121
102
  """
122
- if not any([name, amount, profile_id, payment_id, address_id]):
123
- raise ValueError("At least one argument is required.")
124
- if profile_id and isinstance(profile_id, str) and not profile_id.isdigit():
125
- raise ValueError(f"'profile_id' must be a digit, got '{profile_id}'.")
126
- if payment_id and isinstance(payment_id, str) and not payment_id.isdigit():
127
- raise ValueError(f"'payment_id' must be a digit, got '{payment_id}'.")
128
- if address_id and isinstance(address_id, str) and not address_id.isdigit():
129
- raise ValueError(f"'address_id' must be a digit, got '{address_id}'.")
130
-
131
- subscription: apicontractsv1.ARBSubscriptionType = (
132
- apicontractsv1.ARBSubscriptionType()
133
- )
134
-
135
- if name:
136
- subscription.name = name
137
- if amount:
138
- subscription.amount = amount
139
- if any([profile_id, payment_id, address_id]):
140
- profile = apicontractsv1.customerProfileIdType()
141
- if profile_id:
142
- profile.customerProfileId = profile_id
143
- if payment_id:
144
- profile.customerPaymentProfileId = payment_id
145
- if address_id:
146
- profile.customerAddressId = address_id
147
-
148
103
  self._authorizenet_update_subscription(subscription)
149
104
 
150
105
  @property
@@ -155,14 +110,19 @@ class SubscriptionProfile(ControllerExecutionMixin):
155
110
  @property
156
111
  def status(self) -> str | None:
157
112
  """Current status of the subscription."""
158
- response: dict | None = self._authorizenet_get_subscription_status()
159
- return (
160
- str(response.status) if response and response.status is not None else None
161
- )
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
162
119
 
163
120
  @property
164
121
  def transactions(self) -> list | None:
165
122
  """Transactions for the subscription."""
123
+ if not self.id:
124
+ return
125
+
166
126
  response = self._authorizenet_get_subscription(include_transactions=True)
167
127
  if response is not None and "arbTransactions" in response.getchildren():
168
128
  return [t for t in response.arbTransactions]
@@ -172,16 +132,20 @@ class SubscriptionProfile(ControllerExecutionMixin):
172
132
  """Customer payment profile id for the subscription."""
173
133
  if not self.id:
174
134
  return
135
+
175
136
  response = self._authorizenet_get_subscription()
176
- return int(response.profile.paymentProfile.customerPaymentProfileId)
137
+ if response is not None and "profile" in response.getchildren():
138
+ return int(response.profile.paymentProfile.customerPaymentProfileId)
177
139
 
178
140
  @property
179
141
  def address_id(self) -> int | None:
180
142
  """Customer address profile id for the subscription."""
181
143
  if not self.id:
182
144
  return
145
+
183
146
  response = self._authorizenet_get_subscription()
184
- return int(response.profile.shippingProfile.customerAddressId)
147
+ if response is not None and "profile" in response.getchildren():
148
+ return int(response.profile.shippingProfile.customerAddressId)
185
149
 
186
150
  def _authorizenet_create_subscription(
187
151
  self, subscription: apicontractsv1.ARBSubscriptionType