effective_qb_sync 1.2.5 → 1.3.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/MIT-LICENSE +1 -1
- data/app/controllers/admin/qb_syncs_controller.rb +13 -11
- data/app/datatables/effective_qb_sync_datatable.rb +6 -3
- data/app/models/effective/qb_log.rb +4 -3
- data/app/models/effective/qb_order_item.rb +4 -3
- data/app/models/effective/qb_request.rb +11 -8
- data/app/models/effective/qb_ticket.rb +16 -13
- data/app/views/admin/qb_syncs/show.html.haml +1 -5
- data/app/views/effective/qb_web_connector/quickbooks.qwc.erb +2 -2
- data/config/effective_qb_sync.rb +2 -28
- data/config/routes.rb +1 -1
- data/lib/effective_qb_sync.rb +13 -35
- data/lib/effective_qb_sync/engine.rb +0 -18
- data/lib/effective_qb_sync/version.rb +1 -1
- metadata +40 -76
- data/app/models/effective/access_denied.rb +0 -17
- data/app/views/admin/qb_syncs/_actions.html.haml +0 -8
- data/app/views/admin/qb_syncs/_simple_form.html.haml +0 -19
- data/spec/dummy/log/development.log +0 -90
- data/spec/dummy/log/test.log +0 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 0263ab76ac23e23696838fab00b64f83cfe07adb9f7f63415bfefb02e7abb2fc
|
4
|
+
data.tar.gz: db8e31bc405285342463f3b5f66953c1b193afb559cfb985e46d3695f8e5d656
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 87e4c4e884f4013d9f35e64034c8a2624f044c574a89d01f7f9351e5117647a23d27c97822fe8acea1232c3bf5c0767583e6d362f9eb229b15f3c9c4a180f1fe
|
7
|
+
data.tar.gz: 7d943d58c082a9a835c018157d3dacf8fea2ef054c9ff826f0bab247933f793b65aef12b7d318fa071288d63746ff81f67fe6c815b2e7ae6d1d7214992c9f92d
|
data/MIT-LICENSE
CHANGED
@@ -1,13 +1,16 @@
|
|
1
1
|
module Admin
|
2
2
|
class QbSyncsController < ApplicationController
|
3
|
-
before_action
|
4
|
-
before_action :
|
3
|
+
before_action(:authenticate_user!) if defined?(Devise)
|
4
|
+
before_action { EffectiveResources.authorize!(self, :admin, :effective_qb_sync) }
|
5
5
|
|
6
|
-
|
6
|
+
include Effective::CrudController
|
7
|
+
|
8
|
+
if (config = EffectiveQbSync.layout)
|
9
|
+
layout(config.kind_of?(Hash) ? config[:admin] : config)
|
10
|
+
end
|
7
11
|
|
8
12
|
def index
|
9
13
|
@datatable = EffectiveQbSyncDatatable.new(self)
|
10
|
-
|
11
14
|
@page_title = 'Quickbooks Synchronizations'
|
12
15
|
end
|
13
16
|
|
@@ -23,7 +26,7 @@ module Admin
|
|
23
26
|
@page_title = "Quickbooks Sync ##{@qb_ticket.id}"
|
24
27
|
|
25
28
|
@qb_order_items_form = Effective::QbOrderItemsForm.new(id: @qb_ticket.id, orders: @qb_ticket.orders)
|
26
|
-
@qb_order_items_form.qb_order_items_attributes =
|
29
|
+
@qb_order_items_form.qb_order_items_attributes = permitted_params[:qb_order_items_attributes].values
|
27
30
|
|
28
31
|
if @qb_order_items_form.save
|
29
32
|
flash[:success] = 'Successfully updated Quickbooks item names'
|
@@ -39,7 +42,7 @@ module Admin
|
|
39
42
|
end
|
40
43
|
|
41
44
|
def qwc
|
42
|
-
@filename =
|
45
|
+
@filename = EffectiveQbSync.qwc_name.parameterize + '.qwc'
|
43
46
|
|
44
47
|
response.headers['Content-Disposition'] = "attachment; filename=\"#{@filename}\""
|
45
48
|
|
@@ -70,12 +73,11 @@ module Admin
|
|
70
73
|
|
71
74
|
private
|
72
75
|
|
73
|
-
def
|
74
|
-
|
76
|
+
def permitted_params
|
77
|
+
params.require(:effective_qb_order_items_form).permit(
|
78
|
+
:id, qb_order_items_attributes: [:name, :id, :order_item_id]
|
79
|
+
)
|
75
80
|
end
|
76
81
|
|
77
|
-
def permitted_qb_order_items_params
|
78
|
-
params.require(:effective_qb_order_items_form).permit(:id, qb_order_items_attributes: [:name, :id, :order_item_id])
|
79
|
-
end
|
80
82
|
end
|
81
83
|
end
|
@@ -3,7 +3,7 @@ class EffectiveQbSyncDatatable < Effective::Datatable
|
|
3
3
|
order :created_at, :desc
|
4
4
|
|
5
5
|
col :created_at
|
6
|
-
col :state
|
6
|
+
col :state
|
7
7
|
|
8
8
|
val :num_orders, visible: false do |qb_ticket|
|
9
9
|
qb_ticket.qb_requests.length
|
@@ -24,11 +24,14 @@ class EffectiveQbSyncDatatable < Effective::Datatable
|
|
24
24
|
end
|
25
25
|
end
|
26
26
|
|
27
|
-
actions_col
|
27
|
+
actions_col do |qb_ticket|
|
28
|
+
dropdown_link_to 'Show', effective_qb_sync.admin_qb_sync_path(qb_ticket)
|
29
|
+
end
|
30
|
+
|
28
31
|
end
|
29
32
|
|
30
33
|
collection do
|
31
|
-
Effective::QbTicket.
|
34
|
+
Effective::QbTicket.deep.all
|
32
35
|
end
|
33
36
|
|
34
37
|
end
|
@@ -2,9 +2,10 @@ module Effective
|
|
2
2
|
class QbLog < ActiveRecord::Base
|
3
3
|
belongs_to :qb_ticket
|
4
4
|
|
5
|
-
|
6
|
-
|
7
|
-
|
5
|
+
effective_resource do
|
6
|
+
message :text
|
7
|
+
timestamps
|
8
|
+
end
|
8
9
|
|
9
10
|
validates :qb_ticket, presence: true
|
10
11
|
validates :message, presence: true
|
@@ -2,9 +2,10 @@ module Effective
|
|
2
2
|
class QbOrderItem < ActiveRecord::Base
|
3
3
|
belongs_to :order_item
|
4
4
|
|
5
|
-
|
6
|
-
|
7
|
-
|
5
|
+
effective_resource do
|
6
|
+
name :string
|
7
|
+
timestamps
|
8
|
+
end
|
8
9
|
|
9
10
|
validates :order_item, presence: true
|
10
11
|
validates :name, presence: true
|
@@ -9,17 +9,20 @@ module Effective
|
|
9
9
|
COMPLETED_STATES = ['Finished', 'Error']
|
10
10
|
PROCESSING_STATES = ['Processing', 'CustomerQuery', 'CreateCustomer', 'OrderSync']
|
11
11
|
|
12
|
-
|
13
|
-
|
14
|
-
|
12
|
+
effective_resource do
|
13
|
+
state :string
|
14
|
+
error :text
|
15
15
|
|
16
|
-
|
17
|
-
# response_received_at :datetime
|
16
|
+
request_type :string
|
18
17
|
|
19
|
-
|
20
|
-
|
18
|
+
request_qbxml :text
|
19
|
+
response_qbxml :text
|
21
20
|
|
22
|
-
|
21
|
+
request_sent_at :datetime
|
22
|
+
response_received_at :datetime
|
23
|
+
|
24
|
+
timestamps
|
25
|
+
end
|
23
26
|
|
24
27
|
validates :state, inclusion: { in: COMPLETED_STATES + PROCESSING_STATES }
|
25
28
|
validates :qb_ticket, presence: true
|
@@ -7,23 +7,26 @@ module Effective
|
|
7
7
|
|
8
8
|
STATES = ['Ready', 'Authenticated', 'Processing', 'Finished', 'ConnectionError', 'RequestError']
|
9
9
|
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
10
|
+
effective_resource do
|
11
|
+
username :string
|
12
|
+
company_file_name :string
|
13
|
+
country :string
|
14
14
|
|
15
|
-
|
16
|
-
|
15
|
+
qbxml_major_version :string
|
16
|
+
qbxml_minor_version :string
|
17
17
|
|
18
|
-
|
19
|
-
|
18
|
+
state :string, default: 'Ready'
|
19
|
+
percent :integer
|
20
20
|
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
21
|
+
hpc_response :text
|
22
|
+
connection_error_hresult :text
|
23
|
+
connection_error_message :text
|
24
|
+
last_error :text
|
25
25
|
|
26
|
-
|
26
|
+
timestamps
|
27
|
+
end
|
28
|
+
|
29
|
+
scope :deep, -> { includes(qb_requests: :order) }
|
27
30
|
|
28
31
|
validates :state, inclusion: { in: STATES }
|
29
32
|
|
@@ -8,11 +8,7 @@
|
|
8
8
|
%td= value
|
9
9
|
|
10
10
|
%h3 Orders
|
11
|
-
|
12
|
-
- if defined?(EffectiveBootstrap)
|
13
|
-
= render 'form', qb_order_items_form: @qb_order_items_form, qb_ticket: @qb_ticket
|
14
|
-
- else
|
15
|
-
= render 'simple_form', qb_order_items_form: @qb_order_items_form, qb_ticket: @qb_ticket
|
11
|
+
= render 'form', qb_order_items_form: @qb_order_items_form, qb_ticket: @qb_ticket
|
16
12
|
|
17
13
|
%h3 Sync Log
|
18
14
|
|
@@ -1,8 +1,8 @@
|
|
1
1
|
<QBWCXML>
|
2
|
-
<AppName><%=
|
2
|
+
<AppName><%= EffectiveQbSync.qwc_name.upcase %> Web Connector</AppName>
|
3
3
|
<AppID>{<%= SecureRandom.uuid.upcase %>}</AppID>
|
4
4
|
<AppURL><%= effective_qb_sync.qb_sync_url(protocol: 'https') %></AppURL>
|
5
|
-
<AppDescription><%=
|
5
|
+
<AppDescription><%= EffectiveQbSync.qwc_name.upcase %> EffectiveOrders to Quickbooks Web Connector</AppDescription>
|
6
6
|
<AppSupport><%= root_url(protocol: 'https') %></AppSupport>
|
7
7
|
<UserName><%= EffectiveQbSync.quickbooks_username || 'MISSING' %></UserName>
|
8
8
|
<OwnerID>{<%= SecureRandom.uuid.upcase %>}</OwnerID>
|
data/config/effective_qb_sync.rb
CHANGED
@@ -5,36 +5,10 @@ EffectiveQbSync.setup do |config|
|
|
5
5
|
config.qb_logs_table_name = :qb_logs
|
6
6
|
config.qb_order_items_table_name = :qb_order_items
|
7
7
|
|
8
|
-
#
|
9
|
-
#
|
10
|
-
# This method is called by all controller actions with the appropriate action and resource
|
11
|
-
# If the method returns false, an Effective::AccessDenied Error will be raised (see README.md for complete info)
|
12
|
-
#
|
13
|
-
# Use via Proc (and with CanCan):
|
14
|
-
# config.authorization_method = Proc.new { |controller, action, resource| authorize!(action, resource) }
|
15
|
-
#
|
16
|
-
# Use via custom method:
|
17
|
-
# config.authorization_method = :my_authorization_method
|
18
|
-
#
|
19
|
-
# And then in your application_controller.rb:
|
20
|
-
#
|
21
|
-
# def my_authorization_method(action, resource)
|
22
|
-
# current_user.is?(:admin)
|
23
|
-
# end
|
24
|
-
#
|
25
|
-
# Or disable the check completely:
|
26
|
-
# config.authorization_method = false
|
27
|
-
config.authorization_method = Proc.new { |controller, action, resource| authorize!(action, resource) } # CanCanCan
|
28
|
-
|
29
|
-
# All EffectiveQbSync controllers will use this layout
|
30
|
-
config.layout = 'application'
|
31
|
-
|
32
|
-
# SimpleForm Options
|
33
|
-
# This Hash of options will be passed into any admin facing simple_form_for() calls
|
34
|
-
config.admin_simple_form_options = {} # For the /admin/qb_syncs form
|
8
|
+
# Layout Settings
|
9
|
+
# config.layout = { admin: 'admin' }
|
35
10
|
|
36
11
|
# Quickbooks Company File Settings
|
37
|
-
|
38
12
|
# The username / password of the Quickbooks user that should be allowed to synchronize.
|
39
13
|
# This must match the user configured in the Quickbooks .qwc file
|
40
14
|
config.quickbooks_username = ''
|
data/config/routes.rb
CHANGED
data/lib/effective_qb_sync.rb
CHANGED
@@ -1,48 +1,22 @@
|
|
1
|
+
require 'effective_resources'
|
1
2
|
require 'effective_orders'
|
2
3
|
require 'effective_qb_sync/engine'
|
3
4
|
require 'effective_qb_sync/version'
|
4
5
|
|
5
6
|
module EffectiveQbSync
|
6
|
-
# The following are all valid config keys
|
7
|
-
mattr_accessor :qb_requests_table_name
|
8
|
-
mattr_accessor :qb_tickets_table_name
|
9
|
-
mattr_accessor :qb_logs_table_name
|
10
|
-
mattr_accessor :qb_order_items_table_name
|
11
7
|
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
mattr_accessor :error_email
|
19
|
-
|
20
|
-
mattr_accessor :layout
|
21
|
-
mattr_accessor :admin_simple_form_options
|
22
|
-
|
23
|
-
def self.setup
|
24
|
-
yield self
|
25
|
-
end
|
26
|
-
|
27
|
-
def self.authorized?(controller, action, resource)
|
28
|
-
@_exceptions ||= [Effective::AccessDenied, (CanCan::AccessDenied if defined?(CanCan)), (Pundit::NotAuthorizedError if defined?(Pundit))].compact
|
29
|
-
|
30
|
-
return !!authorization_method unless authorization_method.respond_to?(:call)
|
31
|
-
controller = controller.controller if controller.respond_to?(:controller)
|
32
|
-
|
33
|
-
begin
|
34
|
-
!!(controller || self).instance_exec((controller || self), action, resource, &authorization_method)
|
35
|
-
rescue *@_exceptions
|
36
|
-
false
|
37
|
-
end
|
8
|
+
def self.config_keys
|
9
|
+
[
|
10
|
+
:qb_requests_table_name, :qb_tickets_table_name, :qb_logs_table_name, :qb_order_items_table_name,
|
11
|
+
:quickbooks_username, :quickbooks_password, :quickbooks_tax_name,
|
12
|
+
:layout, :error_email
|
13
|
+
]
|
38
14
|
end
|
39
15
|
|
40
|
-
|
41
|
-
raise Effective::AccessDenied.new('Access Denied', action, resource) unless authorized?(controller, action, resource)
|
42
|
-
end
|
16
|
+
include EffectiveGem
|
43
17
|
|
44
18
|
def self.permitted_params
|
45
|
-
[:note]
|
19
|
+
@permitted_params ||= [:note]
|
46
20
|
end
|
47
21
|
|
48
22
|
def self.skip_order!(order)
|
@@ -72,4 +46,8 @@ module EffectiveQbSync
|
|
72
46
|
true
|
73
47
|
end
|
74
48
|
|
49
|
+
def self.qwc_name
|
50
|
+
(defined?(Tenant) ? Tenant.current.to_s : Rails.application.class.parent_name).downcase
|
51
|
+
end
|
52
|
+
|
75
53
|
end
|
@@ -2,28 +2,10 @@ module EffectiveQbSync
|
|
2
2
|
class Engine < ::Rails::Engine
|
3
3
|
engine_name 'effective_qb_sync'
|
4
4
|
|
5
|
-
config.autoload_paths += Dir["#{config.root}/app/models/**/"]
|
6
|
-
|
7
5
|
# Set up our default configuration options.
|
8
6
|
initializer "effective_qb_sync.defaults", before: :load_config_initializers do |app|
|
9
7
|
eval File.read("#{config.root}/config/effective_qb_sync.rb")
|
10
8
|
end
|
11
9
|
|
12
|
-
# Include acts_as_addressable concern and allow any ActiveRecord object to call it
|
13
|
-
initializer 'effective_qb_sync.active_record' do |app|
|
14
|
-
Rails.application.config.to_prepare do
|
15
|
-
ActiveSupport.on_load :active_record do
|
16
|
-
Effective::OrderItem.class_eval do
|
17
|
-
has_one :qb_order_item
|
18
|
-
|
19
|
-
# first or build
|
20
|
-
def qb_item_name
|
21
|
-
(qb_order_item || build_qb_order_item(name: purchasable.qb_item_name)).name
|
22
|
-
end
|
23
|
-
end
|
24
|
-
end
|
25
|
-
end
|
26
|
-
end
|
27
|
-
|
28
10
|
end
|
29
11
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: effective_qb_sync
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.3.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Code and Effect
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2021-02-24 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
@@ -25,35 +25,7 @@ dependencies:
|
|
25
25
|
- !ruby/object:Gem::Version
|
26
26
|
version: 4.2.0
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
|
-
name:
|
29
|
-
requirement: !ruby/object:Gem::Requirement
|
30
|
-
requirements:
|
31
|
-
- - ">="
|
32
|
-
- !ruby/object:Gem::Version
|
33
|
-
version: '0'
|
34
|
-
type: :runtime
|
35
|
-
prerelease: false
|
36
|
-
version_requirements: !ruby/object:Gem::Requirement
|
37
|
-
requirements:
|
38
|
-
- - ">="
|
39
|
-
- !ruby/object:Gem::Version
|
40
|
-
version: '0'
|
41
|
-
- !ruby/object:Gem::Dependency
|
42
|
-
name: jquery-rails
|
43
|
-
requirement: !ruby/object:Gem::Requirement
|
44
|
-
requirements:
|
45
|
-
- - ">="
|
46
|
-
- !ruby/object:Gem::Version
|
47
|
-
version: '0'
|
48
|
-
type: :runtime
|
49
|
-
prerelease: false
|
50
|
-
version_requirements: !ruby/object:Gem::Requirement
|
51
|
-
requirements:
|
52
|
-
- - ">="
|
53
|
-
- !ruby/object:Gem::Version
|
54
|
-
version: '0'
|
55
|
-
- !ruby/object:Gem::Dependency
|
56
|
-
name: devise
|
28
|
+
name: nokogiri
|
57
29
|
requirement: !ruby/object:Gem::Requirement
|
58
30
|
requirements:
|
59
31
|
- - ">="
|
@@ -67,7 +39,7 @@ dependencies:
|
|
67
39
|
- !ruby/object:Gem::Version
|
68
40
|
version: '0'
|
69
41
|
- !ruby/object:Gem::Dependency
|
70
|
-
name:
|
42
|
+
name: effective_resources
|
71
43
|
requirement: !ruby/object:Gem::Requirement
|
72
44
|
requirements:
|
73
45
|
- - ">="
|
@@ -81,7 +53,7 @@ dependencies:
|
|
81
53
|
- !ruby/object:Gem::Version
|
82
54
|
version: '0'
|
83
55
|
- !ruby/object:Gem::Dependency
|
84
|
-
name:
|
56
|
+
name: effective_datatables
|
85
57
|
requirement: !ruby/object:Gem::Requirement
|
86
58
|
requirements:
|
87
59
|
- - ">="
|
@@ -120,7 +92,6 @@ files:
|
|
120
92
|
- app/controllers/admin/qb_syncs_controller.rb
|
121
93
|
- app/controllers/effective/qb_sync_controller.rb
|
122
94
|
- app/datatables/effective_qb_sync_datatable.rb
|
123
|
-
- app/models/effective/access_denied.rb
|
124
95
|
- app/models/effective/qb_log.rb
|
125
96
|
- app/models/effective/qb_machine.rb
|
126
97
|
- app/models/effective/qb_order_item.rb
|
@@ -128,10 +99,8 @@ files:
|
|
128
99
|
- app/models/effective/qb_request.rb
|
129
100
|
- app/models/effective/qb_ticket.rb
|
130
101
|
- app/models/effective/qbwc_supervisor.rb
|
131
|
-
- app/views/admin/qb_syncs/_actions.html.haml
|
132
102
|
- app/views/admin/qb_syncs/_form.html.haml
|
133
103
|
- app/views/admin/qb_syncs/_qb_item_names.html.haml
|
134
|
-
- app/views/admin/qb_syncs/_simple_form.html.haml
|
135
104
|
- app/views/admin/qb_syncs/index.html.haml
|
136
105
|
- app/views/admin/qb_syncs/instructions.html.haml
|
137
106
|
- app/views/admin/qb_syncs/show.html.haml
|
@@ -192,8 +161,6 @@ files:
|
|
192
161
|
- spec/dummy/config/secrets.yml
|
193
162
|
- spec/dummy/db/schema.rb
|
194
163
|
- spec/dummy/db/test.sqlite3
|
195
|
-
- spec/dummy/log/development.log
|
196
|
-
- spec/dummy/log/test.log
|
197
164
|
- spec/dummy/public/404.html
|
198
165
|
- spec/dummy/public/422.html
|
199
166
|
- spec/dummy/public/500.html
|
@@ -211,7 +178,7 @@ homepage: https://github.com/code-and-effect/effective_qb_sync
|
|
211
178
|
licenses:
|
212
179
|
- MIT
|
213
180
|
metadata: {}
|
214
|
-
post_install_message:
|
181
|
+
post_install_message:
|
215
182
|
rdoc_options: []
|
216
183
|
require_paths:
|
217
184
|
- lib
|
@@ -226,62 +193,59 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
226
193
|
- !ruby/object:Gem::Version
|
227
194
|
version: '0'
|
228
195
|
requirements: []
|
229
|
-
|
230
|
-
|
231
|
-
signing_key:
|
196
|
+
rubygems_version: 3.1.2
|
197
|
+
signing_key:
|
232
198
|
specification_version: 4
|
233
199
|
summary: Synchronize EffectiveOrders with QuickBooks Web Connector.
|
234
200
|
test_files:
|
235
|
-
- spec/
|
236
|
-
- spec/dummy/app/assets/stylesheets/application.css
|
237
|
-
- spec/dummy/app/controllers/application_controller.rb
|
238
|
-
- spec/dummy/app/helpers/application_helper.rb
|
201
|
+
- spec/spec_helper.rb
|
239
202
|
- spec/dummy/app/models/product.rb
|
240
203
|
- spec/dummy/app/models/product_with_float_price.rb
|
241
204
|
- spec/dummy/app/models/user.rb
|
205
|
+
- spec/dummy/app/controllers/application_controller.rb
|
242
206
|
- spec/dummy/app/views/layouts/application.html.erb
|
207
|
+
- spec/dummy/app/assets/javascripts/application.js
|
208
|
+
- spec/dummy/app/assets/stylesheets/application.css
|
209
|
+
- spec/dummy/app/helpers/application_helper.rb
|
210
|
+
- spec/dummy/bin/rake
|
243
211
|
- spec/dummy/bin/bundle
|
244
212
|
- spec/dummy/bin/rails
|
245
|
-
- spec/dummy/
|
246
|
-
- spec/dummy/config/
|
247
|
-
- spec/dummy/config/
|
248
|
-
- spec/dummy/config/database.yml
|
249
|
-
- spec/dummy/config/environment.rb
|
250
|
-
- spec/dummy/config/environments/development.rb
|
213
|
+
- spec/dummy/config/secrets.yml
|
214
|
+
- spec/dummy/config/routes.rb
|
215
|
+
- spec/dummy/config/locales/en.yml
|
251
216
|
- spec/dummy/config/environments/production.rb
|
217
|
+
- spec/dummy/config/environments/development.rb
|
252
218
|
- spec/dummy/config/environments/test.rb
|
219
|
+
- spec/dummy/config/environment.rb
|
220
|
+
- spec/dummy/config/application.rb
|
221
|
+
- spec/dummy/config/database.yml
|
222
|
+
- spec/dummy/config/boot.rb
|
253
223
|
- spec/dummy/config/initializers/backtrace_silencers.rb
|
254
|
-
- spec/dummy/config/initializers/
|
255
|
-
- spec/dummy/config/initializers/devise.rb
|
224
|
+
- spec/dummy/config/initializers/mime_types.rb
|
256
225
|
- spec/dummy/config/initializers/effective_addresses.rb
|
257
|
-
- spec/dummy/config/initializers/effective_orders.rb
|
258
|
-
- spec/dummy/config/initializers/effective_qb_sync.rb
|
259
226
|
- spec/dummy/config/initializers/filter_parameter_logging.rb
|
260
|
-
- spec/dummy/config/initializers/inflections.rb
|
261
|
-
- spec/dummy/config/initializers/mime_types.rb
|
262
227
|
- spec/dummy/config/initializers/session_store.rb
|
263
|
-
- spec/dummy/config/initializers/simple_form.rb
|
264
228
|
- spec/dummy/config/initializers/wrap_parameters.rb
|
265
|
-
- spec/dummy/config/
|
266
|
-
- spec/dummy/config/
|
267
|
-
- spec/dummy/config/
|
229
|
+
- spec/dummy/config/initializers/effective_qb_sync.rb
|
230
|
+
- spec/dummy/config/initializers/cookies_serializer.rb
|
231
|
+
- spec/dummy/config/initializers/devise.rb
|
232
|
+
- spec/dummy/config/initializers/effective_orders.rb
|
233
|
+
- spec/dummy/config/initializers/simple_form.rb
|
234
|
+
- spec/dummy/config/initializers/inflections.rb
|
268
235
|
- spec/dummy/config.ru
|
269
|
-
- spec/dummy/
|
270
|
-
- spec/dummy/
|
271
|
-
- spec/dummy/log/development.log
|
272
|
-
- spec/dummy/log/test.log
|
273
|
-
- spec/dummy/public/404.html
|
236
|
+
- spec/dummy/Rakefile
|
237
|
+
- spec/dummy/public/favicon.ico
|
274
238
|
- spec/dummy/public/422.html
|
275
239
|
- spec/dummy/public/500.html
|
276
|
-
- spec/dummy/public/
|
277
|
-
- spec/dummy/
|
240
|
+
- spec/dummy/public/404.html
|
241
|
+
- spec/dummy/db/schema.rb
|
242
|
+
- spec/dummy/db/test.sqlite3
|
278
243
|
- spec/dummy/README.rdoc
|
279
|
-
- spec/fixtures/qbxml_response_error.xml
|
280
|
-
- spec/fixtures/qbxml_response_success.xml
|
281
|
-
- spec/models/acts_as_purchasable_spec.rb
|
282
|
-
- spec/models/factories_spec.rb
|
283
|
-
- spec/models/qb_machine_spec.rb
|
284
244
|
- spec/models/qb_request_spec.rb
|
285
245
|
- spec/models/qb_ticket_spec.rb
|
286
|
-
- spec/
|
246
|
+
- spec/models/qb_machine_spec.rb
|
247
|
+
- spec/models/factories_spec.rb
|
248
|
+
- spec/models/acts_as_purchasable_spec.rb
|
287
249
|
- spec/support/factories.rb
|
250
|
+
- spec/fixtures/qbxml_response_success.xml
|
251
|
+
- spec/fixtures/qbxml_response_error.xml
|
@@ -1,17 +0,0 @@
|
|
1
|
-
unless defined?(Effective::AccessDenied)
|
2
|
-
module Effective
|
3
|
-
class AccessDenied < StandardError
|
4
|
-
attr_reader :action, :subject
|
5
|
-
|
6
|
-
def initialize(message = nil, action = nil, subject = nil)
|
7
|
-
@message = message
|
8
|
-
@action = action
|
9
|
-
@subject = subject
|
10
|
-
end
|
11
|
-
|
12
|
-
def to_s
|
13
|
-
@message || I18n.t(:'unauthorized.default', :default => 'Access Denied')
|
14
|
-
end
|
15
|
-
end
|
16
|
-
end
|
17
|
-
end
|
@@ -1,19 +0,0 @@
|
|
1
|
-
= simple_form_for qb_order_items_form, (EffectiveOrders.admin_simple_form_options || {}).merge(url: effective_qb_sync.admin_qb_sync_path(qb_order_items_form)) do |f|
|
2
|
-
%table.table
|
3
|
-
%thead
|
4
|
-
%tr
|
5
|
-
%th Order
|
6
|
-
%th Order Item
|
7
|
-
%th Quickbooks Item Name
|
8
|
-
%tbody
|
9
|
-
- qb_ticket.orders.each do |order|
|
10
|
-
- order.order_items.each_with_index do |order_item, index|
|
11
|
-
%tr
|
12
|
-
%td= (link_to(('#' + order.to_param.to_s), effective_orders.admin_order_path(order)) if index == 0)
|
13
|
-
%td= order_item
|
14
|
-
%td
|
15
|
-
= f.simple_fields_for :qb_order_items, order_item.qb_order_item do |foi|
|
16
|
-
= foi.input :order_item_id, as: :hidden, value: order_item.id
|
17
|
-
= foi.input :name, label: false, required: false
|
18
|
-
|
19
|
-
%p= f.button :submit, 'Save Quickbooks Item Names', data: { disable_with: 'Saving...' }
|
@@ -1,90 +0,0 @@
|
|
1
|
-
[1m[36m (17.9ms)[0m [1mCREATE TABLE "qb_logs" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "qb_ticket_id" integer, "message" text, "created_at" datetime, "updated_at" datetime) [0m
|
2
|
-
[1m[35m (0.1ms)[0m select sqlite_version(*)
|
3
|
-
[1m[36m (1.1ms)[0m [1mCREATE INDEX "index_qb_logs_on_qb_ticket_id" ON "qb_logs" ("qb_ticket_id")[0m
|
4
|
-
[1m[35m (1.2ms)[0m CREATE TABLE "qb_order_items" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "order_item_id" integer, "name" varchar, "created_at" datetime, "updated_at" datetime)
|
5
|
-
[1m[36m (1.1ms)[0m [1mCREATE INDEX "index_qb_order_items_on_order_item_id" ON "qb_order_items" ("order_item_id")[0m
|
6
|
-
[1m[35m (1.0ms)[0m CREATE TABLE "qb_requests" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "order_id" integer, "qb_ticket_id" integer, "state" varchar DEFAULT 'Processing', "error" text, "request_type" varchar, "request_qbxml" text, "response_qbxml" text, "request_sent_at" datetime, "response_received_at" datetime, "created_at" datetime, "updated_at" datetime)
|
7
|
-
[1m[36m (1.0ms)[0m [1mCREATE INDEX "index_qb_requests_on_order_id" ON "qb_requests" ("order_id")[0m
|
8
|
-
[1m[35m (1.0ms)[0m CREATE TABLE "qb_tickets" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "qb_request_id" integer, "username" varchar, "hpc_response" text, "company_file_name" varchar, "country" varchar, "qbxml_major_version" varchar, "qbxml_minor_version" varchar, "state" varchar DEFAULT 'Ready', "percent" integer DEFAULT 0, "connection_error_hresult" text, "connection_error_message" text, "last_error" text, "created_at" datetime, "updated_at" datetime)
|
9
|
-
[1m[36m (0.8ms)[0m [1mCREATE INDEX "index_qb_tickets_on_qb_request_id" ON "qb_tickets" ("qb_request_id")[0m
|
10
|
-
[1m[35m (1.0ms)[0m CREATE TABLE "addresses" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "addressable_type" varchar, "addressable_id" integer, "category" varchar(64), "full_name" varchar, "address1" varchar, "address2" varchar, "city" varchar, "state_code" varchar, "country_code" varchar, "postal_code" varchar, "updated_at" datetime, "created_at" datetime)
|
11
|
-
[1m[36m (0.9ms)[0m [1mCREATE INDEX "index_addresses_on_addressable_id" ON "addresses" ("addressable_id")[0m
|
12
|
-
[1m[35m (0.1ms)[0m SELECT sql
|
13
|
-
FROM sqlite_master
|
14
|
-
WHERE name='index_addresses_on_addressable_id' AND type='index'
|
15
|
-
UNION ALL
|
16
|
-
SELECT sql
|
17
|
-
FROM sqlite_temp_master
|
18
|
-
WHERE name='index_addresses_on_addressable_id' AND type='index'
|
19
|
-
|
20
|
-
[1m[36m (0.8ms)[0m [1mCREATE INDEX "index_addresses_on_addressable_type_and_addressable_id" ON "addresses" ("addressable_type", "addressable_id")[0m
|
21
|
-
[1m[35m (0.9ms)[0m CREATE TABLE "cart_items" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "cart_id" integer, "purchasable_type" varchar, "purchasable_id" integer, "quantity" integer, "created_at" datetime NOT NULL, "updated_at" datetime NOT NULL)
|
22
|
-
[1m[36m (1.2ms)[0m [1mCREATE INDEX "index_cart_items_on_cart_id" ON "cart_items" ("cart_id")[0m
|
23
|
-
[1m[35m (0.1ms)[0m SELECT sql
|
24
|
-
FROM sqlite_master
|
25
|
-
WHERE name='index_cart_items_on_cart_id' AND type='index'
|
26
|
-
UNION ALL
|
27
|
-
SELECT sql
|
28
|
-
FROM sqlite_temp_master
|
29
|
-
WHERE name='index_cart_items_on_cart_id' AND type='index'
|
30
|
-
|
31
|
-
[1m[36m (1.1ms)[0m [1mCREATE INDEX "index_cart_items_on_purchasable_id" ON "cart_items" ("purchasable_id")[0m
|
32
|
-
[1m[35m (0.1ms)[0m SELECT sql
|
33
|
-
FROM sqlite_master
|
34
|
-
WHERE name='index_cart_items_on_purchasable_id' AND type='index'
|
35
|
-
UNION ALL
|
36
|
-
SELECT sql
|
37
|
-
FROM sqlite_temp_master
|
38
|
-
WHERE name='index_cart_items_on_purchasable_id' AND type='index'
|
39
|
-
|
40
|
-
[1m[36m (0.1ms)[0m [1m SELECT sql
|
41
|
-
FROM sqlite_master
|
42
|
-
WHERE name='index_cart_items_on_cart_id' AND type='index'
|
43
|
-
UNION ALL
|
44
|
-
SELECT sql
|
45
|
-
FROM sqlite_temp_master
|
46
|
-
WHERE name='index_cart_items_on_cart_id' AND type='index'
|
47
|
-
[0m
|
48
|
-
[1m[35m (0.9ms)[0m CREATE INDEX "index_cart_items_on_purchasable_type_and_purchasable_id" ON "cart_items" ("purchasable_type", "purchasable_id")
|
49
|
-
[1m[36m (1.0ms)[0m [1mCREATE TABLE "carts" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "user_id" integer, "created_at" datetime NOT NULL, "updated_at" datetime NOT NULL) [0m
|
50
|
-
[1m[35m (0.9ms)[0m CREATE INDEX "index_carts_on_user_id" ON "carts" ("user_id")
|
51
|
-
[1m[36m (0.8ms)[0m [1mCREATE TABLE "custom_products" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "title" varchar, "price" integer DEFAULT 0, "tax_exempt" boolean, "created_at" datetime, "updated_at" datetime) [0m
|
52
|
-
[1m[35m (1.0ms)[0m CREATE TABLE "customers" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "user_id" integer, "stripe_customer_id" varchar, "stripe_active_card" varchar, "stripe_connect_access_token" varchar, "created_at" datetime, "updated_at" datetime)
|
53
|
-
[1m[36m (2.2ms)[0m [1mCREATE TABLE "order_items" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "order_id" integer, "seller_id" integer, "purchasable_type" varchar, "purchasable_id" integer, "title" varchar, "quantity" integer, "price" integer DEFAULT 0, "tax_exempt" boolean, "created_at" datetime NOT NULL, "updated_at" datetime NOT NULL) [0m
|
54
|
-
[1m[35m (1.1ms)[0m CREATE INDEX "index_order_items_on_order_id" ON "order_items" ("order_id")
|
55
|
-
[1m[36m (0.1ms)[0m [1m SELECT sql
|
56
|
-
FROM sqlite_master
|
57
|
-
WHERE name='index_order_items_on_order_id' AND type='index'
|
58
|
-
UNION ALL
|
59
|
-
SELECT sql
|
60
|
-
FROM sqlite_temp_master
|
61
|
-
WHERE name='index_order_items_on_order_id' AND type='index'
|
62
|
-
[0m
|
63
|
-
[1m[35m (0.9ms)[0m CREATE INDEX "index_order_items_on_purchasable_id" ON "order_items" ("purchasable_id")
|
64
|
-
[1m[36m (0.1ms)[0m [1m SELECT sql
|
65
|
-
FROM sqlite_master
|
66
|
-
WHERE name='index_order_items_on_purchasable_id' AND type='index'
|
67
|
-
UNION ALL
|
68
|
-
SELECT sql
|
69
|
-
FROM sqlite_temp_master
|
70
|
-
WHERE name='index_order_items_on_purchasable_id' AND type='index'
|
71
|
-
[0m
|
72
|
-
[1m[35m (0.1ms)[0m SELECT sql
|
73
|
-
FROM sqlite_master
|
74
|
-
WHERE name='index_order_items_on_order_id' AND type='index'
|
75
|
-
UNION ALL
|
76
|
-
SELECT sql
|
77
|
-
FROM sqlite_temp_master
|
78
|
-
WHERE name='index_order_items_on_order_id' AND type='index'
|
79
|
-
|
80
|
-
[1m[36m (1.0ms)[0m [1mCREATE INDEX "index_order_items_on_purchasable_type_and_purchasable_id" ON "order_items" ("purchasable_type", "purchasable_id")[0m
|
81
|
-
[1m[35m (1.1ms)[0m CREATE TABLE "orders" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "user_id" integer, "purchase_state" varchar, "purchased_at" datetime, "payment" text, "created_at" datetime NOT NULL, "updated_at" datetime NOT NULL, "note" text, "total" integer, "tax_rate" decimal(6,3), "subtotal" integer, "tax" integer, "payment_provider" varchar, "payment_card" varchar)
|
82
|
-
[1m[36m (1.8ms)[0m [1mCREATE INDEX "index_orders_on_user_id" ON "orders" ("user_id")[0m
|
83
|
-
[1m[35m (0.8ms)[0m CREATE TABLE "products" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "title" varchar, "price" integer DEFAULT 0, "tax_exempt" boolean, "created_at" datetime NOT NULL, "updated_at" datetime NOT NULL)
|
84
|
-
[1m[36m (0.9ms)[0m [1mCREATE TABLE "product_with_float_prices" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "title" varchar, "price" decimal DEFAULT 0, "tax_exempt" boolean, "created_at" datetime NOT NULL, "updated_at" datetime NOT NULL) [0m
|
85
|
-
[1m[35m (1.0ms)[0m CREATE TABLE "subscriptions" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "customer_id" integer, "stripe_plan_id" varchar, "stripe_subscription_id" varchar, "stripe_coupon_id" varchar, "title" varchar, "price" integer DEFAULT 0, "created_at" datetime, "updated_at" datetime)
|
86
|
-
[1m[36m (1.2ms)[0m [1mCREATE TABLE "users" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "encrypted_password" varchar, "reset_password_token" varchar, "reset_password_sent_at" datetime, "remember_created_at" datetime, "confirmation_sent_at" datetime, "confirmed_at" datetime, "confirmation_token" varchar, "unconfirmed_email" varchar, "sign_in_count" integer DEFAULT 0, "current_sign_in_at" datetime, "last_sign_in_at" datetime, "current_sign_in_ip" varchar, "last_sign_in_ip" varchar, "email" varchar, "roles_mask" integer DEFAULT 0, "archived" boolean DEFAULT 'f', "updated_at" datetime, "created_at" datetime) [0m
|
87
|
-
[1m[35m (2.4ms)[0m CREATE TABLE "schema_migrations" ("version" varchar NOT NULL)
|
88
|
-
[1m[36m (1.0ms)[0m [1mCREATE UNIQUE INDEX "unique_schema_migrations" ON "schema_migrations" ("version")[0m
|
89
|
-
[1m[35m (0.1ms)[0m SELECT version FROM "schema_migrations"
|
90
|
-
[1m[36m (0.8ms)[0m [1mINSERT INTO "schema_migrations" (version) VALUES ('5')[0m
|
data/spec/dummy/log/test.log
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
[1m[36m (0.5ms)[0m [1mSELECT MAX("orders"."id") FROM "orders"[0m
|