wip
This commit is contained in:
@@ -3,11 +3,14 @@
|
||||
namespace App\Modules\VisaMasterPaymentOrder\Nova\Resources;
|
||||
|
||||
use App\Models\Branch\Branch;
|
||||
use App\Models\Payment\OnlinePaymentHistory;
|
||||
use App\Modules\VisaMasterPaymentOrder\Nova\Resources\Item\NovaVisaMasterPaymentOrderItemAuth;
|
||||
use App\Nova\Resource;
|
||||
use Illuminate\Database\Eloquent\Collection;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Support\Facades\Http;
|
||||
use Laravel\Nova\Actions\Action;
|
||||
use Laravel\Nova\Actions\ActionResponse;
|
||||
use Laravel\Nova\Fields\ActionFields;
|
||||
use Laravel\Nova\Fields\Boolean;
|
||||
use Laravel\Nova\Fields\ID;
|
||||
@@ -122,7 +125,42 @@ class NovaVisaMasterPaymentOrderItem extends Resource
|
||||
{
|
||||
return [
|
||||
Action::using('HALKBANK töleg barla', function (ActionFields $fields, Collection $models) {
|
||||
info('yes');
|
||||
$item = $onlinePaymentResource = $models->first();
|
||||
|
||||
$onlinePaymentResource = OnlinePaymentHistory::find($item->online_payment_history_id);
|
||||
|
||||
if (! $onlinePaymentResource) {
|
||||
return ActionResponse::danger('Online payment resource tapylmady');
|
||||
}
|
||||
|
||||
$relatedResource = (new $onlinePaymentResource->online_paymantable_type)
|
||||
->find(id: $onlinePaymentResource->online_paymantable_id);
|
||||
|
||||
if (! $relatedResource) {
|
||||
return ActionResponse::danger('Bu resource tapylmady');
|
||||
}
|
||||
|
||||
$username = $relatedResource->branch->billing_visa_master_username;
|
||||
$password = $relatedResource->branch->billing_visa_master_password;
|
||||
|
||||
if ($username == '') {
|
||||
return Action::modal('modal-response', [
|
||||
'title' => 'HALKBANK API',
|
||||
'body' => 'Ulanyjy ady bilen açar sözi gabat gelmedi',
|
||||
]);
|
||||
}
|
||||
|
||||
$response = Http::asForm()->post('https://mpi.gov.tm/payment/rest/getOrderStatus.do', [
|
||||
'language' => 'ru',
|
||||
'orderId' => $onlinePaymentResource->orderId,
|
||||
'userName' => $username,
|
||||
'password' => $password,
|
||||
]);
|
||||
|
||||
return Action::modal('modal-response', [
|
||||
'title' => 'HALKBANK API',
|
||||
'html' => $this->resultHTML($response),
|
||||
]);
|
||||
})->icon('server')
|
||||
->sole(),
|
||||
];
|
||||
|
||||
Reference in New Issue
Block a user