Additional changes to move application to CouchDB database backend. Removed loan files from repository (now in selfhosted couchdb instance).
This commit is contained in:
102
0_Test_Loan.loan
102
0_Test_Loan.loan
@@ -1,102 +0,0 @@
|
||||
{
|
||||
"parameters": {
|
||||
"monthly_payment": 589.0,
|
||||
"interest_rate": 6.5,
|
||||
"start_interest_date": "2017-12-05",
|
||||
"payment_day_of_month": "15",
|
||||
"first_payment_month": "2018-01-15",
|
||||
"account_number": "100100",
|
||||
"principal": 10020.0,
|
||||
"start_date": "2017-12-05",
|
||||
"periods_per_year": 12,
|
||||
"periods": 18
|
||||
},
|
||||
"lender": {
|
||||
"city": "Washington",
|
||||
"name": "Test Lender",
|
||||
"zip": "20011",
|
||||
"phone": "703.343.0782",
|
||||
"state": "DC",
|
||||
"address": "743 Madison St NW"
|
||||
},
|
||||
"header": {
|
||||
"date": "Today",
|
||||
"title": "Installment Loan Test Statement"
|
||||
},
|
||||
"payments": [
|
||||
[
|
||||
"2019-07-15",
|
||||
"475.00"
|
||||
],
|
||||
[
|
||||
"2019-08-14",
|
||||
"475.00"
|
||||
],
|
||||
[
|
||||
"2019-09-17",
|
||||
"475"
|
||||
],
|
||||
[
|
||||
"2019-10-15",
|
||||
"0"
|
||||
],
|
||||
[
|
||||
"2019-11-15",
|
||||
"0"
|
||||
],
|
||||
[
|
||||
"2019-12-5",
|
||||
"475"
|
||||
],
|
||||
[
|
||||
"2020-01-15",
|
||||
"0",
|
||||
"50"
|
||||
],
|
||||
[
|
||||
"2020-09-27",
|
||||
"278.15",
|
||||
"20"
|
||||
],
|
||||
[
|
||||
"2020-09-29",
|
||||
"296.12",
|
||||
"25"
|
||||
],
|
||||
[
|
||||
"2020-10-16",
|
||||
"133",
|
||||
"0.00"
|
||||
],
|
||||
[
|
||||
"2020-10-16",
|
||||
"133",
|
||||
"0.00"
|
||||
],
|
||||
[
|
||||
"2020-10-16",
|
||||
"133",
|
||||
"0.00"
|
||||
],
|
||||
[
|
||||
"2021-05-03",
|
||||
"1",
|
||||
"1"
|
||||
]
|
||||
],
|
||||
"borrower": {
|
||||
"city": "Alexandria",
|
||||
"state": "VA",
|
||||
"name": "Test Borrower Houses, LLC",
|
||||
"zip": "22312",
|
||||
"address": "301 N Beauregard St Apt 203"
|
||||
},
|
||||
"email": {
|
||||
"to_address": "jkent3rd@gmail.com",
|
||||
"from_address": "jkent3rd@gmail.com",
|
||||
"subject": "Your test loan statement...",
|
||||
"body": "Your test loan statement is attached.",
|
||||
"server": "smtp.gmail.com",
|
||||
"password": "builcuouzobxroow"
|
||||
}
|
||||
}
|
||||
@@ -1,328 +0,0 @@
|
||||
{
|
||||
"htmlTemplate": "statement.pdf.jinja",
|
||||
"parameters": {
|
||||
"monthly_payment": 278.15,
|
||||
"interest_rate": 5.0,
|
||||
"start_interest_date": "2018-07-01",
|
||||
"payment_day_of_month": "01",
|
||||
"first_payment_month": "2018-08-01",
|
||||
"account_number": "100001",
|
||||
"periods": 180,
|
||||
"start_date": "2018-06-25",
|
||||
"periods_per_year": 12,
|
||||
"principal": 35000.0
|
||||
},
|
||||
"format": "html",
|
||||
"email": {
|
||||
"body": "Your loan statement is attached.",
|
||||
"to_address": "johnakent722@gmail.com",
|
||||
"from_address": "jkent3rd@gmail.com",
|
||||
"text": "Please see your most recent account statement.",
|
||||
"server": "smtp.gmail.com",
|
||||
"send_text": "true",
|
||||
"template": "./template.txt",
|
||||
"send_pdf": "true",
|
||||
"password": "builcuouzobxroow",
|
||||
"subject": "Your loan statement..."
|
||||
},
|
||||
"lender": {
|
||||
"city": "Palmyra",
|
||||
"name": "John Kent",
|
||||
"zip": "22963",
|
||||
"phone": "434-510-7272",
|
||||
"state": "VA",
|
||||
"address": "109 Shores Rd"
|
||||
},
|
||||
"header": {
|
||||
"date": "Today",
|
||||
"title": "Mortgage Loan Statement - 185 James River Rd, Scottsville VA"
|
||||
},
|
||||
"payments": [
|
||||
[
|
||||
"2018-08-01",
|
||||
"278.15"
|
||||
],
|
||||
[
|
||||
"2018-09-01",
|
||||
"278.15"
|
||||
],
|
||||
[
|
||||
"2018-10-01",
|
||||
"278.15"
|
||||
],
|
||||
[
|
||||
"2018-11-01",
|
||||
"278.15"
|
||||
],
|
||||
[
|
||||
"2018-12-01",
|
||||
"278.15"
|
||||
],
|
||||
[
|
||||
"2019-01-01",
|
||||
"278.15"
|
||||
],
|
||||
[
|
||||
"2019-02-01",
|
||||
"278.15"
|
||||
],
|
||||
[
|
||||
"2019-03-01",
|
||||
"278.15"
|
||||
],
|
||||
[
|
||||
"2019-04-01",
|
||||
"278.15"
|
||||
],
|
||||
[
|
||||
"2019-05-01",
|
||||
"278.15"
|
||||
],
|
||||
[
|
||||
"2019-05-31",
|
||||
"278.15"
|
||||
],
|
||||
[
|
||||
"2019-07-01",
|
||||
"278.15"
|
||||
],
|
||||
[
|
||||
"2019-08-01",
|
||||
"278.15"
|
||||
],
|
||||
[
|
||||
"2019-09-02",
|
||||
"278.15"
|
||||
],
|
||||
[
|
||||
"2019-10-01",
|
||||
"278.15"
|
||||
],
|
||||
[
|
||||
"2019-11-01",
|
||||
"278.15"
|
||||
],
|
||||
[
|
||||
"2019-12-02",
|
||||
"278.15"
|
||||
],
|
||||
[
|
||||
"2020-01-02",
|
||||
"278.15"
|
||||
],
|
||||
[
|
||||
"2020-02-01",
|
||||
"278.15"
|
||||
],
|
||||
[
|
||||
"2020-03-02",
|
||||
"278.15"
|
||||
],
|
||||
[
|
||||
"2020-04-01",
|
||||
"278.15"
|
||||
],
|
||||
[
|
||||
"2020-05-01",
|
||||
"278.15"
|
||||
],
|
||||
[
|
||||
"2020-06-01",
|
||||
"278.15"
|
||||
],
|
||||
[
|
||||
"2020-07-01",
|
||||
"278.15"
|
||||
],
|
||||
[
|
||||
"2020-08-01",
|
||||
"278.15"
|
||||
],
|
||||
[
|
||||
"2020-09-01",
|
||||
"278.15"
|
||||
],
|
||||
[
|
||||
"2020-10-01",
|
||||
"278.15"
|
||||
],
|
||||
[
|
||||
"2020-11-01",
|
||||
"278.15",
|
||||
"0.00"
|
||||
],
|
||||
[
|
||||
"2020-12-01",
|
||||
"278.15",
|
||||
"0.00"
|
||||
],
|
||||
[
|
||||
"2021-01-01",
|
||||
"278.15",
|
||||
"0"
|
||||
],
|
||||
[
|
||||
"2021-02-01",
|
||||
"278.15",
|
||||
"0"
|
||||
],
|
||||
[
|
||||
"2021-03-01",
|
||||
"278.15",
|
||||
"0.00"
|
||||
],
|
||||
[
|
||||
"2021-04-01",
|
||||
"278.15",
|
||||
"0.00"
|
||||
],
|
||||
[
|
||||
"2021-04-30",
|
||||
"278.15",
|
||||
"0"
|
||||
],
|
||||
[
|
||||
"2021-06-01",
|
||||
"278.15",
|
||||
"0.00"
|
||||
],
|
||||
[
|
||||
"2021-07-01",
|
||||
"278.15",
|
||||
"0"
|
||||
],
|
||||
[
|
||||
"2021-07-31",
|
||||
"278.15",
|
||||
"0"
|
||||
],
|
||||
[
|
||||
"2021-09-01",
|
||||
"278.15",
|
||||
"0.00",
|
||||
"False"
|
||||
],
|
||||
[
|
||||
"2021-10-01",
|
||||
"278.15",
|
||||
"0.00",
|
||||
"False"
|
||||
],
|
||||
[
|
||||
"2021-11-01",
|
||||
"278.15",
|
||||
"0",
|
||||
"False"
|
||||
],
|
||||
[
|
||||
"2021-12-01",
|
||||
"278.15",
|
||||
"0.00",
|
||||
"False"
|
||||
],
|
||||
[
|
||||
"2022-01-01",
|
||||
"278.15",
|
||||
"0.00",
|
||||
"False"
|
||||
],
|
||||
[
|
||||
"2022-02-01",
|
||||
"278.15",
|
||||
"0.00",
|
||||
"False"
|
||||
],
|
||||
[
|
||||
"2022-03-01",
|
||||
"278.15",
|
||||
"0.00",
|
||||
"False"
|
||||
],
|
||||
[
|
||||
"2022-04-01",
|
||||
"278.15",
|
||||
"0.00",
|
||||
"False"
|
||||
],
|
||||
[
|
||||
"2022-05-01",
|
||||
"278.15",
|
||||
"0.00",
|
||||
"False"
|
||||
],
|
||||
[
|
||||
"2022-06-01",
|
||||
"278.15",
|
||||
"0.00",
|
||||
"False"
|
||||
],
|
||||
[
|
||||
"2022-07-01",
|
||||
"278.15",
|
||||
"0.00",
|
||||
"False"
|
||||
],
|
||||
[
|
||||
"2022-08-01",
|
||||
"278.15",
|
||||
"0.00",
|
||||
"False"
|
||||
],
|
||||
[
|
||||
"2022-09-01",
|
||||
"278.15",
|
||||
"0.00",
|
||||
"False"
|
||||
],
|
||||
[
|
||||
"2022-10-01",
|
||||
"278.15",
|
||||
"0.00",
|
||||
"False"
|
||||
],
|
||||
[
|
||||
"2022-10-31",
|
||||
"278.15",
|
||||
"0.00",
|
||||
"False"
|
||||
],
|
||||
[
|
||||
"2022-12-01",
|
||||
"278.15",
|
||||
"0.00",
|
||||
"False"
|
||||
],
|
||||
[
|
||||
"2023-01-03",
|
||||
"278.15",
|
||||
"0.00",
|
||||
"False"
|
||||
],
|
||||
[
|
||||
"2023-02-01",
|
||||
"278.15",
|
||||
"0.00",
|
||||
"False"
|
||||
],
|
||||
[
|
||||
"2023-03-01",
|
||||
"278.15",
|
||||
"0.00",
|
||||
"False"
|
||||
],
|
||||
[
|
||||
"2023-04-01",
|
||||
"278.15",
|
||||
"0.00",
|
||||
"False"
|
||||
]
|
||||
],
|
||||
"borrower": {
|
||||
"city": "Washington",
|
||||
"state": "DC",
|
||||
"name": "Grandma Tina's Properties, LLC",
|
||||
"zip": "20001",
|
||||
"address": "1720 New Jersey Ave NW Unit 401"
|
||||
},
|
||||
"txtTemplate": "statement.txt.jinja"
|
||||
}
|
||||
@@ -1,328 +0,0 @@
|
||||
{
|
||||
"htmlTemplate": "statement.pdf.jinja",
|
||||
"parameters": {
|
||||
"monthly_payment": 278.15,
|
||||
"interest_rate": 5.0,
|
||||
"start_interest_date": "2018-07-01",
|
||||
"payment_day_of_month": "01",
|
||||
"first_payment_month": "2018-08-01",
|
||||
"account_number": "100001",
|
||||
"periods": 180,
|
||||
"start_date": "2018-06-25",
|
||||
"periods_per_year": 12,
|
||||
"principal": 35000.0
|
||||
},
|
||||
"format": "html",
|
||||
"email": {
|
||||
"body": "Your loan statement is attached.",
|
||||
"to_address": "bck@virginia.edu",
|
||||
"from_address": "jkent3rd@gmail.com",
|
||||
"text": "Please see your most recent account statement.",
|
||||
"server": "smtp.gmail.com",
|
||||
"send_text": "true",
|
||||
"template": "./template.txt",
|
||||
"send_pdf": "true",
|
||||
"password": "builcuouzobxroow",
|
||||
"subject": "Your loan statement..."
|
||||
},
|
||||
"lender": {
|
||||
"city": "Scottsville",
|
||||
"name": "Brenda Kelly",
|
||||
"zip": "24590",
|
||||
"phone": "434-286-2110",
|
||||
"state": "VA",
|
||||
"address": "150 Confederate Street"
|
||||
},
|
||||
"header": {
|
||||
"date": "Today",
|
||||
"title": "Mortgage Loan Statement - 185 James River Rd, Scottsville VA"
|
||||
},
|
||||
"payments": [
|
||||
[
|
||||
"2018-08-01",
|
||||
"278.15"
|
||||
],
|
||||
[
|
||||
"2018-09-01",
|
||||
"278.15"
|
||||
],
|
||||
[
|
||||
"2018-10-01",
|
||||
"278.15"
|
||||
],
|
||||
[
|
||||
"2018-11-01",
|
||||
"278.15"
|
||||
],
|
||||
[
|
||||
"2018-12-01",
|
||||
"278.15"
|
||||
],
|
||||
[
|
||||
"2019-01-01",
|
||||
"278.15"
|
||||
],
|
||||
[
|
||||
"2019-02-01",
|
||||
"278.15"
|
||||
],
|
||||
[
|
||||
"2019-03-01",
|
||||
"278.15"
|
||||
],
|
||||
[
|
||||
"2019-04-01",
|
||||
"278.15"
|
||||
],
|
||||
[
|
||||
"2019-05-01",
|
||||
"278.15"
|
||||
],
|
||||
[
|
||||
"2019-05-31",
|
||||
"278.15"
|
||||
],
|
||||
[
|
||||
"2019-07-01",
|
||||
"278.15"
|
||||
],
|
||||
[
|
||||
"2019-08-01",
|
||||
"278.15"
|
||||
],
|
||||
[
|
||||
"2019-09-02",
|
||||
"278.15"
|
||||
],
|
||||
[
|
||||
"2019-10-01",
|
||||
"278.15"
|
||||
],
|
||||
[
|
||||
"2019-11-01",
|
||||
"278.15"
|
||||
],
|
||||
[
|
||||
"2019-12-02",
|
||||
"278.15"
|
||||
],
|
||||
[
|
||||
"2020-01-02",
|
||||
"278.15"
|
||||
],
|
||||
[
|
||||
"2020-02-01",
|
||||
"278.15"
|
||||
],
|
||||
[
|
||||
"2020-03-01",
|
||||
"278.15"
|
||||
],
|
||||
[
|
||||
"2020-04-01",
|
||||
"278.15"
|
||||
],
|
||||
[
|
||||
"2020-05-01",
|
||||
"278.15"
|
||||
],
|
||||
[
|
||||
"2020-06-01",
|
||||
"278.15"
|
||||
],
|
||||
[
|
||||
"2020-07-01",
|
||||
"278.15"
|
||||
],
|
||||
[
|
||||
"2020-08-01",
|
||||
"278.15"
|
||||
],
|
||||
[
|
||||
"2020-09-01",
|
||||
"278.15"
|
||||
],
|
||||
[
|
||||
"2020-10-01",
|
||||
"278.15"
|
||||
],
|
||||
[
|
||||
"2020-11-01",
|
||||
"278.15",
|
||||
"0.00"
|
||||
],
|
||||
[
|
||||
"2020-12-01",
|
||||
"278.15",
|
||||
"0.00"
|
||||
],
|
||||
[
|
||||
"2021-01-01",
|
||||
"278.15",
|
||||
"0"
|
||||
],
|
||||
[
|
||||
"2021-02-01",
|
||||
"278.15",
|
||||
"0"
|
||||
],
|
||||
[
|
||||
"2021-03-01",
|
||||
"278.15",
|
||||
"0.00"
|
||||
],
|
||||
[
|
||||
"2021-04-01",
|
||||
"278.15",
|
||||
"0.00"
|
||||
],
|
||||
[
|
||||
"2021-04-30",
|
||||
"278.15",
|
||||
"0"
|
||||
],
|
||||
[
|
||||
"2021-06-01",
|
||||
"278.15",
|
||||
"0.00"
|
||||
],
|
||||
[
|
||||
"2021-07-01",
|
||||
"278.15",
|
||||
"0"
|
||||
],
|
||||
[
|
||||
"2021-07-31",
|
||||
"278.15",
|
||||
"0"
|
||||
],
|
||||
[
|
||||
"2021-09-01",
|
||||
"278.15",
|
||||
"0.00",
|
||||
"False"
|
||||
],
|
||||
[
|
||||
"2021-10-01",
|
||||
"278.15",
|
||||
"0.00",
|
||||
"False"
|
||||
],
|
||||
[
|
||||
"2021-11-01",
|
||||
"278.15",
|
||||
"0",
|
||||
"False"
|
||||
],
|
||||
[
|
||||
"2021-12-01",
|
||||
"278.15",
|
||||
"0.00",
|
||||
"False"
|
||||
],
|
||||
[
|
||||
"2022-01-01",
|
||||
"278.15",
|
||||
"0.00",
|
||||
"False"
|
||||
],
|
||||
[
|
||||
"2022-02-01",
|
||||
"278.15",
|
||||
"0",
|
||||
"False"
|
||||
],
|
||||
[
|
||||
"2022-03-01",
|
||||
"278.15",
|
||||
"0.00",
|
||||
"False"
|
||||
],
|
||||
[
|
||||
"2022-04-01",
|
||||
"278.15",
|
||||
"0.00",
|
||||
"False"
|
||||
],
|
||||
[
|
||||
"2022-05-01",
|
||||
"278.15",
|
||||
"0.00",
|
||||
"False"
|
||||
],
|
||||
[
|
||||
"2022-06-01",
|
||||
"278.15",
|
||||
"0.00",
|
||||
"False"
|
||||
],
|
||||
[
|
||||
"2022-07-01",
|
||||
"278.15",
|
||||
"0.00",
|
||||
"False"
|
||||
],
|
||||
[
|
||||
"2022-08-01",
|
||||
"278.15",
|
||||
"0.00",
|
||||
"False"
|
||||
],
|
||||
[
|
||||
"2022-09-01",
|
||||
"278.15",
|
||||
"0.00",
|
||||
"False"
|
||||
],
|
||||
[
|
||||
"2022-10-01",
|
||||
"278.15",
|
||||
"0.00",
|
||||
"False"
|
||||
],
|
||||
[
|
||||
"2022-10-31",
|
||||
"278.15",
|
||||
"0.00",
|
||||
"False"
|
||||
],
|
||||
[
|
||||
"2022-12-01",
|
||||
"278.15",
|
||||
"0.00",
|
||||
"False"
|
||||
],
|
||||
[
|
||||
"2023-01-03",
|
||||
"278.15",
|
||||
"0.00",
|
||||
"False"
|
||||
],
|
||||
[
|
||||
"2023-02-01",
|
||||
"278.15",
|
||||
"0.00",
|
||||
"False"
|
||||
],
|
||||
[
|
||||
"2023-03-01",
|
||||
"278.15",
|
||||
"0.00",
|
||||
"False"
|
||||
],
|
||||
[
|
||||
"2023-04-01",
|
||||
"278.15",
|
||||
"0.00",
|
||||
"False"
|
||||
]
|
||||
],
|
||||
"borrower": {
|
||||
"city": "Washington",
|
||||
"state": "DC",
|
||||
"name": "Grandma Tina's Properties, LLC",
|
||||
"zip": "20001",
|
||||
"address": "1720 New Jersey Ave NW Unit 401"
|
||||
},
|
||||
"txtTemplate": "statement.txt.jinja"
|
||||
}
|
||||
@@ -1,92 +0,0 @@
|
||||
{
|
||||
"htmlTemplate": "statement.pdf.jinja",
|
||||
"parameters": {
|
||||
"monthly_payment": 842.93,
|
||||
"interest_rate": 5.75,
|
||||
"start_interest_date": "2022-08-12",
|
||||
"payment_day_of_month": "15",
|
||||
"first_payment_month": "2022-09-15",
|
||||
"account_number": "22-0001",
|
||||
"periods": 180,
|
||||
"start_date": "2022-08-12",
|
||||
"periods_per_year": 12,
|
||||
"principal": 101508.04
|
||||
},
|
||||
"format": "html",
|
||||
"email": {
|
||||
"body": "Your loan statement is attached.",
|
||||
"to_address": "grady@gradystreet.com",
|
||||
"from_address": "jkent3rd@gmail.com",
|
||||
"text": "Please see your most recent account statement.",
|
||||
"server": "smtp.gmail.com",
|
||||
"send_text": "true",
|
||||
"template": "./template.txt",
|
||||
"send_pdf": "true",
|
||||
"password": "builcuouzobxroow",
|
||||
"subject": "Your loan statement..."
|
||||
},
|
||||
"lender": {
|
||||
"city": "Washington",
|
||||
"name": "Rivanna Graphite Investments, LLC",
|
||||
"zip": "20001",
|
||||
"phone": "703.343.0782",
|
||||
"state": "DC",
|
||||
"address": "1720 New Jersey Ave NW Unit 401"
|
||||
},
|
||||
"header": {
|
||||
"date": "Today",
|
||||
"title": "Mortgage Loan Statement - Harbor Bend Loan 1"
|
||||
},
|
||||
"payments": [
|
||||
[
|
||||
"2022-08-15",
|
||||
"803",
|
||||
"0",
|
||||
"False"
|
||||
],
|
||||
[
|
||||
"2022-09-09",
|
||||
"803",
|
||||
"0.00",
|
||||
"False"
|
||||
],
|
||||
[
|
||||
"2022-11-17",
|
||||
"842.93",
|
||||
"0.00",
|
||||
"False"
|
||||
],
|
||||
[
|
||||
"2022-12-29",
|
||||
"842.93",
|
||||
"0.00",
|
||||
"False"
|
||||
],
|
||||
[
|
||||
"2023-01-27",
|
||||
"842.93",
|
||||
"0.00",
|
||||
"False"
|
||||
],
|
||||
[
|
||||
"2023-02-10",
|
||||
"842.93",
|
||||
"0.00",
|
||||
"False"
|
||||
],
|
||||
[
|
||||
"2023-03-31",
|
||||
"0",
|
||||
"33.68",
|
||||
"False"
|
||||
]
|
||||
],
|
||||
"borrower": {
|
||||
"city": "Alexandria",
|
||||
"state": "VA",
|
||||
"name": "Bear Houses, LLC",
|
||||
"zip": "22312",
|
||||
"address": "301 N Beauregard St Apt 203"
|
||||
},
|
||||
"txtTemplate": "statement.txt.jinja"
|
||||
}
|
||||
@@ -3,6 +3,6 @@ FROM python:3.8-slim-buster
|
||||
COPY requirements.txt requirements.txt
|
||||
RUN pip3 install -r requirements.txt
|
||||
|
||||
COPY . .
|
||||
COPY mortgage/ .
|
||||
|
||||
CMD [ "python3", "-m" , "flask", "run", "--host=0.0.0.0"]
|
||||
CMD [ "python3", "-m" , "web", "run", "--host=0.0.0.0"]
|
||||
@@ -1,255 +0,0 @@
|
||||
{
|
||||
"htmlTemplate": "statement.pdf.jinja",
|
||||
"parameters": {
|
||||
"monthly_payment": 803.0,
|
||||
"interest_rate": 5.5,
|
||||
"start_interest_date": "2017-11-11",
|
||||
"payment_day_of_month": "15",
|
||||
"first_payment_month": "2017-12-15",
|
||||
"account_number": "100001",
|
||||
"periods": 185,
|
||||
"start_date": "2017-11-07",
|
||||
"periods_per_year": 12,
|
||||
"principal": 97750.0
|
||||
},
|
||||
"format": "html",
|
||||
"email": {
|
||||
"body": "Your loan statement is attached.",
|
||||
"to_address": "grady@gradystreet.com",
|
||||
"from_address": "jkent3rd@gmail.com",
|
||||
"text": "Please see your most recent account statement.",
|
||||
"server": "smtp.gmail.com",
|
||||
"send_text": "true",
|
||||
"template": "./template.txt",
|
||||
"send_pdf": "true",
|
||||
"password": "builcuouzobxroow",
|
||||
"subject": "Your loan statement..."
|
||||
},
|
||||
"lender": {
|
||||
"city": "Washington",
|
||||
"name": "Rivanna Graphite Investments, LLC",
|
||||
"zip": "20001",
|
||||
"phone": "703.343.0782",
|
||||
"state": "DC",
|
||||
"address": "1720 New Jersey Ave NW Unit 401"
|
||||
},
|
||||
"header": {
|
||||
"date": "Today",
|
||||
"title": "Mortgage Loan Statement - 195 Greenfield Lane, Pearl MS"
|
||||
},
|
||||
"payments": [
|
||||
[
|
||||
"2017-12-11",
|
||||
"803.00"
|
||||
],
|
||||
[
|
||||
"2018-01-23",
|
||||
"803.00"
|
||||
],
|
||||
[
|
||||
"2018-03-23",
|
||||
"803.00"
|
||||
],
|
||||
[
|
||||
"2018-04-18",
|
||||
"803.00"
|
||||
],
|
||||
[
|
||||
"2018-04-26",
|
||||
"803.00"
|
||||
],
|
||||
[
|
||||
"2018-05-15",
|
||||
"0.00"
|
||||
],
|
||||
[
|
||||
"2018-06-15",
|
||||
"0.00"
|
||||
],
|
||||
[
|
||||
"2018-07-12",
|
||||
"803.00"
|
||||
],
|
||||
[
|
||||
"2018-08-07",
|
||||
"803.00"
|
||||
],
|
||||
[
|
||||
"2018-09-06",
|
||||
"803.00"
|
||||
],
|
||||
[
|
||||
"2018-10-11",
|
||||
"803.00"
|
||||
],
|
||||
[
|
||||
"2018-11-13",
|
||||
"803.00"
|
||||
],
|
||||
[
|
||||
"2018-12-13",
|
||||
"803.00"
|
||||
],
|
||||
[
|
||||
"2019-01-14",
|
||||
"803.00"
|
||||
],
|
||||
[
|
||||
"2019-02-05",
|
||||
"803.00"
|
||||
],
|
||||
[
|
||||
"2019-03-05",
|
||||
"803.00"
|
||||
],
|
||||
[
|
||||
"2019-04-15",
|
||||
"803.00"
|
||||
],
|
||||
[
|
||||
"2019-05-15",
|
||||
"0.00"
|
||||
],
|
||||
[
|
||||
"2019-06-13",
|
||||
"803.00"
|
||||
],
|
||||
[
|
||||
"2019-07-25",
|
||||
"803.00"
|
||||
],
|
||||
[
|
||||
"2019-08-14",
|
||||
"803.00"
|
||||
],
|
||||
[
|
||||
"2019-09-13",
|
||||
"803.00"
|
||||
],
|
||||
[
|
||||
"2019-10-21",
|
||||
"803.00"
|
||||
],
|
||||
[
|
||||
"2019-11-29",
|
||||
"803.00"
|
||||
],
|
||||
[
|
||||
"2019-12-19",
|
||||
"803.00"
|
||||
],
|
||||
[
|
||||
"2020-01-15",
|
||||
"803"
|
||||
],
|
||||
[
|
||||
"2020-03-06",
|
||||
"803",
|
||||
"32.12"
|
||||
],
|
||||
[
|
||||
"2020-03-13",
|
||||
"803.00"
|
||||
],
|
||||
[
|
||||
"2020-04-15",
|
||||
"803.00"
|
||||
],
|
||||
[
|
||||
"2020-05-13",
|
||||
"803.00"
|
||||
],
|
||||
[
|
||||
"2020-06-16",
|
||||
"803.00"
|
||||
],
|
||||
[
|
||||
"2020-07-15",
|
||||
"803"
|
||||
],
|
||||
[
|
||||
"2020-08-13",
|
||||
"803"
|
||||
],
|
||||
[
|
||||
"2020-09-17",
|
||||
"803"
|
||||
],
|
||||
[
|
||||
"2020-10-15",
|
||||
"803",
|
||||
"0.00"
|
||||
],
|
||||
[
|
||||
"2020-11-16",
|
||||
"803.00",
|
||||
"0"
|
||||
],
|
||||
[
|
||||
"2020-12-15",
|
||||
"803.00",
|
||||
"0.00"
|
||||
],
|
||||
[
|
||||
"2021-01-13",
|
||||
"803.00",
|
||||
"0"
|
||||
],
|
||||
[
|
||||
"2021-02-16",
|
||||
"803.00",
|
||||
"0"
|
||||
],
|
||||
[
|
||||
"2021-03-22",
|
||||
"0",
|
||||
"32.12"
|
||||
],
|
||||
[
|
||||
"2021-04-14",
|
||||
"803.00",
|
||||
"0.00"
|
||||
],
|
||||
[
|
||||
"2021-05-18",
|
||||
"803.00",
|
||||
"0"
|
||||
],
|
||||
[
|
||||
"2021-06-15",
|
||||
"803.00",
|
||||
"0"
|
||||
],
|
||||
[
|
||||
"2021-07-31",
|
||||
"0",
|
||||
"32.12"
|
||||
],
|
||||
[
|
||||
"2021-08-18",
|
||||
"803",
|
||||
"0.00",
|
||||
"False"
|
||||
],
|
||||
[
|
||||
"2021-09-24",
|
||||
"803",
|
||||
"0.00",
|
||||
"False"
|
||||
],
|
||||
[
|
||||
"2021-09-25",
|
||||
"0",
|
||||
"0.00",
|
||||
"False"
|
||||
]
|
||||
],
|
||||
"borrower": {
|
||||
"city": "Alexandria",
|
||||
"state": "VA",
|
||||
"name": "Bear Houses, LLC",
|
||||
"zip": "22312",
|
||||
"address": "301 N Beauregard St Apt 203"
|
||||
},
|
||||
"txtTemplate": "statement.txt.jinja"
|
||||
}
|
||||
@@ -1,128 +0,0 @@
|
||||
{
|
||||
"htmlTemplate": "statement.pdf.jinja",
|
||||
"parameters": {
|
||||
"monthly_payment": 831.0,
|
||||
"interest_rate": 5.5,
|
||||
"start_interest_date": "2021-10-13",
|
||||
"payment_day_of_month": "15",
|
||||
"first_payment_month": "2021-11-15",
|
||||
"account_number": "21-0004",
|
||||
"periods": 180,
|
||||
"start_date": "2021-10-13",
|
||||
"periods_per_year": 12,
|
||||
"principal": 101123.26
|
||||
},
|
||||
"format": "html",
|
||||
"email": {
|
||||
"body": "Your loan statement is attached.",
|
||||
"to_address": "grady@gradystreet.com",
|
||||
"from_address": "jkent3rd@gmail.com",
|
||||
"text": "Please see your most recent account statement.",
|
||||
"server": "smtp.gmail.com",
|
||||
"send_text": "true",
|
||||
"template": "./template.txt",
|
||||
"send_pdf": "true",
|
||||
"password": "builcuouzobxroow",
|
||||
"subject": "Your loan statement..."
|
||||
},
|
||||
"lender": {
|
||||
"city": "Washington",
|
||||
"name": "Rivanna Graphite Investments, LLC",
|
||||
"zip": "20001",
|
||||
"phone": "703.343.0782",
|
||||
"state": "DC",
|
||||
"address": "1720 New Jersey Ave NW Unit 401"
|
||||
},
|
||||
"header": {
|
||||
"date": "Today",
|
||||
"title": "Mortgage Loan Statement - 195 Greenfield Lane, Pearl MS"
|
||||
},
|
||||
"payments": [
|
||||
[
|
||||
"2021-10-14",
|
||||
"803",
|
||||
"0.00",
|
||||
"False"
|
||||
],
|
||||
[
|
||||
"2021-10-14",
|
||||
"28",
|
||||
"0.00",
|
||||
"False"
|
||||
],
|
||||
[
|
||||
"2021-10-18",
|
||||
"28",
|
||||
"0.00",
|
||||
"False"
|
||||
],
|
||||
[
|
||||
"2021-11-16",
|
||||
"803.00",
|
||||
"0.00",
|
||||
"False"
|
||||
],
|
||||
[
|
||||
"2021-11-19",
|
||||
"28",
|
||||
"0.00",
|
||||
"False"
|
||||
],
|
||||
[
|
||||
"2022-02-10",
|
||||
"831",
|
||||
"0.00",
|
||||
"False"
|
||||
],
|
||||
[
|
||||
"2022-04-04",
|
||||
"1000",
|
||||
"55.00",
|
||||
"False"
|
||||
],
|
||||
[
|
||||
"2022-05-15",
|
||||
"0",
|
||||
"0.00",
|
||||
"False"
|
||||
],
|
||||
[
|
||||
"2022-06-15",
|
||||
"0",
|
||||
"0.00",
|
||||
"False"
|
||||
],
|
||||
[
|
||||
"2022-07-15",
|
||||
"0",
|
||||
"0.00",
|
||||
"False"
|
||||
],
|
||||
[
|
||||
"2022-07-26",
|
||||
"803",
|
||||
"0.00",
|
||||
"False"
|
||||
],
|
||||
[
|
||||
"2022-08-12",
|
||||
"0",
|
||||
"0.00",
|
||||
"False"
|
||||
],
|
||||
[
|
||||
"2022-08-12",
|
||||
"101508.04",
|
||||
"0.00",
|
||||
"False"
|
||||
]
|
||||
],
|
||||
"borrower": {
|
||||
"city": "Alexandria",
|
||||
"state": "VA",
|
||||
"name": "Bear Houses, LLC",
|
||||
"zip": "22312",
|
||||
"address": "301 N Beauregard St Apt 203"
|
||||
},
|
||||
"txtTemplate": "statement.txt.jinja"
|
||||
}
|
||||
@@ -1,50 +0,0 @@
|
||||
{
|
||||
"htmlTemplate": "statement.pdf.jinja",
|
||||
"parameters": {
|
||||
"monthly_payment": 848,
|
||||
"interest_rate": 5.75,
|
||||
"start_interest_date": "2022-08-12",
|
||||
"payment_day_of_month": "15",
|
||||
"first_payment_month": "2022-09-15",
|
||||
"account_number": "22-0001",
|
||||
"periods": 180,
|
||||
"start_date": "2022-08-12",
|
||||
"periods_per_year": 12,
|
||||
"principal": 101508.04
|
||||
},
|
||||
"format": "html",
|
||||
"email": {
|
||||
"body": "Your loan statement is attached.",
|
||||
"to_address": "grady@gradystreet.com",
|
||||
"from_address": "jkent3rd@gmail.com",
|
||||
"text": "Please see your most recent account statement.",
|
||||
"server": "smtp.gmail.com",
|
||||
"send_text": "true",
|
||||
"template": "./template.txt",
|
||||
"send_pdf": "true",
|
||||
"password": "builcuouzobxroow",
|
||||
"subject": "Your loan statement..."
|
||||
},
|
||||
"lender": {
|
||||
"city": "Washington",
|
||||
"name": "Rivanna Graphite Investments, LLC",
|
||||
"zip": "20001",
|
||||
"phone": "703.343.0782",
|
||||
"state": "DC",
|
||||
"address": "1720 New Jersey Ave NW Unit 401"
|
||||
},
|
||||
"header": {
|
||||
"date": "Today",
|
||||
"title": "Mortgage Loan Statement - Harbor Bend Loan 1"
|
||||
},
|
||||
"payments": [
|
||||
],
|
||||
"borrower": {
|
||||
"city": "Alexandria",
|
||||
"state": "VA",
|
||||
"name": "Bear Houses, LLC",
|
||||
"zip": "22312",
|
||||
"address": "301 N Beauregard St Apt 203"
|
||||
},
|
||||
"txtTemplate": "statement.txt.jinja"
|
||||
}
|
||||
@@ -1,137 +0,0 @@
|
||||
{
|
||||
"htmlTemplate": "statement.pdf.jinja",
|
||||
"parameters": {
|
||||
"monthly_payment": 175.55,
|
||||
"interest_rate": 4.5,
|
||||
"start_interest_date": "2020-07-15",
|
||||
"payment_day_of_month": "15",
|
||||
"first_payment_month": "2020-08-15",
|
||||
"account_number": "100003",
|
||||
"periods": 60,
|
||||
"start_date": "2020-07-15",
|
||||
"periods_per_year": 12,
|
||||
"principal": 16884
|
||||
},
|
||||
"format": "html",
|
||||
"email": {
|
||||
"body": "Your loan statement is attached.",
|
||||
"to_address": "grady@gradystreet.com",
|
||||
"from_address": "jkent3rd@gmail.com",
|
||||
"text": "Please see your most recent account statement.",
|
||||
"server": "smtp.gmail.com",
|
||||
"send_text": "true",
|
||||
"template": "./template.txt",
|
||||
"send_pdf": "true",
|
||||
"password": "builcuouzobxroow",
|
||||
"subject": "Your loan statement..."
|
||||
},
|
||||
"lender": {
|
||||
"city": "Washington",
|
||||
"name": "Rivanna Graphite Investments, LLC",
|
||||
"zip": "20008",
|
||||
"phone": "703.343.0782",
|
||||
"state": "DC",
|
||||
"address": "3100 Connecticut Ave NW Apt 144"
|
||||
},
|
||||
"header": {
|
||||
"date": "Today",
|
||||
"title": "Mortgage Loan Statement - 5025 Wayneland Drive Apt D11 Jackson MS 39211"
|
||||
},
|
||||
"payments": [
|
||||
[
|
||||
"2020-08-27",
|
||||
"175.55"
|
||||
],
|
||||
[
|
||||
"2020-09-30",
|
||||
"175.55"
|
||||
],
|
||||
[
|
||||
"2020-10-19",
|
||||
"175.55",
|
||||
"0.00"
|
||||
],
|
||||
[
|
||||
"2020-12-01",
|
||||
"0",
|
||||
"17.55"
|
||||
],
|
||||
[
|
||||
"2020-12-29",
|
||||
"0",
|
||||
"17.55"
|
||||
],
|
||||
[
|
||||
"2021-01-20",
|
||||
"175.55",
|
||||
"0"
|
||||
],
|
||||
[
|
||||
"2021-02-15",
|
||||
"0.00",
|
||||
"17.55"
|
||||
],
|
||||
[
|
||||
"2021-03-12",
|
||||
"175.55",
|
||||
"0.00"
|
||||
],
|
||||
[
|
||||
"2021-04-15",
|
||||
"0",
|
||||
"17.55"
|
||||
],
|
||||
[
|
||||
"2021-05-17",
|
||||
"0",
|
||||
"17.55"
|
||||
],
|
||||
[
|
||||
"2021-06-30",
|
||||
"0",
|
||||
"0.00"
|
||||
],
|
||||
[
|
||||
"2021-07-29",
|
||||
"175.55",
|
||||
"17.55"
|
||||
],
|
||||
[
|
||||
"2021-08-09",
|
||||
"175.55",
|
||||
"0"
|
||||
],
|
||||
[
|
||||
"2021-08-10",
|
||||
"175.55",
|
||||
"0",
|
||||
"extra"
|
||||
],
|
||||
[
|
||||
"2021-09-03",
|
||||
"175.55",
|
||||
"0.00",
|
||||
"False"
|
||||
],
|
||||
[
|
||||
"2021-09-17",
|
||||
"175.55",
|
||||
"0.00",
|
||||
"False"
|
||||
],
|
||||
[
|
||||
"2021-09-18",
|
||||
"0",
|
||||
"0.00",
|
||||
"False"
|
||||
]
|
||||
],
|
||||
"borrower": {
|
||||
"city": "Alexandria",
|
||||
"state": "VA",
|
||||
"name": "Bear Houses, LLC",
|
||||
"zip": "22312",
|
||||
"address": "301 N Beauregard St Apt 203"
|
||||
},
|
||||
"txtTemplate": "statement.txt.jinja"
|
||||
}
|
||||
@@ -17,6 +17,6 @@
|
||||
<tr><td>{{message}}</td></tr>
|
||||
{% endfor %}
|
||||
</table>
|
||||
<a href="/?loan={{filename}}">Return to Main Screen</a>.
|
||||
<a href="/?loan={{document_id}}">Return to Main Screen</a>.
|
||||
</body>
|
||||
</html>
|
||||
@@ -13,7 +13,7 @@
|
||||
<p id="header" align="center"><font face="Arial" size=+2 >Web Mortgage Manager</font></p>
|
||||
|
||||
<p> The email has been sent.</p>
|
||||
<a href="/?loan={{filename}}">Return to Main Screen</a>.
|
||||
<a href="/?loan={{document_id}}">Return to Main Screen</a>.
|
||||
|
||||
</body>
|
||||
</html>
|
||||
@@ -16,10 +16,10 @@
|
||||
<td>
|
||||
<select name="loan" id="loan">
|
||||
{% for loan in loans %}
|
||||
{% if loan.filename==filename %}
|
||||
<option value="{{loan.filename}}" selected>{{loan.name}}</option>
|
||||
{% if loan.document_id==document_id %}
|
||||
<option value="{{loan.document_id}}" selected>{{loan.name}}</option>
|
||||
{% else %}
|
||||
<option value="{{loan.filename}}">{{loan.name}}</option>
|
||||
<option value="{{loan.document_id}}">{{loan.name}}</option>
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
</select>
|
||||
@@ -44,8 +44,8 @@
|
||||
<li><a href="#loan_history">Loan History</a></li>
|
||||
<li><a href="#loan_amortization">Future Amortization</a></li>
|
||||
<li><a href="#email">Email Statement</a></li>
|
||||
<li><a href="#add_payment">Add Payment</a></li>
|
||||
<li><a href="#add_extra_payment">Add Payment</a></li>
|
||||
<li><a href="#add_payment">Add a Regular Payment</a></li>
|
||||
<li><a href="#add_extra_payment">Add an Extra Payment</a></li>
|
||||
</ul>
|
||||
<div id="loan_information">
|
||||
<table align="center" border="1px">
|
||||
@@ -163,12 +163,12 @@
|
||||
</td></tr>
|
||||
<tr><td><button>Send Statement</button></td></tr>
|
||||
</table>
|
||||
<input type="hidden" name='loan' value="{{filename}}" />
|
||||
<input type="hidden" name='loan' value="{{document_id}}" />
|
||||
</form>
|
||||
</div>
|
||||
<div id="add_payment">
|
||||
<form name="AddPayment" method="post" action="/update_file">
|
||||
<input type="hidden" name="loan" value="{{filename}}" />
|
||||
<input type="hidden" name="loan" value="{{document_id}}" />
|
||||
<table align="center" border="1px" width="75%">
|
||||
<tr><td align="center" bgcolor="darkgrey">Record a Payment</td></tr>
|
||||
<tr><td bgcolor="beige">Payment Date:</td></tr>
|
||||
@@ -184,7 +184,7 @@
|
||||
</div>
|
||||
<div id="add_extra_payment">
|
||||
<form name="AddExtraPayment" method="post" action="/update_file">
|
||||
<input type="hidden" name="loan" value="{{filename}}" />
|
||||
<input type="hidden" name="loan" value="{{document_id}}" />
|
||||
<table align="center" border="1px" width="75%">
|
||||
<tr><td align="center" bgcolor="darkgrey">Record an Extra Payment</td></tr>
|
||||
<tr><td bgcolor="beige">Payment Date:</td></tr>
|
||||
|
||||
108
mortgage/web.py
108
mortgage/web.py
@@ -10,9 +10,12 @@ from email.mime.multipart import MIMEMultipart
|
||||
from email.mime.text import MIMEText
|
||||
from email.mime.base import MIMEBase
|
||||
from email import encoders
|
||||
import couchdb
|
||||
|
||||
couch = couchdb.Server('https://admin:ams19230@couch.jkent.org:443/')
|
||||
database = couch['mortgage']
|
||||
|
||||
module_directory = os.path.dirname(__file__)
|
||||
app_directory = os.path.normpath(os.path.join(module_directory, ".."))
|
||||
loader = jinja2.FileSystemLoader([os.path.join(module_directory, "templates")])
|
||||
environment = jinja2.Environment(loader=loader)
|
||||
app = Flask(__name__)
|
||||
@@ -24,31 +27,31 @@ app = Flask(__name__)
|
||||
|
||||
@app.route('/')
|
||||
def hello():
|
||||
loans = getLoanFiles(app_directory)
|
||||
loans = getLoanFiles(database)
|
||||
|
||||
#if a loan was not specified, choose the first loan and reload page with it
|
||||
if 'loan' in request.args:
|
||||
filename = request.args["loan"]
|
||||
document_id = request.args["loan"]
|
||||
else:
|
||||
return redirect('/?loan=' + loans[0]['filename'])
|
||||
return redirect('/?loan=' + loans[0]['document_id'])
|
||||
|
||||
loan = loadLoanInformation(getFullPathOfLoanFile(filename))
|
||||
loan = loadLoanInformation(document_id)
|
||||
amortizeLoan(loan)
|
||||
|
||||
return render_template('main.html', filename=filename, loans=loans, model=loan)
|
||||
return render_template('main.html', document_id=document_id, loans=loans, model=loan)
|
||||
|
||||
|
||||
@app.route('/update_file', methods=['POST'])
|
||||
def update_file():
|
||||
messages = []
|
||||
|
||||
loanFile = request.form["loan"]
|
||||
data = getDatastore(getFullPathOfLoanFile(loanFile))
|
||||
document_id = request.form["loan"]
|
||||
document = getDatastore(document_id)
|
||||
|
||||
late_fee = Decimal('0.00').quantize(Decimal('1.00'))
|
||||
extra_payment = False
|
||||
payment_amount = Decimal('0.00').quantize(Decimal('1.00'))
|
||||
payment_history = data["payments"]
|
||||
payment_history = document["payments"]
|
||||
todays_date = str(datetime.now().strftime("%Y-%m-%d"))
|
||||
if 'date' in request.form:
|
||||
if request.form['date'] == '':
|
||||
@@ -88,44 +91,25 @@ def update_file():
|
||||
extra_payment = True
|
||||
|
||||
if proceed_flag is True:
|
||||
try:
|
||||
backup_filename = loanFile + ".backup-" + datetime.now().strftime("%Y-%m-%d %H-%M-%S") + ".json"
|
||||
backup_file = open(getFullPathOfLoanFile(backup_filename), 'w+')
|
||||
json.dump(data, backup_file, indent=2)
|
||||
backup_file.close()
|
||||
except:
|
||||
messages.append("A backup file could not be created. Your payment was not recorded.")
|
||||
proceed_flag = False
|
||||
else:
|
||||
messages.append("A backup of your file was created: '" + backup_filename + "'")
|
||||
|
||||
if proceed_flag is True:
|
||||
try:
|
||||
payment_history.append([payment_date, str(payment_amount), str(late_fee), str(extra_payment)])
|
||||
file = open(getFullPathOfLoanFile(loanFile), 'w+')
|
||||
json.dump(data, file, indent=2)
|
||||
file.close()
|
||||
except:
|
||||
messages.append("An error occurred writing to the file. Your payment file may be corrupt, " +
|
||||
"please consider rolling back to the backup created above.")
|
||||
else:
|
||||
messages.append("The payment was successfully written. ")
|
||||
payment_history.append([payment_date, str(payment_amount), str(late_fee), str(extra_payment)])
|
||||
database[document_id]=document
|
||||
messages.append("The payment was successfully written. ")
|
||||
|
||||
# see if an email notification was requested, if not, exit now
|
||||
if 'notify' not in request.form:
|
||||
messages.append("Payment notification email not requested.")
|
||||
return render_template('add.html', filename=loanFile, messages=messages)
|
||||
return render_template('add.html', document_id=document_id, messages=messages)
|
||||
|
||||
messages.append("Payment notification email requested.")
|
||||
# send email
|
||||
emailParameters = data["email"]
|
||||
emailParameters = document["email"]
|
||||
result = {}
|
||||
payment = {}
|
||||
result['payment'] = payment
|
||||
payment['today'] = todays_date
|
||||
payment['date'] = payment_date
|
||||
payment['payer'] = data['borrower']['name']
|
||||
payment['payee'] = data['lender']['name']
|
||||
payment['payer'] = document['borrower']['name']
|
||||
payment['payee'] = document['lender']['name']
|
||||
payment['amount'] = payment_amount
|
||||
payment['late_fee'] = late_fee
|
||||
payment['extra_payment'] = extra_payment
|
||||
@@ -135,16 +119,16 @@ def update_file():
|
||||
msg = generatePaymentNotificationEmail(emailParameters["from_address"], emailParameters["to_address"],
|
||||
subject, html)
|
||||
sendEmail(msg, emailParameters["from_address"], emailParameters["to_address"], emailParameters['password'])
|
||||
return render_template('add.html', filename=loanFile, messages=messages)
|
||||
return render_template('add.html', document_id=document_id, messages=messages)
|
||||
|
||||
|
||||
@app.route('/send_statement', methods=['POST'])
|
||||
def send_statement():
|
||||
loanFile = request.form["loan"]
|
||||
document_id = request.form["loan"]
|
||||
subject = request.form["subject"]
|
||||
message = request.form["message"]
|
||||
|
||||
loan = loadLoanInformation(getFullPathOfLoanFile(loanFile))
|
||||
loan = loadLoanInformation(document_id)
|
||||
amortizeLoan(loan)
|
||||
|
||||
reportCreated = False
|
||||
@@ -172,7 +156,7 @@ def send_statement():
|
||||
|
||||
sendEmail(msg, emailParameters["from_address"], emailParameters["to_address"], emailParameters['password'])
|
||||
|
||||
return render_template('email.html', filename=loanFile)
|
||||
return render_template('email.html', document_id=document_id)
|
||||
|
||||
|
||||
######
|
||||
@@ -181,37 +165,27 @@ def send_statement():
|
||||
|
||||
|
||||
def getLoanFiles(directory):
|
||||
#iterate over each of the documents found in the mortgage couchdb
|
||||
#database and pull their display name
|
||||
loans = []
|
||||
|
||||
directory = os.path.normpath(directory)
|
||||
print("Directory {}".format(directory))
|
||||
fileNames = os.listdir(directory)
|
||||
fileNames.sort()
|
||||
for filename in fileNames:
|
||||
if filename.endswith(".loan"):
|
||||
displayName = filename.removesuffix(".loan").replace("_"," ")
|
||||
loans.append(createLoanEntryMenuItem("{0}".format(displayName), filename))
|
||||
for document_id in database:
|
||||
document = database[document_id]
|
||||
displayName = document['displayName']
|
||||
loans.append(createLoanEntryMenuItem(displayName, document_id))
|
||||
|
||||
return loans
|
||||
|
||||
def createLoanEntryMenuItem(loanName, fileName):
|
||||
def createLoanEntryMenuItem(loanName, document_id):
|
||||
x = {}
|
||||
x['name'] = loanName
|
||||
x['filename'] = fileName
|
||||
x['document_id'] = document_id
|
||||
return x
|
||||
|
||||
def getFullPathOfLoanFile(filename):
|
||||
app_path = os.path.dirname(__file__)
|
||||
file_path = os.path.normpath(os.path.join(os.path.dirname(__file__),'..'))
|
||||
print("App Path: {0}\nFile Path: {1}".format(app_path, file_path))
|
||||
return os.path.join(file_path, filename)
|
||||
|
||||
|
||||
######
|
||||
# Datastore Manipulation Functions
|
||||
######
|
||||
|
||||
|
||||
def getStatementHeader(datastore):
|
||||
return datastore['header']
|
||||
|
||||
@@ -220,8 +194,8 @@ def getEmailInformation(datastore):
|
||||
return datastore['email']
|
||||
|
||||
|
||||
def loadLoanInformation(filename):
|
||||
datastore = getDatastore(filename)
|
||||
def loadLoanInformation(document_id):
|
||||
datastore = getDatastore(document_id)
|
||||
|
||||
loanModel = {}
|
||||
loanModel['datastore'] = datastore
|
||||
@@ -273,18 +247,11 @@ def getBorrower(datastore):
|
||||
return datastore['borrower']
|
||||
|
||||
|
||||
def getDatastore(filename=None):
|
||||
try:
|
||||
if filename:
|
||||
with open(filename, 'r') as f:
|
||||
datastore = json.load(f)
|
||||
|
||||
except Exception as e:
|
||||
print("An error occurred opening your loan file '%s'. " % filename)
|
||||
print("The Exception:")
|
||||
print(e.__repr__())
|
||||
quit()
|
||||
def getDatastore(document_id=None):
|
||||
if document_id == None:
|
||||
quit("Invalid document.")
|
||||
|
||||
datastore = database[document_id]
|
||||
return datastore
|
||||
|
||||
######
|
||||
@@ -479,7 +446,6 @@ def generatePaymentNotificationEmail(from_address, to_address, subject, html):
|
||||
msg['From'] = from_address
|
||||
msg['To'] = to_address
|
||||
|
||||
#msg.attach(MIMEText(body))
|
||||
part = MIMEBase("text", "html")
|
||||
part.set_payload(html)
|
||||
encoders.encode_base64(part)
|
||||
|
||||
Reference in New Issue
Block a user