public async Task <HttpResponseMessage> InstamojoWebHookReceiver(InstamojoWebhookRequest request)
        {
            Services.Log.Info("Instamojo Webhook Request");

            string incidentPropertyName = WebConfigurationManager.AppSettings["RZ_InstamojoIncidentDataField"];

            //var customFieldsObject = JsonConvert.DeserializeObject<InstamojoCustomFields>(request.Custom_Fields);
            //var parsedIncidentGUID = customFieldsObject.Field_25373.value;

            Services.Log.Info(incidentPropertyName);
            Services.Log.Info(request.Custom_Fields);

            JObject customFieldSetObj = JObject.Parse(request.Custom_Fields);

            Services.Log.Info(customFieldSetObj.ToString());
            JObject customFieldInstanceObj = (JObject)customFieldSetObj[incidentPropertyName];

            Services.Log.Info(customFieldInstanceObj.ToString());
            string parsedIncidentGUID = customFieldInstanceObj["value"].ToString();

            Services.Log.Info(parsedIncidentGUID);

            // Set the Payment Platform.
            string nameInstamojo = "Instamojo";

            Payment newPayment = new Payment()
            {
                Id = Guid.NewGuid().ToString(),
                PlatformPaymentID = request.Payment_ID,
                Status            = request.Status,
                BuyerName         = request.Buyer_Name,
                BuyerEmail        = request.Buyer,
                BuyerPhone        = request.Buyer_Phone,
                Currency          = request.Currency,
                Amount            = request.Amount,
                Fees = request.Fees,
                AuthenticationCode = request.MAC,
                PaymentPlatform    = nameInstamojo,
                IncidentGUID       = parsedIncidentGUID,
                ProviderUserID     = IncidentInfo.GetProviderID(parsedIncidentGUID)
            };

            stranddContext context = new stranddContext();

            context.Payments.Add(newPayment);

            await context.SaveChangesAsync();

            //Initiating Hub Context
            Microsoft.AspNet.SignalR.IHubContext hubContext = Services.GetRealtime <IncidentHub>();

            if (newPayment.ProviderUserID == "NO INCIDENT - NO PROVIDER ID")
            {
                Services.Log.Warn("New Instamojo Payment Received - No Incident");
            }
            else if (newPayment.ProviderUserID == "INCIDENT NOT FOUND - NO PROVIDER ID")
            {
                Services.Log.Warn("New Instamojo Payment Received - No Found Incident");
            }
            else if (newPayment.ProviderUserID == "NO ASSOCIATED USER")
            {
                Services.Log.Warn("New Instamojo Payment Received - No Associated User");
            }
            else
            {
                Services.Log.Info("New Instamojo Payment Received from User [" + newPayment.ProviderUserID + "]");

                //Notify Particular Connected User through SignalR
                hubContext.Clients.Group(newPayment.ProviderUserID).updateMobileClientStatus(newPayment.GetCustomerPushObject());
                Services.Log.Info("Mobile Client [" + newPayment.ProviderUserID + "] Status Update Payload Sent");

                SendGridController.SendIncidentPaymentReceiptEmail(newPayment, Services);
            }

            //Web Client Notifications
            hubContext.Clients.All.saveNewPayment(newPayment);
            Services.Log.Info("Connected Clients Updated");

            return(this.Request.CreateResponse(HttpStatusCode.Created));
        }
Ejemplo n.º 2
0
 public static Rac.VOne.Common.IProgressNotifier CreateNotifier(
     this Microsoft.AspNet.SignalR.IHubContext context, string connectionId)
 => string.IsNullOrEmpty(connectionId) ? null
     : new Rac.VOne.Common.ProgressNotifier(context.Clients.Client(connectionId));
Ejemplo n.º 3
0
 public AdminController()
 {
     context = new CPMathHubModelContainer();
     _hub    = Microsoft.AspNet.SignalR.GlobalHost.ConnectionManager.GetHubContext <RealTimeHub>();
 }
Ejemplo n.º 4
0
 public TicketsController(IDatabase db, IConnectionManager signalR)
 {
     _db  = db;
     _hub = signalR.GetHubContext <TicketHub>();
 }
Ejemplo n.º 5
0
 public MessageController(Microsoft.AspNet.SignalR.IHubContext <NotifyHub> hubContext)
 {
     _hubContext = hubContext;
 }
Ejemplo n.º 6
0
 public AccountController(ApplicationUserManager userManager, ApplicationSignInManager signInManager)
 {
     UserManager   = userManager;
     SignInManager = signInManager;
     _theHub       = Microsoft.AspNet.SignalR.GlobalHost.ConnectionManager.GetHubContext <TheHub>();
 }
 public ChamadaController(IUsuarioRepository UserRepository, IOrdemRepository OrdemRepository, IChamadasRepository ChamadasRepository, IChamadasRecusadasRepository ChamadasRecusadasRepository, IChamadaEditadaRepository ChamadasEditadasRepository,
                          ICancelamentoChamadaRepository cancelamentoChamadaRepository, Microsoft.AspNet.SignalR.IHubContext hubcontext)
 {
     _UserRepo                      = UserRepository;
     _OrdemRepo                     = OrdemRepository;
     _ChamadasRepo                  = ChamadasRepository;
     _ChamadasRecusadasRepo         = ChamadasRecusadasRepository;
     _ChamadaEditadaRepository      = ChamadasEditadasRepository;
     _cancelamentoChamadaRepository = cancelamentoChamadaRepository;
     _signalContext                 = hubcontext;
 }
Ejemplo n.º 8
0
 public ContactMessageQueueServiceHandler()
 {
     _messageHub = Microsoft.AspNet.SignalR.GlobalHost.ConnectionManager.GetHubContext <ContactMessageQueueMessageHub>();
 }
        public async Task <HttpResponseMessage> inboundSms()
        {
            Microsoft.AspNet.SignalR.IHubContext hubContext = Services.GetRealtime <IncidentHub>();
            Services.Log.Info("Inbound SMS Request");

            String Type = "INBOUND SMS";
            String ID   = Guid.NewGuid().ToString();

            var    queryStrings = Request.GetQueryNameValuePairs().ToDictionary(x => x.Key, x => x.Value);
            String from         = String.Empty;
            String message      = String.Empty;
            String ts           = String.Empty;


            if (queryStrings.ContainsKey("from"))
            {
                from = queryStrings["from"];
            }
            if (queryStrings.ContainsKey("message"))
            {
                message = queryStrings["message"];
            }
            if (queryStrings.ContainsKey("ts"))
            {
                ts = queryStrings["ts"];
            }


            //store at DB Level
            // LogInboundOutboundMessageToDB(ID, Type, from, "SUBMITTED", "Source", message);

            CommunicationEntry newCommunication = new CommunicationEntry()
            {
                Id        = ID,
                Type      = Type,
                Tag       = from,
                Status    = "SUBMITTED",
                Text      = message,
                StartTime = DateTime.Now
            };


            stranddContext context = new stranddContext();

            context.CommunicationLog.Add(newCommunication);

            await context.SaveChangesAsync();

            String responseText = ("New Communication Log Created #" + ID);

            Services.Log.Info(responseText);

            //  return this.Request.CreateResponse(HttpStatusCode.Created, responseText);


            //----------------------------NOTIFICATION INBOUND SMS CODE-------------------------------//
            responseText = "";

            if (from != null)
            {
                responseText += "Please call [" + from + "] ";
            }

            if (message != null)
            {
                responseText += "[" + message + "]";
                //hubContext.Clients.All.updateIncidentCustomerError(responseText);
            }

            Services.Log.Warn(responseText);

            // hubContext.Clients.All.notifyCustomerClientExceptionContact(new CommunicationInfo(newCommunication));
            hubContext.Clients.All.notifyCustomerNewInboundSmsContact(new InboundsmsInfo(newCommunication));
            Services.Log.Info("Inbound Notification Cerated.");


            // Outbound SMS triggered to above Number with following text from MM-STRNDD:
            String strdownloadlink = ConfigurationManager.AppSettings["Appdownloadlink"];

            strdownloadlink = "<" + "a href='" + strdownloadlink + "'>" + strdownloadlink + "<a>";

            CommunicationsLogOutboundRequest communicationRequest = new CommunicationsLogOutboundRequest();

            communicationRequest.MobileNo = from;
            communicationRequest.Message  = "Please download the StrandD App [" + strdownloadlink + "] so we can better assist you incase you need us again.";

            await OutboundSms(communicationRequest);

            //Return Successful Response
            return(this.Request.CreateResponse(HttpStatusCode.OK, responseText));

            //----------------------------NOTIFICATION INBOUND SMS CODE END-------------------------------//
        }
Ejemplo n.º 10
0
 public OrdemController(IUsuarioRepository UserRepository, IOrdemRepository OrdemRepository, IChamadasRepository ChamadasRepository, IOrdemComissionRepository OrdemComissionRepository, Microsoft.AspNet.SignalR.IHubContext hubcontext)
 {
     _UserRepo           = UserRepository;
     _OrdemRepo          = OrdemRepository;
     _OrdemComissionRepo = OrdemComissionRepository;
 }