effective_qb_online 0.9.9 → 0.9.11
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
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 78e60bd08d0c81f3aee5084c32b6276cb0c01f4e5ca7fee043451003f84e0745
|
|
4
|
+
data.tar.gz: e6e5d58197ffb083cf351f0cd4931729769a716f47d5751fbfa0a4c02134adcc
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 5d58050f4a1c942479d9b6ab5494de290e9e3111d0c7b46837aa321b53dbc61c032000bfef27cc32ac917e7618acfaaef18d23433a22cb4611c5a9d27817bb6d
|
|
7
|
+
data.tar.gz: 3685f8ac6b49b091dcbfd000e8aebcf8191ee7883cae82095b69013db939f5b3de2380d7aabc3c5cf5757207590c4cadfb2f224e1a112ba04f5fad2c7ac86587
|
|
@@ -66,6 +66,12 @@ module Effective
|
|
|
66
66
|
sales_receipt = Effective::QbSalesReceipt.build_from_receipt!(self, api: api)
|
|
67
67
|
sales_receipt = api.create_sales_receipt(sales_receipt: sales_receipt)
|
|
68
68
|
|
|
69
|
+
# The SalesReceipt now exists in QuickBooks. Persist its id immediately so a
|
|
70
|
+
# later failure (e.g. the total sanity checks below) doesn't orphan it. Without
|
|
71
|
+
# this, a re-sync would try to create it again and QuickBooks rejects the
|
|
72
|
+
# reused DocNumber with a Duplicate Document Number Error.
|
|
73
|
+
update_column(:sales_receipt_id, sales_receipt.id)
|
|
74
|
+
|
|
69
75
|
# Sanity check
|
|
70
76
|
if EffectiveOrders.try(:credit_card_surcharge_qb_item_name).present? && !EffectiveOrders.try(:fee_saver?)
|
|
71
77
|
if (expected = api.price_to_amount(order.total)) != sales_receipt.total
|
|
@@ -38,8 +38,11 @@ module Effective
|
|
|
38
38
|
end
|
|
39
39
|
|
|
40
40
|
receipt.qb_receipt_items.each do |receipt_item|
|
|
41
|
+
# The purchasable may have been deleted. When it's missing we can't auto-match
|
|
42
|
+
# the QuickBooks item from its qb_item_id/qb_item_name, so we fall back to the
|
|
43
|
+
# QbReceiptItem's item_id (mapped manually in the admin). The SalesReceipt line
|
|
44
|
+
# items are built from the OrderItem, so a missing purchasable is not fatal.
|
|
41
45
|
purchasable = receipt_item.order_item.purchasable
|
|
42
|
-
raise("Expected a purchasable for Effective::OrderItem #{receipt_item.order_item.id}") unless purchasable.present?
|
|
43
46
|
|
|
44
47
|
# Either of these could match
|
|
45
48
|
purchasable_id_name = [
|
|
@@ -59,7 +62,7 @@ module Effective
|
|
|
59
62
|
|
|
60
63
|
if item.blank?
|
|
61
64
|
purchasable_id_name = [purchasable.try(:qb_item_id), purchasable.try(:qb_item_name)].compact
|
|
62
|
-
raise("Unknown Item #{purchasable_id_name.join(' or ')} from #{purchasable} (#{purchasable.class.name} ##{purchasable
|
|
65
|
+
raise("Unknown Item #{purchasable_id_name.join(' or ')} from #{purchasable} (#{purchasable.class.name} ##{purchasable&.id})")
|
|
63
66
|
end
|
|
64
67
|
|
|
65
68
|
receipt_item.update!(item_id: item.id)
|
|
@@ -162,13 +165,14 @@ module Effective
|
|
|
162
165
|
end
|
|
163
166
|
|
|
164
167
|
# Order item names may contain HTML (e.g. an EventRegistrant's "Member" badge).
|
|
165
|
-
# QuickBooks line item descriptions are plain text, so strip the markup while keeping
|
|
166
|
-
#
|
|
168
|
+
# QuickBooks line item descriptions are plain text, so strip the markup while keeping the badge text.
|
|
169
|
+
# <br> and carry spacing, so they become spaces rather than being dropped or passed through.
|
|
170
|
+
# The sanitizer re-encodes as it strips, so unescape after or a title with an & syncs as &
|
|
167
171
|
def self.strip_html(value)
|
|
168
172
|
return value if value.blank?
|
|
169
173
|
|
|
170
|
-
text = value.to_s.gsub(/<br\s*\/?>/i, ' ')
|
|
171
|
-
|
|
174
|
+
text = ActionView::Base.full_sanitizer.sanitize(value.to_s.gsub(/<br\s*\/?>/i, ' '))
|
|
175
|
+
CGI.unescapeHTML(text.gsub(' ', ' ')).squish
|
|
172
176
|
end
|
|
173
177
|
|
|
174
178
|
end
|
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.9.
|
|
4
|
+
version: 0.9.11
|
|
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: 2026-
|
|
11
|
+
date: 2026-07-24 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: rails
|