Recording payment into the servicing history of the loan

The following code demonstrates how to record a payment into the servicing history of the loan.

using System;
using System.IO;
using EllieMae.Encompass.Client;
using EllieMae.Encompass.BusinessObjects;
using EllieMae.Encompass.BusinessObjects.Loans;
using EllieMae.Encompass.BusinessObjects.Loans.Servicing;

class SampleApp
{
public static void Main(string[] args)
{
// Open the session to the remote server
Session session = new Session();
session.StartOffline(“mary”, “maryspwd”);

// Open the loan using the GUID specified on the command line
Loan loan = session.Loans.Open(args[0]);
loan.Lock();

// Add a new payment to the servicing history of the loan.
// The payment will be pre-populated with the data for the next scheduled payment.
Payment pmt = loan.Servicing.Transactions.AddPayment(DateTime.Now);

// Adjust the transaction amount to the amount actually received from the customer
// If this is more than the scheduled payment amount, the balanced will be applied
// as an additional principal payment. If it’s less, the portion of the
// payment allocated to principal will be reduced by the difference.
pmt.TransactionAmount = 2000;

// Display the portion allocated to each balance
Console.WriteLine(“Principal: ” + pmt.Principal);
Console.WriteLine(“Interest: ” + pmt.Interest);
Console.WriteLine(“Escrow: ” + pmt.Escrow);
Console.WriteLine(“Late Fee: ” + pmt.LateFee);
Console.WriteLine(“Addl Prin: ” + pmt.AdditionalPrincipal);
Console.WriteLine(“Addl Escr: ” + pmt.AdditionalEscrow);
Console.WriteLine(“Misc Fees: ” + pmt.MiscFee);

// Close the loan, releasing its resources
loan.Commit();
loan.Close();

// End the session to gracefully disconnect from the server
session.End();
}
}

You may also like...

Popular Posts

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.