snoopy_afip 4.2.2 → 4.3.0
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/lib/snoopy_afip/authorize_adapter.rb +9 -8
- data/lib/snoopy_afip/bill.rb +16 -3
- data/lib/snoopy_afip/constants.rb +13 -0
- data/lib/snoopy_afip/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ddb431b984f379cd6f6030e90734cf449d025e804cacdc039a746bd5f2ab44b4
|
4
|
+
data.tar.gz: cc2af52ee88ac9e1abcb9f6d7f478f6dbaad8abe99e5b51c7585f0e5ec7c856e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 260af80a82dbde4632293ee5458acdfff10fd98f33412e21c18d24b07fbe88e29eafda3d98d84fadda48e51cf793f45e59ac2ecc0c156a68d0c552b8bace6852
|
7
|
+
data.tar.gz: 4d6f545f2004b35986f41d2e7f67ba931dbc4a056f948a5b670ab66a7cd7201aba9c6cd461efe511d3a13800f79cb61c6fa9baecc93048c244ff34013367ba53
|
@@ -62,14 +62,15 @@ module Snoopy
|
|
62
62
|
# today = Time.new.in_time_zone('Buenos Aires').strftime('%Y%m%d')
|
63
63
|
today = Date.today.strftime('%Y%m%d')
|
64
64
|
fecaereq = {"FeCAEReq" => { "FeCabReq" => { "CantReg" => "1", "CbteTipo" => bill.cbte_type, "PtoVta" => bill.sale_point },
|
65
|
-
"FeDetReq" => { "FECAEDetRequest" => { "Concepto"
|
66
|
-
"DocTipo"
|
67
|
-
"CbteFch"
|
68
|
-
"ImpTotConc"
|
69
|
-
"MonId"
|
70
|
-
"MonCotiz"
|
71
|
-
"ImpOpEx"
|
72
|
-
"ImpTrib"
|
65
|
+
"FeDetReq" => { "FECAEDetRequest" => { "Concepto" => Snoopy::CONCEPTS[bill.concept],
|
66
|
+
"DocTipo" => Snoopy::DOCUMENTS[bill.document_type],
|
67
|
+
"CbteFch" => today,
|
68
|
+
"ImpTotConc" => 0.00,
|
69
|
+
"MonId" => Snoopy::CURRENCY[bill.currency][:code],
|
70
|
+
"MonCotiz" => bill.exchange_rate,
|
71
|
+
"ImpOpEx" => 0.00,
|
72
|
+
"ImpTrib" => 0.00,
|
73
|
+
"CondicionIVAReceptorId" => bill.receiver_iva_condition_id }}}}
|
73
74
|
|
74
75
|
unless bill.issuer_iva_cond.to_sym == Snoopy::RESPONSABLE_MONOTRIBUTO
|
75
76
|
_alicivas = bill.alicivas.collect do |aliciva|
|
data/lib/snoopy_afip/bill.rb
CHANGED
@@ -5,11 +5,11 @@ module Snoopy
|
|
5
5
|
:cbte_asoc_num, :cae, :service_date_to, :due_date,
|
6
6
|
:number, :alicivas, :cuit, :sale_point, :service_date_from,
|
7
7
|
:due_date_cae, :voucher_date, :process_date, :imp_iva, :cbte_asoc_to_sale_point,
|
8
|
-
:receiver_iva_cond, :issuer_iva_cond, :errors, :asoc_receiver_iva_cond]
|
8
|
+
:receiver_iva_cond, :issuer_iva_cond, :errors, :asoc_receiver_iva_cond, :receiver_iva_condition]
|
9
9
|
|
10
10
|
TAX_ATTRIBUTES = [:id, :amount, :taxeable_base]
|
11
11
|
|
12
|
-
ATTRIBUTES_PRECENSE = [:total_net, :concept, :receiver_iva_cond, :alicivas, :document_type, :service_date_from, :service_date_to, :sale_point, :issuer_iva_cond]
|
12
|
+
ATTRIBUTES_PRECENSE = [:total_net, :concept, :receiver_iva_cond, :alicivas, :document_type, :service_date_from, :service_date_to, :sale_point, :issuer_iva_cond, :receiver_iva_condition]
|
13
13
|
|
14
14
|
attr_accessor *ATTRIBUTES
|
15
15
|
|
@@ -31,9 +31,10 @@ module Snoopy
|
|
31
31
|
@issuer_iva_cond = attrs[:issuer_iva_cond]
|
32
32
|
@service_date_to = attrs[:service_date_to]
|
33
33
|
@service_date_from = attrs[:service_date_from]
|
34
|
-
@receiver_iva_cond = attrs[:receiver_iva_cond]
|
34
|
+
@receiver_iva_cond = attrs[:receiver_iva_cond] # Esto se usa para el cbte_type
|
35
35
|
@asoc_receiver_iva_cond = attrs[:asoc_receiver_iva_cond]
|
36
36
|
@cbte_asoc_to_sale_point = attrs[:cbte_asoc_to_sale_point] # Esto es el punto de venta de la factura para la nota de credito
|
37
|
+
@receiver_iva_condition = attrs[:receiver_iva_condition] # La verdadera condicion de iva del receptor
|
37
38
|
end
|
38
39
|
|
39
40
|
# def self.bill_request(number, attrs={})
|
@@ -105,6 +106,12 @@ module Snoopy
|
|
105
106
|
end
|
106
107
|
alias :to_hash :to_h
|
107
108
|
|
109
|
+
def receiver_iva_condition_id
|
110
|
+
return '' if @receiver_iva_condition.nil?
|
111
|
+
|
112
|
+
Snoopy::IVA_COND_RECEIVER[@receiver_iva_condition.to_sym]
|
113
|
+
end
|
114
|
+
|
108
115
|
private
|
109
116
|
|
110
117
|
def validate!
|
@@ -147,6 +154,12 @@ module Snoopy
|
|
147
154
|
status = false unless errors.empty?
|
148
155
|
end
|
149
156
|
|
157
|
+
unless Snoopy::IVA_COND_RECEIVER.keys.include?(@receiver_iva_condition&.to_sym)
|
158
|
+
@errors[:receiver_iva_condition] = [] unless errors.has_key?(:receiver_iva_condition)
|
159
|
+
@errors[:receiver_iva_condition] << Snoopy::Exception::Bill::InvalidValueAttribute.new("Invalid value #{@receiver_iva_condition}. Possible values #{Snoopy::IVA_COND_RECEIVER.keys}").message
|
160
|
+
status = false unless errors.empty?
|
161
|
+
end
|
162
|
+
|
150
163
|
unless Snoopy::DOCUMENTS.keys.include?(@document_type)
|
151
164
|
@errors[:document_type] = [] unless errors.has_key?(:document_type)
|
152
165
|
@errors[:document_type] << Snoopy::Exception::Bill::InvalidValueAttribute.new("Invalid value #{@document_type}. Possible values #{Snoopy::DOCUMENTS.keys}").message
|
@@ -25,9 +25,22 @@ module Snoopy
|
|
25
25
|
|
26
26
|
RESPONSABLE_INSCRIPTO = :responsable_inscripto
|
27
27
|
RESPONSABLE_MONOTRIBUTO = :responsable_monotributo
|
28
|
+
CONSUMIDOR_FINAL = :consumidor_final
|
29
|
+
IVA_SUJETO_EXENTO = :sujeto_exento
|
30
|
+
IVA_NO_ALCANZADO = :no_alcanzado
|
28
31
|
|
32
|
+
# Issuer
|
29
33
|
IVA_COND = [ RESPONSABLE_MONOTRIBUTO, RESPONSABLE_INSCRIPTO ]
|
30
34
|
|
35
|
+
# Receiver
|
36
|
+
IVA_COND_RECEIVER = {
|
37
|
+
RESPONSABLE_INSCRIPTO => '1', # registered_vat_payer
|
38
|
+
RESPONSABLE_MONOTRIBUTO => '6', # self_employed_taxpayer
|
39
|
+
CONSUMIDOR_FINAL => '5', # final_consumer
|
40
|
+
IVA_SUJETO_EXENTO => '4', # exempt
|
41
|
+
IVA_NO_ALCANZADO => '15' # not_applicable
|
42
|
+
}.freeze
|
43
|
+
|
31
44
|
CONCEPTS = { 'Productos' => '01',
|
32
45
|
'Servicios' => '02',
|
33
46
|
'Productos y Servicios' => '03' }
|
data/lib/snoopy_afip/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: snoopy_afip
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 4.
|
4
|
+
version: 4.3.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- g.edera
|
@@ -75,7 +75,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
75
75
|
- !ruby/object:Gem::Version
|
76
76
|
version: '0'
|
77
77
|
requirements: []
|
78
|
-
rubygems_version: 3.6.
|
78
|
+
rubygems_version: 3.6.9
|
79
79
|
specification_version: 4
|
80
80
|
summary: Adaptador AFIP wsfe.
|
81
81
|
test_files:
|