Testing with Migration Mode

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:
  1. Enqueuing all of the events from your test case
  1. Running through the events in order
  1. Querying the outcome to make sure it is what you expect.
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.
Set the product in migration mode
PUT /products/{product_id}/migration_mode
{ "migration_mode": true }
Onboard a borrower as normal
POST /customers
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
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 }
Turn migration mode back off, and wait 60 seconds
PUT /products/{product_id}/migration_mode
{ "migration_mode": false }
Log into CanopyOS UAT and access the account
Enterprise? 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.