This commit is contained in:
2025-09-09 11:06:36 +05:00
parent 4e1f286eb5
commit 0b63d9098e
3 changed files with 125 additions and 44 deletions

View File

@@ -2,10 +2,13 @@
namespace App\Nova\Actions\Sber;
use App\Models\Payment\OnlinePaymentHistory;
use App\Nova\Actions\CheckOnlinePayment;
use Illuminate\Bus\Queueable;
use Illuminate\Queue\InteractsWithQueue;
use Illuminate\Support\Collection;
use Laravel\Nova\Actions\Action;
use Laravel\Nova\Actions\ActionResponse;
use Laravel\Nova\Fields\ActionFields;
use Laravel\Nova\Http\Requests\NovaRequest;
@@ -30,7 +33,41 @@ class SyncWithSystem extends Action
*/
public function handle(ActionFields $fields, Collection $models)
{
//
/** @var \App\Modules\SberPaymentOrder\Models\SberPaymentOrderItem $item */
$item = $models->first();
/** @var \App\Models\Payment\OnlinePaymentHistory $onlinePaymentResource */
$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_sber_username;
$password = $relatedResource->branch->billing_sber_password;
if ($username == '') {
return Action::modal('modal-response', [
'title' => 'HALKBANK API',
'body' => 'Ulanyjy ady bilen açar sözi gabat gelmedi',
]);
}
$response = checkOnlinePayment($onlinePaymentResource->orderId, $username, $password);
// syncWithBankSystem();
return Action::modal('modal-response', [
'title' => 'HALKBANK API',
'html' => CheckOnlinePayment::resultHTML($response),
]);
}
/**