caboose-cms 0.9.11 → 0.9.12

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
  SHA1:
3
- metadata.gz: 4298da2a7310afb66b5acfe0f5b1aed40328acfc
4
- data.tar.gz: 1482610b197353074a198f8e28e99eeb668d83d0
3
+ metadata.gz: e6b21e4e3fe1e4fffbbf0e0c07e5a8f66014fba1
4
+ data.tar.gz: c8794f4febe45b56f519a93d8db75a75e34cb19e
5
5
  SHA512:
6
- metadata.gz: abdc67be4a910c33816a9298d08f68843d3a27723547c5b3a800fbffac9729101b96e35e494b47f520a888e01b2ee5df6e23601d5a3d7f611bbf846767e12a16
7
- data.tar.gz: b77679d97a89ca4404788fb1fc456af8a8a20633dd6d4014374dcc879f9046f4cd7e65e63a97efd82089d62a92b6ecb166ed0514cf35fa43c08c12eeb695cd28
6
+ metadata.gz: 4aee44531816be1b60eba614a3f76a7b212df96a4c6e9dec4aead01d9f6d22ae9ee373f34783041921bfe78d746cca320bdd5e8f8af48022c8004612cd69afa7
7
+ data.tar.gz: 41e9fe6899cf068580bfe5640133333300db0ea342d61cbc69e8cbf6289f85b48d88638d7256b52d7ccb0f8a9ac0e8dc593d6e093e02a36abf832fe2083ed024
@@ -150,13 +150,14 @@ CheckoutController.prototype = {
150
150
  //before_update: function() { this.value_old = this.value_clean; },
151
151
  after_update: function() {
152
152
  that.invoice.instore_pickup = this.value;
153
- var arr = ['shipping_address_container'];
154
- $.each(that.invoice.invoice_packages, function(i, ip) {
155
- arr.push('invoice_package_' + ip.id + '_shipping_method');
156
- });
157
- if (parseInt(this.value) == 0) $.each(arr, function(i, el) { $('#'+el).slideDown(); });
158
- else $.each(arr, function(i, el) { $('#'+el).slideUp(); });
159
- that.print_ready_message();
153
+ //var arr = ['shipping_address_container'];
154
+ //$.each(that.invoice.invoice_packages, function(i, ip) {
155
+ // arr.push('invoice_package_' + ip.id + '_shipping_method');
156
+ //});
157
+ //if (parseInt(this.value) == 0) $.each(arr, function(i, el) { $('#'+el).slideDown(); });
158
+ //else $.each(arr, function(i, el) { $('#'+el).slideUp(); });
159
+ that.refresh_and_print();
160
+ //that.print_ready_message();
160
161
  }
161
162
  }
162
163
  ]
@@ -464,6 +464,8 @@ module Caboose
464
464
  ip.instore_pickup = v
465
465
  ip.save
466
466
  end
467
+
468
+ @invoice.calculate
467
469
  end
468
470
  end
469
471
 
@@ -0,0 +1,12 @@
1
+
2
+ x = 0.0
3
+ invoice.line_items.each do |li|
4
+ li.verify_unit_price
5
+ x = x + (li.unit_price * li.quantity) if li.variant.taxable
6
+ end
7
+
8
+ return x * 0.09 if invoice.instore_pickup
9
+ sa = invoice.shipping_address
10
+ return 0.00 if sa.nil? || sa.city.nil? || sa.state.nil?
11
+ return 0.00 if sa.state.downcase != 'al'
12
+ return (0.09 * x).round(2)
@@ -842,6 +842,7 @@ class Caboose::Schema < Caboose::Utilities::Schema
842
842
  [ :default_product_status , :string ],
843
843
  [ :default_taxable , :boolean ],
844
844
  [ :allow_instore_pickup , :boolean , { :default => false }],
845
+ [ :instore_tax_rate , :decimal , { :precision => 8, :scale => 2 }],
845
846
  [ :custom_invoice_pdf , :string ]
846
847
  ],
847
848
  Caboose::Subscription => [
@@ -9,16 +9,23 @@ module Caboose
9
9
 
10
10
  def self.tax(invoice)
11
11
  sc = invoice.site.store_config
12
- return self.custom_tax(sc, invoice) if !sc.auto_calculate_tax
12
+ return self.custom_tax(sc, invoice) if !sc.auto_calculate_tax
13
+
14
+ if invoice.instore_pickup
15
+ if sc.instore_tax_rate.nil?
16
+ Caboose.log("Error: Null in-store tax rate")
17
+ return 0.00
18
+ end
19
+ return invoice.subtotal * sc.instore_tax_rate
20
+ end
13
21
 
14
- return 0.00 if !invoice.shipping_address
22
+ return 0.00 if !invoice.shipping_address
15
23
  return 0.00 if !invoice.has_taxable_items?
16
24
  return 0.00 if !invoice.has_shippable_items?
17
25
 
18
26
  return invoice.subtotal * invoice.tax_rate if invoice.tax_rate # See if the tax rate has already been calculated
19
27
 
20
- t = self.transaction(invoice)
21
- Caboose.log(t.inspect)
28
+ t = self.transaction(invoice)
22
29
  lookup = t.lookup
23
30
  tax = lookup.tax_amount
24
31
 
@@ -1,3 +1,3 @@
1
1
  module Caboose
2
- VERSION = '0.9.11'
2
+ VERSION = '0.9.12'
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: caboose-cms
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.9.11
4
+ version: 0.9.12
5
5
  platform: ruby
6
6
  authors:
7
7
  - William Barry
@@ -839,6 +839,7 @@ files:
839
839
  - app/mailers/caboose/caboose_mailer.rb
840
840
  - app/mailers/caboose/invoices_mailer.rb
841
841
  - app/mailers/caboose/login_mailer.rb
842
+ - app/models/caboose/#Untitled-1#
842
843
  - app/models/caboose/ab_option.rb
843
844
  - app/models/caboose/ab_testing.rb
844
845
  - app/models/caboose/ab_value.rb