Exemple #1
0
        protected void Page_Load(object sender, EventArgs e)
        {
            string type = Request.Form["paytype"];
            if (type == "alipay")
            {
                BCBill bill = new BCBill(BCPay.PayChannel.ALI_WEB.ToString(), 1, BCUtil.GetUUID(), "dotNet自来水");
                bill.returnUrl = "http://*****:*****@xx.com";
                data.receiverName = "某某某";
                data.transferFee = 100;
                data.transferNote = "note";
                BCTransferData data2 = new BCTransferData();
                data2.transferId = BCUtil.GetUUID();
                data2.receiverAccount = "*****@*****.**";
                data2.receiverName = "某某";
                data2.transferFee = 100;
                data2.transferNote = "note";
                List<BCTransferData> list = new List<BCTransferData>();
                list.Add(data);
                list.Add(data2);

                try
                {
                    BCTransfersParameter para = new BCTransfersParameter();
                    para.channel = BCPay.TransferChannel.ALI.ToString();
                    para.batchNo = BCUtil.GetUUID();
                    para.accountName = "毛毛";
                    para.transfersData = list;
                    string transfersURL = BCPay.BCTransfers(para);
                    Response.Write("<a href=" + transfersURL + ">付款地址</a><br/>");
                }
                catch (Exception excption)
                {
                    Response.Write("<span style='color:#00CD00;font-size:20px'>" + excption.Message + "</span><br/>");
                }
            }
            else if (type == "alitransfer")
            {
                try
                {
                    BCTransferParameter para = new BCTransferParameter();
                    para.channel = BCPay.TransferChannel.ALI_TRANSFER.ToString();
                    para.transferNo = BCUtil.GetUUID();
                    para.totalFee = 100;
                    para.desc = "C# 单笔打款";
                    para.channelUserId = "*****@*****.**";
                    para.channelUserName = "******";
                    para.accountName = "XXX有限公司";
                    string aliURL = BCPay.BCTransfer(para);
                    Response.Write("<a href=" + aliURL + ">付款地址</a><br/>");
                }
                catch (Exception excption)
                {
                    Response.Write("<span style='color:#00CD00;font-size:20px'>" + excption.Message + "</span><br/>");
                }
            }
            else if (type == "wxtransfer")
            {
                try
                {
                    BCTransferParameter para = new BCTransferParameter();
                    para.channel = BCPay.TransferChannel.WX_TRANSFER.ToString();
                    para.transferNo = "1000000000";
                    para.totalFee = 100;
                    para.desc = "C# 单笔打款";
                    para.channelUserId = "XXXXXXXXXXXXXXXXXX";
                    BCPay.BCTransfer(para);
                    Response.Write("完成");
                }
                catch (Exception excption)
                {
                    Response.Write("<span style='color:#00CD00;font-size:20px'>" + excption.Message + "</span><br/>");
                }
            }
            else if (type == "wxredpack")
            {
                BCRedPackInfo info = new BCRedPackInfo();
                info.actName = "C# 红包";
                info.sendName = "BeeCloud";
                info.wishing = "啦啦啦";

                try
                {
                    BCTransferParameter para = new BCTransferParameter();
                    para.channel = BCPay.TransferChannel.WX_REDPACK.ToString();
                    para.transferNo = "1000000001";
                    para.totalFee = 100;
                    para.desc = "C# 红包";
                    para.channelUserId = "XXXXXXXXXXXXXXXX";
                    para.info = info;
                    BCPay.BCTransfer(para);
                    Response.Write("完成");
                }
                catch (Exception excption)
                {
                    Response.Write("<span style='color:#00CD00;font-size:20px'>" + excption.Message + "</span><br/>");
                }
            }
            else if (type == "bctransfer")
            {
                //getBankFullNames方法可以获取所有支持的银行全称,将全称填写到BCTransferWithBackCard里的bank_fullname字段
                BankList banks = BCPay.getBankFullNames("P_CR");
                foreach (var bank in banks.bankList)
                {
                    Response.Write("<span style='color:#00CD00;font-size:20px'>" + bank.ToString() + "</span><br/>");
                }

                BCTransferWithBackCard transfer = new BCTransferWithBackCard(1, BCUtil.GetUUID(), ".net测试代付", "OUT_PC", "中国银行", "DE", "P", "xxxxxxxxxxxx", "xxx");
                transfer.mobile = "xxxxxxxxxxxxxx";
                try
                {
                    transfer = BCPay.BCBankCardTransfer(transfer);
                    Response.Write("<span style='color:#00CD00;font-size:20px'>已代付</span><br/>");
                }
                catch (Exception excption)
                {
                    Response.Write("<span style='color:#00CD00;font-size:20px'>" + excption.Message + "</span><br/>");
                }
            }
            else if (type == "bccjtransfer")
            {
                BCCJTransferWithBackCard transfer = new BCCJTransferWithBackCard(BCUtil.GetUUID(), ".net测试代付", 100, "姓名", "银行名", "卡号", "支行名", "省", "市", "DEBIT", "C");
                try
                {
                    transfer = BCPay.BCCJBankCardTransfer(transfer);
                    Response.Write("<span style='color:#00CD00;font-size:20px'>已代付</span><br/>");
                }
                catch (Exception excption)
                {
                    Response.Write("<span style='color:#00CD00;font-size:20px'>" + excption.Message + "</span><br/>");
                }
            }
            Response.Write("<span style='color:#00CD00;font-size:20px'>" + type + "</span>");
        }
