Skip to content

# Profiles

## Base

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

  Base class for Authorizenet profiles.

  Public Data Attributes:

  `id` | An Authorizenet generated id.
  `merchantAuthentication` | A merchant authentication object to authenticate Authorizenet API calls.
  `validationMode` | The current Authorizenet API validation mode.

  Public Methods:

  `__init__`([id]) | Sets `id` if provided.
  `__str__`() | Returns a string representation of the profile, if `id` was set.

  Inherited from `AuthorizenetControllerExecutor`

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

  property id: str | None

    An Authorizenet generated id.

    Type:

      `str` | `None`

  property merchantAuthentication: merchantAuthenticationType

    A merchant authentication object to authenticate Authorizenet API calls.

    Returns:

      A merchant authentication object.

    Return type:

      `merchantAuthenticationType`

  property validationMode: str

    The current Authorizenet API validation mode.

    Returns:

      An Authorizenet API validation mode string.

    Return type:

      `str`

class terminusgps.authorizenet.profiles.base.AuthorizenetSubProfileBase(customer_profile_id: int | str, id: int | str | None = None, default: bool = False)

  Base class for Authorizenet ‘sub-profiles’, profiles that have an associated customer profile.

  Public Data Attributes:

  `customerProfileId` | A customer profile id.
  `default` | Whether or not the sub-profile is set as default.

  Inherited from `AuthorizenetProfileBase`

  `id` | An Authorizenet generated id.
  `merchantAuthentication` | A merchant authentication object to authenticate Authorizenet API calls.
  `validationMode` | The current Authorizenet API validation mode.

  Public Methods:

  `__init__`(customer_profile_id[, id, default]) | Sets `customerProfileId` for the sub-profile.

  Inherited from `AuthorizenetProfileBase`

  `__init__`([id]) | Sets `id` if provided.
  `__str__`() | Returns a string representation of the profile, if `id` was set.

  Inherited from `AuthorizenetControllerExecutor`

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

  property customerProfileId: str

    A customer profile id.

    Type:

      `str`

  property default: str

    Whether or not the sub-profile is set as default.

    Type:

      `str`

## Customer

class terminusgps.authorizenet.profiles.customers.CustomerProfile(id: int | str | None = None, merchant_id: int | str | None = None, email: str | None = None, desc: str | None = None)

  An Authorizenet customer profile.

  Public Data Attributes:

  `validationMode` | The current Authorizenet validation mode.
  `merchantCustomerId` | A merchant designated customer id.
  `email` | A customer email address.
  `desc` | A customer description.

  Inherited from `AuthorizenetProfileBase`

  `id` | An Authorizenet generated id.
  `merchantAuthentication` | A merchant authentication object to authenticate Authorizenet API calls.
  `validationMode` | The current Authorizenet API validation mode.

  Public Methods:

  `__init__`([id, merchant_id, email, desc]) | Sets `merchant_id`, `email` and `desc`.
  `create`() | Creates the customer profile in Authorizenet.
  `update`() | Updates the customer profile in Authorizenet if `id` is set.
  `delete`() | Deletes the customer profile in Authorizenet and sets `id` to `None` if `id` is set.
  `get_payment_profile_ids`() | Returns a list of payment profile ids assigned to the customer profile.
  `get_address_profile_ids`() | Returns a list of address profile ids assigned to the customer profile.

  Inherited from `AuthorizenetProfileBase`

  `__init__`([id]) | Sets `id` if provided.
  `__str__`() | Returns a string representation of the profile, if `id` was set.

  Inherited from `AuthorizenetControllerExecutor`

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

  Private Methods:

  `_generate_customer_profile_ex_type`() | Generates and returns a `customerProfileExType`.
  `_generate_customer_profile_type`() | Generates and returns a `customerProfileType`.
  `_authorizenet_get_customer_profile`([issuer_info]) | Executes a `getCustomerProfileRequest` using the Authorizenet API.
  `_authorizenet_create_customer_profile`([validate]) | Executes a `createCustomerProfileRequest` using the Authorizenet API.
  `_authorizenet_update_customer_profile`([validate]) | Executes an `updateCustomerProfileRequest` using the Authorizenet API.
  `_authorizenet_delete_customer_profile`() | Executes a `deleteCustomerProfileRequest` using the Authorizenet API.

  _authorizenet_create_customer_profile(validate: bool = False) → dict | None

    Executes a `createCustomerProfileRequest` using the Authorizenet API.

    createCustomerProfileRequest

    Parameters:

      validate (`bool`) – Whether or not to validate the customer profile in Authorizenet.

    Raises:

      - AssertionError – If neither `merchantCustomerId` nor `email` were set.

      - AuthorizenetControllerExecutionError – 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.

      - AuthorizenetControllerExecutionError – 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. Default is `True`.

    Raises:

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

    Returns:

      An Authorizenet API response, if any.

    Return type:

      `dict` | `None`

  _authorizenet_update_customer_profile(validate: bool = False) → dict | None

    Executes an `updateCustomerProfileRequest` using the Authorizenet API.

    updateCustomerProfileRequest

    Parameters:

      validate (`bool`) – Whether or not to validate the customer profile in Authorizenet.

    Raises:

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

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

    Returns:

      An Authorizenet API response, if any.

    Return type:

      `dict` | `None`

  _generate_customer_profile_ex_type() → customerProfileExType

    Generates and returns a `customerProfileExType`.

    Returns:

      A customer profile object.

    Return type:

      `customerProfileExType`

  _generate_customer_profile_type() → customerProfileType

    Generates and returns a `customerProfileType`.

    Returns:

      A customer profile object.

    Return type:

      `customerProfileType`

  create() → int

    Creates the customer profile in Authorizenet.

    Raises:

      - AssertionError – If neither `merchantCustomerId` nor `email` were set.

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

    Returns:

      An id for the new customer profile.

    Return type:

      `int`

  delete() → None

    Deletes the customer profile in Authorizenet and sets `id` to `None` if `id` is set.

    Returns:

      Nothing.

    Return type:

      `None`

  property desc: str | None

    A customer description.

    Type:

      `str` | `None`

  property email: str | None

    A customer email address.

    Type:

      `str` | `None`

  get_address_profile_ids() → list[int]

    Returns a list of address profile ids assigned to the customer profile.

    Returns:

      A list of address profile ids.

    Return type:

      `list`

  get_payment_profile_ids() → list[int]

    Returns a list of payment profile ids assigned to the customer profile.

    Returns:

      A list of payment profile ids.

    Return type:

      `list`

  property merchantCustomerId: str | None

    A merchant designated customer id.

    Type:

      `str` | `None`

  update() → None

    Updates the customer profile in Authorizenet if `id` is set.

    Returns:

      Nothing.

    Return type:

      `None`

  property validationMode: str

    The current Authorizenet validation mode.

    Type:

      `str`

class terminusgps.authorizenet.profiles.addresses.AddressProfile(customer_profile_id: int | str, id: int | str | None = None, default: bool = False)

  An Authorizenet customer address profile.

  Public Data Attributes:

  Inherited from `AuthorizenetSubProfileBase`

  `customerProfileId` | A customer profile id.
  `default` | Whether or not the sub-profile is set as default.

  Inherited from `AuthorizenetProfileBase`

  `id` | An Authorizenet generated id.
  `merchantAuthentication` | A merchant authentication object to authenticate Authorizenet API calls.
  `validationMode` | The current Authorizenet API validation mode.

  Public Methods:

  `create`(address) | Creates the customer shipping address profile in Authorizenet.
  `update`(address) | Updates the customer shipping address to the new address in Authorizenet.
  `delete`() | Deletes the customer address profile in Authorizenet and sets `id` to `None` if `id` is set.

  Inherited from `AuthorizenetSubProfileBase`

  `__init__`(customer_profile_id[, id, default]) | Sets `customerProfileId` for the sub-profile.

  Inherited from `AuthorizenetProfileBase`

  `__init__`([id]) | Sets `id` if provided.
  `__str__`() | Returns a string representation of the profile, if `id` was set.

  Inherited from `AuthorizenetControllerExecutor`

  `execute_controller`(controller) | Executes an Authorizenet API 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:

      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.

      - AssertionError – If `customerProfileId` 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.

      - AssertionError – If `customerProfileId` 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.

      - AssertionError – If `customerProfileId` 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 the customer shipping address profile in Authorizenet.

    Parameters:

      address (`customerAddressType`) – A customer address.

    Returns:

      An address profile id.

    Return type:

      `int`

  delete() → None

    Deletes the customer address profile in Authorizenet and sets `id` to `None` if `id` is set.

    Returns:

      Nothing.

    Return type:

      `None`

  update(address: customerAddressType) → None

    Updates the customer shipping address to the new address in Authorizenet.

    Parameters:

      address (`customerAddressType`) – A customer address.

    Returns:

      Nothing.

    Return type:

      `None`

class terminusgps.authorizenet.profiles.payments.PaymentProfile(customer_profile_id: int | str, id: int | str | None = None, default: bool = False)

  An Authorizenet customer payment profile.

  Public Data Attributes:

  `last_4` | Last 4 digits of the payment profile credit card.

  Inherited from `AuthorizenetSubProfileBase`

  `customerProfileId` | A customer profile id.
  `default` | Whether or not the sub-profile is set as default.

  Inherited from `AuthorizenetProfileBase`

  `id` | An Authorizenet generated id.
  `merchantAuthentication` | A merchant authentication object to authenticate Authorizenet API calls.
  `validationMode` | The current Authorizenet API validation mode.

  Public Methods:

  `create`(address, payment) | Creates the customer payment profile in Authorizenet.
  `update`(address, payment) | Updates the customer payment profile in Authorizenet if `id` is set.
  `delete`() | Deletes the customer payment profile in Authorizenet and sets `id` to `None` if `id` is set.

  Inherited from `AuthorizenetSubProfileBase`

  `__init__`(customer_profile_id[, id, default]) | Sets `customerProfileId` for the sub-profile.

  Inherited from `AuthorizenetProfileBase`

  `__init__`([id]) | Sets `id` if provided.
  `__str__`() | Returns a string representation of the profile, if `id` was set.

  Inherited from `AuthorizenetControllerExecutor`

  `execute_controller`(controller) | Executes an Authorizenet API 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 = True) → dict | None

    Executes a `getCustomerPaymentProfileRequest` using the Authorizenet API.

    getCustomerPaymentProfileRequest

    Parameters:

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

    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 the customer payment profile in Authorizenet.

    Parameters:

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

      - payment (`paymentType`) – A payment.

    Returns:

      A customer payment profile id.

    Return type:

      `int`

  delete() → None

    Deletes the customer payment profile in Authorizenet and sets `id` to `None` if `id` is set.

    Returns:

      Nothing.

    Return type:

      `None`

  property last_4: str | None

    Last 4 digits of the payment profile credit card.

    Type:

      `str` | `None`

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

    Updates the customer payment profile in Authorizenet if `id` is set.

    Parameters:

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

      - payment (`paymentType`) – A payment.

    Returns:

      Nothing.

    Return type:

      `None`

class terminusgps.authorizenet.profiles.subscriptions.SubscriptionProfile(customer_profile_id: int | str, id: int | str | None = None, default: bool = False)

  An Authorizenet subscription profile.

  Public Data Attributes:

  `status` | Current subscription status.
  `transactions` | Subscription transactions.

  Inherited from `AuthorizenetSubProfileBase`

  `customerProfileId` | A customer profile id.
  `default` | Whether or not the sub-profile is set as default.

  Inherited from `AuthorizenetProfileBase`

  `id` | An Authorizenet generated id.
  `merchantAuthentication` | A merchant authentication object to authenticate Authorizenet API calls.
  `validationMode` | The current Authorizenet API validation mode.

  Public Methods:

  `create`(subscription) | Creates a subscription in Authorizenet.
  `update`(subscription) | Updates a subscription in Authorizenet if `id` is set.
  `delete`() | Deletes (cancels) a subscription in Authorizenet if `id` is set.

  Inherited from `AuthorizenetSubProfileBase`

  `__init__`(customer_profile_id[, id, default]) | Sets `customerProfileId` for the sub-profile.

  Inherited from `AuthorizenetProfileBase`

  `__init__`([id]) | Sets `id` if provided.
  `__str__`() | Returns a string representation of the profile, if `id` was set.

  Inherited from `AuthorizenetControllerExecutor`

  `execute_controller`(controller) | Executes an Authorizenet API 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.

      - AuthorizenetControllerExecutionError – 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.

      - AuthorizenetControllerExecutionError – 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

    Parameters:

      include_transactions – Whether or not to include subscription transactions in the Authorizenet API response. Default is `False`.

    Raises:

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

      - AuthorizenetControllerExecutionError – 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.

      - AuthorizenetControllerExecutionError – 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.

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

    Returns:

      An Authorizenet API response, if any.

    Return type:

      `dict` | `None`

  create(subscription: ARBSubscriptionType) → int

    Creates a subscription in Authorizenet.

    Parameters:

      subscription (`ARBSubscriptionType`) – A subscription.

    Raises:

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

    Returns:

      A subscription id.

    Return type:

      `int`

  delete() → None

    Deletes (cancels) a subscription in Authorizenet if `id` is set.

    Raises:

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

    Returns:

      Nothing.

    Return type:

      `None`

  property status: AuthorizenetSubscriptionStatus | None

    Current subscription status.

    Type:

      `AuthorizenetSubscriptionStatus` | `None`

  property transactions: list[dict[str, str]]

    Subscription transactions.

    Type:

      `list`

  update(subscription: ARBSubscriptionType) → None

    Updates a subscription in Authorizenet if `id` is set.

    Parameters:

      subscription (`ARBSubscriptionType`) – A subscription.

    Raises:

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

    Returns:

      Nothing.

    Return type:

      `None`