示例#1
0
        /// <summary>
        /// 统一对外入口
        /// </summary>
        /// <param name="payPlatform"></param>
        /// <returns></returns>
        public static async Task <IPayProvider> GetPayPlatformAsync(PayPlatform payPlatform)
        {
            IPayProvider payProvider;

            switch (payPlatform.PayChannel)
            {
            case PayChannel.WeChatPay:
                payProvider = new WechatPayProvider(payPlatform);
                break;

            case PayChannel.AliPay:
                payProvider = new AliPayProvider(payPlatform);
                break;

            case PayChannel.UnionPay:
                payProvider = new UnionPayProvider(payPlatform);
                break;

            default:
                throw new NotSupportedException($"没有实现{payPlatform.PayChannel.ToString()}支付接口");
            }

            await payProvider.InitSandboxAsync();

            return(payProvider);
        }
        protected void EgvPayPlatform_RowCommand(object sender, CommandEventArgs e)
        {
            int    payPlatformId = DataConverter.CLng(e.CommandArgument);
            string commandName   = e.CommandName;

            if (commandName != null)
            {
                if (!(commandName == "Disabled"))
                {
                    if (commandName == "Enabled")
                    {
                        PayPlatform.DisablePayPlatform(payPlatformId, false);
                    }
                    else if (commandName == "Del")
                    {
                        PayPlatform.Delete(payPlatformId);
                    }
                    else if (commandName == "SetDefault")
                    {
                        PayPlatform.SetDefault(payPlatformId);
                    }
                }
                else
                {
                    PayPlatform.DisablePayPlatform(payPlatformId, true);
                }
            }
            this.EgvPayPlatform.DataBind();
        }
 protected void GdvPaymentLogList_RowDataBound(object sender, GridViewRowEventArgs e)
 {
     if (e.Row.RowType == DataControlRowType.DataRow)
     {
         PaymentLogInfo dataItem = e.Row.DataItem as PaymentLogInfo;
         object         obj1     = e.Row.DataItem;
         if (dataItem != null)
         {
             Label     label  = (Label)e.Row.FindControl("LblStatus");
             Label     label2 = (Label)e.Row.FindControl("LblPlatform");
             HyperLink link   = (HyperLink)e.Row.FindControl("LnkPaymentNum");
             if (this.ShowOptions == 1)
             {
                 link.Text = dataItem.PaymentNum;
             }
             else
             {
                 link.Text        = dataItem.PaymentNum;
                 link.NavigateUrl = string.Concat(new object[] { "../User/PaymentLogDetail.aspx?ReturnUrl=../Shop/OrderManage.aspx?OrderID=", dataItem.OrderId, "&PaymentLogID=", dataItem.PaymentLogId.ToString() });
             }
             label.Text = PaymentLog.GetStatusDepict(dataItem.PlatformId, dataItem.Status);
             if (dataItem.Status != 1)
             {
                 e.Row.Cells[0].Enabled = false;
             }
             label2.Text = PayPlatform.GetPayPlatformById(dataItem.PlatformId).PayPlatformName;
         }
     }
 }
 protected void Page_Load(object sender, EventArgs e)
 {
     if (!this.Page.IsPostBack)
     {
         PaymentLogInfo paymentLogById = PaymentLog.GetPaymentLogById(BasePage.RequestInt32("PaymentLogID"));
         if (!paymentLogById.IsNull)
         {
             this.LblPaymentNum.Text = paymentLogById.PaymentNum;
             this.LblUserName.Text   = paymentLogById.UserName;
             PayPlatformInfo payPlatformById = PayPlatform.GetPayPlatformById(paymentLogById.PlatformId);
             if (!paymentLogById.IsNull)
             {
                 this.LblPlatform.Text = payPlatformById.PayPlatformName;
             }
             this.LblPayTime.Text      = paymentLogById.PayTime.ToString();
             this.LblMoneyPay.Text     = paymentLogById.MoneyPay.ToString("0.00");
             this.LblMoneyTrue.Text    = paymentLogById.MoneyTrue.ToString("0.00");
             this.LblStatus.Text       = PaymentLog.GetStatusDepict(paymentLogById.PlatformId, paymentLogById.Status);
             this.LblPlatformInfo.Text = paymentLogById.PlatformInfo;
             this.LblRemark.Text       = paymentLogById.Remark;
         }
         else
         {
             AdminPage.WriteErrMsg("<li>找不到对应的支付记录</li>");
         }
     }
 }
示例#5
0
 protected void Page_Load(object sender, EventArgs e)
 {
     this.m_OrderId     = BasePage.RequestInt32("OrderID");
     this.m_PointAmonut = BasePage.RequestInt32("PointAmount");
     if (!this.Page.IsPostBack)
     {
         if (this.m_OrderId > 0)
         {
             OrderInfo orderById = Order.GetOrderById(this.m_OrderId);
             this.PlhOrderInfo.Visible = true;
             this.PlhMoney.Visible     = false;
             this.PlhBuyPoint.Visible  = false;
             this.LblOrderNum.Text     = orderById.OrderNum;
             this.LblMoneyTotal.Text   = orderById.MoneyTotal.ToString("0.00");
             this.LblMoneyReceipt.Text = orderById.MoneyReceipt.ToString("0.00");
             this.LblNeedPay.Text      = (orderById.MoneyTotal - orderById.MoneyReceipt).ToString("0.00");
         }
         else
         {
             if (string.IsNullOrEmpty(PEContext.Current.User.UserName))
             {
                 base.Response.Redirect("../User/Login.aspx?ReturnUrl=" + HttpUtility.UrlEncode("../PayOnline/SelectPayPlatform.aspx?PointAmount=" + this.m_PointAmonut));
             }
             if (this.m_PointAmonut > 0)
             {
                 this.PlhOrderInfo.Visible = false;
                 this.PlhMoney.Visible     = false;
                 this.PlhBuyPoint.Visible  = true;
                 this.InitBuyPoint();
             }
         }
         this.DropPayPlatform.DataSource = PayPlatform.GetListOfEnabled();
         this.DropPayPlatform.DataBind();
     }
 }
示例#6
0
        protected void BtnSubmit_Click(object sender, EventArgs e)
        {
            PayPlatformInfo payPlatformInfo = new PayPlatformInfo();

            if (BasePage.RequestString("Action") == "Modify")
            {
                payPlatformInfo.PayPlatformId = BasePage.RequestInt32("ID");
                payPlatformInfo.OrderId       = DataConverter.CLng(this.ViewState["orderId"]);
            }
            payPlatformInfo.PayPlatformName = this.TxtPlatformName.Text;
            payPlatformInfo.AccountsId      = this.TxtAccountsID.Text;
            payPlatformInfo.MD5             = this.TxtMD5.Text;
            payPlatformInfo.Rate            = DataConverter.CDouble(this.TxtRate.Text);
            payPlatformInfo.IsDisabled      = this.ChkIsDisabled.Checked;
            payPlatformInfo.IsDefault       = this.ChkIsDefault.Checked;
            bool flag = false;

            if (BasePage.RequestString("Action") == "Modify")
            {
                flag = PayPlatform.Update(payPlatformInfo);
            }
            else
            {
                flag = PayPlatform.Add(payPlatformInfo);
            }
            if (flag)
            {
                AdminPage.WriteSuccessMsg("保存数据成功!", "PayPlatformManage.aspx");
            }
            else
            {
                AdminPage.WriteErrMsg("保存数据失败!");
            }
        }
示例#7
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (!this.Page.IsPostBack)
     {
         this.ChkIsDefault.Attributes.Add("onchange", "DefalutChange()");
         if (BasePage.RequestString("Action") == "Modify")
         {
             PayPlatformInfo payPlatformById = PayPlatform.GetPayPlatformById(BasePage.RequestInt32("ID"));
             this.TxtPlatformName.Text = payPlatformById.PayPlatformName;
             this.TxtAccountsID.Text   = payPlatformById.AccountsId;
             this.TxtMD5.Text          = payPlatformById.MD5;
             this.TxtRate.Text         = payPlatformById.Rate.ToString();
             this.ViewState["orderId"] = payPlatformById.OrderId;
             if (payPlatformById.IsDisabled)
             {
                 this.ChkIsDisabled.Checked = true;
             }
             if (payPlatformById.IsDefault)
             {
                 this.ChkIsDefault.Checked   = true;
                 this.ChkIsDisabled.Disabled = true;
             }
         }
     }
 }
