Tabnine Logo
SubscriptionBaseApiException.getCode
Code IndexAdd Tabnine to your IDE (free)

How to use
getCode
method
in
com.ning.billing.subscription.api.user.SubscriptionBaseApiException

Best Java code snippets using com.ning.billing.subscription.api.user.SubscriptionBaseApiException.getCode (Showing top 6 results out of 315)

origin: com.ning.billing/killbill-entitlement

private DefaultBlockingAggregator getBlockedStateSubscriptionId(final UUID subscriptionId, final InternalTenantContext context) throws BlockingApiException {
  final SubscriptionBase subscription;
  try {
    subscription = subscriptionApi.getSubscriptionFromId(subscriptionId, context);
    return getBlockedStateSubscription(subscription, context);
  } catch (SubscriptionBaseApiException e) {
    throw new BlockingApiException(e, ErrorCode.fromCode(e.getCode()));
  }
}
origin: com.ning.billing/killbill-entitlement

private DefaultBlockingAggregator getBlockedStateBundleId(final UUID bundleId, final InternalTenantContext context) throws BlockingApiException {
  final SubscriptionBaseBundle bundle;
  try {
    bundle = subscriptionApi.getBundleFromId(bundleId, context);
    return getBlockedStateBundle(bundle, context);
  } catch (SubscriptionBaseApiException e) {
    throw new BlockingApiException(e, ErrorCode.fromCode(e.getCode()));
  }
}
origin: com.ning.billing/killbill-subscription

private void tCreateSubscriptionInternal(@Nullable final UUID bundleId, @Nullable final String productName,
                     @Nullable final BillingPeriod term, final String planSet, final ErrorCode expected) {
  try {
    subscriptionInternalApi.createSubscription(bundleId,
                          testUtil.getProductSpecifier(productName, planSet, term, null),
                          clock.getUTCNow(), internalCallContext);
    Assert.fail("Exception expected, error code: " + expected);
  } catch (SubscriptionBaseApiException e) {
    assertEquals(e.getCode(), expected.getCode());
  }
}
origin: com.ning.billing/killbill-subscription

  @Test(groups = "fast")
  public void testUncancelBadState() throws SubscriptionBaseApiException {
    final SubscriptionBase subscription = testUtil.createSubscription(bundle, "Shotgun", BillingPeriod.MONTHLY, PriceListSet.DEFAULT_PRICELIST_NAME);

    try {
      subscription.uncancel(callContext);
    } catch (SubscriptionBaseApiException e) {
      assertEquals(e.getCode(), ErrorCode.SUB_UNCANCEL_BAD_STATE.getCode());
    }
    assertListenerStatus();
  }
}
origin: com.ning.billing/killbill-subscription

@Test(groups = "fast")
public void testChangeSubscriptionNonActive() throws SubscriptionBaseApiException {
  final SubscriptionBase subscription = testUtil.createSubscription(bundle, "Shotgun", BillingPeriod.ANNUAL, PriceListSet.DEFAULT_PRICELIST_NAME);
  testListener.pushExpectedEvent(NextEvent.CANCEL);
  subscription.cancelWithDate(clock.getUTCNow(), callContext);
  try {
    subscription.changePlanWithDate("Pistol", BillingPeriod.MONTHLY, PriceListSet.DEFAULT_PRICELIST_NAME, clock.getUTCNow(), callContext);
  } catch (SubscriptionBaseApiException e) {
    assertEquals(e.getCode(), ErrorCode.SUB_CHANGE_NON_ACTIVE.getCode());
  }
}
origin: com.ning.billing/killbill-subscription

@Test(groups = "fast")
public void testChangeSubscriptionFutureCancelled() throws SubscriptionBaseApiException {
  SubscriptionBase subscription = testUtil.createSubscription(bundle, "Shotgun", BillingPeriod.MONTHLY, PriceListSet.DEFAULT_PRICELIST_NAME);
  final PlanPhase trialPhase = subscription.getCurrentPhase();
  // MOVE TO NEXT PHASE
  final PlanPhase currentPhase = subscription.getCurrentPhase();
  testListener.pushExpectedEvent(NextEvent.PHASE);
  final Interval it = new Interval(clock.getUTCNow(), clock.getUTCNow().plusDays(31));
  clock.addDeltaFromReality(it.toDurationMillis());
  assertListenerStatus();
  // SET CTD TO CANCEL IN FUTURE
  final DateTime expectedPhaseTrialChange = TestSubscriptionHelper.addDuration(subscription.getStartDate(), trialPhase.getDuration());
  final Duration ctd = testUtil.getDurationMonth(1);
  final DateTime newChargedThroughDate = TestSubscriptionHelper.addDuration(expectedPhaseTrialChange, ctd);
  subscriptionInternalApi.setChargedThroughDate(subscription.getId(), newChargedThroughDate, internalCallContext);
  subscription = subscriptionInternalApi.getSubscriptionFromId(subscription.getId(), internalCallContext);
  subscription.cancelWithPolicy(BillingActionPolicy.END_OF_TERM, callContext);
  try {
    subscription.changePlanWithDate("Pistol", BillingPeriod.MONTHLY, PriceListSet.DEFAULT_PRICELIST_NAME, clock.getUTCNow(), callContext);
  } catch (SubscriptionBaseApiException e) {
    assertEquals(e.getCode(), ErrorCode.SUB_CHANGE_FUTURE_CANCELLED.getCode());
  }
  assertListenerStatus();
}
com.ning.billing.subscription.api.userSubscriptionBaseApiExceptiongetCode

Popular methods of SubscriptionBaseApiException

  • <init>
  • getMessage

Popular in Java

  • Making http post requests using okhttp
  • notifyDataSetChanged (ArrayAdapter)
  • getResourceAsStream (ClassLoader)
  • scheduleAtFixedRate (Timer)
  • Graphics2D (java.awt)
    This Graphics2D class extends the Graphics class to provide more sophisticated control overgraphics
  • Kernel (java.awt.image)
  • String (java.lang)
  • Format (java.text)
    The base class for all formats. This is an abstract base class which specifies the protocol for clas
  • SimpleDateFormat (java.text)
    Formats and parses dates in a locale-sensitive manner. Formatting turns a Date into a String, and pa
  • Filter (javax.servlet)
    A filter is an object that performs filtering tasks on either the request to a resource (a servlet o
  • Top PhpStorm plugins
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now