Subversion Repositories SmartDukaan

Rev

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

Rev 6294 Rev 6307
Line 54... Line 54...
54
    private String userId;
54
    private String userId;
55
    private String message = "";
55
    private String message = "";
56
    private String errorMessage = "";
56
    private String errorMessage = "";
57
    private String totalAmount = "";
57
    private String totalAmount = "";
58
    private String plan = "";
58
    private String plan = "";
-
 
59
    private String circleCode;
59
    private static final String chars = "abcdefghijklmonpqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789";
60
    private static final String chars = "abcdefghijklmonpqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789";
60
    private static final Random random = new Random();
61
    private static final Random random = new Random();
61
    private static final int LENGTH = 10;
62
    private static final int LENGTH = 10;
62
    private static Logger log = Logger.getLogger(Class.class);
63
    private static Logger log = Logger.getLogger(Class.class);
63
    
64
    
Line 111... Line 112...
111
    
112
    
112
    public String validateRecharge(){
113
    public String validateRecharge(){
113
    	TransactionClient tcl;
114
    	TransactionClient tcl;
114
    	try {
115
    	try {
115
    		tcl = new TransactionClient();
116
    		tcl = new TransactionClient();
116
    		return tcl.getClient().validateRecharge(RechargeType.findByValue(Integer.parseInt(this.rechargeType)), number);
117
    		return tcl.getClient().validateRecharge(RechargeType.findByValue(Integer.parseInt(this.rechargeType)), number, circleCode, Long.parseLong(operator));
117
    	} catch (Exception e) {
118
    	} catch (Exception e) {
118
    		log.error("Unable to get service provider for Device number " + number + " and rechargeType : " +  rechargeType, e);
119
    		log.error("Unable to get service provider for Device number " + number + " and rechargeType : " +  rechargeType, e);
119
    	}
120
    	}
120
    	return "Oops! There seems to be a problem. Please try after some time";
121
    	return "Oops! There seems to be a problem. Please try after some time";
121
    	
122
    	
122
    }
123
    }
123
    
124
    
-
 
125
    public boolean shouldPromptForWallet(){
-
 
126
        if(!isLoggedIn()) {
-
 
127
            try {
-
 
128
                TransactionClient tc = new TransactionClient();
-
 
129
                UserWallet wallet = tc.getClient().getUserWallet(Long.parseLong(userId));
-
 
130
                if(wallet.getAmount() != 0) {
-
 
131
                    return true;
-
 
132
                }
-
 
133
            } catch (Exception e) {
-
 
134
                log.error("Unable to get wallet for userId : " + userId, e);
-
 
135
            }
-
 
136
        }
-
 
137
        return false;
-
 
138
    }
-
 
139
    
124
    public String createRecharge(){
140
    public String createRecharge(){
125
        if (amount.equals("0")) {
141
        if (amount.equals("0")) {
126
            if (!verifyCaptcha()) {
142
            if (!verifyCaptcha()) {
127
                setErrorMessage("Invalid captcha. Try Again.");
143
                setErrorMessage("Invalid captcha. Try Again.");
128
                log.info("Invalid captcha error msg has been added");
144
                log.info("Invalid captcha error msg has been added");
Line 359... Line 375...
359
    }
375
    }
360
 
376
 
361
    public void setErrorMessage(String errorMessage) {
377
    public void setErrorMessage(String errorMessage) {
362
        this.errorMessage = errorMessage;
378
        this.errorMessage = errorMessage;
363
    }
379
    }
-
 
380
 
-
 
381
    public String getCircleCode() {
-
 
382
        return circleCode;
-
 
383
    }
-
 
384
 
-
 
385
    public void setCircleCode(String circleCode) {
-
 
386
        this.circleCode = circleCode;
-
 
387
    }
364
    
388
    
365
}
389
}