Class: CyberSourceMergedSpec::BuyerInformation6

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

Overview

BuyerInformation6 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(merchant_customer_id: SKIP, date_of_birth: SKIP, gender: SKIP, language: SKIP, additional_properties: nil) ⇒ BuyerInformation6

Returns a new instance of BuyerInformation6.



80
81
82
83
84
85
86
87
88
89
90
# File 'lib/cyber_source_merged_spec/models/buyer_information6.rb', line 80

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

  @merchant_customer_id = merchant_customer_id unless merchant_customer_id == SKIP
  @date_of_birth = date_of_birth unless date_of_birth == SKIP
  @gender = gender unless gender == SKIP
  @language = language unless language == SKIP
  @additional_properties = additional_properties
end

Instance Attribute Details

#date_of_birthString

Recipient’s date of birth. Format: YYYYMMDD. This field is a pass-through, which means that CyberSource ensures that the value is eight numeric characters but otherwise does not verify the value or modify it in any way before sending it to the processor. If the field is not required for the transaction, CyberSource does not forward it to the processor.

Returns:

  • (String)


45
46
47
# File 'lib/cyber_source_merged_spec/models/buyer_information6.rb', line 45

def date_of_birth
  @date_of_birth
end

#genderString

Customer's gender. Possible values are F (female), M (male), O (other).

Returns:

  • (String)


49
50
51
# File 'lib/cyber_source_merged_spec/models/buyer_information6.rb', line 49

def gender
  @gender
end

#languageString

language setting of the user

Returns:

  • (String)


53
54
55
# File 'lib/cyber_source_merged_spec/models/buyer_information6.rb', line 53

def language
  @language
end

#merchant_customer_idString

Your identifier for the customer. When a subscription or customer profile is being created, the maximum length for this field for most processors is 30. Otherwise, the maximum length is 100.

SEPA/BACS

Required for Create Mandate and Import Mandate

Comercio Latino

For recurring payments in Mexico, the value is the customer’s contract number. Note Before you request the authorization, you must inform the issuer of the customer contract numbers that will be used for recurring transactions.

Worldpay VAP

For a follow-on credit with Worldpay VAP, CyberSource checks the following locations, in the order given, for a customer account ID value and uses the first value it finds:

  1. customer_account_id value in the follow-on credit request
  2. Customer account ID value that was used for the capture that is being credited
  3. Customer account ID value that was used for the original authorization If a customer account ID value cannot be found in any of these locations, then no value is used.

Returns:

  • (String)


35
36
37
# File 'lib/cyber_source_merged_spec/models/buyer_information6.rb', line 35

def merchant_customer_id
  @merchant_customer_id
end

Class Method Details

.from_element(root) ⇒ Object



118
119
120
121
122
123
124
125
126
127
128
129
130
131
# File 'lib/cyber_source_merged_spec/models/buyer_information6.rb', line 118

def self.from_element(root)
  merchant_customer_id = XmlUtilities.from_element(root,
                                                   'merchantCustomerId',
                                                   String)
  date_of_birth = XmlUtilities.from_element(root, 'dateOfBirth', String)
  gender = XmlUtilities.from_element(root, 'gender', String)
  language = XmlUtilities.from_element(root, 'language', String)

  new(merchant_customer_id: merchant_customer_id,
      date_of_birth: date_of_birth,
      gender: gender,
      language: language,
      additional_properties: additional_properties)
end

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
# File 'lib/cyber_source_merged_spec/models/buyer_information6.rb', line 93

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  merchant_customer_id =
    hash.key?('merchantCustomerId') ? hash['merchantCustomerId'] : SKIP
  date_of_birth = hash.key?('dateOfBirth') ? hash['dateOfBirth'] : SKIP
  gender = hash.key?('gender') ? hash['gender'] : SKIP
  language = hash.key?('language') ? hash['language'] : 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.
  BuyerInformation6.new(merchant_customer_id: merchant_customer_id,
                        date_of_birth: date_of_birth,
                        gender: gender,
                        language: language,
                        additional_properties: additional_properties)
end

.namesObject

A mapping from model property names to API property names.



56
57
58
59
60
61
62
63
# File 'lib/cyber_source_merged_spec/models/buyer_information6.rb', line 56

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['merchant_customer_id'] = 'merchantCustomerId'
  @_hash['date_of_birth'] = 'dateOfBirth'
  @_hash['gender'] = 'gender'
  @_hash['language'] = 'language'
  @_hash
end

.nullablesObject

An array for nullable fields



76
77
78
# File 'lib/cyber_source_merged_spec/models/buyer_information6.rb', line 76

def self.nullables
  []
end

.optionalsObject

An array for optional fields



66
67
68
69
70
71
72
73
# File 'lib/cyber_source_merged_spec/models/buyer_information6.rb', line 66

def self.optionals
  %w[
    merchant_customer_id
    date_of_birth
    gender
    language
  ]
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



156
157
158
159
160
161
# File 'lib/cyber_source_merged_spec/models/buyer_information6.rb', line 156

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

#to_sObject

Provides a human-readable string representation of the object.



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

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

#to_xml_element(doc, root_name) ⇒ Object



133
134
135
136
137
138
139
140
141
142
143
144
145
# File 'lib/cyber_source_merged_spec/models/buyer_information6.rb', line 133

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

  XmlUtilities.add_as_subelement(doc, root, 'merchantCustomerId',
                                 merchant_customer_id)
  XmlUtilities.add_as_subelement(doc, root, 'dateOfBirth', date_of_birth)
  XmlUtilities.add_as_subelement(doc, root, 'gender', gender)
  XmlUtilities.add_as_subelement(doc, root, 'language', language)
  XmlUtilities.add_as_subelement(doc, root, 'additional_properties',
                                 additional_properties)

  root
end