| Line 40... |
Line 40... |
| 40 |
import com.spice.profitmandi.service.integrations.zest.InsuranceService;
|
40 |
import com.spice.profitmandi.service.integrations.zest.InsuranceService;
|
| 41 |
import com.spice.profitmandi.service.integrations.zest.MobileInsurancePlan;
|
41 |
import com.spice.profitmandi.service.integrations.zest.MobileInsurancePlan;
|
| 42 |
import com.spice.profitmandi.service.order.BulkOrderService;
|
42 |
import com.spice.profitmandi.service.order.BulkOrderService;
|
| 43 |
import com.spice.profitmandi.service.order.OrderService;
|
43 |
import com.spice.profitmandi.service.order.OrderService;
|
| 44 |
import com.spice.profitmandi.service.pricing.PricingService;
|
44 |
import com.spice.profitmandi.service.pricing.PricingService;
|
| - |
|
45 |
import com.spice.profitmandi.service.transaction.SDCreditService;
|
| 45 |
import com.spice.profitmandi.service.transaction.TransactionService;
|
46 |
import com.spice.profitmandi.service.transaction.TransactionService;
|
| 46 |
import com.spice.profitmandi.service.user.RetailerService;
|
47 |
import com.spice.profitmandi.service.user.RetailerService;
|
| 47 |
import com.spice.profitmandi.service.wallet.WalletService;
|
48 |
import com.spice.profitmandi.service.wallet.WalletService;
|
| 48 |
import com.spice.profitmandi.service.whatsapp.WhatsappMessageService;
|
49 |
import com.spice.profitmandi.service.whatsapp.WhatsappMessageService;
|
| 49 |
import com.spice.profitmandi.service.whatsapp.WhatsappMessageType;
|
50 |
import com.spice.profitmandi.service.whatsapp.WhatsappMessageType;
|
| Line 1534... |
Line 1535... |
| 1534 |
model.addAttribute("response1", mvcResponseSender.createResponseString(true));
|
1535 |
model.addAttribute("response1", mvcResponseSender.createResponseString(true));
|
| 1535 |
return "response";
|
1536 |
return "response";
|
| 1536 |
|
1537 |
|
| 1537 |
}
|
1538 |
}
|
| 1538 |
|
1539 |
|
| - |
|
1540 |
@Autowired
|
| - |
|
1541 |
SDCreditService sdCreditService;
|
| - |
|
1542 |
|
| 1539 |
private void updateApprovalStatus(int transactionId, int approvalId, String approvedBy, LocalDateTime approvedOn, String remark, TransactionApprovalStatus transactionApprovalStatus) throws Exception {
|
1543 |
private void updateApprovalStatus(int transactionId, int approvalId, String approvedBy, LocalDateTime approvedOn, String remark, TransactionApprovalStatus transactionApprovalStatus) throws Exception {
|
| 1540 |
TransactionApproval transactionApproval = transactionApprovalRepository.selectById(transactionId);
|
1544 |
TransactionApproval transactionApproval = transactionApprovalRepository.selectById(transactionId);
|
| 1541 |
int retailerId = transactionRepository.selectById(transactionId).getRetailerId();
|
1545 |
int retailerId = transactionRepository.selectById(transactionId).getRetailerId();
|
| 1542 |
if (!transactionApproval.getStatus().equals(TransactionApprovalStatus.PENDING)) {
|
1546 |
if (!transactionApproval.getStatus().equals(TransactionApprovalStatus.PENDING)) {
|
| 1543 |
throw new ProfitMandiBusinessException("Transaction already Processed", "Transaction already Processed", "Transaction already Processed");
|
1547 |
throw new ProfitMandiBusinessException("Transaction already Processed", "Transaction already Processed", "Transaction already Processed");
|
| Line 1553... |
Line 1557... |
| 1553 |
float totalAmount = 0;
|
1557 |
float totalAmount = 0;
|
| 1554 |
// referense id = transaction id
|
1558 |
// referense id = transaction id
|
| 1555 |
// here refund the amount of an order
|
1559 |
// here refund the amount of an order
|
| 1556 |
List<UserWalletHistory> uwhList = walletService.getAllByReference(retailerId, transactionId, WalletReferenceType.PURCHASE);
|
1560 |
List<UserWalletHistory> uwhList = walletService.getAllByReference(retailerId, transactionId, WalletReferenceType.PURCHASE);
|
| 1557 |
//Refund only if any amount is deducted from wallet for that particular Transaction
|
1561 |
//Refund only if any amount is deducted from wallet for that particular Transaction
|
| 1558 |
if(uwhList.size() > 0) {
|
1562 |
if (uwhList.size() > 0) {
|
| 1559 |
totalAmount = -uwhList.get(0).getAmount();
|
1563 |
totalAmount = -uwhList.get(0).getAmount();
|
| 1560 |
walletService.refundToWallet(retailerId, totalAmount, transactionId, WalletReferenceType.PURCHASE, "Order canceled");
|
1564 |
walletService.refundToWallet(retailerId, totalAmount, transactionId, WalletReferenceType.PURCHASE, "Order canceled");
|
| - |
|
1565 |
sdCreditService.settleBlockedLoan(transactionId);
|
| 1561 |
}
|
1566 |
}
|
| 1562 |
}
|
1567 |
}
|
| 1563 |
}
|
1568 |
}
|
| 1564 |
|
1569 |
|
| 1565 |
@RequestMapping(value = "/bulkOrderTemplate", method = RequestMethod.GET)
|
1570 |
@RequestMapping(value = "/bulkOrderTemplate", method = RequestMethod.GET)
|