Online payment

This commit is contained in:
2024-10-14 20:35:30 +05:00
parent b17357d53f
commit 94cc0e2d19
4 changed files with 76 additions and 26 deletions

View File

@@ -17,30 +17,9 @@ class OnlinePaymentHistory extends Model
protected $table = 'online_payment_histories';
/**
* The attributes that are mass assignable.
* Guarded attributes
*
* @var array<int, string>
* @var array
*/
protected $fillable = [
'refunded_amount',
'booking_number',
'amount',
'depositedAmount',
'orderNumber',
'description',
'orderId',
'cardholderName',
'pan',
'approvalCode',
'expiration',
'formUrl',
'successUrl',
'errorUrl',
'api_client',
'paymentStatus',
'callbackStatus',
'username',
'online_paymantable_id',
'online_paymantable_type',
];
protected $guarded = [];
}

View File

@@ -154,7 +154,7 @@ class MakePaymentNovaVisaMaster extends Action
OnlinePaymentHistory::create([
'online_paymantable_id' => $resource->id,
'online_paymantable_type' => '\App\Modules\VisaMasterPaymentOrder\Models\VisaMasterPaymentOrder',
'amount' => $onlinePaymentRepo->getPrice($paymentMethod == 'usd' ? '902.38' : '1058,60'),
'amount' => number_format($amount, 2, '', ''),
'orderNumber' => $orderNumber,
'description' => 'Visa/Master tölegi',
'orderId' => $paymentResponse['orderId'],
@@ -162,7 +162,7 @@ class MakePaymentNovaVisaMaster extends Action
'successUrl' => route('online-payment-store-visa-master'),
'errorUrl' => route('online-payment-store-visa-master'),
'api_client' => config('app.url'),
'username' => $resource->branch->billing_username,
'username' => $resource->branch->billing_visa_master_username,
'paymentStatus' => OnlinePaymentRepo::PENDING,
]);

View File

@@ -0,0 +1,66 @@
<?php
namespace App\Policies;
use App\Models\Payment\OnlinePaymentHistory;
use App\Models\User;
use Illuminate\Auth\Access\Response;
class OnlinePaymentHistoryPolicy
{
/**
* Determine whether the user can view any models.
*/
public function viewAny(User $user): bool
{
return $user->isAdmin();
}
/**
* Determine whether the user can view the model.
*/
public function view(User $user, OnlinePaymentHistory $onlinePaymentHistory): bool
{
return $user->isAdmin();
}
/**
* Determine whether the user can create models.
*/
public function create(User $user): bool
{
return false;
}
/**
* Determine whether the user can update the model.
*/
public function update(User $user, OnlinePaymentHistory $onlinePaymentHistory): bool
{
return false;
}
/**
* Determine whether the user can delete the model.
*/
public function delete(User $user, OnlinePaymentHistory $onlinePaymentHistory): bool
{
return false;
}
/**
* Determine whether the user can restore the model.
*/
public function restore(User $user, OnlinePaymentHistory $onlinePaymentHistory): bool
{
return false;
}
/**
* Determine whether the user can permanently delete the model.
*/
public function forceDelete(User $user, OnlinePaymentHistory $onlinePaymentHistory): bool
{
return false;
}
}

View File

@@ -7,12 +7,14 @@ use App\Models\Order\Card\CardState;
use App\Models\Order\Card\CardType;
use App\Models\Order\Loan\LoanOrder;
use App\Models\Order\Loan\LoanType;
use App\Models\Payment\OnlinePaymentHistory;
use App\Models\System\Locale\LocaleManager;
use App\Models\System\Location\Province;
use App\Models\System\Roles\Permission;
use App\Models\System\Roles\Role;
use App\Models\User;
use App\Policies\Branch\BranchPolicy;
use App\Policies\OnlinePaymentHistoryPolicy;
use App\Policies\Order\Card\CardStatePolicy;
use App\Policies\Order\Card\CardTypePolicy;
use App\Policies\Order\Loan\LoanOrderPolicy;
@@ -61,6 +63,9 @@ class AuthServiceProvider extends ServiceProvider
// ActionsEvents...
ActionEvent::class => ActionEventPolicy::class,
// Online payment history...
OnlinePaymentHistory::class => OnlinePaymentHistoryPolicy::class,
];
/**