Exemple #2
0
        protected void Page_Load(object sender, EventArgs e)
        {
            string type = Request.Form["paytype"];

            if (type == "alipay")
            {
                BCBill bill = new BCBill(BCPay.PayChannel.ALI_WEB.ToString(), 300, BCUtil.GetUUID(), "dotNet自来水");
                bill.returnUrl = "http://*****:*****@xx.com";
                data.receiverName    = "某某某";
                data.transferFee     = 100;
                data.transferNote    = "note";
                BCTransferData data2 = new BCTransferData();
                data2.transferId      = BCUtil.GetUUID();
                data2.receiverAccount = "*****@*****.**";
                data2.receiverName    = "某某";
                data2.transferFee     = 100;
                data2.transferNote    = "note";
                List <BCTransferData> list = new List <BCTransferData>();
                list.Add(data);
                list.Add(data2);

                try
                {
                    BCTransfersParameter para = new BCTransfersParameter();
                    para.channel       = BCPay.TransferChannel.ALI.ToString();
                    para.batchNo       = BCUtil.GetUUID();
                    para.accountName   = "毛毛";
                    para.transfersData = list;
                    string transfersURL = BCPay.BCTransfers(para);
                    Response.Write("<a href=" + transfersURL + ">付款地址</a><br/>");
                }
                catch (Exception excption)
                {
                    Response.Write("<span style='color:#00CD00;font-size:20px'>" + excption.Message + "</span><br/>");
                }
            }
            else if (type == "alitransfer")
            {
                try
                {
                    BCTransferParameter para = new BCTransferParameter();
                    para.channel         = BCPay.TransferChannel.ALI_TRANSFER.ToString();
                    para.transferNo      = BCUtil.GetUUID();
                    para.totalFee        = 100;
                    para.desc            = "C# 单笔打款";
                    para.channelUserId   = "*****@*****.**";
                    para.channelUserName = "******";
                    para.accountName     = "XXX有限公司";
                    string aliURL = BCPay.BCTransfer(para);
                    Response.Write("<a href=" + aliURL + ">付款地址</a><br/>");
                }
                catch (Exception excption)
                {
                    Response.Write("<span style='color:#00CD00;font-size:20px'>" + excption.Message + "</span><br/>");
                }
            }
            else if (type == "wxtransfer")
            {
                try
                {
                    BCTransferParameter para = new BCTransferParameter();
                    para.channel       = BCPay.TransferChannel.WX_TRANSFER.ToString();
                    para.transferNo    = "1000000000";
                    para.totalFee      = 100;
                    para.desc          = "C# 单笔打款";
                    para.channelUserId = "XXXXXXXXXXXXXXXXXX";
                    BCPay.BCTransfer(para);
                    Response.Write("完成");
                }
                catch (Exception excption)
                {
                    Response.Write("<span style='color:#00CD00;font-size:20px'>" + excption.Message + "</span><br/>");
                }
            }
            else if (type == "wxredpack")
            {
                BCRedPackInfo info = new BCRedPackInfo();
                info.actName  = "C# 红包";
                info.sendName = "BeeCloud";
                info.wishing  = "啦啦啦";

                try
                {
                    BCTransferParameter para = new BCTransferParameter();
                    para.channel       = BCPay.TransferChannel.WX_REDPACK.ToString();
                    para.transferNo    = "1000000001";
                    para.totalFee      = 100;
                    para.desc          = "C# 红包";
                    para.channelUserId = "XXXXXXXXXXXXXXXX";
                    para.info          = info;
                    BCPay.BCTransfer(para);
                    Response.Write("完成");
                }
                catch (Exception excption)
                {
                    Response.Write("<span style='color:#00CD00;font-size:20px'>" + excption.Message + "</span><br/>");
                }
            }
            else if (type == "bctransfer")
            {
                //getBankFullNames方法可以获取所有支持的银行全称,将全称填写到BCTransferWithBackCard里的bank_fullname字段
                BankList banks = BCPay.getBankFullNames("P_CR");
                foreach (var bank in banks.bankList)
                {
                    Response.Write("<span style='color:#00CD00;font-size:20px'>" + bank.ToString() + "</span><br/>");
                }


                BCTransferWithBackCard transfer = new BCTransferWithBackCard(1, BCUtil.GetUUID(), ".net测试代付", "OUT_PC", "中国银行", "DE", "P", "xxxxxxxxxxxx", "xxx");
                transfer.mobile = "xxxxxxxxxxxxxx";
                try
                {
                    transfer = BCPay.BCBankCardTransfer(transfer);
                    Response.Write("<span style='color:#00CD00;font-size:20px'>已代付</span><br/>");
                }
                catch (Exception excption)
                {
                    Response.Write("<span style='color:#00CD00;font-size:20px'>" + excption.Message + "</span><br/>");
                }
            }
            else if (type == "bccjtransfer")
            {
                BCCJTransferWithBackCard transfer = new BCCJTransferWithBackCard(BCUtil.GetUUID(), ".net测试代付", 100, "姓名", "银行名", "卡号", "支行名", "省", "市", "DEBIT", "C");
                try
                {
                    transfer = BCPay.BCCJBankCardTransfer(transfer);
                    Response.Write("<span style='color:#00CD00;font-size:20px'>已代付</span><br/>");
                }
                catch (Exception excption)
                {
                    Response.Write("<span style='color:#00CD00;font-size:20px'>" + excption.Message + "</span><br/>");
                }
            }
            Response.Write("<span style='color:#00CD00;font-size:20px'>" + type + "</span>");
        }