Exemplo n.º 1
0
  @Override
  protected boolean isRSSFeedsEnabled(HttpServletRequest request) throws Exception {

    SettingsFactory settingsFactory = SettingsFactoryUtil.getSettingsFactory();

    ThemeDisplay themeDisplay = (ThemeDisplay) request.getAttribute(WebKeys.THEME_DISPLAY);

    BlogsGroupServiceSettings rssBlogsGroupServiceSettings =
        settingsFactory.getSettings(
            BlogsGroupServiceSettings.class,
            new GroupServiceSettingsLocator(
                themeDisplay.getSiteGroupId(), BlogsConstants.SERVICE_NAME));

    return rssBlogsGroupServiceSettings.enableRss();
  }
Exemplo n.º 2
0
  protected void forwardCheckout(
      ActionRequest actionRequest, ActionResponse actionResponse, ShoppingOrder order)
      throws Exception {

    ThemeDisplay themeDisplay = (ThemeDisplay) actionRequest.getAttribute(WebKeys.THEME_DISPLAY);

    ShoppingCart cart = ShoppingUtil.getCart(actionRequest);

    ShoppingWebComponentProvider shoppingWebComponentProvider =
        ShoppingWebComponentProvider.getShoppingWebComponentProvider();

    SettingsFactory settingsFactory = shoppingWebComponentProvider.getSettingsFactory();

    ShoppingGroupServiceSettings shoppingGroupServiceSettings =
        settingsFactory.getSettings(
            ShoppingGroupServiceSettings.class,
            new GroupServiceSettingsLocator(
                themeDisplay.getScopeGroupId(), ShoppingConstants.SERVICE_NAME));

    String returnURL =
        ShoppingUtil.getPayPalReturnURL(
            ((ActionResponseImpl) actionResponse).createActionURL(), order);
    String notifyURL = ShoppingUtil.getPayPalNotifyURL(themeDisplay);

    if (shoppingGroupServiceSettings.usePayPal()) {
      double total =
          ShoppingUtil.calculateTotal(
              cart.getItems(),
              order.getBillingState(),
              cart.getCoupon(),
              cart.getAltShipping(),
              cart.isInsure());

      String redirectURL =
          ShoppingUtil.getPayPalRedirectURL(
              shoppingGroupServiceSettings, order, total, returnURL, notifyURL);

      actionResponse.sendRedirect(redirectURL);
    } else {
      ServiceContext serviceContext = ServiceContextFactory.getInstance(actionRequest);

      ShoppingOrderLocalServiceUtil.sendEmail(order, "confirmation", serviceContext);

      actionResponse.sendRedirect(returnURL);
    }
  }