mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2025-05-24 02:14:21 -04:00
Additional functionality for bank integrations
This commit is contained in:
parent
2ffc4cb68d
commit
237725a9c8
@ -566,9 +566,17 @@ class BankIntegrationController extends BaseController
|
||||
$bank_integration->currency = $account['account_currency'];
|
||||
|
||||
$bank_integration->save();
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
$account = auth()->user()->account;
|
||||
|
||||
$account->bank_integrations->each(function ($bank_integration) use ($account){
|
||||
|
||||
ProcessBankTransactions::dispatch($account->bank_integration_account_id, $bank_integration);
|
||||
|
||||
});
|
||||
|
||||
return response()->json(BankIntegration::query()->company(), 200);
|
||||
}
|
||||
|
@ -94,6 +94,10 @@ class TwilioController extends BaseController
|
||||
|
||||
if($verification_check->status == 'approved'){
|
||||
|
||||
if($request->query('validate_only') == 'true')
|
||||
return response()->json(['message' => 'SMS verified'], 200);
|
||||
|
||||
|
||||
$account->account_sms_verified = true;
|
||||
$account->save();
|
||||
|
||||
|
@ -33,7 +33,8 @@ class StoreBankIntegrationRequest extends Request
|
||||
{
|
||||
|
||||
$rules = [
|
||||
'bank_account_name' => 'required|min:3'
|
||||
'bank_account_name' => 'required|min:3',
|
||||
'auto_sync' => 'sometimes|bool'
|
||||
];
|
||||
|
||||
return $rules;
|
||||
|
@ -31,7 +31,9 @@ class UpdateBankIntegrationRequest extends Request
|
||||
public function rules()
|
||||
{
|
||||
/* Ensure we have a client name, and that all emails are unique*/
|
||||
$rules = [];
|
||||
$rules = [
|
||||
'auto_sync' => 'sometimes|bool'
|
||||
];
|
||||
|
||||
return $rules;
|
||||
}
|
||||
|
@ -60,7 +60,7 @@ class BankTransactionSync implements ShouldQueue
|
||||
|
||||
public function syncTransactions()
|
||||
{
|
||||
$a = Account::with('bank_integrations')->whereNotNull('bank_integration_account_id')->cursor()->each(function ($account){
|
||||
$a = Account::with('bank_integrations')->where('auto_sync', true)->whereNotNull('bank_integration_account_id')->cursor()->each(function ($account){
|
||||
|
||||
// $queue = Ninja::isHosted() ? 'bank' : 'default';
|
||||
|
||||
|
@ -27,6 +27,7 @@ class BankIntegration extends BaseModel
|
||||
'currency',
|
||||
'nickname',
|
||||
'from_date',
|
||||
'auto_sync',
|
||||
];
|
||||
|
||||
protected $dates = [
|
||||
|
@ -61,6 +61,7 @@ class BankIntegrationTransformer extends EntityTransformer
|
||||
'from_date' => (string)$bank_integration->from_date ?: '',
|
||||
'is_deleted' => (bool) $bank_integration->is_deleted,
|
||||
'disabled_upstream' => (bool) $bank_integration->disabled_upstream,
|
||||
'auto_sync' => (bool)$bank_integration->auto_sync,
|
||||
'created_at' => (int) $bank_integration->created_at,
|
||||
'updated_at' => (int) $bank_integration->updated_at,
|
||||
'archived_at' => (int) $bank_integration->deleted_at,
|
||||
|
@ -25,6 +25,10 @@ return new class extends Migration
|
||||
Schema::table('backups', function (Blueprint $table) {
|
||||
$table->string('disk')->nullable();
|
||||
});
|
||||
|
||||
Schema::table('bank_integrations', function (Blueprint $table) {
|
||||
$table->boolean('auto_sync')->default(false);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -109,7 +109,7 @@ Route::group(['middleware' => ['throttle:10,1','api_secret_check','email_db']],
|
||||
Route::group(['middleware' => ['throttle:300,1', 'api_db', 'token_auth', 'locale'], 'prefix' => 'api/v1', 'as' => 'api.'], function () {
|
||||
Route::put('accounts/{account}', [AccountController::class, 'update'])->name('account.update');
|
||||
Route::resource('bank_integrations', BankIntegrationController::class); // name = (clients. index / create / show / update / destroy / edit
|
||||
Route::post('bank_integrations/refresh_accounts', [BankIntegrationController::class, 'refreshAccounts'])->name('bank_integrations.refresh_accounts');
|
||||
Route::post('bank_integrations/refresh_accounts', [BankIntegrationController::class, 'refreshAccounts'])->name('bank_integrations.refresh_accounts')->middleware('throttle:1,1');
|
||||
Route::post('bank_integrations/remove_account/{acc_id}', [BankIntegrationController::class, 'removeAccount'])->name('bank_integrations.remove_account');
|
||||
Route::post('bank_integrations/get_transactions/{acc_id}', [BankIntegrationController::class, 'getTransactions'])->name('bank_integrations.transactions')->middleware('throttle:1,1');
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user