Class: CyberSourceMergedSpec::FollowOnTransactionBuyerInformation

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

Overview

FollowOnTransactionBuyerInformation 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(company_tax_id: SKIP, currency: SKIP, date_of_birth: SKIP, personal_identification: SKIP, additional_properties: nil) ⇒ FollowOnTransactionBuyerInformation

Returns a new instance of FollowOnTransactionBuyerInformation.



64
65
66
67
68
69
70
71
72
73
74
# File 'lib/cyber_source_merged_spec/models/follow_on_transaction_buyer_information.rb', line 64

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

  @company_tax_id = company_tax_id unless company_tax_id == SKIP
  @currency = currency unless currency == SKIP
  @date_of_birth = date_of_birth unless date_of_birth == SKIP
  @personal_identification = personal_identification unless personal_identification == SKIP
  @additional_properties = additional_properties
end

Instance Attribute Details

#company_tax_idString

Company’s tax identifier. This is only used for eCheck service.

Returns:

  • (String)


14
15
16
# File 'lib/cyber_source_merged_spec/models/follow_on_transaction_buyer_information.rb', line 14

def company_tax_id
  @company_tax_id
end

#currencyString

Currency used for the order. Use the three-character I[ISO Standard Currency Codes.](http://apps.cybersource.com/library/documentation/sbc/quickref/cur rencies.pdf) For an authorization reversal (reversalInformation) or a capture (processingOptions.capture is set to true), you must use the same currency that you used in your payment authorization request.

DCC for First Data

Your local currency. For details, see the currency field description in [Dynamic Currency Conversion For First Data Using the SCMP API](http://apps.cybersource.com/library/documentation/dev_guides/DCC_Firs tData_SCMP/DCC_FirstData_SCMP_API.pdf).

Returns:

  • (String)


29
30
31
# File 'lib/cyber_source_merged_spec/models/follow_on_transaction_buyer_information.rb', line 29

def currency
  @currency
end

#date_of_birthDate

Date of birth of the customer. Format: YYYY-MM-DD

Returns:

  • (Date)


33
34
35
# File 'lib/cyber_source_merged_spec/models/follow_on_transaction_buyer_information.rb', line 33

def date_of_birth
  @date_of_birth
end

#personal_identificationArray[PersonalIdentification9]

Date of birth of the customer. Format: YYYY-MM-DD

Returns:



37
38
39
# File 'lib/cyber_source_merged_spec/models/follow_on_transaction_buyer_information.rb', line 37

def personal_identification
  @personal_identification
end

Class Method Details

.from_element(root) ⇒ Object



110
111
112
113
114
115
116
117
118
119
120
121
122
123
# File 'lib/cyber_source_merged_spec/models/follow_on_transaction_buyer_information.rb', line 110

def self.from_element(root)
  company_tax_id = XmlUtilities.from_element(root, 'companyTaxID', String)
  currency = XmlUtilities.from_element(root, 'currency', String)
  date_of_birth = XmlUtilities.from_element(root, 'dateOfBirth', String)
  personal_identification = XmlUtilities.from_element_to_array(
    root, 'PersonalIdentification9', PersonalIdentification9
  )

  new(company_tax_id: company_tax_id,
      currency: currency,
      date_of_birth: date_of_birth,
      personal_identification: personal_identification,
      additional_properties: additional_properties)
end

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
# File 'lib/cyber_source_merged_spec/models/follow_on_transaction_buyer_information.rb', line 77

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  company_tax_id = hash.key?('companyTaxID') ? hash['companyTaxID'] : SKIP
  currency = hash.key?('currency') ? hash['currency'] : SKIP
  date_of_birth = hash.key?('dateOfBirth') ? hash['dateOfBirth'] : SKIP
  # Parameter is an array, so we need to iterate through it
  personal_identification = nil
  unless hash['personalIdentification'].nil?
    personal_identification = []
    hash['personalIdentification'].each do |structure|
      personal_identification << (PersonalIdentification9.from_hash(structure) if structure)
    end
  end

  personal_identification = SKIP unless hash.key?('personalIdentification')

  # 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.
  FollowOnTransactionBuyerInformation.new(company_tax_id: company_tax_id,
                                          currency: currency,
                                          date_of_birth: date_of_birth,
                                          personal_identification: personal_identification,
                                          additional_properties: additional_properties)
end

.namesObject

A mapping from model property names to API property names.



40
41
42
43
44
45
46
47
# File 'lib/cyber_source_merged_spec/models/follow_on_transaction_buyer_information.rb', line 40

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['company_tax_id'] = 'companyTaxID'
  @_hash['currency'] = 'currency'
  @_hash['date_of_birth'] = 'dateOfBirth'
  @_hash['personal_identification'] = 'personalIdentification'
  @_hash
end

.nullablesObject

An array for nullable fields



60
61
62
# File 'lib/cyber_source_merged_spec/models/follow_on_transaction_buyer_information.rb', line 60

def self.nullables
  []
end

.optionalsObject

An array for optional fields



50
51
52
53
54
55
56
57
# File 'lib/cyber_source_merged_spec/models/follow_on_transaction_buyer_information.rb', line 50

def self.optionals
  %w[
    company_tax_id
    currency
    date_of_birth
    personal_identification
  ]
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



148
149
150
151
152
153
# File 'lib/cyber_source_merged_spec/models/follow_on_transaction_buyer_information.rb', line 148

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

#to_sObject

Provides a human-readable string representation of the object.



140
141
142
143
144
145
# File 'lib/cyber_source_merged_spec/models/follow_on_transaction_buyer_information.rb', line 140

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

#to_xml_element(doc, root_name) ⇒ Object



125
126
127
128
129
130
131
132
133
134
135
136
137
# File 'lib/cyber_source_merged_spec/models/follow_on_transaction_buyer_information.rb', line 125

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

  XmlUtilities.add_as_subelement(doc, root, 'companyTaxID', company_tax_id)
  XmlUtilities.add_as_subelement(doc, root, 'currency', currency)
  XmlUtilities.add_as_subelement(doc, root, 'dateOfBirth', date_of_birth)
  XmlUtilities.add_array_as_subelement(doc, root, 'PersonalIdentification9',
                                       personal_identification)
  XmlUtilities.add_as_subelement(doc, root, 'additional_properties',
                                 additional_properties)

  root
end