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

Order contains no line items - only adjustments #8844

Closed
lin-d-hop opened this issue Feb 7, 2022 · 10 comments
Closed

Order contains no line items - only adjustments #8844

lin-d-hop opened this issue Feb 7, 2022 · 10 comments
Labels
bug-s2 The bug is affecting any of the non-critical features described in S1 and there is no workaround.

Comments

@lin-d-hop
Copy link
Contributor

lin-d-hop commented Feb 7, 2022

Description

Order R420586454 on UK Production appears to be an empty order with no line items.
However the order does contain the correct adjustments and order total for what the customer ordered.

According to the user the correct items appeared in reports as the order was correctly packed and delivered.

However the order itself appears to require that a refund of the full amount is required, despite the total still displaying correctly. This is messing up the balance and accounting processes for the hub.

Probably related to being completed with Paypal.

Expected Behavior

Line items should appear.
Order should not have a 'credit owing'

Actual Behaviour

Order appears to have a 'credit owing' of the full order amount
No line items are appearing on the order

Steps to Reproduce

  1. Unknown. Seems to be impacting only this order

Animated Gif/Screenshot

Screenshot from 2022-02-07 13-44-42

Workaround

Severity

bug-s2: a non-critical feature is broken, no workaround
I am applying S2 in the hope we can:
a) Restore this order to a sensible state
b) Gain information on what happened

Unless there is a critical issue uncovered it is not important to fix the root cause of this issue as an S2 - we can downgrade for that.

Your Environment

  • Version used: UK Prod
  • Browser name and version:
  • Operating System and version (desktop or mobile):

Possible Fix

@lin-d-hop lin-d-hop added the bug-s2 The bug is affecting any of the non-critical features described in S1 and there is no workaround. label Feb 7, 2022
@lin-d-hop
Copy link
Contributor Author

@filipefurtad0 did you read the issue? Its not a stripe sca issue ;)

@filipefurtad0
Copy link
Contributor

filipefurtad0 commented Feb 9, 2022

Sorry, my mix-up.
I'm not sure if somehow related but items were not appearing on the order when out of stock. Wonder if this OC closed on the 31st... Anyway, this has been recently fixed but the payment was created/updated/captured just before this was deployed into production (which was on the 01.02.2022):

   id   | amount | order_id |         created_at         |         updated_at         | source_id |         source_type          | payment_method_id |   state   | response_code | avs_response | identifier | cvv_response_code | cvv_response_message |        captured_at         
--------+--------+----------+----------------------------+----------------------------+-----------+------------------------------+-------------------+-----------+---------------+--------------+------------+-------------------+----------------------+----------------------------
 429902 |  42.02 |  2308784 | 2022-01-31 09:03:19.636198 | 2022-01-31 09:03:23.096696 |    210594 | Spree::PaypalExpressCheckout |                 7 | completed |               |              | CMYCRHRE   |                   |                      | 2022-01-31 09:03:23.105361
(1 row)

@lin-d-hop
Copy link
Contributor Author

Nice thoughts @filipefurtad0
The OC was open until the 2nd at 9:30am
All 13 line items were in stock and delivered to the customer.

@lin-d-hop
Copy link
Contributor Author

Note you can see all the line items in the origianl issue... just they are adjustments, rather than line items

@filipefurtad0
Copy link
Contributor

filipefurtad0 commented Feb 9, 2022

Tricky... Just triggered this order on staging-UK, with failed checkout attempts. It looks very similar:

image

  • First payment attempt was Stripe - failed due to previously saved but expired card. Second payment attempt was cash. So I don't think it relates to any payment method
  • This was the first order placed after deployment of master. Following orders are fine.
  • At the time of deployment split-checkout feature was activated. The order was created before this. -> I know this does not apply to production, but worth noting.

Related error to this order:
https://app.bugsnag.com/yaycode/openfoodnetwork-uk/errors/61f7a5e1588013000802d818?filters[event.since]=30d&filters[error.status]=open&filters[app.release_stage]=staging&pivot_tab=event

