Portfolio is a service made to support the creation of products in general, starting with loans in particular.  Currently loans and products are together in one module, but the intention is to separate them in order to make adding new product types a deployment problem rather than an upgrade problem.  As long as they remain together however, the documentation for them should remain together.

Portfolio

The domain of portfolio orients around three levels of abstraction:

Pattern

There is currently only one pattern: individual loans.  Patterns define the schedules and charges for a product.

Product

A product is an institution-wide configuration of a range of parameters available for a customer case.  The definition consists of a range of terms, a range of interest rates, and which accounts or ledgers to charge from and to.  Which tasks are involved in loan processing is defined at this level, and how expensive charges are for the various steps is too.

Case

For individual loans, a case is a loan that a customer has taken out.  The case includes the precise definition of the terms, and interest rates, and tracks which tasks have been completed, and what state the loan is in.

Individual Loans

Schedule calculation

Loan schedule calculation produces a list of the actions expected to be taken on a loan and the days on which they are expected to occur.  It is used to create the planned payments pages so that customers and employees can see what a payment schedule would look like for a theoretical loan.  If a loan hasn't yet been approved, schedule calculation assumes the current date as the start date, uses the maximum term length to determine the end date, and the configured payment cycle to determine when payments will occur.  Interest is accrued daily and then incurred when the payment is actually made.

Interest

Interest is accrued daily based on the amount currently owed by the customer.  In keeping with common practice in the United States, the interest rate provided for a customer case is the nominal interest rate.  The effective interest rate will be higher.  (When communicating about the loan, naming the effective interest rate is required in some countries. We've chosen to the nominal interest rate simply because it is easier to calculate from the nominal interest rate to the effective rate than it is in the other direction.) The nominal interest rate is divided by 365.25.  The resulting amount is then applied daily.  When in the day interest is accrued is configurable via the yaml file of the portfolio microservice.

Troubleshooting Deployment of Rhythm And Portfolio

If you aren't getting daily interest calculations in portfolio, please check the following aspects of  your deployment: 

  1. There should be only one instance of rhythm running.
  2. In the configuration for rhythm, rhythm.user should be set to a valid user in your system.  I'll pretend you named it imhotep from here on.
  3. In portfolio, portfolio.bookLateFeesAndInterestAsUser should be set to a valid user in your system.  I'll pretend you also named it imhotep from here on.
  4. Rhythm's user should have permission to the identity endpoint for creating permission requests for other services, and for the application which is to receive the beats. Its role should contain change permissions for identity__v1__app_self, and, for example, portfolio__v1__khepri
  5. Rhythm the application should have permission to act in the name of its user to access the identity endpoint for creating permission requests for other services. /applications/rhythm/permissions/identity__v1__app_self/users/imhotep/enabled should return true.
  6. Rhythm the application should have permission to act in the name of its user to call portfolio's beat endpoint. /applications/rhythm/permissions/portfolio__v1__khepri/users/imhotep/enabled should return true.
  7. Twenty-four beats should be provisioned for portfolio in rhythm.


  • No labels