Subversion Repositories SmartDukaan

Rev

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

Rev 3101 Rev 3126
Line 8... Line 8...
8
import in.shop2020.model.v1.user.Line;
8
import in.shop2020.model.v1.user.Line;
9
import in.shop2020.model.v1.user.User;
9
import in.shop2020.model.v1.user.User;
10
import in.shop2020.model.v1.user.UserContextService;
10
import in.shop2020.model.v1.user.UserContextService;
11
import in.shop2020.serving.utils.FormattingUtils;
11
import in.shop2020.serving.utils.FormattingUtils;
12
import in.shop2020.serving.utils.Utils;
12
import in.shop2020.serving.utils.Utils;
13
import in.shop2020.thrift.clients.CatalogServiceClient;
13
import in.shop2020.thrift.clients.CatalogClient;
14
import in.shop2020.thrift.clients.UserContextServiceClient;
14
import in.shop2020.thrift.clients.UserClient;
15
import in.shop2020.utils.DataLogger;
15
import in.shop2020.utils.DataLogger;
16
 
16
 
17
import java.util.ArrayList;
17
import java.util.ArrayList;
18
import java.util.Collection;
18
import java.util.Collection;
19
import java.util.HashMap;
19
import java.util.HashMap;
Line 60... Line 60...
60
	 // GET /shipping
60
	 // GET /shipping
61
	 public String index() {
61
	 public String index() {
62
    	long userId = userinfo.getUserId();
62
    	long userId = userinfo.getUserId();
63
    	long cartId = userinfo.getCartId();
63
    	long cartId = userinfo.getCartId();
64
    	try {
64
    	try {
65
			UserContextService.Client userClient = (new UserContextServiceClient()).getClient();
65
			UserContextService.Client userClient = (new UserClient()).getClient();
66
			userClient.checkOut(cartId);
66
			userClient.checkOut(cartId);
67
			Cart cart = userClient.getCart(cartId);
67
			Cart cart = userClient.getCart(cartId);
68
			long defaultAddressId = cart.getAddressId();
68
			long defaultAddressId = cart.getAddressId();
69
			if (defaultAddressId == 0) {
69
			if (defaultAddressId == 0) {
70
			    defaultAddressId = userClient.getDefaultAddressId(userId);
70
			    defaultAddressId = userClient.getDefaultAddressId(userId);
Line 94... Line 94...
94
    	return "index";
94
    	return "index";
95
	 }
95
	 }
96
 
96
 
97
	// POST /entity
97
	// POST /entity
98
	public String create(){
98
	public String create(){
99
		UserContextServiceClient userContextServiceClient = null;
99
		UserClient userContextServiceClient = null;
100
		in.shop2020.model.v1.user.UserContextService.Client userClient = null;
100
		in.shop2020.model.v1.user.UserContextService.Client userClient = null;
101
		
101
		
102
    	String action = this.request.getParameter("action");
102
    	String action = this.request.getParameter("action");
103
		if(action == null){
103
		if(action == null){
104
			return "failure";
104
			return "failure";
105
		}
105
		}
106
		
106
		
107
		try {
107
		try {
108
			userContextServiceClient = new UserContextServiceClient();
108
			userContextServiceClient = new UserClient();
109
			userClient = userContextServiceClient.getClient();
109
			userClient = userContextServiceClient.getClient();
110
			
110
			
111
			if(action != null){
111
			if(action != null){
112
				if(action.equals("add")){
112
				if(action.equals("add")){
113
					boolean invalidInput = false;
113
					boolean invalidInput = false;
Line 188... Line 188...
188
		List<Address> addresses = null;
188
		List<Address> addresses = null;
189
		long defaultAddressId = 0;
189
		long defaultAddressId = 0;
190
		String fullName = "";
190
		String fullName = "";
191
		String phoneNumber = "";
191
		String phoneNumber = "";
192
 
192
 
193
		CatalogServiceClient catalogServiceClient  = null;
193
		CatalogClient catalogServiceClient  = null;
194
		in.shop2020.model.v1.catalog.InventoryService.Client catalogClient = null;
194
		in.shop2020.model.v1.catalog.InventoryService.Client catalogClient = null;
195
		UserContextServiceClient userContextServiceClient = null;
195
		UserClient userContextServiceClient = null;
196
		in.shop2020.model.v1.user.UserContextService.Client userClient = null;
196
		in.shop2020.model.v1.user.UserContextService.Client userClient = null;
197
		
197
		
198
		FormattingUtils formattingUtils = new FormattingUtils();
198
		FormattingUtils formattingUtils = new FormattingUtils();
199
		
199
		
200
		try {
200
		try {
201
			catalogServiceClient = new CatalogServiceClient();
201
			catalogServiceClient = new CatalogClient();
202
			catalogClient = catalogServiceClient.getClient();
202
			catalogClient = catalogServiceClient.getClient();
203
			userContextServiceClient = new UserContextServiceClient();
203
			userContextServiceClient = new UserClient();
204
			userClient = userContextServiceClient.getClient();
204
			userClient = userContextServiceClient.getClient();
205
			
205
			
206
			Cart cart = userClient.getCart(cartId);
206
			Cart cart = userClient.getCart(cartId);
207
			List<Line> lineItems = cart.getLines();
207
			List<Line> lineItems = cart.getLines();
208
			
208