Esempio n. 1
0
        private void Button_Click_MoMoPayment(object sender, RoutedEventArgs e)
        {
            MoMoPayment momopayment = new MoMoPayment();
            string      billId      = "BILL_" + DateTime.Now.ToString("yyyyMMddHHmmssffff");
            int         result      = momopayment.GoToMomoPayment(paymentVM.MoneyModel.TotalPay, billId);

            if (result == 1) // thanh toan thanh cong
            {
                GoToPayment("momo", billId);
            }
            else if (result == -1) // thanh toan that bai
            {
                System.Windows.MessageBox.Show("Thanh toan momo that bai, vui long kiem tra lai");
            }
            else if (result == 0) // khong bat browser
            {
            }
        }
Esempio n. 2
0
        public async void GotoMomopayment(int idTable)
        {
            MoMoPayment momoRequest = new MoMoPayment();

            BillViewModel billVM = new BillViewModel(idTable, 0, 0);
            string        billId = "BILL_" + DateTime.Now.ToString("yyyyMMddHHmmssffff");
            int           result = momoRequest.GoToMomoPayment(billVM.MoneyDetail.TotalPay, billId);

            if (result == 1) // thanh toan thanh cong
            {
                PaymentViewModel paymentVM = new PaymentViewModel(billVM.MoneyDetail.TotalPay);
                if (paymentVM.FinishPayment(billVM.OrderInfo, idTable, billVM.CustomerInfo, paymentVM.MoneyModel, "", billId))
                {
                    //  System.Windows.Forms.MessageBox.Show("Thanh toan thành công");
                    // send api to backend
                    ApiBackendService apiBackend = new ApiBackendService();
                    await apiBackend.SendApiToBackend(billVM.OrderInfo.Id);

                    //  MessageBox.Show("Thanh toan thanh cong");

                    // return table page
                    IRES_Globals.Cashier.MemoryAction.Instance = null;
                    ViewModel.Cashier.Common.BreadCrumbViewModel.Instance.RemovePos("Bàn");
                    Switcher.Switch(new TablePage());
                }
                else
                {
                    System.Windows.Forms.MessageBox.Show("Có sự cố xảy ra!!! Vui lòng kiểm tra lại");
                }
            }
            else if (result == -1) // thanh toan that bai
            {
                MessageBox.Show("Thanh toan momo that bai, vui long kiem tra lai");
            }
            else if (result == 0) // khong bat browser
            {
            }
        }