diff --git a/app/Nova/Actions/CheckOnlinePayment.php b/app/Nova/Actions/CheckOnlinePayment.php index 845e48b..f7937c6 100644 --- a/app/Nova/Actions/CheckOnlinePayment.php +++ b/app/Nova/Actions/CheckOnlinePayment.php @@ -5,6 +5,7 @@ namespace App\Nova\Actions; use Illuminate\Bus\Queueable; use Illuminate\Queue\InteractsWithQueue; use Illuminate\Support\Collection; +use Illuminate\Support\Facades\Http; use Laravel\Nova\Actions\Action; use Laravel\Nova\Actions\ActionResponse; use Laravel\Nova\Fields\ActionFields; @@ -36,21 +37,30 @@ class CheckOnlinePayment extends Action $relatedResource->load('branch'); - $username = $relatedResource->branch; - $password = $relatedResource->branch; + if ($onlinePaymentResource->api_client == 'billing_username') { + $username = $relatedResource->branch->billing_username; + $password = $relatedResource->branch->billing_password; + } - // $response = Http::asForm()->post('https://mpi.gov.tm/payment/rest/getOrderStatus.do', [ - // 'language' => 'ru', - // 'orderId' => $onlinePaymentResource->orderId, - // 'userName' => $username, - // 'password' => $password, - // ]); + if ($onlinePaymentResource->api_client == 'billing_visa_master_username') { + $username = $relatedResource->branch->billing_visa_master_username; + $password = $relatedResource->branch->billing_visa_master_password; + } - // $payment_status = $response['ErrorCode'] == '0'; + $response = Http::asForm()->post('https://mpi.gov.tm/payment/rest/getOrderStatus.do', [ + 'language' => 'ru', + 'orderId' => $onlinePaymentResource->orderId, + 'userName' => $username, + 'password' => $password, + ]); - // if ($payment_status) { + $payment_status = $response['ErrorCode'] == '0'; - // } + if ($payment_status) { + return Action::modal('modal', [ + 'message' => 'Tölenen', + ]); + } } /**