mirror of
https://gitlab.com/CIEFWorldwideSdnBhd/exchange-2.0.git
synced 2026-08-26 07:53:58 +00:00
fix the invoice date for IZYIM when export invoice to autocount and have reject function in mapping review
This commit is contained in:
+15
-34
@@ -2,16 +2,14 @@
|
||||
|
||||
namespace App\Classes\Modules\Accounting\ControllersLogic;
|
||||
|
||||
use App\Classes\General\Abstracts\AbstractControllerLogic;
|
||||
use App\Classes\Modules\Accounting\Services\FetchesBankStatementTransaction;
|
||||
use App\Http\Resources\BankStatementTransactionResource;
|
||||
use App\Classes\Modules\Accounting\Services\UpdatesBankStatementTransactionOwnerStatus;
|
||||
use App\Classes\ValueObjects\Constants\ApprovalStatus;
|
||||
use App\Classes\ValueObjects\Constants\StatementTransactionOwnerType;
|
||||
use Illuminate\Http\JsonResponse;
|
||||
use Illuminate\Http\Request;
|
||||
use App\Classes\Modules\Transactions\Services\UpdatesTransactionStatus;
|
||||
|
||||
use Illuminate\Http\JsonResponse;
|
||||
use App\Classes\ValueObjects\Constants\ApprovalStatus;
|
||||
use App\Classes\General\Abstracts\AbstractControllerLogic;
|
||||
use App\Http\Resources\BankStatementTransactionOwnerResource;
|
||||
use App\Classes\ValueObjects\Constants\StatementTransactionOwnerType;
|
||||
use App\Classes\Modules\Accounting\Services\FetchesBankStatementTransactionOwner;
|
||||
use App\Classes\Modules\Accounting\Services\UpdatesBankStatementTransactionOwnerStatus;
|
||||
|
||||
class UpdateStatementTransactionStatusLogic extends AbstractControllerLogic
|
||||
{
|
||||
@@ -27,29 +25,23 @@ class UpdateStatementTransactionStatusLogic extends AbstractControllerLogic
|
||||
];
|
||||
}
|
||||
|
||||
/** @var FetchesBankStatementTransaction */
|
||||
private $fetchesBankStatementTransaction;
|
||||
/** @var FetchesBankStatementTransactionOwner */
|
||||
private $fetchesBankStatementTransactionOwner;
|
||||
|
||||
/** @var UpdatesBankStatementTransactionOwnerStatus */
|
||||
private $updatesBankStatementTransactionOwnerStatus;
|
||||
|
||||
/** @var UpdatesTransactionStatus */
|
||||
private $updatesTransactionStatus;
|
||||
|
||||
/**
|
||||
* UpdateAnnouncementLogic constructor.
|
||||
* @param FetchesBankStatementTransaction $fetchesBankStatementTransaction
|
||||
* @param FetchesBankStatementTransactionOwner $fetchesBankStatementTransactionOwner
|
||||
* @param UpdatesBankStatementTransactionOwnerStatus $updatesBankStatementTransactionOwnerStatus
|
||||
* @param UpdatesTransactionStatus $updatesTransactionStatus
|
||||
*/
|
||||
public function __construct(
|
||||
FetchesBankStatementTransaction $fetchesBankStatementTransaction,
|
||||
UpdatesBankStatementTransactionOwnerStatus $updatesBankStatementTransactionOwnerStatus,
|
||||
UpdatesTransactionStatus $updatesTransactionStatus
|
||||
FetchesBankStatementTransactionOwner $fetchesBankStatementTransactionOwner,
|
||||
UpdatesBankStatementTransactionOwnerStatus $updatesBankStatementTransactionOwnerStatus
|
||||
) {
|
||||
$this->fetchesBankStatementTransaction = $fetchesBankStatementTransaction;
|
||||
$this->fetchesBankStatementTransactionOwner = $fetchesBankStatementTransactionOwner;
|
||||
$this->updatesBankStatementTransactionOwnerStatus = $updatesBankStatementTransactionOwnerStatus;
|
||||
$this->updatesTransactionStatus = $updatesTransactionStatus;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -61,21 +53,10 @@ class UpdateStatementTransactionStatusLogic extends AbstractControllerLogic
|
||||
*/
|
||||
public function logic(Request $request): JsonResponse
|
||||
{
|
||||
$statementTrasaction = $this->fetchesBankStatementTransaction->execute(['id' => $request->route('id')]);
|
||||
|
||||
$statementTrasactionOwner = $statementTrasaction->owners()->where('status', '!=', ApprovalStatus::REJECTED)->first();
|
||||
$statementTrasactionOwner = $this->fetchesBankStatementTransactionOwner->execute(['id' => $request->route('id')]);
|
||||
|
||||
$this->updatesBankStatementTransactionOwnerStatus->execute($statementTrasactionOwner, $request->route('status') == 'approve' ? ApprovalStatus::APPROVED : ApprovalStatus::REJECTED);
|
||||
|
||||
// todo-new: approve payments status, need to check the owner(if system is shipping, need to api with shipping portal)
|
||||
// if ($request->route('status') == 'approve') {
|
||||
// if ($statementTrasactionOwner->transaction->type === StatementTransactionOwnerType::SALES) {
|
||||
// if ($statementTrasactionOwner->owner->status === ApprovalStatus::PENDING_VERIFICATION) {
|
||||
// $this->updatesTransactionStatus->execute($statementTrasactionOwner->owner, ApprovalStatus::APPROVED);
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
|
||||
return $this->resourceResponse(new BankStatementTransactionResource($statementTrasaction));
|
||||
return $this->resourceResponse(new BankStatementTransactionOwnerResource($statementTrasactionOwner));
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user