pay 8.2.1 → 8.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 +4 -4
- data/README.md +5 -4
- data/app/models/pay/fake_processor/subscription.rb +5 -1
- data/app/models/pay/stripe/subscription.rb +1 -1
- data/lib/pay/nano_id.rb +1 -1
- data/lib/pay/paddle_classic/webhooks/signature_verifier.rb +1 -1
- data/lib/pay/stripe/webhooks/payment_action_required.rb +2 -1
- data/lib/pay/stripe/webhooks/payment_failed.rb +2 -1
- data/lib/pay/version.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: 8db3bdd142f76a9bd53d2a5e490c8209570c0b56e29a285c7d261bfab89a8fd8
|
4
|
+
data.tar.gz: cb518172aa52336942cd612bdf3f4df5a6145109748cfa58b2d07b62361aab83
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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
|
-
[](https://github.com/pay-rails/pay/actions) [](https://badge.fury.io/rb/pay)
|
6
|
-
|
7
|
-
<img src="docs/images/stripe_partner_badge.svg" height="26px">
|
5
|
+
[](https://github.com/pay-rails/pay/actions) [](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
|
-
|
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 (
|
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
@@ -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
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.
|
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-
|
13
|
+
date: 2024-12-20 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: rails
|