27bfd4db4d
- Stripe payments/refunds/chargebacks now post DR/CR entries (PaymentController) - Vendor credit void now reverses the posted GL lines (VendorCreditsController) - Gift certificate issue/redeem/void post GL to account 2500 GC Liability; FinancialReportService Trial Balance + Balance Sheet include GC liability and breakage income; P&L shows deferred revenue deduction and breakage income line - Customer deposits now post DR Checking / CR 2300 on record, reverse on delete; invoice auto-apply uses DR 2300 / CR AR (not a second bank debit); draft invoice delete reverses deposit-apply GL before the AR reversal - Deposit.DepositAccountId column added; account 2300 seeded via migration - InvoicesController.ApplyCredit now posts DR Sales Discounts / CR AR, consistent with CreditMemosController.Apply - IssueRefund (cash/card) posts DR AR / CR Bank and sets Refund.DepositAccountId; refund modal gains a bank account selector hidden for store-credit path - CancelRefund (cash/card) reverses the IssueRefund GL entries - LedgerService GetAccountLedgerAsync + ComputePriorBalanceAsync now include Refunds, CreditMemoApplications, VendorCreditApplications, GC Liability (2500), and Customer Deposits (2300) so account ledger view and RecalculateAllAsync produce correct balances - Three EF migrations applied: SeedSalesDiscountsAccount, AccountingGapsPhase2, AccountingDepositsGL - Unit tests updated for new IAccountBalanceService constructor params (200/200) Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
95 lines
3.6 KiB
C#
95 lines
3.6 KiB
C#
using PowderCoating.Core.Enums;
|
|
|
|
namespace PowderCoating.Application.DTOs.Invoice;
|
|
|
|
// ── Refund DTOs ───────────────────────────────────────────────────────────────
|
|
|
|
public class RefundDto
|
|
{
|
|
public int Id { get; set; }
|
|
public int InvoiceId { get; set; }
|
|
public int? PaymentId { get; set; }
|
|
public decimal Amount { get; set; }
|
|
public DateTime RefundDate { get; set; }
|
|
public PaymentMethod RefundMethod { get; set; }
|
|
public string RefundMethodDisplay => RefundMethod switch
|
|
{
|
|
PaymentMethod.Cash => "Cash",
|
|
PaymentMethod.Check => "Check",
|
|
PaymentMethod.CreditDebitCard => "Credit/Debit Card",
|
|
PaymentMethod.BankTransferACH => "Bank Transfer / ACH",
|
|
PaymentMethod.DigitalPayment => "Digital Payment",
|
|
PaymentMethod.StoreCredit => "Store Credit",
|
|
_ => RefundMethod.ToString()
|
|
};
|
|
public string Reason { get; set; } = string.Empty;
|
|
public string? Reference { get; set; }
|
|
public string? Notes { get; set; }
|
|
public RefundStatus Status { get; set; }
|
|
public DateTime? IssuedDate { get; set; }
|
|
public string? IssuedByName { get; set; }
|
|
}
|
|
|
|
public class IssueRefundDto
|
|
{
|
|
public int? PaymentId { get; set; }
|
|
public decimal Amount { get; set; }
|
|
public DateTime RefundDate { get; set; } = DateTime.Today;
|
|
public PaymentMethod RefundMethod { get; set; }
|
|
/// <summary>Bank/cash account money leaves when issuing a cash/card refund. Null for store credit.</summary>
|
|
public int? DepositAccountId { get; set; }
|
|
public string Reason { get; set; } = string.Empty;
|
|
public string? Reference { get; set; }
|
|
public string? Notes { get; set; }
|
|
}
|
|
|
|
// ── Credit Memo DTOs ──────────────────────────────────────────────────────────
|
|
|
|
public class CreditMemoDto
|
|
{
|
|
public int Id { get; set; }
|
|
public string MemoNumber { get; set; } = string.Empty;
|
|
public int CustomerId { get; set; }
|
|
public string CustomerName { get; set; } = string.Empty;
|
|
public int? OriginalInvoiceId { get; set; }
|
|
public string? OriginalInvoiceNumber { get; set; }
|
|
public int? ReworkRecordId { get; set; }
|
|
public decimal Amount { get; set; }
|
|
public decimal AmountApplied { get; set; }
|
|
public decimal RemainingBalance { get; set; }
|
|
public DateTime IssueDate { get; set; }
|
|
public DateTime? ExpiryDate { get; set; }
|
|
public string Reason { get; set; } = string.Empty;
|
|
public string? Notes { get; set; }
|
|
public CreditMemoStatus Status { get; set; }
|
|
public string? IssuedByName { get; set; }
|
|
public List<CreditMemoApplicationDto> Applications { get; set; } = new();
|
|
}
|
|
|
|
public class CreditMemoApplicationDto
|
|
{
|
|
public int Id { get; set; }
|
|
public int CreditMemoId { get; set; }
|
|
public string MemoNumber { get; set; } = string.Empty;
|
|
public int InvoiceId { get; set; }
|
|
public string InvoiceNumber { get; set; } = string.Empty;
|
|
public decimal AmountApplied { get; set; }
|
|
public DateTime AppliedDate { get; set; }
|
|
public string? AppliedByName { get; set; }
|
|
}
|
|
|
|
public class IssueCreditMemoDto
|
|
{
|
|
public decimal Amount { get; set; }
|
|
public string Reason { get; set; } = string.Empty;
|
|
public string? Notes { get; set; }
|
|
public DateTime? ExpiryDate { get; set; }
|
|
public int? ReworkRecordId { get; set; }
|
|
}
|
|
|
|
public class ApplyCreditDto
|
|
{
|
|
public int CreditMemoId { get; set; }
|
|
public decimal Amount { get; set; }
|
|
}
|