/// <summary> /// Get Payment Type PerCase /// </summary> /// <param name="paymentTypePerCase"></param> /// <returns></returns> public PaymentTypePerCase GetPaymentTypePerCase(PaymentTypePerCase paymentTypePerCase) { // 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, paymentTypePerCase.PaymentTypeId); _db.AddInParameter(_cmd, "@ContractID", DbType.Int64, paymentTypePerCase.ContractId); _db.AddInParameter(_cmd, "@ContractServiceTypeID", DbType.Int64, paymentTypePerCase.ServiceTypeId); _db.AddInParameter(_cmd, "@ServiceLineTypeId", DbType.Int64, 0); _db.AddInParameter(_cmd, "@UserName", DbType.String, paymentTypePerCase.UserName); // Retrieve the results of the Stored Procedure in Datatable DataSet paymentTypePerCaseDataSet = _db.ExecuteDataSet(_cmd); if (paymentTypePerCaseDataSet != null && paymentTypePerCaseDataSet.Tables.Count > 0) { //populating ContractBasicInfo data if (paymentTypePerCaseDataSet.Tables[0].Rows != null && paymentTypePerCaseDataSet.Tables[0] != null && paymentTypePerCaseDataSet.Tables[0].Rows.Count > 0) { PaymentTypePerCase paymentPerCase = new PaymentTypePerCase { Rate = Convert.ToDouble(paymentTypePerCaseDataSet.Tables[0].Rows[0]["Rate"]), PaymentTypeDetailId = Convert.ToInt64(paymentTypePerCaseDataSet.Tables[0].Rows[0]["PaymentTypeDetailID"]), MaxCasesPerDay = DBNull.Value == paymentTypePerCaseDataSet.Tables[0].Rows[0]["MaxCasesPerDay"] ? (int?)null : Convert.ToInt32(paymentTypePerCaseDataSet.Tables[0].Rows[0]["MaxCasesPerDay"]) }; return(paymentPerCase); } } //returns response to Business layer return(null); }
// // GET: /PaymentTypePerCaseDetails/ public ActionResult PaymentTypePerCase(long?contractId, long?serviceTypeId, int paymentTypeId, bool isEdit) { PaymentTypePerCaseViewModel modelPaymentTypePerCaseViewModel = new PaymentTypePerCaseViewModel(); if (isEdit) { PaymentTypePerCase paymentTypePerCaseForPost = new PaymentTypePerCase { ServiceTypeId = serviceTypeId, ContractId = contractId, PaymentTypeId = paymentTypeId, UserName = GetCurrentUserName() }; //Get the Name of User logged in PaymentTypePerCase paymentTypePerCaseViewModelInfo = PostApiResponse <PaymentTypePerCase>("PaymentTypePerCase", "GetPaymentPerCaseDetails", paymentTypePerCaseForPost); modelPaymentTypePerCaseViewModel = AutoMapper.Mapper.Map <PaymentTypePerCase, PaymentTypePerCaseViewModel>(paymentTypePerCaseViewModelInfo); } modelPaymentTypePerCaseViewModel.ContractId = contractId; modelPaymentTypePerCaseViewModel.ServiceTypeId = serviceTypeId; modelPaymentTypePerCaseViewModel.PaymentTypeId = paymentTypeId; modelPaymentTypePerCaseViewModel.IsEdit = isEdit; return(View(modelPaymentTypePerCaseViewModel)); }
public JsonResult AddEditPaymentPerCase(PaymentTypePerCaseViewModel info) { PaymentTypePerCase perCasePaymentInfo = AutoMapper.Mapper.Map <PaymentTypePerCaseViewModel, PaymentTypePerCase>(info); //Get the Name of User logged in perCasePaymentInfo.UserName = GetCurrentUserName(); long perCaseId = PostApiResponse <long>("PaymentTypePerCase", "AddEditPaymentPerCaseDetails", perCasePaymentInfo); return(perCaseId > 0 ? Json(new { sucess = true, Id = perCaseId }) : Json(new { sucess = false })); }
public void GetPaymentPerCaseDetailsMockTestIfNull() { PaymentTypePerCase result = new PaymentTypePerCase(); _mockPaymentTypePerCaseRepository = new Mock <IPaymentTypePerCaseRepository>(); _mockPaymentTypePerCaseRepository.Setup(f => f.GetPaymentTypePerCase(It.IsAny <PaymentTypePerCase>())).Returns(result); _target = new PaymentTypePerCaseLogic(_mockPaymentTypePerCaseRepository.Object); PaymentTypePerCase actual = (PaymentTypePerCase)_target.GetPaymentType(null); Assert.AreEqual(result, actual); }
public void EditPaymentTypePerCaseIfNotNull() { _mockPaymentTypePerCaseRepository = new Mock <IPaymentTypePerCaseRepository>(); _mockPaymentTypePerCaseRepository.Setup(f => f.AddEditPaymentTypePerCase(It.IsAny <PaymentTypePerCase>())).Returns(1); _target = new PaymentTypePerCaseLogic(_mockPaymentTypePerCaseRepository.Object); PaymentTypePerCase objPaymentTypePerCase = new PaymentTypePerCase { PaymentTypeDetailId = 1 }; long actual = _target.AddEditPaymentType(objPaymentTypePerCase); Assert.AreEqual(1, actual); }
/// <summary> /// Gets the payment type per case. /// </summary> /// <param name="contractServiceTypeId">The contract service type identifier.</param> /// <param name="dtPerCaseTable">The dt per case table.</param> /// <param name="serviceTypeConditions">The servicetype conditions.</param> /// <returns></returns> public static PaymentTypePerCase GetPaymentType(long contractServiceTypeId, DataTable dtPerCaseTable, List <ICondition> serviceTypeConditions) { PaymentTypePerCase paymentTypePerCase = null; if (dtPerCaseTable != null && dtPerCaseTable.Rows.Count > 0) { paymentTypePerCase = (from DataRow row in dtPerCaseTable.Rows where (row["contractServiceTypeId"] != DBNull.Value && Convert.ToInt64(row["contractServiceTypeId"]) == contractServiceTypeId) select new PaymentTypePerCase { Rate = Convert.ToDouble( row["Rate"]), ContractId = DBNull.Value == row["ContractId"] ? (long?)null : Convert.ToInt64( row["ContractId"]), ServiceTypeId = DBNull.Value == row["ContractServiceTypeID"] ? (long?)null : Convert.ToInt64( row["ContractServiceTypeID"]), MaxCasesPerDay = DBNull.Value == row["MaxCasesPerDay"] ? (int?)null : Convert.ToInt32( row["MaxCasesPerDay"]), PaymentTypeDetailId = Convert.ToInt64(row["PaymentTypeDetailID"]), PaymentTypeId = (byte)Enums.PaymentTypeCodes.PerCase }).FirstOrDefault(); if (serviceTypeConditions != null && paymentTypePerCase != null) { var revCodeCondition = serviceTypeConditions.FirstOrDefault( q => q.OperandIdentifier == (byte)Enums.OperandIdentifier.RevCode); if (revCodeCondition != null) { paymentTypePerCase.RevCode = revCodeCondition.RightOperand; } var cptCodeCondition = serviceTypeConditions.FirstOrDefault( q => q.OperandIdentifier == (byte)Enums.OperandIdentifier.HcpcsCode); if (cptCodeCondition != null) { paymentTypePerCase.HcpcsCode = cptCodeCondition.RightOperand; } } } return(paymentTypePerCase); }
public void GetPaymentPerCaseDetailsMockTestIfNotNull() { PaymentTypePerCase objPaymentTypePerCase = new PaymentTypePerCase { PaymentTypeId = 6, ContractId = 890, ServiceTypeId = null }; PaymentTypePerCase result = new PaymentTypePerCase { Rate = 234, PaymentTypeDetailId = 678 }; _mockPaymentTypePerCaseRepository = new Mock <IPaymentTypePerCaseRepository>(); _mockPaymentTypePerCaseRepository.Setup(f => f.GetPaymentTypePerCase(objPaymentTypePerCase)).Returns(result); _target = new PaymentTypePerCaseLogic(_mockPaymentTypePerCaseRepository.Object); PaymentTypePerCase actual = (PaymentTypePerCase)_target.GetPaymentType(objPaymentTypePerCase); Assert.AreEqual(result, actual); }
/// <summary> /// Add and edit payment type per case. /// </summary> /// <param name="paymentTypePerCase">The payment type per case.</param> /// <returns></returns> public long AddEditPaymentTypePerCase(PaymentTypePerCase paymentTypePerCase) { //Checks if input request is not null if (paymentTypePerCase != null) { // Initialize the Stored Procedure _cmd = _db.GetStoredProcCommand("AddEditPerCasePayment"); // Pass parameters to Stored Procedure(i.e., @ParamName), add values for _db.AddInParameter(_cmd, "@PaymentTypeDetailID", DbType.Int64, paymentTypePerCase.PaymentTypeDetailId); _db.AddInParameter(_cmd, "@Rate", DbType.Decimal, paymentTypePerCase.Rate); _db.AddInParameter(_cmd, "@PaymentTypeID", DbType.Int64, paymentTypePerCase.PaymentTypeId); _db.AddInParameter(_cmd, "@ContractID", DbType.Int64, paymentTypePerCase.ContractId); _db.AddInParameter(_cmd, "@ContractServiceTypeID", DbType.Int64, paymentTypePerCase.ServiceTypeId); _db.AddInParameter(_cmd, "@MaxCasesPerDay", DbType.Int32, paymentTypePerCase.MaxCasesPerDay); _db.AddInParameter(_cmd, "@UserName", DbType.String, paymentTypePerCase.UserName); // Retrieve the results of the Stored Procedure in Datatable return(long.Parse(_db.ExecuteScalar(_cmd).ToString())); } return(0); }
public PaymentTypePerCase GetPaymentPerCaseDetails(PaymentTypePerCase paymentTypePerCase) { return((PaymentTypePerCase)_paymentTypePerCaseDetailsLogic.GetPaymentType(paymentTypePerCase)); }
public long AddEditPaymentPerCaseDetails(PaymentTypePerCase paymentTypePerCase) { return(_paymentTypePerCaseDetailsLogic.AddEditPaymentType(paymentTypePerCase)); }
public void EvaluatePaymentTypePayAtClaimLevel() { List <PaymentResult> paymentResults = new List <PaymentResult> { new PaymentResult { ClaimId = 123, ServiceTypeId = 1 }, new PaymentResult { ClaimId = 123, Line = 1, ServiceTypeId = 1 } }; PaymentTypePerCase paymentTypePerCase = new PaymentTypePerCase { PayAtClaimLevel = true, Conditions = new List <ICondition> { new Condition { ConditionOperator = (byte)Enums.ConditionOperation.EqualTo, LeftOperands = new List <string> { "ABCDE" }, OperandType = (byte)Enums.OperandIdentifier.HcpcsCode, RightOperand = "ABCDE" } }, ServiceTypeId = 1, ValidLineIds = new List <int> { 1 }, HcpcsCode = "ABCDE", MaxCasesPerDay = 1, Rate = 10 }; // Arrange _mockContractServiceTypeLogic = new Mock <IContractServiceTypeLogic>(); _mockPaymentResultLogic = new Mock <IPaymentResultLogic>(); _mockPaymentResultLogic.Setup( x => x.Evaluate(It.IsAny <EvaluateableClaim>(), It.IsAny <List <PaymentResult> >(), It.IsAny <bool>(), It.IsAny <bool>())).Returns(paymentResults); _mockPaymentTypePerCaseRepository = new Mock <IPaymentTypePerCaseRepository>(); _mockPaymentTypePerCaseRepository.Setup(x => x.GetPaymentTypePerCase(It.IsAny <PaymentTypePerCase>())) .Returns(paymentTypePerCase); _target = new PaymentTypePerCaseLogic(_mockPaymentTypePerCaseRepository.Object) { PaymentTypeBase = paymentTypePerCase }; // _target.Contract = contract; IEvaluateableClaim evaluateableClaim = new EvaluateableClaim(); evaluateableClaim.ClaimId = 123; evaluateableClaim.ClaimTotal = 100; evaluateableClaim.ClaimCharges = new List <ClaimCharge> { new ClaimCharge { Line = 1, Amount = 20, RevCode = "250", HcpcsCode = "ABCDE", Units = 2 } }; List <PaymentResult> updatedPaymentResults = new List <PaymentResult> { new PaymentResult { ClaimId = 123, ContractId = 1, AdjudicatedValue = 110 }, new PaymentResult { ClaimId = 123, Line = 1, ContractId = 1, AdjudicatedValue = 110 } }; _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(3, actual.Count); var firstOrDefault = paymentResults.FirstOrDefault(x => x.AdjudicatedValue != null); if (firstOrDefault != null) { Assert.AreEqual(10, firstOrDefault.AdjudicatedValue); } }