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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 0f230e4d0683a015b03fdce5ff72660db014b3424db327eafd629004a89ee824
4
- data.tar.gz: c90800d64f0fc4218b3876a0f84b7a9d8f3e376324d1502c5e6f7c1ca198ef53
3
+ metadata.gz: 1b4b5809b0613aa09826db8973eeed7b681c9e58e71dbaf3b576699f8e21d36f
4
+ data.tar.gz: 23f05a69070c17cf208119c71ac4871c86b9b62063f9b9c8f961273548c944b6
5
5
  SHA512:
6
- metadata.gz: 41cdadcd47f8321bb8f0b3c94881ae174b96a4d65f133a19bdf3ba14591747b188df66ca8861cbb51ebb085ecbaee29033074aaf505525a54bbd12ca68efa64e
7
- data.tar.gz: 4bff11573094e29ef0d870edafba4cf9e8260eebbef45f8985b0b007bcd83daf71dfa066b30a37c68269d9476ba90722d846f33cb4c3f015dcd82fbff4b844df
6
+ metadata.gz: 2bdc2748e5ef2a825a64e07d2dcf5fbd975d87ea3d7a7874cdaddcef2e4b592a6d57d630ddc30c81fe2debb432dbf04ba86ec462ee6c587a59815fc88b30ee70
7
+ data.tar.gz: d24b2d6b4b17b18b83fd764e2a7ca584266839570a5c861f745a22aa251a2eb4d8ceee0536dd5494f91abd560608a4df39bd8441c3c0e50d2a0bcfcee5949f6e
@@ -1,10 +1,6 @@
1
1
  module Pay
2
2
  module Webhooks
3
- class BraintreeController < Pay::ApplicationController
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 < Pay::ApplicationController
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 < Pay::ApplicationController
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 < Pay::ApplicationController
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 < Pay::ApplicationController
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(type: "Pay::LemonSqueezy::Customer", processor_id: object.customer_id)
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(type: "Pay::LemonSqueezy::Customer", processor_id: object.customer_id)
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}"
@@ -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(processor: processor_name, type: klass.name, stripe_account: stripe_account).first_or_initialize
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(processor: processor_name, type: klass.name, stripe_account: stripe_account).first_or_initialize
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(processor: processor_name, type: "Pay::#{processor_name.to_s.classify}::Merchant").first_or_initialize
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
 
@@ -39,7 +39,7 @@ module Pay
39
39
 
40
40
  # verify the data
41
41
  digest = OpenSSL::Digest.new("SHA1")
42
- pub_key = OpenSSL::PKey::RSA.new(public_key)
42
+ pub_key = OpenSSL::PKey::RSA.new(public_key).public_key
43
43
  pub_key.verify(digest, signature, data_serialized)
44
44
  end
45
45
 
data/lib/pay/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Pay
2
- VERSION = "11.4.1"
2
+ VERSION = "11.4.2"
3
3
  end
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
- mattr_accessor :support_email
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.1
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.1
190
+ rubygems_version: 4.0.3
191
191
  specification_version: 4
192
192
  summary: Payments engine for Ruby on Rails
193
193
  test_files: []