| Line 509... |
Line 509... |
| 509 |
return fofoOrderItemSchemsMap;
|
509 |
return fofoOrderItemSchemsMap;
|
| 510 |
}
|
510 |
}
|
| 511 |
|
511 |
|
| 512 |
@Override
|
512 |
@Override
|
| 513 |
public void processSchemeIn(int purchaseId, int retailerId) throws ProfitMandiBusinessException {
|
513 |
public void processSchemeIn(int purchaseId, int retailerId) throws ProfitMandiBusinessException {
|
| - |
|
514 |
LOGGER.info("Trying to process SchemeIn with purchaseId [{}] and retailerId [{}]", purchaseId, retailerId);
|
| 514 |
Purchase purchase = purchaseRepository.selectByIdAndFofoId(purchaseId, retailerId);
|
515 |
Purchase purchase = purchaseRepository.selectByIdAndFofoId(purchaseId, retailerId);
|
| - |
|
516 |
LOGGER.info("purchase is completed = {}", (purchase.getCompleteTimestamp() != null));
|
| 515 |
if(purchase.getCompleteTimestamp() != null) {
|
517 |
if(purchase.getCompleteTimestamp() != null) {
|
| 516 |
List<Order> orders = orderRepository.selectByAirwayBillOrInvoiceNumber(purchase.getPurchaseReference(), retailerId);
|
518 |
List<Order> orders = orderRepository.selectByAirwayBillOrInvoiceNumber(purchase.getPurchaseReference(), retailerId);
|
| 517 |
LocalDateTime billingTimestamp = LocalDateTime.now();
|
519 |
LocalDateTime billingTimestamp = LocalDateTime.now();
|
| 518 |
if(!orders.isEmpty()){
|
520 |
if(!orders.isEmpty()){
|
| 519 |
billingTimestamp = orders.get(0).getBillingTimestamp();
|
521 |
billingTimestamp = orders.get(0).getBillingTimestamp();
|
| Line 596... |
Line 598... |
| 596 |
}
|
598 |
}
|
| 597 |
for(Map.Entry<Integer, Float> itemIdCashbackEntry : itemIdCashbackMap.entrySet()){
|
599 |
for(Map.Entry<Integer, Float> itemIdCashbackEntry : itemIdCashbackMap.entrySet()){
|
| 598 |
walletService.addAmountToWallet(retailerId, purchaseId, WalletReferenceType.SCHEME_IN,
|
600 |
walletService.addAmountToWallet(retailerId, purchaseId, WalletReferenceType.SCHEME_IN,
|
| 599 |
itemIdCashbackCountMap.get(itemIdCashbackEntry.getKey())+"pcs of item "+
|
601 |
itemIdCashbackCountMap.get(itemIdCashbackEntry.getKey())+"pcs of item "+
|
| 600 |
itemStringMap.get(itemIdCashbackEntry.getKey()) +
|
602 |
itemStringMap.get(itemIdCashbackEntry.getKey()) +
|
| 601 |
" Added for SCHEME_IN against invoiceNumber ["+purchase.getPurchaseReference()+"]", totalCashback);
|
603 |
" Added for SCHEME_IN against invoiceNumber ["+purchase.getPurchaseReference()+"]", itemIdCashbackEntry.getValue());
|
| 602 |
}
|
604 |
}
|
| 603 |
purchase.setCashback(totalCashback);
|
605 |
purchase.setCashback(totalCashback);
|
| 604 |
purchaseRepository.persist(purchase);
|
606 |
purchaseRepository.persist(purchase);
|
| 605 |
}
|
607 |
}
|
| 606 |
}
|
608 |
}
|