mirror of
https://gitlab.com/CIEFWorldwideSdnBhd/exchange-2.0.git
synced 2026-08-27 00:13:59 +00:00
Merge branch 'debtor' into 'development'
bank log See merge request CIEFWorldwideSdnBhd/exchange-2.0!97
This commit is contained in:
@@ -6,6 +6,7 @@ use App\Classes\General\Abstracts\AbstractControllerLogic;
|
||||
|
||||
use App\Classes\Modules\Banks\Standards\Rules\CanCreateBank;
|
||||
use App\Classes\Modules\Banks\Services\CreatesBank;
|
||||
use App\Classes\Modules\Banks\Services\CreatesBankLog;
|
||||
use App\Classes\Modules\Banks\DataTransferObjects\BankObject;
|
||||
use App\Http\Resources\BankResource;
|
||||
|
||||
@@ -32,19 +33,24 @@ class CreateBankLogic extends AbstractControllerLogic
|
||||
/** @var CreatesBank */
|
||||
private $createsBank;
|
||||
|
||||
/** @var CreatesBankLog */
|
||||
private $createsBankLog;
|
||||
|
||||
/**
|
||||
* CreateBankLogic constructor.
|
||||
* @param CanCreateBank $canCreateBank
|
||||
* @param CreatesBank $createsBank
|
||||
* @param CreatesBankLog $createsBankLog
|
||||
*/
|
||||
public function __construct(
|
||||
CanCreateBank $canCreateBank,
|
||||
CreatesBank $createsBank
|
||||
CreatesBank $createsBank,
|
||||
CreatesBankLog $createsBankLog
|
||||
)
|
||||
{
|
||||
$this->canCreateBank = $canCreateBank;
|
||||
$this->createsBank = $createsBank;
|
||||
$this->createsBankLog = $createsBankLog;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -56,7 +62,6 @@ class CreateBankLogic extends AbstractControllerLogic
|
||||
*/
|
||||
public function logic(Request $request) : JsonResponse
|
||||
{
|
||||
|
||||
$bank_object = new BankObject($request->input('company_id'), $request->input('account_type'),
|
||||
$request->input('bank_name'), $request->input('holder_name'), $request->input('account_no'),
|
||||
$request->input('bank_branch'), $request->input('swift'), $request->input('snap'),
|
||||
@@ -66,6 +71,8 @@ class CreateBankLogic extends AbstractControllerLogic
|
||||
|
||||
$bank = $this->createsBank->execute($bank_object);
|
||||
|
||||
$bankLog = $this->createsBankLog->execute($bank);
|
||||
|
||||
return $this->resourceResponse(new BankResource($bank));
|
||||
|
||||
}
|
||||
|
||||
@@ -7,6 +7,7 @@ use App\Classes\General\Abstracts\AbstractControllerLogic;
|
||||
use App\Classes\Modules\Banks\Services\FetchesBank;
|
||||
use App\Classes\Modules\Banks\Standards\Rules\CanDeleteBank;
|
||||
use App\Classes\Modules\Banks\Services\DeletesBank;
|
||||
use App\Classes\Modules\Banks\Services\CreatesBankLog;
|
||||
use App\Http\Resources\BankResource;
|
||||
use Illuminate\Http\JsonResponse;
|
||||
use Illuminate\Http\Request;
|
||||
@@ -33,22 +34,27 @@ class DeleteBankLogic extends AbstractControllerLogic
|
||||
/** @var FetchesBank */
|
||||
private $fetchesBank;
|
||||
|
||||
/** @var CreatesBankLog */
|
||||
private $createsBankLog;
|
||||
|
||||
/**
|
||||
* DeleteBankLogic constructor.
|
||||
* @param CanDeleteBank $canDeleteBank
|
||||
* @param DeletesBank $deletesBank
|
||||
* @param FetchesBank $fetchesBank
|
||||
* @param CreatesBankLog $createsBankLog
|
||||
*/
|
||||
public function __construct(
|
||||
CanDeleteBank $canDeleteBank,
|
||||
DeletesBank $deletesBank,
|
||||
FetchesBank $fetchesBank
|
||||
FetchesBank $fetchesBank,
|
||||
CreatesBankLog $createsBankLog
|
||||
)
|
||||
{
|
||||
$this->canDeleteBank = $canDeleteBank;
|
||||
$this->deletesBank = $deletesBank;
|
||||
$this->fetchesBank = $fetchesBank;
|
||||
$this->createsBankLog = $createsBankLog;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -69,7 +75,9 @@ class DeleteBankLogic extends AbstractControllerLogic
|
||||
throw new RequestValidationException('You can\'t delete bank account when it set to default');
|
||||
}
|
||||
|
||||
$this->deletesBank->execute($bank);
|
||||
$bank = $this->deletesBank->execute($bank);
|
||||
|
||||
$bankLog = $this->createsBankLog->execute($bank);
|
||||
|
||||
return $this->response([]);
|
||||
}
|
||||
|
||||
@@ -10,6 +10,8 @@ use App\Classes\Modules\Banks\Services\FetchesBank;
|
||||
|
||||
use App\Classes\Modules\Banks\Standards\Rules\CanUpdateBank;
|
||||
use App\Classes\Modules\Banks\Services\UpdatesBank;
|
||||
use App\Classes\Modules\Banks\Services\CreatesBankLog;
|
||||
|
||||
use App\Classes\Modules\Banks\DataTransferObjects\BankObject;
|
||||
|
||||
use ErrorException;
|
||||
@@ -39,21 +41,27 @@ class UpdateBankLogic extends AbstractControllerLogic
|
||||
/** @var FetchesBank */
|
||||
private $fetchesBank;
|
||||
|
||||
/** @var CreatesBankLog */
|
||||
private $createsBankLog;
|
||||
|
||||
/**
|
||||
* UpdateBankLogic constructor.
|
||||
* @param CanUpdateBank $canUpdateBank
|
||||
* @param UpdatesBank $updatesBank
|
||||
* @param FetchesBank $fetchesBank
|
||||
* @param CreatesBankLog $createsBankLog
|
||||
*/
|
||||
public function __construct(
|
||||
CanUpdateBank $canUpdateBank,
|
||||
UpdatesBank $updatesBank,
|
||||
FetchesBank $fetchesBank
|
||||
FetchesBank $fetchesBank,
|
||||
CreatesBankLog $createsBankLog
|
||||
)
|
||||
{
|
||||
$this->canUpdateBank = $canUpdateBank;
|
||||
$this->updatesBank = $updatesBank;
|
||||
$this->fetchesBank = $fetchesBank;
|
||||
$this->createsBankLog = $createsBankLog;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -84,6 +92,8 @@ class UpdateBankLogic extends AbstractControllerLogic
|
||||
|
||||
$bank_query = $this->updatesBank->execute($bank, $bankObject);
|
||||
|
||||
$bankLog = $this->createsBankLog->execute($bank_query);
|
||||
|
||||
return $this->resourceResponse(new BankResource($bank_query));
|
||||
|
||||
}
|
||||
|
||||
@@ -6,6 +6,7 @@ use App\Http\Resources\BankResource;
|
||||
use App\Classes\General\Abstracts\AbstractControllerLogic;
|
||||
use App\Classes\Modules\Banks\Services\FetchesBank;
|
||||
use App\Classes\Modules\Banks\Services\UpdatesBankStatus;
|
||||
use App\Classes\Modules\Banks\Services\CreatesBankLog;
|
||||
use Illuminate\Http\JsonResponse;
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
@@ -28,18 +29,24 @@ class UpdateBankStatusLogic extends AbstractControllerLogic
|
||||
/** @var UpdatesBankStatus */
|
||||
private $updatesBankStatus;
|
||||
|
||||
/** @var CreatesBankLog */
|
||||
private $createsBankLog;
|
||||
|
||||
/**
|
||||
* UpdateBankStatusLogic constructor.
|
||||
* @param FetchesBank $fetchesBank
|
||||
* @param UpdatesBankStatus $updatesBankStatus
|
||||
* @param CreatesBankLog $createsBankLog
|
||||
*/
|
||||
public function __construct(
|
||||
FetchesBank $fetchesBank,
|
||||
UpdatesBankStatus $updatesBankStatus
|
||||
UpdatesBankStatus $updatesBankStatus,
|
||||
CreatesBankLog $createsBankLog
|
||||
)
|
||||
{
|
||||
$this->fetchesBank = $fetchesBank;
|
||||
$this->updatesBankStatus = $updatesBankStatus;
|
||||
$this->createsBankLog = $createsBankLog;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -55,6 +62,8 @@ class UpdateBankStatusLogic extends AbstractControllerLogic
|
||||
|
||||
$bank_query = $this->updatesBankStatus->execute($bank, $request->input('status'));
|
||||
|
||||
$bankLog = $this->createsBankLog->execute($bank_query);
|
||||
|
||||
return $this->resourceResponse(new BankResource($bank_query));
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,32 @@
|
||||
<?php
|
||||
|
||||
namespace App\Classes\Modules\Banks\Services;
|
||||
|
||||
use App\Classes\General\Eloquent\AbstractUpdateRecord;
|
||||
use App\Models\Bank;
|
||||
use App\Models\BankLog;
|
||||
|
||||
class CreatesBankLog extends AbstractUpdateRecord
|
||||
{
|
||||
/**
|
||||
* @param Bank $object
|
||||
* @return \Illuminate\Database\Eloquent\Model
|
||||
* @throws \App\Classes\Exceptions\MalformedRequestException
|
||||
*/
|
||||
public function execute(Bank $object) {
|
||||
$model = new BankLog();
|
||||
$model->bank_id = $object->id;
|
||||
$model->company_id = $object->company_id;
|
||||
$model->reference = $object->reference;
|
||||
$model->bank_name = $object->bank_name;
|
||||
$model->holder_name = $object->holder_name;
|
||||
$model->account_no = $object->account_no;
|
||||
$model->bank_branch = $object->bank_branch;
|
||||
$model->swift = $object->swift;
|
||||
$model->snap = $object->snap;
|
||||
$model->type = $object->type;
|
||||
$model->country_id = $object->country_id;
|
||||
return $this->handler($model);
|
||||
|
||||
}
|
||||
}
|
||||
@@ -86,7 +86,6 @@ class CreateCashBackTransactionProcessor
|
||||
where('type', TransactionType::CASH_BACK)
|
||||
->whereMonth('created_at', Carbon::now()->month)->sum('amount');
|
||||
|
||||
|
||||
if (
|
||||
$current_total_cash_back < CashBack::MAX &&
|
||||
$transaction->owner()->first()->transactions()->where('type', TransactionType::PURCHASE_ORDER)->count() > 0
|
||||
@@ -125,7 +124,6 @@ class CreateCashBackTransactionProcessor
|
||||
|
||||
$company = $transaction->owner()->first()->company;
|
||||
$credit = $this->creditWalletProcessor->execute($company, $transaction->type, $cash_back_transaction->amount, '');
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,10 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class BankLog extends Model
|
||||
{
|
||||
//
|
||||
}
|
||||
@@ -0,0 +1,51 @@
|
||||
<?php
|
||||
|
||||
use App\Classes\ValueObjects\Constants\ApprovalStatus;
|
||||
use App\Classes\ValueObjects\Constants\BankAccountType;
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class CreateBankLogsTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create('bank_logs', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->foreignId('bank_id')->unsigned();
|
||||
$table->foreignId('company_id')->unsigned();
|
||||
$table->string('reference')->nullable();
|
||||
$table->string('bank_name');
|
||||
$table->string('holder_name');
|
||||
$table->string('account_no');
|
||||
$table->string('bank_branch')->nullable();
|
||||
$table->string('swift')->nullable();
|
||||
$table->string('snap')->nullable();
|
||||
$table->integer('type')->default(BankAccountType::EXTERNAL);
|
||||
$table->integer('default')->default(false);
|
||||
$table->integer('status')->default(ApprovalStatus::APPROVED);
|
||||
$table->foreignId('country_id')->unsigned();
|
||||
$table->softDeletes();
|
||||
$table->timestamps();
|
||||
|
||||
$table->foreign('bank_id')->references('id')->on('banks');
|
||||
$table->foreign('country_id')->references('id')->on('countries');
|
||||
$table->foreign('company_id')->references('id')->on('companies');
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::dropIfExists('bank_logs');
|
||||
}
|
||||
}
|
||||
@@ -148,6 +148,7 @@
|
||||
</div>
|
||||
<div class="row" v-show="createBank">
|
||||
<div class="col">
|
||||
{{ data.company.id }}
|
||||
<bank-account-form-component v-if="data.serviceType.id !== 4" section="customerProfileSection" :disabled="formDisabled" :data="Object.keys(parameters.bankAccount).length ? parameters.bankAccount : {account_no: account_no, company_id: data.company.id, country_id: 2, account_type: 2}" :company_id="data.company.id" :country_id="2" :type="2" v-on:createdBank="updateBank($event)" :serviceType="data.serviceType" :closable=false v-on:close="clearAccount()"></bank-account-form-component>
|
||||
<phone-account-form-component v-if="data.serviceType.id === 4" section="customerProfileSection" :disabled="formDisabled" :data="Object.keys(parameters.bankAccount).length ? parameters.bankAccount : {account_no: account_no, company_id: data.company.id, country_id: 2, account_type: 2}" :company_id="data.company.id" :country_id="2" :type="2" v-on:createdBank="updateBank($event)" :serviceType="data.serviceType" :closable=false v-on:close="clearAccount()"></phone-account-form-component>
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user