Subversion Repositories SmartDukaan

Rev

Rev 35458 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 35458 Rev 36418
Line 47... Line 47...
47
import com.spice.profitmandi.service.LogisticsService;
47
import com.spice.profitmandi.service.LogisticsService;
48
 
48
 
49
import in.shop2020.model.v1.order.OrderStatusGroups;
49
import in.shop2020.model.v1.order.OrderStatusGroups;
50
import io.swagger.annotations.ApiImplicitParam;
50
import io.swagger.annotations.ApiImplicitParam;
51
import io.swagger.annotations.ApiImplicitParams;
51
import io.swagger.annotations.ApiImplicitParams;
52
import okhttp3.OkHttpClient;
-
 
53
import okhttp3.Request;
-
 
54
import okhttp3.Response;
-
 
55
 
52
 
56
@Controller
53
@Controller
57
@Transactional(rollbackFor = Throwable.class)
54
@Transactional(rollbackFor = Throwable.class)
58
public class TrackingController {
55
public class TrackingController {
59
 
56
 
Line 113... Line 110...
113
		LOGGER.info("tdm" + tdm);
110
		LOGGER.info("tdm" + tdm);
114
 
111
 
115
		return responseSender.ok(tdm);
112
		return responseSender.ok(tdm);
116
	}
113
	}
117
 
114
 
118
	private TrackingDetailModel getDelhiveryTracking(String airwayBillNo) throws IOException {
115
	private TrackingDetailModel getDelhiveryTracking(String airwayBillNo) throws Exception {
119
		String url = "https://track.delhivery.com/api/v1/packages/json/";
116
		String fullUrl = "https://track.delhivery.com/api/v1/packages/json/?waybill="
120
 
-
 
121
		OkHttpClient client = new OkHttpClient();
-
 
122
 
-
 
123
		Request request1 = new Request.Builder()
-
 
124
				.url(url + "?waybill=" + String.join(",", airwayBillNo) + "&token=" + token).get().build();
117
				+ String.join(",", airwayBillNo) + "&token=" + token;
125
 
-
 
126
		LOGGER.info("request1" + request1);
118
		LOGGER.info("delhivery tracking url {}", fullUrl);
127
 
-
 
128
		Response response1 = client.newCall(request1).execute();
119
		String responseBody = restClient.get(fullUrl, null, null);
129
 
-
 
130
		LOGGER.info("jsonbj" + response1.body());
-
 
131
 
-
 
132
		JSONObject jsonObj = new JSONObject(response1.body().string());
120
		JSONObject jsonObj = new JSONObject(responseBody);
133
 
121
 
134
		LOGGER.info("jsonObj" + jsonObj);
122
		LOGGER.info("jsonObj" + jsonObj);
135
 
123
 
136
		JSONArray shipmentData = jsonObj.getJSONArray("ShipmentData");
124
		JSONArray shipmentData = jsonObj.getJSONArray("ShipmentData");
137
 
125