コード例 #1
0
ファイル: SplitPaymentVM.cs プロジェクト: 7ccgroup/MIS
        public bool Authorize(ISaleModel ccSale)
        {
            if (_activeSplit == null || _activeSplit.IsPaid)
            {
                return(false);
            }

            _order.IsAuthorizing = true;
            PaymentType          = SplitPaymentType.Card;

            SaleResponse response = ccSale.Process();



            bool result = (response != null && response.IsValid) ? true : false;
            //bool result = true;


            string errormessage = null;

            if (response != null && !result)
            {
                errormessage = response.ErrorMessage;
            }


            Application.Current.Dispatcher.BeginInvoke(new Action(() =>
            {
                if (result)
                {
                    if (BaseAppUI.Properties.Settings.Default.TipSignModifierSwitch == "SignOnReceipt")
                    {
                        SwitchSplitPaymentProccess(response);
                        new ViewModel.Notifies.ThanksNotify(_order).Show(() =>
                        {
                            //SwitchSplitPaymentProccess();
                            _order.IsAuthorizing = false;
                        });
                    }
                    else
                    {
                        new ViewModel.Notifies.TipSignModifier(_order).Show(() =>
                        {
                            SwitchSplitPaymentProccess(response);
                            new ViewModel.Notifies.ThanksNotify(_order).Show(() =>
                            {
                                //SwitchSplitPaymentProccess();
                                _order.IsAuthorizing = false;
                            });
                        });
                    }
                }

                else
                {
                    new ViewModel.Notifies.TransactionFailedNotify(errormessage, null).Show(() => {
                        _order.IsAuthorizing = false;
                    });
                }
            }));



            return(result);
        }
コード例 #2
0
ファイル: CardPayVM.cs プロジェクト: 7ccgroup/MIS
        public bool Authorize(ISaleModel ccSale)
        {
            _order.IsAuthorizing = true;
            SaleResponse response = ccSale.Process();

            GConfig.response2 = response;

            //Save Response to Order on successful response. //Add by SAA 5/6/16
            if (response.Resp_Msg == "APPROVAL")
            {
                LinkCreditCardResponseToOrder(response);
            }


            bool result = (response != null && response.IsValid) ? true : false;
            //bool result = true;


            string errormessage = null;

            if (response != null && !result)
            {
                errormessage = response.ErrorMessage;
            }


            Application.Current.Dispatcher.BeginInvoke(new Action(() =>
            {
                if (result)
                {
                    _order.PaymentType = Model.OrderPaymentTypes.Card;
                    _order.OrderStatus = Model.OrderStatuses.Completed;

                    var _h = _order._orderHeader;

                    _h.dOrderTax     = _order.TaxSubtotal;
                    _h.dOrderAmount  = _order.AllTotal;
                    _h.TxnId         = response.Resp_TxnId;
                    _h.vApprovalCode = response.Resp_ApprovalCode;


                    //new ViewModel.Notifies.PaymentCompletedNotify().Show(() =>         // Commenting this to remove payment complete screen. Amjad 5/15
                    //{

                    ((BaseAppUI.ViewModel.Sections.Payment)MainVM.Main.Content).Release();

                    if (BaseAppUI.Properties.Settings.Default.TipSignModifierSwitch == "SignOnReceipt")
                    {
                        ReceiptPrinter.Print(_order);    // Print Merchant Copy Automatically for signature & tip - Amjad 5/15

                        new ViewModel.Notifies.ThanksNotify(_order).Show(() => {
                            MainVM.Main.SwitchToView(Model.SectionType.Dashboard);
                        });
                    }
                    else
                    {
                        new ViewModel.Notifies.TipSignModifier(_order).Show(() =>
                        {
                            new ViewModel.Notifies.ThanksNotify(_order).Show(() => {
                                MainVM.Main.SwitchToView(Model.SectionType.Dashboard);
                            });
                        });
                    }

                    //});
                }

                else
                {
                    new ViewModel.Notifies.TransactionFailedNotify(errormessage, null).Show();
                }
            }));



            _order.IsAuthorizing = false;

            return(result);
        }