Subversion Repositories SmartDukaan

Rev

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

Rev 21735 Rev 21738
Line 17... Line 17...
17
import org.springframework.http.HttpStatus;
17
import org.springframework.http.HttpStatus;
18
import org.springframework.http.MediaType;
18
import org.springframework.http.MediaType;
19
import org.springframework.http.ResponseEntity;
19
import org.springframework.http.ResponseEntity;
20
import org.springframework.stereotype.Controller;
20
import org.springframework.stereotype.Controller;
21
import org.springframework.transaction.annotation.Transactional;
21
import org.springframework.transaction.annotation.Transactional;
22
import org.springframework.web.bind.annotation.PathVariable;
-
 
23
import org.springframework.web.bind.annotation.RequestBody;
22
import org.springframework.web.bind.annotation.RequestBody;
24
import org.springframework.web.bind.annotation.RequestMapping;
23
import org.springframework.web.bind.annotation.RequestMapping;
25
import org.springframework.web.bind.annotation.RequestMethod;
24
import org.springframework.web.bind.annotation.RequestMethod;
26
import org.springframework.web.bind.annotation.RequestParam;
25
import org.springframework.web.bind.annotation.RequestParam;
27
 
26
 
28
import com.google.gson.Gson;
27
import com.google.gson.Gson;
29
import com.spice.profitmandi.common.model.ProfitMandiConstants;
28
import com.spice.profitmandi.common.model.ProfitMandiConstants;
30
import com.spice.profitmandi.dao.entity.dtr.UserAccounts;
29
import com.spice.profitmandi.dao.entity.dtr.UserAccounts;
31
import com.spice.profitmandi.dao.enumuration.dtr.AccountType;
30
import com.spice.profitmandi.dao.enumuration.dtr.AccountType;
32
import com.spice.profitmandi.dao.model.ProductPojo;
31
import com.spice.profitmandi.dao.model.ProductPojo;
-
 
32
import com.spice.profitmandi.dao.model.UserCart;
33
import com.spice.profitmandi.dao.repository.dtr.UserAccountRepository;
33
import com.spice.profitmandi.dao.repository.dtr.UserAccountRepository;
34
import com.spice.profitmandi.dao.util.ContentPojoPopulator;
34
import com.spice.profitmandi.dao.util.ContentPojoPopulator;
35
import com.spice.profitmandi.dao.util.LogisticsService;
35
import com.spice.profitmandi.dao.util.LogisticsService;
36
import com.spice.profitmandi.thrift.clients.UserClient;
36
import com.spice.profitmandi.thrift.clients.UserClient;
37
import com.spice.profitmandi.web.model.ProfitMandiResponse;
37
import com.spice.profitmandi.web.model.ProfitMandiResponse;
Line 227... Line 227...
227
		@ApiImplicitParam(name = "Auth-Token", value = "Auth-Token", 
227
		@ApiImplicitParam(name = "Auth-Token", value = "Auth-Token", 
228
				required = true, dataType = "string", paramType = "header")
228
				required = true, dataType = "string", paramType = "header")
229
	})
229
	})
230
	
230
	
231
	@ApiOperation(value = "Change address")
231
	@ApiOperation(value = "Change address")
232
	public ResponseEntity<?> changeAddress(HttpServletRequest request,@PathVariable(value="cartId") long cartId, @RequestParam(value="addressId") long addressId) throws Throwable{
232
	public ResponseEntity<?> changeAddress(HttpServletRequest request, @RequestParam(value="addressId") long addressId) throws Throwable{
-
 
233
		UserCart uc = userAccountRepository.getUserCart((int)request.getAttribute("userId"));
233
    	UserContextService.Client userClient = new UserClient().getClient();
234
    	UserContextService.Client userClient = new UserClient().getClient();
234
    	userClient.addAddressToCart(cartId, addressId);
235
    	userClient.addAddressToCart(uc.getCartId(), addressId);
235
    	return responseSender.ok("Address Changed successfully");
236
    	return responseSender.ok("Address Changed successfully");
236
    }
237
    }
237
}
238
}
238
239