示例#1
0
        /// <summary>
        /// 发送支付请求到支付网关
        /// </summary>
        /// <returns></returns>
        public override void SendRequest(PaymentOrder order)
        {
            var v_mid = Config["chinabank_account"].Values.ToString();
            var v_oid = order.PaymentNo;
            var v_amount = order.Money.ToString("#.00");
            var v_url = order.ReturnUrl;
            var v_autoReceive = "[url:={0}]".FormatWith(order.NoticeUrl);
            var key = Config["chinabank_key"].Values.ToString();

            var md5str = v_amount + v_moneytype + v_oid + v_mid + v_url + key;

            string v_md5info = md5str.Hash();

            var stringBuilder = new StringBuilder();
            stringBuilder.Append(this.CreateField("v_mid", v_mid));
            stringBuilder.Append(this.CreateField("v_oid", v_oid));
            stringBuilder.Append(this.CreateField("v_amount", v_amount));
            stringBuilder.Append(this.CreateField("v_moneytype", v_moneytype));
            stringBuilder.Append(this.CreateField("v_url", v_url));
            stringBuilder.Append(this.CreateField("remark1", "ChinaBankDirect"));
            stringBuilder.Append(this.CreateField("remark2", v_autoReceive));
            stringBuilder.Append(this.CreateField("v_md5info", v_md5info));

            this.SubmitPaymentForm(this.CreateForm(stringBuilder.ToString(), Gateway));
        }
示例#2
0
        public override void SendRequest(PaymentOrder order)
        {
            param["transType"] = UPOPSrv.TransType.CONSUME;                         // 交易类型,前台只支持CONSUME 和 PRE_AUTH
            param["orderNumber"] = order.PaymentNo;                                 // 订单号,必须唯一
            param["orderAmount"] = Math.Round(order.Money*100).ToString();                          // 交易金额
            param["orderCurrency"] = UPOPSrv.CURRENCY_CNY;                          // 币种
            param["orderTime"] = DateTime.Now.ToString("yyyyMMddHHmmss");           // 交易时间
            param["frontEndUrl"] = order.ReturnUrl;                                 // 前台回调URL
            param["backEndUrl"] = order.NoticeUrl;                                  // 后台回调URL
            param["merId"] = Config["unionpay_account"].Values.ToString();          // 商户编号
            param["customerIp"] = GetIP();

            UPOPSrv.Config.securityKey = Config["unionpay_key"].Values.ToString(); //设置密钥

            // 创建前台交易服务对象
            var srv = new FrontPaySrv(param);

            HttpContext.Current.Response.ContentEncoding = srv.Charset; // 指定输出编码
            HttpContext.Current.Response.Write(srv.CreateHtml());
            HttpContext.Current.Response.End();
        }
示例#3
0
 /// <summary>
 /// 获得支付请求的Form表单
 /// </summary>
 /// <param name="order"></param>
 /// <returns></returns>
 public override string GetPaymentForm(PaymentOrder order)
 {
     throw new NotImplementedException();
 }
示例#4
0
 protected virtual void OnPayment(PaymentOrder order)
 {
     if (this.Payment != null)
     {
         this.Payment(order, null);
     }
 }
示例#5
0
 protected virtual void OnNotifyVerifyFaild(PaymentOrder order)
 {
     if (this.NotifyVerifyFaild != null)
     {
         this.NotifyVerifyFaild(order, null);
     }
 }
示例#6
0
 protected virtual void OnFinished(PaymentOrder order)
 {
     if (this.Finished != null)
     {
         this.Finished(order,null);
     }
 }
示例#7
0
 /// <summary>
 /// 发送支付请求到支付网关
 /// </summary>
 /// <param name="PaymentOrder">支付订单信息</param>
 /// <returns></returns>
 public abstract void SendRequest(PaymentOrder order);
示例#8
0
 /// <summary>
 /// 获得支付请求的Form表单
 /// </summary>
 /// <param name="order"></param>
 /// <returns></returns>
 public abstract string GetPaymentForm(PaymentOrder order);