Class: Spree::Paysera::CompleteOrder
- Inherits:
-
Object
- Object
- Spree::Paysera::CompleteOrder
- Defined in:
- app/domain/spree/paysera/complete_order.rb
Instance Attribute Summary collapse
-
#order ⇒ Object
readonly
Returns the value of attribute order.
-
#order_total ⇒ Object
readonly
Returns the value of attribute order_total.
-
#payamount ⇒ Object
readonly
Returns the value of attribute payamount.
-
#payment_method ⇒ Object
readonly
Returns the value of attribute payment_method.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(order, payment_method, params) ⇒ CompleteOrder
constructor
A new instance of CompleteOrder.
- #run ⇒ Object
Constructor Details
#initialize(order, payment_method, params) ⇒ CompleteOrder
Returns a new instance of CompleteOrder.
10 11 12 13 14 15 |
# File 'app/domain/spree/paysera/complete_order.rb', line 10 def initialize(order, payment_method, params) @order = order @payment_method = payment_method @order_total = order.total.to_money @payamount = params[:payamount].to_money / 100 end |
Instance Attribute Details
#order ⇒ Object (readonly)
Returns the value of attribute order.
4 5 6 |
# File 'app/domain/spree/paysera/complete_order.rb', line 4 def order @order end |
#order_total ⇒ Object (readonly)
Returns the value of attribute order_total.
4 5 6 |
# File 'app/domain/spree/paysera/complete_order.rb', line 4 def order_total @order_total end |
#payamount ⇒ Object (readonly)
Returns the value of attribute payamount.
4 5 6 |
# File 'app/domain/spree/paysera/complete_order.rb', line 4 def payamount @payamount end |
#payment_method ⇒ Object (readonly)
Returns the value of attribute payment_method.
4 5 6 |
# File 'app/domain/spree/paysera/complete_order.rb', line 4 def payment_method @payment_method end |
Class Method Details
.for(order, payment_method, params) ⇒ Object
6 7 8 |
# File 'app/domain/spree/paysera/complete_order.rb', line 6 def self.for(order, payment_method, params) new(order, payment_method, params).run end |
Instance Method Details
#run ⇒ Object
17 18 19 20 21 22 |
# File 'app/domain/spree/paysera/complete_order.rb', line 17 def run return if order.paid? check_payammount! complete_order end |