Class SubscriptionService
Inheritance
Implements
Namespace: DirectScale.Disco.Extension.Services
Assembly: DirectScale.Disco.Extension.Abstractions.dll
Syntax
public class SubscriptionService : Object, ISubscriptionService
Constructors
SubscriptionService(IApiService)
Declaration
public SubscriptionService(IApiService apiService)
Parameters
Type | Name | Description |
---|---|---|
IApiService | apiService |
Methods
CancelSubscription(Int32, Int32)
Cancels the first instance of a particular subscription on the given associate's account. A subscription should only exist once in the system, unless the database has been modified manually.
Declaration
public Task CancelSubscription(int associateId, int subscriptionId)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | associateId | Associate with subscription |
System.Int32 | subscriptionId | Subscription/Service ID to cancel |
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task |
GetSubscription(Int32, Int32)
This returns non-void subscriptions. To see a void subscription, please use GetAssociateSubscriptionsWithVoids(associateId).
Declaration
public Task<Subscription> GetSubscription(int associateId, int subscriptionId)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | associateId | ID of associate who owns subscription |
System.Int32 | subscriptionId | Subscription/Service ID of subscription to fetch |
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task<Subscription> | Single, non-void subscription |
GetSubscriptionItems()
Get the items configured to begin a subscription.
Declaration
public Task<SubscriptionItem[]> GetSubscriptionItems()
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task<SubscriptionItem[]> | Subscription items and renewal details. |
GetSubscriptions(Int32)
Get all associateId
's subscriptions, including Void subscriptions.
Declaration
public Task<Subscription[]> GetSubscriptions(int associateId)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | associateId | Associate with subscriptions. |
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task<Subscription[]> | Associate's subscriptions. |
ProcessItems(Int32, Int32[])
Create recurring subscriptions to itemIds
for associateId
.
Declaration
public Task ProcessItems(int associateId, int[] itemIds)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | associateId | Associate to create subscriptions for. |
System.Int32[] | itemIds | Items the associate purchased, subscriptions will be created for the ones that are subscription items. |
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task |
Remarks
itemIds
that are not subscription items will be ignored. See GetSubscriptionItems().
UpdateExpiration(Int32, Int32, DateTime)
Push out a specific associateId
's subscriptionId
exipriation date to expirationDate
.
Declaration
public Task UpdateExpiration(int associateId, int subscriptionId, DateTime expirationDate)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | associateId | Associate with subscription. |
System.Int32 | subscriptionId | Specific subscription. |
System.DateTime | expirationDate | New expiration date. |
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task |