public static decimal GetRestPenalty(this IPayableDocument payableDocument)
        {
            decimal fullAmountOfDebt = GetActualFullAmountOfDebt(payableDocument);
            decimal duty             = GetActualDuty(payableDocument);;
            decimal penalty          = GetActualPenalty(payableDocument);

            decimal paid = (duty + penalty) - fullAmountOfDebt;

            if ((paid - duty) >= penalty)
            {
                return(0);
            }

            return(penalty - (paid - duty));
        }
 private static decimal GetActualDuty(IPayableDocument payableDocument)
 {
     return(payableDocument.CorrectedAmountOfDuty != null ?
            payableDocument.CorrectedAmountOfDuty.Value :
            payableDocument.AmountOfDuty);
 }
 private static decimal GetActualFullAmountOfDebt(IPayableDocument payableDocument)
 {
     return payableDocument.FullAmountOfDebt != null ?
                   payableDocument.FullAmountOfDebt.Value :
                   0;
 }
 private static decimal GetActualFullAmountOfDebt(IPayableDocument payableDocument)
 {
     return(payableDocument.FullAmountOfDebt != null ?
            payableDocument.FullAmountOfDebt.Value :
            0);
 }
 private static decimal GetActualPenalty(IPayableDocument payableDocument)
 {
     return payableDocument.CorrectedAmountOfPenalty != null ?
                   payableDocument.CorrectedAmountOfPenalty.Value :
                   payableDocument.AmountOfPenalty;
 }