-
Notifications
You must be signed in to change notification settings - Fork 13
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add diga invoice correction #154
Conversation
src/main/java/com/alextherapeutics/diga/model/DigaCorrectionInvoice.java
Show resolved
Hide resolved
src/main/java/com/alextherapeutics/diga/model/DigaCorrectionInvoice.java
Show resolved
Hide resolved
Thanks @gtuk ! I will review soon (possibly next week though) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for adding this feature!
Functionally the implementation looks great, but I have some thoughts about the code design.
First of all, I think I agree with your decision to expose a new method for corrections only in the public contract. In practice, when it comes to corrections I think you wouldn't be doing those automatically as part of your application's logic very often, but rather on a manual basis or possibly with some internal tooling. As such I think it makes a lot of sense to have a separate method for it.
On the other hand, there are so many things in common between the invoicing methods right now, that we have quite a lot of duplicated code in DigaApiClient
and in the two invoice types. I think this indicates that they are similar enough that we should be able to handle them both through the invoiceDiga
API.
In summary, I think I would like to do this:
- have
DigaCorrectionInvoice
extendDigaInvoice
and add the new fields only (remember to useSuperBuilder
annotation for builder to work) - in
performDigaInvoicing
, change
var xmlInvoice = xmlRequestWriter.createBillingRequest(invoice, billingInformation);
to
var xmlInvoice = invoice instanceOf DigaCorrectionInvoice ? xmlRequestWriter.createInvoiceCorrectionRequest(invoice, billingInformation); : xmlRequestWriter.createBillingRequest(invoice, billingInformation);
- keep the
digaInvoiceCorrection
method but just have it callinvoiceDiga
Unless I'm mistaken those changes will be enough to accomplish this and still have the rest of your feature work the same. I think it will be easier to keep track of the invoicing logic by doing it in one place, and I'm not that worried about it interfering with any working code 😃
What do you think? I'm open to discussion on this!
@fongie thanks for the great feedback. I incorporated all the changes (although i'm not really sure about the casting to DigaCorrectionInvoice when calling the createInvoiceCorrectionRequest method) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice, I think it all looks good now! Just some doc on the main class, and maybe a suggestion on the cast since you mentioned it, and we'll be good to go with this!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
looks good now I think! do you still consider it WIP or is it ready to be released @gtuk ?
From my side it would be ready |
Released in 2.1.0! 🎉 https://github.com/alex-therapeutics/diga-api-client/releases/tag/2.1.0 |
Pull Request
Description
This PR (WIP in order to gather more feedback) adds the possibility to send diga invoice corrections as described in "Technische Anlage 1" https://www.gkv-datenaustausch.de/media/dokumente/leistungserbringer_1/digitale_gesundheitsanwendungen/technische_anlagen_aktuell_7/DiGA_Anlage_1_Technische_Anlage_zur_RL_V2.0_20230510.pdf and "Anhang 8" https://www.gkv-datenaustausch.de/media/dokumente/leistungserbringer_1/digitale_gesundheitsanwendungen/technische_anlagen_archiv_8/DiGA_Anhang8_Rechnungskorrekturen_V1.1.0_20230413.pdf
The idea is to have a separate class (similiar to DigaInvoice) in order to not interfere with the existing implementation.
In the DigaApiClient two new methods (digaInvoiceCorrection and digaTestInvoiceCorrection) are exposed that take the DigaCorrectionInvoice class as a parameter.
The request payload is build inside DigaXmlJaxbRequestWriter and is reusing as much functions as possible from the existing implementation for billing.
Feel free to share ideas / opinions / feedback regarding the current state of the implementation
Open