8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
|
# File 'app/controllers/pay/webhooks/paddle_controller.rb', line 8
def create
verifier = Pay::Paddle::Webhooks::SignatureVerifier.new(check_params.as_json)
if verifier.verify
case params["alert_name"]
when "subscription_created"
Pay::Paddle::Webhooks::SubscriptionCreated.new(check_params.as_json)
when "subscription_updated"
Pay::Paddle::Webhooks::SubscriptionUpdated.new(check_params.as_json)
when "subscription_cancelled"
Pay::Paddle::Webhooks::SubscriptionCancelled.new(check_params.as_json)
when "subscription_payment_succeeded"
Pay::Paddle::Webhooks::SubscriptionPaymentSucceeded.new(check_params.as_json)
when "subscription_payment_refunded"
Pay::Paddle::Webhooks::SubscriptionPaymentRefunded.new(check_params.as_json)
end
render json: {success: true}, status: :ok
else
head :ok
end
end
|