I have a scenario where a seller have following fees configured:
BigDecimal paidPlanFixedFee
BigDecimal fixedFee
Boolean isPaidPlan
Now, if seller has paid plan it should use paidPlanFixedFee while triggering payments and fixedFee if seller is on free plan.
One approach is to change the code everywhere where fixedFee is referred like:
if(paidPlan){
// Use paidPlanFixedFee
}else{
// Use fixedFee
}
Other approach is to change only in the getter method of fixedFee :
BigDecimal getFixedFee(){
if(paidPlan){
// return paidPlanFixedFee
} else{
// return fixedFee
}
}
Is it a good practice to use the getter method approach in this scenario or should it be avoided ?