NASER add bedehi/talab api to tahesab controller(commented)

This commit is contained in:
gholak tala
2026-05-18 17:15:24 +00:00
parent 156b39ee7c
commit 9b4b4f3245
@@ -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;
}