195 lines
18 KiB
Gherkin
195 lines
18 KiB
Gherkin
Feature: Import Read Service - Closed Loans
|
|
Gets closed loans from a stream of csv data, reads loans into memory, calculates chargebacks, saves loans, saves import information
|
|
|
|
Scenario: AddImport for Closed Loans - all loans are saved
|
|
Given an import file named "ClosedLoans 2021-03-01.txt" that contains
|
|
"""
|
|
LoanNumber,PaidLoanDate
|
|
147,02/25/2021
|
|
143,02/12/2021
|
|
144,02/12/2021
|
|
"""
|
|
And a loan table consisting of
|
|
| LoanId | ImportId | Member Number | Loan Number | Member Last Name | Member First Name | Member Initial | Dealer Code | Loan Date | PostedDate | FirstPmtDate | FinalPmtDate | Loan Amount | Buy Rate | Contract Rate | Loan Type | Term | Reserve Amount | MonthlyPmt | Flat Fee Paid | Chargeback | Paid Loan Date | Reserve Message | LoanStatus | RemainingMonthsAtClose |
|
|
| 1 | 1 | 5841 | 147 | Smith | Joe | | S7 | 2/25/2021 | 2/28/2021 | 4/11/2021 | 6/11/2026 | 12615.87 | 4.030 | 4.790 | NC | 63 | 210.0375 | 200 | false | | | Standard | New | |
|
|
| 2 | 2 | 10094 | 143 | Jones | Laura | M | H21 | 2/24/2021 | 2/27/2021 | 4/10/2021 | 3/10/2026 | 21274.24 | 2.490 | 4.970 | NC | 60 | 1450.2923 | 500 | false | | | Message | Updated | |
|
|
| 3 | 2 | 100947 | 144 | Johnson | Laura | M | H21 | 2/24/2021 | 2/27/2021 | 4/10/2021 | 3/10/2026 | 21274.24 | 2.490 | 4.970 | NC | 60 | 1450.2923 | 500 | false | | | Message | New | |
|
|
When I read this closed loan import file at "3/5/2021 5:00:00 AM"
|
|
Then the import looks like
|
|
| StartDate | RecordCount | RecordsSaved | Success | Filename | Import Type |
|
|
| 3/5/2021 5:00:00 AM | 3 | 3 | true | ClosedLoans 2021-03-01.txt | Closed |
|
|
And the import has an end date that is greater or equal to the start date
|
|
And the loans now look like
|
|
| LoanId | Member Number | Loan Number | Chargeback | Paid Loan Date | LoanStatus | RemainingMonthsAtClose |
|
|
| 1 | 5841 | 147 | 210.0375 | 2/25/2021 | Closed | 63 |
|
|
| 2 | 10094 | 143 | 1498.6354 | 2/12/2021 | Closed | 61 |
|
|
| 3 | 100947 | 144 | 1498.6354 | 2/12/2021 | Closed | 61 |
|
|
And AddHistoriesAsync is called with 2 history/ies having OldValue "New" and NewValue "Closed"
|
|
And AddHistoriesAsync is called with 1 history/ies having OldValue "Updated" and NewValue "Closed"
|
|
And AddHistoriesAsync is called with 3 history/ies having ActivityType "LoanStatusChange" and AuditDescription "Importing closed loan changed loan status"
|
|
And ExportChargebacksAsync is called
|
|
|
|
Scenario: AddImport for Closed Loans - trim fields and header
|
|
Given an import file named "ClosedLoans 2021-03-01.txt" that contains
|
|
"""
|
|
LoanNumber,PaidLoanDate
|
|
147, 02/25/2021
|
|
143, 02/12/2021
|
|
144, 02/12/2021
|
|
"""
|
|
And a loan table consisting of
|
|
| LoanId | ImportId | Member Number | Loan Number | Member Last Name | Member First Name | Member Initial | Dealer Code | Loan Date | PostedDate | FirstPmtDate | FinalPmtDate | Loan Amount | Buy Rate | Contract Rate | Loan Type | Term | Reserve Amount | MonthlyPmt | Flat Fee Paid | Chargeback | Paid Loan Date | Reserve Message | LoanStatus |
|
|
| 1 | 1 | 5841 | 147 | Smith | Joe | | S7 | 2/25/2021 | 2/28/2021 | 4/11/2021 | 6/11/2026 | 12615.87 | 4.030 | 4.790 | NC | 63 | 210.0375 | 200 | false | | | Standard | New |
|
|
| 2 | 2 | 10094 | 143 | Jones | Laura | M | H21 | 2/24/2021 | 2/27/2021 | 4/10/2021 | 3/10/2026 | 21274.24 | 2.490 | 4.970 | BB | 60 | 1450.2923 | 500 | false | | | Message | New |
|
|
| 3 | 2 | 10621 | 144 | Johnson | Laura | M | H21 | 2/24/2021 | 2/27/2021 | 4/10/2021 | 3/10/2026 | 21274.24 | 2.490 | 4.970 | BB | 60 | 1450.2923 | 500 | false | | | Message | New |
|
|
When I read this closed loan import file at "3/5/2021 5:00:00 AM"
|
|
Then the import looks like
|
|
| StartDate | RecordCount | RecordsSaved | Success | Filename | Import Type |
|
|
| 3/5/2021 5:00:00 AM | 3 | 3 | true | ClosedLoans 2021-03-01.txt | Closed |
|
|
And the import has an end date that is greater or equal to the start date
|
|
And the loans now look like
|
|
| LoanId | Member Number | Loan Number | Chargeback | Paid Loan Date | LoanStatus | RemainingMonthsAtClose |
|
|
| 1 | 5841 | 147 | 210.0375 | 2/25/2021 | Closed | 63 |
|
|
| 2 | 10094 | 143 | 1498.6354 | 2/12/2021 | Closed | 61 |
|
|
| 3 | 10621 | 144 | 1498.6354 | 2/12/2021 | Closed | 61 |
|
|
And AddHistoriesAsync is called with 3 history/ies having OldValue "New" and NewValue "Closed"
|
|
And AddHistoriesAsync is called with 3 history/ies having ActivityType "LoanStatusChange" and AuditDescription "Importing closed loan changed loan status"
|
|
And ExportChargebacksAsync is called
|
|
|
|
Scenario: AddImport for Closed Loans - Set Action Required to False
|
|
Given an import file named "ClosedLoans 2021-03-01.txt" that contains
|
|
"""
|
|
LoanNumber,PaidLoanDate
|
|
147, 02/25/2021
|
|
143, 02/12/2021
|
|
144, 02/12/2021
|
|
"""
|
|
And a loan table consisting of
|
|
| LoanId | ImportId | Member Number | Loan Number | Member Last Name | Member First Name | Member Initial | Dealer Code | Loan Date | PostedDate | FirstPmtDate | FinalPmtDate | Loan Amount | Buy Rate | Contract Rate | Loan Type | Term | Reserve Amount | MonthlyPmt | Flat Fee Paid | Chargeback | Paid Loan Date | Reserve Message | LoanStatus | ActionRequired |
|
|
| 1 | 1 | 5841 | 147 | Smith | Joe | | S7 | 2/25/2021 | 2/28/2021 | 4/11/2021 | 6/11/2026 | 12615.87 | 4.030 | 4.790 | NC | 63 | 210.0375 | 200 | false | | | Standard | New | true |
|
|
| 2 | 2 | 10094 | 143 | Jones | Laura | M | H21 | 2/24/2021 | 2/27/2021 | 4/10/2021 | 3/10/2026 | 21274.24 | 2.490 | 4.970 | BB | 60 | 1450.2923 | 500 | false | | | Message | New | false |
|
|
| 3 | 2 | 10621 | 144 | Johnson | Laura | M | H21 | 2/24/2021 | 2/27/2021 | 4/10/2021 | 3/10/2026 | 21274.24 | 2.490 | 4.970 | BB | 60 | 1450.2923 | 500 | false | | | Message | New | true |
|
|
When I read this closed loan import file at "3/5/2021 5:00:00 AM"
|
|
Then the import looks like
|
|
| StartDate | RecordCount | RecordsSaved | Success | Filename | Import Type |
|
|
| 3/5/2021 5:00:00 AM | 3 | 3 | true | ClosedLoans 2021-03-01.txt | Closed |
|
|
And the import has an end date that is greater or equal to the start date
|
|
And the loans now look like
|
|
| LoanId | Member Number | Loan Number | Chargeback | Paid Loan Date | LoanStatus | RemainingMonthsAtClose | ActionRequired |
|
|
| 1 | 5841 | 147 | 210.0375 | 2/25/2021 | Closed | 63 | false |
|
|
| 2 | 10094 | 143 | 1498.6354 | 2/12/2021 | Closed | 61 | false |
|
|
| 3 | 10621 | 144 | 1498.6354 | 2/12/2021 | Closed | 61 | false |
|
|
And AddHistoriesAsync is called with 3 history/ies having OldValue "New" and NewValue "Closed"
|
|
And AddHistoriesAsync is called with 3 history/ies having ActivityType "LoanStatusChange" and AuditDescription "Importing closed loan changed loan status"
|
|
And ExportChargebacksAsync is called
|
|
|
|
Scenario: AddImport for Closed Loans - header case insensitive
|
|
Given an import file named "ClosedLoans 2021-03-01.txt" that contains
|
|
"""
|
|
loannumber,PaidLoanDate
|
|
147, 02/25/2021
|
|
143, 02/12/2021
|
|
144, 02/12/2021
|
|
"""
|
|
And a loan table consisting of
|
|
| LoanId | ImportId | Member Number | Loan Number | Member Last Name | Member First Name | Member Initial | Dealer Code | Loan Date | PostedDate | FirstPmtDate | FinalPmtDate | Loan Amount | Buy Rate | Contract Rate | Loan Type | Term | Reserve Amount | MonthlyPmt | Flat Fee Paid | Chargeback | Paid Loan Date | Reserve Message | LoanStatus |
|
|
| 1 | 1 | 5841 | 147 | Smith | Joe | | S7 | 2/25/2021 | 2/28/2021 | 4/11/2021 | 6/11/2026 | 12615.87 | 4.030 | 4.790 | NC | 63 | 210.0375 | 200 | false | | | Standard | New |
|
|
| 2 | 2 | 10094 | 143 | Jones | Laura | M | H21 | 2/24/2021 | 2/27/2021 | 4/10/2021 | 3/10/2026 | 21274.24 | 2.490 | 4.970 | BB | 60 | 1450.2923 | 500 | false | | | Message | New |
|
|
| 3 | 2 | 10621 | 144 | Johnson | Laura | M | H21 | 2/24/2021 | 2/27/2021 | 4/10/2021 | 3/10/2026 | 21274.24 | 2.490 | 4.970 | BB | 60 | 1450.2923 | 500 | false | | | Message | New |
|
|
When I read this closed loan import file at "3/5/2021 5:00:00 AM"
|
|
Then the import looks like
|
|
| StartDate | RecordCount | RecordsSaved | Success | Filename | Import Type |
|
|
| 3/5/2021 5:00:00 AM | 3 | 3 | true | ClosedLoans 2021-03-01.txt | Closed |
|
|
And the loans now look like
|
|
| LoanId | Member Number | Loan Number | Chargeback | Paid Loan Date | LoanStatus | RemainingMonthsAtClose |
|
|
| 1 | 5841 | 147 | 210.0375 | 2/25/2021 | Closed | 63 |
|
|
| 2 | 10094 | 143 | 1498.6354 | 2/12/2021 | Closed | 61 |
|
|
| 3 | 10621 | 144 | 1498.6354 | 2/12/2021 | Closed | 61 |
|
|
And the import has an end date that is greater or equal to the start date
|
|
And AddHistoriesAsync is called with 3 history/ies having OldValue "New" and NewValue "Closed"
|
|
And AddHistoriesAsync is called with 3 history/ies having ActivityType "LoanStatusChange" and AuditDescription "Importing closed loan changed loan status"
|
|
And ExportChargebacksAsync is called
|
|
|
|
Scenario: AddImport for Closed Loans - saves two loans that are in the loan table
|
|
Given an import file named "ClosedLoans 2021-03-01.txt" that contains
|
|
"""
|
|
LoanNumber,PaidLoanDate
|
|
149,02/25/2021
|
|
143,02/12/2021
|
|
144,02/12/2021
|
|
"""
|
|
And a loan table consisting of
|
|
| LoanId | ImportId | Member Number | Loan Number | Member Last Name | Member First Name | Member Initial | Dealer Code | Loan Date | PostedDate | FirstPmtDate | FinalPmtDate | Loan Amount | Buy Rate | Contract Rate | Loan Type | Term | Reserve Amount | MonthlyPmt | Flat Fee Paid | Chargeback | Paid Loan Date | Reserve Message | LoanStatus |
|
|
| 1 | 1 | 12 | 3 | Smith | Joe | | S7 | 2/25/2021 | 2/28/2021 | 4/11/2021 | 6/11/2026 | 12615.87 | 4.030 | 4.790 | NC | 63 | 210.0375 | 200 | false | | | Standard | New |
|
|
| 2 | 2 | 10094 | 143 | Jones | Laura | M | H21 | 2/24/2021 | 2/27/2021 | 4/10/2021 | 3/10/2026 | 21274.24 | 2.490 | 4.970 | BB | 60 | 1450.2923 | 500 | false | | | Message | New |
|
|
| 3 | 2 | 10621 | 144 | Johnson | Laura | M | H21 | 2/24/2021 | 2/27/2021 | 4/10/2021 | 3/10/2026 | 21274.24 | 2.490 | 4.970 | BB | 60 | 1450.2923 | 500 | false | | | Message | New |
|
|
When I read this closed loan import file at "3/5/2021 5:00:00 AM"
|
|
Then the import looks like
|
|
| StartDate | RecordCount | RecordsSaved | Success | Filename | Import Type |
|
|
| 3/5/2021 5:00:00 AM | 3 | 2 | true | ClosedLoans 2021-03-01.txt | Closed |
|
|
And the import has an end date that is greater or equal to the start date
|
|
And the loans now look like
|
|
| LoanId | Member Number | Loan Number | Chargeback | Paid Loan Date | LoanStatus | RemainingMonthsAtClose |
|
|
| 1 | 12 | 3 | | | New | |
|
|
| 2 | 10094 | 143 | 1498.6354 | 2/12/2021 | Closed | 61 |
|
|
| 3 | 10621 | 144 | 1498.6354 | 2/12/2021 | Closed | 61 |
|
|
And AddHistoriesAsync is called with 2 history/ies having OldValue "New" and NewValue "Closed"
|
|
And AddHistoriesAsync is called with 2 history/ies having ActivityType "LoanStatusChange" and AuditDescription "Importing closed loan changed loan status"
|
|
And AddHistoriesAsync is called with 1 history/ies having ActivityType "Error" and AuditDescription "Loan in closed import not found"
|
|
And ExportChargebacksAsync is called
|
|
|
|
Scenario: AddImport for Closed Boat Loans - saves two loans that are in the loan table
|
|
Given an import file named "ClosedLoans 2021-03-01.txt" that contains
|
|
"""
|
|
LoanNumber,PaidLoanDate,AccountType
|
|
151,02/25/2021,DL10
|
|
143,04/12/2021,DL11
|
|
144,04/12/2021,DL12
|
|
"""
|
|
And a loan table consisting of
|
|
| LoanId | ImportId | Member Number | Loan Number | Member Last Name | Member First Name | Member Initial | Dealer Code | Loan Date | PostedDate | FirstPmtDate | FinalPmtDate | Loan Amount | Buy Rate | Contract Rate | Loan Type | Term | Reserve Amount | MonthlyPmt | Flat Fee Paid | Chargeback | Paid Loan Date | Reserve Message | LoanStatus | AccountType |
|
|
| 1 | 1 | 12 | 3 | Smith | Joe | | S7 | 2/25/2021 | 2/28/2021 | 4/11/2021 | 6/11/2026 | 12615.87 | 4.030 | 4.790 | NC | 63 | 210.0375 | 200 | false | | | Standard | New | DL10 |
|
|
| 2 | 2 | 10094 | 143 | Jones | Laura | M | H21 | 2/24/2021 | 2/27/2021 | 4/10/2021 | 3/10/2026 | 21274.24 | 2.490 | 4.970 | NC | 60 | 1450.2923 | 500 | false | | | Message | New | DL11 |
|
|
| 3 | 2 | 10621 | 144 | Johnson | Laura | M | H21 | 2/24/2021 | 2/27/2021 | 4/10/2021 | 1/10/2027 | 21274.24 | 2.490 | 4.470 | NC | 70 | 1063.7120 | 500 | false | | | Message | New | DL12 |
|
|
When I read this closed loan import file at "3/5/2021 5:00:00 AM"
|
|
Then the import looks like
|
|
| StartDate | RecordCount | RecordsSaved | Success | Filename | Import Type |
|
|
| 3/5/2021 5:00:00 AM | 3 | 2 | true | ClosedLoans 2021-03-01.txt | Closed |
|
|
And the import has an end date that is greater or equal to the start date
|
|
And the loans now look like
|
|
| LoanId | Member Number | Loan Number | Chargeback | Paid Loan Date | LoanStatus | RemainingMonthsAtClose |
|
|
| 1 | 12 | 3 | | | New | |
|
|
| 2 | 10094 | 143 | 1402.7417 | 4/12/2021 | Closed | 59 |
|
|
| 3 | 10621 | 144 | 1033.7483 | 4/12/2021 | Closed | 69 |
|
|
And AddHistoriesAsync is called with 2 history/ies having OldValue "New" and NewValue "Closed"
|
|
And AddHistoriesAsync is called with 2 history/ies having ActivityType "LoanStatusChange" and AuditDescription "Importing closed loan changed loan status"
|
|
And AddHistoriesAsync is called with 1 history/ies having ActivityType "Error" and AuditDescription "Loan in closed import not found"
|
|
And ExportChargebacksAsync is called
|
|
|
|
Scenario: AddImport - file has a header with one column named incorrectly
|
|
Given an import file named "ClosedLoans 2021-03-01.txt" that contains
|
|
"""
|
|
LoanNumber,PaidDate
|
|
147,02/25/2021
|
|
143,02/12/2021
|
|
144,02/12/2021
|
|
"""
|
|
When I read this closed loan import file at "3/5/2021 5:00:00 AM"
|
|
And I get the record from the ImportTable
|
|
Then the import looks like
|
|
| StartDate | EndDate | RecordCount | RecordsSaved | Success | Filename | Import Type |
|
|
| 3/5/2021 5:00:00 AM | | 0 | 0 | false | ClosedLoans 2021-03-01.txt | Closed |
|
|
|
|
Scenario: AddImport - file is missing the header
|
|
Given an import file named "ClosedLoans 2021-03-01.txt" that contains
|
|
"""
|
|
147,02/25/2021
|
|
143,02/12/2021
|
|
144,02/12/2021
|
|
"""
|
|
When I read this closed loan import file at "3/5/2021 5:00:00 AM"
|
|
And I get the record from the ImportTable
|
|
Then the import looks like
|
|
| StartDate | EndDate | RecordCount | RecordsSaved | Success | Filename | Import Type |
|
|
| 3/5/2021 5:00:00 AM | | 0 | 0 | false | ClosedLoans 2021-03-01.txt | Closed |
|