Add AST cache files for AltchaService, API documentation, and AltchaService tests

- Created JSON representation of AltchaService class and its methods, including imports and relationships.
- Added documentation for the Captcha API, detailing endpoints and responses.
- Introduced test cases for AltchaService, covering various functionalities and edge cases.
This commit is contained in:
hamed
2026-07-10 11:42:23 +03:30
parent c3c520801d
commit ec184dfcc8
17 changed files with 1069 additions and 1039 deletions
+26 -10
View File
@@ -23,6 +23,7 @@ interface TaxHistoryRow {
const schema = z.object({
site_name: z.string().min(1, 'نام سایت الزامی است'),
support_phone: z.string(),
altcha_enabled: z.string(),
max_cancel_hours_before: z.string(),
appointment_reminder_hours: z.string(),
// financial engine
@@ -55,6 +56,7 @@ interface Settings extends FormValues {
const toForm = (s: Partial<Settings>): FormValues => ({
site_name: s.site_name ?? 'ClinicPro',
support_phone: s.support_phone ?? '',
altcha_enabled: s.altcha_enabled ?? '0',
max_cancel_hours_before: s.max_cancel_hours_before ?? '24',
appointment_reminder_hours: s.appointment_reminder_hours ?? '2',
appointment_commission_enabled: s.appointment_commission_enabled ?? '0',
@@ -91,7 +93,7 @@ interface SectionDef {
}
const SECTIONS: SectionDef[] = [
{ id: 'general', label: 'عمومی', desc: 'اطلاعات پایه پلتفرم', Icon: Cog6ToothIcon, bg: 'var(--primary-soft)', fg: 'var(--primary)', keywords: 'نام سایت پشتیبانی شماره تلفن brand' },
{ id: 'general', label: 'عمومی', desc: 'اطلاعات پایه پلتفرم', Icon: Cog6ToothIcon, bg: 'var(--primary-soft)', fg: 'var(--primary)', keywords: 'نام سایت پشتیبانی شماره تلفن brand کپچا امنیت altcha captcha بات' },
{ id: 'appointments', label: 'نوبت‌دهی', desc: 'قوانین لغو و یادآوری', Icon: ClockIcon, bg: 'var(--warning-bg)', fg: 'var(--warning)', keywords: 'نوبت لغو یادآور reminder cancel ساعت' },
{ id: 'financial', label: 'مالی', desc: 'پورسانت، مالیات و کارمزدها', Icon: CalculatorIcon, bg: 'var(--info-bg)', fg: 'var(--info)', keywords: 'پورسانت مالیات کارمزد پیامک نوبت مبلغ ریال tax commission' },
{ id: 'payment', label: 'درگاه پرداخت', desc: 'ملت، سپ و حالت تست', Icon: CreditCardIcon, bg: 'var(--success-bg)', fg: 'var(--success)', keywords: 'درگاه پرداخت ملت سپ mellat sep terminal تست gateway' },
@@ -218,6 +220,7 @@ export default function SettingsPage() {
const apptCommissionEnabled = watch('appointment_commission_enabled') === '1';
const upgradeCommissionEnabled = watch('upgrade_commission_enabled') === '1';
const taxEnabled = watch('tax_enabled') === '1';
const altchaEnabled = watch('altcha_enabled') === '1';
const toggle = (name: keyof FormValues, current: boolean) =>
setValue(name, current ? '0' : '1', { shouldDirty: true });
@@ -284,15 +287,28 @@ export default function SettingsPage() {
{/* عمومی */}
{current.id === 'general' && (
<div className="settings-grid">
<Field label="نام سایت" required error={errors.site_name?.message}
hint="عنوانی که در سربرگ سایت و پیامک‌ها استفاده می‌شود.">
<input {...register('site_name')} className={`input${errors.site_name ? ' err' : ''}`} placeholder="نام سایت" />
</Field>
<Field label="شماره پشتیبانی" optional hint="برای نمایش به کاربران در بخش تماس.">
<input {...register('support_phone')} className="input" dir="ltr" placeholder="021-12345678" />
</Field>
</div>
<>
<div className="settings-grid">
<Field label="نام سایت" required error={errors.site_name?.message}
hint="عنوانی که در سربرگ سایت و پیامک‌ها استفاده می‌شود.">
<input {...register('site_name')} className={`input${errors.site_name ? ' err' : ''}`} placeholder="نام سایت" />
</Field>
<Field label="شماره پشتیبانی" optional hint="برای نمایش به کاربران در بخش تماس.">
<input {...register('support_phone')} className="input" dir="ltr" placeholder="021-12345678" />
</Field>
</div>
{/* کپچا (ALTCHA) */}
<div className={`toggle-row${altchaEnabled ? ' on' : ''}`} style={{ marginTop: 18 }}>
<div>
<div className="tr-title">کپچای امنیتی (ALTCHA)</div>
<div className="tr-desc">
محافظت فرمهای ورود/ثبتنام در برابر بات. پیشفرض از متغیر محیطی سرور خوانده میشود؛ این کلید آن را override میکند.
</div>
</div>
<Toggle checked={altchaEnabled} onChange={() => toggle('altcha_enabled', altchaEnabled)} label="کپچای امنیتی ALTCHA" />
</div>
</>
)}
{/* نوبت‌دهی */}