Class: Belvo::TaxRetentions

Inherits:
Resource show all
Defined in:
lib/belvo/resources.rb

Overview

A tax retention is the amount of money that the payer must deduct from the total amount of a purchase invoice, according to the regulations of the fiscal institution.

Defined Under Namespace

Classes: TaxRetentionsType

Instance Attribute Summary

Attributes inherited from Resource

#endpoint

Instance Method Summary collapse

Methods inherited from Resource

#clean, #delete, #detail, #list

Constructor Details

#initialize(session) ⇒ TaxRetentions

Returns a new instance of TaxRetentions.



522
523
524
525
# File 'lib/belvo/resources.rb', line 522

def initialize(session)
  super(session)
  @endpoint = 'api/tax-retentions/'
end

Instance Method Details

#resume(_session_id, _token, _link: nil) ⇒ Object



554
555
556
557
# File 'lib/belvo/resources.rb', line 554

def resume(_session_id, _token, _link: nil)
  raise NotImplementedError \
    'TaxRetentions does not support resuming a session'
end

#retrieve(link:, type:, options: nil) ⇒ Object

Retrieve tax retentions from a specific fiscal link. for (UUID). the invoice (from the perspective of the Link owner). ‘OUTFLOW` relates to a tax retention for a sent invoice. `INFLOW` relates to a tax retention for a received invoice. (inflow or outflow)

Parameters:

  • link (String)

    The ‘link.id` that you want to get information

  • type (TaxRetentionsType)

    The type of tax retention in relation to

  • options (TaxRetentionsOptions) (defaults to: nil)

    Configurable properties



540
541
542
543
544
545
546
547
548
549
550
551
552
# File 'lib/belvo/resources.rb', line 540

def retrieve(link:, type:, options: nil)
  options = TaxRetentionsOptions.from(options)
  body = {
    link: link,
    date_from: options.date_from,
    date_to: options.date_to,
    save_data: options.save_data,
    attach_xml: options.attach_xml,
    type: type
  }.merge(options)
  body = clean body: body
  @session.post(@endpoint, body)
end