Example #1
0
        public async Task UpdatePaymentStatus(string message)
        {
            try
            {
                JObject objMessage        = JObject.Parse(message);
                int     RoomId            = (int)objMessage["RoomId"];
                int     AppointmentId     = (int)objMessage["AppointmentId"];
                int     OrderId           = (int)objMessage["OrderId"];
                int     ProviderId        = (int)objMessage["ProviderId"];
                string  OrderStatus       = (string)objMessage["OrderStatus"];
                var     Error             = objMessage["Error"];
                string  RazorPayPaymentId = (string)objMessage["RazorPayPaymentId"];
                string  RazorPaySignature = (string)objMessage["RazorPaySignature"];
                string  socket            = await _providerManager.GetSocketIdForProvider(ProviderId);

                await _commonManager.UpdatePaymentStatus(new PaymentModel
                {
                    Id                = OrderId,
                    AppointmentId     = AppointmentId,
                    PaymentStatus     = OrderStatus,
                    ErrorJson         = Error != null ? Error.ToString() : null,
                    RazorPayPaymentId = RazorPayPaymentId,
                    RazorPaySignature = RazorPaySignature
                });

                await Clients.Client(socket).SendAsync("UpdatePaymentStatus", new JObject
                {
                    ["OrderId"] = OrderId,
                    ["Status"]  = OrderStatus
                }.ToString());
            }
            catch (Exception ex)
            {
                await Clients.Caller.SendAsync("Exception", new JObject
                {
                    ["error"]      = ex.Message,
                    ["stackTrace"] = ex.StackTrace
                }.ToString());
            }
        }