hummingbird-me/kitsu-server

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

Summary

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

    SECRET = AppleReceiptService::SECRET

    def notify
      AppleReceiptService.new(params[:latest_receipt]).call
      head 204
    end

    private

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