Skip to content

@sourceloop/ctrl-plane-subscription-service / Exports / SubscriptionService

Class: SubscriptionService

Table of contents

Constructors

Properties

Methods

Constructors

constructor

new SubscriptionService(subscriptionRepository, planRepository, billingCycleRepository)

Parameters

Name Type
subscriptionRepository SubscriptionRepository<Subscription>
planRepository PlanRepository<Plan>
billingCycleRepository BillingCycleRepository<BillingCycle>

Defined in

services/subscription-service/src/services/subscription.service.ts:14

Properties

billingCycleRepository

Private Readonly billingCycleRepository: BillingCycleRepository<BillingCycle>

Defined in

services/subscription-service/src/services/subscription.service.ts:20


planRepository

Private Readonly planRepository: PlanRepository<Plan>

Defined in

services/subscription-service/src/services/subscription.service.ts:18


subscriptionRepository

Private Readonly subscriptionRepository: SubscriptionRepository<Subscription>

Defined in

services/subscription-service/src/services/subscription.service.ts:16

Methods

_unitMap

Private _unitMap(durationUnit): DurationConstructor

Parameters

Name Type
durationUnit string

Returns

DurationConstructor

Defined in

services/subscription-service/src/services/subscription.service.ts:42


createSubscription

createSubscription(subscription): Promise<Subscription>

Parameters

Name Type
subscription Omit<Subscription, "id" | "startDate" | "endDate">

Returns

Promise<Subscription>

Defined in

services/subscription-service/src/services/subscription.service.ts:22


getExpireSoonSubscriptions

getExpireSoonSubscriptions(): Promise<{ daysRemainingToExpiry: number ; id: string ; subscriberId: string }[]>

Returns

Promise<{ daysRemainingToExpiry: number ; id: string ; subscriberId: string }[]>

Defined in

services/subscription-service/src/services/subscription.service.ts:55


handleExpiredSubscriptions

handleExpiredSubscriptions(dayCount): Promise<{ subscriberId: string ; subscriptionId: string }[]>

Parameters

Name Type
dayCount number

Returns

Promise<{ subscriberId: string ; subscriptionId: string }[]>

Defined in

services/subscription-service/src/services/subscription.service.ts:76