use of org.olat.resource.accesscontrol.AccessTransaction in project OpenOLAT by OpenOLAT.
the class PaypalManagerImpl method completeDeniedTransaction.
private void completeDeniedTransaction(PaypalTransaction trx) {
updateTransaction(trx, PaypalTransactionStatus.DENIED);
Order order = orderManager.loadOrderByNr(trx.getRefNo());
order = orderManager.save(order, OrderStatus.ERROR);
PaypalAccessMethod method = getMethodSecure(trx.getMethodId());
if (order.getKey().equals(trx.getOrderId())) {
// make accessible
Identity identity = order.getDelivery();
for (OrderPart part : order.getParts()) {
if (part.getKey().equals(trx.getOrderPartId())) {
AccessTransaction transaction = transactionManager.createTransaction(order, part, method);
transaction = transactionManager.update(transaction, AccessTransactionStatus.ERROR);
for (OrderLine line : part.getOrderLines()) {
acService.denyAccesToResource(identity, line.getOffer());
log.audit("Paypal payed access revoked for: " + buildLogMessage(line, method) + " to " + identity, null);
ResourceReservation reservation = reservationDao.loadReservation(identity, line.getOffer().getResource());
if (reservation != null) {
acService.removeReservation(identity, identity, reservation);
log.audit("Remove reservation after cancellation for: " + reservation + " to " + identity, null);
}
}
}
}
} else {
log.error("Order not in sync with PaypalTransaction", null);
}
}
use of org.olat.resource.accesscontrol.AccessTransaction in project OpenOLAT by OpenOLAT.
the class OrderDetailController method getOrderItemsDataModel.
private OrderItemsDataModel getOrderItemsDataModel() {
List<OrderItemWrapper> items = new ArrayList<OrderItemWrapper>();
for (OrderPart part : order.getParts()) {
boolean first = true;
AccessTransaction transaction = null;
if (transactions != null) {
for (AccessTransaction trx : transactions) {
if (trx.getOrderPart().equals(part)) {
transaction = trx;
break;
}
}
}
for (OrderLine line : part.getOrderLines()) {
OLATResource resource = line.getOffer().getResource();
String displayName;
if (resource == null) {
displayName = line.getOffer().getResourceDisplayName();
} else {
displayName = acService.resolveDisplayName(resource);
}
OrderItemWrapper wrapper = new OrderItemWrapper(part, line, transaction, displayName, first);
items.add(wrapper);
first = false;
}
}
return new OrderItemsDataModel(items);
}
use of org.olat.resource.accesscontrol.AccessTransaction in project openolat by klemens.
the class TransactionDetailsController method initForm.
@Override
protected void initForm(FormItemContainer formLayout, Controller listener, UserRequest ureq) {
String page = velocity_root + "/transaction_details.html";
FormLayoutContainer detailsLayout = FormLayoutContainer.createCustomFormLayout("transaction-details-layout", getTranslator(), page);
formLayout.add(detailsLayout);
detailsLayout.setRootForm(mainForm);
AccessTransaction transaction = wrapper.getTransaction();
DetailsForm detailsForm = new DetailsForm(ureq, getWindowControl(), transaction, mainForm);
detailsLayout.add("simple", detailsForm.getInitialFormItem());
AccessMethod method = transaction.getMethod();
AccessMethodHandler handler = acModule.getAccessMethodHandler(method.getType());
FormController controller = handler.createTransactionDetailsController(ureq, getWindowControl(), order, wrapper.getPart(), method, mainForm);
if (controller != null) {
uifactory.addSpacerElement("details-spacer", detailsLayout, false);
detailsLayout.add("custom", controller.getInitialFormItem());
}
}
use of org.olat.resource.accesscontrol.AccessTransaction in project openolat by klemens.
the class OrderDetailController method getOrderItemsDataModel.
private OrderItemsDataModel getOrderItemsDataModel() {
List<OrderItemWrapper> items = new ArrayList<OrderItemWrapper>();
for (OrderPart part : order.getParts()) {
boolean first = true;
AccessTransaction transaction = null;
if (transactions != null) {
for (AccessTransaction trx : transactions) {
if (trx.getOrderPart().equals(part)) {
transaction = trx;
break;
}
}
}
for (OrderLine line : part.getOrderLines()) {
OLATResource resource = line.getOffer().getResource();
String displayName;
if (resource == null) {
displayName = line.getOffer().getResourceDisplayName();
} else {
displayName = acService.resolveDisplayName(resource);
}
OrderItemWrapper wrapper = new OrderItemWrapper(part, line, transaction, displayName, first);
items.add(wrapper);
first = false;
}
}
return new OrderItemsDataModel(items);
}
Aggregations