unidom-order 1.5.5 → 1.5.6
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
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c5c3bfc09e3b888292b6148bee326d99bcecfffa
|
4
|
+
data.tar.gz: dd0714bbe35e4e9f06207add90aac766ddb09425
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: bdc23e284f05a35246495d3af7923b243a93dcb1b1232e541f2d67724c3dc342766a8b377d10dfb533cb7a82097c2764a76c7f875a9c1514d504289f7c0a3435
|
7
|
+
data.tar.gz: 2d1431fb93c6f974ddfc51bc806ef12c74845118e3e2a32da4c4366e73ff764cb26fa7c08ac83f4f31c9a2f183ec424cbc83d4fe26a8e32709c095a95e7b26c3
|
@@ -20,6 +20,12 @@ class Unidom::Order::OrderAdjustment < Unidom::Order::ApplicationRecord
|
|
20
20
|
# 对订单或者订单项 adjusted 进行调整。调整金额为 amount ,缺省为 0 。调整原因是 due_to ,缺省是 FRGT 。调整时间是 opened_at ,缺省为当前时间。如:
|
21
21
|
# Unidom::Order::OrderAdjustment.adjust! order, amount: 7.90, due_to: 'LTAX'
|
22
22
|
def self.adjust!(adjusted, amount: 0, due_to: 'FRGT', opened_at: Time.now)
|
23
|
+
|
24
|
+
assert_present! :adjusted, adjusted
|
25
|
+
assert_present! :amount, amount
|
26
|
+
assert_present! :due_to, due_to
|
27
|
+
assert_present! :opened_at, opened_at
|
28
|
+
|
23
29
|
query = adjusted_is(adjusted).adjustment_factor_coded_as(due_to).valid_at(now: opened_at).alive
|
24
30
|
adjustment = query.first
|
25
31
|
if adjustment.present?
|
@@ -21,8 +21,6 @@ describe Unidom::Order::OrderAdjustment, type: :model do
|
|
21
21
|
it_behaves_like 'validates numericality', model_attributes, :amount,
|
22
22
|
range: -1_000_000_000..1_000_000_000, minimum_inclusive: true, maximum_inclusive: true
|
23
23
|
|
24
|
-
it_behaves_like 'ProgneTapera::EnumCode', described_class.new(model_attributes), :adjustment_factor, Unidom::Order::AdjustmentFactor
|
25
|
-
|
26
24
|
order_attributes = {
|
27
25
|
placer_id: SecureRandom.uuid,
|
28
26
|
placer_type: 'Unidom::Order::Placer::Mock',
|
@@ -51,6 +49,11 @@ describe Unidom::Order::OrderAdjustment, type: :model do
|
|
51
49
|
|
52
50
|
it_behaves_like 'polymorphic scope', model_attributes, :adjusted_is, :adjusted, [ Unidom::Order::Order, Unidom::Order::OrderItem ]
|
53
51
|
|
52
|
+
it_behaves_like 'ProgneTapera::EnumCode', described_class.new(model_attributes), :adjustment_factor, Unidom::Order::AdjustmentFactor
|
53
|
+
|
54
|
+
adjusted = Unidom::Order::Order.create! order_attributes
|
55
|
+
it_behaves_like 'assert_present!', described_class, :adjust!, [ adjusted, amount: 0, due_to: 'FRGT', opened_at: Time.now ], [ { 0 => :adjusted }, :amount, :due_to, :opened_at ]
|
56
|
+
|
54
57
|
end
|
55
58
|
|
56
59
|
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.5.
|
4
|
+
version: 1.5.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Topbit Du
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-03
|
11
|
+
date: 2017-04-03 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: unidom-common
|