Example #1
0
        /// <summary>
        /// 条码支付操作
        /// </summary>
        /// <param name="posOrder"></param>
        /// <returns></returns>
        public Result <AlipayF2FPayResult> AlipayDsPosOrder(DBDsPosOrder posOrder)
        {
            Result <AlipayF2FPayResult> resultMod     = new Result <AlipayF2FPayResult>();
            IAlipayTradeService         serviceClient = F2FBiz.CreateClientInstance(Config.serverUrl, Config.appId, Config.merchant_private_key, Config.version,
                                                                                    Config.sign_type, Config.alipay_public_key, Config.charset);

            AlipayF2FPayResult payResult = serviceClient.tradePay(BuildPayContent(posOrder));

            switch (payResult.Status)
            {
            case ResultEnum.SUCCESS:
                DoSuccessProcess(payResult, ref resultMod);
                break;

            case ResultEnum.FAILED:
                DoFailedProcess(payResult, ref resultMod);
                break;

            case ResultEnum.UNKNOWN:
                resultMod.Status  = false;
                resultMod.Message = "网络异常,请检查网络配置后,更换外部订单号重试";
                resultMod.Data    = payResult;
                break;
            }

            return(resultMod);
            //Response.Redirect("result.aspx?Text=" + result);
        }
Example #2
0
        private AlipayTradePayContentBuilder BuildPayContent(DBDsPosOrder posOrder)
        {
            //扫码枪扫描到的用户手机钱包中的付款条码
            AlipayTradePayContentBuilder builder = new AlipayTradePayContentBuilder();

            builder.out_trade_no          = posOrder.SerialNumber;
            builder.scene                 = "bar_code";
            builder.auth_code             = posOrder.PayAuthCode;
            builder.total_amount          = (posOrder.TotalSellValue - posOrder.PointMoney).ToString("0.00");
            builder.discountable_amount   = "0";
            builder.undiscountable_amount = posOrder.TotalSellValue.ToString("0.00");
            builder.operator_id           = posOrder.Clerker;
            builder.subject               = "条码支付";
            builder.timeout_express       = "2m";
            builder.body      = "订单商品描述";
            builder.store_id  = posOrder.StoreName; //很重要的参数,可以用作之后的营销
            builder.seller_id = Config.pid;         //可以是具体的收款账号。

            //传入商品信息详情
            List <GoodsInfo> gList = new List <GoodsInfo>();

            foreach (DsPosOrderItem posItem in posOrder.items)
            {
                GoodsInfo goods = new GoodsInfo();
                goods.goods_id   = posItem.ProSysNo.ToString();
                goods.goods_name = posItem.ProName;
                goods.price      = posItem.ProTotalValue.ToString("0.00");
                goods.quantity   = posItem.ProNum.ToString();
                gList.Add(goods);
            }
            builder.goods_detail = gList;
            //扩展参数
            //系统商接入可以填此参数用作返佣
            //ExtendParams exParam = new ExtendParams();
            //exParam.sysServiceProviderId = "20880000000000";
            //builder.extendParams = exParam;

            return(builder);
        }