caboose-cms 0.5.144 → 0.5.145

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,15 +1,15 @@
1
1
  ---
2
2
  !binary "U0hBMQ==":
3
3
  metadata.gz: !binary |-
4
- ZTBkNjY5NmJkMWRmNjljM2I1NjU2NTFkNDZlN2IyZGIzZDg1YTgyNg==
4
+ Zjk4OTU1YWUyMzU5YmFiOWNjYzc3NTMyYThkOWFjMDcxYzNjYjBlOQ==
5
5
  data.tar.gz: !binary |-
6
- NDEwNmU1MjUwNjkxYTQ5NGYzOWUzYWE4YzNlZjliNjI2YjViODAxMw==
6
+ YWI0OTVkODQyOTY5Yjc0NmQzOGQyMzBlMTRlNGJiYTgzNTRjYWM5Mw==
7
7
  SHA512:
8
8
  metadata.gz: !binary |-
9
- ZDM3YWY0MGNjMmJhYThiMmRlNTlkZDAyOTk3ZTZkODdhODRjNzg3NTljNzli
10
- OWE0ODk5NzYyOTU3NTA4YzFlZTQyYTg1NDk4ODdhN2JjMzgyMjJhMzI2NWVm
11
- Mzg3OWFmOTY4MzllYmRhYTdiNTJkMDU3MDk5ODFlOTlkNjdlZTE=
9
+ YTE1OTI2ZGQ5MzIyMmIwOTBiNGRmMDJkZjdkMjBhZjUwMDczYmFjYTcwYjJl
10
+ MjMwMWRiY2Y1OGYzZTM4MjQ0MThlYTg0NGIyMTM0NjI1YmQ2ZjI1NTk2ZDU5
11
+ OTEyYTg2ZmQzOGE3OTRmYWVjMjU5ODMzOTU5MGVhN2QxMmY5ODc=
12
12
  data.tar.gz: !binary |-
13
- NjI1MWEwNDRmOTU2NDYwYTg0YWJjYzJmMTBmNmU2NWM2NzM3MzJhNWUzNjRh
14
- NWMyMTM5NGI3YTA5MTBjMDMyNmJhNmUzYWJkNzYzMGU1OGQzNjVkZmMxYTE2
15
- YTVlZDBjMjQ0NjM1OTU4ZjQ0YjU0YTZjNTVlZDc0Zjk2MjE1OWM=
13
+ MmQwZjQ1MTA2YTQ4ZGFmOWI0MjFjZDZlMTA0NGUyYTcwMWNmYjI4NWVkYjg4
14
+ NTIyNmYxYjNkMjBkNTBmMzJkYWRmZjhhNzlkOWQ4NzBlOTU4MjI0ZWJmZGMx
15
+ MTc1YTk5YzI3ZTE1NTljOGJiOWZlNmVjMjAxODQ5MzcxMjhkYTI=
@@ -62,10 +62,10 @@ module Caboose
62
62
  def capture_funds
63
63
  return if !user_is_allowed('orders', 'edit')
64
64
 
65
- response = Caboose::StdClass.new
65
+ resp = Caboose::StdClass.new
66
66
  order = Order.find(params[:id])
67
67
  t = OrderTransaction.where(:order_id => order.id, :transaction_type => OrderTransaction::TYPE_AUTHORIZE, :success => true).first
68
-
68
+
69
69
  if order.financial_status == Order::FINANCIAL_STATUS_CAPTURED
70
70
  resp.error = "Funds for this order have already been captured."
71
71
  elsif order.total > t.amount
@@ -87,6 +87,20 @@ module Caboose
87
87
  )
88
88
  order.update_attribute(:financial_status, Order::FINANCIAL_STATUS_CAPTURED)
89
89
  resp.success = 'Captured funds successfully'
90
+
91
+ Caboose.log(response.inspect)
92
+
93
+ ot = Caboose::OrderTransaction.new(
94
+ :order_id => order.id,
95
+ :date_processed => DateTime.now.utc,
96
+ :transaction_type => Caboose::OrderTransaction::TYPE_CAPTURE
97
+ )
98
+ ot.success = response.success?
99
+ ot.transaction_id = response.transaction_id
100
+ ot.response_code = response.response_code
101
+ ot.amount = order.total
102
+ ot.save
103
+
90
104
  when 'payscape'
