rs.ge 0.0.17 → 0.1.0.beta1
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.
- data/lib/rs.rb +5 -71
- data/lib/rs/models/waybill_unit.rb +21 -0
- data/lib/rs/requests/base_request.rb +20 -0
- data/lib/rs/requests/waybill_unit_request.rb +44 -0
- data/lib/rs/version.rb +1 -2
- data/rs.gemspec +3 -5
- data/spec/requests/waybill_units_spec.rb +24 -0
- data/spec/spec_helper.rb +3 -85
- metadata +14 -42
- data/lib/rs/car.rb +0 -6
- data/lib/rs/dict.rb +0 -259
- data/lib/rs/invoice.rb +0 -18
- data/lib/rs/print.rb +0 -331
- data/lib/rs/sys.rb +0 -128
- data/lib/rs/waybill.rb +0 -483
- data/problems.md +0 -1
- data/spec/rs/car_spec.rb +0 -25
- data/spec/rs/dict_spec.rb +0 -181
- data/spec/rs/open_user.rb +0 -12
- data/spec/rs/pdf_spec.rb +0 -21
- data/spec/rs/sys_spec.rb +0 -77
- data/spec/rs/waybill_delete_spec.rb +0 -63
- data/spec/rs/waybill_invoice_spec.rb +0 -19
- data/spec/rs/waybill_spec.rb +0 -205
- data/spec/rs/waybill_validation_spec.rb +0 -149
data/problems.md
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
# არსებობს სისტემაში მომხმარებელი, რომელსაც IP არ აქვს მითითებული. ეს რას ნიშნავს?
|
data/spec/rs/car_spec.rb
DELETED
@@ -1,25 +0,0 @@
|
|
1
|
-
# -*- encoding : utf-8 -*-
|
2
|
-
|
3
|
-
require 'spec_helper'
|
4
|
-
|
5
|
-
def valid_vehicle_number(number)
|
6
|
-
describe "#{number} სწორი სახელმწიფო ნომერია" do
|
7
|
-
it { RS.valid_vehicle_number?(number).should == true }
|
8
|
-
end
|
9
|
-
end
|
10
|
-
|
11
|
-
def invalid_vehicle_number(number)
|
12
|
-
describe "#{number} არასწორი სახელმწიფო ნომერია" do
|
13
|
-
it { RS.valid_vehicle_number?(number).should == false }
|
14
|
-
end
|
15
|
-
end
|
16
|
-
|
17
|
-
describe 'მანქანის ნომრების შემოწმება' do
|
18
|
-
valid_vehicle_number 'WDW842'
|
19
|
-
valid_vehicle_number 'KFK061'
|
20
|
-
valid_vehicle_number 'wdw467'
|
21
|
-
valid_vehicle_number 'kfk061'
|
22
|
-
invalid_vehicle_number 'WDW-842'
|
23
|
-
invalid_vehicle_number 'Subaru WDW842'
|
24
|
-
invalid_vehicle_number 'Mercedes KFK061'
|
25
|
-
end
|
data/spec/rs/dict_spec.rb
DELETED
@@ -1,181 +0,0 @@
|
|
1
|
-
# -*- encoding : utf-8 -*-
|
2
|
-
require 'spec_helper'
|
3
|
-
require 'rs'
|
4
|
-
|
5
|
-
# excise codes
|
6
|
-
|
7
|
-
describe 'excise name normalization' do
|
8
|
-
context 'name 1 (1234) _ msr _ (1)' do
|
9
|
-
subject { RS.normalize_excise_name('name 1 (1234) _ msr _ (1)') }
|
10
|
-
it { should == 'name 1' }
|
11
|
-
end
|
12
|
-
context 'name 2 (019048999) _ msr _ (1)' do
|
13
|
-
subject { RS.normalize_excise_name('name 2 (019048999) _ msr _ (1)') }
|
14
|
-
it { should == 'name 2' }
|
15
|
-
end
|
16
|
-
context 'name 3 () _ msr __ ' do
|
17
|
-
subject { RS.normalize_excise_name('name 3 () _ msr __ ') }
|
18
|
-
it { should == 'name 3' }
|
19
|
-
end
|
20
|
-
end
|
21
|
-
|
22
|
-
describe 'getting excise codes' do
|
23
|
-
before(:all) do
|
24
|
-
@codes = RS.get_excise_codes(RS.su_params)
|
25
|
-
end
|
26
|
-
subject { @codes }
|
27
|
-
it { should_not be_nil }
|
28
|
-
it { should_not be_empty }
|
29
|
-
context "first code" do
|
30
|
-
subject {@codes.first}
|
31
|
-
it { should be_instance_of RS::ExciseCode }
|
32
|
-
its(:id) { should_not be_nil }
|
33
|
-
its(:name) { should_not be_nil }
|
34
|
-
its(:name) { should_not be_empty }
|
35
|
-
its(:code) { should_not be_empty }
|
36
|
-
its(:measure) { should_not be_nil }
|
37
|
-
its(:value) { should_not be_nil }
|
38
|
-
its(:value) { should > 0 }
|
39
|
-
end
|
40
|
-
end
|
41
|
-
|
42
|
-
# waybill types
|
43
|
-
|
44
|
-
describe 'getting waybill types' do
|
45
|
-
before(:all) do
|
46
|
-
@types = RS.get_waybill_types(RS.su_params)
|
47
|
-
end
|
48
|
-
subject { @types }
|
49
|
-
it { should_not be_nil }
|
50
|
-
it { should_not be_empty }
|
51
|
-
context 'first type' do
|
52
|
-
subject { @types.first }
|
53
|
-
it { should be_instance_of RS::WaybillType }
|
54
|
-
its(:id) { should_not be_nil }
|
55
|
-
its(:name) { should_not be_nil }
|
56
|
-
its(:name) { should_not be_empty }
|
57
|
-
end
|
58
|
-
end
|
59
|
-
|
60
|
-
def waybill_type_creation_test(id)
|
61
|
-
context "WaybillType with ID=#{id}" do
|
62
|
-
subject { RS::WaybillType.create_from_id(id) }
|
63
|
-
it { should be_instance_of RS::WaybillType }
|
64
|
-
its(:id) { should == id }
|
65
|
-
its(:name) { should == RS::WaybillType::NAMES[id]}
|
66
|
-
end
|
67
|
-
end
|
68
|
-
|
69
|
-
describe RS::WaybillType do
|
70
|
-
waybill_type_creation_test RS::WaybillType::INNER
|
71
|
-
waybill_type_creation_test RS::WaybillType::TRANSPORTATION
|
72
|
-
waybill_type_creation_test RS::WaybillType::WITHOUT_TRANSPORTATION
|
73
|
-
waybill_type_creation_test RS::WaybillType::DISTRIBUTION
|
74
|
-
waybill_type_creation_test RS::WaybillType::RETURN
|
75
|
-
waybill_type_creation_test RS::WaybillType::SUB_WAYBILL
|
76
|
-
end
|
77
|
-
|
78
|
-
# waybill units
|
79
|
-
|
80
|
-
describe 'getting waybill units' do
|
81
|
-
before(:all) do
|
82
|
-
@units = RS.get_waybill_units(RS.su_params)
|
83
|
-
end
|
84
|
-
subject { @units }
|
85
|
-
it { should_not be_nil }
|
86
|
-
it { should_not be_empty }
|
87
|
-
context 'first unit' do
|
88
|
-
subject{ @units.first }
|
89
|
-
it { should_not be_nil }
|
90
|
-
it { should be_instance_of RS::WaybillUnit }
|
91
|
-
its(:id) { should_not be_nil }
|
92
|
-
its(:name) { should_not be_nil }
|
93
|
-
its(:name) { should_not be_empty }
|
94
|
-
end
|
95
|
-
end
|
96
|
-
|
97
|
-
# transport types
|
98
|
-
|
99
|
-
describe 'getting transport types' do
|
100
|
-
before(:all) do
|
101
|
-
@types = RS.get_transport_types(RS.su_params)
|
102
|
-
end
|
103
|
-
subject { @types }
|
104
|
-
it { should_not be_nil }
|
105
|
-
it { should_not be_empty }
|
106
|
-
its(:size) { should == 5 }
|
107
|
-
context 'first type' do
|
108
|
-
subject { @types.first }
|
109
|
-
it { should_not be_nil }
|
110
|
-
it { should be_instance_of RS::TransportType }
|
111
|
-
its(:id) { should_not be_nil }
|
112
|
-
its(:name) { should_not be_nil }
|
113
|
-
its(:name) { should_not be_empty }
|
114
|
-
end
|
115
|
-
end
|
116
|
-
|
117
|
-
# bar codes
|
118
|
-
|
119
|
-
describe 'save and delete bar code' do
|
120
|
-
before(:all) do
|
121
|
-
@resp = RS.save_bar_code(RS.su_params.merge('bar_code' => '001', 'prod_name' => 'Apple', 'unit_id' => 1, 'unit_name' => 'kg', 'excise_id' => nil))
|
122
|
-
end
|
123
|
-
subject { @resp }
|
124
|
-
it { should be_true }
|
125
|
-
context 'delete this bar code' do
|
126
|
-
before(:all) do
|
127
|
-
@resp_delete = RS.delete_bar_code(RS.su_params.merge('bar_code' => 'inv/1'))
|
128
|
-
end
|
129
|
-
subject { @resp_delete }
|
130
|
-
it { should be_true }
|
131
|
-
end
|
132
|
-
end
|
133
|
-
|
134
|
-
describe 'get bar codes' do
|
135
|
-
before(:all) do
|
136
|
-
RS.save_bar_code(RS.su_params.merge({'bar_code' => 'rs_TV1', 'prod_name' => 'tv set 1', 'unit_id' => RS::WaybillUnit::OTHERS, 'unit_name' => 'box'}))
|
137
|
-
RS.save_bar_code(RS.su_params.merge({'bar_code' => 'rs_TV2', 'prod_name' => 'tv set 2', 'unit_id' => RS::WaybillUnit::OTHERS, 'unit_name' => 'box'}))
|
138
|
-
end
|
139
|
-
context "look up first code" do
|
140
|
-
before(:all) do
|
141
|
-
@codes = RS.get_bar_codes(RS.su_params.merge({'bar_code' => 'rs_TV1'}))
|
142
|
-
end
|
143
|
-
subject { @codes }
|
144
|
-
it { should_not be_nil }
|
145
|
-
it { should_not be_empty }
|
146
|
-
its(:size) { should == 1 }
|
147
|
-
context 'rs_TV1 bar code' do
|
148
|
-
subject { @codes.first }
|
149
|
-
it { should be_instance_of RS::BarCode }
|
150
|
-
its(:code) { should == 'rs_TV1' }
|
151
|
-
its(:name) { should == 'tv set 1' }
|
152
|
-
its(:unit_id) { should == RS::WaybillUnit::OTHERS }
|
153
|
-
its(:excise_id) { should be_nil }
|
154
|
-
end
|
155
|
-
end
|
156
|
-
context "lookup both codes" do
|
157
|
-
before(:all) do
|
158
|
-
@codes = RS.get_bar_codes(RS.su_params.merge({'bar_code' => 'rs_TV'}))
|
159
|
-
end
|
160
|
-
subject { @codes }
|
161
|
-
it { should_not be_nil }
|
162
|
-
it { should_not be_empty }
|
163
|
-
its(:size) { should == 2 }
|
164
|
-
context 'rs_TV1 bar code' do
|
165
|
-
subject { @codes.first }
|
166
|
-
it { should be_instance_of RS::BarCode }
|
167
|
-
its(:code) { should == 'rs_TV1' }
|
168
|
-
its(:name) { should == 'tv set 1' }
|
169
|
-
its(:unit_id) { should == RS::WaybillUnit::OTHERS }
|
170
|
-
its(:excise_id) { should be_nil }
|
171
|
-
end
|
172
|
-
context 'rs_TV2 bar code' do
|
173
|
-
subject { @codes[1] }
|
174
|
-
it { should be_instance_of RS::BarCode }
|
175
|
-
its(:code) { should == 'rs_TV2' }
|
176
|
-
its(:name) { should == 'tv set 2' }
|
177
|
-
its(:unit_id) { should == RS::WaybillUnit::OTHERS }
|
178
|
-
its(:excise_id) { should be_nil }
|
179
|
-
end
|
180
|
-
end
|
181
|
-
end
|
data/spec/rs/open_user.rb
DELETED
@@ -1,12 +0,0 @@
|
|
1
|
-
# -*- encoding : utf-8 -*-
|
2
|
-
|
3
|
-
require 'spec_helper'
|
4
|
-
require 'rs'
|
5
|
-
|
6
|
-
describe 'get name from TIN using open user' do
|
7
|
-
before(:all) do
|
8
|
-
@name = RS.get_name_from_tin('tin' => '02001000490')
|
9
|
-
end
|
10
|
-
subject { @name }
|
11
|
-
it { should == 'დიმიტრი ყურაშვილი' }
|
12
|
-
end
|
data/spec/rs/pdf_spec.rb
DELETED
@@ -1,21 +0,0 @@
|
|
1
|
-
# -*- encoding : utf-8 -*-
|
2
|
-
require 'spec_helper'
|
3
|
-
require 'rs'
|
4
|
-
|
5
|
-
describe 'printing waybill PDF' do
|
6
|
-
before(:all) do
|
7
|
-
@waybill = waybill_skeleton
|
8
|
-
@waybill.number = '000003123'
|
9
|
-
@waybill.activate_date = Time.now
|
10
|
-
@waybill.seller_tin = '12345678901'
|
11
|
-
@waybill.seller_name = 'შპს ც12'
|
12
|
-
@waybill.delivery_date = Time.now
|
13
|
-
@waybill.comment = 'ეს არის სატესტო ზედნადები'
|
14
|
-
@waybill.items = @waybill.items * 10
|
15
|
-
@path = File.expand_path('tmp/waybill.pdf')
|
16
|
-
RS.print_waybill(@waybill, @path, :bottom_text => 'მომზადებულია <u><color rgb="0000FF"><link href="http://invoice.ge">http://invoice.ge</link></color></u>-ზე')
|
17
|
-
#RS.render_waybill(@waybill)
|
18
|
-
end
|
19
|
-
subject { @waybill }
|
20
|
-
it { should_not be_nil }
|
21
|
-
end
|
data/spec/rs/sys_spec.rb
DELETED
@@ -1,77 +0,0 @@
|
|
1
|
-
# -*- encoding : utf-8 -*-
|
2
|
-
require 'spec_helper'
|
3
|
-
require 'rs'
|
4
|
-
|
5
|
-
IP_PATTERN = /^[0-9]{1,3}.[0-9]{1,3}.[0-9]{1,3}.[0-9]{1,3}$/
|
6
|
-
|
7
|
-
describe 'what is my IP' do
|
8
|
-
before(:all) do
|
9
|
-
@ip = RS.what_is_my_ip
|
10
|
-
end
|
11
|
-
subject { @ip }
|
12
|
-
it { should match IP_PATTERN }
|
13
|
-
end
|
14
|
-
|
15
|
-
describe 'get service users' do
|
16
|
-
before(:all) do
|
17
|
-
@org = RS::TEST_ORG1
|
18
|
-
@users = RS.get_service_users(RS.auth_params)
|
19
|
-
@user = nil
|
20
|
-
@users.each do |user|
|
21
|
-
if user.ip
|
22
|
-
@user = user
|
23
|
-
break
|
24
|
-
end
|
25
|
-
end
|
26
|
-
end
|
27
|
-
subject { @users }
|
28
|
-
it { should_not be_empty }
|
29
|
-
context 'one of the users' do
|
30
|
-
subject { @user }
|
31
|
-
it('should not have empty ID') { subject.id.should_not be_nil }
|
32
|
-
it('should not have empty USER_NAME') { subject.user_name.should_not be_nil }
|
33
|
-
it('should not have empty PAYER_ID') { subject.payer_id.should_not be_nil }
|
34
|
-
#it('should have correct IP') { subject.ip.should match IP_PATTERN }
|
35
|
-
it('should have some NAME') { subject.name.should_not be_nil }
|
36
|
-
end
|
37
|
-
end
|
38
|
-
|
39
|
-
describe 'check service user' do
|
40
|
-
before(:all) do
|
41
|
-
@user = RS.check_service_user(RS.su_params)
|
42
|
-
end
|
43
|
-
subject { @user }
|
44
|
-
it { should be_instance_of RS::User }
|
45
|
-
its(:id) { should_not be_nil }
|
46
|
-
its(:payer_id) { should_not be_nil }
|
47
|
-
its(:user_name) { should_not be_nil }
|
48
|
-
its(:user_name) { should == RS::SU_NAME }
|
49
|
-
its(:name) { should be_nil }
|
50
|
-
its(:ip) { should be_nil }
|
51
|
-
end
|
52
|
-
|
53
|
-
describe 'check service user with illegal password' do
|
54
|
-
before(:all) do
|
55
|
-
@user = RS.check_service_user('su' => RS::SU_NAME, 'sp' => 'someincorrectpassword')
|
56
|
-
end
|
57
|
-
subject { @user }
|
58
|
-
it { should be_nil }
|
59
|
-
end
|
60
|
-
|
61
|
-
describe 'update service user' do
|
62
|
-
before(:all) do
|
63
|
-
@org = RS::TEST_ORG1
|
64
|
-
@ip = RS.what_is_my_ip
|
65
|
-
@resp = RS.update_service_user( RS.auth_params.merge(RS.su_params).merge({ 'ip' => @ip, 'name' => 'c12' }) )
|
66
|
-
end
|
67
|
-
subject { @resp }
|
68
|
-
it { should be_true }
|
69
|
-
end
|
70
|
-
|
71
|
-
describe 'get name from TIN' do
|
72
|
-
before(:all) do
|
73
|
-
@name = RS.get_name_from_tin(RS.su_params.merge('tin' => '422430239'))
|
74
|
-
end
|
75
|
-
subject { @name }
|
76
|
-
it { should == 'შპს ც12' }
|
77
|
-
end
|
@@ -1,63 +0,0 @@
|
|
1
|
-
# -*- encoding : utf-8 -*-
|
2
|
-
require 'spec_helper'
|
3
|
-
require 'rs'
|
4
|
-
|
5
|
-
describe 'create waybill, activate it, then deactivate' do
|
6
|
-
before(:all) do
|
7
|
-
@waybill = waybill_skeleton
|
8
|
-
RS.save_waybill(@waybill, RS.su_params)
|
9
|
-
end
|
10
|
-
subject { @waybill }
|
11
|
-
it { should_not be_nil }
|
12
|
-
its(:id) { should_not be_nil }
|
13
|
-
its(:status) { should == RS::Waybill::STATUS_SAVED }
|
14
|
-
context 'activate waybill' do
|
15
|
-
before(:all) do
|
16
|
-
params = RS.su_params.merge('waybill_id' => @waybill.id)
|
17
|
-
RS.activate_waybill(params)
|
18
|
-
@waybill = RS.get_waybill(params)
|
19
|
-
end
|
20
|
-
subject { @waybill }
|
21
|
-
its(:status) { should == RS::Waybill::STATUS_ACTIVE }
|
22
|
-
end
|
23
|
-
context 'now deactivate waybill' do
|
24
|
-
before(:all) do
|
25
|
-
params = RS.su_params.merge('waybill_id' => @waybill.id)
|
26
|
-
#RS.close_waybill(params)
|
27
|
-
RS.deactivate_waybill(params)
|
28
|
-
@waybill = RS.get_waybill(params)
|
29
|
-
end
|
30
|
-
subject { @waybill }
|
31
|
-
its(:status) { should == RS::Waybill::STATUS_DEACTIVATED }
|
32
|
-
end
|
33
|
-
end
|
34
|
-
|
35
|
-
describe 'create waybill, activate and close it, then try to deactivate' do
|
36
|
-
before(:all) do
|
37
|
-
@waybill = waybill_skeleton
|
38
|
-
RS.save_waybill(@waybill, RS.su_params)
|
39
|
-
end
|
40
|
-
subject { @waybill }
|
41
|
-
it { should_not be_nil }
|
42
|
-
its(:id) { should_not be_nil }
|
43
|
-
its(:status) { should == RS::Waybill::STATUS_SAVED }
|
44
|
-
context 'activate and close waybill' do
|
45
|
-
before(:all) do
|
46
|
-
params = RS.su_params.merge('waybill_id' => @waybill.id)
|
47
|
-
RS.activate_waybill(params)
|
48
|
-
RS.close_waybill(params)
|
49
|
-
@waybill = RS.get_waybill(params)
|
50
|
-
end
|
51
|
-
subject { @waybill }
|
52
|
-
its(:status) { should == RS::Waybill::STATUS_CLOSED }
|
53
|
-
end
|
54
|
-
context 'closed waybill is diactivable too' do
|
55
|
-
before(:all) do
|
56
|
-
params = RS.su_params.merge('waybill_id' => @waybill.id)
|
57
|
-
RS.deactivate_waybill(params)
|
58
|
-
@waybill = RS.get_waybill(params)
|
59
|
-
end
|
60
|
-
subject { @waybill }
|
61
|
-
its(:status) { should == RS::Waybill::STATUS_DEACTIVATED }
|
62
|
-
end
|
63
|
-
end
|
@@ -1,19 +0,0 @@
|
|
1
|
-
# -*- encoding : utf-8 -*-
|
2
|
-
|
3
|
-
require 'spec_helper'
|
4
|
-
require 'rs'
|
5
|
-
|
6
|
-
describe 'save invoice (only for closed waybill)' do
|
7
|
-
before(:all) do
|
8
|
-
@waybill = waybill_skeleton
|
9
|
-
RS.save_waybill(@waybill, RS.su_params)
|
10
|
-
RS.activate_waybill(RS.su_params.merge('waybill_id' => @waybill.id))
|
11
|
-
RS.close_waybill(RS.su_params.merge('waybill_id' => @waybill.id))
|
12
|
-
RS.save_waybill_invoice(@waybill, RS.su_params)
|
13
|
-
end
|
14
|
-
subject { @waybill }
|
15
|
-
its(:invoice_id) { should_not be_nil }
|
16
|
-
its(:invoice_id) { should > 0 }
|
17
|
-
end
|
18
|
-
|
19
|
-
# TODO: როდესაც არაა დღგ-ს გადამხდელი ვერ აგზავნი?!
|
data/spec/rs/waybill_spec.rb
DELETED
@@ -1,205 +0,0 @@
|
|
1
|
-
# -*- encoding : utf-8 -*-
|
2
|
-
|
3
|
-
require 'spec_helper'
|
4
|
-
require 'rs'
|
5
|
-
|
6
|
-
RSpec::Matchers.define :be_valid_personal_tin do #|expected|
|
7
|
-
match do |actual|
|
8
|
-
RS.is_valid_personal_tin(actual)
|
9
|
-
end
|
10
|
-
end
|
11
|
-
|
12
|
-
RSpec::Matchers.define :be_valid_corporate_tin do #|expected|
|
13
|
-
match do |actual|
|
14
|
-
RS.is_valid_corporate_tin(actual)
|
15
|
-
end
|
16
|
-
end
|
17
|
-
|
18
|
-
def validate_personal_tin(tin, valid=true)
|
19
|
-
if valid
|
20
|
-
context "#{tin} should be valid" do
|
21
|
-
subject{ tin }
|
22
|
-
it { should be_valid_personal_tin }
|
23
|
-
end
|
24
|
-
else
|
25
|
-
context "#{tin} should NOT be valid" do
|
26
|
-
subject{ tin }
|
27
|
-
it { should_not be_valid_personal_tin }
|
28
|
-
end
|
29
|
-
end
|
30
|
-
end
|
31
|
-
|
32
|
-
def validate_corporate_tin(tin, valid=true)
|
33
|
-
if valid
|
34
|
-
context "#{tin} should be valid" do
|
35
|
-
subject{ tin }
|
36
|
-
it { should be_valid_corporate_tin }
|
37
|
-
end
|
38
|
-
else
|
39
|
-
context "#{tin} should NOT be valid" do
|
40
|
-
subject{ tin }
|
41
|
-
it { should_not be_valid_corporate_tin }
|
42
|
-
end
|
43
|
-
end
|
44
|
-
end
|
45
|
-
|
46
|
-
describe 'Personal TIN validation' do
|
47
|
-
validate_personal_tin('12345678901', true)
|
48
|
-
validate_personal_tin('1234567890', false)
|
49
|
-
validate_personal_tin('123456789012', false)
|
50
|
-
validate_personal_tin('1234567890A', false)
|
51
|
-
end
|
52
|
-
|
53
|
-
describe 'Corporate TIN validation' do
|
54
|
-
validate_corporate_tin('123456789', true)
|
55
|
-
validate_corporate_tin('1234567890', false)
|
56
|
-
validate_corporate_tin('12345678', false)
|
57
|
-
validate_corporate_tin('12345678A', false)
|
58
|
-
end
|
59
|
-
|
60
|
-
describe 'save waybill' do
|
61
|
-
before(:all) do
|
62
|
-
@waybill = waybill_skeleton
|
63
|
-
RS.save_waybill(@waybill, RS.su_params)
|
64
|
-
end
|
65
|
-
subject { @waybill }
|
66
|
-
its(:status) { should == 0 }
|
67
|
-
its(:id) { should_not be_nil }
|
68
|
-
its(:id) { should > 0 }
|
69
|
-
its(:error_code) { should == 0 }
|
70
|
-
context 'items' do
|
71
|
-
subject { @waybill.items }
|
72
|
-
its(:size) { should == 1 }
|
73
|
-
context 'first item' do
|
74
|
-
subject { @waybill.items.first }
|
75
|
-
its(:id) { should_not be_nil }
|
76
|
-
its(:id) { should > 0 }
|
77
|
-
end
|
78
|
-
end
|
79
|
-
end
|
80
|
-
|
81
|
-
describe 'save waybill with large production name' do
|
82
|
-
before(:all) do
|
83
|
-
@waybill = waybill_skeleton
|
84
|
-
@waybill.items[0].prod_name = '1234567890'*30 + '1' # 301 სიმბოლო შეცდომითია
|
85
|
-
RS.save_waybill(@waybill, RS.su_params)
|
86
|
-
#puts @waybill.id
|
87
|
-
end
|
88
|
-
subject { @waybill }
|
89
|
-
# გაუგებარია რატომ გააკეთეს ასე ?!
|
90
|
-
its(:error_code) { should == 0 }
|
91
|
-
# ID არის ცარიელი
|
92
|
-
its(:id) { should be_nil }
|
93
|
-
end
|
94
|
-
|
95
|
-
describe 'get waybill information' do
|
96
|
-
before(:all) do
|
97
|
-
@start = waybill_skeleton({:comment => 'სატესტო კომენტარი'})
|
98
|
-
@item = @start.items.first
|
99
|
-
RS.save_waybill(@start, RS.su_params)
|
100
|
-
@waybill = RS.get_waybill(RS.su_params.merge('waybill_id' => @start.id))
|
101
|
-
end
|
102
|
-
subject { @waybill }
|
103
|
-
it { should_not be_nil }
|
104
|
-
its(:id) { should_not be_nil }
|
105
|
-
its(:type) { should == @start.type }
|
106
|
-
its(:create_date) { should_not be_nil }
|
107
|
-
its(:status) { should == RS::Waybill::STATUS_SAVED }
|
108
|
-
its(:parent_id) { should be_nil }
|
109
|
-
its(:seller_id) { should == @start.seller_id }
|
110
|
-
its(:buyer_tin) { should == @start.buyer_tin }
|
111
|
-
its(:buyer_name) { should == @start.buyer_name }
|
112
|
-
its(:check_buyer_tin) { should == @start.check_buyer_tin }
|
113
|
-
its(:seller_info) { should == @start.seller_info }
|
114
|
-
its(:buyer_info) { should == @start.buyer_info }
|
115
|
-
its(:driver_tin) { should == @start.driver_tin }
|
116
|
-
its(:check_driver_tin) { should == @start.check_driver_tin }
|
117
|
-
its(:driver_name) { should == @start.driver_name }
|
118
|
-
its(:start_address) { should == @start.start_address }
|
119
|
-
its(:end_address) { should == @start.end_address }
|
120
|
-
its(:transportation_cost) { should == @start.transportation_cost }
|
121
|
-
its(:transportation_cost_payer) { should == @start.transportation_cost_payer }
|
122
|
-
its(:transport_type_id) { should == @start.transport_type_id }
|
123
|
-
its(:transport_type_name) { should == @start.transport_type_name }
|
124
|
-
its(:car_number) { should == @start.car_number }
|
125
|
-
its(:comment) { should == @start.comment }
|
126
|
-
its(:start_date) { should_not be_nil }
|
127
|
-
its(:delivery_date) { should be_nil }
|
128
|
-
context 'items' do
|
129
|
-
subject { @waybill.items }
|
130
|
-
it { should_not be_empty }
|
131
|
-
its(:size) { should == 1 }
|
132
|
-
context 'first item' do
|
133
|
-
subject { @waybill.items.first }
|
134
|
-
it { should be_instance_of RS::WaybillItem }
|
135
|
-
its(:id) { should_not be_nil }
|
136
|
-
its(:prod_name) { should == @item.prod_name }
|
137
|
-
its(:unit_id) { should == @item.unit_id }
|
138
|
-
its(:unit_name) { should == @item.unit_name }
|
139
|
-
its(:quantity) { should == @item.quantity }
|
140
|
-
its(:price) { should == @item.price }
|
141
|
-
its(:bar_code) { should == @item.bar_code }
|
142
|
-
its(:excise_id) { should == @item.excise_id}
|
143
|
-
end
|
144
|
-
end
|
145
|
-
end
|
146
|
-
|
147
|
-
describe 'activate waybill' do
|
148
|
-
before(:all) do
|
149
|
-
@waybill = waybill_skeleton
|
150
|
-
RS.save_waybill(@waybill, RS.su_params)
|
151
|
-
wb_params = RS.su_params.merge({ 'waybill_id' => @waybill.id })
|
152
|
-
RS.activate_waybill(wb_params)
|
153
|
-
@waybill = RS.get_waybill(wb_params)
|
154
|
-
end
|
155
|
-
subject { @waybill }
|
156
|
-
its(:status) { should == RS::Waybill::STATUS_ACTIVE }
|
157
|
-
end
|
158
|
-
|
159
|
-
describe 'close waybill' do
|
160
|
-
before(:all) do
|
161
|
-
@waybill = waybill_skeleton
|
162
|
-
RS.save_waybill(@waybill, RS.su_params)
|
163
|
-
@wb_params = RS.su_params.merge({ 'waybill_id' => @waybill.id })
|
164
|
-
RS.activate_waybill(@wb_params)
|
165
|
-
@resp = RS.close_waybill(@wb_params)
|
166
|
-
end
|
167
|
-
subject { @resp }
|
168
|
-
it { should == true }
|
169
|
-
context "waybill itself" do
|
170
|
-
before(:all) do
|
171
|
-
@waybill = RS.get_waybill(@wb_params)
|
172
|
-
end
|
173
|
-
subject { @waybill }
|
174
|
-
its(:status) { should == RS::Waybill::STATUS_CLOSED }
|
175
|
-
end
|
176
|
-
end
|
177
|
-
|
178
|
-
describe 'delete saved waybill' do
|
179
|
-
before(:all) do
|
180
|
-
@waybill = waybill_skeleton
|
181
|
-
RS.save_waybill(@waybill, RS.su_params)
|
182
|
-
@wb_params = RS.su_params.merge({ 'waybill_id' => @waybill.id })
|
183
|
-
@resp = RS.delete_waybill(@wb_params)
|
184
|
-
end
|
185
|
-
subject { @resp }
|
186
|
-
it { should == true }
|
187
|
-
context "where is waybill" do
|
188
|
-
before(:all) do
|
189
|
-
@deleted = RS.get_waybill(@wb_params)
|
190
|
-
end
|
191
|
-
subject { @deleted }
|
192
|
-
it { should_not be_nil}
|
193
|
-
its(:status) { should == RS::Waybill::STATUS_DELETED }
|
194
|
-
end
|
195
|
-
end
|
196
|
-
|
197
|
-
describe '"ტრანსპორტირების გარეშე" ზედნადები განსხვავებული მისამართებით' do
|
198
|
-
before(:all) do
|
199
|
-
@waybill = waybill_skeleton(:type => RS::WaybillType::WITHOUT_TRANSPORTATION, :start_address => 'აბაშა', :end_address => ' თბილისი')
|
200
|
-
RS.save_waybill(@waybill, RS.su_params)
|
201
|
-
@resp = @waybill.error_code
|
202
|
-
end
|
203
|
-
subject { @resp }
|
204
|
-
it { should == -1036 }
|
205
|
-
end
|