Subversion Repositories SmartDukaan

Rev

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

Rev 6727 Rev 6730
Line 71... Line 71...
71
    private Long minDiscountableVal;
71
    private Long minDiscountableVal;
72
    private Long startHour;
72
    private Long startHour;
73
    private Long startMinute;
73
    private Long startMinute;
74
    private Long endHour;
74
    private Long endHour;
75
    private Long endMinute;
75
    private Long endMinute;
-
 
76
 
-
 
77
    private String couponCode;
76
	
78
	
77
    public CouponGvsController(){
79
    public CouponGvsController(){
78
	    try {
80
	    try {
79
            psc = new PromotionClient();
81
            psc = new PromotionClient();
80
            pClient = psc.getClient();
82
            pClient = psc.getClient();
Line 184... Line 186...
184
                    arguments = arguments + ", \"startMinute\":" + startMinute.toString();
186
                    arguments = arguments + ", \"startMinute\":" + startMinute.toString();
185
                }
187
                }
186
			    
188
			    
187
			    arguments = arguments + ", \"isCod\":False}";
189
			    arguments = arguments + ", \"isCod\":False}";
188
			    
190
			    
-
 
191
			    if(couponCode == null) {
-
 
192
			        couponCode = "";
-
 
193
			    }
-
 
194
			    
189
				coupon = pClient.createCoupon(type, arguments, false, null);
195
				coupon = pClient.createCoupon(type, couponCode, arguments, false, null);
190
			} catch (Exception e){
196
			} catch (Exception e){
191
				return "authsuccess";
197
				return "authsuccess";
192
			}
198
			}
193
		}
199
		}
194
		return "authsuccess";	
200
		return "authsuccess";	
Line 251... Line 257...
251
	public List<String> getArguments(Coupon coupon){
257
	public List<String> getArguments(Coupon coupon){
252
		List<String> result = new ArrayList<String>();
258
		List<String> result = new ArrayList<String>();
253
		try {
259
		try {
254
			JSONObject obj = new JSONObject(coupon.getArguments());
260
			JSONObject obj = new JSONObject(coupon.getArguments());
255
			result.add(obj.getString("emails"));
261
			result.add(obj.getString("emails"));
-
 
262
			try {
-
 
263
    			if(obj.getString("discountType").equals("absolute")) {
256
			result.add(obj.getString("discount"));
264
    			    result.add(obj.getString("discount"));
-
 
265
    			} else {
-
 
266
    			    result.add(obj.getString("discount") + " %");
-
 
267
    			}
-
 
268
    		} catch (JSONException e){
-
 
269
    		    result.add(obj.getString("discount"));
-
 
270
    		}
-
 
271
    		
-
 
272
    		try {
-
 
273
    			result.add(obj.getString("couponType"));
-
 
274
    		} catch (JSONException e){
-
 
275
    		    result.add("Physical");
-
 
276
    		}
-
 
277
    		
257
		} catch (JSONException e) {
278
		} catch (JSONException e) {
258
			// TODO Auto-generated catch block
279
			result.add("ERROR");
259
			e.printStackTrace();
280
			result.add("ERROR");
-
 
281
			result.add("ERROR");
260
		}
282
		}
261
		return result;
283
		return result;
262
	}
284
	}
263
		
285
		
264
	public void setId(String id) {
286
	public void setId(String id) {
Line 396... Line 418...
396
 
418
 
397
 
419
 
398
    public void setEndMinute(Long endMinute) {
420
    public void setEndMinute(Long endMinute) {
399
        this.endMinute = endMinute;
421
        this.endMinute = endMinute;
400
    }
422
    }
-
 
423
 
-
 
424
 
-
 
425
    public String getCouponCode() {
-
 
426
        return couponCode;
-
 
427
    }
-
 
428
 
-
 
429
 
-
 
430
    public void setCouponCode(String couponCode) {
-
 
431
        this.couponCode = couponCode;
-
 
432
    }
401
}
433
}