code: function isLoanPastDue(loan) {
      var d = Q.defer();
      var paid = 0;
      var earned = 0;
      var date;
      if (!loan || !loan.amortizationTable || !loan.transactions || !loan.dateLastPaymentShouldHaveBeenMade) {
        d.reject('required isLoanPastDue parameters not provided')
      } else {
        var dateLastPaymentShouldHaveBeenMade = moment(loan.dateLastPaymentShouldHaveBeenMade);
        loan.transactions.forEach(function (tx) {
          paid += Number(tx.amount);
        });
        loan.amortizationTable.forEach(function (pmt) {
          date = moment(pmt.date);
          if (date.isBefore(dateLastPaymentShouldHaveBeenMade)) earned += Number(pmt.payment);
        });
        loan.pastDue = paid < earned;
        d.resolve(loan);
      }
      return d.promise;
    }
docs: isLoanPastDue
  @param loan
  - amortizationTable - an array of transactions
  - transactions - a list of payment transactions
  - dateLastPaymentShouldHaveBeenMade - obvious
  - dateLastPaymentWasReceived - obvious
  @returns {promise|Q.promise}
  compares amount of payments that have been received against those that
  should have been received.