For Overdraft testing, we need to use the loan-tool.py which is a helper script written by BE developers. For more information: https://safibank.atlassian.net/wiki/spaces/ITArch/pages/217710593/Manually+testing+loan+using+loan-tool+and+API#Partially-repay-the-loan

It is not possible to create an Overdraft retrospectively, also it’s not possible to specify the duration of the grace period and fee period using standard API. Therefore we need loan-tool.py which contains a method to create an overdraft with a specified duration of the grace period and fee period:

./loan-tool.py overdraft-test-open [main_account_id] [principal] [fee] [penalty_interest_rate] [grace-period-duration] [fee-period-duration]

Provide grace-period-duration and fee-period-duration in the following format: PT{number_of_minutes}M or PT{number_of_hours}H

Past 1st due date (between 1 month two 2 months):

Prerequisites:

  • account that has 0 balance

Steps:

  1. Create an overdraft with shorter grace but longer fee period using overdraft-test-open method. E.g.:

    ./loan-tool.py overdraft-test-open 0cd7e263-38b3-4c9b-a8ff-e8a63ea5a62f 500 50 0.05 PT2M PT720H
  2. Transfer all the money from the main account to test the asset internal amount using do-payment method within the grace period duration (2 minutes in this case)

    ./loan-tool.py do-payment bff6934b-3153-4c7b-adbe-77b299dc706f TEST_ASSET_INTERNAL_ACCOUNT 500

Past 2nd due date (after 2 months):

Prerequisites:

  • account that has 0 balance

Steps:

  1. Create an overdraft with shorter grace and fee period using overdraft-test-open method. E.g.:

    ./loan-tool.py overdraft-test-open 0cd7e263-38b3-4c9b-a8ff-e8a63ea5a62f 500 50 0.05 PT2M PT1M
  2. Transfer all the money from the main account to test the asset internal amount using do-payment method within the grace period duration (2 minutes in this case)

    ./loan-tool.py do-payment bff6934b-3153-4c7b-adbe-77b299dc706f TEST_ASSET_INTERNAL_ACCOUNT 500