mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2025-05-24 02:14:21 -04:00
Stubs for bank integration
This commit is contained in:
parent
6dd9f7302d
commit
1be1a80437
74
app/Helpers/Bank/Yodlee/Transformer/AccountTransformer.php
Normal file
74
app/Helpers/Bank/Yodlee/Transformer/AccountTransformer.php
Normal file
@ -0,0 +1,74 @@
|
||||
<?php
|
||||
/**
|
||||
* Invoice Ninja (https://invoiceninja.com).
|
||||
*
|
||||
* @link https://github.com/invoiceninja/invoiceninja source repository
|
||||
*
|
||||
* @copyright Copyright (c) 2022. Invoice Ninja LLC (https://invoiceninja.com)
|
||||
*
|
||||
* @license https://www.elastic.co/licensing/elastic-license
|
||||
*/
|
||||
|
||||
namespace App\Helpers\Bank\Yodlee\Transformer;
|
||||
|
||||
/**
|
||||
[account] => Array
|
||||
(
|
||||
[0] => stdClass Object
|
||||
(
|
||||
[CONTAINER] => bank
|
||||
[providerAccountId] => 11308693
|
||||
[accountName] => My CD - 8878
|
||||
[accountStatus] => ACTIVE
|
||||
[accountNumber] => xxxx8878
|
||||
[aggregationSource] => USER
|
||||
[isAsset] => 1
|
||||
[balance] => stdClass Object
|
||||
(
|
||||
[currency] => USD
|
||||
[amount] => 49778.07
|
||||
)
|
||||
|
||||
[id] => 12331861
|
||||
[includeInNetWorth] => 1
|
||||
[providerId] => 18769
|
||||
[providerName] => Dag Site Captcha
|
||||
[isManual] =>
|
||||
[currentBalance] => stdClass Object
|
||||
(
|
||||
[currency] => USD
|
||||
[amount] => 49778.07
|
||||
)
|
||||
|
||||
[accountType] => CD
|
||||
[displayedName] => LORETTA
|
||||
[createdDate] => 2022-07-28T06:55:33Z
|
||||
[lastUpdated] => 2022-07-28T06:56:09Z
|
||||
[dataset] => Array
|
||||
(
|
||||
[0] => stdClass Object
|
||||
(
|
||||
[name] => BASIC_AGG_DATA
|
||||
[additionalStatus] => AVAILABLE_DATA_RETRIEVED
|
||||
[updateEligibility] => ALLOW_UPDATE
|
||||
[lastUpdated] => 2022-07-28T06:55:50Z
|
||||
[lastUpdateAttempt] => 2022-07-28T06:55:50Z
|
||||
)
|
||||
|
||||
)
|
||||
|
||||
)
|
||||
)
|
||||
*/
|
||||
|
||||
class AccountTransformer
|
||||
{
|
||||
|
||||
public static function transform(array $account)
|
||||
{
|
||||
return [
|
||||
];
|
||||
}
|
||||
}
|
||||
|
||||
|
42
app/Http/Controllers/BankIntegrationController.php
Normal file
42
app/Http/Controllers/BankIntegrationController.php
Normal file
@ -0,0 +1,42 @@
|
||||
<?php
|
||||
/**
|
||||
* Invoice Ninja (https://invoiceninja.com).
|
||||
*
|
||||
* @link https://github.com/invoiceninja/invoiceninja source repository
|
||||
*
|
||||
* @copyright Copyright (c) 2022. Invoice Ninja LLC (https://invoiceninja.com)
|
||||
*
|
||||
* @license https://www.elastic.co/licensing/elastic-license
|
||||
*/
|
||||
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
use App\Http\Requests\Activity\DownloadHistoricalEntityRequest;
|
||||
use App\Models\Activity;
|
||||
use App\Transformers\ActivityTransformer;
|
||||
use App\Utils\HostedPDF\NinjaPdf;
|
||||
use App\Utils\Ninja;
|
||||
use App\Utils\PhantomJS\Phantom;
|
||||
use App\Utils\Traits\Pdf\PageNumbering;
|
||||
use App\Utils\Traits\Pdf\PdfMaker;
|
||||
use Illuminate\Http\JsonResponse;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Http\Response;
|
||||
use Illuminate\Support\Facades\Storage;
|
||||
use stdClass;
|
||||
use Symfony\Component\HttpFoundation\StreamedResponse;
|
||||
|
||||
class BankIntegrationController extends BaseController
|
||||
{
|
||||
|
||||
protected $entity_type = BankIntegration::class;
|
||||
|
||||
protected $entity_transformer = BankIntegrationTransformer::class;
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
}
|
||||
|
||||
|
||||
}
|
49
app/Models/BankIntegration.php
Normal file
49
app/Models/BankIntegration.php
Normal file
@ -0,0 +1,49 @@
|
||||
<?php
|
||||
/**
|
||||
* Invoice Ninja (https://invoiceninja.com).
|
||||
*
|
||||
* @link https://github.com/invoiceninja/invoiceninja source repository
|
||||
*
|
||||
* @copyright Copyright (c) 2022. Invoice Ninja LLC (https://invoiceninja.com)
|
||||
*
|
||||
* @license https://www.elastic.co/licensing/elastic-license
|
||||
*/
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
class BankIntegration extends BaseModel
|
||||
{
|
||||
|
||||
protected $fillable = [
|
||||
];
|
||||
|
||||
protected $dates = [
|
||||
];
|
||||
|
||||
protected $casts = [
|
||||
'updated_at' => 'timestamp',
|
||||
'created_at' => 'timestamp',
|
||||
'deleted_at' => 'timestamp',
|
||||
];
|
||||
|
||||
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()
|
||||
{
|
||||
return $this->belongsTo(Account::class)->withTrashed();
|
||||
}
|
||||
|
||||
}
|
77
app/Transformers/BankIntegrationTransformer.php
Normal file
77
app/Transformers/BankIntegrationTransformer.php
Normal file
@ -0,0 +1,77 @@
|
||||
<?php
|
||||
/**
|
||||
* Invoice Ninja (https://invoiceninja.com).
|
||||
*
|
||||
* @link https://github.com/invoiceninja/invoiceninja source repository
|
||||
*
|
||||
* @copyright Copyright (c) 2022. Invoice Ninja LLC (https://invoiceninja.com)
|
||||
*
|
||||
* @license https://www.elastic.co/licensing/elastic-license
|
||||
*/
|
||||
|
||||
namespace App\Transformers;
|
||||
|
||||
use App\Models\Account;
|
||||
use App\Models\BankIntegration;
|
||||
use App\Utils\Traits\MakesHash;
|
||||
|
||||
/**
|
||||
* Class BankIntegrationTransformer.
|
||||
*/
|
||||
class BankIntegrationTransformer extends EntityTransformer
|
||||
{
|
||||
use MakesHash;
|
||||
|
||||
/**
|
||||
* @var array
|
||||
*/
|
||||
protected $defaultIncludes = [
|
||||
//'default_company',
|
||||
//'user',
|
||||
//'company_users'
|
||||
];
|
||||
|
||||
/**
|
||||
* @var array
|
||||
*/
|
||||
protected $availableIncludes = [
|
||||
'company',
|
||||
'account',
|
||||
];
|
||||
|
||||
/**
|
||||
* @param Account $bank_integration
|
||||
*
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function transform(BankIntegration $bank_integration)
|
||||
{
|
||||
return [
|
||||
'id' => (string) $this->encodePrimaryKey($bank_integration->id),
|
||||
'provider_bank_name' => $bank_integration->provider_bank_name ?: '',
|
||||
'bank_account_id' => $bank_integration->bank_account_id ?: '',
|
||||
'bank_account_name' => $bank_integration->bank_account_name ?: '',
|
||||
'bank_account_number' => $bank_integration->bank_account_number ?: '',
|
||||
'bank_account_status' => $bank_integration->bank_account_status ?: '',
|
||||
'bank_account_type' => $bank_integration->bank_account_type ?: '',
|
||||
'balance' => (float)$bank_integration->balance ?: 0,
|
||||
'currency' => $bank_integration->currency ?: '',
|
||||
];
|
||||
}
|
||||
|
||||
public function includeAccount(BankIntegration $bank_integration)
|
||||
{
|
||||
$transformer = new AccountTransformer($this->serializer);
|
||||
|
||||
return $this->includeItem($bank_integration->account, $transformer, Account::class);
|
||||
}
|
||||
|
||||
public function includeCompany(BankIntegration $bank_integration)
|
||||
{
|
||||
$transformer = new CompanyTransformer($this->serializer);
|
||||
|
||||
return $this->includeItem($bank_integration->company, $transformer, Company::class);
|
||||
}
|
||||
|
||||
}
|
@ -14,24 +14,21 @@ return new class extends Migration
|
||||
public function up()
|
||||
{
|
||||
|
||||
Schema::table('bank_integration', function (Blueprint $table) {
|
||||
Schema::create('bank_integrations', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->unsignedInteger('account_id');
|
||||
$table->unsignedInteger('company_id');
|
||||
$table->unsignedInteger('user_id');
|
||||
|
||||
$table->string('account_type')->nullable();
|
||||
// $table->bigInteger('bank_account_id'); //providerAccountId
|
||||
// $table->bigInteger('bank_id'); //providerId
|
||||
$table->text('bank_name'); //providerName
|
||||
$table->text('account_name')->nullable(); //accountName
|
||||
$table->text('account_number')->nullable(); //accountNumber
|
||||
$table->text('account_status')->nullable(); //accountStatus
|
||||
$table->text('account_type')->nullable(); //CONTAINER
|
||||
$table->text('provider_bank_name'); //providerName ie Chase
|
||||
$table->bigInteger('bank_account_id'); //id
|
||||
$table->text('bank_account_name')->nullable(); //accountName
|
||||
$table->text('bank_account_number')->nullable(); //accountNumber
|
||||
$table->text('bank_account_status')->nullable(); //accountStatus
|
||||
$table->text('bank_account_type')->nullable(); //CONTAINER
|
||||
$table->decimal('balance', 20, 6)->default(0); //currentBalance.amount
|
||||
$table->text('currency')->nullable(); //currentBalance.currency
|
||||
|
||||
$table->
|
||||
$table->timestamps(6);
|
||||
$table->softDeletes('deleted_at', 6);
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user