Subversion Repositories SmartDukaan

Rev

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

Rev 17945 Rev 20600
Line 1... Line 1...
1
package in.shop2020.mobileapi.serving.controllers;
1
package in.shop2020.mobileapi.serving.controllers;
2
 
2
 
-
 
3
import in.shop2020.config.ConfigException;
3
import in.shop2020.logistics.DeliveryType;
4
import in.shop2020.logistics.DeliveryType;
4
import in.shop2020.metamodel.util.ProductPojo;
5
import in.shop2020.metamodel.util.ProductPojo;
5
import in.shop2020.mobileapi.serving.pojos.CartPojo;
6
import in.shop2020.mobileapi.serving.pojos.CartPojo;
6
import in.shop2020.mobileapi.serving.pojos.RedirectPojo;
7
import in.shop2020.mobileapi.serving.pojos.RedirectPojo;
7
import in.shop2020.mobileapi.serving.services.ContentServingService;
8
import in.shop2020.mobileapi.serving.services.ContentServingService;
Line 18... Line 19...
18
import in.shop2020.model.v1.user.ShoppingCartException;
19
import in.shop2020.model.v1.user.ShoppingCartException;
19
import in.shop2020.model.v1.user.UserContextService;
20
import in.shop2020.model.v1.user.UserContextService;
20
import in.shop2020.thrift.clients.CatalogClient;
21
import in.shop2020.thrift.clients.CatalogClient;
21
import in.shop2020.thrift.clients.PromotionClient;
22
import in.shop2020.thrift.clients.PromotionClient;
22
import in.shop2020.thrift.clients.UserClient;
23
import in.shop2020.thrift.clients.UserClient;
-
 
24
import in.shop2020.thrift.clients.config.ConfigClient;
23
 
25
 
24
import java.util.ArrayList;
26
import java.util.ArrayList;
25
import java.util.Arrays;
27
import java.util.Arrays;
26
import java.util.List;
28
import java.util.List;
27
import java.util.Map;
29
import java.util.Map;
Line 74... Line 76...
74
    public UserContextService.Client getClient() throws Exception{
76
    public UserContextService.Client getClient() throws Exception{
75
    	userClient = new UserClient().getClient();
77
    	userClient = new UserClient().getClient();
76
    	return userClient;
78
    	return userClient;
77
    }	
79
    }	
78
    public String index() {
80
    public String index() {
-
 
81
		try {
-
 
82
			if(ConfigClient.getClient().get("SALES_FLAG").equals("0")){
-
 
83
				cartPojoJson = new Gson().toJson(new CartPojo());
-
 
84
				return "index";
-
 
85
			}
-
 
86
		} catch (ConfigException e1) {
-
 
87
			cartPojoJson = new Gson().toJson(new CartPojo());
-
 
88
			return "index";
-
 
89
		}
79
        if(id != -1){
90
        if(id != -1){
80
            try {
91
            try {
81
            	String cc = null;
92
            	String cc = null;
82
            	log.info(privateDealUser + "  "  + autoApplicationOff);
93
            	log.info(privateDealUser + "  "  + autoApplicationOff);
83
            	if(privateDealUser && !autoApplicationOff) {
94
            	if(privateDealUser && !autoApplicationOff) {
Line 109... Line 120...
109
 
120
 
110
    public String create() {
121
    public String create() {
111
    	RedirectPojo rp = new RedirectPojo();
122
    	RedirectPojo rp = new RedirectPojo();
112
    	rp.setRedirectUrl("");
123
    	rp.setRedirectUrl("");
113
        try {
124
        try {
-
 
125
        	
-
 
126
			if(ConfigClient.getClient().get("SALES_FLAG").equals("1")){
-
 
127
				cartMsg = getClient().addItemToCart(id, itemId, 1, -1);
-
 
128
			} else {
-
 
129
				cartMsg = "Sale is off";
-
 
130
			}
114
        	//Try adding to cart
131
        	//Try adding to cart
115
            cartMsg = getClient().addItemToCart(id, itemId, 1, -1);
-
 
116
            log.info("Cart message while adding item to cart - " + cartMsg);
132
            log.info("Cart message while adding item to cart - " + cartMsg);
117
            //If could not add to cart try to add notification reminder if email exists.
133
            //If could not add to cart try to add notification reminder if email exists.
118
            if (!("".equals(cartMsg))) {
134
            if (!("".equals(cartMsg))) {
119
            	String emailId = this.request.getParameter("email");
135
            	String emailId = this.request.getParameter("email");
120
            	log.info("QuesyString" + this.request.getParameterMap().toString());
136
            	log.info("QuesyString" + this.request.getParameterMap().toString());