diff --git a/app/models/spree/payment.rb b/app/models/spree/payment.rb index ef386f22186..de134899229 100644 --- a/app/models/spree/payment.rb +++ b/app/models/spree/payment.rb @@ -174,7 +174,11 @@ def profiles_supported? end def create_payment_profile - return unless source.is_a?(CreditCard) && source.number && !source.has_payment_profile? + return unless source.is_a?(CreditCard) + return unless source.try(:save_requested_by_customer?) + return unless source.number || source.gateway_payment_profile_id + return unless source.gateway_customer_profile_id.nil? + payment_method.create_profile(self) rescue ActiveMerchant::ConnectionError => e gateway_error e diff --git a/app/models/spree/payment_decorator.rb b/app/models/spree/payment_decorator.rb index 3c88894bc2a..a66346dd7e3 100644 --- a/app/models/spree/payment_decorator.rb +++ b/app/models/spree/payment_decorator.rb @@ -8,18 +8,5 @@ module Spree # The issues the callback fixes are not experienced in OFN: # if a payment fails on checkout the state "failed" is persisted correctly def persist_invalid; end - - private - - def create_payment_profile - return unless source.is_a?(CreditCard) - return unless source.try(:save_requested_by_customer?) - return unless source.number || source.gateway_payment_profile_id - return unless source.gateway_customer_profile_id.nil? - - payment_method.create_profile(self) - rescue ActiveMerchant::ConnectionError => e - gateway_error e - end end end