Class: CyberSourceMergedSpec::ShipTo33

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

Overview

ShipTo33 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(first_name: SKIP, last_name: SKIP, address1: SKIP, address2: SKIP, locality: SKIP, administrative_area: SKIP, postal_code: SKIP, company: SKIP, country: SKIP, phone_number: SKIP, additional_properties: nil) ⇒ ShipTo33

Returns a new instance of ShipTo33.



183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
# File 'lib/cyber_source_merged_spec/models/ship_to33.rb', line 183

def initialize(first_name: SKIP, last_name: SKIP, address1: SKIP,
               address2: SKIP, locality: SKIP, administrative_area: SKIP,
               postal_code: SKIP, company: SKIP, country: SKIP,
               phone_number: SKIP, additional_properties: nil)
  # Add additional model properties to the instance
  additional_properties = {} if additional_properties.nil?

  @first_name = first_name unless first_name == SKIP
  @last_name = last_name unless last_name == SKIP
  @address1 = address1 unless address1 == SKIP
  @address2 = address2 unless address2 == SKIP
  @locality = locality unless locality == SKIP
  @administrative_area = administrative_area unless administrative_area == SKIP
  @postal_code = postal_code unless postal_code == SKIP
  @company = company unless company == SKIP
  @country = country unless country == SKIP
  @phone_number = phone_number unless phone_number == SKIP
  @additional_properties = additional_properties
end

Instance Attribute Details

#address1String

First line of the shipping address. Required field for authorization if any shipping address information is included in the request; otherwise, optional.

Tax Calculation

Optional field for U.S. and Canadian taxes. Not applicable to international and value added taxes. Billing address objects will be used to determine the cardholder’s location when shipTo objects are not present.

Returns:

  • (String)


39
40
41
# File 'lib/cyber_source_merged_spec/models/ship_to33.rb', line 39

def address1
  @address1
end

#address2String

Second line of the shipping address. Optional field.

Tax Calculation

Optional field for U.S. and Canadian taxes. Not applicable to international and value added taxes. Billing address objects will be used to determine the cardholder’s location when shipTo objects are not present.

Returns:

  • (String)


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

def address2
  @address2
end

#administrative_areaString

State or province of the billing address. Use the [State, Province, and Territory Codes for the United States and Canada](https://developer.cybersource.com/library/documentation/sbc/quickr ef/states_and_provinces.pdf). For Payouts: This field may be sent only for FDC Compass.

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.

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)


96
97
98
# File 'lib/cyber_source_merged_spec/models/ship_to33.rb', line 96

def administrative_area
  @administrative_area
end

#companyString

Name of the customer’s company.

Returns:

  • (String)


126
127
128
# File 'lib/cyber_source_merged_spec/models/ship_to33.rb', line 126

def company
  @company
end

#countryString

