pay 11.4.1 → 11.4.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/app/controllers/pay/webhooks/braintree_controller.rb +1 -5
- data/app/controllers/pay/webhooks/lemon_squeezy_controller.rb +1 -5
- data/app/controllers/pay/webhooks/paddle_billing_controller.rb +1 -5
- data/app/controllers/pay/webhooks/paddle_classic_controller.rb +1 -5
- data/app/controllers/pay/webhooks/stripe_controller.rb +2 -4
- data/app/models/pay/lemon_squeezy/charge.rb +2 -2
- data/lib/pay/attributes.rb +14 -3
- data/lib/pay/paddle_classic/webhooks/signature_verifier.rb +1 -1
- data/lib/pay/version.rb +1 -1
- data/lib/pay.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 1b4b5809b0613aa09826db8973eeed7b681c9e58e71dbaf3b576699f8e21d36f
|
|
4
|
+
data.tar.gz: 23f05a69070c17cf208119c71ac4871c86b9b62063f9b9c8f961273548c944b6
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 2bdc2748e5ef2a825a64e07d2dcf5fbd975d87ea3d7a7874cdaddcef2e4b592a6d57d630ddc30c81fe2debb432dbf04ba86ec462ee6c587a59815fc88b30ee70
|
|
7
|
+
data.tar.gz: d24b2d6b4b17b18b83fd764e2a7ca584266839570a5c861f745a22aa251a2eb4d8ceee0536dd5494f91abd560608a4df39bd8441c3c0e50d2a0bcfcee5949f6e
|
|
@@ -1,10 +1,6 @@
|
|
|
1
1
|
module Pay
|
|
2
2
|
module Webhooks
|
|
3
|
-
class BraintreeController <
|
|
4
|
-
if Rails.application.config.action_controller.default_protect_from_forgery
|
|
5
|
-
skip_before_action :verify_authenticity_token
|
|
6
|
-
end
|
|
7
|
-
|
|
3
|
+
class BraintreeController < ActionController::API
|
|
8
4
|
def create
|
|
9
5
|
queue_event(verified_event)
|
|
10
6
|
head :ok
|
|
@@ -1,10 +1,6 @@
|
|
|
1
1
|
module Pay
|
|
2
2
|
module Webhooks
|
|
3
|
-
class LemonSqueezyController <
|
|
4
|
-
if Rails.application.config.action_controller.default_protect_from_forgery
|
|
5
|
-
skip_before_action :verify_authenticity_token
|
|
6
|
-
end
|
|
7
|
-
|
|
3
|
+
class LemonSqueezyController < ActionController::API
|
|
8
4
|
def create
|
|
9
5
|
if valid_signature?(request.headers["X-Signature"])
|
|
10
6
|
queue_event(verify_params.as_json)
|
|
@@ -1,10 +1,6 @@
|
|
|
1
1
|
module Pay
|
|
2
2
|
module Webhooks
|
|
3
|
-
class PaddleBillingController <
|
|
4
|
-
if Rails.application.config.action_controller.default_protect_from_forgery
|
|
5
|
-
skip_before_action :verify_authenticity_token
|
|
6
|
-
end
|
|
7
|
-
|
|
3
|
+
class PaddleBillingController < ActionController::API
|
|
8
4
|
def create
|
|
9
5
|
if valid_signature?(request.headers["Paddle-Signature"])
|
|
10
6
|
queue_event(verify_params.as_json)
|
|
@@ -1,10 +1,6 @@
|
|
|
1
1
|
module Pay
|
|
2
2
|
module Webhooks
|
|
3
|
-
class PaddleClassicController <
|
|
4
|
-
if Rails.application.config.action_controller.default_protect_from_forgery
|
|
5
|
-
skip_before_action :verify_authenticity_token
|
|
6
|
-
end
|
|
7
|
-
|
|
3
|
+
class PaddleClassicController < ActionController::API
|
|
8
4
|
def create
|
|
9
5
|
queue_event(verified_event)
|
|
10
6
|
head :ok
|
|
@@ -1,9 +1,7 @@
|
|
|
1
1
|
module Pay
|
|
2
2
|
module Webhooks
|
|
3
|
-
class StripeController <
|
|
4
|
-
if Rails.application.config.action_controller.default_protect_from_forgery
|
|
5
|
-
skip_before_action :verify_authenticity_token
|
|
6
|
-
end
|
|
3
|
+
class StripeController < ActionController::API
|
|
4
|
+
skip_forgery_protection if Rails.application.config.action_controller.default_protect_from_forgery
|
|
7
5
|
|
|
8
6
|
def create
|
|
9
7
|
event = verified_event
|
|
@@ -6,7 +6,7 @@ module Pay
|
|
|
6
6
|
def self.sync_order(order_id, object: nil, try: 0, retries: 1)
|
|
7
7
|
object ||= ::LemonSqueezy::Order.retrieve(id: order_id)
|
|
8
8
|
|
|
9
|
-
pay_customer = Pay::Customer.find_by(
|
|
9
|
+
pay_customer = Pay::LemonSqueezy::Customer.find_by(processor_id: object.customer_id)
|
|
10
10
|
return unless pay_customer
|
|
11
11
|
|
|
12
12
|
processor_id = "order:#{object.id}"
|
|
@@ -34,7 +34,7 @@ module Pay
|
|
|
34
34
|
# Skip loading the latest subscription invoice details from the API if we already have it
|
|
35
35
|
object ||= ::LemonSqueezy::SubscriptionInvoice.retrieve(id: subscription_invoice_id)
|
|
36
36
|
|
|
37
|
-
pay_customer = Pay::Customer.find_by(
|
|
37
|
+
pay_customer = Pay::LemonSqueezy::Customer.find_by(processor_id: object.customer_id)
|
|
38
38
|
return unless pay_customer
|
|
39
39
|
|
|
40
40
|
processor_id = "subscription_invoice:#{object.id}"
|
data/lib/pay/attributes.rb
CHANGED
|
@@ -37,7 +37,11 @@ module Pay
|
|
|
37
37
|
|
|
38
38
|
with_lock do
|
|
39
39
|
pay_customers.update_all(default: false)
|
|
40
|
-
pay_customer = pay_customers.active.where(
|
|
40
|
+
pay_customer = pay_customers.active.where(
|
|
41
|
+
Pay::Customer.inheritance_column => klass.name,
|
|
42
|
+
:processor => processor_name,
|
|
43
|
+
:stripe_account => stripe_account
|
|
44
|
+
).first_or_initialize
|
|
41
45
|
pay_customer.update!(attributes.merge(default: true))
|
|
42
46
|
end
|
|
43
47
|
|
|
@@ -52,7 +56,11 @@ module Pay
|
|
|
52
56
|
klass = "Pay::#{processor_name.to_s.classify}::Customer".constantize
|
|
53
57
|
raise ArgumentError, "not a valid payment processor" if klass.ancestors.exclude?(Pay::Customer)
|
|
54
58
|
|
|
55
|
-
pay_customer = pay_customers.active.where(
|
|
59
|
+
pay_customer = pay_customers.active.where(
|
|
60
|
+
Pay::Customer.inheritance_column => klass.name,
|
|
61
|
+
:processor => processor_name,
|
|
62
|
+
:stripe_account => stripe_account
|
|
63
|
+
).first_or_initialize
|
|
56
64
|
pay_customer.update!(attributes)
|
|
57
65
|
pay_customer
|
|
58
66
|
end
|
|
@@ -83,7 +91,10 @@ module Pay
|
|
|
83
91
|
def set_merchant_processor(processor_name, **attributes)
|
|
84
92
|
with_lock do
|
|
85
93
|
pay_merchants.update_all(default: false)
|
|
86
|
-
pay_merchant = pay_merchants.where(
|
|
94
|
+
pay_merchant = pay_merchants.where(
|
|
95
|
+
Pay::Merchant.inheritance_column => "Pay::#{processor_name.to_s.classify}::Merchant",
|
|
96
|
+
:processor => processor_name
|
|
97
|
+
).first_or_initialize
|
|
87
98
|
pay_merchant.update!(attributes.merge(default: true))
|
|
88
99
|
end
|
|
89
100
|
|
data/lib/pay/version.rb
CHANGED
data/lib/pay.rb
CHANGED
|
@@ -38,7 +38,7 @@ module Pay
|
|
|
38
38
|
mattr_accessor :business_address
|
|
39
39
|
mattr_accessor :business_name
|
|
40
40
|
mattr_accessor :business_logo
|
|
41
|
-
|
|
41
|
+
mattr_reader :support_email
|
|
42
42
|
|
|
43
43
|
def self.support_email=(value)
|
|
44
44
|
@@support_email = value.is_a?(::Mail::Address) ? value : ::Mail::Address.new(value)
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: pay
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 11.4.
|
|
4
|
+
version: 11.4.2
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Jason Charnes
|
|
@@ -187,7 +187,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
187
187
|
- !ruby/object:Gem::Version
|
|
188
188
|
version: '0'
|
|
189
189
|
requirements: []
|
|
190
|
-
rubygems_version: 4.0.
|
|
190
|
+
rubygems_version: 4.0.3
|
|
191
191
|
specification_version: 4
|
|
192
192
|
summary: Payments engine for Ruby on Rails
|
|
193
193
|
test_files: []
|