pay 7.2.1 → 7.3.0

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: 690bb7ad1078274199d3a9c3c32b5ace7fb405bf0c37f0bcabeffeb8af734902
4
- data.tar.gz: 1e0df19aea4d907f3878450fcbb320421a3abb7da1fe0187ba7bde1878267d60
3
+ metadata.gz: 3ec013c6c05d0e8027b628258882c9bac3a01f7942e9654cc52582643cf57629
4
+ data.tar.gz: 75bcbbfcd8b63bb0f73e97b4a4da41335923f5f3af2e8577fc1f2aa94baa8542
5
5
  SHA512:
6
- metadata.gz: a0767157a5d6ecc7a710e71047080b4e5d6edbdf4a27fb7f2fcfbf585558b68b43af5f483d87815668dcc4d85128f3fe6c098a5fc2899195529142a1ba3682fa
7
- data.tar.gz: 400de12e3525fc3395ba4bf4dd8b2df158de62cb18db60a298d51acec1fe1a16fa0c32f0f3750f9f8a01f0337de9f71d61b33628e0c39848508dc818c85f5356
6
+ metadata.gz: dd2822689a009a126f016365182312e4555098ba40b429e16c1dc41b76902a4fd18da06e3465b25cf17e0bf53371adf147bfd3c72e2c9186ce965de304f403e4
7
+ data.tar.gz: 1ad32b2e21be33e58ffb855dec4275cdff66d036a1728f2573d54d61a2937c6aa6c4602cb59f1dc53bea2edcd4fac46f89efcb91a5ea22443669087569959e5b
@@ -6,7 +6,8 @@ module Pay
6
6
  end
7
7
 
8
8
  def create
9
- queue_event(verified_event)
9
+ event = verified_event
10
+ queue_event(event) if event.livemode || Pay::Stripe.webhook_receive_test_events
10
11
  head :ok
11
12
  rescue ::Stripe::SignatureVerificationError => e
12
13
  log_error(e)
@@ -79,7 +79,11 @@ module Pay
79
79
  }
80
80
  )
81
81
 
82
- pay_customer.reload_default_payment_method if default
82
+ if default
83
+ pay_customer.payment_methods.where.not(id: pay_payment_method.id).update_all(default: false)
84
+ pay_customer.reload_default_payment_method
85
+ end
86
+
83
87
  pay_payment_method
84
88
  end
85
89
 
@@ -10,7 +10,7 @@ module Pay
10
10
 
11
11
  if (payment_intent_id = event.data.object.payment_intent)
12
12
  payment_intent = ::Stripe::PaymentIntent.retrieve({id: payment_intent_id}, {stripe_account: event.try(:account)}.compact)
13
- Pay::Stripe::Charge.sync(payment_intent.latest_charge, stripe_account: event.try(:account))
13
+ Pay::Stripe::Charge.sync(payment_intent.latest_charge, stripe_account: event.try(:account)) if payment_intent.latest_charge
14
14
  end
15
15
 
16
16
  if (subscription_id = event.data.object.subscription)
@@ -8,7 +8,7 @@ module Pay
8
8
  pay_subscription = Pay::Subscription.find_by_processor_and_id(:stripe, object.id)
9
9
  return if pay_subscription.nil?
10
10
 
11
- pay_subscription.sync!
11
+ pay_subscription.sync!(stripe_account: event.try(:account))
12
12
 
13
13
  pay_user_mailer = Pay.mailer.with(pay_customer: pay_subscription.customer, pay_subscription: pay_subscription)
14
14
 
data/lib/pay/stripe.rb CHANGED
@@ -30,7 +30,7 @@ module Pay
30
30
 
31
31
  extend Env
32
32
 
33
- REQUIRED_VERSION = "~> 11"
33
+ REQUIRED_VERSION = "~> 12"
34
34
 
35
35
  # A list of database model names that include Pay
36
36
  # Used for safely looking up models with client_reference_id
@@ -66,6 +66,11 @@ module Pay
66
66
  find_value_by_name(:stripe, :signing_secret)
67
67
  end
68
68
 
69
+ def self.webhook_receive_test_events
70
+ value = find_value_by_name(:stripe, :webhook_receive_test_events)
71
+ value.blank? ? true : ActiveModel::Type::Boolean.new.cast(value)
72
+ end
73
+
69
74
  def self.configure_webhooks
70
75
  Pay::Webhooks.configure do |events|
71
76
  # Listen to the charge event to make sure we get non-subscription
data/lib/pay/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Pay
2
- VERSION = "7.2.1"
2
+ VERSION = "7.3.0"
3
3
  end
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: 7.2.1
4
+ version: 7.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jason Charnes
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2024-05-29 00:00:00.000000000 Z
13
+ date: 2024-07-09 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: rails
@@ -184,7 +184,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
184
184
  - !ruby/object:Gem::Version
185
185
  version: '0'
186
186
  requirements: []
187
- rubygems_version: 3.4.22
187
+ rubygems_version: 3.5.13
188
188
  signing_key:
189
189
  specification_version: 4
190
190
  summary: Payments engine for Ruby on Rails