effective_orders 4.5.4 → 4.5.9

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: 0144e9b8480285f5329cdb80f310ae893afc715ef1515a9d466d19075e5f0795
4
- data.tar.gz: c4f7848248c853fc25f8123113cb863087ed92b0cfc01b78f85892ea09bb24ea
3
+ metadata.gz: 59043240411738af58cfc47af461408a055e6c5b14cb972bfe2813e6406ff33f
4
+ data.tar.gz: 2984831a23addc106308001ebd736ddc549575b9af42062d2328633050e9a9c3
5
5
  SHA512:
6
- metadata.gz: 06ed32afc06143accff761edb35b4018196558a9f3a76e6817be18e772f746acc84ec7ddc202f13713fc66316c64040518748116b2c68011d5d2358e5ad6be74
7
- data.tar.gz: 11ffb123b02a984def655fae15a9c35a3f7f6266f7245faea219169090839683b7c17509295c99450443faa0cbb66ceb1b01a742008cab9b7e641ccb01990579
6
+ metadata.gz: 65434ddd798e864809733e292b6dddd6bf57b20d0c336d44558e1dd80c5c2b9893d3c1e797c54cbbf6f8583188022c75c1c1e5baff7f7c2ee5e4fca150bb2d81
7
+ data.tar.gz: '0939ceffcb5d665ef932ce414c425c11b8e10f697abdce2bbd5c24335c1b438c3753a8c2a5223060f81872d8402f77f48a7178c492501b7a286f30893a71bb31'
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!
@@ -2,9 +2,11 @@ module Effective
2
2
  class CartsController < ApplicationController
3
3
  layout (EffectiveOrders.layout.kind_of?(Hash) ? EffectiveOrders.layout[:carts] : EffectiveOrders.layout)
4
4
 
5
+ before_action :authenticate_user!
6
+
5
7
  def show
6
8
  @cart = current_cart
7
- @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?
8
10
 
9
11
  @page_title ||= 'My Cart'
10
12
  EffectiveOrders.authorize!(self, :show, @cart)
@@ -4,6 +4,8 @@ module Effective
4
4
 
5
5
  include Effective::CrudController
6
6
 
7
+ before_action :authenticate_user!
8
+
7
9
  submit :save, 'Save', success: -> { 'Successfully updated card.' }
8
10
  page_title 'Customer Settings'
9
11
 
@@ -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
 
@@ -1,3 +1,3 @@
1
1
  module EffectiveOrders
2
- VERSION = '4.5.4'.freeze
2
+ VERSION = '4.5.9'.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.4
4
+ version: 4.5.9
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-13 00:00:00.000000000 Z
11
+ date: 2020-08-24 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails