Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def issueOrderCreditRequest(locale: String, orderId: Int): Action[AnyContent] = Action { implicit request => {
- val requestPattern = request.attrs.get(Router.Attrs.HandlerDef)
- requestPattern.get.path
- request.path;
- Logger.info("Testing info")
- Logger.warn("Testing warn")
- Logger.debug("Testing debug")
- Logger.trace("Testing trace")
- val requestBody: JsValue = request.body.asJson.get;
- val pathVairableResult = super.validateRequestPathParams(Schemas.orderSchemaFilePath, Json.toJson(Map("orderId" -> orderId)))
- pathVairableResult.fold(
- invalid = { errors =>
- BadRequest(JsonHelper.convertToJson(JsonHelper.throwValidationException(errors))).as("application/json")
- },
- valid = { post => {
- val schemaResult = super.validateRequestBody(Schemas.orderSchemaFilePath, requestBody)
- schemaResult.fold(requestBodyErrors => {
- BadRequest(JsonHelper.convertToJson(JsonHelper.throwValidationException(requestBodyErrors))).as("application/json")
- },
- post => {})
- }
- })
- audit(request)
- val foo= JsonHelper.getJsonValue(requestBody, "foo").toInt;
- val bar = JsonHelper.getJsonValue(requestBody, "bar");
- val result = FOOBAR.GETFOOBAR(BAZ, locale);
- if (result == 0 || foo> result) {
- BadRequest(JsonHelper.convertToJson("")).as("application/json")
- }
- //... somecode
- .
- .
- .
- Ok(JsonHelper.convertToJson("OK")).as("application/json")
Add Comment
Please, Sign In to add comment