public override List <PaymentResult> EvaluatePaymentType(IEvaluateableClaim claim,
                                                                 List <PaymentResult> paymentResults, bool isCarveOut, bool isContractFilter)
        {
            MedicareInPatientResult medicareInPatientResult = GetMedicareInPatientResult(claim);

            var claimPaymentResult = GetClaimLevelPaymentResult(paymentResults, isCarveOut);

            if (claimPaymentResult != null && medicareInPatientResult != null)
            {
                //Update PaymentResult and set matching ServiceTypeId,PaymentTypeDetailId & PaymentTypeId
                Utilities.UpdatePaymentResult(claimPaymentResult, PaymentTypeMedicareIp.ServiceTypeId,
                                              PaymentTypeMedicareIp.PaymentTypeDetailId, PaymentTypeMedicareIp.PaymentTypeId);

                if (medicareInPatientResult.IsSucess)
                {
                    if (PaymentTypeMedicareIp.InPatient.HasValue)
                    {
                        claimPaymentResult.AdjudicatedValue = (PaymentTypeMedicareIp.InPatient.Value / 100) *
                                                              medicareInPatientResult.TotalPaymentAmount;
                        claimPaymentResult.ClaimStatus = (byte)Enums.AdjudicationOrVarianceStatuses.Adjudicated;
                    }
                    else
                    {
                        claimPaymentResult.ClaimStatus =
                            (byte)Enums.AdjudicationOrVarianceStatuses.AdjudicationErrorInvalidPaymentData;
                    }
                }
                else
                {
                    claimPaymentResult.ClaimStatus = (byte)Enums.AdjudicationOrVarianceStatuses.ClaimDataError;
                }
            }

            return(paymentResults);
        }
        private MedicareInPatientResult GetMedicareInPatientResult(IEvaluateableClaim claim)
        {
            MedicareInPatientResult medicareInPatientResult = new MedicareInPatientResult();
            MedicareInPatient       medicarePatient         = claim.MedicareInPatient;

            _pricerDll = new NetPrcM5
            {
                Provider = medicarePatient.Npi,
                DDate    = medicarePatient.DischargeDate.ToString(CultureInfo.InvariantCulture),
                DRG      = medicarePatient.Drg,
                DStat    = medicarePatient.DischargeStatus
            };
            _pricerDll.ReviewCode = _pricerDll.DStat;
            _pricerDll.LOS        = medicarePatient.LengthOfStay;
            _pricerDll.Charges    = medicarePatient.Charges;

            //A string of diagnosis codes formatted as 7-Byte values.
            //Each code is left justified and blank filled to a length of 7 bytes.
            //Any decimal point in the diagnosis code should be removed before passing the code to PRICERActive.
            _pricerDll.DiagnosisCodes = GetDiagnosisCodeString(claim.DiagnosisCodes, claim.StatementThru);

            //A string of procedure codes formatted as 7-Byte values.
            //Each code is left justified and blank filled to a length of 7 bytes.
            //Any decimal point in the procedure code should be removed before passing the code to PRICERActive.
            _pricerDll.ProcedureCodes = GetProcedureCodeString(claim.ProcedureCodes, claim.StatementThru);

            //If statementThru Date is equal to or greater than 10/01/2015, then we pass "0" as ICDVersion10 else "9" as ICDVersion 9
            _pricerDll.ICDVersion              = claim.StatementThru >= DateTime.Parse(Constants.IcdVersionDate, CultureInfo.InvariantCulture) ? Constants.IcdVersion10 : Constants.IcdVersion9;
            _pricerDll.DeviceCreditAmount      = Constants.DeviceCreditAmount;      // 0; // Source unknown.
            _pricerDll.DIFICIDOnClaim          = Constants.DificidOnClaim;          // false;
            _pricerDll.HMOClaim                = Constants.HmoClaim;                // false;
            _pricerDll.IncludePassthru         = Constants.IncludePassthru;         //false;
            _pricerDll.AllowTerminatedProvider = Constants.AllowTerminatedProvider; // false;
            _pricerDll.AdjustmentFactor        = Constants.AdjustmentFactor;        // 1;
            _pricerDll.AdjustmentOption        = Constants.AdjustmentOption;        // 0;

            if (GlobalConfigVariable.IsMicrodynLogEnabled)
            {
                XmlSerializer xsSubmit = new XmlSerializer(typeof(NetPrcM5));
                StringWriter  sww      = new StringWriter();
                XmlWriter     writer   = XmlWriter.Create(sww);
                xsSubmit.Serialize(writer, _pricerDll);
                var xml = sww.ToString();

                Log.LogInfo("MedicareInPatient Input : \n" + xml, "MicrodynPriceInputData");
            }

            if (GlobalConfigVariable.IsMicrodynEnabled)
            {
                _pricerDll.PRICERCalc();
                string message = string.Empty;
                medicareInPatientResult.TotalPaymentAmount = _pricerDll.PRICERSuccess ? GetTotalAmount(_pricerDll) : 0.00;
                medicareInPatientResult.IsSucess           = _pricerDll.PRICERSuccess;
                message = GetPricerReturnValue(_pricerDll.ReturnCode, message, _pricerDll.PRICERSuccess);
                medicareInPatientResult.ClaimId    = claim.ClaimId;
                medicareInPatientResult.ReturnCode = _pricerDll.ReturnCode;
                medicareInPatientResult.Message    = message;

                if (GlobalConfigVariable.IsMicrodynLogEnabled)
                {
                    Log.LogInfo(
                        string.Format(CultureInfo.InvariantCulture, Constants.MedicareIpClaimIdLog, medicareInPatientResult.Message,
                                      medicareInPatientResult.ClaimId), Constants.MicrodynInPatientMessage);
                }
            }
            else
            {
                medicareInPatientResult.ReturnCode         = 0;
                medicareInPatientResult.TotalPaymentAmount = 0;
                medicareInPatientResult.Message            = Constants.MessageMicrodyneOff;
                medicareInPatientResult.IsSucess           = true;
            }
            //After processing, destroy the Reimbursement DLL object
            _pricerDll.Dispose();

            return(medicareInPatientResult);
        }