piggybak 0.6.22 → 0.6.23
Sign up to get free protection for your applications and to get access to all the features.
- data/Gemfile.lock +1 -1
- data/README.md +2 -6
- data/app/assets/javascripts/piggybak/piggybak.js +4 -0
- data/app/models/piggybak/tax_calculator/percent.rb +11 -1
- data/app/views/piggybak/cart/_items.html.erb +2 -2
- data/app/views/piggybak/orders/download.text.erb +4 -5
- data/lib/piggybak.rb +1 -1
- data/lib/piggybak/version.rb +1 -1
- metadata +4 -4
data/Gemfile.lock
CHANGED
data/README.md
CHANGED
@@ -63,13 +63,9 @@ Visit the project website [here][project-website] to see more documentation and
|
|
63
63
|
TODO
|
64
64
|
========
|
65
65
|
|
66
|
-
*
|
67
|
-
|
68
|
-
* Add/check validation to ensure sufficient inventory
|
66
|
+
* Fix tax calculation when coupon / discounts applied.
|
69
67
|
|
70
|
-
*
|
71
|
-
|
72
|
-
* Re-add order logging / masking payment parameters
|
68
|
+
* Ensure that changes in nested addresses are recorded on order notes.
|
73
69
|
|
74
70
|
Copyright
|
75
71
|
========
|
@@ -98,6 +98,10 @@ var piggybak = {
|
|
98
98
|
},
|
99
99
|
update_tax: function(field) {
|
100
100
|
var billing_data = {};
|
101
|
+
billing_data['reduce_tax_subtotal'] = 0;
|
102
|
+
$('.reduce_tax_subtotal:visible').each(function(i, j) {
|
103
|
+
billing_data['reduce_tax_subtotal'] += parseFloat($(j).html().replace('$', ''));
|
104
|
+
});
|
101
105
|
$('#billing_address input, #billing_address select').each(function(i, j) {
|
102
106
|
var id = $(j).attr('id');
|
103
107
|
id = id.replace("piggybak_order_billing_address_attributes_", '');
|
@@ -19,7 +19,17 @@ module Piggybak
|
|
19
19
|
end
|
20
20
|
|
21
21
|
def self.rate(method, object)
|
22
|
-
|
22
|
+
taxable_total = object.subtotal
|
23
|
+
if object.is_a?(::Piggybak::Order)
|
24
|
+
Piggybak.config.line_item_types.each do |k, v|
|
25
|
+
if v.has_key?(:reduce_tax_subtotal) && v[:reduce_tax_subtotal]
|
26
|
+
taxable_total += object.send("#{k}_charge")
|
27
|
+
end
|
28
|
+
end
|
29
|
+
else
|
30
|
+
taxable_total += object.extra_data[:reduce_tax_subtotal].to_f
|
31
|
+
end
|
32
|
+
(method.metadata.detect { |m| m.key == "rate" }.value.to_f * taxable_total).to_c
|
23
33
|
end
|
24
34
|
end
|
25
35
|
end
|
@@ -40,7 +40,7 @@
|
|
40
40
|
<% if page != "cart" -%>
|
41
41
|
<tr>
|
42
42
|
<td colspan="<%= page == "cart" ? "3" : "2" %>"></td>
|
43
|
-
<td>Tax</td>
|
43
|
+
<td>Estimated Tax</td>
|
44
44
|
<td id="tax_total"></td>
|
45
45
|
</tr>
|
46
46
|
<tr>
|
@@ -53,7 +53,7 @@
|
|
53
53
|
<tr id="<%= "#{k}_row" %>" style="display:none;">
|
54
54
|
<td colspan="<%= page == "cart" ? "3" : "2" %>"></td>
|
55
55
|
<td><%= v[:display_in_cart] %></td>
|
56
|
-
<td class="extra_totals" id="<%= k %>_total">$0.00</td>
|
56
|
+
<td class="extra_totals <%= 'reduce_tax_subtotal' if v.has_key?(:reduce_tax_subtotal) && v[:reduce_tax_subtotal] %>" id="<%= k %>_total">$0.00</td>
|
57
57
|
</tr>
|
58
58
|
<% end -%>
|
59
59
|
<% end -%>
|
@@ -7,12 +7,11 @@ Phone: <%= @order.phone %>
|
|
7
7
|
<%= line_item.quantity %> x <%= raw line_item.description %> (<%= number_to_currency line_item.price %>)
|
8
8
|
<% end -%>
|
9
9
|
|
10
|
-
|
11
|
-
|
12
|
-
|
10
|
+
<% Piggybak::LineItem.sorted_line_item_types.each do |type| -%>
|
11
|
+
<%= type.to_s.pluralize.titleize %>: <%= number_to_currency @order.send("#{type}_charge") %>
|
12
|
+
<% end -%>
|
13
|
+
|
13
14
|
Total: <%= number_to_currency @order.total %>
|
14
|
-
Less Payment: <%= number_to_currency(@order.line_items.payments.inject(0) { |total, p| total + p.price if p.payment.status == "paid" }) %>
|
15
|
-
Adjustments: <%= number_to_currency(@order.line_items.adjustments.inject(0) { |total, adj| total + adj.price }) %>
|
16
15
|
Balance Due: <%= number_to_currency @order.total_due %>
|
17
16
|
|
18
17
|
Billing Information
|
data/lib/piggybak.rb
CHANGED
@@ -82,7 +82,7 @@ module Piggybak
|
|
82
82
|
# e.g. self.line_items.sellables
|
83
83
|
# e.g. self.line_items.taxes
|
84
84
|
define_method "#{k.to_s.pluralize}" do
|
85
|
-
proxy_association.proxy.select { |li| li.line_item_type == "#{k}"
|
85
|
+
proxy_association.proxy.select { |li| li.line_item_type == "#{k}" && !li.marked_for_destruction? }
|
86
86
|
end
|
87
87
|
end
|
88
88
|
end
|
data/lib/piggybak/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: piggybak
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.6.
|
4
|
+
version: 0.6.23
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -11,7 +11,7 @@ authors:
|
|
11
11
|
autorequire:
|
12
12
|
bindir: bin
|
13
13
|
cert_chain: []
|
14
|
-
date: 2012-11-
|
14
|
+
date: 2012-11-16 00:00:00.000000000 Z
|
15
15
|
dependencies:
|
16
16
|
- !ruby/object:Gem::Dependency
|
17
17
|
name: rails
|
@@ -234,7 +234,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
234
234
|
version: '0'
|
235
235
|
segments:
|
236
236
|
- 0
|
237
|
-
hash: -
|
237
|
+
hash: -2079213283630134630
|
238
238
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
239
239
|
none: false
|
240
240
|
requirements:
|
@@ -243,7 +243,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
243
243
|
version: '0'
|
244
244
|
segments:
|
245
245
|
- 0
|
246
|
-
hash: -
|
246
|
+
hash: -2079213283630134630
|
247
247
|
requirements: []
|
248
248
|
rubyforge_project:
|
249
249
|
rubygems_version: 1.8.23
|