effective_orders 1.1.2 → 1.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/models/effective/order.rb +12 -0
- data/app/views/effective/orders/_order_items.html.haml +20 -19
- data/app/views/effective/orders/_order_shipping.html.haml +11 -8
- data/app/views/effective/orders/moneris/_form.html.haml +6 -1
- data/lib/effective_orders/version.rb +1 -1
- data/lib/generators/templates/effective_orders.rb +4 -2
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c7ae38c1740cd0fbe0188bb662c302c209218bcf
|
4
|
+
data.tar.gz: 8bc72c28a5cd18d2437068c3b43f2670ba74d140
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ef0673ac7015c222e065432e5bd167ab759107369127a06e5816ead520293a8292affa9189a5ec637a370764cae5b6bf90e6b0990bc3101e2b2c790ead13b6ed
|
7
|
+
data.tar.gz: dadf0b8b6ccc382db5c4bcfe9f89989566d46cae4e926fa1914125de8a1cdbccbb55fa8398e901fcfc2becd4c9f4549c6203db6db9be0976ba9045073926552d
|
@@ -157,6 +157,18 @@ module Effective
|
|
157
157
|
end
|
158
158
|
end
|
159
159
|
|
160
|
+
def billing_name
|
161
|
+
if billing_address.try(:full_name).present?
|
162
|
+
billing_address.full_name
|
163
|
+
elsif user.to_s.start_with?('#<User:') == false
|
164
|
+
user.to_s
|
165
|
+
elsif user.respond_to?(:first_name) && user.respond_to?(:last_name)
|
166
|
+
user.first_name.to_s + ' ' + user.last_name.to_s
|
167
|
+
elsif user.respond_to?(:full_name)
|
168
|
+
user.full_name.to_s
|
169
|
+
end
|
170
|
+
end
|
171
|
+
|
160
172
|
# :validate => false, :email => false
|
161
173
|
def purchase!(payment_details = nil, opts = {})
|
162
174
|
opts = {:validate => true, :email => true}.merge(opts)
|
@@ -1,39 +1,40 @@
|
|
1
|
+
- include_download_column = order.purchased? && order.order_items.any? { |order_item| order_item.purchased_download_url.present? rescue false }
|
2
|
+
|
1
3
|
.effective-order
|
2
|
-
%table.table
|
3
|
-
|
4
|
+
%table.table{:style => 'width: 600px;margin-bottom:25px;'}
|
5
|
+
|
4
6
|
%thead
|
5
7
|
%tr
|
6
|
-
%th.quantity
|
7
|
-
%th.item Item
|
8
|
+
%th.quantity{:style => 'text-align: left;'} Qty
|
9
|
+
%th.item{:style => 'text-align: left;'} Item
|
8
10
|
- if include_download_column
|
9
|
-
%th.download Download
|
10
|
-
%th.price Price
|
11
|
+
%th.download{:style => 'text-align: left;'} Download
|
12
|
+
%th.price{:style => 'text-align: right;'} Price
|
13
|
+
|
11
14
|
%tbody
|
12
15
|
- order.order_items.each do |item|
|
13
16
|
%tr
|
14
|
-
%td.quantity
|
15
|
-
|
16
|
-
%td.item
|
17
|
+
%td.quantity{:style => 'text-align: left;'}= item.quantity
|
18
|
+
%td.item{:style => 'text-align: left;'}
|
17
19
|
= item.title.html_safe
|
18
20
|
- if order.new_record? && item.purchasable.kind_of?(Effective::Subscription)
|
19
21
|
= render :partial => 'effective/orders/stripe/subscription_fields', :locals => {:form => form, :subscription => item.purchasable }
|
20
22
|
|
21
23
|
- if include_download_column
|
22
|
-
%td.download
|
24
|
+
%td.download{:style => 'text-align: left;'}
|
23
25
|
- if item.purchased? && (item.purchased_download_url rescue nil).present?
|
24
26
|
= link_to 'download', item.purchased_download_url
|
25
27
|
- else
|
26
28
|
= '-'
|
27
|
-
%td.price
|
28
|
-
|
29
|
+
%td.price{:style => 'text-align: right;'}= price_to_currency(item.subtotal)
|
30
|
+
|
29
31
|
%tfoot
|
30
32
|
%tr
|
31
|
-
%th{:colspan => (include_download_column ? 3 : 2)} Subtotal
|
32
|
-
%td.price= price_to_currency(order.subtotal)
|
33
|
+
%th{:style => 'text-align: right;', :colspan => (include_download_column ? 3 : 2)} Subtotal
|
34
|
+
%td.price{:style => 'text-align: right;'}= price_to_currency(order.subtotal)
|
33
35
|
%tr
|
34
|
-
%th{:colspan => (include_download_column ? 3 : 2)} Tax
|
35
|
-
%td.price= price_to_currency(order.tax)
|
36
|
+
%th{:style => 'text-align: right;', :colspan => (include_download_column ? 3 : 2)} Tax
|
37
|
+
%td.price{:style => 'text-align: right;'}= price_to_currency(order.tax)
|
36
38
|
%tr
|
37
|
-
%th{:colspan => (include_download_column ? 3 : 2)} Total Due
|
38
|
-
%td.price= price_to_currency(order.total)
|
39
|
-
|
39
|
+
%th{:style => 'text-align: right;', :colspan => (include_download_column ? 3 : 2)} Total Due
|
40
|
+
%td.price{:style => 'text-align: right;'}= price_to_currency(order.total)
|
@@ -1,19 +1,22 @@
|
|
1
|
-
%table.table
|
1
|
+
%table.table{:style => 'width: 600px;margin-bottom:25px;'}
|
2
2
|
%thead
|
3
3
|
%tr
|
4
|
-
%th= "#{order.purchased? ? 'Sold
|
4
|
+
%th{:style => 'text-align: left;'}= "#{order.purchased? ? 'Sold to' : 'Bill to'}"
|
5
5
|
- if EffectiveOrders.require_shipping_address && order.shipping_address.present?
|
6
|
-
%th Ship
|
6
|
+
%th{:style => 'text-align: left;'} Ship to
|
7
|
+
|
7
8
|
%tbody
|
8
9
|
%tr
|
9
|
-
%td
|
10
|
-
- if order.
|
11
|
-
= order.
|
10
|
+
%td{:style => 'text-align: left;'}
|
11
|
+
- if order.billing_name.present? && EffectiveAddresses.use_full_name == false
|
12
|
+
= order.billing_name
|
12
13
|
%br
|
13
14
|
= mail_to order.user.email
|
14
|
-
|
15
|
+
|
15
16
|
- if order.billing_address.present?
|
17
|
+
%br
|
16
18
|
= render :partial => 'effective/addresses/address', :locals => {:address => order.billing_address}
|
19
|
+
|
17
20
|
- if EffectiveOrders.require_shipping_address && order.shipping_address.present?
|
18
|
-
%td
|
21
|
+
%td{:style => 'text-align: left;'}
|
19
22
|
= render :partial => 'effective/addresses/address', :locals => {:address => order.shipping_address}
|
@@ -12,7 +12,12 @@
|
|
12
12
|
|
13
13
|
= hidden_field_tag(:email, order.user.try(:email))
|
14
14
|
= hidden_field_tag(:cust_id, order.user.to_param)
|
15
|
-
|
15
|
+
|
16
|
+
- moneris_order_id = "#{order.to_param.to_i + EffectiveOrders.moneris[:order_nudge].to_i}"
|
17
|
+
- if EffectiveOrders.moneris[:include_billing_name_in_order_id] == true
|
18
|
+
- moneris_order_id = moneris_order_id + '-' + order.billing_name.parameterize
|
19
|
+
|
20
|
+
= hidden_field_tag(:order_id, moneris_order_id)
|
16
21
|
= hidden_field_tag(:gst, '%.2f' % (order.tax / 100.0))
|
17
22
|
= hidden_field_tag(:charge_total, '%.2f' % (order.total / 100.0))
|
18
23
|
|
@@ -143,7 +143,8 @@ EffectiveOrders.setup do |config|
|
|
143
143
|
:hpp_key => '',
|
144
144
|
:hpp_url => 'https://www3.moneris.com/HPPDP/index.php',
|
145
145
|
:verify_url => 'https://www3.moneris.com/HPPDP/verifyTxn.php',
|
146
|
-
:order_nudge => 0
|
146
|
+
:order_nudge => 0,
|
147
|
+
:include_billing_name_in_order_id => false
|
147
148
|
}
|
148
149
|
else
|
149
150
|
config.moneris = {
|
@@ -151,7 +152,8 @@ EffectiveOrders.setup do |config|
|
|
151
152
|
:hpp_key => '',
|
152
153
|
:hpp_url => 'https://esqa.moneris.com/HPPDP/index.php',
|
153
154
|
:verify_url => 'https://esqa.moneris.com/HPPDP/verifyTxn.php',
|
154
|
-
:order_nudge => 0
|
155
|
+
:order_nudge => 0,
|
156
|
+
:include_billing_name_in_order_id => false
|
155
157
|
}
|
156
158
|
end
|
157
159
|
|
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: 1.
|
4
|
+
version: 1.2.0
|
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: 2014-12-
|
11
|
+
date: 2014-12-22 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|