Subscriptions
- class terminusgps.authorizenet.subscriptions.subscriptions.Subscription(id: str | int | None = None, *args, **kwargs)[source]
Public Data Attributes:
Merchant authentication for API calls.
Current status of the subscription.
Transactions for the subscription.
Public Methods:
__init__
([id])create
(name, amount, schedule, profile_id, ...)Creates a subscription in Authorizenet.
cancel
()Cancels the subscription.
Inherited from
ControllerExecutionMixin
execute_controller
(controller)Executes an Authorizenet controller and returns its response.
Private Methods:
Executes a
ARBGetSubscriptionRequest
using the Authorizenet API.Executes a
ARBGetSubscriptionStatusRequest
using the Authorizenet API._authorizenet_update_subscription
(subscription)Executes a
ARBUpdateSubscriptionRequest
using the Authorizenet API.Executes a
ARBCancelSubscriptionRequest
using the Authorizenet API.
- _authorizenet_cancel_subscription() dict | None [source]
Executes a
ARBCancelSubscriptionRequest
using the Authorizenet API.- 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:
- _authorizenet_get_subscription(include_transactions: bool = False) dict | None [source]
Executes a
ARBGetSubscriptionRequest
using the Authorizenet API.- 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:
- _authorizenet_get_subscription_status() dict | None [source]
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:
- _authorizenet_update_subscription(subscription: ARBSubscriptionType) dict | None [source]
Executes a
ARBUpdateSubscriptionRequest
using the Authorizenet API.- 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:
- cancel() None [source]
Cancels the subscription.
- Raises:
AssertionError – If
id
wasn’t set.ControllerExecutionError – If something goes wrong during an Authorizenet API call.
- Returns:
Nothing.
- Return type:
- 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 [source]
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 Authoriznet customer profile id.payment_id (
int
|str
) – An Authoriznet customer payment profile id.address_id (
int
|str
) – An Authoriznet customer address profile id.trial_amount (
Decimal
) – Trial amount for the subscription. Default is0.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: