Module: Pay::Paddle
- Extended by:
- Env
- Defined in:
- lib/pay/paddle.rb,
lib/pay/paddle/error.rb,
lib/pay/paddle/charge.rb,
lib/pay/paddle/billable.rb,
lib/pay/paddle/subscription.rb,
lib/pay/paddle/payment_method.rb,
lib/pay/paddle/webhooks/signature_verifier.rb,
lib/pay/paddle/webhooks/subscription_created.rb,
lib/pay/paddle/webhooks/subscription_updated.rb,
lib/pay/paddle/webhooks/subscription_cancelled.rb,
lib/pay/paddle/webhooks/subscription_payment_refunded.rb,
lib/pay/paddle/webhooks/subscription_payment_succeeded.rb
Defined Under Namespace
Modules: Webhooks
Classes: Billable, Charge, Error, PaymentMethod, Subscription
Class Method Summary
collapse
Class Method Details
58
59
60
61
62
63
64
65
66
|
# File 'lib/pay/paddle.rb', line 58
def self.configure_webhooks
Pay::Webhooks.configure do |events|
events.subscribe "paddle.subscription_created", Pay::Paddle::Webhooks::SubscriptionCreated.new
events.subscribe "paddle.subscription_updated", Pay::Paddle::Webhooks::SubscriptionUpdated.new
events.subscribe "paddle.subscription_cancelled", Pay::Paddle::Webhooks::SubscriptionCancelled.new
events.subscribe "paddle.subscription_payment_succeeded", Pay::Paddle::Webhooks::SubscriptionPaymentSucceeded.new
events.subscribe "paddle.subscription_payment_refunded", Pay::Paddle::Webhooks::SubscriptionPaymentRefunded.new
end
end
|
.environment ⇒ Object
36
37
38
|
# File 'lib/pay/paddle.rb', line 36
def self.environment
find_value_by_name(:paddle, :environment) || "production"
end
|
.owner_from_passthrough(passthrough) ⇒ Object
52
53
54
55
56
|
# File 'lib/pay/paddle.rb', line 52
def self.owner_from_passthrough(passthrough)
GlobalID::Locator.locate_signed parse_passthrough(passthrough)["owner_sgid"]
rescue JSON::ParserError
nil
end
|
.parse_passthrough(passthrough) ⇒ Object
48
49
50
|
# File 'lib/pay/paddle.rb', line 48
def self.parse_passthrough(passthrough)
JSON.parse(passthrough)
end
|
.passthrough(owner:, **options) ⇒ Object
44
45
46
|
# File 'lib/pay/paddle.rb', line 44
def self.passthrough(owner:, **options)
options.merge(owner_sgid: owner.to_sgid.to_s).to_json
end
|
.public_key_base64 ⇒ Object
40
41
42
|
# File 'lib/pay/paddle.rb', line 40
def self.public_key_base64
find_value_by_name(:paddle, :public_key_base64)
end
|
.setup ⇒ Object
20
21
22
23
24
25
26
|
# File 'lib/pay/paddle.rb', line 20
def self.setup
::PaddlePay.config.vendor_id = vendor_id
::PaddlePay.config.vendor_auth_code = vendor_auth_code
::PaddlePay.config.environment = environment
configure_webhooks
end
|
.vendor_auth_code ⇒ Object
32
33
34
|
# File 'lib/pay/paddle.rb', line 32
def self.vendor_auth_code
find_value_by_name(:paddle, :vendor_auth_code)
end
|
.vendor_id ⇒ Object
28
29
30
|
# File 'lib/pay/paddle.rb', line 28
def self.vendor_id
find_value_by_name(:paddle, :vendor_id)
end
|