Class: Pay::Webhooks::BraintreeController

Inherits:
ApplicationController show all
Defined in:
app/controllers/pay/webhooks/braintree_controller.rb

Instance Method Summary collapse

Instance Method Details

#createObject



8
9
10
11
12
13
14
15
16
17
18
19
20
21
# File 'app/controllers/pay/webhooks/braintree_controller.rb', line 8

def create
  case webhook_notification.kind
  when "subscription_charged_successfully"
    subscription_charged_successfully(webhook_notification)
  when "subscription_canceled"
    subscription_canceled(webhook_notification)
  when "subscription_trial_ended"
    subscription_trial_ended(webhook_notification)
  end

  render json: {success: true}, status: :ok
rescue ::Braintree::InvalidSignature
  head :ok
end