Ejemplo n.º 1
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="payValue"></param>
        /// <returns></returns>
        public PayValue SignVerify(PayValue payValue)
        {
            PayValue   returnValue = new PayValue();
            EpayNotify notify      = new EpayNotify();

            returnValue.HasError     = !notify.Verify((SortedDictionary <string, string>)payValue.ReturnObject, payValue.ReturnString);
            returnValue.ReturnString = "";
            return(returnValue);
        }
Ejemplo n.º 2
0
        public string GetColumn(int index, ExportColumnType type)
        {
            bool   isHeader = type == ExportColumnType.ColumnHeader;
            string text     = "";

            switch (index)
            {
            case (int)ColumnIndex.COLUMN_PAY_MODE: text = isHeader ? "支付方式" : PayType; break;

            case (int)ColumnIndex.COLUMN_SALE_TIMES: text = isHeader ? "支付次数" : Num.ToString(); break;

            case (int)ColumnIndex.COLUMN_SALE_MONEY: text = isHeader ? "支付金额" : PayValue.ToString(); break;

            case (int)ColumnIndex.COLUMN_RETURN_TIMES: text = isHeader ? "退货次数" : ReturnNum.ToString(); break;

            case (int)ColumnIndex.COLUMN_RETURN_MONEY: text = isHeader ? "退货金额" : ReturnValue.ToString(); break;

            case (int)ColumnIndex.COLUMN_NET_INCOME: text = isHeader ? "合计金额" : Amount.ToString(); break;
            }
            return(text);
        }
Ejemplo n.º 3
0
        public PayValue OrderPay(PayValue payValue)
        {
            PayValue      returnValue   = new PayValue();
            PayOrderModel payOrderModel = (PayOrderModel)payValue.ReturnObject;

            //备注
            byte[] bytes       = System.Text.Encoding.Default.GetBytes(payOrderModel.Note);
            string base64_memo = Convert.ToBase64String(bytes);

            StringBuilder sb = new StringBuilder();

            sb.Append("user_id=");
            sb.Append(payOrderModel.Userid);
            sb.Append("&user_name=");
            sb.Append(payOrderModel.Receiver);
            sb.Append("&user_cert_type=");
            if (payOrderModel.PassPortType == 1)
            {
                sb.Append("00");
            }
            else if (payOrderModel.PassPortType == 2)
            {
                sb.Append("02");
            }
            else
            {
                sb.Append("99");
            }
            sb.Append("&user_cert_no=");
            sb.Append(payOrderModel.PassPortNum);
            sb.Append("&user_mobile=");
            sb.Append(payOrderModel.Phone);

            byte[] userInfobytes  = System.Text.Encoding.Default.GetBytes(sb.ToString());
            String userInfoBase64 = Convert.ToBase64String(userInfobytes);

            //设置支付请求参数
            SortedDictionary <string, string> sParaTemp = new SortedDictionary <string, string>();

            sParaTemp.Add("out_trade_no", payOrderModel.OrderId);                  //商家订单号
            sParaTemp.Add("total_fee", payOrderModel.Totalfee.ToString("f2"));     //商品金额,以元为单位
            sParaTemp.Add("return_url", ConfigHelper.EReturnUrl);                  //交易完成后跳转的URL
            sParaTemp.Add("notify_url", ConfigHelper.ENotifyUrl);                  //接收后台通知的URL
            sParaTemp.Add("currency_type", payOrderModel.PayCurrencys.ToString()); //货币种类
            sParaTemp.Add("order_create_ip", payOrderModel.Createip);              //创建订单的客户端IP(消费者电脑公网IP,用于防钓鱼支付)
            sParaTemp.Add("sign_type", ConfigHelper.ESignType);                    //签名算法(暂时只支持SHA256)
            sParaTemp.Add("store_oi_type", StringUtils.ToInt(payOrderModel.Storeoitype, 1).ToString());

            sParaTemp.Add("goods_amount", payOrderModel.OrderGoodsAmount.ToString("f2")); //支付货款
            sParaTemp.Add("goods_amount_curr", payOrderModel.PayCurrencys.ToString());    //货币种类
            sParaTemp.Add("tax_amount", payOrderModel.OrderTaxAmount.ToString("f2"));     //支付税款
            sParaTemp.Add("tax_amount_curr", payOrderModel.PayCurrencys.ToString());      //货币种类
            sParaTemp.Add("freight", payOrderModel.OrderFreight.ToString("f2"));          //支付运费
            sParaTemp.Add("freight_curr", payOrderModel.PayCurrencys.ToString());         //货币种类
            sParaTemp.Add("submission_type", "01");
            sParaTemp.Add("base64_user_info", userInfoBase64);                            //用户信息
            sParaTemp.Add("pay_id", payOrderModel.PayId);
            //可选参数
            sParaTemp.Add("base64_memo", base64_memo);          //订单备注的BASE64编码

            //建立请求
            string sHtmlText = Submit.BuildRequestUrl(sParaTemp);

            returnValue.HasError     = false;
            returnValue.ReturnString = sHtmlText;
            return(returnValue);
        }