Utilities
- terminusgps.authorizenet.utils.calculate_amount_plus_tax(amount: Decimal, tax_rate: Decimal | None = None) → Decimal[source]
Returns the amount + tax. Uses
DEFAULT_TAX_RATE
iftax_rate
wasn’t provided.
- terminusgps.authorizenet.utils.generate_customer_address(form: Form) → customerAddressType[source]
Takes a form and returns a
customerAddressType
.Required form fields:
name
type
address
customerAddressType
first_name
last_name
- Parameters:
form (
Form
) – A Django form.- Raises:
ValueError – If
address
wasn’t in the form.ValueError – If
first_name
wasn’t in the form.ValueError – If
last_name
wasn’t in the form.
- Returns:
A customer address object.
- Return type:
customerAddressType
- terminusgps.authorizenet.utils.generate_customer_payment(form: Form) → paymentType[source]
Takes a form and returns a
paymentType
.Required form fields:
name
type
credit_card
creditCardType
- Parameters:
form (
Form
) – A Django form.- Raises:
ValueError – If
credit_card
wasn’t in the form.- Returns:
A payment object.
- Return type:
paymentType
- terminusgps.authorizenet.utils.get_customer_profile_ids() → list[int][source]
Returns a list of all customer profile ids in Authorizenet.
- Raises:
AuthorizenetControllerExecutionError – If the API call fails.
- Returns:
A list of all customer profile ids in Authorizenet.
- Return type:
- terminusgps.authorizenet.utils.get_days_between(start_date: date, end_date: date) → int[source]
Returns the total number of days between two dates.
- terminusgps.authorizenet.utils.get_merchant_details() → dict | None[source]
Returns Authorizenet merchant details.
- Raises:
AuthorizenetControllerExecutionError – If the API call fails.
- Returns:
A merchant details object, if found.
- Return type:
- terminusgps.authorizenet.utils.get_transaction(id: int | str) → dict | None[source]
Returns Authorizenet transaction details by id.
- Parameters:
- Raises:
ValueError – If
id
was provided as a string containing non-digits.AuthorizenetControllerExecutionError – If the API call fails.
- Returns:
A transaction object, if found.
- Return type: