Class: SolidusImporter::Processors::Payment

Inherits:
Base
  • Object
show all
Defined in:
lib/solidus_importer/processors/payment.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from Base

#options

Instance Attribute Details

#orderObject

Returns the value of attribute order.



8
9
10
# File 'lib/solidus_importer/processors/payment.rb', line 8

def order
  @order
end

Instance Method Details

#call(context) ⇒ Object



10
11
12
13
14
15
16
17
18
19
20
21
# File 'lib/solidus_importer/processors/payment.rb', line 10

def call(context)
  @data = context.fetch(:data)

  return unless amount > 0

  self.order = context.fetch(:order, {})

  order[:payments_attributes] ||= []
  order[:payments_attributes] << payment_attributes

  context.merge!(order: order)
end