Ejemplo n.º 1
0
    public override BaseView OpenWindow()
    {
        BaseView view = base.OpenWindow();

        if (mPayView == null)
        {
            mPayView = view as PayView;
        }
        return(view);
    }
Ejemplo n.º 2
0
 /// <summary>
 /// 充值点击
 /// </summary>
 public void OnRechargeClick()
 {
     SQDebug.Log("======>" + mData.desc);
     Global.Inst.GetController <CommonTipsController>().ShowTips("是否充值:" + mData.desc + "?", "取消|充值", null, () =>
     {
         PayView view = Global.Inst.GetController <PayController>().OpenWindow() as PayView;
         view.SetData(mData);  //可以充值 释放
         // Global.Inst.GetController<CommonTipsController>().ShowTips("即将开放,请联系客服处理!");
     }, null, "充值");
 }
Ejemplo n.º 3
0
    public override void Init(IModule module)
    {
        base.Init(module);

        PayView payview = (PayView)InstantiateWindow <PayView>("Pay/Prefabs/PayView");

        payview.WindowActionCallback = evt =>
        {
            ModuleManager.Instance.GoBack();
        };
    }
Ejemplo n.º 4
0
 public NavigationModel(ContentWindow contentWindow)
 {
     _contentWindow  = contentWindow;
     _mainView       = new MainView();
     _settingsView   = new SettingsView();
     _bookingView    = new BookingView();
     _payView        = new PayView();
     _reportView     = new ReportView();
     _addBookingView = new AddBookingView();
     _clientView     = new ClientView();
     _personnelView  = new PersonnelView();
 }
Ejemplo n.º 5
0
    private void buy()
    {
        GameObject         go   = UIManager.OpenUI(Config.UI.UIPath.ContanerSelectPanel);
        ContanerSelectView list = go.GetComponent <ContanerSelectView>();

        list.setCallback((id) => {
            Destroy(go);
            Mod.Cabinet cabinet = Mod.Cabinet.GetById(id);
            GameObject pay      = UIManager.OpenUI(Config.UI.UIPath.PayPanel);
            PayView pv          = pay.GetComponent <PayView>();
            pv.amount           = cabinet.Good().Price;
        });
    }
Ejemplo n.º 6
0
    private void playGame()
    {
        // startGame(false);
        if (Coin.GetInstance().afford())
        {
            GameObject         gl   = UIManager.OpenUI(Config.UI.UIPath.ContanerSelectPanel);
            ContanerSelectView list = gl.GetComponent <ContanerSelectView>();
            list.setCallback((id) => {
                Destroy(gl);
                Coin.GetInstance().consume(id);
                startGame(false);
            });
            return;
        }
        GameObject go = UIManager.OpenUI(Config.UI.UIPath.PayPanel);
        PayView    pv = go.GetComponent <PayView>();

        pv.amount = 4;
    }
Ejemplo n.º 7
0
        public HttpResponseMessage SpgatewayPayBill(PayView payView)
        {
            Pay pay_ = new Pay();

            ModelState.Remove("Status");
            ModelState.Remove("Message");

            if (!ModelState.IsValid)
            {
                return(Request.CreateResponse(HttpStatusCode.OK, ModelState));
            }
            pay_.OrderId = payView.OrderId;
            db.Pays.Add(pay_);
            db.SaveChanges();

            Orders orders  = db.Orders.Where(x => x.Id == payView.OrderId).FirstOrDefault();
            string version = "1.5";
            string payType = "CREDIT";
            // 目前時間轉換 +08:00, 防止傳入時間或Server時間時區不同造成錯誤
            DateTimeOffset taipeiStandardTimeOffset = DateTimeOffset.Now.ToOffset(new TimeSpan(8, 0, 0));

            TradeInfo tradeInfo = new TradeInfo()
            {
                // * 商店代號
                MerchantID = _bankInfoModel.MerchantID,
                // * 回傳格式
                RespondType = "String",
                // * TimeStamp
                TimeStamp = taipeiStandardTimeOffset.ToUnixTimeSeconds().ToString(),
                // * 串接程式版本
                Version = version,
                // * 商店訂單編號
                MerchantOrderNo = pay_.Id.ToString(),
                // MerchantOrderNo = ordernumber,
                // * 訂單金額
                Amt = (int)orders.Total,
                // * 商品資訊
                ItemDesc = pay_.OrderId.ToString(),
                // 繳費有效期限(適用於非即時交易)
                ExpireDate = null,
                // 支付完成 返回商店網址
                ReturnURL = _bankInfoModel.ReturnURL,
                // 支付通知網址
                NotifyURL = _bankInfoModel.NotifyURL,
                // 商店取號網址
                CustomerURL = _bankInfoModel.CustomerURL,
                // 支付取消 返回商店網址
                ClientBackURL = null,
                // * 付款人電子信箱
                Email = string.Empty,
                // 付款人電子信箱 是否開放修改(1=可修改 0=不可修改)
                EmailModify = 0,
                // 商店備註
                OrderComment = "商店備註",
                // 信用卡 一次付清啟用(1=啟用、0或者未有此參數=不啟用)
                CREDIT = 1,
                // WEBATM啟用(1=啟用、0或者未有此參數,即代表不開啟)
                //WEBATM = null,
                // ATM 轉帳啟用(1=啟用、0或者未有此參數,即代表不開啟)
                //VACC = null,
                // 超商代碼繳費啟用(1=啟用、0或者未有此參數,即代表不開啟)(當該筆訂單金額小於 30 元或超過 2 萬元時,即使此參數設定為啟用,MPG 付款頁面仍不會顯示此支付方式選項。)
                //CVS = 1,
                // 超商條碼繳費啟用(1=啟用、0或者未有此參數,即代表不開啟)(當該筆訂單金額小於 20 元或超過 4 萬元時,即使此參數設定為啟用,MPG 付款頁面仍不會顯示此支付方式選項。)
                //BARCODE = 1
            };

            if (string.Equals(payType, "CREDIT"))
            {
                tradeInfo.CREDIT = 1;
            }
            else if (string.Equals(payType, "WEBATM"))
            {
                tradeInfo.WEBATM = 1;
            }
            else if (string.Equals(payType, "VACC"))
            {
                // 設定繳費截止日期
                tradeInfo.ExpireDate = taipeiStandardTimeOffset.AddDays(1).ToString("yyyyMMdd");
                tradeInfo.VACC       = 1;
            }
            else if (string.Equals(payType, "CVS"))
            {
                // 設定繳費截止日期
                tradeInfo.ExpireDate = taipeiStandardTimeOffset.AddDays(1).ToString("yyyyMMdd");
                tradeInfo.CVS        = 1;
            }
            else if (string.Equals(payType, "BARCODE"))
            {
                // 設定繳費截止日期
                tradeInfo.ExpireDate = taipeiStandardTimeOffset.AddDays(1).ToString("yyyyMMdd");
                tradeInfo.BARCODE    = 1;
            }

            Atom <string> result = new Atom <string>()
            {
                IsSuccess = true
            };

            var inputModel = new SpgatewayInputModel
            {
                MerchantID = _bankInfoModel.MerchantID,
                Version    = version
            };

            // 將model 轉換為List<KeyValuePair<string, string>>, null值不轉
            List <KeyValuePair <string, string> > tradeData = LambdaUtil.ModelToKeyValuePairList <TradeInfo>(tradeInfo);
            // 將List<KeyValuePair<string, string>> 轉換為 key1=Value1&key2=Value2&key3=Value3...
            var tradeQueryPara = string.Join("&", tradeData.Select(x => $"{x.Key}={x.Value}"));

            // AES 加密
            inputModel.TradeInfo =
                CryptoUtil.EncryptAESHex(tradeQueryPara, _bankInfoModel.HashKey, _bankInfoModel.HashIV);
            // SHA256 加密
            inputModel.TradeSha =
                CryptoUtil.EncryptSHA256(
                    $"HashKey={_bankInfoModel.HashKey}&{inputModel.TradeInfo}&HashIV={_bankInfoModel.HashIV}");

            // 將model 轉換為List<KeyValuePair<string, string>>, null值不轉
            List <KeyValuePair <string, string> > postData =
                LambdaUtil.ModelToKeyValuePairList <SpgatewayInputModel>(inputModel);


            //StringBuilder s = new StringBuilder();
            //s.Append("<html>");
            //s.AppendFormat("<body onload='document.forms[\"form\"].submit()'>");
            //s.AppendFormat("<form name='form' action='{0}' method='post'>", _bankInfoModel.AuthUrl);
            //foreach (KeyValuePair<string, string> item in postData)
            //{
            //    s.AppendFormat("<input type='hidden' name='{0}' value='{1}' />", item.Key, item.Value);
            //}

            //s.Append("</form></body></html>");


            return(Request.CreateResponse(HttpStatusCode.OK, postData));
        }
Ejemplo n.º 8
0
        public OrderDetailViewModel(long orderId)
        {
            Order = new OrderDetail();

            DeleteBtnVisible = false;
            InitOrderDetailPage(orderId);

            CancelCommand = new Command(async() =>
            {
                bool action = await Application.Current.MainPage.DisplayAlert("取消订单", "您想要取消订单吗?取消后,我们将为您退回货款并拦截快递。", "是的", "算了");
                if (action)
                {
                    CancelOrder();
                    InitOrderDetailPage(orderId);
                }
            }, () => { return(true); });

            HomeCommand = new Command(() =>
            {
                //Application.Current.MainPage.Navigation.PopToRootAsync();
            }, () => { return(true); });

            PayCommand = new Command(() =>
            {
                var page = new PayView(Order);
                PopupNavigation.Instance.PushAsync(page);

                //PlaceAnOrder();
                //InitOrderDetailPage(orderId);
            }, () => { return(true); });

            DeleteOrderCommand = new Command(() =>
            {
                DeleteOrderAsync();
            }, () => { return(true); });

            DeleteCommand = new Command(() =>
            {
                DeleteBtnVisible = !DeleteBtnVisible;
            }, () => { return(true); });

            OneTappedCommand = new Command <long>((id) =>
            {
                ProductDetailPage productDetailPage = new ProductDetailPage(id.ToString());
                Application.Current.MainPage.Navigation.PushAsync(productDetailPage);
            }, (id) => { return(true); });

            MessagingCenter.Subscribe <object, string>(this, "PaySuccess", (sender, resultStatus) =>
            {
                switch (resultStatus)
                {
                case "9000": CrossToastPopUp.Current.ShowToastSuccess("订单支付成功!", ToastLength.Long); break;

                case "8000": CrossToastPopUp.Current.ShowToastWarning("正在处理中!", ToastLength.Long); break;

                case "4000": CrossToastPopUp.Current.ShowToastError("订单支付失败!", ToastLength.Long); break;

                case "6001": CrossToastPopUp.Current.ShowToastWarning("用户中途取消!", ToastLength.Long); break;

                case "6002": CrossToastPopUp.Current.ShowToastError("网络连接出错!", ToastLength.Long); break;

                default: break;
                }

                PopupNavigation.Instance.PopAllAsync();

                InitOrderDetailPage(orderId);
            });
        }