lib/paybox_system/rails/integrity.rb
def check_paybox_integrity!
        unless params[:error].present? && params[:sign].present?
          raise Error, 'Bad response'
        end

        request_fullpath = request.fullpath
        request_params = request_fullpath[request_fullpath.index('?') + 1..request_fullpath.index('&sign') - 1]
        request_sign = request_fullpath[request_fullpath.index('&sign') + 6..-1]
        unless PayboxSystem.valid_response?(request_params, request_sign)
          raise Error, 'Bad Paybox integrity test'
        end
      end
# Raise an exception if request is not valid
Raise an exception if request is not valid
Raise an exception if request is not valid
def check_paybox_integrity!
        unless params[:error].present? && params[:sign].present?
          raise Error, 'Bad response'
        end
        request_fullpath = request.fullpath
        request_params = request_fullpath[request_fullpath.index('?') + 1..request_fullpath.index('&sign') - 1]
        request_sign = request_fullpath[request_fullpath.index('&sign') + 6..-1]
        unless PayboxSystem.valid_response?(request_params, request_sign)
          raise Error, 'Bad Paybox integrity test'
        end
      end
def check_paybox_integrity! unless params [ :error ] . present? && params [ :sign ] . present? raise Error , 'Bad response' end request_fullpath = request . fullpath request_params = request_fullpath [ request_fullpath . index ( '?' ) + 1 .. request_fullpath . index ( '&sign' ) - 1 ] request_sign = request_fullpath [ request_fullpath . index ( '&sign' ) + 6 .. - 1 ] unless PayboxSystem . valid_response? ( request_params , request_sign ) raise Error , 'Bad Paybox integrity test' end end
Raise an exception if request is not valid
Raise an exception if request is not valid