private void ValidateJointAmountToPayExceedBillBalance(JointPayeePayment jointPayeePayment)
        {
            var billAmount = GetBillAmount(jointPayeePayment);

            if (jointPayeePayment.JointAmountToPay > billAmount)
            {
                var message = jointPayeePayment.IsPaymentByline()
                    ? JointCheckMessages.JointAmountToPayExceedsBillLineBalance
                    : JointCheckMessages.JointAmountToPayExceedsBillBalance;
                ShowErrorMessage <JointPayeePayment.jointAmountToPay>(jointPayeePayment, message, billAmount);
                ShowErrorOnPersistIfRequired(jointPayeePaymentCache, true);
            }
        }
        private void ValidateJointAmountToPayExceedJointBalance(JointPayeePayment jointPayeePayment)
        {
            var controlAmountToPay = GetControlAmountToPay(jointPayeePayment);

            if (jointPayeePayment.JointAmountToPay > controlAmountToPay)
            {
                var message = jointPayeePayment.IsPaymentByline()
                    ? JointCheckMessages.JointAmountToPayCannotExceedJointPayeeLineBalance
                    : JointCheckMessages.JointAmountToPayCannotExceedJointPayeeBalance;
                ShowErrorMessage <JointPayeePayment.jointAmountToPay>(jointPayeePayment, message);
                ShowErrorOnPersistIfRequired(jointPayeePaymentCache, true);
            }
        }
        private void ValidateJointPayeePaymentTotalAmountToPayExceedBillAmount(
            IEnumerable <JointPayeePayment> jointPayeePayments, JointPayeePayment jointPayeePayment)
        {
            var totalAmountToPayForBill = jointPayeePayments
                                          .Where(jpp => jpp.IsRelatedToSameInvoice(jointPayeePayment))
                                          .Sum(jpp => jpp.JointAmountToPay);
            var billAmount = GetBillAmount(jointPayeePayment);

            if (totalAmountToPayForBill > billAmount)
            {
                var message = jointPayeePayment.IsPaymentByline()
                    ? JointCheckMessages.TotalJointAmountToPayExceedsBillLineBalance
                    : JointCheckMessages.TotalJointAmountToPayExceedsBillBalance;
                ShowErrorMessage <JointPayeePayment.jointAmountToPay>(jointPayeePayment, message);
                ShowErrorOnPersistIfRequired(jointPayeePaymentCache, true);
            }
        }