effective_qb_online 0.8.2 → 0.8.4
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/models/effective/qb_api.rb +20 -2
- data/app/models/effective/qb_receipt.rb +10 -2
- data/lib/effective_qb_online/version.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: e4a6e26114f3805b82bdbcbc34318059adb74df98bb512ae0615e007afbd51ea
|
|
4
|
+
data.tar.gz: f53a3c1ce92f2c00173b9c6f546f73c857aee00727804cd58e92dcfef51b6f2f
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 87d0bebfa848203a06341107077234f66d1c3a54aa749c210c270770af4d42d2e66b258c181dc33cc142e3441e6fab7aab32c938317266f16f1725f8f95d84ee
|
|
7
|
+
data.tar.gz: 6470e477febff32df0df7a648df3521f6ea65f1433f244f99ce095a56c1f76f1e1d68ed58b2abd32ad8a3a00f98980cdeb8c459bf751359b1f50a307c111758f
|
|
@@ -105,7 +105,25 @@ module Effective
|
|
|
105
105
|
raise('expected an Effective::Order') unless order.kind_of?(Effective::Order)
|
|
106
106
|
|
|
107
107
|
with_service('Customer') do |service|
|
|
108
|
-
|
|
108
|
+
util = Quickbooks::Util::QueryBuilder.new
|
|
109
|
+
|
|
110
|
+
# Find by display name
|
|
111
|
+
customer = service.find_by(:display_name, scrub(order.qb_online_customer_display_name))&.first
|
|
112
|
+
|
|
113
|
+
# Find by email
|
|
114
|
+
customer ||= if order.email.present?
|
|
115
|
+
email = util.clause("PrimaryEmailAddr", "LIKE", order.email)
|
|
116
|
+
service.query("SELECT * FROM Customer WHERE #{email}")&.first
|
|
117
|
+
end
|
|
118
|
+
|
|
119
|
+
# Find by first name and last name
|
|
120
|
+
customer ||= if order.billing_first_name.present? && order.billing_last_name.present?
|
|
121
|
+
first_name = util.clause("GivenName", "LIKE", order.billing_first_name)
|
|
122
|
+
last_name = util.clause("FamilyName", "LIKE", order.billing_last_name)
|
|
123
|
+
service.query("SELECT * FROM Customer WHERE #{first_name} AND #{last_name}")&.first
|
|
124
|
+
end
|
|
125
|
+
|
|
126
|
+
customer
|
|
109
127
|
end
|
|
110
128
|
end
|
|
111
129
|
|
|
@@ -116,7 +134,7 @@ module Effective
|
|
|
116
134
|
with_service('Customer') do |service|
|
|
117
135
|
customer = Quickbooks::Model::Customer.new(
|
|
118
136
|
primary_email_address: Quickbooks::Model::EmailAddress.new(order.email),
|
|
119
|
-
display_name: scrub(order.
|
|
137
|
+
display_name: scrub(order.qb_online_customer_display_name)
|
|
120
138
|
)
|
|
121
139
|
|
|
122
140
|
service.create(customer)
|
|
@@ -67,8 +67,16 @@ module Effective
|
|
|
67
67
|
sales_receipt = api.create_sales_receipt(sales_receipt: sales_receipt)
|
|
68
68
|
|
|
69
69
|
# Sanity check
|
|
70
|
-
if
|
|
71
|
-
|
|
70
|
+
if EffectiveOrders.try(:credit_card_surcharge_qb_item_name).present?
|
|
71
|
+
if (expected = api.price_to_amount(order.total)) != sales_receipt.total
|
|
72
|
+
raise("A QuickBooks Online Sales Receipt has been created with an unexpected total. QuickBooks total is #{sales_receipt.total} but we expected #{expected}. Please adjust the Sales Receipt on QuickBooks")
|
|
73
|
+
end
|
|
74
|
+
end
|
|
75
|
+
|
|
76
|
+
if EffectiveOrders.try(:credit_card_surcharge_qb_item_name).blank?
|
|
77
|
+
if (expected = api.price_to_amount(order.amount_owing)) != sales_receipt.total
|
|
78
|
+
raise("A QuickBooks Online Sales Receipt has been created with an unexpected total. QuickBooks total is #{sales_receipt.total} but we expected #{expected}. Please adjust the Sales Receipt on QuickBooks")
|
|
79
|
+
end
|
|
72
80
|
end
|
|
73
81
|
|
|
74
82
|
assign_attributes(result: 'completed successfully', sales_receipt_id: sales_receipt.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.8.
|
|
4
|
+
version: 0.8.4
|
|
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: 2025-12-
|
|
11
|
+
date: 2025-12-09 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: rails
|