Skip to content

# Profiles

class terminusgps.authorizenet.profiles.base.AuthorizenetProfileBase(merchant_id: int | str, id: int | str | None = None, *args, **kwargs)

  Public Data Attributes:

  `merchantCustomerId` | An internally designated customer id.
  `id` | An Authorizenet generated id.
  `merchantAuthentication` | Merchant authentication for Authorizenet API calls.

  Public Methods:

  `__init__`(merchant_id[, id]) |
  `__str__`() | Return str(self).
  `create`(*args, **kwargs) |
  `update`(*args, **kwargs) |
  `delete`(*args, **kwargs) |

  Inherited from `ControllerExecutionMixin`

  `execute_controller`(controller) | Executes an Authorizenet controller and returns its response.

  property id: str

    An Authorizenet generated id.

  property merchantAuthentication: merchantAuthenticationType

    Merchant authentication for Authorizenet API calls.

  property merchantCustomerId: str

    An internally designated customer id.

class terminusgps.authorizenet.profiles.base.AuthorizenetSubProfileBase(customer_profile_id: int | str, default: bool, *args, **kwargs)

  Public Data Attributes:

  `validationMode` | The validation mode for Authorizenet API calls.
  `default` | Whether or not the sub profile is set as default in Authorizenet.
  `customerProfileId` | An Authorizenet generated customer profile id.

  Inherited from `AuthorizenetProfileBase`

  `merchantCustomerId` | An internally designated customer id.
  `id` | An Authorizenet generated id.
  `merchantAuthentication` | Merchant authentication for Authorizenet API calls.

  Public Methods:

  `__init__`(customer_profile_id, default, ...) |

  Inherited from `AuthorizenetProfileBase`

  `__init__`(merchant_id[, id]) |
  `__str__`() | Return str(self).
  `create`(*args, **kwargs) |
  `update`(*args, **kwargs) |
  `delete`(*args, **kwargs) |

  Inherited from `ControllerExecutionMixin`

  `execute_controller`(controller) | Executes an Authorizenet controller and returns its response.

  property customerProfileId: str

    An Authorizenet generated customer profile id.

  property default: str

    Whether or not the sub profile is set as default in Authorizenet.

  property validationMode: str

    The validation mode for Authorizenet API calls.

class terminusgps.authorizenet.profiles.addresses.AddressProfile(customer_profile_id: int | str, default: bool, *args, **kwargs)

  An Authorizenet customer address profile.

  Public Data Attributes:

  Inherited from `AuthorizenetSubProfileBase`

  `validationMode` | The validation mode for Authorizenet API calls.
  `default` | Whether or not the sub profile is set as default in Authorizenet.
  `customerProfileId` | An Authorizenet generated customer profile id.

  Inherited from `AuthorizenetProfileBase`

  `merchantCustomerId` | An internally designated customer id.
  `id` | An Authorizenet generated id.
  `merchantAuthentication` | Merchant authentication for Authorizenet API calls.

  Public Methods:

  `create`(address) | Creates an Authorizenet address profile.
  `update`(address) | Updates the Authorizenet address profile.
  `delete`() | Deletes the Authorizenet address profile.
  `get_details`() | Gets details for the Authorizenet address profile.

  Inherited from `AuthorizenetSubProfileBase`

  `__init__`(customer_profile_id, default, ...) |

  Inherited from `AuthorizenetProfileBase`

  `__init__`(merchant_id[, id]) |
  `__str__`() | Return str(self).
  `create`(*args, **kwargs) |
  `update`(*args, **kwargs) |
  `delete`(*args, **kwargs) |

  Inherited from `ControllerExecutionMixin`

  `execute_controller`(controller) | Executes an Authorizenet controller and returns its response.

  Private Methods:

  `_authorizenet_get_shipping_address`() | Executes a `getCustomerShippingAddressRequest` using the Authorizenet API.
  `_authorizenet_create_shipping_address`(address) | Executes a `createCustomerShippingAddressRequest` using the Authorizenet API.
  `_authorizenet_update_shipping_address`(address) | Executes a `updateCustomerShippingAddressRequest` using the Authorizenet API.
  `_authorizenet_delete_shipping_address`() | Executes a `deleteCustomerShippingAddressRequest` using the Authorizenet API.

  _authorizenet_create_shipping_address(address: customerAddressType) → dict | None

    Executes a `createCustomerShippingAddressRequest` using the Authorizenet API.

    createCustomerShippingAddressRequest

    Raises:

      - AssertionError – If `id` wasn’t set.

      - ControllerExecutionError – If something goes wrong during an Authorizenet API call.

    Returns:

      An Authorizenet API response, if any.

    Return type:

      `dict` | `None`

  _authorizenet_delete_shipping_address() → dict | None

    Executes a `deleteCustomerShippingAddressRequest` using the Authorizenet API.

    deleteCustomerShippingAddressRequest

    Raises:

      - AssertionError – If `id` wasn’t set.

      - ControllerExecutionError – If something goes wrong during an Authorizenet API call.

    Returns:

      An Authorizenet API response, if any.

    Return type:

      `dict` | `None`

  _authorizenet_get_shipping_address() → dict | None

    Executes a `getCustomerShippingAddressRequest` using the Authorizenet API.

    getCustomerShippingAddressRequest

    Raises:

      - AssertionError – If `id` wasn’t set.

      - ControllerExecutionError – If something goes wrong during an Authorizenet API call.

    Returns:

      An Authorizenet API response, if any.

    Return type:

      `dict` | `None`

  _authorizenet_update_shipping_address(address: customerAddressType) → dict | None

    Executes a `updateCustomerShippingAddressRequest` using the Authorizenet API.

    updateCustomerShippingAddressRequest

    Raises:

      - AssertionError – If `id` wasn’t set.

      - ControllerExecutionError – If something goes wrong during an Authorizenet API call.

    Returns:

      An Authorizenet API response, if any.

    Return type:

      `dict` | `None`

  create(address: customerAddressType) → int

    Creates an Authorizenet address profile.

    Parameters:

      address (`customerAddressType`) – A customer address.

    Raises:

      - ControllerExecutionError – If something goes wrong during an Authorizenet API call.

      - ValueError – If the Authorizenet API response was not retrieved.

    Returns:

      A new address profile id.

    Return type:

      `int`

  delete() → dict | None

    Deletes the Authorizenet address profile.

    Raises:

      ControllerExecutionError – If something goes wrong during an Authorizenet API call.

    Returns:

      An Authorizenet API response, if any.

    Return type:

      `dict` | `None`

  get_details() → dict | None

    Gets details for the Authorizenet address profile.

    Returns:

      An Authorizenet API response, if any.

    Return type:

      `dict` | `None`

  update(address: customerAddressType) → dict | None

    Updates the Authorizenet address profile.

    Parameters:

      address (`customerAddressType`) – A customer shipping address.

    Raises:

      ControllerExecutionError – If something goes wrong during an Authorizenet API call.

    Returns:

      An Authorizenet API response, if any.

    Return type:

      `dict` | `None`

class terminusgps.authorizenet.profiles.customers.CustomerProfile(merchant_id: int | str, id: int | str | None = None, *args, **kwargs)

  An Authorizenet customer profile.

  Public Data Attributes:

  `payment_profile_ids` | A list of the customer's payment profile ids, if any.
  `address_profile_ids` | A list of the customer's address profile ids, if any.
  `exists` | Whether or not the customer profile exists in Authorizenet.

  Inherited from `AuthorizenetProfileBase`

  `merchantCustomerId` | An internally designated customer id.
  `id` | An Authorizenet generated id.
  `merchantAuthentication` | Merchant authentication for Authorizenet API calls.

  Public Methods:

  `create`(email[, desc]) | Creates a customer profile and returns its id.
  `update`(email[, desc]) | Updates the customer profile.
  `delete`() | Deletes the customer profile.

  Inherited from `AuthorizenetProfileBase`

  `__init__`(merchant_id[, id]) |
  `__str__`() | Return str(self).
  `create`(*args, **kwargs) |
  `update`(*args, **kwargs) |
  `delete`(*args, **kwargs) |

  Inherited from `ControllerExecutionMixin`

  `execute_controller`(controller) | Executes an Authorizenet controller and returns its response.

  Private Methods:

  `_authorizenet_get_customer_profile_ids`() | Executes a `getCustomerProfileIdsRequest` using the Authorizenet API.
  `_authorizenet_create_customer_profile`(email) | Executes a `createCustomerProfileRequest` using the Authorizenet API.
  `_authorizenet_get_customer_profile`([issuer_info]) | Executes a `getCustomerProfileRequest` using the Authorizenet API.
  `_authorizenet_update_customer_profile`(email) | Executes an `updateCustomerProfileRequest` using the Authorizenet API.
  `_authorizenet_delete_customer_profile`() | Executes a `deleteCustomerProfileRequest` using the Authorizenet API.

  _authorizenet_create_customer_profile(email: str, desc: str = '') → dict | None

    Executes a `createCustomerProfileRequest` using the Authorizenet API.

    createCustomerProfileRequest

    Parameters:

      - email (`str`) – An email address.

      - desc (`str`) – An optional description.

    Raises:

      ControllerExecutionError – If something goes wrong during an Authorizenet API call.

    Returns:

      An Authorizenet API response, if any.

    Return type:

      `dict` | `None`

  _authorizenet_delete_customer_profile() → dict | None

    Executes a `deleteCustomerProfileRequest` using the Authorizenet API.

    deleteCustomerProfileRequest

    Raises:

      - AssertionError – If `id` wasn’t set.

      - ControllerExecutionError – If something goes wrong during an Authorizenet API call.

    Returns:

      An Authorizenet API response, if any.

    Return type:

      `dict` | `None`

  _authorizenet_get_customer_profile(issuer_info: bool = True) → dict | None

    Executes a `getCustomerProfileRequest` using the Authorizenet API.

    getCustomerProfileRequest

    Parameters:

      issuer_info (`bool`) – Whether or not to include issuer info in the response.

    Raises:

      - AssertionError – If `id` was not set.

      - ControllerExecutionError – If something goes wrong during an Authorizenet API call.

    Returns:

      An Authorizenet API response, if any.

    Return type:

      `dict` | `None`

  _authorizenet_get_customer_profile_ids() → dict | None

    Executes a `getCustomerProfileIdsRequest` using the Authorizenet API.

    getCustomerProfileIdsRequest

    Raises:

      ControllerExecutionError – If something goes wrong during an Authorizenet API call.

    Returns:

      An Authorizenet API response, if any.

    Return type:

      `dict` | `None`

  _authorizenet_update_customer_profile(email: str, desc: str = '') → dict | None

    Executes an `updateCustomerProfileRequest` using the Authorizenet API.

    updateCustomerProfileRequest

    Parameters:

      - email (`str`) – An email address.

      - desc (`str`) – An optional description.

    Raises:

      - ControllerExecutionError – If something goes wrong during an Authorizenet API call.

      - AssertionError – If `id` wasn’t set.

    Returns:

      An Authorizenet API response, if any.

    Return type:

      `dict` | `None`

  property address_profile_ids: list[int]

    A list of the customer’s address profile ids, if any.

  create(email: str, desc: str = '') → int

    Creates a customer profile and returns its id.

    Parameters:

      - email (`str`) – An email address.

      - desc (`str`) – An optional description.

    Raises:

      - ControllerExecutionError – If something goes wrong during an Authorizenet API call.

      - ValueError – If the Authorizenet API response was not retrieved.

    Returns:

      The new customer profile id.

    Return type:

      `int`

  delete() → None

    Deletes the customer profile.

    Raises:

      ControllerExecutionError – If something goes wrong during an Authorizenet API call.

    Returns:

      Nothing.

    Return type:

      `None`

  property exists: bool

    Whether or not the customer profile exists in Authorizenet.

  property payment_profile_ids: list[int]

    A list of the customer’s payment profile ids, if any.

  update(email: str, desc: str = '') → None

    Updates the customer profile.

    Parameters:

      - email (`str`) – An email address.

      - desc (`str`) – An optional description.

    Raises:

      ControllerExecutionError – If something goes wrong during an Authorizenet API call.

    Returns:

      Nothing.

    Return type:

      `None`

