effective_orders 5.2.11 → 5.2.15

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 9ed1d4a8621f678e9117f8e6e562220ebe988ce26febfbf30cf7b842ff1a2c04
4
- data.tar.gz: 97271616a90392d36fbe3ff5302b5f3437a6fafb010ca478a386a28265939aaa
3
+ metadata.gz: fba0c7839a152e7d31995a7562c016c757e53cea88fd91eebd13716bd5cbd4af
4
+ data.tar.gz: b4a9abe9ae8b0f4813a2144e4282b3520247f9a44f0a6ed7ce2324eb6b9e397c
5
5
  SHA512:
6
- metadata.gz: bd81818649ad2d7527492260d7e84ad2cbf4a2fbc3af3d0aef32f2385bec5b7ae891ec176e02955a6e479090f1092a19ea1b06bcea9fdbc79fb62466e6ca2aab
7
- data.tar.gz: c1d4d06ced8f1b9910c6b0610ca44a6dfb981448400876df1f1bdcd68d282e1d4ee1984c018adcca6bd1be367b548d02a9769bd9cb312fa850cacf7ca08e5113
6
+ metadata.gz: 73abb8f0c16620de36ad27cf6ca0559a93910617d11eb352674383208352804813068d1f682ef5f22ec5364719ede17c2b40f3ea3b986de71baa16c11706af44
7
+ data.tar.gz: 07e880765995acda972d4011cda0ac57b750ffdab98bd4e3a5c1cd8a0bb9d68ff55a8e9bc4136df927ae018a9252c9fd8e5df59905387ff83496471582777d5b
@@ -65,7 +65,7 @@ module EffectiveMonerisCheckoutHelper
65
65
 
66
66
  def moneris_checkout_scrub(value)
67
67
  return value unless value.kind_of?(String)
68
- value.gsub(SCRUB, '')
68
+ value.gsub(SCRUB, '').first(50)
69
69
  end
70
70
 
71
71
  end
@@ -484,7 +484,7 @@ module Effective
484
484
  self.payment = payment_to_h(payment) if self.payment.blank?
485
485
 
486
486
  begin
487
- EffectiveResources.transaction do
487
+ Effective::Order.transaction do
488
488
  run_purchasable_callbacks(:before_purchase)
489
489
 
490
490
  save!
@@ -493,7 +493,7 @@ module Effective
493
493
  run_purchasable_callbacks(:after_purchase)
494
494
  end
495
495
  rescue => e
496
- EffectiveResources.transaction do
496
+ Effective::Order.transaction do
497
497
  save!(validate: false)
498
498
  update_purchasables_purchased_order!
499
499
  end
@@ -533,7 +533,7 @@ module Effective
533
533
  skip_buyer_validations: true
534
534
  )
535
535
 
536
- EffectiveResources.transaction do
536
+ Effective::Order.transaction do
537
537
  begin
538
538
  run_purchasable_callbacks(:before_decline)
539
539
  save!(validate: validate)
@@ -611,7 +611,7 @@ module Effective
611
611
 
612
612
  def assign_order_totals
613
613
  self.subtotal = present_order_items.map { |oi| oi.subtotal }.sum
614
- self.tax_rate = get_tax_rate() unless (tax_rate || 0) > 0
614
+ self.tax_rate = get_tax_rate()
615
615
  self.tax = get_tax()
616
616
  self.total = subtotal + (tax || 0)
617
617
  end
@@ -665,11 +665,19 @@ module Effective
665
665
 
666
666
  def run_purchasable_callbacks(name)
667
667
  order_items.select { |item| item.purchasable.respond_to?(name) }.each do |item|
668
- EffectiveResources.transaction(item) { item.purchasable.public_send(name, self, item) }
668
+ if item.class.respond_to?(:transaction)
669
+ item.class.transaction { item.purchasable.public_send(name, self, item) }
670
+ else
671
+ item.purchasable.public_send(name, self, item)
672
+ end
669
673
  end
670
674
 
671
675
  if parent.respond_to?(name)
672
- EffectiveResources.transaction(parent) { parent.public_send(name, self) }
676
+ if parent.class.respond_to?(:transaction)
677
+ parent.class.transaction { parent.public_send(name, self) }
678
+ else
679
+ parent.public_send(name, self)
680
+ end
673
681
  end
674
682
 
675
683
  true
@@ -68,7 +68,7 @@ module Effective
68
68
  # first or build
69
69
  def qb_item_name
70
70
  raise('expected EffectiveQbSync gem') unless defined?(EffectiveQbSync)
71
- (qb_order_item || build_qb_order_item(name: purchasable.qb_item_name)).name
71
+ (qb_order_item || build_qb_order_item(name: purchasable&.qb_item_name)).name
72
72
  end
73
73
 
74
74
  end
@@ -1,3 +1,3 @@
1
1
  module EffectiveOrders
2
- VERSION = '5.2.11'.freeze
2
+ VERSION = '5.2.15'.freeze
3
3
  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: 5.2.11
4
+ version: 5.2.15
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: 2021-12-23 00:00:00.000000000 Z
11
+ date: 2022-01-11 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails