hummingbird-me/kitsu-server

View on GitHub
app/controllers/webhooks/google_play_billing_controller.rb

Summary

Maintainability
A
0 mins
Test Coverage
D
63%
module Webhooks
  class GooglePlayBillingController < ApplicationController
    include CustomControllerHelpers

    SECRET = ENV['GOOGLE_PLAY_BILLING_WEBHOOK_SECRET']

    def notify
      GooglePlayNotificationService.new(params).call
      head 204
    end

    private

    def check_secret
      unless ActiveSupport::SecurityUtils.secure_compare(SECRET, params[:secret])
        render_jsonapi_error 400, 'Invalid Secret'
      end
    end
  end
end