This commit is contained in:
nurmuhammet committed 2024-11-23 17:19:25 +05:00
1 parent 2aa8bf9869
commit d8f847346b
7 files changed
+51 -19

No files matched your search

+6 -3
View File
@@ -202,18 +202,21 @@ function localeAppUrl(): string
return config('app.locale_app.url');
}
function convertToOriginalFormat($apiPrice) {
function convertToOriginalFormat($apiPrice)
{
// Convert to float and divide by 100
$originalPrice = intval($apiPrice) / 100;
return number_format($originalPrice, 2, '.', ''); // Format with 2 decimal places
}
function lastDayOfMonth($month, $year) {
function lastDayOfMonth($month, $year)
{
// Create a DateTime object for the first day of the given month
$date = new DateTime("$year-$month-01");
// Modify the date to the last day of the same month
$date->modify('last day of this month');
// Return the formatted date
return $date->format('d');
}
@@ -79,7 +79,7 @@ public function store(Request $request)
public function visaMaster(OnlinePaymentStoreRequest $request)
{
$data = OnlinePaymentRepo::checkPayment($request);
$data = OnlinePaymentRepo::checkPaymentVisaMaster($request);
return view(OnlinePaymentRepo::statusView(), $data);
}
@@ -6,12 +6,14 @@
use App\Repos\Order\Loan\LoanOrderRepo;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\BelongsTo;
use Illuminate\Database\Eloquent\SoftDeletes;
use Spatie\MediaLibrary\HasMedia;
use Spatie\MediaLibrary\InteractsWithMedia;
class SberPaymentOrder extends Model implements HasMedia
{
use InteractsWithMedia;
use SoftDeletes;
/**
* Table
@@ -330,7 +330,17 @@ public function actions(NovaRequest $request): array
return [
MakeSberPaymentAction::make()
->icon('credit-card')
->sole(),
->sole()
->canSee(function ($request) {
if (in_array($this->resource->status, [
OrderRepo::PENDING,
OrderRepo::CANCELLED,
])) {
return false;
}
return true;
}),
];
}
}
@@ -7,17 +7,6 @@
trait NovaVisaMasterPaymentOrderItemAuth
{
/**
* Determine if the current user can view the given resource.
*
* @param \Illuminate\Http\Request $request
* @return bool
*/
public function authorizedToView(Request $request): bool
{
return false;
}
/** Edit button */
public function authorizedToUpdate(Request $request): bool
{
+3 -3
View File
@@ -156,7 +156,7 @@ public static function statusView(): string
return 'orders.cards.online-payment.status';
}
public static function checkPayment(Request $request)
public static function checkPaymentVisaMaster(Request $request)
{
// Find order from history
$paymentHistory = OnlinePaymentHistory::where('orderId', $request->orderId)->first();
@@ -208,8 +208,8 @@ public static function checkPayment(Request $request)
'title' => $payment_status ? __('Payment is successful') : __('Payment has failed'),
'pnr' => $paymentHistory->orderNumber,
'branch_name' => $bank_branch->name,
'price_amount' => convertToOriginalFormat($paymentHistory->amount) . ' TMT',
'return_url' => url('/work-place/resources/nova-visa-master-payment-orders/' . $resource->visa_master_payment_order_id),
'price_amount' => convertToOriginalFormat($paymentHistory->amount).' TMT',
'return_url' => url('/work-place/resources/nova-visa-master-payment-orders/'.$resource->visa_master_payment_order_id),
];
}