Subversion Repositories SmartDukaan

Rev

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

Rev 3128 Rev 3499
Line 30... Line 30...
30
@SuppressWarnings("serial")
30
@SuppressWarnings("serial")
31
public class UserOrderInfoController extends BaseController {
31
public class UserOrderInfoController extends BaseController {
32
    private static Logger log = Logger.getLogger(Class.class);
32
    private static Logger log = Logger.getLogger(Class.class);
33
    private static BlueDartTrackingService blueDartTrackingService = new BlueDartTrackingService();
33
    private static BlueDartTrackingService blueDartTrackingService = new BlueDartTrackingService();
34
 
34
 
35
    private long userId;
-
 
36
    private long orderId;
35
    private long orderId;
-
 
36
    private Order order;
37
    private Map<String, String> userOrder;
37
    private Map<String, String> userOrder;
38
    private List<Map<String, String>> lineItemsList;
38
    private List<Map<String, String>> lineItemsList;
39
    private List<Map<String, String>> paymentsList;
39
    private List<Map<String, String>> paymentsList;
40
    private List<ShipmentUpdate> shipmentUpdates;
40
    private List<ShipmentUpdate> shipmentUpdates;
41
 
41
 
Line 45... Line 45...
45
 
45
 
46
    public String index() throws Exception {
46
    public String index() throws Exception {
47
        PaymentClient paymentServiceClient = new PaymentClient();
47
        PaymentClient paymentServiceClient = new PaymentClient();
48
        TransactionClient transactionServiceClient = new TransactionClient();
48
        TransactionClient transactionServiceClient = new TransactionClient();
49
 
49
 
50
        Order order = null;
-
 
51
        try {
50
        try {
52
            order = transactionServiceClient.getClient().getOrderForCustomer(orderId, userId);
51
            order = transactionServiceClient.getClient().getOrder(orderId);
53
        }
52
        }
54
        catch (Exception e) {
53
        catch (Exception e) {
55
            addActionError("Invalid order id or no order selected.");
54
            addActionError("Invalid order id or no order selected.");
56
            return "index";
55
            return "index";
57
        }
56
        }
Line 104... Line 103...
104
            paymentMap.put("amount", Double.toString(payment.getAmount()));
103
            paymentMap.put("amount", Double.toString(payment.getAmount()));
105
            paymentMap.put("status", payment.getStatus().name());
104
            paymentMap.put("status", payment.getStatus().name());
106
            try {
105
            try {
107
                paymentMap.put("gatewayname", paymentServiceClient.getClient().getPaymentGateway(payment.getGatewayId()).getName());
106
                paymentMap.put("gatewayname", paymentServiceClient.getClient().getPaymentGateway(payment.getGatewayId()).getName());
108
            }
107
            }
109
            catch (TApplicationException e) {
108
            catch (TException e) {
110
                log.warn("No payment gateway set", e);
109
                log.warn("No payment gateway set", e);
111
            }
110
            }
112
            paymentMap.put("paymethod", getPaymentMethod(payment.getAttributes()));
111
            paymentMap.put("paymethod", getPaymentMethod(payment.getAttributes()));
113
            
112
            
114
            if (payment.getSuccessTimestamp() != 0) {
113
            if (payment.getSuccessTimestamp() != 0) {
Line 207... Line 206...
207
            }
206
            }
208
        }
207
        }
209
        return paymentMethod != null ? paymentMethod : "N/A";
208
        return paymentMethod != null ? paymentMethod : "N/A";
210
    }
209
    }
211
 
210
 
212
    public void setUserId(String userId) {
-
 
213
        try {
-
 
214
            this.userId = Long.parseLong(userId);
-
 
215
        }
-
 
216
        catch (NumberFormatException e) {
-
 
217
            log.error(e);
-
 
218
        }
-
 
219
    }
-
 
220
 
-
 
221
    public void setOrderId(String orderId) {
211
    public void setOrderId(String orderId) {
222
        try {
212
        try {
223
            this.orderId = Long.parseLong(orderId);
213
            this.orderId = Long.parseLong(orderId);
224
        }
214
        }
225
        catch (NumberFormatException e) {
215
        catch (NumberFormatException e) {
226
            log.error(e);
216
            log.error(e);
227
        }
217
        }
228
    }
218
    }
229
 
219
 
230
    public Long getUserId() {
-
 
231
        return userId;
-
 
232
    }
-
 
233
 
-
 
234
    public Map<String, String> getUserOrder() {
220
    public Map<String, String> getUserOrder() {
235
        return userOrder;
221
        return userOrder;
236
    }
222
    }
237
 
223
 
238
    public List<Map<String, String>> getLineItemsList() {
224
    public List<Map<String, String>> getLineItemsList() {
Line 248... Line 234...
248
    }
234
    }
249
 
235
 
250
    public void setShipmentUpdates(List<ShipmentUpdate> shipmentUpdates) {
236
    public void setShipmentUpdates(List<ShipmentUpdate> shipmentUpdates) {
251
        this.shipmentUpdates = shipmentUpdates;
237
        this.shipmentUpdates = shipmentUpdates;
252
    }
238
    }
-
 
239
 
-
 
240
    public Order getOrder() {
-
 
241
        return order;
-
 
242
    }
-
 
243
 
-
 
244
    public void setOrder(Order order) {
-
 
245
        this.order = order;
-
 
246
    }
253
}
247
}
254
248