| Line 29... |
Line 29... |
| 29 |
import org.springframework.transaction.annotation.Transactional;
|
29 |
import org.springframework.transaction.annotation.Transactional;
|
| 30 |
import org.springframework.web.bind.annotation.RequestBody;
|
30 |
import org.springframework.web.bind.annotation.RequestBody;
|
| 31 |
import org.springframework.web.bind.annotation.RequestMapping;
|
31 |
import org.springframework.web.bind.annotation.RequestMapping;
|
| 32 |
import org.springframework.web.bind.annotation.RequestMethod;
|
32 |
import org.springframework.web.bind.annotation.RequestMethod;
|
| 33 |
|
33 |
|
| - |
|
34 |
import com.spice.profitmandi.service.user.StoreStatusService;
|
| 34 |
import com.spice.profitmandi.common.exception.ProfitMandiBusinessException;
|
35 |
import com.spice.profitmandi.common.exception.ProfitMandiBusinessException;
|
| 35 |
import com.spice.profitmandi.common.model.CustomAddress;
|
36 |
import com.spice.profitmandi.common.model.CustomAddress;
|
| 36 |
import com.spice.profitmandi.common.model.CustomCustomer;
|
37 |
import com.spice.profitmandi.common.model.CustomCustomer;
|
| 37 |
import com.spice.profitmandi.common.model.CustomOrderItem;
|
38 |
import com.spice.profitmandi.common.model.CustomOrderItem;
|
| 38 |
import com.spice.profitmandi.common.model.CustomRetailer;
|
39 |
import com.spice.profitmandi.common.model.CustomRetailer;
|
| Line 134... |
Line 135... |
| 134 |
|
135 |
|
| 135 |
@Autowired
|
136 |
@Autowired
|
| 136 |
WalletService walletService;
|
137 |
WalletService walletService;
|
| 137 |
|
138 |
|
| 138 |
@Autowired
|
139 |
@Autowired
|
| - |
|
140 |
private StoreStatusService storeStatusService;
|
| - |
|
141 |
|
| - |
|
142 |
@Autowired
|
| 139 |
UserWalletRepository userWalletRepositoy;
|
143 |
UserWalletRepository userWalletRepositoy;
|
| 140 |
|
144 |
|
| 141 |
@Autowired
|
145 |
@Autowired
|
| 142 |
PolicyNumberGenerationSequenceRepository policyNumberGenerationSequenceRepository;
|
146 |
PolicyNumberGenerationSequenceRepository policyNumberGenerationSequenceRepository;
|
| 143 |
|
147 |
|
| Line 193... |
Line 197... |
| 193 |
insurancePolicyRepository.persist(insurancePolicy);
|
197 |
insurancePolicyRepository.persist(insurancePolicy);
|
| 194 |
insuranceModel.setPolicyNumber(insurancePolicy.getPolicyNumber());
|
198 |
insuranceModel.setPolicyNumber(insurancePolicy.getPolicyNumber());
|
| 195 |
String walletDescription = "Purchased Damage Protection policy " + insurancePolicy.getPolicyNumber() + " for "
|
199 |
String walletDescription = "Purchased Damage Protection policy " + insurancePolicy.getPolicyNumber() + " for "
|
| 196 |
+ insurancePolicy.getCustomerFirstName();
|
200 |
+ insurancePolicy.getCustomerFirstName();
|
| 197 |
|
201 |
|
| - |
|
202 |
storeStatusService.assertCanSpendWallet(uc.getUserId());
|
| 198 |
walletService.consumeAmountFromWallet(uc.getUserId(), insurancePolicy.getId(),
|
203 |
walletService.consumeAmountFromWallet(uc.getUserId(), insurancePolicy.getId(),
|
| 199 |
WalletReferenceType.DAMAGE_PROTECTION, walletDescription, insurancePolicy.getSaleAmount(),
|
204 |
WalletReferenceType.DAMAGE_PROTECTION, walletDescription, insurancePolicy.getSaleAmount(),
|
| 200 |
LocalDateTime.now());
|
205 |
LocalDateTime.now());
|
| 201 |
|
206 |
|
| 202 |
try {
|
207 |
try {
|