pay 8.2.1 → 8.3.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: a39b730745356243341550162435243b696379b5f11fd2a7b74d9c29889583b3
4
- data.tar.gz: df19a0a68194d605b2ae3e00d570aaa0cbd843d24e6358b922d08bb87020c152
3
+ metadata.gz: 8db3bdd142f76a9bd53d2a5e490c8209570c0b56e29a285c7d261bfab89a8fd8
4
+ data.tar.gz: cb518172aa52336942cd612bdf3f4df5a6145109748cfa58b2d07b62361aab83
5
5
  SHA512:
6
- metadata.gz: 8a579a7456dd58a98e7708b607a2e41b5576387ccc23070959cfed1909470811661c8e4ebd3c9ad6a59dfc7af1e74d3304f0d71dd6531573abb9beab499252a0
7
- data.tar.gz: 6c8db9763ddc6664189ac098a72da3a7440e28f414cd11f6d4eb944f441856f7ba0aee8420f453391711bc0dea783db22d8b17067d86d4786182fbfa4681171a
6
+ metadata.gz: fd1d1207c6babf29d763320cced7aa7d595c49d55125c5655132c021a2c836cae85f1c51909ad3e2141545ec0d44fd9575db14ca3dc78dfb25c2a16fa5446606
7
+ data.tar.gz: b0c7e0b96b6d7734fb967fd93b328e890c1085eb8c2b159b2ea6ccdd4093e073af39c0785fad9c75bcdfe918ee77a8028f4b9a931cdc72b3571f644844dfd449
data/README.md CHANGED
@@ -2,13 +2,14 @@
2
2
 
3
3
  # 💳 Pay - Payments engine for Ruby on Rails
4
4
 
5
- [![Build Status](https://github.com/pay-rails/pay/workflows/Tests/badge.svg)](https://github.com/pay-rails/pay/actions) [![Gem Version](https://badge.fury.io/rb/pay.svg)](https://badge.fury.io/rb/pay)
6
-
7
- <img src="docs/images/stripe_partner_badge.svg" height="26px">
5
+ [![Build Status](https://github.com/pay-rails/pay/workflows/Tests/badge.svg)](https://github.com/pay-rails/pay/actions) [![Gem Version](https://badge.fury.io/rb/pay.svg)](https://badge.fury.io/rb/pay) <img src="docs/images/stripe_partner_badge.svg" height="26px">
8
6
 
9
7
  Pay is a payments engine for Ruby on Rails 6.0 and higher.
10
8
 
11
- ⚠️ **Upgrading?** Check the [UPGRADE](UPGRADE.md) guide for required changes and/or migration when upgrading from a previous version of Pay.
9
+ > [!TIP]
10
+ > Check out [Jumpstart](https://jumpstartrails.com) for Rails Starter Kit with Pay already integrated!
11
+
12
+ **Upgrading?** Check the [UPGRADE](UPGRADE.md) guide for required changes and/or migration when upgrading from a previous version of Pay.
12
13
 
13
14
  ## 🧑‍💻 Tutorial
14
15
 
@@ -1,11 +1,15 @@
1
1
  module Pay
2
2
  module FakeProcessor
3
3
  class Subscription < Pay::Subscription
4
+ def self.sync(processor_id, **options)
5
+ # Bypass sync operation for FakeProcessor
6
+ end
7
+
4
8
  def api_record(**options)
5
9
  self
6
10
  end
7
11
 
8
- # With trial, sets end to trial end (mimicing Stripe)
12
+ # With trial, sets end to trial end (mimicking Stripe)
9
13
  # Without trial, sets can ends_at to end of month
10
14
  def cancel(**options)
11
15
  return if canceled?
@@ -174,7 +174,7 @@ module Pay
174
174
  return if canceled? && ends_at.past?
175
175
 
176
176
  @api_record = ::Stripe::Subscription.cancel(processor_id, options.merge(expand_options), stripe_options)
177
- update(ends_at: Time.current, status: :canceled)
177
+ update(trial_ends_at: Time.current, ends_at: Time.current, status: :canceled)
178
178
  rescue ::Stripe::StripeError => e
179
179
  raise Pay::Stripe::Error, e
180
180
  end
data/lib/pay/nano_id.rb CHANGED
@@ -5,7 +5,7 @@ module Pay
5
5
  ALPHABET_SIZE = ALPHABET.size
6
6
 
7
7
  def self.generate(size: 21)
8
- id = ""
8
+ id = +""
9
9
  size.times { id << ALPHABET[(Random.rand * ALPHABET_SIZE).floor] }
10
10
  id
11
11
  end
@@ -61,7 +61,7 @@ module Pay
61
61
  # array will be assumed to be an associative array, and will be serialized
62
62
  # as a PHP associative array rather than a multidimensional array.
63
63
  def serialize(var, assoc = false)
64
- s = ""
64
+ s = +""
65
65
  case var
66
66
  when Array
67
67
  s << "a:#{var.size}:{"
@@ -8,8 +8,9 @@ module Pay
8
8
 
9
9
  object = event.data.object
10
10
 
11
+ # Don't send email on incomplete Stripe subscriptions since they're just getting created and the JavaScript will handle SCA
11
12
  pay_subscription = Pay::Subscription.find_by_processor_and_id(:stripe, object.subscription)
12
- return if pay_subscription.nil?
13
+ return if pay_subscription.nil? || pay_subscription.status == "incomplete"
13
14
 
14
15
  if Pay.send_email?(:payment_action_required, pay_subscription)
15
16
  Pay.mailer.with(
@@ -8,8 +8,9 @@ module Pay
8
8
 
9
9
  object = event.data.object
10
10
 
11
+ # Don't send email on incomplete Stripe subscriptions since they're just getting created and the JavaScript will handle SCA
11
12
  pay_subscription = Pay::Subscription.find_by_processor_and_id(:stripe, object.subscription)
12
- return if pay_subscription.nil?
13
+ return if pay_subscription.nil? || pay_subscription.status == "incomplete"
13
14
 
14
15
  if Pay.send_email?(:payment_failed, pay_subscription)
15
16
  Pay.mailer.with(
data/lib/pay/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Pay
2
- VERSION = "8.2.1"
2
+ VERSION = "8.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: 8.2.1
4
+ version: 8.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-11-26 00:00:00.000000000 Z
13
+ date: 2024-12-20 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: rails