rs.ge 0.1.0.beta2 → 0.1.0.rc1

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/.gitignore CHANGED
@@ -3,4 +3,5 @@
3
3
  Gemfile.lock
4
4
  pkg/*
5
5
  coverage/*
6
- tmp/*
6
+ tmp/*
7
+ *.swp
data/README.md CHANGED
@@ -1,107 +1,43 @@
1
- # RS.GE ვებ-სერვისები
1
+ # RS.GE web services
2
2
 
3
- ეს ბიბლიოთეკა განკუთვნილია RS.GE-ს ვებ სერვისების გამოყენებაზე.
4
- ამ ბიბლიოთეკის მეშვეობით ადვილად მოახერხებთ ყველა ოპერაციის ჩატარებას,
5
- რასაც აღნიშნული ვებ სერვისი ითვალისწინებს.
3
+ This is a tiny API for working with [rs.ge](http://eservices.rs.ge) web-services from Ruby.
6
4
 
7
- ## გამოყენება
5
+ ## System methods
8
6
 
9
- გამოყენებისათვის უნდა ჩასვათ შემდეგი ხაზი თქვენს Gemfile-ში:
10
-
11
- ```
12
- gem 'rs.ge', '~> 0.0.7'
13
- ```
14
-
15
- შემდეგი გამოყენება ძალიან მარტივია:
7
+ The simplest method to use is `what_is_my_ip`, which returns your outer IP address.
8
+ You'll need this IP address, when registering service user (see below):
16
9
 
17
10
  ```ruby
18
- require 'rs'
19
-
20
- puts RS.what_is_my_ip # თქვენს IP მისამართს დაბეჭდავს კონსოლში
11
+ ip = RS.sys.what_is_my_ip
21
12
  ```
22
13
 
23
- ## სისტემური ფუნქციები
24
-
25
- თქვენი IP-ს გასაგებად შეგიძლიათ გამოიყენოთ `what_is_my_ip` ფუნქცია:
14
+ Before you can work with main API functions, you need to create a special user
15
+ (which is called *service user*). Use `create_user` method for this purpose:
26
16
 
27
17
  ```ruby
28
- my_ip = RS.what_is_my_ip
18
+ created = RS.sys.create_user(username: 'your_rs.ge_username', password: 'secret', ip: 'access_ip', name: 'name_of_this_user/ip_pair', su: 'new_user', sp: 'new_password'))
29
19
  ```
30
20
 
31
- სერვისის სხვა მეთოდების გამოსაყენებლად უნდა გქონდეთ შექმნილი სერვისის მომხმარებელი.
32
- სერვისის მომხმარებლის შესაქმენლად დაგჭირდებათ თქვენს ორგანიზაციაზე მინიჭებული მომხმარებლის სახელი და პაროლი.
21
+ All parameters in the example above are required. The method return `true` if the user creation was successfull.
33
22
 
34
- ახალი სერვისის მომხმარებლის შესაქმნელად გამოიყენეთ `create_service_user` ფუნქცია:
23
+ When you need to update your user (including password change), `update_user` method should be used:
35
24
 
36
25
  ```ruby
37
- was_created = RS.create_service_user(params)
26
+ updated = RS.sys.update_user(username: 'your_rs.ge_username', password: 'secret', ip: 'access_ip', name: 'name_of_this_user/ip_pair', su: 'new_user', sp: 'new_password'))
38
27
  ```
39
28
 
40
- `params` წარმოადგენს შემდეგი მონაცემების ჰეშს (ყველა პარამეტრი აუცილებელია):
41
-
42
- - `user_name` — თქვენი ორგანიზაციის მომხმარებლის სახელი;
43
- - `user_password` — თქვენი ორგანიზაციის პაროლი;
44
- - `ip` — IP მისამართი, რომლიდანაც შეგიძლიათ იმუშაოთ;
45
- - `su` — ახალი სერვისის მომხმარებლის სახელი;
46
- - `sp` — სერვისის მომხმარებლის პაროლი.
47
-
48
- ეს ფუნქცია აბრუნებს `boolean` ტიპის მნიშვნელობას: თუ მომხმარებელი შეიქმნა, ბრუნდება `true`, ხოლო `false` — წინააღმდეგ შემთხვევაში. თუ რატომ არ მოხდა მომხმარებლის გახსნა შეიძლება მხოლოდ ვივარაუდოდ: ამის შესახებ rs-ის სერვისი არანაირ პასუხს არ იძლევა.
49
-
50
- ძალაინ მნიშვნელოვანი ფუნქციაა `check_service_user`, რომელიც გარდა იმისა, რომ ამოწმებს ახლად შექმნილი მომხმარებლის სახელს და პაროლს, ასევე გაძლევთ შანსს გაიგოთ თქვენი ორგანიზაციის გადამხდელის ID. ამ ფუნქციის გამოძახება ასე გამოიყურება:
29
+ Checking of username/password can be done using `check_user` method:
51
30
 
52
31
  ```ruby
53
- user = RS.check_service_user(params)
32
+ resp = RS.sys.check_user(su: 'service_user', sp: 'password')
54
33
  ```
55
34
 
56
- გადასაცემი პარამეტრების სია გაცილებით მოკრძალებულია:
57
-
58
- - `su` — სერვისის მომხმარებლის სახელი;
59
- - `sp` — სერვისის მომხმარებლის პაროლი.
60
-
61
- თუ `su` და `sp` პარამეტრების სწორადაა მოწოდებულია, მაშინ `RS::User` ობიექტი ბრუნდება, რომელიც შეიცავს `payer_id` თვისებას, სადაც თქვენი ორგანიზაციის გადამხდელის საიდენტიფიკაციო კოდია ჩაწერილი. თუ ავტორიზაციის მონაცემები არასწორადაა მიწოდებული, ეს მეთოდი დააბრუნებს `nil` მნიშვნელობას.
62
-
63
- ასევე მარტივია მომხმარებლის მონაცემების შეცვლა. ამისათვის `update_service_user` მეთოდი შეგიძლიათ გამოიყენოთ:
64
-
35
+ If the username/passowrd pair is correct, the following hash is returned:
65
36
 
66
37
  ```ruby
67
- was_updated = RS.create_service_user(params)
38
+ {payer: payer_id, user: user_id}
68
39
  ```
69
40
 
70
- `params` წარმოადგენს მონაცემების ჰეშს, რომელიც მსგავსია იმისა, რასაც გადავცემდით `create_service_user` ფუნქციის გამოძახებისა:
71
-
72
- - `user_name` — თქვენი ორგანიზაციის მომხმარებლის სახელი;
73
- - `user_password` — თქვენი ორგანიზაციის პაროლი;
74
- - `ip` — IP მისამართი, რომლიდანაც შეგიძლიათ იმუშაოთ;
75
- - `su` — სერვისის მომხმარებლის სახელი;
76
- - `sp` — სერვისის მომხმარებლის პაროლი.
77
-
78
- თქვენი ორგანიზაციის მომხმარებელთა სიის სანახავად გამოიყენეთ `get_service_users` მეთოდი:
79
-
80
- ```ruby
81
- users = RS.get_service_users(params)
82
- ```
83
-
84
- პარამეტრებში უნდა გადაეცეს შემდეგი მონაცემები:
85
-
86
- - `user_name` — თქვენი ორგანიზაციის მომხმარებლის სახელი;
87
- - `user_password` — თქვენი ორგანიზაციის პაროლი.
88
-
89
- ეს ფუნქცია აბრუნებს `RS::User` ტიპის (მომხმარებლის კლასი) ობიექტების მასივს.
90
-
91
- ბოლო სასარგებლო სისტემური ფუნქციაა `get_name_from_tin`, რომლის დახმარებით შეგიძლიათ ორგანიზაციის საიდენტიფიკაციო ნომრიდან (ან პირადი ნომრიდან) მიიღოთ ამ ორგანიზაციის (პირის) დასახელება.
92
-
93
- ```ruby
94
- name = RS.get_name_from_tin(params)
95
- ```
96
-
97
- - `su` — სერვისის მომხმარებლის სახელი;
98
- - `sp` — სერვისის მომხმარებლის პაროლი;
99
- - `tin` — საიდენტიფიკაციო ნომერი ან პირადი ნომერი.
100
-
101
- ## ცნობარის ფუნქციები
102
-
103
- TODO:
104
-
105
- ## ზედნადებთან მუშაობა
41
+ where `payer` is the unique ID of the payer, whom this user belongs to, and `user` gives ID of the user itself.
106
42
 
107
- TODO:
43
+ Payer ID is very important for futher processing.
data/lib/rs.rb CHANGED
@@ -3,11 +3,14 @@ require 'savon'
3
3
  require 'rs/version'
4
4
 
5
5
  # models
6
- require 'rs/models/waybill_unit'
6
+ require 'rs/models/waybill'
7
7
 
8
8
  # requests
9
- require 'rs/requests/base_request'
10
- require 'rs/requests/waybill_unit_request'
9
+ require 'rs/requests/config'
10
+ require 'rs/requests/base'
11
+ require 'rs/requests/dict'
12
+ require 'rs/requests/sys'
13
+ require 'rs/requests/waybill'
11
14
 
12
15
  module RS
13
16
  # This constant indicates 18% vat tariff.
@@ -0,0 +1,340 @@
1
+ # -*- encoding : utf-8 -*-
2
+ require 'active_support/all'
3
+
4
+ # Class with errors and warnings.
5
+ class RS::Validable
6
+ attr_accessor :errors, :warnings
7
+
8
+ def initialize(opts = {})
9
+ opts.each do |k, v|
10
+ instance_variable_set("@#{k}", v) unless v.nil?
11
+ end
12
+ end
13
+
14
+ # Add error to the specified field.
15
+ def add_error(fld, msg)
16
+ self.errors = {} unless self.errors
17
+ self.errors[fld.to_sym] = msg
18
+ end
19
+
20
+ # Add warning to the specified field.
21
+ def add_warning(fld, msg)
22
+ self.warnings = {} unless self.warnings
23
+ self.warnings[fld.to_sym] = msg
24
+ end
25
+
26
+ # Valid?
27
+ def valid?
28
+ self.errors.nil? or self.errors.empty?
29
+ end
30
+ end
31
+
32
+ # Waybill item class.
33
+ class RS::WaybillItem < RS::Validable
34
+ # Item ID.
35
+ attr_accessor :id
36
+ # Barcode for the production in this item,
37
+ attr_accessor :bar_code
38
+ # Name of the production in this item.
39
+ attr_accessor :prod_name
40
+ # Unit ID.
41
+ attr_accessor :unit_id
42
+ # Unit name.
43
+ attr_accessor :unit_name
44
+ # Quantity.
45
+ attr_accessor :quantity
46
+ # Price.
47
+ attr_accessor :price
48
+ # Excise ID.
49
+ attr_accessor :excise_id
50
+ # VAT type.
51
+ attr_accessor :vat_type
52
+ # Mark this item for deletion.
53
+ attr_accessor :delete
54
+
55
+ # Initialize WaybillItem from hash.
56
+ def init_from_hash(hash)
57
+ self.id = hash[:id]
58
+ self.bar_code = hash[:bar_code]
59
+ self.prod_name = hash[:w_name]
60
+ self.unit_id = hash[:unit_id].to_i
61
+ self.unit_name = hash[:unit_txt]
62
+ self.quantity = hash[:quantity].to_f
63
+ self.price = hash[:price].to_f
64
+ self.excise_id = hash[:a_id] == '0' ? nil : hash[:a_id].to_i
65
+ end
66
+
67
+ # Convert item to XML.
68
+ def to_xml(xml)
69
+ xml.GOODS do |b|
70
+ b.ID (self.id ? self.id : 0)
71
+ b.W_NAME self.prod_name
72
+ b.UNIT_ID self.unit_id
73
+ b.UNIT_TXT self.unit_name
74
+ b.QUANTITY self.quantity
75
+ b.PRICE self.price
76
+ b.STATUS self.delete ? -1 : +1
77
+ b.AMOUNT self.quantity * self.price
78
+ b.BAR_CODE self.bar_code
79
+ b.A_ID (self.excise_id ? self.excise_id : 0)
80
+ b.VAT_TYPE (self.vat_type || RS::VAT_COMMON)
81
+ end
82
+ end
83
+
84
+ # Validate this item.
85
+ def validate
86
+ self.errors = {}
87
+ add_error(:bar_code, 'საქონლის შტრიხ-კოდი უნდა იყოს განსაზღვრული') if self.bar_code.blank?
88
+ add_error(:prod_name, 'საქონლის სახელი არაა განსაზღვრული') if self.prod_name.blank?
89
+ add_error(:unit_id, 'ზომის ერთეული არაა განსაზღვრული') if self.unit_id.blank?
90
+ add_error(:unit_name, 'ზომის ერთეულის სახელი არაა განსაზღვრული') if self.unit_id == RS::UNIT_OTHERS and (self.unit_name.blank?)
91
+ add_error(:quantity, 'რაოდენობა უნდა იყოს მეტი 0-ზე') if self.quantity.blank? or self.quantity <= 0
92
+ add_error(:price, 'ფასი არ უნდა იყოს უარყოფითი') if self.price.blank? or self.price < 0
93
+ end
94
+ end
95
+
96
+ # Waybill class.
97
+ class RS::Waybill < RS::Validable
98
+ # Constant, which indicates, that transportation cost is paid by buyer.
99
+ TRANSPORTATION_PAID_BY_BUYER = 1
100
+ # Constant, which indicates, that transportation cost is paid by seller.
101
+ TRANSPORTATION_PAID_BY_SELLER = 2
102
+
103
+ # Deleted waybill status.
104
+ STATUS_DELETED = -1
105
+ # Deactivated waybill status.
106
+ STATUS_DEACTIVATED = -2
107
+ # Saved waybill status.
108
+ STATUS_SAVED = 0
109
+ # Active waybill status.
110
+ STATUS_ACTIVE = 1
111
+ # Closed (complete) waybill status.
112
+ STATUS_CLOSED = 2
113
+
114
+ # ID of the waybill
115
+ attr_accessor :id
116
+ # Waybill type (see RS::WAYBILL_TYPES).
117
+ attr_accessor :type
118
+ # Waybill status.
119
+ attr_accessor :status
120
+ # Parent waybill (for subwaybills).
121
+ attr_accessor :parent_id
122
+ # Waybill number.
123
+ attr_accessor :number
124
+ # Waybill creation date.
125
+ attr_accessor :create_date
126
+ # Waybill activation date.
127
+ attr_accessor :activate_date
128
+ # Waybill delivery date.
129
+ attr_accessor :delivery_date
130
+ # Waybill close date.
131
+ attr_accessor :close_date
132
+ # Unique ID of the seller
133
+ attr_accessor :seller_id
134
+ # Seller TIN.
135
+ attr_accessor :seller_tin
136
+ # Seller name.
137
+ attr_accessor :seller_name
138
+ # Buyer TIN.
139
+ attr_accessor :buyer_tin
140
+ # Whether buyer TIN should be validated.
141
+ # Use `false` for foreigner.
142
+ attr_accessor :check_buyer_tin
143
+ # Buyer name.
144
+ attr_accessor :buyer_name
145
+ # Information about a person, who sends this waybill.
146
+ attr_accessor :seller_info
147
+ # Information about a person, who receives this waybill.
148
+ attr_accessor :buyer_info
149
+ # Driver TIN.
150
+ attr_accessor :driver_tin
151
+ # Whether driver TIN should be validated.
152
+ # Use `false` for foreigner.
153
+ attr_accessor :check_driver_tin
154
+ # Driver name.
155
+ attr_accessor :driver_name
156
+ # Waybill start address.
157
+ attr_accessor :start_address
158
+ # Waybill end address.
159
+ attr_accessor :end_address
160
+ # Transportation cost.
161
+ attr_accessor :transportation_cost
162
+ # Who pays for transportation?
163
+ attr_accessor :transportation_cost_payer
164
+ # Transportation type (see RS::TRANSPORT_TYPES).
165
+ attr_accessor :transport_type_id
166
+ # Transportation name.
167
+ attr_accessor :transport_type_name
168
+ # Vehicle number.
169
+ attr_accessor :car_number
170
+ # ==> XXX: there should be some flag which indicates whether vehicle number should be checked but documentation given no answer on this
171
+ # Comment on this waybill.
172
+ attr_accessor :comment
173
+ # Waybill items.
174
+ attr_accessor :items
175
+ # Waybill error code.
176
+ attr_accessor :error_code
177
+ # Invoice ID, related to this waybill.
178
+ attr_accessor :invoice_id
179
+ # Full amount of this waybill.
180
+ attr_accessor :total
181
+ # Service user ID, who created this waybill.
182
+ attr_accessor :user_id
183
+
184
+ # Convert this waybill to XML.
185
+ def to_xml(xml)
186
+ xml.WAYBILL do |b|
187
+ b.GOODS_LIST do |g|
188
+ (self.items || []).each do |item|
189
+ item.to_xml g
190
+ end
191
+ end
192
+ b.ID (self.id ? self.id : 0)
193
+ b.TYPE self.type
194
+ b.BUYER_TIN self.buyer_tin
195
+ b.CHEK_BUYER_TIN (self.check_buyer_tin ? 1 : 0)
196
+ b.BUYER_NAME self.buyer_name
197
+ b.START_ADDRESS self.start_address
198
+ b.END_ADDRESS self.end_address
199
+ b.DRIVER_TIN self.driver_tin
200
+ b.CHEK_DRIVER_TIN (self.check_driver_tin ? 1 : 0)
201
+ b.DRIVER_NAME self.driver_name
202
+ b.TRANSPORT_COAST (self.transportation_cost ? self.transportation_cost : 0)
203
+ b.RECEPTION_INFO self.seller_info
204
+ b.RECEIVER_INFO self.buyer_info
205
+ b.DELIVERY_DATE (self.delivery_date ? self.delivery_date.strftime('%Y-%m-%dT%H:%M:%S') : '')
206
+ b.STATUS self.status
207
+ b.SELER_UN_ID self.seller_id
208
+ b.PAR_ID (self.parent_id ? self.parent_id : '')
209
+ b.CAR_NUMBER self.car_number
210
+ b.WAYBILL_NUMBER (self.number ? self.number : '')
211
+ ## XXX: b.S_USER_ID
212
+ b.BEGIN_DATE (self.activate_date ? self.activate_date.strftime('%Y-%m-%dT%H:%M:%S') : '')
213
+ b.TRAN_COST_PAYER (self.transportation_cost_payer ? self.transportation_cost_payer : Waybill::TRANSPORTATION_PAID_BY_BUYER)
214
+ b.TRANS_ID self.transport_type_id
215
+ b.TRANS_TXT self.transport_type_name
216
+ b.COMMENT self.comment
217
+ end
218
+ end
219
+
220
+ # Initialize this waybill from given hash.
221
+ def init_from_hash(hash)
222
+ items_hash = hash[:goods_list][:goods]
223
+ items_hash = [items_hash] if items_hash.instance_of? Hash
224
+ self.items = []
225
+ items_hash.each do |item_hash|
226
+ item = RS::WaybillItem.new
227
+ item.init_from_hash(item_hash)
228
+ self.items << item
229
+ end
230
+ self.id = hash[:id].to_i
231
+ self.type = hash[:type].to_i
232
+ self.create_date = hash[:create_date]
233
+ self.buyer_tin = hash[:buyer_tin]
234
+ self.check_buyer_tin = hash[:chek_buyer_tin].to_i == 1
235
+ self.buyer_name = hash[:buyer_name]
236
+ self.start_address = hash[:start_address]
237
+ self.end_address = hash[:end_address]
238
+ self.driver_tin = hash[:driver_tin]
239
+ self.check_driver_tin = hash[:chek_driver_tin].to_i == 1
240
+ self.driver_name = hash[:driver_name]
241
+ self.transportation_cost = hash[:transport_coast].to_f
242
+ self.seller_info = hash[:reception_info]
243
+ self.buyer_info = hash[:receiver_info]
244
+ self.delivery_date = hash[:delivery_date] # delivery date
245
+ self.status = hash[:status].to_i
246
+ self.seller_id = hash[:seler_un_id].to_i
247
+ self.activate_date = hash[:activate_date]
248
+ self.parent_id = hash[:par_id]
249
+ self.total = hash[:full_amount].to_f
250
+ self.car_number = hash[:car_number]
251
+ self.number = hash[:waybill_number]
252
+ self.close_date = hash[:close_date]
253
+ self.user_id = hash[:s_user_id].to_i
254
+ self.activate_date = hash[:begin_date]
255
+ self.transportation_cost_payer = hash[:tran_cost_payer] ? hash[:tran_cost_payer].to_i : nil
256
+ self.transport_type_id = hash[:trans_id].to_i
257
+ self.transport_type_name = hash[:trans_txt]
258
+ self.comment = hash[:comment]
259
+ self
260
+ end
261
+
262
+ def validate
263
+ self.errors = {}
264
+ self.items.each { |it| it.validate } if self.items
265
+ validate_buyer
266
+ validate_transport
267
+ validate_addresses
268
+ validate_remote if RS.config.validate_remote
269
+ end
270
+
271
+ def valid?
272
+ self.items.each { |it| return false unless it.valid? }
273
+ super.valid?
274
+ end
275
+
276
+ private
277
+
278
+ def validate_buyer
279
+ if self.buyer_tin.blank?
280
+ add_error(:buyer_tin, 'მყიდველის საიდენტიფიკაციო ნომერი განუსაზღვრელია')
281
+ else
282
+ if self.check_buyer_tin
283
+ add_error(:buyer_tin, 'საიდენტიფიკაციო ნომერი უნდა შედგებოდეს 9 ან 11 ციფრისაგან') if !RS.dict.personal_tin?(self.buyer_tin) and !RS.corporate_tin?(self.buyer_tin)
284
+ else
285
+ add_error(:buyer_name, 'განსაზღვრეთ მყიდველის სახელი') if self.buyer_name.blank?
286
+ end
287
+ end
288
+ end
289
+
290
+ def validate_transport
291
+ if self.transport_type_id == RS::TRANS_VEHICLE
292
+ add_error(:car_number, 'მიუთითეთ სატრანსპორტო საშუალების სახელმწიფო ნომერი') if self.car_number.blank?
293
+ add_error(:driver_tin, 'მძღოლის პირადი ნომერი უნდა იყოს მითითებული') if self.driver_tin.blank?
294
+ if self.check_driver_tin
295
+ add_error(:driver_tin, 'მძღოლის პირადი ნომერი არასწორია') unless RS.dict.personal_tin?(self.driver_tin)
296
+ # unless RS.valid_vehicle_number?(self.car_number)
297
+ # RS.append_validation_error(@validation_errors, :car_number, 'არასწორი მანქანის ნომერი: ჩაწერეთ ABC123 ფორმატში!')
298
+ # end
299
+ else
300
+ add_error(:driver_name, 'ჩაწერეთ მძღოლის სახელი') if self.driver_name.blank?
301
+ end
302
+ elsif self.transport_type_id == RS::TRANS_OTHER
303
+ add_error(:transport_type_name, 'მიუთითეთ სატრანსპორტო საშუალების დასახელება') if self.transport_type_name.blank?
304
+ end
305
+ end
306
+
307
+ def validate_addresses
308
+ add_error(:start_address, 'საწყისი მისამართი განუსაზღვრელია') if self.start_address.blank?
309
+ add_error(:end_address, 'საბოლოო მისამართი განუსაზღვრელია') if self.end_address.blank?
310
+ if not self.start_address.blank? and not self.end_address.blank? and
311
+ self.start_address.strip != self.end_address.strip and
312
+ self.type == RS::WAYBILL_TYPE_WITHOUT_TRANS
313
+ add_error(:type, '"ტრანსპორტირების გარეშე" დაუშვებელია, როდესაც საწყისი მისამართი არ ემთხვევა საბოლოოს.')
314
+ end
315
+ end
316
+
317
+ def validate_remote
318
+ # driver
319
+ if self.transport_type_id == RS::WAYBILL_TYPE_TRANS and self.check_driver_tin
320
+ unless self.driver_tin.blank?
321
+ driver_name = RS.dict.get_name_from_tin(tin: self.driver_tin)
322
+ add_error(:driver_tin, "საიდ. ნომერი ვერ მოიძებნა: #{self.driver_tin}") if driver_name.nil?
323
+ add_error(:driver_name, "მძღოლის სახელია: #{driver_name}") if driver_name and driver_name.split.join(' ') != self.driver_name.split.join(' ')
324
+ else
325
+ add_error(:driver_tin, "მძღოლის პირადი ნომერი არაა მითითებული.")
326
+ end
327
+ end
328
+ # buyer
329
+ if self.check_buyer_tin
330
+ unless self.buyer_tin.blank?
331
+ buyer_name = RS.dict.get_name_from_tin(tin: self.buyer_tin)
332
+ add_error(:buyer_tin, "საიდ. ნომერი ვერ მოიძებნა: #{self.buyer_tin}") if buyer_name.nil?
333
+ add_error(:buyer_name, "მყიდველის სახელია: #{buyer_name}") if buyer_name and buyer_name.split.join(' ') != self.buyer_name.split.join(' ')
334
+ else
335
+ add_error(:buyer_tin, "მყიდველის პირადი ნომერი არაა მითითებული.")
336
+ end
337
+ end
338
+ end
339
+
340
+ end