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(); }
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(); }
public InvoiceViewModel(Invoice invoice) { _invoice = invoice; _amount = _invoice.Amount; _isPaid = _invoice.IsPaid; PayCommand = new PayCommand(() => IsPaid = true, () => !IsPaid); }
protected virtual void UpdateCanGoNext() { CanGoNext = CardsHelper.IsValidNumber(CardNumber.Without(' ')) && CardsHelper.IsValidCvc(Cvv) && CardsHelper.IsValidExpirationDate(ExpirationDate) && !string.IsNullOrWhiteSpace(CardHolder); PayCommand.RaiseCanExecuteChanged(); }
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()); }
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); } }
protected override void OnPropertyChanged([CallerMemberName] string propertyName = "") { PayCommand.ChangeCanExecute(); base.OnPropertyChanged(propertyName); }
public static void SendPayCommand(Command command) { PayCommand payCommand = (PayCommand)command; POST(JsonConvert.SerializeObject(payCommand), "SendPaymentInputData"); }