| Line 9... |
Line 9... |
| 9 |
import in.shop2020.model.v1.user.PromotionService;
|
9 |
import in.shop2020.model.v1.user.PromotionService;
|
| 10 |
import in.shop2020.serving.controllers.BaseController;
|
10 |
import in.shop2020.serving.controllers.BaseController;
|
| 11 |
import in.shop2020.thrift.clients.UserContextServiceClient;
|
11 |
import in.shop2020.thrift.clients.UserContextServiceClient;
|
| 12 |
import in.shop2020.thrift.clients.PromotionServiceClient;
|
12 |
import in.shop2020.thrift.clients.PromotionServiceClient;
|
| 13 |
|
13 |
|
| 14 |
import in.shop2020.model.v1.user.Cart;
|
14 |
@SuppressWarnings("serial")
|
| 15 |
|
- |
|
| 16 |
@Results({
|
15 |
@Results({
|
| 17 |
@Result(name = "redirect", type = "redirectAction", params = {"actionName" , "cart"})
|
16 |
@Result(name = "redirect", type = "redirectAction", params = {"actionName" , "cart"})
|
| 18 |
})
|
17 |
})
|
| 19 |
public class PromotionController extends BaseController {
|
18 |
public class PromotionController extends BaseController {
|
| 20 |
|
19 |
|
| Line 44... |
Line 43... |
| 44 |
addActionError("Coupon Code field cannot be left empty");
|
43 |
addActionError("Coupon Code field cannot be left empty");
|
| 45 |
return "redirect";
|
44 |
return "redirect";
|
| 46 |
}
|
45 |
}
|
| 47 |
promotionServiceClient = new PromotionServiceClient();
|
46 |
promotionServiceClient = new PromotionServiceClient();
|
| 48 |
PromotionService.Client promotionClient = promotionServiceClient.getClient();
|
47 |
PromotionService.Client promotionClient = promotionServiceClient.getClient();
|
| 49 |
Cart cart = promotionClient.applyCoupon(couponCode, cartId);
|
48 |
promotionClient.applyCoupon(couponCode, cartId);
|
| 50 |
}
|
49 |
}
|
| 51 |
else if (action.equals("removecoupon")) {
|
50 |
else if (action.equals("removecoupon")) {
|
| 52 |
userServiceClient = new UserContextServiceClient();
|
51 |
userServiceClient = new UserContextServiceClient();
|
| 53 |
UserContextService.Client userClient = userServiceClient.getClient();
|
52 |
UserContextService.Client userClient = userServiceClient.getClient();
|
| 54 |
userClient.removeCoupon(cartId);
|
53 |
userClient.removeCoupon(cartId);
|