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 { } }
public async Task <int> AddMoMoPaymentAsync(int orderId, string moMoOrderId, string payType, string responseTime) { var checkDatetime = DateTime.TryParse(responseTime, out DateTime responseTimeParse); if (checkDatetime) { var moMoPayment = new MoMoPayment() { Id = moMoOrderId, PayType = payType, ResponseTime = responseTimeParse, OrderId = orderId }; await _context.AddAsync(moMoPayment); return(await _context.SaveChangesAsync()); } return(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 { } }