diff --git a/Controllers/RvfController.cs b/Controllers/RvfController.cs index 1c9da9a..419171b 100644 --- a/Controllers/RvfController.cs +++ b/Controllers/RvfController.cs @@ -40,8 +40,12 @@ namespace rockfishCore.Controllers } else { - //is there a valid trial request + //is there an Approved UnFetched trial request for this DB ID? var req = await ct.TrialRequest.Where(z => z.DbId == dbid && z.DtFetched == null && z.Status == TrialRequest.TrialRequestStatus.Approved).FirstOrDefaultAsync(); + if (req == null) + { + return NotFound(); + } LicenseKey = req.Key; req.DtFetched = DateUtil.NowAsEpoch(); await ct.SaveChangesAsync(); @@ -60,20 +64,7 @@ namespace rockfishCore.Controllers } }); - // - // //This is to simulate the scenarios where there is no license to return - // //either due to no current account / canceled or simply no license exists - // //Changes here must be reflected in RAVEN Util.License.Fetch block - // bool bTestStatusOtherThanOk = false; - // if (bTestStatusOtherThanOk) - // { - // return Json(new {Status="NONE", Reason="No license"}); - // //return Json(new {Status="Canceled", Reason="Non payment"}); - // } - // else - // { - // return Ok(RavenKeyFactory.GetRavenTestKey(dbid)); - // } + }