Skip to content

Commit

Permalink
Adicionado método para retentativa de envio de nota fiscal. (#25)
Browse files Browse the repository at this point in the history
* Adicionado método para retentativa de envio de nota fiscal.

* Update CHANGELOG.md

* Update version.rb

Co-authored-by: Laerte Guimarães <[email protected]>
  • Loading branch information
rainerborene and laerte-guimaraes authored Nov 16, 2020
1 parent d0590cd commit fa7e63b
Show file tree
Hide file tree
Showing 5 changed files with 75 additions and 2 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
# Notas das versões


## [v0.0.8 - 16/11/2020](https://github.com/vindi/vindi-ruby/releases/tag/v0.0.8)
- Adiciona endpoint para retentativa de envio de notas fiscais

## [v0.0.7 - 14/10/2020](https://github.com/vindi/vindi-ruby/releases/tag/v0.0.7)
- Adiciona endpoint para consulta de registros de utilização associados ao período

Expand Down
12 changes: 11 additions & 1 deletion lib/vindi/rest/invoice.rb
Original file line number Diff line number Diff line change
Expand Up @@ -38,13 +38,23 @@ def create_invoice(options = {})
#
# @params invoice_id [Integer] ID of the invoice
# @option options [Hash] :options invoice attributes
#
# @see https://vindi.github.io/api-docs/dist/#!/invoices/DELETE_version_invoices_id_format
# @example Delete invoice #108
# client.delete_invoice(108)
def delete_invoice(invoice_id, options = {})
delete("invoices/#{invoice_id}", options)[:invoice]
end

# Retry a invoice from merchant vindi
#
# @params invoice_id [Integer] ID of the invoice
# @option options [Hash] :options invoice attributes
# @see https://vindi.github.io/api-docs/dist/#/invoices/postV1InvoicesIdRetry
# @example Retry a invoice from merchant vindi
# client.retry_invoice(108)
def retry_invoice(invoice_id, options = {})
post("invoices/#{invoice_id}/retry", options)[:invoice]
end
end
end
end
2 changes: 1 addition & 1 deletion lib/vindi/version.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
module Vindi
VERSION = '0.0.7'
VERSION = '0.0.8'
end
50 changes: 50 additions & 0 deletions spec/cassettes/vindi/rest/invoices/retry_invoice.yml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 10 additions & 0 deletions spec/vindi/rest/invoice_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -44,4 +44,14 @@
end
end
end

describe 'retry_invoice' do
it 'returns the retried invoice' do
VCR.use_cassette("rest/invoices/retry_invoice") do
invoice_response = client.retry_invoice(108)
assert_requested :post, vindi_url("invoices/108/retry")
expect(invoice_response[:status]).to eq('processing')
end
end
end
end

0 comments on commit fa7e63b

Please sign in to comment.