lib/generators/rubykassa/templates/rubykassa.rb in rubykassa-0.3.1 vs lib/generators/rubykassa/templates/rubykassa.rb in rubykassa-0.3.2
- old
+ new
@@ -1,14 +1,21 @@
# -*- encoding : utf-8 -*-
-Rubykassa.configure do |c|
- c.login = ENV["ROBOKASSA_LOGIN"]
- c.first_password = ENV["ROBOKASSA_FIRST_PASSWORD"]
- c.second_password = ENV["ROBOKASSA_SECOND_PASSWORD"]
- c.mode = :test # or :production
- c.http_method = :get # or :post
- c.xml_http_method = :get # or :post
+Rubykassa.configure do |config|
+ config.login = ENV["ROBOKASSA_LOGIN"]
+ config.first_password = ENV["ROBOKASSA_FIRST_PASSWORD"]
+ config.second_password = ENV["ROBOKASSA_SECOND_PASSWORD"]
+ config.mode = :test # or :production
+ config.http_method = :get # or :post
+ config.xml_http_method = :get # or :post
+
+ # Result callback is called in RobokassaController#paid action if valid signature
+ # was generated. It should always return "OK#{ invoice_id }" string, so implement
+ # your custom logic above `controller.render text: notification.success` line
+
+ config.result_callback = -> (controller, notification) { controller.render text: notification.success }
+
# Define success or failure callbacks here like:
- # config.success_callback = -> (controller, notification){ render text: 'success' }
- # config.fail_callback = -> (controller, notification){ redirect_to root_path }
+ # config.success_callback = -> (controller, notification) { controller.render text: 'success' }
+ # config.fail_callback = -> (controller, notification) { controller.redirect_to controller.root_path }
end