omega-tariffs-base 0.1.6 → 0.1.7
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/Rakefile +1 -1
- data/lib/single_time_filter.rb +3 -5
- data/omega-tariffs-base.gemspec +1 -1
- data/spec/single_time_filter_spec.rb +2 -2
- metadata +3 -3
data/Rakefile
CHANGED
data/lib/single_time_filter.rb
CHANGED
@@ -8,9 +8,10 @@ module UniqSysOmega
|
|
8
8
|
@payments.member? [ tarif_id, login_id, period_id ]
|
9
9
|
end
|
10
10
|
|
11
|
-
def register_single_payment(tarif_id, login_id, period_id)
|
11
|
+
def register_single_payment(tarif_id, login_id, period_id, fin_transaction_id)
|
12
12
|
@payments ||= [ ]
|
13
13
|
@payments << [ tarif_id, login_id, period_id ] unless had_single_payment?(tarif_id, login_id, period_id)
|
14
|
+
true
|
14
15
|
end
|
15
16
|
end
|
16
17
|
end
|
@@ -50,12 +51,9 @@ module UniqSysOmega
|
|
50
51
|
def make_single_payment(ft, login_id, options)
|
51
52
|
return false unless can_make_single_payment?(login_id)
|
52
53
|
|
53
|
-
# TODO: Make it transactional!
|
54
|
-
SingleTimeFilterRepository.register_single_payment(tarif_id, login_id, options[:period].begin)
|
55
|
-
|
56
54
|
ft = ft.dup
|
57
55
|
ft.volume = @price
|
58
|
-
ft.save
|
56
|
+
ft.save and SingleTimeFilterRepository.register_single_payment(tarif_id, login_id, options[:period].begin, ft.id)
|
59
57
|
end
|
60
58
|
|
61
59
|
def after_initialize
|
data/omega-tariffs-base.gemspec
CHANGED
@@ -6,8 +6,8 @@ describe "SingleTimeFilterRepository" do
|
|
6
6
|
end
|
7
7
|
|
8
8
|
it "should return true for registered payments and false for the others" do
|
9
|
-
SingleTimeFilterRepository.register_single_payment(1, 2, 3)
|
10
|
-
SingleTimeFilterRepository.register_single_payment(1, 2, 7)
|
9
|
+
SingleTimeFilterRepository.register_single_payment(1, 2, 3, 4)
|
10
|
+
SingleTimeFilterRepository.register_single_payment(1, 2, 7, 4)
|
11
11
|
SingleTimeFilterRepository.had_single_payment?(1, 2, 3).should == true
|
12
12
|
SingleTimeFilterRepository.had_single_payment?(1, 2, 4).should == false
|
13
13
|
SingleTimeFilterRepository.had_single_payment?(1, 5, 3).should == false
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: omega-tariffs-base
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 21
|
5
5
|
prerelease: false
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 1
|
9
|
-
-
|
10
|
-
version: 0.1.
|
9
|
+
- 7
|
10
|
+
version: 0.1.7
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Uniq Systems
|