From 8b3c050d17409b662ac03204d38a177156b29d13 Mon Sep 17 00:00:00 2001 From: gholak tala Date: Sun, 17 May 2026 18:57:02 +0000 Subject: [PATCH] NASER connect to hamkar app for orders and prices dynamiclly --- .../Controllers/Single/SingleOrderController.php | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/app/Http/Controllers/Single/SingleOrderController.php b/app/Http/Controllers/Single/SingleOrderController.php index b2ce055..6f0290b 100644 --- a/app/Http/Controllers/Single/SingleOrderController.php +++ b/app/Http/Controllers/Single/SingleOrderController.php @@ -463,31 +463,35 @@ class SingleOrderController extends Controller { if ($this->Config('send_to_goldir') == "true") { + $goldir_base_url=$this->Config('goldir_base_url')??'https://gold.ir'; + // $liman_diff = Cnt::where('key', 'goldir_diff')->value('value'); // $liman_price = Cnt::where('key', 'goldir_price')->value('value'); $mazaneh = ($data['direction'] == 1) ? Cnt::where('key', 'goldir_truly_buy_mazaneh')->value('value') : Cnt::where('key', 'goldir_truly_sell_mazaneh')->value('value'); $cash = Cnt::where('key', 'goldir_price')->value('value') * $data['amount']; - $response = Http::withToken(Cnt::where('key', 'goldir')->first()['value'])->post("https://gold.ir/server/customer/order", [ + $response = Http::withToken(Cnt::where('key', 'goldir')->first()['value'])->post($goldir_base_url."/server/customer/order", [ "mazaneh" => ((int)$mazaneh), 'amount' => $data['amount'], 'description' => $this->Config('name_fa') . " - " . auth('customer')->user()->name, 'direction' => $data['direction'], - 'product_id' => 47, - 'cash' => $cash + 'product_id' => $this->Config('hamkar_product_id'), + 'cash' => $cash, + 'input_mode'=> 'gold' ])/*->json()*/ ; if (isset($response['message']) && $response['message'] == 'no authorised') { $cnt = new Cnt(); $response = Http::withToken($cnt->goldir_login())//$this->Config('liman_token')) - ->post("https://gold.ir/server/customer/order", [ + ->post($goldir_base_url."/server/customer/order", [ "mazaneh" => ((int)$mazaneh), 'amount' => $data['amount'], 'description' => $this->Config('name_fa') . " - " . auth('customer')->user()->name, 'direction' => $data['direction'], - 'product_id' => 47, - 'cash' => $cash + 'product_id' => $this->Config('hamkar_product_id'), + 'cash' => $cash, + 'input_mode'=> 'gold' ])/*->json()*/ ; }