add routes documentation for some plugins

This commit is contained in:
Gloomy 2025-08-24 07:40:17 +00:00
parent b7ecafb3a7
commit fb71c35ac3
4 changed files with 2373 additions and 10 deletions

View file

@ -1,5 +1,10 @@
<?php
/**
* Developed by Mohammad Rezai
* https://pirouz.xyz 2025-08-24
*/
namespace App\Controller;
use App\Entity\Business;
@ -18,9 +23,38 @@ use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\Routing\Annotation\Route;
use Symfony\Component\Security\Http\Attribute\CurrentUser;
use OpenApi\Annotations as OA;
class ApprovalController extends AbstractController
{
/**
* تأیید حواله انبار
*
* @OA\Post(
* path="/api/approval/approve/storeroom/{ticketCode}",
* summary="تأیید حواله انبار",
* tags={"Approval"},
* @OA\Parameter(
* name="ticketCode",
* in="path",
* description="کد حواله انبار",
* required=true,
* @OA\Schema(type="string")
* ),
* @OA\Response(
* response=200,
* description="حواله انبار با موفقیت تأیید شد",
* @OA\JsonContent(
* type="object",
* @OA\Property(property="success", type="boolean", example=true),
* @OA\Property(property="message", type="string", example="حواله انبار با موفقیت تأیید شد")
* )
* ),
* @OA\Response(response=403, description="دسترسی غیرمجاز یا تأیید دو مرحله‌ای فعال نیست"),
* @OA\Response(response=404, description="حواله انبار یافت نشد"),
* @OA\Response(response=500, description="خطا در تأیید حواله انبار")
* )
*/
#[Route('/api/approval/approve/storeroom/{ticketCode}', name: 'api_approval_approve_storeroom', methods: ['POST'])]
public function approveStoreroomTicket(
$ticketCode,
@ -87,6 +121,34 @@ class ApprovalController extends AbstractController
}
}
/**
* لغو تأیید حواله انبار
*
* @OA\Post(
* path="/api/approval/unapprove/storeroom/{ticketCode}",
* summary="لغو تأیید حواله انبار",
* tags={"Approval"},
* @OA\Parameter(
* name="ticketCode",
* in="path",
* description="کد حواله انبار",
* required=true,
* @OA\Schema(type="string")
* ),
* @OA\Response(
* response=200,
* description="حواله انبار با موفقیت لغو تأیید شد",
* @OA\JsonContent(
* type="object",
* @OA\Property(property="success", type="boolean", example=true),
* @OA\Property(property="message", type="string", example="حواله انبار با موفقیت لغو تأیید شد")
* )
* ),
* @OA\Response(response=403, description="دسترسی غیرمجاز یا تأیید دو مرحله‌ای فعال نیست"),
* @OA\Response(response=404, description="حواله انبار یافت نشد"),
* @OA\Response(response=500, description="خطا در لغو تأیید حواله انبار")
* )
*/
#[Route('/api/approval/unapprove/storeroom/{ticketCode}', name: 'api_approval_unapprove_storeroom', methods: ['POST'])]
public function unapproveStoreroomTicket(
$ticketCode,
@ -153,6 +215,34 @@ class ApprovalController extends AbstractController
}
}
/**
* تأیید فاکتور فروش
*
* @OA\Post(
* path="/api/approval/approve/sales/{docId}",
* summary="تأیید فاکتور فروش",
* tags={"Approval"},
* @OA\Parameter(
* name="docId",
* in="path",
* description="کد فاکتور فروش",
* required=true,
* @OA\Schema(type="string")
* ),
* @OA\Response(
* response=200,
* description="فاکتور فروش با موفقیت تأیید شد",
* @OA\JsonContent(
* type="object",
* @OA\Property(property="success", type="boolean", example=true),
* @OA\Property(property="message", type="string", example="فاکتور فروش با موفقیت تأیید شد")
* )
* ),
* @OA\Response(response=403, description="دسترسی غیرمجاز یا تأیید دو مرحله‌ای فعال نیست"),
* @OA\Response(response=404, description="فاکتور فروش یافت نشد"),
* @OA\Response(response=500, description="خطا در تأیید فاکتور فروش")
* )
*/
#[Route('/api/approval/approve/sales/{docId}', name: 'api_approval_approve_sales', methods: ['POST'])]
public function approveSalesInvoice(
$docId,
@ -232,6 +322,34 @@ class ApprovalController extends AbstractController
}
}
/**
* تأیید گروهی فاکتورهای فروش
*
* @OA\Post(
* path="/api/approval/approve/group/sales",
* summary="تأیید گروهی فاکتورهای فروش",
* tags={"Approval"},
* @OA\RequestBody(
* required=true,
* @OA\JsonContent(
* required={"docIds"},
* @OA\Property(property="docIds", type="array", @OA\Items(type="string"), description="کدهای فاکتورهای فروش")
* )
* ),
* @OA\Response(
* response=200,
* description="فاکتورهای فروش با موفقیت تأیید شدند",
* @OA\JsonContent(
* type="object",
* @OA\Property(property="success", type="boolean", example=true),
* @OA\Property(property="message", type="string", example="فاکتورهای فروش با موفقیت تأیید شدند")
* )
* ),
* @OA\Response(response=403, description="دسترسی غیرمجاز یا تأیید دو مرحله‌ای فعال نیست"),
* @OA\Response(response=404, description="فاکتور فروش یافت نشد"),
* @OA\Response(response=500, description="خطا در تأیید فاکتورهای فروش")
* )
*/
#[Route('/api/approval/approve/group/sales', name: 'api_approval_approve_group_sales', methods: ['POST'])]
public function approveSalesInvoiceGroup(
Request $request,
@ -320,6 +438,34 @@ class ApprovalController extends AbstractController
}
}
/**
* لغو تأیید فاکتور فروش
*
* @OA\Post(
* path="/api/approval/unapprove/sales/{docId}",
* summary="لغو تأیید فاکتور فروش",
* tags={"Approval"},
* @OA\Parameter(
* name="docId",
* in="path",
* description="کد فاکتور فروش",
* required=true,
* @OA\Schema(type="string")
* ),
* @OA\Response(
* response=200,
* description="فاکتور فروش با موفقیت لغو تأیید شد",
* @OA\JsonContent(
* type="object",
* @OA\Property(property="success", type="boolean", example=true),
* @OA\Property(property="message", type="string", example="فاکتور فروش با موفقیت لغو تأیید شد")
* )
* ),
* @OA\Response(response=403, description="دسترسی غیرمجاز یا تأیید دو مرحله‌ای فعال نیست"),
* @OA\Response(response=404, description="فاکتور فروش یافت نشد"),
* @OA\Response(response=500, description="خطا در لغو تأیید فاکتور فروش")
* )
*/
#[Route('/api/approval/unapprove/sales/{docId}', name: 'api_approval_unapprove_sales', methods: ['POST'])]
public function unapproveSalesInvoice(
$docId,
@ -399,6 +545,34 @@ class ApprovalController extends AbstractController
}
}
/**
* تأیید فاکتور خرید
*
* @OA\Post(
* path="/api/approval/approve/buy/{docId}",
* summary="تأیید فاکتور خرید",
* tags={"Approval"},
* @OA\Parameter(
* name="docId",
* in="path",
* description="کد فاکتور خرید",
* required=true,
* @OA\Schema(type="string")
* ),
* @OA\Response(
* response=200,
* description="فاکتور خرید با موفقیت تأیید شد",
* @OA\JsonContent(
* type="object",
* @OA\Property(property="success", type="boolean", example=true),
* @OA\Property(property="message", type="string", example="فاکتور خرید با موفقیت تأیید شد")
* )
* ),
* @OA\Response(response=403, description="دسترسی غیرمجاز یا تأیید دو مرحله‌ای فعال نیست"),
* @OA\Response(response=404, description="فاکتور خرید یافت نشد"),
* @OA\Response(response=500, description="خطا در تأیید فاکتور خرید")
* )
*/
#[Route('/api/approval/approve/buy/{docId}', name: 'api_approval_approve_buy', methods: ['POST'])]
public function approveBuyInvoice(
$docId,
@ -465,6 +639,34 @@ class ApprovalController extends AbstractController
}
}
/**
* تأیید گروهی فاکتورهای خرید
*
* @OA\Post(
* path="/api/approval/approve/group/buy",
* summary="تأیید گروهی فاکتورهای خرید",
* tags={"Approval"},
* @OA\RequestBody(
* required=true,
* @OA\JsonContent(
* required={"docIds"},
* @OA\Property(property="docIds", type="array", @OA\Items(type="string"), description="کدهای فاکتورهای خرید")
* )
* ),
* @OA\Response(
* response=200,
* description="فاکتورهای خرید با موفقیت تأیید شدند",
* @OA\JsonContent(
* type="object",
* @OA\Property(property="success", type="boolean", example=true),
* @OA\Property(property="message", type="string", example="فاکتورهای خرید با موفقیت تأیید شدند")
* )
* ),
* @OA\Response(response=403, description="دسترسی غیرمجاز یا تأیید دو مرحله‌ای فعال نیست"),
* @OA\Response(response=404, description="فاکتور خرید یافت نشد"),
* @OA\Response(response=500, description="خطا در تأیید فاکتورهای خرید")
* )
*/
#[Route('/api/approval/approve/group/buy', name: 'api_approval_approve_group_buy', methods: ['POST'])]
public function approveBuyInvoiceGroup(
Request $request,
@ -541,6 +743,34 @@ class ApprovalController extends AbstractController
}
}
/**
* لغو تأیید فاکتور خرید
*
* @OA\Post(
* path="/api/approval/unapprove/buy/{docId}",
* summary="لغو تأیید فاکتور خرید",
* tags={"Approval"},
* @OA\Parameter(
* name="docId",
* in="path",
* description="کد فاکتور خرید",
* required=true,
* @OA\Schema(type="string")
* ),
* @OA\Response(
* response=200,
* description="فاکتور خرید با موفقیت لغو تأیید شد",
* @OA\JsonContent(
* type="object",
* @OA\Property(property="success", type="boolean", example=true),
* @OA\Property(property="message", type="string", example="فاکتور خرید با موفقیت لغو تأیید شد")
* )
* ),
* @OA\Response(response=403, description="دسترسی غیرمجاز یا تأیید دو مرحله‌ای فعال نیست"),
* @OA\Response(response=404, description="فاکتور خرید یافت نشد"),
* @OA\Response(response=500, description="خطا در لغو تأیید فاکتور خرید")
* )
*/
#[Route('/api/approval/unapprove/buy/{docId}', name: 'api_approval_unapprove_buy', methods: ['POST'])]
public function unapproveBuyInvoice(
$docId,
@ -607,6 +837,34 @@ class ApprovalController extends AbstractController
}
}
/**
* لغو تأیید گروهی فاکتورهای خرید
*
* @OA\Post(
* path="/api/approval/unapprove/group/buy",
* summary="لغو تأیید گروهی فاکتورهای خرید",
* tags={"Approval"},
* @OA\RequestBody(
* required=true,
* @OA\JsonContent(
* required={"docIds"},
* @OA\Property(property="docIds", type="array", @OA\Items(type="string"), description="کدهای فاکتورهای خرید")
* )
* ),
* @OA\Response(
* response=200,
* description="فاکتورهای خرید با موفقیت لغو تأیید شدند",
* @OA\JsonContent(
* type="object",
* @OA\Property(property="success", type="boolean", example=true),
* @OA\Property(property="message", type="string", example="فاکتورهای خرید با موفقیت لغو تأیید شدند")
* )
* ),
* @OA\Response(response=403, description="دسترسی غیرمجاز یا تأیید دو مرحله‌ای فعال نیست"),
* @OA\Response(response=404, description="فاکتور خرید یافت نشد"),
* @OA\Response(response=500, description="خطا در لغو تأیید فاکتورهای خرید")
* )
*/
#[Route('/api/approval/unapprove/group/buy', name: 'api_approval_unapprove_group_buy', methods: ['POST'])]
public function unapproveBuyInvoiceGroup(
Request $request,

View file

@ -1,5 +1,10 @@
<?php
/**
* Developed by Mohammad Rezai
* https://pirouz.xyz 2025-08-24
*/
namespace App\Controller\Plugins;
use App\Repository\PlugWarrantySerialRepository;
@ -15,15 +20,13 @@ use App\Entity\HesabdariDoc;
use App\Entity\Business;
use App\Service\Access;
use App\Service\Log;
use App\Service\Provider;
use App\Service\Jdate;
use PhpOffice\PhpSpreadsheet\IOFactory;
use Symfony\Component\HttpFoundation\File\UploadedFile;
use App\Service\PluginService;
use App\Service\SMS;
use App\Service\registryMGR;
use Symfony\Component\Validator\Constraints as Assert;
use App\Entity\StoreroomTicket;
use OpenApi\Annotations as OA;
class PlugWarrantyController extends AbstractController
{
@ -40,6 +43,47 @@ class PlugWarrantyController extends AbstractController
}
}
/**
* دریافت سریال‌های گارانتی بر اساس حواله انبار
*
* @OA\Get(
* path="/api/plugins/warranty/serials/by-storeroom-ticket/{code}",
* summary="دریافت سریال‌های گارانتی مرتبط با حواله انبار",
* tags={"Warranty Serials"},
* @OA\Parameter(
* name="code",
* in="path",
* description="کد حواله انبار",
* required=true,
* @OA\Schema(type="string")
* ),
* @OA\Response(
* response=200,
* description="سریال‌های گارانتی حواله",
* @OA\JsonContent(
* type="object",
* @OA\Property(property="success", type="boolean", example=true),
* @OA\Property(property="ticketActivationCode", type="string", description="کد فعال‌سازی حواله"),
* @OA\Property(property="items", type="array", @OA\Items(
* type="object",
* @OA\Property(property="serialNumber", type="string", description="شماره سریال"),
* @OA\Property(property="commoditySerial", type="string", description="سریال کالا"),
* @OA\Property(property="commodity", type="object",
* @OA\Property(property="id", type="integer", description="شناسه کالا"),
* @OA\Property(property="name", type="string", description="نام کالا"),
* @OA\Property(property="code", type="string", description="کد کالا")
* ),
* @OA\Property(property="status", type="string", description="وضعیت"),
* @OA\Property(property="activation", type="string", description="فعال‌سازی"),
* @OA\Property(property="activationTicketCode", type="string", description="کد حواله فعال‌سازی"),
* @OA\Property(property="warrantyEndDate", type="string", description="تاریخ پایان گارانتی")
* ))
* )
* ),
* @OA\Response(response=403, description="دسترسی غیرمجاز"),
* @OA\Response(response=404, description="حواله یافت نشد")
* )
*/
#[Route('/api/plugins/warranty/serials/by-storeroom-ticket/{code}', name: 'plugin_warranty_serials_by_storeroom_ticket', methods: ['GET'])]
public function plugin_warranty_serials_by_storeroom_ticket(string $code, Request $request, Access $access, EntityManagerInterface $entityManager, PluginService $pluginService): JsonResponse
{
@ -111,6 +155,45 @@ class PlugWarrantyController extends AbstractController
$this->entityManager = $entityManager;
}
/**
* درخواست تخصیص سریال‌های گارانتی
*
* @OA\Post(
* path="/api/plugins/warranty/assign/request",
* summary="درخواست تخصیص سریال‌های گارانتی به اسناد",
* tags={"Warranty Assignment"},
* @OA\RequestBody(
* required=true,
* @OA\JsonContent(
* required={"items"},
* @OA\Property(property="items", type="array", @OA\Items(
* type="object",
* @OA\Property(property="commodity_id", type="integer", description="شناسه کالا"),
* @OA\Property(property="count", type="integer", description="تعداد"),
* @OA\Property(property="document_id", type="integer", description="شناسه سند"),
* @OA\Property(property="document_item_id", type="integer", description="شناسه آیتم سند")
* ), description="لیست اقلام برای تخصیص")
* )
* ),
* @OA\Response(
* response=200,
* description="سریال‌ها با موفقیت تخصیص داده شدند",
* @OA\JsonContent(
* type="object",
* @OA\Property(property="success", type="boolean", example=true),
* @OA\Property(property="allocated", type="array", @OA\Items(
* type="object",
* @OA\Property(property="commodity_id", type="integer", description="شناسه کالا"),
* @OA\Property(property="allocated", type="array", @OA\Items(type="integer"), description="شناسه‌های سریال‌های تخصیص داده شده")
* ))
* )
* ),
* @OA\Response(response=403, description="دسترسی غیرمجاز"),
* @OA\Response(response=400, description="پارامترهای نامعتبر"),
* @OA\Response(response=404, description="کسب‌وکار یافت نشد"),
* @OA\Response(response=409, description="کد گارانتی کافی موجود نیست")
* )
*/
#[Route('/api/plugins/warranty/assign/request', name: 'plugin_warranty_assign_request', methods: ['POST'])]
public function plugin_warranty_assign_request(Request $request, EntityManagerInterface $em, Access $access, PluginService $pluginService): JsonResponse
{
@ -179,6 +262,40 @@ class PlugWarrantyController extends AbstractController
}
}
/**
* اسکن و تأیید سریال گارانتی
*
* @OA\Post(
* path="/api/plugins/warranty/assign/scan",
* summary="اسکن و تأیید سریال گارانتی برای تخصیص",
* tags={"Warranty Assignment"},
* @OA\RequestBody(
* required=true,
* @OA\JsonContent(
* required={"serialNumber", "commodity_id", "document_item_id"},
* @OA\Property(property="serialNumber", type="string", description="شماره سریال"),
* @OA\Property(property="commodity_id", type="integer", description="شناسه کالا"),
* @OA\Property(property="document_id", type="integer", description="شناسه سند"),
* @OA\Property(property="document_item_id", type="integer", description="شناسه آیتم سند"),
* @OA\Property(property="physicalBoxBarcode", type="string", description="بارکد فیزیکی جعبه"),
* @OA\Property(property="productTypeCode", type="string", description="کد نوع محصول")
* )
* ),
* @OA\Response(
* response=200,
* description="سریال با موفقیت تأیید شد",
* @OA\JsonContent(
* type="object",
* @OA\Property(property="success", type="boolean", example=true),
* @OA\Property(property="message", type="string", example="تأیید شد")
* )
* ),
* @OA\Response(response=403, description="دسترسی غیرمجاز"),
* @OA\Response(response=400, description="پارامترهای ناقص"),
* @OA\Response(response=404, description="کد گارانتی یافت نشد"),
* @OA\Response(response=409, description="وضعیت کد برای اسکن معتبر نیست")
* )
*/
#[Route('/api/plugins/warranty/assign/scan', name: 'plugin_warranty_assign_scan', methods: ['POST'])]
public function plugin_warranty_assign_scan(Request $request, EntityManagerInterface $entityManager, Access $access, PluginService $pluginService): JsonResponse
{
@ -240,6 +357,40 @@ class PlugWarrantyController extends AbstractController
}
}
/**
* دریافت سریال‌های گارانتی بر اساس فاکتور
*
* @OA\Get(
* path="/api/plugins/warranty/serials/by-invoice/{code}",
* summary="دریافت سریال‌های گارانتی مرتبط با فاکتور",
* tags={"Warranty Serials"},
* @OA\Parameter(
* name="code",
* in="path",
* description="کد فاکتور",
* required=true,
* @OA\Schema(type="string")
* ),
* @OA\Response(
* response=200,
* description="سریال‌های گارانتی فاکتور",
* @OA\JsonContent(
* type="object",
* @OA\Property(property="success", type="boolean", example=true),
* @OA\Property(property="items", type="array", @OA\Items(
* type="object",
* @OA\Property(property="serialNumber", type="string", description="شماره سریال"),
* @OA\Property(property="commodity", type="string", description="نام کالا"),
* @OA\Property(property="status", type="string", description="وضعیت"),
* @OA\Property(property="warrantyEndDate", type="string", description="تاریخ پایان گارانتی"),
* @OA\Property(property="expired", type="boolean", description="آیا منقضی شده")
* ))
* )
* ),
* @OA\Response(response=403, description="دسترسی غیرمجاز"),
* @OA\Response(response=404, description="فاکتور یافت نشد")
* )
*/
#[Route('/api/plugins/warranty/serials/by-invoice/{code}', name: 'plugin_warranty_serials_by_invoice', methods: ['GET'])]
public function plugin_warranty_serials_by_invoice(string $code, Request $request, Access $access, EntityManagerInterface $entityManager, PluginService $pluginService): JsonResponse
{
@ -283,6 +434,34 @@ class PlugWarrantyController extends AbstractController
return $this->json(['success' => true, 'items' => $result]);
}
/**
* ارسال سریال‌های گارانتی
*
* @OA\Post(
* path="/api/plugins/warranty/send-serials",
* summary="ارسال سریال‌های گارانتی فاکتور به مشتری",
* tags={"Warranty Serials"},
* @OA\RequestBody(
* required=true,
* @OA\JsonContent(
* required={"invoiceCode", "mobile"},
* @OA\Property(property="invoiceCode", type="string", description="کد فاکتور"),
* @OA\Property(property="mobile", type="string", description="شماره موبایل مشتری")
* )
* ),
* @OA\Response(
* response=200,
* description="سریال‌ها با موفقیت ارسال شدند",
* @OA\JsonContent(
* type="object",
* @OA\Property(property="success", type="boolean", example=true)
* )
* ),
* @OA\Response(response=403, description="دسترسی غیرمجاز"),
* @OA\Response(response=400, description="پارامترهای ناقص"),
* @OA\Response(response=404, description="فاکتور یافت نشد")
* )
*/
#[Route('/api/plugins/warranty/send-serials', name: 'plugin_warranty_send_serials', methods: ['POST'])]
public function plugin_warranty_send_serials(Request $request, Access $access, EntityManagerInterface $entityManager, PluginService $pluginService, SMS $SMS, registryMGR $registryMGR): JsonResponse
{
@ -332,6 +511,35 @@ class PlugWarrantyController extends AbstractController
return $this->json(['success' => true]);
}
/**
* پیش‌نمایش وارد کردن سریال‌های گارانتی
*
* @OA\Post(
* path="/api/plugins/warranty/serials/preview-import",
* summary="پیش‌نمایش فایل اکسل برای وارد کردن سریال‌های گارانتی",
* tags={"Warranty Import"},
* @OA\RequestBody(
* required=true,
* @OA\MediaType(
* mediaType="multipart/form-data",
* @OA\Schema(
* @OA\Property(property="file", type="string", format="binary", description="فایل اکسل")
* )
* )
* ),
* @OA\Response(
* response=200,
* description="پیش‌نمایش داده‌های فایل",
* @OA\JsonContent(
* type="object",
* @OA\Property(property="preview", type="array", @OA\Items(type="object"), description="داده‌های پیش‌نمایش"),
* @OA\Property(property="errors", type="array", @OA\Items(type="string"), description="خطاهای موجود")
* )
* ),
* @OA\Response(response=403, description="دسترسی غیرمجاز"),
* @OA\Response(response=400, description="فایل ارسال نشده است")
* )
*/
#[Route('/api/plugins/warranty/serials/preview-import', name: 'plugin_warranty_serial_preview_import', methods: ['POST'])]
public function plugin_warranty_serial_preview_import(Request $request, Access $access): JsonResponse
{
@ -398,6 +606,34 @@ class PlugWarrantyController extends AbstractController
}
}
/**
* وارد کردن سریال‌های گارانتی از اکسل
*
* @OA\Post(
* path="/api/plugins/warranty/serials/import-excel",
* summary="وارد کردن سریال‌های گارانتی از فایل اکسل",
* tags={"Warranty Import"},
* @OA\RequestBody(
* required=true,
* @OA\MediaType(
* mediaType="multipart/form-data",
* @OA\Schema(
* @OA\Property(property="file", type="string", format="binary", description="فایل اکسل")
* )
* )
* ),
* @OA\Response(
* response=200,
* description="داده‌های استخراج شده از فایل",
* @OA\JsonContent(
* type="object",
* @OA\Property(property="serials", type="array", @OA\Items(type="object"), description="سریال‌های استخراج شده")
* )
* ),
* @OA\Response(response=403, description="دسترسی غیرمجاز"),
* @OA\Response(response=400, description="فایل ارسال نشده است")
* )
*/
#[Route('/api/plugins/warranty/serials/import-excel', name: 'plugin_warranty_serial_import_excel', methods: ['POST'])]
public function plugin_warranty_serial_import_excel(Request $request, EntityManagerInterface $entityManager, Access $access): JsonResponse
{
@ -458,6 +694,60 @@ class PlugWarrantyController extends AbstractController
}
}
/**
* دریافت لیست سریال‌های گارانتی
*
* @OA\Get(
* path="/api/plugins/warranty/serials",
* summary="دریافت لیست سریال‌های گارانتی با فیلترهای مختلف",
* tags={"Warranty Serials"},
* @OA\Parameter(name="page", in="query", description="شماره صفحه", @OA\Schema(type="integer", default=1)),
* @OA\Parameter(name="limit", in="query", description="تعداد در هر صفحه", @OA\Schema(type="integer", default=20)),
* @OA\Parameter(name="status", in="query", description="فیلتر بر اساس وضعیت", @OA\Schema(type="string")),
* @OA\Parameter(name="commodity_id", in="query", description="فیلتر بر اساس کالا", @OA\Schema(type="integer")),
* @OA\Parameter(name="search", in="query", description="جستجو در سریال‌ها", @OA\Schema(type="string")),
* @OA\Response(
* response=200,
* description="لیست سریال‌های گارانتی",
* @OA\JsonContent(
* type="array",
* @OA\Items(
* type="object",
* @OA\Property(property="id", type="integer", description="شناسه سریال"),
* @OA\Property(property="serialNumber", type="string", description="شماره سریال"),
* @OA\Property(property="commodity", type="object",
* @OA\Property(property="id", type="integer", description="شناسه کالا"),
* @OA\Property(property="name", type="string", description="نام کالا"),
* @OA\Property(property="code", type="string", description="کد کالا")
* ),
* @OA\Property(property="dateSubmit", type="string", description="تاریخ ثبت"),
* @OA\Property(property="description", type="string", description="توضیحات"),
* @OA\Property(property="warrantyStartDate", type="string", description="تاریخ شروع گارانتی"),
* @OA\Property(property="warrantyEndDate", type="string", description="تاریخ پایان گارانتی"),
* @OA\Property(property="status", type="string", description="وضعیت"),
* @OA\Property(property="activation", type="string", description="فعال‌سازی"),
* @OA\Property(property="notes", type="string", description="یادداشت‌ها"),
* @OA\Property(property="expired", type="boolean", description="آیا منقضی شده"),
* @OA\Property(property="submitter", type="object",
* @OA\Property(property="id", type="integer", description="شناسه ثبت‌کننده"),
* @OA\Property(property="name", type="string", description="نام ثبت‌کننده")
* ),
* @OA\Property(property="commoditySerial", type="string", description="سریال کالا"),
* @OA\Property(property="buyer", type="object",
* @OA\Property(property="id", type="integer", description="شناسه خریدار"),
* @OA\Property(property="code", type="string", description="کد خریدار"),
* @OA\Property(property="name", type="string", description="نام خریدار"),
* @OA\Property(property="nikename", type="string", description="نام مستعار"),
* @OA\Property(property="mobile", type="string", description="موبایل")
* ),
* @OA\Property(property="activationAt", type="string", description="تاریخ فعال‌سازی"),
* @OA\Property(property="allocatedToDocumentCode", type="string", description="کد سند تخصیص داده شده")
* )
* )
* ),
* @OA\Response(response=403, description="دسترسی غیرمجاز")
* )
*/
#[Route('/api/plugins/warranty/serials', name: 'plugin_warranty_serials', methods: ['GET'])]
public function plugin_warranty_serials(EntityManagerInterface $entityManager, PlugWarrantySerialRepository $repository, Access $access, Request $request): JsonResponse
{
@ -531,6 +821,60 @@ class PlugWarrantyController extends AbstractController
}
}
/**
* دریافت جزئیات یک سریال گارانتی
*
* @OA\Get(
* path="/api/plugins/warranty/serials/{id}",
* summary="دریافت جزئیات کامل یک سریال گارانتی",
* tags={"Warranty Serials"},
* @OA\Parameter(
* name="id",
* in="path",
* description="شناسه سریال گارانتی",
* required=true,
* @OA\Schema(type="integer")
* ),
* @OA\Response(
* response=200,
* description="جزئیات سریال گارانتی",
* @OA\JsonContent(
* type="object",
* @OA\Property(property="id", type="integer", description="شناسه سریال"),
* @OA\Property(property="serialNumber", type="string", description="شماره سریال"),
* @OA\Property(property="commodity", type="object",
* @OA\Property(property="id", type="integer", description="شناسه کالا"),
* @OA\Property(property="name", type="string", description="نام کالا"),
* @OA\Property(property="code", type="string", description="کد کالا")
* ),
* @OA\Property(property="dateSubmit", type="string", description="تاریخ ثبت"),
* @OA\Property(property="description", type="string", description="توضیحات"),
* @OA\Property(property="warrantyStartDate", type="string", description="تاریخ شروع گارانتی"),
* @OA\Property(property="warrantyEndDate", type="string", description="تاریخ پایان گارانتی"),
* @OA\Property(property="status", type="string", description="وضعیت"),
* @OA\Property(property="activation", type="string", description="فعال‌سازی"),
* @OA\Property(property="notes", type="string", description="یادداشت‌ها"),
* @OA\Property(property="expired", type="boolean", description="آیا منقضی شده"),
* @OA\Property(property="submitter", type="object",
* @OA\Property(property="id", type="integer", description="شناسه ثبت‌کننده"),
* @OA\Property(property="name", type="string", description="نام ثبت‌کننده")
* ),
* @OA\Property(property="commoditySerial", type="string", description="سریال کالا"),
* @OA\Property(property="buyer", type="object",
* @OA\Property(property="id", type="integer", description="شناسه خریدار"),
* @OA\Property(property="code", type="string", description="کد خریدار"),
* @OA\Property(property="name", type="string", description="نام خریدار"),
* @OA\Property(property="nikename", type="string", description="نام مستعار"),
* @OA\Property(property="mobile", type="string", description="موبایل")
* ),
* @OA\Property(property="activationAt", type="string", description="تاریخ فعال‌سازی"),
* @OA\Property(property="allocatedToDocumentCode", type="string", description="کد سند تخصیص داده شده")
* )
* ),
* @OA\Response(response=403, description="دسترسی غیرمجاز"),
* @OA\Response(response=404, description="سریال یافت نشد")
* )
*/
#[Route('/api/plugins/warranty/serials/{id}', name: 'plugin_warranty_serial', methods: ['GET'])]
public function plugin_warranty_serial(EntityManagerInterface $entityManager, Access $access, $id): JsonResponse
{
@ -589,6 +933,41 @@ class PlugWarrantyController extends AbstractController
}
}
/**
* افزودن سریال گارانتی جدید
*
* @OA\Post(
* path="/api/plugins/warranty/serials/add",
* summary="افزودن سریال گارانتی جدید",
* tags={"Warranty Serials"},
* @OA\RequestBody(
* required=true,
* @OA\JsonContent(
* required={"serialNumber", "commodity_id"},
* @OA\Property(property="serialNumber", type="string", description="شماره سریال"),
* @OA\Property(property="commodity_id", type="integer", description="شناسه کالا"),
* @OA\Property(property="description", type="string", description="توضیحات"),
* @OA\Property(property="warrantyStartDate", type="string", description="تاریخ شروع گارانتی"),
* @OA\Property(property="warrantyEndDate", type="string", description="تاریخ پایان گارانتی"),
* @OA\Property(property="status", type="string", description="وضعیت"),
* @OA\Property(property="notes", type="string", description="یادداشت‌ها")
* )
* ),
* @OA\Response(
* response=200,
* description="سریال با موفقیت افزوده شد",
* @OA\JsonContent(
* type="object",
* @OA\Property(property="success", type="boolean", example=true),
* @OA\Property(property="message", type="string", example="سریال با موفقیت افزوده شد"),
* @OA\Property(property="id", type="integer", description="شناسه سریال ایجاد شده")
* )
* ),
* @OA\Response(response=403, description="دسترسی غیرمجاز"),
* @OA\Response(response=400, description="شماره سریال تکراری است یا محصول یافت نشد"),
* @OA\Response(response=404, description="کسب‌وکار یافت نشد")
* )
*/
#[Route('/api/plugins/warranty/serials/add', name: 'plugin_warranty_serial_add', methods: ['POST'])]
public function plugin_warranty_serial_add(Request $request, EntityManagerInterface $entityManager, PlugWarrantySerialRepository $repository, Access $access, Log $log): JsonResponse
{
@ -657,6 +1036,74 @@ class PlugWarrantyController extends AbstractController
}
}
/**
* ویرایش سریال گارانتی
*
* @OA\Post(
* path="/api/plugins/warranty/serials/edit/{id}",
* summary="ویرایش اطلاعات سریال گارانتی",
* tags={"Warranty Serials"},
* @OA\Parameter(
* name="id",
* in="path",
* description="شناسه سریال گارانتی",
* required=true,
* @OA\Schema(type="integer")
* ),
* @OA\RequestBody(
* required=true,
* @OA\JsonContent(
* @OA\Property(property="serialNumber", type="string", description="شماره سریال"),
* @OA\Property(property="commodity_id", type="integer", description="شناسه کالا"),
* @OA\Property(property="description", type="string", description="توضیحات"),
* @OA\Property(property="warrantyStartDate", type="string", description="تاریخ شروع گارانتی"),
* @OA\Property(property="warrantyEndDate", type="string", description="تاریخ پایان گارانتی"),
* @OA\Property(property="status", type="string", description="وضعیت"),
* @OA\Property(property="notes", type="string", description="یادداشت‌ها"),
* @OA\Property(property="activation", type="string", description="فعال‌سازی")
* )
* ),
* @OA\Response(
* response=200,
* description="سریال با موفقیت ویرایش شد",
* @OA\JsonContent(
* type="object",
* @OA\Property(property="success", type="boolean", example=true),
* @OA\Property(property="message", type="string", example="سریال با موفقیت ویرایش شد")
* )
* ),
* @OA\Response(response=403, description="دسترسی غیرمجاز"),
* @OA\Response(response=400, description="شماره سریال تکراری است یا محصول یافت نشد"),
* @OA\Response(response=404, description="سریال یافت نشد")
* )
*/
/**
* ویرایش سریال گارانتی
*
* @OA\Post(
* path="/api/plugins/warranty/serials/edit/{id}",
* summary="ویرایش اطلاعات سریال گارانتی",
* tags={"Warranty Serials"},
* @OA\Parameter(name="id", in="path", description="شناسه سریال", required=true, @OA\Schema(type="integer")),
* @OA\RequestBody(required=true, @OA\JsonContent(
* @OA\Property(property="serialNumber", type="string"),
* @OA\Property(property="commodity_id", type="integer"),
* @OA\Property(property="description", type="string"),
* @OA\Property(property="warrantyStartDate", type="string"),
* @OA\Property(property="warrantyEndDate", type="string"),
* @OA\Property(property="status", type="string"),
* @OA\Property(property="notes", type="string"),
* @OA\Property(property="activation", type="string")
* )),
* @OA\Response(response=200, description="سریال ویرایش شد", @OA\JsonContent(
* @OA\Property(property="success", type="boolean", example=true),
* @OA\Property(property="message", type="string", example="سریال با موفقیت ویرایش شد")
* )),
* @OA\Response(response=403, description="دسترسی غیرمجاز"),
* @OA\Response(response=400, description="شماره سریال تکراری است"),
* @OA\Response(response=404, description="سریال یافت نشد")
* )
*/
#[Route('/api/plugins/warranty/serials/edit/{id}', name: 'plugin_warranty_serial_edit', methods: ['POST'])]
public function plugin_warranty_serial_edit(Request $request, EntityManagerInterface $entityManager, PlugWarrantySerialRepository $repository, Access $access, $id, Log $log): JsonResponse
{
@ -753,6 +1200,49 @@ class PlugWarrantyController extends AbstractController
}
}
/**
* حذف سریال گارانتی
*
* @OA\Delete(
* path="/api/plugins/warranty/serials/{id}",
* summary="حذف سریال گارانتی",
* tags={"Warranty Serials"},
* @OA\Parameter(
* name="id",
* in="path",
* description="شناسه سریال گارانتی",
* required=true,
* @OA\Schema(type="integer")
* ),
* @OA\Response(
* response=200,
* description="سریال با موفقیت حذف شد",
* @OA\JsonContent(
* type="object",
* @OA\Property(property="success", type="boolean", example=true),
* @OA\Property(property="message", type="string", example="سریال با موفقیت حذف شد")
* )
* ),
* @OA\Response(response=403, description="دسترسی غیرمجاز"),
* @OA\Response(response=404, description="سریال یافت نشد")
* )
*/
/**
* حذف سریال گارانتی
*
* @OA\Delete(
* path="/api/plugins/warranty/serials/{id}",
* summary="حذف سریال گارانتی",
* tags={"Warranty Serials"},
* @OA\Parameter(name="id", in="path", description="شناسه سریال", required=true, @OA\Schema(type="integer")),
* @OA\Response(response=200, description="سریال حذف شد", @OA\JsonContent(
* @OA\Property(property="success", type="boolean", example=true),
* @OA\Property(property="message", type="string", example="سریال با موفقیت حذف شد")
* )),
* @OA\Response(response=403, description="دسترسی غیرمجاز"),
* @OA\Response(response=404, description="سریال یافت نشد")
* )
*/
#[Route('/api/plugins/warranty/serials/{id}', name: 'plugin_warranty_serial_delete', methods: ['DELETE'])]
public function plugin_warranty_serial_delete(EntityManagerInterface $entityManager, PlugWarrantySerialRepository $repository, Access $access, $id, Log $log): JsonResponse
{
@ -791,6 +1281,69 @@ class PlugWarrantyController extends AbstractController
}
}
/**
* وارد کردن انبوه سریال‌های گارانتی
*
* @OA\Post(
* path="/api/plugins/warranty/serials/bulk-import",
* summary="وارد کردن انبوه سریال‌های گارانتی",
* tags={"Warranty Import"},
* @OA\RequestBody(
* required=true,
* @OA\JsonContent(
* required={"serials"},
* @OA\Property(property="serials", type="array", @OA\Items(
* type="object",
* @OA\Property(property="serialNumber", type="string", description="شماره سریال"),
* @OA\Property(property="commodity_code", type="string", description="کد کالا"),
* @OA\Property(property="description", type="string", description="توضیحات"),
* @OA\Property(property="warrantyStartDate", type="string", description="تاریخ شروع گارانتی"),
* @OA\Property(property="warrantyEndDate", type="string", description="تاریخ پایان گارانتی"),
* @OA\Property(property="status", type="string", description="وضعیت"),
* @OA\Property(property="notes", type="string", description="یادداشت‌ها")
* ), description="لیست سریال‌ها برای وارد کردن")
* )
* ),
* @OA\Response(
* response=200,
* description="عملیات وارد کردن انبوه تکمیل شد",
* @OA\JsonContent(
* type="object",
* @OA\Property(property="success", type="boolean", example=true),
* @OA\Property(property="message", type="string", description="پیام نتیجه"),
* @OA\Property(property="successCount", type="integer", description="تعداد موفق"),
* @OA\Property(property="errorCount", type="integer", description="تعداد خطا"),
* @OA\Property(property="errors", type="array", @OA\Items(type="string"), description="لیست خطاها")
* )
* ),
* @OA\Response(response=403, description="دسترسی غیرمجاز"),
* @OA\Response(response=400, description="داده‌های نامعتبر"),
* @OA\Response(response=404, description="کسب‌وکار یافت نشد")
* )
*/
/**
* وارد کردن انبوه سریال‌های گارانتی
*
* @OA\Post(
* path="/api/plugins/warranty/serials/bulk-import",
* summary="وارد کردن انبوه سریال‌های گارانتی",
* tags={"Warranty Import"},
* @OA\RequestBody(required=true, @OA\JsonContent(
* required={"serials"},
* @OA\Property(property="serials", type="array", @OA\Items(type="object"), description="لیست سریال‌ها")
* )),
* @OA\Response(response=200, description="عملیات تکمیل شد", @OA\JsonContent(
* @OA\Property(property="success", type="boolean", example=true),
* @OA\Property(property="message", type="string"),
* @OA\Property(property="successCount", type="integer"),
* @OA\Property(property="errorCount", type="integer"),
* @OA\Property(property="errors", type="array", @OA\Items(type="string"))
* )),
* @OA\Response(response=403, description="دسترسی غیرمجاز"),
* @OA\Response(response=400, description="داده‌های نامعتبر"),
* @OA\Response(response=404, description="کسب‌وکار یافت نشد")
* )
*/
#[Route('/api/plugins/warranty/serials/bulk-import', name: 'plugin_warranty_serial_bulk_import', methods: ['POST'])]
public function plugin_warranty_serial_bulk_import(Request $request, EntityManagerInterface $entityManager, PlugWarrantySerialRepository $repository, Access $access, Log $log): JsonResponse
{
@ -891,6 +1444,26 @@ class PlugWarrantyController extends AbstractController
}
}
/**
* دریافت آمار سریال‌های گارانتی
*
* @OA\Get(
* path="/api/plugins/warranty/stats",
* summary="دریافت آمار و گزارش سریال‌های گارانتی",
* tags={"Warranty Statistics"},
* @OA\Response(
* response=200,
* description="آمار سریال‌های گارانتی",
* @OA\JsonContent(
* type="object",
* @OA\Property(property="totalSerials", type="integer", description="تعداد کل سریال‌ها"),
* @OA\Property(property="byStatus", type="object", description="تعداد بر اساس وضعیت"),
* @OA\Property(property="expiredFlagCount", type="integer", description="تعداد منقضی شده")
* )
* ),
* @OA\Response(response=403, description="دسترسی غیرمجاز")
* )
*/
#[Route('/api/plugins/warranty/stats', name: 'plugin_warranty_stats', methods: ['GET'])]
public function plugin_warranty_stats(EntityManagerInterface $entityManager, PlugWarrantySerialRepository $repository, Access $access): JsonResponse
{
@ -936,6 +1509,35 @@ class PlugWarrantyController extends AbstractController
}
}
/**
* حذف گروهی سریال‌های گارانتی
*
* @OA\Post(
* path="/api/plugins/warranty/serials/bulk-delete",
* summary="حذف گروهی سریال‌های گارانتی",
* tags={"Warranty Serials"},
* @OA\RequestBody(
* required=true,
* @OA\JsonContent(
* required={"ids"},
* @OA\Property(property="ids", type="array", @OA\Items(type="integer"), description="شناسه‌های سریال‌ها برای حذف")
* )
* ),
* @OA\Response(
* response=200,
* description="سریال‌ها با موفقیت حذف شدند",
* @OA\JsonContent(
* type="object",
* @OA\Property(property="success", type="boolean", example=true),
* @OA\Property(property="message", type="string", description="پیام نتیجه"),
* @OA\Property(property="deletedCount", type="integer", description="تعداد حذف شده"),
* @OA\Property(property="errors", type="array", @OA\Items(type="string"), description="لیست خطاها")
* )
* ),
* @OA\Response(response=403, description="دسترسی غیرمجاز"),
* @OA\Response(response=400, description="هیچ آیتمی برای حذف انتخاب نشده است")
* )
*/
#[Route('/api/plugins/warranty/serials/bulk-delete', name: 'plugin_warranty_serial_bulk_delete', methods: ['POST'])]
public function plugin_warranty_serial_bulk_delete(Request $request, EntityManagerInterface $entityManager, PlugWarrantySerialRepository $repository, Access $access, Log $log): JsonResponse
{
@ -999,6 +1601,26 @@ class PlugWarrantyController extends AbstractController
}
}
/**
* دریافت تنظیمات گارانتی
*
* @OA\Get(
* path="/api/plugins/warranty/settings/get",
* summary="دریافت تنظیمات گارانتی کسب و کار",
* tags={"Warranty Settings"},
* @OA\Response(
* response=200,
* description="تنظیمات گارانتی",
* @OA\JsonContent(
* type="object",
* @OA\Property(property="requireWarrantyOnDelivery", type="boolean", description="آیا گارانتی در تحویل الزامی است"),
* @OA\Property(property="activationGraceDays", type="integer", description="تعداد روزهای مهلت فعال‌سازی"),
* @OA\Property(property="matchWarrantyToSerial", type="boolean", description="آیا گارانتی با سریال مطابقت دارد")
* )
* ),
* @OA\Response(response=403, description="دسترسی غیرمجاز")
* )
*/
#[Route('/api/plugins/warranty/settings/get', name: 'plugin_warranty_settings_get', methods: ['GET'])]
public function plugin_warranty_settings_get(Access $access, registryMGR $registryMGR, EntityManagerInterface $entityManager): JsonResponse
{
@ -1019,6 +1641,32 @@ class PlugWarrantyController extends AbstractController
]);
}
/**
* ذخیره تنظیمات گارانتی
*
* @OA\Post(
* path="/api/plugins/warranty/settings/save",
* summary="ذخیره تنظیمات گارانتی کسب و کار",
* tags={"Warranty Settings"},
* @OA\RequestBody(
* required=true,
* @OA\JsonContent(
* @OA\Property(property="requireWarrantyOnDelivery", type="boolean", description="آیا گارانتی در تحویل الزامی است"),
* @OA\Property(property="activationGraceDays", type="integer", description="تعداد روزهای مهلت فعال‌سازی"),
* @OA\Property(property="matchWarrantyToSerial", type="boolean", description="آیا گارانتی با سریال مطابقت دارد")
* )
* ),
* @OA\Response(
* response=200,
* description="تنظیمات با موفقیت ذخیره شد",
* @OA\JsonContent(
* type="object",
* @OA\Property(property="success", type="boolean", example=true)
* )
* ),
* @OA\Response(response=403, description="دسترسی غیرمجاز")
* )
*/
#[Route('/api/plugins/warranty/settings/save', name: 'plugin_warranty_settings_save', methods: ['POST'])]
public function plugin_warranty_settings_save(Request $request, Access $access, registryMGR $registryMGR, EntityManagerInterface $entityManager): JsonResponse
{

View file

@ -10,7 +10,6 @@ namespace App\Controller\Plugins;
use App\Entity\Business;
use App\Entity\Permission;
use App\Service\Access;
use App\Service\Extractor;
use App\Service\Log;
use App\Service\registryMGR;
use Doctrine\ORM\EntityManagerInterface;
@ -24,6 +23,7 @@ use App\Entity\PluginTaxInvoice;
use App\Dto\TaxSettingsDto;
use Symfony\Component\Validator\Validator\ValidatorInterface;
use App\Entity\User;
use OpenApi\Annotations as OA;
use DateTime;
class TaxSettingsController extends AbstractController
@ -74,6 +74,26 @@ class TaxSettingsController extends AbstractController
return $settings;
}
/**
* دریافت تنظیمات مالیاتی
*
* @OA\Get(
* path="/api/plugins/tax/settings/get",
* summary="دریافت تنظیمات مالیاتی کسب و کار",
* tags={"Tax Settings"},
* @OA\Response(
* response=200,
* description="تنظیمات مالیاتی",
* @OA\JsonContent(
* type="object",
* @OA\Property(property="taxMemoryId", type="string", description="شناسه حافظه مالیاتی"),
* @OA\Property(property="economicCode", type="string", description="کد اقتصادی"),
* @OA\Property(property="privateKey", type="string", description="کلید خصوصی")
* )
* ),
* @OA\Response(response=403, description="دسترسی غیرمجاز")
* )
*/
#[Route('/api/plugins/tax/settings/get', name: 'plugin_tax_settings_get', methods: ['GET'])]
public function plugin_tax_settings_get(EntityManagerInterface $em, Access $access): JsonResponse
{
@ -90,6 +110,35 @@ class TaxSettingsController extends AbstractController
return $this->json($settings);
}
/**
* ذخیره تنظیمات مالیاتی
*
* @OA\Post(
* path="/api/plugins/tax/settings/save",
* summary="ذخیره تنظیمات مالیاتی کسب و کار",
* tags={"Tax Settings"},
* @OA\RequestBody(
* required=true,
* @OA\JsonContent(
* required={"taxMemoryId", "economicCode", "privateKey"},
* @OA\Property(property="taxMemoryId", type="string", description="شناسه حافظه مالیاتی"),
* @OA\Property(property="economicCode", type="string", description="کد اقتصادی"),
* @OA\Property(property="privateKey", type="string", description="کلید خصوصی")
* )
* ),
* @OA\Response(
* response=200,
* description="تنظیمات با موفقیت ذخیره شد",
* @OA\JsonContent(
* type="object",
* @OA\Property(property="success", type="boolean", example=true),
* @OA\Property(property="message", type="string", example="تنظیمات با موفقیت ذخیره شد")
* )
* ),
* @OA\Response(response=403, description="دسترسی غیرمجاز"),
* @OA\Response(response=422, description="اطلاعات نامعتبر")
* )
*/
#[Route('/api/plugins/tax/settings/save', name: 'plugin_tax_settings_save', methods: ['POST'])]
public function plugin_tax_settings_save(Request $request, registryMGR $registryMGR, Access $access, Log $log, EntityManagerInterface $em, ValidatorInterface $validator): JsonResponse
{
@ -119,7 +168,7 @@ class TaxSettingsController extends AbstractController
$businessId = is_object($acc['bid']) ? $acc['bid']->getId() : $acc['bid'];
$user = $this->getUser();
$userId = $user instanceof \App\Entity\User ? $user->getId() : null;
$userId = $user instanceof User ? $user->getId() : null;
$repo = $em->getRepository(PluginTaxsettingsKey::class);
$entity = $repo->findOneBy(['business_id' => $businessId, 'user_id' => $userId]);
@ -127,12 +176,12 @@ class TaxSettingsController extends AbstractController
$entity = new PluginTaxsettingsKey();
$entity->setBusinessId($businessId);
$entity->setUserId($userId);
$entity->setCreatedAt(new \DateTime());
$entity->setCreatedAt(new DateTime());
}
$entity->setPrivateKey($dto->privateKey);
$entity->setTaxMemoryId($dto->taxMemoryId);
$entity->setEconomicCode($dto->economicCode);
$entity->setUpdatedAt(new \DateTime());
$entity->setUpdatedAt(new DateTime());
$em->persist($entity);
$em->flush();
@ -177,6 +226,40 @@ class TaxSettingsController extends AbstractController
return $keyDetails['key'];
}
/**
* تولید کلید و CSR
*
* @OA\Post(
* path="/api/plugins/tax/settings/generate-csr",
* summary="تولید کلید خصوصی، عمومی و CSR برای سامانه مودیان",
* tags={"Tax Settings"},
* @OA\RequestBody(
* required=true,
* @OA\JsonContent(
* required={"nationalId"},
* @OA\Property(property="personType", type="string", enum={"natural", "legal"}, description="نوع شخص"),
* @OA\Property(property="nationalId", type="string", description="شناسه ملی"),
* @OA\Property(property="nameFa", type="string", description="نام فارسی (برای اشخاص حقوقی)"),
* @OA\Property(property="nameEn", type="string", description="نام انگلیسی (برای اشخاص حقوقی)"),
* @OA\Property(property="email", type="string", description="ایمیل (برای اشخاص حقوقی)")
* )
* ),
* @OA\Response(
* response=200,
* description="کلید و CSR با موفقیت تولید شد",
* @OA\JsonContent(
* type="object",
* @OA\Property(property="success", type="boolean", example=true),
* @OA\Property(property="privateKey", type="string", description="کلید خصوصی"),
* @OA\Property(property="publicKey", type="string", description="کلید عمومی"),
* @OA\Property(property="csr", type="string", description="CSR (برای اشخاص حقوقی)"),
* @OA\Property(property="message", type="string", description="پیام نتیجه")
* )
* ),
* @OA\Response(response=403, description="دسترسی غیرمجاز"),
* @OA\Response(response=400, description="اطلاعات نامعتبر")
* )
*/
#[Route('/api/plugins/tax/settings/generate-csr', name: 'plugin_tax_settings_generate_csr', methods: ['POST'])]
public function plugin_tax_settings_generate_csr(Request $request, registryMGR $registryMGR, Access $access, Log $log): JsonResponse
{
@ -279,6 +362,39 @@ class TaxSettingsController extends AbstractController
return $csr;
}
/**
* اضافه کردن فاکتورها به لیست ارسال
*
* @OA\Post(
* path="/api/plugins/tax/list/send-invoice",
* summary="اضافه کردن فاکتورها به لیست ارسال به سامانه مودیان",
* tags={"Tax Invoices"},
* @OA\RequestBody(
* required=true,
* @OA\JsonContent(
* required={"codes"},
* @OA\Property(property="codes", type="array", @OA\Items(type="string"), description="کدهای فاکتور")
* )
* ),
* @OA\Response(
* response=200,
* description="فاکتورها با موفقیت به لیست ارسال اضافه شدند",
* @OA\JsonContent(
* type="object",
* @OA\Property(property="success", type="boolean", example=true),
* @OA\Property(property="message", type="string", description="پیام نتیجه"),
* @OA\Property(property="summary", type="object",
* @OA\Property(property="total", type="integer", description="تعداد کل"),
* @OA\Property(property="success", type="integer", description="تعداد موفق"),
* @OA\Property(property="error", type="integer", description="تعداد خطا")
* ),
* @OA\Property(property="results", type="array", @OA\Items(type="object"))
* )
* ),
* @OA\Response(response=403, description="دسترسی غیرمجاز"),
* @OA\Response(response=400, description="اطلاعات نامعتبر")
* )
*/
#[Route('/api/plugins/tax/list/send-invoice', name: 'plugin_tax_list_send_invoice', methods: ['POST'])]
public function plugin_tax_list_send_invoice(Request $request, Access $access, Log $log, EntityManagerInterface $em): JsonResponse
{
@ -299,7 +415,7 @@ class TaxSettingsController extends AbstractController
$businessId = is_object($acc['bid']) ? $acc['bid']->getId() : $acc['bid'];
$user = $this->getUser();
$userId = $user instanceof \App\Entity\User ? $user->getId() : null;
$userId = $user instanceof User ? $user->getId() : null;
try {
$taxRepo = $em->getRepository(PluginTaxsettingsKey::class);
@ -416,8 +532,8 @@ class TaxSettingsController extends AbstractController
}
$taxInvoice = new PluginTaxInvoice();
$taxInvoice->setBusiness($em->getRepository(\App\Entity\Business::class)->find($businessId));
$taxInvoice->setUser($em->getRepository(\App\Entity\User::class)->find($userId));
$taxInvoice->setBusiness($em->getRepository(Business::class)->find($businessId));
$taxInvoice->setUser($em->getRepository(User::class)->find($userId));
$taxInvoice->setInvoice($invoice);
$taxInvoice->setInvoiceCode($invoice->getCode());
$taxInvoice->setStatus('pending');
@ -461,6 +577,40 @@ class TaxSettingsController extends AbstractController
}
}
/**
* دریافت لیست فاکتورهای مالیاتی
*
* @OA\Get(
* path="/api/plugins/tax/invoices/list",
* summary="دریافت لیست فاکتورهای مالیاتی کسب و کار",
* tags={"Tax Invoices"},
* @OA\Response(
* response=200,
* description="لیست فاکتورهای مالیاتی",
* @OA\JsonContent(
* type="object",
* @OA\Property(property="success", type="boolean", example=true),
* @OA\Property(property="data", type="array", @OA\Items(
* type="object",
* @OA\Property(property="id", type="integer", description="شناسه فاکتور مالیاتی"),
* @OA\Property(property="invoiceNumber", type="string", description="شماره فاکتور"),
* @OA\Property(property="date", type="string", description="تاریخ فاکتور"),
* @OA\Property(property="customerName", type="string", description="نام مشتری"),
* @OA\Property(property="customerId", type="string", description="کد مشتری"),
* @OA\Property(property="totalAmount", type="number", description="مبلغ کل"),
* @OA\Property(property="status", type="string", description="وضعیت"),
* @OA\Property(property="sentDate", type="string", description="تاریخ ارسال"),
* @OA\Property(property="errorMessage", type="string", description="پیام خطا"),
* @OA\Property(property="createdAt", type="string", description="تاریخ ایجاد"),
* @OA\Property(property="uniqueTaxNumber", type="string", description="شماره یکتا مالیاتی"),
* @OA\Property(property="referenceUniqueTaxNumber", type="string", description="شماره ارجاع یکتا"),
* @OA\Property(property="invoiceType", type="string", description="نوع فاکتور")
* ))
* )
* ),
* @OA\Response(response=403, description="دسترسی غیرمجاز")
* )
*/
#[Route('/api/plugins/tax/invoices/list', name: 'plugin_tax_settings_invoices_list', methods: ['GET'])]
public function plugin_tax_settings_invoices_list(Request $request, Access $access, EntityManagerInterface $em): JsonResponse
{
@ -774,6 +924,36 @@ class TaxSettingsController extends AbstractController
}
}
/**
* ارسال فاکتور مالیاتی
*
* @OA\Post(
* path="/api/plugins/tax/invoice/send/{id}",
* summary="ارسال فاکتور مالیاتی به سامانه مودیان",
* tags={"Tax Invoices"},
* @OA\Parameter(
* name="id",
* in="path",
* description="شناسه فاکتور مالیاتی",
* required=true,
* @OA\Schema(type="integer")
* ),
* @OA\Response(
* response=200,
* description="فاکتور با موفقیت ارسال شد",
* @OA\JsonContent(
* type="object",
* @OA\Property(property="success", type="boolean", example=true),
* @OA\Property(property="data", type="object", description="پاسخ سامانه مودیان"),
* @OA\Property(property="invoiceCode", type="string", description="کد فاکتور"),
* @OA\Property(property="referenceNumber", type="string", description="شماره ارجاع")
* )
* ),
* @OA\Response(response=403, description="دسترسی غیرمجاز"),
* @OA\Response(response=404, description="فاکتور مالیاتی یافت نشد"),
* @OA\Response(response=400, description="خطا در ارسال فاکتور")
* )
*/
#[Route('/api/plugins/tax/invoice/send/{id}', name: 'plugin_tax_invoice_send', methods: ['POST'])]
public function sendTaxInvoice(int $id, Access $access, Log $log, EntityManagerInterface $em, registryMGR $registryMGR): JsonResponse
{
@ -933,6 +1113,34 @@ class TaxSettingsController extends AbstractController
}
}
/**
* حذف فاکتور مالیاتی
*
* @OA\Delete(
* path="/api/plugins/tax/invoice/delete/{id}",
* summary="حذف فاکتور مالیاتی از لیست ارسال",
* tags={"Tax Invoices"},
* @OA\Parameter(
* name="id",
* in="path",
* description="شناسه فاکتور مالیاتی",
* required=true,
* @OA\Schema(type="integer")
* ),
* @OA\Response(
* response=200,
* description="فاکتور مالیاتی با موفقیت حذف شد",
* @OA\JsonContent(
* type="object",
* @OA\Property(property="success", type="boolean", example=true),
* @OA\Property(property="message", type="string", example="فاکتور مالیاتی با موفقیت حذف شد")
* )
* ),
* @OA\Response(response=403, description="دسترسی غیرمجاز"),
* @OA\Response(response=404, description="فاکتور مالیاتی یافت نشد"),
* @OA\Response(response=400, description="فاکتور قابل حذف نیست")
* )
*/
#[Route('/api/plugins/tax/invoice/delete/{id}', name: 'plugin_tax_invoice_delete', methods: ['DELETE'])]
public function deleteTaxInvoice(int $id, Access $access, Log $log, EntityManagerInterface $em): JsonResponse
{
@ -989,6 +1197,33 @@ class TaxSettingsController extends AbstractController
}
}
/**
* استعلام وضعیت فاکتورهای مالیاتی
*
* @OA\Post(
* path="/api/plugins/tax/inquire-status",
* summary="استعلام وضعیت فاکتورهای ارسال شده به سامانه مودیان",
* tags={"Tax Invoices"},
* @OA\RequestBody(
* required=true,
* @OA\JsonContent(
* required={"referenceNumbers"},
* @OA\Property(property="referenceNumbers", type="array", @OA\Items(type="string"), description="شماره‌های ارجاع فاکتورها")
* )
* ),
* @OA\Response(
* response=200,
* description="وضعیت فاکتورها با موفقیت دریافت شد",
* @OA\JsonContent(
* type="object",
* @OA\Property(property="success", type="boolean", example=true),
* @OA\Property(property="data", type="array", @OA\Items(type="object"), description="اطلاعات وضعیت فاکتورها")
* )
* ),
* @OA\Response(response=403, description="دسترسی غیرمجاز"),
* @OA\Response(response=400, description="اطلاعات نامعتبر")
* )
*/
#[Route('/api/plugins/tax/inquire-status', name: 'plugin_tax_inquire_status', methods: ['POST'])]
public function inquireInvoiceStatus(Request $request, Access $access, EntityManagerInterface $em, registryMGR $registryMGR): JsonResponse
{
@ -1342,6 +1577,39 @@ class TaxSettingsController extends AbstractController
}
}
/**
* ارسال گروهی فاکتورهای مالیاتی
*
* @OA\Post(
* path="/api/plugins/tax/invoice/send-bulk",
* summary="ارسال گروهی فاکتورهای مالیاتی به سامانه مودیان",
* tags={"Tax Invoices"},
* @OA\RequestBody(
* required=true,
* @OA\JsonContent(
* required={"ids"},
* @OA\Property(property="ids", type="array", @OA\Items(type="integer"), description="شناسه‌های فاکتورهای مالیاتی")
* )
* ),
* @OA\Response(
* response=200,
* description="ارسال گروهی فاکتورها تکمیل شد",
* @OA\JsonContent(
* type="object",
* @OA\Property(property="success", type="boolean", example=true),
* @OA\Property(property="message", type="string", description="پیام نتیجه"),
* @OA\Property(property="summary", type="object",
* @OA\Property(property="total", type="integer", description="تعداد کل"),
* @OA\Property(property="success", type="integer", description="تعداد موفق"),
* @OA\Property(property="error", type="integer", description="تعداد خطا")
* ),
* @OA\Property(property="results", type="array", @OA\Items(type="object"), description="نتایج ارسال هر فاکتور")
* )
* ),
* @OA\Response(response=403, description="دسترسی غیرمجاز"),
* @OA\Response(response=400, description="اطلاعات نامعتبر")
* )
*/
#[Route('/api/plugins/tax/invoice/send-bulk', name: 'plugin_tax_invoice_send_bulk', methods: ['POST'])]
public function sendBulkTaxInvoices(Request $request, Access $access, Log $log, EntityManagerInterface $em, registryMGR $registryMGR): JsonResponse
{
@ -1572,6 +1840,44 @@ class TaxSettingsController extends AbstractController
}
}
/**
* اعتبارسنجی اطلاعات خریدار
*
* @OA\Post(
* path="/api/plugins/tax/invoice/validate-buyer-info/{id}",
* summary="اعتبارسنجی اطلاعات اقتصادی خریدار فاکتور",
* tags={"Tax Invoices"},
* @OA\Parameter(
* name="id",
* in="path",
* description="شناسه فاکتور مالیاتی",
* required=true,
* @OA\Schema(type="integer")
* ),
* @OA\Response(
* response=200,
* description="اطلاعات اقتصادی خریدار بررسی شد",
* @OA\JsonContent(
* type="object",
* @OA\Property(property="success", type="boolean", example=true),
* @OA\Property(property="message", type="string", description="پیام نتیجه"),
* @OA\Property(property="buyer_info", type="object",
* @OA\Property(property="is_valid", type="boolean", description="آیا اطلاعات معتبر است"),
* @OA\Property(property="buyer_name", type="string", description="نام خریدار"),
* @OA\Property(property="buyer_id", type="integer", description="شناسه خریدار"),
* @OA\Property(property="buyer_code", type="string", description="کد خریدار"),
* @OA\Property(property="national_id", type="string", description="شناسه ملی"),
* @OA\Property(property="economic_code", type="string", description="کد اقتصادی"),
* @OA\Property(property="missing_fields", type="array", @OA\Items(type="string"), description="فیلدهای ناقص")
* ),
* @OA\Property(property="can_proceed", type="boolean", description="آیا می‌توان ادامه داد")
* )
* ),
* @OA\Response(response=403, description="دسترسی غیرمجاز"),
* @OA\Response(response=404, description="فاکتور مالیاتی یافت نشد"),
* @OA\Response(response=400, description="اطلاعات نامعتبر")
* )
*/
#[Route('/api/plugins/tax/invoice/validate-buyer-info/{id}', name: 'plugin_tax_invoice_validate_buyer_info', methods: ['POST'])]
public function validateBuyerInfo(int $id, Access $access, Log $log, EntityManagerInterface $em): JsonResponse
{