effective_orders 1.5.1 → 1.5.2

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: c1cf9baa9d485752d3758cd486c22451656851a9
4
- data.tar.gz: c4e7fae35b93f72319b7b525382c085272c8f016
3
+ metadata.gz: 68837d038f48f9503cb95b4975a88a85bf2bb5f4
4
+ data.tar.gz: dab5e51afb7ea037856bea992fea9ea0c9b8da73
5
5
  SHA512:
6
- metadata.gz: 406fb85de09e76af4dcbd5c3ef92d911f587a8bbdce2cefeb5f095ccf2f1e1341e2e7b716a21b4106c06baff89a5285281fcd407b4e381512acaa9c3ff2add5c
7
- data.tar.gz: dbff00b400518808d5071d166c8246a673fda871a71304e5ad16726e7402c355e77389a4965bc363b4cbc81715261c1efd9dc1cb6ea1887a1dbe50071f9e6d8b
6
+ metadata.gz: 1edcf64fe4df807a613887574d172fc86a713c03448ce9bf75d4dd82c63bce49154c7b44c056977d916a39493d1b04076d4323bed4e400716b92f485392c7f59
7
+ data.tar.gz: 6038dfad385dd638b9419bda5d851cd39f497a16d661111d8c8829b53cc80f8e3c0f0ae2f3d8ddfbf465d6d8fe7bb9f2692c9879ffbffb6e8d9e43e00aef5293
@@ -62,7 +62,7 @@ if defined?(ActiveAdmin)
62
62
  end
63
63
 
64
64
  collection_action :export_csv do
65
- @orders = Effective::Order.purchased
65
+ @orders = Effective::Order.purchased.includes(:addresses)
66
66
 
67
67
  col_headers = []
68
68
  col_headers << "Order ID"
@@ -81,9 +81,9 @@ if defined?(ActiveAdmin)
81
81
  row << order.to_param
82
82
  row << (order.billing_address.try(:full_name) || order.user.to_s)
83
83
  row << order.purchased_at.strftime("%Y-%m-%d %H:%M:%S %z")
84
- row << "%.2f" % order.subtotal
85
- row << "%.2f" % order.tax
86
- row << "%.2f" % order.total
84
+ row << (order.subtotal / 100.0).round(2)
85
+ row << (order.tax / 100.0).round(2)
86
+ row << (order.total / 100.0).round(2)
87
87
 
88
88
  csv << row
89
89
  end
@@ -1,7 +1,7 @@
1
1
  module Effective
2
2
  class CartsController < ApplicationController
3
3
  include EffectiveCartsHelper
4
- acts_as_active_admin_controller('carts') if EffectiveOrders.use_active_admin
4
+ acts_as_active_admin_controller('carts') if EffectiveOrders.use_active_admin?
5
5
 
6
6
  layout (EffectiveOrders.layout.kind_of?(Hash) ? EffectiveOrders.layout[:carts] : EffectiveOrders.layout)
7
7
 
@@ -1,7 +1,7 @@
1
1
  module Effective
2
2
  class OrdersController < ApplicationController
3
3
  include EffectiveCartsHelper
4
- acts_as_active_admin_controller('orders') if EffectiveOrders.use_active_admin
4
+ acts_as_active_admin_controller('orders') if EffectiveOrders.use_active_admin?
5
5
 
6
6
  include Providers::Moneris if EffectiveOrders.moneris_enabled
7
7
  include Providers::Paypal if EffectiveOrders.paypal_enabled
@@ -26,12 +26,22 @@
26
26
 
27
27
  - if order.billing_address.present?
28
28
  - address = order.billing_address
29
- = hidden_field_tag(:bill_first_name, address.first_name)
30
- = hidden_field_tag(:bill_last_name, address.last_name)
29
+ = hidden_field_tag(:bill_first_name, address.first_name || order.try(:user).try(:first_name))
30
+ = hidden_field_tag(:bill_last_name, address.last_name || order.try(:user).try(:last_name))
31
31
  = hidden_field_tag(:bill_address_one, address.address1)
32
32
  = hidden_field_tag(:bill_city, address.city)
33
33
  = hidden_field_tag(:bill_state_or_province, address.state)
34
34
  = hidden_field_tag(:bill_postal_code, address.postal_code)
35
35
  = hidden_field_tag(:bill_country, address.country)
36
36
 
37
+ - if order.shipping_address.present?
38
+ - address = order.shipping_address
39
+ = hidden_field_tag(:ship_first_name, address.first_name || order.try(:user).try(:first_name))
40
+ = hidden_field_tag(:ship_last_name, address.last_name || order.try(:user).try(:last_name))
41
+ = hidden_field_tag(:ship_address_one, address.address1)
42
+ = hidden_field_tag(:ship_city, address.city)
43
+ = hidden_field_tag(:ship_state_or_province, address.state)
44
+ = hidden_field_tag(:ship_postal_code, address.postal_code)
45
+ = hidden_field_tag(:ship_country, address.country)
46
+
37
47
  = submit_tag 'Pay with Moneris', :class => 'btn btn-primary', :data => {'disable_with' => 'Continuing...' }
data/config/routes.rb CHANGED
@@ -47,7 +47,7 @@ EffectiveOrders::Engine.routes.draw do
47
47
  match 'webhooks/stripe', :to => 'webhooks#stripe', :via => [:post, :put]
48
48
  end
49
49
 
50
- if defined?(EffectiveDatatables) && !EffectiveOrders.use_active_admin == true
50
+ if defined?(EffectiveDatatables) && !EffectiveOrders.use_active_admin?
51
51
  namespace :admin do
52
52
  resources :customers, :only => [:index]
53
53
  resources :orders, :only => [:index, :show]
@@ -80,6 +80,10 @@ module EffectiveOrders
80
80
  end
81
81
  end
82
82
 
83
+ def self.use_active_admin?
84
+ use_active_admin && defined?(ActiveAdmin)
85
+ end
86
+
83
87
  class SoldOutException < Exception; end
84
88
  class AlreadyPurchasedException < Exception; end
85
89
  class AlreadyDeclinedException < Exception; end
@@ -42,7 +42,7 @@ module EffectiveOrders
42
42
 
43
43
  # Use ActiveAdmin (optional)
44
44
  initializer 'effective_orders.active_admin' do
45
- if EffectiveOrders.use_active_admin
45
+ if EffectiveOrders.use_active_admin?
46
46
  require 'activeadmin'
47
47
 
48
48
  ActiveSupport.on_load :action_controller do
@@ -1,3 +1,3 @@
1
1
  module EffectiveOrders
2
- VERSION = '1.5.1'.freeze
2
+ VERSION = '1.5.2'.freeze
3
3
  end
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.5.1
4
+ version: 1.5.2
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: 2015-10-17 00:00:00.000000000 Z
11
+ date: 2015-10-20 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails