caboose-cms 0.9.11 → 0.9.12
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 +4 -4
- data/app/assets/javascripts/caboose/checkout/checkout_controller.js +8 -7
- data/app/controllers/caboose/checkout_controller.rb +2 -0
- data/app/models/caboose/#Untitled-1# +12 -0
- data/app/models/caboose/schema.rb +1 -0
- data/app/models/caboose/tax_calculator.rb +11 -4
- data/lib/caboose/version.rb +1 -1
- metadata +2 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e6b21e4e3fe1e4fffbbf0e0c07e5a8f66014fba1
|
4
|
+
data.tar.gz: c8794f4febe45b56f519a93d8db75a75e34cb19e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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
|
-
|
155
|
-
|
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.
|
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
|
]
|
@@ -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
|
|
data/lib/caboose/version.rb
CHANGED
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.
|
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
|