-
Notifications
You must be signed in to change notification settings - Fork 1.2k
/
DefaultDynamicSkuPricingFilter.java
64 lines (54 loc) · 2.34 KB
/
DefaultDynamicSkuPricingFilter.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
/*
* #%L
* BroadleafCommerce Framework Web
* %%
* Copyright (C) 2009 - 2016 Broadleaf Commerce
* %%
* Licensed under the Broadleaf Fair Use License Agreement, Version 1.0
* (the "Fair Use License" located at http://license.broadleafcommerce.org/fair_use_license-1.0.txt)
* unless the restrictions on use therein are violated and require payment to Broadleaf in which case
* the Broadleaf End User License Agreement (EULA), Version 1.1
* (the "Commercial License" located at http://license.broadleafcommerce.org/commercial_license-1.1.txt)
* shall apply.
*
* Alternatively, the Commercial License may be replaced with a mutually agreed upon license (the "Custom License")
* between you and Broadleaf Commerce. You may not use this file except in compliance with the applicable license.
* #L%
*/
package org.broadleafcommerce.core.web.catalog;
import org.broadleafcommerce.core.catalog.service.dynamic.DynamicSkuPricingService;
import org.broadleafcommerce.profile.core.domain.Customer;
import org.broadleafcommerce.profile.web.core.CustomerState;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import java.util.HashMap;
import javax.servlet.ServletRequest;
import javax.servlet.http.HttpServletRequest;
/**
* Register this filter via Spring DelegatingFilterProxy, or register your own implementation
* that provides additional, desirable members to the pricingConsiderations Map
* that is generated from the getPricingConsiderations method.
*
* @author jfischer
*
*/
public class DefaultDynamicSkuPricingFilter extends AbstractDynamicSkuPricingFilter {
@Autowired
@Qualifier("blDynamicSkuPricingService")
protected DynamicSkuPricingService skuPricingService;
@Autowired
@Qualifier("blCustomerState")
protected CustomerState customerState;
@Override
public DynamicSkuPricingService getDynamicSkuPricingService(ServletRequest request) {
return skuPricingService;
}
@Override
@SuppressWarnings({ "rawtypes", "unchecked" })
public HashMap getPricingConsiderations(ServletRequest request) {
HashMap pricingConsiderations = new HashMap();
Customer customer = customerState.getCustomer((HttpServletRequest) request);
pricingConsiderations.put("customer", customer);
return pricingConsiderations;
}
}