Given this context, I am curious if the setting to Debit is intentional or if it’s an oversight. Can we safely modify the validateInstance method to not forcibly set the CreditOrDebit to Debit, thereby allowing the issuance of actual Credit type credit notes? Or is there more complexity behind this decision that might affect other parts of the framework?
I would appreciate any insights or suggestions regarding this matter. Thank you!
API for issuing Credit Notes available here: https://github.com/premium-minds/billy/blob/791b6d563ec0808257aeb56e06e916c93033a127/billy-portugal/src/main/java/com/premiumminds/billy/portugal/util/CreditNotes.java#L89
Upon reviewing the implementation, I noticed that the
validateInstance
method in the code sets the document type toDebit
by default:This behavior is enforced every time a document is issued, as seen here:
However, the
PTSAFTFileGenerator
seems to handle bothCredit
andDebit
types, as indicated by the switch-case handling in the code:https://github.com/premium-minds/billy/blob/791b6d563ec0808257aeb56e06e916c93033a127/billy-portugal/src/main/java/com/premiumminds/billy/portugal/services/export/saftpt/v1_04_01/PTSAFTFileGenerator.java#L835-L842
Given this context, I am curious if the setting to
Debit
is intentional or if it’s an oversight. Can we safely modify thevalidateInstance
method to not forcibly set theCreditOrDebit
toDebit
, thereby allowing the issuance of actualCredit
type credit notes? Or is there more complexity behind this decision that might affect other parts of the framework?I would appreciate any insights or suggestions regarding this matter. Thank you!