This commit is contained in:
2025-09-25 15:28:35 +05:00
parent f5de6b0a58
commit b6bfcfcdd8
5 changed files with 26 additions and 29 deletions

View File

@@ -3,7 +3,6 @@
use App\Models\Auth\Verification; use App\Models\Auth\Verification;
use App\Models\Ecommerce\Channel\Channel; use App\Models\Ecommerce\Channel\Channel;
use App\Models\Ecommerce\Product\Inventory\Inventory; use App\Models\Ecommerce\Product\Inventory\Inventory;
use App\Models\System\Settings\Settings;
use App\Repositories\Ecommerce\Product\Barcode\BarcodeRepository; use App\Repositories\Ecommerce\Product\Barcode\BarcodeRepository;
use Illuminate\Http\Client\PendingRequest; use Illuminate\Http\Client\PendingRequest;
use Illuminate\Support\Collection; use Illuminate\Support\Collection;
@@ -71,21 +70,21 @@ if (! function_exists('sendSMS')) {
function sendSMS(string|int $phone, string|int $message): mixed function sendSMS(string|int $phone, string|int $message): mixed
{ {
$response = Http::retry( $response = Http::retry(
times: 3, times: 3,
sleepMilliseconds: 50, sleepMilliseconds: 50,
throw: false, throw: false,
when: function (Exception $exception, PendingRequest $request) { when: function (Exception $exception, PendingRequest $request) {
Log::channel('sms_api_error') Log::channel('sms_api_error')
->error('Exception: ', [ ->error('Exception: ', [
'message' => $exception->getMessage(), 'message' => $exception->getMessage(),
'line' => $exception->getLine(), 'line' => $exception->getLine(),
]); ]);
return true; return true;
}) })
->post('http://216.250.14.144:3000/api/data', [ ->post('http://216.250.14.144:3000/api/data', [
'phone' => '+993'.$phone, 'phone' => '+993'.$phone,
'code' => $message, 'code' => $message,
]); ]);
return $response->body(); return $response->body();
@@ -355,7 +354,7 @@ if (! function_exists('calculateProductPriceAmount')) {
*/ */
function halkbankCredentials(string $key = ''): int|string|array function halkbankCredentials(string $key = ''): int|string|array
{ {
return match($key) { return match ($key) {
'username' => 516122500260, 'username' => 516122500260,
'password' => 'MrZsO9wfgWOBjf4', 'password' => 'MrZsO9wfgWOBjf4',
default => [ default => [
@@ -368,7 +367,7 @@ function halkbankCredentials(string $key = ''): int|string|array
/** /**
* Create halkbank order * Create halkbank order
* *
* @param string $price * @param string $price
* @return array{status: string, url: string|null} * @return array{status: string, url: string|null}
*/ */
function createHalkbankOrder($price = 123): array function createHalkbankOrder($price = 123): array

View File

@@ -47,14 +47,14 @@ class OrderController extends Controller
$url = $response['url']; $url = $response['url'];
$order->update([ $order->update([
'halkbank_id' => $response['orderId'] 'halkbank_id' => $response['orderId'],
]); ]);
} }
} }
return response()->rest([ return response()->rest([
'order_id' => $order->id, 'order_id' => $order->id,
'payment_url' => $url 'payment_url' => $url,
], 201); ], 201);
} }

View File

@@ -12,7 +12,7 @@ class OnlinePaymentController extends Controller
public function index(Request $request) public function index(Request $request)
{ {
$request->validate([ $request->validate([
'orderId' => ['required', 'string'] 'orderId' => ['required', 'string'],
]); ]);
$resource = Order::query()->where('halkbank_id', $request->orderId)->first(); $resource = Order::query()->where('halkbank_id', $request->orderId)->first();
@@ -46,7 +46,7 @@ class OnlinePaymentController extends Controller
} }
public function view( public function view(
$status = false, $status,
$message, $message,
string $pnr = '-', string $pnr = '-',
string $branch_name = 'MM.COM.TM', string $branch_name = 'MM.COM.TM',

View File

@@ -33,8 +33,6 @@ class TestController extends Controller
public function ok() public function ok()
{ {
if (! app()->isProduction()) { if (! app()->isProduction()) {
auth()->login(User::where('email', 'nurmuhammet@mail.com')->first()); auth()->login(User::where('email', 'nurmuhammet@mail.com')->first());

View File

@@ -99,13 +99,13 @@ class SendOrderCreatedNotification implements ShouldQueue
// Log::channel('order_sms_notification_sent_activity') // Log::channel('order_sms_notification_sent_activity')
// ->info(sprintf('SMS_SENT_FOR_ORDER[id, phone]: %s, %s', $order->id, orderAdminNumber())); // ->info(sprintf('SMS_SENT_FOR_ORDER[id, phone]: %s, %s', $order->id, orderAdminNumber()));
// User::where('phone_number', orderAdminNumber())->first()->notify( // User::where('phone_number', orderAdminNumber())->first()->notify(
// NovaNotification::make() // NovaNotification::make()
// ->message('Täze sargyt.') // ->message('Täze sargyt.')
// ->action('Gör', sprintf('/turkmenpostadmin/resources/orders/%s', $order->id)) // ->action('Gör', sprintf('/turkmenpostadmin/resources/orders/%s', $order->id))
// ->icon('download') // ->icon('download')
// ->type('info') // ->type('info')
// ); // );
// } // }
} }