public interface SubscriptionService
Modifier and Type | Method and Description |
---|---|
Calendar |
cartFutureStartDate(org.broadleafcommerce.core.order.domain.Order cart) |
Subscription |
create()
creates a new subscription
|
void |
delete(Subscription subscription)
physically deletes a subscription from the database
|
ScheduledPayment |
findScheduledPaymentByPeriodAndSubscription(Subscription subscription,
Integer period)
Reads the scheduled payment with the matching period and Subscription
|
SubscriptionSku |
findSkuByUpgradeFamilyTypeAndLevel(String upgradeFamilyType,
Integer upgradeLevel)
Finds the subscription sku for a specific upgradeFamilyType and upgradeLevel
|
Subscription |
findSubscriptionById(Long subscriptionId)
finds a specific subscription
|
Subscription |
findSubscriptionByOrderItemIdAndCustomerId(Long orderItemId,
Long customerId,
Boolean activeOnly)
Retrieves the subscription with the matching Order and a Customer
|
Subscription |
findSubscriptionBySkuIdAndCustomerId(Long productId,
Long customerId)
Find an active subscription for the given product and customer
|
Subscription |
findSubscriptionByUpgradeFamilyTypeAndCustomer(String upgradeFamily,
org.broadleafcommerce.profile.core.domain.Customer customer)
Returns the active subscription from an upgrade family for the given customer.
|
List<Subscription> |
findSubscriptionsByCustomerId(Long customerId,
boolean activeOnly)
retrieves all subscriptions by a given customer.
|
List<Subscription> |
findSubscriptionsByDayOfMonth(org.broadleafcommerce.common.time.DayOfMonthType dayOfMonth,
boolean activeOnly)
retrieves all subscriptions due by a specific day of the month.
|
Calendar |
futureStartDateForOrderItem(org.broadleafcommerce.core.order.domain.DiscreteOrderItem discreteOrderItem) |
Integer |
getDefaultStartPeriod()
Returns the default start period relative to the order date.
|
Calendar |
getNextBillingDateForCustomer(org.broadleafcommerce.profile.core.domain.Customer c,
int relativePeriod,
BillingFrequencyType freqType,
Calendar futureStartDate) |
Date |
getNextBillingDateForSubscription(Subscription subscription)
Calculates the date for the next scheduled billing job to run for the
referenced subscription, given the primary order's submit date and the
billing frequency on the order items
|
Date |
getNextBillingDateForSubscription(Subscription subscription,
Integer period)
Used to determine the billing date of a subscription object for the given
period.
|
ScheduledPayment |
getNextScheduledPrice(Subscription subscription,
org.broadleafcommerce.core.order.domain.OrderItem orderItem)
accurately calculates, based solely on the current subscription
information, the next estimated retail price for a specific orderItem
|
Calendar |
getOriginalBillingDateForCustomer(org.broadleafcommerce.profile.core.domain.Customer c,
BillingFrequencyType freqType) |
org.broadleafcommerce.common.money.Money |
getProratedPriceForUpgrade(org.broadleafcommerce.common.money.Money newPrice,
Subscription subscription)
Returns the prorated price calculated by determining days of the month left in the subscription as a percent
of the new price passed in.
|
List<ScheduledPayment> |
getScheduledPayments(Subscription subscription,
org.broadleafcommerce.core.order.domain.OrderItem orderItem)
Calculates the next scheduled payment for a specific order item
within the primary order of the subscriptions
|
List<ScheduledPayment> |
getScheduledPaymentsForOrder(String billingFrequencyType,
SubscriptionOrder subOrder,
int startPeriod,
int endPeriod,
Calendar futureStartDate) |
Calendar |
getStartDateForOrderItem(org.broadleafcommerce.core.order.domain.OrderItem orderItem) |
Boolean |
isItemUpgrade(org.broadleafcommerce.profile.core.domain.Customer customer,
org.broadleafcommerce.core.order.domain.DiscreteOrderItem subscriptionItem)
Returns whether the passed in subscription item would be considered and upgrade to an existing
subscription for the given customer
|
Calendar |
overrideGetCalendarForNextBillingDate(BillingFrequencyType freqType,
Calendar returnDate,
Integer relativePeriod)
This method is intended to be overridden for custom billing date calculation whenever a custom BillingFrequencyType
is passed in.
|
Integer |
overrideGetNextPeriod(BillingFrequencyType frequencyType,
org.joda.time.LocalDate startSubscriptionDate,
org.joda.time.LocalDate today)
This method is intended to be overridden for custom period calculation whenever a custom BillingFrequencyType is
passed in.
|
Calendar |
parseDateToCalendar(Calendar calendar,
String value) |
Subscription |
save(Subscription subscription)
saves a subscription to the database
|
List<ScheduledPayment> getScheduledPayments(Subscription subscription, org.broadleafcommerce.core.order.domain.OrderItem orderItem)
subscription
- orderItem
- Integer overrideGetNextPeriod(BillingFrequencyType frequencyType, org.joda.time.LocalDate startSubscriptionDate, org.joda.time.LocalDate today)
frequencyType
- startSubscriptionDate
- today
- Date getNextBillingDateForSubscription(Subscription subscription, Integer period)
subscription
- period
- Calendar overrideGetCalendarForNextBillingDate(BillingFrequencyType freqType, Calendar returnDate, Integer relativePeriod)
freqType
- returnDate
- relativePeriod
- List<ScheduledPayment> getScheduledPaymentsForOrder(String billingFrequencyType, SubscriptionOrder subOrder, int startPeriod, int endPeriod, Calendar futureStartDate)
Calendar getOriginalBillingDateForCustomer(org.broadleafcommerce.profile.core.domain.Customer c, BillingFrequencyType freqType)
Calendar getNextBillingDateForCustomer(org.broadleafcommerce.profile.core.domain.Customer c, int relativePeriod, BillingFrequencyType freqType, Calendar futureStartDate)
Integer getDefaultStartPeriod()
Subscription findSubscriptionById(Long subscriptionId)
subscriptionId
- List<Subscription> findSubscriptionsByCustomerId(Long customerId, boolean activeOnly)
customerId
- activeOnly
- List<Subscription> findSubscriptionsByDayOfMonth(org.broadleafcommerce.common.time.DayOfMonthType dayOfMonth, boolean activeOnly)
dayOfMonth
- activeOnly
- Subscription findSubscriptionByOrderItemIdAndCustomerId(Long orderItemId, Long customerId, Boolean activeOnly)
orderId
- customerId
- Subscription findSubscriptionBySkuIdAndCustomerId(Long productId, Long customerId)
skuId
- customerId
- Subscription save(Subscription subscription)
subscription
- Subscription create()
void delete(Subscription subscription)
subscription
- ScheduledPayment getNextScheduledPrice(Subscription subscription, org.broadleafcommerce.core.order.domain.OrderItem orderItem)
subscription
- Date getNextBillingDateForSubscription(Subscription subscription)
subscription
- ScheduledPayment findScheduledPaymentByPeriodAndSubscription(Subscription subscription, Integer period)
subscription
- period
- SubscriptionSku findSkuByUpgradeFamilyTypeAndLevel(String upgradeFamilyType, Integer upgradeLevel)
upgradeFamilyType
- upgradeLevel
- Subscription findSubscriptionByUpgradeFamilyTypeAndCustomer(String upgradeFamily, org.broadleafcommerce.profile.core.domain.Customer customer)
upgradeFamily
- customer
- Boolean isItemUpgrade(org.broadleafcommerce.profile.core.domain.Customer customer, org.broadleafcommerce.core.order.domain.DiscreteOrderItem subscriptionItem)
customer
- subscriptionItem
- org.broadleafcommerce.common.money.Money getProratedPriceForUpgrade(org.broadleafcommerce.common.money.Money newPrice, Subscription subscription)
newPrice
- subscription
- Calendar getStartDateForOrderItem(org.broadleafcommerce.core.order.domain.OrderItem orderItem) throws Exception
Exception
Calendar parseDateToCalendar(Calendar calendar, String value) throws Exception
Exception
Calendar cartFutureStartDate(org.broadleafcommerce.core.order.domain.Order cart)
Calendar futureStartDateForOrderItem(org.broadleafcommerce.core.order.domain.DiscreteOrderItem discreteOrderItem)
Copyright © 2020. All rights reserved.