Search in sources :

Example 11 with PaypalTransaction

use of org.olat.resource.accesscontrol.provider.paypal.model.PaypalTransaction in project OpenOLAT by OpenOLAT.

the class PaypalManagerImpl method updateTransactionByNotification.

@Override
public void updateTransactionByNotification(Map<String, String> values, boolean verified) {
    if (verified) {
        // CREATED - The payment request was received; funds will be transferred
        // COMPLETED - The payment was successful
        // INCOMPLETE - Some transfers succeeded and some failed for a parallel payment or, for a delayed chained payment, secondary receivers have not been paid
        // ERROR - The payment failed and all attempted transfers failed or all
        // REVERSALERROR - One or more transfers failed when attempting to
        // PROCESSING - The payment is in progress
        // PENDING - The payment is awaiting processing
        // String status = values.get("status");
        // if("COMPLETED".equals(status))
        String invoiceId = values.get("transaction[0].invoiceId");
        PaypalTransaction trx = loadTransactionByInvoiceId(invoiceId);
        if (trx != null) {
            completeTransaction(trx, values);
        } else {
            log.error("Paypal IPN Transaction not found: " + values, null);
        }
    } else {
        String invoiceId = values.get("transaction[0].invoiceId");
        log.error("Paypal IPN Transaction not verified: " + invoiceId + " raw values: " + values, null);
    }
}
Also used : PaypalTransaction(org.olat.resource.accesscontrol.provider.paypal.model.PaypalTransaction)

Example 12 with PaypalTransaction

use of org.olat.resource.accesscontrol.provider.paypal.model.PaypalTransaction in project OpenOLAT by OpenOLAT.

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 13 with PaypalTransaction

use of org.olat.resource.accesscontrol.provider.paypal.model.PaypalTransaction in project OpenOLAT by OpenOLAT.

the class PaypalManagerImpl method updateTransaction.

@Override
public void updateTransaction(String uuid) {
    PaypalTransaction trx = loadTransactionByUUID(uuid);
    if (uuid.equals(trx.getSecureSuccessUUID())) {
        log.audit("Paypal transaction success: " + trx);
        completeTransaction(trx, null);
    } else if (uuid.equals(trx.getSecureCancelUUID())) {
        // cancel -> return to the access panel
        log.audit("Paypal transaction canceled by user: " + trx);
        cancelTransaction(trx);
    }
}
Also used : PaypalTransaction(org.olat.resource.accesscontrol.provider.paypal.model.PaypalTransaction)

Example 14 with PaypalTransaction

use of org.olat.resource.accesscontrol.provider.paypal.model.PaypalTransaction in project OpenOLAT by OpenOLAT.

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)

Example 15 with PaypalTransaction

use of org.olat.resource.accesscontrol.provider.paypal.model.PaypalTransaction in project OpenOLAT by OpenOLAT.

the class PaypalTransactionsController method formInnerEvent.

@Override
protected void formInnerEvent(UserRequest ureq, FormItem source, FormEvent event) {
    if (source == backLink) {
        if (detailsController != null) {
            flc.remove(detailsController.getInitialComponent());
            removeAsListenerAndDispose(detailsController);
        }
        addSearchToHistory(ureq);
    } else if (source == tableEl) {
        if (event instanceof SelectionEvent) {
            SelectionEvent se = (SelectionEvent) event;
            PaypalTransaction row = dataModel.getObject(se.getIndex());
            if (CMD_SELECT.equals(se.getCommand())) {
                doSelectTransaction(ureq, row);
            }
        } else if (event instanceof FlexiTableSearchEvent) {
            FlexiTableSearchEvent se = (FlexiTableSearchEvent) event;
            doSearch(ureq, se.getSearch());
        }
    }
    super.formInnerEvent(ureq, source, event);
}
Also used : PaypalTransaction(org.olat.resource.accesscontrol.provider.paypal.model.PaypalTransaction) SelectionEvent(org.olat.core.gui.components.form.flexible.impl.elements.table.SelectionEvent) FlexiTableSearchEvent(org.olat.core.gui.components.form.flexible.impl.elements.table.FlexiTableSearchEvent)

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