Class: Spree::PayseraController
- Inherits:
-
StoreController
- Object
- StoreController
- Spree::PayseraController
- Includes:
- Spree::Paysera::ErrorHandler
- Defined in:
- app/controllers/spree/paysera_controller.rb
Instance Method Summary collapse
Instance Method Details
#callback ⇒ Object
16 17 18 19 20 21 22 23 24 25 26 27 28 29 |
# File 'app/controllers/spree/paysera_controller.rb', line 16 def callback Spree::LogEntry.create( source: payment_method, details: params.to_yaml ) response = Spree::Paysera::ParseResponse.for(payment_method, params) raise Spree::Paysera::Error, 'wrong project id' if response[:projectid] != payment_method.preferred_project_id.to_s order = Spree::Order.find_by!(number: response[:orderid]) Spree::Paysera::CompleteOrder.for(order, payment_method, response) render plain: 'OK' end |
#cancel ⇒ Object
46 47 48 49 |
# File 'app/controllers/spree/paysera_controller.rb', line 46 def cancel flash.notice = Spree.t(:order_canceled) redirect_to products_path end |
#confirm ⇒ Object
31 32 33 34 35 36 37 38 39 40 41 42 43 44 |
# File 'app/controllers/spree/paysera_controller.rb', line 31 def confirm response = Spree::Paysera::ParseResponse.for(payment_method, params) order = Spree::Order.find_by(number: response[:orderid]) if order.paid? flash.notice = Spree.t(:order_processed_successfully) else flash.alert = Spree.t(:payment_processing_failed) end rescue StandardError flash.alert = Spree.t(:payment_processing_failed) ensure redirect_to account_path end |