effective_orders 6.7.0 → 6.7.2
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/controllers/effective/providers/moneris_checkout.rb +5 -0
- data/app/models/concerns/acts_as_purchasable.rb +3 -0
- data/app/models/effective/order.rb +7 -0
- data/app/models/effective/tax_rate_calculator.rb +8 -8
- data/app/views/effective/orders/_order_payment.html.haml +1 -1
- data/lib/effective_orders/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: cf1784e619c52695ef3be94dfd8ed164c5c6b0f81e2a853239ba5963e916ee14
|
4
|
+
data.tar.gz: ef0eeb3c19bd456a8d806dfb0ea2963b06b0a2786ce2e7d0f0071c261ed61162
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: dba9ec63003ed63c5b40ea9aae431c42ea55d11eb496acfe9154e07e5ecdc5ab41f7b37be0b6ab1d65747bc7515b77fc342cb841491c714aab238d7c5d0f182b
|
7
|
+
data.tar.gz: 5b809f63ee1cb262688f69f274b79519711b7a8fc5eec2028fdc76aa1fcb579bd78bd6aac681227947e86ea43737f54693889aac79d82237a145ab4ed32316d7
|
@@ -22,6 +22,11 @@ module Effective
|
|
22
22
|
)
|
23
23
|
end
|
24
24
|
|
25
|
+
if payment['card_type'].present?
|
26
|
+
active_card = "**** **** **** #{payment['first6last4'].to_s.last(4)} #{payment['card_type']} #{payment['expiry_date'].to_s.first(2)}/#{payment['expiry_date'].to_s.last(2)}"
|
27
|
+
payment = payment.except('first6last4').merge('active_card' => active_card)
|
28
|
+
end
|
29
|
+
|
25
30
|
order_purchased(
|
26
31
|
payment: payment,
|
27
32
|
provider: 'moneris_checkout',
|
@@ -54,6 +54,9 @@ module ActsAsPurchasable
|
|
54
54
|
|
55
55
|
scope :purchased_by, lambda { |user| joins(order_items: :order).where(orders: { purchased_by: user, status: :purchased }).distinct }
|
56
56
|
scope :not_purchased_by, lambda { |user| where.not(id: purchased_by(user)) }
|
57
|
+
|
58
|
+
scope :purchased_or_deferred, -> { joins(order_items: :order).where(orders: { status: [:purchased, :deferred] }) }
|
59
|
+
scope :deferred, -> { joins(order_items: :order).where(orders: { status: :deferred }) }
|
57
60
|
end
|
58
61
|
|
59
62
|
module ClassMethods
|
@@ -103,7 +103,10 @@ module Effective
|
|
103
103
|
scope :sorted, -> { order(:id) }
|
104
104
|
|
105
105
|
scope :purchased, -> { where(status: :purchased) }
|
106
|
+
scope :purchased_or_deferred, -> { where(status: [:purchased, :deferred]) }
|
107
|
+
|
106
108
|
scope :purchased_by, lambda { |user| purchased.where(user: user) }
|
109
|
+
|
107
110
|
scope :not_purchased, -> { where.not(status: [:purchased, :deferred]) }
|
108
111
|
scope :was_not_purchased, -> { where.not(status: :purchased) }
|
109
112
|
|
@@ -406,6 +409,10 @@ module Effective
|
|
406
409
|
payment[:active_card][15,4]
|
407
410
|
end
|
408
411
|
|
412
|
+
last4 ||= if payment['active_card'] && payment['active_card'].include?('**** **** ****')
|
413
|
+
payment['active_card'][15,4]
|
414
|
+
end
|
415
|
+
|
409
416
|
# stripe, moneris, moneris_checkout
|
410
417
|
last4 ||= (payment['f4l4'] || payment['first6last4']).to_s.last(4)
|
411
418
|
|
@@ -30,14 +30,14 @@ module Effective
|
|
30
30
|
country = country_code
|
31
31
|
state = state_code
|
32
32
|
|
33
|
-
if order.present?
|
34
|
-
country ||= order.billing_address.country_code
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
state ||= order.user.billing_address.state_code
|
33
|
+
if order.present?
|
34
|
+
country ||= order.billing_address.try(:country_code)
|
35
|
+
country ||= order.organization.try(:billing_address).try(:country_code)
|
36
|
+
country ||= order.user.try(:billing_address).try(:country_code)
|
37
|
+
|
38
|
+
state ||= order.billing_address.try(:state_code)
|
39
|
+
state ||= order.organization.try(:billing_address).try(:state_code)
|
40
|
+
state ||= order.user.try(:billing_address).try(:state_code)
|
41
41
|
end
|
42
42
|
|
43
43
|
rate = RATES[country]
|
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.7.
|
4
|
+
version: 6.7.2
|
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: 2023-08-
|
11
|
+
date: 2023-08-14 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|