zbyle sluzby podle CC
This commit is contained in:
@@ -0,0 +1,101 @@
|
||||
using IdokladSdk.Models.PriceListItem;
|
||||
using IdokladSdk.Models.StockMovement;
|
||||
using IdokladSdk.Models.Tag;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Idoklad.Services;
|
||||
|
||||
namespace Idoklad.Controllers;
|
||||
|
||||
/// <summary>
|
||||
/// Price list items, stock movements and tags. Requires iDoklad credentials (headers or environment defaults).
|
||||
/// </summary>
|
||||
[ApiController]
|
||||
[Produces("application/json")]
|
||||
[Tags("Catalog")]
|
||||
public sealed class CatalogController : ControllerBase
|
||||
{
|
||||
private readonly CatalogService _service;
|
||||
|
||||
public CatalogController(CatalogService service) => _service = service;
|
||||
|
||||
// ---- Price list items ----
|
||||
|
||||
/// <summary>List price list items (paged).</summary>
|
||||
[HttpGet("price-list-items")]
|
||||
public async Task<IActionResult> ListPriceListItems(int page = 1, int pageSize = 20, CancellationToken ct = default)
|
||||
=> Ok(await _service.ListPriceListItemsAsync(page, pageSize, ct));
|
||||
|
||||
/// <summary>Get a pre-filled default model for creating a new price list item.</summary>
|
||||
[HttpGet("price-list-items/default")]
|
||||
public async Task<IActionResult> PriceListItemDefault(CancellationToken ct)
|
||||
=> Ok(await _service.PriceListItemDefaultAsync(ct));
|
||||
|
||||
/// <summary>Get a price list item detail by id.</summary>
|
||||
[HttpGet("price-list-items/{id:int}")]
|
||||
public async Task<IActionResult> PriceListItemDetail(int id, CancellationToken ct)
|
||||
=> Ok(await _service.PriceListItemDetailAsync(id, ct));
|
||||
|
||||
/// <summary>Create a new price list item.</summary>
|
||||
[HttpPost("price-list-items")]
|
||||
public async Task<IActionResult> CreatePriceListItem([FromBody] PriceListItemPostModel model, CancellationToken ct)
|
||||
=> Ok(await _service.CreatePriceListItemAsync(model, ct));
|
||||
|
||||
/// <summary>Update an existing price list item (the model id identifies the item).</summary>
|
||||
[HttpPatch("price-list-items")]
|
||||
public async Task<IActionResult> UpdatePriceListItem([FromBody] PriceListItemPatchModel model, CancellationToken ct)
|
||||
=> Ok(await _service.UpdatePriceListItemAsync(model, ct));
|
||||
|
||||
// ---- Stock movements ----
|
||||
|
||||
/// <summary>List stock movements (paged).</summary>
|
||||
[HttpGet("stock-movements")]
|
||||
public async Task<IActionResult> ListStockMovements(int page = 1, int pageSize = 20, CancellationToken ct = default)
|
||||
=> Ok(await _service.ListStockMovementsAsync(page, pageSize, ct));
|
||||
|
||||
/// <summary>Get a pre-filled default stock movement model for the given price list item id.</summary>
|
||||
[HttpGet("stock-movements/default/{priceListItemId:int}")]
|
||||
public async Task<IActionResult> StockMovementDefault(int priceListItemId, CancellationToken ct)
|
||||
=> Ok(await _service.StockMovementDefaultAsync(priceListItemId, ct));
|
||||
|
||||
/// <summary>Get a stock movement detail by id.</summary>
|
||||
[HttpGet("stock-movements/{id:int}")]
|
||||
public async Task<IActionResult> StockMovementDetail(int id, CancellationToken ct)
|
||||
=> Ok(await _service.StockMovementDetailAsync(id, ct));
|
||||
|
||||
/// <summary>Create a new stock movement.</summary>
|
||||
[HttpPost("stock-movements")]
|
||||
public async Task<IActionResult> CreateStockMovement([FromBody] StockMovementPostModel model, CancellationToken ct)
|
||||
=> Ok(await _service.CreateStockMovementAsync(model, ct));
|
||||
|
||||
/// <summary>Update an existing stock movement (the model id identifies the movement).</summary>
|
||||
[HttpPatch("stock-movements")]
|
||||
public async Task<IActionResult> UpdateStockMovement([FromBody] StockMovementPatchModel model, CancellationToken ct)
|
||||
=> Ok(await _service.UpdateStockMovementAsync(model, ct));
|
||||
|
||||
/// <summary>Delete a stock movement by id.</summary>
|
||||
[HttpDelete("stock-movements/{id:int}")]
|
||||
public async Task<IActionResult> DeleteStockMovement(int id, CancellationToken ct)
|
||||
=> Ok(await _service.DeleteStockMovementAsync(id, ct));
|
||||
|
||||
// ---- Tags ----
|
||||
|
||||
/// <summary>List tags (paged).</summary>
|
||||
[HttpGet("tags")]
|
||||
public async Task<IActionResult> ListTags(int page = 1, int pageSize = 20, CancellationToken ct = default)
|
||||
=> Ok(await _service.ListTagsAsync(page, pageSize, ct));
|
||||
|
||||
/// <summary>Create a new tag.</summary>
|
||||
[HttpPost("tags")]
|
||||
public async Task<IActionResult> CreateTag([FromBody] TagPostModel model, CancellationToken ct)
|
||||
=> Ok(await _service.CreateTagAsync(model, ct));
|
||||
|
||||
/// <summary>Update an existing tag (the model id identifies the tag).</summary>
|
||||
[HttpPatch("tags")]
|
||||
public async Task<IActionResult> UpdateTag([FromBody] TagPatchModel model, CancellationToken ct)
|
||||
=> Ok(await _service.UpdateTagAsync(model, ct));
|
||||
|
||||
/// <summary>Delete a tag by id.</summary>
|
||||
[HttpDelete("tags/{id:int}")]
|
||||
public async Task<IActionResult> DeleteTag(int id, CancellationToken ct)
|
||||
=> Ok(await _service.DeleteTagAsync(id, ct));
|
||||
}
|
||||
@@ -0,0 +1,118 @@
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Idoklad.Services;
|
||||
|
||||
namespace Idoklad.Controllers;
|
||||
|
||||
/// <summary>
|
||||
/// Read-only iDoklad code lists / registers. Requires iDoklad credentials (headers or environment
|
||||
/// defaults).
|
||||
/// </summary>
|
||||
[ApiController]
|
||||
[Produces("application/json")]
|
||||
[Tags("CodeLists")]
|
||||
public sealed class CodeListsController : ControllerBase
|
||||
{
|
||||
private readonly CodeListsService _service;
|
||||
|
||||
public CodeListsController(CodeListsService service) => _service = service;
|
||||
|
||||
/// <summary>List banks (paged).</summary>
|
||||
[HttpGet("code-lists/banks")]
|
||||
public async Task<IActionResult> Banks(int page = 1, int pageSize = 20, CancellationToken ct = default)
|
||||
=> Ok(await _service.ListBanksAsync(page, pageSize, ct));
|
||||
|
||||
/// <summary>Get a bank detail by id.</summary>
|
||||
[HttpGet("code-lists/banks/{id:int}")]
|
||||
public async Task<IActionResult> BankDetail(int id, CancellationToken ct)
|
||||
=> Ok(await _service.BankDetailAsync(id, ct));
|
||||
|
||||
/// <summary>List countries (paged).</summary>
|
||||
[HttpGet("code-lists/countries")]
|
||||
public async Task<IActionResult> Countries(int page = 1, int pageSize = 20, CancellationToken ct = default)
|
||||
=> Ok(await _service.ListCountriesAsync(page, pageSize, ct));
|
||||
|
||||
/// <summary>Get a country detail by id.</summary>
|
||||
[HttpGet("code-lists/countries/{id:int}")]
|
||||
public async Task<IActionResult> CountryDetail(int id, CancellationToken ct)
|
||||
=> Ok(await _service.CountryDetailAsync(id, ct));
|
||||
|
||||
/// <summary>List currencies (paged).</summary>
|
||||
[HttpGet("code-lists/currencies")]
|
||||
public async Task<IActionResult> Currencies(int page = 1, int pageSize = 20, CancellationToken ct = default)
|
||||
=> Ok(await _service.ListCurrenciesAsync(page, pageSize, ct));
|
||||
|
||||
/// <summary>Get a currency detail by id.</summary>
|
||||
[HttpGet("code-lists/currencies/{id:int}")]
|
||||
public async Task<IActionResult> CurrencyDetail(int id, CancellationToken ct)
|
||||
=> Ok(await _service.CurrencyDetailAsync(id, ct));
|
||||
|
||||
/// <summary>List constant symbols (paged).</summary>
|
||||
[HttpGet("code-lists/constant-symbols")]
|
||||
public async Task<IActionResult> ConstantSymbols(int page = 1, int pageSize = 20, CancellationToken ct = default)
|
||||
=> Ok(await _service.ListConstantSymbolsAsync(page, pageSize, ct));
|
||||
|
||||
/// <summary>Get a constant symbol detail by id.</summary>
|
||||
[HttpGet("code-lists/constant-symbols/{id:int}")]
|
||||
public async Task<IActionResult> ConstantSymbolDetail(int id, CancellationToken ct)
|
||||
=> Ok(await _service.ConstantSymbolDetailAsync(id, ct));
|
||||
|
||||
/// <summary>List exchange rates (paged).</summary>
|
||||
[HttpGet("code-lists/exchange-rates")]
|
||||
public async Task<IActionResult> ExchangeRates(int page = 1, int pageSize = 20, CancellationToken ct = default)
|
||||
=> Ok(await _service.ListExchangeRatesAsync(page, pageSize, ct));
|
||||
|
||||
/// <summary>Get an exchange rate detail by id.</summary>
|
||||
[HttpGet("code-lists/exchange-rates/{id:int}")]
|
||||
public async Task<IActionResult> ExchangeRateDetail(int id, CancellationToken ct)
|
||||
=> Ok(await _service.ExchangeRateDetailAsync(id, ct));
|
||||
|
||||
/// <summary>List payment options (paged).</summary>
|
||||
[HttpGet("code-lists/payment-options")]
|
||||
public async Task<IActionResult> PaymentOptions(int page = 1, int pageSize = 20, CancellationToken ct = default)
|
||||
=> Ok(await _service.ListPaymentOptionsAsync(page, pageSize, ct));
|
||||
|
||||
/// <summary>Get a payment option detail by id.</summary>
|
||||
[HttpGet("code-lists/payment-options/{id:int}")]
|
||||
public async Task<IActionResult> PaymentOptionDetail(int id, CancellationToken ct)
|
||||
=> Ok(await _service.PaymentOptionDetailAsync(id, ct));
|
||||
|
||||
/// <summary>List VAT codes (paged).</summary>
|
||||
[HttpGet("code-lists/vat-codes")]
|
||||
public async Task<IActionResult> VatCodes(int page = 1, int pageSize = 20, CancellationToken ct = default)
|
||||
=> Ok(await _service.ListVatCodesAsync(page, pageSize, ct));
|
||||
|
||||
/// <summary>Get a VAT code detail by id.</summary>
|
||||
[HttpGet("code-lists/vat-codes/{id:int}")]
|
||||
public async Task<IActionResult> VatCodeDetail(int id, CancellationToken ct)
|
||||
=> Ok(await _service.VatCodeDetailAsync(id, ct));
|
||||
|
||||
/// <summary>List VAT reverse-charge codes (paged).</summary>
|
||||
[HttpGet("code-lists/vat-reverse-charge-codes")]
|
||||
public async Task<IActionResult> VatReverseChargeCodes(int page = 1, int pageSize = 20, CancellationToken ct = default)
|
||||
=> Ok(await _service.ListVatReverseChargeCodesAsync(page, pageSize, ct));
|
||||
|
||||
/// <summary>Get a VAT reverse-charge code detail by id.</summary>
|
||||
[HttpGet("code-lists/vat-reverse-charge-codes/{id:int}")]
|
||||
public async Task<IActionResult> VatReverseChargeCodeDetail(int id, CancellationToken ct)
|
||||
=> Ok(await _service.VatReverseChargeCodeDetailAsync(id, ct));
|
||||
|
||||
/// <summary>List sales offices (paged).</summary>
|
||||
[HttpGet("code-lists/sales-offices")]
|
||||
public async Task<IActionResult> SalesOffices(int page = 1, int pageSize = 20, CancellationToken ct = default)
|
||||
=> Ok(await _service.ListSalesOfficesAsync(page, pageSize, ct));
|
||||
|
||||
/// <summary>Get a sales office detail by id.</summary>
|
||||
[HttpGet("code-lists/sales-offices/{id:int}")]
|
||||
public async Task<IActionResult> SalesOfficeDetail(int id, CancellationToken ct)
|
||||
=> Ok(await _service.SalesOfficeDetailAsync(id, ct));
|
||||
|
||||
/// <summary>List sales POS equipment (paged).</summary>
|
||||
[HttpGet("code-lists/sales-pos-equipment")]
|
||||
public async Task<IActionResult> SalesPosEquipment(int page = 1, int pageSize = 20, CancellationToken ct = default)
|
||||
=> Ok(await _service.ListSalesPosEquipmentAsync(page, pageSize, ct));
|
||||
|
||||
/// <summary>Get a sales POS equipment detail by id.</summary>
|
||||
[HttpGet("code-lists/sales-pos-equipment/{id:int}")]
|
||||
public async Task<IActionResult> SalesPosEquipmentDetail(int id, CancellationToken ct)
|
||||
=> Ok(await _service.SalesPosEquipmentDetailAsync(id, ct));
|
||||
}
|
||||
@@ -0,0 +1,122 @@
|
||||
using IdokladSdk.Enums;
|
||||
using IdokladSdk.Models.Attachment;
|
||||
using IdokladSdk.Models.Webhook;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Idoklad.Services;
|
||||
|
||||
namespace Idoklad.Controllers;
|
||||
|
||||
/// <summary>
|
||||
/// Integration / utility agendas: webhooks, notifications, change log, registered sales,
|
||||
/// unpaired documents, attachments and system code books. Requires iDoklad credentials.
|
||||
/// </summary>
|
||||
[ApiController]
|
||||
[Produces("application/json")]
|
||||
[Tags("Integration")]
|
||||
public sealed class IntegrationController : ControllerBase
|
||||
{
|
||||
private readonly IntegrationService _service;
|
||||
|
||||
public IntegrationController(IntegrationService service) => _service = service;
|
||||
|
||||
// ---- Webhooks ----
|
||||
|
||||
/// <summary>List configured webhooks (paged).</summary>
|
||||
[HttpGet("webhooks")]
|
||||
public async Task<IActionResult> ListWebhooks(int page = 1, int pageSize = 20, CancellationToken ct = default)
|
||||
=> Ok(await _service.ListWebhooksAsync(page, pageSize, ct));
|
||||
|
||||
/// <summary>Get a webhook detail by id.</summary>
|
||||
[HttpGet("webhooks/{id:int}")]
|
||||
public async Task<IActionResult> WebhookDetail(int id, CancellationToken ct)
|
||||
=> Ok(await _service.WebhookDetailAsync(id, ct));
|
||||
|
||||
/// <summary>Create (register) a new webhook subscription.</summary>
|
||||
[HttpPost("webhooks")]
|
||||
public async Task<IActionResult> CreateWebhook([FromBody] AgendaWebhookSettingsPostModel model, CancellationToken ct)
|
||||
=> Ok(await _service.CreateWebhookAsync(model, ct));
|
||||
|
||||
/// <summary>Delete a webhook by id.</summary>
|
||||
[HttpDelete("webhooks/{id:int}")]
|
||||
public async Task<IActionResult> DeleteWebhook(int id, CancellationToken ct)
|
||||
=> Ok(await _service.DeleteWebhookAsync(id, ct));
|
||||
|
||||
// ---- Notifications ----
|
||||
|
||||
/// <summary>List notifications (paged).</summary>
|
||||
[HttpGet("notifications")]
|
||||
public async Task<IActionResult> ListNotifications(int page = 1, int pageSize = 20, CancellationToken ct = default)
|
||||
=> Ok(await _service.ListNotificationsAsync(page, pageSize, ct));
|
||||
|
||||
/// <summary>Delete (dismiss) a notification by id.</summary>
|
||||
[HttpDelete("notifications/{id:int}")]
|
||||
public async Task<IActionResult> DeleteNotification(int id, CancellationToken ct)
|
||||
=> Ok(await _service.DeleteNotificationAsync(id, ct));
|
||||
|
||||
// ---- Change log ----
|
||||
|
||||
/// <summary>List the agenda change log (paged).</summary>
|
||||
[HttpGet("logs")]
|
||||
public async Task<IActionResult> ListLog(int page = 1, int pageSize = 20, CancellationToken ct = default)
|
||||
=> Ok(await _service.ListLogAsync(page, pageSize, ct));
|
||||
|
||||
// ---- Registered sales (EET) ----
|
||||
|
||||
/// <summary>List registered sales / EET records (paged).</summary>
|
||||
[HttpGet("registered-sales")]
|
||||
public async Task<IActionResult> ListRegisteredSales(int page = 1, int pageSize = 20, CancellationToken ct = default)
|
||||
=> Ok(await _service.ListRegisteredSalesAsync(page, pageSize, ct));
|
||||
|
||||
/// <summary>Get a pre-filled default model for creating a new registered sale.</summary>
|
||||
[HttpGet("registered-sales/default")]
|
||||
public async Task<IActionResult> RegisteredSaleDefault(CancellationToken ct)
|
||||
=> Ok(await _service.RegisteredSaleDefaultAsync(ct));
|
||||
|
||||
// ---- Unpaired documents ----
|
||||
|
||||
/// <summary>List unpaired documents for a movement type and pairing document type.</summary>
|
||||
[HttpGet("unpaired-documents/{movementType}/{pairingDocumentType}")]
|
||||
public async Task<IActionResult> ListUnpairedDocuments(
|
||||
MovementType movementType, PairingDocumentType pairingDocumentType, int page = 1, int pageSize = 20, CancellationToken ct = default)
|
||||
=> Ok(await _service.ListUnpairedDocumentsAsync(movementType, pairingDocumentType, page, pageSize, ct));
|
||||
|
||||
// ---- Attachments ----
|
||||
|
||||
/// <summary>Get a single attachment by its id.</summary>
|
||||
[HttpGet("attachments/{attachmentId:int}")]
|
||||
public async Task<IActionResult> GetAttachment(int attachmentId, bool compressed = false, CancellationToken ct = default)
|
||||
=> Ok(await _service.GetAttachmentAsync(attachmentId, compressed, ct));
|
||||
|
||||
/// <summary>Get all attachments of a document.</summary>
|
||||
[HttpGet("attachments/document/{documentId:int}/{documentType}")]
|
||||
public async Task<IActionResult> GetDocumentAttachments(
|
||||
int documentId, AttachmentDocumentType documentType, bool compressed = false, CancellationToken ct = default)
|
||||
=> Ok(await _service.GetDocumentAttachmentsAsync(documentId, documentType, compressed, ct));
|
||||
|
||||
/// <summary>Upload an attachment for a document.</summary>
|
||||
[HttpPost("attachments")]
|
||||
public async Task<IActionResult> UploadAttachment([FromBody] AttachmentUploadModel model, CancellationToken ct)
|
||||
=> Ok(await _service.UploadAttachmentAsync(model, ct));
|
||||
|
||||
/// <summary>Delete a single attachment by its id.</summary>
|
||||
[HttpDelete("attachments/{attachmentId:int}")]
|
||||
public async Task<IActionResult> DeleteAttachment(int attachmentId, CancellationToken ct)
|
||||
=> Ok(await _service.DeleteAttachmentAsync(attachmentId, ct));
|
||||
|
||||
/// <summary>Delete all attachments of a document.</summary>
|
||||
[HttpDelete("attachments/document/{documentId:int}/{documentType}")]
|
||||
public async Task<IActionResult> DeleteDocumentAttachments(int documentId, AttachmentDocumentType documentType, CancellationToken ct)
|
||||
=> Ok(await _service.DeleteDocumentAttachmentsAsync(documentId, documentType, ct));
|
||||
|
||||
// ---- System code books ----
|
||||
|
||||
/// <summary>Get the iDoklad system code books.</summary>
|
||||
[HttpGet("system/code-books")]
|
||||
public async Task<IActionResult> CodeBooks(CancellationToken ct)
|
||||
=> Ok(await _service.CodeBooksAsync(ct));
|
||||
|
||||
/// <summary>Get changes to the code books since the given timestamp.</summary>
|
||||
[HttpGet("system/code-books/changes")]
|
||||
public async Task<IActionResult> CodeBooksChanges([FromQuery] DateTime lastCheck, CancellationToken ct = default)
|
||||
=> Ok(await _service.CodeBooksChangesAsync(lastCheck, ct));
|
||||
}
|
||||
@@ -0,0 +1,112 @@
|
||||
using IdokladSdk.Models.BankStatement.Patch;
|
||||
using IdokladSdk.Models.BankStatement.Post;
|
||||
using IdokladSdk.Models.IssuedDocumentPayment;
|
||||
using IdokladSdk.Models.ReceivedDocumentPayments;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Idoklad.Services;
|
||||
|
||||
namespace Idoklad.Controllers;
|
||||
|
||||
/// <summary>
|
||||
/// Bank statements and document payments. Requires iDoklad credentials (headers or environment defaults).
|
||||
/// </summary>
|
||||
[ApiController]
|
||||
[Produces("application/json")]
|
||||
[Tags("Payments")]
|
||||
public sealed class PaymentsController : ControllerBase
|
||||
{
|
||||
private readonly PaymentsService _service;
|
||||
|
||||
public PaymentsController(PaymentsService service) => _service = service;
|
||||
|
||||
// ---- Bank statements ----
|
||||
|
||||
/// <summary>List bank statements (paged).</summary>
|
||||
[HttpGet("bank-statements")]
|
||||
public async Task<IActionResult> ListBankStatements(int page = 1, int pageSize = 20, CancellationToken ct = default)
|
||||
=> Ok(await _service.ListBankStatementsAsync(page, pageSize, ct));
|
||||
|
||||
/// <summary>Get a bank statement detail by id.</summary>
|
||||
[HttpGet("bank-statements/{id:int}")]
|
||||
public async Task<IActionResult> BankStatementDetail(int id, CancellationToken ct)
|
||||
=> Ok(await _service.BankStatementDetailAsync(id, ct));
|
||||
|
||||
/// <summary>Create a new bank statement.</summary>
|
||||
[HttpPost("bank-statements")]
|
||||
public async Task<IActionResult> CreateBankStatement([FromBody] BankStatementPostModel model, CancellationToken ct)
|
||||
=> Ok(await _service.CreateBankStatementAsync(model, ct));
|
||||
|
||||
/// <summary>Update an existing bank statement (the model id identifies the statement).</summary>
|
||||
[HttpPatch("bank-statements")]
|
||||
public async Task<IActionResult> UpdateBankStatement([FromBody] BankStatementPatchModel model, CancellationToken ct)
|
||||
=> Ok(await _service.UpdateBankStatementAsync(model, ct));
|
||||
|
||||
/// <summary>Delete a bank statement by id.</summary>
|
||||
[HttpDelete("bank-statements/{id:int}")]
|
||||
public async Task<IActionResult> DeleteBankStatement(int id, CancellationToken ct)
|
||||
=> Ok(await _service.DeleteBankStatementAsync(id, ct));
|
||||
|
||||
// ---- Issued document payments ----
|
||||
|
||||
/// <summary>List issued document payments (paged).</summary>
|
||||
[HttpGet("issued-payments")]
|
||||
public async Task<IActionResult> ListIssuedPayments(int page = 1, int pageSize = 20, CancellationToken ct = default)
|
||||
=> Ok(await _service.ListIssuedPaymentsAsync(page, pageSize, ct));
|
||||
|
||||
/// <summary>Get a pre-filled default issued payment model for the given issued invoice id.</summary>
|
||||
[HttpGet("issued-payments/default/{invoiceId:int}")]
|
||||
public async Task<IActionResult> IssuedPaymentDefault(int invoiceId, CancellationToken ct)
|
||||
=> Ok(await _service.IssuedPaymentDefaultAsync(invoiceId, ct));
|
||||
|
||||
/// <summary>Get an issued document payment detail by id.</summary>
|
||||
[HttpGet("issued-payments/{id:int}")]
|
||||
public async Task<IActionResult> IssuedPaymentDetail(int id, CancellationToken ct)
|
||||
=> Ok(await _service.IssuedPaymentDetailAsync(id, ct));
|
||||
|
||||
/// <summary>Create (register) a new payment for an issued document.</summary>
|
||||
[HttpPost("issued-payments")]
|
||||
public async Task<IActionResult> CreateIssuedPayment([FromBody] IssuedDocumentPaymentPostModel model, CancellationToken ct)
|
||||
=> Ok(await _service.CreateIssuedPaymentAsync(model, ct));
|
||||
|
||||
/// <summary>Delete an issued document payment by id.</summary>
|
||||
[HttpDelete("issued-payments/{id:int}")]
|
||||
public async Task<IActionResult> DeleteIssuedPayment(int id, CancellationToken ct)
|
||||
=> Ok(await _service.DeleteIssuedPaymentAsync(id, ct));
|
||||
|
||||
/// <summary>Fully unpay an issued invoice (removes all its payments).</summary>
|
||||
[HttpPost("issued-payments/fully-unpay/{invoiceId:int}")]
|
||||
public async Task<IActionResult> FullyUnpayIssued(int invoiceId, CancellationToken ct)
|
||||
=> Ok(await _service.FullyUnpayIssuedAsync(invoiceId, ct));
|
||||
|
||||
// ---- Received document payments ----
|
||||
|
||||
/// <summary>List received document payments (paged).</summary>
|
||||
[HttpGet("received-payments")]
|
||||
public async Task<IActionResult> ListReceivedPayments(int page = 1, int pageSize = 20, CancellationToken ct = default)
|
||||
=> Ok(await _service.ListReceivedPaymentsAsync(page, pageSize, ct));
|
||||
|
||||
/// <summary>Get a pre-filled default received payment model for the given received invoice id.</summary>
|
||||
[HttpGet("received-payments/default/{invoiceId:int}")]
|
||||
public async Task<IActionResult> ReceivedPaymentDefault(int invoiceId, CancellationToken ct)
|
||||
=> Ok(await _service.ReceivedPaymentDefaultAsync(invoiceId, ct));
|
||||
|
||||
/// <summary>Get a received document payment detail by id.</summary>
|
||||
[HttpGet("received-payments/{id:int}")]
|
||||
public async Task<IActionResult> ReceivedPaymentDetail(int id, CancellationToken ct)
|
||||
=> Ok(await _service.ReceivedPaymentDetailAsync(id, ct));
|
||||
|
||||
/// <summary>Create (register) a new payment for a received document.</summary>
|
||||
[HttpPost("received-payments")]
|
||||
public async Task<IActionResult> CreateReceivedPayment([FromBody] ReceivedDocumentPaymentPostModel model, CancellationToken ct)
|
||||
=> Ok(await _service.CreateReceivedPaymentAsync(model, ct));
|
||||
|
||||
/// <summary>Delete a received document payment by id.</summary>
|
||||
[HttpDelete("received-payments/{id:int}")]
|
||||
public async Task<IActionResult> DeleteReceivedPayment(int id, CancellationToken ct)
|
||||
=> Ok(await _service.DeleteReceivedPaymentAsync(id, ct));
|
||||
|
||||
/// <summary>Fully unpay a received invoice (removes all its payments).</summary>
|
||||
[HttpPost("received-payments/fully-unpay/{invoiceId:int}")]
|
||||
public async Task<IActionResult> FullyUnpayReceived(int invoiceId, CancellationToken ct)
|
||||
=> Ok(await _service.FullyUnpayReceivedAsync(invoiceId, ct));
|
||||
}
|
||||
@@ -0,0 +1,107 @@
|
||||
using IdokladSdk.Models.CashRegister;
|
||||
using IdokladSdk.Models.CashVoucher;
|
||||
using IdokladSdk.Models.ReceivedReceipt.Patch;
|
||||
using IdokladSdk.Models.ReceivedReceipt.Post;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Idoklad.Services;
|
||||
|
||||
namespace Idoklad.Controllers;
|
||||
|
||||
/// <summary>
|
||||
/// Received receipts and cash agendas. Requires iDoklad credentials (headers or environment defaults).
|
||||
/// </summary>
|
||||
[ApiController]
|
||||
[Produces("application/json")]
|
||||
[Tags("PurchaseAndCash")]
|
||||
public sealed class PurchaseCashController : ControllerBase
|
||||
{
|
||||
private readonly PurchaseCashService _service;
|
||||
|
||||
public PurchaseCashController(PurchaseCashService service) => _service = service;
|
||||
|
||||
// ---- Received receipts ----
|
||||
|
||||
/// <summary>List received receipts (paged).</summary>
|
||||
[HttpGet("received-receipts")]
|
||||
public async Task<IActionResult> ListReceivedReceipts(int page = 1, int pageSize = 20, CancellationToken ct = default)
|
||||
=> Ok(await _service.ListReceivedReceiptsAsync(page, pageSize, ct));
|
||||
|
||||
/// <summary>Get a pre-filled default model for creating a new received receipt.</summary>
|
||||
[HttpGet("received-receipts/default")]
|
||||
public async Task<IActionResult> ReceivedReceiptDefault(CancellationToken ct)
|
||||
=> Ok(await _service.ReceivedReceiptDefaultAsync(ct));
|
||||
|
||||
/// <summary>Get a received receipt detail by id.</summary>
|
||||
[HttpGet("received-receipts/{id:int}")]
|
||||
public async Task<IActionResult> ReceivedReceiptDetail(int id, CancellationToken ct)
|
||||
=> Ok(await _service.ReceivedReceiptDetailAsync(id, ct));
|
||||
|
||||
/// <summary>Create a new received receipt.</summary>
|
||||
[HttpPost("received-receipts")]
|
||||
public async Task<IActionResult> CreateReceivedReceipt([FromBody] ReceivedReceiptPostModel model, CancellationToken ct)
|
||||
=> Ok(await _service.CreateReceivedReceiptAsync(model, ct));
|
||||
|
||||
/// <summary>Update an existing received receipt (the model id identifies the document).</summary>
|
||||
[HttpPatch("received-receipts")]
|
||||
public async Task<IActionResult> UpdateReceivedReceipt([FromBody] ReceivedReceiptPatchModel model, CancellationToken ct)
|
||||
=> Ok(await _service.UpdateReceivedReceiptAsync(model, ct));
|
||||
|
||||
/// <summary>Delete a received receipt by id.</summary>
|
||||
[HttpDelete("received-receipts/{id:int}")]
|
||||
public async Task<IActionResult> DeleteReceivedReceipt(int id, CancellationToken ct)
|
||||
=> Ok(await _service.DeleteReceivedReceiptAsync(id, ct));
|
||||
|
||||
// ---- Cash vouchers ----
|
||||
|
||||
/// <summary>List cash vouchers (paged).</summary>
|
||||
[HttpGet("cash-vouchers")]
|
||||
public async Task<IActionResult> ListCashVouchers(int page = 1, int pageSize = 20, CancellationToken ct = default)
|
||||
=> Ok(await _service.ListCashVouchersAsync(page, pageSize, ct));
|
||||
|
||||
/// <summary>Get a cash voucher detail by id.</summary>
|
||||
[HttpGet("cash-vouchers/{id:int}")]
|
||||
public async Task<IActionResult> CashVoucherDetail(int id, CancellationToken ct)
|
||||
=> Ok(await _service.CashVoucherDetailAsync(id, ct));
|
||||
|
||||
/// <summary>Create a new cash voucher.</summary>
|
||||
[HttpPost("cash-vouchers")]
|
||||
public async Task<IActionResult> CreateCashVoucher([FromBody] CashVoucherPostModel model, CancellationToken ct)
|
||||
=> Ok(await _service.CreateCashVoucherAsync(model, ct));
|
||||
|
||||
/// <summary>Update an existing cash voucher (the model id identifies the document).</summary>
|
||||
[HttpPatch("cash-vouchers")]
|
||||
public async Task<IActionResult> UpdateCashVoucher([FromBody] CashVoucherPatchModel model, CancellationToken ct)
|
||||
=> Ok(await _service.UpdateCashVoucherAsync(model, ct));
|
||||
|
||||
/// <summary>Delete a cash voucher by id.</summary>
|
||||
[HttpDelete("cash-vouchers/{id:int}")]
|
||||
public async Task<IActionResult> DeleteCashVoucher(int id, CancellationToken ct)
|
||||
=> Ok(await _service.DeleteCashVoucherAsync(id, ct));
|
||||
|
||||
// ---- Cash registers ----
|
||||
|
||||
/// <summary>List cash registers (paged).</summary>
|
||||
[HttpGet("cash-registers")]
|
||||
public async Task<IActionResult> ListCashRegisters(int page = 1, int pageSize = 20, CancellationToken ct = default)
|
||||
=> Ok(await _service.ListCashRegistersAsync(page, pageSize, ct));
|
||||
|
||||
/// <summary>Get a cash register detail by id.</summary>
|
||||
[HttpGet("cash-registers/{id:int}")]
|
||||
public async Task<IActionResult> CashRegisterDetail(int id, CancellationToken ct)
|
||||
=> Ok(await _service.CashRegisterDetailAsync(id, ct));
|
||||
|
||||
/// <summary>Create a new cash register.</summary>
|
||||
[HttpPost("cash-registers")]
|
||||
public async Task<IActionResult> CreateCashRegister([FromBody] CashRegisterPostModel model, CancellationToken ct)
|
||||
=> Ok(await _service.CreateCashRegisterAsync(model, ct));
|
||||
|
||||
/// <summary>Update an existing cash register (the model id identifies the register).</summary>
|
||||
[HttpPatch("cash-registers")]
|
||||
public async Task<IActionResult> UpdateCashRegister([FromBody] CashRegisterPatchModel model, CancellationToken ct)
|
||||
=> Ok(await _service.UpdateCashRegisterAsync(model, ct));
|
||||
|
||||
/// <summary>Delete a cash register by id.</summary>
|
||||
[HttpDelete("cash-registers/{id:int}")]
|
||||
public async Task<IActionResult> DeleteCashRegister(int id, CancellationToken ct)
|
||||
=> Ok(await _service.DeleteCashRegisterAsync(id, ct));
|
||||
}
|
||||
@@ -0,0 +1,270 @@
|
||||
using IdokladSdk.Models.CreditNote;
|
||||
using IdokladSdk.Models.IssuedDocumentTemplate.Patch;
|
||||
using IdokladSdk.Models.IssuedDocumentTemplate.Post;
|
||||
using IdokladSdk.Models.IssuedTaxDocument.Patch;
|
||||
using IdokladSdk.Models.IssuedTaxDocument.Post;
|
||||
using IdokladSdk.Models.ProformaInvoice;
|
||||
using IdokladSdk.Models.RecurringInvoice;
|
||||
using IdokladSdk.Models.SalesOrder;
|
||||
using IdokladSdk.Models.SalesReceipt;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Idoklad.Services;
|
||||
|
||||
namespace Idoklad.Controllers;
|
||||
|
||||
/// <summary>
|
||||
/// Sales-side documents. Requires iDoklad credentials (headers or environment defaults).
|
||||
/// </summary>
|
||||
[ApiController]
|
||||
[Produces("application/json")]
|
||||
[Tags("SalesDocuments")]
|
||||
public sealed class SalesDocumentsController : ControllerBase
|
||||
{
|
||||
private readonly SalesDocumentsService _service;
|
||||
|
||||
public SalesDocumentsController(SalesDocumentsService service) => _service = service;
|
||||
|
||||
// ---- Proforma invoices ----
|
||||
|
||||
/// <summary>List proforma invoices (paged).</summary>
|
||||
[HttpGet("proforma-invoices")]
|
||||
public async Task<IActionResult> ListProforma(int page = 1, int pageSize = 20, CancellationToken ct = default)
|
||||
=> Ok(await _service.ListProformaAsync(page, pageSize, ct));
|
||||
|
||||
/// <summary>Get a pre-filled default model for creating a new proforma invoice.</summary>
|
||||
[HttpGet("proforma-invoices/default")]
|
||||
public async Task<IActionResult> ProformaDefault(CancellationToken ct)
|
||||
=> Ok(await _service.ProformaDefaultAsync(ct));
|
||||
|
||||
/// <summary>Get a proforma invoice detail by id.</summary>
|
||||
[HttpGet("proforma-invoices/{id:int}")]
|
||||
public async Task<IActionResult> ProformaDetail(int id, CancellationToken ct)
|
||||
=> Ok(await _service.ProformaDetailAsync(id, ct));
|
||||
|
||||
/// <summary>Create a new proforma invoice.</summary>
|
||||
[HttpPost("proforma-invoices")]
|
||||
public async Task<IActionResult> CreateProforma([FromBody] ProformaInvoicePostModel model, CancellationToken ct)
|
||||
=> Ok(await _service.CreateProformaAsync(model, ct));
|
||||
|
||||
/// <summary>Update an existing proforma invoice (the model id identifies the document).</summary>
|
||||
[HttpPatch("proforma-invoices")]
|
||||
public async Task<IActionResult> UpdateProforma([FromBody] ProformaInvoicePatchModel model, CancellationToken ct)
|
||||
=> Ok(await _service.UpdateProformaAsync(model, ct));
|
||||
|
||||
/// <summary>Create a copy (draft) of an existing proforma invoice.</summary>
|
||||
[HttpPost("proforma-invoices/{id:int}/copy")]
|
||||
public async Task<IActionResult> CopyProforma(int id, CancellationToken ct)
|
||||
=> Ok(await _service.ProformaCopyAsync(id, ct));
|
||||
|
||||
/// <summary>Delete a proforma invoice by id.</summary>
|
||||
[HttpDelete("proforma-invoices/{id:int}")]
|
||||
public async Task<IActionResult> DeleteProforma(int id, CancellationToken ct)
|
||||
=> Ok(await _service.DeleteProformaAsync(id, ct));
|
||||
|
||||
// ---- Credit notes ----
|
||||
|
||||
/// <summary>List credit notes (paged).</summary>
|
||||
[HttpGet("credit-notes")]
|
||||
public async Task<IActionResult> ListCreditNotes(int page = 1, int pageSize = 20, CancellationToken ct = default)
|
||||
=> Ok(await _service.ListCreditNotesAsync(page, pageSize, ct));
|
||||
|
||||
/// <summary>Get a pre-filled default credit note model for the given (issued) invoice id.</summary>
|
||||
[HttpGet("credit-notes/default/{invoiceId:int}")]
|
||||
public async Task<IActionResult> CreditNoteDefault(int invoiceId, CancellationToken ct)
|
||||
=> Ok(await _service.CreditNoteDefaultAsync(invoiceId, ct));
|
||||
|
||||
/// <summary>Get a credit note detail by id.</summary>
|
||||
[HttpGet("credit-notes/{id:int}")]
|
||||
public async Task<IActionResult> CreditNoteDetail(int id, CancellationToken ct)
|
||||
=> Ok(await _service.CreditNoteDetailAsync(id, ct));
|
||||
|
||||
/// <summary>Create a new credit note.</summary>
|
||||
[HttpPost("credit-notes")]
|
||||
public async Task<IActionResult> CreateCreditNote([FromBody] CreditNotePostModel model, CancellationToken ct)
|
||||
=> Ok(await _service.CreateCreditNoteAsync(model, ct));
|
||||
|
||||
/// <summary>Update an existing credit note (the model id identifies the document).</summary>
|
||||
[HttpPatch("credit-notes")]
|
||||
public async Task<IActionResult> UpdateCreditNote([FromBody] CreditNotePatchModel model, CancellationToken ct)
|
||||
=> Ok(await _service.UpdateCreditNoteAsync(model, ct));
|
||||
|
||||
/// <summary>Delete a credit note by id.</summary>
|
||||
[HttpDelete("credit-notes/{id:int}")]
|
||||
public async Task<IActionResult> DeleteCreditNote(int id, CancellationToken ct)
|
||||
=> Ok(await _service.DeleteCreditNoteAsync(id, ct));
|
||||
|
||||
// ---- Sales receipts ----
|
||||
|
||||
/// <summary>List sales receipts (paged).</summary>
|
||||
[HttpGet("sales-receipts")]
|
||||
public async Task<IActionResult> ListSalesReceipts(int page = 1, int pageSize = 20, CancellationToken ct = default)
|
||||
=> Ok(await _service.ListSalesReceiptsAsync(page, pageSize, ct));
|
||||
|
||||
/// <summary>Get a pre-filled default model for creating a new sales receipt.</summary>
|
||||
[HttpGet("sales-receipts/default")]
|
||||
public async Task<IActionResult> SalesReceiptDefault(CancellationToken ct)
|
||||
=> Ok(await _service.SalesReceiptDefaultAsync(ct));
|
||||
|
||||
/// <summary>Get a sales receipt detail by id.</summary>
|
||||
[HttpGet("sales-receipts/{id:int}")]
|
||||
public async Task<IActionResult> SalesReceiptDetail(int id, CancellationToken ct)
|
||||
=> Ok(await _service.SalesReceiptDetailAsync(id, ct));
|
||||
|
||||
/// <summary>Create a new sales receipt.</summary>
|
||||
[HttpPost("sales-receipts")]
|
||||
public async Task<IActionResult> CreateSalesReceipt([FromBody] SalesReceiptPostModel model, CancellationToken ct)
|
||||
=> Ok(await _service.CreateSalesReceiptAsync(model, ct));
|
||||
|
||||
/// <summary>Update an existing sales receipt (the model id identifies the document).</summary>
|
||||
[HttpPatch("sales-receipts")]
|
||||
public async Task<IActionResult> UpdateSalesReceipt([FromBody] SalesReceiptPatchModel model, CancellationToken ct)
|
||||
=> Ok(await _service.UpdateSalesReceiptAsync(model, ct));
|
||||
|
||||
/// <summary>Create a copy (draft) of an existing sales receipt.</summary>
|
||||
[HttpPost("sales-receipts/{id:int}/copy")]
|
||||
public async Task<IActionResult> CopySalesReceipt(int id, CancellationToken ct)
|
||||
=> Ok(await _service.SalesReceiptCopyAsync(id, ct));
|
||||
|
||||
/// <summary>Delete a sales receipt by id.</summary>
|
||||
[HttpDelete("sales-receipts/{id:int}")]
|
||||
public async Task<IActionResult> DeleteSalesReceipt(int id, CancellationToken ct)
|
||||
=> Ok(await _service.DeleteSalesReceiptAsync(id, ct));
|
||||
|
||||
// ---- Sales orders ----
|
||||
|
||||
/// <summary>List sales orders (paged).</summary>
|
||||
[HttpGet("sales-orders")]
|
||||
public async Task<IActionResult> ListSalesOrders(int page = 1, int pageSize = 20, CancellationToken ct = default)
|
||||
=> Ok(await _service.ListSalesOrdersAsync(page, pageSize, ct));
|
||||
|
||||
/// <summary>Get a pre-filled default model for creating a new sales order.</summary>
|
||||
[HttpGet("sales-orders/default")]
|
||||
public async Task<IActionResult> SalesOrderDefault(CancellationToken ct)
|
||||
=> Ok(await _service.SalesOrderDefaultAsync(ct));
|
||||
|
||||
/// <summary>Get a sales order detail by id.</summary>
|
||||
[HttpGet("sales-orders/{id:int}")]
|
||||
public async Task<IActionResult> SalesOrderDetail(int id, CancellationToken ct)
|
||||
=> Ok(await _service.SalesOrderDetailAsync(id, ct));
|
||||
|
||||
/// <summary>Create a new sales order.</summary>
|
||||
[HttpPost("sales-orders")]
|
||||
public async Task<IActionResult> CreateSalesOrder([FromBody] SalesOrderPostModel model, CancellationToken ct)
|
||||
=> Ok(await _service.CreateSalesOrderAsync(model, ct));
|
||||
|
||||
/// <summary>Update an existing sales order (the model id identifies the document).</summary>
|
||||
[HttpPatch("sales-orders")]
|
||||
public async Task<IActionResult> UpdateSalesOrder([FromBody] SalesOrderPatchModel model, CancellationToken ct)
|
||||
=> Ok(await _service.UpdateSalesOrderAsync(model, ct));
|
||||
|
||||
/// <summary>Create a copy (draft) of an existing sales order.</summary>
|
||||
[HttpPost("sales-orders/{id:int}/copy")]
|
||||
public async Task<IActionResult> CopySalesOrder(int id, CancellationToken ct)
|
||||
=> Ok(await _service.SalesOrderCopyAsync(id, ct));
|
||||
|
||||
/// <summary>Delete a sales order by id.</summary>
|
||||
[HttpDelete("sales-orders/{id:int}")]
|
||||
public async Task<IActionResult> DeleteSalesOrder(int id, CancellationToken ct)
|
||||
=> Ok(await _service.DeleteSalesOrderAsync(id, ct));
|
||||
|
||||
// ---- Recurring invoices ----
|
||||
|
||||
/// <summary>List recurring invoices (paged).</summary>
|
||||
[HttpGet("recurring-invoices")]
|
||||
public async Task<IActionResult> ListRecurring(int page = 1, int pageSize = 20, CancellationToken ct = default)
|
||||
=> Ok(await _service.ListRecurringAsync(page, pageSize, ct));
|
||||
|
||||
/// <summary>Get a pre-filled default model for creating a new recurring invoice.</summary>
|
||||
[HttpGet("recurring-invoices/default")]
|
||||
public async Task<IActionResult> RecurringDefault(CancellationToken ct)
|
||||
=> Ok(await _service.RecurringDefaultAsync(ct));
|
||||
|
||||
/// <summary>Get a recurring invoice detail by id.</summary>
|
||||
[HttpGet("recurring-invoices/{id:int}")]
|
||||
public async Task<IActionResult> RecurringDetail(int id, CancellationToken ct)
|
||||
=> Ok(await _service.RecurringDetailAsync(id, ct));
|
||||
|
||||
/// <summary>Create a new recurring invoice template.</summary>
|
||||
[HttpPost("recurring-invoices")]
|
||||
public async Task<IActionResult> CreateRecurring([FromBody] RecurringInvoicePostModel model, CancellationToken ct)
|
||||
=> Ok(await _service.CreateRecurringAsync(model, ct));
|
||||
|
||||
/// <summary>Update an existing recurring invoice (the model id identifies the template).</summary>
|
||||
[HttpPatch("recurring-invoices")]
|
||||
public async Task<IActionResult> UpdateRecurring([FromBody] RecurringInvoicePatchModel model, CancellationToken ct)
|
||||
=> Ok(await _service.UpdateRecurringAsync(model, ct));
|
||||
|
||||
/// <summary>Create a copy (draft) of an existing recurring invoice.</summary>
|
||||
[HttpPost("recurring-invoices/{id:int}/copy")]
|
||||
public async Task<IActionResult> CopyRecurring(int id, CancellationToken ct)
|
||||
=> Ok(await _service.RecurringCopyAsync(id, ct));
|
||||
|
||||
/// <summary>Delete a recurring invoice by id.</summary>
|
||||
[HttpDelete("recurring-invoices/{id:int}")]
|
||||
public async Task<IActionResult> DeleteRecurring(int id, CancellationToken ct)
|
||||
=> Ok(await _service.DeleteRecurringAsync(id, ct));
|
||||
|
||||
// ---- Issued tax documents ----
|
||||
|
||||
/// <summary>List issued tax documents (paged).</summary>
|
||||
[HttpGet("issued-tax-documents")]
|
||||
public async Task<IActionResult> ListTaxDocuments(int page = 1, int pageSize = 20, CancellationToken ct = default)
|
||||
=> Ok(await _service.ListTaxDocumentsAsync(page, pageSize, ct));
|
||||
|
||||
/// <summary>Get a pre-filled default tax document model for the given advance (proforma) invoice id.</summary>
|
||||
[HttpGet("issued-tax-documents/default/{advanceInvoiceId:int}")]
|
||||
public async Task<IActionResult> TaxDocumentDefault(int advanceInvoiceId, CancellationToken ct)
|
||||
=> Ok(await _service.TaxDocumentDefaultAsync(advanceInvoiceId, ct));
|
||||
|
||||
/// <summary>Get an issued tax document detail by id.</summary>
|
||||
[HttpGet("issued-tax-documents/{id:int}")]
|
||||
public async Task<IActionResult> TaxDocumentDetail(int id, CancellationToken ct)
|
||||
=> Ok(await _service.TaxDocumentDetailAsync(id, ct));
|
||||
|
||||
/// <summary>Create a new issued tax document.</summary>
|
||||
[HttpPost("issued-tax-documents")]
|
||||
public async Task<IActionResult> CreateTaxDocument([FromBody] IssuedTaxDocumentPostModel model, CancellationToken ct)
|
||||
=> Ok(await _service.CreateTaxDocumentAsync(model, ct));
|
||||
|
||||
/// <summary>Update an existing issued tax document (the model id identifies the document).</summary>
|
||||
[HttpPatch("issued-tax-documents")]
|
||||
public async Task<IActionResult> UpdateTaxDocument([FromBody] IssuedTaxDocumentPatchModel model, CancellationToken ct)
|
||||
=> Ok(await _service.UpdateTaxDocumentAsync(model, ct));
|
||||
|
||||
/// <summary>Delete an issued tax document by id.</summary>
|
||||
[HttpDelete("issued-tax-documents/{id:int}")]
|
||||
public async Task<IActionResult> DeleteTaxDocument(int id, CancellationToken ct)
|
||||
=> Ok(await _service.DeleteTaxDocumentAsync(id, ct));
|
||||
|
||||
// ---- Issued document templates ----
|
||||
|
||||
/// <summary>List issued document templates (paged).</summary>
|
||||
[HttpGet("issued-document-templates")]
|
||||
public async Task<IActionResult> ListTemplates(int page = 1, int pageSize = 20, CancellationToken ct = default)
|
||||
=> Ok(await _service.ListTemplatesAsync(page, pageSize, ct));
|
||||
|
||||
/// <summary>Get a pre-filled default model for creating a new issued document template.</summary>
|
||||
[HttpGet("issued-document-templates/default")]
|
||||
public async Task<IActionResult> TemplateDefault(CancellationToken ct)
|
||||
=> Ok(await _service.TemplateDefaultAsync(ct));
|
||||
|
||||
/// <summary>Get an issued document template detail by id.</summary>
|
||||
[HttpGet("issued-document-templates/{id:int}")]
|
||||
public async Task<IActionResult> TemplateDetail(int id, CancellationToken ct)
|
||||
=> Ok(await _service.TemplateDetailAsync(id, ct));
|
||||
|
||||
/// <summary>Create a new issued document template.</summary>
|
||||
[HttpPost("issued-document-templates")]
|
||||
public async Task<IActionResult> CreateTemplate([FromBody] IssuedDocumentTemplatePostModel model, CancellationToken ct)
|
||||
=> Ok(await _service.CreateTemplateAsync(model, ct));
|
||||
|
||||
/// <summary>Update an existing issued document template (the model id identifies the template).</summary>
|
||||
[HttpPatch("issued-document-templates")]
|
||||
public async Task<IActionResult> UpdateTemplate([FromBody] IssuedDocumentTemplatePatchModel model, CancellationToken ct)
|
||||
=> Ok(await _service.UpdateTemplateAsync(model, ct));
|
||||
|
||||
/// <summary>Delete an issued document template by id.</summary>
|
||||
[HttpDelete("issued-document-templates/{id:int}")]
|
||||
public async Task<IActionResult> DeleteTemplate(int id, CancellationToken ct)
|
||||
=> Ok(await _service.DeleteTemplateAsync(id, ct));
|
||||
}
|
||||
@@ -0,0 +1,62 @@
|
||||
using IdokladSdk.Enums;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Idoklad.Services;
|
||||
|
||||
namespace Idoklad.Controllers;
|
||||
|
||||
/// <summary>Agenda statistics and summaries. Requires iDoklad credentials.</summary>
|
||||
[ApiController]
|
||||
[Route("statistics")]
|
||||
[Produces("application/json")]
|
||||
[Tags("Statistics")]
|
||||
public sealed class StatisticsController : ControllerBase
|
||||
{
|
||||
private readonly StatisticsService _service;
|
||||
|
||||
public StatisticsController(StatisticsService service) => _service = service;
|
||||
|
||||
/// <summary>Invoicing totals for a relative period (e.g. LastSevenDays, ThisMonth).</summary>
|
||||
[HttpGet("invoicing-for-period/{periodType}")]
|
||||
public async Task<IActionResult> InvoicingForPeriod(PeriodType periodType, CancellationToken ct)
|
||||
=> Ok(await _service.InvoicingForPeriodAsync(periodType, ct));
|
||||
|
||||
/// <summary>Invoicing totals for a relative year (e.g. ThisYear, LastYear).</summary>
|
||||
[HttpGet("invoicing-for-year/{yearType}")]
|
||||
public async Task<IActionResult> InvoicingForYear(YearType yearType, CancellationToken ct)
|
||||
=> Ok(await _service.InvoicingForYearAsync(yearType, ct));
|
||||
|
||||
/// <summary>Invoicing summary broken down by quarter.</summary>
|
||||
[HttpGet("quarter-summary")]
|
||||
public async Task<IActionResult> QuarterSummary(CancellationToken ct)
|
||||
=> Ok(await _service.QuarterSummaryAsync(ct));
|
||||
|
||||
/// <summary>Top partners by turnover (optionally limited by count).</summary>
|
||||
[HttpGet("top-partners")]
|
||||
public async Task<IActionResult> TopPartners([FromQuery] int? count, CancellationToken ct)
|
||||
=> Ok(await _service.TopPartnersAsync(count, ct));
|
||||
|
||||
/// <summary>Overall agenda summary (totals and key figures).</summary>
|
||||
[HttpGet("agenda-summary")]
|
||||
public async Task<IActionResult> AgendaSummary(CancellationToken ct)
|
||||
=> Ok(await _service.AgendaSummaryAsync(ct));
|
||||
|
||||
/// <summary>Statistics for a single contact by id.</summary>
|
||||
[HttpGet("contact/{id:int}")]
|
||||
public async Task<IActionResult> StatisticForContact(int id, CancellationToken ct)
|
||||
=> Ok(await _service.StatisticForContactAsync(id, ct));
|
||||
|
||||
/// <summary>Receivables broken down by debt age intervals.</summary>
|
||||
[HttpGet("debt-intervals")]
|
||||
public async Task<IActionResult> DebtIntervals(CancellationToken ct)
|
||||
=> Ok(await _service.DebtIntervalsAsync(ct));
|
||||
|
||||
/// <summary>Top debtors by outstanding amount (optionally limited by count).</summary>
|
||||
[HttpGet("top-debtors")]
|
||||
public async Task<IActionResult> TopDebtors([FromQuery] int? count, CancellationToken ct)
|
||||
=> Ok(await _service.TopDebtorsAsync(count, ct));
|
||||
|
||||
/// <summary>Progress of the agenda towards the VAT-payer registration threshold.</summary>
|
||||
[HttpGet("vat-payer-progress")]
|
||||
public async Task<IActionResult> VatPayerProgress(CancellationToken ct)
|
||||
=> Ok(await _service.VatPayerProgressAsync(ct));
|
||||
}
|
||||
Reference in New Issue
Block a user