use of org.killbill.billing.entitlement.api.BlockingState in project killbill by killbill.
the class TestBlockingChecker method setStateAccount.
private void setStateAccount(final boolean bC, final boolean bE, final boolean bB) {
final BlockingState accountState = new DefaultBlockingState(account.getId(), BlockingStateType.ACCOUNT, "state", "test-service", bC, bE, bB, clock.getUTCNow());
blockingStateDao.setBlockingStatesAndPostBlockingTransitionEvent(ImmutableMap.<BlockingState, Optional<UUID>>of(accountState, Optional.<UUID>absent()), internalCallContext);
}
use of org.killbill.billing.entitlement.api.BlockingState in project killbill by killbill.
the class TestBlockingChecker method setStateBundle.
private void setStateBundle(final boolean bC, final boolean bE, final boolean bB) {
final BlockingState bundleState = new DefaultBlockingState(bundle.getId(), BlockingStateType.SUBSCRIPTION_BUNDLE, "state", "test-service", bC, bE, bB, clock.getUTCNow());
blockingStateDao.setBlockingStatesAndPostBlockingTransitionEvent(ImmutableMap.<BlockingState, Optional<UUID>>of(bundleState, Optional.<UUID>absent()), internalCallContext);
}
use of org.killbill.billing.entitlement.api.BlockingState in project killbill by killbill.
the class JaxRsResourceBase method addBlockingState.
public Response addBlockingState(final BlockingStateJson json, final String id, final BlockingStateType type, final String requestedDate, final List<String> pluginPropertiesString, final String createdBy, final String reason, final String comment, final HttpServletRequest request) throws SubscriptionApiException, EntitlementApiException, AccountApiException {
final Iterable<PluginProperty> pluginProperties = extractPluginProperties(pluginPropertiesString);
final CallContext callContext = context.createContext(createdBy, reason, comment, request);
final UUID blockableId = UUID.fromString(id);
final boolean isBlockBilling = (json.isBlockBilling() != null && json.isBlockBilling());
final boolean isBlockEntitlement = (json.isBlockEntitlement() != null && json.isBlockEntitlement());
final boolean isBlockChange = (json.isBlockChange() != null && json.isBlockChange());
final LocalDate resolvedRequestedDate = toLocalDate(requestedDate);
final BlockingState input = new DefaultBlockingState(blockableId, type, json.getStateName(), json.getService(), isBlockChange, isBlockEntitlement, isBlockBilling, null);
subscriptionApi.addBlockingState(input, resolvedRequestedDate, pluginProperties, callContext);
return Response.status(Status.OK).build();
}
use of org.killbill.billing.entitlement.api.BlockingState in project killbill by killbill.
the class AccountResource method getBlockingStates.
/*
* ************************* BLOCKING STATE *****************************
*/
@TimedResource
@GET
@Path("/{accountId:" + UUID_PATTERN + "}/" + BLOCK)
@Produces(APPLICATION_JSON)
@ApiOperation(value = "Retrieve blocking states for account", response = BlockingStateJson.class, responseContainer = "List")
@ApiResponses(value = { @ApiResponse(code = 400, message = "Invalid account id supplied") })
public Response getBlockingStates(@PathParam(ID_PARAM_NAME) final String id, @QueryParam(QUERY_BLOCKING_STATE_TYPES) final List<BlockingStateType> typeFilter, @QueryParam(QUERY_BLOCKING_STATE_SVCS) final List<String> svcsFilter, @QueryParam(QUERY_AUDIT) @DefaultValue("NONE") final AuditMode auditMode, @javax.ws.rs.core.Context final HttpServletRequest request) throws EntitlementApiException {
final TenantContext tenantContext = this.context.createContext(request);
final UUID accountId = UUID.fromString(id);
final Iterable<BlockingState> blockingStates = subscriptionApi.getBlockingStates(accountId, typeFilter, svcsFilter, OrderingType.ASCENDING, SubscriptionApi.ALL_EVENTS, tenantContext);
final AccountAuditLogs accountAuditLogs = auditUserApi.getAccountAuditLogs(accountId, auditMode.getLevel(), tenantContext);
final List<BlockingStateJson> result = ImmutableList.copyOf(Iterables.transform(blockingStates, new Function<BlockingState, BlockingStateJson>() {
@Override
public BlockingStateJson apply(final BlockingState input) {
return new BlockingStateJson(input, accountAuditLogs);
}
}));
return Response.status(Status.OK).entity(result).build();
}
use of org.killbill.billing.entitlement.api.BlockingState in project killbill by killbill.
the class MockEntitlementModuleForPayment method installBlockingApi.
@Override
public void installBlockingApi() {
super.installBlockingApi();
final BlockingState blockingState = new DefaultBlockingState(null, BlockingStateType.ACCOUNT, "CLEAR_STATE_NAME", "test", false, false, false, new DateTime(DateTimeZone.UTC));
Mockito.when(blockingApi.getBlockingAllForAccount(Mockito.<InternalTenantContext>any())).thenReturn(ImmutableList.<BlockingState>of(blockingState));
Mockito.when(blockingApi.getBlockingStateForService(Mockito.<UUID>any(), Mockito.<BlockingStateType>any(), Mockito.anyString(), Mockito.<InternalTenantContext>any())).thenReturn(blockingState);
}
Aggregations