Subversion Repositories SmartDukaan

Rev

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

Rev 4882 Rev 5572
Line 37... Line 37...
37
    private long addressId = -1;
37
    private long addressId = -1;
38
    private String totalAmount = "";
38
    private String totalAmount = "";
39
    private boolean showCodOption = true;
39
    private boolean showCodOption = true;
40
    private boolean showEmiOption = false;
40
    private boolean showEmiOption = false;
41
    private String errorMsg = "";
41
    private String errorMsg = "";
-
 
42
    private String deliveryLocation = ""; //This could be set as myLocation or HotSpot
-
 
43
    private boolean showStorePickUpOption = false;
-
 
44
    private long hotSpotAddressId = 1;
42
    
45
    
43
    public String index(){
46
    public String index(){
44
        return processPaymentOptions();
47
        return processPaymentOptions();
45
    }
48
    }
46
    
49
    
Line 78... Line 81...
78
        String itemIdString = "";
81
        String itemIdString = "";
79
        try {
82
        try {
80
            userContextServiceClient = new UserClient();
83
            userContextServiceClient = new UserClient();
81
            userClient = userContextServiceClient.getClient();
84
            userClient = userContextServiceClient.getClient();
82
            
85
            
-
 
86
            
83
            long cartId = userinfo.getCartId();
87
            long cartId = userinfo.getCartId();
-
 
88
            if(deliveryLocation.equals("myLocation")) {
-
 
89
                userClient.addStoreToCart(cartId, 0);
84
                  
90
            }
-
 
91
            
-
 
92
            if (deliveryLocation.equals("HotSpot")) {
-
 
93
                addressId = hotSpotAddressId ;
-
 
94
                showStorePickUpOption = true;
-
 
95
            }
85
            // Validate the cart to ensure that we are not accepting payment for
96
            // Validate the cart to ensure that we are not accepting payment for
86
            // an invalid order.
97
            // an invalid order.
87
            errorMsg = userClient.validateCart(cartId, sourceId);
98
            errorMsg = userClient.validateCart(cartId, sourceId);
88
            
99
            
89
            Cart cart = userClient.getCart(cartId);
100
            Cart cart = userClient.getCart(cartId);
Line 107... Line 118...
107
            } catch(Exception e) {
118
            } catch(Exception e) {
108
                logger.error("Error while checking if COD is available for: " + showCodOption, e);
119
                logger.error("Error while checking if COD is available for: " + showCodOption, e);
109
                showCodOption = false; //Not a critical error, proceeding with defensive behaviour.
120
                showCodOption = false; //Not a critical error, proceeding with defensive behaviour.
110
            }
121
            }
111
            
122
            
-
 
123
            
-
 
124
            
112
            DataLogger.logData(EventType.PROCEED_TO_PAY, getSessionId(), userinfo.getUserId(), userinfo.getEmail(),
125
            DataLogger.logData(EventType.PROCEED_TO_PAY, getSessionId(), userinfo.getUserId(), userinfo.getEmail(),
113
                    Long.toString(cartId), itemIdString);
126
                    Long.toString(cartId), itemIdString);
114
        } catch(Exception e) {
127
        } catch(Exception e) {
115
            logger.error("Error while either validating the cart or getting the address", e);
128
            logger.error("Error while either validating the cart or getting the address", e);
116
            addActionError("We are experiencing some problem. Please try again.");
129
            addActionError("We are experiencing some problem. Please try again.");
Line 170... Line 183...
170
			url = "?" + url;
183
			url = "?" + url;
171
		}
184
		}
172
		url = request.getRequestURI() + url;
185
		url = request.getRequestURI() + url;
173
		return pageLoader.getHeaderHtml(userinfo.isLoggedIn(), userinfo.getEmail(), url , 0, false);
186
		return pageLoader.getHeaderHtml(userinfo.isLoggedIn(), userinfo.getEmail(), url , 0, false);
174
	}
187
	}
-
 
188
 
-
 
189
    public String getDeliveryLocation() {
-
 
190
        return deliveryLocation;
-
 
191
    }
-
 
192
 
-
 
193
    public void setDeliveryLocation(String deliveryLocation) {
-
 
194
        this.deliveryLocation = deliveryLocation;
-
 
195
    }
-
 
196
 
-
 
197
    public long getHotSpotAddressId() {
-
 
198
        return hotSpotAddressId;
-
 
199
    }
-
 
200
 
-
 
201
    public void setHotSpotAddressId(long hotSpotAddressId) {
-
 
202
        this.hotSpotAddressId = hotSpotAddressId;
-
 
203
    }
-
 
204
 
-
 
205
    public boolean shouldShowStorePickUpOption() {
-
 
206
        return showStorePickUpOption;
-
 
207
    }
175
}
208
}
176
209