use of org.killbill.billing.jaxrs.json.CreditJson in project killbill by killbill.
the class CreditResource method getCredit.
@GET
@Path("/{creditId:" + UUID_PATTERN + "}")
@Produces(APPLICATION_JSON)
@ApiOperation(value = "Retrieve a credit by id", response = CreditJson.class)
@ApiResponses(value = { @ApiResponse(code = 400, message = "Invalid credit id supplied"), @ApiResponse(code = 404, message = "Credit not found") })
public Response getCredit(@PathParam("creditId") final String creditId, @javax.ws.rs.core.Context final HttpServletRequest request) throws InvoiceApiException, AccountApiException {
final TenantContext tenantContext = context.createContext(request);
final InvoiceItem credit = invoiceUserApi.getCreditById(UUID.fromString(creditId), tenantContext);
final Invoice invoice = invoiceUserApi.getInvoice(credit.getInvoiceId(), tenantContext);
final CreditJson creditJson = new CreditJson(invoice, credit);
return Response.status(Response.Status.OK).entity(creditJson).build();
}
Aggregations