Class: CyberSourceMergedSpec::BuyerInformation42

Inherits:
BaseModel
  • Object
show all
Defined in:
lib/cyber_source_merged_spec/models/buyer_information42.rb

Overview

BuyerInformation42 Model.

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(vat_registration_number: SKIP, additional_properties: nil) ⇒ BuyerInformation42

Returns a new instance of BuyerInformation42.



52
53
54
55
56
57
58
# File 'lib/cyber_source_merged_spec/models/buyer_information42.rb', line 52

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

  @vat_registration_number = vat_registration_number unless vat_registration_number == SKIP
  @additional_properties = additional_properties
end

Instance Attribute Details

#vat_registration_numberString

Customer's VAT registration number for the individual sender tax identification. This field flows in ISO field 104, DSID 63 tag 06. Visa is recommending the use of the following business application identifier (BAI) values and merchant category code (MCC) combinations to process domestic bill payments, toll payments, and business-to-business funding transactions as AFTs in Brazil:

  • BB (Business-to-business)
  • BP (Non-card bill payment)
  • FT (Funds transfer)
  • WT (Wallet transfer) MCC: 4784

Mapping

  • SCMP API Field: purchaser_vat_registration_number
  • Simple Order API Field: invoiceHeader_purchaserVATRegistrationNumber
  • CCS: customer.vatRegistrationNumber Optional field.

Returns:

  • (String)


31
32
33
# File 'lib/cyber_source_merged_spec/models/buyer_information42.rb', line 31

def vat_registration_number
  @vat_registration_number
end

Class Method Details

.from_element(root) ⇒ Object



80
81
82
83
84
85
86
87
# File 'lib/cyber_source_merged_spec/models/buyer_information42.rb', line 80

def self.from_element(root)
  vat_registration_number = XmlUtilities.from_element(
    root, 'vatRegistrationNumber', String
  )

  new(vat_registration_number: vat_registration_number,
      additional_properties: additional_properties)
end

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
# File 'lib/cyber_source_merged_spec/models/buyer_information42.rb', line 61

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  vat_registration_number =
    hash.key?('vatRegistrationNumber') ? hash['vatRegistrationNumber'] : SKIP

  # 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.
  BuyerInformation42.new(vat_registration_number: vat_registration_number,
                         additional_properties: additional_properties)
end

.namesObject

A mapping from model property names to API property names.



34
35
36
37
38
# File 'lib/cyber_source_merged_spec/models/buyer_information42.rb', line 34

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['vat_registration_number'] = 'vatRegistrationNumber'
  @_hash
end

.nullablesObject

An array for nullable fields



48
49
50
# File 'lib/cyber_source_merged_spec/models/buyer_information42.rb', line 48

def self.nullables
  []
end

.optionalsObject

An array for optional fields



41
42
43
44
45
# File 'lib/cyber_source_merged_spec/models/buyer_information42.rb', line 41

def self.optionals
  %w[
    vat_registration_number
  ]
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



108
109
110
111
112
# File 'lib/cyber_source_merged_spec/models/buyer_information42.rb', line 108

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

#to_sObject

Provides a human-readable string representation of the object.



101
102
103
104
105
# File 'lib/cyber_source_merged_spec/models/buyer_information42.rb', line 101

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

#to_xml_element(doc, root_name) ⇒ Object



89
90
91
92
93
94
95
96
97
98
# File 'lib/cyber_source_merged_spec/models/buyer_information42.rb', line 89

def to_xml_element(doc, root_name)
  root = doc.create_element(root_name)

  XmlUtilities.add_as_subelement(doc, root, 'vatRegistrationNumber',
                                 vat_registration_number)
  XmlUtilities.add_as_subelement(doc, root, 'additional_properties',
                                 additional_properties)

  root
end