Class: CyberSourceMergedSpec::CustomerInformation2

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

Overview

CustomerInformation2 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(name: SKIP, merchant_customer_id: SKIP, additional_properties: nil) ⇒ CustomerInformation2

Returns a new instance of CustomerInformation2.



60
61
62
63
64
65
66
67
68
# File 'lib/cyber_source_merged_spec/models/customer_information2.rb', line 60

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

  @name = name unless name == SKIP
  @merchant_customer_id = merchant_customer_id unless merchant_customer_id == SKIP
  @additional_properties = additional_properties
end

Instance Attribute Details

#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.

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)


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

def merchant_customer_id
  @merchant_customer_id
end

#nameString

Payer name for the invoice.

Returns:

  • (String)


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

def name
  @name
end

Class Method Details

.from_element(root) ⇒ Object



92
93
94
95
96
97
98
99
100
101
# File 'lib/cyber_source_merged_spec/models/customer_information2.rb', line 92

def self.from_element(root)
  name = XmlUtilities.from_element(root, 'name', String)
  merchant_customer_id = XmlUtilities.from_element(root,
                                                   'merchantCustomerId',
                                                   String)

  new(name: name,
      merchant_customer_id: merchant_customer_id,
      additional_properties: additional_properties)
end

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
# File 'lib/cyber_source_merged_spec/models/customer_information2.rb', line 71

def self.from_hash(hash)
  return nil unless hash

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

.namesObject

A mapping from model property names to API property names.



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

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['name'] = 'name'
  @_hash['merchant_customer_id'] = 'merchantCustomerId'
  @_hash
end

.nullablesObject

An array for nullable fields



56
57
58
# File 'lib/cyber_source_merged_spec/models/customer_information2.rb', line 56

def self.nullables
  []
end

.optionalsObject

An array for optional fields



48
49
50
51
52
53
# File 'lib/cyber_source_merged_spec/models/customer_information2.rb', line 48

def self.optionals
  %w[
    name
    merchant_customer_id
  ]
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



123
124
125
126
127
# File 'lib/cyber_source_merged_spec/models/customer_information2.rb', line 123

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

#to_sObject

Provides a human-readable string representation of the object.



116
117
118
119
120
# File 'lib/cyber_source_merged_spec/models/customer_information2.rb', line 116

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

#to_xml_element(doc, root_name) ⇒ Object



103
104
105
106
107
108
109
110
111
112
113
# File 'lib/cyber_source_merged_spec/models/customer_information2.rb', line 103

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

  XmlUtilities.add_as_subelement(doc, root, 'name', name)
  XmlUtilities.add_as_subelement(doc, root, 'merchantCustomerId',
                                 merchant_customer_id)
  XmlUtilities.add_as_subelement(doc, root, 'additional_properties',
                                 additional_properties)

  root
end