Search in sources :

Example 1 with PaypalTransactionStatus

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

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 2 with PaypalTransactionStatus

use of org.olat.resource.accesscontrol.provider.paypal.model.PaypalTransactionStatus 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)

Aggregations

FormLayoutContainer (org.olat.core.gui.components.form.flexible.impl.FormLayoutContainer)2 Price (org.olat.resource.accesscontrol.Price)2 PaypalTransaction (org.olat.resource.accesscontrol.provider.paypal.model.PaypalTransaction)2 PaypalTransactionStatus (org.olat.resource.accesscontrol.provider.paypal.model.PaypalTransactionStatus)2