unidom-order 1.5.7 → 2.0.1
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 +5 -5
- data/README.md +13 -0
- data/app/controllers/unidom/order/application_controller.rb +8 -2
- data/app/helpers/unidom/order/application_helper.rb +7 -1
- data/app/jobs/unidom/order/application_job.rb +7 -1
- data/app/mailers/unidom/order/application_mailer.rb +9 -3
- data/app/models/unidom/order/application_record.rb +8 -2
- data/app/models/unidom/order/concerns/as_adjusted.rb +34 -26
- data/app/models/unidom/order/concerns/as_order_placer.rb +15 -7
- data/app/models/unidom/order/concerns/as_order_taker.rb +15 -7
- data/app/models/unidom/order/order.rb +19 -13
- data/app/models/unidom/order/order_adjustment.rb +36 -30
- data/app/models/unidom/order/order_item.rb +44 -38
- data/app/types/unidom/order/adjustment_factor.rb +9 -3
- data/app/views/layouts/unidom/order/application.html.erb +1 -1
- data/db/migrate/20020601000000_create_unidom_orders.rb +4 -4
- data/db/migrate/20020602000000_create_unidom_order_items.rb +5 -5
- data/db/migrate/20020603000000_create_unidom_order_adjustments.rb +4 -4
- data/lib/rspec/models/unidom/order/concerns/as_order_taker_shared_examples.rb +25 -0
- data/lib/unidom/order/rspec_shared_examples.rb +1 -0
- data/lib/unidom/order/version.rb +1 -1
- metadata +10 -10
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 65be3c651c2b77bfef5f74d06723a94f8b36c060a3418be80c8c92322ebe4c4c
|
4
|
+
data.tar.gz: 662944e10031a663cda34bec754b4ad465021f286b5ab9efd3a126dd81e2ab7a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f6b87ba705f596f32aa92e97e5e228fbecebc64da2bbae6b9de470abcb11e71ac3d0ff132e4c00d3411697b2907e8ea2bf0677ddd67e16d7fe818a5e3058ce9c
|
7
|
+
data.tar.gz: f2e5a93ece0a2de244afbe19783ec093c4cfe99e7b55a3c5cc781a3737243553e1600f4f12f8894d0b0dce4d123038b181a310de118159a175ac9c084e38d06d
|
data/README.md
CHANGED
@@ -192,6 +192,12 @@ Unidom::Party::Person.class_eval do
|
|
192
192
|
|
193
193
|
end
|
194
194
|
|
195
|
+
Unidom::Party::Shop.class_eval do
|
196
|
+
|
197
|
+
include Unidom::Order::Concerns::AsOrderTaker
|
198
|
+
|
199
|
+
end
|
200
|
+
|
195
201
|
# spec/support/unidom_rspec_shared_examples.rb
|
196
202
|
require 'unidom/order/rspec_shared_examples'
|
197
203
|
|
@@ -200,5 +206,12 @@ describe Unidom::Party::Person, type: :model do
|
|
200
206
|
|
201
207
|
it_behaves_like 'Unidom::Order::Concerns::AsOrderPlacer', model_attributes
|
202
208
|
|
209
|
+
end
|
210
|
+
|
211
|
+
# spec/models/unidom/party/shop_spec.rb
|
212
|
+
describe Unidom::Party::Shop, type: :model do
|
213
|
+
|
214
|
+
it_behaves_like 'Unidom::Order::Concerns::AsOrderTaker', model_attributes
|
215
|
+
|
203
216
|
end
|
204
217
|
```
|
@@ -1,6 +1,12 @@
|
|
1
1
|
##
|
2
2
|
# Application controller 是模块内所有控制器的基类。
|
3
3
|
|
4
|
-
|
5
|
-
|
4
|
+
module Unidom
|
5
|
+
module Order
|
6
|
+
|
7
|
+
class ApplicationController < ActionController::Base
|
8
|
+
protect_from_forgery with: :exception
|
9
|
+
end
|
10
|
+
|
11
|
+
end
|
6
12
|
end
|
@@ -1,7 +1,13 @@
|
|
1
1
|
##
|
2
2
|
# Application mailer 是模块内所有电子邮件发送类的基类。
|
3
3
|
|
4
|
-
|
5
|
-
|
6
|
-
|
4
|
+
module Unidom
|
5
|
+
module Order
|
6
|
+
|
7
|
+
class ApplicationMailer < ActionMailer::Base
|
8
|
+
default from: 'from@example.com'
|
9
|
+
layout 'mailer'
|
10
|
+
end
|
11
|
+
|
12
|
+
end
|
7
13
|
end
|
@@ -1,6 +1,12 @@
|
|
1
1
|
##
|
2
2
|
# Application record 是模块内所有模型的抽象基类。
|
3
3
|
|
4
|
-
|
5
|
-
|
4
|
+
module Unidom
|
5
|
+
module Order
|
6
|
+
|
7
|
+
class ApplicationRecord < ActiveRecord::Base
|
8
|
+
self.abstract_class = true
|
9
|
+
end
|
10
|
+
|
11
|
+
end
|
6
12
|
end
|
@@ -1,34 +1,42 @@
|
|
1
|
-
module Unidom
|
1
|
+
module Unidom
|
2
|
+
module Order
|
3
|
+
module Concerns
|
4
|
+
|
5
|
+
module AsAdjusted
|
6
|
+
|
7
|
+
extend ActiveSupport::Concern
|
8
|
+
|
9
|
+
included do |includer|
|
10
|
+
|
11
|
+
has_many :adjustments, class_name: 'Unidom::Order::OrderAdjustment', as: :adjusted
|
12
|
+
|
13
|
+
def is_adjusted!(amount, due_to: 'FRGT', at: Time.now)
|
14
|
+
query = adjustments.adjustment_factor_coded_as(due_to).valid_at(now: at).alive
|
15
|
+
adjustment = query.first
|
16
|
+
if adjustment.present?
|
17
|
+
if 0==amount
|
18
|
+
adjustment.soft_destroy
|
19
|
+
else
|
20
|
+
adjustment.amount = amount
|
21
|
+
adjustment.save!
|
22
|
+
end
|
23
|
+
else
|
24
|
+
adjustment = query.create! amount: amount, opened_at: at
|
25
|
+
end
|
26
|
+
adjustment
|
27
|
+
end
|
28
|
+
|
29
|
+
def is_adjusted?(due_to: 'FRGT', at: Time.now)
|
30
|
+
adjustments.adjustment_factor_coded_as(due_to).valid_at(now: at).alive.exists?
|
31
|
+
end
|
2
32
|
|
3
|
-
|
4
|
-
|
5
|
-
included do |includer|
|
6
|
-
|
7
|
-
has_many :adjustments, class_name: 'Unidom::Order::OrderAdjustment', as: :adjusted
|
33
|
+
end
|
8
34
|
|
9
|
-
|
10
|
-
query = adjustments.adjustment_factor_coded_as(due_to).valid_at(now: at).alive
|
11
|
-
adjustment = query.first
|
12
|
-
if adjustment.present?
|
13
|
-
if 0==amount
|
14
|
-
adjustment.soft_destroy
|
15
|
-
else
|
16
|
-
adjustment.amount = amount
|
17
|
-
adjustment.save!
|
35
|
+
module ClassMethods
|
18
36
|
end
|
19
|
-
|
20
|
-
adjustment = query.create! amount: amount, opened_at: at
|
37
|
+
|
21
38
|
end
|
22
|
-
adjustment
|
23
|
-
end
|
24
39
|
|
25
|
-
def is_adjusted?(due_to: 'FRGT', at: Time.now)
|
26
|
-
adjustments.adjustment_factor_coded_as(due_to).valid_at(now: at).alive.exists?
|
27
40
|
end
|
28
|
-
|
29
|
-
end
|
30
|
-
|
31
|
-
module ClassMethods
|
32
41
|
end
|
33
|
-
|
34
42
|
end
|
@@ -1,14 +1,22 @@
|
|
1
|
-
module Unidom
|
1
|
+
module Unidom
|
2
|
+
module Order
|
3
|
+
module Concerns
|
2
4
|
|
3
|
-
|
5
|
+
module AsOrderPlacer
|
4
6
|
|
5
|
-
|
7
|
+
extend ActiveSupport::Concern
|
6
8
|
|
7
|
-
|
9
|
+
included do |includer|
|
8
10
|
|
9
|
-
|
11
|
+
has_many :placed_orders, class_name: 'Unidom::Order::Order', as: :placer
|
10
12
|
|
11
|
-
|
12
|
-
|
13
|
+
end
|
14
|
+
|
15
|
+
module ClassMethods
|
16
|
+
end
|
13
17
|
|
18
|
+
end
|
19
|
+
|
20
|
+
end
|
21
|
+
end
|
14
22
|
end
|
@@ -1,14 +1,22 @@
|
|
1
|
-
module Unidom
|
1
|
+
module Unidom
|
2
|
+
module Order
|
3
|
+
module Concerns
|
2
4
|
|
3
|
-
|
5
|
+
module AsOrderTaker
|
4
6
|
|
5
|
-
|
7
|
+
extend ActiveSupport::Concern
|
6
8
|
|
7
|
-
|
9
|
+
included do |includer|
|
8
10
|
|
9
|
-
|
11
|
+
has_many :taken_orders, class_name: 'Unidom::Order::Order', as: :taker
|
10
12
|
|
11
|
-
|
12
|
-
|
13
|
+
end
|
14
|
+
|
15
|
+
module ClassMethods
|
16
|
+
end
|
13
17
|
|
18
|
+
end
|
19
|
+
|
20
|
+
end
|
21
|
+
end
|
14
22
|
end
|
@@ -1,23 +1,29 @@
|
|
1
1
|
##
|
2
2
|
# Order 是订单。
|
3
3
|
|
4
|
-
|
4
|
+
module Unidom
|
5
|
+
module Order
|
5
6
|
|
6
|
-
|
7
|
+
class Order < ApplicationRecord
|
7
8
|
|
8
|
-
|
9
|
-
include Unidom::Order::Concerns::AsAdjusted
|
9
|
+
self.table_name = 'unidom_orders'
|
10
10
|
|
11
|
-
|
12
|
-
|
13
|
-
validates :aggregate_amount, presence: true, numericality: { greater_than_or_equal_to: 0, less_than_or_equal_to: 1_000_000_000 }
|
11
|
+
include Unidom::Common::Concerns::ModelExtension
|
12
|
+
include Unidom::Order::Concerns::AsAdjusted
|
14
13
|
|
15
|
-
|
16
|
-
|
14
|
+
validates :number, presence: true, length: { is: self.columns_hash['number'].limit }
|
15
|
+
validates :purchase_amount, presence: true, numericality: { greater_than_or_equal_to: 0, less_than_or_equal_to: 1_000_000_000 }
|
16
|
+
validates :aggregate_amount, presence: true, numericality: { greater_than_or_equal_to: 0, less_than_or_equal_to: 1_000_000_000 }
|
17
17
|
|
18
|
-
|
18
|
+
belongs_to :placer, polymorphic: true
|
19
|
+
belongs_to :taker, polymorphic: true
|
19
20
|
|
20
|
-
|
21
|
-
scope :taken_by, ->(taker) { where taker: taker }
|
21
|
+
has_many :items, class_name: 'Unidom::Order::OrderItem'
|
22
22
|
|
23
|
-
|
23
|
+
scope :placed_by, ->(placer) { where placer: placer }
|
24
|
+
scope :taken_by, ->(taker) { where taker: taker }
|
25
|
+
|
26
|
+
end unless Unidom::Common::Neglection.namespace_neglected? 'Unidom::Order::Order'
|
27
|
+
|
28
|
+
end
|
29
|
+
end
|
@@ -1,44 +1,50 @@
|
|
1
1
|
##
|
2
2
|
# Order Adjustment 是订单调整项。
|
3
3
|
|
4
|
-
|
4
|
+
module Unidom
|
5
|
+
module Order
|
5
6
|
|
6
|
-
|
7
|
+
class OrderAdjustment < ApplicationRecord
|
7
8
|
|
8
|
-
|
9
|
-
include ProgneTapera::EnumCode
|
9
|
+
self.table_name = 'unidom_order_adjustments'
|
10
10
|
|
11
|
-
|
11
|
+
include Unidom::Common::Concerns::ModelExtension
|
12
|
+
include ProgneTapera::EnumCode
|
12
13
|
|
13
|
-
|
14
|
+
validates :amount, presence: true, numericality: { greater_than_or_equal_to: -1_000_000_000, less_than_or_equal_to: 1_000_000_000 }
|
14
15
|
|
15
|
-
|
16
|
+
belongs_to :adjusted, polymorphic: true
|
16
17
|
|
17
|
-
|
18
|
+
scope :adjusted_is, ->(adjusted) { where adjusted: adjusted }
|
18
19
|
|
19
|
-
|
20
|
-
# 对订单或者订单项 adjusted 进行调整。调整金额为 amount ,缺省为 0 。调整原因是 due_to ,缺省是 FRGT 。调整时间是 opened_at ,缺省为当前时间。如:
|
21
|
-
# Unidom::Order::OrderAdjustment.adjust! order, amount: 7.90, due_to: 'LTAX'
|
22
|
-
def self.adjust!(adjusted, amount: 0, due_to: 'FRGT', opened_at: Time.now)
|
20
|
+
code :adjustment_factor, Unidom::Order::AdjustmentFactor
|
23
21
|
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
22
|
+
##
|
23
|
+
# 对订单或者订单项 adjusted 进行调整。调整金额为 amount ,缺省为 0 。调整原因是 due_to ,缺省是 FRGT 。调整时间是 opened_at ,缺省为当前时间。如:
|
24
|
+
# Unidom::Order::OrderAdjustment.adjust! order, amount: 7.90, due_to: 'LTAX'
|
25
|
+
def self.adjust!(adjusted, amount: 0, due_to: 'FRGT', opened_at: Time.now)
|
28
26
|
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
adjustment
|
36
|
-
adjustment.
|
27
|
+
assert_present! :adjusted, adjusted
|
28
|
+
assert_present! :amount, amount
|
29
|
+
assert_present! :due_to, due_to
|
30
|
+
assert_present! :opened_at, opened_at
|
31
|
+
|
32
|
+
query = adjusted_is(adjusted).adjustment_factor_coded_as(due_to).valid_at(now: opened_at).alive
|
33
|
+
adjustment = query.first
|
34
|
+
if adjustment.present?
|
35
|
+
if 0==amount
|
36
|
+
adjustment.soft_destroy
|
37
|
+
else
|
38
|
+
adjustment.amount = amount
|
39
|
+
adjustment.save!
|
40
|
+
end
|
41
|
+
else
|
42
|
+
adjustment = query.create! amount: amount, opened_at: opened_at
|
43
|
+
end
|
44
|
+
adjustment
|
37
45
|
end
|
38
|
-
else
|
39
|
-
adjustment = query.create! amount: amount, opened_at: opened_at
|
40
|
-
end
|
41
|
-
adjustment
|
42
|
-
end
|
43
46
|
|
44
|
-
end unless Unidom::Common::Neglection.namespace_neglected? 'Unidom::Order::OrderAdjustment'
|
47
|
+
end unless Unidom::Common::Neglection.namespace_neglected? 'Unidom::Order::OrderAdjustment'
|
48
|
+
|
49
|
+
end
|
50
|
+
end
|
@@ -1,42 +1,48 @@
|
|
1
1
|
##
|
2
2
|
# Order Item 是订单项。
|
3
3
|
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
4
|
+
module Unidom
|
5
|
+
module Order
|
6
|
+
|
7
|
+
class OrderItem < ApplicationRecord
|
8
|
+
|
9
|
+
self.table_name = 'unidom_order_items'
|
10
|
+
|
11
|
+
include Unidom::Common::Concerns::ModelExtension
|
12
|
+
include Unidom::Order::Concerns::AsAdjusted
|
13
|
+
|
14
|
+
#validates :ordinal, presence: true, numericality: { only_integer: true, greater_than: 0, less_than: 1_000_000_000 }
|
15
|
+
validates :unit_price, presence: true, numericality: { greater_than_or_equal_to: 0, less_than_or_equal_to: 1_000_000_000 }
|
16
|
+
validates :quantity, presence: true, numericality: { greater_than: 0, less_than_or_equal_to: 1_000_000_000 }
|
17
|
+
validates :purchase_amount, presence: true, numericality: { greater_than_or_equal_to: 0, less_than_or_equal_to: 1_000_000_000 }
|
18
|
+
validates :subtotal_amount, presence: true, numericality: { greater_than_or_equal_to: 0, less_than_or_equal_to: 1_000_000_000 }
|
19
|
+
|
20
|
+
belongs_to :order, class_name: 'Unidom::Order::Order'
|
21
|
+
belongs_to :ordered, polymorphic: true
|
22
|
+
belongs_to :placer, polymorphic: true
|
23
|
+
|
24
|
+
scope :order_is, ->(order) { where order: order }
|
25
|
+
scope :ordered_is, ->(ordered) { where ordered: ordered }
|
26
|
+
scope :placed_by, ->(placer) { where placer: placer }
|
27
|
+
|
28
|
+
##
|
29
|
+
# 订购商品 ordered ,放入订单 of 。订购者为 by ,缺省为订单的下单者。单价为 unit_price ,缺省值为 0 。数量为 quantity ,缺省值为 1。如:
|
30
|
+
# Unidom::Order::OrderItem.order! coca_cola, of: order, by: current_person, unit_price: 3.50, quantity: 2
|
31
|
+
def self.order!(ordered, of: nil, by: of.placer, unit_price: 0, quantity: 1)
|
32
|
+
item = of.items.ordered_is(ordered).placed_by(by).valid_at.alive.first
|
33
|
+
if item.present?
|
34
|
+
item.quantity += quantity
|
35
|
+
item.unit_price = unit_price
|
36
|
+
item.purchase_amount = item.unit_price*item.quantity
|
37
|
+
item.subtotal_amount = item.purchase_amount+item.adjustments.valid_at.alive.sum(:amount).to_f
|
38
|
+
item.save!
|
39
|
+
else
|
40
|
+
ordinal = 1+of.items.valid_at.alive.maximum(:ordinal).to_i
|
41
|
+
of.items.create! ordered: ordered, placer: by, ordinal: ordinal, quantity: quantity, unit_price: unit_price, purchase_amount: unit_price*quantity, subtotal_amount: unit_price*quantity, opened_at: Time.now
|
42
|
+
end
|
43
|
+
end
|
44
|
+
|
45
|
+
end unless Unidom::Common::Neglection.namespace_neglected? 'Unidom::Order::OrderItem'
|
41
46
|
|
42
|
-
end
|
47
|
+
end
|
48
|
+
end
|
@@ -1,9 +1,15 @@
|
|
1
1
|
# Adjustment Factor 是调整因素。
|
2
2
|
|
3
|
-
|
3
|
+
module Unidom
|
4
|
+
module Order
|
4
5
|
|
5
|
-
|
6
|
+
class AdjustmentFactor < ActiveRecord::Type::Value
|
6
7
|
|
7
|
-
|
8
|
+
include ProgneTapera::EnumConfig
|
8
9
|
|
10
|
+
enum :unidom_adjustment_factor
|
11
|
+
|
12
|
+
end
|
13
|
+
|
14
|
+
end
|
9
15
|
end
|
@@ -1,4 +1,4 @@
|
|
1
|
-
class CreateUnidomOrders < ActiveRecord::Migration
|
1
|
+
class CreateUnidomOrders < ActiveRecord::Migration[6.0]
|
2
2
|
|
3
3
|
def change
|
4
4
|
|
@@ -18,9 +18,9 @@ class CreateUnidomOrders < ActiveRecord::Migration
|
|
18
18
|
t.text :description
|
19
19
|
|
20
20
|
t.string :slug, null: false, default: nil, limit: 200
|
21
|
-
t.column :state, 'char(1)', null: false, default:
|
22
|
-
t.datetime :opened_at, null: false, default: ::
|
23
|
-
t.datetime :closed_at, null: false, default: ::
|
21
|
+
t.column :state, 'char(1)', null: false, default: Unidom::Common::STATE
|
22
|
+
t.datetime :opened_at, null: false, default: Unidom::Common::OPENED_AT
|
23
|
+
t.datetime :closed_at, null: false, default: Unidom::Common::CLOSED_AT
|
24
24
|
t.boolean :defunct, null: false, default: false
|
25
25
|
t.jsonb :notation, null: false, default: {}
|
26
26
|
|
@@ -1,6 +1,6 @@
|
|
1
1
|
# Order Item 是订单项。
|
2
2
|
|
3
|
-
class CreateUnidomOrderItems < ActiveRecord::Migration
|
3
|
+
class CreateUnidomOrderItems < ActiveRecord::Migration[6.0]
|
4
4
|
|
5
5
|
def change
|
6
6
|
|
@@ -22,9 +22,9 @@ class CreateUnidomOrderItems < ActiveRecord::Migration
|
|
22
22
|
t.text :instruction
|
23
23
|
t.text :description
|
24
24
|
|
25
|
-
t.column :state, 'char(1)', null: false, default:
|
26
|
-
t.datetime :opened_at, null: false, default: ::
|
27
|
-
t.datetime :closed_at, null: false, default: ::
|
25
|
+
t.column :state, 'char(1)', null: false, default: Unidom::Common::STATE
|
26
|
+
t.datetime :opened_at, null: false, default: Unidom::Common::OPENED_AT
|
27
|
+
t.datetime :closed_at, null: false, default: Unidom::Common::CLOSED_AT
|
28
28
|
t.boolean :defunct, null: false, default: false
|
29
29
|
t.jsonb :notation, null: false, default: {}
|
30
30
|
|
@@ -32,7 +32,7 @@ class CreateUnidomOrderItems < ActiveRecord::Migration
|
|
32
32
|
|
33
33
|
end
|
34
34
|
|
35
|
-
add_index :unidom_order_items, :order_id
|
35
|
+
#add_index :unidom_order_items, :order_id
|
36
36
|
add_index :unidom_order_items, :ordered_id
|
37
37
|
add_index :unidom_order_items, :placer_id
|
38
38
|
|
@@ -1,4 +1,4 @@
|
|
1
|
-
class CreateUnidomOrderAdjustments < ActiveRecord::Migration
|
1
|
+
class CreateUnidomOrderAdjustments < ActiveRecord::Migration[6.0]
|
2
2
|
|
3
3
|
def change
|
4
4
|
|
@@ -15,9 +15,9 @@ class CreateUnidomOrderAdjustments < ActiveRecord::Migration
|
|
15
15
|
t.text :instruction
|
16
16
|
t.text :description
|
17
17
|
|
18
|
-
t.column :state, 'char(1)', null: false, default:
|
19
|
-
t.datetime :opened_at, null: false, default: ::
|
20
|
-
t.datetime :closed_at, null: false, default: ::
|
18
|
+
t.column :state, 'char(1)', null: false, default: Unidom::Common::STATE
|
19
|
+
t.datetime :opened_at, null: false, default: Unidom::Common::OPENED_AT
|
20
|
+
t.datetime :closed_at, null: false, default: Unidom::Common::CLOSED_AT
|
21
21
|
t.boolean :defunct, null: false, default: false
|
22
22
|
t.jsonb :notation, null: false, default: {}
|
23
23
|
|
@@ -0,0 +1,25 @@
|
|
1
|
+
shared_examples 'Unidom::Order::Concerns::AsOrderTaker' do |model_attributes|
|
2
|
+
|
3
|
+
context do
|
4
|
+
|
5
|
+
order_1_attributes = {
|
6
|
+
placer_id: SecureRandom.uuid,
|
7
|
+
placer_type: 'Unidom::Order::Placer::Mock',
|
8
|
+
number: SecureRandom.hex(6),
|
9
|
+
purchase_amount: 10.00,
|
10
|
+
aggregate_amount: 10.00
|
11
|
+
}
|
12
|
+
|
13
|
+
order_1_attributes = {
|
14
|
+
placer_id: SecureRandom.uuid,
|
15
|
+
placer_type: 'Unidom::Order::Placer::Mock',
|
16
|
+
number: SecureRandom.hex(6),
|
17
|
+
purchase_amount: 20.00,
|
18
|
+
aggregate_amount: 20.00
|
19
|
+
}
|
20
|
+
|
21
|
+
it_behaves_like 'has_many', model_attributes, :taken_orders, Unidom::Order::Order, [ order_1_attributes, order_1_attributes ]
|
22
|
+
|
23
|
+
end
|
24
|
+
|
25
|
+
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:
|
4
|
+
version: 2.0.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Topbit Du
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2021-08-10 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: unidom-common
|
@@ -16,14 +16,14 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: '
|
19
|
+
version: '2.0'
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
24
|
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: '
|
26
|
+
version: '2.0'
|
27
27
|
description: Unidom (UNIfied Domain Object Model) is a series of domain model engines.
|
28
28
|
The Order domain model engine includes Order, Order Item, and Order Adjustment models.
|
29
29
|
Unidom (统一领域对象模型)是一系列的领域模型引擎。订单领域模型引擎包括订单、订单项和订单调整的模型。
|
@@ -59,6 +59,7 @@ files:
|
|
59
59
|
- db/migrate/20020602000000_create_unidom_order_items.rb
|
60
60
|
- db/migrate/20020603000000_create_unidom_order_adjustments.rb
|
61
61
|
- lib/rspec/models/unidom/order/concerns/as_order_placer_shared_examples.rb
|
62
|
+
- lib/rspec/models/unidom/order/concerns/as_order_taker_shared_examples.rb
|
62
63
|
- lib/rspec/models/unidom/order/order_adjustment_spec.rb
|
63
64
|
- lib/rspec/models/unidom/order/order_item_spec.rb
|
64
65
|
- lib/rspec/models/unidom/order/order_spec.rb
|
@@ -71,11 +72,11 @@ files:
|
|
71
72
|
- lib/unidom/order/types_rspec.rb
|
72
73
|
- lib/unidom/order/validators_rspec.rb
|
73
74
|
- lib/unidom/order/version.rb
|
74
|
-
homepage: https://
|
75
|
+
homepage: https://gitee.com/Unidom/unidom-order
|
75
76
|
licenses:
|
76
77
|
- MIT
|
77
78
|
metadata: {}
|
78
|
-
post_install_message:
|
79
|
+
post_install_message:
|
79
80
|
rdoc_options: []
|
80
81
|
require_paths:
|
81
82
|
- lib
|
@@ -90,9 +91,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
90
91
|
- !ruby/object:Gem::Version
|
91
92
|
version: '0'
|
92
93
|
requirements: []
|
93
|
-
|
94
|
-
|
95
|
-
signing_key:
|
94
|
+
rubygems_version: 3.2.3
|
95
|
+
signing_key:
|
96
96
|
specification_version: 4
|
97
97
|
summary: Unidom Order Domain Model Engine 订单领域模型引擎
|
98
98
|
test_files: []
|