예제 #1
0
        private void OnPreAuth()
        {
            var args = new OnProcessedArgs {
                ProcessType = ProcessType.PreAuth
            };

            InvokeProcessed(args);
        }
예제 #2
0
        private void InvokeProcessed(OnProcessedArgs args)
        {
            OnProcessed handler = Processed;

            if (handler != null)
            {
                handler(this, args);
            }
        }
예제 #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);
        }
예제 #4
0
 private void InvokeProcessed(OnProcessedArgs args)
 {
     OnProcessed handler = Processed;
     if (handler != null) handler(this, args);
 }
예제 #5
0
 private void OnPreAuth()
 {
     var args = new OnProcessedArgs { ProcessType = ProcessType.PreAuth };
     InvokeProcessed(args);
 }
예제 #6
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);
        }