qrtr-services/qrtr_account/dummy_data/fill_transactions.py

680 lines
18 KiB
Python

from qrtr_account.models import Transaction
from datetime import datetime
null = None
false = False
true = True
transactions = [
{
"account_id": "9rpy6BK7NeiqLAPNyyPVsxpgRVawWntRpMX5q",
"account_owner": null,
"amount": 500,
"authorized_date": null,
"category": [
"Travel",
"Airlines and Aviation Services"
],
"category_id": "22001000",
"date": "2020-03-31",
"iso_currency_code": "USD",
"location": {
"address": null,
"city": null,
"country": null,
"lat": null,
"lon": null,
"postal_code": null,
"region": null,
"store_number": null
},
"name": "United Airlines",
"payment_channel": "in store",
"payment_meta": {
"by_order_of": null,
"payee": null,
"payer": null,
"payment_method": null,
"payment_processor": null,
"ppd_id": null,
"reason": null,
"reference_number": null
},
"pending": false,
"pending_transaction_id": null,
"transaction_code": null,
"transaction_id": "MqedPko4Gxhpmrw9MMwqS1yZZWjVmmc9JGd8x",
"transaction_type": "special",
"unofficial_currency_code": null
},
{
"account_id": "bE4Py7gXQlh1pQVGeeVnhXlAdeoDq5uVXrMdG",
"account_owner": null,
"amount": 6.33,
"authorized_date": null,
"category": [
"Travel",
"Taxi"
],
"category_id": "22016000",
"date": "2020-03-29",
"iso_currency_code": "USD",
"location": {
"address": null,
"city": null,
"country": null,
"lat": null,
"lon": null,
"postal_code": null,
"region": null,
"store_number": null
},
"name": "Uber",
"payment_channel": "in store",
"payment_meta": {
"by_order_of": null,
"payee": null,
"payer": null,
"payment_method": null,
"payment_processor": null,
"ppd_id": null,
"reason": null,
"reference_number": null
},
"pending": false,
"pending_transaction_id": null,
"transaction_code": null,
"transaction_id": "apaN7j9XyAf58dVK33V1HBdGG9aPvvc7BVAx5",
"transaction_type": "special",
"unofficial_currency_code": null
},
{
"account_id": "9rpy6BK7NeiqLAPNyyPVsxpgRVawWntRpMX5q",
"account_owner": null,
"amount": 500,
"authorized_date": null,
"category": [
"Food and Drink",
"Restaurants"
],
"category_id": "13005000",
"date": "2020-03-26",
"iso_currency_code": "USD",
"location": {
"address": null,
"city": null,
"country": null,
"lat": null,
"lon": null,
"postal_code": null,
"region": null,
"store_number": null
},
"name": "Tectra Inc",
"payment_channel": "in store",
"payment_meta": {
"by_order_of": null,
"payee": null,
"payer": null,
"payment_method": null,
"payment_processor": null,
"ppd_id": null,
"reason": null,
"reference_number": null
},
"pending": false,
"pending_transaction_id": null,
"transaction_code": null,
"transaction_id": "1Zj7WnmV3xFQ9oz7JJzpsQA77oEvaas58EAGR",
"transaction_type": "place",
"unofficial_currency_code": null
},
{
"account_id": "9rpy6BK7NeiqLAPNyyPVsxpgRVawWntRpMX5q",
"account_owner": null,
"amount": 2078.5,
"authorized_date": null,
"category": [
"Payment"
],
"category_id": "16000000",
"date": "2020-03-25",
"iso_currency_code": "USD",
"location": {
"address": null,
"city": null,
"country": null,
"lat": null,
"lon": null,
"postal_code": null,
"region": null,
"store_number": null
},
"name": "AUTOMATIC PAYMENT - THANK",
"payment_channel": "other",
"payment_meta": {
"by_order_of": null,
"payee": null,
"payer": null,
"payment_method": null,
"payment_processor": null,
"ppd_id": null,
"reason": null,
"reference_number": null
},
"pending": false,
"pending_transaction_id": null,
"transaction_code": null,
"transaction_id": "oEgdyA9DNjhbek8G668lH8jnnQVq99cRdGWnB",
"transaction_type": "special",
"unofficial_currency_code": null
},
{
"account_id": "9rpy6BK7NeiqLAPNyyPVsxpgRVawWntRpMX5q",
"account_owner": null,
"amount": 500,
"authorized_date": null,
"category": [
"Food and Drink",
"Restaurants",
"Fast Food"
],
"category_id": "13005032",
"date": "2020-03-25",
"iso_currency_code": "USD",
"location": {
"address": null,
"city": null,
"country": null,
"lat": null,
"lon": null,
"postal_code": null,
"region": null,
"store_number": null
},
"name": "KFC",
"payment_channel": "in store",
"payment_meta": {
"by_order_of": null,
"payee": null,
"payer": null,
"payment_method": null,
"payment_processor": null,
"ppd_id": null,
"reason": null,
"reference_number": null
},
"pending": false,
"pending_transaction_id": null,
"transaction_code": null,
"transaction_id": "pw8kAG9Dp7fRjk8EWW8qClyNNwB8XXtLZ8ANq",
"transaction_type": "place",
"unofficial_currency_code": null
},
{
"account_id": "9rpy6BK7NeiqLAPNyyPVsxpgRVawWntRpMX5q",
"account_owner": null,
"amount": 500,
"authorized_date": null,
"category": [
"Shops",
"Sporting Goods"
],
"category_id": "19046000",
"date": "2020-03-25",
"iso_currency_code": "USD",
"location": {
"address": null,
"city": null,
"country": null,
"lat": null,
"lon": null,
"postal_code": null,
"region": null,
"store_number": null
},
"name": "Madison Bicycle Shop",
"payment_channel": "in store",
"payment_meta": {
"by_order_of": null,
"payee": null,
"payer": null,
"payment_method": null,
"payment_processor": null,
"ppd_id": null,
"reason": null,
"reference_number": null
},
"pending": false,
"pending_transaction_id": null,
"transaction_code": null,
"transaction_id": "Ll7xP8oay3fLeKGbmmGlSGazzoRZEESPXdVy5",
"transaction_type": "place",
"unofficial_currency_code": null
},
{
"account_id": "myp3AEbDZNsb86vEMMvdHkGnzml5docLD8VWL",
"account_owner": null,
"amount": 25,
"authorized_date": null,
"category": [
"Payment",
"Credit Card"
],
"category_id": "16001000",
"date": "2020-03-16",
"iso_currency_code": "USD",
"location": {
"address": null,
"city": null,
"country": null,
"lat": null,
"lon": null,
"postal_code": null,
"region": null,
"store_number": null
},
"name": "CREDIT CARD 3333 PAYMENT *//",
"payment_channel": "other",
"payment_meta": {
"by_order_of": null,
"payee": null,
"payer": null,
"payment_method": null,
"payment_processor": null,
"ppd_id": null,
"reason": null,
"reference_number": null
},
"pending": false,
"pending_transaction_id": null,
"transaction_code": null,
"transaction_id": "eEjewZ1XQrho4PVGvvVzS4rnnw6kWWiL4eolg",
"transaction_type": "special",
"unofficial_currency_code": null
},
{
"account_id": "bE4Py7gXQlh1pQVGeeVnhXlAdeoDq5uVXrMdG",
"account_owner": null,
"amount": 5.4,
"authorized_date": null,
"category": [
"Travel",
"Taxi"
],
"category_id": "22016000",
"date": "2020-03-16",
"iso_currency_code": "USD",
"location": {
"address": null,
"city": null,
"country": null,
"lat": null,
"lon": null,
"postal_code": null,
"region": null,
"store_number": null
},
"name": "Uber",
"payment_channel": "in store",
"payment_meta": {
"by_order_of": null,
"payee": null,
"payer": null,
"payment_method": null,
"payment_processor": null,
"ppd_id": null,
"reason": null,
"reference_number": null
},
"pending": false,
"pending_transaction_id": null,
"transaction_code": null,
"transaction_id": "4LQyZlGbj4i8aoX5nnX4sgErrPyK88IdQ4jwy",
"transaction_type": "special",
"unofficial_currency_code": null
},
{
"account_id": "vXzelKAD9Lu79KvEppvNSEwrjzPD67IWMV9En",
"account_owner": null,
"amount": 5850,
"authorized_date": null,
"category": [
"Transfer",
"Debit"
],
"category_id": "21006000",
"date": "2020-03-15",
"iso_currency_code": "USD",
"location": {
"address": null,
"city": null,
"country": null,
"lat": null,
"lon": null,
"postal_code": null,
"region": null,
"store_number": null
},
"name": "ACH Electronic CreditGUSTO PAY 123456",
"payment_channel": "other",
"payment_meta": {
"by_order_of": null,
"payee": null,
"payer": null,
"payment_method": "ACH",
"payment_processor": null,
"ppd_id": null,
"reason": null,
"reference_number": null
},
"pending": false,
"pending_transaction_id": null,
"transaction_code": null,
"transaction_id": "8KLyZzqmV7FlqrNw88N4i9bDDoNgXXfwbekVx",
"transaction_type": "special",
"unofficial_currency_code": null
},
{
"account_id": "yqxJrB5KzghpdBw9yywPSGVAv3JQy7hyzp7l4",
"account_owner": null,
"amount": 1000,
"authorized_date": null,
"category": [
"Transfer",
"Deposit"
],
"category_id": "21007000",
"date": "2020-03-15",
"iso_currency_code": "USD",
"location": {
"address": null,
"city": null,
"country": null,
"lat": null,
"lon": null,
"postal_code": null,
"region": null,
"store_number": null
},
"name": "CD DEPOSIT .INITIAL.",
"payment_channel": "other",
"payment_meta": {
"by_order_of": null,
"payee": null,
"payer": null,
"payment_method": null,
"payment_processor": null,
"ppd_id": null,
"reason": null,
"reference_number": null
},
"pending": false,
"pending_transaction_id": null,
"transaction_code": null,
"transaction_id": "Z7KzB3eMDLfneQVk99VmSBdkkj1PWWcg69dDR",
"transaction_type": "special",
"unofficial_currency_code": null
},
{
"account_id": "9rpy6BK7NeiqLAPNyyPVsxpgRVawWntRpMX5q",
"account_owner": null,
"amount": 78.5,
"authorized_date": null,
"category": [
"Recreation",
"Gyms and Fitness Centers"
],
"category_id": "17018000",
"date": "2020-03-14",
"iso_currency_code": "USD",
"location": {
"address": null,
"city": null,
"country": null,
"lat": null,
"lon": null,
"postal_code": null,
"region": null,
"store_number": null
},
"name": "Touchstone Climbing",
"payment_channel": "in store",
"payment_meta": {
"by_order_of": null,
"payee": null,
"payer": null,
"payment_method": null,
"payment_processor": null,
"ppd_id": null,
"reason": null,
"reference_number": null
},
"pending": false,
"pending_transaction_id": null,
"transaction_code": null,
"transaction_id": "g9el71kXZBiwZNVEPPVvTvGkkXQMeeFgxdvQj",
"transaction_type": "place",
"unofficial_currency_code": null
},
{
"account_id": "bE4Py7gXQlh1pQVGeeVnhXlAdeoDq5uVXrMdG",
"account_owner": null,
"amount": -500,
"authorized_date": null,
"category": [
"Travel",
"Airlines and Aviation Services"
],
"category_id": "22001000",
"date": "2020-03-14",
"iso_currency_code": "USD",
"location": {
"address": null,
"city": null,
"country": null,
"lat": null,
"lon": null,
"postal_code": null,
"region": null,
"store_number": null
},
"name": "United Airlines",
"payment_channel": "other",
"payment_meta": {
"by_order_of": null,
"payee": null,
"payer": null,
"payment_method": null,
"payment_processor": null,
"ppd_id": null,
"reason": null,
"reference_number": null
},
"pending": false,
"pending_transaction_id": null,
"transaction_code": null,
"transaction_id": "NKQaPWgNbdForzbwllbXSqkNNlgnLLHW4kPq4",
"transaction_type": "special",
"unofficial_currency_code": null
},
{
"account_id": "bE4Py7gXQlh1pQVGeeVnhXlAdeoDq5uVXrMdG",
"account_owner": null,
"amount": 12,
"authorized_date": null,
"category": [
"Food and Drink",
"Restaurants",
"Fast Food"
],
"category_id": "13005032",
"date": "2020-03-13",
"iso_currency_code": "USD",
"location": {
"address": null,
"city": null,
"country": null,
"lat": null,
"lon": null,
"postal_code": null,
"region": null,
"store_number": "3322"
},
"name": "McDonald's",
"payment_channel": "in store",
"payment_meta": {
"by_order_of": null,
"payee": null,
"payer": null,
"payment_method": null,
"payment_processor": null,
"ppd_id": null,
"reason": null,
"reference_number": null
},
"pending": false,
"pending_transaction_id": null,
"transaction_code": null,
"transaction_id": "PzMN7GoWX4cnG3yb99yzS9vmm3rKWWf7PVpr4",
"transaction_type": "place",
"unofficial_currency_code": null
},
{
"account_id": "bE4Py7gXQlh1pQVGeeVnhXlAdeoDq5uVXrMdG",
"account_owner": null,
"amount": 4.33,
"authorized_date": null,
"category": [
"Food and Drink",
"Restaurants",
"Coffee Shop"
],
"category_id": "13005043",
"date": "2020-03-13",
"iso_currency_code": "USD",
"location": {
"address": null,
"city": null,
"country": null,
"lat": null,
"lon": null,
"postal_code": null,
"region": null,
"store_number": null
},
"name": "Starbucks",
"payment_channel": "in store",
"payment_meta": {
"by_order_of": null,
"payee": null,
"payer": null,
"payment_method": null,
"payment_processor": null,
"ppd_id": null,
"reason": null,
"reference_number": null
},
"pending": false,
"pending_transaction_id": null,
"transaction_code": null,
"transaction_id": "jEMr7oP5Xdhb87v9ppvLHVGggK8Nzzu1Vlr8X",
"transaction_type": "place",
"unofficial_currency_code": null
},
{
"account_id": "bE4Py7gXQlh1pQVGeeVnhXlAdeoDq5uVXrMdG",
"account_owner": null,
"amount": 89.4,
"authorized_date": null,
"category": [
"Food and Drink",
"Restaurants"
],
"category_id": "13005000",
"date": "2020-03-12",
"iso_currency_code": "USD",
"location": {
"address": null,
"city": null,
"country": null,
"lat": null,
"lon": null,
"postal_code": null,
"region": null,
"store_number": null
},
"name": "SparkFun",
"payment_channel": "in store",
"payment_meta": {
"by_order_of": null,
"payee": null,
"payer": null,
"payment_method": null,
"payment_processor": null,
"ppd_id": null,
"reason": null,
"reference_number": null
},
"pending": false,
"pending_transaction_id": null,
"transaction_code": null,
"transaction_id": "7q1yXrlb3jh8wA4v994VsJabbQk4eefgor7KW",
"transaction_type": "place",
"unofficial_currency_code": null
},
{
"account_id": "myp3AEbDZNsb86vEMMvdHkGnzml5docLD8VWL",
"account_owner": null,
"amount": -4.22,
"authorized_date": null,
"category": [
"Transfer",
"Credit"
],
"category_id": "21005000",
"date": "2020-03-11",
"iso_currency_code": "USD",
"location": {
"address": null,
"city": null,
"country": null,
"lat": null,
"lon": null,
"postal_code": null,
"region": null,
"store_number": null
},
"name": "INTRST PYMNT",
"payment_channel": "other",
"payment_meta": {
"by_order_of": null,
"payee": null,
"payer": null,
"payment_method": null,
"payment_processor": null,
"ppd_id": null,
"reason": null,
"reference_number": null
},
"pending": false,
"pending_transaction_id": null,
"transaction_code": null,
"transaction_id": "QB1PZnmMgNfn3xXe99XoS53AAe4rJJtp5RqWg",
"transaction_type": "special",
"unofficial_currency_code": null
}
]
print(len(transactions))
for transaction in transactions:
bank = Bank.objects.filter(acc_id=transaction.get("account_id",[None]))[0]
print(bank)
if bank:
fields = {
"datetime":datetime.strptime(transaction.get("date"),"%Y-%m-%d"),
"details":transaction
}
Transaction.objects.update_or_create(Bank=bank,defaults=fields)