monza 1.3.6 → 1.3.7
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +0 -5
- data/lib/monza/verification_response.rb +7 -18
- data/lib/monza/version.rb +3 -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: 441bc579be3150547bfa2b26215ef90ba39ff5f4792d06008f2d5693fa078370
|
4
|
+
data.tar.gz: a42a4897914ee9628bcc59b898d80a598fc08c8e29bf0466044a763bf9019178
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 205b6eb1b331e502fcd8c17c3057bd2f45fe98e1ece2afe22ff70714dcbfb7716bb9f10e2eb6e384aa89d461056c1615f9b9a1e85b09a10c687fc85356707796
|
7
|
+
data.tar.gz: a246be0abc7030fb6d43f043d1808345a0f800457b293ec155a9de3941d64acffe3b7146cca53a0ca66f2c85d3dca37c5c1f6af7c537a16c213ac711ffca2873
|
data/README.md
CHANGED
@@ -41,11 +41,6 @@ You can also pass in `exclude_old_transactions` with value `true` as an option i
|
|
41
41
|
# this checks if latest transaction receipt expiry_date is in today or the future
|
42
42
|
response.is_subscription_active? # => true or false
|
43
43
|
|
44
|
-
# Check if subscription is active
|
45
|
-
# this checks if ANY transaction receipt expiry_date is in today or the future
|
46
|
-
# this is helpful in case the most recent transaction was cancelled but the user still has a previous transaction or subscription that is active
|
47
|
-
response.is_any_subscription_active? # => true or false
|
48
|
-
|
49
44
|
# Returns the active subscription TransactionReceipt or nil
|
50
45
|
response.latest_active_transaction_receipt # => TransactionReceipt instance
|
51
46
|
|
@@ -37,30 +37,19 @@ module Monza
|
|
37
37
|
end
|
38
38
|
|
39
39
|
def is_subscription_active?
|
40
|
-
|
41
|
-
if @latest_receipt_info.last.cancellation_date
|
42
|
-
false
|
43
|
-
else
|
44
|
-
@latest_receipt_info.last.expires_date_ms >= Time.zone.now
|
45
|
-
end
|
46
|
-
else
|
47
|
-
false
|
48
|
-
end
|
40
|
+
latest_active_transaction_receipt.present?
|
49
41
|
end
|
50
42
|
|
43
|
+
# Deprecated, only left here for backwards compatibility, please use is_subscription_active?
|
51
44
|
def is_any_subscription_active?
|
52
|
-
|
53
|
-
latest_expires_date_ms = expires_dates_ms.max
|
54
|
-
|
55
|
-
if latest_expires_date_ms
|
56
|
-
latest_expires_date_ms >= Time.zone.now
|
57
|
-
else
|
58
|
-
false
|
59
|
-
end
|
45
|
+
is_subscription_active?
|
60
46
|
end
|
61
47
|
|
62
48
|
def latest_active_transaction_receipt
|
63
|
-
latest_active_sub = @latest_receipt_info
|
49
|
+
latest_active_sub = @latest_receipt_info
|
50
|
+
.reject(&:cancellation_date)
|
51
|
+
.select(&:expires_date_ms)
|
52
|
+
.max_by(&:expires_date_ms)
|
64
53
|
|
65
54
|
if latest_active_sub && latest_active_sub.expires_date_ms >= Time.zone.now
|
66
55
|
return latest_active_sub
|
data/lib/monza/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: monza
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.3.
|
4
|
+
version: 1.3.7
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Gabriel Garza
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2020-05-31 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: json
|