Created
August 16, 2020 13:24
-
-
Save yusufcakal/578118eb6a873c112ba577fac1a70b2e to your computer and use it in GitHub Desktop.
SellerCenterService
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Service | |
public class SellerCenterService { | |
private final List<SellerLabelProcessor> sellerLabelProcessors; | |
public SellerCenterService(List<SellerLabelProcessor> sellerLabelProcessors) { | |
this.sellerLabelProcessors = sellerLabelProcessors; | |
} | |
public SellerCenterLabel getSellerCenterLabel(Seller seller) { | |
final SellerLabel sellerLabel = sellerLabelProcessors.stream() | |
.map(sellerLabelProcessor -> sellerLabelProcessor.getSellerLabel(seller.getSellCount())) | |
.filter(SellerLabel::isSellerLabelNotNewSeller) | |
.findFirst() | |
.orElse(SellerLabel.NEW_SELLER); | |
if (sellerLabel.isSellerLabelOne() && seller.getPreviousSellerLabel().isSellerLabelTwenty()) { | |
return SellerCenterLabel.getSellerCenterLabel(SellerLabel.SELLER_5); | |
} | |
return SellerCenterLabel.getSellerCenterLabel(sellerLabel); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment