public IActionResult Post([FromBody] OrderDetails details) { Dictionary <string, string> response = new Dictionary <string, string>(); try { if (details != null) { string orderData = JsonConvert.SerializeObject(details); ProcessMessage _payment = new ProcessMessage(_config); string result = string.Empty; int responseCode = _payment.ProcessMessageMethod(details, ref result); switch (responseCode) { case 202: return(Accepted(result)); case 400: return(BadRequest(result)); } return(Ok()); } else { response["message"] = "Body should not be empty"; response["code"] = "400"; return(BadRequest(response)); } } catch (JsonSerializationException ex) { response["message"] = "Invalid Data Format " + ex.Message; response["code"] = "400"; return(BadRequest(response)); } catch (Exception ex) { response["message"] = "(500) internal server error " + ex.Message; response["code"] = "500"; return(StatusCode(StatusCodes.Status500InternalServerError, response)); } }