added pargar

This commit is contained in:
2026-07-05 16:43:34 +03:30
parent 694fddc909
commit 7ac7bbdb90
27 changed files with 1341 additions and 493 deletions
+32
View File
@@ -685,4 +685,36 @@ class ConfigService
throw new UnprocessableEntityHttpException($this->productTradingClosedMessage($product));
}
}
public const ACCOUNTING_NONE = 'none';
public const ACCOUNTING_TAHESAB = 'tahesab';
public const ACCOUNTING_PARGAR = 'pargar';
/** none | tahesab | pargar — از setting accounting_provider */
public function accountingProvider(): string
{
$provider = strtolower(trim($this->getString('accounting_provider', '')));
if (in_array($provider, [self::ACCOUNTING_NONE, self::ACCOUNTING_TAHESAB, self::ACCOUNTING_PARGAR], true)) {
return $provider;
}
if ($this->getString('send_to_pargar', 'false') === 'true') {
return self::ACCOUNTING_PARGAR;
}
if ($this->getString('send_to_tahesab', 'false') === 'true') {
return self::ACCOUNTING_TAHESAB;
}
return self::ACCOUNTING_NONE;
}
public function isTahesabAccounting(): bool
{
return $this->accountingProvider() === self::ACCOUNTING_TAHESAB;
}
public function isPargarAccounting(): bool
{
return $this->accountingProvider() === self::ACCOUNTING_PARGAR;
}
}