| Line 4... |
Line 4... |
| 4 |
import in.shop2020.model.v1.order.OrderStatus;
|
4 |
import in.shop2020.model.v1.order.OrderStatus;
|
| 5 |
import in.shop2020.serving.utils.FormattingUtils;
|
5 |
import in.shop2020.serving.utils.FormattingUtils;
|
| 6 |
import in.shop2020.thrift.clients.TransactionServiceClient;
|
6 |
import in.shop2020.thrift.clients.TransactionServiceClient;
|
| 7 |
|
7 |
|
| 8 |
import java.text.SimpleDateFormat;
|
8 |
import java.text.SimpleDateFormat;
|
| - |
|
9 |
import java.util.Arrays;
|
| 9 |
import java.util.Collections;
|
10 |
import java.util.Collections;
|
| 10 |
import java.util.Date;
|
11 |
import java.util.Date;
|
| 11 |
import java.util.List;
|
12 |
import java.util.List;
|
| 12 |
|
13 |
|
| 13 |
import org.apache.log4j.Logger;
|
14 |
import org.apache.log4j.Logger;
|
| Line 26... |
Line 27... |
| 26 |
@Result(name="redirect", type="redirectAction",
|
27 |
@Result(name="redirect", type="redirectAction",
|
| 27 |
params = {"actionName" , "login"})
|
28 |
params = {"actionName" , "login"})
|
| 28 |
})
|
29 |
})
|
| 29 |
public class FailedOrdersController extends BaseController {
|
30 |
public class FailedOrdersController extends BaseController {
|
| 30 |
private static Logger logger = Logger.getLogger(FailedOrdersController.class);
|
31 |
private static Logger logger = Logger.getLogger(FailedOrdersController.class);
|
| - |
|
32 |
private static final List<OrderStatus> statuses = Arrays.asList(new OrderStatus[] {OrderStatus.PAYMENT_FAILED});
|
| - |
|
33 |
|
| 31 |
private FormattingUtils formattingUtils = new FormattingUtils();
|
34 |
private FormattingUtils formattingUtils = new FormattingUtils();
|
| 32 |
|
- |
|
| 33 |
List<Order> orders = null;
|
- |
|
| 34 |
SimpleDateFormat dateformat = new SimpleDateFormat("dd/MM/yyyy hh:mm:ss aa");
|
35 |
SimpleDateFormat dateformat = new SimpleDateFormat("dd/MM/yyyy hh:mm:ss aa");
|
| - |
|
36 |
List<Order> orders = null;
|
| 35 |
|
37 |
|
| 36 |
public String index(){
|
38 |
public String index(){
|
| 37 |
logger.info("this.request=" + this.request);
|
39 |
logger.info("this.request=" + this.request);
|
| 38 |
|
40 |
|
| 39 |
try {
|
41 |
try {
|
| 40 |
TransactionServiceClient transactionServiceClient = new TransactionServiceClient();
|
42 |
TransactionServiceClient transactionServiceClient = new TransactionServiceClient();
|
| 41 |
in.shop2020.model.v1.order.TransactionService.Client orderClient = transactionServiceClient.getClient();
|
43 |
in.shop2020.model.v1.order.TransactionService.Client orderClient = transactionServiceClient.getClient();
|
| - |
|
44 |
|
| 42 |
orders = orderClient.getOrdersForCustomer(userinfo.getUserId(), 0, (new Date()).getTime(), OrderStatus.PAYMENT_FAILED);
|
45 |
orders = orderClient.getOrdersForCustomer(userinfo.getUserId(), 0, (new Date()).getTime(), statuses);
|
| 43 |
//Reverse the list of order. Last come should be displayed first.
|
46 |
//Reverse the list of order. Last come should be displayed first.
|
| 44 |
Collections.reverse(orders);
|
47 |
Collections.reverse(orders);
|
| 45 |
} catch (Exception e) {
|
48 |
} catch (Exception e) {
|
| 46 |
logger.error("Unable to get the failed orders of the customer", e);
|
49 |
logger.error("Unable to get the failed orders of the customer", e);
|
| 47 |
}
|
50 |
}
|