Class: Corzinus::Checkout::ConfirmStep

Inherits:
Rectify::Command
  • Object
show all
Defined in:
app/commands/corzinus/checkout/confirm_step.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(options) ⇒ ConfirmStep

Returns a new instance of ConfirmStep.



6
7
8
9
10
# File 'app/commands/corzinus/checkout/confirm_step.rb', line 6

def initialize(options)
  @order = options[:order]
  @person = options[:person]
  @confirm = options[:params][:confirm] if options[:params]
end

Instance Attribute Details

#confirmObject (readonly)

Returns the value of attribute confirm.



4
5
6
# File 'app/commands/corzinus/checkout/confirm_step.rb', line 4

def confirm
  @confirm
end

#orderObject (readonly)

Returns the value of attribute order.



4
5
6
# File 'app/commands/corzinus/checkout/confirm_step.rb', line 4

def order
  @order
end

#personObject (readonly)

Returns the value of attribute person.



4
5
6
# File 'app/commands/corzinus/checkout/confirm_step.rb', line 4

def person
  @person
end

Instance Method Details

#callObject



12
13
14
15
16
17
18
19
# File 'app/commands/corzinus/checkout/confirm_step.rb', line 12

def call
  return broadcast(:invalid) if confirm.blank? || person.blank?
  transaction do
    order.confirm!
    send_mail
  end
  broadcast :valid
end