*/
public Notification getNotificationFromRequest(HttpServletRequest request) throws CheckoutException {
if (Utils.isSerialNumberRequest(request)) {
String serialNumber = request.getParameter(SERIAL_NUMBER_PARAMETER);
if (serialNumber == null) {
throw new CheckoutException("Couldn't find serial number in parameters");
}
return apiContext.reportsRequester().requestNotification(serialNumber);
} else {
String auth = request.getHeader("Authorization");
if (!apiContext.isValidAuth(auth)) {
throw new CheckoutException("Invalid auth found");
}
try {
return (Notification)Utils.fromXML(request.getInputStream()).getValue();
} catch (Exception e) {
throw new CheckoutException("Could not retrieve notification", e);
}
}
}