Beispiel #1
0
        /// <summary>
        /// 计算费率
        /// </summary>
        /// <param name="totalAmount">金额(元)</param>
        /// <param name="rate">费率%</param>
        /// <returns></returns>
        public static decimal CalcFee(decimal totalAmount, MerchantChannelModel merchObj)
        {
            var     svc              = new CommonPayService();
            var     payChannelObj    = svc.GetPayChannelDetail(merchObj);
            var     monthTotalAmt    = svc.GetMonthTotalTradeAmt(DateTime.Now, merchObj.MchId);
            decimal rst              = payChannelObj.SingleServFeeLowLimit;
            var     curMonthTotalAmt = monthTotalAmt + totalAmount;

            if (curMonthTotalAmt > payChannelObj.MonthFreeTradeAmount)
            { //计算费率
                var freeAmt = totalAmount;
                if (monthTotalAmt < payChannelObj.MonthFreeTradeAmount)
                {
                    freeAmt = curMonthTotalAmt - payChannelObj.MonthFreeTradeAmount;
                }
                if (freeAmt > 0)
                {
                    decimal per = 0.01m;
                    rst = freeAmt * payChannelObj.OverServiceRate * per;
                    if (rst < payChannelObj.SingleServFeeLowLimit)
                    {
                        rst = payChannelObj.SingleServFeeLowLimit;
                    }
                    if (rst > payChannelObj.SingleServFeeUpLimit)
                    {
                        rst = payChannelObj.SingleServFeeUpLimit;
                    }
                    return(rst);
                }
                return(rst);
            }
            return(rst);
        }
Beispiel #2
0
        /// <summary>
        /// 获取对应表最大编号
        /// </summary>
        /// <param name="tbName"></param>
        /// <param name="fieldName"></param>
        /// <returns></returns>
        public static int GetMaxNo(string tbName, string fieldName)
        {
            var svc = new CommonPayService();

            return(svc.GetMaxNo(tbName, fieldName));
        }