Files
Khaemhat/src/Khaemhat.Fiscal.Abstractions/Treasury.cs
T
Alby96andClaude Opus 5.5 5bbc2120a1 feat: remittances, SDD mandates, bank reconciliation, dunning and cash flow services (#70 #71 #72)
Remittances draft the items due, write the RiBa CBI or SEPA pain.001/pain.008
file, present them (bills account and advance, or supplier payments), credit
them and record unpaid effects with their fees. The reconciliation imports
CSV, CBI and CAMT.053 statements without duplicates and proposes matches with
open items, payments, F24, remittances and saved rules. Reminders follow three
levels with late interest, e-mail/PEC/letter and customer block, also from a
scheduled task; the cash flow forecasts 90 days by week.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-13 09:06:04 +01:00

68 lines
2.9 KiB
C#

using Khaemhat.Core.Treasury;
namespace Khaemhat.Fiscal.Abstractions;
/// <summary>
/// Writes the national remittance files the SEPA formats do not cover (Italy: RiBa in the CBI fixed-width layout).
/// SEPA credit transfers and direct debits are written by <c>Khaemhat.Core.Treasury.SepaXmlWriter</c> for every
/// country.
/// </summary>
public interface IRemittanceFileWriter
{
/// <summary>Whether this writer writes a kind of remittance.</summary>
/// <param name="kind">The kind.</param>
/// <returns><see langword="true"/> when <see cref="Write"/> accepts it.</returns>
bool Supports(RemittanceKind kind);
/// <summary>Writes the file.</summary>
/// <param name="remittance">The remittance.</param>
/// <returns>The file.</returns>
/// <exception cref="BankFileException">A value cannot be written in the format.</exception>
BankFile Write(BankFileRemittance remittance);
}
/// <summary>
/// Reads the national bank statement format of the country (Italy: CBI). CSV and <c>camt.053</c> are read by
/// <c>Khaemhat.Core.Treasury</c> for every country.
/// </summary>
public interface IBankStatementReader
{
/// <summary>The format read.</summary>
StatementFormat Format { get; }
/// <summary>Whether the start of a file looks like this format.</summary>
/// <param name="head">The first bytes of the file (up to 4 KB).</param>
/// <returns><see langword="true"/> when <see cref="Read"/> should be tried.</returns>
bool Recognizes(ReadOnlySpan<byte> head);
/// <summary>Reads a statement.</summary>
/// <param name="content">The file.</param>
/// <returns>The statement.</returns>
/// <exception cref="BankFileException">The file is not in the format.</exception>
StatementFile Read(Stream content);
}
/// <summary>Late payment interest between companies (Italy: D.Lgs. 231/2002).</summary>
public interface ILatePaymentRules
{
/// <summary>The yearly rate, in percent, that applies to the days of a half-year.</summary>
/// <param name="day">A day.</param>
/// <returns>The reference rate of the half-year plus the margin.</returns>
decimal RateOn(DateOnly day);
/// <summary>The law the interest comes from, for the letters (Italy: <c>D.Lgs. 231/2002</c>).</summary>
string LegalReference { get; }
/// <summary>The fixed compensation for recovery costs, per invoice (Italy: 40 euro, art. 6).</summary>
decimal RecoveryCompensation { get; }
}
/// <summary>Which remittance collects or pays the items of a payment method, by the code of the method in the pack.</summary>
public interface IRemittanceMethods
{
/// <summary>The kind of remittance of a method.</summary>
/// <param name="methodCode">The code of the method in the e-invoice (for Italy the <c>MPxx</c> codes).</param>
/// <returns>The kind, or <see langword="null"/> when the method does not go in remittances.</returns>
RemittanceKind? KindOf(string? methodCode);
}