effective_orders 5.2.12 → 5.2.16

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: e6fc5fddf4893dd467c30bd2ae4f505b1c4f4f191e819601364bc230d8530627
4
- data.tar.gz: 6a157d58abcf4836b1324b17dbee3fcb502e23e2924d59daa1ef8a957cb91fbb
3
+ metadata.gz: f39960e8a8f551838180f27b80909a6aaeab1b2188ed64940dc3fe35a97a44a7
4
+ data.tar.gz: 7910cdfe509ba84be703aad6bc452bfd53e9b8760027cc17e1bac280b9d373ac
5
5
  SHA512:
6
- metadata.gz: 9c98604d9238a92c62d41422b31f63001144fa47eaa5dbcf7359cf98ec849e8846d07db9be11e498df0024b66212bb674afcc646ab9f7bf4922c8b446a947ba5
7
- data.tar.gz: 537d27c651f334bb17a189d4f3085eca6f0b33e9aaa742ea9ae270f5f3f6d00746d56007a10a5abbe2941ecbd083ae42a052bfbeecc627f0a79e31076b2dcb7c
6
+ metadata.gz: 87a550796efef35f0175625db99570302027b6f091cb5fdea1510b3a3d4c7691c26c947e6a0e6e4dc95b11bc683fc333fa3590605b5313b527df64186b77c26a
7
+ data.tar.gz: 1b73bd83140864c0fbb70ee9bbbe684f5e36abdeb2ecb68cd10ba4bbebc7cc4c83d34673760c2e2fc15484d678b651b563293881ee0449eb5f09eb72639d20f0
@@ -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
@@ -333,8 +333,12 @@ module Effective
333
333
  else payment_card.to_s
334
334
  end unless payment_provider == 'free'
335
335
 
336
+ last4 = if payment[:active_card] && payment[:active_card].include?('**** **** ****')
337
+ payment[:active_card][15,4]
338
+ end
339
+
336
340
  # stripe, moneris, moneris_checkout
337
- last4 = (payment[:active_card] || payment['f4l4'] || payment['first6last4']).to_s.last(4)
341
+ last4 ||= (payment['f4l4'] || payment['first6last4']).to_s.last(4)
338
342
 
339
343
  [card, '-', last4].compact.join(' ')
340
344
  end
@@ -484,7 +488,7 @@ module Effective
484
488
  self.payment = payment_to_h(payment) if self.payment.blank?
485
489
 
486
490
  begin
487
- EffectiveResources.transaction do
491
+ Effective::Order.transaction do
488
492
  run_purchasable_callbacks(:before_purchase)
489
493
 
490
494
  save!
@@ -493,7 +497,7 @@ module Effective
493
497
  run_purchasable_callbacks(:after_purchase)
494
498
  end
495
499
  rescue => e
496
- EffectiveResources.transaction do
500
+ Effective::Order.transaction do
497
501
  save!(validate: false)
498
502
  update_purchasables_purchased_order!
499
503
  end
@@ -533,7 +537,7 @@ module Effective
533
537
  skip_buyer_validations: true
534
538
  )
535
539
 
536
- EffectiveResources.transaction do
540
+ Effective::Order.transaction do
537
541
  begin
538
542
  run_purchasable_callbacks(:before_decline)
539
543
  save!(validate: validate)
@@ -665,11 +669,19 @@ module Effective
665
669
 
666
670
  def run_purchasable_callbacks(name)
667
671
  order_items.select { |item| item.purchasable.respond_to?(name) }.each do |item|
668
- EffectiveResources.transaction(item) { item.purchasable.public_send(name, self, item) }
672
+ if item.class.respond_to?(:transaction)
673
+ item.class.transaction { item.purchasable.public_send(name, self, item) }
674
+ else
675
+ item.purchasable.public_send(name, self, item)
676
+ end
669
677
  end
670
678
 
671
679
  if parent.respond_to?(name)
672
- EffectiveResources.transaction(parent) { parent.public_send(name, self) }
680
+ if parent.class.respond_to?(:transaction)
681
+ parent.class.transaction { parent.public_send(name, self) }
682
+ else
683
+ parent.public_send(name, self)
684
+ end
673
685
  end
674
686
 
675
687
  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.12'.freeze
2
+ VERSION = '5.2.16'.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.12
4
+ version: 5.2.16
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: 2022-01-04 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