public JsonResult Send(string messageType, string jsonMessage) { PgNotification notification = _notificationDeserialize.DeserializeNotification(messageType, jsonMessage); PGResponseBasic response = null; if(notification==null) { response = new PGResponseBasic {Result = "Invalid", ErrorInfo = "Failed"}; }else { response = new PGResponseBasic { Result = "OK", ErrorInfo = "Success" }; } return Json(response); }
public JsonResult MSend(string messageType, string jsonMessage) { PgNotification notification = _notificationDeserialize.DeserializeNotification(messageType, jsonMessage); PGResponseBasic response = null; if (notification == null) { response = new PGResponseBasic { Result = "Invalid", ErrorInfo = "Failed" }; } else { try { RequestMessage msg= null; _resolveRequestService.ProcessRequest(notification, out msg); StartTheSaveAndSendThread(notification, msg); response = new PGResponseBasic { Result = "OK", ErrorInfo = "Success" }; } catch (Exception ex) { } } return Json(response); }
public ActionResult SLSendSimulator(string messageType, string jsonMessage)//sl { ContentResult cResult = new ContentResult(); cResult.ContentType = "application/json"; cResult.ContentEncoding = Encoding.UTF8; cResult.Content = null; ClientRequestResponseBase crrRequestMessage = _messageDeserialize.DeserializeClientRequest(messageType, jsonMessage); _auditLogRepository.AddLog(crrRequestMessage.DistributorCostCenterId, crrRequestMessage.ClientRequestResponseType.ToString() + "Request", "From SL client", "Json: " + jsonMessage); object response = null; if (crrRequestMessage == null) { response = new PGResponseBasic { Result = "Invalid", ErrorInfo = "Failed" }; } else { try { ClientRequestResponseBase serverResponse = null; if (crrRequestMessage.ClientRequestResponseType == ClientRequestResponseType.AsynchronousPaymentNotification || crrRequestMessage.ClientRequestResponseType == ClientRequestResponseType.BuyGoodsNotification) { var notifList = _resolveMessageService.ProcessClientPaymentNotificationRequest(crrRequestMessage); response = notifList; } else { ServiceProvider sp = _resolveMessageService.GetServiceProvider(crrRequestMessage.DistributorCostCenterId); if (sp == null) response = ThrowError("This service provider is not registered.", crrRequestMessage); else { ServerRequestBase msgToSDP = null; _resolveMessageService.ProcessClientRequest(crrRequestMessage, sp, out msgToSDP); //StartTheSaveAndSendThread(crrMessage, msg); if (crrRequestMessage.ClientRequestResponseType == ClientRequestResponseType.PaymentInstrument) serverResponse = SaveNSend(crrRequestMessage, msgToSDP); else serverResponse = SaveNSendSimulator(crrRequestMessage, msgToSDP); response = serverResponse; } } } catch (WebException we) { //response = new ResponseBasic { Result = "Failed", ErrorInfo = "Unable to contact remote server.\n" + we.Message }; response = ThrowError("Unable to contact remote server.\n" + we.Message, crrRequestMessage); } catch (Exception ex) { //response = new ResponseBasic {Result = "Failed", ErrorInfo = ex.Message}; response = ThrowError(ex.Message, crrRequestMessage); } } string result = JsonConvert.SerializeObject(response, new IsoDateTimeConverter()); _auditLogRepository.AddLog(crrRequestMessage.DistributorCostCenterId, messageType + "Response", "To SL client", "Json: " + result); cResult.Content = result; return cResult; }