effective_orders 6.29.7 → 6.30.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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 9beef9eeb047dc515cda23db8001b8a816e44f8f2ff440ef804a6135ea3a843b
4
- data.tar.gz: f621cbae970ea961847e258519c508fae2a28f55f8a6f4f14249636ce9b26d4b
3
+ metadata.gz: aee4787c09a06d02aa6af53d268cdcd591a1945b6707c4fd0df859e6ed395a33
4
+ data.tar.gz: 9774c66eb6892dff37be2f21ae73700232afe8d6b70bdc85acfbaf7500db09a9
5
5
  SHA512:
6
- metadata.gz: b3ab2700a219c1a26ba49c7cc16e007b2678b45da7496080ab6fa3c7ce267ced4f42874dcf74026f0c93f6cabf5725ab65720a2fceb2987083f5a42ab617082f
7
- data.tar.gz: 050c6e81ba740942b39f64d20af131aa845be1b6a7ad7edfef13dc0146cbbfedbd9af19b67dbd1b7d90c40ce2037c60ff463016b9ef7566b407bdc5191cf9265
6
+ metadata.gz: b9c729ade3bd37a3b03096ca717ad097dee983e8ccc1b6e8869fd5014e9da9b336b3866978e332bf97adfd682020bbe2a0b6867a440293438b337d95d5e6ba88
7
+ data.tar.gz: fe21232c2ed494ab678d4ab2b7c000b056aa9c2270d2800c38d1a77c24a78ef9ca95f0052cd4bf982e4be8503f90f41dd4b81ba53656be1fcc73a92af0710628
@@ -77,7 +77,9 @@ module Effective
77
77
  note_to_buyer :text # From admin to buyer
78
78
  note_internal :text # Internal admin only
79
79
 
80
- billing_name :string # name of buyer
80
+ billing_name :string # name of buyer
81
+ billing_first_name :string
82
+ billing_last_name :string
81
83
  email :string # same as user.email
82
84
  cc :string # can be set by admin
83
85
 
@@ -429,6 +431,19 @@ module Effective
429
431
  [to_s, billing_name.presence, email.presence, total_to_s].compact.join(' - ')
430
432
  end
431
433
 
434
+ def qb_online_customer_display_name
435
+ return billing_name if billing_first_name.blank? || billing_last_name.blank?
436
+
437
+ case EffectiveOrders.qb_online_customer_display_name_format
438
+ when :first_last
439
+ "#{billing_first_name} #{billing_last_name}"
440
+ when :last_first
441
+ "#{billing_last_name}, #{billing_first_name}"
442
+ else
443
+ raise("invalid qb_online_customer_display_name_format: #{EffectiveOrders.qb_online_customer_display_name_format}")
444
+ end
445
+ end
446
+
432
447
  def label
433
448
  if refund? && purchased?
434
449
  'Refund'
@@ -472,14 +487,6 @@ module Effective
472
487
  end
473
488
  end
474
489
 
475
- def billing_first_name
476
- billing_name.to_s.split(' ').first
477
- end
478
-
479
- def billing_last_name
480
- Array(billing_name.to_s.split(' ')[1..-1]).join(' ')
481
- end
482
-
483
490
  def in_progress?
484
491
  pending? || confirmed? || deferred?
485
492
  end
@@ -752,6 +759,7 @@ module Effective
752
759
  # We support two different Quickbooks synchronization gems: effective_qb_sync and effective_qb_online
753
760
  def sync_quickbooks!(skip:)
754
761
  if EffectiveOrders.qb_online?
762
+ skip ||= (EffectiveOrders.qb_online_sync_free_orders? if free?)
755
763
  skip ? EffectiveQbOnline.skip_order!(self) : EffectiveQbOnline.sync_order!(self)
756
764
  end
757
765
 
@@ -1084,7 +1092,13 @@ module Effective
1084
1092
 
1085
1093
  # Organization first
1086
1094
  def assign_billing_name
1087
- self.billing_name = billing_address.try(:full_name).presence || organization.to_s.presence || user.to_s.presence
1095
+ owner = (organization || user)
1096
+
1097
+ assign_attributes(
1098
+ billing_name: owner.to_s.presence,
1099
+ billing_first_name: owner.try(:first_name).presence,
1100
+ billing_last_name: owner.try(:last_name).presence
1101
+ )
1088
1102
  end
1089
1103
 
1090
1104
  # User first
@@ -19,10 +19,13 @@ EffectiveOrders.setup do |config|
19
19
  # config.organization_enabled = false
20
20
  # config.organization_class_name = 'Example::Organization'
21
21
 
22
- # Synchronize with Quickbooks
22
+ # Effective Quickbooks Synchronization
23
23
  config.use_effective_qb_sync = false
24
24
  config.use_effective_qb_online = false
25
25
 
26
+ config.qb_online_sync_free_orders = true
27
+ config.qb_online_customer_display_name_format = :first_last
28
+
26
29
  # Display the item name field on the orders#new screen
27
30
  config.use_item_names = true
28
31
 
@@ -56,7 +59,7 @@ EffectiveOrders.setup do |config|
56
59
  # Will be applied to all orders based off the after-tax total.
57
60
  # Use 2.4 for 2.4% or nil for none
58
61
  config.credit_card_surcharge_percent = nil
59
- config.credit_card_surcharge_qb_item_name = 'Credit Card Surcharge'
62
+ config.credit_card_surcharge_qb_item_name = nil # 'Credit Card Surcharge'
60
63
 
61
64
  # Minimum Charge
62
65
  # Prevent orders less than this value from being purchased
@@ -23,6 +23,8 @@ class CreateEffectiveOrders < ActiveRecord::Migration[6.0]
23
23
  t.text :note_internal
24
24
 
25
25
  t.string :billing_name
26
+ t.string :billing_first_name
27
+ t.string :billing_last_name
26
28
  t.string :email
27
29
  t.string :cc
28
30
 
@@ -1,3 +1,3 @@
1
1
  module EffectiveOrders
2
- VERSION = '6.29.7'.freeze
2
+ VERSION = '6.30.0'.freeze
3
3
  end
@@ -42,7 +42,10 @@ module EffectiveOrders
42
42
  :send_subscription_trialing, :send_subscription_trial_expired,
43
43
  :send_refund_notification_to_admin,
44
44
 
45
- # Quickbooks Online Sync Errors
45
+ # Quickbooks Online
46
+ :qb_online_sync_free_orders, :qb_online_customer_display_name_format,
47
+
48
+ # Quickbooks Online Error Emails
46
49
  :send_qb_online_sync_error, :qb_online_sync_error_recipients,
47
50
 
48
51
  # Features
@@ -223,6 +226,10 @@ module EffectiveOrders
223
226
  use_effective_qb_online && defined?(EffectiveQbOnline)
224
227
  end
225
228
 
229
+ def self.qb_online_sync_free_orders?
230
+ qb_online_sync_free_orders != false
231
+ end
232
+
226
233
  def self.use_item_names?
227
234
  use_item_names != false
228
235
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: effective_orders
3
3
  version: !ruby/object:Gem::Version
4
- version: 6.29.7
4
+ version: 6.30.0
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-08 00:00:00.000000000 Z
11
+ date: 2025-12-09 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails