Skip to content

Commit

Permalink
BILL_TYPE, Y U SO COMPLEX?
Browse files Browse the repository at this point in the history
  • Loading branch information
miloops committed Dec 21, 2011
1 parent 0b55790 commit 3951136
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 11 deletions.
4 changes: 2 additions & 2 deletions lib/bravo/bill.rb
Expand Up @@ -25,7 +25,7 @@ def initialize(attrs = {})
end

def cbte_type
Bravo::BILL_TYPE[Bravo.own_iva_cond][iva_cond] ||
Bravo::BILL_TYPE[iva_cond] ||
raise(NullOrInvalidAttribute.new, "Please choose a valid document type.")
end

Expand Down Expand Up @@ -120,7 +120,7 @@ def authorized?
end

def query_bill(iva_cond, cbte_number)
cbte_type = Bravo::BILL_TYPE[Bravo.own_iva_cond][iva_cond] ||
cbte_type = Bravo::BILL_TYPE[iva_cond] ||
raise(NullOrInvalidAttribute.new, "Please choose a valid document type.")

response = client.request :fe_comp_consultar do
Expand Down
14 changes: 6 additions & 8 deletions lib/bravo/constants.rb
Expand Up @@ -36,13 +36,11 @@ module Bravo
ALIC_IVA = [["03", 0], ["04", 0.105], ["05", 0.21], ["06", 0.27]]

BILL_TYPE = {
:responsable_inscripto => {
:responsable_inscripto => "01",
:consumidor_final => "06",
:exento => "06",
:responsable_monotributo => "06",
:nota_credito_a => "03",
:nota_credito_b => "08"
}
:responsable_inscripto => "01",
:consumidor_final => "06",
:exento => "06",
:responsable_monotributo => "06",
:nota_credito_a => "03",
:nota_credito_b => "08"
}
end
2 changes: 1 addition & 1 deletion spec/bravo/bill_spec.rb
Expand Up @@ -84,7 +84,7 @@
detail["FchVtoPago"].should == "20111210"
end

Bravo::BILL_TYPE[Bravo.own_iva_cond].keys.each do |target_iva_cond|
Bravo::BILL_TYPE.keys.each do |target_iva_cond|
it "should authorize a valid bill for #{target_iva_cond.to_s}" do
@bill.net = 1000000
@bill.aliciva_id = 2
Expand Down

0 comments on commit 3951136

Please sign in to comment.