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 +4 -4
- data/active_admin/effective_orders.rb +4 -4
- data/app/controllers/effective/carts_controller.rb +1 -1
- data/app/controllers/effective/orders_controller.rb +1 -1
- data/app/views/effective/orders/moneris/_form.html.haml +12 -2
- data/config/routes.rb +1 -1
- data/lib/effective_orders.rb +4 -0
- data/lib/effective_orders/engine.rb +1 -1
- data/lib/effective_orders/version.rb +1 -1
- 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: 68837d038f48f9503cb95b4975a88a85bf2bb5f4
|
4
|
+
data.tar.gz: dab5e51afb7ea037856bea992fea9ea0c9b8da73
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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 <<
|
85
|
-
row <<
|
86
|
-
row <<
|
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
|
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]
|
data/lib/effective_orders.rb
CHANGED
@@ -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
|
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.
|
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-
|
11
|
+
date: 2015-10-20 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|