Class: Corzinus::Checkout::PaymentStep
- Inherits:
-
Rectify::Command
- Object
- Rectify::Command
- Corzinus::Checkout::PaymentStep
- Defined in:
- app/commands/corzinus/checkout/payment_step.rb
Instance Attribute Summary collapse
-
#order ⇒ Object
readonly
Returns the value of attribute order.
-
#payment_form ⇒ Object
readonly
Returns the value of attribute payment_form.
Instance Method Summary collapse
- #call ⇒ Object
-
#initialize(options) ⇒ PaymentStep
constructor
A new instance of PaymentStep.
Constructor Details
#initialize(options) ⇒ PaymentStep
Returns a new instance of PaymentStep.
6 7 8 9 10 |
# File 'app/commands/corzinus/checkout/payment_step.rb', line 6 def initialize() @order = [:order] payment_attrs = [:params][:order][:credit_card_attributes] @payment_form = CreditCardForm.from_params(payment_attrs) end |
Instance Attribute Details
#order ⇒ Object (readonly)
Returns the value of attribute order.
4 5 6 |
# File 'app/commands/corzinus/checkout/payment_step.rb', line 4 def order @order end |
#payment_form ⇒ Object (readonly)
Returns the value of attribute payment_form.
4 5 6 |
# File 'app/commands/corzinus/checkout/payment_step.rb', line 4 def payment_form @payment_form end |
Instance Method Details
#call ⇒ Object
12 13 14 15 16 17 18 |
# File 'app/commands/corzinus/checkout/payment_step.rb', line 12 def call if payment_form.valid? && update_order broadcast(:valid) else broadcast :invalid, payment_form: payment_form end end |