Advertisement
Guest User

Braintree Rails Webhooks Controller

a guest
Sep 4th, 2015
169
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Ruby 0.59 KB | None | 0 0
  1. class WebhooksController < ApplicationController
  2.  
  3.   skip_before_action :verify_authenticity_token
  4.  
  5.   def create
  6.   end
  7.  
  8.   def handle
  9.     signature, payload = Braintree::WebhookTesting.sample_notification(
  10.       Braintree::WebhookNotification::Kind::SubMerchantAccountApproved,
  11.       rand(10000)
  12.     )
  13.  
  14.     @message = Braintree::WebhookNotification.parse(signature, payload)
  15.  
  16.     respond_to do |f|
  17.       f.js { render template: 'notifications/create', layout: false }
  18.     end
  19.   end
  20.  
  21.   def verify
  22.     # render text: Braintree::WebhookNotification.verify(params[:bt_challenge])
  23.   end
  24. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement