unidom-order 1.3.3 → 1.4
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/README.md +15 -0
- data/app/models/unidom/order/order.rb +1 -0
- data/app/models/unidom/order/order_adjustment.rb +4 -0
- data/app/models/unidom/order/order_item.rb +1 -0
- data/app/types/unidom/order/adjustment_factor.rb +9 -0
- data/config/enum.yml +15 -0
- data/config/locales/enum.zh-CN.yml +10 -0
- data/lib/unidom/order/engine.rb +6 -0
- data/lib/unidom/order/version.rb +1 -1
- metadata +5 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2d1fa66d2364b60de3450cfe90fc68f9f72c2db8
|
4
|
+
data.tar.gz: e2adc0a6972748779bcf763951bfa2098900f612
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f7b20de05ccbe2922ed4e7152419c84557fd4732c69e518a7a3c1abe6658af14c845ffafa592e11ffea60665b7c2cf4741334bac8a92b499684d2813a469bf88
|
7
|
+
data.tar.gz: 34f2db87779651a16dff3d2402ba482c5dabdd04cb6fda6fb11af14386376766cda62670321029a9e9b352a81de318b298029b12b7cd77ef0a60fd0588363be2
|
data/README.md
CHANGED
@@ -126,3 +126,18 @@ The As Order Placer concern do the following tasks for the includer automaticall
|
|
126
126
|
|
127
127
|
The As Order Taker concern do the following tasks for the includer automatically:
|
128
128
|
1. Define the has_many :taken_orders macro as: ``has_many :taken_orders, class_name: 'Unidom::Order::Order', as: :taker``
|
129
|
+
|
130
|
+
|
131
|
+
|
132
|
+
## Enum codes
|
133
|
+
|
134
|
+
### Adjustment Factor enum code 调整因素
|
135
|
+
|
136
|
+
```ruby
|
137
|
+
Unidom::Order::AdjustmentFactor::DISCOUNT_ADJUSTMENT # 折扣调整
|
138
|
+
Unidom::Order::AdjustmentFactor::SURCHARGE_ADJUSTMENT # 额外费调整
|
139
|
+
Unidom::Order::AdjustmentFactor::SALES_TAX # 销售税
|
140
|
+
Unidom::Order::AdjustmentFactor::SHIPPING_AND_HANDLING_CHARGES # 装运和处理费
|
141
|
+
Unidom::Order::AdjustmentFactor::FEE # 手续费
|
142
|
+
Unidom::Order::AdjustmentFactor::MISCELLANEOUS_CHARGE # 杂项收费
|
143
|
+
```
|
@@ -1,3 +1,4 @@
|
|
1
|
+
##
|
1
2
|
# Order Adjustment 是订单调整项。
|
2
3
|
|
3
4
|
class Unidom::Order::OrderAdjustment < Unidom::Order::ApplicationRecord
|
@@ -5,6 +6,7 @@ class Unidom::Order::OrderAdjustment < Unidom::Order::ApplicationRecord
|
|
5
6
|
self.table_name = 'unidom_order_adjustments'
|
6
7
|
|
7
8
|
include Unidom::Common::Concerns::ModelExtension
|
9
|
+
include ProgneTapera::EnumCode
|
8
10
|
|
9
11
|
validates :amount, presence: true, numericality: { less_than: 1000000000, greater_than: -1000000000 }
|
10
12
|
|
@@ -12,6 +14,8 @@ class Unidom::Order::OrderAdjustment < Unidom::Order::ApplicationRecord
|
|
12
14
|
|
13
15
|
scope :adjusted_is, ->(adjusted) { where adjusted: adjusted }
|
14
16
|
|
17
|
+
code :adjustment_factor, Unidom::Order::AdjustmentFactor
|
18
|
+
|
15
19
|
def self.adjust!(adjusted, amount: 0, due_to: 'FRGT', opened_at: Time.now)
|
16
20
|
query = adjusted_is(adjusted).adjustment_factor_coded_as(due_to).valid_at(now: opened_at).alive
|
17
21
|
adjustment = query.first
|
data/config/enum.yml
ADDED
data/lib/unidom/order/engine.rb
CHANGED
@@ -1,3 +1,5 @@
|
|
1
|
+
require 'unidom/common/yaml_helper'
|
2
|
+
|
1
3
|
module Unidom
|
2
4
|
module Order
|
3
5
|
|
@@ -5,6 +7,10 @@ module Unidom
|
|
5
7
|
|
6
8
|
isolate_namespace ::Unidom::Order
|
7
9
|
|
10
|
+
initializer :load_config_initializers do |app|
|
11
|
+
Unidom::Common::YamlHelper.load_enum config: app.config, root: config.root
|
12
|
+
end
|
13
|
+
|
8
14
|
initializer :append_migrations do |app|
|
9
15
|
config.paths['db/migrate'].expanded.each { |expanded_path| app.config.paths['db/migrate'] << expanded_path } unless app.root.to_s.match root.to_s
|
10
16
|
end
|
data/lib/unidom/order/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: unidom-order
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: '1.4'
|
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-28 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: unidom-common
|
@@ -50,7 +50,10 @@ files:
|
|
50
50
|
- app/models/unidom/order/order.rb
|
51
51
|
- app/models/unidom/order/order_adjustment.rb
|
52
52
|
- app/models/unidom/order/order_item.rb
|
53
|
+
- app/types/unidom/order/adjustment_factor.rb
|
53
54
|
- app/views/layouts/unidom/order/application.html.erb
|
55
|
+
- config/enum.yml
|
56
|
+
- config/locales/enum.zh-CN.yml
|
54
57
|
- config/routes.rb
|
55
58
|
- db/migrate/20020601000000_create_unidom_orders.rb
|
56
59
|
- db/migrate/20020602000000_create_unidom_order_items.rb
|