If I understand correctly the error above points to the missing name on order.shipping_method.name, which prevents:

  • the order confirmation page to be correctly rendered
  • the shipping state of the order from being updated

Both the shipment state on the production and staging order is none. [edited] Maybe related:
#8219

@lin-d-hop
Copy link
Contributor Author

Ok, I just made this order even worse. I added a line item so I could try adding a shipping method back in to see if that would fix things.

However it didn't. And now the Apple juice I added can't be removed from the order because it is the 'last item' on the order.
Screenshot from 2022-02-09 13-33-25

Ah what a mess 🤦

@filipefurtad0
Copy link
Contributor

Maybe a heads-up on this issue @lin-d-hop : These orders potentially break /admin/reports/orders_and_distributors reports... probably because they have shipment state = none...

@filipefurtad0
Copy link
Contributor

filipefurtad0 commented Feb 21, 2022

Ahh, the order does have a shipment:

   id   | tracking |    number    | cost | shipped_at | order_id | address_id |         created_at         |        updated_at        |  state  | stock_location_id | included_tax_total | additional_tax_total | adjustment_total 
--------+----------+--------------+------+------------+----------+------------+----------------------------+--------------------------+---------+-------------------+--------------------+----------------------+------------------
 417125 |          | H10087645525 | 0.00 |            |  2308784 |            | 2022-02-09 13:32:07.596705 | 2022-02-09 13:32:32.9324 | pending |                 1 |               0.00 |                 0.00 |             0.00
(1 row)

The order, from spree_orders:


   id    |   number   | item_total | total |  state   | adjustment_total | user_id |         created_at         |         updated_at         |        completed_at        | bill_address_id | ship_address_id | payment_total | shipment_state | payment_state |             email             | special_instructions | distributor_id | currency | last_ip_address | order_cycle_id | customer_id | created_by_id | included_tax_total | additional_tax_total 
---------+------------+------------+-------+----------+------------------+---------+----------------------------+----------------------------+----------------------------+-----------------+-----------------+---------------+----------------+---------------+-------------------------------+----------------------+----------------+----------+-----------------+----------------+-------------+---------------+--------------------+----------------------
 2308784 | R420586454 |      38.08 | 45.22 | complete |             7.14 |  201478 | 2022-01-24 11:30:26.738293 | 2022-02-09 13:32:32.941567 | 2022-01-31 09:03:23.129574 |          888541 |          888542 |         42.02 | pending        | balance_due   |     <hiddenhidden>            |                      |            160 | GBP      | 86.129.43.189   |         210637 |        5353 |        201478 |               0.00 |                 0.00
(1 row)

So it seems the order now has a shipment, and it is pending. But this makes sense, because the only exiting payment (42.02) does not cover the order total (45.22)... so, balance_due state.

This seems to have changed, since you've reported @lin-d-hop - maybe because of the OJ you've added? 🍹
How does it look now in the UI? Can you add additional payments? Does clicking Update and Recalculate fees change something?

@lin-d-hop
Copy link
Contributor Author

@filipefurtad0
The order is missing its line items. All of them. I feel like this discussion has gone on a huge tangent from the fundamental problem here.

I'm closing this issue. Its been sitting here for so long and the user has worked around in their accounts that this order is just a broken mess.

@filipefurtad0
Copy link
Contributor

filipefurtad0 commented Mar 7, 2022

A broken "user" coming from split-checkout generated this order which seems similar to this issue:

image

Noting it here. I'll reopen after confirmation.

Bugsnag:

https://app.bugsnag.com/yaycode/openfoodnetwork-uk/errors/61addaf4e787680007fb5221?filters[event.since]=30d&filters[app.release_stage]=staging&event_id=6226305c009249d8284e0000

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug-s2 The bug is affecting any of the non-critical features described in S1 and there is no workaround.
Projects
None yet
Development

No branches or pull requests

2 participants