Subversion Repositories SmartDukaan

Rev

Rev 7151 | Rev 7236 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 7151 Rev 7207
Line 1... Line 1...
1
package in.shop2020.recharge.controllers;
1
package in.shop2020.recharge.controllers;
2
 
2
 
3
import in.shop2020.model.v1.order.FRC;
3
import in.shop2020.model.v1.order.FRC;
-
 
4
import in.shop2020.model.v1.order.HotspotStore;
4
import in.shop2020.model.v1.order.PayMethod;
5
import in.shop2020.model.v1.order.PayMethod;
5
import in.shop2020.model.v1.order.RechargePlan;
6
import in.shop2020.model.v1.order.RechargePlan;
6
import in.shop2020.model.v1.order.RechargeTransaction;
7
import in.shop2020.model.v1.order.RechargeTransaction;
7
import in.shop2020.model.v1.order.RechargeType;
8
import in.shop2020.model.v1.order.RechargeType;
8
import in.shop2020.model.v1.order.TelecomCircle;
9
import in.shop2020.model.v1.order.TelecomCircle;
9
import in.shop2020.thrift.clients.TransactionClient;
10
import in.shop2020.thrift.clients.TransactionClient;
10
 
11
 
11
import java.math.BigInteger;
-
 
12
import java.util.ArrayList;
12
import java.util.ArrayList;
13
import java.util.List;
13
import java.util.List;
14
import java.util.Random;
-
 
15
 
14
 
16
import javax.servlet.http.HttpServletRequest;
15
import javax.servlet.http.HttpServletRequest;
17
 
16
 
18
import org.apache.log4j.Logger;
17
import org.apache.log4j.Logger;
19
import org.apache.struts2.convention.annotation.Result;
18
import org.apache.struts2.convention.annotation.Result;
Line 40... Line 39...
40
    private String email = "";
39
    private String email = "";
41
    private String rechargeType = "";
40
    private String rechargeType = "";
42
    private String deviceType = "";
41
    private String deviceType = "";
43
    private String mobileOperator = "";
42
    private String mobileOperator = "";
44
    private String dthOperator = "";
43
    private String dthOperator = "";
45
    private String storeId = "";
-
 
46
    private String cafNum = "";
44
    private String cafNum = "";
47
    private String simNum = "";
45
    private String simNum = "";
48
    private String altNum = "";
46
    private String altNum = "";
49
    private String name = "";
47
    private String name = "";
50
    private String plan = "";
48
    private String plan = "";
Line 56... Line 54...
56
    private String totalAmount = "";
54
    private String totalAmount = "";
57
    private String couponCode = "";
55
    private String couponCode = "";
58
    private String couponMessage = "";
56
    private String couponMessage = "";
59
    private String hiddenUserId = "";
57
    private String hiddenUserId = "";
60
    private long couponAmount = 0;
58
    private long couponAmount = 0;
61
    private static final BigInteger key = new BigInteger("0333910847013829827302347601486730417451");
-
 
62
    
59
 
63
    private static final Random random = new Random();
-
 
64
    private static final int LENGTH = 10;
-
 
65
    private static final String HEADER_X_FORWARDED_FOR = "X-FORWARDED-FOR";
60
    private static final String HEADER_X_FORWARDED_FOR = "X-FORWARDED-FOR";
66
    private static final String DISHTV = "DISH TV";
61
    private static final String DISHTV = "DISH TV";
67
    private static Logger log = Logger.getLogger(Class.class);
62
    private static Logger log = Logger.getLogger(Class.class);
68
    
63
    
69
    public String index() {
64
    public String index() {
-
 
65
        storeId = Long.parseLong((String) request.getSession().getAttribute("STORE_ID"));
-
 
66
        if(!hotspotStores.containsKey(storeId)){
-
 
67
            try{
-
 
68
                HotspotStore hotSpotStore = (new TransactionClient()).getClient().getHotspotStore(storeId, "");
-
 
69
                hotspotStores.put(storeId, hotSpotStore);
-
 
70
            } catch (Exception e) {
-
 
71
                log.error("Unable to get store", e);
-
 
72
            }
-
 
73
        }
70
        return "index";
74
        return "index";
71
    }
75
    }
72
    
76
    
73
    public String create() {
77
    public String create() {
74
        try {
78
        try {
Line 208... Line 212...
208
                }
212
                }
209
            }
213
            }
210
            
214
            
211
            TransactionClient tc1 = new TransactionClient();
215
            TransactionClient tc1 = new TransactionClient();
212
            rechargeOrder = tc1.getClient().createRechargeTransaction(rechargeOrder);
216
            rechargeOrder = tc1.getClient().createRechargeTransaction(rechargeOrder);
213
            HomeController.hotspotStores.put(rechargeOrder.getStoreId(), tc1.getClient().getHotspotStore(rechargeOrder.getStoreId(), ""));
217
            BaseController.hotspotStores.put(rechargeOrder.getStoreId(), tc1.getClient().getHotspotStore(rechargeOrder.getStoreId(), ""));
214
            setRechargeOrderId(rechargeOrder.getId());
218
            setRechargeOrderId(rechargeOrder.getId());
215
            
219
            
216
        } catch (Exception e) {
220
        } catch (Exception e) {
217
            log.error("Unable to create recharge order", e);
221
            log.error("Unable to create recharge order", e);
218
            errorMessage = "Oops! There seems to be a problem. Please try after some time";
222
            errorMessage = "Oops! There seems to be a problem. Please try after some time";
Line 437... Line 441...
437
 
441
 
438
    public void setDeviceType(String deviceType) {
442
    public void setDeviceType(String deviceType) {
439
        this.deviceType = deviceType;
443
        this.deviceType = deviceType;
440
    }
444
    }
441
 
445
 
442
    public String getStoreId() {
-
 
443
        return storeId;
-
 
444
    }
-
 
445
 
-
 
446
    public void setStoreId(String storeId) {
-
 
447
        this.storeId = storeId;
-
 
448
    }
-
 
449
 
-
 
450
    public String getCafNum() {
446
    public String getCafNum() {
451
        return cafNum;
447
        return cafNum;
452
    }
448
    }
453
 
449
 
454
    public void setCafNum(String cafNum) {
450
    public void setCafNum(String cafNum) {