| Line 821... |
Line 821... |
| 821 |
RandomCollection<ScratchedGift> giftRandomCollection = createDynamicGiftSeries(scratchOfferCountMap, purchaseAmount, fofoId);
|
821 |
RandomCollection<ScratchedGift> giftRandomCollection = createDynamicGiftSeries(scratchOfferCountMap, purchaseAmount, fofoId);
|
| 822 |
|
822 |
|
| 823 |
if (giftRandomCollection.size() > 0) {
|
823 |
if (giftRandomCollection.size() > 0) {
|
| 824 |
ScratchedGift selectedGift = giftRandomCollection.next();
|
824 |
ScratchedGift selectedGift = giftRandomCollection.next();
|
| 825 |
|
825 |
|
| 826 |
// 🛑 Ensure one LED for 175139615 and one Oven for 175139583
|
826 |
// Ensure one LED for 175139615 and one Oven for 175139583
|
| 827 |
if (selectedGift == ScratchedGift.LED || selectedGift == ScratchedGift.MICROWAVE_OVEN) {
|
827 |
if (selectedGift == ScratchedGift.LED || selectedGift == ScratchedGift.MICROWAVE_OVEN) {
|
| 828 |
if (!PREMIUM_ELIGIBLE_PARTNERS.contains(fofoId)) {
|
828 |
if (!PREMIUM_ELIGIBLE_PARTNERS.contains(fofoId)) {
|
| 829 |
LOGGER.info("Partner {} not eligible for {}", fofoId, selectedGift);
|
829 |
LOGGER.info("Partner {} not eligible for {}", fofoId, selectedGift);
|
| 830 |
return ScratchedGift.ACCESSORIES_50_PERCENT_OFF; // Default alternate gift
|
830 |
return ScratchedGift.ACCESSORIES_50_PERCENT_OFF; // Default alternate gift
|
| 831 |
}
|
831 |
}
|
| Line 845... |
Line 845... |
| 845 |
LOGGER.info("Both LED and Microwave Oven already given today.");
|
845 |
LOGGER.info("Both LED and Microwave Oven already given today.");
|
| 846 |
return ScratchedGift.ACCESSORIES_50_PERCENT_OFF;
|
846 |
return ScratchedGift.ACCESSORIES_50_PERCENT_OFF;
|
| 847 |
}
|
847 |
}
|
| 848 |
}
|
848 |
}
|
| 849 |
|
849 |
|
| 850 |
// 🛑 Ensure only one Neckband per partner per day
|
850 |
// Ensure only one Neckband per partner per day
|
| 851 |
if (selectedGift == ScratchedGift.NECK_BAND) {
|
851 |
if (selectedGift == ScratchedGift.NECK_BAND) {
|
| 852 |
List<FofoOrder> fofoOrders = fofoOrderRepository.selectByFofoId(fofoId, startDateTime, endDateTime, 0, 0);
|
852 |
List<FofoOrder> fofoOrders = fofoOrderRepository.selectByFofoId(fofoId, startDateTime, endDateTime, 0, 0);
|
| 853 |
List<String> invoiceNumbers = fofoOrders.stream().map(FofoOrder::getInvoiceNumber).collect(Collectors.toList());
|
853 |
List<String> invoiceNumbers = fofoOrders.stream().map(FofoOrder::getInvoiceNumber).collect(Collectors.toList());
|
| 854 |
List<ScratchOffer> offers = scratchOfferRepository.selectByInvoiceNumbers(invoiceNumbers);
|
854 |
List<ScratchOffer> offers = scratchOfferRepository.selectByInvoiceNumbers(invoiceNumbers);
|
| 855 |
LOGGER.info("offers for partner {}", offers);
|
855 |
LOGGER.info("offers for partner {}", offers);
|