Utilities
- terminusgps.authorizenet.utils.calculate_amount_plus_tax(amount: Decimal, tax_rate: Decimal | None = None) → Decimal[source]
Returns the amount + tax. Uses
DEFAULT_TAX_RATEiftax_ratewasn’t provided.
- terminusgps.authorizenet.utils.generate_customer_address(form: Form) → customerAddressType[source]
Takes a form and returns a
customerAddressType.Required form fields:
name
type
addresscustomerAddressTypefirst_namelast_name- Parameters:
form (
Form) – A Django form.- Raises:
ValueError – If
addresswasn’t in the form.ValueError – If
first_namewasn’t in the form.ValueError – If
last_namewasn’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_cardcreditCardType- Parameters:
form (
Form) – A Django form.- Raises:
ValueError – If
credit_cardwasn’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_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
idwas provided as a string containing non-digits.AuthorizenetControllerExecutionError – If the API call fails.
- Returns:
A transaction object, if found.
- Return type: