Subversion Repositories SmartDukaan

Rev

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

Rev 306 Rev 484
Line 1... Line 1...
1
package in.shop2020.hotspot.dashbaord.server.handler;
1
package in.shop2020.hotspot.dashbaord.server.handler;
2
 
2
 
3
import in.shop2020.hotspot.dashbaord.shared.actions.AddressRequest;
3
import in.shop2020.hotspot.dashbaord.shared.actions.AddressRequest;
4
import in.shop2020.hotspot.dashbaord.shared.actions.AddressResponse;
4
import in.shop2020.hotspot.dashbaord.shared.actions.AddressResponse;
5
import in.shop2020.hotspot.dashbaord.shared.data.Address;
5
import in.shop2020.hotspot.dashbaord.shared.data.Address;
-
 
6
import in.shop2020.model.v1.order.Order;
6
import in.shop2020.model.v1.order.ShipmentInfo;
7
import in.shop2020.model.v1.order.ShipmentInfo;
7
import in.shop2020.model.v1.order.Transaction;
8
import in.shop2020.model.v1.order.Transaction;
8
import in.shop2020.model.v1.order.TransactionService.Client;
9
import in.shop2020.model.v1.order.TransactionService.Client;
9
import in.shop2020.thrift.clients.TransactionServiceClient;
10
import in.shop2020.thrift.clients.TransactionServiceClient;
10
import net.customware.gwt.dispatch.server.ActionHandler;
11
import net.customware.gwt.dispatch.server.ActionHandler;
Line 17... Line 18...
17
	public AddressResponse execute(AddressRequest request, ExecutionContext context)
18
	public AddressResponse execute(AddressRequest request, ExecutionContext context)
18
			throws ActionException {
19
			throws ActionException {
19
		try{
20
		try{
20
			TransactionServiceClient client = new TransactionServiceClient();
21
			TransactionServiceClient client = new TransactionServiceClient();
21
			Client c = client.getClient();
22
			Client c = client.getClient();
22
			ShipmentInfo sionfo = c.getShippingInfo(request.getOrder().getTransactionId());
23
			Order t_order = c.getOrder(request.getOrder().getOrderId());
23
			if (sionfo == null || sionfo.getShipments() == null || sionfo.getShipments().size() == 0){
24
			if (t_order == null ){
24
				Address a = new Address("Ashish", "D-15/15, GF,", "Ardee City", "Sector-52", "Gold Souk", "Gurgaon", "Haryana", "India", "122003", "9811384697");
25
				Address a = new Address("Ashish", "D-15/15, GF,", "Ardee City", "Sector-52", "Gold Souk", "Gurgaon", "Haryana", "India", "122003", "9811384697");
25
				return new AddressResponse(a);
26
				return new AddressResponse(a);
26
			}else{
27
			}else{
27
				String address = sionfo.getShipments().iterator().next().getAddress();
28
				String address = t_order.getCustomer_address();
28
				Address a = new Address(address);
29
				Address a = new Address(address);
29
				return new AddressResponse(a);
30
				return new AddressResponse(a);
30
				
31
				//TODO remove hardcoding
31
			}
32
			}
32
			
33
			
33
		}catch(Exception e){
34
		}catch(Exception e){
34
			Address a = new Address("Ashish", "D-15/15, GF,", "Ardee City", "Sector-52", "Gold Souk", "Gurgaon", "Haryana", "India", "122003", "9811384697");
35
			Address a = new Address("Ashish", "D-15/15, GF,", "Ardee City", "Sector-52", "Gold Souk", "Gurgaon", "Haryana", "India", "122003", "9811384697");
35
			return new AddressResponse(a);
36
			return new AddressResponse(a);