// // GET: /PaymentTypePercentageDiscountDetails/ public ActionResult PaymentTypePercentageCharge(long?contractId, long?serviceTypeId, int paymentTypeId, bool isEdit) { PaymentTypePercentageChargeViewModel modePaymentTypePercentageDiscountViewModel = new PaymentTypePercentageChargeViewModel(); if (isEdit) { PaymentTypePercentageCharge paymentTypePercentageDiscountForPost = new PaymentTypePercentageCharge { ServiceTypeId = serviceTypeId, ContractId = contractId, PaymentTypeId = paymentTypeId, UserName = GetCurrentUserName() }; //Get the Name of User logged in PaymentTypePercentageCharge paymentTypePercentageDiscountInfo = PostApiResponse <PaymentTypePercentageCharge>("PaymentTypePercentageCharge", "GetPaymentTypePercentageDiscount", paymentTypePercentageDiscountForPost); modePaymentTypePercentageDiscountViewModel = AutoMapper.Mapper.Map <PaymentTypePercentageCharge, PaymentTypePercentageChargeViewModel>(paymentTypePercentageDiscountInfo); } modePaymentTypePercentageDiscountViewModel.ContractId = contractId; modePaymentTypePercentageDiscountViewModel.ServiceTypeId = serviceTypeId; modePaymentTypePercentageDiscountViewModel.PaymentTypeId = paymentTypeId; modePaymentTypePercentageDiscountViewModel.IsEdit = isEdit; return(View(modePaymentTypePercentageDiscountViewModel)); }
/// <summary> /// Gets the payment type percentage. /// </summary> /// <param name="contractServiceTypeId">The contract service type identifier.</param> /// <param name="dtPercentageTable">The percentage table.</param> /// <returns></returns> public static PaymentTypePercentageCharge GetPaymentType(long contractServiceTypeId, DataTable dtPercentageTable) { PaymentTypePercentageCharge paymentTypePercentageCharge = null; if (dtPercentageTable != null && dtPercentageTable.Rows.Count > 0) { paymentTypePercentageCharge = (from DataRow row in dtPercentageTable.Rows where (row["contractServiceTypeId"] != DBNull.Value && Convert.ToInt64(row["contractServiceTypeId"]) == contractServiceTypeId) select new PaymentTypePercentageCharge { ContractId = DBNull.Value == row["ContractId"] ? (long?)null : Convert.ToInt64( row["ContractId"]), ServiceTypeId = DBNull.Value == row["ContractServiceTypeID"] ? (long?)null : Convert.ToInt64( row["ContractServiceTypeID"]), Percentage = Convert.ToDouble( row["Percentage"]), PaymentTypeDetailId = Convert.ToInt64(row["PaymentTypeDetailID"]), PaymentTypeId = (byte)Enums.PaymentTypeCodes.PercentageDiscountPayment }).FirstOrDefault(); } return(paymentTypePercentageCharge); }
/// <summary> /// Get Payment Type Percentage Discount Details /// </summary> /// <param name="paymentTypePercentageDiscount"></param> /// <returns></returns> public PaymentTypePercentageCharge GetPaymentTypePercentageDiscountDetails(PaymentTypePercentageCharge paymentTypePercentageDiscount) { // Initialize the Stored Procedure _cmd = _db.GetStoredProcCommand("GetServiceLinesandPaymentTypes"); // Pass parameters to Stored Procedure(i.e., @ParamName), add values for _db.AddInParameter(_cmd, "@PaymentTypeID ", DbType.Int64, paymentTypePercentageDiscount.PaymentTypeId); _db.AddInParameter(_cmd, "@ContractID", DbType.Int64, paymentTypePercentageDiscount.ContractId); _db.AddInParameter(_cmd, "@ContractServiceTypeID", DbType.Int64, paymentTypePercentageDiscount.ServiceTypeId); _db.AddInParameter(_cmd, "@ServiceLineTypeId", DbType.Int64, 0); _db.AddInParameter(_cmd, "@UserName", DbType.String, paymentTypePercentageDiscount.UserName); // Retrieve the results of the Stored Procedure in Data set DataSet paymentTypePercentageDiscountDataSet = _db.ExecuteDataSet(_cmd); if (paymentTypePercentageDiscountDataSet != null && paymentTypePercentageDiscountDataSet.Tables.Count > 0) { //populating PercentageDiscount data if (paymentTypePercentageDiscountDataSet.Tables[0].Rows != null && paymentTypePercentageDiscountDataSet.Tables[0] != null && paymentTypePercentageDiscountDataSet.Tables[0].Rows.Count > 0) { PaymentTypePercentageCharge paymentPercentageDiscount = new PaymentTypePercentageCharge { Percentage = Convert.ToDouble(paymentTypePercentageDiscountDataSet.Tables[0].Rows[0]["Percentage"]), PaymentTypeDetailId = Convert.ToInt64(paymentTypePercentageDiscountDataSet.Tables[0].Rows[0]["PaymentTypeDetailID"]), }; return(paymentPercentageDiscount); } } //returns response to Business layer return(null); }
public JsonResult AddEditPercentageDiscountDetails(PaymentTypePercentageChargeViewModel info) { PaymentTypePercentageCharge percentagePaymentInfo = AutoMapper.Mapper.Map <PaymentTypePercentageChargeViewModel, PaymentTypePercentageCharge>(info); //Get the Name of User logged in percentagePaymentInfo.UserName = GetCurrentUserName(); long percentageId = PostApiResponse <long>("PaymentTypePercentageCharge", "AddEditPaymentTypePercentageDiscount", percentagePaymentInfo); return(percentageId > 0 ? Json(new { sucess = true, Id = percentageId }) : Json(new { sucess = false })); }
public void AddNewPaymentTypePercentageDiscountIfNotNull() { var mockAddNewPaymentTypePercentageDiscount = new Mock <IPaymentTypePercentageChargeRepository>(); mockAddNewPaymentTypePercentageDiscount.Setup(f => f.AddEditPaymentTypePercentageDiscountDetails(It.IsAny <PaymentTypePercentageCharge>())).Returns(1); PaymentTypePercentageChargeLogic target = new PaymentTypePercentageChargeLogic(mockAddNewPaymentTypePercentageDiscount.Object); PaymentTypePercentageCharge objPaymentTypeStopLoss = new PaymentTypePercentageCharge { PaymentTypeDetailId = 1 }; long actual = target.AddEditPaymentType(objPaymentTypeStopLoss); Assert.AreEqual(1, actual); }
public void GetPaymentTypePercentageDiscountTestIfNull() { PaymentTypePercentageCharge result = new PaymentTypePercentageCharge(); var mockGetPaymentTypePercentageDiscount = new Mock <IPaymentTypePercentageChargeRepository>(); mockGetPaymentTypePercentageDiscount.Setup(f => f.GetPaymentTypePercentageDiscountDetails(null)).Returns(result); PaymentTypePercentageChargeLogic target = new PaymentTypePercentageChargeLogic(mockGetPaymentTypePercentageDiscount.Object); PaymentTypePercentageCharge actual = (PaymentTypePercentageCharge)target.GetPaymentType(null); Assert.AreEqual(result, actual); }
public void GetPaymentTypePercentageDiscountTestIfNotNull() { //Mock Input PaymentTypePercentageCharge objPaymentTypePercentageDiscount = new PaymentTypePercentageCharge { PaymentTypeId = 8, ContractId = 345, ServiceTypeId = null }; //Mock output PaymentTypePercentageCharge result = new PaymentTypePercentageCharge { Percentage = 43.56, PaymentTypeDetailId = 234 }; var mockGetPaymentTypePercentageDiscount = new Mock <IPaymentTypePercentageChargeRepository>(); mockGetPaymentTypePercentageDiscount.Setup(f => f.GetPaymentTypePercentageDiscountDetails(objPaymentTypePercentageDiscount)).Returns(result); PaymentTypePercentageChargeLogic target = new PaymentTypePercentageChargeLogic(mockGetPaymentTypePercentageDiscount.Object); PaymentTypePercentageCharge actual = (PaymentTypePercentageCharge)target.GetPaymentType(objPaymentTypePercentageDiscount); Assert.AreEqual(result, actual); }
/// <summary> /// Add & Edit Payment Type Percentage Discount Details /// </summary> /// <param name="paymentTypePercentageDiscount"></param> /// <returns></returns> public long AddEditPaymentTypePercentageDiscountDetails(PaymentTypePercentageCharge paymentTypePercentageDiscount) { //Checks if input request is not null if (paymentTypePercentageDiscount != null) { // Initialize the Stored Procedure _cmd = _db.GetStoredProcCommand("AddEditPercentageDiscountPayment"); // Pass parameters to Stored Procedure(i.e., @ParamName), add values for _db.AddInParameter(_cmd, "@PaymentTypeDetailID", DbType.Int64, paymentTypePercentageDiscount.PaymentTypeDetailId); _db.AddInParameter(_cmd, "@Percentage ", DbType.Decimal, paymentTypePercentageDiscount.Percentage); _db.AddInParameter(_cmd, "@PaymentTypeID ", DbType.Int64, paymentTypePercentageDiscount.PaymentTypeId); _db.AddInParameter(_cmd, "@ContractID", DbType.Int64, paymentTypePercentageDiscount.ContractId); _db.AddInParameter(_cmd, "@ContractServiceTypeID", DbType.Int64, paymentTypePercentageDiscount.ServiceTypeId); _db.AddInParameter(_cmd, "@UserName", DbType.String, paymentTypePercentageDiscount.UserName); // Retrieve the results of the Stored Procedure in Datatable return(long.Parse(_db.ExecuteScalar(_cmd).ToString())); } return(0); }
public void EvaluateAtLineLevelAmountIsNullTest() { List <PaymentResult> paymentResults = new List <PaymentResult> { new PaymentResult { ClaimId = 123, Line = 1, AdjudicatedValue = null, ServiceTypeId = 1, ContractId = 1 }, new PaymentResult { ClaimId = 123, Line = 2, AdjudicatedValue = null, ServiceTypeId = 1, ContractId = 1 }, }; PaymentTypePercentageCharge paymentTypePercentageCharge = new PaymentTypePercentageCharge { Percentage = 10, ValidLineIds = new List <int> { 1, 2, 3, 4, 5, 6 }, Conditions = new List <ICondition> { new Condition { ConditionOperator = (byte)Enums.ConditionOperation.EqualTo, LeftOperands = new List <string> { "300" }, OperandType = (byte)Enums.OperandIdentifier.HcpcsCode, RightOperand = "300" } }, ContractId = 1, HcpcsCode = "300", ServiceTypeId = 1 }; // Arrange var mockContractServiceTypeLogic = new Mock <IContractServiceTypeLogic>(); var mockPaymentResultLogic = new Mock <IPaymentResultLogic>(); mockPaymentResultLogic.Setup( x => x.Evaluate(It.IsAny <EvaluateableClaim>(), It.IsAny <List <PaymentResult> >(), It.IsAny <bool>(), It.IsAny <bool>())).Returns(paymentResults); Mock <IPaymentTypePercentageChargeRepository> paymentTypePercentageChargeRepository = new Mock <IPaymentTypePercentageChargeRepository>(); paymentTypePercentageChargeRepository.Setup(x => x.GetPaymentTypePercentageDiscountDetails(It.IsAny <PaymentTypePercentageCharge>())) .Returns(paymentTypePercentageCharge); var target = new PaymentTypePercentageChargeLogic(paymentTypePercentageChargeRepository.Object) { PaymentTypeBase = paymentTypePercentageCharge }; // _target.Contract = contract; IEvaluateableClaim evaluateableClaim = new EvaluateableClaim(); evaluateableClaim.ClaimId = 123; evaluateableClaim.ClaimTotal = 100; evaluateableClaim.ClaimCharges = new List <ClaimCharge> { new ClaimCharge { Line = 1, HcpcsCode = "300" }, new ClaimCharge { Line = 2, HcpcsCode = "301" }, new ClaimCharge { Line = 3, HcpcsCode = "302" }, new ClaimCharge { Line = 4, HcpcsCode = "303" }, new ClaimCharge { Line = 5, HcpcsCode = "304" }, new ClaimCharge { Line = 6, HcpcsCode = "305" } }; List <PaymentResult> updatedPaymentResults = new List <PaymentResult> { new PaymentResult { ClaimId = 123, ContractId = 1, AdjudicatedValue = 110 }, new PaymentResult { ClaimId = 123, Line = 1, ContractId = 1, AdjudicatedValue = 110 } }; Mock <ContractBaseLogic> mockContractBaseLogic = new Mock <ContractBaseLogic>(); mockContractServiceTypeLogic.Setup(x => x.IsValidServiceType()).Returns(true); mockContractServiceTypeLogic.Setup(x => x.Evaluate(evaluateableClaim, paymentResults, false, false)) .Returns(updatedPaymentResults); mockContractBaseLogic.SetupAllProperties(); //Act List <PaymentResult> actual = target.EvaluatePaymentType(evaluateableClaim, paymentResults, false, false); // Assert Assert.AreEqual(2, actual.Count); var firstOrDefault = paymentResults.FirstOrDefault(x => x.AdjudicatedValue != null); Assert.IsNull(firstOrDefault); }
public PaymentTypePercentageCharge GetPaymentTypePercentageDiscount(PaymentTypePercentageCharge paymentTypePercentageDiscount) { return((PaymentTypePercentageCharge)_paymentTypePercentageDiscountDetailsLogic.GetPaymentType(paymentTypePercentageDiscount)); }
public long AddEditPaymentTypePercentageDiscount(PaymentTypePercentageCharge paymentTypePercentageDiscount) { return(_paymentTypePercentageDiscountDetailsLogic.AddEditPaymentType(paymentTypePercentageDiscount)); }