effective_orders 5.1.0 → 5.1.4

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: 31540d5d07a5c2afc891284cd037d88d25ea6aba9db57073a53b5dd60c952a11
4
- data.tar.gz: 502ad51ce45452ff307292de9d2f16c934a7e1a0aca7c62376272b1f3ede07b0
3
+ metadata.gz: 8a084a1145beb50dc672efd5506bb81e497553d73e945195f2f31ea567bbc757
4
+ data.tar.gz: 2743bac90f7d5f5ff4b2985b97a7404040f875fc12414e308bd188023307512c
5
5
  SHA512:
6
- metadata.gz: 7541296d5ee6f6d52dc2edf94938f28734bf8da046612c46b0de23ee51fcd70c2eb80a32dd53534d16ffd3a9de72a923de9fffa709c4b96651ccf49fe7779b9b
7
- data.tar.gz: 7be888605850e6dda6b952bf6ba9cceb575577b3d18ded8c118c8028890715bf41c8d8ded387de1bd5378c38207329af61709d071f2a80eec528ce6c7e701164
6
+ metadata.gz: 2ee2c0d212855b3a7883c9ac4194b2b9b796668cdadd57778e23afdfe774fcd07f503f96b0812242bb2e0aa9f872c6a354fa2dd0d10275fc78b3787d9a09a65b
7
+ data.tar.gz: 2d6ae464bd99a12bfd0e3226d8a1bdb20fa04c4e7b015d185f0432c8be5a92644840a3e9a93b9f437102f5dc03ae9dcc6faa7d7589582235b55609bef976cbe9
@@ -11,7 +11,7 @@ module Admin
11
11
 
12
12
  submit :save, 'Continue', redirect: :index
13
13
  submit :save, 'Add New', redirect: -> { effective_orders.new_admin_order_path(user_id: resource.user&.to_param) }
14
- submit :save, 'Duplicate', redirect: -> { effective_posts.new_admin_post_path(duplicate_id: resource.id) }
14
+ submit :save, 'Duplicate', redirect: -> { effective_orders.new_admin_order_path(duplicate_id: resource.to_param) }
15
15
  submit :save, 'Checkout', redirect: -> { effective_orders.checkout_admin_order_path(resource) }
16
16
 
17
17
  def create
@@ -118,12 +118,6 @@ module Effective
118
118
  end
119
119
  end
120
120
 
121
- with_options if: -> { confirmed? && !skip_buyer_validations? } do
122
- if EffectiveOrders.terms_and_conditions
123
- validates :terms_and_conditions, presence: true
124
- end
125
- end
126
-
127
121
  # When Purchased
128
122
  with_options if: -> { purchased? } do
129
123
  validates :purchased_at, presence: true
@@ -231,7 +225,6 @@ module Effective
231
225
  retval.size == 1 ? retval.first : retval
232
226
  end
233
227
 
234
-
235
228
  def update_prices!
236
229
  raise('already purchased') if purchased?
237
230
  raise('must be pending or confirmed') unless pending? || confirmed?
@@ -30,8 +30,13 @@ module Effective
30
30
  end
31
31
 
32
32
  def tax_rate
33
- country = country_code || (order.billing_address.country_code if order.billing_address.present?)
34
- state = state_code || (order.billing_address.state_code if order.billing_address.present?)
33
+ country = country_code
34
+ country ||= order.billing_address.country_code if order.billing_address.present?
35
+ country ||= order.user.billing_address.country_code if order.user.respond_to?(:billing_address) && order.user.billing_address.present?
36
+
37
+ state = state_code
38
+ state ||= order.billing_address.state_code if order.billing_address.present?
39
+ state ||= order.user.billing_address.state_code if order.user.respond_to?(:billing_address) && order.user.billing_address.present?
35
40
 
36
41
  rate = RATES[country]
37
42
  return rate if rate.kind_of?(Numeric)
@@ -8,7 +8,7 @@
8
8
  = f.email_cc_field :cc, hint: "Cc the above on any emailed receipts or payment requests."
9
9
 
10
10
  %h2 Order Items
11
- = f.has_many :order_items do |fc|
11
+ = f.has_many :order_items, remove: f.object.new_record? do |fc|
12
12
  = render 'order_item_fields', f: fc
13
13
 
14
14
  %hr
@@ -1,3 +1,3 @@
1
1
  module EffectiveOrders
2
- VERSION = '5.1.0'.freeze
2
+ VERSION = '5.1.4'.freeze
3
3
  end
@@ -107,7 +107,7 @@ module EffectiveOrders
107
107
 
108
108
  # The Effective::Order.payment_provider value must be in this collection
109
109
  def self.payment_providers
110
- [
110
+ @payment_providers ||= [
111
111
  ('cheque' if cheque?),
112
112
  ('credit card' if mark_as_paid?),
113
113
  ('free' if free?),
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: 5.1.0
4
+ version: 5.1.4
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: 2021-05-20 00:00:00.000000000 Z
11
+ date: 2021-08-30 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails