Sha256: 9affebe7a69a955b882449fe4f56045654d9670b9738a905d1d79426a25069f1
Contents?: true
Size: 1.19 KB
Versions: 2
Compression:
Stored size: 1.19 KB
Contents
module Unitpay module Controller # Skip RequestForgeryProtection # skip_before_filter :verify_authenticity_token class ServiceNotImplemented < StandardError; end class PayMethodNotImplemented < StandardError; end class ErrorMethodNotImplemented < StandardError; end class RuntimeException < StandardError; end def notify if service.valid_action_signature?(params[:method], params[:params]) send(params[:method]) success_request else fail_request end rescue RuntimeException => e fail_request(e.message) end def success warn 'NotImplementedError' end def fail warn 'NotImplementedError' end private def service raise ServiceNotImplemented end def check warn 'NotImplementedError' end def pay raise PayMethodNotImplemented end def error raise ErrorMethodNotImplemented end def success_request render json: { result: { message: 'Запрос успешно обработан' } } end def fail_request(message = 'Неверная сигнатура') render json: { error: { message: message } } end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
unitpay-1.0.1 | lib/unitpay/controller.rb |
unitpay-1.0.0 | lib/unitpay/controller.rb |