effective_qb_online 0.1.2 → 0.1.5
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.
- checksums.yaml +4 -4
- data/app/jobs/qb_sync_order_job.rb +1 -1
- data/app/models/effective/qb_api.rb +28 -1
- data/app/views/admin/qb_online/_company.html.haml +46 -32
- data/app/views/admin/qb_receipts/_form.html.haml +1 -1
- data/lib/effective_qb_online/version.rb +1 -1
- data/lib/generators/effective_qb_online/install_generator.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b576a3949ed29e03fff73780968b77c380cd4454c8117b39aba87690f96a0ae9
|
4
|
+
data.tar.gz: c16c7f2ad020a416e0fae62fa98016cff913f1bd372e4e06feb8cd042954ebae
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 07c548ac7ea522e377897dca08cb17f77b3db74b3633bd61135584297857c04100a7adc1942f410b141dbbb2c7e3968e748c2769f4e32c98fbd627977924c8fc
|
7
|
+
data.tar.gz: d4986d17edbe98241942c5888537f2593fcbab09a0ddf81c6194989a0daf7db7124025c992c0d39ac1157077314cd8b6dd3dcdbdecd6dabd05e4a00e428e6c99
|
@@ -1,7 +1,7 @@
|
|
1
1
|
class QbSyncOrderJob < ApplicationJob
|
2
2
|
queue_as :default
|
3
3
|
|
4
|
-
def perform(order)
|
4
|
+
def perform(order, opts = {})
|
5
5
|
raise('expected a purchased Effective::Order') unless order.kind_of?(Effective::Order) && order.purchased?
|
6
6
|
|
7
7
|
puts "Starting QB Sync Order Job for order #{order}"
|
@@ -41,6 +41,14 @@ module Effective
|
|
41
41
|
)
|
42
42
|
end
|
43
43
|
|
44
|
+
def api_error
|
45
|
+
begin
|
46
|
+
company_info.present?; nil
|
47
|
+
rescue => e
|
48
|
+
return e.message
|
49
|
+
end
|
50
|
+
end
|
51
|
+
|
44
52
|
# Singular
|
45
53
|
def company_info
|
46
54
|
with_service('CompanyInfo') { |service| service.fetch_by_id(realm.realm_id) }
|
@@ -67,10 +75,29 @@ module Effective
|
|
67
75
|
items
|
68
76
|
.reject { |item| item.type == 'Category' }
|
69
77
|
.sort_by { |item| [item.type, item.name] }
|
70
|
-
.map { |item| [item
|
78
|
+
.map { |item| [item_name(item), item.id, {'data-html': item_html(item)}, item.type] }
|
71
79
|
.group_by(&:last)
|
72
80
|
end
|
73
81
|
|
82
|
+
def item_name(item)
|
83
|
+
[
|
84
|
+
item.name,
|
85
|
+
("##{item.id}"),
|
86
|
+
(item.sku if item.sku.present?),
|
87
|
+
(item.description if item.description.present?)
|
88
|
+
].compact.join(' ')
|
89
|
+
end
|
90
|
+
|
91
|
+
def item_html(item)
|
92
|
+
details = [
|
93
|
+
("##{item.id}"),
|
94
|
+
(item.sku if item.sku.present?),
|
95
|
+
(item.description if item.description.present?)
|
96
|
+
].compact.join(', ')
|
97
|
+
|
98
|
+
"<span>#{item.name}</span> <small>(#{details})</small>"
|
99
|
+
end
|
100
|
+
|
74
101
|
def payment_methods
|
75
102
|
with_service('PaymentMethod') { |service| service.all }
|
76
103
|
end
|
@@ -1,32 +1,46 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
%
|
5
|
-
%
|
6
|
-
%
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
%
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
%
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
%
|
20
|
-
|
21
|
-
|
22
|
-
.
|
23
|
-
.
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
%
|
28
|
-
|
29
|
-
|
30
|
-
.
|
31
|
-
.
|
32
|
-
|
1
|
+
- company_info = (api.company_info rescue nil)
|
2
|
+
|
3
|
+
- if company_info.present?
|
4
|
+
%table.table.table-sm
|
5
|
+
%tbody
|
6
|
+
%tr
|
7
|
+
%td Name
|
8
|
+
%td= company_info.company_name
|
9
|
+
|
10
|
+
%tr
|
11
|
+
%td Country
|
12
|
+
%td= company_info.country
|
13
|
+
|
14
|
+
%tr
|
15
|
+
%td QuickBooks Online
|
16
|
+
%td
|
17
|
+
= link_to('Revoke Access and Disconnect', effective_qb_online.revoke_quickbooks_oauth_path, class: 'btn btn-sm btn-danger', 'data-method': 'delete', 'data-confirm': 'Really disconnect from QuickBooks Online?')
|
18
|
+
|
19
|
+
%tr
|
20
|
+
%td Deposit to Account
|
21
|
+
%td
|
22
|
+
= effective_form_with(model: [:admin, api.realm], engine: true) do |f|
|
23
|
+
.row
|
24
|
+
.col= f.select :deposit_to_account_id, api.accounts_collection, grouped: true, label: false
|
25
|
+
.col= f.save
|
26
|
+
|
27
|
+
%tr
|
28
|
+
%td Payment Method
|
29
|
+
%td
|
30
|
+
= effective_form_with(model: [:admin, api.realm], engine: true) do |f|
|
31
|
+
.row
|
32
|
+
.col= f.select :payment_method_id, api.payment_methods_collection, label: false
|
33
|
+
.col= f.save
|
34
|
+
|
35
|
+
|
36
|
+
- if company_info.blank?
|
37
|
+
%table.table.table-sm
|
38
|
+
%tbody
|
39
|
+
%tr
|
40
|
+
%td QuickBooks API Error
|
41
|
+
%td= api.api_error
|
42
|
+
|
43
|
+
%tr
|
44
|
+
%td QuickBooks Online
|
45
|
+
%td
|
46
|
+
= link_to('Revoke Access and Disconnect', effective_qb_online.revoke_quickbooks_oauth_path, class: 'btn btn-sm btn-danger', 'data-method': 'delete', 'data-confirm': 'Really disconnect from QuickBooks Online?')
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: effective_qb_online
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.5
|
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: 2022-
|
11
|
+
date: 2022-04-11 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|