public void orderInfo(ref GasOrderInfo orderinfo, PayParam p)
        {
            log.Write("发起订单:燃气卡号:" + card.CardNo + ",充值气量:" + card.rechargeNum);
            GasOrderParam gasOrderParam = new GasOrderParam();

            gasOrderParam.paymentno    = card.CardNo;
            gasOrderParam.chargeAmount = card.rechargeNum;
            gasOrderParam.paymentAmout = card.price;
            gasOrderParam.shopType     = PayAccess.isWtLkl(p.icParams);
            //发送燃气订单
            orderinfo = GasAccess.gasOrder(gasOrderParam);
            if ("9999".Equals(orderinfo.msgrsp.retcode))
            {
                return;
            }
            if ("1234".Equals(orderinfo.msgrsp.retcode))
            {
                return;
            }
            if ("11111".Equals(orderinfo.msgrsp.retcode))
            {
                return;
            }
            if (!"0000".Equals(orderinfo.msgrsp.retcode))
            {
                return;
            }
            //获取商户号
            p.MERCHANTNO_shopNo = orderinfo.msgrsp.MERCHANTNO;
            //获取终端号
            p.TERMINALNO_clientNo = orderinfo.msgrsp.TERMINALNO;
            //交易金额
            p.rechageAmount = orderinfo.msgrsp.realAmout;
            //交易订单号
            p.orderNo = orderinfo.msgrsp.orderNo;
            if (!orderinfo.msgrsp.retcode.Equals("0000"))
            {
                throw new Exception();
            }
            Payment.GasPayParam.GasOrderInfo = orderinfo;
        }
Ejemplo n.º 2
0
        /// <summary>
        /// 燃气卡提交订单接口
        /// </summary>
        /// <param name="param"></param>
        /// <returns></returns>
        public GasOrderInfo GasOrder(GasOrderParam param)
        {
            GasOrderInfo gasOrderInfo = null;
            Dictionary <String, String> parameters = new Dictionary <String, String>();

            parameters.Add("shopType", param.shopType);
            parameters.Add("servicename", "RQ002");
            parameters.Add("loginId", SysBLL.getCpuNo());
            parameters.Add("reqsn", SysBLL.getSerialNum());
            parameters.Add("authcode", SysBLL.Authcode);
            parameters.Add("trandateTime", SysBLL.getYYYYMMDDHHMMSSTime());
            parameters.Add("paymentno", param.paymentno);
            parameters.Add("chargeAmount", param.chargeAmount);
            parameters.Add("paymentAmout", param.paymentAmout);
            parameters.Add("terminalNo", ConfigurationManager.AppSettings["MechineNo"]);

            string jsonText = HttpHelper.getHttp(SysConfigHelper.readerNode("getOrderNoNewName"), parameters, null);

            //反序列化JSON字符串,将JSON字符串转换成LIST列表
            gasOrderInfo = JsonConvert.DeserializeObject <GasOrderInfo>(jsonText);
            return(gasOrderInfo);
        }
        public void pay()
        {
            log.Write("--------------------交易开始--------------------");
            log.Write("----------缴费类型:燃气");
            PayAccess payAccess = new PayAccess();
            PayParam  p         = new PayParam();
            Pay       pay       = new Pay();
            //订单结果
            GasOrderInfo orderinfo = null;

            //初始化参数
            payAccess.InitPayParam(ref p);
            PayBLL.payCode_terminalNo(ref p);
            try
            {
                //获取订单
                orderInfo(ref orderinfo, p);
                //获取订单结果处理
                if (pay.orderInfoResult(orderinfo.msgrsp.retcode, orderinfo.msgrsp.retshow) == false)
                {
                    return;
                }
                //支付
                if (pay.payResult(ref p))
                {
                    bool           isCarsWrite    = false;
                    WriteCardParam writeCardParam = new WriteCardParam();
                    writeCardParam.write_card_status = "3";
                    //金卡卡内充值
                    if (card.cardType == 1)
                    {
                        int rechageNum = Convert.ToInt32(card.rechargeNum) + card.GasValue;
                        if (jinCard.Recharge(card.CardNo, rechageNum))
                        {
                            isCarsWrite = true;
                            writeCardParam.write_card_status = "1";
                        }
                    }
                    //先锋卡内充值
                    if (card.cardType == 2)
                    {
                        int rechageNum = Convert.ToInt32(card.rechargeNum);
                        if (xf.Recharge(card.CardNo, rechageNum))
                        {
                            isCarsWrite = true;
                            writeCardParam.write_card_status = "1";
                        }
                    }
                    //写卡状态
                    writeCardParam.serviceType   = p.serviceType;
                    writeCardParam.rqFlushesCode = isCardTypeRq(card);
                    writeCardParam.shop_type     = PayAccess.isWtLkl(p.icParams);
                    writeCardParam.cloud_no      = orderinfo.msgrsp.orderNo;
                    writeCardParam.data          = pay.refundStr(p.payResultInfo, p);
                    payAccess.WriteCardAcc(writeCardParam);
                    if (isCarsWrite)
                    {
                        log.Write("--------------------交易结束--------------------");
                        Util.JumpUtil.jumpCommonPage("FormGasGoldenCardStep08_success");
                        return;
                    }
                    else
                    {
                        log.Write("error:燃气卡写卡失败");
                        exitRefund("缴费失败,退款成功");
                        return;
                    }
                }
                return;
            }
            catch (Exception ex) { log.Write("error:" + ex.Message); }
            exit("缴费失败,退款成功");
            return;
        }