Subversion Repositories SmartDukaan

Rev

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

Rev 24166 Rev 24198
Line 90... Line 90...
90
		for (CartItems ci: cartItems) {
90
		for (CartItems ci: cartItems) {
91
			if (itemRepository.selectById(ci.getItemId()).getHsnCode().equals("NOGST")) {
91
			if (itemRepository.selectById(ci.getItemId()).getHsnCode().equals("NOGST")) {
92
				noGst=true;
92
				noGst=true;
93
			}
93
			}
94
		}
94
		}
-
 
95
		JSONObject cartMessage=null;
95
		for (CartItems ci: cartItems) {
96
		for (CartItems ci: cartItems) {
96
			if (noGst && !itemRepository.selectById(ci.getItemId()).getHsnCode().equals("NOGST")) {
97
			if (noGst && !itemRepository.selectById(ci.getItemId()).getHsnCode().equals("NOGST")) {
-
 
98
				if(cartMessage == null) {
-
 
99
					cartMessage = new JSONObject();
97
				throw new ProfitMandiBusinessException("Cart Items", "NOGST", "Billable and Nonbillable orders can't be processed together");
100
					cartMessage.put("messageText", "Billable items can't be billed along with non Billable items");
-
 
101
				}
-
 
102
				continue;
98
			}
103
			}
99
			itemsList.add(ci.getItemId());
104
			itemsList.add(ci.getItemId());
100
			ItemQuantity iq = new ItemQuantity(ci.getItemId(), ci.getQuantity());
105
			ItemQuantity iq = new ItemQuantity(ci.getItemId(), ci.getQuantity());
101
			itemQuantities.add(iq);
106
			itemQuantities.add(iq);
102
		}
107
		}
-
 
108
		if(cartMessage == null) {
-
 
109
			cartMessage = new JSONObject();
-
 
110
		}
-
 
111
 
103
		Client userClient = null;
112
		Client userClient = null;
104
		try {
113
		try {
105
			userClient = new UserClient().getClient();
114
			userClient = new UserClient().getClient();
106
			userClient.addItemsToCart(Integer.valueOf(userAccount.getAccountKey()), itemQuantities, null);
115
			userClient.addItemsToCart(Integer.valueOf(userAccount.getAccountKey()), itemQuantities, null);
107
		} catch (Exception e) {
116
		} catch (Exception e) {
Line 184... Line 193...
184
		JSONArray cartMessagesArray = new JSONArray();
193
		JSONArray cartMessagesArray = new JSONArray();
185
		for (String message :Arrays.asList("cartMessageOOS", "cartMessageUndeliverable", "cartMessageChanged","cartMessagesMerged")){
194
		for (String message :Arrays.asList("cartMessageOOS", "cartMessageUndeliverable", "cartMessageChanged","cartMessagesMerged")){
186
			int count = cartObj.getInt(message);
195
			int count = cartObj.getInt(message);
187
			if (count>0) {
196
			if (count>0) {
188
				String type="danger";
197
				String type="danger";
189
				JSONObject cartMessage=new JSONObject();
-
 
190
				if (message.equals("cartMessagesMerged")) {
198
				if (message.equals("cartMessagesMerged")) {
191
					type = "info";
199
					type = "info";
192
					if (count==1){
200
					if (count==1){
193
						cartMessage.put("messageText","1 item is added from earlier cart");
201
						cartMessage.put("messageText","1 item is added from earlier cart");
194
					}else {
202
					}else {