230 lines
16 KiB
Gherkin
230 lines
16 KiB
Gherkin
Feature: Reserve Calculation
|
|
Calculates reserve amount for a loan
|
|
|
|
Scenario: Calculate Reserve with Standard Markup
|
|
Given a loan that looks like
|
|
| Loan Date | First Pmt Date | Final Pmt Date | Loan Amount | Buy Rate | Contract Rate | Loan Type | Term |
|
|
| 5/28/2015 | 6/27/2015 | 5/27/2017 | 6200.20 | 1.48 | 3.89 | NC | 24 |
|
|
And a loan type table that looks like
|
|
| LoanTypeId | LoanComment | ChargebackMethod | NoChargebackDays | NoChargebackPayments | ReserveDiscount | FlatFeePercent | NoReserveThreshold |
|
|
| NC | 75% Reserve | N | 90 | 3 | 25.00 | 1.00 | 0.25 |
|
|
When the reserve is calculated
|
|
Then the reserve amount should be 118.73687752592344707611833965
|
|
And the reserve message should be Standard Reserve
|
|
And FlatFeePaid should be "false"
|
|
|
|
Scenario: Calculate Boat Reserve with Standard Markup
|
|
Given a loan that looks like
|
|
| Loan Date | First Pmt Date | Final Pmt Date | Loan Amount | Buy Rate | Contract Rate | Loan Type | Term | AccountType |
|
|
| 5/28/2015 | 6/27/2015 | 5/27/2017 | 6200.20 | 1.50 | 3.00 | NC | 24 | DL09 |
|
|
And a loan type table that looks like
|
|
| LoanTypeId | LoanComment | ChargebackMethod | NoChargebackDays | NoChargebackPayments | ReserveDiscount | FlatFeePercent | NoReserveThreshold |
|
|
| NC | 75% Reserve | N | 90 | 3 | 25.00 | 1.00 | 0.25 |
|
|
When the reserve is calculated
|
|
Then the reserve amount should be 310.01
|
|
And the reserve message should be Standard Reserve
|
|
And FlatFeePaid should be "false"
|
|
|
|
Scenario: Calculate Reserve with Standard Markup and Days to First Payment is less than 30
|
|
Given a loan that looks like
|
|
| Loan Date | First Pmt Date | Final Pmt Date | Loan Amount | Buy Rate | Contract Rate | Loan Type | Term |
|
|
| 2/27/2021 | 3/27/2021 | 2/27/2028 | 55799.16 | 4.59 | 6.34 | NC | 84 |
|
|
And a loan type table that looks like
|
|
| LoanTypeId | LoanComment | ChargebackMethod | NoChargebackDays | NoChargebackPayments | ReserveDiscount | FlatFeePercent | NoReserveThreshold |
|
|
| NC | 75% Reserve | N | 90 | 3 | 25.00 | 1.00 | 0.25 |
|
|
When the reserve is calculated
|
|
Then the reserve amount should be 2917.8694562514364202612072482
|
|
And the reserve message should be Standard Reserve
|
|
And FlatFeePaid should be "false"
|
|
|
|
Scenario: Calculate Reserve with Standard Markup - first pay date is less than 30 days from loan date (this calculation might be wrong)
|
|
Given a loan that looks like
|
|
| Loan Date | First Pmt Date | Final Pmt Date | Loan Amount | Buy Rate | Contract Rate | Loan Type | Term |
|
|
| 4/23/2021 | 5/21/2021 | 4/21/2026 | 6474.80 | 3.24 | 5.24 | NC | 60 |
|
|
And a loan type table that looks like
|
|
| LoanTypeId | LoanComment | ChargebackMethod | NoChargebackDays | NoChargebackPayments | ReserveDiscount | FlatFeePercent | NoReserveThreshold |
|
|
| NC | 75% Reserve | N | 90 | 3 | 25.00 | 1.00 | 0.25 |
|
|
When the reserve is calculated
|
|
Then the reserve amount should be 263.93215613213476391531161260
|
|
And the reserve message should be Standard Reserve
|
|
And FlatFeePaid should be "false"
|
|
|
|
Scenario: Calculate Reserve with Standard Markup - loan type id is missing, but will calculate the same as NC
|
|
Given a loan that looks like
|
|
| Loan Date | First Pmt Date | Final Pmt Date | Loan Amount | Buy Rate | Contract Rate | Loan Type Id | Term |
|
|
| 5/28/2015 | 6/27/2015 | 5/27/2017 | 6200.20 | 1.48 | 3.89 | | 24 |
|
|
And a loan type table that looks like
|
|
| LoanTypeId | LoanComment | ChargebackMethod | NoChargebackDays | NoChargebackPayments | ReserveDiscount | FlatFeePercent | NoReserveThreshold |
|
|
| NC | 75% Reserve | N | 90 | 3 | 25.00 | 1.00 | 0.25 |
|
|
When the reserve is calculated
|
|
Then the reserve amount should be 118.73687752592344707611833965
|
|
And the reserve message should be Standard Reserve
|
|
And FlatFeePaid should be "false"
|
|
|
|
Scenario: Calculate Reserve with Standard Markup - BB
|
|
Given a loan that looks like
|
|
| Loan Date | First Pmt Date | Final Pmt Date | Loan Amount | Buy Rate | Contract Rate | Loan Type Id | Term |
|
|
| 5/28/2015 | 6/27/2015 | 5/27/2017 | 6200.20 | 1.48 | 3.89 | BB | 24 |
|
|
And a loan type table that looks like
|
|
| LoanTypeId | LoanComment | ChargebackMethod | NoChargebackDays | NoChargebackPayments | ReserveDiscount | FlatFeePercent | NoReserveThreshold |
|
|
| BB | Standard | S | 0 | 0 | 0 | 1.00 | 0.25 |
|
|
When the reserve is calculated
|
|
Then the reserve amount should be 158.3158367012312627681577862
|
|
And the reserve message should be Standard Reserve
|
|
And FlatFeePaid should be "false"
|
|
|
|
Scenario: Calculate Reserve with Standard Markup - NR
|
|
Given a loan that looks like
|
|
| Loan Date | First Pmt Date | Final Pmt Date | Loan Amount | Buy Rate | Contract Rate | Loan Type Id | Term |
|
|
| 5/28/2015 | 6/27/2015 | 5/27/2017 | 6200.20 | 3.89 | 3.89 | NR | 24 |
|
|
And a loan type table that looks like
|
|
| LoanTypeId | LoanComment | ChargebackMethod | NoChargebackDays | NoChargebackPayments | ReserveDiscount | FlatFeePercent | NoReserveThreshold |
|
|
| NR | No reserve to be paid | N | 0 | 0 | 0 | 0.00 | 0.25 |
|
|
When the reserve is calculated
|
|
Then the reserve amount should be 0
|
|
And the reserve message should be No Reserve
|
|
And FlatFeePaid should be "false"
|
|
|
|
Scenario: Calculate Reserve with Standard Markup Flat Fee Applied
|
|
Given a loan that looks like
|
|
| Loan Date | First Pmt Date | Final Pmt Date | Loan Amount | Buy Rate | Contract Rate | Loan Type | Term |
|
|
| 2/18/2021 | 4/4/2021 | 3/1/2024 | 12000.95 | 2.89 | 3.49 | NC | 36 |
|
|
And a loan type table that looks like
|
|
| LoanTypeId | LoanComment | ChargebackMethod | NoChargebackDays | NoChargebackPayments | ReserveDiscount | FlatFeePercent | NoReserveThreshold |
|
|
| NC | 75% Reserve | N | 90 | 3 | 25.00 | 1.00 | 0.25 |
|
|
When the reserve is calculated
|
|
Then the reserve amount should be 90.007125
|
|
And the reserve message should be Flat Fee Reserve
|
|
And FlatFeePaid should be "true"
|
|
|
|
Scenario: Calculate Reserve with No Markup Flat Fee Applied
|
|
Given a loan that looks like
|
|
| Loan Date | First Pmt Date | Final Pmt Date | Loan Amount | Buy Rate | Contract Rate | Loan Type | Term |
|
|
| 7/10/2019 | 8/24/2019 | 7/24/2024 | 20500 | 3.49 | 3.49 | NC | 60 |
|
|
And a loan type table that looks like
|
|
| LoanTypeId | LoanComment | ChargebackMethod | NoChargebackDays | NoChargebackPayments | ReserveDiscount | FlatFeePercent | NoReserveThreshold |
|
|
| NC | 75% Reserve | N | 90 | 3 | 25.00 | 1.00 | 0.25 |
|
|
When the reserve is calculated
|
|
Then the reserve amount should be 153.75
|
|
Then the reserve message should be Flat Fee Reserve
|
|
And FlatFeePaid should be "true"
|
|
|
|
Scenario: Calculate Boat Reserve with No Markup Standard Reserve Applied @ 1% Reserve
|
|
Given a loan that looks like
|
|
| Loan Date | First Pmt Date | Final Pmt Date | Loan Amount | Buy Rate | Contract Rate | Loan Type | Term | AccountType |
|
|
| 7/10/2019 | 8/24/2019 | 7/24/2024 | 20500 | 3.49 | 3.49 | NC | 60 | DL12 |
|
|
And a loan type table that looks like
|
|
| LoanTypeId | LoanComment | ChargebackMethod | NoChargebackDays | NoChargebackPayments | ReserveDiscount | FlatFeePercent | NoReserveThreshold |
|
|
| NC | 75% Reserve | N | 90 | 3 | 25.00 | 1.00 | 0.25 |
|
|
When the reserve is calculated
|
|
Then the reserve amount should be 205
|
|
Then the reserve message should be Standard Reserve
|
|
And FlatFeePaid should be "false"
|
|
|
|
Scenario: Calculate Boat Reserve with Non Standard Markup
|
|
Given a loan that looks like
|
|
| Loan Date | First Pmt Date | Final Pmt Date | Loan Amount | Buy Rate | Contract Rate | Loan Type | Term | AccountType |
|
|
| 1/2/2021 | 2/16/2021 | 1/26/2026 | 28423.05 | 1.83 | 11.73 | NC | 60 | DL10 |
|
|
And a loan type table that looks like
|
|
| LoanTypeId | LoanComment | ChargebackMethod | NoChargebackDays | NoChargebackPayments | ReserveDiscount | FlatFeePercent | NoReserveThreshold |
|
|
| NC | 75% Reserve | N | 90 | 3 | 25.00 | 1.00 | 0.25 |
|
|
When the reserve is calculated
|
|
Then the reserve amount should be 1705.383
|
|
Then the reserve message should be Standard Reserve - Exceeds Max Markup
|
|
And FlatFeePaid should be "false"
|
|
|
|
Scenario: Calculate Reserve with Non Standard Markup
|
|
Given a loan that looks like
|
|
| Loan Date | First Pmt Date | Final Pmt Date | Loan Amount | Buy Rate | Contract Rate | Loan Type | Term |
|
|
| 1/2/2021 | 2/16/2021 | 1/26/2026 | 28423.05 | 1.83 | 11.73 | NC | 60 |
|
|
And a loan type table that looks like
|
|
| LoanTypeId | LoanComment | ChargebackMethod | NoChargebackDays | NoChargebackPayments | ReserveDiscount | FlatFeePercent | NoReserveThreshold |
|
|
| NC | 75% Reserve | N | 90 | 3 | 25.00 | 1.00 | 0.25 |
|
|
When the reserve is calculated
|
|
Then the reserve amount should be 6104.6234279062733014747185835
|
|
Then the reserve message should be Standard Reserve - Exceeds Max Markup
|
|
And FlatFeePaid should be "false"
|
|
|
|
Scenario: Calculate Buydown Reserve
|
|
Given a loan that looks like
|
|
| Loan Date | First Pmt Date | Final Pmt Date | Loan Amount | Buy Rate | Contract Rate | Loan Type | Term |
|
|
| 4/19/2018 | 5/19/2018 | 4/19/2024 | 27042.25 | 4.6 | 1.9 | NC | 72 |
|
|
And a loan type table that looks like
|
|
| LoanTypeId | LoanComment | ChargebackMethod | NoChargebackDays | NoChargebackPayments | ReserveDiscount | FlatFeePercent | NoReserveThreshold |
|
|
| NC | 75% Reserve | N | 90 | 3 | 25.00 | 1.00 | 0.25 |
|
|
When the reserve is calculated
|
|
Then the reserve amount should be -2362.679817869475221821891298
|
|
Then the reserve message should be Buy Down Reserve
|
|
And FlatFeePaid should be "false"
|
|
|
|
Scenario: Calculate Boat Buydown Reserve
|
|
Given a loan that looks like
|
|
| Loan Date | First Pmt Date | Final Pmt Date | Loan Amount | Buy Rate | Contract Rate | Loan Type | Term | AccountType |
|
|
| 4/19/2018 | 5/19/2018 | 4/19/2024 | 27042.25 | 4.6 | 1.9 | NC | 72 | DL11 |
|
|
And a loan type table that looks like
|
|
| LoanTypeId | LoanComment | ChargebackMethod | NoChargebackDays | NoChargebackPayments | ReserveDiscount | FlatFeePercent | NoReserveThreshold |
|
|
| NC | 75% Reserve | N | 90 | 3 | 25.00 | 1.00 | 0.25 |
|
|
When the reserve is calculated
|
|
Then the reserve amount should be -2362.679817869475221821891298
|
|
Then the reserve message should be Buy Down Reserve
|
|
And FlatFeePaid should be "false"
|
|
|
|
Scenario: Calculate Buydown Reserve - 0.5 difference
|
|
Given a loan that looks like
|
|
| Loan Date | First Pmt Date | Final Pmt Date | Loan Amount | Buy Rate | Contract Rate | Loan Type | Term |
|
|
| 5/15/2019 | 7/1/2019 | 6/1/2022 | 6261 | 5.27 | 4.77 | NC | 36 |
|
|
And a loan type table that looks like
|
|
| LoanTypeId | LoanComment | ChargebackMethod | NoChargebackDays | NoChargebackPayments | ReserveDiscount | FlatFeePercent | NoReserveThreshold |
|
|
| NC | 75% Reserve | N | 90 | 3 | 25.00 | 1.00 | 0.25 |
|
|
When the reserve is calculated
|
|
Then the reserve amount should be -52.284980016715778985051587237
|
|
Then the reserve message should be Buy Down Reserve
|
|
And FlatFeePaid should be "false"
|
|
|
|
Scenario: Calculate Boat Buydown Reserve - 0.05 difference (reserve should be 0)
|
|
Given a loan that looks like
|
|
| Loan Date | First Pmt Date | Final Pmt Date | Loan Amount | Buy Rate | Contract Rate | Loan Type | Term | AccountType |
|
|
| 8/4/2017 | 9/3/2017 | 8/3/2022 | 15721.42 | 9.95 | 9.9 | NC | 60 | DL09 |
|
|
And a loan type table that looks like
|
|
| LoanTypeId | LoanComment | ChargebackMethod | NoChargebackDays | NoChargebackPayments | ReserveDiscount | FlatFeePercent | NoReserveThreshold |
|
|
| NC | 75% Reserve | N | 90 | 3 | 25.00 | 1.00 | 0.25 |
|
|
When the reserve is calculated
|
|
Then the reserve amount should be 0
|
|
Then the reserve message should be No Reserve
|
|
And FlatFeePaid should be "false"
|
|
|
|
Scenario: Calculate Buydown Reserve - 0.05 difference (reserve should be 0)
|
|
Given a loan that looks like
|
|
| Loan Date | First Pmt Date | Final Pmt Date | Loan Amount | Buy Rate | Contract Rate | Loan Type | Term |
|
|
| 8/4/2017 | 9/3/2017 | 8/3/2022 | 15721.42 | 9.95 | 9.9 | NC | 60 |
|
|
And a loan type table that looks like
|
|
| LoanTypeId | LoanComment | ChargebackMethod | NoChargebackDays | NoChargebackPayments | ReserveDiscount | FlatFeePercent | NoReserveThreshold |
|
|
| NC | 75% Reserve | N | 90 | 3 | 25.00 | 1.00 | 0.25 |
|
|
When the reserve is calculated
|
|
Then the reserve amount should be 0
|
|
Then the reserve message should be No Reserve
|
|
And FlatFeePaid should be "false"
|
|
|
|
Scenario: Calculate Buydown Reserve - 0.25 difference (reserve should be 0)
|
|
Given a loan that looks like
|
|
| Loan Date | First Pmt Date | Final Pmt Date | Loan Amount | Buy Rate | Contract Rate | Loan Type | Term |
|
|
| 8/4/2017 | 9/3/2017 | 8/3/2022 | 15721.42 | 8.25 | 8 | NC | 60 |
|
|
And a loan type table that looks like
|
|
| LoanTypeId | LoanComment | ChargebackMethod | NoChargebackDays | NoChargebackPayments | ReserveDiscount | FlatFeePercent | NoReserveThreshold |
|
|
| NC | 75% Reserve | N | 90 | 3 | 25.00 | 1.00 | 0.25 |
|
|
When the reserve is calculated
|
|
Then the reserve amount should be 0
|
|
Then the reserve message should be No Reserve
|
|
And FlatFeePaid should be "false"
|
|
|
|
Scenario: Calculate Reserve when there are weird payment dates
|
|
Given a loan that looks like
|
|
| Loan Date | First Pmt Date | Final Pmt Date | PostedDate | Loan Amount | Buy Rate | Contract Rate | Loan Type |
|
|
| 6/14/2021 | 7/24/2021 | 6/30/2021 | 6/18/2021 | 20500 | 3.49 | 3.49 | NC |
|
|
And a loan type table that looks like
|
|
| LoanTypeId | LoanComment | ChargebackMethod | NoChargebackDays | NoChargebackPayments | ReserveDiscount | FlatFeePercent | NoReserveThreshold |
|
|
| NC | 75% Reserve | N | 90 | 3 | 25.00 | 1.00 | 0.25 |
|
|
When the reserve is calculated
|
|
Then the reserve amount should be 0
|
|
Then the reserve message should be Exception while calculating reserve
|
|
And FlatFeePaid should be "false" |