pay 11.0.0 → 11.1.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: bbc13750a45c160a2cf53afc173735a5e846d3401955b3c05b080b61936b3173
4
- data.tar.gz: 315acc27967b4dc0063981950dbb25aade62c8e29447714d410db48066acbf83
3
+ metadata.gz: 82dd9dc3193e898e2fd8538148e9ff886b852506d80c768a26616921049fbd65
4
+ data.tar.gz: 1b85c150235a1ae4531592b6d6c5cf577e126e693c1ce516ea2b01d8199f5276
5
5
  SHA512:
6
- metadata.gz: 6730e4367a8c0de82aa4f7daddb87c8c4184fe3f87830b5dff9fb13480f2583c002d7ef0c65c466a528596d3c60a373c69112a396c01a8903103c640417ba304
7
- data.tar.gz: 8bb32b72e87510fa62be51140271a163424d7bfc12c046b1faa128ff155fa46e03f43018f79e205283c07d56674083cb0de1b278c10c0fd61d65569f468fcdd7
6
+ metadata.gz: c0b450e4daa02317f33e74bc627728643157361f5d51d5748e37c5a372d94dabb41b28306b569f4e9c2fa4a0ca04e437f18e15007cac6ec3eb23a8a9ca190609
7
+ data.tar.gz: 1964aabb5533aba8a248164ef01b7203bf450fed5dab23859c14a1cbbdf9f90a67ac29beeb8840decd0ec4e70bd4da0d252e668b1d5b6bcbb63b3214ad16d38b
@@ -47,6 +47,8 @@ module Pay
47
47
  if object.trial_end
48
48
  trial_ended_at = [object.ended_at, object.trial_end].compact.min
49
49
  attributes[:trial_ends_at] = Time.at(trial_ended_at)
50
+ else
51
+ attributes[:trial_ends_at] = nil
50
52
  end
51
53
 
52
54
  object.items.auto_paging_each do |subscription_item|
@@ -164,7 +166,7 @@ module Pay
164
166
  cancel_now!
165
167
  else
166
168
  @api_record = ::Stripe::Subscription.update(processor_id, {cancel_at_period_end: true}.merge(expand_options), stripe_options)
167
- update(ends_at: (on_trial? ? trial_ends_at : Time.at(@api_record.items.first.current_period_end)))
169
+ update(ends_at: Time.at(@api_record.cancel_at))
168
170
  end
169
171
  rescue ::Stripe::StripeError => e
170
172
  raise Pay::Stripe::Error, e
@@ -178,7 +180,11 @@ module Pay
178
180
  return if canceled? && ends_at.past?
179
181
 
180
182
  @api_record = ::Stripe::Subscription.cancel(processor_id, options.merge(expand_options), stripe_options)
181
- update(trial_ends_at: Time.current, ends_at: Time.current, status: :canceled)
183
+ update(
184
+ trial_ends_at: (@api_record.trial_end ? Time.at(@api_record.trial_end) : nil),
185
+ ends_at: Time.at(@api_record.ended_at),
186
+ status: @api_record.status
187
+ )
182
188
  rescue ::Stripe::StripeError => e
183
189
  raise Pay::Stripe::Error, e
184
190
  end
@@ -66,10 +66,12 @@ module Pay
66
66
 
67
67
  # Does not include the last second of the trial
68
68
  def on_trial?
69
+ return false if ended?
69
70
  trial_ends_at? && trial_ends_at > Time.current
70
71
  end
71
72
 
72
73
  def trial_ended?
74
+ return true if ended?
73
75
  trial_ends_at? && trial_ends_at <= Time.current
74
76
  end
75
77
 
