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
ControllerExecutionMixinexecute_controller(controller)Executes an Authorizenet controller and returns its response.
Private Methods:
Executes a
ARBGetSubscriptionRequestusing the Authorizenet API.Executes a
ARBGetSubscriptionStatusRequestusing the Authorizenet API._authorizenet_update_subscription(subscription)Executes a
ARBUpdateSubscriptionRequestusing the Authorizenet API.Executes a
ARBCancelSubscriptionRequestusing the Authorizenet API.
- _authorizenet_cancel_subscription() dict | None[source]
Executes a
ARBCancelSubscriptionRequestusing the Authorizenet API.- Raises:
AssertionError – If
idwasn’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
ARBGetSubscriptionRequestusing the Authorizenet API.- Raises:
AssertionError – If
idwasn’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
ARBGetSubscriptionStatusRequestusing the Authorizenet API.ARBGetSubscriptionStatusRequest
- Raises:
AssertionError – If
idwasn’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
ARBUpdateSubscriptionRequestusing the Authorizenet API.- Raises:
AssertionError – If
idwasn’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
idwasn’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_idwasn’t a digit.ValueError – If
payment_idwasn’t a digit.ValueError – If
address_idwasn’t a digit.ValueError – If the Authorizenet API response was not retrieved.
- Returns:
An Authorizenet subscription id.
- Return type: