mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-02-27 01:43:22 +00:00
add remove_shop_authorizations method to controller
This commit is contained in:
@@ -27,6 +27,7 @@ module Spree
|
||||
authorize! :update, @credit_card
|
||||
|
||||
if @credit_card.update(credit_card_params)
|
||||
remove_shop_authorizations if credit_card_params["is_default"]
|
||||
render json: @credit_card, serializer: ::Api::CreditCardSerializer, status: :ok
|
||||
else
|
||||
update_failed
|
||||
@@ -56,6 +57,10 @@ module Spree
|
||||
|
||||
private
|
||||
|
||||
def remove_shop_authorizations
|
||||
@credit_card.user.customers.update_all(allow_charges: false)
|
||||
end
|
||||
|
||||
# It destroys the whole customer object
|
||||
def destroy_at_stripe
|
||||
stripe_customer = Stripe::Customer.retrieve(@credit_card.gateway_customer_profile_id, {})
|
||||
|
||||
Reference in New Issue
Block a user