use of org.killbill.billing.util.audit.AuditLogWithHistory in project killbill by killbill.
the class PaymentResource method getPaymentAuditLogsWithHistory.
@TimedResource
@GET
@Path("/{paymentId:" + UUID_PATTERN + "}/" + AUDIT_LOG_WITH_HISTORY)
@Produces(APPLICATION_JSON)
@ApiOperation(value = "Retrieve payment audit logs with history by id", response = AuditLogJson.class, responseContainer = "List")
@ApiResponses(value = { @ApiResponse(code = 404, message = "Account not found") })
public Response getPaymentAuditLogsWithHistory(@PathParam("paymentId") final UUID paymentId, @javax.ws.rs.core.Context final HttpServletRequest request) throws AccountApiException {
final TenantContext tenantContext = context.createTenantContextNoAccountId(request);
final List<AuditLogWithHistory> auditLogWithHistory = paymentApi.getPaymentAuditLogsWithHistoryForId(paymentId, AuditLevel.FULL, tenantContext);
return Response.status(Status.OK).entity(getAuditLogsWithHistory(auditLogWithHistory)).build();
}
use of org.killbill.billing.util.audit.AuditLogWithHistory in project killbill by killbill.
the class PaymentMethodResource method getPaymentMethodAuditLogsWithHistory.
@TimedResource
@GET
@Path("/{paymentMethodId:" + UUID_PATTERN + "}/" + AUDIT_LOG_WITH_HISTORY)
@Produces(APPLICATION_JSON)
@ApiOperation(value = "Retrieve payment method audit logs with history by id", response = AuditLogJson.class, responseContainer = "List")
@ApiResponses(value = { @ApiResponse(code = 404, message = "Account not found") })
public Response getPaymentMethodAuditLogsWithHistory(@PathParam("paymentMethodId") final UUID paymentMethodId, @javax.ws.rs.core.Context final HttpServletRequest request) throws AccountApiException {
final TenantContext tenantContext = context.createTenantContextNoAccountId(request);
final List<AuditLogWithHistory> auditLogWithHistory = paymentApi.getPaymentMethodAuditLogsWithHistoryForId(paymentMethodId, AuditLevel.FULL, tenantContext);
return Response.status(Status.OK).entity(getAuditLogsWithHistory(auditLogWithHistory)).build();
}
use of org.killbill.billing.util.audit.AuditLogWithHistory in project killbill by killbill.
the class TestPaymentMethodProcessorWithDB method testDeletePaymentMethod.
@Test(groups = "slow")
public void testDeletePaymentMethod() throws Exception {
final Account account = testHelper.createTestAccount("foo@bar.com", true);
final UUID paymentMethodId = paymentMethodProcessor.createOrGetExternalPaymentMethod("pmExternalKey", account, PLUGIN_PROPERTIES, callContext, internalCallContext);
final PaymentMethodModelDao paymentMethodModelDao = paymentDao.getPaymentMethod(paymentMethodId, internalCallContext);
List<AuditLogWithHistory> auditLogsWithHistory = paymentDao.getPaymentMethodAuditLogsWithHistoryForId(paymentMethodModelDao.getId(), AuditLevel.FULL, internalCallContext);
Assert.assertEquals(auditLogsWithHistory.size(), 1);
PaymentMethodModelDao history1 = (PaymentMethodModelDao) auditLogsWithHistory.get(0).getEntity();
Assert.assertEquals(auditLogsWithHistory.get(0).getChangeType(), ChangeType.INSERT);
Assert.assertEquals(history1.getAccountRecordId(), paymentMethodModelDao.getAccountRecordId());
Assert.assertEquals(history1.getTenantRecordId(), paymentMethodModelDao.getTenantRecordId());
Assert.assertEquals(history1.getExternalKey(), paymentMethodModelDao.getExternalKey());
Assert.assertTrue(history1.isActive());
paymentMethodProcessor.deletedPaymentMethod(account, paymentMethodId, true, true, ImmutableList.<PluginProperty>of(), callContext, internalCallContext);
auditLogsWithHistory = paymentDao.getPaymentMethodAuditLogsWithHistoryForId(paymentMethodModelDao.getId(), AuditLevel.FULL, internalCallContext);
Assert.assertEquals(auditLogsWithHistory.size(), 2);
history1 = (PaymentMethodModelDao) auditLogsWithHistory.get(0).getEntity();
PaymentMethodModelDao history2 = (PaymentMethodModelDao) auditLogsWithHistory.get(1).getEntity();
Assert.assertEquals(auditLogsWithHistory.get(0).getChangeType(), ChangeType.INSERT);
Assert.assertEquals(history1.getAccountRecordId(), paymentMethodModelDao.getAccountRecordId());
Assert.assertEquals(history1.getTenantRecordId(), paymentMethodModelDao.getTenantRecordId());
Assert.assertEquals(history1.getExternalKey(), paymentMethodModelDao.getExternalKey());
Assert.assertTrue(history1.isActive());
Assert.assertEquals(auditLogsWithHistory.get(1).getChangeType(), ChangeType.DELETE);
Assert.assertEquals(history2.getAccountRecordId(), paymentMethodModelDao.getAccountRecordId());
Assert.assertEquals(history2.getTenantRecordId(), paymentMethodModelDao.getTenantRecordId());
Assert.assertEquals(history2.getExternalKey(), paymentMethodModelDao.getExternalKey());
Assert.assertFalse(history2.isActive());
}
Aggregations