Search in sources :

Example 6 with SubscriptionNotificationKey

use of org.killbill.billing.subscription.engine.core.SubscriptionNotificationKey in project killbill by killbill.

the class MockSubscriptionDaoMemory method createSubscriptionsWithAddOns.

@Override
public void createSubscriptionsWithAddOns(final List<SubscriptionBaseWithAddOns> subscriptions, final Map<UUID, List<SubscriptionBaseEvent>> initialEventsMap, final InternalCallContext context) {
    synchronized (events) {
        for (final SubscriptionBaseWithAddOns subscription : subscriptions) {
            for (final SubscriptionBase subscriptionBase : subscription.getSubscriptionBaseList()) {
                final List<SubscriptionBaseEvent> initialEvents = initialEventsMap.get(subscriptionBase.getId());
                events.addAll(initialEvents);
                for (final SubscriptionBaseEvent cur : initialEvents) {
                    recordFutureNotificationFromTransaction(null, cur.getEffectiveDate(), new SubscriptionNotificationKey(cur.getId()), context);
                }
                final SubscriptionBase updatedSubscription = buildSubscription((DefaultSubscriptionBase) subscriptionBase, context);
                this.subscriptions.add(updatedSubscription);
                mockNonEntityDao.addTenantRecordIdMapping(updatedSubscription.getId(), context);
            }
        }
    }
}
Also used : SubscriptionBase(org.killbill.billing.subscription.api.SubscriptionBase) DefaultSubscriptionBase(org.killbill.billing.subscription.api.user.DefaultSubscriptionBase) SubscriptionNotificationKey(org.killbill.billing.subscription.engine.core.SubscriptionNotificationKey) DefaultSubscriptionBaseWithAddOns(org.killbill.billing.subscription.api.user.DefaultSubscriptionBaseWithAddOns) SubscriptionBaseWithAddOns(org.killbill.billing.subscription.api.SubscriptionBaseWithAddOns) SubscriptionBaseEvent(org.killbill.billing.subscription.events.SubscriptionBaseEvent)

Aggregations

SubscriptionNotificationKey (org.killbill.billing.subscription.engine.core.SubscriptionNotificationKey)6 SubscriptionBaseEvent (org.killbill.billing.subscription.events.SubscriptionBaseEvent)5 DefaultSubscriptionBase (org.killbill.billing.subscription.api.user.DefaultSubscriptionBase)3 SubscriptionBase (org.killbill.billing.subscription.api.SubscriptionBase)2 SubscriptionEventModelDao (org.killbill.billing.subscription.engine.dao.model.SubscriptionEventModelDao)2 ImmutableList (com.google.common.collect.ImmutableList)1 IOException (java.io.IOException)1 ArrayList (java.util.ArrayList)1 Date (java.util.Date)1 LinkedList (java.util.LinkedList)1 List (java.util.List)1 UUID (java.util.UUID)1 InternalCallContext (org.killbill.billing.callcontext.InternalCallContext)1 CatalogApiException (org.killbill.billing.catalog.api.CatalogApiException)1 SubscriptionApiException (org.killbill.billing.entitlement.api.SubscriptionApiException)1 EntityPersistenceException (org.killbill.billing.entity.EntityPersistenceException)1 SubscriptionBaseWithAddOns (org.killbill.billing.subscription.api.SubscriptionBaseWithAddOns)1 SubscriptionTransferData (org.killbill.billing.subscription.api.transfer.SubscriptionTransferData)1 DefaultSubscriptionBaseBundle (org.killbill.billing.subscription.api.user.DefaultSubscriptionBaseBundle)1 DefaultSubscriptionBaseWithAddOns (org.killbill.billing.subscription.api.user.DefaultSubscriptionBaseWithAddOns)1