-
-
Notifications
You must be signed in to change notification settings - Fork 1k
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
createRefund not taking promotions into account #2393
Comments
Oeh, that's a nasty one! :( |
I'm going to re-think the way that refunds work. Right now it is both too complex and too restrictive.
I think a better design would allow:
|
Something to consider that we encounter is when an order is changed, when need to refund the difference to them, the entire payment can't be considered refunded because if the customer wants to cancel later, they need refunded the part that wasn't refunded previously. I would like the redesign of refunds to allow for partial refunds against a payment. Something else I want to implement, but don't have a good way to currently, is to have a portion of the order be non-refundable, as we sell custom made-to-order products, and calculating and adding an adjustment every time someone cancels is onerous. |
@jacobfrantz1 thanks for the input. I definitely intend to allow partial refunds (as long as the underlying payment provider allows it, which is mostly the case). Right now the big issue for me is that the way Refunds are designed, they have to be related to a particular part of the order that is getting refunded (e.g. an order line item, or shipping). I'm not sure if this is useful or not. I'm wondering whether it would make more sense to just simplify refunds and allow the store operator to decide how much to refund from each payment method. Of course we can calculate what we think the refund should be based on e.g. cancelled items, but beyond that maybe just let the store operator have total control and not have Vendure do its own calculations on what it thinks should be an allowable refund in the backend logic as it does currently. Any thoughts on that? |
The only use case I can think of for linking refunds to order line items is for statistics, which isn't super important. I think how the refund amount is determined should be a configurable strategy, though the store operator should still be able to change it to what they want. That would help my use case, though I'm not sure if enough people would find that useful to justify it. |
I agree that separating refunds from cancellation gives us a lot more freedom on how to do refunds. It also feels a more intuitive for me. We could then just manually refund $10, with a manual note like As you already said, you can still have the admin UI do a suggestion for a refund when you cancel an order item. ❓ What happens with the order when you refund $10, but don't cancel any items? E.g:
Will the order total still be $100, or will it be $90? I'm thinking about this from an invoice perspective, where the invoice should reflect the actual amount paid. (So, $90 should be on a re-created invoice after refund) |
@martijnvdbrug good question. I'm not sure, I'd need to research how other systems handle this. Here's a video that show's Shopify's refund process - it is very simple and follows the idea I outline above where the system will calculate the refund amount based on the selected products being refunded, but also just allows the amount to be set manually. |
Describe the bug
When canceling and refunding a order that has promotions applied. The refundOrderLinesTotal doesn't account for promotions. The payment is properly refunded, but there is an error as it looks for another payment to cover the total, and the refund on vendure's side fails.
From the logs:
To Reproduce
Steps to reproduce the behavior:
1.) Cancel and Refund order that has promotions applied.
2.) See Error "Could not find a Payment to refund"
Expected behavior
The problem may be wide spread, as order line prices are not calculated properly on placed orders.
The problem is here:
vendure/packages/core/src/entity/order-line/order-line.entity.ts
Lines 392 to 395 in bd834d0
and here:
vendure/packages/core/src/entity/order-line/order-line.entity.ts
Lines 407 to 409 in 7e2c17a
These function exits early as quantity is 0, but orderPlacedQuantity is not 0.
Environment (please complete the following information):
The text was updated successfully, but these errors were encountered: