openfoodfoundation / openfoodnetwork

Connect suppliers, distributors and consumers to trade local produce.
https://www.openfoodnetwork.org
GNU Affero General Public License v3.0
1.12k stars 723 forks source link

Orders showing Shipping as 'pending' when they should be 'ready' #5119

Open kirstenalarsen opened 4 years ago

kirstenalarsen commented 4 years ago

Description

New hub, most of their orders are showing as payment complete but shipping pending [image removed - see /admin/orders with orders paid by Stripe]

There is only one payment method - Stripe. There are four shipping methods, all pick-up 3 of them did have weight (per kg) = zero, so i have now changed them to flat rate per order and will monitor

But what is happening when I open the order - the shipping is showing as pending image.png

But when I click on the payments tab, it switches to ready image.png

Expected Behavior

When an order is completed and the payment is taken, the order should show as Shipping = Ready

Actual Behaviour

For some orders (not known why), it shows as Pending instead

We're not sure if this actually has any implications, other than the user can't click the 'Shipped' button on Orders page until they have opened the order and clicked another tab. But it is confusing and off-putting

Steps to Reproduce

not sure - right now seems to be just place any order through the https://openfoodnetwork.org.au/melbourne-farmers-marketplace/shop shop! I just did a test order post my updated shipping calculators and the same thing happened

Workaround

Open the order and select any other tab (payments, adjustments etc) and it clicks to Ready

Severity

I think it's s4 because we don't think it has any significant repercussions, but it is annoying and confusing to the users. and I don't think it used to happen or happens to others? So it makes me nervous

Your Environment

Mac, Chrome but I don't think is relevant

Possible Fix

lin-d-hop commented 4 years ago

I've got this on my long to do list - to understand the different shipping state transitions.

I believe that Stripe payment method sets Shipping State to Pending but manual payment methods set Shipping State to Ready with the little icon you can click to 'Ship'. Thought I've never confirmed this or created issues.

Next Steps:

  1. Identify the how the different Shipping States are created
  2. Make a product decision about what is the correct state transition for Shipping States
  3. Create a set of papercuts that unify these Shipping State transitions.
RachL commented 4 years ago

@kirstenalarsen @lin-d-hop I wonder if this isn't the same as : https://github.com/openfoodfoundation/openfoodnetwork/issues/4121

luisramos0 commented 4 years ago

I dont think this is worrying, I cant see how this could create problems elsewhere except for the actual problem of not seeing the expected state and action buttons to change it.

kirstenalarsen commented 4 years ago

yes @RachL I think it is closely related or the same as #4121

The only thing that doesn't gell about your theory abovce @lin-d-hop is that these are ALL Stripe payments, and a couple came through as ready and the rest pending. Athough I suppose it's possible that the user had opened the orders which changed the state

kirstenalarsen commented 4 years ago

Just some more cries of pain from the user to add here. Unfortunately I don't think it warrants an S2, but will likely be next cab for Aus S3

"I have a question about marking orders off as shipped, for some reason all of our orders are saying pending in the shipping column, even though payment has been settled through stripe in the checkout. I have to go into each order manually, click onto another part of the order (either customer details or payment) and then when I go back to the order details it has the option to ship then. With so many orders, this is a hugely manual process and very slow… is there a quicker way to mark as ready to ship as there is from the main orders page with marking off payments?"

RachL commented 4 years ago

Should we close it in favor of #4121 ?

luisramos0 commented 4 years ago

I believe shipment and payment states are not, and should not be, related. An order can shipped and not payed and payed but not shippped. We shouldnt make them related.

Looking at the spree code, I believe pending shipment is for when order is not complete yet (you cannot ship an incomplete order. Ready is for complete orders and shipped is for when the order is actually shipped. Apart from this, there is a workflow transition from ready and pending to cancelled and another move back again to pending/ready called resume.

lbwright22 commented 4 years ago

can this be moved to a potential papercut issue?

lbwright22 commented 4 years ago

UX of the ship button and order states

mbudm commented 4 years ago

As discussed in this thread this issue is cause by the order shipping_state being changed from ready to pending in an adjustments callback after the checkout submit. Later, after the order is edited, another adjustment changes the shipping_state back from pending to ready. Ideally this should not happen in such an adhoc, hard to follow way.

Adjustments are a known tech debt issue and quite hard to work with/comprehend. @luisramos0 summarised that the better aproach may be to do this after we have moved Sprre code to OFN:

I'd be very glad to see that someone has an alternative approach but I think the first step to resolve this mess is to bring all the related Spree code to our side (which means moving core model classes like Order, Adjustment, OrderUpdater, etc to our side) and then clean up (remove callbacks, etc) when it's all in the OFN codebase.

RachL commented 3 years ago

@Matt-Yorkley @lin-d-hop do you know if this issue is still blocked?

Matt-Yorkley commented 3 years ago

I thought it was already resolved..? :man_shrugging: