| Line 175... |
Line 175... |
| 175 |
insurancePolicyRepository.persist(insurancePolicy);
|
175 |
insurancePolicyRepository.persist(insurancePolicy);
|
| 176 |
insuranceModel.setPolicyNumber(insurancePolicy.getPolicyNumber());
|
176 |
insuranceModel.setPolicyNumber(insurancePolicy.getPolicyNumber());
|
| 177 |
String walletDescription = "Purchased Damage Protection policy " + insurancePolicy.getPolicyNumber()
|
177 |
String walletDescription = "Purchased Damage Protection policy " + insurancePolicy.getPolicyNumber()
|
| 178 |
+ " for " + insurancePolicy.getCustomerFirstName();
|
178 |
+ " for " + insurancePolicy.getCustomerFirstName();
|
| 179 |
|
179 |
|
| - |
|
180 |
walletService.consumeAmountFromWallet(uc.getUserId(), insurancePolicy.getId(),
|
| 180 |
walletService.consumeAmountFromWallet(uc.getUserId(), insurancePolicy.getId(), WalletReferenceType.DAMAGE_PROTECTION, walletDescription, insurancePolicy.getSaleAmount());
|
181 |
WalletReferenceType.DAMAGE_PROTECTION, walletDescription, insurancePolicy.getSaleAmount());
|
| 181 |
|
182 |
|
| 182 |
try{
|
183 |
try{
|
| 183 |
InsuranceUtils.submitToGadgetCops(insuranceModel);
|
184 |
InsuranceUtils.submitToGadgetCops(insuranceModel);
|
| 184 |
insurancePolicy.setPosted(true);
|
185 |
insurancePolicy.setPosted(true);
|
| 185 |
}catch (ProfitMandiBusinessException profitMandiBusinessException) {
|
186 |
}catch (ProfitMandiBusinessException profitMandiBusinessException) {
|
| Line 346... |
Line 347... |
| 346 |
for (GadgetCopsInsuranceCalc calc : calcList) {
|
347 |
for (GadgetCopsInsuranceCalc calc : calcList) {
|
| 347 |
GadgetCopsInsuranceCalcResponse calcResponse = new GadgetCopsInsuranceCalcResponse();
|
348 |
GadgetCopsInsuranceCalcResponse calcResponse = new GadgetCopsInsuranceCalcResponse();
|
| 348 |
calcResponse.setDealerPrice(calc.getDealerPrice());
|
349 |
calcResponse.setDealerPrice(calc.getDealerPrice());
|
| 349 |
calcResponse.setPriceRangeMax(calc.getPriceRangeMax());
|
350 |
calcResponse.setPriceRangeMax(calc.getPriceRangeMax());
|
| 350 |
calcResponse.setPriceRangeMin(calc.getPriceRangeMin());
|
351 |
calcResponse.setPriceRangeMin(calc.getPriceRangeMin());
|
| - |
|
352 |
calcResponse.setSellingPrice(calc.getSellingPrice());
|
| 351 |
float taxableInsuranceMargin = (calc.getSellingPrice() - calc.getDealerPrice()) / (1 + ProfitMandiConstants.INSURANCE_TAX_RATE / 100);
|
353 |
float taxableInsuranceMargin = (calc.getSellingPrice() - calc.getDealerPrice()) / (1 + ProfitMandiConstants.INSURANCE_TAX_RATE / 100);
|
| 352 |
calcResponse.setCashBack((int)taxableInsuranceMargin);
|
354 |
calcResponse.setCashBack((int)taxableInsuranceMargin);
|
| 353 |
calcResponseList.add(calcResponse);
|
355 |
calcResponseList.add(calcResponse);
|
| 354 |
}
|
356 |
}
|
| 355 |
return calcResponseList;
|
357 |
return calcResponseList;
|