add remarks for refund

This commit is contained in:
edmondlang
2024-05-10 00:00:01 +08:00
parent 2ad1841e54
commit f03d91ba42
15 changed files with 83 additions and 17 deletions
@@ -14,12 +14,14 @@ use App\Classes\General\Abstracts\AbstractControllerLogic;
use App\Classes\Modules\Transactions\Services\CreatesTransaction;
use App\Classes\Modules\Transactions\Services\FetchesTransaction;
use App\Classes\Modules\Bookings\Services\FetchesBookingQuotation;
use App\Classes\Modules\Remarks\DataTransferObjects\RemarkObject;
use App\Classes\Modules\Transactions\ControllersLogic\UpdateRefundTransactionStatusLogic;
use App\Classes\Modules\Transactions\Services\UpdatesTransactionStatus;
use App\Classes\Modules\Transactions\DataTransferObjects\TransactionObject;
use App\Classes\Modules\Transactions\Services\GeneratesTransactionBillNumber;
use App\Classes\Modules\Transactions\DataTransferObjects\TransactionRefundCalculationObject;
use App\Classes\ValueObjects\Constants\PaymentMethodType;
use App\Classes\Modules\Remarks\Processors\CreateRemarkProcessor;
class CreateBookingRefundLogic extends AbstractControllerLogic
{
@@ -52,6 +54,9 @@ class CreateBookingRefundLogic extends AbstractControllerLogic
/** @var UpdateRefundTransactionStatusLogic */
private $updateRefundTransactionStatusLogic;
/** @var CreateRemarkProcessor */
private $createRemarkProcessor;
/**
* CreateBookingPaymentLogic constructor.
* @param FetchesBookingQuotation $fetchBookingQuotation
@@ -60,8 +65,9 @@ class CreateBookingRefundLogic extends AbstractControllerLogic
* @param GeneratesTransactionBillNumber $generatesTransactionBillNumber
* @param CreatesTransaction $createsTransaction
* @param UpdateRefundTransactionStatusLogic $updateRefundTransactionStatusLogic
* @param CreateRemarkProcessor $createRemarkProcessor
*/
public function __construct(FetchesBookingQuotation $fetchBookingQuotation, FetchesTransaction $fetchesTransaction, UpdatesTransactionStatus $updatesTransactionStatus, GeneratesTransactionBillNumber $generatesTransactionBillNumber, CreatesTransaction $createsTransaction, UpdateRefundTransactionStatusLogic $updateRefundTransactionStatusLogic)
public function __construct(FetchesBookingQuotation $fetchBookingQuotation, FetchesTransaction $fetchesTransaction, UpdatesTransactionStatus $updatesTransactionStatus, GeneratesTransactionBillNumber $generatesTransactionBillNumber, CreatesTransaction $createsTransaction, UpdateRefundTransactionStatusLogic $updateRefundTransactionStatusLogic, CreateRemarkProcessor $createRemarkProcessor)
{
$this->fetchBookingQuotation = $fetchBookingQuotation;
$this->fetchesTransaction = $fetchesTransaction;
@@ -69,6 +75,7 @@ class CreateBookingRefundLogic extends AbstractControllerLogic
$this->generatesTransactionBillNumber = $generatesTransactionBillNumber;
$this->createsTransaction = $createsTransaction;
$this->updateRefundTransactionStatusLogic = $updateRefundTransactionStatusLogic;
$this->createRemarkProcessor = $createRemarkProcessor;
}
/**
@@ -132,6 +139,11 @@ class CreateBookingRefundLogic extends AbstractControllerLogic
}
if($request->input('refundRemark')){
$remarkObject = new RemarkObject($request->input('refundRemark'), Auth()->user()->id);
$this->createRemarkProcessor->execute($this->fetchesTransaction->execute(['id' => $refund_transaction->id]), $remarkObject);
}
return $this->resourceResponse(new TransactionResource($refund_transaction));
}
@@ -26,7 +26,7 @@ class CanCreateRemark extends AbstractRule
/**
* @return bool
*/
protected function authorized($object): bool
protected function authorized(): bool
{
// TODO Set Authorization rules
return true;
@@ -13,7 +13,7 @@ class CanDeleteRemark extends AbstractRule
/**
* @return bool
*/
protected function authorized($object): bool
protected function authorized(): bool
{
// TODO Set Authorization rules
return true;
@@ -13,7 +13,7 @@ class CanFetchRemark extends AbstractRule
/**
* @return bool
*/
protected function authorized($object): bool
protected function authorized(): bool
{
// TODO Set Authorization rules
return true;
@@ -13,7 +13,7 @@ class CanListRemarks extends AbstractRule
/**
* @return bool
*/
protected function authorized($object): bool
protected function authorized(): bool
{
// TODO Set Authorization rules
return true;
@@ -26,7 +26,7 @@ class CanUpdateRemark extends AbstractRule
/**
* @return bool
*/
protected function authorized($object): bool
protected function authorized(): bool
{
// TODO Set Authorization rules
return true;