Search in sources :

Example 6 with CustomerReview

use of com.salesmanager.core.model.customer.review.CustomerReview in project shopizer by shopizer-ecommerce.

the class CustomerFacadeImpl method updateCustomerReview.

@Override
public PersistableCustomerReview updateCustomerReview(Long id, Long reviewId, PersistableCustomerReview review, MerchantStore store, Language language) {
    CustomerReview customerReview = getCustomerReviewById(reviewId);
    if (!customerReview.getReviewedCustomer().getId().equals(id)) {
        throw new ResourceNotFoundException("Customer review with id " + reviewId + " does not exist for this customer");
    }
    // rating maximum 5
    if (review.getRating() > Constants.MAX_REVIEW_RATING_SCORE) {
        throw new ServiceRuntimeException("Maximum rating score is " + Constants.MAX_REVIEW_RATING_SCORE);
    }
    review.setReviewedCustomer(id);
    return review;
}
Also used : ResourceNotFoundException(com.salesmanager.shop.store.api.exception.ResourceNotFoundException) ReadableCustomerReview(com.salesmanager.shop.model.customer.ReadableCustomerReview) CustomerReview(com.salesmanager.core.model.customer.review.CustomerReview) PersistableCustomerReview(com.salesmanager.shop.model.customer.PersistableCustomerReview) ServiceRuntimeException(com.salesmanager.shop.store.api.exception.ServiceRuntimeException)

Aggregations

CustomerReview (com.salesmanager.core.model.customer.review.CustomerReview)6 PersistableCustomerReview (com.salesmanager.shop.model.customer.PersistableCustomerReview)6 ReadableCustomerReview (com.salesmanager.shop.model.customer.ReadableCustomerReview)5 ConversionException (com.salesmanager.core.business.exception.ConversionException)3 ResourceNotFoundException (com.salesmanager.shop.store.api.exception.ResourceNotFoundException)3 Customer (com.salesmanager.core.model.customer.Customer)2 Language (com.salesmanager.core.model.reference.language.Language)2 PersistableCustomerReviewPopulator (com.salesmanager.shop.populator.customer.PersistableCustomerReviewPopulator)2 ConversionRuntimeException (com.salesmanager.shop.store.api.exception.ConversionRuntimeException)2 ServiceRuntimeException (com.salesmanager.shop.store.api.exception.ServiceRuntimeException)2 ServiceException (com.salesmanager.core.business.exception.ServiceException)1 Email (com.salesmanager.core.business.modules.email.Email)1 CustomerService (com.salesmanager.core.business.services.customer.CustomerService)1 CustomerOptinService (com.salesmanager.core.business.services.customer.optin.CustomerOptinService)1 CustomerReviewService (com.salesmanager.core.business.services.customer.review.CustomerReviewService)1 CountryService (com.salesmanager.core.business.services.reference.country.CountryService)1 LanguageService (com.salesmanager.core.business.services.reference.language.LanguageService)1 ZoneService (com.salesmanager.core.business.services.reference.zone.ZoneService)1 ShoppingCartService (com.salesmanager.core.business.services.shoppingcart.ShoppingCartService)1 EmailService (com.salesmanager.core.business.services.system.EmailService)1