/// <summary> /// 檢查超商代收項目 /// </summary> /// <param name="payEndDate"></param> /// <param name="customer"></param> /// <returns></returns> private static void CheckCollectionTypeId(SysMessageLog message, ApplicationDbContext dataAccess, BillModel bill) { if (bill.BizCustomer.MarketEnable) { if (bill.CollectionTypeId.IsNullOrEmpty()) { message.AddCustErrorMessage(MessageCode.Code0001, ResxManage.GetDescription <BillModel>(p => p.CollectionTypeId)); } else { if (!bill.BizCustomer.CollectionTypeIds.Split(',').Contains(bill.CollectionTypeId)) { message.AddCustErrorMessage(MessageCode.Code1015, bill.CollectionTypeId); } else { CollectionTypeDetailModel colDet = dataAccess.Set <CollectionTypeDetailModel>().FirstOrDefault(p => p.CollectionTypeId.Equals(bill.CollectionTypeId) && p.SRange <= bill.PayAmount && p.ERange >= bill.PayAmount); if (null == colDet) { message.AddCustErrorMessage(MessageCode.Code1016, bill.CollectionTypeId); } } } } }
/// <summary> /// 設置費用 /// </summary> private static void SetFee(ReceiptBillModel receiptBill, BizCustomerSet bizCustomerSet, CollectionTypeSet collectionTypeSet) { CollectionTypeDetailModel collectionTypeDetailModel = collectionTypeSet.CollectionTypeDetail.FirstOrDefault(p => p.ChannelId.Equals(receiptBill.ChannelId) && (p.SRange <= receiptBill.PayAmount && p.ERange >= receiptBill.PayAmount)); BizCustomerFeeDetailModel bizCustomerFeeDetailModel = bizCustomerSet.BizCustomerFeeDetail.FirstOrDefault(p => p.ChannelGroupType.Equals(receiptBill.Channel.ChannelGroupType)); BizCustomerFeeDetailModel hiTrust = bizCustomerSet.BizCustomerFeeDetail.FirstOrDefault(p => p.BankFeeType.Equals(BankFeeType.Hitrust_ClearFee_CurMonth) || p.BankFeeType.Equals(BankFeeType.Hitrust_ClearFee_NextMonth)); receiptBill.ChargePayType = collectionTypeSet.CollectionType.ChargePayType; receiptBill.BankFeeType = bizCustomerFeeDetailModel.BankFeeType; if (receiptBill.BankFeeType.Equals(BankFeeType.TotalFee)) { switch (receiptBill.CollectionType.ChargePayType) { case ChargePayType.Deduction: { receiptBill.ThirdFee = FeeDeduct(bizCustomerFeeDetailModel.Fee, collectionTypeDetailModel.ChannelTotalFee, bizCustomerFeeDetailModel.IntroPercent); receiptBill.BankFee = bizCustomerFeeDetailModel.Fee - receiptBill.ThirdFee; } break; case ChargePayType.Increase: { receiptBill.ThirdFee = FeePlus(bizCustomerFeeDetailModel.Fee, bizCustomerFeeDetailModel.IntroPercent); receiptBill.BankFee = bizCustomerFeeDetailModel.Fee - receiptBill.ThirdFee; } break; } } else { receiptBill.BankFee = bizCustomerFeeDetailModel.Fee; receiptBill.ThirdFee = 0m; } receiptBill.ThirdFee = null != hiTrust ? hiTrust.IntroPercent : receiptBill.ThirdFee; receiptBill.ChannelFeedBackFee = collectionTypeDetailModel.ChannelFeedBackFee; receiptBill.ChannelRebateFee = collectionTypeDetailModel.ChannelRebateFee; receiptBill.ChannelFee = collectionTypeDetailModel.ChannelFee; receiptBill.ChannelTotalFee = collectionTypeDetailModel.ChannelTotalFee; receiptBill.TotalFee = receiptBill.BankFeeType.Equals(BankFeeType.TotalFee) ? bizCustomerFeeDetailModel.Fee : collectionTypeDetailModel.ChannelTotalFee; }