Testing with Migration Mode
Overview
In order to understand how to set up test cases in the system and enforce their behavior, you will need to think about an account lifecycle as a series of events that occur; starting with the moment they’re onboarded. Events can range from human activity — such as making a payment, to automatic activity — such as a due date passing by.
The Migration Mode testing framework involves:
- Enqueuing all of the events from your test case
- Running through the events in order
- Querying the outcome to make sure it is what you expect.
Why Use Migration Mode?
Normally, Canopy’s system processes events as soon as they happen. This creates challenges in simulating historical activity for an account.
For example, normally, if you are trying to set up the system with backdated payments after each month, as soon as you backdate the account by five months, the system will immediately assume you’ve been late for five straight payments and generate late fees.
To test without this risk, we use migration mode. Migration mode asks the system to wait until you’ve loaded in all of your historical activity before it starts to process it.
How To Use
The steps below will show you how to enable Migration Mode for a product, take a couple of example actions, and then turn Migration Mode back off.
1. Set the product in migration mode
PUT /products/{product_id}/migration_mode
{
"migration_mode": true
}
2. Onboard a borrower as normal
POST /customers
and POST /accounts
-- using the configs from above, with one difference.
For the account payload, backdate the `effective_at` for the account to the historical date of your simulation
3. Simulate repayment activity
POST /accounts/{account_id}/line_items/payments/payment_record
{
"line_item_id": "<some ID for the payment>",
"original_amount_cents": 3000, -- payment amount in cents
"line_item_status": "VALID",
"effective_at": "2020-07-20T09:11:28+00:00", -- date you expect the payment to occur
}
4. Turn migration mode back off, and wait 60 seconds
PUT /products/{product_id}/migration_mode
{
"migration_mode": false
}
5. Log into CanopyOS UAT and access the account
https://canopyservicing.com/app/accounts/<account_id>
Enterprise Customer?
If your SOW includes technical support, our team is very specialized in helping you set up test cases that ensure your loan behaves as expected.
API Reference:
Updated about 1 year ago