Subversion Repositories SmartDukaan

Rev

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

Rev 4815 Rev 4882
Line 1... Line 1...
1
package in.shop2020.serving.controllers;
1
package in.shop2020.serving.controllers;
2
 
2
 
3
import in.shop2020.datalogger.EventType;
3
import in.shop2020.datalogger.EventType;
4
import in.shop2020.model.v1.catalog.Item;
-
 
5
import in.shop2020.model.v1.user.Address;
4
import in.shop2020.model.v1.user.Address;
6
import in.shop2020.model.v1.user.Cart;
5
import in.shop2020.model.v1.user.Cart;
7
import in.shop2020.model.v1.user.Line;
-
 
8
import in.shop2020.serving.utils.FormattingUtils;
6
import in.shop2020.serving.utils.FormattingUtils;
9
import in.shop2020.serving.utils.Utils;
7
import in.shop2020.serving.utils.Utils;
10
import in.shop2020.thrift.clients.CatalogClient;
-
 
11
import in.shop2020.thrift.clients.LogisticsClient;
-
 
12
import in.shop2020.thrift.clients.UserClient;
8
import in.shop2020.thrift.clients.UserClient;
13
import in.shop2020.utils.DataLogger;
9
import in.shop2020.utils.DataLogger;
14
 
10
 
15
import java.util.Collection;
11
import java.util.Collection;
16
import java.util.List;
-
 
17
import java.util.ResourceBundle;
12
import java.util.ResourceBundle;
18
 
13
 
19
import org.apache.log4j.Logger;
14
import org.apache.log4j.Logger;
20
import org.apache.struts2.convention.annotation.InterceptorRef;
15
import org.apache.struts2.convention.annotation.InterceptorRef;
21
import org.apache.struts2.convention.annotation.InterceptorRefs;
16
import org.apache.struts2.convention.annotation.InterceptorRefs;
Line 35... Line 30...
35
public class ProceedToPayController extends BaseController {
30
public class ProceedToPayController extends BaseController {
36
    
31
    
37
    private static Logger logger = Logger.getLogger(ProceedToPayController.class);
32
    private static Logger logger = Logger.getLogger(ProceedToPayController.class);
38
    
33
    
39
    private static final ResourceBundle resource = ResourceBundle.getBundle(ProceedToPayController.class.getName());
34
    private static final ResourceBundle resource = ResourceBundle.getBundle(ProceedToPayController.class.getName());
40
    private static final double COD_MIN_AMOUNT = Double.parseDouble(resource.getString("cod_min_amount"));
-
 
41
    private static final double COD_MAX_AMOUNT = Double.parseDouble(resource.getString("cod_max_amount")); 
-
 
42
    private static final String RECAPTCHA_PUBLIC_KEY = resource.getString("recaptcha_public_key");
-
 
43
    private static final boolean SHOW_EBS_TEST_GATEWAY = Boolean.parseBoolean(resource.getString("show_ebs_test_gateway"));
35
    private static final boolean SHOW_EBS_TEST_GATEWAY = Boolean.parseBoolean(resource.getString("show_ebs_test_gateway"));
44
    
36
    
45
    private long addressId = -1;
37
    private long addressId = -1;
46
    private String totalAmount = "";
38
    private String totalAmount = "";
47
    private boolean showCodOption = true;
39
    private boolean showCodOption = true;
Line 81... Line 73...
81
        
73
        
82
        UserClient userContextServiceClient = null;
74
        UserClient userContextServiceClient = null;
83
        in.shop2020.model.v1.user.UserContextService.Client userClient = null;
75
        in.shop2020.model.v1.user.UserContextService.Client userClient = null;
84
        
76
        
85
        Address address;
77
        Address address;
86
        List<Line> lineItems;
-
 
87
        String itemIdString = "";
78
        String itemIdString = "";
88
        try {
79
        try {
89
            userContextServiceClient = new UserClient();
80
            userContextServiceClient = new UserClient();
90
            userClient = userContextServiceClient.getClient();
81
            userClient = userContextServiceClient.getClient();
91
            
82
            
Line 101... Line 92...
101
            logger.info("Coupon: " + couponCode);
92
            logger.info("Coupon: " + couponCode);
102
            
93
            
103
            setTotalAmount(cart);
94
            setTotalAmount(cart);
104
            itemIdString = Utils.getItemIdStringInCart(cart);
95
            itemIdString = Utils.getItemIdStringInCart(cart);
105
            
96
            
106
            //Get the line items to check if COD option should be shown.
-
 
107
            lineItems = cart.getLines();
-
 
108
            
97
            
109
            // Get the address to check if COD option is available for this
98
            // Get the address to check if COD option is available for this
110
            // address.
99
            // address.
111
            if(addressId == -1){
100
            if(addressId == -1){
112
                addressId = cart.getAddressId();
101
                addressId = cart.getAddressId();
Line 170... Line 159...
170
    
159
    
171
    public boolean shouldShowEbsTestGateway() {
160
    public boolean shouldShowEbsTestGateway() {
172
        return SHOW_EBS_TEST_GATEWAY;
161
        return SHOW_EBS_TEST_GATEWAY;
173
    }
162
    }
174
    
163
    
175
    public String getPublicKey(){
-
 
176
        return RECAPTCHA_PUBLIC_KEY;
-
 
177
    }
-
 
178
 
-
 
179
	@Override
164
	@Override
180
	public String getHeaderSnippet() {
165
	public String getHeaderSnippet() {
181
		String url = request.getQueryString();
166
		String url = request.getQueryString();
182
		if (url == null) {
167
		if (url == null) {
183
			url = "";
168
			url = "";