Billing: Update EBICS exporter
This commit is contained in:
26
Elwig/Models/Dtos/Transaction.cs
Normal file
26
Elwig/Models/Dtos/Transaction.cs
Normal file
@ -0,0 +1,26 @@
|
||||
using Elwig.Models.Entities;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
|
||||
namespace Elwig.Models.Dtos {
|
||||
public class Transaction(Member member, decimal amount, string currency, int nr) {
|
||||
|
||||
public readonly Member Member = member;
|
||||
public readonly decimal Amount = amount;
|
||||
public readonly string Currency = currency;
|
||||
public readonly int Nr = nr;
|
||||
|
||||
public Transaction(Credit c) : this(c.Member, c.Amount, c.Variant.Season.CurrencyCode, c.TgNr) { }
|
||||
|
||||
public static IEnumerable<Transaction> FromPaymentVariant(PaymentVar variant) {
|
||||
return variant.Credits
|
||||
.OrderBy(c => c.TgNr)
|
||||
.Select(c => new Transaction(c))
|
||||
.ToList();
|
||||
}
|
||||
|
||||
public static string FormatAmountCent(long cents) => $"{cents / 100}.{cents % 100:00}";
|
||||
|
||||
public static string FormatAmount(decimal amount) => FormatAmountCent((int)(amount * 100));
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user