Sha256: 2af4eea720b2ad120b00e955eeaac88839b07a041dd83aa910aab6d9ae2ef0b8

Contents?: true

Size: 610 Bytes

Versions: 2

Compression:

Stored size: 610 Bytes

Contents

module DiscoApp
  module CarrierRequestController
    extend ActiveSupport::Concern

    included do
      before_action :verify_carrier_request
    end

    private

      def verify_carrier_request
        unless carrier_request_signature_is_valid?
          head :unauthorized
        end
      end

      def carrier_request_signature_is_valid?
        return true if DiscoApp.configuration.skip_carrier_request_verification?
        DiscoApp::CarrierRequestService.is_valid_hmac?(request.body.read.to_s, ShopifyApp.configuration.secret, request.headers['HTTP_X_SHOPIFY_HMAC_SHA256'])
      end

  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
disco_app-0.8.4 app/controllers/disco_app/carrier_request_controller.rb
disco_app-0.8.5 app/controllers/disco_app/carrier_request_controller.rb