Module: Spree::Billing::PaymentFireable
- Included in:
- PaymentsController
- Defined in:
- app/controllers/concerns/spree/billing/payment_fireable.rb
Instance Method Summary collapse
Instance Method Details
#fire ⇒ Object
6 7 8 9 10 11 12 |
# File 'app/controllers/concerns/spree/billing/payment_fireable.rb', line 6 def fire fire_action rescue Spree::Core::GatewayError => e flash[:error] = e..to_s ensure redirect_to spree.billing_order_payments_path(@order) end |
#fire_action ⇒ Object
14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 |
# File 'app/controllers/concerns/spree/billing/payment_fireable.rb', line 14 def fire_action return unless @payment.payment_source event = params[:e] event = 'void_transaction' if event == 'void' event = supported_events.find { |e| e == event } # safe send() raise Spree::Core::GatewayError, Spree.t(:upsupported_payment) if event.blank? if @payment.send("#{event}!") flash[:success] = Spree.t(:payment_updated) else flash[:error] = Spree.t(:cannot_perform_operation) end end |
#supported_events ⇒ Object
30 31 32 |
# File 'app/controllers/concerns/spree/billing/payment_fireable.rb', line 30 def supported_events %w[void_transaction cancel credit capture] end |