@@ -0,0 +1,9 @@
1
+ Extra confirmation is needed to process your payment
2
+
3
+ Your <%= Pay.application_name %> subscription requires confirmation to process your payment to continue access.
4
+
5
+ Confirm your payment: <%= pay.payment_url(params[:payment_intent_id]) %>
6
+
7
+ If you have any questions, please hit reply and let us know.
8
+
9
+ — The <%= Pay.application_name %> Team
@@ -0,0 +1,9 @@
1
+ Your payment was declined
2
+
3
+ We were unable to charge your payment method for your <%= Pay.application_name %> subscription. Please update your billing information.
4
+
5
+ Update billing information: <%= root_url %>
6
+
7
+ Let us know if you have any questions.
8
+
9
+ — The <%= Pay.application_name %> Team
@@ -0,0 +1,20 @@
1
+ We received payment for your <%= Pay.application_name %> subscription. Thanks for your business!
2
+
3
+ Questions? Please reply to this email.
4
+
5
+ ------------------------------------
6
+ RECEIPT - SUBSCRIPTION
7
+
8
+ <%= Pay.application_name %>
9
+ Amount: <%= params[:pay_charge].amount_with_currency %>
10
+
11
+ Charged to: <%= params[:pay_charge].charged_to %>
12
+ Transaction ID: <%= params[:pay_charge].id %>
13
+ Date: <%= l params[:pay_charge].created_at %>
14
+ <% if params[:pay_charge].customer.owner.try(:extra_billing_info?) %>
15
+ <%= params[:pay_charge].customer.owner.extra_billing_info %>
16
+ <% end %>
17
+
18
+ <%= Pay.business_name %>
19
+ <%= Pay.business_address %>
20
+ ------------------------------------
@@ -0,0 +1,21 @@
1
+ We have processed your <%= Pay.application_name %> refund.
2
+ Please allow up to 7 business days for your refund to appear in your account
3
+
4
+ Questions? Please reply to this email.
5
+
6
+ ------------------------------------
7
+ RECEIPT - REFUND
8
+
9
+ <%= Pay.application_name %>
10
+ Amount: <%= params[:pay_charge].amount_refunded_with_currency %>
11
+
12
+ Refunded to: <%= params[:pay_charge].charged_to %>
13
+ Transaction ID: <%= params[:pay_charge].id %>
14
+ Date: <%= l params[:pay_charge].created_at %>
15
+ <% if params[:pay_charge].customer.owner.try(:extra_billing_info?) %>
16
+ <%= params[:pay_charge].customer.owner.extra_billing_info %>
17
+ <% end %>
18
+
19
+ <%= Pay.business_name %>
20
+ <%= Pay.business_address %>
21
+ ------------------------------------
@@ -0,0 +1,8 @@
1
+ Your upcoming <%= Pay.application_name %> subscription renewal
2
+
3
+ This is a friendly reminder that your <%= Pay.application_name %> subscription will renew automatically on <%= l params[:date].to_date, format: :long %>.
4
+
5
+ You may manage your subscription via your account: <%= root_url %>
6
+ If you have any questions, please hit reply and let us know.
7
+
8
+ — The <%= Pay.application_name %> Team
@@ -0,0 +1,8 @@
1
+ Your <%= Pay.application_name %> trial has ended
2
+
3
+ This is just a friendly reminder that your <%= Pay.application_name %> trial has ended.
4
+
5
+ You may manage your subscription via your account: <%= root_url %>
6
+ If you have any questions, please hit reply and let us know.
7
+
8
+ — The <%= Pay.application_name %> Team
@@ -0,0 +1,8 @@
1
+ Your <%= Pay.application_name %> trial is ending soon
2
+
3
+ This is just a friendly reminder that your <%= Pay.application_name %> trial will be ending soon.
4
+
5
+ You may manage your subscription via your account: <%= root_url %>
6
+ If you have any questions, please hit reply and let us know.
7
+
8
+ — The <%= Pay.application_name %> Team
data/lib/pay/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Pay
2
- VERSION = "11.0.0"
2
+ VERSION = "11.1.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: 11.0.0
4
+ version: 11.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jason Charnes
@@ -89,12 +89,19 @@ files:
89
89
  - app/views/layouts/pay/application.html.erb
90
90
  - app/views/pay/payments/show.html.erb
91
91
  - app/views/pay/user_mailer/payment_action_required.html.erb
92
+ - app/views/pay/user_mailer/payment_action_required.text.erb
92
93
  - app/views/pay/user_mailer/payment_failed.html.erb
94
+ - app/views/pay/user_mailer/payment_failed.text.erb
93
95
  - app/views/pay/user_mailer/receipt.html.erb
96
+ - app/views/pay/user_mailer/receipt.text.erb
94
97
  - app/views/pay/user_mailer/refund.html.erb
98
+ - app/views/pay/user_mailer/refund.text.erb
95
99
  - app/views/pay/user_mailer/subscription_renewing.html.erb
100
+ - app/views/pay/user_mailer/subscription_renewing.text.erb
96
101
  - app/views/pay/user_mailer/subscription_trial_ended.html.erb
102
+ - app/views/pay/user_mailer/subscription_trial_ended.text.erb
97
103
  - app/views/pay/user_mailer/subscription_trial_will_end.html.erb
104
+ - app/views/pay/user_mailer/subscription_trial_will_end.text.erb
98
105
  - config/currencies/iso.json
99
106
  - config/locales/en.yml
100
107
  - config/routes.rb