Move method from decorator to model

This commit is contained in:
Pau Perez
2020-06-26 18:06:01 +02:00
parent 322c4d0f3f
commit 6d9a518616
2 changed files with 7 additions and 13 deletions

View File

@@ -89,11 +89,15 @@ module Spree
end
# see https://github.com/spree/spree/issues/981
#
# Import from future Spree v.2.3.0 d470b31798f37
def build_source
return if source_attributes.nil?
if payment_method and payment_method.payment_source_class
self.source = payment_method.payment_source_class.new(source_attributes)
end
return unless payment_method.andand.payment_source_class
self.source = payment_method.payment_source_class.new(source_attributes)
source.payment_method_id = payment_method.id
source.user_id = order.user_id if order
end
def actions

View File

@@ -60,16 +60,6 @@ module Spree
end
end
# Import from future Spree v.2.3.0 d470b31798f37
def build_source
return if source_attributes.nil?
return unless payment_method.andand.payment_source_class
self.source = payment_method.payment_source_class.new(source_attributes)
source.payment_method_id = payment_method.id
source.user_id = order.user_id if order
end
private
def calculate_refund_amount(refund_amount = nil)