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

Improve handling of refunded invoice in invoices, invoice details and invoice export. #3597

Closed
2 of 3 tasks
pavlenex opened this issue Mar 31, 2022 · 8 comments · Fixed by #5791
Closed
2 of 3 tasks
Labels
Bug Invoice Related to Invoices in BTCPay
Milestone

Comments

@pavlenex
Copy link
Contributor

pavlenex commented Mar 31, 2022

Currently, if an invoice is refunded:

  • It's not visible in invoice export as refunded it's settled the amount is in +, which can lead to accounting problems.
  • In invoices view you cannot distinguish refunded invoices, they say settled so it's hard for a merchant to pick a particular invoice that may need to be refunded or view a refunded one as they're all settled
  • In the invoice details there's no field indicating an invoice is refunded in any way
  • In invoice details there's no indicator of the refunded amount , and you can even click issue a refund on an invoice already refunded.

This is an example of an invoice detail of an already refunded invoice.
Screenshot 2022-03-31 at 16 11 47
This invoices view shows 3 invoices as settled, all of them refunded
Screenshot 2022-03-31 at 20 08 43
And most problematic of all, this is an invoice export containing reporting for refunded invoices

Screenshot 2022-03-31 at 20 10 30

This issue can potentially be broken down into several issues, but for now we'll use it as a tracker

  • Add refunded invoices in invoice export and show refunded amount
  • Add refunded label in invoices page view to distinguish easier refunded from settled.
  • Add indicator that invoice is refunded in invoice details and don't show issue a refund button, instead show preview a refund

Luckily we log in refunded in database, but we don't show it in the UI, show a fix for all of these shouldn't be that hard as @Kukks pointed out.
I had an idea of introducing refunded and refunded-partial status, but Kukks was against it.

Thanks to Bas for pointing majority of these problems, I'm just logging an issue.

@pavlenex pavlenex added Bug Invoice Related to Invoices in BTCPay labels Mar 31, 2022
@rustywave
Copy link
Contributor

rustywave commented Jul 13, 2022

Hi @Kukks , was advised that updating the export was the only thing remaining on this ticket. Found a couple items for clarification if you have time:

  1. Refunds are list of Pull Payments. However, through the invoice detail page you can only perform a full or partial refund once. Should we anticipate multiple refunds in the future? Seems like we should.
  2. If yes to 1, how should we deal with summing multiple refunds that may be in different currencies? Is there a function for this already? Easy solution would be to just take the first one but may cause problems in the future. But I guess we'd have to refactor in multiple areas anyway.
  3. Paid and Paid Currency are strings but Invoice Due and Invoice Price are numbers. Thoughts? I'll leave as string for now (see draft).

Another separate-but-related issue:

  • Export doesn't appear to go off of selected invoices but rather the search bar

@rustywave
Copy link
Contributor

@pavlenex

Need a little clarification for desired result -- invoice export actually can have multiple payments per invoice. Refunds have multiple pull payments per refund and could be added separately like payments. However, as @Kukks pointed out this is not really an invoice export now.

Some options:

  1. Make this a top-level, invoice-only export (no multiple payments or pull payments)
  2. Add pull payments, by line like we do for payments
  3. Other

Also a separate issue to consider is that exporting invoices does not respect the checkbox selections -- it exports all invoices that have been listed on the page (via filter terms). Will try to join the call!

@rustywave
Copy link
Contributor

Update from dev call 7/19: We will go with option 2 -- listing all payments and pull payments

@pavlenex
Copy link
Contributor Author

Hey @rustywave are you still up for tackling this one?

@rustywave
Copy link
Contributor

@pavlenex, sorry for being MIA! i won't be able to finish this or any others at this time. update is partway done but there are still some clarifications needed on which are the correct fields to use. i can either create a PR or push my changes to a remote branch for the next person to review.

@rustywave
Copy link
Contributor

If it helps, branch is here:
feature/3597-add-refund-to-invoice-export

Can delete if not needed anymore or just let me know and I'll delete.

@NicolasDorier
Copy link
Member

NicolasDorier commented Nov 17, 2022

The invoice export isn't an invoice export but a payment export. We shouldn't try to change the nature of it.

If we need exports on other things, we need more discussion and refactor completely our data export system.
It isn't an easy topic as there are multiple use cases to consider, and it is never clear for each use case which fields and data would make sense.

But would be to inspire from fireflyiii.

This shouldn't go in 1.7.0

@pavlenex
Copy link
Contributor Author

@NicolasDorier Agreed. Can you explain what fireflyiii does that you like?

@pavlenex pavlenex removed this from the 1.7.0 milestone Dec 19, 2022
@pavlenex pavlenex modified the milestones: 1.12.x, 1.13.0 Jun 19, 2023
@btcpayserver btcpayserver deleted a comment from RSALDANA31 Nov 21, 2023
@pavlenex pavlenex modified the milestones: 1.13.0, 1.14.0 Dec 22, 2023
@pavlenex pavlenex modified the milestones: 1.14.0, 1.13.0 Mar 4, 2024
@pavlenex pavlenex linked a pull request Mar 4, 2024 that will close this issue
@pavlenex pavlenex modified the milestones: 1.13.0, 1.14.0 Mar 20, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Invoice Related to Invoices in BTCPay
Projects
Status: Done
Development

Successfully merging a pull request may close this issue.

3 participants