2022-08-05 06:25:06 +02:00
|
|
|
<?php
|
|
|
|
/**
|
|
|
|
* Invoice Ninja (https://invoiceninja.com).
|
|
|
|
*
|
|
|
|
* @link https://github.com/invoiceninja/invoiceninja source repository
|
|
|
|
*
|
2024-04-12 06:15:41 +02:00
|
|
|
* @copyright Copyright (c) 2024. Invoice Ninja LLC (https://invoiceninja.com)
|
2022-08-05 06:25:06 +02:00
|
|
|
*
|
|
|
|
* @license https://www.elastic.co/licensing/elastic-license
|
|
|
|
*/
|
|
|
|
|
|
|
|
namespace App\Models;
|
|
|
|
|
2022-08-11 06:19:35 +02:00
|
|
|
use Illuminate\Database\Eloquent\SoftDeletes;
|
|
|
|
|
2023-03-08 08:33:42 +01:00
|
|
|
/**
|
|
|
|
* App\Models\BankIntegration
|
|
|
|
*
|
|
|
|
* @property int $id
|
|
|
|
* @property int $account_id
|
|
|
|
* @property int $company_id
|
|
|
|
* @property int $user_id
|
2023-12-11 09:23:35 +01:00
|
|
|
* @property string $integration_type
|
2023-03-08 08:33:42 +01:00
|
|
|
* @property string $provider_name
|
|
|
|
* @property int $provider_id
|
|
|
|
* @property int $bank_account_id
|
|
|
|
* @property string|null $bank_account_name
|
|
|
|
* @property string|null $bank_account_number
|
|
|
|
* @property string|null $bank_account_status
|
|
|
|
* @property string|null $bank_account_type
|
2023-08-01 14:36:04 +02:00
|
|
|
* @property float $balance
|
|
|
|
* @property int|null $currency
|
2023-03-08 08:33:42 +01:00
|
|
|
* @property string $nickname
|
2023-12-11 09:23:35 +01:00
|
|
|
* @property string $nordigen_account_id
|
2023-12-11 16:13:26 +01:00
|
|
|
* @property string $nordigen_institution_id
|
2023-03-08 08:33:42 +01:00
|
|
|
* @property string|null $from_date
|
2023-08-01 14:36:04 +02:00
|
|
|
* @property bool $is_deleted
|
2023-03-08 08:33:42 +01:00
|
|
|
* @property int|null $created_at
|
|
|
|
* @property int|null $updated_at
|
|
|
|
* @property int|null $deleted_at
|
2023-04-28 03:39:41 +02:00
|
|
|
* @property bool $disabled_upstream
|
|
|
|
* @property bool $auto_sync
|
2023-03-08 08:33:42 +01:00
|
|
|
* @property-read \App\Models\Account $account
|
|
|
|
* @property-read \App\Models\Company $company
|
|
|
|
* @property-read mixed $hashed_id
|
|
|
|
* @property-read \Illuminate\Database\Eloquent\Collection<int, \App\Models\BankTransaction> $transactions
|
|
|
|
* @property-read int|null $transactions_count
|
|
|
|
* @property-read \App\Models\User $user
|
|
|
|
* @method static \Illuminate\Database\Eloquent\Builder|BaseModel exclude($columns)
|
|
|
|
* @method static \Database\Factories\BankIntegrationFactory factory($count = null, $state = [])
|
|
|
|
* @method static \Illuminate\Database\Eloquent\Builder|BankIntegration filter(\App\Filters\QueryFilters $filters)
|
|
|
|
* @method static \Illuminate\Database\Eloquent\Builder|BankIntegration newModelQuery()
|
|
|
|
* @method static \Illuminate\Database\Eloquent\Builder|BankIntegration newQuery()
|
|
|
|
* @method static \Illuminate\Database\Eloquent\Builder|BankIntegration onlyTrashed()
|
|
|
|
* @method static \Illuminate\Database\Eloquent\Builder|BankIntegration query()
|
|
|
|
* @method static \Illuminate\Database\Eloquent\Builder|BaseModel scope()
|
|
|
|
* @method static \Illuminate\Database\Eloquent\Builder|BankIntegration withTrashed()
|
|
|
|
* @method static \Illuminate\Database\Eloquent\Builder|BankIntegration withoutTrashed()
|
2023-03-16 05:20:38 +01:00
|
|
|
* @property-read \Illuminate\Database\Eloquent\Collection<int, \App\Models\BankTransaction> $transactions
|
2023-03-08 08:33:42 +01:00
|
|
|
* @mixin \Eloquent
|
|
|
|
*/
|
2022-08-05 06:25:06 +02:00
|
|
|
class BankIntegration extends BaseModel
|
|
|
|
{
|
2022-08-11 06:19:35 +02:00
|
|
|
use SoftDeletes;
|
2022-11-11 00:13:11 +01:00
|
|
|
use Filterable;
|
2023-11-30 16:00:50 +01:00
|
|
|
|
2022-08-05 06:25:06 +02:00
|
|
|
protected $fillable = [
|
2022-09-29 11:43:59 +02:00
|
|
|
'bank_account_name',
|
|
|
|
'provider_name',
|
|
|
|
'bank_account_number',
|
|
|
|
'bank_account_status',
|
|
|
|
'bank_account_type',
|
|
|
|
'balance',
|
|
|
|
'currency',
|
|
|
|
'from_date',
|
2022-11-08 11:48:29 +01:00
|
|
|
'auto_sync',
|
2022-08-05 06:25:06 +02:00
|
|
|
];
|
|
|
|
|
2024-01-14 05:05:00 +01:00
|
|
|
public const INTEGRATION_TYPE_YODLEE = 'YODLEE';
|
2023-11-30 16:00:50 +01:00
|
|
|
|
2024-01-14 05:05:00 +01:00
|
|
|
public const INTEGRATION_TYPE_NORDIGEN = 'NORDIGEN';
|
2023-11-30 16:00:50 +01:00
|
|
|
|
2022-08-05 06:25:06 +02:00
|
|
|
public function getEntityType()
|
|
|
|
{
|
|
|
|
return self::class;
|
|
|
|
}
|
|
|
|
|
|
|
|
public function company()
|
|
|
|
{
|
|
|
|
return $this->belongsTo(Company::class);
|
|
|
|
}
|
|
|
|
|
|
|
|
public function user()
|
|
|
|
{
|
|
|
|
return $this->belongsTo(User::class)->withTrashed();
|
|
|
|
}
|
|
|
|
|
|
|
|
public function account()
|
|
|
|
{
|
2022-09-14 10:52:17 +02:00
|
|
|
return $this->belongsTo(Account::class);
|
2022-08-05 06:25:06 +02:00
|
|
|
}
|
|
|
|
|
2022-08-12 03:40:35 +02:00
|
|
|
public function transactions()
|
|
|
|
{
|
|
|
|
return $this->hasMany(BankTransaction::class)->withTrashed();
|
|
|
|
}
|
2023-11-30 16:00:50 +01:00
|
|
|
}
|