spree_loyalty_points 1.0.1 → 1.0.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.
- data/README.md +1 -1
- data/app/models/concerns/spree/payment/loyalty_points.rb +4 -0
- data/app/models/spree/app_configuration_decorator.rb +0 -1
- data/app/models/spree/loyalty_points_transaction.rb +0 -3
- data/app/models/spree/payment_decorator.rb +0 -1
- data/app/models/spree/payment_method_decorator.rb +3 -1
- data/lib/tasks/loyalty_points/award.rake +0 -2
- metadata +4 -4
data/README.md
CHANGED
@@ -5,6 +5,10 @@ module Spree
|
|
5
5
|
module LoyaltyPoints
|
6
6
|
extend ActiveSupport::Concern
|
7
7
|
|
8
|
+
included do
|
9
|
+
scope :by_loyalty_points, -> { joins(:payment_method).readonly(false).where(:spree_payment_methods => { type: 'Spree::PaymentMethod::LoyaltyPoints'}) }
|
10
|
+
end
|
11
|
+
|
8
12
|
module ClassMethods
|
9
13
|
|
10
14
|
def any_with_loyalty_points?
|
@@ -12,13 +12,10 @@ module Spree
|
|
12
12
|
validate :source_or_comment_present
|
13
13
|
validate :transactions_total_range, if: -> { source.present? && source.loyalty_points_transactions.present? }
|
14
14
|
|
15
|
-
#TODO -> rspecs missing for this scope
|
16
15
|
scope :for_order, ->(order) { where(source: order) }
|
17
16
|
|
18
|
-
#TODO -> Rspecs missing for this callback.
|
19
17
|
before_create :generate_transaction_id
|
20
18
|
|
21
|
-
#TODO -> Rspecs missing for this method.
|
22
19
|
def transaction_type
|
23
20
|
CLASS_TO_TRANSACTION_TYPE[type]
|
24
21
|
end
|
@@ -5,7 +5,6 @@ Spree::Payment.class_eval do
|
|
5
5
|
|
6
6
|
validates :amount, numericality: { greater_than: 0 }, :if => :by_loyalty_points?
|
7
7
|
scope :state_not, ->(s) { where('state != ?', s) }
|
8
|
-
scope :by_loyalty_points, -> { joins(:payment_method).readonly(false).where(:spree_payment_methods => { type: 'Spree::PaymentMethod::LoyaltyPoints'}) }
|
9
8
|
|
10
9
|
fsm = self.state_machines[:state]
|
11
10
|
fsm.after_transition :from => fsm.states.map(&:name) - [:completed], :to => [:completed], :do => :notify_paid_order
|
@@ -1,7 +1,9 @@
|
|
1
1
|
Spree::PaymentMethod.class_eval do
|
2
2
|
|
3
|
+
scope :loyalty_points_type, -> { where(type: 'Spree::PaymentMethod::LoyaltyPoints') }
|
4
|
+
|
3
5
|
def self.loyalty_points_id_included?(method_ids)
|
4
|
-
|
6
|
+
loyalty_points_type.where(id: method_ids).size != 0
|
5
7
|
end
|
6
8
|
|
7
9
|
end
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: spree_loyalty_points
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 19
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 1
|
8
8
|
- 0
|
9
|
-
-
|
10
|
-
version: 1.0.
|
9
|
+
- 2
|
10
|
+
version: 1.0.2
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Jatin Baweja
|
@@ -16,7 +16,7 @@ autorequire:
|
|
16
16
|
bindir: bin
|
17
17
|
cert_chain: []
|
18
18
|
|
19
|
-
date: 2014-
|
19
|
+
date: 2014-03-05 00:00:00 Z
|
20
20
|
dependencies:
|
21
21
|
- !ruby/object:Gem::Dependency
|
22
22
|
name: spree_core
|