openfoodfoundation / wishlist

This repository welcomes ideas and suggestions to improve the OFN software.
3 stars 0 forks source link

[Admin][Orders] Payment amount not updated after adjusting order #311

Open audez opened 2 years ago

audez commented 2 years ago

Description

The payment amount owed by client is not updated after adjusting products. This is fine in the case of payments that have already been captured (=when the shop manager has clicked the "capture" icon in the orders list page). But this is problematic in the case of payments that have not been captured.

We have hubs that don't understand why the change is not impacted on the price amount. There has also been this discussion on the topic on Slack.

Expected Behavior

If the initial payment has not been captured, and there is an adjustment made on the order, the payment amount should be updated to match the new order amount.

Actual Behaviour

If a shop manager adjust products in an order, and it changes the order amount, in the order details, the "balance due" and "Total" are correct, as well as the totals that the client can see in their account, but the “amount” column in the order detail table still shows the initial price. If the manager wants to capture the correct amount, he’ll either have:

It will also appear on the client invoice, which is not pretty.

Animated Gif/Screenshot

In the following example, the initial order was 6€, then the shop manager added 1kg of potato, so the final order is 9€.

What the clients see in their account: 👍

Screen Shot 2022-10-21 at 19 27 15

What the shop manager sees in the order detail

The balance due and Total shown are correct 👍 but the “amount” in the table still shows 6€, which is the initial price 👎 Screen Shot 2022-10-21 at 19 27 01

Steps to Reproduce

  1. Pass an order as a client on a shop
  2. As the shop manager, edit this order (by adjusting a product)
  3. See in the order detail, in the "Payment" tab (admin/orders/XXXXXX/payments) that the amount shown in the table is the initial amount and not the updated one

Severity

bug-s4: it's annoying, but you can use it

RachL commented 2 years ago

I'm not sure we can do that. Payments are showing action from users, as in actual payments. So the software cannot pretend you intended to pay 9 euros when you agreed to 6.

Perhaps if one day we create a preorder form instead of an actual order this could be done. Anyway it needs a serious inception and cannot be done with a bug fix. Moving to wishlist :+1:

audez commented 2 years ago

What bothers me though is the following:

IMO: when an order is passed, a payment intent is created with the initial price. Then the seller do adjustments:

But yeah if payment intents should only follow an action from the buyer, then there must be another way to ease the process for producers and avoid to give them such a workload.. Like creating a second type of payment intent, which would not be linked to the buyer until it is captured?

audez commented 2 years ago

We had this request from one of our hub: "If an order is modified, the invoice displays the previous amounts, which is incomprehensible for the client and the volunteer. Need to delete this trace and show only one amount."