effective_qb_sync 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (92) hide show
  1. checksums.yaml +7 -0
  2. data/MIT-LICENSE +20 -0
  3. data/README.md +94 -0
  4. data/Rakefile +21 -0
  5. data/app/controllers/admin/qb_syncs_controller.rb +60 -0
  6. data/app/controllers/effective/qb_sync_controller.rb +40 -0
  7. data/app/models/effective/access_denied.rb +17 -0
  8. data/app/models/effective/datatables/qb_syncs.rb +30 -0
  9. data/app/models/effective/qb_log.rb +13 -0
  10. data/app/models/effective/qb_machine.rb +281 -0
  11. data/app/models/effective/qb_order_item.rb +13 -0
  12. data/app/models/effective/qb_order_items_form.rb +55 -0
  13. data/app/models/effective/qb_request.rb +262 -0
  14. data/app/models/effective/qb_ticket.rb +55 -0
  15. data/app/models/effective/qbwc_supervisor.rb +89 -0
  16. data/app/views/admin/qb_syncs/_actions.html.haml +2 -0
  17. data/app/views/admin/qb_syncs/_qb_item_names.html.haml +9 -0
  18. data/app/views/admin/qb_syncs/index.html.haml +24 -0
  19. data/app/views/admin/qb_syncs/instructions.html.haml +136 -0
  20. data/app/views/admin/qb_syncs/show.html.haml +52 -0
  21. data/app/views/effective/orders_mailer/qb_sync_error.html.haml +56 -0
  22. data/app/views/effective/qb_sync/authenticate.erb +12 -0
  23. data/app/views/effective/qb_sync/clientVersion.erb +8 -0
  24. data/app/views/effective/qb_sync/closeConnection.erb +8 -0
  25. data/app/views/effective/qb_sync/connectionError.erb +9 -0
  26. data/app/views/effective/qb_sync/getLastError.erb +9 -0
  27. data/app/views/effective/qb_sync/receiveResponseXML.erb +8 -0
  28. data/app/views/effective/qb_sync/sendRequestXML.erb +8 -0
  29. data/app/views/effective/qb_sync/serverVersion.erb +8 -0
  30. data/app/views/effective/qb_web_connector/quickbooks.qwc.erb +12 -0
  31. data/config/routes.rb +16 -0
  32. data/db/migrate/01_create_effective_qb_sync.rb.erb +68 -0
  33. data/lib/effective_qb_sync/engine.rb +42 -0
  34. data/lib/effective_qb_sync/version.rb +3 -0
  35. data/lib/effective_qb_sync.rb +42 -0
  36. data/lib/generators/effective_qb_sync/install_generator.rb +42 -0
  37. data/lib/generators/templates/effective_qb_sync.rb +61 -0
  38. data/lib/generators/templates/effective_qb_sync_mailer_preview.rb +39 -0
  39. data/spec/dummy/README.rdoc +8 -0
  40. data/spec/dummy/Rakefile +6 -0
  41. data/spec/dummy/app/assets/javascripts/application.js +13 -0
  42. data/spec/dummy/app/assets/stylesheets/application.css +15 -0
  43. data/spec/dummy/app/controllers/application_controller.rb +5 -0
  44. data/spec/dummy/app/helpers/application_helper.rb +2 -0
  45. data/spec/dummy/app/models/product.rb +14 -0
  46. data/spec/dummy/app/models/product_with_float_price.rb +13 -0
  47. data/spec/dummy/app/models/user.rb +14 -0
  48. data/spec/dummy/app/views/layouts/application.html.erb +14 -0
  49. data/spec/dummy/bin/bundle +3 -0
  50. data/spec/dummy/bin/rails +4 -0
  51. data/spec/dummy/bin/rake +4 -0
  52. data/spec/dummy/config/application.rb +32 -0
  53. data/spec/dummy/config/boot.rb +5 -0
  54. data/spec/dummy/config/database.yml +25 -0
  55. data/spec/dummy/config/environment.rb +5 -0
  56. data/spec/dummy/config/environments/development.rb +37 -0
  57. data/spec/dummy/config/environments/production.rb +80 -0
  58. data/spec/dummy/config/environments/test.rb +36 -0
  59. data/spec/dummy/config/initializers/backtrace_silencers.rb +7 -0
  60. data/spec/dummy/config/initializers/cookies_serializer.rb +3 -0
  61. data/spec/dummy/config/initializers/devise.rb +254 -0
  62. data/spec/dummy/config/initializers/effective_addresses.rb +15 -0
  63. data/spec/dummy/config/initializers/effective_orders.rb +154 -0
  64. data/spec/dummy/config/initializers/effective_qb_sync.rb +41 -0
  65. data/spec/dummy/config/initializers/filter_parameter_logging.rb +4 -0
  66. data/spec/dummy/config/initializers/inflections.rb +16 -0
  67. data/spec/dummy/config/initializers/mime_types.rb +4 -0
  68. data/spec/dummy/config/initializers/session_store.rb +3 -0
  69. data/spec/dummy/config/initializers/simple_form.rb +189 -0
  70. data/spec/dummy/config/initializers/wrap_parameters.rb +14 -0
  71. data/spec/dummy/config/locales/en.yml +23 -0
  72. data/spec/dummy/config/routes.rb +3 -0
  73. data/spec/dummy/config/secrets.yml +22 -0
  74. data/spec/dummy/config.ru +4 -0
  75. data/spec/dummy/db/schema.rb +208 -0
  76. data/spec/dummy/db/test.sqlite3 +0 -0
  77. data/spec/dummy/log/development.log +90 -0
  78. data/spec/dummy/log/test.log +1 -0
  79. data/spec/dummy/public/404.html +67 -0
  80. data/spec/dummy/public/422.html +67 -0
  81. data/spec/dummy/public/500.html +66 -0
  82. data/spec/dummy/public/favicon.ico +0 -0
  83. data/spec/fixtures/qbxml_response_error.xml +6 -0
  84. data/spec/fixtures/qbxml_response_success.xml +621 -0
  85. data/spec/models/acts_as_purchasable_spec.rb +131 -0
  86. data/spec/models/factories_spec.rb +32 -0
  87. data/spec/models/qb_machine_spec.rb +554 -0
  88. data/spec/models/qb_request_spec.rb +327 -0
  89. data/spec/models/qb_ticket_spec.rb +62 -0
  90. data/spec/spec_helper.rb +45 -0
  91. data/spec/support/factories.rb +97 -0
  92. metadata +397 -0
@@ -0,0 +1,2 @@
1
+ = link_to effective_qb_sync.admin_qb_sync_path(qb_sync), title: 'View' do
2
+ %span.glyphicon.glyphicon-eye-open
@@ -0,0 +1,9 @@
1
+ %table.table
2
+ %thead
3
+ %th Quickbooks Item Name/Number
4
+ -#%th Website object
5
+ %tbody
6
+ - ActsAsPurchasable.descendants.each do |klass|
7
+ %tr
8
+ %td= klass.new().try(:qb_item_name)
9
+ -#%td= klass.name
@@ -0,0 +1,24 @@
1
+ %h2.effective-qb-sync-page-title= (@page_title || 'Quickbooks Synchronizations')
2
+
3
+ %p.text-right.effective-qb-sync-page-action
4
+ = link_to 'Quickbooks Setup Instructions', effective_qb_sync.instructions_admin_qb_syncs_path, class: 'btn btn-primary'
5
+
6
+ %hr
7
+ - unsynced = Effective::QbRequest.new_requests_for_unsynced_items.length
8
+
9
+ - if unsynced == 0
10
+ %p All orders have been synchronized with Quickbooks.
11
+ - elsif unsynced == 1
12
+ %p There is 1 order ready to be synchronized with Quickbooks.
13
+ - else
14
+ %p There are #{unsynced} orders ready to be synchronized with Quickbooks.
15
+
16
+ %hr
17
+
18
+ - if @datatable.nil?
19
+ %p Please install #{link_to 'effective_datatables', 'https://github.com/code-and-effect/effective_datatables'} to see this page.
20
+ - elsif @datatable.present?
21
+ = render_datatable @datatable
22
+ - else
23
+ %p There are no Quickbook Syncs present
24
+
@@ -0,0 +1,136 @@
1
+ %h2.effective-qb-sync-page-title= @page_title
2
+
3
+ %h3 1. Create a Quickbooks user for sync
4
+
5
+ %p The Quickbooks web connector requires a user be created for synchronization.
6
+
7
+ %ul
8
+ %li
9
+ Open the Quickbooks Pro company file that will be synchronized with the website
10
+ %li
11
+ Click Company -> Set up Users and Passwords -> Set Up Users...
12
+ - if EffectiveQbSync.quickbooks_username.present? && EffectiveQbSync.quickbooks_password.present?
13
+ %li
14
+ Add a Quickbooks user with username
15
+ %strong= EffectiveQbSync.quickbooks_username
16
+ and password
17
+ %strong= EffectiveQbSync.quickbooks_password
18
+ - else
19
+ %li
20
+ (developer) Add a quickbooks_username and quickbooks_password to the config/initializers/effective_qb_sync.rb file
21
+ %ul
22
+ %li Add a Quickbooks user with that same username and password
23
+ %li Access for user: "Selected areas of Quickbooks"
24
+ %li Sales and Accounts Receivable "Selective Access - Create transactions only"
25
+ %li Purchases and Accounts Payable "No Access"
26
+ %li Chequing and Credit Cards "No Access"
27
+ %li Time Tracking "No Access"
28
+ %li Payroll and Employees "No Access"
29
+ %li Sales Tax "No Access"
30
+ %li Sensitive Accounting Activities "No Access"
31
+ %li Sensitive Financial Reporting "No Access"
32
+ %li Changing or Deleting Transactions "Yes" and "No"
33
+ %li Finished
34
+
35
+ %h3 2. Create all Quickbooks items
36
+
37
+ %p
38
+ Each acts_as_purchasable object on the website has a qb_item_name that must match an existing Quickbooks Item.
39
+ %br
40
+ The website's price will override any Quickbooks default item prices.
41
+
42
+ %p Make sure a Quickbooks Item exists for each of the following:
43
+ = render partial: '/admin/qb_syncs/qb_item_names'
44
+
45
+ %p To add an Item in Quickbooks:
46
+
47
+ %ul
48
+ %li Click the menu bar Lists -> Item List
49
+ %li In the bottom left, Item -> New
50
+ %li Make sure the "Item Name/Number" matches with above.
51
+
52
+ %h3 3. Configure the Quickbooks Sales Tax Behaviour
53
+
54
+ %p Quickbooks sales tax can be configured in one of two ways:
55
+
56
+ %ul
57
+ %li
58
+ Sales tax should be added by Quickbooks
59
+ %ul
60
+ %li Click Edit -> Preferences -> Sales Tax -> Company Preferences
61
+ %li Do you charge sales tax? Yes
62
+ %li Add sales tax item...
63
+ %li Set the config/initializers/effective_qb_sync.rb "quickbooks_tax_name" to an empty string
64
+ %li When synchronizing, the website will not add in the tax amount
65
+ %li Quickbooks will consider the order subtotal and add the appropriate tax amount
66
+
67
+ %li
68
+ Sales tax should be added by the website
69
+ %ul
70
+ %li Click Edit -> Preferences -> Sales Tax -> Company Preferences
71
+ %li Do you charge sales tax? No
72
+ %li Add a regular Quickbooks Item (as per 2. Create all Quickbooks items instructions, above)
73
+ %li
74
+ - if EffectiveQbSync.quickbooks_tax_name.present?
75
+ Ensure that the Item Name in Quickbooks is
76
+ %strong #{EffectiveQbSync.quickbooks_tax_name}
77
+ - else
78
+ (developer) Add a quickbooks_tax_name to the config/initializers/effective_qb_sync.rb file
79
+ %li The website will add an additional line item with the tax amount.
80
+
81
+ %p
82
+ Currently, the website is configured such that:
83
+ %strong
84
+ - if EffectiveQbSync.quickbooks_tax_name.present?
85
+ Sales tax should be added by the website
86
+ - else
87
+ Sales tax should be added by Quickbooks
88
+
89
+
90
+ %h3 4. Configure the Quickbooks Web Connector
91
+
92
+ %p Now that the Quickbooks company file has been configured, it is time to set up the Quickbooks Web Connector program.
93
+
94
+ %ul
95
+ %li
96
+ Download the #{link_to 'quickbooks web connector .qwc file', (effective_qb_sync.qwc_admin_qb_syncs_path)} and put it somewhere safe
97
+ %li
98
+ Open the Quickbooks Web Connector program from the Start menu
99
+ %ul
100
+ %li Click Add an application
101
+ %li Select the .qwc file just downloaded
102
+ %li Click OK to add the new web service
103
+ %li Select any of the 'Yes' options (Yes, always; allow access even if Quickbooks is not running is prefered) and Continue...
104
+ %li Done
105
+ %li
106
+ If the .qwc file doesn't add properly, you can edit the .qwc file with wordpad, and check the following:
107
+ %ul
108
+ %li The AppID must be unique between all other .qwc files
109
+ %li
110
+ The AppURL must be an
111
+ %strong https://
112
+ url that ends with
113
+ %strong= effective_qb_sync.qb_sync_path
114
+ such as
115
+ %strong https://myapp.heroku.com#{effective_qb_sync.qb_sync_path}
116
+ %li The AppSupport url doesn't matter
117
+ %li The UserName must be present and match an existing user
118
+ %li The OwnerID and FileID values must also be unique between all other .qwc files
119
+ %li Enter the password as above and Save it
120
+
121
+
122
+ %h3 5. Start the Synchronization
123
+
124
+ %p Everything is ready to go. Good luck with the first synchronization!
125
+
126
+ %ul
127
+ %li Open the Quickbooks Web Connector
128
+ %li Check the far left checkbox next to the new application
129
+ %li Click Update Selected to do the sync
130
+ %li (optional) or enable Auto-Run
131
+ %li
132
+ If any synchronization errors occur,
133
+ %strong= EffectiveQbSync.error_email || EffectiveOrders.mailer[:admin_email]
134
+ will receive an email with instructions on how to fix the error
135
+
136
+
@@ -0,0 +1,52 @@
1
+ %h2.effective-qb-sync-page-title= @page_title
2
+
3
+ %table.table
4
+ %tbody
5
+ - @qb_ticket.attributes.except('hpc_response', 'qb_request_id', 'id').each do |key, value|
6
+ %tr
7
+ %th= key.titleize
8
+ %td= value
9
+
10
+ %h3 Orders
11
+
12
+ = 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|
13
+ %table.table
14
+ %thead
15
+ %tr
16
+ %th Order
17
+ %th Order Item
18
+ %th Quickbooks Item Name
19
+ %tbody
20
+ - @qb_ticket.orders.each do |order|
21
+ - order.order_items.each_with_index do |order_item, index|
22
+ %tr
23
+ %td= (link_to(('#' + order.to_param.to_s), effective_orders.admin_order_path(order)) if index == 0)
24
+ %td= order_item
25
+ %td
26
+ = f.simple_fields_for :qb_order_items, order_item.qb_order_item do |foi|
27
+ = foi.input :order_item_id, as: :hidden, value: order_item.id
28
+ = foi.input :name, label: false, required: false
29
+
30
+ %p= f.button :submit, 'Save Quickbooks Item Names', data: { disable_with: 'Saving...' }
31
+
32
+
33
+
34
+ %h3 Sync Log
35
+
36
+ %table.table
37
+ %thead
38
+ %tr
39
+ %th Time
40
+ %th Message
41
+ %tbody
42
+ - @qb_ticket.qb_logs.each do |qb_log|
43
+ %tr
44
+ %th= qb_log.created_at.strftime("%H:%M:%S").html_safe
45
+ %td= qb_log.message
46
+
47
+
48
+
49
+
50
+
51
+
52
+
@@ -0,0 +1,56 @@
1
+ !!!
2
+ %html
3
+ %head
4
+ %meta{:content => 'text/html; charset=UTF-8', 'http-equiv' => "Content-Type"}
5
+ %body
6
+
7
+ %p
8
+ %strong An error occurred while synchronizing QuickBooks:
9
+
10
+ - if @error.present?
11
+ %p= @error
12
+
13
+ - if @order.present?
14
+ %p
15
+ %strong= "Order ##{@order.to_param}"
16
+ %br
17
+ = @order.created_at
18
+ %br
19
+ = @order.billing_name
20
+ %br
21
+ - @order.order_items.each do |oi|
22
+ = "#{oi.title} (#{oi.try(:qb_item_name)})"
23
+ %br
24
+
25
+ %p
26
+ %strong Resolution steps:
27
+
28
+ %ol
29
+ - if @error.include?('invalid reference to QuickBooks Item')
30
+ %li Confirm the QuickBooks Item Names for this Order within QuickBooks
31
+ %li Visit the website administration
32
+ %li Visit the Orders screen, find the order, and click the 'QB Item Names'
33
+ %li Update each order item with a correct Item Name
34
+ %li Update the Product (Event, Membership Type, Product, etc.) with the correct Item Name
35
+ %li Re-run the QuickBooks Sync
36
+
37
+ - elsif @error.include?('the list element is already in use')
38
+ %li This customer could not be created because they share a name with an existing Item Name. This could be as a Vendor, Product, or Service.
39
+ %li Search QuickBooks for the non-customer item name and rename it. Ex: rename "John Doe" to "John Doe (Vendor)"
40
+ %li Re-run the QuickBooks Sync
41
+
42
+ - elsif @error.include?('cannot use the same tax item')
43
+ %li QuickBooks has been configured to automatically add GST for this item, but the order already contains a GST line item
44
+ %li Edit the item in QuickBooks and uncheck the inclusion of GST
45
+ %li Re-run the QuickBooks Sync
46
+
47
+ - else
48
+ %li This is an error without a predefined resolution. Please wait for AgileStyle to follow up with you.
49
+
50
+ -# Common error messages for refernece:
51
+
52
+ -# An unexpected error occurred: Order 31 could not be synchronized with QuickBooks: There is an "qbitemname" in the SalesReceipt line. QuickBooks error message: Invalid argument. The specified record does not exist in the list.
53
+
54
+ -# An unexpected error occurred: Order 190 could not be synchronized with QuickBooks: There is an invalid reference to QuickBooks Item "GST (1) On Sales" in the SalesReceipt line. QuickBooks error message: You cannot use the same tax item in both the line items and the txn tax.
55
+
56
+ -# An unexpected error occurred: Customer Peter Jenkins could not be created in QuickBooks: The name "Peter Jenkins" of the list element is already in use.
@@ -0,0 +1,12 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns1="http://developer.intuit.com/">
3
+ <SOAP-ENV:Body>
4
+ <ns1:authenticateResponse>
5
+ <ns1:authenticateResult>
6
+ <ns1:string><%= @token %></ns1:string>
7
+ <ns1:string><%= @message %></ns1:string>
8
+ </ns1:authenticateResult>
9
+ </ns1:authenticateResponse>
10
+ </SOAP-ENV:Body>
11
+ </SOAP-ENV:Envelope>
12
+
@@ -0,0 +1,8 @@
1
+ <?xml version="1.0" encoding="utf-8"?>
2
+ <soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
3
+ <soap:Body>
4
+ <clientVersionResponse xmlns="http://developer.intuit.com/">
5
+ <clientVersionResult><%= @version %></clientVersionResult>
6
+ </clientVersionResponse>
7
+ </soap:Body>
8
+ </soap:Envelope>
@@ -0,0 +1,8 @@
1
+ <?xml version="1.0" encoding="utf-8"?>
2
+ <soap12:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap12="http://www.w3.org/2003/05/soap-envelope">
3
+ <soap12:Body>
4
+ <closeConnectionResponse xmlns="http://developer.intuit.com/">
5
+ <closeConnectionResult><%= @message %></closeConnectionResult>
6
+ </closeConnectionResponse>
7
+ </soap12:Body>
8
+ </soap12:Envelope>
@@ -0,0 +1,9 @@
1
+ <?xml version="1.0" encoding="utf-8"?>
2
+ <soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
3
+ <soap:Body>
4
+ <connectionErrorResponse xmlns="http://developer.intuit.com/">
5
+ <connectionErrorResult><%= @message %></connectionErrorResult>
6
+ </connectionErrorResponse>
7
+ </soap:Body>
8
+ </soap:Envelope>
9
+
@@ -0,0 +1,9 @@
1
+ <?xml version="1.0" encoding="utf-8"?>
2
+ <soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
3
+ <soap:Body>
4
+ <getLastErrorResponse xmlns="http://developer.intuit.com/">
5
+ <getLastErrorResult><%= @message %></getLastErrorResult>
6
+ </getLastErrorResponse>
7
+ </soap:Body>
8
+ </soap:Envelope>
9
+
@@ -0,0 +1,8 @@
1
+ <?xml version="1.0" encoding="utf-8"?>
2
+ <soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
3
+ <soap:Body>
4
+ <receiveResponseXMLResponse xmlns="http://developer.intuit.com/">
5
+ <receiveResponseXMLResult><%= @message %></receiveResponseXMLResult>
6
+ </receiveResponseXMLResponse>
7
+ </soap:Body>
8
+ </soap:Envelope>
@@ -0,0 +1,8 @@
1
+ <?xml version="1.0" encoding="utf-8"?>
2
+ <soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
3
+ <soap:Body>
4
+ <sendRequestXMLResponse xmlns="http://developer.intuit.com/">
5
+ <sendRequestXMLResult><%= @message %></sendRequestXMLResult>
6
+ </sendRequestXMLResponse>
7
+ </soap:Body>
8
+ </soap:Envelope>
@@ -0,0 +1,8 @@
1
+ <?xml version="1.0" encoding="utf-8"?>
2
+ <soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
3
+ <soap:Body>
4
+ <serverVersionResponse xmlns="http://developer.intuit.com/">
5
+ <serverVersionResult><%= @version %></serverVersionResult>
6
+ </serverVersionResponse>
7
+ </soap:Body>
8
+ </soap:Envelope>
@@ -0,0 +1,12 @@
1
+ <QBWCXML>
2
+ <AppName><%= Rails.application.class.parent_name.upcase %> Web Connector</AppName>
3
+ <AppID>{<%= SecureRandom.uuid.upcase %>}</AppID>
4
+ <AppURL><%= effective_qb_sync.qb_sync_url(protocol: 'https') %></AppURL>
5
+ <AppDescription><%= Rails.application.class.parent_name.upcase %> EffectiveOrders to Quickbooks Web Connector</AppDescription>
6
+ <AppSupport><%= effective_qb_sync.instructions_admin_qb_syncs_url(protocol: 'https') %></AppSupport>
7
+ <UserName><%= EffectiveQbSync.quickbooks_username || 'MISSING' %></UserName>
8
+ <OwnerID>{<%= SecureRandom.uuid.upcase %>}</OwnerID>
9
+ <FileID>{<%= SecureRandom.uuid.upcase %>}</FileID>
10
+ <QBType>QBFS</QBType>
11
+ <Style>DocWrapped</Style>
12
+ </QBWCXML>
data/config/routes.rb ADDED
@@ -0,0 +1,16 @@
1
+ Rails.application.routes.draw do
2
+ mount EffectiveQbSync::Engine => '/', as: 'effective_qb_sync'
3
+ end
4
+
5
+ EffectiveQbSync::Engine.routes.draw do
6
+ scope module: 'effective' do
7
+ match 'quickbooks/api', to: 'qb_sync#api', as: 'qb_sync', via: :all
8
+ end
9
+
10
+ namespace :admin do
11
+ resources :qb_syncs, only: [:index, :show, :update] do
12
+ get :instructions, on: :collection
13
+ get :qwc, on: :collection
14
+ end
15
+ end
16
+ end
@@ -0,0 +1,68 @@
1
+ class CreateEffectiveQbSync < ActiveRecord::Migration
2
+ def self.up
3
+ create_table <%= @qb_requests_table_name %> do |t|
4
+ t.integer :order_id
5
+ t.integer :qb_ticket_id
6
+
7
+ t.string :state, default: 'Processing'
8
+ t.text :error
9
+
10
+ t.string :request_type
11
+ t.text :request_qbxml
12
+ t.text :response_qbxml
13
+
14
+ t.datetime :request_sent_at
15
+ t.datetime :response_received_at
16
+
17
+ t.timestamps
18
+ end
19
+ add_index <%= @qb_requests_table_name %>, :order_id
20
+
21
+ create_table <%= @qb_tickets_table_name %> do |t|
22
+ t.integer :qb_request_id
23
+
24
+ t.string :username
25
+ t.text :hpc_response
26
+ t.string :company_file_name
27
+ t.string :country
28
+ t.string :qbxml_major_version
29
+ t.string :qbxml_minor_version
30
+
31
+ t.string :state, default: 'Ready'
32
+ t.integer :percent, default: 0
33
+
34
+ t.text :connection_error_hresult
35
+ t.text :connection_error_message
36
+ t.text :last_error
37
+
38
+ t.timestamps
39
+ end
40
+ add_index <%= @qb_tickets_table_name %>, :qb_request_id
41
+
42
+ create_table <%= @qb_logs_table_name %> do |t|
43
+ t.integer :qb_ticket_id
44
+
45
+ t.text :message
46
+
47
+ t.timestamps
48
+ end
49
+ add_index <%= @qb_logs_table_name %>, :qb_ticket_id
50
+
51
+ create_table <%= @qb_order_items_table_name %> do |t|
52
+ t.integer :order_item_id
53
+
54
+ t.string :name
55
+
56
+ t.timestamps
57
+ end
58
+ add_index <%= @qb_order_items_table_name %>, :order_item_id
59
+
60
+ end
61
+
62
+ def self.down
63
+ drop_table <%= @qb_requests_table_name %>
64
+ drop_table <%= @qb_tickets_table_name %>
65
+ drop_table <%= @qb_logs_table_name %>
66
+ drop_table <%= @qb_order_items_table_name %>
67
+ end
68
+ end