import { AutoEncoder } from '@simonbackx/simple-encoding'; import { Payment, PrivatePayment } from './members/Payment.js'; import { PriceBreakdown } from './PriceBreakdown.js'; import { TranslatedString } from './TranslatedString.js'; export declare enum BalanceItemStatusV352 { Hidden = "Hidden", Pending = "Pending", Paid = "Paid" } export declare enum BalanceItemStatus { /** * The balance is not yet due, but it can be paid. As soon as it is paid, it will transform into 'Due' and automatic status changes can happen to connected resources. */ Hidden = "Hidden", /** * This means payment of the amount is a requirement. */ Due = "Due", /** * This means the balance is no longer due. If there is any paid amount, it is refundable. * In case you don't want to refund the amount, you should change the status to 'Due' and change the amount to the amount that is not refundable. */ Canceled = "Canceled" } export declare enum VATExcemptReason { /** * Btw verlegd: Art. 39 bis – intracommunautaire levering */ IntraCommunity = "IntraCommunity" } export declare function getVATExcemptReasonName(reason: VATExcemptReason): string; export declare function getVATExcemptInvoiceNote(reason: VATExcemptReason): string; export declare enum BalanceItemType { Registration = "Registration", AdministrationFee = "AdministrationFee", FreeContribution = "FreeContribution", Order = "Order", Other = "Other", PlatformMembership = "PlatformMembership", CancellationFee = "CancellationFee", RegistrationBundleDiscount = "RegistrationBundleDiscount", /** * Small differences that occurred when creating a payment or invoice */ Rounding = "Rounding", /** * Platform package activation (features) */ STPackage = "STPackage" } export declare function getBalanceItemStatusName(type: BalanceItemStatus): string; export declare function getBalanceItemTypeName(type: BalanceItemType): string; export declare function getBalanceItemTypeIcon(type: BalanceItemType): string | null; export declare enum BalanceItemRelationType { Webshop = "Webshop",// Contains the name of the webshop Group = "Group",// Contains the name of the group you registered for GroupPrice = "GroupPrice",// Contains the price of the group you registered for GroupOptionMenu = "GroupOptionMenu",// Contains the option menu that was chosen for the group GroupOption = "GroupOption",// Contains the option that was chosen for the group Member = "Member",// Contains the name of the member you registered MembershipType = "MembershipType", Discount = "Discount",// Name and id of the related discount STPackage = "STPackage" } export declare function getBalanceItemRelationTypeName(type: BalanceItemRelationType): string; export declare function getBalanceItemRelationTypeDescription(type: BalanceItemRelationType): string; /** * Return true if it is allowed to group balance items if they have a different value for this relation type */ export declare function shouldAggregateOnRelationType(type: BalanceItemRelationType, item: { type: BalanceItemType; relations: Map; }): boolean; /** * Helps you understand what a balance item is for. It can be for multiple things at the same time, e.g. when it is an option to buy a ticket, it is also a ticket. */ export declare class BalanceItemRelation extends AutoEncoder { id: string; name: TranslatedString; } export declare function doBalanceItemRelationsMatch(a: Map, b: Map, allowedDifference?: number): boolean; export declare class BalanceItem extends AutoEncoder { id: string; type: BalanceItemType; relations: Map; description: string; /** * quantity, should be renamed to quantity in the future */ amount: number; get quantity(): number; set quantity(value: number); /** * Price per piece * * NOTE: We store an integer of the price up to 4 digits after the comma. * 1 euro = 10000. * 0,01 euro = 100 * 0,0001 euro = 1 * * This is required for correct VAT calculations without intermediate rounding. */ unitPrice: number; VATPercentage: number | null; VATIncluded: boolean; /** * Whether there is a VAT excempt reason. * Note: keep the original VAT in these cases. On time of payment or invoicing, the VAT excemption will be revalidated. * If that fails, we can still charge the VAT. */ VATExcempt: VATExcemptReason | null; /** * @deprecated use priceWithVAT in combination with isDue * * NOTE: We store an integer of the price up to 4 digits after the comma. * 1 euro = 10000. * 0,01 euro = 100 * 0,0001 euro = 1 * * This is required for correct VAT calculations without intermediate rounding. */ get price(): number; /** * Total price that needs to be paid, not including already paid or pending payments. * * The difference with priceWithVAT is that it takes into account canceled and hidden balance items */ get payablePriceWithVAT(): number; /** * Difference here is that when the VAT is excempt, this is still set, while VAT will be zero. */ get calculatedVAT(): number; /** * Note, this is not 100% accurate. * Legally we most often need to calculate the VAT on invoice level and round it there. * Technically we cannot pass infinite accurate numbers around in a system to avoid rounding. The returned number is * therefore rounded up to 4 digits after the comma. On normal amounts, with only 2 digits after the comma, this won't lose accuracy. * So the VAT calculation needs to happen at the end again before payment. */ get VAT(): number; get priceWithVAT(): number; /** * Note: when the VAT is already included, the result of this will be unreliable because of rounding issues. * Do not use this in calculations! */ get priceWithoutVAT(): number; get unitPriceWithVAT(): number; /** * NOTE: We store an integer of the price up to 4 digits after the comma. * 1 euro = 10000. * 0,01 euro = 100 * 0,0001 euro = 1 * * This is required for correct VAT calculations without intermediate rounding. */ get priceOpen(): number; /** * Cached value, for optimizations * * NOTE: We store an integer of the price up to 4 digits after the comma. * 1 euro = 10000. * 0,01 euro = 100 * 0,0001 euro = 1 * * This is required for correct VAT calculations without intermediate rounding. */ pricePaid: number; /** * Cached value, for optimizations * * NOTE: We store an integer of the price up to 4 digits after the comma. * 1 euro = 10000. * 0,01 euro = 100 * 0,0001 euro = 1 * * This is required for correct VAT calculations without intermediate rounding. */ pricePending: number; /** * How much has been invoiced */ dueAt: Date | null; createdAt: Date; status: BalanceItemStatus; get isPaid(): boolean; get isDue(): boolean; get isOverDue(): boolean; organizationId: string; memberId: string | null; userId: string | null; registrationId: string | null; payingOrganizationId: string | null; orderId: string | null; static getDueOffset(from?: Date): Date; static getOutstandingBalance(items: BalanceItem[]): { priceWithVAT: number; payablePriceWithVAT: number; pricePending: number; priceOpen: number; pricePaid: number; }; static filterBalanceItems(items: BalanceItem[]): BalanceItem[]; get paymentShortDescription(): string; /** * To help split payments in categories: return a more detailed category than purely the type */ get category(): string; get groupTitle(): string; get groupDescription(): string | null; get priceBreakown(): PriceBreakdown; /** * Unique identifier whithing a reporting group */ get groupCode(): string; /** * When displayed as a single item */ get itemTitle(): string; /** * When displayed as a single item */ get itemDescription(): string | null; static getDetailsHTMLTable(items: BalanceItem[]): string; } export declare class BalanceItemPayment extends AutoEncoder { id: string; price: number; } export declare class BalanceItemPaymentWithPayment extends BalanceItemPayment { payment: Payment; } export declare class BalanceItemPaymentWithPrivatePayment extends BalanceItemPayment { payment: PrivatePayment; } export declare class BalanceItemWithPayments extends BalanceItem { payments: BalanceItemPaymentWithPayment[]; updatePricePaid(): void; /** * Return whether a payment has been initiated for this balance item */ get hasPendingPayment(): boolean; } export declare class BalanceItemWithPrivatePayments extends BalanceItemWithPayments { payments: BalanceItemPaymentWithPrivatePayment[]; } export declare class GroupedBalanceItems { items: BalanceItem[]; constructor(); get id(): string; add(item: BalanceItem): void; get balanceItem(): BalanceItem; /** * Only shows amount open */ get amount(): number; get status(): BalanceItemStatus; /** * Only shows outstanding price */ get priceOpen(): number; get price(): number; get unitPriceWithVAT(): number; get pricePending(): number; get pricePaid(): number; get itemTitle(): string; get itemDescription(): string | null; get unitPrice(): number; get unitPriceWithAT(): number; get dueAt(): Date | null; get isDue(): boolean; get isOverDue(): boolean; get type(): BalanceItemType; static group(items: BalanceItem[]): GroupedBalanceItems[]; } //# sourceMappingURL=BalanceItem.d.ts.map