Beispiel #1
0
 private static void calcMoney(Customer customerInfo, TransactionLog localItem)
 {
     if (localItem.isValid != 1) return;
     if (customerInfo.IsFengDing && null == customerInfo.fengding) throw new Exception("封顶机没配置封顶金额");
     decimal tixianfei = customerInfo.tixianfei.Value;
     if (true) tixianfei += customerInfo.tixianfeiEles.Value;//节假日多收手续费
     localItem.discountMoney = Math.Round(localItem.tradeMoney.Value * customerInfo.discount.Value * 0.01m, 2);
     if (!customerInfo.IsFengDing || localItem.discountMoney < customerInfo.fengding)
     {
         //pos ji
         localItem.discountMoney = Math.Round(localItem.tradeMoney.Value * customerInfo.discount.Value * 0.01m, 2);
         decimal totalSxf = Math.Round(localItem.tradeMoney.Value * (customerInfo.discount.Value + tixianfei) * 0.01m, 2);
         //t0
         localItem.tixianfeiMoney = totalSxf - localItem.discountMoney.Value;
     }
     else
     {
         //feng ding
         localItem.discountMoney = customerInfo.fengding;
         localItem.tixianfeiMoney = Math.Round(localItem.tradeMoney.Value * tixianfei * 0.01m, 2);
     }
     //代付手续费
     if (customerInfo.daifufei != null && customerInfo.daifufei.Value > 0)
     {
         localItem.tixianfeiMoney += customerInfo.daifufei.Value;
     }
     localItem.finallyMoney = localItem.tradeMoney.Value - localItem.discountMoney.Value - localItem.tixianfeiMoney.Value;
 }
Beispiel #2
0
 public TransactionLog[] ToTransactionArray()
 {
     if (rows == null) throw new Exception("JingKongResult.row is null");
     TransactionLog[] newItemList = new TransactionLog[rows.Count];
     for (int i = 0; i < newItemList.Length; i++)
     {
         newItemList[i] = rows[i].ToTransactionLog();
     }
     return newItemList;
 }
Beispiel #3
0
 public TransactionLog ToTransactionLog()
 {
     if (this.trname == null) this.trname = "";//会有空名字的交易,比如系统无法找到POS请求交易 message_type=0820
     if (this.amt == null) throw new ArgumentNullException("json row item value amt");
     if (this.amt == null) throw new ArgumentNullException("json row item value tdate");
     if (this.amt == null) throw new ArgumentNullException("json row item value stime");
     if (this.tid == null) throw new ArgumentNullException("json row item value tid");
     if (this.descr == null) throw new ArgumentNullException("json row item value descr");//descr: "20151010175846"
     if (this.descr.Length != 14) throw new ArgumentNullException("json row item value descr length is not 14");
     TransactionLog log = new TransactionLog();
     string dayStr = this.tdate;
     string timeStr = this.stime;
     //string minute = timeStr.Substring(2, 2);
     //if (minute.CompareTo("59") > 0) minute = "59";
     //string second = timeStr.Substring(4, 2);
     //if (second.CompareTo("59") > 0) second = "59";
     log.time = descr.Substring(0, 4) + '-' + descr.Substring(4, 2) + '-' + descr.Substring(6, 2) + " " + descr.Substring(8, 2) + ":" + descr.Substring(10, 2) + ":" + descr.Substring(12, 2);
     decimal money = Convert.ToDecimal(this.amt);
     log.isValid = 0;
     if (this.trname.IndexOf("冲正") > -1) { money = -1 * money; log.isValid = 1; }
     else if (this.trname == "消费") log.isValid = 1;
     if (this.rspcode != "00") log.isValid = 0;
     log.resultCode = this.rspcode;
     log.terminal = this.tid;
     log.tradeName = this.trname;
     log.tradeMoney = money;
     log.faren = this.lpName;
     log.results = this.rspmsg;
     log.timeStr = this.tdate + " " + this.stime;
     return log;
 }
Beispiel #4
0
        public TransactionLog ToTransactionLog()
        {
            if (this.trname == null)
            {
                this.trname = "";                     //会有空名字的交易,比如系统无法找到POS请求交易 message_type=0820
            }
            if (this.amt == null)
            {
                throw new ArgumentNullException("json row item value amt");
            }
            if (this.amt == null)
            {
                throw new ArgumentNullException("json row item value tdate");
            }
            if (this.amt == null)
            {
                throw new ArgumentNullException("json row item value stime");
            }
            if (this.tid == null)
            {
                throw new ArgumentNullException("json row item value tid");
            }
            if (this.descr == null)
            {
                throw new ArgumentNullException("json row item value descr");                    //descr: "20151010175846"
            }
            if (this.descr.Length != 14)
            {
                throw new ArgumentNullException("json row item value descr length is not 14");
            }
            TransactionLog log     = new TransactionLog();
            string         dayStr  = this.tdate;
            string         timeStr = this.stime;

            //string minute = timeStr.Substring(2, 2);
            //if (minute.CompareTo("59") > 0) minute = "59";
            //string second = timeStr.Substring(4, 2);
            //if (second.CompareTo("59") > 0) second = "59";
            log.time = descr.Substring(0, 4) + '-' + descr.Substring(4, 2) + '-' + descr.Substring(6, 2) + " " + descr.Substring(8, 2) + ":" + descr.Substring(10, 2) + ":" + descr.Substring(12, 2);
            decimal money = Convert.ToDecimal(this.amt);

            log.isValid = 0;
            if (this.trname.IndexOf("冲正") > -1)
            {
                money = -1 * money; log.isValid = 1;
            }
            else if (this.trname == "消费")
            {
                log.isValid = 1;
            }
            if (this.rspcode != "00")
            {
                log.isValid = 0;
            }
            log.resultCode = this.rspcode;
            log.terminal   = this.tid;
            log.tradeName  = this.trname;
            log.tradeMoney = money;
            log.faren      = this.lpName;
            log.results    = this.rspmsg;
            log.timeStr    = this.tdate + " " + this.stime;
            return(log);
        }