Country of the shipping address. Use the two-character [ISO Standard Country Codes.](http://apps.cybersource.com/library/documentation/sbc/quickref/cou ntries_alpha_list.pdf) Required field for authorization if any shipping address information is included in the request; otherwise, optional.

Tax Calculation

Optional field for U.S., Canadian, international tax, and value added taxes. Billing address objects will be used to determine the cardholder’s location when shipTo objects are not present.

Returns:

  • (String)


140
141
142
# File 'lib/cyber_source_merged_spec/models/ship_to33.rb', line 140

def country
  @country
end

#first_nameString

First name of the recipient.

Litle

Maximum length: 25

All other processors

Maximum length: 60 Optional field.

Returns:

  • (String)


19
20
21
# File 'lib/cyber_source_merged_spec/models/ship_to33.rb', line 19

def first_name
  @first_name
end

#last_nameString

Last name of the recipient.

Litle

Maximum length: 25

All other processors

Maximum length: 60 Optional field.

Returns:

  • (String)


28
29
30
# File 'lib/cyber_source_merged_spec/models/ship_to33.rb', line 28

def last_name
  @last_name
end

#localityString

City of the shipping address. Required field for authorization if any shipping address information is included in the request and shipping to the U.S. or Canada; otherwise, optional.

Tax Calculation

Optional field for U.S. and Canadian taxes. Not applicable to international and value added taxes. Billing address objects will be used to determine the cardholder’s location when shipTo objects are not present.

Returns:

  • (String)


61
62
63
# File 'lib/cyber_source_merged_spec/models/ship_to33.rb', line 61

def locality
  @locality
end

#phone_numberString

Phone number associated with the shipping address.

Returns:

  • (String)


144
145
146
# File 'lib/cyber_source_merged_spec/models/ship_to33.rb', line 144

def phone_number
  @phone_number
end

#postal_codeString

Postal code for the shipping address. The postal code must consist of 5 to 9 digits. Required field for authorization if any shipping address information is included in the request and shipping to the U.S. or Canada; otherwise, optional. When the billing country is the U.S., the 9-digit postal code must follow this format: [5 digits][dash][4 digits] Example 12345-6789 When the billing country is Canada, the 6-digit postal code must follow this format: [alpha][numeric][alpha][space][numeric][alpha][numeric] Example A1B 2C3

American Express Direct

Before sending the postal code to the processor, all nonalphanumeric characters are removed and, if the remaining value is longer than nine characters, the value is truncated starting from the right side.

Tax Calculation

Optional field for U.S. and Canadian taxes. Not applicable to international and value added taxes. Billing address objects will be used to determine the cardholder’s location when shipTo objects are not present.

Returns:

  • (String)


122
123
124
# File 'lib/cyber_source_merged_spec/models/ship_to33.rb', line 122

def postal_code
  @postal_code
end

Class Method Details

.from_element(root) ⇒ Object



241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
# File 'lib/cyber_source_merged_spec/models/ship_to33.rb', line 241

def self.from_element(root)
  first_name = XmlUtilities.from_element(root, 'firstName', String)
  last_name = XmlUtilities.from_element(root, 'lastName', String)
  address1 = XmlUtilities.from_element(root, 'address1', String)
  address2 = XmlUtilities.from_element(root, 'address2', String)
  locality = XmlUtilities.from_element(root, 'locality', String)
  administrative_area = XmlUtilities.from_element(root,
                                                  'administrativeArea',
                                                  String)
  postal_code = XmlUtilities.from_element(root, 'postalCode', String)
  company = XmlUtilities.from_element(root, 'company', String)
  country = XmlUtilities.from_element(root, 'country', String)
  phone_number = XmlUtilities.from_element(root, 'phoneNumber', String)

  new(first_name: first_name,
      last_name: last_name,
      address1: address1,
      address2: address2,
      locality: locality,
      administrative_area: administrative_area,
      postal_code: postal_code,
      company: company,
      country: country,
      phone_number: phone_number,
      additional_properties: additional_properties)
end

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
# File 'lib/cyber_source_merged_spec/models/ship_to33.rb', line 204

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  first_name = hash.key?('firstName') ? hash['firstName'] : SKIP
  last_name = hash.key?('lastName') ? hash['lastName'] : SKIP
  address1 = hash.key?('address1') ? hash['address1'] : SKIP
  address2 = hash.key?('address2') ? hash['address2'] : SKIP
  locality = hash.key?('locality') ? hash['locality'] : SKIP
  administrative_area =
    hash.key?('administrativeArea') ? hash['administrativeArea'] : SKIP
  postal_code = hash.key?('postalCode') ? hash['postalCode'] : SKIP
  company = hash.key?('company') ? hash['company'] : SKIP
  country = hash.key?('country') ? hash['country'] : SKIP
  phone_number = hash.key?('phoneNumber') ? hash['phoneNumber'] : 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.
  ShipTo33.new(first_name: first_name,
               last_name: last_name,
               address1: address1,
               address2: address2,
               locality: locality,
               administrative_area: administrative_area,
               postal_code: postal_code,
               company: company,
               country: country,
               phone_number: phone_number,
               additional_properties: additional_properties)
end

.namesObject

A mapping from model property names to API property names.



147
148
149
150
151
152
153
154
155
156
157
158
159
160
# File 'lib/cyber_source_merged_spec/models/ship_to33.rb', line 147

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['first_name'] = 'firstName'
  @_hash['last_name'] = 'lastName'
  @_hash['address1'] = 'address1'
  @_hash['address2'] = 'address2'
  @_hash['locality'] = 'locality'
  @_hash['administrative_area'] = 'administrativeArea'
  @_hash['postal_code'] = 'postalCode'
  @_hash['company'] = 'company'
  @_hash['country'] = 'country'
  @_hash['phone_number'] = 'phoneNumber'
  @_hash
end

.nullablesObject

An array for nullable fields



179
180
181
# File 'lib/cyber_source_merged_spec/models/ship_to33.rb', line 179

def self.nullables
  []
end

.optionalsObject

An array for optional fields



163
164
165
166
167
168
169
170
171
172
173
174
175
176
# File 'lib/cyber_source_merged_spec/models/ship_to33.rb', line 163

def self.optionals
  %w[
    first_name
    last_name
    address1
    address2
    locality
    administrative_area
    postal_code
    company
    country
    phone_number
  ]
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



299
300
301
302
303
304
305
306
# File 'lib/cyber_source_merged_spec/models/ship_to33.rb', line 299

def inspect
  class_name = self.class.name.split('::').last
  "<#{class_name} first_name: #{@first_name.inspect}, last_name: #{@last_name.inspect},"\
  " address1: #{@address1.inspect}, address2: #{@address2.inspect}, locality:"\
  " #{@locality.inspect}, administrative_area: #{@administrative_area.inspect}, postal_code:"\
  " #{@postal_code.inspect}, company: #{@company.inspect}, country: #{@country.inspect},"\
  " phone_number: #{@phone_number.inspect}, additional_properties: #{@additional_properties}>"
end

#to_sObject

Provides a human-readable string representation of the object.



289
290
291
292
293
294
295
296
# File 'lib/cyber_source_merged_spec/models/ship_to33.rb', line 289

def to_s
  class_name = self.class.name.split('::').last
  "<#{class_name} first_name: #{@first_name}, last_name: #{@last_name}, address1:"\
  " #{@address1}, address2: #{@address2}, locality: #{@locality}, administrative_area:"\
  " #{@administrative_area}, postal_code: #{@postal_code}, company: #{@company}, country:"\
  " #{@country}, phone_number: #{@phone_number}, additional_properties:"\
  " #{@additional_properties}>"
end

#to_xml_element(doc, root_name) ⇒ Object



268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
# File 'lib/cyber_source_merged_spec/models/ship_to33.rb', line 268

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

  XmlUtilities.add_as_subelement(doc, root, 'firstName', first_name)
  XmlUtilities.add_as_subelement(doc, root, 'lastName', last_name)
  XmlUtilities.add_as_subelement(doc, root, 'address1', address1)
  XmlUtilities.add_as_subelement(doc, root, 'address2', address2)
  XmlUtilities.add_as_subelement(doc, root, 'locality', locality)
  XmlUtilities.add_as_subelement(doc, root, 'administrativeArea',
                                 administrative_area)
  XmlUtilities.add_as_subelement(doc, root, 'postalCode', postal_code)
  XmlUtilities.add_as_subelement(doc, root, 'company', company)
  XmlUtilities.add_as_subelement(doc, root, 'country', country)
  XmlUtilities.add_as_subelement(doc, root, 'phoneNumber', phone_number)
  XmlUtilities.add_as_subelement(doc, root, 'additional_properties',
                                 additional_properties)

  root
end