orangedata 0.0.3 → 0.0.4
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 +4 -4
- data/Gemfile.lock +1 -1
- data/lib/orange_data/receipt.rb +40 -5
- data/lib/orange_data/schema_definitions.yml +63 -6
- data/lib/orange_data/transport.rb +1 -1
- data/lib/orange_data/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 98ed7a5c255afffc47d6bf269ff2b437d93b3a1e
|
4
|
+
data.tar.gz: 81e4bc91eb71b7e0bd3fbe2aac56a7c34288b5c1
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: de702c4f2271f2a53e9cc19a52393ac6ee902f4f606ffdb807bc85f4890ddb8ea0befa14fb2a3ee19fda41963f78c0f16de8b642bd944c1f4f1be84f144b5c49
|
7
|
+
data.tar.gz: 787824699a16f84ae7e3398db3283b2a5a5c1a0ec91d59421d83b33225400def49e7ee589c549b4869cedc5d07dfd08a804c6441b7686e300546fe45095728cf
|
data/Gemfile.lock
CHANGED
data/lib/orange_data/receipt.rb
CHANGED
@@ -120,6 +120,11 @@ module OrangeData
|
|
120
120
|
else
|
121
121
|
|
122
122
|
end
|
123
|
+
|
124
|
+
if info["x-alias"]
|
125
|
+
# alias_method "#{info["x-alias"]}", property.underscore
|
126
|
+
alias_method "#{info["x-alias"]}=", "#{property.underscore}="
|
127
|
+
end
|
123
128
|
end
|
124
129
|
end
|
125
130
|
end
|
@@ -283,11 +288,6 @@ module OrangeData
|
|
283
288
|
|
284
289
|
end
|
285
290
|
|
286
|
-
|
287
|
-
class Correction < Document
|
288
|
-
# TODO: same as Receipt, but based on correctionType
|
289
|
-
end
|
290
|
-
|
291
291
|
class ReceiptResult < PayloadContent
|
292
292
|
def initialize payload
|
293
293
|
@payload = payload
|
@@ -322,4 +322,39 @@ module OrangeData
|
|
322
322
|
end
|
323
323
|
end
|
324
324
|
|
325
|
+
# Correction
|
326
|
+
|
327
|
+
class Correction < Document
|
328
|
+
def initialize(id:SecureRandom.uuid, inn:, group:nil, key_name:nil, content:nil)
|
329
|
+
@content = CorrectionContent.new(content || {})
|
330
|
+
super
|
331
|
+
end
|
332
|
+
PAYLOAD_SCHEMA["definitions"]["CorrectionContent"]["properties"]["type"]["x-enum"].each_pair do |slug, info|
|
333
|
+
define_singleton_method(slug) do |**args, &block|
|
334
|
+
new(**args, &block).tap{|doc|
|
335
|
+
doc.content.type = slug
|
336
|
+
}
|
337
|
+
end
|
338
|
+
end
|
339
|
+
end
|
340
|
+
|
341
|
+
class CorrectionContent < PayloadContent
|
342
|
+
GeneratedAttributes.from_schema(self, PAYLOAD_SCHEMA["definitions"]["CorrectionContent"])
|
343
|
+
end
|
344
|
+
|
345
|
+
class CorrectionResult < PayloadContent
|
346
|
+
def initialize payload
|
347
|
+
@payload = payload || {}
|
348
|
+
@content = CorrectionContent.new(@payload["content"] || {})
|
349
|
+
end
|
350
|
+
|
351
|
+
def self.from_hash(hash)
|
352
|
+
raise ArgumentError, 'Expect hash here' unless hash.is_a?(Hash)
|
353
|
+
new(hash)
|
354
|
+
end
|
355
|
+
|
356
|
+
attr_reader :content
|
357
|
+
GeneratedAttributes.from_schema(self, PAYLOAD_SCHEMA["definitions"]["CheckStatusViewModel[CheckContent]"])
|
358
|
+
end
|
359
|
+
|
325
360
|
end
|
@@ -319,10 +319,14 @@ definitions:
|
|
319
319
|
other:
|
320
320
|
val: 13
|
321
321
|
description: Иной предмет расчета
|
322
|
-
|
323
322
|
nomenclatureCode:
|
324
323
|
description: Код товарной номенклатуры
|
325
|
-
x-comment:
|
324
|
+
x-comment: |-
|
325
|
+
base64 строка
|
326
|
+
Данные в массиве представлены в виде строки, в которой:
|
327
|
+
первые 4 байта –код справочника;
|
328
|
+
последующие 8 байт – код группы товаров;
|
329
|
+
последние 20 байт – код идентификации товара
|
326
330
|
x-tag-id: 1162
|
327
331
|
type: string
|
328
332
|
nullable: true
|
@@ -392,6 +396,7 @@ definitions:
|
|
392
396
|
description: Акциз
|
393
397
|
x-tag-id: 1229
|
394
398
|
type: number
|
399
|
+
|
395
400
|
CheckClose:
|
396
401
|
type: object
|
397
402
|
properties:
|
@@ -493,6 +498,8 @@ definitions:
|
|
493
498
|
description: ИНН оператора перевода
|
494
499
|
x-tag-id: 1016
|
495
500
|
type: string
|
501
|
+
|
502
|
+
|
496
503
|
CheckPayment:
|
497
504
|
type: object
|
498
505
|
properties:
|
@@ -536,7 +543,6 @@ definitions:
|
|
536
543
|
type: string
|
537
544
|
|
538
545
|
|
539
|
-
|
540
546
|
CheckDocumentCreate[CorrectionContent]:
|
541
547
|
type: object
|
542
548
|
x-todo: DRY CheckDocumentCreate[CheckContent] is exactly the same, but has different content field
|
@@ -552,6 +558,7 @@ definitions:
|
|
552
558
|
content:
|
553
559
|
"$ref": "#/definitions/CorrectionContent"
|
554
560
|
|
561
|
+
|
555
562
|
CorrectionContent:
|
556
563
|
type: object
|
557
564
|
properties:
|
@@ -577,7 +584,6 @@ definitions:
|
|
577
584
|
expense:
|
578
585
|
val: 3
|
579
586
|
description: Расход
|
580
|
-
|
581
587
|
description:
|
582
588
|
description: Описание коррекции
|
583
589
|
x-tag-id: 1177
|
@@ -615,6 +621,7 @@ definitions:
|
|
615
621
|
x-tag-id: 1031
|
616
622
|
type: number
|
617
623
|
eCashSum:
|
624
|
+
x-todo: унифицировать с названиями в CheckPayment.type.x-enum
|
618
625
|
format: double
|
619
626
|
description: Сумма по чеку (БСО) электронными
|
620
627
|
x-tag-id: 1081
|
@@ -637,32 +644,39 @@ definitions:
|
|
637
644
|
tax1Sum:
|
638
645
|
format: double
|
639
646
|
description: Сумма НДС чека по ставке 18%
|
647
|
+
x-comment: осторожно, номера в названии поля не соответствуют значениям в CheckPosition.tax
|
640
648
|
x-tag-id: 1102
|
649
|
+
x-alias: vat_18
|
641
650
|
type: number
|
642
651
|
tax2Sum:
|
643
652
|
format: double
|
644
653
|
description: Сумма НДС чека по ставке 10%
|
645
654
|
x-tag-id: 1103
|
655
|
+
x-alias: vat_10
|
646
656
|
type: number
|
647
657
|
tax3Sum:
|
648
658
|
format: double
|
649
659
|
description: Сумма расчета по чеку с НДС по ставке 0%
|
650
660
|
x-tag-id: 1104
|
661
|
+
x-alias: vat_0
|
651
662
|
type: number
|
652
663
|
tax4Sum:
|
653
664
|
format: double
|
654
665
|
description: Сумма расчета по чеку без НДС
|
655
666
|
x-tag-id: 1105
|
667
|
+
x-alias: vat_not_charged
|
656
668
|
type: number
|
657
669
|
tax5Sum:
|
658
670
|
format: double
|
659
671
|
description: Сумма НДС чека по расч. ставке 18/118
|
660
672
|
x-tag-id: 1106
|
673
|
+
x-alias: vat_18_118
|
661
674
|
type: number
|
662
675
|
tax6Sum:
|
663
676
|
format: double
|
664
677
|
description: Сумма НДС чека по расч. ставке 10/110
|
665
678
|
x-tag-id: 1107
|
679
|
+
x-alias: vat_10_110
|
666
680
|
type: number
|
667
681
|
taxationSystem:
|
668
682
|
type: integer
|
@@ -689,88 +703,131 @@ definitions:
|
|
689
703
|
val: 5
|
690
704
|
description: Патентная система налогообложения, Патент
|
691
705
|
|
706
|
+
|
692
707
|
CheckStatusViewModel[CheckContent]:
|
693
708
|
type: object
|
694
709
|
properties:
|
695
710
|
id:
|
711
|
+
description: Идентификатор документа
|
696
712
|
type: string
|
697
713
|
deviceSN:
|
714
|
+
description: Заводской номер устройства пробившего чек
|
698
715
|
type: string
|
699
716
|
deviceRN:
|
717
|
+
description: Регистрационный номер устройства пробившего чек
|
700
718
|
type: string
|
701
719
|
fsNumber:
|
720
|
+
description: Номер фискального накопителя
|
702
721
|
type: string
|
703
722
|
ofdName:
|
723
|
+
description: Наименование ОФД
|
704
724
|
type: string
|
705
725
|
ofdWebsite:
|
726
|
+
description: Web-сайт ОФД
|
706
727
|
type: string
|
707
728
|
ofdinn:
|
729
|
+
description: ИНН ОФД
|
708
730
|
type: string
|
709
731
|
fnsWebsite:
|
732
|
+
description: Web-сайт ФНС
|
710
733
|
type: string
|
711
734
|
companyINN:
|
735
|
+
description: ИНН пользователя
|
712
736
|
type: string
|
713
737
|
companyName:
|
738
|
+
description: Наименование пользователя
|
714
739
|
type: string
|
715
740
|
documentNumber:
|
741
|
+
description: Номер ФД
|
716
742
|
format: int64
|
717
743
|
type: integer
|
718
744
|
shiftNumber:
|
745
|
+
description: Номер смены
|
719
746
|
format: int32
|
720
747
|
type: integer
|
721
748
|
documentIndex:
|
749
|
+
description: Номер чека за смену
|
722
750
|
format: int32
|
723
751
|
type: integer
|
724
752
|
processedAt:
|
753
|
+
description: Время регистрации фискального документа в ФН, ISO8601
|
725
754
|
format: date-time
|
726
755
|
type: string
|
727
756
|
content:
|
757
|
+
description: Содержимое документа
|
728
758
|
"$ref": "#/definitions/CheckContent"
|
729
759
|
change:
|
760
|
+
description: Сдача
|
730
761
|
format: double
|
731
762
|
type: number
|
732
763
|
fp:
|
764
|
+
description: Фискальный признак
|
733
765
|
type: string
|
734
766
|
|
767
|
+
|
735
768
|
CheckStatusViewModel[CorrectionContent]:
|
736
769
|
type: object
|
737
770
|
properties:
|
738
771
|
id:
|
739
772
|
type: string
|
773
|
+
maxLength: 64
|
740
774
|
deviceSN:
|
775
|
+
description: Заводской номер устройства пробившего чек
|
741
776
|
type: string
|
777
|
+
maxLength: 20
|
742
778
|
deviceRN:
|
779
|
+
description: Регистрационный номер устройства пробившего чек
|
743
780
|
type: string
|
781
|
+
maxLength: 20
|
744
782
|
fsNumber:
|
783
|
+
description: Номер фискального накопителя
|
745
784
|
type: string
|
746
785
|
ofdName:
|
786
|
+
description: Наименование ОФД
|
747
787
|
type: string
|
788
|
+
maxLength: 256
|
748
789
|
ofdWebsite:
|
790
|
+
description: Web-сайт ОФД
|
749
791
|
type: string
|
750
792
|
ofdinn:
|
793
|
+
description: ИНН ОФД
|
751
794
|
type: string
|
752
795
|
fnsWebsite:
|
796
|
+
description: Web-сайт ФНС
|
753
797
|
type: string
|
798
|
+
maxLength: 256
|
754
799
|
companyINN:
|
800
|
+
description: ИНН пользователя
|
755
801
|
type: string
|
802
|
+
maxLength: 12
|
756
803
|
companyName:
|
804
|
+
description: Наименование пользователя
|
757
805
|
type: string
|
806
|
+
maxLength: 256
|
758
807
|
documentNumber:
|
759
|
-
|
808
|
+
description: Номер ФД
|
760
809
|
type: integer
|
810
|
+
format: int64
|
761
811
|
shiftNumber:
|
762
|
-
|
812
|
+
description: Номер смены
|
763
813
|
type: integer
|
814
|
+
format: int32
|
764
815
|
documentIndex:
|
816
|
+
description: Номер чека за смену
|
765
817
|
format: int32
|
766
818
|
type: integer
|
767
819
|
processedAt:
|
820
|
+
description: Время регистрации фискального документа в ФН, ISO8601
|
768
821
|
format: date-time
|
769
822
|
type: string
|
770
823
|
content:
|
824
|
+
description: Содержимое документа
|
771
825
|
"$ref": "#/definitions/CorrectionContent"
|
772
826
|
change:
|
827
|
+
x-unknown: Сдача?
|
773
828
|
format: double
|
774
829
|
type: number
|
775
830
|
fp:
|
831
|
+
description: Фискальный признак
|
776
832
|
type: string
|
833
|
+
maxLength: 10
|
data/lib/orange_data/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: orangedata
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Vasily Fedoseyev
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-10-
|
11
|
+
date: 2018-10-27 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: faraday
|
@@ -183,7 +183,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
183
183
|
version: '0'
|
184
184
|
requirements: []
|
185
185
|
rubyforge_project:
|
186
|
-
rubygems_version: 2.
|
186
|
+
rubygems_version: 2.5.1
|
187
187
|
signing_key:
|
188
188
|
specification_version: 4
|
189
189
|
summary: Ruby client for orangedata.ru service
|