class terminusgps.authorizenet.profiles.payments.PaymentProfile(customer_profile_id: int | str, default: bool, *args, **kwargs)

  An Authorizenet customer payment profile.

  Public Data Attributes:

  `last_4` |

  Inherited from `AuthorizenetSubProfileBase`

  `validationMode` | The validation mode for Authorizenet API calls.
  `default` | Whether or not the sub profile is set as default in Authorizenet.
  `customerProfileId` | An Authorizenet generated customer profile id.

  Inherited from `AuthorizenetProfileBase`

  `merchantCustomerId` | An internally designated customer id.
  `id` | An Authorizenet generated id.
  `merchantAuthentication` | Merchant authentication for Authorizenet API calls.

  Public Methods:

  `create`(address, payment) | Creates an Authorizenet payment profile and returns its id.
  `update`(address, payment) | Updates the Authorizenet payment profile.
  `delete`() | Deletes the Authorizenet payment profile.
  `get_details`([issuer_info]) |

  Inherited from `AuthorizenetSubProfileBase`

  `__init__`(customer_profile_id, default, ...) |

  Inherited from `AuthorizenetProfileBase`

  `__init__`(merchant_id[, id]) |
  `__str__`() | Return str(self).
  `create`(*args, **kwargs) |
  `update`(*args, **kwargs) |
  `delete`(*args, **kwargs) |

  Inherited from `ControllerExecutionMixin`

  `execute_controller`(controller) | Executes an Authorizenet controller and returns its response.

  Private Methods:

  `_authorizenet_get_transaction_list_for_customer`([...]) | Executes a `getTransactionListForCustomerRequest` using the Authorizenet API.
  `_authorizenet_create_payment_profile`(...) | Executes a `createCustomerPaymentProfileRequest` using the Authorizenet API.
  `_authorizenet_get_payment_profile`([issuer_info]) | Executes a `getCustomerPaymentProfileRequest` using the Authorizenet API.
  `_authorizenet_update_payment_profile`(...) | Executes a `updateCustomerPaymentProfileRequest` using the Authorizenet API.
  `_authorizenet_validate_payment_profile`() | Executes a `validateCustomerPaymentProfileRequest` using the Authorizenet API.
  `_authorizenet_delete_payment_profile`() | Executes a `deleteCustomerPaymentProfileRequest` using the Authorizenet API.

  _authorizenet_create_payment_profile(address: customerAddressType, payment: paymentType) → dict | None

    Executes a `createCustomerPaymentProfileRequest` using the Authorizenet API.

    createCustomerPaymentProfileRequest

    Parameters:

      - address (`customerAddressType`) – A billing address.

      - payment (`paymentType`) – A payment method.

    Raises:

      ControllerExecutionError – If something goes wrong during an Authorizenet API call.

    Returns:

      An Authorizenet API response, if any.

    Return type:

      `dict` | `None`

  _authorizenet_delete_payment_profile() → dict | None

    Executes a `deleteCustomerPaymentProfileRequest` using the Authorizenet API.

    deleteCustomerPaymentProfileRequest

    Raises:

      - AssertionError – If `id` wasn’t set.

      - ControllerExecutionError – If something goes wrong during an Authorizenet API call.

    Returns:

      An Authorizenet API response, if any.

    Return type:

      `dict` | `None`

  _authorizenet_get_payment_profile(issuer_info: bool = False) → dict | None

    Executes a `getCustomerPaymentProfileRequest` using the Authorizenet API.

    getCustomerPaymentProfileRequest

    Parameters:

      issuer_info (`bool`) – Whether or not to include issuer information in the response.

    Raises:

      - AssertionError – If `id` wasn’t set.

      - ControllerExecutionError – If something goes wrong during an Authorizenet API call.

    Returns:

      An Authorizenet API response, if any.

    Return type:

      `dict` | `None`

  _authorizenet_get_transaction_list_for_customer(limit: int = 100, ordering: str = 'submitTimeUTC', offset: int = 1, descending: bool = False) → dict | None

    Executes a `getTransactionListForCustomerRequest` using the Authorizenet API.

    getTransactionListForCustomerRequest

    Parameters:

      - limit (`int`) – Total number of transactions to retrieve. Default is `100`.

      - ordering (`str`) – A field to order the transactions by. Default is `"submitTimeUTC"`.

      - offset (`customerAddressType`) – Page of the response to retrieve.

      - descending (`bool`) – Sort the results in descending order.

    Raises:

      - ValueError – If `ordering` is invalid.

      - AssertionError – If `id` wasn’t set.

      - ControllerExecutionError – If something goes wrong during an Authorizenet API call.

    Returns:

      An Authorizenet API response, if any.

    Return type:

      `dict` | `None`

  _authorizenet_update_payment_profile(address: customerAddressType, payment: paymentType) → dict | None

    Executes a `updateCustomerPaymentProfileRequest` using the Authorizenet API.

    updateCustomerPaymentProfileRequest

    Parameters:

      - address (`customerAddressType`) – A customer address.

      - payment (`paymentType`) – A payment method.

    Raises:

      - AssertionError – If `id` wasn’t set.

      - ControllerExecutionError – If something goes wrong during an Authorizenet API call.

    Returns:

      An Authorizenet API response, if any.

    Return type:

      `dict` | `None`

  _authorizenet_validate_payment_profile() → dict | None

    Executes a `validateCustomerPaymentProfileRequest` using the Authorizenet API.

    validateCustomerPaymentProfileRequest

    Raises:

      - AssertionError – If `id` wasn’t set.

      - ControllerExecutionError – If something goes wrong during an Authorizenet API call.

    Returns:

      An Authorizenet API response, if any.

    Return type:

      `dict` | `None`

  create(address: customerAddressType, payment: paymentType) → int

    Creates an Authorizenet payment profile and returns its id.

    Parameters:

      - address (`customerAddressType`) – A billing address.

      - payment (`paymentType`) – A payment object.

    Raises:

      - ControllerExecutionError – If something goes wrong during an Authorizenet API call.

      - ValueError – If the Authorizenet API response was not retrieved.

    Returns:

      The new payment profile’s id.

    Return type:

      `int`

  delete() → dict | None

    Deletes the Authorizenet payment profile.

    Raises:

      ControllerExecutionError – If something goes wrong during an Authorizenet API call.

    Returns:

      An Authorizenet API response, if any.

    Return type:

      `dict` | `None`

  update(address: customerAddressType, payment: paymentType) → dict | None

    Updates the Authorizenet payment profile.

    Parameters:

      - address (`customerAddressType`) – A billing address.

      - payment (`paymentType`) – A payment method.

    Raises:

      ControllerExecutionError – If something goes wrong during an Authorizenet API call.

    Returns:

      An Authorizenet API reponse, if any.

    Return type:

      `dict` | `None`

class terminusgps.authorizenet.profiles.subscriptions.SubscriptionProfile(id: str | int | None = None, *args, **kwargs)

  An Authorizenet subscription profile.

  Public Data Attributes:

  `merchantAuthentication` | Merchant authentication for API calls.
  `status` | Current status of the subscription.
  `transactions` | Transactions for the subscription.

  Public Methods:

  `__init__`([id]) |
  `create`(name, amount, schedule, profile_id, ...) | Creates a subscription in Authorizenet.
  `cancel`() | Cancels the subscription.
  `update`(name, amount, schedule, profile_id, ...) | Updates a subscription in Authorizenet.

  Inherited from `ControllerExecutionMixin`

  `execute_controller`(controller) | Executes an Authorizenet controller and returns its response.

  Private Methods:

  `_authorizenet_create_subscription`(subscription) | Executes a `ARBCreateSubscriptionRequest` using the Authorizenet API.
  `_authorizenet_get_subscription`([...]) | Executes a `ARBGetSubscriptionRequest` using the Authorizenet API.
  `_authorizenet_get_subscription_status`() | Executes a `ARBGetSubscriptionStatusRequest` using the Authorizenet API.
  `_authorizenet_update_subscription`(subscription) | Executes a `ARBUpdateSubscriptionRequest` using the Authorizenet API.
  `_authorizenet_cancel_subscription`() | Executes a `ARBCancelSubscriptionRequest` using the Authorizenet API.

  _authorizenet_cancel_subscription() → dict | None

    Executes a `ARBCancelSubscriptionRequest` using the Authorizenet API.

    ARBCancelSubscriptionRequest

    Raises:

      - AssertionError – If `id` wasn’t set.

      - ControllerExecutionError – If something goes wrong during an Authorizenet API call.

    Returns:

      An Authorizenet API response, if any.

    Return type:

      `dict` | `None`

  _authorizenet_create_subscription(subscription: ARBSubscriptionType) → dict | None

    Executes a `ARBCreateSubscriptionRequest` using the Authorizenet API.

    ARBCreateSubscriptionRequest

    Raises:

      - AssertionError – If `id` wasn’t set.

      - ControllerExecutionError – If something goes wrong during an Authorizenet API call.

    Returns:

      An Authorizenet API response, if any.

    Return type:

      `dict` | `None`

  _authorizenet_get_subscription(include_transactions: bool = False) → dict | None

    Executes a `ARBGetSubscriptionRequest` using the Authorizenet API.

    ARBGetSubscriptionRequest

    Raises:

      - AssertionError – If `id` wasn’t set.

      - ControllerExecutionError – If something goes wrong during an Authorizenet API call.

    Returns:

      An Authorizenet API response, if any.

    Return type:

      `dict` | `None`

  _authorizenet_get_subscription_status() → dict | None

    Executes a `ARBGetSubscriptionStatusRequest` using the Authorizenet API.

    ARBGetSubscriptionStatusRequest

    Raises:

      - AssertionError – If `id` wasn’t set.

      - ControllerExecutionError – If something goes wrong during an Authorizenet API call.

    Returns:

      An Authorizenet API response, if any.

    Return type:

      `dict` | `None`

  _authorizenet_update_subscription(subscription: ARBSubscriptionType) → dict | None

    Executes a `ARBUpdateSubscriptionRequest` using the Authorizenet API.

    ARBUpdateSubscriptionRequest

    Raises:

      - AssertionError – If `id` wasn’t set.

      - ControllerExecutionError – If something goes wrong during an Authorizenet API call.

    Returns:

      An Authorizenet API response, if any.

    Return type:

      `dict` | `None`

  cancel() → None

    Cancels the subscription.

    Raises:

      - AssertionError – If `id` wasn’t set.

      - ControllerExecutionError – If something goes wrong during an Authorizenet API call.

    Returns:

      Nothing.

    Return type:

      `None`

  create(name: str, amount: Decimal, schedule: paymentScheduleType, profile_id: int | str, payment_id: int | str, address_id: int | str, trial_amount: Decimal = Decimal('0')) → int

    Creates a subscription in Authorizenet.

    Parameters:

      - name (`str`) – A name for the subscription.

      - amount (`paymentScheduleType`) – An amount of money paid per occurrence of the subscription.

      - schedule – A payment schedule for the subscription.

      - profile_id (`int` | `str`) – An Authorizenet customer profile id.

      - payment_id (`int` | `str`) – An Authorizenet customer payment profile id.

      - address_id (`int` | `str`) – An Authorizenet customer address profile id.

      - trial_amount (`Decimal`) – Trial amount for the subscription. Default is `0.00`.

    Raises:

      - ControllerExecutionError – If something goes wrong during an Authorizenet API call.

      - ValueError – If `profile_id` wasn’t a digit.

      - ValueError – If `payment_id` wasn’t a digit.

      - ValueError – If `address_id` wasn’t a digit.

      - ValueError – If the Authorizenet API response was not retrieved.

    Returns:

      An Authorizenet subscription id.

    Return type:

      `int`

  property merchantAuthentication: merchantAuthenticationType

    Merchant authentication for API calls.

  property status: str | None

    Current status of the subscription.

  property transactions: list | None

    Transactions for the subscription.

  update(name: str, amount: Decimal, schedule: paymentScheduleType, profile_id: int | str, payment_id: int | str, address_id: int | str, trial_amount: Decimal = Decimal('0')) → None

    Updates a subscription in Authorizenet.

    Parameters:

      - name (`str`) – A name for the subscription.

      - amount (`paymentScheduleType`) – An amount of money paid per occurrence of the subscription.

      - schedule – A payment schedule for the subscription.

      - profile_id (`int` | `str`) – An Authorizenet customer profile id.

      - payment_id (`int` | `str`) – An Authorizenet customer payment profile id.

      - address_id (`int` | `str`) – An Authorizenet customer address profile id.

      - trial_amount (`Decimal`) – Trial amount for the subscription. Default is `0.00`.

    Raises:

      - ControllerExecutionError – If something goes wrong during an Authorizenet API call.

      - ValueError – If `profile_id` wasn’t a digit.

      - ValueError – If `payment_id` wasn’t a digit.

      - ValueError – If `address_id` wasn’t a digit.

      - ValueError – If the Authorizenet API response was not retrieved.

    Returns:

      An Authorizenet subscription id.

    Return type:

      `int`