effective_orders 4.5.5 → 4.5.10

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: e4a671a96fc25bfd1d0bb8f45b5df4e4f764a68fc22b8d0e9fe30d762d899676
4
- data.tar.gz: 1dd069a7a189dd813649db7cde82b5d6aea048a711d4282a02577587f22cbcac
3
+ metadata.gz: fedc9964ed35e8479f4c5d663fe37c7f76f1ebebd3a6852f880be58aa9ada488
4
+ data.tar.gz: 0b6e195ea558eec5b0bb5b5be2f7dd17fe769233b039c475c6c24f1136d5b144
5
5
  SHA512:
6
- metadata.gz: f4c244b0f027f500a7a2a4619529498b6b64fc24d6578f2a16dc5c4471ec70c92867b8aa9ea3a7d7a073db07b47c29e262fd90f19f4cbafe6e32496fea9d04d3
7
- data.tar.gz: fbf13d0a45dca91251c2b027baaed9cf8e30f406c09cc8ab3c7920045d4bb2f48335ce07b6ce71bebcce86b60e39cb1b05daa8a4d32312f57aa1baebadb197c0
6
+ metadata.gz: 92930b78d50b28a14afbb274fe01c9a8677541955084b19b3d3e17440dacdb00299e7462a9db6921074736e903123bee09ba5ffc2483271a89aa088ebd637285
7
+ data.tar.gz: c0966358967695aa5df3c62ed423123640e91e4b816e607b5e153a6a3cced73c7228d7b133e4d10e25e4243bc9470e55e35a898b24c5e41a3466cecb3f1d8b1e
data/README.md CHANGED
@@ -828,6 +828,12 @@ effective_orders works around this by appending a timestamp to the order ID.
828
828
 
829
829
  Make sure `gem 'stripe'` is included in your Gemfile.
830
830
 
831
+ Add to your application layout / header
832
+
833
+ ```
834
+ = javascript_include_tag 'https://js.stripe.com/v3/'
835
+ ```
836
+
831
837
  First register for an account with Stripe
832
838
 
833
839
  https://manage.stripe.com/register
@@ -1001,4 +1007,3 @@ MIT License. Copyright [Code and Effect Inc.](http://www.codeandeffect.com/)
1001
1007
  4. Push to the branch (`git push origin my-new-feature`)
1002
1008
  5. Bonus points for test coverage
1003
1009
  6. Create new Pull Request
1004
-
@@ -8,7 +8,7 @@ this.StripeForm ||= class StripeForm
8
8
  @card = null
9
9
 
10
10
  initialize: ->
11
- @form = $('form[data-stripe-form]').first()
11
+ @form = $('form[data-stripe-form]:not(.initialized)').first()
12
12
  return false unless @form.length > 0
13
13
 
14
14
  @paymentIntent = @form.find("input[name$='[payment_intent_id]']").first()
@@ -17,6 +17,7 @@ this.StripeForm ||= class StripeForm
17
17
  @card = @stripe.elements().create('card', @style())
18
18
 
19
19
  @mount()
20
+ @form.addClass('initialized')
20
21
 
21
22
  style: ->
22
23
  style: {
@@ -75,3 +76,4 @@ this.StripeForm ||= class StripeForm
75
76
  EffectiveForm.invalidate(@form);
76
77
 
77
78
  $ -> (new StripeForm()).initialize()
79
+ $(document).on 'turbolinks:load', -> (new StripeForm()).initialize()
@@ -145,7 +145,7 @@ module Admin
145
145
  end
146
146
 
147
147
  def send_payment_request
148
- @order = Effective::Order.pending.find(params[:id])
148
+ @order = Effective::Order.not_purchased.find(params[:id])
149
149
  authorize_effective_order!
150
150
 
151
151
  if @order.send_payment_request_to_buyer!
@@ -164,7 +164,7 @@ module Admin
164
164
  end
165
165
 
166
166
  def bulk_send_payment_request
167
- @orders = Effective::Order.pending.where(id: params[:ids])
167
+ @orders = Effective::Order.not_purchased.where(id: params[:ids])
168
168
 
169
169
  begin
170
170
  authorize_effective_order!
@@ -6,7 +6,7 @@ module Effective
6
6
 
7
7
  def show
8
8
  @cart = current_cart
9
- @pending_orders = Effective::Order.pending.where(user: current_user) if current_user.present?
9
+ @pending_orders = Effective::Order.not_purchased.where(user: current_user) if current_user.present?
10
10
 
11
11
  @page_title ||= 'My Cart'
12
12
  EffectiveOrders.authorize!(self, :show, @cart)
@@ -228,7 +228,7 @@ module Effective
228
228
 
229
229
  def update_prices!
230
230
  raise('already purchased') if purchased?
231
- raise('must be pending') unless pending?
231
+ raise('must be pending or confirmed') unless pending? || confirmed?
232
232
 
233
233
  order_items.each do |item|
234
234
  purchasable = item.purchasable
@@ -382,11 +382,11 @@ module Effective
382
382
 
383
383
  raise "Failed to purchase order: #{error || errors.full_messages.to_sentence}" unless error.nil?
384
384
 
385
+ run_purchasable_callbacks(:after_purchase)
386
+
385
387
  send_refund_notification! if email && refund?
386
388
  send_order_receipts! if email
387
389
 
388
- run_purchasable_callbacks(:after_purchase)
389
-
390
390
  true
391
391
  end
392
392
 
@@ -538,7 +538,11 @@ module Effective
538
538
  end
539
539
 
540
540
  def send_email(email, *mailer_args)
541
- Effective::OrdersMailer.public_send(email, *mailer_args).public_send(EffectiveOrders.mailer[:deliver_method])
541
+ begin
542
+ Effective::OrdersMailer.public_send(email, *mailer_args).public_send(EffectiveOrders.mailer[:deliver_method])
543
+ rescue => e
544
+ raise if Rails.env.development? || Rails.env.test?
545
+ end
542
546
  end
543
547
 
544
548
  def truthy?(value)
@@ -1,4 +1,4 @@
1
- = javascript_include_tag 'https://js.stripe.com/v3/'
1
+ /= javascript_include_tag 'https://js.stripe.com/v3/'
2
2
 
3
3
  - stripe = stripe_payment_intent(order)
4
4
 
@@ -204,7 +204,7 @@ module EffectiveOrders
204
204
  currency: plan.currency,
205
205
  interval: plan.interval,
206
206
  interval_count: plan.interval_count,
207
- trial_period_days: plan.trial_period_days
207
+ trial_period_days: (plan.trial_period_days if plan.respond_to?(:trial_period_days))
208
208
  }
209
209
  end.sort do |x, y|
210
210
  val ||= (x[:interval] <=> y[:interval])
@@ -1,3 +1,3 @@
1
1
  module EffectiveOrders
2
- VERSION = '4.5.5'.freeze
2
+ VERSION = '4.5.10'.freeze
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: effective_orders
3
3
  version: !ruby/object:Gem::Version
4
- version: 4.5.5
4
+ version: 4.5.10
5
5
  platform: ruby
6
6
  authors:
7
7
  - Code and Effect
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-08-14 00:00:00.000000000 Z
11
+ date: 2020-08-26 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails