64 lines
2.0 KiB
PHP
64 lines
2.0 KiB
PHP
<?php
|
|
|
|
namespace App\Http\Controllers;
|
|
|
|
use App\Http\Requests\OnlinePaymentStoreRequest;
|
|
use App\Repos\Payment\OnlinePaymentRepo;
|
|
use Illuminate\Contracts\View\View;
|
|
|
|
class OnlinePaymentController extends Controller
|
|
{
|
|
/**
|
|
* Card online payment
|
|
*/
|
|
public function store(OnlinePaymentStoreRequest $request): View
|
|
{
|
|
$data = OnlinePaymentRepo::checkCardOrderPayment($request);
|
|
|
|
return view(OnlinePaymentRepo::statusView(), $data);
|
|
}
|
|
|
|
/**
|
|
* Visa-master online payment
|
|
*/
|
|
public function visaMaster(OnlinePaymentStoreRequest $request): View
|
|
{
|
|
$data = OnlinePaymentRepo::checkPaymentVisaMaster($request);
|
|
|
|
/** @var \App\Models\Payment\OnlinePaymentHistory */
|
|
$paymentHistory = $data['paymentHistory'];
|
|
|
|
/** @var \App\Models\Branch\Branch */
|
|
$bank = $data['bank_branch'];
|
|
|
|
/** @var \App\Modules\VisaMasterPaymentOrder\Models\VisaMasterPaymentOrderItem */
|
|
$resource = $data['resource'];
|
|
|
|
if ($data['success'] && $paymentHistory && is_array($paymentHistory->api_response)) {
|
|
info(OnlinePaymentRepo::syncWithBilling(
|
|
uuid: $paymentHistory->orderId,
|
|
bank_code: $bank->unique_code,
|
|
terminal_id: $paymentHistory->api_response['terminalId'],
|
|
account_number: $resource->parent->sender_datas[0]['deposit_account'],
|
|
rrn: $paymentHistory->api_response['authRefNum'],
|
|
amount: $paymentHistory->api_response['amount'],
|
|
pay_purpose: $resource->created_at->translatedFormat('F').' '.$resource->created_at->format('Y'),
|
|
));
|
|
}
|
|
|
|
return view(OnlinePaymentRepo::statusView(), $data);
|
|
}
|
|
|
|
/**
|
|
* Sber online payment
|
|
*/
|
|
public function sber(OnlinePaymentStoreRequest $request): View
|
|
{
|
|
$data = OnlinePaymentRepo::checkPaymentSber($request);
|
|
|
|
// OnlinePaymentRepo::syncWithBilling();
|
|
|
|
return view(OnlinePaymentRepo::statusView(), $data);
|
|
}
|
|
}
|