Skip to content

Commit fa7e63b

Browse files
Adicionado método para retentativa de envio de nota fiscal. (#25)
* Adicionado método para retentativa de envio de nota fiscal. * Update CHANGELOG.md * Update version.rb Co-authored-by: Laerte Guimarães <[email protected]>
1 parent d0590cd commit fa7e63b

File tree

5 files changed

+75
-2
lines changed

5 files changed

+75
-2
lines changed

CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
# Notas das versões
22

33

4+
## [v0.0.8 - 16/11/2020](https://github.com/vindi/vindi-ruby/releases/tag/v0.0.8)
5+
- Adiciona endpoint para retentativa de envio de notas fiscais
6+
47
## [v0.0.7 - 14/10/2020](https://github.com/vindi/vindi-ruby/releases/tag/v0.0.7)
58
- Adiciona endpoint para consulta de registros de utilização associados ao período
69

lib/vindi/rest/invoice.rb

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,13 +38,23 @@ def create_invoice(options = {})
3838
#
3939
# @params invoice_id [Integer] ID of the invoice
4040
# @option options [Hash] :options invoice attributes
41-
#
4241
# @see https://vindi.github.io/api-docs/dist/#!/invoices/DELETE_version_invoices_id_format
4342
# @example Delete invoice #108
4443
# client.delete_invoice(108)
4544
def delete_invoice(invoice_id, options = {})
4645
delete("invoices/#{invoice_id}", options)[:invoice]
4746
end
47+
48+
# Retry a invoice from merchant vindi
49+
#
50+
# @params invoice_id [Integer] ID of the invoice
51+
# @option options [Hash] :options invoice attributes
52+
# @see https://vindi.github.io/api-docs/dist/#/invoices/postV1InvoicesIdRetry
53+
# @example Retry a invoice from merchant vindi
54+
# client.retry_invoice(108)
55+
def retry_invoice(invoice_id, options = {})
56+
post("invoices/#{invoice_id}/retry", options)[:invoice]
57+
end
4858
end
4959
end
5060
end

lib/vindi/version.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
module Vindi
2-
VERSION = '0.0.7'
2+
VERSION = '0.0.8'
33
end

spec/cassettes/vindi/rest/invoices/retry_invoice.yml

Lines changed: 50 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

spec/vindi/rest/invoice_spec.rb

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,4 +44,14 @@
4444
end
4545
end
4646
end
47+
48+
describe 'retry_invoice' do
49+
it 'returns the retried invoice' do
50+
VCR.use_cassette("rest/invoices/retry_invoice") do
51+
invoice_response = client.retry_invoice(108)
52+
assert_requested :post, vindi_url("invoices/108/retry")
53+
expect(invoice_response[:status]).to eq('processing')
54+
end
55+
end
56+
end
4757
end

0 commit comments

Comments
 (0)