| Line 1... |
Line 1... |
| 1 |
package in.shop2020.mobileapi.serving.utils;
|
1 |
package in.shop2020.mobileapi.serving.utils;
|
| 2 |
|
2 |
|
| 3 |
import in.shop2020.config.ConfigException;
|
3 |
import in.shop2020.config.ConfigException;
|
| - |
|
4 |
import in.shop2020.model.v1.catalog.ExclusiveAffiliateItemInfo;
|
| 4 |
import in.shop2020.model.v1.order.LineItem;
|
5 |
import in.shop2020.model.v1.order.LineItem;
|
| 5 |
import in.shop2020.model.v1.order.Order;
|
6 |
import in.shop2020.model.v1.order.Order;
|
| 6 |
import in.shop2020.model.v1.order.RechargeOrderStatus;
|
7 |
import in.shop2020.model.v1.order.RechargeOrderStatus;
|
| 7 |
import in.shop2020.model.v1.order.RechargePlan;
|
8 |
import in.shop2020.model.v1.order.RechargePlan;
|
| 8 |
import in.shop2020.model.v1.order.RechargeType;
|
9 |
import in.shop2020.model.v1.order.RechargeType;
|
| 9 |
import in.shop2020.model.v1.user.Cart;
|
10 |
import in.shop2020.model.v1.user.Cart;
|
| 10 |
import in.shop2020.model.v1.user.Line;
|
11 |
import in.shop2020.model.v1.user.Line;
|
| - |
|
12 |
import in.shop2020.thrift.clients.CatalogClient;
|
| 11 |
import in.shop2020.thrift.clients.TransactionClient;
|
13 |
import in.shop2020.thrift.clients.TransactionClient;
|
| 12 |
import in.shop2020.thrift.clients.config.ConfigClient;
|
14 |
import in.shop2020.thrift.clients.config.ConfigClient;
|
| 13 |
|
15 |
|
| 14 |
import java.util.ArrayList;
|
16 |
import java.util.ArrayList;
|
| 15 |
import java.util.Arrays;
|
17 |
import java.util.Arrays;
|
| 16 |
import java.util.Collections;
|
18 |
import java.util.Collections;
|
| - |
|
19 |
import java.util.Date;
|
| 17 |
import java.util.HashMap;
|
20 |
import java.util.HashMap;
|
| 18 |
import java.util.List;
|
21 |
import java.util.List;
|
| 19 |
import java.util.Map;
|
22 |
import java.util.Map;
|
| 20 |
|
23 |
|
| 21 |
import javax.mail.internet.AddressException;
|
24 |
import javax.mail.internet.AddressException;
|
| Line 40... |
Line 43... |
| 40 |
static Map<Long, String> providersMap;
|
43 |
static Map<Long, String> providersMap;
|
| 41 |
static Map<Long, String> mobileProvidersMap;
|
44 |
static Map<Long, String> mobileProvidersMap;
|
| 42 |
static Map<Long, String> dthProvidersMap;
|
45 |
static Map<Long, String> dthProvidersMap;
|
| 43 |
static Map<Long, List<RechargePlan>> operatorPlanMap = new HashMap<Long, List<RechargePlan>>();
|
46 |
static Map<Long, List<RechargePlan>> operatorPlanMap = new HashMap<Long, List<RechargePlan>>();
|
| 44 |
private static Map<String, Map<String, String>> uriOperatorMap = new HashMap<String, Map<String,String>>();
|
47 |
private static Map<String, Map<String, String>> uriOperatorMap = new HashMap<String, Map<String,String>>();
|
| - |
|
48 |
static Map<Long, ExclusiveAffiliateItemInfo> exclusiveAffiliateItems = null;
|
| - |
|
49 |
static long fifteenMinsCounter = 0l;
|
| 45 |
|
50 |
|
| 46 |
public static final List<RechargeOrderStatus> refundableRechargeStatusList = new ArrayList<RechargeOrderStatus>(Arrays.asList(new RechargeOrderStatus[]
|
51 |
public static final List<RechargeOrderStatus> refundableRechargeStatusList = new ArrayList<RechargeOrderStatus>(Arrays.asList(new RechargeOrderStatus[]
|
| 47 |
{RechargeOrderStatus.RECHARGE_FAILED,
|
52 |
{RechargeOrderStatus.RECHARGE_FAILED,
|
| 48 |
RechargeOrderStatus.RECHARGE_FAILED_REFUNDED}));
|
53 |
RechargeOrderStatus.RECHARGE_FAILED_REFUNDED}));
|
| 49 |
|
54 |
|
| Line 254... |
Line 259... |
| 254 |
}
|
259 |
}
|
| 255 |
|
260 |
|
| 256 |
public static Map<String, String> getOperatorByUri(String uri){
|
261 |
public static Map<String, String> getOperatorByUri(String uri){
|
| 257 |
return uriOperatorMap.get(uri);
|
262 |
return uriOperatorMap.get(uri);
|
| 258 |
}
|
263 |
}
|
| - |
|
264 |
|
| - |
|
265 |
|
| - |
|
266 |
|
| - |
|
267 |
public static Map<Long, ExclusiveAffiliateItemInfo> getExclusiveAffiliateItems(){
|
| - |
|
268 |
try{
|
| - |
|
269 |
CatalogClient client = new CatalogClient();
|
| - |
|
270 |
if(exclusiveAffiliateItems == null || fifteenMinsCounter > new Date().getTime()) {
|
| - |
|
271 |
exclusiveAffiliateItems = client.getClient().getExAffiliateItemInfo();
|
| - |
|
272 |
fifteenMinsCounter = new Date().getTime() + 15*60000;
|
| - |
|
273 |
}
|
| - |
|
274 |
}catch(Exception ce){
|
| - |
|
275 |
logger.error("Unable to fetch exclusive items from catalog", ce);
|
| - |
|
276 |
}
|
| - |
|
277 |
return exclusiveAffiliateItems;
|
| - |
|
278 |
}
|
| 259 |
}
|
279 |
}
|
| 260 |
|
280 |
|