Watch
1
0
Fork
You've already forked arc
0
forked from hesabix/arc
arc/hesabixAPI
Repository files (latest commit first)
Filename Latest commit message Latest commit date
Motamed ASA 2d06563b6c feat(tax): send Motamed ASA invoices to the tax sandbox in sandbox mode
Hesabix asked for a sandbox. Motamed ASA's API v2 has no separate sandbox
host: the same base URL, token and client credentials are used, and each
/send member says where it goes with sandBox (API v2 docs, section 05F).
No new table, column or migration; Direct and Fanava are unchanged.

- With tax_settings.sandbox_mode on, every /api/invoice/send member
  (original, return) carries sandBox: true and no fiscalId: ASA accepts it
  only with the business's Sandbox fiscal memory (its default, or the only
  active one) and sends it to the tax organisation's sandbox. The memory id
  issued at sign-up is a production one. In production mode the member
  carries sandBox: false and that memory id, as before.
- editInvoice, cancelInvoice and registerPayment take no sandBox: an invoice
  keeps the environment it was registered in (docs 08D). Each document
  records its environment in extra_info.asa_sandbox (chains sent before this
  change are production), and a sandbox chain has its own internalId
  (hesabix-sandbox-{id}), as ASA keeps internalIds unique per business across
  both environments.
- Changing the setting never moves an invoice. Before the document is marked
  as being sent, a correction or cancellation of an invoice from the other
  environment is refused (MOTAMED_ASA_ENVIRONMENT_MISMATCH); an original or
  return whose chain there is unknown to ASA or was refused starts again in
  the current environment, one registered or in flight is refused. Payment
  registration follows the same rule; reading payments and inquiries work in
  either mode, each chain by its stored internalId. A return must refer to a
  sale of its own environment (MOTAMED_ASA_REFERENCE_OTHER_ENVIRONMENT).
- The MOTAMED_ASA_SANDBOX_UNAVAILABLE guards are removed (settings save,
  provider selection, manual credentials, sending); Fanava's stay.
- Tax settings: Motamed ASA stays selectable in sandbox mode, and a note says
  where invoices go and that the business's Sandbox fiscal memory must be
  registered with Motamed ASA. motamedAsaSandboxNote replaces the now unused
  motamedAsaSandboxUnavailable (ARB and generated files).

