Working on bank transactions

This commit is contained in:
David Bomba 2022-09-14 08:54:59 +10:00
parent 654460758d
commit 17cb8b1b94
3 changed files with 15 additions and 7 deletions

View File

@ -37,11 +37,10 @@ class ProcessBankTransactions implements ShouldQueue
/**
* Create a new job instance.
*/
public function __construct(string $bank_integration_account_id, BankIntegration $bank_integration, string $from_date = '2022-01-01')
public function __construct(string $bank_integration_account_id, BankIntegration $bank_integration)
{
$this->bank_integration_account_id = $bank_integration_account_id;
$this->bank_integration = $bank_integration;
$this->from_date = $from_date;
}
/**
@ -54,6 +53,8 @@ class ProcessBankTransactions implements ShouldQueue
{
//Loop through everything until we are up to date
$this->from_date = $this->from_date ?: '2021-01-01';
do{
$this->processTransactions();
}
@ -73,9 +74,16 @@ class ProcessBankTransactions implements ShouldQueue
'accountId' => $this->bank_integration->bank_account_id,
];
nlog($data);
$transaction_count = $yodlee->getTransactionCount($data);
nlog($transaction_count);
$count = $transaction_count->transaction->TOTAL->count;
nlog($count);
//expense transactions
$transactions = $yodlee->getTransactions($data);

View File

@ -44,9 +44,9 @@ class BankTransactionSync implements ShouldQueue
*/
public function handle()
{
if (! Ninja::isHosted()) {
return;
}
// if (! Ninja::isHosted()) {
// return;
// }
//multiDB environment, need to
foreach (MultiDB::$dbs as $db) {

View File

@ -362,9 +362,9 @@ class Account extends BaseModel
'plan_price' => $price,
'trial' => false,
'plan' => $plan,
'started' => DateTime::createFromFormat('Y-m-d', $this->plan_started),
'started' => $this->plan_started ? DateTime::createFromFormat('Y-m-d', $this->plan_started) : false,
'expires' => $plan_expires,
'paid' => DateTime::createFromFormat('Y-m-d', $this->plan_paid),
'paid' => $this->plan_paid ? DateTime::createFromFormat('Y-m-d', $this->plan_paid) : false,
'term' => $this->plan_term,
'active' => $plan_active,
];