Exemple #1
0
        public async Task RejectedApplication(int ActiveProductID)
        {
            var rejectProd = db.activeproductitems.Find(ActiveProductID);
            var prodValue  = rejectProd.productValue;
            var tempCons   = db.consumers.Find(rejectProd.Consumer_ID);
            var tempUser   = db.users.Find(tempCons.User_ID);

            refundConsumer(tempCons.User_ID, rejectProd.productValue);

            //deactive product from active
            rejectProd.isActive = false;
            rejectProd.Accepted = false;
            rejectProd.activeProductItemPolicyNum = "Rejected";
            //notify user push Notification
            var NC = new NotificationController();

            var message = "NanoFin: Your purchase for '";

            message += prodIDToProdName(rejectProd.Product_ID);
            message += "; has been rejected. Your Account has been refunded with R";
            message += rejectProd.productValue.ToString() + ".";
            //db.UpdateConsumerRiskValues();
            NC.SendSMS(tempUser.userContactNumber, message);

            //reflect on blockchain
            string productName = prodIDToProdName(rejectProd.Product_ID);
            MConsumerController consumerCtrl = new MConsumerController(tempUser.User_ID);

            consumerCtrl = await consumerCtrl.init();

            await consumerCtrl.refundConsumer(productName, Decimal.ToInt32(prodValue));
        }
Exemple #2
0
        public Boolean sendMessageToConsumer(ClientMessage advt)
        {
            var notificationH      = new NotificationController();
            var consumerReferences = advt.IDs.Split(',').Select(Int32.Parse).ToList();

            foreach (var id  in consumerReferences)
            {
                var cons = db.consumers.Find(id);
                notificationH.SendSMS(cons.user.userContactNumber, advt.message);
            }

            return(true);
        }
        public async Task <IHttpActionResult> acceptConsumer(int userID)
        {
            try
            {
                user toAccept = db.users.Find(userID);
                toAccept.userActivationType = "Verified";
                await db.SaveChangesAsync();

                NotificationController notification = new NotificationController();
                string userNum = notification.getPhoneNumFromUserID(userID);
                notification.SendSMS(userNum, "Welcome to NanoFIn! Your application was accepted by our staff. Feel free to use NanoFin, if you are having trouble please email us at: [email protected] or contact us at 0110000000 - a trained professional will assist you.");
            }
            catch (NullReferenceException)
            {
                return(BadRequest("User to reject not found."));
            }
            return(Ok());
        }
        public async Task <IHttpActionResult> rejectConsumer(int userID)
        {
            try
            {
                user toReject = db.users.Find(userID);
                toReject.userActivationType = "Rejected";
                await db.SaveChangesAsync();

                NotificationController notification = new NotificationController();
                string userNum = notification.getPhoneNumFromUserID(userID);
                notification.SendSMS(userNum, "Hello from NanoFin. We are sorry to inform you that your NanoFin application could not be processed. Please contact us at: [email protected] or visit us at: JoziHub - 44 Stanley Ave, Milpark, Johannesburg");
            }
            catch (NullReferenceException)
            {
                return(BadRequest("User to reject not found."));
            }
            return(Ok());
        }