Subversion Repositories SmartDukaan

Rev

Rev 6360 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 6360 Rev 6466
Line 1... Line 1...
1
package in.shop2020.support.controllers;
1
package in.shop2020.support.controllers;
2
 
2
 
3
import java.util.ArrayList;
-
 
4
import java.util.List;
-
 
5
 
-
 
6
import in.shop2020.model.v1.user.UserContextService;
-
 
7
import in.shop2020.model.v1.user.PromotionService.Client;
-
 
8
import in.shop2020.model.v1.user.Coupon;
3
import in.shop2020.model.v1.user.Coupon;
-
 
4
import in.shop2020.model.v1.user.PromotionService.Client;
-
 
5
import in.shop2020.model.v1.user.UserContextService;
9
import in.shop2020.support.utils.ReportsUtils;
6
import in.shop2020.support.utils.ReportsUtils;
10
import in.shop2020.thrift.clients.PromotionClient;
7
import in.shop2020.thrift.clients.PromotionClient;
11
import in.shop2020.thrift.clients.UserClient;
8
import in.shop2020.thrift.clients.UserClient;
12
 
9
 
-
 
10
import java.util.ArrayList;
-
 
11
import java.util.List;
-
 
12
 
13
import javax.servlet.http.HttpServletRequest;
13
import javax.servlet.http.HttpServletRequest;
14
import javax.servlet.http.HttpSession;
14
import javax.servlet.http.HttpSession;
15
 
15
 
16
import org.apache.struts2.convention.annotation.InterceptorRef;
16
import org.apache.struts2.convention.annotation.InterceptorRef;
17
import org.apache.struts2.convention.annotation.InterceptorRefs;
17
import org.apache.struts2.convention.annotation.InterceptorRefs;
18
import org.apache.struts2.convention.annotation.Result;
18
import org.apache.struts2.convention.annotation.Result;
19
import org.apache.struts2.convention.annotation.Results;
19
import org.apache.struts2.convention.annotation.Results;
20
import org.apache.struts2.interceptor.ServletRequestAware;
20
import org.apache.struts2.interceptor.ServletRequestAware;
21
import org.apache.velocity.util.introspection.MethodMap.AmbiguousException;
-
 
22
import org.json.JSONException;
21
import org.json.JSONException;
23
import org.json.JSONObject;
22
import org.json.JSONObject;
24
import org.slf4j.Logger;
23
import org.slf4j.Logger;
25
import org.slf4j.LoggerFactory;
24
import org.slf4j.LoggerFactory;
26
 
25
 
Line 94... Line 93...
94
						coupons.add(couponInfo);
93
						coupons.add(couponInfo);
95
						
94
						
96
					} catch (JSONException e) {
95
					} catch (JSONException e) {
97
						log.error("" + e);
96
						log.error("" + e);
98
					}
97
					}
99
				} else {
98
				} else if (coupon.getPromotion().getId() == 26){
100
					try {
99
					try {
101
						voucherIssued++;
100
						voucherIssued++;
102
						long redeemeCount = promotionClient.getSuccessfulPaymentCountForCoupon(coupon.getCouponCode());
101
						long redeemedCount = promotionClient.getSuccessfulPaymentCountForCoupon(coupon.getCouponCode());
103
						voucherRedeemed += redeemeCount;
102
						voucherRedeemed += redeemedCount;
104
						voucherInCart += userClient.getCartsWithCouponCount(coupon.getCouponCode());
103
						voucherInCart += userClient.getCartsWithCouponCount(coupon.getCouponCode());
105
						JSONObject argsJSON = new JSONObject(coupon.getArguments());
104
						JSONObject argsJSON = new JSONObject(coupon.getArguments());
106
						if(redeemeCount > 0){
105
						if(redeemedCount > 0){
107
							voucherAmountRedeemed += argsJSON.getDouble("discount");
106
							voucherAmountRedeemed += argsJSON.getDouble("discount");
108
						}
107
						}
109
					} catch (Exception e) {
108
					} catch (Exception e) {
110
						log.error("" + e);
109
						log.error("" + e);
111
					}
110
					}