91
105
  # TODO: Implement capture funds for payscape
92
106
 
@@ -3,81 +3,240 @@ require 'prawn'
3
3
  module Caboose
4
4
  class PendingOrdersPdf < Prawn::Document
5
5
 
6
- attr_accessor :orders
7
- attr_accessor :order
6
+ attr_accessor :orders, :card_type, :card_number
8
7
 
9
8
  def to_pdf
10
- #image open("https://dmwwflw4i3miv.cloudfront.net/logo.png"), :position => :center
11
- text " "
12
- self.orders.each_with_index do |o, i|
13
- start_new_page if i > 0
14
- self.order = o
15
- customer_info
16
- text " "
17
- order_table
18
- end
9
+
10
+ # Get the type of card and last four digits
11
+
12
+ orders.each_with_index do |o,index|
13
+ get_card_details(o)
14
+ font_size 9
15
+ move_down 10
16
+ order_info(o)
17
+ move_down 15
18
+ order_table(o)
19
+ move_down 15
20
+ customer_info(o)
21
+ move_down 15
22
+ payment_info(o)
23
+ if index + 1 < orders.count then start_new_page end
24
+ end
25
+
19
26
  render
20
27
  end
21
28
 
22
- def customer_info
23
-
24
- order_info = "Order ##{self.order.id}\n"
25
- order_info << "Status: #{self.order.status.capitalize}\n"
26
- order_info << "Received: #{self.order.date_created ? self.order.date_created.strftime("%m/%d/%Y") : ''}\n"
27
- if order.status == 'shipped' && self.order.date_shipped
28
- order_info << "Shipped: #{self.order.date_shipped.strftime("%m/%d/%Y")}"
29
+ def formatted_phone(str)
30
+ return '' if str.nil?
31
+ str = str.gsub(/[^0-9]/i, '')
32
+ return "#{str[0]} (#{str[1..3]}) #{str[4..6]}-#{str[7..10]}" if str.length == 11
33
+ return "(#{str[0..2]}) #{str[3..5]}-#{str[6..9]}" if str.length == 10
34
+ return "#{str[0..2]}-#{str[3..6]}" if str.length == 7
35
+ return str
36
+ end
37
+
38
+ def get_card_details(order)
39
+ sc = order.site.store_config
40
+ ot = order.order_transactions.where(:transaction_type => OrderTransaction::TYPE_AUTHORIZE, :success => true).first
41
+ case sc.pp_name
42
+ when 'authorize.net'
43
+ t = AuthorizeNet::Reporting::Transaction.new(sc.pp_username, sc.pp_password)
44
+ resp = t.get_transaction_details(ot.transaction_id)
45
+ t2 = resp.transaction
46
+ self.card_type = t2.payment_method.card_type.upcase
47
+ self.card_number = t2.payment_method.card_number.gsub('X', '')
29
48
  end
49
+ end
50
+
51
+ def order_info(order)
52
+ order_info = "Order Number: #{order.id}\n"
53
+ order_info << "Order Date: #{order.date_created.strftime('%d %b %Y %H:%M:%S %p')}\n"
54
+ order_info << "Status: #{order.status.capitalize}\n"
55
+ tbl = []
56
+ tbl << [
57
+ { :content => order_info }
58
+ ]
59
+ move_down 4
60
+ table tbl, :position => 7, :width => 530
61
+ end
62
+
63
+
64
+ def customer_info(order)
65
+ c = order.customer
66
+ ba = order.billing_address
67
+ billed_to = []
68
+ billed_to << [
69
+ { :content => "Name", :border_width => 0 },
70
+ { :content => "#{ba.first_name} #{ba.last_name}", :border_width => 0}
71
+ ]
72
+ billed_to << [
73
+ { :content => "Address", :border_width => 0 },
74
+ { :content => "#{ba.address1}" + (ba.address2.blank? ? '' : "\n#{ba.address2}") + "\n#{ba.city}, #{ba.state} #{ba.zip}", :border_width => 0}
75
+ ]
76
+ billed_to << [
77
+ { :content => "Email", :border_width => 0 },
78
+ { :content => "#{c.email}", :border_width => 0}
79
+ ]
80
+ billed_to << [
81
+ { :content => "Phone", :border_width => 0 },
82
+ { :content => "#{self.formatted_phone(c.phone)}", :border_width => 0}
83
+ ]
30
84
 
31
- c = self.order.customer
32
- billed_to = c ? "#{c.first_name} #{c.last_name}\n#{c.email}\n#{c.phone}" : ''
33
-
34
- sa = self.order.shipping_address
35
- shipped_to = "#{sa.name}\n#{sa.address1}\n"
36
- shipped_to << "#{sa.address2}\n" if sa.address2 && sa.address2.strip.length > 0
37
- shipped_to << "#{sa.city}, #{sa.state} #{sa.zip}"
38
-
85
+ sa = order.shipping_address
86
+ shipped_to = []
87
+ shipped_to << [
88
+ { :content => "Name", :border_width => 0 },
89
+ { :content => "#{sa.first_name} #{sa.last_name}", :border_width => 0}
90
+ ]
91
+ shipped_to << [
92
+ { :content => "Address", :border_width => 0 },
93
+ { :content => "#{sa.address1}" + (sa.address2.blank? ? '' : "\n#{sa.address2}") + "\n#{sa.city}, #{sa.state} #{sa.zip}", :border_width => 0}
94
+ ]
95
+ shipped_to << [
96
+ { :content => "Email", :border_width => 0 },
97
+ { :content => "#{c.email}", :border_width => 0}
98
+ ]
99
+ shipped_to << [
100
+ { :content => "Phone", :border_width => 0 },
101
+ { :content => "#{self.formatted_phone(c.phone)}", :border_width => 0}
102
+ ]
103
+
39
104
  tbl = []
40
105
  tbl << [
41
- { :content => "Order Info" , :align => :center, :valign => :bottom, :width => 180 },
42
- { :content => "Billed To" , :align => :center, :valign => :bottom, :width => 180 },
43
- { :content => "Shipped To" , :align => :center, :valign => :bottom, :width => 180 }
106
+ { :content => "Shipping Information" , :align => :left, :width => 255, :font_style => :bold },
107
+ { :content => "Billing Information" , :align => :left, :width => 255, :font_style => :bold }
44
108
  ]
45
109
  tbl << [
46
- { :content => order_info, :valign => :top, :height => 75 },
47
- { :content => billed_to , :valign => :top, :height => 75 },
48
- { :content => shipped_to, :valign => :top, :height => 75 }
49
- ]
50
- table tbl
110
+ { :content => shipped_to },
111
+ { :content => billed_to }
112
+ ]
113
+ move_down 4
114
+ table tbl, :position => 7, :width => 530
51
115
 
52
116
  end
53
117
 
54
- def order_table
118
+ def order_table(order)
55
119
 
56
120
  tbl = []
57
121
  tbl << [
58
- { :content => "Item" , :align => :center, :valign => :bottom },
59
- { :content => "Tracking Number" , :align => :center, :valign => :bottom },
60
- { :content => "Unit Price" , :align => :center, :valign => :bottom },
61
- { :content => "Quantity" , :align => :center, :valign => :bottom },
62
- { :content => "Subtotal" , :align => :center, :valign => :bottom, :width => 60 }
122
+ { :content => "Package" , :align => :left, :valign => :bottom },
123
+ { :content => "Product" , :align => :left, :valign => :bottom, :colspan => 2 },
124
+ { :content => "Attributes" , :align => :left, :valign => :bottom },
125
+ { :content => "Quantity" , :align => :right, :valign => :bottom },
126
+ { :content => "Price" , :align => :right, :valign => :bottom },
127
+ { :content => "Amount" , :align => :right, :valign => :bottom }
63
128
  ]
129
+
130
+ order.calculate
64
131
 
65
- order.line_items.each do |li|
66
- tbl << [
67
- "#{li.variant.product.title}\n#{li.variant.sku}\n#{li.variant.title}",
68
- { :content => li.tracking_number },
69
- { :content => sprintf("%.2f", li.unit_price) , :align => :right },
70
- { :content => "#{li.quantity}" , :align => :right },
71
- { :content => sprintf("%.2f", li.subtotal) , :align => :right }
72
- ]
73
- end
74
- tbl << [{ :content => "Subtotal" , :colspan => 4, :align => :right }, { :content => sprintf("%.2f", order.subtotal ) , :align => :right }]
75
- tbl << [{ :content => "Tax" , :colspan => 4, :align => :right }, { :content => sprintf("%.2f", order.tax ? order.tax : 0.0 ) , :align => :right }]
76
- #tbl << [{ :content => "#{order.shipping_method} Shipping & Handling" , :colspan => 4, :align => :right }, { :content => sprintf("%.2f", order.shipping_and_handling ) , :align => :right }]
77
- tbl << [{ :content => "Discount" , :colspan => 4, :align => :right }, { :content => sprintf("%.2f", order.discount ? order.discount : 0.0 ) , :align => :right }]
78
- tbl << [{ :content => "Total" , :colspan => 4, :align => :right }, { :content => sprintf("%.2f", order.total ) , :align => :right }]
132
+ order.order_packages.all.each do |pk|
133
+
134
+ carrier = pk.shipping_method.carrier
135
+ service = pk.shipping_method.service_name
136
+ package = pk.shipping_package.name
137
+
138
+ pk.line_items.each_with_index do |li, index|
139
+ options = ''
140
+ if li.variant.product.option1 && li.variant.option1 then options += li.variant.product.option1 + ": " + li.variant.option1 + "\n" end
141
+ if li.variant.product.option2 && li.variant.option2 then options += li.variant.product.option2 + ": " + li.variant.option2 + "\n" end
142
+ if li.variant.product.option3 && li.variant.option3 then options += li.variant.product.option3 + ": " + li.variant.option3 + "\n" end
143
+ if li.variant.product.product_images.count > 0
144
+ image = open("#{li.variant.product.product_images.first.url(:tiny)}")
145
+ else
146
+ image = ""
147
+ end
148
+ arr = []
149
+ if index == 0
150
+ arr << { :content => package + "\n" + carrier + "\n" + service, :width => 115, :rowspan => (index == 0 ? pk.line_items.count : 1) }
151
+ end
152
+
153
+ arr << { :image => image, :fit => [40, 40], :borders => [:top, :bottom, :left], :width => 50 }
154
+ arr << { :content => "#{li.variant.product.title}\n#{li.variant.sku}", :borders => [:top, :right, :bottom], :width => 100 }
155
+ arr << { :content => options }
156
+ arr << { :content => "#{li.quantity}" , :align => :right }
157
+ arr << { :content => "$" + sprintf("%.2f", li.unit_price) , :align => :right }
158
+ arr << { :content => "$" + sprintf("%.2f", li.subtotal) , :align => :right }
159
+
160
+ tbl << arr
161
+
162
+ end
163
+ end
164
+
165
+ unassigned = order.line_items.where("order_package_id IS NULL OR order_package_id = ?",-1)
166
+ unassigned.each_with_index do |li, index|
167
+ options = ''
168
+ if li.variant.product.option1 && li.variant.option1 then options += li.variant.product.option1 + ": " + li.variant.option1 + "\n" end
169
+ if li.variant.product.option2 && li.variant.option2 then options += li.variant.product.option2 + ": " + li.variant.option2 + "\n" end
170
+ if li.variant.product.option3 && li.variant.option3 then options += li.variant.product.option3 + ": " + li.variant.option3 + "\n" end
171
+ if li.variant.product.product_images.count > 0
172
+ image = open("#{li.variant.product.product_images.first.url(:tiny)}")
173
+ else
174
+ image = ""
175
+ end
176
+ arr = []
177
+ if index == 0
178
+ arr << { :content => "Unassigned", :width => 115, :rowspan => (index == 0 ? unassigned.count : 1) }
179
+ end
180
+ arr << { :image => image, :fit => [40, 40], :borders => [:top, :bottom, :left], :width => 50 }
181
+ arr << { :content => "#{li.variant.product.title}\n#{li.variant.sku}", :borders => [:top, :right, :bottom], :width => 100 }
182
+ arr << { :content => options }
183
+ arr << { :content => "#{li.quantity}" , :align => :right }
184
+ arr << { :content => "$" + sprintf("%.2f", li.price) , :align => :right }
185
+ arr << { :content => "$" + sprintf("%.2f", li.subtotal) , :align => :right }
186
+ tbl << arr
187
+ end
188
+
189
+ tbl << [{ :content => "Subtotal" , :colspan => 6, :align => :right }, { :content => "$" + sprintf("%.2f", order.subtotal ) , :align => :right }]
190
+ tbl << [{ :content => "Discount" , :colspan => 6, :align => :right }, { :content => "(-) $" + sprintf("%.2f", order.discount ? order.discount : 0.0 ) , :align => :right }]
191
+ tbl << [{ :content => "Shipping and Handling Charges" , :colspan => 6, :align => :right }, { :content => "(+) $" + sprintf("%.2f", order.shipping_and_handling ) , :align => :right }]
192
+ tbl << [{ :content => "Sales Tax" , :colspan => 6, :align => :right }, { :content => "(+) $" + sprintf("%.2f", order.tax ? order.tax : 0.0 ) , :align => :right }]
193
+ tbl << [{ :content => "Grand Total" , :colspan => 6, :align => :right, :font_style => :bold }, { :content => "$" + sprintf("%.2f", order.total ) , :align => :right, :font_style => :bold }]
79
194
 
80
- table tbl
195
+ table tbl , :position => 7, :width => 530
196
+ end
197
+
198
+ def payment_info(order)
199
+
200
+ trans = order.order_transactions.where(:transaction_type => OrderTransaction::TYPE_AUTHORIZE, :success => true).first
201
+ tbl = []
202
+ tbl2 = []
203
+ tbl3 = []
204
+
205
+ tbl2 << [
206
+ { :content => "Card Type", :width => 127, :border_width => 0 },
207
+ { :content => self.card_type, :width => 128, :border_width => 0 }
208
+ ]
209
+ tbl2 << [
210
+ { :content => "Transaction ID", :width => 127, :border_width => 0 },
211
+ { :content => trans.transaction_id.to_s, :width => 128, :border_width => 0 }
212
+ ]
213
+ tbl2 << [
214
+ { :content => "Gateway Response", :width => 127, :border_width => 0},
215
+ { :content => trans.response_code.to_s, :width => 128, :border_width => 0 }
216
+ ]
217
+ tbl3 << [
218
+ { :content => "Card Number", :width => 127, :border_width => 0},
219
+ { :content => "XXXX XXXX XXXX " + self.card_number, :width => 128, :border_width => 0 }
220
+ ]
221
+ tbl3 << [
222
+ { :content => "Transaction Time", :width => 127, :border_width => 0},
223
+ { :content => trans.date_processed.strftime("%d %b %Y %H:%M:%S %p"), :width => 128, :border_width => 0 }
224
+ ]
225
+ tbl3 << [
226
+ { :content => "Payment Process", :width => 127, :border_width => 0},
227
+ { :content => trans.success ? "Successful" : "Failed", :width => 128, :border_width => 0 }
228
+ ]
229
+ tbl << [
230
+ { :content => "Authorization Details", :colspan => 2, :font_style => :bold }
231
+ ]
232
+ tbl << [
233
+ { :content => tbl2, :width => 255 },
234
+ { :content => tbl3, :width => 255 }
235
+ ]
236
+
237
+ table tbl, :position => 7, :width => 530
238
+
81
239
  end
240
+
82
241
  end
83
242
  end
@@ -2,11 +2,11 @@
2
2
 
3
3
  <h1>Thank you for your order!</h1>
4
4
 
5
- <p>Order #<%= @order.order_number %></p>
6
-
7
5
  <h2>Order Details</h2>
8
6
 
9
- <table>
7
+ <p>Order #<%= @order.order_number %></p>
8
+
9
+ <table border='1' style='border-collapse: collapse;'>
10
10
  <tr>
11
11
  <th>Package</th>
12
12
  <th>Line Item</th>
@@ -55,21 +55,21 @@
55
55
  <td align='right'><%= number_to_currency(li.subtotal) %></td>
56
56
  </tr>
57
57
  <% end %>
