wip
This commit is contained in:
@@ -3,7 +3,6 @@
|
||||
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;
|
||||
@@ -22,13 +21,6 @@ class HalkbankOnlinePaymentController extends Controller
|
||||
|
||||
$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'],
|
||||
]);
|
||||
return $onlinePaymentRepository->paymentStatusView($paymentStatus);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -56,6 +56,7 @@ class HalkbankOnlinePaymentRepository implements PaymentProviderContract
|
||||
Log::channel('halkbank_payment_error')
|
||||
->error('Payment error', [
|
||||
'response' => [
|
||||
'title' => 'REGISTER',
|
||||
'error' => $e->getMessage(),
|
||||
'file_line' => $e->getFile().':'.$e->getLine(),
|
||||
],
|
||||
@@ -71,9 +72,39 @@ class HalkbankOnlinePaymentRepository implements PaymentProviderContract
|
||||
return $paymentResponse;
|
||||
}
|
||||
|
||||
public function checkPayment()
|
||||
public function checkPayment(string $orderId): Response
|
||||
{
|
||||
// ...
|
||||
try {
|
||||
$paymentCheckResponse = Http::asForm()->post('https://mpi.gov.tm/payment/rest/getOrderStatus.do', [
|
||||
'language' => 'ru',
|
||||
'orderId' => $orderId,
|
||||
'userName' => $this->username,
|
||||
'password' => $this->password,
|
||||
]);
|
||||
} catch (Exception $e) {
|
||||
Config::set('logging.channels.halkbank_payment_error', [
|
||||
'driver' => 'single',
|
||||
'path' => storage_path('logs/halkbank_payment_error.log'),
|
||||
'level' => 'debug',
|
||||
]);
|
||||
|
||||
Log::channel('halkbank_payment_error')
|
||||
->error('Payment error', [
|
||||
'response' => [
|
||||
'title' => 'CHECKING',
|
||||
'error' => $e->getMessage(),
|
||||
'file_line' => $e->getFile().':'.$e->getLine(),
|
||||
],
|
||||
]);
|
||||
|
||||
return new Response(new GuzzleResponse(
|
||||
503,
|
||||
['Content-Type' => 'application/json'],
|
||||
sprintf('{"ErrorCode":"99","ErrorMessage":"%s"}', $e->getMessage())
|
||||
));
|
||||
}
|
||||
|
||||
return $paymentCheckResponse;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user