Example #1
0
        async Task ExecuteLoadItemsCommand()    // Will load the items in this section
        {
            if (IsBusy)
            {
                return;
            }

            IsBusy = true;

            try
            {
                PaymentItems.Clear();       // Get Paymethods from the Logged in user
                ListPaymentItems = App.LoggedInUser.Payments;
                var paymentitems = ListPaymentItems;
                foreach (var paymethod in paymentitems)
                {
                    PaymentItems.Add(paymethod);
                }
            }
            catch (Exception ex)
            {
                Debug.WriteLine(ex);
            }
            finally
            {
                IsBusy = false;
            }
        }
Example #2
0
 public void AddPaymentItem(PaymentItem item)
 {
     if (Installments.Count() <= 0 && PayInSlips.Count() <= 0)
     {
         PaymentItems.Add(item);
     }
 }
Example #3
0
        public void Load()
        {
            var denominations = ApplicationService.GetDenominations();

            PaymentItems.AddRange(denominations.Select(o => new TransactionItemViewModel {
                Description = o.Description, BasePrice = o.Value, ImageSource = ImageService.GetImage(o.Description)
            }));
        }
Example #4
0
        public EmployeePaymentItem addPaymentItems(Guid PaymentTypeGuid, decimal amount)
        {
            var employeePaymentItem = new EmployeePaymentItem()
            {
                Id = Guid.NewGuid(),
                PaymentTypeGuid = PaymentTypeGuid,
                Amount          = Math.Abs(amount)
            };

            PaymentItems.Add(employeePaymentItem);

            return(employeePaymentItem);
        }
Example #5
0
        private void OnRefreshCommandExecute()
        {
            switch (SelectedTab)
            {
            case ClaimsTabIndex:
                AppService.ReloadClaims();
                break;

            case DownloadsTabIndex:
                var worker = new BackgroundWorker();
                worker.DoWork += (i, j) =>
                {
                    var list = AppService.GetDownloads();
                    DispatcherHelper.CheckBeginInvokeOnUI(() =>
                    {
                        DownloadItems.Clear();
                        foreach (var item in list)
                        {
                            DownloadItems.Add(item);
                        }
                    });
                };
                worker.RunWorkerAsync();
                break;

            case PaymentsTabIndex:
                worker         = new BackgroundWorker();
                worker.DoWork += (i, j) =>
                {
                    var list = AppService.GetPayments();
                    DispatcherHelper.CheckBeginInvokeOnUI(() =>
                    {
                        PaymentItems.Clear();
                        foreach (var item in list)
                        {
                            PaymentItems.Add(item);
                        }
                    });
                };
                worker.RunWorkerAsync();
                break;

            default:
                throw new ArgumentOutOfRangeException();
            }
        }
Example #6
0
 public void AddPaymentItem(int serviceCode, string serviceName, int quantity, decimal unitAmount, decimal taxOrVat,
                            decimal withHoldingTax, bool isRevenue, bool isLegalPerson, string itemDescription)
 {
     if (Installments.Count() <= 0 && PayInSlips.Count() <= 0)
     {
         PaymentItems.Add(new PaymentItem(
                              //serviceCode,
                              //serviceName,
                              quantity,
                              unitAmount,
                              taxOrVat,
                              withHoldingTax,
                              isRevenue,
                              isLegalPerson,
                              itemDescription));
     }
 }
Example #7
0
        public Payment(string createBy, long customerIdmPartyId,
                       string customerName, string customerAddress,
                       params PaymentItem[] paymentItems)
        {
            CreatedBy   = createBy;
            CreatedDate = DateTime.Now;
            UpdatedBy   = createBy;
            UpdatedDate = DateTime.Now;

            CustomerIdmPartyId = customerIdmPartyId;
            CustomerName       = customerName;
            CustomerAddress    = customerAddress;
            Status             = PaymentStatusEnum.UNPAID.ToString();

            foreach (var paymentItem in paymentItems)
            {
                PaymentItems.Add(paymentItem);
            }
        }
Example #8
0
 public void Load()
 {
     PaymentItems.Add(new PayItemViewModel {
         Description = "$100", Price = 100.0m
     });
     PaymentItems.Add(new PayItemViewModel {
         Description = "$50", Price = 50.0m
     });
     PaymentItems.Add(new PayItemViewModel {
         Description = "$20", Price = 20.0m
     });
     PaymentItems.Add(new PayItemViewModel {
         Description = "$10", Price = 10.0m
     });
     PaymentItems.Add(new PayItemViewModel {
         Description = "$5", Price = 5.0m
     });
     PaymentItems.Add(new PayItemViewModel {
         Description = "$2", Price = 2.0m
     });
     PaymentItems.Add(new PayItemViewModel {
         Description = "$1", Price = 1.0m
     });
     PaymentItems.Add(new PayItemViewModel {
         Description = "50c", Price = 0.50m
     });
     PaymentItems.Add(new PayItemViewModel {
         Description = "20c", Price = 0.20m
     });
     PaymentItems.Add(new PayItemViewModel {
         Description = "10c", Price = 0.10m
     });
     PaymentItems.Add(new PayItemViewModel {
         Description = "5c", Price = 0.05m
     });
 }
Example #9
0
 public decimal TotalDiscount()
 {
     return(PaymentItems.Where(x => x.NetTotal() < 0).Sum(x => x.NetTotal()));
 }
Example #10
0
 public decimal TotalWithholdingTax()
 {
     return(PaymentItems.Sum(x => x.WithHoldingTaxAmount()));
 }
Example #11
0
 public decimal TotalVat()
 {
     return(PaymentItems.Sum(x => x.VATAmount()));
 }
Example #12
0
 public decimal TotalUnitAmount()
 {
     return(PaymentItems.Sum(x => x.SubTotal()));
 }
Example #13
0
        public IHttpActionResult RegisterForm(RegisterFormDTO registerForm)
        {
            PaymentItems    MyPaymentItems      = null;
            int             NoOfUsers           = 0;
            int             PurchaseItemsId     = 0;
            ResultReponse   MyResultResponse    = new ResultReponse();
            UserDTO         UserDTOInfo         = new UserDTO();
            SetupProcessDTO SetupProcessDTOInfo = new SetupProcessDTO();

            CardPaymentDTO  CardPaymentDTOInfo = null;
            SubscriptionDTO m_subscriptionDTO;
            //string APIKey = "sk_test_MCGUn4fT1YzFQzGcRa9HiC3v";

            string APIKey = "sk_test_ffjSM0I2xFEg7I18xCdxb9EJ";

            RegisterFormResults MyRegisterFormResults = new RegisterFormResults();
            string MessageBody      = "Welcome to MyUEL..";
            string TemplateBody     = "";
            string Subject          = "Message";
            string SubscriptionName = "";

            string        ExpMonth        = "";
            string        ExpYear         = "";
            ResultReponse MyResultReponse = new ResultReponse();

            try
            {
                //Get Stripe API Key
                //APIKey = "sk_test_ffjSM0I2xFEg7I18xCdxb9EJ";
                //m_subscriptionDTO = m_IRegisterBusiness.GetSubscriptionId(registerForm.Subscriptionid);

                //if (m_subscriptionDTO != null)
                //{
                //    NoOfUsers = m_subscriptionDTO.noOfUser;



                //    MyUELHelpers.Info(typeof(RegisterController).ToString(), "SaveUserDetails", "Started " + DateTime.Now.ToString());
                //    UserDTOInfo = m_IRegisterBusiness.creatingUsers(registerForm.FirstName, registerForm.LastName, registerForm.UserEmail,
                //        registerForm.Password, registerForm.Company, registerForm.Subscriptionid, m_subscriptionDTO);
                //    MyUELHelpers.Info(typeof(RegisterController).ToString(), "SaveUserDetails", "Done " + DateTime.Now.ToString());

                //    SubscriptionName = string.Format("{0}  {1}   {2} ", m_subscriptionDTO.SubscriptionName, m_subscriptionDTO.SubscriptionDays, m_subscriptionDTO.SubscriptionType);

                //    if (UserDTOInfo != null)
                //    {
                //        MyUserInfo.TenantId = UserDTOInfo.TenantId;
                //        MyUserInfo.UserId = UserDTOInfo.Id;
                //        MyUserInfo.UserName = UserDTOInfo.UserName;
                //        MyUserInfo.SubscriptionId = registerForm.Subscriptionid;
                //        MyUserInfo.SubscriptionName = m_subscriptionDTO.SubscriptionName;
                //        MyUserInfo.SubscriptionType = m_subscriptionDTO.SubscriptionType;
                //        MyRegisterFormResults.StatusCode = "USERREGISTER";
                //        MyRegisterFormResults.Status = "User Registration Done";
                //        MyRegisterFormResults.Message = "User Registration Done";
                //        MyUELHelpers.Info(typeof(RegisterController).ToString(), "Creating Table", "Started " + DateTime.Now.ToString());
                //        SetupProcessDTOInfo = m_ISetupProcessBusiness.CreateTable("boundhound" + MyUserInfo.TenantId, MyUserInfo);
                //        if (SetupProcessDTOInfo.Status == "SUCCESS")
                //        {
                //            MyUELHelpers.Info(typeof(RegisterController).ToString(), "Table Created Successfully", "End " + DateTime.Now.ToString());
                //            MyUserInfo.databasename = "MyUELLoyalty" + MyUserInfo.TenantId;
                //        }
                //        else
                //        {
                //            MyUELHelpers.Info(typeof(RegisterController).ToString(), "Creating Table Error", string.Format("Error {0}\n ", SetupProcessDTOInfo.Message) + DateTime.Now.ToString());
                //        }

                //        if (m_subscriptionDTO.SubscriptionType == "Paid")
                //        {


                //            registerForm.TotalAmount = m_subscriptionDTO.Amount;
                //            //create a card
                //            ExpMonth = registerForm.ExpMonth.Split('/')[0];
                //            ExpYear = registerForm.ExpMonth.Split('/')[1];

                //            MyUELHelpers.Info(typeof(RegisterController).ToString(), "SaveCardDetails", "Started " + DateTime.Now.ToString());
                //            CardDetailsDTO cardDetailsDTOInfo = null;
                //            cardDetailsDTOInfo = m_ICardDetailsBusiness.savecardDetails(registerForm.ccNo, registerForm.SecurityCode, ExpMonth, ExpYear, registerForm.UserEmail, APIKey, MyUserInfo);
                //            MyUELHelpers.Info(typeof(RegisterController).ToString(), "SaveCardDetails", "Ended " + DateTime.Now.ToString());
                //            if (cardDetailsDTOInfo != null)
                //            {
                //                //payment
                //                MyUELHelpers.Info(typeof(RegisterController).ToString(), "SavePaymentDetails", "Started " + DateTime.Now.ToString());
                //                CardPaymentDTOInfo = m_paymentDetailsBusiness.PaymentDetails(Convert.ToString(cardDetailsDTOInfo.Id), registerForm.TotalAmount, APIKey, MyUserInfo);
                //                MyUELHelpers.Info(typeof(RegisterController).ToString(), "SavePaymentDetails", "Done " + DateTime.Now.ToString());
                //                MyResultResponse.Status = CardPaymentDTOInfo.transactionstatus;
                //                MyResultResponse.Message = "Paid Subscription";

                //                MyRegisterFormResults.StatusCode = "PAYMENTDONESUCCESS";
                //                MyRegisterFormResults.Status = "Payment done subscription created";
                //                MyRegisterFormResults.Message = "Payment done subscription created";

                //                MyRegisterFormResults.PaymentId = CardPaymentDTOInfo.PaymentId;
                //                MyRegisterFormResults.TransactionId = CardPaymentDTOInfo.transactionId;
                //                //****************************************************************************************************************************************************************
                //                // Save In Payment Items
                //                //****************************************************************************************************************************************************************
                //                MyPaymentItems = new PaymentItems();

                //                MyPaymentItems.PaymentId = CardPaymentDTOInfo.id;
                //                MyPaymentItems.ItemName = "Subscription Charges";
                //                MyPaymentItems.PurchaseAmount = registerForm.TotalAmount;
                //                MyPaymentItems.NoOfUsers = NoOfUsers;
                //                PurchaseItemsId = m_IPurchaseUsersBusiness.CreatePaymentItems(MyPaymentItems, MyUserInfo);

                //                //****************************************************************************************************************************************************************

                //                //Send this Details to send the mail
                //                //MyRegisterFormResults.Subscription = m_subscriptionDTO;
                //                //MyRegisterFormResults.CardPayment = CardPaymentDTOInfo;
                //                //MyRegisterFormResults.User = UserDTOInfo;

                //                //TODO Send the email to user

                //            }
                //        }

                //        //Send Email After Register
                //        Subject = "User Registration Confirmation...";

                //        MyUserInfo.UserName = UserDTOInfo.UserName;
                //        MyUserInfo.Email = UserDTOInfo.UserEmail;
                //        MyUserInfo.Password = UserDTOInfo.UserPassword;

                //        MyUserInfo.SubscriptionName = SubscriptionName;

                //        //Template Parse
                //        TemplateParsers MyTemplateParser = new TemplateParsers(MyUserInfo);

                //        //Get After register html template from the Templates/AfterRegister.html
                //        var filePath = HttpContext.Current.Server.MapPath("~/Templates/AfterRegister.html");

                //        string html = File.ReadAllText(filePath);

                //        TemplateBody = MyTemplateParser.ParseAfterRegister(html, MyUserInfo);

                //        MessageBody = TemplateBody;

                //        //GET SMTP Settings
                //        SMTPSettings MyUELLoyaltySMTPSettings = new SMTPSettings();

                //        UtilityBusiness MyUtilityBusiness = new UtilityBusiness();
                //        BoundHoundSMTPSettings = MyUtilityBusiness.GetBoundHoundSMPTSettings(MyUserInfo);

                //        if (BoundHoundSMTPSettings != null)
                //        {
                //            if (BoundHoundSMTPSettings.Id > 0)
                //            {
                //                //string FromAddress = string.Format("{0} <{1}>", BoundHoundSMTPSettings.DisplayName, BoundHoundSMTPSettings.UserName);

                //                MyResultReponse = m_IEmailsBusiness.SendEmailAfterRegister(registerForm.UserEmail, BoundHoundSMTPSettings.HostName, BoundHoundSMTPSettings.Port, BoundHoundSMTPSettings.UserName,
                //                BoundHoundSMTPSettings.UserPassword,
                //                Subject, MessageBody, UserDTOInfo, m_subscriptionDTO, CardPaymentDTOInfo);

                //                //MyResultReponse = m_IEmailsBusiness.SendEmailAfterRegister(registerForm.UserEmail, MyUserInfo.FromUserEmail,
                //                //        MyUserInfo.FromPassword,
                //                //        Subject, MessageBody, UserDTOInfo, m_subscriptionDTO, CardPaymentDTOInfo);

                //                if (MyResultReponse.Status == "SUCCESS")
                //                {
                //                    MyRegisterFormResults.StatusCode = "USERREGISTER";
                //                    MyRegisterFormResults.Status = "User Registration Done";
                //                    MyRegisterFormResults.Message = "User Registration Done";
                //                    MyRegisterFormResults.User = UserDTOInfo;

                //                }
                //                else
                //                {
                //                    MyRegisterFormResults.StatusCode = "PAYMENTDONESUCCESS";
                //                    MyRegisterFormResults.Status = "Payment done subscription created";
                //                    MyRegisterFormResults.Message = "Payment done subscription created - Email error ";
                //                    MyRegisterFormResults.User = UserDTOInfo;
                //                }
                //            }
                //        }



                //        //SetupProcessDTOInfo = m_ISetupProcessBusiness.CreateTable("boundhound" + MyUserInfo.TenantId, MyUserInfo);

                //    }

                //}

                //else
                //{
                //    MyRegisterFormResults.Message = "InValid Subscription Id ";
                //    MyRegisterFormResults.User = UserDTOInfo;
                //}
                return(Json(MyRegisterFormResults));
            }
            catch (Exception Ex)
            {
                MyUELHelpers.ErrorLog(typeof(RegisterController).ToString(), "RegisterForm", Ex.ToString());
            }

            return(Json(MyRegisterFormResults));
        }
        private void TempInitDB()
        {
            if (Users.Count() > 0)
            {
                return;
            }

            // Actual password for each user is the UserName: example - UserName = "******" => Password = "******"
            Users.Add(new User()
            {
                ID = "asdf", UserName = "******", HashedPassword = "******", Salt = "superRandomSalt"
            });
            Users.Add(new User()
            {
                ID = "asdg", UserName = "******", HashedPassword = "******", Salt = "evenMoreRandomSalt"
            });

            PaymentItems.AddRange(
                new Payment()
            {
                ID = Guid.NewGuid().ToString(), Amount = 32, UserID = "asdf", CreditCardNumber = "1234561234561234", CVV = 657, Currency = "EURO", ExpirationDate = new DateTime(2020, 12, 1), IsPaymentSuccessful = true
            },
                new Payment()
            {
                ID = Guid.NewGuid().ToString(), Amount = 35, UserID = "asdf", CreditCardNumber = "1234578902237320", CVV = 131, Currency = "EURO", ExpirationDate = new DateTime(2022, 11, 2), IsPaymentSuccessful = false
            },
                new Payment()
            {
                ID = Guid.NewGuid().ToString(), Amount = 22, UserID = "asdf", CreditCardNumber = "1234578902237320", CVV = 985, Currency = "EURO", ExpirationDate = new DateTime(2023, 11, 3), IsPaymentSuccessful = false
            },
                new Payment()
            {
                ID = Guid.NewGuid().ToString(), Amount = 42, UserID = "asdf", CreditCardNumber = "1234578902237320", CVV = 123, Currency = "EURO", ExpirationDate = new DateTime(2023, 11, 4), IsPaymentSuccessful = true
            },
                new Payment()
            {
                ID = Guid.NewGuid().ToString(), Amount = 12, UserID = "asdf", CreditCardNumber = "1234578902237320", CVV = 524, Currency = "EURO", ExpirationDate = new DateTime(2023, 11, 5), IsPaymentSuccessful = false
            },
                new Payment()
            {
                ID = Guid.NewGuid().ToString(), Amount = 42, UserID = "asdf", CreditCardNumber = "1234578902237320", CVV = 634, Currency = "EURO", ExpirationDate = new DateTime(2024, 11, 6), IsPaymentSuccessful = false
            },
                new Payment()
            {
                ID = Guid.NewGuid().ToString(), Amount = 32, UserID = "asdf", CreditCardNumber = "1234578902237320", CVV = 467, Currency = "EURO", ExpirationDate = new DateTime(2020, 12, 1), IsPaymentSuccessful = false
            },
                new Payment()
            {
                ID = Guid.NewGuid().ToString(), Amount = 32, UserID = "asdf", CreditCardNumber = "1234578902237320", CVV = 923, Currency = "EURO", ExpirationDate = new DateTime(2020, 12, 1), IsPaymentSuccessful = true
            },
                new Payment()
            {
                ID = Guid.NewGuid().ToString(), Amount = 32, UserID = "asdf", CreditCardNumber = "1234578902237320", CVV = 947, Currency = "EURO", ExpirationDate = new DateTime(2020, 12, 1), IsPaymentSuccessful = false
            },
                new Payment()
            {
                ID = Guid.NewGuid().ToString(), Amount = 32, UserID = "asdg", CreditCardNumber = "1234578902237320", CVV = 352, Currency = "EURO", ExpirationDate = new DateTime(2020, 12, 1), IsPaymentSuccessful = true
            },
                new Payment()
            {
                ID = Guid.NewGuid().ToString(), Amount = 12, UserID = "asdg", CreditCardNumber = "1234678902237320", CVV = 799, Currency = "EURO", ExpirationDate = new DateTime(2023, 11, 7), IsPaymentSuccessful = true
            },
                new Payment()
            {
                ID = Guid.NewGuid().ToString(), Amount = 39, UserID = "asdg", CreditCardNumber = "1234678902237320", CVV = 845, Currency = "EURO", ExpirationDate = new DateTime(2023, 11, 8), IsPaymentSuccessful = false
            });
            SaveChanges();
        }