unidom-price 1.4.1 → 1.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +10 -2
- data/app/models/unidom/price/price.rb +1 -0
- data/app/types/unidom/price/charging.rb +7 -0
- data/config/enum.yml +11 -0
- data/config/locales/enum.zh-CN.yml +5 -0
- data/lib/unidom/price/version.rb +1 -1
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ae7ea7b7ce37f9e2175e1cfb5b6ea571d8e487bf
|
4
|
+
data.tar.gz: cae78a1bdfc17538c70fd939c6fa7698012b8288
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3d29943e072be1c3109a5efe7964ba99bbf918a26fd3b04ba5b39798f2090ec252893449ba730bd6cc1101bdcfe584d8cad5b547a6f9fa5f03879c556566b853
|
7
|
+
data.tar.gz: 330734b9fcd88e5b2525d4e45a5583bc63653cf41b506f6353bace1316412ebdc9786714241615811fea933a6700592f3b00887036f4fe7778efb31f907b586c
|
data/README.md
CHANGED
@@ -97,6 +97,14 @@ The As Priced concern do the following tasks for the includer automatically:
|
|
97
97
|
### Calculation enum code
|
98
98
|
|
99
99
|
```ruby
|
100
|
-
Unidom::Price::Calculation::AMOUNT
|
101
|
-
Unidom::Price::Calculation::PERCENTAGE
|
100
|
+
Unidom::Price::Calculation::AMOUNT # 金额
|
101
|
+
Unidom::Price::Calculation::PERCENTAGE # 百分比
|
102
|
+
```
|
103
|
+
|
104
|
+
### Charging enum code
|
105
|
+
|
106
|
+
```ruby
|
107
|
+
Unidom::Price::Charging::ONE_TIME # 一次性收费
|
108
|
+
Unidom::Price::Charging::RECURRING # 重复性收费
|
109
|
+
Unidom::Price::Charging::UTILIZATION # 使用率收费
|
102
110
|
```
|
@@ -18,6 +18,7 @@ class Unidom::Price::Price < Unidom::Price::ApplicationRecord
|
|
18
18
|
scope :priced_is, ->(priced) { where priced: priced }
|
19
19
|
|
20
20
|
code :calculation, Unidom::Price::Calculation
|
21
|
+
code :charging, Unidom::Price::Charging
|
21
22
|
|
22
23
|
def self.price!(priced, amount: 0, pricer: nil, calculation_code: 'AMNT', pricing_code: 'BASE', charging_code: 'ONCE', opened_at: Time.now)
|
23
24
|
price = priced_is(priced).calculation_coded_as(calculation_code).pricing_coded_as(pricing_code).charging_coded_as(charging_code).valid_at.alive.first
|
data/config/enum.yml
CHANGED
@@ -5,3 +5,14 @@ enum:
|
|
5
5
|
code: AMNT
|
6
6
|
percentage:
|
7
7
|
code: PCTG
|
8
|
+
|
9
|
+
unidom_charging:
|
10
|
+
one_time:
|
11
|
+
code: ONCE
|
12
|
+
description: such as for buying a good
|
13
|
+
recurring:
|
14
|
+
code: RECR
|
15
|
+
description: an ongoing charge such as a monthly fee for a standard type of service
|
16
|
+
utilization:
|
17
|
+
code: UTLZ
|
18
|
+
description: usage of a product
|
data/lib/unidom/price/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: unidom-price
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: '1.5'
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Topbit Du
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-12-
|
11
|
+
date: 2016-12-26 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: unidom-common
|
@@ -47,6 +47,7 @@ files:
|
|
47
47
|
- app/models/unidom/price/concerns/as_pricer.rb
|
48
48
|
- app/models/unidom/price/price.rb
|
49
49
|
- app/types/unidom/price/calculation.rb
|
50
|
+
- app/types/unidom/price/charging.rb
|
50
51
|
- app/views/layouts/unidom/price/application.html.erb
|
51
52
|
- config/enum.yml
|
52
53
|
- config/locales/enum.zh-CN.yml
|