35 lines
1.3 KiB
PHP
35 lines
1.3 KiB
PHP
<?php
|
|
|
|
namespace App\Modules\HalkbankOnlinePayment\Controllers;
|
|
|
|
use App\Http\Controllers\Controller;
|
|
use App\Modules\CardOrder\Models\CardOrder;
|
|
use App\Modules\HalkbankOnlinePayment\Repositories\HalkbankOnlinePaymentRepository;
|
|
use App\Modules\OnlinePayment\Repositories\OnlinePaymentRepository;
|
|
use Illuminate\Contracts\View\View;
|
|
use Illuminate\Http\Request;
|
|
|
|
class HalkbankOnlinePaymentController extends Controller
|
|
{
|
|
public function store(Request $request): View
|
|
{
|
|
$request->validate([
|
|
'orderId' => ['required', 'string', 'max:50', 'exists:online_payments,orderId'],
|
|
]);
|
|
|
|
$onlinePaymentRepository = OnlinePaymentRepository::make()
|
|
->paymentProvider(new HalkbankOnlinePaymentRepository);
|
|
|
|
$paymentStatus = $onlinePaymentRepository->checkPayment($request->string('orderId'));
|
|
|
|
return $onlinePaymentRepository->paymentStatusView([
|
|
'success' => $paymentStatus['success'],
|
|
'title' => __('Payment has failed'),
|
|
'pnr' => $paymentStatus['paymentHistory']->orderNumber,
|
|
'branch_name' => $paymentStatus['bank_branch']->name,
|
|
'price_amount' => $paymentStatus['paymentHistory']->amount.' TMT',
|
|
'return_url' => $paymentStatus['return_url'],
|
|
]);
|
|
}
|
|
}
|