Mango.Nop.Plugins/Nop.Plugin.Misc.AIPlugin/docs/INNVOICE.md

42 lines
2.5 KiB
Markdown

# InnVoice integration — current state & planned migration
> Reference doc for `Nop.Plugin.Misc.FruitBankPlugin`. See [`README.md`](README.md) for the docs index.
> Scope: how the plugin pushes orders/invoices to the external **InnVoice** system from the admin order page.
## Where it lives
The admin **order edit** widget ([`Views/OrderAttributes.cshtml`](../Views/OrderAttributes.cshtml), rendered by `OrderAttributesViewComponent` into `AdminWidgetZones.OrderDetailsBlock`) hosts the InnVoice UI in its right-hand card *"Megrendelés beküldése Innvoice-ba"*.
Related server side: `InnVoiceApiService` (`Services/`), `InnVoiceOrderController` and `InvoiceController` (`Areas/Admin/Controllers/`).
## Current behaviour (order submission)
The active flow submits an **order** to InnVoice:
| UI | Endpoint |
|---|---|
| "Megrendelés beküldése" | `InnVoiceOrder/CreateOrder` |
| "Invoice adat ellenőrzése" | `InnVoiceOrder/GetOrderStatus` (also auto-run on page load) |
On success the card shows the InnVoice Order Table ID / Tech ID and a PDF link.
## Orphaned invoice JS (intentional, kept for the migration)
`OrderAttributes.cshtml` also contains a **full invoice-handling JS block** — handlers for `#createInvoiceBtn` / `#checkInvoiceBtn`, `displayInvoiceDetails(...)`, calls to `Invoice/CreateInvoice` and `Invoice/GetInvoiceStatus`, plus a page-load `GetInvoiceStatus` AJAX.
**These have no matching markup** (`#createInvoiceBtn`, `#invoiceDetails`, `#invoiceNumber`, `#invoicePdfLink`, … do not exist in the view), so the code is currently dead — the only live side effect is a silent, failing `GetInvoiceStatus` call on every order page load.
This is **not a bug to clean up yet**: it is groundwork for the planned migration below.
## Planned migration — direct invoice submission (draft)
We will switch the InnVoice integration from the current **order submission** to **direct invoice submission**, creating the invoice in **draft ("piszkozat") status** in InnVoice.
When we return to this:
- Wire the existing invoice JS to real buttons/markup in the InnVoice card (replacing or complementing the current order-submission buttons).
- Confirm `Invoice/CreateInvoice` creates the invoice in draft status.
- Decide the fate of the current `InnVoiceOrder/CreateOrder` order-submission path (keep, deprecate, or remove).
- Remove the wasted page-load `GetInvoiceStatus` call if it is not needed in the final design.
_Status: planned, not started. Recorded so the orphaned invoice code is understood as intentional._