vat_payer_cz 0.0.3 → 0.2.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: 807e334a32d9d296115c356a28f12aa21aec3397
4
- data.tar.gz: f5420d9d49965329a2a97941de66d19f01ac85e8
2
+ SHA256:
3
+ metadata.gz: 65a5f930698ecb26ede822b1980ed56acb8809c91d898a9d2ac40c39794a3ffb
4
+ data.tar.gz: 571a1fa6a1f507c68d51eee0b0299ebab0281f9c3f543d4c820a1b7234ed6ddb
5
5
  SHA512:
6
- metadata.gz: a9407c571506ee198838e31d539dda02d2cb5139efccb54670040021ac4764f4bacb8ba25b151c9632f1c737bae6e4aff18bb383716b3f9af1aa68f2926d2aca
7
- data.tar.gz: 7730a090a5cc510c1de40ea11eecc719ff19b4a16a80433b45e9b286b3d124060afc5ccbe7bdc32fdb6c6bcdc0ab16b25472e6b4dafad870cad6b9ec6e9dfb98
6
+ metadata.gz: 63a63c999159b785d41e3d74d8ca6b14dc8822f6fd8ab2ef5b2038dfb77480a9e38dd2dcde61de29d95c9b47094724958f3a6c1c0c18990811383de51138206a
7
+ data.tar.gz: 3c6033d7f7ba1476f4d7cae9722c3a17a2337116e36c7932c93a73c9b5fb11efbbf1b3fcab8c8d26ec8501466d5989a7c6633f7cdceb2397a79649c07fd4aebd
data/.gitignore CHANGED
@@ -7,5 +7,6 @@
7
7
  /tmp/
8
8
  /*.gem
9
9
  .docker-sync/
10
+ .idea/
10
11
  .git
11
- .DS_Store
12
+ .DS_Store
data/.rubocop.yml CHANGED
@@ -3,15 +3,12 @@
3
3
  inherit_from: .rubocop_todo.yml
4
4
 
5
5
  AllCops:
6
+ TargetRubyVersion: 2.5
6
7
  Exclude:
7
- - 'db/**/*'
8
- - 'node_modules/**/*'
9
8
  - 'bin/**/*'
10
- - 'app/views/contacts/*.json.jbuilder'
11
- - 'config/initializers/active_record_monkey_patch.rb'
12
9
  CacheRootDirectory: './tmp'
13
10
 
14
- Style/PredicateName:
11
+ Naming/PredicateName:
15
12
  Exclude:
16
13
  - 'spec/support/feature_macros.rb'
17
14
 
@@ -39,21 +36,18 @@ Style/PredicateName:
39
36
  Metrics/ModuleLength:
40
37
  Max: 205
41
38
 
42
- Metrics/LineLength:
39
+ Layout/LineLength:
43
40
  Enabled: false
44
41
 
45
42
  Style/EmptyMethod:
46
43
  Enabled: false
47
44
 
48
- Style/WordArray:
49
- Enabled: false
50
-
51
45
  # default zarovnavani vim
52
46
  # ignoruje hash pokud jej pouzivame napr. jako parametr:
53
47
  #
54
48
  # mail to: 'info@uol.cz',
55
49
  # subject: "Message: #{message.name}",
56
- Layout/AlignHash:
50
+ Layout/HashAlignment:
57
51
  EnforcedLastArgumentHashStyle: 'ignore_implicit'
58
52
 
59
53
  # TODO vim jinak zarovnava pokud je metoda volana se zavorkou nebo bez
@@ -64,5 +58,5 @@ Layout/AlignHash:
64
58
  #
65
59
  # create :job,
66
60
  # title: "Ucetni"
67
- Layout/AlignParameters:
61
+ Layout/ParameterAlignment:
68
62
  Enabled: false
data/.rubocop_todo.yml CHANGED
@@ -1,463 +1,29 @@
1
1
  # This configuration was generated by
2
2
  # `rubocop --auto-gen-config`
3
- # on 2018-01-15 09:04:51 +0100 using RuboCop version 0.49.1.
3
+ # on 2022-03-01 13:59:52 UTC using RuboCop version 1.25.1.
4
4
  # The point is for the user to remove these configuration records
5
5
  # one by one as the offenses are removed from the code base.
6
6
  # Note that changes in the inspected code, or installation of new
7
7
  # versions of RuboCop, may require this file to be generated again.
8
8
 
9
- # Offense count: 29
10
- # Cop supports --auto-correct.
11
- # Configuration parameters: Include, TreatCommentsAsGroupSeparators.
12
- # Include: **/Gemfile, **/gems.rb
13
- Bundler/OrderedGems:
14
- Exclude:
15
- - 'Gemfile'
16
-
17
- # Offense count: 3
18
- # Cop supports --auto-correct.
19
- Layout/EmptyLinesAroundExceptionHandlingKeywords:
20
- Exclude:
21
- - 'app/models/document_template.rb'
22
- - 'app/models/sales_invoice_import.rb'
23
- - 'lib/tasks/import_currencies_exchange.rake'
24
-
25
- # Offense count: 5
26
- # Cop supports --auto-correct.
27
- # Configuration parameters: AllowForAlignment, ForceEqualSignAlignment.
28
- Layout/ExtraSpacing:
29
- Exclude:
30
- - 'app/controllers/users_controller.rb'
31
- - 'app/models/contact.rb'
32
- - 'app/models/offer.rb'
33
- - 'app/models/sales_order.rb'
34
-
35
- # Offense count: 1
36
- # Cop supports --auto-correct.
37
- # Configuration parameters: IndentationWidth.
38
- Layout/IndentAssignment:
39
- Exclude:
40
- - 'app/services/cash_book_data_generator.rb'
41
-
42
- # Offense count: 6
43
- # Cop supports --auto-correct.
44
- # Configuration parameters: EnforcedStyle, SupportedStyles.
45
- # SupportedStyles: symmetrical, new_line, same_line
46
- Layout/MultilineArrayBraceLayout:
47
- Exclude:
48
- - 'app/controllers/application_controller.rb'
49
- - 'spec/fixtures/payables.rb'
50
- - 'spec/policies/sales_order_policy_spec.rb'
51
-
52
- # Offense count: 57
53
- # Cop supports --auto-correct.
54
- # Configuration parameters: EnforcedStyle, SupportedStyles.
55
- # SupportedStyles: symmetrical, new_line, same_line
56
- Layout/MultilineHashBraceLayout:
57
- Enabled: false
58
-
59
- # Offense count: 14
60
- # Cop supports --auto-correct.
61
- # Configuration parameters: EnforcedStyle, SupportedStyles.
62
- # SupportedStyles: symmetrical, new_line, same_line
63
- Layout/MultilineMethodCallBraceLayout:
64
- Exclude:
65
- - 'app/services/accounting_records_pdf_generator.rb'
66
- - 'spec/factories/uploaded_documents.rb'
67
- - 'spec/models/address_spec.rb'
68
- - 'spec/models/contact_spec.rb'
69
- - 'spec/models/invitation_spec.rb'
70
- - 'spec/services/paypal/statement_fetcher_spec.rb'
71
- - 'spec/support/shared_examples/base_send_by.rb'
72
-
73
- # Offense count: 113
74
- # Cop supports --auto-correct.
75
- # Configuration parameters: EnforcedStyle, SupportedStyles, IndentationWidth.
76
- # SupportedStyles: aligned, indented, indented_relative_to_receiver
77
- Layout/MultilineMethodCallIndentation:
78
- Enabled: false
79
-
80
- # Offense count: 11
81
- # Cop supports --auto-correct.
82
- # Configuration parameters: EnforcedStyle, SupportedStyles, IndentationWidth.
83
- # SupportedStyles: aligned, indented
84
- Layout/MultilineOperationIndentation:
85
- Exclude:
86
- - 'app/mailers/invitation_mailer.rb'
87
- - 'app/models/address.rb'
88
- - 'app/models/sales_invoice.rb'
89
- - 'app/models/sales_invoice_item.rb'
90
- - 'lib/tasks/intrastat_report.rake'
91
- - 'lib/tenant_builder.rb'
92
-
93
- # Offense count: 1
94
- # Cop supports --auto-correct.
95
- Layout/SpaceAroundKeyword:
96
- Exclude:
97
- - 'app/models/sales_order.rb'
98
-
99
- # Offense count: 1
100
- # Cop supports --auto-correct.
101
- # Configuration parameters: AllowForAlignment.
102
- Layout/SpaceAroundOperators:
103
- Exclude:
104
- - 'app/controllers/products/products_controller.rb'
105
-
106
- # Offense count: 9
107
- # Cop supports --auto-correct.
108
- # Configuration parameters: EnforcedStyle, SupportedStyles.
109
- # SupportedStyles: require_no_space, require_space
110
- Layout/SpaceInLambdaLiteral:
111
- Exclude:
112
- - 'app/models/accounting_record.rb'
113
- - 'app/models/currency_pair.rb'
114
- - 'app/models/logo.rb'
115
- - 'app/models/message.rb'
116
- - 'app/models/product.rb'
117
- - 'config/environments/production.rb'
118
-
119
- # Offense count: 18
120
- # Cop supports --auto-correct.
121
- Layout/SpaceInsidePercentLiteralDelimiters:
122
- Exclude:
123
- - 'app/models/concerns/after_document_issue_attributes.rb'
124
- - 'app/models/my_bank_account.rb'
125
- - 'app/models/my_company.rb'
126
- - 'app/models/vat_rate.rb'
127
- - 'config/initializers/assets.rb'
128
- - 'spec/models/my_bank_account_spec.rb'
129
- - 'spec/models/sales_order_spec.rb'
130
-
131
- # Offense count: 5
132
- Lint/AmbiguousBlockAssociation:
133
- Exclude:
134
- - 'spec/models/tenant_spec.rb'
135
- - 'spec/services/document_template_manager_spec.rb'
136
- - 'spec/services/paypal/balance_fetcher_spec.rb'
137
- - 'spec/services/paypal/statement_fetcher_spec.rb'
138
-
139
- # Offense count: 9
140
- Lint/IneffectiveAccessModifier:
141
- Exclude:
142
- - 'app/data_objects/interval.rb'
143
- - 'app/models/setting.rb'
144
- - 'app/models/tenant.rb'
145
- - 'app/services/public_id_guesser.rb'
146
- - 'lib/expert_fantozzi_contract.rb'
147
- - 'lib/ldap_user_finder.rb'
148
-
149
- # Offense count: 1
150
- # Cop supports --auto-correct.
151
- Lint/UnifiedInteger:
152
- Exclude:
153
- - 'spec/support/rspec_matchers/have_row.rb'
154
-
155
- # Offense count: 1
156
- # Cop supports --auto-correct.
157
- Lint/UnneededDisable:
158
- Exclude:
159
- - 'app/queries/query/budget_by_days.rb'
160
-
161
- # Offense count: 1
162
- # Cop supports --auto-correct.
163
- Lint/UnneededSplatExpansion:
164
- Exclude:
165
- - 'app/api/v1/sales_orders.rb'
166
-
167
- # Offense count: 272
168
- Metrics/AbcSize:
169
- Max: 169
170
-
171
- # Offense count: 607
172
- # Configuration parameters: CountComments, ExcludedMethods.
173
- Metrics/BlockLength:
174
- Max: 1260
175
-
176
- # Offense count: 42
177
- # Configuration parameters: CountComments.
178
- Metrics/ClassLength:
179
- Max: 302
180
-
181
- # Offense count: 56
182
- Metrics/CyclomaticComplexity:
183
- Max: 17
184
-
185
- # Offense count: 219
186
- # Configuration parameters: CountComments.
187
- Metrics/MethodLength:
188
- Max: 125
189
-
190
- # Offense count: 6
191
- # Configuration parameters: CountKeywordArgs.
192
- Metrics/ParameterLists:
193
- Max: 7
194
-
195
- # Offense count: 37
196
- Metrics/PerceivedComplexity:
197
- Max: 17
198
-
199
- # Offense count: 1
200
- # Cop supports --auto-correct.
201
- Performance/Casecmp:
202
- Exclude:
203
- - 'app/models/product.rb'
204
-
205
- # Offense count: 5
206
- # Cop supports --auto-correct.
207
- Performance/RangeInclude:
208
- Exclude:
209
- - 'app/models/accounting_period.rb'
210
- - 'app/validators/vatin_validator.rb'
211
- - 'lib/tasks/intrastat_report.rake'
212
-
213
- # Offense count: 1
214
- # Cop supports --auto-correct.
215
- Performance/RedundantBlockCall:
216
- Exclude:
217
- - 'spec/support/database_helper.rb'
218
-
219
- # Offense count: 8
220
- # Cop supports --auto-correct.
221
- # Configuration parameters: MaxKeyValuePairs.
222
- Performance/RedundantMerge:
223
- Exclude:
224
- - 'app/api/v1/demands_for_payment.rb'
225
- - 'app/api/v1/my_bank_accounts.rb'
226
- - 'app/api/v1/pagination_helpers.rb'
227
- - 'app/services/frontend_modifier_symbolizer.rb'
228
- - 'app/services/modifier_symbolizer.rb'
229
- - 'spec/api/v1/contacts_spec.rb'
230
-
231
- # Offense count: 3
232
- # Cop supports --auto-correct.
233
- Security/YAMLLoad:
234
- Exclude:
235
- - 'config/application.rb'
236
- - 'lib/ldap_user_finder.rb'
237
- - 'lib/tasks/migrate.rake'
238
-
239
- # Offense count: 6
240
- # Cop supports --auto-correct.
241
- # Configuration parameters: EnforcedStyle, SupportedStyles.
242
- # SupportedStyles: prefer_alias, prefer_alias_method
243
- Style/Alias:
244
- Exclude:
245
- - 'app/models/search/sales_order.rb'
246
- - 'app/models/user_permission.rb'
247
- - 'app/models/user_permissions_collection.rb'
248
- - 'app/services/subject_to_vat_specification.rb'
249
-
250
- # Offense count: 10
251
- Style/AsciiComments:
252
- Exclude:
253
- - 'app/controllers/application_controller.rb'
254
- - 'app/models/currency.rb'
255
- - 'app/workers/cost_revenue_worker_base.rb'
256
- - 'spec/factories/reports.rb'
257
- - 'spec/models/my_bank_account_spec.rb'
258
- - 'spec/models/vat_rate_spec.rb'
259
-
260
- # Offense count: 6
261
- # Cop supports --auto-correct.
262
- # Configuration parameters: EnforcedStyle, SupportedStyles, SingleLineConditionsOnly, IncludeTernaryExpressions.
263
- # SupportedStyles: assign_to_condition, assign_inside_condition
264
- Style/ConditionalAssignment:
265
- Exclude:
266
- - 'app/helpers/invoice_helper.rb'
267
- - 'app/models/address.rb'
268
- - 'app/models/product.rb'
269
- - 'app/services/cash_book_data_generator.rb'
270
- - 'app/validators/bank_account_or_iban_validator.rb'
271
- - 'app/validators/sales_invoice_validator.rb'
272
-
273
- # Offense count: 4
274
- # Cop supports --auto-correct.
275
- Style/EmptyCaseCondition:
276
- Exclude:
277
- - 'app/decorators/concerns/document_addresses.rb'
278
- - 'app/services/subject_to_vat_specification.rb'
279
- - 'app/validators/linked_doc_validator.rb'
280
-
281
- # Offense count: 1294
282
- # Cop supports --auto-correct.
283
- # Configuration parameters: EnforcedStyle, SupportedStyles.
284
- # SupportedStyles: when_needed, always, never
285
- Style/FrozenStringLiteralComment:
286
- Enabled: false
287
-
288
- # Offense count: 2
289
- Style/IdenticalConditionalBranches:
290
- Exclude:
291
- - 'lib/tasks/export_accounting_records_to_pdf.rake'
292
-
293
- # Offense count: 10
294
- Style/IfInsideElse:
295
- Exclude:
296
- - 'app/controllers/logos_controller.rb'
297
- - 'app/models/currency_pair.rb'
298
- - 'app/models/default_attrs/purchase_invoice.rb'
299
- - 'app/models/purchase_invoice_item.rb'
300
- - 'app/queries/query/receivables_core.rb'
301
- - 'app/services/currency_exchange.rb'
302
- - 'app/services/subject_to_vat_specification.rb'
303
- - 'app/validators/vatin_validator.rb'
304
-
305
- # Offense count: 1
306
- # Cop supports --auto-correct.
307
- # Configuration parameters: MaxLineLength.
308
- Style/IfUnlessModifier:
309
- Exclude:
310
- - 'app/validators/vatin_validator.rb'
311
-
312
- # Offense count: 2
313
- # Cop supports --auto-correct.
314
- # Configuration parameters: InverseMethods, InverseBlocks.
315
- Style/InverseMethods:
316
- Exclude:
317
- - 'app/models/sales_invoice.rb'
318
- - 'app/validators/bank_symbol_validator.rb'
319
-
320
- # Offense count: 2
321
- Style/MultilineBlockChain:
322
- Exclude:
323
- - 'app/controllers/contracts/most_used_controller.rb'
324
-
325
- # Offense count: 1
326
- # Cop supports --auto-correct.
327
- Style/MultilineIfModifier:
328
- Exclude:
329
- - 'app/services/currency_exchange.rb'
330
-
331
9
  # Offense count: 2
332
- Style/MultipleComparison:
10
+ Lint/MissingSuper:
333
11
  Exclude:
334
- - 'app/helpers/report_helper.rb'
335
- - 'lib/core_ext/date.rb'
336
-
337
- # Offense count: 134
338
- # Cop supports --auto-correct.
339
- Style/MutableConstant:
340
- Enabled: false
12
+ - 'lib/vat_info/request/unreliable_payer.rb'
13
+ - 'lib/vat_info/request/unreliable_payer_extended.rb'
341
14
 
342
15
  # Offense count: 4
343
- # Cop supports --auto-correct.
344
- Style/NestedParenthesizedCalls:
345
- Exclude:
346
- - 'app/controllers/contacts_controller.rb'
347
- - 'app/decorators/concerns/document_addresses.rb'
348
- - 'app/models/purchase_order.rb'
349
- - 'app/services/logo_upload.rb'
350
-
351
- # Offense count: 1
352
- # Cop supports --auto-correct.
353
- # Configuration parameters: EnforcedOctalStyle, SupportedOctalStyles.
354
- # SupportedOctalStyles: zero_with_o, zero_only
355
- Style/NumericLiteralPrefix:
356
- Exclude:
357
- - 'spec/factories/bank_payments.rb'
358
-
359
- # Offense count: 14
360
- # Cop supports --auto-correct.
361
- # Configuration parameters: Strict.
362
- Style/NumericLiterals:
363
- MinDigits: 11
364
-
365
- # Offense count: 35
366
- # Cop supports --auto-correct.
367
- # Configuration parameters: AutoCorrect, EnforcedStyle, SupportedStyles.
368
- # SupportedStyles: predicate, comparison
369
- Style/NumericPredicate:
370
- Enabled: false
371
-
372
- # Offense count: 1
373
- # Cop supports --auto-correct.
374
- # Configuration parameters: AllowSafeAssignment.
375
- Style/ParenthesesAroundCondition:
376
- Exclude:
377
- - 'app/models/default_attrs/purchase_invoice.rb'
378
-
379
- # Offense count: 101
380
- # Cop supports --auto-correct.
381
- # Configuration parameters: PreferredDelimiters.
382
- Style/PercentLiteralDelimiters:
383
- Enabled: false
384
-
385
- # Offense count: 10
386
- # Cop supports --auto-correct.
387
- Style/RedundantParentheses:
388
- Exclude:
389
- - 'app/controllers/application_controller.rb'
390
- - 'app/models/cash_book_report.rb'
391
- - 'app/models/concerns/cost_revenue_report_base.rb'
392
- - 'app/models/contract_report.rb'
393
- - 'app/models/costs_by_contacts_report.rb'
394
- - 'app/models/purchase_invoice_item.rb'
395
- - 'app/queries/query/receivables_core.rb'
396
- - 'spec/models/external_notification_spec.rb'
397
-
398
- # Offense count: 3
399
- # Cop supports --auto-correct.
400
- # Configuration parameters: AllowMultipleReturnValues.
401
- Style/RedundantReturn:
402
- Exclude:
403
- - 'app/data_objects/interval.rb'
404
-
405
- # Offense count: 44
406
- # Cop supports --auto-correct.
407
- # Configuration parameters: ConvertCodeThatCanStartToReturnNil.
408
- Style/SafeNavigation:
409
- Enabled: false
410
-
411
- # Offense count: 55
412
- # Cop supports --auto-correct.
413
- # Configuration parameters: EnforcedStyle, SupportedStyles.
414
- # SupportedStyles: only_raise, only_fail, semantic
415
- Style/SignalException:
416
- Enabled: false
16
+ # Configuration parameters: IgnoredMethods, CountRepeatedAttributes.
17
+ Metrics/AbcSize:
18
+ Max: 21
417
19
 
418
20
  # Offense count: 1
419
- # Cop supports --auto-correct.
420
- # Configuration parameters: EnforcedStyle, SupportedStyles, ConsistentQuotesInMultiline.
421
- # SupportedStyles: single_quotes, double_quotes
422
- Style/StringLiterals:
423
- Exclude:
424
- - 'spec/models/invitation_spec.rb'
425
-
426
- # Offense count: 160
427
- # Cop supports --auto-correct.
428
- # Configuration parameters: EnforcedStyle, MinSize, SupportedStyles.
429
- # SupportedStyles: percent, brackets
430
- Style/SymbolArray:
431
- Enabled: false
21
+ # Configuration parameters: CountComments, CountAsOne, ExcludedMethods, IgnoredMethods.
22
+ # IgnoredMethods: refine
23
+ Metrics/BlockLength:
24
+ Max: 40
432
25
 
433
26
  # Offense count: 5
434
- # Cop supports --auto-correct.
435
- Style/UnneededInterpolation:
436
- Exclude:
437
- - 'app/helpers/select_helper.rb'
438
- - 'app/mailers/notification_mailer.rb'
439
- - 'app/models/user.rb'
440
- - 'app/services/frontend_params_normalizer.rb'
441
- - 'spec/features/sales/orders/order_spec.rb'
442
-
443
- # Offense count: 43
444
- # Configuration parameters: EnforcedStyle, SupportedStyles.
445
- # SupportedStyles: snake_case, normalcase, non_integer
446
- Style/VariableNumber:
447
- Exclude:
448
- - 'spec/api/v1/sales_orders_spec.rb'
449
- - 'spec/features/purchase/invoices_spec.rb'
450
- - 'spec/features/purchase/petty_cash_disburstment_spec.rb'
451
- - 'spec/features/sales/orders/order_spec.rb'
452
- - 'spec/features/sales/petty_cash_income_spec.rb'
453
- - 'spec/queries/query/cash_book_spec.rb'
454
- - 'spec/queries/query/contracts_costs_report_spec.rb'
455
- - 'spec/queries/query/contracts_revenues_report_spec.rb'
456
- - 'spec/services/cash_book_data_generator_spec.rb'
457
- - 'spec/services/generate_order_from_confirmed_payments_service_spec.rb'
458
-
459
- # Offense count: 1
460
- # Cop supports --auto-correct.
461
- Style/YodaCondition:
462
- Exclude:
463
- - 'app/services/subject_to_vat_specification.rb'
27
+ # Configuration parameters: CountComments, CountAsOne, ExcludedMethods, IgnoredMethods.
28
+ Metrics/MethodLength:
29
+ Max: 20
data/.ruby-version ADDED
@@ -0,0 +1 @@
1
+ 2.7.5
data/.travis.yml ADDED
@@ -0,0 +1,30 @@
1
+ language: ruby
2
+ rvm:
3
+ - 2.5.3
4
+ - 2.6.0
5
+ - 2.7.5
6
+
7
+ stages:
8
+ - code-quality
9
+ - test
10
+
11
+ jobs:
12
+ include:
13
+ - rvm: 2.5.3
14
+ stage: code-quality
15
+ script: bundle exec rubocop
16
+ - rvm: 2.5.3
17
+ stage: test
18
+ script: bundle exec rspec
19
+ - rvm: 2.6.0
20
+ stage: code-quality
21
+ script: bundle exec rubocop
22
+ - rvm: 2.6.0
23
+ stage: test
24
+ script: bundle exec rspec
25
+ - rvm: 2.7.5
26
+ stage: code-quality
27
+ script: bundle exec rubocop
28
+ - rvm: 2.7.5
29
+ stage: test
30
+ script: bundle exec rspec
data/Gemfile CHANGED
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  source 'https://rubygems.org'
2
4
 
3
5
  # Specify your gem's dependencies in vat_info.gemspec
data/README.md CHANGED
@@ -8,9 +8,7 @@ This is Ruby wrapper for [web service for "searching information about reliabili
8
8
  The web service has the following three end-points:
9
9
  - [standard VAT payer info](#standard)
10
10
  - [extended VAT payer info](#extended)
11
- - list of unreliable VAT payers (not implemented)
12
-
13
- This gem currently implements **standard VAT payer info** and **extended VAT payer info**.
11
+ - [list of unreliable VAT payers](#list)
14
12
 
15
13
  ## <a name="standard">Standard VAT payer info</a>
16
14
  ```ruby
@@ -28,6 +26,15 @@ require 'vat_info'
28
26
  vat_ids = %w(CZ27169278 CZ26168685)
29
27
  VatInfo.unreliable_payer_extended(*vat_ids)
30
28
  ```
29
+ ## <a name="list">List VAT payers</a>
30
+ Lists all unreliable VAT payers, but only their status as payer (reliable/unreliable),
31
+ their VAT number, financial office they belong to and date on which they became
32
+ unreliable
33
+ ```ruby
34
+ require 'vat_info'
35
+
36
+ VatInfo.unreliable_payer_list
37
+ ```
31
38
 
32
39
  ## Response
33
40
  Object `VatInfo::Response`
data/Rakefile CHANGED
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'bundler/gem_tasks'
2
4
  require 'rspec/core/rake_task'
3
5
 
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module VatInfo
2
4
  module Models
3
5
  class Status
@@ -11,8 +13,8 @@ module VatInfo
11
13
 
12
14
  def create_status
13
15
  {
14
- status_code: params.fetch(:@status_code),
15
- status_text: params.fetch(:@status_text),
16
+ status_code: params.fetch(:@status_code),
17
+ status_text: params.fetch(:@status_text),
16
18
  odpoved_generovana: params.fetch(:@odpoved_generovana)
17
19
  }
18
20
  rescue KeyError => e
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module VatInfo
2
4
  module Models
3
5
  class VatPayer
@@ -29,19 +31,19 @@ module VatInfo
29
31
 
30
32
  def standard_account(data)
31
33
  {
32
- predcisli: data[:@predcisli],
33
- cislo: data[:@cislo],
34
- kod_banky: data[:@kod_banky],
35
- iban: nil
34
+ predcisli: data[:@predcisli],
35
+ cislo: data[:@cislo],
36
+ kod_banky: data[:@kod_banky],
37
+ iban: nil
36
38
  }
37
39
  end
38
40
 
39
41
  def non_standard_account(data)
40
42
  {
41
- predcisli: nil,
42
- cislo: nil,
43
- kod_banky: nil,
44
- iban: data[:@cislo]
43
+ predcisli: nil,
44
+ cislo: nil,
45
+ kod_banky: nil,
46
+ iban: data[:@cislo]
45
47
  }
46
48
  end
47
49
  end
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module VatInfo
2
4
  module Models
3
5
  class VatPayerExtended < VatPayer
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module VatInfo
2
4
  module Models
3
5
  class VatPayers
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'vat_info/models/status'
2
4
  require 'vat_info/models/vat_payers'
3
5
  require 'vat_info/models/vat_payer'
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'savon'
2
4
 
3
5
  module VatInfo
@@ -5,8 +7,10 @@ module VatInfo
5
7
 
6
8
  class Query
7
9
  DOCS = 'https://adisspr.mfcr.cz/adistc/adis/idpr_pub/dpr_info/ws_spdph.faces'
8
- WSDL = 'http://adisrws.mfcr.cz/adistc/axis2/services/rozhraniCRPDPH.rozhraniCRPDPHSOAP?wsdl'.freeze
9
- TIMEOUT = 2
10
+ WSDL = 'https://adisrws.mfcr.cz/adistc/axis2/services/rozhraniCRPDPH.rozhraniCRPDPHSOAP?wsdl'
11
+ TIMEOUT = 2
12
+ SERVICE_UNAVAILABLE = 503
13
+ REQUEST_TIME_OUT = 408
10
14
 
11
15
  def self.call(request, endpoint, wsdl = WSDL, timeout = TIMEOUT)
12
16
  client = Savon.client(wsdl: wsdl, open_timeout: timeout)
@@ -16,10 +20,16 @@ module VatInfo
16
20
  if response.success?
17
21
  VatInfo::Response.new(status_code: 200, raw: response.body)
18
22
  else
19
- VatInfo::Response.new(status_code: 503)
23
+ VatInfo::Response.new(status_code: SERVICE_UNAVAILABLE)
24
+ end
25
+ rescue Savon::HTTPError => e
26
+ if e.to_s.include?('sorry-page.html')
27
+ VatInfo::Response.new(status_code: SERVICE_UNAVAILABLE)
28
+ else
29
+ raise e
20
30
  end
21
31
  rescue Net::OpenTimeout
22
- VatInfo::Response.new(status_code: 408)
32
+ VatInfo::Response.new(status_code: REQUEST_TIME_OUT)
23
33
  rescue Savon::SOAPFault => e
24
34
  raise SchemaError, 'The SOAP schema of VAT service may have changed. Go to '\
25
35
  "#{DOCS} to verify. Original error: #{e}"
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module VatInfo
2
4
  class Request
3
5
  class UnreliablePayer < VatInfo::Request
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module VatInfo
2
4
  class Request
3
5
  class UnreliablePayerExtended < VatInfo::Request
@@ -0,0 +1,13 @@
1
+ # frozen_string_literal: true
2
+
3
+ module VatInfo
4
+ class Request
5
+ class UnreliablePayerList < VatInfo::Request
6
+ def body
7
+ Nokogiri::XML::Builder.new('encoding' => 'UTF-8') do |xml|
8
+ xml.SeznamNespolehlivyPlatceRequest(xmlns: 'http://adis.mfcr.cz/rozhraniCRPDPH/')
9
+ end.doc
10
+ end
11
+ end
12
+ end
13
+ end
@@ -1,10 +1,13 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'nokogiri'
2
4
  require 'vat_info/request/unreliable_payer'
3
5
  require 'vat_info/request/unreliable_payer_extended'
6
+ require 'vat_info/request/unreliable_payer_list'
4
7
 
5
8
  module VatInfo
6
9
  class Request
7
- SOAP_ENV_SCHEMA = 'http://schemas.xmlsoap.org/soap/envelope/'.freeze
10
+ SOAP_ENV_SCHEMA = 'http://schemas.xmlsoap.org/soap/envelope/'
8
11
 
9
12
  def envelope
10
13
  Nokogiri::XML::Builder.new('encoding' => 'UTF-8') do |xml|
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module VatInfo
2
4
  class Response
3
5
  attr_accessor :status_code, :body, :raw
@@ -1,9 +1,11 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module VatInfo
2
4
  module Utils
3
5
  COMPANY_TYPES = ['a.s.', 's.r.o.', 'v.o.s.', 'k.s.', 'z.s.'].freeze
4
6
  SPECIAL_CHARS = [
5
- %w(Á á), %w(Č č), %w(Ď ď), %w(É é), %w(Ě ě), %w(Í í), %w(Ň ń), %w(Ó ó),
6
- %w(Ř ř), %w(Š š), %w(Ť ť), %w(Ú ú), %w(Ů ů), %w(Ž ž), %w(Ý ý)
7
+ %w[Á á], %w[Č č], %w[Ď ď], %w[É é], %w[Ě ě], %w[Í í], %w[Ň ń], %w[Ó ó],
8
+ %w[Ř ř], %w[Š š], %w[Ť ť], %w[Ú ú], %w[Ů ů], %w[Ž ž], %w[Ý ý]
7
9
  ].freeze
8
10
 
9
11
  def self.wrap_in_array(content)
@@ -12,6 +14,7 @@ module VatInfo
12
14
 
13
15
  def self.normalize(string)
14
16
  return unless string
17
+
15
18
  replace_exceptions(string).strip.split(' ').map do |word|
16
19
  format_this word
17
20
  end.join(' ')
@@ -32,6 +35,7 @@ module VatInfo
32
35
  def self.format_this(string)
33
36
  return string.downcase if string.size == 1
34
37
  return string.downcase if COMPANY_TYPES.include? string.downcase
38
+
35
39
  replace_special_chars(string.capitalize)
36
40
  end
37
41
  end
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module VatInfo
2
- VERSION = '0.0.3'
4
+ VERSION = '0.2.0'
3
5
  end
data/lib/vat_info.rb CHANGED
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'vat_info/version'
2
4
  require 'vat_info/utils'
3
5
  require 'vat_info/request'
@@ -43,7 +45,18 @@ module VatInfo
43
45
  end
44
46
 
45
47
  def self.unreliable_payer_list
46
- # :get_seznam_nespolehlivy_platce
47
- raise NotImplementedError
48
+ request = VatInfo::Request::UnreliablePayerList.new.to_xml
49
+ response = VatInfo::Query.call(request, :get_seznam_nespolehlivy_platce)
50
+
51
+ if response.ok?
52
+ status_raw = response.raw[:seznam_nespolehlivy_platce_response][:status]
53
+ status = VatInfo::Models::Status.new(status_raw).data
54
+
55
+ payers_raw = VatInfo::Utils.wrap_in_array(response.raw[:seznam_nespolehlivy_platce_response][:status_platce_dph])
56
+ payers = VatInfo::Models::VatPayers.new(VatInfo::Models::VatPayerExtended, payers_raw).data
57
+
58
+ response.body = status.merge(payers)
59
+ end
60
+ response
48
61
  end
49
62
  end
data/vat_info.gemspec CHANGED
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  lib = File.expand_path('lib', __dir__)
2
4
  $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
3
5
  require 'vat_info/version'
@@ -20,13 +22,15 @@ Gem::Specification.new do |spec|
20
22
  spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
21
23
  spec.require_paths = ['lib']
22
24
 
25
+ spec.required_ruby_version = '>= 2.5'
26
+
23
27
  spec.add_dependency 'savon', '~> 2.12'
24
28
 
25
- spec.add_development_dependency 'bundler', '~> 1.13'
29
+ spec.add_development_dependency 'bundler', '~> 2.0'
26
30
  spec.add_development_dependency 'pry', '~> 0.11'
27
- spec.add_development_dependency 'rake', '~> 10.0'
31
+ spec.add_development_dependency 'rake', '~> 13.0'
28
32
  spec.add_development_dependency 'rspec', '~> 3.0'
29
33
  spec.add_development_dependency 'rubocop'
30
- spec.add_development_dependency 'vcr', '~> 4.0'
31
- spec.add_development_dependency 'webmock', '~> 3.3'
34
+ spec.add_development_dependency 'vcr'
35
+ spec.add_development_dependency 'webmock'
32
36
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: vat_payer_cz
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.3
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tomas Landovsky
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-03-27 00:00:00.000000000 Z
11
+ date: 2022-03-01 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: savon
@@ -30,14 +30,14 @@ dependencies:
30
30
  requirements:
31
31
  - - "~>"
32
32
  - !ruby/object:Gem::Version
33
- version: '1.13'
33
+ version: '2.0'
34
34
  type: :development
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
38
  - - "~>"
39
39
  - !ruby/object:Gem::Version
40
- version: '1.13'
40
+ version: '2.0'
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: pry
43
43
  requirement: !ruby/object:Gem::Requirement
@@ -58,14 +58,14 @@ dependencies:
58
58
  requirements:
59
59
  - - "~>"
60
60
  - !ruby/object:Gem::Version
61
- version: '10.0'
61
+ version: '13.0'
62
62
  type: :development
63
63
  prerelease: false
64
64
  version_requirements: !ruby/object:Gem::Requirement
65
65
  requirements:
66
66
  - - "~>"
67
67
  - !ruby/object:Gem::Version
68
- version: '10.0'
68
+ version: '13.0'
69
69
  - !ruby/object:Gem::Dependency
70
70
  name: rspec
71
71
  requirement: !ruby/object:Gem::Requirement
@@ -98,30 +98,30 @@ dependencies:
98
98
  name: vcr
99
99
  requirement: !ruby/object:Gem::Requirement
100
100
  requirements:
101
- - - "~>"
101
+ - - ">="
102
102
  - !ruby/object:Gem::Version
103
- version: '4.0'
103
+ version: '0'
104
104
  type: :development
105
105
  prerelease: false
106
106
  version_requirements: !ruby/object:Gem::Requirement
107
107
  requirements:
108
- - - "~>"
108
+ - - ">="
109
109
  - !ruby/object:Gem::Version
110
- version: '4.0'
110
+ version: '0'
111
111
  - !ruby/object:Gem::Dependency
112
112
  name: webmock
113
113
  requirement: !ruby/object:Gem::Requirement
114
114
  requirements:
115
- - - "~>"
115
+ - - ">="
116
116
  - !ruby/object:Gem::Version
117
- version: '3.3'
117
+ version: '0'
118
118
  type: :development
119
119
  prerelease: false
120
120
  version_requirements: !ruby/object:Gem::Requirement
121
121
  requirements:
122
- - - "~>"
122
+ - - ">="
123
123
  - !ruby/object:Gem::Version
124
- version: '3.3'
124
+ version: '0'
125
125
  description: Using mfcr.cz SOAP API to get information about Czech VAT payers.
126
126
  email:
127
127
  - landovsky@gmail.com
@@ -135,6 +135,8 @@ files:
135
135
  - ".rspec"
136
136
  - ".rubocop.yml"
137
137
  - ".rubocop_todo.yml"
138
+ - ".ruby-version"
139
+ - ".travis.yml"
138
140
  - Dockerfile
139
141
  - Gemfile
140
142
  - LICENSE
@@ -155,6 +157,7 @@ files:
155
157
  - lib/vat_info/request.rb
156
158
  - lib/vat_info/request/unreliable_payer.rb
157
159
  - lib/vat_info/request/unreliable_payer_extended.rb
160
+ - lib/vat_info/request/unreliable_payer_list.rb
158
161
  - lib/vat_info/response.rb
159
162
  - lib/vat_info/utils.rb
160
163
  - lib/vat_info/version.rb
@@ -163,7 +166,7 @@ homepage: https://github.com/ucetnictvi-on-line/vat_payer_cz
163
166
  licenses:
164
167
  - MIT
165
168
  metadata: {}
166
- post_install_message:
169
+ post_install_message:
167
170
  rdoc_options: []
168
171
  require_paths:
169
172
  - lib
@@ -171,16 +174,15 @@ required_ruby_version: !ruby/object:Gem::Requirement
171
174
  requirements:
172
175
  - - ">="
173
176
  - !ruby/object:Gem::Version
174
- version: '0'
177
+ version: '2.5'
175
178
  required_rubygems_version: !ruby/object:Gem::Requirement
176
179
  requirements:
177
180
  - - ">="
178
181
  - !ruby/object:Gem::Version
179
182
  version: '0'
180
183
  requirements: []
181
- rubyforge_project:
182
- rubygems_version: 2.6.8
183
- signing_key:
184
+ rubygems_version: 3.1.6
185
+ signing_key:
184
186
  specification_version: 4
185
187
  summary: Ruby wrapper for web service providing info about Czech VAT payers.
186
188
  test_files: []