From 4d4a499a56be8f0a3ee517153867d1eff259ca1f Mon Sep 17 00:00:00 2001 From: Nurmuhammet Allanov Date: Tue, 9 Sep 2025 16:45:21 +0500 Subject: [PATCH] wip --- app/Nova/Actions/Sber/SyncWithSystem.php | 39 ++++++++++-------------- 1 file changed, 16 insertions(+), 23 deletions(-) diff --git a/app/Nova/Actions/Sber/SyncWithSystem.php b/app/Nova/Actions/Sber/SyncWithSystem.php index 17b9051..e277def 100644 --- a/app/Nova/Actions/Sber/SyncWithSystem.php +++ b/app/Nova/Actions/Sber/SyncWithSystem.php @@ -65,32 +65,25 @@ class SyncWithSystem extends Action pay_purpose: $orderItem->created_at->translatedFormat('F').' '.$orderItem->created_at->format('Y') ); - info(['response' => $systemRawResponse]); + $systemResponse = json_decode($systemRawResponse); - return ActionResponse::message('Sync with system success'); + $success = false; + if (is_object($systemResponse)) { + $success = $systemResponse->errCode == 0; + info('aaa'); + } else { + $success = $systemResponse['errCode'] == 0; + info('bbb'); + } - // $systemResponse = json_decode($systemRawResponse); + $orderItem->update([ + 'synced_with_system' => $success, + ]); - // if (is_object($systemResponse)) { - // $success = $systemResponse->errCode == 0; - // } else { - // $success = $systemResponse['errCode'] == 0; - // } - - // if ($success) { - // $orderItem->update([ - // 'synced_with_system' => true, - // ]); - // } else { - // $orderItem->update([ - // 'synced_with_system' => false, - // ]); - // } - - // return Action::modal('modal-response', [ - // 'html' => $success ? "Success" : "Fail", - // 'title' => $success ? "Success" : "Fail", - // ]); + return Action::modal('modal-response', [ + 'html' => $success ? "Success" : "Fail", + 'title' => $success ? "Success" : "Fail", + ]); } /**