Class DefaultB2BCreditLimitEvaluationStrategy
java.lang.Object
de.hybris.platform.b2b.strategies.impl.AbstractEvaluationStrategy<B2BCreditLimitModel>
de.hybris.platform.b2b.strategies.impl.DefaultB2BCreditLimitEvaluationStrategy
- All Implemented Interfaces:
EvaluateStrategy<Set<B2BMerchantCheckResultModel>,AbstractOrderModel, B2BCustomerModel>
public class DefaultB2BCreditLimitEvaluationStrategy
extends AbstractEvaluationStrategy<B2BCreditLimitModel>
implements EvaluateStrategy<Set<B2BMerchantCheckResultModel>,AbstractOrderModel,B2BCustomerModel>
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected booleanalertSent(B2BCreditLimitModel creditLimit, StandardDateRange creditLimitDateRange) To determine if credit limit alert is already sent for current date range periodevaluate(AbstractOrderModel order, B2BCustomerModel customer) Evaluate.protected B2BCurrencyConversionServiceprotected B2BDateUtilsprotected B2BOrderDaoprotected B2BUnitService<B2BUnitModel,B2BCustomerModel> protected List<B2BCostCenterModel>getCostCentersForUnitWithCreditLimit(B2BUnitModel unit, CurrencyModel currency) protected B2BCreditLimitModelgetCreditLimitForCostCenter(B2BCostCenterModel costCenter, CurrencyModel currency) protected StandardDateRangegetDateRangeForCreditLimit(B2BCreditLimitModel creditLimit) protected BigDecimalprotected DoublegetTotalCost(List<B2BCostCenterModel> costCenters, StandardDateRange standardDateRange) protected BigDecimalgetTotalOfEntriesWithCostCenter(B2BCostCenterModel costCenter, List<AbstractOrderEntryModel> entries) protected BigDecimalgetTotalTax(AbstractOrderEntryModel orderEntry) getTypesToEvaluate(B2BCustomerModel customer, AbstractOrderModel order) voidsetB2bCostCenterService(B2BCostCenterService b2bCostCenterService) voidsetB2bCurrencyConversionService(B2BCurrencyConversionService b2bCurrencyConversionService) voidsetB2bDateUtils(B2BDateUtils b2bDateUtils) voidsetB2bOrderDao(B2BOrderDao b2bOrderDao) voidsetB2bUnitService(B2BUnitService<B2BUnitModel, B2BCustomerModel> b2bUnitService) protected booleanshouldCreditLimitTriggerAlert(BigDecimal orderTotals, B2BCreditLimitModel creditLimit, StandardDateRange creditLimitDateRange) To determine if an alert is to be sent to the B2BCustomer based on exceeding a limit and alertSentDate and update alertSentDateprotected BigDecimalMethods inherited from class de.hybris.platform.b2b.strategies.impl.AbstractEvaluationStrategy
getModelService, getTypeService, setModelService, setTypeService
-
Constructor Details
-
DefaultB2BCreditLimitEvaluationStrategy
public DefaultB2BCreditLimitEvaluationStrategy()
-
-
Method Details
-
evaluate
public Set<B2BMerchantCheckResultModel> evaluate(AbstractOrderModel order, B2BCustomerModel customer) Description copied from interface:EvaluateStrategyEvaluate.- Specified by:
evaluatein interfaceEvaluateStrategy<Set<B2BMerchantCheckResultModel>,AbstractOrderModel, B2BCustomerModel> - Parameters:
order- the AbstractOrderModelcustomer- the B2BCustomerModel- Returns:
- the B2BPermissionResultModel
-
getCreditLimitForCostCenter
protected B2BCreditLimitModel getCreditLimitForCostCenter(B2BCostCenterModel costCenter, CurrencyModel currency) -
getCostCentersForUnitWithCreditLimit
protected List<B2BCostCenterModel> getCostCentersForUnitWithCreditLimit(B2BUnitModel unit, CurrencyModel currency) -
getTotalOfEntriesWithCostCenter
protected BigDecimal getTotalOfEntriesWithCostCenter(B2BCostCenterModel costCenter, List<AbstractOrderEntryModel> entries) -
getOrderEntryTotal
-
getTotalTax
-
getTotalCost
protected Double getTotalCost(List<B2BCostCenterModel> costCenters, StandardDateRange standardDateRange) -
getTypesToEvaluate
public Set<B2BCreditLimitModel> getTypesToEvaluate(B2BCustomerModel customer, AbstractOrderModel order) - Specified by:
getTypesToEvaluatein classAbstractEvaluationStrategy<B2BCreditLimitModel>
-
shouldCreditLimitTriggerAlert
protected boolean shouldCreditLimitTriggerAlert(BigDecimal orderTotals, B2BCreditLimitModel creditLimit, StandardDateRange creditLimitDateRange) To determine if an alert is to be sent to the B2BCustomer based on exceeding a limit and alertSentDate and update alertSentDate- Parameters:
orderTotals- the total amount of all orderscreditLimit- the limit type (currency or percentage) which also provides the limit amount- Returns:
- true if the credit limit has been exceeded
-
alertSent
protected boolean alertSent(B2BCreditLimitModel creditLimit, StandardDateRange creditLimitDateRange) To determine if credit limit alert is already sent for current date range period- Parameters:
creditLimit- Current credit limit to work oncreditLimitDateRange- Date range for current credit limit- Returns:
- true if the credit limit alert check should be avoided
-
getDateRangeForCreditLimit
-
toMoney
-
setB2bUnitService
-
setB2bCurrencyConversionService
public void setB2bCurrencyConversionService(B2BCurrencyConversionService b2bCurrencyConversionService) -
getB2bCurrencyConversionService
-
getB2bUnitService
-
getB2bOrderDao
-
setB2bOrderDao
-
getB2bCostCenterService
-
setB2bCostCenterService
-
getB2bDateUtils
-
setB2bDateUtils
-