use of org.olat.resource.accesscontrol.Offer in project openolat by klemens.
the class PaypalManagerImpl method buildLogMessage.
private String buildLogMessage(OrderLine line, PaypalAccessMethod method) {
StringBuilder sb = new StringBuilder();
Offer offer = line.getOffer();
sb.append("OrderLine[key=").append(line.getKey()).append("]").append("[method=").append(method.getClass().getSimpleName()).append("]");
if (offer == null) {
sb.append("[resource=null]");
} else {
sb.append("[resource=").append(offer.getResourceId()).append(":").append(offer.getResourceTypeName()).append(":").append(offer.getResourceDisplayName()).append("]");
}
return sb.toString();
}
use of org.olat.resource.accesscontrol.Offer in project openolat by klemens.
the class PaypalAccessConfigurationController method commitChanges.
@Override
public OfferAccess commitChanges() {
BigDecimal amount = new BigDecimal(priceEl.getValue());
String currencyCode = currencyEl.getSelectedKey();
PriceImpl price = new PriceImpl();
price.setAmount(amount);
price.setCurrencyCode(currencyCode);
Offer offer = link.getOffer();
offer.setPrice(price);
offer.setDescription(descEl.getValue());
offer.setValidFrom(dateFrom.getDate());
offer.setValidTo(dateTo.getDate());
link.setValidFrom(dateFrom.getDate());
link.setValidTo(dateTo.getDate());
return link;
}
use of org.olat.resource.accesscontrol.Offer in project openolat by klemens.
the class TokenAccessConfigurationController method commitChanges.
@Override
public OfferAccess commitChanges() {
Offer offer = link.getOffer();
if (offer instanceof OfferImpl) {
((OfferImpl) offer).setToken(tokenEl.getValue());
}
offer.setDescription(descEl.getValue());
offer.setValidFrom(dateFrom.getDate());
offer.setValidTo(dateTo.getDate());
link.setValidFrom(dateFrom.getDate());
link.setValidTo(dateTo.getDate());
return link;
}
use of org.olat.resource.accesscontrol.Offer in project openolat by klemens.
the class AccessConfigurationController method addMethod.
protected void addMethod(UserRequest ureq, AccessMethod method) {
boolean confirmationEmail = confirmationEmailEl.isVisible() && confirmationEmailEl.isAtLeastSelected(1);
Offer offer = acService.createOffer(resource, displayName);
offer.setConfirmationEmail(confirmationEmail);
OfferAccess link = acService.createOfferAccess(offer, method);
removeAsListenerAndDispose(newMethodCtrl);
AccessMethodHandler handler = acModule.getAccessMethodHandler(link.getMethod().getType());
if (handler != null) {
newMethodCtrl = handler.createConfigurationController(ureq, getWindowControl(), link);
}
if (newMethodCtrl != null) {
listenTo(newMethodCtrl);
String title = handler.getMethodName(getLocale());
cmc = new CloseableModalController(getWindowControl(), translate("close"), newMethodCtrl.getInitialComponent(), true, title);
cmc.activate();
listenTo(cmc);
} else {
OfferAccess newLink = acService.saveOfferAccess(link);
addConfiguration(newLink);
}
}
use of org.olat.resource.accesscontrol.Offer in project openolat by klemens.
the class AccessConfigurationController method setConfirmationEmail.
private void setConfirmationEmail(boolean confirmationEmail) {
for (AccessInfo info : confControllers) {
Offer offer = info.getLink().getOffer();
offer.setConfirmationEmail(confirmationEmail);
offer = acService.save(offer);
}
// make sure all is on the dabatase
dbInstance.commit();
confControllers.clear();
loadConfigurations();
}
Aggregations