Module: Pay::PaddleClassic
- Extended by:
- Env
- Defined in:
- lib/pay/paddle_classic.rb,
lib/pay/paddle_classic/error.rb,
lib/pay/paddle_classic/charge.rb,
lib/pay/paddle_classic/billable.rb,
lib/pay/paddle_classic/subscription.rb,
lib/pay/paddle_classic/payment_method.rb,
lib/pay/paddle_classic/webhooks/signature_verifier.rb,
lib/pay/paddle_classic/webhooks/subscription_created.rb,
lib/pay/paddle_classic/webhooks/subscription_updated.rb,
lib/pay/paddle_classic/webhooks/subscription_cancelled.rb,
lib/pay/paddle_classic/webhooks/subscription_payment_refunded.rb,
lib/pay/paddle_classic/webhooks/subscription_payment_succeeded.rb
Defined Under Namespace
Modules: Webhooks
Classes: Billable, Charge, Error, PaymentMethod, Subscription
Class Method Summary
collapse
Class Method Details
.client ⇒ Object
26
27
28
29
30
31
32
|
# File 'lib/pay/paddle_classic.rb', line 26
def self.client
@client ||= Paddle::Classic::Client.new(
vendor_id: vendor_id,
vendor_auth_code: vendor_auth_code,
sandbox: environment != "production"
)
end
|
.enabled? ⇒ Boolean
20
21
22
23
24
|
# File 'lib/pay/paddle_classic.rb', line 20
def self.enabled?
return false unless Pay.enabled_processors.include?(:paddle_classic) && defined?(::Paddle)
Pay::Engine.version_matches?(required: "~> 2.1", current: ::Paddle::VERSION) || (raise "[Pay] paddle gem must be version ~> 2.1")
end
|
.environment ⇒ Object
42
43
44
|
# File 'lib/pay/paddle_classic.rb', line 42
def self.environment
find_value_by_name(:paddle_classic, :environment) || "production"
end
|
.owner_from_passthrough(passthrough) ⇒ Object
66
67
68
69
70
|
# File 'lib/pay/paddle_classic.rb', line 66
def self.owner_from_passthrough(passthrough)
GlobalID::Locator.locate_signed parse_passthrough(passthrough)["owner_sgid"]
rescue JSON::ParserError
nil
end
|
.parse_passthrough(passthrough) ⇒ Object
62
63
64
|
# File 'lib/pay/paddle_classic.rb', line 62
def self.parse_passthrough(passthrough)
JSON.parse(passthrough)
end
|
.passthrough(owner:, **options) ⇒ Object
58
59
60
|
# File 'lib/pay/paddle_classic.rb', line 58
def self.passthrough(owner:, **options)
options.merge(owner_sgid: owner.to_sgid.to_s).to_json
end
|
.public_key ⇒ Object
46
47
48
|
# File 'lib/pay/paddle_classic.rb', line 46
def self.public_key
find_value_by_name(:paddle_classic, :public_key)
end
|
.public_key_base64 ⇒ Object
54
55
56
|
# File 'lib/pay/paddle_classic.rb', line 54
def self.public_key_base64
find_value_by_name(:paddle_classic, :public_key_base64)
end
|
.public_key_file ⇒ Object
50
51
52
|
# File 'lib/pay/paddle_classic.rb', line 50
def self.public_key_file
find_value_by_name(:paddle_classic, :public_key_file)
end
|
.vendor_auth_code ⇒ Object
38
39
40
|
# File 'lib/pay/paddle_classic.rb', line 38
def self.vendor_auth_code
find_value_by_name(:paddle_classic, :vendor_auth_code)
end
|
.vendor_id ⇒ Object
34
35
36
|
# File 'lib/pay/paddle_classic.rb', line 34
def self.vendor_id
find_value_by_name(:paddle_classic, :vendor_id)
end
|