effective_qb_online 0.9.9 → 0.9.10
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: e6a3e221e9f86bab6fec4bbdf698d486a12924850960c797e897a79a9dde137e
|
|
4
|
+
data.tar.gz: eceb1df9ab98fd686e43e23572ef6be5ace97720bddaf35df4878dee8c5fafbe
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 481a68ddeda1c7dd2fc07f6c5a44758df77f7bed84a84313f8f33850c3b061a59444c5f3f9654e35f114677752e12b750909f0fb45e5298a8d6a7282e59a19ab
|
|
7
|
+
data.tar.gz: 6840d8757d7d237283957334a868f447348395972f42e09c036bd6b6f16ac6e7baf5b84dea43419d9653e2e9968527c8dfba2a10424ee4d41f87978c1800fa2c
|
|
@@ -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)
|
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.10
|
|
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-20 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: rails
|