示例#8
0
    //发送购买请求
    private void SendBuyReq(uint itemid, PayPlatform payPlatform = PayPlatform.none)
    {
        UMessage buyMsg = new UMessage((uint)GameCity.EMSG_ENUM.CrazyCityMsg_PLAYER_REQESTBUY);

        buyMsg.Add(GetPlayerId());
        buyMsg.Add(itemid);
        buyMsg.Add((byte)payPlatform);
        NetWorkClient.GetInstance().SendMsg(buyMsg);
    }
示例#9
0
        public static PayOnlineState AddPayment(int orderId, int payPlatformId, decimal money, string userName, string paymentNum)
        {
            if (orderId > 0)
            {
                OrderInfo orderById = Order.GetOrderById(orderId);
                if (orderById.IsNull)
                {
                    return(PayOnlineState.OrderNotFound);
                }
                if (orderById.MoneyTotal <= orderById.MoneyReceipt)
                {
                    return(PayOnlineState.AccountPaid);
                }
            }
            PayPlatformInfo payPlatformById = PayPlatform.GetPayPlatformById(payPlatformId);

            if (payPlatformById.IsNull)
            {
                return(PayOnlineState.PayPlatFormNotFound);
            }
            if (payPlatformById.IsDisabled)
            {
                return(PayOnlineState.PayPlatFormDisabled);
            }
            money = Math.Abs(money);
            if (money <= 0.01M)
            {
                return(PayOnlineState.TooLittleMoney);
            }
            if (string.IsNullOrEmpty(paymentNum))
            {
                return(PayOnlineState.NoPaymentNumber);
            }
            decimal        num            = money + ((money * DataConverter.CDecimal(payPlatformById.Rate)) / 100M);
            PaymentLogInfo paymentLogInfo = new PaymentLogInfo();

            paymentLogInfo.UserName     = userName;
            paymentLogInfo.OrderId      = orderId;
            paymentLogInfo.PaymentNum   = paymentNum;
            paymentLogInfo.PlatformId   = payPlatformById.PayPlatformId;
            paymentLogInfo.MoneyPay     = money;
            paymentLogInfo.MoneyTrue    = num;
            paymentLogInfo.PayTime      = new DateTime?(DateTime.Now);
            paymentLogInfo.Status       = 1;
            paymentLogInfo.PlatformInfo = "";
            paymentLogInfo.Remark       = "";
            paymentLogInfo.SuccessTime  = null;
            if (PaymentLog.Add(paymentLogInfo))
            {
                return(PayOnlineState.Ok);
            }
            return(PayOnlineState.Fail);
        }
 protected void BtnSaveSort_Click(object sender, EventArgs e)
 {
     foreach (GridViewRow row in this.EgvPayPlatform.Rows)
     {
         if (row.RowType == DataControlRowType.DataRow)
         {
             DropDownList list    = (DropDownList)row.FindControl("DropOrderId");
             int          orderId = DataConverter.CLng(list.SelectedValue);
             PayPlatform.SetOrderId(DataConverter.CLng(this.EgvPayPlatform.DataKeys[row.RowIndex].Value), orderId);
         }
     }
     this.EgvPayPlatform.DataBind();
 }
示例#11
0
 //购买完成后发送凭据给服务器验证数据
 public static bool SendBuyReceiptToServer(PayPlatform payplatform, string receipt)
 {
     //if (Application.platform == RuntimePlatform.IPhonePlayer)
     {
         UMessage buyMsg = new UMessage((uint)GameCity.EMSG_ENUM.CrazyCityMsg_PLAYER_BUYVERIFY);
         buyMsg.Add(GameMain.hall_.GetPlayerId());
         buyMsg.Add(GameMain.hall_.GetPlayer().GetPlayerBuyingItemId());
         buyMsg.Add((byte)payplatform);
         buyMsg.Add(receipt);
         NetWorkClient.GetInstance().SendMsg(buyMsg);
     }
     return(true);
 }
示例#12
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (!this.Page.IsPostBack)
     {
         BankrollItemInfo bankrollItemById = BankrollItem.GetBankrollItemById(BasePage.RequestInt32("BankrollItemID"));
         if (!bankrollItemById.IsNull)
         {
             this.LblDateAndTime.Text  = bankrollItemById.DateAndTime.ToString();
             this.LblClientName.Text   = Client.GetClientNameById(bankrollItemById.ClientId);
             this.LblUserName.Text     = bankrollItemById.UserName;
             this.LblMoneyType.Text    = BankrollItem.GetMoneyType(bankrollItemById.MoneyType);
             this.LblCurrencyType.Text = BankrollItem.GetCurrencyType(bankrollItemById.CurrencyType);
             if (bankrollItemById.Money > 0M)
             {
                 this.LblIncomeMoney.Text = bankrollItemById.Money.ToString("N2");
             }
             else if (bankrollItemById.Money < 0M)
             {
                 this.LblPaymentMoney.Text = Math.Abs(bankrollItemById.Money).ToString("N2");
             }
             if (bankrollItemById.MoneyType == 3)
             {
                 this.LblBank.Text = PayPlatform.GetPayPlatformById(bankrollItemById.EBankId).PayPlatformName;
             }
             else
             {
                 this.LblBank.Text = bankrollItemById.Bank;
             }
             if (bankrollItemById.Status == BankrollItemStatus.NoConfirm)
             {
                 this.LblStatus.Text     = "未确认";
                 this.BtnConfirm.Visible = true;
                 this.BtnDelete.Visible  = true;
             }
             else
             {
                 this.LblStatus.Text = "已确认";
             }
             this.LblIP.Text      = bankrollItemById.IP;
             this.LblInputer.Text = bankrollItemById.Inputer;
             this.LblLogTime.Text = bankrollItemById.LogTime.ToString();
             this.LblRemark.Text  = bankrollItemById.Remark;
             this.LblMemo.Text    = bankrollItemById.Memo;
         }
         else
         {
             AdminPage.WriteErrMsg("<li>未找到对应的资金明细记录</li>");
         }
     }
 }
示例#13
0
 protected void GdvPaymentLogList_RowDataBound(object sender, GridViewRowEventArgs e)
 {
     if (e.Row.RowType == DataControlRowType.DataRow)
     {
         PaymentLogInfo dataItem = e.Row.DataItem as PaymentLogInfo;
         if (dataItem != null)
         {
             Label label  = (Label)e.Row.FindControl("LblStatus");
             Label label2 = (Label)e.Row.FindControl("LblPlatform");
             label.Text = PaymentLog.GetStatusDepict(dataItem.PlatformId, dataItem.Status);
             if (dataItem.Status != 1)
             {
                 e.Row.Cells[0].Enabled = false;
             }
             label2.Text = PayPlatform.GetPayPlatformById(dataItem.PlatformId).PayPlatformName;
         }
     }
 }
示例#14
0
        protected void DropPaymentType_SelectedIndexChanged(object sender, EventArgs e)
        {
            PaymentTypeInfo paymentTypeById = PaymentType.GetPaymentTypeById(DataConverter.CLng(this.DropPaymentType.SelectedValue));

            this.LblPaymentTypeIntro.Text = paymentTypeById.Intro;
            if (paymentTypeById.Category == 1)
            {
                this.RadlPayPlatform.Visible = true;
                IList <PayPlatformInfo> listOfEnabled = PayPlatform.GetListOfEnabled();
                this.RadlPayPlatform.DataSource = listOfEnabled;
                this.RadlPayPlatform.DataBind();
                this.RadlPayPlatform.SelectedIndex = 0;
            }
            else
            {
                this.RadlPayPlatform.Visible = false;
            }
        }
示例#15
0
 protected void EgvPayment_RowDataBound(object sender, GridViewRowEventArgs e)
 {
     if (e.Row.RowType == DataControlRowType.DataRow)
     {
         Label          label    = e.Row.FindControl("LblPlatform") as Label;
         Label          label2   = e.Row.FindControl("LblStatus") as Label;
         PaymentLogInfo dataItem = e.Row.DataItem as PaymentLogInfo;
         if (dataItem != null)
         {
             if (label != null)
             {
                 label.Text = PayPlatform.GetPayPlatformById(dataItem.PlatformId).PayPlatformName;
             }
             if (label2 != null)
             {
                 label2.Text = EasyOne.Accessories.PaymentLog.GetStatusDepict(dataItem.PlatformId, dataItem.Status);
             }
         }
     }
 }
示例#16
0
 protected PayPlatformInfo GetPayPlatformById(int payPlatformId)
 {
     return(PayPlatform.GetPayPlatformById(payPlatformId));
 }
示例#17
0
 protected PayBase(PayPlatform payPlatform)
 {
     m_PayPlatform = payPlatform;
 }
示例#18
0
    //请求购买物品
    public bool RequestBuyItem(uint itemId, PayPlatform tradeplatform = PayPlatform.none)
    {
        ShopItemdata itemdata = CCsvDataManager.Instance.ShopItemDataMgr.GetShopItemData(itemId);

        if (itemdata == null)
        {
            return(false);
        }
        if (bBuyingProcess)
        {
            Debug.LogWarning("当前正处于购买过程中。。。。");
            return(false);
        }
        iBuyingItemId  = itemId;
        bBuyingProcess = true;

        CCustomDialog.OpenCustomWaitUI(1107);
        switch (itemdata.ItemType)
        {
        case Shop.ITEMTYPE.ITEMTYPE_DIAMOND:
        {
            //苹果平台
            if (tradeplatform == PayPlatform.Apple)
            {
#if UNITY_IOS
                ApplePay.Instance.BuyItem(itemId.ToString());
#endif
            }
            else if (tradeplatform == PayPlatform.none)
            {
                //SendBuyReq(itemdata.ItemID, PayPlatform.Wechat);
                //发个假的票据
                Player.SendBuyReceiptToServer(tradeplatform, "this is fake receipt!");
            }
            else
            {
                SendBuyReq(itemdata.ItemID, tradeplatform);
            }
        }
        break;

        case Shop.ITEMTYPE.ITEMTYPE_COIN:
        {
            //判断钻石是否足够
            if (itemdata.CurrencyType == Shop.CURRENCYTYPE.CURRENCYTYPE_DIAMOND)
            {
                if (playerData.GetDiamond() < itemdata.ItemPrice)
                {
                    BuyEnd();
                    CCustomDialog.OpenCustomConfirmUI(1102);
                }
                else
                {
                    SendBuyReq(itemdata.ItemID);
                }
            }
            else if (itemdata.CurrencyType == Shop.CURRENCYTYPE.CURRENCYTYPE_LOTTERY)
            {
                //判断奖券是否足够
                if (playerData.GetLottery() < itemdata.ItemPrice)
                {
                    BuyEnd();
                    CCustomDialog.OpenCustomConfirmUI(1103);
                }
                else
                {
                    SendBuyReq(itemdata.ItemID);
                }
            }
        }
        break;

        default:
            //发个假的票据
            Player.SendBuyReceiptToServer(tradeplatform, "this is fake receipt!");
            break;
        }

        return(true);
    }
