use of org.killbill.billing.jaxrs.json.PlanDetailJson in project killbill by killbill.
the class CatalogResource method getAvailableAddons.
// Need to figure out dependency on StandaloneCatalog
// @GET
// @Path("/xsd")
// @Produces(APPLICATION_XML)
// public String getCatalogXsd() throws Exception
// {
// InputStream stream = XMLSchemaGenerator.xmlSchema(StandaloneCatalog.class);
// StringWriter writer = new StringWriter();
// IOUtils.copy(stream, writer);
// String result = writer.toString();
//
// return result;
// }
@TimedResource
@GET
@Path("/availableAddons")
@Produces(APPLICATION_JSON)
@ApiOperation(value = "Retrieve available add-ons for a given product", response = PlanDetailJson.class, responseContainer = "List")
@ApiResponses(value = {})
public Response getAvailableAddons(@QueryParam("baseProductName") final String baseProductName, @Nullable @QueryParam("priceListName") final String priceListName, @javax.ws.rs.core.Context final HttpServletRequest request) throws CatalogApiException {
final TenantContext tenantContext = context.createContext(request);
final StaticCatalog catalog = catalogUserApi.getCurrentCatalog(catalogName, tenantContext);
final List<Listing> listings = catalog.getAvailableAddOnListings(baseProductName, priceListName);
final List<PlanDetailJson> details = new ArrayList<PlanDetailJson>();
for (final Listing listing : listings) {
details.add(new PlanDetailJson(listing));
}
return Response.status(Status.OK).entity(details).build();
}
use of org.killbill.billing.jaxrs.json.PlanDetailJson in project killbill by killbill.
the class CatalogResource method getAvailableBasePlans.
@TimedResource
@GET
@Path("/availableBasePlans")
@Produces(APPLICATION_JSON)
@ApiOperation(value = "Retrieve available base plans", response = PlanDetailJson.class, responseContainer = "List")
@ApiResponses(value = {})
public Response getAvailableBasePlans(@javax.ws.rs.core.Context final HttpServletRequest request) throws CatalogApiException {
final TenantContext tenantContext = context.createContext(request);
final StaticCatalog catalog = catalogUserApi.getCurrentCatalog(catalogName, tenantContext);
final List<Listing> listings = catalog.getAvailableBasePlanListings();
final List<PlanDetailJson> details = new ArrayList<PlanDetailJson>();
for (final Listing listing : listings) {
details.add(new PlanDetailJson(listing));
}
return Response.status(Status.OK).entity(details).build();
}
use of org.killbill.billing.jaxrs.json.PlanDetailJson in project killbill by killbill.
the class CatalogResource method getAvailableBasePlans.
@TimedResource
@GET
@Path("/availableBasePlans")
@Produces(APPLICATION_JSON)
@ApiOperation(value = "Retrieve available base plans", response = PlanDetailJson.class, responseContainer = "List")
@ApiResponses(value = {})
public Response getAvailableBasePlans(@QueryParam(QUERY_ACCOUNT_ID) final UUID accountId, @javax.ws.rs.core.Context final HttpServletRequest request) throws CatalogApiException {
final TenantContext tenantContext = accountId != null ? context.createTenantContextWithAccountId(accountId, request) : context.createTenantContextNoAccountId(request);
final StaticCatalog catalog = catalogUserApi.getCurrentCatalog(catalogName, tenantContext);
final List<Listing> listings = catalog.getAvailableBasePlanListings();
final List<PlanDetailJson> details = new ArrayList<PlanDetailJson>();
for (final Listing listing : listings) {
details.add(new PlanDetailJson(listing));
}
return Response.status(Status.OK).entity(details).build();
}
use of org.killbill.billing.jaxrs.json.PlanDetailJson in project killbill by killbill.
the class CatalogResource method getAvailableAddons.
// Need to figure out dependency on StandaloneCatalog
// @GET
// @Path("/xsd")
// @Produces(APPLICATION_XML)
// public String getCatalogXsd() throws Exception
// {
// InputStream stream = XMLSchemaGenerator.xmlSchema(StandaloneCatalog.class);
// StringWriter writer = new StringWriter();
// IOUtils.copy(stream, writer);
// String result = writer.toString();
//
// return result;
// }
@TimedResource
@GET
@Path("/availableAddons")
@Produces(APPLICATION_JSON)
@ApiOperation(value = "Retrieve available add-ons for a given product", response = PlanDetailJson.class, responseContainer = "List")
@ApiResponses(value = {})
public Response getAvailableAddons(@QueryParam("baseProductName") final String baseProductName, @Nullable @QueryParam("priceListName") final String priceListName, @QueryParam(QUERY_ACCOUNT_ID) final UUID accountId, @javax.ws.rs.core.Context final HttpServletRequest request) throws CatalogApiException {
final TenantContext tenantContext = accountId != null ? context.createTenantContextWithAccountId(accountId, request) : context.createTenantContextNoAccountId(request);
final StaticCatalog catalog = catalogUserApi.getCurrentCatalog(catalogName, tenantContext);
final List<Listing> listings = catalog.getAvailableAddOnListings(baseProductName, priceListName);
final List<PlanDetailJson> details = new ArrayList<PlanDetailJson>();
for (final Listing listing : listings) {
details.add(new PlanDetailJson(listing));
}
return Response.status(Status.OK).entity(details).build();
}
Aggregations