58
- <tr><td colspan="4">Subtotal: </td><td><%= number_to_currency(@order.subtotal) %></td></tr>
59
- <tr><td colspan="4">Tax: </td><td><%= number_to_currency(@order.tax) %></td></tr>
60
- <tr><td colspan="4">Shipping and Handling: </td><td><%= number_to_currency(@order.shipping + @order.handling) %></td></tr>
58
+ <tr><td colspan="4" align='right'>Subtotal: </td><td align='right'><%= number_to_currency(@order.subtotal) %></td></tr>
59
+ <tr><td colspan="4" align='right'>Tax: </td><td align='right'><%= number_to_currency(@order.tax) %></td></tr>
60
+ <tr><td colspan="4" align='right'>Shipping and Handling: </td><td align='right'><%= number_to_currency(@order.shipping + @order.handling) %></td></tr>
61
61
  <% if @order.gift_wrap && @order.gift_wrap > 0 %>
62
- <tr><td colspan="4">Gift wrap: </td><td><%= number_to_currency(@order.gift_wrap) %></td></tr>
62
+ <tr><td colspan="4" align='right'>Gift wrap: </td><td align='right'><%= number_to_currency(@order.gift_wrap) %></td></tr>
63
63
  <% end %>
64
64
  <% if @order.discounts %>
65
65
  <% @order.discounts.each do |d| %>
66
- <tr><td colspan="4">"<%= d.gift_card.code %>" gift card: </td><td><%= number_to_currency(d.amount) %></td></tr>
66
+ <tr><td colspan="4" align='right'>"<%= d.gift_card.code %>" gift card: </td><td align='right'><%= number_to_currency(d.amount) %></td></tr>
67
67
  <% end %>
68
68
  <% end %>
69
69
  <% if @order.custom_discount %>
70
- <tr><td colspan="4">Discount: </td><td><%= number_to_currency(@order.custom_discount) %></td></tr>
70
+ <tr><td colspan="4" align='right'>Discount: </td><td align='right'><%= number_to_currency(@order.custom_discount) %></td></tr>
71
71
  <% end %>
72
- <tr><td colspan="4">Total: </td><td><%= number_to_currency(@order.total) %></td></tr>
72
+ <tr><td colspan="4" align='right'>Total: </td><td align='right'><%= number_to_currency(@order.total) %></td></tr>
73
73
  </table>
74
74
 
75
75
  <% if @order.shipping_address %>
@@ -78,7 +78,7 @@
78
78
  <p>
79
79
  <%= sa.first_name %> <%= sa.last_name %><br />
80
80
  <%= sa.address1 %><br />
81
- <% if sa.address2 %><%= sa.address2 %><br /><% end %>
81
+ <% if sa.address2 && sa.address2.strip.length > 0 %><%= sa.address2 %><br /><% end %>
82
82
  <%= sa.city %>, <%= sa.state %> <%= sa.zip %>
83
83
  </p>
84
84
  <% end %>
@@ -89,7 +89,7 @@
89
89
  <p>
90
90
  <%= ba.first_name %> <%= ba.last_name %><br />
91
91
  <%= ba.address1 %><br />
92
- <% if ba.address2 %><%= ba.address2 %><br /><% end %>
92
+ <% if ba.address2 && ba.address2.strip.length > 0 %><%= ba.address2 %><br /><% end %>
93
93
  <%= ba.city %>, <%= ba.state %> <%= ba.zip %>
94
94
  </p>
95
95
  <% end %>
@@ -1 +1,96 @@
1
- <h1>Your order has been udpated</h1>
1
+ <p><img src='<%= @order.site.logo.url(:thumb) %>' /></p>
2
+
3
+ <h1>Your order has been updated</h1>
4
+
5
+ <h2>Order Details</h2>
6
+
7
+ <p>Order #<%= @order.order_number %></p>
8
+
9
+ <table border='1' style='border-collapse: collapse;'>
10
+ <tr>
11
+ <th>Package</th>
12
+ <th>Line Item</th>
13
+ <th>Unit Price</th>
14
+ <th>Quantity</th>
15
+ <th>Subtotal</th>
16
+ </tr>
17
+ <% @order.order_packages.each do |op| %>
18
+ <% op.line_items.each_with_index do |li, i| %>
19
+ <% v = li.variant %>
20
+ <% p = v.product %>
21
+ <tr>
22
+ <% if i == 0 %>
23
+ <td rowspan="<%= op.line_items.count %>">
24
+ <div><%= op.shipping_method.service_name %></div>
25
+ <div><%= op.status %></div>
26
+ <% if op.tracking_number %><div><%= op.tracking_number %></div><% end %>
27
+ </td>
28
+ <% end %>
29
+ <td>
30
+ <%= p.title %>
31
+ <% if li.is_gift %>
32
+ <p>This item is a gift.</p>
33
+ <ul>
34
+ <li><% if li.gift_wrap %>Gift wrap (<%= number_to_currency(p.gift_wrap_price) %>)<% else %>Do not gift wrap<% end %></li>
35
+ <li><% if li.include_gift_message %>Gift message: <%= li.gift_message %><% else %>No gift message<% end %></li>
36
+ <li><% if li.hide_prices %>Hide all prices<% else %>Show all prices<% end %></li>
37
+ </ul>
38
+ <% end %>
39
+ </td>
40
+ <td align='right'><%= number_to_currency(li.unit_price) %></td>
41
+ <td align='right'><%= li.quantity %></td>
42
+ <td align='right'><%= number_to_currency(li.subtotal) %></td>
43
+ </tr>
44
+ <% end %>
45
+ <% end %>
46
+ <% @order.line_items.each do |li| %>
47
+ <% next if li.order_package_id %>
48
+ <% v = li.variant %>
49
+ <% p = v.product %>
50
+ <tr>
51
+ <td>Not assigned to a package</td>
52
+ <td><%= p.title %></td></td>
53
+ <td align='right'><%= number_to_currency(li.unit_price) %></td>
54
+ <td align='right'><%= li.quantity %></td>
55
+ <td align='right'><%= number_to_currency(li.subtotal) %></td>
56
+ </tr>
57
+ <% end %>
58
+ <tr><td colspan="4" align='right'>Subtotal: </td><td align='right'><%= number_to_currency(@order.subtotal) %></td></tr>
59
+ <tr><td colspan="4" align='right'>Tax: </td><td align='right'><%= number_to_currency(@order.tax) %></td></tr>
60
+ <tr><td colspan="4" align='right'>Shipping and Handling: </td><td align='right'><%= number_to_currency(@order.shipping + @order.handling) %></td></tr>
61
+ <% if @order.gift_wrap && @order.gift_wrap > 0 %>
62
+ <tr><td colspan="4" align='right'>Gift wrap: </td><td align='right'><%= number_to_currency(@order.gift_wrap) %></td></tr>
63
+ <% end %>
64
+ <% if @order.discounts %>
65
+ <% @order.discounts.each do |d| %>
66
+ <tr><td colspan="4" align='right'>"<%= d.gift_card.code %>" gift card: </td><td align='right'><%= number_to_currency(d.amount) %></td></tr>
67
+ <% end %>
68
+ <% end %>
69
+ <% if @order.custom_discount %>
70
+ <tr><td colspan="4" align='right'>Discount: </td><td align='right'><%= number_to_currency(@order.custom_discount) %></td></tr>
71
+ <% end %>
72
+ <tr><td colspan="4" align='right'>Total: </td><td align='right'><%= number_to_currency(@order.total) %></td></tr>
73
+ </table>
74
+
75
+ <% if @order.shipping_address %>
76
+ <% sa = @order.shipping_address %>
77
+ <h2>Shipping Address</h2>
78
+ <p>
79
+ <%= sa.first_name %> <%= sa.last_name %><br />
80
+ <%= sa.address1 %><br />
81
+ <% if sa.address2 && sa.address2.strip.length > 0 %><%= sa.address2 %><br /><% end %>
82
+ <%= sa.city %>, <%= sa.state %> <%= sa.zip %>
83
+ </p>
84
+ <% end %>
85
+
86
+ <% if @order.billing_address %>
87
+ <% ba = @order.billing_address %>
88
+ <h2>Billing Address</h2>
89
+ <p>
90
+ <%= ba.first_name %> <%= ba.last_name %><br />
91
+ <%= ba.address1 %><br />
92
+ <% if ba.address2 && ba.address2.strip.length > 0 %><%= ba.address2 %><br /><% end %>
93
+ <%= ba.city %>, <%= ba.state %> <%= ba.zip %>
94
+ </p>
95
+ <% end %>
96
+
@@ -1,3 +1,3 @@
1
1
  module Caboose
2
- VERSION = '0.5.144'
2
+ VERSION = '0.5.145'
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.5.144
4
+ version: 0.5.145
5
5
  platform: ruby
6
6
  authors:
7
7
  - William Barry