Class: CyberSourceMergedSpec::CustomerInformation

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

Overview

Contains all of the customer-related fields for the invoice.

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, email: SKIP, merchant_customer_id: SKIP, company: SKIP, additional_properties: nil) ⇒ CustomerInformation

Returns a new instance of CustomerInformation.



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

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

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

Instance Attribute Details

#companyCompany6

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:



94
95
96
# File 'lib/cyber_source_merged_spec/models/customer_information.rb', line 94

def company
  @company
end

#emailString

Customer's email address, including the full domain name.

CyberSource through VisaNet

Credit card networks cannot process transactions that contain non-ASCII characters. CyberSource through VisaNet accepts and stores non-ASCII characters correctly and displays them correctly in reports. However, the limitations of the credit card networks prevent CyberSource through VisaNet from transmitting non-ASCII characters to the credit card networks. Therefore, CyberSource through VisaNet replaces non-ASCII characters with meaningless ASCII characters for transmission to the credit card networks. Important It is your responsibility to determine whether a field is required for the transaction you are requesting.

Invoicing

Email address for the customer for sending the invoice. If the invoice is in SENT status and email is updated, the old email customer payment link won't work and you must resend the invoice with the new payment link.

Chase Paymentech Solutions

Optional field.

Credit Mutuel-CIC

Optional field.

OmniPay Direct

Optional field.

SIX

Optional field.

TSYS Acquiring Solutions

Required when processingInformation.billPaymentOptions.billPayment=true and pointOfSaleInformation.entryMode=keyed.

Worldpay VAP

Optional field.

All other processors

Not used.

Returns:

  • (String)


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

def email
  @email
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.

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)


71
72
73
# File 'lib/cyber_source_merged_spec/models/customer_information.rb', line 71

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_information.rb', line 14

def name
  @name
end

Class Method Details

.from_element(root) ⇒ Object



159
160
161
162
163
164
165
166
167
168
169
170
171
172
# File 'lib/cyber_source_merged_spec/models/customer_information.rb', line 159

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

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

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
# File 'lib/cyber_source_merged_spec/models/customer_information.rb', line 134

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  name = hash.key?('name') ? hash['name'] : SKIP
  email = hash.key?('email') ? hash['email'] : SKIP
  merchant_customer_id =
    hash.key?('merchantCustomerId') ? hash['merchantCustomerId'] : SKIP
  company = Company6.from_hash(hash['company']) if hash['company']

  # 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.
  CustomerInformation.new(name: name,
                          email: email,
                          merchant_customer_id: merchant_customer_id,
                          company: company,
                          additional_properties: additional_properties)
end

.namesObject

A mapping from model property names to API property names.



97
98
99
100
101
102
103
104
# File 'lib/cyber_source_merged_spec/models/customer_information.rb', line 97

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

.nullablesObject

An array for nullable fields



117
118
119
# File 'lib/cyber_source_merged_spec/models/customer_information.rb', line 117

def self.nullables
  []
end

.optionalsObject

An array for optional fields



107
108
109
110
111
112
113
114
# File 'lib/cyber_source_merged_spec/models/customer_information.rb', line 107

def self.optionals
  %w[
    name
    email
    merchant_customer_id
    company
  ]
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



197
198
199
200
201
202
# File 'lib/cyber_source_merged_spec/models/customer_information.rb', line 197

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

#to_sObject

Provides a human-readable string representation of the object.



189
190
191
192
193
194
# File 'lib/cyber_source_merged_spec/models/customer_information.rb', line 189

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

#to_xml_element(doc, root_name) ⇒ Object



174
175
176
177
178
179
180
181
182
183
184
185
186
# File 'lib/cyber_source_merged_spec/models/customer_information.rb', line 174

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, 'email', email)
  XmlUtilities.add_as_subelement(doc, root, 'merchantCustomerId',
                                 merchant_customer_id)
  XmlUtilities.add_as_subelement(doc, root, 'Company6', company)
  XmlUtilities.add_as_subelement(doc, root, 'additional_properties',
                                 additional_properties)

  root
end