nfe_reader 1.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +23 -0
- data/Gemfile +4 -0
- data/LICENSE.txt +22 -0
- data/README.md +38 -0
- data/Rakefile +13 -0
- data/lib/nfe_reader/authorization.rb +12 -0
- data/lib/nfe_reader/carrier.rb +16 -0
- data/lib/nfe_reader/collection/duplicate.rb +12 -0
- data/lib/nfe_reader/collection.rb +34 -0
- data/lib/nfe_reader/customer.rb +62 -0
- data/lib/nfe_reader/delivery.rb +20 -0
- data/lib/nfe_reader/document.rb +73 -0
- data/lib/nfe_reader/export.rb +12 -0
- data/lib/nfe_reader/fiscal.rb +33 -0
- data/lib/nfe_reader/header.rb +129 -0
- data/lib/nfe_reader/information.rb +38 -0
- data/lib/nfe_reader/product/armament.rb +22 -0
- data/lib/nfe_reader/product/cane.rb +42 -0
- data/lib/nfe_reader/product/exportation.rb +20 -0
- data/lib/nfe_reader/product/fuel.rb +18 -0
- data/lib/nfe_reader/product/importation.rb +49 -0
- data/lib/nfe_reader/product/medicament.rb +19 -0
- data/lib/nfe_reader/product/vehicle.rb +117 -0
- data/lib/nfe_reader/product.rb +90 -0
- data/lib/nfe_reader/provider.rb +43 -0
- data/lib/nfe_reader/purchase.rb +14 -0
- data/lib/nfe_reader/removal.rb +20 -0
- data/lib/nfe_reader/taxation/cofins.rb +43 -0
- data/lib/nfe_reader/taxation/cofins_st.rb +19 -0
- data/lib/nfe_reader/taxation/icms.rb +86 -0
- data/lib/nfe_reader/taxation/importation_tax.rb +17 -0
- data/lib/nfe_reader/taxation/ipi.rb +41 -0
- data/lib/nfe_reader/taxation/issqn.rb +22 -0
- data/lib/nfe_reader/taxation/pis.rb +42 -0
- data/lib/nfe_reader/taxation/pis_st.rb +19 -0
- data/lib/nfe_reader/total.rb +76 -0
- data/lib/nfe_reader/transport.rb +97 -0
- data/lib/nfe_reader/version.rb +5 -0
- data/lib/nfe_reader.rb +129 -0
- data/lib/nokogiri_hash.rb +60 -0
- data/nfe-reader.gemspec +24 -0
- data/test/files/sample-nfe.xml +234 -0
- data/test/files/sample2-nfe.xml +192 -0
- data/test/nfe_reader/authorization_test.rb +22 -0
- data/test/nfe_reader/cane_test.rb +71 -0
- data/test/nfe_reader/carrier_test.rb +46 -0
- data/test/nfe_reader/collection/duplicate_test.rb +27 -0
- data/test/nfe_reader/collection_test.rb +78 -0
- data/test/nfe_reader/customer_test.rb +133 -0
- data/test/nfe_reader/delivery_test.rb +57 -0
- data/test/nfe_reader/document_test.rb +113 -0
- data/test/nfe_reader/export_test.rb +22 -0
- data/test/nfe_reader/fiscal_test.rb +67 -0
- data/test/nfe_reader/header_test.rb +135 -0
- data/test/nfe_reader/information_test.rb +37 -0
- data/test/nfe_reader/product/armament_test.rb +32 -0
- data/test/nfe_reader/product/exportation_test.rb +34 -0
- data/test/nfe_reader/product/fuel_test.rb +44 -0
- data/test/nfe_reader/product/importation_test.rb +64 -0
- data/test/nfe_reader/product/medicament_test.rb +37 -0
- data/test/nfe_reader/product/vehicle_test.rb +133 -0
- data/test/nfe_reader/product_test.rb +125 -0
- data/test/nfe_reader/provider_test.rb +155 -0
- data/test/nfe_reader/purchase_test.rb +27 -0
- data/test/nfe_reader/removal_test.rb +57 -0
- data/test/nfe_reader/taxation/cofins_st_test.rb +37 -0
- data/test/nfe_reader/taxation/cofins_test.rb +42 -0
- data/test/nfe_reader/taxation/icms_test.rb +122 -0
- data/test/nfe_reader/taxation/importation_tax_test.rb +32 -0
- data/test/nfe_reader/taxation/ipi_test.rb +78 -0
- data/test/nfe_reader/taxation/issqn_test.rb +42 -0
- data/test/nfe_reader/taxation/pis_st_test.rb +37 -0
- data/test/nfe_reader/taxation/pis_test.rb +42 -0
- data/test/nfe_reader/total_test.rb +148 -0
- data/test/nfe_reader/transport_test.rb +172 -0
- data/test/nfe_reader_test.rb +125 -0
- data/test/nokogiri_test.rb +27 -0
- data/test/test_helper.rb +13 -0
- metadata +201 -0
@@ -0,0 +1,133 @@
|
|
1
|
+
require File.expand_path("../../../test_helper", __FILE__)
|
2
|
+
|
3
|
+
describe Nfe::Vehicle do
|
4
|
+
def nfe_hash
|
5
|
+
{
|
6
|
+
vehicle: {
|
7
|
+
pOp: '1',
|
8
|
+
chassi: '1234789',
|
9
|
+
cCor: '1',
|
10
|
+
xCor: 'Black',
|
11
|
+
pot: '2.0',
|
12
|
+
cilin: '500',
|
13
|
+
pesoL: '2.700',
|
14
|
+
pesoB: '4.000',
|
15
|
+
nSerie: '1235',
|
16
|
+
tpComb: '1',
|
17
|
+
nMotor: '1351',
|
18
|
+
tpComb: '1',
|
19
|
+
CMT: '13221',
|
20
|
+
dist: '2.3',
|
21
|
+
anoMod: '2000',
|
22
|
+
anoFab: '2000',
|
23
|
+
tpPint: '1',
|
24
|
+
tpVeic: '1',
|
25
|
+
espVeic: '1',
|
26
|
+
VIN: '123123',
|
27
|
+
condVeic: '1',
|
28
|
+
cMod: '1',
|
29
|
+
cCorDEN: '1',
|
30
|
+
lota: '5',
|
31
|
+
tpRest: '0',
|
32
|
+
}
|
33
|
+
}
|
34
|
+
end
|
35
|
+
|
36
|
+
let(:vehicle) { Nfe::Vehicle.new(nfe_hash[:vehicle]) }
|
37
|
+
|
38
|
+
it '#operation' do
|
39
|
+
vehicle.operation.must_equal '1'
|
40
|
+
end
|
41
|
+
|
42
|
+
it '#chassi' do
|
43
|
+
vehicle.chassi.must_equal '1234789'
|
44
|
+
end
|
45
|
+
|
46
|
+
it '#color' do
|
47
|
+
vehicle.color.must_equal '1'
|
48
|
+
end
|
49
|
+
|
50
|
+
it '#color_name' do
|
51
|
+
vehicle.color_name.must_equal 'Black'
|
52
|
+
end
|
53
|
+
|
54
|
+
it '#engine_power' do
|
55
|
+
vehicle.engine_power.must_equal '2.0'
|
56
|
+
end
|
57
|
+
|
58
|
+
it '#engine_capacities' do
|
59
|
+
vehicle.engine_capacities.must_equal '500'
|
60
|
+
end
|
61
|
+
|
62
|
+
it '#weight_net' do
|
63
|
+
vehicle.weight_net.must_equal '2.700'
|
64
|
+
end
|
65
|
+
|
66
|
+
it '#weight_gross' do
|
67
|
+
vehicle.weight_gross.must_equal '4.000'
|
68
|
+
end
|
69
|
+
|
70
|
+
it '#serie' do
|
71
|
+
vehicle.serie.must_equal '1235'
|
72
|
+
end
|
73
|
+
|
74
|
+
it '#fuel_kind' do
|
75
|
+
vehicle.fuel_kind.must_equal '1'
|
76
|
+
end
|
77
|
+
|
78
|
+
it '#engine_number' do
|
79
|
+
vehicle.engine_number.must_equal '1351'
|
80
|
+
end
|
81
|
+
|
82
|
+
it '#cmt' do
|
83
|
+
vehicle.cmt.must_equal '13221'
|
84
|
+
end
|
85
|
+
|
86
|
+
it '#wheelbase' do
|
87
|
+
vehicle.wheelbase.must_equal '2.3'
|
88
|
+
end
|
89
|
+
|
90
|
+
it '#year' do
|
91
|
+
vehicle.year.must_equal '2000'
|
92
|
+
end
|
93
|
+
|
94
|
+
it '#fabrication_year' do
|
95
|
+
vehicle.fabrication_year.must_equal '2000'
|
96
|
+
end
|
97
|
+
|
98
|
+
it '#paint_kind' do
|
99
|
+
vehicle.paint_kind.must_equal '1'
|
100
|
+
end
|
101
|
+
|
102
|
+
it '#kind' do
|
103
|
+
vehicle.kind.must_equal '1'
|
104
|
+
end
|
105
|
+
|
106
|
+
it '#vehicle_kind' do
|
107
|
+
vehicle.vehicle_kind.must_equal '1'
|
108
|
+
end
|
109
|
+
|
110
|
+
it '#vin' do
|
111
|
+
vehicle.vin.must_equal '123123'
|
112
|
+
end
|
113
|
+
|
114
|
+
it '#condiction' do
|
115
|
+
vehicle.condiction.must_equal '1'
|
116
|
+
end
|
117
|
+
|
118
|
+
it '#model' do
|
119
|
+
vehicle.model.must_equal '1'
|
120
|
+
end
|
121
|
+
|
122
|
+
it '#color_code' do
|
123
|
+
vehicle.color_code.must_equal '1'
|
124
|
+
end
|
125
|
+
|
126
|
+
it '#capacity' do
|
127
|
+
vehicle.capacity.must_equal '5'
|
128
|
+
end
|
129
|
+
|
130
|
+
it '#restriction' do
|
131
|
+
vehicle.restriction.must_equal '0'
|
132
|
+
end
|
133
|
+
end
|
@@ -0,0 +1,125 @@
|
|
1
|
+
require File.expand_path("../../test_helper", __FILE__)
|
2
|
+
|
3
|
+
describe Nfe::Product do
|
4
|
+
def product_hash
|
5
|
+
{
|
6
|
+
product: {
|
7
|
+
nItem: '1',
|
8
|
+
prod: {
|
9
|
+
cProd: '0001',
|
10
|
+
xProd: 'Product',
|
11
|
+
cEAN: '789101312121',
|
12
|
+
NCM: '10.10.10.00',
|
13
|
+
CFOP: '1111',
|
14
|
+
uCom: 'UN',
|
15
|
+
qCom: '2',
|
16
|
+
vUnCom: '10',
|
17
|
+
vProd: '20',
|
18
|
+
cEANTrib: '789101312122',
|
19
|
+
uTrib: 'UN',
|
20
|
+
qTrib: '2',
|
21
|
+
vUnTrib: '20',
|
22
|
+
indTot: '1',
|
23
|
+
EXTIPI: '00',
|
24
|
+
vFrete: '0.00',
|
25
|
+
vSeg: '2.00',
|
26
|
+
vDesc: '0.00',
|
27
|
+
vOutro: '4.00',
|
28
|
+
xPed: '1001',
|
29
|
+
nItemPed: '23'
|
30
|
+
},
|
31
|
+
imposto: {}
|
32
|
+
}
|
33
|
+
}
|
34
|
+
end
|
35
|
+
|
36
|
+
let(:product) { Nfe::Product.new(product_hash[:product]) }
|
37
|
+
|
38
|
+
it '#demand_item' do
|
39
|
+
product.demand_item.must_equal '23'
|
40
|
+
end
|
41
|
+
|
42
|
+
it '#demand_number' do
|
43
|
+
product.demand_number.must_equal '1001'
|
44
|
+
end
|
45
|
+
|
46
|
+
it '#number' do
|
47
|
+
product.number.must_equal '1'
|
48
|
+
end
|
49
|
+
|
50
|
+
it '#product_code' do
|
51
|
+
product.product_code.must_equal '0001'
|
52
|
+
end
|
53
|
+
|
54
|
+
it '#product' do
|
55
|
+
product.product.must_equal 'Product'
|
56
|
+
end
|
57
|
+
|
58
|
+
it '#ean' do
|
59
|
+
product.ean.must_equal '789101312121'
|
60
|
+
end
|
61
|
+
|
62
|
+
it '#ncm' do
|
63
|
+
product.ncm.must_equal '10.10.10.00'
|
64
|
+
end
|
65
|
+
|
66
|
+
it '#cfop' do
|
67
|
+
product.cfop.must_equal '1111'
|
68
|
+
end
|
69
|
+
|
70
|
+
it '#unit_sale' do
|
71
|
+
product.unit_sale.must_equal 'UN'
|
72
|
+
end
|
73
|
+
|
74
|
+
it '#amount_sale' do
|
75
|
+
product.amount_sale.must_equal '2'
|
76
|
+
end
|
77
|
+
|
78
|
+
it '#value_sale' do
|
79
|
+
product.value_sale.must_equal '10'
|
80
|
+
end
|
81
|
+
|
82
|
+
it '#total' do
|
83
|
+
product.total.must_equal '20'
|
84
|
+
end
|
85
|
+
|
86
|
+
it '#gtin' do
|
87
|
+
product.gtin.must_equal '789101312122'
|
88
|
+
end
|
89
|
+
|
90
|
+
it '#unit' do
|
91
|
+
product.unit.must_equal 'UN'
|
92
|
+
end
|
93
|
+
|
94
|
+
it '#amount' do
|
95
|
+
product.amount.must_equal '2'
|
96
|
+
end
|
97
|
+
|
98
|
+
it '#value' do
|
99
|
+
product.value.must_equal '20'
|
100
|
+
end
|
101
|
+
|
102
|
+
it '#kind' do
|
103
|
+
product.kind.must_equal '1'
|
104
|
+
end
|
105
|
+
|
106
|
+
it '#ipi_exception' do
|
107
|
+
product.ipi_exception.must_equal '00'
|
108
|
+
end
|
109
|
+
|
110
|
+
it '#freight' do
|
111
|
+
product.freight.must_equal '0.00'
|
112
|
+
end
|
113
|
+
|
114
|
+
it '#insurance' do
|
115
|
+
product.insurance.must_equal '2.00'
|
116
|
+
end
|
117
|
+
|
118
|
+
it '#discount' do
|
119
|
+
product.discount.must_equal '0.00'
|
120
|
+
end
|
121
|
+
|
122
|
+
it '#other_value' do
|
123
|
+
product.other_value.must_equal '4.00'
|
124
|
+
end
|
125
|
+
end
|
@@ -0,0 +1,155 @@
|
|
1
|
+
require File.expand_path("../../test_helper", __FILE__)
|
2
|
+
|
3
|
+
describe Nfe::Provider do
|
4
|
+
def provider_hash
|
5
|
+
{
|
6
|
+
emit: {
|
7
|
+
CNPJ: '99819146000120',
|
8
|
+
CPF: '64046757655',
|
9
|
+
xNome: 'Provider',
|
10
|
+
xFant: 'Provider',
|
11
|
+
IE: '15786913',
|
12
|
+
IEST: '975940113',
|
13
|
+
IM: '3856749',
|
14
|
+
CRT: '1',
|
15
|
+
CNAE: '123456',
|
16
|
+
enderEmit: {
|
17
|
+
fone: '55 5555-5555',
|
18
|
+
xLgr: 'Green Street',
|
19
|
+
nro: '123',
|
20
|
+
xCpl: '',
|
21
|
+
xBairro: 'Neighborhood',
|
22
|
+
cMun: '1246',
|
23
|
+
xMun: 'City',
|
24
|
+
UF: 'ST',
|
25
|
+
CEP: '00000-000',
|
26
|
+
cPais: '1058',
|
27
|
+
xPais: 'Brazil'
|
28
|
+
}
|
29
|
+
}
|
30
|
+
}
|
31
|
+
end
|
32
|
+
|
33
|
+
describe 'with address' do
|
34
|
+
let(:provider) { Nfe::Provider.new(provider_hash[:emit]) }
|
35
|
+
|
36
|
+
it '#cnpj' do
|
37
|
+
provider.cnpj.must_equal '99819146000120'
|
38
|
+
end
|
39
|
+
|
40
|
+
it '#cpf' do
|
41
|
+
provider.cpf.must_equal '64046757655'
|
42
|
+
end
|
43
|
+
|
44
|
+
it '#name' do
|
45
|
+
provider.name.must_equal 'Provider'
|
46
|
+
end
|
47
|
+
|
48
|
+
it '#fantasia' do
|
49
|
+
provider.fantasy.must_equal 'Provider'
|
50
|
+
end
|
51
|
+
|
52
|
+
it '#state_registration' do
|
53
|
+
provider.state_registration.must_equal '15786913'
|
54
|
+
end
|
55
|
+
|
56
|
+
it '#state_registration_st' do
|
57
|
+
provider.state_registration_st.must_equal '975940113'
|
58
|
+
end
|
59
|
+
|
60
|
+
it '#city_registration' do
|
61
|
+
provider.city_registration.must_equal '3856749'
|
62
|
+
end
|
63
|
+
|
64
|
+
it '#regime' do
|
65
|
+
provider.regime.must_equal '1'
|
66
|
+
end
|
67
|
+
|
68
|
+
it '#cnae' do
|
69
|
+
provider.cnae.must_equal '123456'
|
70
|
+
end
|
71
|
+
|
72
|
+
it '#phone' do
|
73
|
+
provider.phone.must_equal '55 5555-5555'
|
74
|
+
end
|
75
|
+
|
76
|
+
it '#number' do
|
77
|
+
provider.number.must_equal '123'
|
78
|
+
end
|
79
|
+
|
80
|
+
it '#complement' do
|
81
|
+
provider.complement.must_equal ''
|
82
|
+
end
|
83
|
+
|
84
|
+
it '#address' do
|
85
|
+
provider.address.must_equal 'Green Street'
|
86
|
+
end
|
87
|
+
|
88
|
+
it '#neighborhood' do
|
89
|
+
provider.neighborhood.must_equal 'Neighborhood'
|
90
|
+
end
|
91
|
+
|
92
|
+
it '#city_code' do
|
93
|
+
provider.city_code.must_equal '1246'
|
94
|
+
end
|
95
|
+
|
96
|
+
it '#city' do
|
97
|
+
provider.city.must_equal 'City'
|
98
|
+
end
|
99
|
+
|
100
|
+
it '#state' do
|
101
|
+
provider.state.must_equal 'ST'
|
102
|
+
end
|
103
|
+
|
104
|
+
it '#country_code' do
|
105
|
+
provider.country_code.must_equal '1058'
|
106
|
+
end
|
107
|
+
|
108
|
+
it '#country' do
|
109
|
+
provider.country.must_equal 'Brazil'
|
110
|
+
end
|
111
|
+
|
112
|
+
it '#zip_code' do
|
113
|
+
provider.zip_code.must_equal '00000-000'
|
114
|
+
end
|
115
|
+
end
|
116
|
+
|
117
|
+
describe 'without address' do
|
118
|
+
let(:provider) { Nfe::Provider.new }
|
119
|
+
|
120
|
+
it '#phone' do
|
121
|
+
provider.number.must_be_nil
|
122
|
+
end
|
123
|
+
|
124
|
+
it '#number' do
|
125
|
+
provider.number.must_be_nil
|
126
|
+
end
|
127
|
+
|
128
|
+
it '#address' do
|
129
|
+
provider.address.must_be_nil
|
130
|
+
end
|
131
|
+
it '#neighborhood' do
|
132
|
+
provider.neighborhood.must_be_nil
|
133
|
+
end
|
134
|
+
|
135
|
+
it '#city_code' do
|
136
|
+
provider.city_code.must_be_nil
|
137
|
+
end
|
138
|
+
|
139
|
+
it '#city' do
|
140
|
+
provider.city.must_be_nil
|
141
|
+
end
|
142
|
+
|
143
|
+
it '#state' do
|
144
|
+
provider.state.must_be_nil
|
145
|
+
end
|
146
|
+
|
147
|
+
it '#country_code' do
|
148
|
+
provider.country_code.must_be_nil
|
149
|
+
end
|
150
|
+
|
151
|
+
it '#country' do
|
152
|
+
provider.country.must_be_nil
|
153
|
+
end
|
154
|
+
end
|
155
|
+
end
|
@@ -0,0 +1,27 @@
|
|
1
|
+
require File.expand_path("../../test_helper", __FILE__)
|
2
|
+
|
3
|
+
describe Nfe::Purchase do
|
4
|
+
def nfe_hash
|
5
|
+
{
|
6
|
+
compra: {
|
7
|
+
xNEmp: '10001',
|
8
|
+
xPed: '12356',
|
9
|
+
xCont: '1257521'
|
10
|
+
}
|
11
|
+
}
|
12
|
+
end
|
13
|
+
|
14
|
+
let(:purchase) { Nfe::Purchase.new(nfe_hash[:compra]) }
|
15
|
+
|
16
|
+
it '#number' do
|
17
|
+
purchase.number.must_equal '10001'
|
18
|
+
end
|
19
|
+
|
20
|
+
it '#demand' do
|
21
|
+
purchase.demand.must_equal '12356'
|
22
|
+
end
|
23
|
+
|
24
|
+
it '#contract' do
|
25
|
+
purchase.contract.must_equal '1257521'
|
26
|
+
end
|
27
|
+
end
|
@@ -0,0 +1,57 @@
|
|
1
|
+
require File.expand_path("../../test_helper", __FILE__)
|
2
|
+
|
3
|
+
describe Nfe::Removal do
|
4
|
+
def nfe_hash
|
5
|
+
{
|
6
|
+
retirada: {
|
7
|
+
CNPJ: '99819146000120',
|
8
|
+
CPF: '64046757655',
|
9
|
+
xLgr: 'Street',
|
10
|
+
nro: '157',
|
11
|
+
xCpl: 'Address',
|
12
|
+
xBairro: 'Neighborhood',
|
13
|
+
xMun: 'City',
|
14
|
+
cMun: '1234',
|
15
|
+
UF: 'ST',
|
16
|
+
}
|
17
|
+
}
|
18
|
+
end
|
19
|
+
|
20
|
+
let(:removal) { Nfe::Removal.new(nfe_hash[:retirada]) }
|
21
|
+
|
22
|
+
it '#cnpj' do
|
23
|
+
removal.cnpj.must_equal '99819146000120'
|
24
|
+
end
|
25
|
+
|
26
|
+
it '#cpf' do
|
27
|
+
removal.cpf.must_equal '64046757655'
|
28
|
+
end
|
29
|
+
|
30
|
+
it '#address' do
|
31
|
+
removal.address.must_equal 'Street'
|
32
|
+
end
|
33
|
+
|
34
|
+
it '#number' do
|
35
|
+
removal.number.must_equal '157'
|
36
|
+
end
|
37
|
+
|
38
|
+
it '#complement' do
|
39
|
+
removal.complement.must_equal 'Address'
|
40
|
+
end
|
41
|
+
|
42
|
+
it '#neighborhood' do
|
43
|
+
removal.neighborhood.must_equal 'Neighborhood'
|
44
|
+
end
|
45
|
+
|
46
|
+
it '#city_code' do
|
47
|
+
removal.city_code.must_equal '1234'
|
48
|
+
end
|
49
|
+
|
50
|
+
it '#city' do
|
51
|
+
removal.city.must_equal 'City'
|
52
|
+
end
|
53
|
+
|
54
|
+
it '#state' do
|
55
|
+
removal.state.must_equal 'ST'
|
56
|
+
end
|
57
|
+
end
|
@@ -0,0 +1,37 @@
|
|
1
|
+
require File.expand_path("../../../test_helper", __FILE__)
|
2
|
+
|
3
|
+
describe Nfe::CofinsSt do
|
4
|
+
def nfe_hash
|
5
|
+
{
|
6
|
+
COFINSST: {
|
7
|
+
vBC: '100.00',
|
8
|
+
pCOFINS: '17.00',
|
9
|
+
vCOFINS: '17.00',
|
10
|
+
qBCProd: '0',
|
11
|
+
vAliqProd: '0'
|
12
|
+
}
|
13
|
+
}
|
14
|
+
end
|
15
|
+
|
16
|
+
let(:cofins) { Nfe::CofinsSt.new(nfe_hash[:COFINSST]) }
|
17
|
+
|
18
|
+
it '#base' do
|
19
|
+
cofins.base.must_equal '100.00'
|
20
|
+
end
|
21
|
+
|
22
|
+
it '#percentage' do
|
23
|
+
cofins.percentage.must_equal '17.00'
|
24
|
+
end
|
25
|
+
|
26
|
+
it '#value' do
|
27
|
+
cofins.value.must_equal '17.00'
|
28
|
+
end
|
29
|
+
|
30
|
+
it '#amount' do
|
31
|
+
cofins.amount.must_equal '0'
|
32
|
+
end
|
33
|
+
|
34
|
+
it '#aliquot' do
|
35
|
+
cofins.aliquot.must_equal '0'
|
36
|
+
end
|
37
|
+
end
|
@@ -0,0 +1,42 @@
|
|
1
|
+
require File.expand_path("../../../test_helper", __FILE__)
|
2
|
+
|
3
|
+
describe Nfe::Cofins do
|
4
|
+
def nfe_hash
|
5
|
+
{
|
6
|
+
COFINSNT: {
|
7
|
+
CST: '06',
|
8
|
+
vBC: '100.00',
|
9
|
+
pCOFINS: '17.00',
|
10
|
+
vCOFINS: '17.00',
|
11
|
+
qBCProd: '0',
|
12
|
+
vAliqProd: '0'
|
13
|
+
}
|
14
|
+
}
|
15
|
+
end
|
16
|
+
|
17
|
+
let(:cofins) { Nfe::Cofins.new(nfe_hash[:COFINSNT]) }
|
18
|
+
|
19
|
+
it '#cst' do
|
20
|
+
cofins.cst.must_equal '06'
|
21
|
+
end
|
22
|
+
|
23
|
+
it '#base' do
|
24
|
+
cofins.base.must_equal '100.00'
|
25
|
+
end
|
26
|
+
|
27
|
+
it '#percentage' do
|
28
|
+
cofins.percentage.must_equal '17.00'
|
29
|
+
end
|
30
|
+
|
31
|
+
it '#value' do
|
32
|
+
cofins.value.must_equal '17.00'
|
33
|
+
end
|
34
|
+
|
35
|
+
it '#amount' do
|
36
|
+
cofins.amount.must_equal '0'
|
37
|
+
end
|
38
|
+
|
39
|
+
it '#aliquot' do
|
40
|
+
cofins.aliquot.must_equal '0'
|
41
|
+
end
|
42
|
+
end
|
@@ -0,0 +1,122 @@
|
|
1
|
+
require File.expand_path("../../../test_helper", __FILE__)
|
2
|
+
|
3
|
+
describe Nfe::Icms do
|
4
|
+
def nfe_hash
|
5
|
+
{
|
6
|
+
ICMS: {
|
7
|
+
orig: '1',
|
8
|
+
CST: '10',
|
9
|
+
pICMS: '10',
|
10
|
+
vICMS: '100',
|
11
|
+
modBC: '1',
|
12
|
+
vBC: '1000',
|
13
|
+
pRedBC: '0',
|
14
|
+
modBCST: '0',
|
15
|
+
pRedBCST: '0',
|
16
|
+
pMVAST: '0',
|
17
|
+
vBCST: '0',
|
18
|
+
pICMSST: '0',
|
19
|
+
vICMSST: '0',
|
20
|
+
vBCSTRet: '0',
|
21
|
+
vICMSSTRet: '0',
|
22
|
+
vBCSTDest: '0',
|
23
|
+
vICMSSTDes: '0',
|
24
|
+
UFST: 'ST',
|
25
|
+
motDesICMS: '0',
|
26
|
+
pCredSN: '0',
|
27
|
+
vCredICMSSN: '0',
|
28
|
+
CSOSN: '0',
|
29
|
+
}
|
30
|
+
}
|
31
|
+
end
|
32
|
+
|
33
|
+
let(:icms) { Nfe::Icms.new(nfe_hash[:ICMS]) }
|
34
|
+
|
35
|
+
it '#origin' do
|
36
|
+
icms.origin.must_equal '1'
|
37
|
+
end
|
38
|
+
|
39
|
+
it '#cst' do
|
40
|
+
icms.cst.must_equal '10'
|
41
|
+
end
|
42
|
+
|
43
|
+
it '#icms_percentage' do
|
44
|
+
icms.icms_percentage.must_equal '10'
|
45
|
+
end
|
46
|
+
|
47
|
+
it '#icms' do
|
48
|
+
icms.icms.must_equal '100'
|
49
|
+
end
|
50
|
+
|
51
|
+
it '#icms_base_kind' do
|
52
|
+
icms.icms_base_kind.must_equal '1'
|
53
|
+
end
|
54
|
+
|
55
|
+
it '#icms_base' do
|
56
|
+
icms.icms_base.must_equal '1000'
|
57
|
+
end
|
58
|
+
|
59
|
+
it '#icms_base_reductionicms_base_reduction' do
|
60
|
+
icms.icms_base_reduction.must_equal '0'
|
61
|
+
end
|
62
|
+
|
63
|
+
it '#icms_st_base_kind' do
|
64
|
+
icms.icms_st_base_kind.must_equal '0'
|
65
|
+
end
|
66
|
+
|
67
|
+
it '#icms_st_base_reduction' do
|
68
|
+
icms.icms_st_base_reduction.must_equal '0'
|
69
|
+
end
|
70
|
+
|
71
|
+
it '#mva' do
|
72
|
+
icms.mva.must_equal '0'
|
73
|
+
end
|
74
|
+
|
75
|
+
it '#icms_st_base' do
|
76
|
+
icms.icms_st_base.must_equal '0'
|
77
|
+
end
|
78
|
+
|
79
|
+
it '#icms_st_percentage' do
|
80
|
+
icms.icms_st_percentage.must_equal '0'
|
81
|
+
end
|
82
|
+
|
83
|
+
it '#icms_st' do
|
84
|
+
icms.icms_st.must_equal '0'
|
85
|
+
end
|
86
|
+
|
87
|
+
it '#icms_st_base_retained_sender' do
|
88
|
+
icms.icms_st_base_retained_sender.must_equal '0'
|
89
|
+
end
|
90
|
+
|
91
|
+
it '#icms_st_retained_sender' do
|
92
|
+
icms.icms_st_retained_sender.must_equal '0'
|
93
|
+
end
|
94
|
+
|
95
|
+
it '#icms_st_base_retained' do
|
96
|
+
icms.icms_st_base_retained.must_equal '0'
|
97
|
+
end
|
98
|
+
|
99
|
+
it '#icms_st_retained' do
|
100
|
+
icms.icms_st_retained.must_equal '0'
|
101
|
+
end
|
102
|
+
|
103
|
+
it '#state' do
|
104
|
+
icms.state.must_equal 'ST'
|
105
|
+
end
|
106
|
+
|
107
|
+
it '#retained_reason' do
|
108
|
+
icms.retained_reason.must_equal '0'
|
109
|
+
end
|
110
|
+
|
111
|
+
it '#credit_percentage' do
|
112
|
+
icms.credit_percentage.must_equal '0'
|
113
|
+
end
|
114
|
+
|
115
|
+
it '#icms_credit' do
|
116
|
+
icms.icms_credit.must_equal '0'
|
117
|
+
end
|
118
|
+
|
119
|
+
it '#sn_operation_code' do
|
120
|
+
icms.sn_operation_code.must_equal '0'
|
121
|
+
end
|
122
|
+
end
|