A shoppers balance appears to be incorrect in many places.
The affected user id is 200213.
A consistent customer balance in /accounts, admin/customers, admin/orders of £35.86.
From the hubs records the balance should be £35.86.
From the shopper perspective /accounts shows a balance of £73.70
From admin/orders the account has a small credit of 97p
No workaround.
Technically S2. I hope that @sauloperez will look at this at part of the Customer Balances work if its not finished.
Both pages look at Spree::Order#outstanding_balance which is total - payment_total.
@lin-d-hop Where do you see the non-matching amount? Can you share a screenshot?
I edited the issue adding the user id which enables all core devs to find the user without sharing the email address publicly.
Even if we don't know how to get into this situation, I think that it can be useful to include the steps of how to observe this situation in How to reproduce.
The non-matching amount comes from two places:
What I will do is go to the user and ask for a running balance of the users orders according to their accounting software and reconcile against the shopper accounts.
Looking at admin/orders and /accounts I see there are only two orders for this customer with balance owing:
R685780682 placed on 07/03/21 owing £35.73 (admin) £35.73 (accounts)
R627200625 placed on 11/12/17 owing £37.84 (admin) £37.84 (accounts)
This makes the balance due overall = £73.57 (which is the total seen when I enter the customer's account and look under /transactions)
The name of the customer in R627200625 is not R* F* but a different name. I think this might be the difference we are looking for.
Searching /admin/orders by the customer's name (first four letters of first name and initial of surname) and not their account email address brings up orders related to not only the @tam* email address but another email address. It also misses out order R627200625
Search /admin/orders by name gives outstanding payments on orders
R685780682 placed on 07/03/21 owing £35.73
R406025453 placed on 11/12/16 owing £26.55
R344617085 placed on 05/11/16 owing £9.12
This is excellent sleuthing! Please share with Sara and once she confirms we can all celebrate that balances are working!!
Tamar tested with their whole staff team so this inspires huge confidence in a part of the system that has always been tricky.
Thanks @lbwright22 and huge thanks to @sauloperez for driving this work!!!