Ejemplo n.º 1
0
        public void Process(CreditCardProcessingData creditCardProcessingData)
        {
            // get operator response 
            var userEntry = InteractionService.UserIntraction.GetStringFromUser(Name, _settings.DisplayMessage);

            // publish processing result
            var result = new CreditCardProcessingResult()
                             {
                                 Amount = creditCardProcessingData.TenderedAmount,
                                 ProcessType = userEntry.Length > 0 ? ProcessType.Force : ProcessType.Cancel
                             };

            result.PublishEvent(EventTopicNames.PaymentProcessed);
        }
        void ViewModelProcessed(object sender, OnProcessedArgs args)
        {
            var processType = args.ProcessType;
            var gratuity = _viewModel.Gratuity;
            var ticket = SelectedTicket;

            InteractionService.UserIntraction.DeblurMainWindow();
            _view.Close();

            var result = new CreditCardProcessingResult { ProcessType = processType };

            if (processType == ProcessType.PreAuth)
                result.Amount = Preauth(_view.SwipeDataBox.SecurePassword, ticket, _viewModel.TenderedAmount, gratuity);

            if (processType == ProcessType.Force)
                result.Amount = Force(_view.SwipeDataBox.SecurePassword, ticket, _viewModel.TenderedAmount, gratuity);

            result.PublishEvent(EventTopicNames.PaymentProcessed);
        }
Ejemplo n.º 3
0
        public void ViewModelProcessed(object sender, OnProcessedArgs args)
        {
            var processType = args.ProcessType;
            var gratuity = _viewModel.Gratuity;
            var ticket = SelectedTicket;
            var txType = ((ComboBoxItem)_view.FdTransactionType.SelectedItem).Tag;

            var result = new CreditCardProcessingResult { ProcessType = processType };
            var amount = _viewModel.TenderedAmount + gratuity;
            if (processType == ProcessType.External)
            {
                result.Amount = amount;
                InteractionService.UserIntraction.DeblurMainWindow();
                _view.Close();
                result.PublishEvent(EventTopicNames.PaymentProcessed);
                return;
            }

               if (processType == ProcessType.Swipe)
               {
               string debugTrack = "";
               _view.CardStatus.Text = Samba.Localization.Properties.Resources.SwipeCreditCard;
               _view.Refresh();
               var ccData = ReadCreditCardTrackData(out debugTrack);
               if (ccData == null)
               {
                   if (String.IsNullOrWhiteSpace(debugTrack))
                   {
                       _view.CardStatus.Text = Samba.Localization.Properties.Resources.CreditCardReadFailed;
                   }
                   else
                   {
                       _view.CardStatus.Text = debugTrack;
                   }
                   _view.Refresh();
                   return;
               }

               _view.CardExpire.Text = ccData.CardExpiry;
               _view.CardName.Text = ccData.CardName;
               _view.CardNumber.Password = ccData.CardNumber;
               _view.CardStatus.Text = Samba.Localization.Properties.Resources.CreditCardReadSuccess;
               _view.Refresh();
               return;
               }

            if (processType == ProcessType.Force)
            {

                string requestStatus;
                _view.CardStatus.Text = "";
                _view.Refresh();

                var resp = Force(ticket, amount, out requestStatus);
                if (resp != null)
                {
                    //rjoshi fix me

                    var content = resp.ctr.Split(new[] { '\r', '\n' }, StringSplitOptions.RemoveEmptyEntries);
                    PrintJobFactory.CreatePrintJob(AppServices.CurrentTerminal.SlipReportPrinter).DoPrint(content);

                    if (resp.transaction_approved)
                    {
                        result.Amount = amount;
                        _view.CardStatus.Text = resp.bank_message;

                        //TODO Print job
                    }
                    else
                    {
                        _view.CardStatus.Text = resp.bank_message;
                        _view.Refresh();
                        return;
                    }
                }
                else
                {
                    _view.CardStatus.Text = Localization.Properties.Resources.CreditCardRequestSendFailure + " " + requestStatus;
                    _view.Refresh();
                    return;
                }

            }else if (processType == ProcessType.External)
            {
                result.Amount = amount;
            }
            InteractionService.UserIntraction.DeblurMainWindow();
            _view.Close();
            result.PublishEvent(EventTopicNames.PaymentProcessed);
        }