Tests: tests/test_motamed_asa_sandbox.py

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-03 04:02:12 +03:00
..
.github/workflows change file permissions 2026-04-14 19:34:55 +03:30
adapters feat(tax): send Motamed ASA invoices to the tax sandbox in sandbox mode 2026-11-03 04:02:12 +03:00
app feat(tax): send Motamed ASA invoices to the tax sandbox in sandbox mode 2026-11-03 04:02:12 +03:00
assets more bug fix in permission control and reports 2026-05-07 22:21:45 +03:30
deployment/systemd Stop deploy pip from stalling on dead extra-index mirrors. 2026-10-28 17:45:51 +03:30
docs fix(invoices): allow sales at exact stock 2026-10-03 17:11:35 +03:30
examples change file permissions 2026-04-14 19:34:55 +03:30
locales feat(office-automation): auto-generate org codes and show the unit tree 2026-11-02 00:02:45 +03:30
migrations feat(inventory): add opt-in lot and expiry tracking for perishables 2026-11-02 23:22:50 +03:30
nginx-conf.d some more bug fix in telephony connector 2026-08-06 07:12:10 +00:00
nginx-snippets some more bug fix in telephony connector 2026-08-06 07:12:10 +00:00
scripts Add the fixed-assets plugin with per-business legal settings. 2026-10-28 16:32:31 +03:30
templates fix(pay-page): post successful deposits to the customer and show a correct receipt 2026-11-02 16:02:05 +03:30
tests feat(tax): send Motamed ASA invoices to the tax sandbox in sandbox mode 2026-11-03 04:02:12 +03:00
vendor/voice_wheels progress in ai 2026-05-28 14:18:39 +00:00
.gitignore chore(repo): remove generated cross-platform artifacts 2026-10-24 21:55:42 +03:30
.pre-commit-config.yaml change file permissions 2026-04-14 19:34:55 +03:30
=0.9.14 change file permissions 2026-04-14 19:34:55 +03:30
=1.15.0 change file permissions 2026-04-14 19:34:55 +03:30
=3.1.0 change file permissions 2026-04-14 19:34:55 +03:30
=5.9.0 change file permissions 2026-04-14 19:34:55 +03:30
alembic.ini change file permissions 2026-04-14 19:34:55 +03:30
alembic_build.ini change file permissions 2026-04-14 19:34:55 +03:30
analyze_business_endpoints.py change file permissions 2026-04-14 19:34:55 +03:30
analyze_migrations.py change file permissions 2026-04-14 19:34:55 +03:30
api.hesabix.ir.conf change file permissions 2026-04-14 19:34:55 +03:30
check_notification_issue.py change file permissions 2026-04-14 19:34:55 +03:30
check_ticket_notification.py change file permissions 2026-04-14 19:34:55 +03:30
debug_telegram_notification.py change file permissions 2026-04-14 19:34:55 +03:30
docker-compose.yml some security bug fix 2026-06-19 22:03:43 +00:00
Dockerfile change file permissions 2026-04-14 19:34:55 +03:30
env.example Merge remote-tracking branch 'pr32/windows-weasyprint-runtime' 2026-10-25 18:06:59 +03:30
f.mirror.hesabix.ir.conf add shabake tamin network 2026-05-20 15:30:21 +00:00
fix_null_strings.sql change file permissions 2026-04-14 19:34:55 +03:30
gradle.mirror.hesabix.ir.conf add shabake tamin network 2026-05-20 15:30:21 +00:00
hesabix.db change file permissions 2026-04-14 19:34:55 +03:30
maven.mirror.hesabix.ir.conf add shabake tamin network 2026-05-20 15:30:21 +00:00
migration_checkpoint.json change file permissions 2026-04-14 19:34:55 +03:30
migrations_backup_20251206_031601.tar.gz change file permissions 2026-04-14 19:34:55 +03:30
mysql.conf change file permissions 2026-04-14 19:34:55 +03:30
p-mirror-pypi.conf add shabake tamin network 2026-05-20 15:30:21 +00:00
pyproject.toml fix(backend): support Windows timezone and CAPTCHA fonts 2026-10-23 21:23:45 +03:30
pytest.ini chore(repo): remove generated cross-platform artifacts 2026-10-24 21:55:42 +03:30
README.md fix(products): optimize Excel import opening balance 2026-10-01 19:44:08 +03:30
rq_worker.py add calendar and note taking 2026-04-15 17:33:30 +00:00
run_migrations.py change file permissions 2026-04-14 19:34:55 +03:30
run_notification_worker.sh big progress 2025-12-09 02:51:12 +00:00
test_create_ticket.sh change file permissions 2026-04-14 19:34:55 +03:30
test_create_ticket_via_api.sh big progress 2025-12-09 02:51:12 +00:00
test_notification_manual.md change file permissions 2026-04-14 19:34:55 +03:30
test_notification_simple.py change file permissions 2026-04-14 19:34:55 +03:30
test_notify_operators.py change file permissions 2026-04-14 19:34:55 +03:30
test_ticket_notification.py change file permissions 2026-04-14 19:34:55 +03:30
test_ticket_with_notification.py change file permissions 2026-04-14 19:34:55 +03:30

Hesabix API

Monolithic modular backend (DDD-lite) using FastAPI + SQLAlchemy + MySQL.

Quickstart (Dev)

  1. Create and fill .env from .env.example.
  2. Install dependencies:
pip install -e .[dev]
  1. Run app:
uvicorn app.main:app --reload

Health endpoint: GET /api/v1/health.

Configuration

  • See app/core/settings.py and .env.example.
  • چت CRM و WebSocket: اگر Redis برای API خاموش است، برای رویدادهای زندهٔ چت باید تک worker یا sticky وب‌سوکت باشد؛ جزییات: docs/CRM_CHAT_WEBSOCKET_DEPLOYMENT.md.
  • معماری، رفتار تراکنشی و راهنمای پایش ایمپورت Excel کالا/خدمت: docs/PRODUCT_EXCEL_IMPORT_PERFORMANCE.md.