python-terminusgps 45.7.0__py3-none-any.whl → 45.8.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.
Potentially problematic release.
This version of python-terminusgps might be problematic. Click here for more details.
- {python_terminusgps-45.7.0.dist-info → python_terminusgps-45.8.0.dist-info}/METADATA +1 -1
- {python_terminusgps-45.7.0.dist-info → python_terminusgps-45.8.0.dist-info}/RECORD +6 -6
- terminusgps/authorizenet/api/transactions.py +142 -41
- terminusgps/authorizenet/constants.py +15 -0
- {python_terminusgps-45.7.0.dist-info → python_terminusgps-45.8.0.dist-info}/WHEEL +0 -0
- {python_terminusgps-45.7.0.dist-info → python_terminusgps-45.8.0.dist-info}/licenses/COPYING +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: python-terminusgps
|
|
3
|
-
Version: 45.
|
|
3
|
+
Version: 45.8.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
|
|
@@ -3,14 +3,14 @@ terminusgps/default_settings.py,sha256=7GLW3RlkuTbpj82KSWjcbgf-unEmrPvKCyLci14LG
|
|
|
3
3
|
terminusgps/mixins.py,sha256=Q9ZJuzpk3d9lDnlVA8ZTVvnZWxB13p08EQ8yVJcztn4,1034
|
|
4
4
|
terminusgps/validators.py,sha256=Mf0c7ku_wTQ7uv4hcLRyz0r2eRjvznIL77LLTE5uJ6E,9152
|
|
5
5
|
terminusgps/authorizenet/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
6
|
-
terminusgps/authorizenet/constants.py,sha256
|
|
6
|
+
terminusgps/authorizenet/constants.py,sha256=Bat87PXB-g5_FM0pkAwX2dTHLJ05UAf_xLery4eKmr0,2723
|
|
7
7
|
terminusgps/authorizenet/service.py,sha256=MKtudM2vwmBytCneZsQ9PDAX-RO4Ma2sPL6ZwEcHDms,4198
|
|
8
8
|
terminusgps/authorizenet/api/__init__.py,sha256=VXR4Yco1yz5R-R7vgaH2zTP9VFqzfvvGy_XJVjyb3i0,154
|
|
9
9
|
terminusgps/authorizenet/api/address_profiles.py,sha256=VouUN6dIxlnuE3qEiacFqqDBi_VtwvSbsELqTqFZ0BE,4746
|
|
10
10
|
terminusgps/authorizenet/api/customer_profiles.py,sha256=oya9KMRE10nKLjECTIdanfV_P8-gnNZLE0sYmRYVkgM,4505
|
|
11
11
|
terminusgps/authorizenet/api/payment_profiles.py,sha256=s-telQZXdq6bu5TxWVYv5xBNHWq81ve_hQVrRlqoBb0,8089
|
|
12
12
|
terminusgps/authorizenet/api/subscriptions.py,sha256=VAXKjOHLOfifrixObK6XbiJCmPobkYBzXJQrjtos9LE,4542
|
|
13
|
-
terminusgps/authorizenet/api/transactions.py,sha256=
|
|
13
|
+
terminusgps/authorizenet/api/transactions.py,sha256=zwbUXGxI1wkTXSPG4L4O5Y2fdNgxOrNaak1jwcC9PeM,8531
|
|
14
14
|
terminusgps/wialon/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
15
15
|
terminusgps/wialon/constants.py,sha256=p2BhopeE6lXzjzdzb4ZKOz0rhJQIMUbXLrBy1Yzf57s,13730
|
|
16
16
|
terminusgps/wialon/flags.py,sha256=M50EdhxQ8IMnJnU0mrHK7-h8Asc6tvNiTOOfd1dBW6A,12815
|
|
@@ -27,7 +27,7 @@ terminusgps/wialon/items/route.py,sha256=9hmRBEFRJF3lKukv_y3blZxqxv75YgFCcRALrU6
|
|
|
27
27
|
terminusgps/wialon/items/unit.py,sha256=B5iuGEghu89SL8KzYLUytYNRa8cogsVtf-bJ_RybPTA,5522
|
|
28
28
|
terminusgps/wialon/items/unit_group.py,sha256=MIR0x5IlTjcnwx8Y9wXLNTql-wwVVj7NCe7dL2vOw4c,2131
|
|
29
29
|
terminusgps/wialon/items/user.py,sha256=CRSICiJ-qzybEO_gXuKyzW5oa2RQeIp0SzX9ARcdME4,5151
|
|
30
|
-
python_terminusgps-45.
|
|
31
|
-
python_terminusgps-45.
|
|
32
|
-
python_terminusgps-45.
|
|
33
|
-
python_terminusgps-45.
|
|
30
|
+
python_terminusgps-45.8.0.dist-info/METADATA,sha256=9UdnSnFWPz1De4j4nqUlyiRrA-MPsb2Yvoj9J8WDZGs,938
|
|
31
|
+
python_terminusgps-45.8.0.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
|
|
32
|
+
python_terminusgps-45.8.0.dist-info/licenses/COPYING,sha256=OXLcl0T2SZ8Pmy2_dmlvKuetivmyPd5m1q-Gyd-zaYY,35149
|
|
33
|
+
python_terminusgps-45.8.0.dist-info/RECORD,,
|
|
@@ -4,36 +4,35 @@ from authorizenet import apicontractsv1, apicontrollers
|
|
|
4
4
|
from authorizenet.apicontrollersbase import APIOperationBase
|
|
5
5
|
from lxml.objectify import ObjectifiedElement
|
|
6
6
|
|
|
7
|
-
__all__ = [
|
|
7
|
+
__all__ = [
|
|
8
|
+
"charge_credit_card",
|
|
9
|
+
"authorize_credit_card",
|
|
10
|
+
"capture_authorized_amount",
|
|
11
|
+
"refund_credit_card",
|
|
12
|
+
]
|
|
8
13
|
|
|
9
14
|
|
|
10
|
-
def
|
|
11
|
-
|
|
12
|
-
amount: Decimal,
|
|
13
|
-
payment: apicontractsv1.paymentType | None = None,
|
|
14
|
-
order: apicontractsv1.orderType | None = None,
|
|
15
|
-
address: apicontractsv1.customerAddressType | None = None,
|
|
16
|
-
customer_data: apicontractsv1.customerDataType | None = None,
|
|
17
|
-
settings: apicontractsv1.settingType | None = None,
|
|
18
|
-
line_items: apicontractsv1.ArrayOfLineItem | None = None,
|
|
15
|
+
def build_transaction(
|
|
16
|
+
amount: Decimal, **kwargs
|
|
19
17
|
) -> apicontractsv1.transactionRequestType:
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
if payment
|
|
25
|
-
|
|
26
|
-
if
|
|
27
|
-
|
|
28
|
-
if
|
|
29
|
-
|
|
30
|
-
if customer_data
|
|
31
|
-
|
|
32
|
-
if settings
|
|
33
|
-
|
|
34
|
-
if line_items
|
|
35
|
-
|
|
36
|
-
|
|
18
|
+
"""Returns a transaction element for a transaction request."""
|
|
19
|
+
transaction_request = apicontractsv1.transactionRequestType()
|
|
20
|
+
transaction_request.amount = amount
|
|
21
|
+
|
|
22
|
+
if payment := kwargs.get("payment"):
|
|
23
|
+
transaction_request.payment = payment
|
|
24
|
+
if address := kwargs.get("address"):
|
|
25
|
+
transaction_request.billTo = address
|
|
26
|
+
if order := kwargs.get("order"):
|
|
27
|
+
transaction_request.order = order
|
|
28
|
+
if customer_data := kwargs.get("customer_data"):
|
|
29
|
+
transaction_request.customerData = customer_data
|
|
30
|
+
if settings := kwargs.get("settings"):
|
|
31
|
+
transaction_request.transactionSettings = settings
|
|
32
|
+
if line_items := kwargs.get("line_items"):
|
|
33
|
+
transaction_request.lineItems = line_items
|
|
34
|
+
|
|
35
|
+
return transaction_request
|
|
37
36
|
|
|
38
37
|
|
|
39
38
|
def charge_credit_card(
|
|
@@ -42,17 +41,45 @@ def charge_credit_card(
|
|
|
42
41
|
address: apicontractsv1.customerAddressType,
|
|
43
42
|
order: apicontractsv1.orderType | None = None,
|
|
44
43
|
customer_data: apicontractsv1.customerDataType | None = None,
|
|
45
|
-
settings: apicontractsv1.
|
|
44
|
+
settings: apicontractsv1.ArrayOfSetting | None = None,
|
|
45
|
+
line_items: apicontractsv1.ArrayOfLineItem | None = None,
|
|
46
46
|
) -> tuple[ObjectifiedElement, type[APIOperationBase]]:
|
|
47
|
+
"""
|
|
48
|
+
`Charges a credit card <https://developer.authorize.net/api/reference/index.html#payment-transactions-charge-a-credit-card>`_.
|
|
49
|
+
|
|
50
|
+
:param amount: Dollar amount to charge.
|
|
51
|
+
:type amount: ~decimal.Decimal
|
|
52
|
+
:param credit_card: A credit card.
|
|
53
|
+
:type credit_card: ~authorizenet.apicontractsv1.creditCardType
|
|
54
|
+
:param address: A customer address.
|
|
55
|
+
:type address: ~authorizenet.apicontractsv1.customerAddressType
|
|
56
|
+
:param order: Order information. Default is :py:obj:`None`.
|
|
57
|
+
:type order: ~authorizenet.apicontractsv1.orderType | None
|
|
58
|
+
:param customer_data: Customer data. Default is :py:obj:`None`.
|
|
59
|
+
:type customer_data: ~authorizenet.apicontractsv1.customerDataType | None
|
|
60
|
+
:param settings: Transaction settings. Default is :py:obj:`None`.
|
|
61
|
+
:type settings: ~authorizenet.apicontractsv1.ArrayOfSetting | None
|
|
62
|
+
:param line_items: An array of line items. Default is :py:obj:`None`.
|
|
63
|
+
:type line_items: ~authorizenet.apicontractsv1.ArrayOfLineItem | None
|
|
64
|
+
:returns: A tuple containing an Authorizenet API request element and controller class.
|
|
65
|
+
:rtype: tuple[~lxml.objectify.ObjectifiedElement, type[~authorizenet.apicontrollersbase.APIOperationBase]]
|
|
66
|
+
|
|
67
|
+
"""
|
|
47
68
|
request = apicontractsv1.createTransactionRequest()
|
|
48
|
-
|
|
49
|
-
|
|
69
|
+
payment = apicontractsv1.paymentType()
|
|
70
|
+
payment.creditCard = credit_card
|
|
71
|
+
request.transactionRequest = build_transaction(
|
|
50
72
|
amount=amount,
|
|
51
|
-
payment=
|
|
73
|
+
payment=payment,
|
|
52
74
|
address=address,
|
|
53
75
|
order=order,
|
|
54
76
|
customer_data=customer_data,
|
|
55
77
|
settings=settings,
|
|
78
|
+
line_items=line_items,
|
|
79
|
+
)
|
|
80
|
+
|
|
81
|
+
request.transactionRequest.transactionType = (
|
|
82
|
+
apicontractsv1.transactionTypeEnum.authCaptureTransaction
|
|
56
83
|
)
|
|
57
84
|
return request, apicontrollers.createTransactionController
|
|
58
85
|
|
|
@@ -63,17 +90,45 @@ def authorize_credit_card(
|
|
|
63
90
|
address: apicontractsv1.customerAddressType,
|
|
64
91
|
order: apicontractsv1.orderType | None = None,
|
|
65
92
|
customer_data: apicontractsv1.customerDataType | None = None,
|
|
66
|
-
settings: apicontractsv1.
|
|
93
|
+
settings: apicontractsv1.ArrayOfSetting | None = None,
|
|
94
|
+
line_items: apicontractsv1.ArrayOfLineItem | None = None,
|
|
67
95
|
) -> tuple[ObjectifiedElement, type[APIOperationBase]]:
|
|
96
|
+
"""
|
|
97
|
+
`Authorizes a credit card <https://developer.authorize.net/api/reference/index.html#payment-transactions-authorize-a-credit-card>`_.
|
|
98
|
+
|
|
99
|
+
:param amount: Dollar amount to authorize.
|
|
100
|
+
:type amount: ~decimal.Decimal
|
|
101
|
+
:param credit_card: A credit card.
|
|
102
|
+
:type credit_card: ~authorizenet.apicontractsv1.creditCardType
|
|
103
|
+
:param address: A customer address.
|
|
104
|
+
:type address: ~authorizenet.apicontractsv1.customerAddressType
|
|
105
|
+
:param order: Additional order information. Default is :py:obj:`None`.
|
|
106
|
+
:type order: ~authorizenet.apicontractsv1.orderType | None
|
|
107
|
+
:param customer_data: Additional customer data. Default is :py:obj:`None`.
|
|
108
|
+
:type customer_data: ~authorizenet.apicontractsv1.customerDataType | None
|
|
109
|
+
:param settings: Transaction settings. Default is :py:obj:`None`.
|
|
110
|
+
:type settings: ~authorizenet.apicontractsv1.ArrayOfSetting | None
|
|
111
|
+
:param line_items: An array of line items. Default is :py:obj:`None`.
|
|
112
|
+
:type line_items: ~authorizenet.apicontractsv1.ArrayOfLineItem | None
|
|
113
|
+
:returns: A tuple containing an Authorizenet API request element and controller class.
|
|
114
|
+
:rtype: tuple[~lxml.objectify.ObjectifiedElement, type[~authorizenet.apicontrollersbase.APIOperationBase]]
|
|
115
|
+
|
|
116
|
+
"""
|
|
68
117
|
request = apicontractsv1.createTransactionRequest()
|
|
69
|
-
|
|
70
|
-
|
|
118
|
+
payment = apicontractsv1.paymentType()
|
|
119
|
+
payment.creditCard = credit_card
|
|
120
|
+
request.transactionRequest = build_transaction(
|
|
71
121
|
amount=amount,
|
|
72
|
-
payment=
|
|
122
|
+
payment=payment,
|
|
73
123
|
address=address,
|
|
74
124
|
order=order,
|
|
75
125
|
customer_data=customer_data,
|
|
76
126
|
settings=settings,
|
|
127
|
+
line_items=line_items,
|
|
128
|
+
)
|
|
129
|
+
|
|
130
|
+
request.transactionRequest.transactionType = (
|
|
131
|
+
apicontractsv1.transactionTypeEnum.authOnlyTransaction
|
|
77
132
|
)
|
|
78
133
|
return request, apicontrollers.createTransactionController
|
|
79
134
|
|
|
@@ -81,9 +136,19 @@ def authorize_credit_card(
|
|
|
81
136
|
def capture_authorized_amount(
|
|
82
137
|
amount: Decimal,
|
|
83
138
|
) -> tuple[ObjectifiedElement, type[APIOperationBase]]:
|
|
139
|
+
"""
|
|
140
|
+
`Captures a previously authorized amount <https://developer.authorize.net/api/reference/index.html#payment-transactions-capture-a-previously-authorized-amount>`_.
|
|
141
|
+
|
|
142
|
+
:param amount: Dollar amount to capture.
|
|
143
|
+
:type amount: ~decimal.Decimal
|
|
144
|
+
:returns: A tuple containing an Authorizenet API request element and controller class.
|
|
145
|
+
:rtype: tuple[~lxml.objectify.ObjectifiedElement, type[~authorizenet.apicontrollersbase.APIOperationBase]]
|
|
146
|
+
|
|
147
|
+
"""
|
|
84
148
|
request = apicontractsv1.createTransactionRequest()
|
|
85
|
-
request.transactionRequest =
|
|
86
|
-
|
|
149
|
+
request.transactionRequest = build_transaction(amount)
|
|
150
|
+
request.transactionRequest.transactionType = (
|
|
151
|
+
apicontractsv1.transactionTypeEnum.priorAuthCaptureTransaction
|
|
87
152
|
)
|
|
88
153
|
return request, apicontrollers.createTransactionController
|
|
89
154
|
|
|
@@ -91,10 +156,46 @@ def capture_authorized_amount(
|
|
|
91
156
|
def refund_credit_card(
|
|
92
157
|
amount: Decimal, credit_card: apicontractsv1.creditCardType
|
|
93
158
|
) -> tuple[ObjectifiedElement, type[APIOperationBase]]:
|
|
159
|
+
"""
|
|
160
|
+
`Refunds a credit card <https://developer.authorize.net/api/reference/index.html#payment-transactions-refund-a-transaction>`_.
|
|
161
|
+
|
|
162
|
+
:param amount: Dollar amount to refund.
|
|
163
|
+
:type amount: ~decimal.Decimal
|
|
164
|
+
:param credit_card: Destination credit card.
|
|
165
|
+
:type credit_card: ~authorizenet.apicontractsv1.creditCardType
|
|
166
|
+
:returns: A tuple containing an Authorizenet API request element and controller class.
|
|
167
|
+
:rtype: tuple[~lxml.objectify.ObjectifiedElement, type[~authorizenet.apicontrollersbase.APIOperationBase]]
|
|
168
|
+
|
|
169
|
+
"""
|
|
94
170
|
request = apicontractsv1.createTransactionRequest()
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
payment=
|
|
171
|
+
payment = apicontractsv1.paymentType()
|
|
172
|
+
payment.creditCard = credit_card
|
|
173
|
+
request.transactionRequest = build_transaction(
|
|
174
|
+
amount=amount, payment=payment
|
|
175
|
+
)
|
|
176
|
+
|
|
177
|
+
request.transactionRequest.transactionType = (
|
|
178
|
+
apicontractsv1.transactionTypeEnum.refundTransaction
|
|
179
|
+
)
|
|
180
|
+
return request, apicontrollers.createTransactionController
|
|
181
|
+
|
|
182
|
+
|
|
183
|
+
def void_transaction(
|
|
184
|
+
reference_id: str,
|
|
185
|
+
) -> tuple[ObjectifiedElement, type[APIOperationBase]]:
|
|
186
|
+
"""
|
|
187
|
+
`Voids a transaction <https://developer.authorize.net/api/reference/index.html#payment-transactions-void-a-transaction>`_.
|
|
188
|
+
|
|
189
|
+
:param reference_id: Transaction reference id.
|
|
190
|
+
:type reference_id: str
|
|
191
|
+
:returns: A tuple containing an Authorizenet API request element and controller class.
|
|
192
|
+
:rtype: tuple[~lxml.objectify.ObjectifiedElement, type[~authorizenet.apicontrollersbase.APIOperationBase]]
|
|
193
|
+
|
|
194
|
+
"""
|
|
195
|
+
request = apicontractsv1.createTransactionRequest()
|
|
196
|
+
request.transactionRequest = apicontractsv1.transactionRequestType()
|
|
197
|
+
request.transactionRequest.refTransId = reference_id
|
|
198
|
+
request.transactionRequest.transactionType = (
|
|
199
|
+
apicontractsv1.transactionTypeEnum.voidTransaction
|
|
99
200
|
)
|
|
100
201
|
return request, apicontrollers.createTransactionController
|
|
@@ -4,6 +4,21 @@ from django.db import models
|
|
|
4
4
|
from django.utils.translation import gettext_lazy as _
|
|
5
5
|
|
|
6
6
|
|
|
7
|
+
class CreditCardType(models.TextChoices):
|
|
8
|
+
AMEX = apicontractsv1.cardTypeEnum.AmericanExpress, _("American Express")
|
|
9
|
+
"""American express card."""
|
|
10
|
+
DINERS = apicontractsv1.cardTypeEnum.DinersClub, _("Diners Club")
|
|
11
|
+
"""Diners club card."""
|
|
12
|
+
DISCOVER = apicontractsv1.cardTypeEnum.Discover, _("Discover")
|
|
13
|
+
"""Disover card."""
|
|
14
|
+
JCB = apicontractsv1.cardTypeEnum.JCB, _("JCB")
|
|
15
|
+
"""JCB card."""
|
|
16
|
+
MASTERCARD = apicontractsv1.cardTypeEnum.MasterCard, _("Mastercard")
|
|
17
|
+
"""Mastercard card."""
|
|
18
|
+
VISA = apicontractsv1.cardTypeEnum.Visa, _("Visa")
|
|
19
|
+
"""Visa card."""
|
|
20
|
+
|
|
21
|
+
|
|
7
22
|
class CurrencyCode(models.TextChoices):
|
|
8
23
|
USD = "USD", _("United States Dollar")
|
|
9
24
|
"""US dollar."""
|
|
File without changes
|
{python_terminusgps-45.7.0.dist-info → python_terminusgps-45.8.0.dist-info}/licenses/COPYING
RENAMED
|
File without changes
|