Example #1
0
        private void UpdatePaymentInfo(PayCommand command)
        {
            foreach (PaymentDto paymentDto in command.Payments)
            {
                PaymentInfo payment = _context.PaymentsInfo.FirstOrDefault(pay => pay.CaId == command.CaId && pay.AccountNumber == paymentDto.AccountNumber && pay.OptionNumber == paymentDto.OptionNumber && pay.PayoutNumber == paymentDto.PayoutNumber);

                if (payment == null)
                {
                    continue;
                }

                if (paymentDto.IsSettled)
                {
                    payment.ProcessedDateCategory = CalculateProcessedDateCategory(ProcessType.Payment, command.CaId, command.EventDate);
                    payment.IsSettled             = true;
                    payment.ProcessedDate         = command.EventDate;
                }
                else
                {
                    payment.ProcessedDateCategory = ProcessedDateCategory.Missing;
                    payment.IsSettled             = false;
                    payment.ProcessedDate         = null;
                }
            }

            _context.SaveChanges();
        }
Example #2
0
        private void CreatePaymentInfo(PayCommand command)
        {
            foreach (PaymentDto paymentDto in command.Payments)
            {
                PaymentInfo payment = new PaymentInfo();

                payment.CaId          = command.CaId;
                payment.CaTypeId      = command.CaTypeId;
                payment.VolManCho     = command.VolManCho;
                payment.AccountNumber = paymentDto.AccountNumber;
                payment.FieldDisplay  = "O #" + paymentDto.OptionNumber + " " + "P #" + paymentDto.PayoutNumber + " - " + paymentDto.AccountNumber;
                payment.OptionNumber  = paymentDto.OptionNumber;
                payment.PayoutNumber  = paymentDto.PayoutNumber;

                if (paymentDto.IsSettled)
                {
                    payment.ProcessedDateCategory = CalculateProcessedDateCategory(ProcessType.Payment, command.CaId, command.EventDate);
                    payment.IsSettled             = true;
                    payment.ProcessedDate         = command.EventDate;
                }
                else
                {
                    payment.ProcessedDateCategory = ProcessedDateCategory.Missing;
                    payment.IsSettled             = false;
                    payment.ProcessedDate         = null;
                }
                _context.PaymentsInfo.Add(payment);
            }
            _context.SaveChanges();
        }
Example #3
0
        public InvoiceViewModel(Invoice invoice)
        {
            _invoice = invoice;
            _amount  = _invoice.Amount;
            _isPaid  = _invoice.IsPaid;

            PayCommand = new PayCommand(() => IsPaid = true, () => !IsPaid);
        }
Example #4
0
        protected virtual void UpdateCanGoNext()
        {
            CanGoNext = CardsHelper.IsValidNumber(CardNumber.Without(' ')) &&
                        CardsHelper.IsValidCvc(Cvv) &&
                        CardsHelper.IsValidExpirationDate(ExpirationDate) &&
                        !string.IsNullOrWhiteSpace(CardHolder);

            PayCommand.RaiseCanExecuteChanged();
        }
Example #5
0
        public IHttpActionResult PostPayments([FromBody] PayCommand command)
        {
            List <PaymentInfo> payments = _context.PaymentsInfo.Where(view => view.CaId == command.CaId).ToList();

            if (payments.Count == 0)
            {
                CreatePaymentInfo(command);
            }
            else
            {
                UpdatePaymentInfo(command);
            }

            return(Ok());
        }
Example #6
0
        public void SendPaymentInputData(PayCommand command)
        {
            CaProcessViewModel viewModel = _apiService.Execute(command);

            IHubContext notifHub = GlobalHost.ConnectionManager.GetHubContext <NotificationHub>();

            if (viewModel != null)
            {
                notifHub.Clients.All.updateProcess(viewModel);
            }

            SummaryModel summaryModel = GetSummaryModel();

            if (summaryModel != null)
            {
                notifHub.Clients.All.updateSummaryModel(summaryModel);
            }
        }
Example #7
0
 protected override void OnPropertyChanged([CallerMemberName] string propertyName = "")
 {
     PayCommand.ChangeCanExecute();
     base.OnPropertyChanged(propertyName);
 }
Example #8
0
        public static void SendPayCommand(Command command)
        {
            PayCommand payCommand = (PayCommand)command;

            POST(JsonConvert.SerializeObject(payCommand), "SendPaymentInputData");
        }