Improve code readability a little

This commit is contained in:
luisramos0
2020-01-19 21:46:52 +00:00
committed by Luis Ramos
parent 6fb74c88cd
commit b3ac5d8f41
3 changed files with 6 additions and 16 deletions

View File

@@ -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

View File

@@ -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

View File

@@ -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?