use of org.olat.resource.accesscontrol.provider.paypal.model.PaypalTransaction in project OpenOLAT by OpenOLAT.
the class PaypalTransactionsController method activate.
@Override
public void activate(UserRequest ureq, List<ContextEntry> entries, StateEntry state) {
if (state instanceof StateMapped) {
StateMapped map = (StateMapped) state;
String transactionId = map.getDelegate().get("transactionId");
if (StringHelper.containsNonWhitespace(transactionId)) {
tableEl.quickSearch(ureq, transactionId);
}
}
if (entries == null || entries.isEmpty())
return;
Long trxId = entries.get(0).getOLATResourceable().getResourceableId();
PaypalTransaction trx = dataModel.getTransaction(trxId);
if (trx != null) {
doSelectTransaction(ureq, trx);
}
}
use of org.olat.resource.accesscontrol.provider.paypal.model.PaypalTransaction in project openolat by klemens.
the class PaypalAccessHandler method createTransactionDetailsController.
@Override
public FormController createTransactionDetailsController(UserRequest ureq, WindowControl wControl, Order order, OrderPart part, AccessMethod method, Form form) {
PaypalManager paypalManager = CoreSpringFactory.getImpl(PaypalManager.class);
PaypalTransaction transaction = paypalManager.loadTransaction(order, part);
return new PaypalTransactionDetailsController(ureq, wControl, transaction, form);
}
use of org.olat.resource.accesscontrol.provider.paypal.model.PaypalTransaction in project openolat by klemens.
the class PaypalManagerImpl method createAndPersistTransaction.
/*
* @return
*/
private PaypalTransaction createAndPersistTransaction(Price amount, Order order, OrderPart part, AccessMethod method) {
PaypalTransaction transaction = new PaypalTransaction();
transaction.setRefNo(order.getOrderNr());
transaction.setSecureSuccessUUID(UUID.randomUUID().toString().replace("-", ""));
transaction.setSecureCancelUUID(UUID.randomUUID().toString().replace("-", ""));
transaction.setStatus(PaypalTransactionStatus.NEW);
transaction.setOrderId(order.getKey());
transaction.setOrderPartId(part.getKey());
transaction.setMethodId(method.getKey());
transaction.setSecurePrice(amount);
dbInstance.saveObject(transaction);
return transaction;
}
use of org.olat.resource.accesscontrol.provider.paypal.model.PaypalTransaction in project openolat by klemens.
the class PaypalAccessController method initForm.
@Override
protected void initForm(FormItemContainer formLayout, Controller listener, UserRequest ureq) {
setFormTitle("access.paypal.title");
setFormDescription("access.paypal.desc");
setFormTitleIconCss("o_icon o_icon-fw " + PaypalAccessHandler.METHOD_CSS_CLASS + "_icon");
String uuid = (String) ureq.getUserSession().getEntry("paypal-uuid");
if (StringHelper.containsNonWhitespace(uuid)) {
PaypalTransaction transaction = paypalManager.loadTransactionByUUID(uuid);
PaypalTransactionStatus status = transaction.getStatus();
if (status == PaypalTransactionStatus.CANCELED) {
setFormWarning("paypal.cancelled.transaction");
} else if (status == PaypalTransactionStatus.ERROR) {
setFormWarning("paypal.error.transaction");
}
}
String description = link.getOffer().getDescription();
if (StringHelper.containsNonWhitespace(description)) {
description = StringHelper.xssScan(description);
uifactory.addStaticTextElement("offer.description", description, formLayout);
}
Price price = link.getOffer().getPrice();
String priceStr = PriceFormat.fullFormat(price);
uifactory.addStaticTextElement("offer.price", priceStr, formLayout);
final FormLayoutContainer buttonGroupLayout = FormLayoutContainer.createButtonLayout("buttonLayout", getTranslator());
buttonGroupLayout.setRootForm(mainForm);
formLayout.add(buttonGroupLayout);
uifactory.addFormSubmitButton("access.button", formLayout);
}
use of org.olat.resource.accesscontrol.provider.paypal.model.PaypalTransaction in project openolat by klemens.
the class PaypalTransactionDataModel method filter.
@Override
public void filter(List<FlexiTableFilter> filters) {
String key = filters == null || filters.isEmpty() || filters.get(0) == null ? null : filters.get(0).getFilter();
if (StringHelper.containsNonWhitespace(key)) {
List<PaypalTransaction> filteredRows = new ArrayList<>(backups.size());
if (PaypalMergedState.isValueOf(key)) {
PaypalMergedState filterState = PaypalMergedState.valueOf(key);
for (PaypalTransaction row : backups) {
if (PaypalMergedState.value(row) == filterState) {
filteredRows.add(row);
}
}
} else {
filteredRows.addAll(backups);
}
super.setObjects(filteredRows);
} else {
super.setObjects(backups);
}
}
Aggregations