diff --git a/app/Classes/Jobs/Commands/V2/ProcessCreditNoteReportV2CommandJob.php b/app/Classes/Jobs/Commands/V2/ProcessCreditNoteReportV2CommandJob.php index 575ba9a2..133e1441 100644 --- a/app/Classes/Jobs/Commands/V2/ProcessCreditNoteReportV2CommandJob.php +++ b/app/Classes/Jobs/Commands/V2/ProcessCreditNoteReportV2CommandJob.php @@ -2,9 +2,9 @@ namespace App\Classes\Jobs\Commands\V2; -use App\Classes\Modules\Accounts\DataTransferObjects\KeyValuePairObject; -use App\Classes\Modules\Settings\Services\CreatesKeyValuePair; -use App\Classes\Modules\Settings\Services\UpdatesKeyValuePair; +use App\Classes\Modules\KeyValuePairs\DataTransferObjects\KeyValuePairObject; +use App\Classes\Modules\KeyValuePairs\Services\CreatesKeyValuePair; +use App\Classes\Modules\KeyValuePairs\Services\UpdatesKeyValuePair; use App\Classes\Modules\Bookings\Processors\RegenerateInvoiceBookingProcessor; use App\Classes\ValueObjects\Constants\ApprovalStatus; use App\Classes\ValueObjects\Constants\KVPKey; diff --git a/app/Classes/Jobs/Commands/V2/ProcessPaymentReportV2CommandJob.php b/app/Classes/Jobs/Commands/V2/ProcessPaymentReportV2CommandJob.php index 05970692..af029c85 100644 --- a/app/Classes/Jobs/Commands/V2/ProcessPaymentReportV2CommandJob.php +++ b/app/Classes/Jobs/Commands/V2/ProcessPaymentReportV2CommandJob.php @@ -2,9 +2,9 @@ namespace App\Classes\Jobs\Commands\V2; -use App\Classes\Modules\Accounts\DataTransferObjects\KeyValuePairObject; -use App\Classes\Modules\Settings\Services\CreatesKeyValuePair; -use App\Classes\Modules\Settings\Services\UpdatesKeyValuePair; +use App\Classes\Modules\KeyValuePairs\DataTransferObjects\KeyValuePairObject; +use App\Classes\Modules\KeyValuePairs\Services\CreatesKeyValuePair; +use App\Classes\Modules\KeyValuePairs\Services\UpdatesKeyValuePair; use App\Classes\ValueObjects\Constants\KVPKey; use Carbon\Carbon; use Illuminate\Bus\Queueable; diff --git a/app/Classes/Jobs/Commands/V2/ProcessSalesDepositByWalletPaymentEntryV2CommandJob.php b/app/Classes/Jobs/Commands/V2/ProcessSalesDepositByWalletPaymentEntryV2CommandJob.php index cf473be0..0c4d0b78 100644 --- a/app/Classes/Jobs/Commands/V2/ProcessSalesDepositByWalletPaymentEntryV2CommandJob.php +++ b/app/Classes/Jobs/Commands/V2/ProcessSalesDepositByWalletPaymentEntryV2CommandJob.php @@ -2,9 +2,9 @@ namespace App\Classes\Jobs\Commands\V2; -use App\Classes\Modules\Accounts\DataTransferObjects\KeyValuePairObject; -use App\Classes\Modules\Accounts\Services\CreatesKeyValuePair; -use App\Classes\Modules\Accounts\Services\UpdatesKeyValuePair; +use App\Classes\Modules\KeyValuePairs\DataTransferObjects\KeyValuePairObject; +use App\Classes\Modules\KeyValuePairs\Services\CreatesKeyValuePair; +use App\Classes\Modules\KeyValuePairs\Services\UpdatesKeyValuePair; use App\Classes\ValueObjects\Constants\KVPKey; use Carbon\Carbon; use Illuminate\Bus\Queueable; diff --git a/app/Classes/Jobs/Commands/V2/ProcessSalesDepositByWalletRefundEntryV2CommandJob.php b/app/Classes/Jobs/Commands/V2/ProcessSalesDepositByWalletRefundEntryV2CommandJob.php index b984fab2..f5ca3ab0 100644 --- a/app/Classes/Jobs/Commands/V2/ProcessSalesDepositByWalletRefundEntryV2CommandJob.php +++ b/app/Classes/Jobs/Commands/V2/ProcessSalesDepositByWalletRefundEntryV2CommandJob.php @@ -2,9 +2,9 @@ namespace App\Classes\Jobs\Commands\V2; -use App\Classes\Modules\Accounts\DataTransferObjects\KeyValuePairObject; -use App\Classes\Modules\Accounts\Services\CreatesKeyValuePair; -use App\Classes\Modules\Accounts\Services\UpdatesKeyValuePair; +use App\Classes\Modules\KeyValuePairs\DataTransferObjects\KeyValuePairObject; +use App\Classes\Modules\KeyValuePairs\Services\CreatesKeyValuePair; +use App\Classes\Modules\KeyValuePairs\Services\UpdatesKeyValuePair; use App\Classes\ValueObjects\Constants\KVPKey; use Carbon\Carbon; use Illuminate\Bus\Queueable; diff --git a/app/Classes/Jobs/Commands/V2/ProcessSalesInvoiceReportV2CommandJob.php b/app/Classes/Jobs/Commands/V2/ProcessSalesInvoiceReportV2CommandJob.php index a7bf14c9..281ae38f 100644 --- a/app/Classes/Jobs/Commands/V2/ProcessSalesInvoiceReportV2CommandJob.php +++ b/app/Classes/Jobs/Commands/V2/ProcessSalesInvoiceReportV2CommandJob.php @@ -2,9 +2,9 @@ namespace App\Classes\Jobs\Commands\V2; -use App\Classes\Modules\Accounts\DataTransferObjects\KeyValuePairObject; -use App\Classes\Modules\Settings\Services\CreatesKeyValuePair; -use App\Classes\Modules\Settings\Services\UpdatesKeyValuePair; +use App\Classes\Modules\KeyValuePairs\DataTransferObjects\KeyValuePairObject; +use App\Classes\Modules\KeyValuePairs\Services\CreatesKeyValuePair; +use App\Classes\Modules\KeyValuePairs\Services\UpdatesKeyValuePair; use App\Classes\ValueObjects\Constants\KVPKey; use Carbon\Carbon; use Illuminate\Bus\Queueable; diff --git a/app/Classes/Jobs/SendWelcomeVoucherEmail.php b/app/Classes/Jobs/SendWelcomeVoucherEmail.php index a6e9eede..2fcc8dac 100644 --- a/app/Classes/Jobs/SendWelcomeVoucherEmail.php +++ b/app/Classes/Jobs/SendWelcomeVoucherEmail.php @@ -2,8 +2,8 @@ namespace App\Classes\Jobs; -use App\Classes\Modules\Accounts\DataTransferObjects\KeyValuePairObject; -use App\Classes\Modules\Settings\Services\CreatesKeyValuePair; +use App\Classes\Modules\KeyValuePairs\DataTransferObjects\KeyValuePairObject; +use App\Classes\Modules\KeyValuePairs\Services\CreatesKeyValuePair; use App\Classes\Notifications\WelcomeVoucherEmail; use App\Models\User; use App\Models\Voucher; diff --git a/app/Classes/Modules/Accounts/ControllersLogic/CreateCustomerLogic.php b/app/Classes/Modules/Accounts/ControllersLogic/CreateCustomerLogic.php index d681d182..212977be 100644 --- a/app/Classes/Modules/Accounts/ControllersLogic/CreateCustomerLogic.php +++ b/app/Classes/Modules/Accounts/ControllersLogic/CreateCustomerLogic.php @@ -183,8 +183,10 @@ class CreateCustomerLogic extends AbstractControllerLogic } } - // Track affiliate registration if user came from affiliate link - $this->tracksAffiliateRegistration->execute($user, $request->get('tracking')); + // Track affiliate registration if user came from affiliate link. + // Prefer ?tracking= from request; fallback to cookie set by TrackAffiliateClick on /signup visit. + $code = $request->get('tracking') ?? $request->cookie(\App\Classes\Modules\Affiliate\Services\TracksAffiliateClick::COOKIE_NAME); + $this->tracksAffiliateRegistration->execute($user, $code); return $this->response($this->authenticationProcessor->execute($request, false)); diff --git a/app/Classes/Modules/Accounts/ControllersLogic/CreateSystemUserLogic.php b/app/Classes/Modules/Accounts/ControllersLogic/CreateSystemUserLogic.php index f40ae7dd..6e1d08d3 100644 --- a/app/Classes/Modules/Accounts/ControllersLogic/CreateSystemUserLogic.php +++ b/app/Classes/Modules/Accounts/ControllersLogic/CreateSystemUserLogic.php @@ -61,8 +61,8 @@ class CreateSystemUserLogic extends AbstractControllerLogic $this->canCreateUser->passes($user_object); $user = $this->createsUser->execute($user_object); - $token = $user->createToken('my-app-token', ['*'])->plainTextToken; - return $this->response(['token' => $token]); + // $token = $user->createToken('my-app-token', ['*'])->plainTextToken; + // return $this->response(['token' => $token]); } return $this->response([]); } diff --git a/app/Classes/Modules/Affiliate/ControllersLogic/CreateAffiliateLogic.php b/app/Classes/Modules/Affiliate/ControllersLogic/CreateAffiliateLogic.php index ac462a6f..5a8bcfb8 100644 --- a/app/Classes/Modules/Affiliate/ControllersLogic/CreateAffiliateLogic.php +++ b/app/Classes/Modules/Affiliate/ControllersLogic/CreateAffiliateLogic.php @@ -2,33 +2,58 @@ namespace App\Classes\Modules\Affiliate\ControllersLogic; +use App\Classes\General\Abstracts\AbstractControllerLogic; use App\Classes\Modules\Affiliate\Services\CreatesAffiliate; use App\Classes\Modules\Affiliate\DataTransferObjects\AffiliateObject; +use App\Classes\Modules\Affiliate\Standards\Rules\CanCreateAffiliate; +use App\Http\Resources\AffiliateResource; use Illuminate\Http\JsonResponse; use Illuminate\Http\Request; -class CreateAffiliateLogic +class CreateAffiliateLogic extends AbstractControllerLogic { + /** + * @return array + */ + protected function notification(): array + { + return [ + 'title' => 'Created Affiliate', + 'message' => 'You have successfully created a new Affiliate Code' + ]; + } + + /** @var CanCreateAffiliate */ + private $canCreateAffiliate; + /** @var CreatesAffiliate */ private $createsAffiliate; /** + * CreateAffiliateLogic constructor. + * @param CanCreateAffiliate $canCreateAffiliate * @param CreatesAffiliate $createsAffiliate */ - public function __construct(CreatesAffiliate $createsAffiliate) + public function __construct( + CanCreateAffiliate $canCreateAffiliate, + CreatesAffiliate $createsAffiliate + ) { + $this->canCreateAffiliate = $canCreateAffiliate; $this->createsAffiliate = $createsAffiliate; } /** * @param Request $request * @return JsonResponse + * @throws \App\Classes\Exceptions\AccessForbiddenException + * @throws \App\Classes\Exceptions\RequestValidationException */ - public function execute(Request $request): JsonResponse + public function logic(Request $request): JsonResponse { $code = $request->input('code'); $code = $code !== null ? (string) $code : ''; - + $isActive = $request->input('is_active', true); // Convert string 'true'/'false' to boolean if needed if (is_string($isActive)) { @@ -43,12 +68,13 @@ class CreateAffiliateLogic $isActive ); + // Validate the affiliate object + $this->canCreateAffiliate->passes($object); + + // Create the affiliate $affiliate = $this->createsAffiliate->execute($object); - return response()->json([ - 'message' => 'Affiliate code created successfully', - 'data' => $affiliate - ]); + return $this->resourceResponse(new AffiliateResource($affiliate)); } } diff --git a/app/Classes/Modules/Affiliate/Services/CreatesAffiliate.php b/app/Classes/Modules/Affiliate/Services/CreatesAffiliate.php index 327e25f4..5cfd4b9b 100644 --- a/app/Classes/Modules/Affiliate/Services/CreatesAffiliate.php +++ b/app/Classes/Modules/Affiliate/Services/CreatesAffiliate.php @@ -18,23 +18,17 @@ class CreatesAffiliate extends AbstractUpdateRecord public function execute(AffiliateObject $object) { $code = $object->getCode(); - + // Auto-generate code if not provided if (empty($code)) { $code = $this->generateUniqueCode(); } else { - // Validate uniqueness of user-provided code (including soft-deleted records) - $existingAffiliate = Affiliate::where('code', $code) - ->whereNull('deleted_at') - ->first(); - - if ($existingAffiliate) { - throw new \App\Classes\Exceptions\MalformedRequestException('Affiliate code already exists. Please choose a different code.'); - } + // Uppercase the code for consistency + $code = strtoupper($code); } $model = new Affiliate(); - $model->code = $code; + $model->code = strtoupper($code); $model->campaign_name = $object->getCampaignName(); $model->campaign_description = $object->getCampaignDescription(); $model->is_active = $object->getIsActive(); @@ -48,19 +42,19 @@ class CreatesAffiliate extends AbstractUpdateRecord /** * Generate a unique affiliate code - * + * * @return string */ private function generateUniqueCode(): string { $maxAttempts = 10; $attempts = 0; - + do { // Increased from 12 to 16 characters for better uniqueness $code = Str::random(16); $attempts++; - + if ($attempts >= $maxAttempts) { // Fallback to UUID if we can't generate unique code $code = strtoupper(Str::substr(str_replace('-', '', Str::uuid()), 0, 16)); diff --git a/app/Classes/Modules/Affiliate/Services/TracksAffiliateOrder.php b/app/Classes/Modules/Affiliate/Services/TracksAffiliateOrder.php index b6f81dc7..8dd85405 100644 --- a/app/Classes/Modules/Affiliate/Services/TracksAffiliateOrder.php +++ b/app/Classes/Modules/Affiliate/Services/TracksAffiliateOrder.php @@ -12,7 +12,7 @@ class TracksAffiliateOrder { /** * Track when a user with an affiliate code creates an order - * + * * @param Booking $booking * @return Affiliate|null */ @@ -48,22 +48,22 @@ class TracksAffiliateOrder // Check if this booking has already been counted // We'll use a KeyValuePair to track which bookings have been counted $kvpKey = 'affiliate_order_tracked_' . $affiliate->id; - + $existingKvp = $booking->attributesKVP() ->where('key', $kvpKey) ->exists(); - + if ($existingKvp) { return $affiliate; // Already counted } // Mark this booking as tracked - $keyValuePairObject = new \App\Classes\Modules\Accounts\DataTransferObjects\KeyValuePairObject( + $keyValuePairObject = new \App\Classes\Modules\KeyValuePairs\DataTransferObjects\KeyValuePairObject( $kvpKey, '1' ); - - $createsKeyValuePair = app()->make(\App\Classes\Modules\Accounts\Services\CreatesKeyValuePair::class); + + $createsKeyValuePair = app()->make(\App\Classes\Modules\KeyValuePairs\Services\CreatesKeyValuePair::class); $createsKeyValuePair->execute($booking, $keyValuePairObject); // Increment orders count atomically diff --git a/app/Classes/Modules/Affiliate/Services/TracksAffiliateRegistration.php b/app/Classes/Modules/Affiliate/Services/TracksAffiliateRegistration.php index 7768f575..b0bf702d 100644 --- a/app/Classes/Modules/Affiliate/Services/TracksAffiliateRegistration.php +++ b/app/Classes/Modules/Affiliate/Services/TracksAffiliateRegistration.php @@ -13,12 +13,14 @@ class TracksAffiliateRegistration { /** * Track when a user registers with an affiliate code - * + * * @param User $user * @return Affiliate|null */ - public function execute(User $user, string $code): ?Affiliate + public function execute(User $user, ?string $code = null): ?Affiliate { + // Log::info('TracksAffiliateRegistration::execute', ['user' => $user, 'code' => $code]); + if (!$code || !$this->isValidCode($code)) { Log::info('Code is not valid', ['code' => $code]); return null; @@ -65,7 +67,7 @@ class TracksAffiliateRegistration /** * Validate affiliate code format - * + * * @param string $code * @return bool */ diff --git a/app/Classes/Modules/Affiliate/Standards/Rules/CanCreateAffiliate.php b/app/Classes/Modules/Affiliate/Standards/Rules/CanCreateAffiliate.php new file mode 100644 index 00000000..03e7cee1 --- /dev/null +++ b/app/Classes/Modules/Affiliate/Standards/Rules/CanCreateAffiliate.php @@ -0,0 +1,52 @@ +affiliateCreateValidation = $affiliateCreateValidation; + } + + /** + * @param AffiliateObject $object + * @return bool + */ + protected function authorized($object): bool + { + // Authorization is handled by policy in controller + return true; + } + + /** + * @param AffiliateObject $object + * @return bool + * @throws \App\Classes\Exceptions\RequestValidationException + */ + protected function validators($object): bool + { + return $this->affiliateCreateValidation->validate($object); + } + + /** + * @param AffiliateObject $object + * @return bool + */ + protected function criteria($object): bool + { + // No additional criteria needed for affiliate creation + return true; + } +} diff --git a/app/Classes/Modules/Affiliate/Standards/Validators/AffiliateCreateValidation.php b/app/Classes/Modules/Affiliate/Standards/Validators/AffiliateCreateValidation.php new file mode 100644 index 00000000..85fa5079 --- /dev/null +++ b/app/Classes/Modules/Affiliate/Standards/Validators/AffiliateCreateValidation.php @@ -0,0 +1,69 @@ + $object->getCode(), + 'campaign_name' => $object->getCampaignName(), + 'campaign_description' => $object->getCampaignDescription(), + 'is_active' => $object->getIsActive(), + ]; + } + + /** + * @return array + */ + protected function rules(): array + { + return [ + 'code' => [ + 'nullable', + 'string', + 'min:3', + 'max:255', + 'regex:/^[a-zA-Z0-9_-]+$/', + function ($attribute, $value, $fail) { + if (!empty($value)) { + $uppercaseCode = strtoupper($value); + $exists = Affiliate::whereRaw('UPPER(code) = ?', [$uppercaseCode]) + ->whereNull('deleted_at') + ->exists(); + + if ($exists) { + $fail('Affiliate code already exists. Please choose a different code.'); + } + } + }, + ], + 'campaign_name' => 'required|string|max:255', + 'campaign_description' => 'nullable|string|max:65535', + 'is_active' => 'required|boolean', + ]; + } + + /** + * @return array + */ + protected function messages(): array + { + return [ + 'code.regex' => 'The affiliate code may only contain letters, numbers, hyphens, and underscores.', + 'code.min' => 'The affiliate code must be at least 3 characters.', + 'campaign_name.required' => 'A campaign name is required.', + 'campaign_name.max' => 'The campaign name cannot exceed 255 characters.', + ]; + } +} diff --git a/app/Classes/Modules/Banks/Processors/UpdateBankProcessor.php b/app/Classes/Modules/Banks/Processors/UpdateBankProcessor.php index bd6564d9..d1057393 100644 --- a/app/Classes/Modules/Banks/Processors/UpdateBankProcessor.php +++ b/app/Classes/Modules/Banks/Processors/UpdateBankProcessor.php @@ -7,8 +7,8 @@ use App\Classes\Modules\Transactions\Services\FetchesTransaction; use App\Classes\Modules\Banks\Services\UpdatesBank; use App\Classes\Modules\Banks\Services\CreatesOrUpdateBank; use App\Classes\Modules\Banks\DataTransferObjects\BankObject; -use App\Classes\Modules\Accounts\DataTransferObjects\KeyValuePairObject; -use App\Classes\Modules\Settings\Services\CreatesKeyValuePair; +use App\Classes\Modules\KeyValuePairs\DataTransferObjects\KeyValuePairObject; +use App\Classes\Modules\KeyValuePairs\Services\CreatesKeyValuePair; use Illuminate\Database\Eloquent\Model; use App\Models\Bank; diff --git a/app/Classes/Modules/Bookings/ControllersLogic/CreateBookingLockLogic.php b/app/Classes/Modules/Bookings/ControllersLogic/CreateBookingLockLogic.php index 8a3a4912..182bdca7 100644 --- a/app/Classes/Modules/Bookings/ControllersLogic/CreateBookingLockLogic.php +++ b/app/Classes/Modules/Bookings/ControllersLogic/CreateBookingLockLogic.php @@ -6,7 +6,7 @@ use App\Classes\General\Abstracts\AbstractControllerLogic; use App\Classes\Modules\Companies\Services\FetchesCompany; use App\Classes\Modules\Bookings\Standards\Rules\CanCreateBooking; use App\Classes\Modules\Bookings\Services\FetchesBooking; -use App\Classes\Modules\Settings\Services\CreatesKeyValuePair; +use App\Classes\Modules\KeyValuePairs\Services\CreatesKeyValuePair; use App\Classes\ValueObjects\Constants\KVPKey; use Illuminate\Http\JsonResponse; use Illuminate\Http\Request; @@ -62,6 +62,8 @@ class CreateBookingLockLogic extends AbstractControllerLogic */ public function logic(Request $request) : JsonResponse { + // cief todo: 110 - CanCreateBookingLock + // $password = $request->input('password'); // if($password !== 'prototype'){ // throw new AccessForbiddenException('Incorrect Password'); diff --git a/app/Classes/Modules/Bookings/ControllersLogic/DeleteBookingLockLogic.php b/app/Classes/Modules/Bookings/ControllersLogic/DeleteBookingLockLogic.php index 90844ade..5b536038 100644 --- a/app/Classes/Modules/Bookings/ControllersLogic/DeleteBookingLockLogic.php +++ b/app/Classes/Modules/Bookings/ControllersLogic/DeleteBookingLockLogic.php @@ -53,6 +53,8 @@ class DeleteBookingLockLogic extends AbstractControllerLogic */ public function logic(Request $request) : JsonResponse { + // cief todo: 110 - CanDeleteBookingLock + $password = $request->input('password'); if($password !== 'prototype'){ throw new AccessForbiddenException('Incorrect Password'); diff --git a/app/Classes/Modules/Bookings/ControllersLogic/UpdateBookingAmountLogic.php b/app/Classes/Modules/Bookings/ControllersLogic/UpdateBookingAmountLogic.php index 73625a26..9b58b4be 100644 --- a/app/Classes/Modules/Bookings/ControllersLogic/UpdateBookingAmountLogic.php +++ b/app/Classes/Modules/Bookings/ControllersLogic/UpdateBookingAmountLogic.php @@ -13,14 +13,14 @@ use App\Classes\Modules\Bookings\Services\FetchesBooking; use App\Classes\Modules\Bookings\Services\UpdatesBookingInvoiceStatus; use App\Classes\Modules\Bookings\Services\UpdatesBookingFixedAmount; use App\Classes\Modules\Bookings\Standards\Rules\CanUpdateBooking; +use App\Classes\Modules\Rules\Services\RuleEvaluator; +use App\Classes\Modules\Rules\Standards\Rules\CanPassTransferPeriodLockRule; +use App\Classes\Modules\Rules\DataTransferObjects\CheckTransferPeriodLockRuleVariant2DTO; use App\Classes\Modules\Transactions\Processors\CreateInvoiceTransactionV2Processor; use App\Classes\Modules\Transactions\Services\UpdatesTransactionStatus; use App\Classes\ValueObjects\Constants\ApprovalStatus; use App\Classes\ValueObjects\Constants\TransactionType; use App\Http\Resources\BookingResource; -use App\Classes\Modules\Rules\DataTransferObjects\CheckTransferPeriodLockRuleVariant2DTO; -use App\Classes\Modules\Rules\Services\RuleEvaluator; -use App\Classes\Modules\Rules\Standards\Rules\CanPassTransferPeriodLockRule; use ErrorException; use Illuminate\Http\JsonResponse; use Illuminate\Http\Request; @@ -79,8 +79,10 @@ class UpdateBookingAmountLogic extends AbstractControllerLogic * @param CanPassTransferPeriodLockRule $canPassTransferPeriodLockRule * @param UpdatesBookingInvoiceStatus $updatesBookingInvoiceStatus * @param CreateInvoiceTransactionV2Processor $createInvoiceTransactionProcessor + * @param RuleEvaluator $ruleEvaluator + * @param CanPassTransferPeriodLockRule $canPassTransferPeriodLockRule */ - public function __construct(CanUpdateBooking $canUpdateBooking, UpdatesBookingFixedAmount $updatesBookingFixedAmount, FetchesBooking $fetchesBooking, CalculatesBookingOutstanding $calculatesBookingOutstanding, UpdatesTransactionStatus $updatesTransactionStatus, RuleEvaluator $ruleEvaluator, CanPassTransferPeriodLockRule $canPassTransferPeriodLockRule, UpdatesBookingInvoiceStatus $updatesBookingInvoiceStatus, CreateInvoiceTransactionV2Processor $createInvoiceTransactionProcessor) + public function __construct(CanUpdateBooking $canUpdateBooking, UpdatesBookingFixedAmount $updatesBookingFixedAmount, FetchesBooking $fetchesBooking, CalculatesBookingOutstanding $calculatesBookingOutstanding, UpdatesTransactionStatus $updatesTransactionStatus, UpdatesBookingInvoiceStatus $updatesBookingInvoiceStatus, CreateInvoiceTransactionV2Processor $createInvoiceTransactionProcessor, RuleEvaluator $ruleEvaluator, CanPassTransferPeriodLockRule $canPassTransferPeriodLockRule) { $this->canUpdateBooking = $canUpdateBooking; $this->updatesBookingFixedAmount = $updatesBookingFixedAmount; @@ -91,6 +93,8 @@ class UpdateBookingAmountLogic extends AbstractControllerLogic $this->canPassTransferPeriodLockRule = $canPassTransferPeriodLockRule; $this->updatesBookingInvoiceStatus = $updatesBookingInvoiceStatus; $this->createInvoiceTransactionProcessor = $createInvoiceTransactionProcessor; + $this->ruleEvaluator = $ruleEvaluator; + $this->canPassTransferPeriodLockRule = $canPassTransferPeriodLockRule; } /** @@ -101,18 +105,18 @@ class UpdateBookingAmountLogic extends AbstractControllerLogic */ public function logic(Request $request) : JsonResponse { - //cief todo: Prototype Period Lock - Starts - $reqData['id'] = $request->route('id'); - $dto = new CheckTransferPeriodLockRuleVariant2DTO($reqData); + //cief todo: 110 - Prototype Period Lock - Starts + // $reqData['id'] = $request->route('id'); + // $dto = new CheckTransferPeriodLockRuleVariant2DTO($reqData); - $result = $this->ruleEvaluator->evaluate([ - $this->canPassTransferPeriodLockRule, - ], $dto); + // $result = $this->ruleEvaluator->evaluate([ + // $this->canPassTransferPeriodLockRule, + // ], $dto); - if ($result->failed()) { - throw new CriteriaNotFulfilledException("- " . implode("
- ", $result->messages())); - } - //cief todo: Prototype Period Lock - Ends + // if ($result->failed()) { + // throw new CriteriaNotFulfilledException("- " . implode("
- ", $result->messages())); + // } + //cief todo: 110 - Prototype Period Lock - Ends $booking = $this->fetchesBooking->execute(['id' => $request->route('id')]); diff --git a/app/Classes/Modules/Bookings/ControllersLogic/UpdateBookingAmountOnHoldLogic.php b/app/Classes/Modules/Bookings/ControllersLogic/UpdateBookingAmountOnHoldLogic.php index f185a1d0..02b64e36 100644 --- a/app/Classes/Modules/Bookings/ControllersLogic/UpdateBookingAmountOnHoldLogic.php +++ b/app/Classes/Modules/Bookings/ControllersLogic/UpdateBookingAmountOnHoldLogic.php @@ -6,14 +6,14 @@ use App\Classes\Modules\Bookings\Services\UpdatesBookingFixedAmount; use App\Classes\Modules\Transactions\Services\UpdatesTransactionStatus; use App\Classes\Modules\Bookings\Services\FetchesBooking; use App\Classes\Modules\Bookings\Standards\Rules\CanUpdateBooking; -use App\Classes\Modules\Settings\Services\CreatesKeyValuePair; -use App\Classes\Modules\Settings\Services\UpdatesKeyValuePair; +use App\Classes\Modules\KeyValuePairs\Services\CreatesKeyValuePair; +use App\Classes\Modules\KeyValuePairs\Services\UpdatesKeyValuePair; use App\Classes\Modules\Bookings\Services\CalculatesBookingOutstanding; use App\Classes\ValueObjects\Constants\ApprovalStatus; use App\Classes\ValueObjects\Constants\TransactionType; use App\Classes\Exceptions\MalformedRequestException; use App\Classes\General\Abstracts\AbstractControllerLogic; -use App\Classes\Modules\Accounts\DataTransferObjects\KeyValuePairObject; +use App\Classes\Modules\KeyValuePairs\DataTransferObjects\KeyValuePairObject; use App\Classes\ValueObjects\Constants\KVPKey; use App\Http\Resources\BookingResource; use Illuminate\Http\JsonResponse; diff --git a/app/Classes/Modules/Imports/ControllersLogic/ImportExcelLogic.php b/app/Classes/Modules/Imports/ControllersLogic/ImportExcelLogic.php index 347716eb..63f6d45d 100644 --- a/app/Classes/Modules/Imports/ControllersLogic/ImportExcelLogic.php +++ b/app/Classes/Modules/Imports/ControllersLogic/ImportExcelLogic.php @@ -7,10 +7,10 @@ use App\Classes\Exceptions\MalformedRequestException; use App\Classes\General\Abstracts\AbstractControllerLogic; use App\Classes\Jobs\Commands\V2\ProcessPaymentReportV2CommandJob; use App\Classes\Jobs\Commands\V2\ProcessSalesInvoiceReportV2CommandJob; -use App\Classes\Modules\Settings\Services\CreatesKeyValuePair; -use App\Classes\Modules\Settings\Services\UpdatesKeyValuePair; +use App\Classes\Modules\KeyValuePairs\Services\CreatesKeyValuePair; +use App\Classes\Modules\KeyValuePairs\Services\UpdatesKeyValuePair; use App\Classes\Modules\Documents\DataTransferObjects\DocumentObject; -use App\Classes\Modules\Accounts\DataTransferObjects\KeyValuePairObject; +use App\Classes\Modules\KeyValuePairs\DataTransferObjects\KeyValuePairObject; use App\Classes\Modules\Imports\Services\AutoCountDataImport; use App\Classes\ValueObjects\Constants\ApprovalStatus; use App\Classes\ValueObjects\Constants\KVPKey; diff --git a/app/Classes/Modules/KeyValuePairs/ControllersLogic/CreateChatGPTPromptKVPLogic.php b/app/Classes/Modules/KeyValuePairs/ControllersLogic/CreateChatGPTPromptKVPLogic.php index 103f002e..39beec6b 100644 --- a/app/Classes/Modules/KeyValuePairs/ControllersLogic/CreateChatGPTPromptKVPLogic.php +++ b/app/Classes/Modules/KeyValuePairs/ControllersLogic/CreateChatGPTPromptKVPLogic.php @@ -4,8 +4,8 @@ namespace App\Classes\Modules\KeyValuePairs\ControllersLogic; use App\Classes\General\Abstracts\AbstractControllerLogic; -use App\Classes\Modules\Accounts\DataTransferObjects\KeyValuePairObject; -use App\Classes\Modules\Accounts\Services\CreatesKeyValuePair; +use App\Classes\Modules\KeyValuePairs\DataTransferObjects\KeyValuePairObject; +use App\Classes\Modules\KeyValuePairs\Services\CreatesKeyValuePair; use App\Classes\Modules\KeyValuePairs\DataTransferObjects\CreateChatGPTPromptDTO; use App\Classes\Modules\KeyValuePairs\Standards\Rules\CanCreateChatGPTPrompt; use App\Classes\ValueObjects\Constants\KVPKey; diff --git a/app/Classes/Modules/KeyValuePairs/ControllersLogic/CreateClaudePromptKVPLogic.php b/app/Classes/Modules/KeyValuePairs/ControllersLogic/CreateClaudePromptKVPLogic.php index 940b9f8e..91312077 100644 --- a/app/Classes/Modules/KeyValuePairs/ControllersLogic/CreateClaudePromptKVPLogic.php +++ b/app/Classes/Modules/KeyValuePairs/ControllersLogic/CreateClaudePromptKVPLogic.php @@ -4,8 +4,8 @@ namespace App\Classes\Modules\KeyValuePairs\ControllersLogic; use App\Classes\General\Abstracts\AbstractControllerLogic; -use App\Classes\Modules\Accounts\DataTransferObjects\KeyValuePairObject; -use App\Classes\Modules\Accounts\Services\CreatesKeyValuePair; +use App\Classes\Modules\KeyValuePairs\DataTransferObjects\KeyValuePairObject; +use App\Classes\Modules\KeyValuePairs\Services\CreatesKeyValuePair; use App\Classes\Modules\KeyValuePairs\DataTransferObjects\CreateClaudePromptDTO; use App\Classes\Modules\KeyValuePairs\Standards\Rules\CanCreateClaudePrompt; use App\Classes\ValueObjects\Constants\KVPKey; diff --git a/app/Classes/Modules/Settings/ControllersLogic/CreateLockLogic.php b/app/Classes/Modules/KeyValuePairs/ControllersLogic/CreateLockLogic.php similarity index 87% rename from app/Classes/Modules/Settings/ControllersLogic/CreateLockLogic.php rename to app/Classes/Modules/KeyValuePairs/ControllersLogic/CreateLockLogic.php index 0dd83853..76c8d559 100644 --- a/app/Classes/Modules/Settings/ControllersLogic/CreateLockLogic.php +++ b/app/Classes/Modules/KeyValuePairs/ControllersLogic/CreateLockLogic.php @@ -1,11 +1,11 @@ input('password'); // if($password !== 'prototype'){ // throw new AccessForbiddenException('Incorrect Password'); diff --git a/app/Classes/Modules/KeyValuePairs/ControllersLogic/DeleteChatGPTPromptKVPLogic.php b/app/Classes/Modules/KeyValuePairs/ControllersLogic/DeleteChatGPTPromptKVPLogic.php index 87cc9450..6c611a44 100644 --- a/app/Classes/Modules/KeyValuePairs/ControllersLogic/DeleteChatGPTPromptKVPLogic.php +++ b/app/Classes/Modules/KeyValuePairs/ControllersLogic/DeleteChatGPTPromptKVPLogic.php @@ -4,8 +4,8 @@ namespace App\Classes\Modules\KeyValuePairs\ControllersLogic; use App\Classes\General\Abstracts\AbstractControllerLogic; -use App\Classes\Modules\Accounts\Services\DeletesKeyValuePair; -use App\Classes\Modules\Accounts\Services\FetchesKeyValuePair; +use App\Classes\Modules\KeyValuePairs\Services\DeletesKeyValuePair; +use App\Classes\Modules\KeyValuePairs\Services\FetchesKeyValuePair; use App\Classes\Modules\KeyValuePairs\Standards\Rules\CanDeleteChatGPTPrompt; use Illuminate\Http\JsonResponse; use Illuminate\Http\Request; diff --git a/app/Classes/Modules/KeyValuePairs/ControllersLogic/DeleteClaudePromptKVPLogic.php b/app/Classes/Modules/KeyValuePairs/ControllersLogic/DeleteClaudePromptKVPLogic.php index b61b11b9..c0666389 100644 --- a/app/Classes/Modules/KeyValuePairs/ControllersLogic/DeleteClaudePromptKVPLogic.php +++ b/app/Classes/Modules/KeyValuePairs/ControllersLogic/DeleteClaudePromptKVPLogic.php @@ -4,8 +4,8 @@ namespace App\Classes\Modules\KeyValuePairs\ControllersLogic; use App\Classes\General\Abstracts\AbstractControllerLogic; -use App\Classes\Modules\Accounts\Services\DeletesKeyValuePair; -use App\Classes\Modules\Accounts\Services\FetchesKeyValuePair; +use App\Classes\Modules\KeyValuePairs\Services\DeletesKeyValuePair; +use App\Classes\Modules\KeyValuePairs\Services\FetchesKeyValuePair; use App\Classes\Modules\KeyValuePairs\Standards\Rules\CanDeleteClaudePrompt; use Illuminate\Http\JsonResponse; use Illuminate\Http\Request; diff --git a/app/Classes/Modules/Settings/ControllersLogic/FetchLockLogic.php b/app/Classes/Modules/KeyValuePairs/ControllersLogic/FetchLockLogic.php similarity index 94% rename from app/Classes/Modules/Settings/ControllersLogic/FetchLockLogic.php rename to app/Classes/Modules/KeyValuePairs/ControllersLogic/FetchLockLogic.php index a9961331..2165b2d0 100644 --- a/app/Classes/Modules/Settings/ControllersLogic/FetchLockLogic.php +++ b/app/Classes/Modules/KeyValuePairs/ControllersLogic/FetchLockLogic.php @@ -1,6 +1,6 @@ canFetchBooking->passes(); // $query = $this->fetchesKeyValuePair->execute(['marking' => $request->route('marking'), 'with_transactions' => true]); diff --git a/app/Classes/Modules/Settings/ControllersLogic/ListLocksLogic.php b/app/Classes/Modules/KeyValuePairs/ControllersLogic/ListLocksLogic.php similarity index 90% rename from app/Classes/Modules/Settings/ControllersLogic/ListLocksLogic.php rename to app/Classes/Modules/KeyValuePairs/ControllersLogic/ListLocksLogic.php index dc5de052..46e47f2c 100644 --- a/app/Classes/Modules/Settings/ControllersLogic/ListLocksLogic.php +++ b/app/Classes/Modules/KeyValuePairs/ControllersLogic/ListLocksLogic.php @@ -1,10 +1,10 @@ canListServiceTypes->passes(); $query = $this->listsKeyValuePairs->execute($this->listsKeyValuePairs->deserializeFilters($request->input('filters'))); diff --git a/app/Classes/Modules/KeyValuePairs/ControllersLogic/UpdateChatGPTPromptKVPLogic.php b/app/Classes/Modules/KeyValuePairs/ControllersLogic/UpdateChatGPTPromptKVPLogic.php index 0f8022bf..ddc1365a 100644 --- a/app/Classes/Modules/KeyValuePairs/ControllersLogic/UpdateChatGPTPromptKVPLogic.php +++ b/app/Classes/Modules/KeyValuePairs/ControllersLogic/UpdateChatGPTPromptKVPLogic.php @@ -4,11 +4,11 @@ namespace App\Classes\Modules\KeyValuePairs\ControllersLogic; use App\Classes\General\Abstracts\AbstractControllerLogic; -use App\Classes\Modules\Accounts\DataTransferObjects\KeyValuePairObject; +use App\Classes\Modules\KeyValuePairs\DataTransferObjects\KeyValuePairObject; use App\Classes\Modules\KeyValuePairs\DataTransferObjects\UpdateChatGPTPromptDTO; use App\Classes\Modules\KeyValuePairs\Standards\Rules\CanUpdateChatGPTPrompt; -use App\Classes\Modules\Accounts\Services\FetchesKeyValuePair; -use App\Classes\Modules\Settings\Services\UpdatesKeyValuePair; +use App\Classes\Modules\KeyValuePairs\Services\FetchesKeyValuePair; +use App\Classes\Modules\KeyValuePairs\Services\UpdatesKeyValuePair; use App\Http\Resources\ChatGPTPromptResource; use Illuminate\Http\JsonResponse; use Illuminate\Http\Request; diff --git a/app/Classes/Modules/KeyValuePairs/ControllersLogic/UpdateClaudePromptKVPLogic.php b/app/Classes/Modules/KeyValuePairs/ControllersLogic/UpdateClaudePromptKVPLogic.php index 50ded457..88f8e537 100644 --- a/app/Classes/Modules/KeyValuePairs/ControllersLogic/UpdateClaudePromptKVPLogic.php +++ b/app/Classes/Modules/KeyValuePairs/ControllersLogic/UpdateClaudePromptKVPLogic.php @@ -4,11 +4,11 @@ namespace App\Classes\Modules\KeyValuePairs\ControllersLogic; use App\Classes\General\Abstracts\AbstractControllerLogic; -use App\Classes\Modules\Accounts\DataTransferObjects\KeyValuePairObject; +use App\Classes\Modules\KeyValuePairs\DataTransferObjects\KeyValuePairObject; use App\Classes\Modules\KeyValuePairs\DataTransferObjects\UpdateClaudePromptDTO; use App\Classes\Modules\KeyValuePairs\Standards\Rules\CanUpdateClaudePrompt; -use App\Classes\Modules\Accounts\Services\FetchesKeyValuePair; -use App\Classes\Modules\Settings\Services\UpdatesKeyValuePair; +use App\Classes\Modules\KeyValuePairs\Services\FetchesKeyValuePair; +use App\Classes\Modules\KeyValuePairs\Services\UpdatesKeyValuePair; use App\Http\Resources\ClaudePromptResource; use Illuminate\Http\JsonResponse; use Illuminate\Http\Request; diff --git a/app/Classes/Modules/Settings/ControllersLogic/UpdateLockLogic.php b/app/Classes/Modules/KeyValuePairs/ControllersLogic/UpdateLockLogic.php similarity index 88% rename from app/Classes/Modules/Settings/ControllersLogic/UpdateLockLogic.php rename to app/Classes/Modules/KeyValuePairs/ControllersLogic/UpdateLockLogic.php index c131ea62..85c98e8a 100644 --- a/app/Classes/Modules/Settings/ControllersLogic/UpdateLockLogic.php +++ b/app/Classes/Modules/KeyValuePairs/ControllersLogic/UpdateLockLogic.php @@ -1,13 +1,13 @@ input('key'); $kvp = KeyValuePair::whereNull('owner_type') ->whereNull('owner_id') diff --git a/app/Classes/Modules/Accounts/DataTransferObjects/KeyValuePairObject.php b/app/Classes/Modules/KeyValuePairs/DataTransferObjects/KeyValuePairObject.php similarity index 91% rename from app/Classes/Modules/Accounts/DataTransferObjects/KeyValuePairObject.php rename to app/Classes/Modules/KeyValuePairs/DataTransferObjects/KeyValuePairObject.php index fd1eff49..29993692 100644 --- a/app/Classes/Modules/Accounts/DataTransferObjects/KeyValuePairObject.php +++ b/app/Classes/Modules/KeyValuePairs/DataTransferObjects/KeyValuePairObject.php @@ -1,6 +1,6 @@ key = $object->getKey(); - $model->value = $object->getValue(); - - // Owner-less - if (is_null($kv)) { - $model->owner_type = null; - $model->owner_id = null; - $model->save(); - return $model; - } - - return $this->handler($kv->attributesKVP(), $model); - } -} diff --git a/app/Classes/Modules/Settings/Services/FetchesKeyValuePair.php b/app/Classes/Modules/Settings/Services/FetchesKeyValuePair.php deleted file mode 100644 index 0ba19b84..00000000 --- a/app/Classes/Modules/Settings/Services/FetchesKeyValuePair.php +++ /dev/null @@ -1,34 +0,0 @@ -repository = $repository; - } - - - /** - * @return Builder - */ - public function getRepository(): Builder - { - return $this->repository->newQuery(); - } -} diff --git a/app/Classes/Modules/Settings/Services/ListsKeyValuePairs.php b/app/Classes/Modules/Settings/Services/ListsKeyValuePairs.php deleted file mode 100644 index 4abd5086..00000000 --- a/app/Classes/Modules/Settings/Services/ListsKeyValuePairs.php +++ /dev/null @@ -1,34 +0,0 @@ -repository = $repository; - } - - - /** - * @return Builder - */ - function getRepository(): Builder - { - return $this->repository->newQuery(); - } -} diff --git a/app/Classes/Modules/Transactions/ControllersLogic/CreatePaymentProofDocumentLogic.php b/app/Classes/Modules/Transactions/ControllersLogic/CreatePaymentProofDocumentLogic.php index 412d88ab..99287195 100644 --- a/app/Classes/Modules/Transactions/ControllersLogic/CreatePaymentProofDocumentLogic.php +++ b/app/Classes/Modules/Transactions/ControllersLogic/CreatePaymentProofDocumentLogic.php @@ -99,9 +99,9 @@ class CreatePaymentProofDocumentLogic extends AbstractControllerLogic ] ); - //cief todo: Prototype Period Lock - Starts - $this->updateOrCreateKeyValuePair($transaction->owner->booking, KVPKey::BOOKING_IS_LOCKED, 1); - //cief todo: Prototype Period Lock - Ends + //cief todo: 110 - Prototype Period Lock - Starts + // $this->updateOrCreateKeyValuePair($transaction->owner->booking, KVPKey::BOOKING_IS_LOCKED, 1); + //cief todo: 110 - Prototype Period Lock - Ends // send email to customer // todo: a function to send a proof to the receipiant, they have to give us a email of the receipiant and also need to submiited purchase order diff --git a/app/Classes/Modules/Transactions/ControllersLogic/UpdateRefundTransactionStatusLogic.php b/app/Classes/Modules/Transactions/ControllersLogic/UpdateRefundTransactionStatusLogic.php index ff0ddc02..e4e4577c 100644 --- a/app/Classes/Modules/Transactions/ControllersLogic/UpdateRefundTransactionStatusLogic.php +++ b/app/Classes/Modules/Transactions/ControllersLogic/UpdateRefundTransactionStatusLogic.php @@ -24,9 +24,6 @@ class UpdateRefundTransactionStatusLogic extends AbstractControllerLogic /** @var UpdateRefundTransactionStatusProcessor */ private $updateRefundTransactionStatusProcessor; - /** @var CreateInvoiceTransactionV2Processor */ - private $createInvoiceTransactionV2Processor; - /** * UpdateRefundTransactionStatusLogic constructor. * @param UpdateRefundTransactionStatusProcessor $updateRefundTransactionStatusProcessor diff --git a/app/Classes/Modules/Transactions/Processors/CreateInvoiceTransactionV2Processor.php b/app/Classes/Modules/Transactions/Processors/CreateInvoiceTransactionV2Processor.php index f5425900..cad14d4a 100644 --- a/app/Classes/Modules/Transactions/Processors/CreateInvoiceTransactionV2Processor.php +++ b/app/Classes/Modules/Transactions/Processors/CreateInvoiceTransactionV2Processor.php @@ -138,8 +138,8 @@ class CreateInvoiceTransactionV2Processor ->where('type', TransactionType::PURCHASE_ORDER) ->complete() ->first(); - - if(!$purchaseOrder && $generateEInvoiceRefund){ + + if(!$purchaseOrder){ //was use for $generateEInvoiceRefund true $purchaseOrder = $booking->transactions() ->where('type', TransactionType::PURCHASE_ORDER) diff --git a/app/Classes/Modules/Vouchers/ControllersLogic/CreateVoucherLogic.php b/app/Classes/Modules/Vouchers/ControllersLogic/CreateVoucherLogic.php index c6b702e3..698b99ac 100644 --- a/app/Classes/Modules/Vouchers/ControllersLogic/CreateVoucherLogic.php +++ b/app/Classes/Modules/Vouchers/ControllersLogic/CreateVoucherLogic.php @@ -16,12 +16,12 @@ use App\Classes\Modules\Vouchers\Services\CreatesVoucher; use App\Classes\Modules\Vouchers\Services\FetchesVoucher; use App\Classes\Modules\Vouchers\Services\UpdatesVoucherCampaign; use App\Classes\Modules\Rewards\Services\CreatesUserReward; -use App\Classes\Modules\Settings\Services\CreatesKeyValuePair; -use App\Classes\Modules\Settings\Services\UpdatesKeyValuePair; +use App\Classes\Modules\KeyValuePairs\Services\CreatesKeyValuePair; +use App\Classes\Modules\KeyValuePairs\Services\UpdatesKeyValuePair; use App\Classes\Modules\Vouchers\Standards\Rules\CanCreateVoucher; use App\Classes\Modules\Vouchers\DataTransferObjects\ValidateVoucherifyVoucherObject; use App\Classes\Modules\Vouchers\DataTransferObjects\CreateVoucherObject; -use App\Classes\Modules\Accounts\DataTransferObjects\KeyValuePairObject; +use App\Classes\Modules\KeyValuePairs\DataTransferObjects\KeyValuePairObject; use App\Classes\Modules\Vouchers\DataTransferObjects\VoucherCampaignObject; use App\Classes\ValueObjects\Constants\RoleTypes; use App\Classes\ValueObjects\Constants\Vouchers; diff --git a/app/Classes/Modules/Wallets/Processors/CreditWalletProcessor.php b/app/Classes/Modules/Wallets/Processors/CreditWalletProcessor.php index ef19d638..d2e376e1 100644 --- a/app/Classes/Modules/Wallets/Processors/CreditWalletProcessor.php +++ b/app/Classes/Modules/Wallets/Processors/CreditWalletProcessor.php @@ -2,7 +2,7 @@ namespace App\Classes\Modules\Wallets\Processors; -use App\Classes\Modules\Accounts\DataTransferObjects\KeyValuePairObject; +use App\Classes\Modules\KeyValuePairs\DataTransferObjects\KeyValuePairObject; use App\Models\Wallet; use App\Models\Company; use App\Classes\ValueObjects\Constants\ApprovalStatus; @@ -15,10 +15,11 @@ use App\Classes\Modules\Transactions\Services\CreatesTransaction; use App\Classes\Modules\Wallets\DataTransferObjects\WalletObject; use App\Classes\Modules\Transactions\DataTransferObjects\TransactionObject; use App\Classes\Modules\Transactions\Services\GeneratesTransactionBillNumber; -use App\Classes\Modules\Settings\Services\CreatesKeyValuePair; -use App\Classes\Modules\Settings\Services\UpdatesKeyValuePair; +use App\Classes\Modules\KeyValuePairs\Services\CreatesKeyValuePair; +use App\Classes\Modules\KeyValuePairs\Services\UpdatesKeyValuePair; use App\Classes\ValueObjects\Constants\KVPKey; use App\Models\Transaction; +use Illuminate\Support\Facades\Log; class CreditWalletProcessor { diff --git a/app/Classes/ValueObjects/Constants/KVPKey.php b/app/Classes/ValueObjects/Constants/KVPKey.php index 7d4a4463..66378049 100644 --- a/app/Classes/ValueObjects/Constants/KVPKey.php +++ b/app/Classes/ValueObjects/Constants/KVPKey.php @@ -24,6 +24,16 @@ class KVPKey public const BOOKING_EINVOICE_ELIGIBLE = 'BOOKING_EINVOICE_ELIGIBLE'; + public const AUTOCOUNT_DOCNO_SALES_DEPOSIT_BY_WALLET_OFFICIAL_RECEIPT = 'AUTOCOUNT_DOCNO_SALES_DEPOSIT_BY_WALLET_OR'; + + public const AUTOCOUNT_DOCNO_SALES_DEPOSIT_BY_WALLET_REFUND = 'AUTOCOUNT_DOCNO_SALES_DEPOSIT_BY_WALLET_RF'; + + public const CHATGPT_PROMPT_PREFIX = 'CHATGPT_PROMPT_'; + public const CLAUDE_PROMPT_PREFIX = 'CLAUDE_PROMPT_'; + + public const BOOKING_AMOUNT_UPDATE = 'BOOKING_AMOUNT_UPDATE'; + + public const BOOKING_IS_LOCKED = 'BOOKING_IS_LOCKED'; public const UI_SUPPLIER_PAID_CURRENCY_ORDER_TAB_IS_LOCKED = 'UI_SUPPLIER_PAID_CURRENCY_ORDER_TAB_IS_LOCKED'; @@ -32,12 +42,4 @@ class KVPKey public const UI_PAYMENTS_OPEN_CURRENCY_ORDERS_IS_LOCKED = 'UI_PAYMENTS_OPEN_CURRENCY_ORDERS_IS_LOCKED'; - public const AUTOCOUNT_DOCNO_SALES_DEPOSIT_BY_WALLET_OFFICIAL_RECEIPT = 'AUTOCOUNT_DOCNO_SALES_DEPOSIT_BY_WALLET_OR'; - - public const AUTOCOUNT_DOCNO_SALES_DEPOSIT_BY_WALLET_REFUND = 'AUTOCOUNT_DOCNO_SALES_DEPOSIT_BY_WALLET_RF'; - - public const BOOKING_AMOUNT_UPDATE = 'BOOKING_AMOUNT_UPDATE'; - - public const CHATGPT_PROMPT_PREFIX = 'CHATGPT_PROMPT_'; - public const CLAUDE_PROMPT_PREFIX = 'CLAUDE_PROMPT_'; } diff --git a/app/Http/Controllers/Accounts/CreateSystemUserController.php b/app/Http/Controllers/Accounts/CreateSystemUserController.php index d2967be1..a0e5c810 100644 --- a/app/Http/Controllers/Accounts/CreateSystemUserController.php +++ b/app/Http/Controllers/Accounts/CreateSystemUserController.php @@ -9,7 +9,6 @@ use Illuminate\Http\Request; class CreateSystemUserController { - /** * @param Request $request * @param CreateSystemUserLogic $logic diff --git a/app/Http/Controllers/Affiliate/CreateAffiliateController.php b/app/Http/Controllers/Affiliate/CreateAffiliateController.php index 609bf463..9a0679c7 100644 --- a/app/Http/Controllers/Affiliate/CreateAffiliateController.php +++ b/app/Http/Controllers/Affiliate/CreateAffiliateController.php @@ -3,35 +3,21 @@ namespace App\Http\Controllers\Affiliate; use App\Classes\Modules\Affiliate\ControllersLogic\CreateAffiliateLogic; -use App\Http\Requests\CreateAffiliateRequest; use App\Models\Affiliate; use Illuminate\Http\JsonResponse; +use Illuminate\Http\Request; class CreateAffiliateController { /** - * @param CreateAffiliateRequest $request + * @param Request $request * @param CreateAffiliateLogic $logic * @return JsonResponse * @throws \Illuminate\Auth\Access\AuthorizationException */ - public function create(CreateAffiliateRequest $request, CreateAffiliateLogic $logic): JsonResponse { - $this->authorize('create', Affiliate::class); - return $logic->execute($request); - } - - /** - * Authorize a given action for the current user. - * - * @param mixed $ability - * @param mixed|array $arguments - * @return \Illuminate\Auth\Access\Response - * - * @throws \Illuminate\Auth\Access\AuthorizationException - */ - public function authorize($ability, $arguments = []) + public function create(Request $request, CreateAffiliateLogic $logic): JsonResponse { - return app(\Illuminate\Contracts\Auth\Access\Gate::class)->authorize($ability, $arguments); + return $logic->execute($request); } } diff --git a/app/Http/Controllers/Settings/CreateLockController.php b/app/Http/Controllers/KeyValuePairs/CreateLockController.php similarity index 74% rename from app/Http/Controllers/Settings/CreateLockController.php rename to app/Http/Controllers/KeyValuePairs/CreateLockController.php index 89f13f31..5d9c2635 100644 --- a/app/Http/Controllers/Settings/CreateLockController.php +++ b/app/Http/Controllers/KeyValuePairs/CreateLockController.php @@ -1,8 +1,8 @@ execute($request); } + + /** + * @param Request $request + * @param CheckTransferPeriodLockRuleLogic $logic + * @return JsonResponse + */ + public function checkTransferPeriodLockRule(Request $request, CheckTransferPeriodLockRuleLogic $logic): JsonResponse { + return $logic->execute($request); + } } diff --git a/app/Http/Requests/CreateAffiliateRequest.php b/app/Http/Requests/CreateAffiliateRequest.php index f655794f..babdadf6 100644 --- a/app/Http/Requests/CreateAffiliateRequest.php +++ b/app/Http/Requests/CreateAffiliateRequest.php @@ -31,7 +31,6 @@ class CreateAffiliateRequest extends FormRequest 'min:3', 'max:255', 'regex:/^[a-zA-Z0-9_-]+$/', - 'unique:affiliates,code,NULL,id,deleted_at,NULL' ], 'campaign_name' => 'required|string|max:255', 'campaign_description' => 'nullable|string|max:65535', diff --git a/resources/assets/images/cief_e_invoice.webp b/resources/assets/images/cief_e_invoice.webp new file mode 100644 index 00000000..4ae3024a Binary files /dev/null and b/resources/assets/images/cief_e_invoice.webp differ diff --git a/resources/assets/images/normal_invoice.webp b/resources/assets/images/normal_invoice.webp new file mode 100644 index 00000000..100e95e3 Binary files /dev/null and b/resources/assets/images/normal_invoice.webp differ diff --git a/resources/assets/vue/components/accounts/forms/RegistrationFormComponent.vue b/resources/assets/vue/components/accounts/forms/RegistrationFormComponent.vue index 63771a9f..f971b56e 100644 --- a/resources/assets/vue/components/accounts/forms/RegistrationFormComponent.vue +++ b/resources/assets/vue/components/accounts/forms/RegistrationFormComponent.vue @@ -205,7 +205,9 @@ }, submitForm(){ - this.step === 2 ? this.submit(this.route('api.account.registration.register'), 'post', 'registrationSection', false, false) : this.changeStep('next'); + const urlParams = new URLSearchParams(window.location.search); + const tracking = urlParams.get('tracking'); + this.step === 2 ? this.submit(this.route('api.account.registration.register') + (tracking ? '?tracking=' + tracking : ''), 'post', 'registrationSection', false, false) : this.changeStep('next'); }, successHandler(response){ // fire to gtag manager for fb pixel tracking: CompleteRegistration diff --git a/resources/assets/vue/components/bookings/forms/PurchaseOrderFormComponent.vue b/resources/assets/vue/components/bookings/forms/PurchaseOrderFormComponent.vue index 35281a85..5bce1293 100644 --- a/resources/assets/vue/components/bookings/forms/PurchaseOrderFormComponent.vue +++ b/resources/assets/vue/components/bookings/forms/PurchaseOrderFormComponent.vue @@ -195,7 +195,7 @@
-
+
diff --git a/resources/assets/vue/components/bookings/sections/BookingDetailsSectionComponent.vue b/resources/assets/vue/components/bookings/sections/BookingDetailsSectionComponent.vue index 2c41e14f..978681db 100644 --- a/resources/assets/vue/components/bookings/sections/BookingDetailsSectionComponent.vue +++ b/resources/assets/vue/components/bookings/sections/BookingDetailsSectionComponent.vue @@ -1,8 +1,8 @@