mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2025-05-31 08:44:35 -04:00
Bank integration
This commit is contained in:
parent
67494e691b
commit
5a2a2cce4a
@ -154,7 +154,6 @@ class Yodlee
|
|||||||
$at = new AccountTransformer();
|
$at = new AccountTransformer();
|
||||||
nlog($response->object());
|
nlog($response->object());
|
||||||
return $at->transform($response->object());
|
return $at->transform($response->object());
|
||||||
// return $response->object();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if($response->failed())
|
if($response->failed())
|
||||||
|
@ -66,4 +66,18 @@ class YodleeController extends BaseController
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function refreshAccounts(YodleeAdminRequest $request)
|
||||||
|
{
|
||||||
|
|
||||||
|
$token = auth()->user()->account->bank_integration_account_id;
|
||||||
|
|
||||||
|
if(!$token)
|
||||||
|
return response()->json(['message' => 'No bank integrations are present. Please add a bank account. '],400);
|
||||||
|
|
||||||
|
$yodlee = new Yodlee($token);
|
||||||
|
$yodlee->setTestMode();
|
||||||
|
|
||||||
|
$yodlee->getAccounts();
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -40,23 +40,23 @@ class BankIntegrationTransformer extends EntityTransformer
|
|||||||
];
|
];
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param Account $bank_integration
|
* @param BankIntegration $bank_integration
|
||||||
*
|
|
||||||
*
|
|
||||||
* @return array
|
* @return array
|
||||||
*/
|
*/
|
||||||
public function transform(BankIntegration $bank_integration)
|
public function transform(BankIntegration $bank_integration)
|
||||||
{
|
{
|
||||||
return [
|
return [
|
||||||
'id' => (string) $this->encodePrimaryKey($bank_integration->id),
|
'id' => (string) $this->encodePrimaryKey($bank_integration->id),
|
||||||
'provider_bank_name' => $bank_integration->provider_bank_name ?: '',
|
'provider_bank_name' => (string)$bank_integration->provider_bank_name ?: '',
|
||||||
'bank_account_id' => $bank_integration->bank_account_id ?: '',
|
'provider_id' => (int) $bank_integration->provider_id ?: 0,
|
||||||
'bank_account_name' => $bank_integration->bank_account_name ?: '',
|
'bank_account_id' => (int) $bank_integration->bank_account_id ?: 0,
|
||||||
'bank_account_number' => $bank_integration->bank_account_number ?: '',
|
'bank_account_name' => (string) $bank_integration->bank_account_name ?: '',
|
||||||
'bank_account_status' => $bank_integration->bank_account_status ?: '',
|
'bank_account_number' => (string) $bank_integration->bank_account_number ?: '',
|
||||||
'bank_account_type' => $bank_integration->bank_account_type ?: '',
|
'bank_account_status' => (string)$bank_integration->bank_account_status ?: '',
|
||||||
|
'bank_account_type' => (string)$bank_integration->bank_account_type ?: '',
|
||||||
'balance' => (float)$bank_integration->balance ?: 0,
|
'balance' => (float)$bank_integration->balance ?: 0,
|
||||||
'currency' => $bank_integration->currency ?: '',
|
'currency' => (string)$bank_integration->currency ?: '',
|
||||||
|
'nickname' => (string)$bank_integration->nickname ?: '',
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -13,7 +13,7 @@ return new class extends Migration
|
|||||||
*/
|
*/
|
||||||
public function up()
|
public function up()
|
||||||
{
|
{
|
||||||
|
|
||||||
Schema::create('bank_integrations', function (Blueprint $table) {
|
Schema::create('bank_integrations', function (Blueprint $table) {
|
||||||
$table->id();
|
$table->id();
|
||||||
$table->unsignedInteger('account_id');
|
$table->unsignedInteger('account_id');
|
||||||
@ -21,13 +21,17 @@ return new class extends Migration
|
|||||||
$table->unsignedInteger('user_id');
|
$table->unsignedInteger('user_id');
|
||||||
|
|
||||||
$table->text('provider_bank_name'); //providerName ie Chase
|
$table->text('provider_bank_name'); //providerName ie Chase
|
||||||
$table->bigInteger('bank_account_id'); //id
|
$table->bigUnsignedInteger('provider_id'); //id of the bank
|
||||||
|
$table->bigUnsignedInteger('bank_account_id'); //id
|
||||||
$table->text('bank_account_name')->nullable(); //accountName
|
$table->text('bank_account_name')->nullable(); //accountName
|
||||||
$table->text('bank_account_number')->nullable(); //accountNumber
|
$table->text('bank_account_number')->nullable(); //accountNumber
|
||||||
$table->text('bank_account_status')->nullable(); //accountStatus
|
$table->text('bank_account_status')->nullable(); //accountStatus
|
||||||
$table->text('bank_account_type')->nullable(); //CONTAINER
|
$table->text('bank_account_type')->nullable(); //CONTAINER
|
||||||
$table->decimal('balance', 20, 6)->default(0); //currentBalance.amount
|
$table->decimal('balance', 20, 6)->default(0); //currentBalance.amount
|
||||||
$table->text('currency')->nullable(); //currentBalance.currency
|
$table->text('currency')->nullable(); //currentBalance.currency
|
||||||
|
$table->text('nickname')->default(''); //accountName
|
||||||
|
|
||||||
|
$table->boolean('is_deleted')->default(0);
|
||||||
|
|
||||||
$table->timestamps(6);
|
$table->timestamps(6);
|
||||||
$table->softDeletes('deleted_at', 6);
|
$table->softDeletes('deleted_at', 6);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user