NASER connect to hamkar app for orders and prices dynamiclly

This commit is contained in:
gholak tala
2026-05-17 18:57:02 +00:00
parent 3adff03152
commit 8b3c050d17
@@ -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()*/
;
}