From 9b4b4f3245f1c5b383219a5d1367c8828fe84268 Mon Sep 17 00:00:00 2001 From: gholak tala Date: Mon, 18 May 2026 17:15:24 +0000 Subject: [PATCH] NASER add bedehi/talab api to tahesab controller(commented) --- .../Controllers/Admin/TahesabController.php | 85 ++++++++++++++++++- 1 file changed, 84 insertions(+), 1 deletion(-) diff --git a/app/Http/Controllers/Admin/TahesabController.php b/app/Http/Controllers/Admin/TahesabController.php index eeeeea6..0798fa8 100644 --- a/app/Http/Controllers/Admin/TahesabController.php +++ b/app/Http/Controllers/Admin/TahesabController.php @@ -186,9 +186,92 @@ class TahesabController extends Controller "data" => json_encode($data, JSON_UNESCAPED_UNICODE | JSON_PRETTY_PRINT), "res" => json_encode($response, JSON_UNESCAPED_UNICODE | JSON_PRETTY_PRINT), ]); - + return $data; } + +//if bedehi/talab or charge/decharge +// if($data['bank'] == true) { +// try { +// $response = Http::withoutVerifying()->timeout(10)->withHeaders([ +// 'DBName' => $this->Config('tahesab_db'), +// 'Content-Type' => 'application/json', +// 'Authorization' => "Bearer " . $this->Config('tahesab_token'), +// ])->post((string)env('TAHESAB'), [ +// "DoNewSanadVKHBank" => [ +// 1,//Sabte_Kol_Or_Movaghat_1_0 +// $customer->moshtari_code,//Moshtari_Code +// -1,//Factor_Number +// 1,//Radif_Number +// (int)$year,//Shamsi_Year +// (int)$month,//Shamsi_Month +// (int)$day,//Shamsi_Day +// (int)$data['direction'],//IsDayaftAzMoshtariOrPardakhtBeMoshtari_0_1 +// (int)$data['value'],//Mablagh +// $data['direction'] == 0 ? "شارژ حساب" : "برداشت از حساب",//Sharh +// (string)$this->Config('tahesab_bank_account'), //Name_Bank +// "$tahesab->id",//Code_Rahgiri +// -1,//Factor_Code +// -1, +// //MultiRadif +// ] +// ])->json(); +// } catch (\Exception $e) { +// return $e->getMessage(); +// } +// if ($response['OK']) { +// Tahesab::where('id', $tahesab->id)->update([ +// "sh_factor" => $response['Sh_factor'], +// "tahesab_id" => $response['OK'], +// "tah_id" => $response['ID'], +// "factor_number" => $response['Factor_Number'], +// "data" => json_encode($data, JSON_UNESCAPED_UNICODE | JSON_PRETTY_PRINT), +// "res" => json_encode($response, JSON_UNESCAPED_UNICODE | JSON_PRETTY_PRINT), +// ]); +// +// return $data; +// } +// }else{ +// try { +// $response = Http::withoutVerifying()->timeout(10)->withHeaders([ +// 'DBName' => $this->Config('tahesab_db'), +// 'Content-Type' => 'application/json', +// 'Authorization' => "Bearer " . $this->Config('tahesab_token'), +// ])->post((string)env('TAHESAB'), [ +// "DoNewSanadTalabBedehi" => [ +// 1,//Sabte_Kol_Or_Movaghat_1_0, +// $customer->moshtari_code,//Moshtari_Code +// -1,//Factor_Number +// 1,//Radif_Number +// (int)$year,//Shamsi_Year +// (int)$month,//Shamsi_Month +// (int)$day,//Shamsi_Day +// $data['value'] < 0 ? 0 : 1,//IsBedehiOrTalab_0_1, +// (int)abs($data['value']),//Mablagh +// $data['value'] < 0 ? "بدهکار" : "بستانکار",//Sharh +// $data['note'],//"Baabat", +// 0,//Vazn, +// -1,//Factor_Code +// -1,//HavalehBe_Mcode, +// null,//MultiRadif +// 0,//Jens_Felez, +// "ArzName" +// ] +// ])->json(); +// } catch (\Exception $e) { +// return $e->getMessage(); +// } +// if ($response['OK']) { +// Tahesab::where('id', $tahesab->id)->update([ +// "sh_factor" => $response['Sh_factor'], +// "tahesab_id" => $response['OK'], +// "data" => json_encode($data, JSON_UNESCAPED_UNICODE | JSON_PRETTY_PRINT), +// "res" => json_encode($response, JSON_UNESCAPED_UNICODE | JSON_PRETTY_PRINT), +// ]); +// +// return $data; +// } +// } return false; }