feat: add PaymentInfo support for Platnosc element#40
Merged
Conversation
- Add PaymentInfo model with is_paid flag, payment/due dates, due description, payment method, and bank account number - Add PAYMENT_METHOD_* constants matching TFormaPlatnosci enum (cash, card, voucher, check, credit, bank_transfer, mobile) - Add optional payment_info field on InvoiceData - Serialize Platnosc element in correct schema order: Zaplacono -> DataZaplaty -> TerminPlatnosci -> FormaPlatnosci -> RachunekBankowy - Note: Zaplacono is a TWybor1 flag (value '1' = fully paid), not an amount field
Tests cover: - payment_info=None omits <Platnosc> entirely - Bank transfer with due date + account number - Paid-in-full with Zaplacono flag and DataZaplaty - Due description (TerminOpis) - is_paid=False omits Zaplacono element
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds support for the
<Platnosc>element (payment details) in theFasection of the FA(3) schema.What's new
PaymentInfomodel with:is_paid: bool— emits<Zaplacono>1</Zaplacono>flag when Truepayment_date—<DataZaplaty>due_date+due_description—<TerminPlatnosci>/<Termin>/<TerminOpis>method—<FormaPlatnosci>(usePAYMENT_METHOD_*constants)bank_account_number—<RachunekBankowy>/<NrRB>TFormaPlatnoscienum:PAYMENT_METHOD_CASH(1),CARD(2),VOUCHER(3),CHECK(4),CREDIT(5),BANK_TRANSFER(6),MOBILE(7)payment_infofield onInvoiceData_build_payment_info()emitting elements in schema order:Zaplacono→DataZaplaty→TerminPlatnosci→FormaPlatnosci→RachunekBankowyNote on
ZaplaconoInitial attempt treated
Zaplaconoas a decimal amount, which KSeF rejected:TWybor1is a flag type accepting only value1. The actual paid amount is implied fromP_15when the flag is set.Test plan