| 22551 |
ashik.ali |
1 |
package com.spice.profitmandi.web.controller;
|
|
|
2 |
|
| 23985 |
tejbeer |
3 |
import java.text.MessageFormat;
|
| 22551 |
ashik.ali |
4 |
import java.time.LocalDateTime;
|
|
|
5 |
import java.util.ArrayList;
|
|
|
6 |
import java.util.List;
|
| 23936 |
tejbeer |
7 |
import java.util.Map;
|
| 22551 |
ashik.ali |
8 |
|
| 23985 |
tejbeer |
9 |
import javax.mail.internet.InternetAddress;
|
|
|
10 |
import javax.mail.internet.MimeMessage;
|
| 22551 |
ashik.ali |
11 |
import javax.servlet.http.HttpServletRequest;
|
|
|
12 |
|
| 23985 |
tejbeer |
13 |
import org.apache.logging.log4j.LogManager;
|
| 23568 |
govind |
14 |
import org.apache.logging.log4j.Logger;
|
| 22551 |
ashik.ali |
15 |
import org.springframework.beans.factory.annotation.Autowired;
|
| 23985 |
tejbeer |
16 |
import org.springframework.mail.javamail.JavaMailSender;
|
|
|
17 |
import org.springframework.mail.javamail.MimeMessageHelper;
|
| 22551 |
ashik.ali |
18 |
import org.springframework.stereotype.Controller;
|
|
|
19 |
import org.springframework.transaction.annotation.Transactional;
|
|
|
20 |
import org.springframework.ui.Model;
|
|
|
21 |
import org.springframework.web.bind.annotation.RequestMapping;
|
|
|
22 |
import org.springframework.web.bind.annotation.RequestMethod;
|
|
|
23 |
import org.springframework.web.bind.annotation.RequestParam;
|
|
|
24 |
|
|
|
25 |
import com.spice.profitmandi.common.exception.ProfitMandiBusinessException;
|
| 23936 |
tejbeer |
26 |
import com.spice.profitmandi.common.model.CustomRetailer;
|
| 22551 |
ashik.ali |
27 |
import com.spice.profitmandi.common.model.ProfitMandiConstants;
|
|
|
28 |
import com.spice.profitmandi.common.util.StringUtils;
|
| 23936 |
tejbeer |
29 |
import com.spice.profitmandi.dao.entity.transaction.AddWalletRequest;
|
| 22551 |
ashik.ali |
30 |
import com.spice.profitmandi.dao.entity.transaction.UserWallet;
|
|
|
31 |
import com.spice.profitmandi.dao.entity.transaction.UserWalletHistory;
|
| 23936 |
tejbeer |
32 |
import com.spice.profitmandi.dao.enumuration.transaction.AddWalletRequestStatus;
|
|
|
33 |
import com.spice.profitmandi.dao.repository.catalog.AddWalletRequestRepository;
|
| 23985 |
tejbeer |
34 |
import com.spice.profitmandi.dao.repository.dtr.UserAccountRepository;
|
| 22551 |
ashik.ali |
35 |
import com.spice.profitmandi.dao.repository.transaction.UserWalletRepository;
|
| 23936 |
tejbeer |
36 |
import com.spice.profitmandi.service.user.RetailerService;
|
| 22551 |
ashik.ali |
37 |
import com.spice.profitmandi.service.wallet.WalletService;
|
|
|
38 |
import com.spice.profitmandi.web.model.LoginDetails;
|
|
|
39 |
import com.spice.profitmandi.web.util.CookiesProcessor;
|
| 23936 |
tejbeer |
40 |
import com.spice.profitmandi.web.util.MVCResponseSender;
|
| 22551 |
ashik.ali |
41 |
|
| 23936 |
tejbeer |
42 |
import in.shop2020.model.v1.order.WalletReferenceType;
|
|
|
43 |
|
| 22551 |
ashik.ali |
44 |
@Controller
|
|
|
45 |
@Transactional(rollbackFor = Throwable.class)
|
|
|
46 |
public class WalletController {
|
|
|
47 |
|
|
|
48 |
@Autowired
|
| 22927 |
ashik.ali |
49 |
private CookiesProcessor cookiesProcessor;
|
| 22551 |
ashik.ali |
50 |
|
|
|
51 |
@Autowired
|
| 22927 |
ashik.ali |
52 |
private WalletService walletService;
|
| 22551 |
ashik.ali |
53 |
|
|
|
54 |
@Autowired
|
| 22927 |
ashik.ali |
55 |
private UserWalletRepository userWalletRepository;
|
| 22551 |
ashik.ali |
56 |
|
| 23936 |
tejbeer |
57 |
@Autowired
|
|
|
58 |
private MVCResponseSender mvcResponseSender;
|
|
|
59 |
|
|
|
60 |
@Autowired
|
| 23985 |
tejbeer |
61 |
private UserAccountRepository userAccountRepository;
|
|
|
62 |
|
|
|
63 |
@Autowired
|
|
|
64 |
JavaMailSender mailSender;
|
|
|
65 |
|
|
|
66 |
|
|
|
67 |
@Autowired
|
| 23936 |
tejbeer |
68 |
private RetailerService retailerService;
|
|
|
69 |
|
|
|
70 |
|
|
|
71 |
@Autowired
|
|
|
72 |
AddWalletRequestRepository addWalletRequestRepository;
|
| 23568 |
govind |
73 |
private static final Logger LOGGER = LogManager.getLogger(WalletController.class);
|
| 22551 |
ashik.ali |
74 |
|
|
|
75 |
@RequestMapping(value = "/walletDetails", method = RequestMethod.GET)
|
| 22927 |
ashik.ali |
76 |
public String dashboard(HttpServletRequest request, @RequestParam(name = ProfitMandiConstants.START_TIME, required = false) String startTimeString, @RequestParam(name = ProfitMandiConstants.END_TIME, required = false) String endTimeString, @RequestParam(name = "offset", defaultValue = "0") int offset, @RequestParam(name = "limit", defaultValue = "10") int limit, Model model) throws ProfitMandiBusinessException{
|
|
|
77 |
LoginDetails fofoDetails = cookiesProcessor.getCookiesObject(request);
|
| 22551 |
ashik.ali |
78 |
|
|
|
79 |
UserWallet userWallet = null;
|
|
|
80 |
try{
|
|
|
81 |
userWallet = userWalletRepository.selectByRetailerId(fofoDetails.getFofoId());
|
|
|
82 |
}catch(ProfitMandiBusinessException profitMandiBusinessException){
|
|
|
83 |
LOGGER.error("UserWallet not found : ", profitMandiBusinessException);
|
|
|
84 |
//return "error";
|
|
|
85 |
}
|
|
|
86 |
|
|
|
87 |
LocalDateTime startDateTime = StringUtils.toDateTime(startTimeString);
|
|
|
88 |
LocalDateTime endDateTime = StringUtils.toDateTime(endTimeString);
|
|
|
89 |
|
|
|
90 |
List<UserWalletHistory> userWalletHistories = new ArrayList<>();
|
|
|
91 |
try{
|
|
|
92 |
userWalletHistories = walletService.getPaginatedUserWalletHistoryByRetailerId(fofoDetails.getFofoId(), startDateTime, endDateTime, offset, limit);
|
|
|
93 |
}catch(ProfitMandiBusinessException profitMandiBusinessException){
|
|
|
94 |
LOGGER.error("UserWallet History not found : ", profitMandiBusinessException);
|
|
|
95 |
}
|
|
|
96 |
|
|
|
97 |
long countItems = 0;
|
|
|
98 |
try{
|
|
|
99 |
countItems = walletService.getSizeByRetailerId(fofoDetails.getFofoId(), startDateTime, endDateTime);
|
|
|
100 |
}catch(ProfitMandiBusinessException profitMandiBusinessException){
|
|
|
101 |
LOGGER.error("UserWallet not found : ",profitMandiBusinessException);
|
|
|
102 |
}
|
|
|
103 |
model.addAttribute("userWallet", userWallet);
|
|
|
104 |
model.addAttribute("walletHistories", userWalletHistories);
|
|
|
105 |
model.addAttribute("start", offset + 1);
|
|
|
106 |
model.addAttribute("size",countItems);
|
|
|
107 |
model.addAttribute(ProfitMandiConstants.START_TIME, startTimeString);
|
|
|
108 |
model.addAttribute(ProfitMandiConstants.END_TIME, endTimeString);
|
|
|
109 |
if (userWalletHistories.size() < limit){
|
|
|
110 |
model.addAttribute("end", offset + userWalletHistories.size());
|
|
|
111 |
}
|
|
|
112 |
else{
|
|
|
113 |
model.addAttribute("end", offset + limit);
|
|
|
114 |
}
|
|
|
115 |
return "wallet-details";
|
|
|
116 |
}
|
|
|
117 |
|
|
|
118 |
@RequestMapping(value = "/getPaginatedWalletHistory")
|
| 23505 |
ashik.ali |
119 |
public String getSaleHistoryPaginated(HttpServletRequest request, @RequestParam(name = ProfitMandiConstants.START_TIME, required = false) String startTimeString, @RequestParam(name = ProfitMandiConstants.END_TIME, required = false) String endTimeString, @RequestParam(name = "offset", defaultValue = "0") int offset, @RequestParam(name = "limit", defaultValue="10") int limit, Model model) throws ProfitMandiBusinessException{
|
| 22927 |
ashik.ali |
120 |
LoginDetails loginDetails = cookiesProcessor.getCookiesObject(request);
|
|
|
121 |
|
| 22551 |
ashik.ali |
122 |
LocalDateTime startDateTime = StringUtils.toDateTime(startTimeString);
|
|
|
123 |
LocalDateTime endDateTime = StringUtils.toDateTime(endTimeString);
|
|
|
124 |
|
|
|
125 |
List<UserWalletHistory> userWalletHistories = new ArrayList<>();
|
|
|
126 |
try{
|
|
|
127 |
userWalletHistories = walletService.getPaginatedUserWalletHistoryByRetailerId(loginDetails.getFofoId(), startDateTime, endDateTime, offset, limit);
|
|
|
128 |
}catch(ProfitMandiBusinessException profitMandiBusinessException){
|
|
|
129 |
LOGGER.error("UserWallet History not found : ", profitMandiBusinessException);
|
|
|
130 |
}
|
|
|
131 |
|
|
|
132 |
model.addAttribute("walletHistories", userWalletHistories);
|
|
|
133 |
return "wallet-history-paginated";
|
|
|
134 |
}
|
|
|
135 |
|
| 23936 |
tejbeer |
136 |
@RequestMapping(value = "/getAddWalletRequest", method = RequestMethod.GET)
|
|
|
137 |
public String getAddwalletRequest(HttpServletRequest request,
|
|
|
138 |
@RequestParam(name = "offset", defaultValue = "0") int offset,
|
|
|
139 |
@RequestParam(name = "limit", defaultValue = "10") int limit, Model model)
|
|
|
140 |
throws ProfitMandiBusinessException {
|
|
|
141 |
List<AddWalletRequest> walletRequest = null;
|
|
|
142 |
long size = 0;
|
|
|
143 |
walletRequest = addWalletRequestRepository.selectAllByStatus(offset, limit,AddWalletRequestStatus.pending);
|
|
|
144 |
LOGGER .info("walletRequest" + walletRequest);
|
|
|
145 |
size = addWalletRequestRepository.selectCountByStatus(AddWalletRequestStatus.pending);
|
|
|
146 |
|
|
|
147 |
List<Integer> fofoIds=this.getFofoIdsFromWalletRequest(walletRequest);
|
|
|
148 |
Map<Integer,CustomRetailer> fofoIdsAndRetailerName=retailerService.getFofoRetailers(fofoIds);
|
|
|
149 |
|
|
|
150 |
model.addAttribute("fofoIdsAndRetailerName",fofoIdsAndRetailerName);
|
|
|
151 |
model.addAttribute("walletRequest", walletRequest);
|
|
|
152 |
model.addAttribute("rStatus","pending");
|
|
|
153 |
model.addAttribute("start", offset + 1);
|
|
|
154 |
model.addAttribute("size", size);
|
|
|
155 |
model.addAttribute("url","/getPaginatedWalletRequest");
|
|
|
156 |
|
|
|
157 |
if (walletRequest.size() < limit) {
|
|
|
158 |
model.addAttribute("end", offset + walletRequest.size());
|
|
|
159 |
} else {
|
|
|
160 |
model.addAttribute("end", offset + limit);
|
|
|
161 |
}
|
|
|
162 |
|
|
|
163 |
return "add-wallet-request";
|
|
|
164 |
}
|
|
|
165 |
|
|
|
166 |
@RequestMapping(value = "/getPaginatedWalletRequest", method = RequestMethod.GET)
|
|
|
167 |
public String getPaginatedWalletRequest(HttpServletRequest request,
|
|
|
168 |
@RequestParam(name = "offset", defaultValue = "0") int offset,
|
|
|
169 |
@RequestParam(name = "limit", defaultValue = "10") int limit, Model model)
|
|
|
170 |
throws ProfitMandiBusinessException {
|
|
|
171 |
LOGGER .info("requested offset=[{}], limit = [{}]", offset, limit);
|
|
|
172 |
List<AddWalletRequest> walletRequest = null;
|
|
|
173 |
walletRequest = addWalletRequestRepository.selectAllByStatus(offset, limit,AddWalletRequestStatus.pending);
|
|
|
174 |
LOGGER.info("walletRequest" + walletRequest);
|
|
|
175 |
List<Integer> fofoIds=this.getFofoIdsFromWalletRequest(walletRequest);
|
|
|
176 |
Map<Integer,CustomRetailer> fofoIdsAndRetailerName=retailerService.getFofoRetailers(fofoIds);
|
|
|
177 |
|
|
|
178 |
model.addAttribute("fofoIdsAndRetailerName",fofoIdsAndRetailerName);
|
|
|
179 |
model.addAttribute("walletRequest", walletRequest);
|
|
|
180 |
model.addAttribute("rStatus","pending");
|
|
|
181 |
model.addAttribute("url","/getPaginatedWalletRequest");
|
|
|
182 |
|
|
|
183 |
return "add-wallet-request-paginated";
|
|
|
184 |
}
|
|
|
185 |
|
|
|
186 |
@RequestMapping(value = "/getAddWalletApproved", method = RequestMethod.GET)
|
|
|
187 |
public String getAddwalletRequestApproved(HttpServletRequest request,
|
|
|
188 |
@RequestParam(name = "offset", defaultValue = "0") int offset,
|
|
|
189 |
@RequestParam(name = "limit", defaultValue = "10") int limit, Model model)
|
|
|
190 |
throws ProfitMandiBusinessException {
|
|
|
191 |
List<AddWalletRequest> walletRequest = null;
|
|
|
192 |
|
|
|
193 |
long size = 0;
|
|
|
194 |
walletRequest = addWalletRequestRepository.selectAllByStatus(offset, limit,AddWalletRequestStatus.approved);
|
|
|
195 |
size = addWalletRequestRepository.selectCountByStatus(AddWalletRequestStatus.approved);
|
|
|
196 |
LOGGER.info("walletRequest" + walletRequest);
|
|
|
197 |
List<Integer> fofoIds=this.getFofoIdsFromWalletRequest(walletRequest);
|
|
|
198 |
Map<Integer,CustomRetailer> fofoIdsAndRetailerName=retailerService.getFofoRetailers(fofoIds);
|
|
|
199 |
|
|
|
200 |
model.addAttribute("fofoIdsAndRetailerName",fofoIdsAndRetailerName);
|
|
|
201 |
model.addAttribute("walletRequest", walletRequest);
|
|
|
202 |
model.addAttribute("start", offset + 1);
|
|
|
203 |
model.addAttribute("size", size);
|
|
|
204 |
model.addAttribute("url","/getPaginatedWalletApproved");
|
|
|
205 |
|
|
|
206 |
if (walletRequest.size() < limit) {
|
|
|
207 |
model.addAttribute("end", offset + walletRequest.size());
|
|
|
208 |
} else {
|
|
|
209 |
model.addAttribute("end", offset + limit);
|
|
|
210 |
}
|
|
|
211 |
|
|
|
212 |
return "add-wallet-request";
|
|
|
213 |
}
|
|
|
214 |
|
|
|
215 |
@RequestMapping(value = "/getPaginatedWalletApproved", method = RequestMethod.GET)
|
|
|
216 |
public String getPaginatedWalletApproved(HttpServletRequest request,
|
|
|
217 |
@RequestParam(name = "offset", defaultValue = "0") int offset,
|
|
|
218 |
@RequestParam(name = "limit", defaultValue = "10") int limit, Model model)
|
|
|
219 |
throws ProfitMandiBusinessException {
|
|
|
220 |
LOGGER .info("requested offset=[{}], limit = [{}]", offset, limit);
|
|
|
221 |
List<AddWalletRequest> walletRequest = null;
|
|
|
222 |
walletRequest = addWalletRequestRepository.selectAllByStatus(offset, limit, AddWalletRequestStatus.approved);
|
|
|
223 |
LOGGER.info("walletRequest" + walletRequest);
|
|
|
224 |
List<Integer> fofoIds=this.getFofoIdsFromWalletRequest(walletRequest);
|
|
|
225 |
Map<Integer,CustomRetailer> fofoIdsAndRetailerName=retailerService.getFofoRetailers(fofoIds);
|
|
|
226 |
|
|
|
227 |
model.addAttribute("fofoIdsAndRetailerName",fofoIdsAndRetailerName);
|
|
|
228 |
model.addAttribute("walletRequest", walletRequest);
|
|
|
229 |
model.addAttribute("url","/getPaginatedWalletApproved");
|
|
|
230 |
|
|
|
231 |
return "add-wallet-request-paginated";
|
|
|
232 |
}
|
|
|
233 |
|
| 23985 |
tejbeer |
234 |
@RequestMapping(value = "/getAddWalletRequestRejected", method = RequestMethod.GET)
|
|
|
235 |
public String getAddwalletRequestRejected(HttpServletRequest request,
|
|
|
236 |
@RequestParam(name = "offset", defaultValue = "0") int offset,
|
|
|
237 |
@RequestParam(name = "limit", defaultValue = "10") int limit, Model model)
|
|
|
238 |
throws ProfitMandiBusinessException {
|
|
|
239 |
List<AddWalletRequest> walletRequest = null;
|
|
|
240 |
|
|
|
241 |
long size = 0;
|
|
|
242 |
walletRequest = addWalletRequestRepository.selectAllByStatus(offset, limit,AddWalletRequestStatus.rejected);
|
|
|
243 |
size = addWalletRequestRepository.selectCountByStatus(AddWalletRequestStatus.rejected);
|
|
|
244 |
LOGGER.info("walletRequest" + walletRequest);
|
|
|
245 |
List<Integer> fofoIds=this.getFofoIdsFromWalletRequest(walletRequest);
|
|
|
246 |
Map<Integer,CustomRetailer> fofoIdsAndRetailerName=retailerService.getFofoRetailers(fofoIds);
|
|
|
247 |
|
|
|
248 |
model.addAttribute("fofoIdsAndRetailerName",fofoIdsAndRetailerName);
|
|
|
249 |
model.addAttribute("walletRequest", walletRequest);
|
|
|
250 |
model.addAttribute("start", offset + 1);
|
|
|
251 |
model.addAttribute("size", size);
|
|
|
252 |
model.addAttribute("url","/getPaginatedWalletRequestRejected");
|
|
|
253 |
|
|
|
254 |
if (walletRequest.size() < limit) {
|
|
|
255 |
model.addAttribute("end", offset + walletRequest.size());
|
|
|
256 |
} else {
|
|
|
257 |
model.addAttribute("end", offset + limit);
|
|
|
258 |
}
|
|
|
259 |
|
|
|
260 |
return "add-wallet-request";
|
|
|
261 |
}
|
|
|
262 |
|
|
|
263 |
|
|
|
264 |
@RequestMapping(value = "/getPaginatedWalletRequestRejected", method = RequestMethod.GET)
|
|
|
265 |
public String getPaginatedWalletRequestRejected(HttpServletRequest request,
|
|
|
266 |
@RequestParam(name = "offset", defaultValue = "0") int offset,
|
|
|
267 |
@RequestParam(name = "limit", defaultValue = "10") int limit, Model model)
|
|
|
268 |
throws ProfitMandiBusinessException {
|
|
|
269 |
LOGGER .info("requested offset=[{}], limit = [{}]", offset, limit);
|
|
|
270 |
List<AddWalletRequest> walletRequest = null;
|
|
|
271 |
walletRequest = addWalletRequestRepository.selectAllByStatus(offset, limit, AddWalletRequestStatus.rejected);
|
|
|
272 |
LOGGER.info("walletRequest" + walletRequest);
|
|
|
273 |
List<Integer> fofoIds=this.getFofoIdsFromWalletRequest(walletRequest);
|
|
|
274 |
Map<Integer,CustomRetailer> fofoIdsAndRetailerName=retailerService.getFofoRetailers(fofoIds);
|
|
|
275 |
|
|
|
276 |
model.addAttribute("fofoIdsAndRetailerName",fofoIdsAndRetailerName);
|
|
|
277 |
model.addAttribute("walletRequest", walletRequest);
|
|
|
278 |
model.addAttribute("url","/getPaginatedWalletRequestRejected");
|
|
|
279 |
|
|
|
280 |
return "add-wallet-request-paginated";
|
|
|
281 |
}
|
| 23936 |
tejbeer |
282 |
@RequestMapping(value = "/addAmountToWallet", method = RequestMethod.PUT)
|
|
|
283 |
public String addAmountToWallet(HttpServletRequest request,@RequestParam(name = "id", defaultValue = "0")int id,Model model)
|
|
|
284 |
throws Exception {
|
|
|
285 |
|
|
|
286 |
AddWalletRequest addWalletRequest= addWalletRequestRepository.selectById(id);
|
|
|
287 |
walletService.addAmountToWallet(addWalletRequest.getRetailerId(), id,WalletReferenceType.ADVANCE_AMOUNT, "ntfs/rgfs",addWalletRequest.getAmount());
|
|
|
288 |
addWalletRequest.setStatus(AddWalletRequestStatus.approved);
|
|
|
289 |
addWalletRequest.setUpdateTimestamp(LocalDateTime.now());
|
|
|
290 |
addWalletRequestRepository.persist(addWalletRequest);
|
|
|
291 |
model.addAttribute("response", mvcResponseSender.createResponseString(true));
|
| 23985 |
tejbeer |
292 |
CustomRetailer customRetailer=retailerService.getFofoRetailer(addWalletRequest.getRetailerId());
|
|
|
293 |
String subject = "Request Approved for "+customRetailer.getBusinessName()+" of Rs."+ addWalletRequest.getAmount();
|
|
|
294 |
String messageText = MessageFormat.format("User Id - {0}\n Name -{1}\n Email -{2}\n mobile -{3}\n Reference - {4}\n Amount - Rs.{5}",
|
|
|
295 |
new Integer(addWalletRequest.getRetailerId()),customRetailer.getBusinessName(),customRetailer.getEmail(),customRetailer.getMobileNumber(),addWalletRequest.getTransaction_reference(),
|
|
|
296 |
new Float(addWalletRequest.getAmount()));
|
|
|
297 |
|
|
|
298 |
this.sendMailWithAttachments(subject, messageText);
|
| 23936 |
tejbeer |
299 |
return "response";
|
|
|
300 |
}
|
| 23985 |
tejbeer |
301 |
|
|
|
302 |
@RequestMapping(value = "/addAmountToWalletRequestRejected", method = RequestMethod.PUT)
|
|
|
303 |
public String addAmountToWalletRequestRejected(HttpServletRequest request,@RequestParam(name = "id", defaultValue = "0")int id,Model model)
|
|
|
304 |
throws Exception {
|
|
|
305 |
|
|
|
306 |
AddWalletRequest addWalletRequest= addWalletRequestRepository.selectById(id);
|
|
|
307 |
addWalletRequest.setStatus(AddWalletRequestStatus.rejected);
|
|
|
308 |
addWalletRequest.setUpdateTimestamp(LocalDateTime.now());
|
|
|
309 |
addWalletRequestRepository.persist(addWalletRequest);
|
|
|
310 |
model.addAttribute("response", mvcResponseSender.createResponseString(true));
|
|
|
311 |
CustomRetailer customRetailer=retailerService.getFofoRetailer(addWalletRequest.getRetailerId());
|
|
|
312 |
String subject = "Request Rejected for "+customRetailer.getBusinessName()+" of Rs."+ addWalletRequest.getAmount();
|
|
|
313 |
String messageText = MessageFormat.format("User Id - {0}\n Name -{1}\n Email -{2}\n mobile -{3}\n Reference - {4}\n Amount - Rs.{5}",
|
|
|
314 |
new Integer(addWalletRequest.getRetailerId()),customRetailer.getBusinessName(),customRetailer.getEmail(),customRetailer.getMobileNumber(),addWalletRequest.getTransaction_reference(),
|
|
|
315 |
new Float(addWalletRequest.getAmount()));
|
|
|
316 |
|
|
|
317 |
this.sendMailWithAttachments(subject, messageText);
|
|
|
318 |
return "response";
|
|
|
319 |
}
|
|
|
320 |
|
|
|
321 |
private void sendMailWithAttachments(String subject, String messageText) throws Exception {
|
|
|
322 |
MimeMessage message = mailSender.createMimeMessage();
|
|
|
323 |
MimeMessageHelper helper = new MimeMessageHelper(message, true);
|
|
|
324 |
String[] email = {"adeel.yazdani@smartdukaan.com","kamini.sharma@smartdukaan.com","care@smartdukaan.com","mohinder.mutreja@smartdukaan.com"};
|
|
|
325 |
helper.setSubject(subject);
|
|
|
326 |
helper.setText(messageText);
|
|
|
327 |
helper.setTo(email);
|
|
|
328 |
InternetAddress senderAddress = new InternetAddress("noreply@smartdukaan.com", "ProfitMandi Admin");
|
|
|
329 |
helper.setFrom(senderAddress);
|
|
|
330 |
mailSender.send(message);
|
|
|
331 |
|
|
|
332 |
}
|
| 23936 |
tejbeer |
333 |
private List<Integer> getFofoIdsFromWalletRequest(List<AddWalletRequest> walletRequest)
|
|
|
334 |
{
|
|
|
335 |
List<Integer> fofoIds = new ArrayList<>();
|
|
|
336 |
for(AddWalletRequest walletdetail :walletRequest ) {
|
|
|
337 |
fofoIds.add(walletdetail.getRetailerId());
|
|
|
338 |
}
|
|
|
339 |
return fofoIds;
|
| 23985 |
tejbeer |
340 |
}
|
| 23936 |
tejbeer |
341 |
|
| 23985 |
tejbeer |
342 |
|
| 22551 |
ashik.ali |
343 |
}
|