| Line 19... |
Line 19... |
| 19 |
import javax.mail.internet.InternetAddress;
|
19 |
import javax.mail.internet.InternetAddress;
|
| 20 |
import javax.mail.internet.MimeMessage;
|
20 |
import javax.mail.internet.MimeMessage;
|
| 21 |
import javax.servlet.http.HttpServletRequest;
|
21 |
import javax.servlet.http.HttpServletRequest;
|
| 22 |
|
22 |
|
| 23 |
import org.apache.commons.io.FileUtils;
|
23 |
import org.apache.commons.io.FileUtils;
|
| - |
|
24 |
import org.json.JSONObject;
|
| 24 |
import org.slf4j.Logger;
|
25 |
import org.slf4j.Logger;
|
| 25 |
import org.slf4j.LoggerFactory;
|
26 |
import org.slf4j.LoggerFactory;
|
| 26 |
import org.springframework.beans.factory.annotation.Autowired;
|
27 |
import org.springframework.beans.factory.annotation.Autowired;
|
| 27 |
import org.springframework.http.ResponseEntity;
|
28 |
import org.springframework.http.ResponseEntity;
|
| 28 |
import org.springframework.mail.javamail.JavaMailSender;
|
29 |
import org.springframework.mail.javamail.JavaMailSender;
|
| Line 206... |
Line 207... |
| 206 |
|
207 |
|
| 207 |
float taxableInsuranceMargin = (insurancePolicy.getSaleAmount() - insurancePolicy.getPurchaseAmount()) / (1 + ProfitMandiConstants.INSURANCE_TAX_RATE / 100);
|
208 |
float taxableInsuranceMargin = (insurancePolicy.getSaleAmount() - insurancePolicy.getPurchaseAmount()) / (1 + ProfitMandiConstants.INSURANCE_TAX_RATE / 100);
|
| 208 |
walletService.addAmountToWallet(uc.getUserId(), insurancePolicy.getId(), WalletReferenceType.CASHBACK, "Cashback against insurance policy",
|
209 |
walletService.addAmountToWallet(uc.getUserId(), insurancePolicy.getId(), WalletReferenceType.CASHBACK, "Cashback against insurance policy",
|
| 209 |
taxableInsuranceMargin);
|
210 |
taxableInsuranceMargin);
|
| 210 |
LOGGER.info("requested url : " + request.getRequestURL().toString());
|
211 |
LOGGER.info("requested url : " + request.getRequestURL().toString());
|
| - |
|
212 |
JSONObject jsonObject = new JSONObject();
|
| - |
|
213 |
jsonObject.append("policyNumber", insurancePolicy.getPolicyNumber());
|
| 211 |
return responseSender.ok(true);
|
214 |
return responseSender.ok(jsonObject);
|
| 212 |
}
|
215 |
}
|
| 213 |
|
216 |
|
| 214 |
private void sendMailWithAttachments(String email, String subject, String body, List<File> attachments) throws Exception {
|
217 |
private void sendMailWithAttachments(String email, String subject, String body, List<File> attachments) throws Exception {
|
| 215 |
|
218 |
|
| 216 |
MimeMessage message = mailSender.createMimeMessage();
|
219 |
MimeMessage message = mailSender.createMimeMessage();
|