Пример #1
0
        /// <summary>
        /// 获取银行图标
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        public static byte[] ReadBankImage(string id)
        {
            System.Drawing.Bitmap img = null;
            BankSign sign             = (BankSign)Enum.Parse(typeof(BankSign), id, true);

            switch (sign)
            {
            case BankSign.ICBC: img = BankRes.ICBC; break;

            case BankSign.ABC: img = BankRes.ABC; break;

            case BankSign.CCB: img = BankRes.CCB; break;

            case BankSign.BOC: img = BankRes.BOC; break;

            case BankSign.CIB: img = BankRes.CIB; break;

            case BankSign.CITIC: img = BankRes.CITIC; break;

            case BankSign.CMB: img = BankRes.CMB; break;

            case BankSign.CMBC: img = BankRes.CMBC; break;

            case BankSign.CEB: img = BankRes.CEB; break;

            case BankSign.COMM: img = BankRes.COMM; break;

            case BankSign.GDB: img = BankRes.GDB; break;

            case BankSign.SPAB: img = BankRes.SPAB; break;

            case BankSign.POSTGC: img = BankRes.POSTGC; break;

            case BankSign.SPDB: img = BankRes.SPDB; break;
            }
            if (img == null)
            {
                return(new byte[0]);
            }

            MemoryStream ms = new MemoryStream();

            img.Save(ms, System.Drawing.Imaging.ImageFormat.Jpeg);

            byte[] buffer = ms.ToArray();
            ms.Dispose();

            return(buffer);
        }
Пример #2
0
 public BankItem(BankSign sign,string name,string netway)
 {
     this.Sign = sign;
     this.HansName = name;
     this.NetGateway = netway;
 }
Пример #3
0
 public BankItem(BankSign sign, string name, string netway)
 {
     this.Sign       = sign;
     this.HansName   = name;
     this.NetGateway = netway;
 }
Пример #4
0
        /// <summary>
        /// 提交支付请求(收货信息仅支付宝担保时传递)
        /// </summary>
        /// <param name="pm"></param>
        /// <param name="pt"></param>
        /// <param name="partner_id"></param>
        /// <param name="partner_secret"></param>
        /// <param name="seller_account"></param>
        /// <param name="orderNo"></param>
        /// <param name="order_fee"></param>
        /// <param name="order_exp_fee"></param>
        /// <param name="order_desc"></param>
        /// <param name="order_show_url"></param>
        /// <param name="receive_name"></param>
        /// <param name="receive_address"></param>
        /// <param name="receive_zip"></param>
        /// <param name="receive_phone"></param>
        /// <param name="receive_mobile"></param>
        /// <param name="return_url"></param>
        /// <param name="notify_url"></param>
        /// <returns></returns>
        public string SubmitRequest(
            PayMethods pm,
            PayApiType pt,
            string partner_id,
            string partner_secret,
            string seller_account,
            BankSign bank,
            string orderNo,
            float order_fee,
            float order_exp_fee,
            string order_desc,
            string order_show_url,
            string subject,
            string receive_name,
            string receive_address,
            string receive_zip,
            string receive_phone,
            string receive_mobile,
            string return_url,
            string notify_url
            )
        {
            Hashtable ht = new Hashtable();

            // OrderInfo order;

            // order = new Order(orderNo);


            // if (order == null)
            // {
            //    p.PayUtil.SetLogMessage("订单不存在!");
            //     return Result((int)p.PaidHandleResult.Fail);
            // }


            // orderPM = this.LoadOrderPM(order);
            if (String.IsNullOrEmpty(return_url))
            {
                return_url = PayUtil.GetReturnUrl(pm, pt);
            }
            if (String.IsNullOrEmpty(notify_url))
            {
                notify_url = PayUtil.GetNotifyUrl(pm, pt);
            }

            ht.Add("order_subject", subject ?? "支付订单" + orderNo);
            ht.Add("order_no", orderNo);                                            //订单编号
            ht.Add("order_fee", order_fee);
            ht.Add("order_exp_fee", order_exp_fee);                                 //订单快递金额
            try{
                ht.Add("usr_host", HttpContext.Current.Request.UserHostAddress);    //用户IP地址
            }catch {}
            ht.Add("order_showurl", order_show_url);                                //订单显示地址
            ht.Add("return_url", return_url);                                       //返回地址
            ht.Add("notify_url", notify_url);                                       //通知地址
            ht.Add("order_desc", order_desc);                                       //订单描述
            ht.Add("seller_account", seller_account);                               //帐号

            //收货信息
            ht.Add("receive_name", receive_name);
            ht.Add("receive_address", receive_address);
            ht.Add("receive_mobile", receive_mobile);
            ht.Add("receive_zip", receive_zip);
            ht.Add("receive_phone", receive_phone);


            if (bank != BankSign.Default)
            {
                ht.Add("bank", bank.ToString());
            }


            if (pm != PayMethods.Unknown)
            {
                string payHtml = String.Empty;

                switch (pm)
                {
                //财付通
                case PayMethods.Tenpay:

                    ht.Add("tenpay_key", partner_id);
                    ht.Add("tenpay_secret", partner_secret);
                    ht.Add("trade_mode", -((int)pt - 4));    //1:即时到帐,2:中介担保,3:自己选择

                    payHtml = String.Format("<script>location.replace('{0}')</script>",
                                            PayUtil.GetGatewayStr(PayMethods.Tenpay, pt, ht));

                    break;

                //支付宝
                case PayMethods.Alipay:
                    ht.Add("alipay_key", partner_id);
                    ht.Add("alipay_secret", partner_secret);

                    payHtml = PayUtil.GetGatewayStr(PayMethods.Alipay, pt, ht);

                    break;

                //在线支付
                default:
                case PayMethods.OnlinePay:
                    //
                    //UNDONE:
                    //
                    throw new NotImplementedException("暂不支持银行支付!");
                }


                //准备支付
                // orderPM.RepairPay();


                //跳转到支付页面
                return(payHtml);
            }

            else
            {
                return("不支持的支付方式!");
            }
        }