Refactor authorization methods in NovaSberPaymentOrderItemAuth to remove redundant user checks and update MakeSberPaymentAction to fix final_amount assignment.
This commit is contained in:
@@ -28,36 +28,18 @@ trait NovaSberPaymentOrderItemAuth
|
||||
/** Edit button */
|
||||
public function authorizedToUpdate(Request $request): bool
|
||||
{
|
||||
$user = auth()->user();
|
||||
|
||||
if ($user->isMe()) {
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/** Update */
|
||||
public function authorizeToUpdate(Request $request): void
|
||||
{
|
||||
$user = auth()->user();
|
||||
|
||||
if ($user->isMe()) {
|
||||
return;
|
||||
}
|
||||
|
||||
throw new AuthorizationException;
|
||||
}
|
||||
|
||||
/** Delete button */
|
||||
public function authorizedToDelete(Request $request)
|
||||
{
|
||||
$user = auth()->user();
|
||||
|
||||
if ($user->isMe()) {
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@@ -207,7 +207,6 @@ class MakeSberPaymentAction extends Action
|
||||
$orderNumber = $onlinePaymentRepo->generateOrderNumber($resource);
|
||||
|
||||
$final_amount = number_format($amount, 2, '', '');
|
||||
$final_amount = '001';
|
||||
|
||||
$paymentResponse = Http::get('https://mpi.gov.tm/payment/rest/register.do', [
|
||||
'orderNumber' => $orderNumber,
|
||||
|
||||
39
app/Nova/Actions/Sber/SyncWithSystem.php
Normal file
39
app/Nova/Actions/Sber/SyncWithSystem.php
Normal file
@@ -0,0 +1,39 @@
|
||||
<?php
|
||||
|
||||
namespace App\Nova\Actions\Sber;
|
||||
|
||||
use Illuminate\Bus\Queueable;
|
||||
use Illuminate\Contracts\Queue\ShouldQueue;
|
||||
use Illuminate\Queue\InteractsWithQueue;
|
||||
use Illuminate\Support\Collection;
|
||||
use Laravel\Nova\Actions\Action;
|
||||
use Laravel\Nova\Fields\ActionFields;
|
||||
use Laravel\Nova\Http\Requests\NovaRequest;
|
||||
|
||||
class SyncWithSystem extends Action
|
||||
{
|
||||
use InteractsWithQueue, Queueable;
|
||||
|
||||
/**
|
||||
* Perform the action on the given models.
|
||||
*
|
||||
* @param \Laravel\Nova\Fields\ActionFields $fields
|
||||
* @param \Illuminate\Support\Collection $models
|
||||
* @return mixed
|
||||
*/
|
||||
public function handle(ActionFields $fields, Collection $models)
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the fields available on the action.
|
||||
*
|
||||
* @param \Laravel\Nova\Http\Requests\NovaRequest $request
|
||||
* @return array
|
||||
*/
|
||||
public function fields(NovaRequest $request)
|
||||
{
|
||||
return [];
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user