| Line 194... |
Line 194... |
| 194 |
responseMap.put("updateAvailable", true);
|
194 |
responseMap.put("updateAvailable", true);
|
| 195 |
}
|
195 |
}
|
| 196 |
return responseSender.ok(responseMap);
|
196 |
return responseSender.ok(responseMap);
|
| 197 |
}
|
197 |
}
|
| 198 |
|
198 |
|
| - |
|
199 |
/** A partner whose store is SUSPENDED or CLOSED is logged out; retailers without a store are not affected. */
|
| - |
|
200 |
private void assertStoreCanLogin(int retailerId) throws ProfitMandiBusinessException {
|
| - |
|
201 |
FofoStore fofoStore;
|
| - |
|
202 |
try {
|
| - |
|
203 |
fofoStore = fofoStoreRepository.selectByRetailerId(retailerId);
|
| - |
|
204 |
} catch (ProfitMandiBusinessException e) {
|
| - |
|
205 |
return;
|
| - |
|
206 |
}
|
| - |
|
207 |
assertStoreCanLogin(fofoStore);
|
| - |
|
208 |
}
|
| - |
|
209 |
|
| - |
|
210 |
private void assertStoreCanLogin(FofoStore fofoStore) throws ProfitMandiBusinessException {
|
| - |
|
211 |
if (!fofoStore.getStoreStatus().canLogin()) {
|
| - |
|
212 |
throw new ProfitMandiBusinessException("STORE_LOGIN_BLOCKED", fofoStore.getCode(), "Your store " + fofoStore.getCode() + " is "
|
| - |
|
213 |
+ fofoStore.getStoreStatus().name().toLowerCase() + ". Please contact your sales manager.");
|
| - |
|
214 |
}
|
| - |
|
215 |
}
|
| - |
|
216 |
|
| 199 |
private Map<String, Object> getAuthTokenMap(String email, GoogleLoginRequest loginRequest) throws Exception {
|
217 |
private Map<String, Object> getAuthTokenMap(String email, GoogleLoginRequest loginRequest) throws Exception {
|
| 200 |
String name = authService.getNameByEmailId(email);
|
218 |
String name = authService.getNameByEmailId(email);
|
| 201 |
|
219 |
|
| 202 |
Map<String, Object> responseMap = new HashMap<>(2);
|
220 |
Map<String, Object> responseMap = new HashMap<>(2);
|
| 203 |
LOGGER.info("User Name from getNameByEmailId({}) is {}", email, name);
|
221 |
LOGGER.info("User Name from getNameByEmailId({}) is {}", email, name);
|
| Line 264... |
Line 282... |
| 264 |
return responseMap;
|
282 |
return responseMap;
|
| 265 |
}
|
283 |
}
|
| 266 |
} else {
|
284 |
} else {
|
| 267 |
List<Integer> roleIds = userRoleRepository.selectRoleIdsByUserId(user.getId());
|
285 |
List<Integer> roleIds = userRoleRepository.selectRoleIdsByUserId(user.getId());
|
| 268 |
int retailerId = userAccountRepository.selectRetailerIdByUserId(user.getId());
|
286 |
int retailerId = userAccountRepository.selectRetailerIdByUserId(user.getId());
|
| - |
|
287 |
assertStoreCanLogin(retailerId);
|
| 269 |
String[] roleTypes = new String[roleIds.size()];
|
288 |
String[] roleTypes = new String[roleIds.size()];
|
| 270 |
int index = 0;
|
289 |
int index = 0;
|
| 271 |
for (int roleId : roleIds) {
|
290 |
for (int roleId : roleIds) {
|
| 272 |
roleTypes[index++] = String.valueOf(roleId);
|
291 |
roleTypes[index++] = String.valueOf(roleId);
|
| 273 |
}
|
292 |
}
|
| Line 392... |
Line 411... |
| 392 |
}
|
411 |
}
|
| 393 |
|
412 |
|
| 394 |
if (retailer.isActive() || user.isActivated()) {
|
413 |
if (retailer.isActive() || user.isActivated()) {
|
| 395 |
if (roleManager.isPartner(roleIdsSet)) {
|
414 |
if (roleManager.isPartner(roleIdsSet)) {
|
| 396 |
FofoStore fofoStore = fofoStoreRepository.selectByRetailerId(saholicUser.getId());
|
415 |
FofoStore fofoStore = fofoStoreRepository.selectByRetailerId(saholicUser.getId());
|
| - |
|
416 |
assertStoreCanLogin(fofoStore);
|
| - |
|
417 |
responseMap.put("storeStatus", fofoStore.getStoreStatus().name());
|
| 397 |
if (fofoStore.isActive()) {
|
418 |
if (fofoStore.isActive()) {
|
| 398 |
responseMap.put(ProfitMandiConstants.USER_STATUS, UserStatus.FOFO.getValue());
|
419 |
responseMap.put(ProfitMandiConstants.USER_STATUS, UserStatus.FOFO.getValue());
|
| 399 |
responseMap.put("storeUrl", retailerService.getAllFofoRetailerIdUrlMap().get(uc.getUserId()));
|
420 |
responseMap.put("storeUrl", retailerService.getAllFofoRetailerIdUrlMap().get(uc.getUserId()));
|
| 400 |
responseMap.put("timelineStatus", this.getTimeLineStatus(uc.getUserId()));
|
421 |
responseMap.put("timelineStatus", this.getTimeLineStatus(uc.getUserId()));
|
| 401 |
if(fofoStore.isTrial()) {
|
422 |
if(fofoStore.isTrial()) {
|