Skip to content
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

Merged
merged 4 commits into from
Mar 22, 2024
Merged

Conversation

gtuk
Copy link
Contributor

@gtuk gtuk commented Mar 15, 2024

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

  • Tests

@gtuk gtuk changed the title [WIP]Add diga invoice correction [WIP] Add diga invoice correction Mar 15, 2024
@fongie fongie self-requested a review March 15, 2024 10:52
@fongie
Copy link
Contributor

fongie commented Mar 15, 2024

Thanks @gtuk ! I will review soon (possibly next week though)

Copy link
Contributor

@fongie fongie left a 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 extend DigaInvoice and add the new fields only (remember to use SuperBuilder 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 call invoiceDiga

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!

@gtuk
Copy link
Contributor Author

gtuk commented Mar 21, 2024

@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)

Copy link
Contributor

@fongie fongie left a 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!

Copy link
Contributor

@fongie fongie left a 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 ?

@gtuk gtuk changed the title [WIP] Add diga invoice correction Add diga invoice correction Mar 22, 2024
@gtuk
Copy link
Contributor Author

gtuk commented Mar 22, 2024

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

@fongie fongie merged commit 321d41c into alex-therapeutics:main Mar 22, 2024
1 check passed
@fongie
Copy link
Contributor

fongie commented Mar 22, 2024

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants