Search in sources :

Example 16 with PaypalTransaction

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);
    }
}
Also used : PaypalTransaction(org.olat.resource.accesscontrol.provider.paypal.model.PaypalTransaction) StateMapped(org.olat.core.id.context.StateMapped)

Example 17 with PaypalTransaction

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);
}
Also used : PaypalManager(org.olat.resource.accesscontrol.provider.paypal.manager.PaypalManager) PaypalTransaction(org.olat.resource.accesscontrol.provider.paypal.model.PaypalTransaction) PaypalTransactionDetailsController(org.olat.resource.accesscontrol.provider.paypal.ui.PaypalTransactionDetailsController)

Example 18 with PaypalTransaction

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;
}
Also used : PaypalTransaction(org.olat.resource.accesscontrol.provider.paypal.model.PaypalTransaction)

Example 19 with PaypalTransaction

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);
}
Also used : PaypalTransaction(org.olat.resource.accesscontrol.provider.paypal.model.PaypalTransaction) PaypalTransactionStatus(org.olat.resource.accesscontrol.provider.paypal.model.PaypalTransactionStatus) Price(org.olat.resource.accesscontrol.Price) FormLayoutContainer(org.olat.core.gui.components.form.flexible.impl.FormLayoutContainer)

Example 20 with PaypalTransaction

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);
    }
}
Also used : PaypalTransaction(org.olat.resource.accesscontrol.provider.paypal.model.PaypalTransaction) ArrayList(java.util.ArrayList)

Aggregations

PaypalTransaction (org.olat.resource.accesscontrol.provider.paypal.model.PaypalTransaction)20 Price (org.olat.resource.accesscontrol.Price)4 ClientActionRequiredException (com.paypal.exception.ClientActionRequiredException)2 HttpErrorException (com.paypal.exception.HttpErrorException)2 InvalidCredentialException (com.paypal.exception.InvalidCredentialException)2 InvalidResponseDataException (com.paypal.exception.InvalidResponseDataException)2 MissingCredentialException (com.paypal.exception.MissingCredentialException)2 SSLConfigurationException (com.paypal.exception.SSLConfigurationException)2 OAuthException (com.paypal.sdk.exceptions.OAuthException)2 AdaptivePaymentsService (com.paypal.svcs.services.AdaptivePaymentsService)2 PayRequest (com.paypal.svcs.types.ap.PayRequest)2 PayResponse (com.paypal.svcs.types.ap.PayResponse)2 Receiver (com.paypal.svcs.types.ap.Receiver)2 ReceiverList (com.paypal.svcs.types.ap.ReceiverList)2 IOException (java.io.IOException)2 UnsupportedEncodingException (java.io.UnsupportedEncodingException)2 ArrayList (java.util.ArrayList)2 FormLayoutContainer (org.olat.core.gui.components.form.flexible.impl.FormLayoutContainer)2 FlexiTableSearchEvent (org.olat.core.gui.components.form.flexible.impl.elements.table.FlexiTableSearchEvent)2 SelectionEvent (org.olat.core.gui.components.form.flexible.impl.elements.table.SelectionEvent)2