示例#19
0
 public UnionPayProvider(PayPlatform payPlatform) : base(payPlatform)
 {
 }
        protected void BtnExportExcel_Click(object sender, EventArgs e)
        {
            IList <BankrollItemInfo> list    = BankrollItem.GetList(0, 0x7fffffff, 11, 0, this.GetKeywords());
            StringBuilder            builder = new StringBuilder();

            base.Response.Clear();
            base.Response.AppendHeader("content-disposition", "attachment;filename=BankrollItemList.xls");
            base.Response.ContentEncoding = Encoding.GetEncoding("GB2312");
            base.Response.ContentType     = "application/vnd.xls";
            builder.Append("<table border='1' cellspacing='1' style='border-collapse: collapse;table-layout:fixed' id='AutoNumber1' height='32'><tr>");
            builder.Append("<td align='center'><b>交易时间</b></td>");
            builder.Append("<td align='center'><b>客户名称</b></td>");
            builder.Append("<td align='center'><b>用户名</b></td>");
            builder.Append("<td align='center'><b>交易方式</b></td>");
            builder.Append("<td align='center'><b>币种</b></td>");
            builder.Append("<td align='center'><b>收入金额</b></td>");
            builder.Append("<td align='center'><b>支出金额</b></td>");
            builder.Append("<td align='center'><b>摘要</b></td>");
            builder.Append("<td align='center'><b>银行名称</b></td>");
            builder.Append("<td align='center'><b>备注/说明</b></td></tr>");
            foreach (BankrollItemInfo info in list)
            {
                builder.Append("<tr>");
                builder.Append("<td align='center'>" + info.DateAndTime.ToString() + "</td>");
                builder.Append("<td align='center'>" + DataSecurity.HtmlEncode(info.ClientName) + "</td>");
                builder.Append("<td align='center'>" + DataSecurity.HtmlEncode(info.UserName) + "</td>");
                builder.Append("<td align='center'>" + this.GetMoneyType(info.MoneyType) + "</td>");
                builder.Append("<td align='center'>" + this.GetCurrencyType(info.CurrencyType) + "</td>");
                builder.Append("<td align='center'>" + ((info.Money > 0M) ? info.Money.ToString() : "") + "</td>");
                builder.Append("<td align='center'>" + ((info.Money < 0M) ? Math.Abs(info.Money).ToString() : "") + "</td>");
                builder.Append("<td align='center'>" + ((info.Money > 0M) ? "收入" : "支出") + "</td>");
                builder.Append("<td align='center'>" + ((info.MoneyType == 3) ? DataSecurity.HtmlEncode(PayPlatform.GetPayPlatformById(info.EBankId).PayPlatformName) : DataSecurity.HtmlEncode(info.Bank)) + "</td>");
                builder.Append("<td align='center'>" + DataSecurity.HtmlEncode(info.Remark) + "</td>");
                builder.Append("</tr>");
            }
            base.Response.Write(builder.ToString());
            base.Response.End();
        }
示例#21
0
 public WechatPayProvider(PayPlatform payPlatform) : base(payPlatform)
 {
 }
示例#22
0
 public AliPayProvider(PayPlatform payPlatform) : base(payPlatform)
 {
 }
示例#23
0
        private void InitializePaymentType(int paymentTypeId, int payPlatformId)
        {
            IList <PaymentTypeInfo> paymentTypeListByEnabled = PaymentType.GetPaymentTypeListByEnabled();
            int typeId   = 0;
            int category = 0;
            IList <PaymentTypeInfo> list2 = new List <PaymentTypeInfo>();

            foreach (PaymentTypeInfo info in paymentTypeListByEnabled)
            {
                bool userLogin = true;
                if (info.Category == 2)
                {
                    userLogin = this.m_UserLogin;
                }
                if (userLogin)
                {
                    if (paymentTypeId > 0)
                    {
                        if (info.TypeId == paymentTypeId)
                        {
                            typeId   = paymentTypeId;
                            category = info.Category;
                            this.LblPaymentTypeIntro.Text = info.Intro;
                        }
                    }
                    else if (info.IsDefault)
                    {
                        typeId   = info.TypeId;
                        category = info.Category;
                        this.LblPaymentTypeIntro.Text = info.Intro;
                    }
                    list2.Add(info);
                }
            }
            this.DropPaymentType.DataSource = list2;
            this.DropPaymentType.DataBind();
            BasePage.SetSelectedIndexByValue(this.DropPaymentType, typeId.ToString());
            if (category == 1)
            {
                this.RadlPayPlatform.Visible = true;
                IList <PayPlatformInfo> listOfEnabled = PayPlatform.GetListOfEnabled();
                this.RadlPayPlatform.DataSource = listOfEnabled;
                this.RadlPayPlatform.DataBind();
                foreach (PayPlatformInfo info2 in listOfEnabled)
                {
                    if (payPlatformId > 0)
                    {
                        if (info2.PayPlatformId != payPlatformId)
                        {
                            continue;
                        }
                        this.RadlPayPlatform.SelectedValue = info2.PayPlatformId.ToString();
                        return;
                    }
                    if (info2.IsDefault)
                    {
                        this.RadlPayPlatform.SelectedValue = info2.PayPlatformId.ToString();
                        return;
                    }
                }
            }
        }