qrtr-services/qrtr_account/dummy_data/fill_banks.py
2020-05-06 18:40:43 -06:00

147 lines
4.2 KiB
Python
Executable File

from qrtr_account.models import Account, Institution, Bank
from connection.models import Connection
dummy_ac = Account.objects.all()[0]
dummy_isnt = Institution.objects.all()[0]
dummy_bank = Bank.objects.all()[0]
conn_dummy = Connection.objects.all()[0]
accounts= [
{
"account_id": "bE4Py7gXQlh1pQVGeeVnhXlAdeoDq5uVXrMdG",
"balances": {
"available": 100,
"current": 110,
"iso_currency_code": "USD",
"limit": None,
"unofficial_currency_code": None
},
"mask": "0000",
"name": "Plaid Checking",
"official_name": "Plaid Gold Standard 0% Interest Checking",
"subtype": "checking",
"type": "depository"
},
{
"account_id": "myp3AEbDZNsb86vEMMvdHkGnzml5docLD8VWL",
"balances": {
"available": 200,
"current": 210,
"iso_currency_code": "USD",
"limit": None,
"unofficial_currency_code": None
},
"mask": "1111",
"name": "Plaid Saving",
"official_name": "Plaid Silver Standard 0.1% Interest Saving",
"subtype": "savings",
"type": "depository"
},
{
"account_id": "yqxJrB5KzghpdBw9yywPSGVAv3JQy7hyzp7l4",
"balances": {
"available": None,
"current": 1000,
"iso_currency_code": "USD",
"limit": None,
"unofficial_currency_code": None
},
"mask": "2222",
"name": "Plaid CD",
"official_name": "Plaid Bronze Standard 0.2% Interest CD",
"subtype": "cd",
"type": "depository"
},
{
"account_id": "9rpy6BK7NeiqLAPNyyPVsxpgRVawWntRpMX5q",
"balances": {
"available": None,
"current": 410,
"iso_currency_code": "USD",
"limit": 2000,
"unofficial_currency_code": None
},
"mask": "3333",
"name": "Plaid Credit Card",
"official_name": "Plaid Diamond 12.5% APR Interest Credit Card",
"subtype": "credit card",
"type": "credit"
},
{
"account_id": "vXzelKAD9Lu79KvEppvNSEwrjzPD67IWMV9En",
"balances": {
"available": 43200,
"current": 43200,
"iso_currency_code": "USD",
"limit": None,
"unofficial_currency_code": None
},
"mask": "4444",
"name": "Plaid Money Market",
"official_name": "Plaid Platinum Standard 1.85% Interest Money Market",
"subtype": "money market",
"type": "depository"
},
{
"account_id": "R3LjGboMXPTrxdoQzzo3Ud413EPWXRFRg5mBG",
"balances": {
"available": None,
"current": 320.76,
"iso_currency_code": "USD",
"limit": None,
"unofficial_currency_code": None
},
"mask": "5555",
"name": "Plaid IRA",
"official_name": None,
"subtype": "ira",
"type": "investment"
},
{
"account_id": "6lMyvKd6NPf8xAaBkkaLsnwJXDKApgFgBnVyG",
"balances": {
"available": None,
"current": 23631.9805,
"iso_currency_code": "USD",
"limit": None,
"unofficial_currency_code": None
},
"mask": "6666",
"name": "Plaid 401k",
"official_name": None,
"subtype": "401k",
"type": "investment"
},
{
"account_id": "XPlKrkBGEMimr7Gb44GNIQvlMP1NnZIdm8w39",
"balances": {
"available": None,
"current": 65262,
"iso_currency_code": "USD",
"limit": None,
"unofficial_currency_code": None
},
"mask": "7777",
"name": "Plaid Student Loan",
"official_name": None,
"subtype": "student",
"type": "loan"
}
]
for account in accounts:
fields = {
"connection":conn_dummy,
"institution_id":dummy_isnt.id,
"nickname":account.get("name"),
"official_name":account.get("official_name"),
"mask":account.get("mask"),
"ac_type":account.get("type"),
"ac_subtype":account.get("subtype"),
"balance":account.get("balances",{}).get("current"),
"balance_limit":account.get("balances",{}).get("limit")
}
Bank.objects.update_or_create(qrtr_account=dummy_ac, acc_id=account.get("account_id"),
defaults=fields)