diff --git a/app/assets/javascripts/admin/payments/services/payment.js.coffee b/app/assets/javascripts/admin/payments/services/payment.js.coffee index f5cab3061c..a87497226d 100644 --- a/app/assets/javascripts/admin/payments/services/payment.js.coffee +++ b/app/assets/javascripts/admin/payments/services/payment.js.coffee @@ -21,16 +21,7 @@ angular.module('admin.payments').factory 'Payment', (AdminStripeElements, curren year: @form_data.card_year verification_value: @form_data.card_verification_value } - when 'stripe' - angular.extend munged_payment.payment, { - source_attributes: - gateway_payment_profile_id: @form_data.token - cc_type: @form_data.cc_type - last_digits: @form_data.card.last4 - month: @form_data.card.exp_month - year: @form_data.card.exp_year - } - when 'stripe_sca' + when 'stripe', 'stripe_sca' angular.extend munged_payment.payment, { source_attributes: gateway_payment_profile_id: @form_data.token diff --git a/app/controllers/spree/admin/payment_methods_controller.rb b/app/controllers/spree/admin/payment_methods_controller.rb index ad0bff9a3b..c13712b9a1 100644 --- a/app/controllers/spree/admin/payment_methods_controller.rb +++ b/app/controllers/spree/admin/payment_methods_controller.rb @@ -149,13 +149,12 @@ module Spree end def stripe_payment_method? - @payment_method.try(:type) == "Spree::Gateway::StripeConnect" || - @payment_method.try(:type) == "Spree::Gateway::StripeSCA" + ["Spree::Gateway::StripeConnect", + "Spree::Gateway::StripeSCA"].include? @payment_method.try(:type) end def stripe_provider?(provider) - provider.name.ends_with?("StripeConnect") || - provider.name.ends_with?("StripeSCA") + provider.name.ends_with?("StripeConnect", "StripeSCA") end end end diff --git a/lib/open_food_network/subscription_payment_updater.rb b/lib/open_food_network/subscription_payment_updater.rb index d1cbcb4c51..4a9c8fa144 100644 --- a/lib/open_food_network/subscription_payment_updater.rb +++ b/lib/open_food_network/subscription_payment_updater.rb @@ -30,8 +30,8 @@ module OpenFoodNetwork end def card_required? - payment.payment_method.is_a?(Spree::Gateway::StripeConnect) || - payment.payment_method.is_a?(Spree::Gateway::StripeSCA) + [Spree::Gateway::StripeConnect, + Spree::Gateway::StripeSCA].include? payment.payment_method.class end def card_set?