Class: ApiReference::CustomerTaxId

Inherits:
BaseModel
  • Object
show all
Defined in:
lib/api_reference/models/customer_tax_id.rb

Overview

Tax IDs are commonly required to be displayed on customer invoices, which are added to the headers of invoices. ### Supported Tax ID Countries and Types | Country | Type | Description | |---------|------|-------------| | Albania | al_tin | Albania Tax Identification Number | | Andorra | ad_nrt | Andorran NRT Number | | Angola | ao_tin | Angola Tax Identification Number | | Argentina | ar_cuit | Argentinian Tax ID Number | | Armenia | am_tin | Armenia Tax Identification Number | | Aruba | aw_tin | Aruba Tax Identification Number | | Australia | au_abn | Australian Business Number (AU ABN) | | Australia | au_arn | Australian Taxation Office Reference Number | | Austria | eu_vat | European VAT Number | | Azerbaijan | az_tin | Azerbaijan Tax Identification Number | | Bahamas | bs_tin | Bahamas Tax Identification Number | | Bahrain | bh_vat | Bahraini VAT Number | | Bangladesh | bd_bin | Bangladesh Business Identification Number | | Barbados | bb_tin | Barbados Tax Identification Number | | Belarus | by_tin | Belarus TIN Number | | Belgium | eu_vat | European VAT Number | | Benin | bj_ifu | Benin Tax Identification Number (Identifiant Fiscal Unique) | | Bolivia | bo_tin | Bolivian Tax ID | | Bosnia and Herzegovina | ba_tin | Bosnia and Herzegovina Tax Identification Number | | Brazil | br_cnpj | Brazilian CNPJ Number | | Brazil | br_cpf | Brazilian CPF Number | | Bulgaria | bg_uic | Bulgaria Unified Identification Code | | Bulgaria | eu_vat | European VAT Number | | Burkina Faso | bf_ifu | Burkina Faso Tax Identification Number (Numéro d'Identifiant Fiscal Unique) | | Cambodia | kh_tin | Cambodia Tax Identification Number | | Cameroon | cm_niu | Cameroon Tax Identification Number (Numéro d'Identifiant fiscal Unique) | | Canada | ca_bn | Canadian BN | | Canada | ca_gst_hst | Canadian GST/HST Number | | Canada | ca_pst_bc | Canadian PST Number (British Columbia) | | Canada | ca_pst_mb | Canadian PST Number (Manitoba) | | Canada | ca_pst_sk | Canadian PST Number (Saskatchewan) | | Canada | ca_qst | Canadian QST Number (Québec) | | Cape Verde | cv_nif | Cape Verde Tax Identification Number (Número de Identificação Fiscal) | | Chile | cl_tin | Chilean TIN | | China | cn_tin | Chinese Tax ID | | Colombia | co_nit | Colombian NIT Number | | Congo-Kinshasa | cd_nif | Congo (DR) Tax Identification Number (Número de Identificação Fiscal) | | Costa Rica | cr_tin | Costa Rican Tax ID | | Croatia | eu_vat | European VAT Number | | Croatia | hr_oib | Croatian Personal Identification Number (OIB) | | Cyprus | eu_vat | European VAT Number | | Czech Republic | eu_vat | European VAT Number | | Denmark | eu_vat | European VAT Number | | Dominican Republic | do_rcn | Dominican RCN Number | | Ecuador | ec_ruc | Ecuadorian RUC Number | | Egypt | eg_tin | Egyptian Tax Identification Number | | El Salvador | sv_nit | El Salvadorian NIT Number | | Estonia | eu_vat | European VAT Number | | Ethiopia | et_tin | Ethiopia Tax Identification Number | | European Union | eu_oss_vat | European One Stop Shop VAT Number for non-Union scheme | | Faroe Islands | fo_vat | Faroe Islands VAT Number | | Finland | eu_vat | European VAT Number | | France | eu_vat | European VAT Number | | Georgia | ge_vat | Georgian VAT | | Germany | de_stn | German Tax Number (Steuernummer) | | Germany | eu_vat | European VAT Number | | Gibraltar | gi_tin | Gibraltar Tax Identification Number | | Greece | eu_vat | European VAT Number | | Guinea | gn_nif | Guinea Tax Identification Number (Número de Identificação Fiscal) | | Hong Kong | hk_br | Hong Kong BR Number | | Hungary | eu_vat | European VAT Number | | Hungary | hu_tin | Hungary Tax Number (adószám) | | Iceland | is_vat | Icelandic VAT | | India | in_gst | Indian GST Number | | Indonesia | id_npwp | Indonesian NPWP Number | | Ireland | eu_vat | European VAT Number | | Israel | il_vat | Israel VAT | | Italy | eu_vat | European VAT Number | | Italy | it_cf | Italian Codice Fiscale Number | | Japan | jp_cn | Japanese Corporate Number (Hōjin Bangō) | | Japan | jp_rn | Japanese Registered Foreign Businesses' Registration Number (Tōroku Kokugai Jigyōsha no Tōroku Bangō) | | Japan | jp_trn | Japanese Tax Registration Number (Tōroku Bangō) | | Kazakhstan | kz_bin | Kazakhstani Business Identification Number | | Kenya | ke_pin | Kenya Revenue Authority Personal Identification Number | | Kyrgyzstan | kg_tin | Kyrgyzstan Tax Identification Number | | Laos | la_tin | Laos Tax Identification Number | | Latvia | eu_vat | European VAT Number | | Liechtenstein | li_uid | Liechtensteinian UID Number | | Liechtenstein | li_vat | Liechtenstein VAT Number | | Lithuania | eu_vat | European VAT Number | | Luxembourg | eu_vat | European VAT Number | | Malaysia | my_frp | Malaysian FRP Number | | Malaysia | my_itn | Malaysian ITN | | Malaysia | my_sst | Malaysian SST Number | | Malta | eu_vat | European VAT Number | | Mauritania | mr_nif | Mauritania Tax Identification Number (Número de Identificação Fiscal) | | Mexico | mx_rfc | Mexican RFC Number | | Moldova | md_vat | Moldova VAT Number | | Montenegro | me_pib | Montenegro PIB Number | | Morocco | ma_vat | Morocco VAT Number | | Nepal | np_pan | Nepal PAN Number | | Netherlands | eu_vat | European VAT Number | | New Zealand | nz_gst | New Zealand GST Number | | Nigeria | ng_tin | Nigerian Tax Identification Number | | North Macedonia | mk_vat | North Macedonia VAT Number | | Northern Ireland | eu_vat | Northern Ireland VAT Number | | Norway | no_vat | Norwegian VAT Number | | Norway | no_voec | Norwegian VAT on e-commerce Number | | Oman | om_vat | Omani VAT Number | | Paraguay | py_ruc | Paraguayan RUC Number | | Peru | pe_ruc | Peruvian RUC Number | | Philippines | ph_tin | Philippines Tax Identification Number | | Poland | eu_vat | European VAT Number | | Poland | pl_nip | Polish Tax ID Number | | Portugal | eu_vat | European VAT Number | | Romania | eu_vat | European VAT Number | | Romania | ro_tin | Romanian Tax ID Number | | Russia | ru_inn | Russian INN | | Russia | ru_kpp | Russian KPP | | Saudi Arabia | sa_vat | Saudi Arabia VAT | | Senegal | sn_ninea | Senegal NINEA Number | | Serbia | rs_pib | Serbian PIB Number | | Singapore | sg_gst | Singaporean GST | | Singapore | sg_uen | Singaporean UEN | | Slovakia | eu_vat | European VAT Number | | Slovenia | eu_vat | European VAT Number | | Slovenia | si_tin | Slovenia Tax Number (davčna številka) | | South Africa | za_vat | South African VAT Number | | South Korea | kr_brn | Korean BRN | | Spain | es_cif | Spanish NIF Number (previously Spanish CIF Number) | | Spain | eu_vat | European VAT Number | | Sri Lanka | lk_vat | Sri Lanka VAT Number | | Suriname | sr_fin | Suriname FIN Number | | Sweden | eu_vat | European VAT Number | | Switzerland | ch_uid | Switzerland UID Number | | Switzerland | ch_vat | Switzerland VAT Number | | Taiwan | tw_vat | Taiwanese VAT | | Tajikistan | tj_tin | Tajikistan Tax Identification Number | | Tanzania | tz_vat | Tanzania VAT Number | | Thailand | th_vat | Thai VAT | | Turkey | tr_tin | Turkish Tax Identification Number | | Uganda | ug_tin | Uganda Tax Identification Number | | Ukraine | ua_vat | Ukrainian VAT | | United Arab Emirates | ae_trn | United Arab Emirates TRN | | United Kingdom | gb_vat | United Kingdom VAT Number | | United States | us_ein | United States EIN | | Uruguay | uy_ruc | Uruguayan RUC Number | | Uzbekistan | uz_tin | Uzbekistan TIN Number | | Uzbekistan | uz_vat | Uzbekistan VAT Number | | Venezuela | ve_rif | Venezuelan RIF Number | | Vietnam | vn_tin | Vietnamese Tax ID Number | | Zambia | zm_tin | Zambia Tax Identification Number | | Zimbabwe | zw_tin | Zimbabwe Tax Identification Number |

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from BaseModel

#check_for_conflict, #process_additional_properties, #process_array, #process_basic_value, #process_hash, #to_hash, #to_json

Constructor Details

#initialize(country:, type:, value:, additional_properties: nil) ⇒ CustomerTaxId

Returns a new instance of CustomerTaxId.



151
152
153
154
155
156
157
158
159
# File 'lib/api_reference/models/customer_tax_id.rb', line 151

def initialize(country:, type:, value:, additional_properties: nil)
  # Add additional model properties to the instance
  additional_properties = {} if additional_properties.nil?

  @country = country
  @type = type
  @value = value
  @additional_properties = additional_properties
end

Instance Attribute Details

#countryCountry

TODO: Write general description for this method

Returns:



122
123
124
# File 'lib/api_reference/models/customer_tax_id.rb', line 122

def country
  @country
end

#typeType5

TODO: Write general description for this method

Returns:



126
127
128
# File 'lib/api_reference/models/customer_tax_id.rb', line 126

def type
  @type
end

#valueString

TODO: Write general description for this method

Returns:

  • (String)


130
131
132
# File 'lib/api_reference/models/customer_tax_id.rb', line 130

def value
  @value
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
# File 'lib/api_reference/models/customer_tax_id.rb', line 162

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  country = hash.key?('country') ? hash['country'] : nil
  type = hash.key?('type') ? hash['type'] : nil
  value = hash.key?('value') ? hash['value'] : nil

  # Create a new hash for additional properties, removing known properties.
  new_hash = hash.reject { |k, _| names.value?(k) }

  additional_properties = APIHelper.get_additional_properties(
    new_hash, proc { |value| value }
  )

  # Create object from extracted values.
  CustomerTaxId.new(country: country,
                    type: type,
                    value: value,
                    additional_properties: additional_properties)
end

.namesObject

A mapping from model property names to API property names.



133
134
135
136
137
138
139
# File 'lib/api_reference/models/customer_tax_id.rb', line 133

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['country'] = 'country'
  @_hash['type'] = 'type'
  @_hash['value'] = 'value'
  @_hash
end

.nullablesObject

An array for nullable fields



147
148
149
# File 'lib/api_reference/models/customer_tax_id.rb', line 147

def self.nullables
  []
end

.optionalsObject

An array for optional fields



142
143
144
# File 'lib/api_reference/models/customer_tax_id.rb', line 142

def self.optionals
  []
end

.validate(value) ⇒ Object

Validates an instance of the object from a given value.

Parameters:

  • The (CustomerTaxId | Hash)

    value against the validation is performed.



186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
# File 'lib/api_reference/models/customer_tax_id.rb', line 186

def self.validate(value)
  if value.instance_of? self
    return (
      APIHelper.valid_type?(value.country,
                            ->(val) { Country.validate(val) }) and
        APIHelper.valid_type?(value.type,
                              ->(val) { Type5.validate(val) }) and
        APIHelper.valid_type?(value.value,
                              ->(val) { val.instance_of? String })
    )
  end

  return false unless value.instance_of? Hash

  (
    APIHelper.valid_type?(value['country'],
                          ->(val) { Country.validate(val) }) and
      APIHelper.valid_type?(value['type'],
                            ->(val) { Type5.validate(val) }) and
      APIHelper.valid_type?(value['value'],
                            ->(val) { val.instance_of? String })
  )
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



218
219
220
221
222
# File 'lib/api_reference/models/customer_tax_id.rb', line 218

def inspect
  class_name = self.class.name.split('::').last
  "<#{class_name} country: #{@country.inspect}, type: #{@type.inspect}, value:"\
  " #{@value.inspect}, additional_properties: #{@additional_properties}>"
end

#to_sObject

Provides a human-readable string representation of the object.



211
212
213
214
215
# File 'lib/api_reference/models/customer_tax_id.rb', line 211

def to_s
  class_name = self.class.name.split('::').last
  "<#{class_name} country: #{@country}, type: #{@type}, value: #{@value},"\
  " additional_properties: #{@additional_properties}>"
end