dscf-banking 0.5.4 → 0.5.5

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 2120d4ec544cad8e92b56fdada27d93498dc94e49879ac723ffafb898e0ce59d
4
- data.tar.gz: 27c308d176f328a1aafec4f0f6dc860cfed388418224ae65cf1440a626bec56f
3
+ metadata.gz: e91b4944ed5da04e89193cc1e06db5150ea053f3f4cd4a8098a576f25585c8c9
4
+ data.tar.gz: 0c1ef04c3785327d68b9d87d6a62ad228329a9fde73e68b6893253614b31284a
5
5
  SHA512:
6
- metadata.gz: 42473d30dd0ebb03d49193d5beb0852d4499532bd0678297fb54fe80d8994357c5658bcd4e3896cd963aa6874cfcd11e441b7e6e24bf7f538d3a6167ad1e427a
7
- data.tar.gz: de39ecd9ca3c7c67ea0699f7378fe6d5bbf8b399283e7fe5603389161edf286cec5bbe4f05d69e603dead7727ef9ad35c1c0e4a1d31f72f7c3719807f186fa1f
6
+ metadata.gz: a9f07e8d19d474514261bb9189ed89b804525f34839b3ea55704861647a37aa69b840a5ad995b4d3e53c5d6d89237384db92f262173a5021f312257d3abd392e
7
+ data.tar.gz: af083b3874ca0b5e8161125409ed7c06974b8ccf3404f615d0e044bfe434e66022e4f691e6450f7f63a5cd5e15b49061151f4fa27c28ba0acb83aceb330c0a70
@@ -7,16 +7,18 @@ module Dscf::Banking
7
7
  before_validation :normalize_rate_attributes
8
8
  validate :interest_free_configuration_guidance
9
9
 
10
- validates :annual_interest_rate, presence: true, numericality: { greater_than: 0, less_than_or_equal_to: 1 }
11
- validates :income_tax_rate, presence: true, numericality: { greater_than_or_equal_to: 0, less_than_or_equal_to: 1 }
12
- validates :minimum_balance_for_interest, presence: true, numericality: { greater_than_or_equal_to: 0 }
13
- validates :calculation_method, presence: true
14
-
15
- validates :interest_basis, presence: true
16
- validates :accrual_frequency, presence: true
17
- validates :rounding_rule, presence: true
18
- validates :calculation_timing, presence: true
19
- validates :is_active, inclusion: { in: [ true, false ] }
10
+ with_options unless: :interest_free_configuration_request? do
11
+ validates :annual_interest_rate, presence: true, numericality: { greater_than: 0, less_than_or_equal_to: 1 }
12
+ validates :income_tax_rate, presence: true, numericality: { greater_than_or_equal_to: 0, less_than_or_equal_to: 1 }
13
+ validates :minimum_balance_for_interest, presence: true, numericality: { greater_than_or_equal_to: 0 }
14
+ validates :calculation_method, presence: true
15
+
16
+ validates :interest_basis, presence: true
17
+ validates :accrual_frequency, presence: true
18
+ validates :rounding_rule, presence: true
19
+ validates :calculation_timing, presence: true
20
+ validates :is_active, inclusion: { in: [ true, false ] }
21
+ end
20
22
  validate :promotional_dates_consistency
21
23
 
22
24
  enum :calculation_method, {
@@ -72,6 +74,10 @@ module Dscf::Banking
72
74
  )
73
75
  end
74
76
 
77
+ def interest_free_configuration_request?
78
+ no_interest_requested? && required_calculation_fields_missing?
79
+ end
80
+
75
81
  def normalize_rate_attributes
76
82
  self.annual_interest_rate = normalize_rate_value(annual_interest_rate_before_type_cast)
77
83
  self.income_tax_rate = normalize_rate_value(income_tax_rate_before_type_cast)
@@ -1,5 +1,5 @@
1
1
  module Dscf
2
2
  module Banking
3
- VERSION = "0.5.4"
3
+ VERSION = "0.5.5"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: dscf-banking
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.4
4
+ version: 0.5.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Asrat Efrem