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

Remove "Checkout only" option on payment methods #8915

Closed filipefurtad0 closed 2 years ago

filipefurtad0 commented 2 years ago

Description

Came up in #8871, but valid for both legacy and split checkout.

The checkout only option is available only for payment methods but seems not to be working correctly for split checkout. We should remove it from the dropdown, when editing a payment method:

/admin/payment_methods/<id>/edit

Expected Behavior

The checkout only option should not appear on the dropdown when editing payment methods.

Actual Behaviour

The checkout only option appears on the dropdown when editing payment methods; setting it as the only payment method closes the shop on split-checkout.

Steps to Reproduce

  1. Set a shop to open with one payment method only
  2. Set it as checkout only
  3. Verify the shop is closed

Animated Gif/Screenshot

Peek 2022-02-17 10-30

Workaround

Set the payment method as Both checkout and backoffice

Severity

bug-s3

Your Environment

Possible Fix

jibees commented 2 years ago

I guess this one should be renamed to Remove "Checkout only" option on payment methods, as it's not strongly related to splitcheckout and will actually remove this option in both split / legacy checkout, right?

filipefurtad0 commented 2 years ago

it's not strongly related to splitcheckout

Good point :+1: Renamed and updated the issue. Thanks!

Matt-Yorkley commented 2 years ago

Hmmm... I thought this feature was being used? :thinking:

RachL commented 2 years ago

@Matt-Yorkley "backoffice only" yes, "back+ front" yes, but not "checkout only". But we can double check by checking in prod DB if we have users who have selected this?

filipefurtad0 commented 2 years ago

It seems there are some payment methods in FR-prod which are set to checkout only, two of them are Stripe SCA:

select count(*) from spree_payment_methods where display_on = 'front_end'; => 8

select count(*) from spree_payment_methods where display_on = 'front_end' AND type = 'Spree::Gateway::StripeSCA'; => 2

RachL commented 2 years ago

@filipefurtad0 can we know the hub id?

filipefurtad0 commented 2 years ago

The hub (it seems to be only one) using SCA as "checkout only" is:

openfoodnetwork=> SELECT distributor_id FROM distributors_payment_methods WHERE payment_method_id IN (select id FROM spree_payment_methods WHERE display_on = 'front_end' AND type = 'Spree::Gateway::StripeSCA');
 distributor_id 
----------------
           2412
(1 row)

The others are:

openfoodnetwork=> SELECT distributor_id FROM distributors_payment_methods WHERE payment_method_id IN (select id FROM spree_payment_methods WHERE display_on = 'front_end' AND type != 'Spree::Gateway::StripeSCA');
 distributor_id 
----------------
           1453
           1072
           1063
           2412
           3192
(5 rows)
RachL commented 2 years ago

@filipefurtad0 thank you ❤️ I've switched them all :)

apricot12 commented 2 years ago

So it's safe to remove now? @RachL

I'll get on it then 😀

RachL commented 2 years ago

@apricot12 yes. I think we need to run a little migration as part of the removal? Switching all existing "checkout only" to "backoffice and checkout" ?

apricot12 commented 2 years ago

Is it migration to both back office AND checkout or only to one of these in the DB? @RachL

RachL commented 2 years ago

@apricot12 yes both! Switching to backoffice only would make payment method disappear from the shopfront. That would be annoying 😅

apricot12 commented 2 years ago

Sounds good. Will take a crack at it.