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
.enabled? ⇒ Boolean
20
21
22
23
24
|
# File 'lib/pay/paddle.rb', line 20
def self.enabled?
return false unless Pay.enabled_processors.include?(:paddle) && defined?(::PaddlePay)
Pay::Engine.version_matches?(required: "~> 0.2", current: ::PaddlePay::VERSION) || (raise "[Pay] paddle gem must be version ~> 0.2")
end
|
.environment ⇒ Object
40
41
42
|
# File 'lib/pay/paddle.rb', line 40
def self.environment
find_value_by_name(:paddle, :environment) || "production"
end
|
.owner_from_passthrough(passthrough) ⇒ Object
64
65
66
67
68
|
# File 'lib/pay/paddle.rb', line 64
def self.owner_from_passthrough(passthrough)
GlobalID::Locator.locate_signed parse_passthrough(passthrough)["owner_sgid"]
rescue JSON::ParserError
nil
end
|
.parse_passthrough(passthrough) ⇒ Object
60
61
62
|
# File 'lib/pay/paddle.rb', line 60
def self.parse_passthrough(passthrough)
JSON.parse(passthrough)
end
|
.passthrough(owner:, **options) ⇒ Object
56
57
58
|
# File 'lib/pay/paddle.rb', line 56
def self.passthrough(owner:, **options)
options.merge(owner_sgid: owner.to_sgid.to_s).to_json
end
|
.public_key ⇒ Object
44
45
46
|
# File 'lib/pay/paddle.rb', line 44
def self.public_key
find_value_by_name(:paddle, :public_key)
end
|
.public_key_base64 ⇒ Object
52
53
54
|
# File 'lib/pay/paddle.rb', line 52
def self.public_key_base64
find_value_by_name(:paddle, :public_key_base64)
end
|
.public_key_file ⇒ Object
48
49
50
|
# File 'lib/pay/paddle.rb', line 48
def self.public_key_file
find_value_by_name(:paddle, :public_key_file)
end
|
.setup ⇒ Object
26
27
28
29
30
|
# File 'lib/pay/paddle.rb', line 26
def self.setup
::PaddlePay.config.vendor_id = vendor_id
::PaddlePay.config.vendor_auth_code = vendor_auth_code
::PaddlePay.config.environment = environment
end
|
.vendor_auth_code ⇒ Object
36
37
38
|
# File 'lib/pay/paddle.rb', line 36
def self.vendor_auth_code
find_value_by_name(:paddle, :vendor_auth_code)
end
|
.vendor_id ⇒ Object
32
33
34
|
# File 'lib/pay/paddle.rb', line 32
def self.vendor_id
find_value_by_name(:paddle, :vendor_id)
end
|