diff --git a/jarbas/chamber_of_deputies/models.py b/jarbas/chamber_of_deputies/models.py index 99204d2cc..9e9916762 100644 --- a/jarbas/chamber_of_deputies/models.py +++ b/jarbas/chamber_of_deputies/models.py @@ -31,11 +31,11 @@ def __init__(self, year, applicant_id, document_id, document_type): @property def url(self): if self.document_type == self.ELETRONIC_RECEIPT_TYPE: - return self.eletronic_url() + return self.electronic_url() return self.pdf_url() - def eletronic_url(self): + def electronic_url(self): return ( 'https://www.camara.leg.br/cota-parlamentar/' 'nota-fiscal-eletronica?ideDocumentoFiscal={}' @@ -49,7 +49,6 @@ def pdf_url(self): 'cota-parlamentar/documentos/publ/{}/{}/{}.pdf' ).format(*args) - @property def exists(self): status = head(self.url).status_code diff --git a/jarbas/chamber_of_deputies/tests/test_receipt_class.py b/jarbas/chamber_of_deputies/tests/test_receipt_class.py index 5e143e993..f2519b8e8 100644 --- a/jarbas/chamber_of_deputies/tests/test_receipt_class.py +++ b/jarbas/chamber_of_deputies/tests/test_receipt_class.py @@ -10,16 +10,16 @@ class TestReceipt(TestCase): def setUp(self): self.receipt = Receipt(1970, 13, 42, 1) - self.eletronic_receipt = Receipt(1970, 13, 42, 4) + self.electronic_receipt = Receipt(1970, 13, 42, 4) def test_url(self): expected = 'http://www.camara.gov.br/cota-parlamentar/documentos/publ/13/1970/42.pdf' self.assertEqual(expected, self.receipt.url) - def test_eletronic_url(self): + def test_electronic_url(self): expected = ('https://www.camara.leg.br/cota-parlamentar/nota-fiscal-eletronica?' 'ideDocumentoFiscal=42') - self.assertEqual(expected, self.eletronic_receipt.url) + self.assertEqual(expected, self.electronic_receipt.url) @patch('jarbas.chamber_of_deputies.models.head') def test_existing_url(self, mocked_head): diff --git a/jarbas/layers/elm/Internationalization.elm b/jarbas/layers/elm/Internationalization.elm index 406d71c26..d6e3648ed 100644 --- a/jarbas/layers/elm/Internationalization.elm +++ b/jarbas/layers/elm/Internationalization.elm @@ -348,6 +348,9 @@ translate lang trans = 2 -> DocumentType.expenseMadeAbroad + 4 -> + DocumentType.electronicReceipt + _ -> Common.empty in diff --git a/jarbas/layers/elm/Internationalization/DocumentType.elm b/jarbas/layers/elm/Internationalization/DocumentType.elm index 19f1c67a0..51e3d9a74 100644 --- a/jarbas/layers/elm/Internationalization/DocumentType.elm +++ b/jarbas/layers/elm/Internationalization/DocumentType.elm @@ -22,3 +22,9 @@ expenseMadeAbroad = TranslationSet "Expense made abroad" "Despesa no exterior" + +electronicReceipt : TranslationSet +electronicReceipt = + TranslationSet + "Electronic receipt" + "Nota fiscal eletrĂ´nica"