public String getDefaultShippingConfirmationTemplate() {
   EngineSetting defaultShippingConfirmationTemplateEngineSetting =
       engineSettingService.getDefaultShippingConfirmationTemplate();
   String defaultShippingConfirmationTemplate =
       defaultShippingConfirmationTemplateEngineSetting.getDefaultValue();
   return defaultShippingConfirmationTemplate;
 }
 private String buildWebPathSegment(final OrderCustomer order) {
   EngineSetting documentWebRootPathEngineSetting = engineSettingService.getDocumentWebRootPath();
   String documentWebRootPath = documentWebRootPathEngineSetting.getDefaultValue();
   if (documentWebRootPath != null && documentWebRootPath.endsWith("/")) {
     documentWebRootPath = documentWebRootPath.substring(0, documentWebRootPath.length() - 1);
   }
   return documentWebRootPath;
 }
 protected File getCountryDataBase() {
   EngineSetting engineSetting = engineSettingService.getSettingGeolocCountryFilePath();
   if (engineSetting != null) {
     final File database = new File(engineSetting.getDefaultValue());
     return database;
   }
   return null;
 }
 public String buildRetailerLogoWebPath(final String logo) throws Exception {
   EngineSetting engineSetting = engineSettingService.getSettingAssetRetailerAndStoreFilePath();
   String prefixPath = "";
   if (engineSetting != null) {
     prefixPath = engineSetting.getDefaultValue();
   }
   String retailerLogoWebPathPrefix = buildRootAssetWebPath() + prefixPath + "/retailer-logo/";
   String retailerLogoWebPath = retailerLogoWebPathPrefix + logo;
   return retailerLogoWebPath;
 }
 private String buildFilePathSegment(final OrderCustomer order) {
   final EngineSetting documentFileRootPathEngineSetting =
       engineSettingService.getDocumentFileRootPath();
   String documentFileRootPath = documentFileRootPathEngineSetting.getDefaultValue();
   String filePathSegment = documentFileRootPath + "/" + order.getPrefixHashFolder() + "/";
   File file = new File(filePathSegment);
   if (!file.exists()) {
     file.mkdirs();
   }
   return filePathSegment;
 }
 protected String buildRootAssetWebPath() throws Exception {
   EngineSetting engineSetting = engineSettingService.getSettingAssetWebRootPath();
   String prefixPath = "";
   if (engineSetting != null) {
     prefixPath = engineSetting.getDefaultValue();
   }
   if (prefixPath.endsWith("/")) {
     prefixPath = prefixPath.substring(0, prefixPath.length() - 1);
   }
   return prefixPath;
 }
 public String getDefaultInvoiceTemplate() {
   EngineSetting defaultInvoiceTemplateEngineSetting =
       engineSettingService.getDefaultInvoiceTemplate();
   String defaultInvoiceTemplate = defaultInvoiceTemplateEngineSetting.getDefaultValue();
   return defaultInvoiceTemplate;
 }
  @RequestMapping("/connect-oauth-google-account.html*")
  public ModelAndView connectGoogleAccount(
      final HttpServletRequest request, final HttpServletResponse response) throws Exception {
    final RequestData requestData = requestUtil.getRequestData(request);

    // SANITY CHECK
    if (!requestUtil.hasKnownCustomerLogged(request)) {
      try {
        // CLIENT ID
        EngineSetting clientIdEngineSetting = engineSettingService.getSettingOAuthAppKeyOrId();
        EngineSettingValue clientIdEngineSettingValue =
            clientIdEngineSetting.getEngineSettingValue(OAuthType.GOOGLE_ACCOUNT.name());

        // CLIENT SECRET
        EngineSetting clientSecretEngineSetting = engineSettingService.getSettingOAuthAppSecret();
        EngineSettingValue clientSecretEngineSettingValue =
            clientSecretEngineSetting.getEngineSettingValue(OAuthType.GOOGLE_ACCOUNT.name());

        // CLIENT PERMISSIONS
        EngineSetting permissionsEngineSetting =
            engineSettingService.getSettingOAuthAppPermissions();
        EngineSettingValue permissionsEngineSettingValue =
            permissionsEngineSetting.getEngineSettingValue(OAuthType.GOOGLE_ACCOUNT.name());

        if (clientIdEngineSettingValue != null
            && clientSecretEngineSetting != null
            && permissionsEngineSettingValue != null) {
          final String clientId = clientIdEngineSettingValue.getValue();
          final String clientSecret = clientSecretEngineSettingValue.getValue();
          final String permissions = permissionsEngineSettingValue.getValue();

          final String googleAccountCallBackURL =
              urlService.buildAbsoluteUrl(
                  requestData,
                  urlService.buildOAuthCallBackUrl(
                      requestData, OAuthType.GOOGLE_ACCOUNT.getPropertyKey().toLowerCase()));

          OAuthService service =
              new ServiceBuilder()
                  .provider(Google2Api.class)
                  .apiKey(clientId)
                  .apiSecret(clientSecret)
                  .scope(permissions)
                  .callback(googleAccountCallBackURL)
                  .build();

          // Obtain the Authorization URL
          String authorizationUrl = service.getAuthorizationUrl(EMPTY_TOKEN);

          response.sendRedirect(authorizationUrl);
        }

      } catch (Exception e) {
        logger.error("Connect With " + OAuthType.GOOGLE_ACCOUNT.name() + " failed!");
      }
    }

    // DEFAULT FALLBACK VALUE
    if (!response.isCommitted()) {
      response.sendRedirect(urlService.generateUrl(FoUrls.LOGIN, requestData));
    }

    return null;
  }