Search in sources :

Example 6 with AccountJson

use of org.killbill.billing.jaxrs.json.AccountJson in project killbill by killbill.

the class AccountResource method getAccountByKey.

@TimedResource
@GET
@Produces(APPLICATION_JSON)
@ApiOperation(value = "Retrieve an account by external key", response = AccountJson.class)
@ApiResponses(value = { @ApiResponse(code = 404, message = "Account not found") })
public Response getAccountByKey(@QueryParam(QUERY_EXTERNAL_KEY) final String externalKey, @QueryParam(QUERY_ACCOUNT_WITH_BALANCE) @DefaultValue("false") final Boolean accountWithBalance, @QueryParam(QUERY_ACCOUNT_WITH_BALANCE_AND_CBA) @DefaultValue("false") final Boolean accountWithBalanceAndCBA, @QueryParam(QUERY_AUDIT) @DefaultValue("NONE") final AuditMode auditMode, @javax.ws.rs.core.Context final HttpServletRequest request) throws AccountApiException {
    final TenantContext tenantContext = context.createContext(request);
    final Account account = accountUserApi.getAccountByKey(externalKey, tenantContext);
    final AccountAuditLogs accountAuditLogs = auditUserApi.getAccountAuditLogs(account.getId(), auditMode.getLevel(), tenantContext);
    final AccountJson accountJson = getAccount(account, accountWithBalance, accountWithBalanceAndCBA, accountAuditLogs, tenantContext);
    return Response.status(Status.OK).entity(accountJson).build();
}
Also used : AccountJson(org.killbill.billing.jaxrs.json.AccountJson) Account(org.killbill.billing.account.api.Account) TenantContext(org.killbill.billing.util.callcontext.TenantContext) AccountAuditLogs(org.killbill.billing.util.audit.AccountAuditLogs) TimedResource(org.killbill.commons.metrics.TimedResource) Produces(javax.ws.rs.Produces) GET(javax.ws.rs.GET) ApiOperation(io.swagger.annotations.ApiOperation) ApiResponses(io.swagger.annotations.ApiResponses)

Aggregations

AccountJson (org.killbill.billing.jaxrs.json.AccountJson)6 ApiOperation (io.swagger.annotations.ApiOperation)5 ApiResponses (io.swagger.annotations.ApiResponses)5 GET (javax.ws.rs.GET)5 Produces (javax.ws.rs.Produces)5 Account (org.killbill.billing.account.api.Account)5 AccountAuditLogs (org.killbill.billing.util.audit.AccountAuditLogs)5 TenantContext (org.killbill.billing.util.callcontext.TenantContext)5 TimedResource (org.killbill.commons.metrics.TimedResource)5 Path (javax.ws.rs.Path)4 URI (java.net.URI)2 BigDecimal (java.math.BigDecimal)1 ArrayList (java.util.ArrayList)1