fix title
This commit is contained in:
@@ -575,9 +575,11 @@ class TahesabController extends Controller
|
||||
$customer = Customer::where('id', $data['customer_id'])->first();
|
||||
}
|
||||
$data['handler'] = 'wallet';
|
||||
$isDeposit = (int) ($data['direction'] ?? 0) === 0;
|
||||
$sharh = self::accountingWalletDesc($isDeposit, $data['note'] ?? null);
|
||||
$tahesab = $existing ?? Tahesab::create([
|
||||
"customer_id" => $customer->id,
|
||||
"desc" => $data['direction'] == 0 ? "شارژ حساب" : "برداشت از حساب",
|
||||
"desc" => $sharh,
|
||||
"amount" => $data['value'],
|
||||
"type" => "ريال",
|
||||
"date" => Carbon::now(),
|
||||
@@ -610,7 +612,7 @@ class TahesabController extends Controller
|
||||
(int)$day,//Shamsi_Day
|
||||
(int)$data['direction'],//IsDayaftAzMoshtariOrPardakhtBeMoshtari_0_1
|
||||
(int)$data['value'],//Mablagh
|
||||
$data['direction'] == 0 ? "شارژ حساب" : "برداشت از حساب",//Sharh
|
||||
$sharh,//Sharh
|
||||
(string)$this->Config('tahesab_bank_account'), //Name_Bank
|
||||
"$tahesab->id",//Code_Rahgiri
|
||||
-1,//Factor_Code
|
||||
@@ -722,7 +724,7 @@ class TahesabController extends Controller
|
||||
/**
|
||||
* پاداش معرفی — همیشه روی حساب معرف (نه کاربر تازهثبتنامشده).
|
||||
*/
|
||||
public function referrerGoldReward(Customer $invitedCustomer, float $gold, string $desc = 'پاداش بابت معرفی')
|
||||
public function referrerGoldReward(Customer $invitedCustomer, float $gold, string $desc = 'پاداش معرفی')
|
||||
{
|
||||
$referrer = $invitedCustomer->referrer();
|
||||
if (!$referrer) {
|
||||
@@ -876,13 +878,10 @@ class TahesabController extends Controller
|
||||
$isDeposit = (int) ($data['direction'] ?? 1) === 1;
|
||||
$isVorood = $isDeposit ? 1 : 0;
|
||||
|
||||
$action = $isDeposit ? 'شارژ' : 'دشارژ';
|
||||
$kindFa = $mapper->kindLabel($kind);
|
||||
$sharh = !empty($data['note'])
|
||||
? (string) $data['note']
|
||||
: (!empty($data['desc'])
|
||||
? (string) $data['desc']
|
||||
: trim($title !== '' ? "{$action} {$title}" : "{$action} {$kindFa}"));
|
||||
$sharh = self::accountingWalletDesc(
|
||||
$isDeposit,
|
||||
!empty($data['note']) ? (string) $data['note'] : (!empty($data['desc']) ? (string) $data['desc'] : null)
|
||||
);
|
||||
$data['note'] = $sharh;
|
||||
$data['handler'] = 'walletGold';
|
||||
|
||||
|
||||
@@ -1512,9 +1512,11 @@ class ZarinController extends Controller
|
||||
}
|
||||
|
||||
$data['handler'] = 'wallet';
|
||||
$isDeposit = (int) ($data['direction'] ?? 0) === 0;
|
||||
$sharh = self::accountingWalletDesc($isDeposit, $data['note'] ?? null);
|
||||
$zarin = $existing ?? Zarin::create([
|
||||
'customer_id' => $customer->id,
|
||||
'desc' => $data['direction'] == 0 ? 'شارژ حساب' : 'برداشت از حساب',
|
||||
'desc' => $sharh,
|
||||
'amount' => $data['value'],
|
||||
'type' => 'ريال',
|
||||
'date' => Carbon::now(),
|
||||
@@ -1545,7 +1547,7 @@ class ZarinController extends Controller
|
||||
'meghdar' => $data['value'],
|
||||
'fi' => $mazaneh,
|
||||
'hesab' => $customer->moshtari_code,
|
||||
'sharh' => $data['direction'] == 0 ? 'شارژ حساب' : 'برداشت از حساب',
|
||||
'sharh' => $sharh,
|
||||
'ayar' => '750',
|
||||
'movaghat' => '',
|
||||
'idFactor' => '',
|
||||
@@ -1584,7 +1586,7 @@ class ZarinController extends Controller
|
||||
/**
|
||||
* پاداش معرفی — همیشه روی حساب معرف (نه کاربر تازهثبتنامشده).
|
||||
*/
|
||||
public function referrerGoldReward(Customer $invitedCustomer, float $gold, string $desc = 'پاداش بابت معرفی')
|
||||
public function referrerGoldReward(Customer $invitedCustomer, float $gold, string $desc = 'پاداش معرفی')
|
||||
{
|
||||
$referrer = $invitedCustomer->referrer();
|
||||
if (!$referrer) {
|
||||
@@ -1744,12 +1746,10 @@ class ZarinController extends Controller
|
||||
$vazn = $mapper->accountingWeight($product, $rawValue, $data);
|
||||
$isDeposit = (int) ($data['direction'] ?? 1) === 1;
|
||||
$title = $mapper->productTitle($product);
|
||||
$action = $isDeposit ? 'شارژ' : 'دشارژ';
|
||||
$sharh = !empty($data['note'])
|
||||
? (string) $data['note']
|
||||
: (!empty($data['desc'])
|
||||
? (string) $data['desc']
|
||||
: trim($title !== '' ? "{$action} {$title}" : "{$action} {$mapper->kindLabel($mapper->resolveKind($product))}"));
|
||||
$sharh = self::accountingWalletDesc(
|
||||
$isDeposit,
|
||||
!empty($data['note']) ? (string) $data['note'] : (!empty($data['desc']) ? (string) $data['desc'] : null)
|
||||
);
|
||||
$data['note'] = $sharh;
|
||||
$data['handler'] = 'walletGold';
|
||||
$syncAmount = $mapper->isCountDoc($product) ? $count : $vazn;
|
||||
|
||||
@@ -345,6 +345,70 @@ class Controller extends BaseController
|
||||
return 'برداشت ریالی';
|
||||
}
|
||||
|
||||
/** شرح سند حسابداری برای واریز کیف (ریال/طلا) — پرگار، تهحساب، زرین */
|
||||
public static function accountingDepositDesc(?string $note = null): string
|
||||
{
|
||||
return self::normalizeAccountingWalletNote($note, true);
|
||||
}
|
||||
|
||||
/** شرح سند حسابداری برای برداشت کیف (ریال/طلا) — پرگار، تهحساب، زرین */
|
||||
public static function accountingWithdrawDesc(?string $note = null): string
|
||||
{
|
||||
return self::normalizeAccountingWalletNote($note, false);
|
||||
}
|
||||
|
||||
public static function accountingWalletDesc(bool $isDeposit, ?string $note = null): string
|
||||
{
|
||||
return $isDeposit
|
||||
? self::accountingDepositDesc($note)
|
||||
: self::accountingWithdrawDesc($note);
|
||||
}
|
||||
|
||||
/**
|
||||
* شرح سند کیف: پیشفرض «واریز»/«برداشت»؛
|
||||
* note خاص (مثل پاداش معرفی یا توضیح ادمین) حفظ میشود؛
|
||||
* عناوین عمومی واریز/برداشت/شارژ به همان دو کلمه نرمال میشوند.
|
||||
*/
|
||||
public static function normalizeAccountingWalletNote(?string $note, bool $isDeposit): string
|
||||
{
|
||||
$note = trim((string) $note);
|
||||
if ($note === '') {
|
||||
return $isDeposit ? 'واریز' : 'برداشت';
|
||||
}
|
||||
|
||||
if (in_array($note, self::accountingReferralRewardDescAliases(), true)) {
|
||||
return self::accountingReferralRewardDesc();
|
||||
}
|
||||
|
||||
$generic = [
|
||||
'واریز', 'برداشت',
|
||||
'واریز ریالی', 'برداشت ریالی',
|
||||
'واریز طلایی', 'برداشت طلایی',
|
||||
'واریز درگاه', 'واریز آنلاین',
|
||||
'واریز به کیف پول', 'برداشت از کیف پول',
|
||||
'شارژ حساب', 'برداشت از حساب',
|
||||
'شارژ', 'دشارژ',
|
||||
'شارژ طلای کیف اصلی', 'برداشت طلای کیف اصلی',
|
||||
];
|
||||
if (in_array($note, $generic, true)) {
|
||||
return $isDeposit ? 'واریز' : 'برداشت';
|
||||
}
|
||||
|
||||
return $note;
|
||||
}
|
||||
|
||||
/** شرح سند پاداش معرف — باید عین همین متن در همهٔ حسابداریها برود */
|
||||
public static function accountingReferralRewardDesc(): string
|
||||
{
|
||||
return 'پاداش معرفی';
|
||||
}
|
||||
|
||||
/** عناوین قدیمی پاداش معرف برای idempotency / تشخیص دادهٔ قبلی */
|
||||
public static function accountingReferralRewardDescAliases(): array
|
||||
{
|
||||
return ['پاداش معرفی', 'پاداش بابت معرفی'];
|
||||
}
|
||||
|
||||
/**
|
||||
* type و title تراکنش ریالی — بر اساس علامت cash (دادههای قدیمی گاهی type=4 با cash مثبت دارند).
|
||||
*/
|
||||
|
||||
@@ -702,13 +702,16 @@ class PargarInboundController extends Controller
|
||||
$orderId = $withdrawId > 0 ? 'W-' . $withdrawId : 'WLOG-' . $log->id;
|
||||
|
||||
$isDeposit = $signed >= 0;
|
||||
$note = trim((string) ($payload['note'] ?? ''));
|
||||
$docDesc = self::accountingWalletDesc($isDeposit, $note !== '' ? $note : null);
|
||||
|
||||
// قرارداد پرگار (همان چیزی که سند سفارش هم با آن ساخته میشود):
|
||||
// OrderType = 1 → سند «خرید» فروشگاه: وزن بدهکار، ریال بستانکار
|
||||
// OrderType = -1 → سند «فروش» فروشگاه: وزن بستانکار، ریال بدهکار
|
||||
// مانده در پرگار = بستانکار − بدهکار، پس برای اینکه شارژ در حساب مشتری مثبت بنشیند:
|
||||
// شارژ طلای کیف اصلی → باید وزن بستانکار شود → OrderType = -1
|
||||
// واریز ریالی → باید ریال بستانکار شود → OrderType = 1
|
||||
// مانده در پرگار = بستانکار − بدهکار، پس برای اینکه واریز در حساب مشتری مثبت بنشیند:
|
||||
// واریز طلای کیف اصلی → باید وزن بستانکار شود → OrderType = -1
|
||||
// واریز ریالی → باید ریال بستانکار شود → OrderType = 1
|
||||
// برچسب UI پرگار ممکن است همچنان «خرید/فروش پولی» بسازد؛ شرح ارسالی همیشه واریز/برداشت/پاداش است.
|
||||
$orderType = $kind === 'gold'
|
||||
? ($isDeposit ? -1 : 1)
|
||||
: ($isDeposit ? 1 : -1);
|
||||
@@ -727,7 +730,7 @@ class PargarInboundController extends Controller
|
||||
'Weight' => abs($signed),
|
||||
'Price' => 0,
|
||||
'Carat' => 750,
|
||||
'Description' => $isDeposit ? 'شارژ طلای کیف اصلی' : 'برداشت طلای کیف اصلی',
|
||||
'Description' => $docDesc,
|
||||
];
|
||||
}
|
||||
|
||||
@@ -739,14 +742,14 @@ class PargarInboundController extends Controller
|
||||
'PriceType' => 1,
|
||||
'CustomerAccountId' => (int) ($customer->pargar_account_id ?? 0),
|
||||
'ItemId' => $rialItemId > 0 ? $rialItemId : $sync->pargarItemIdGold(),
|
||||
'ItemName' => $isDeposit ? 'واریز ریالی' : 'برداشت ریالی',
|
||||
'ItemName' => $docDesc,
|
||||
'OrderDate' => Jalalian::fromDateTime($log->date ?? $log->created_at)->format('Y/m/d-H:i:s'),
|
||||
'Fee' => 0,
|
||||
'Count' => 0,
|
||||
'Weight' => 0,
|
||||
'Price' => abs($signed),
|
||||
'Carat' => 750,
|
||||
'Description' => $isDeposit ? 'واریز ریالی' : 'برداشت ریالی',
|
||||
'Description' => $docDesc,
|
||||
];
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user