Subversion Repositories SmartDukaan

Rev

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

Rev 27453 Rev 27457
Line 1085... Line 1085...
1085
	public void createGeofence() throws IOException, ProfitMandiBusinessException {
1085
	public void createGeofence() throws IOException, ProfitMandiBusinessException {
1086
 
1086
 
1087
		List<FofoStore> fofoStores = fofoStoreRepository.selectActiveStores();
1087
		List<FofoStore> fofoStores = fofoStoreRepository.selectActiveStores();
1088
		for (FofoStore fofoStore : fofoStores) {
1088
		for (FofoStore fofoStore : fofoStores) {
1089
			if (fofoStore.getLatitude() != null && fofoStore.getLongitude() != null) {
1089
			if (fofoStore.getLatitude() != null && fofoStore.getLongitude() != null) {
1090
				CustomRetailer customRetailer = retailerService.getFofoRetailer(157112773);
1090
				CustomRetailer customRetailer = retailerService.getFofoRetailer(fofoStore.getId());
1091
				OkHttpClient client = new OkHttpClient();
1091
				OkHttpClient client = new OkHttpClient();
1092
				okhttp3.MediaType mediaType = okhttp3.MediaType.parse("application/json");
1092
				okhttp3.MediaType mediaType = okhttp3.MediaType.parse("application/json");
1093
				JSONObject geofe = new JSONObject();
1093
				JSONObject geofe = new JSONObject();
1094
				JSONArray geofences = new JSONArray();
1094
				JSONArray geofences = new JSONArray();
1095
				JSONObject geometry = new JSONObject();
1095
				JSONObject geometry = new JSONObject();
Line 1141... Line 1141...
1141
		Response response = client.newCall(request1).execute();
1141
		Response response = client.newCall(request1).execute();
1142
 
1142
 
1143
		LOGGER.info("response" + response.body().string());
1143
		LOGGER.info("response" + response.body().string());
1144
	}
1144
	}
1145
 
1145
 
-
 
1146
	@RequestMapping(value = "/deletegeofence", method = RequestMethod.DELETE, produces = MediaType.APPLICATION_JSON_VALUE)
-
 
1147
	public void deleteGeofences(List<String> geofenceIds) throws IOException, ProfitMandiBusinessException {
-
 
1148
		OkHttpClient client = new OkHttpClient();
-
 
1149
 
-
 
1150
		String authString = "Basic "
-
 
1151
				+ Base64.getEncoder().encodeToString(String.format("%s:%s", ACCOUNT_ID, SECRET_KEY).getBytes());
-
 
1152
 
-
 
1153
		for (String geofenceId : geofenceIds) {
-
 
1154
			Request request1 = new Request.Builder().url("https://v3.api.hypertrack.com/geofences/" + geofenceId)
-
 
1155
					.delete().addHeader("Authorization", authString).build();
-
 
1156
			LOGGER.info("geofenceId" + geofenceId);
-
 
1157
			Response response = client.newCall(request1).execute();
-
 
1158
 
-
 
1159
			LOGGER.info("response" + response.body().string());
-
 
1160
		}
-
 
1161
 
-
 
1162
	}
-
 
1163
 
1146
	public void processSchemeOut(int fofoId, int orderId) throws Exception {
1164
	public void processSchemeOut(int fofoId, int orderId) throws Exception {
1147
		schemeService.processSchemeOut(orderId, fofoId);
1165
		schemeService.processSchemeOut(orderId, fofoId);
1148
 
1166
 
1149
	}
1167
	}
1150
}
1168
}