Class: VisaAcceptanceMergedSpec::BillTo16

Inherits:
BaseModel
  • Object
show all
Defined in:
lib/visa_acceptance_merged_spec/models/bill_to16.rb

Overview

This information is sent to the issuer as part of network token enrollment and is not stored under the Instrument Identifier.

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(address1: SKIP, address2: SKIP, locality: SKIP, administrative_area: SKIP, postal_code: SKIP, country: SKIP, additional_properties: nil) ⇒ BillTo16

Returns a new instance of BillTo16.



79
80
81
82
83
84
85
86
87
88
89
90
91
92
# File 'lib/visa_acceptance_merged_spec/models/bill_to16.rb', line 79

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

  @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
  @country = country unless country == SKIP
  @additional_properties = additional_properties
end

Instance Attribute Details

#address1 ⇒ String

Payment card billing street address as it appears on the credit card issuer’s records.

Returns:

  • (String)


16
17
18
# File 'lib/visa_acceptance_merged_spec/models/bill_to16.rb', line 16

def address1
  @address1
end

#address2 ⇒ String

Additional address information.

Returns:

  • (String)


20
21
22
# File 'lib/visa_acceptance_merged_spec/models/bill_to16.rb', line 20

def address2
  @address2
end

#administrative_area ⇒ String

State or province of the billing address. Use the State, Province, and Territory Codes for the United States and Canada.

Returns:

  • (String)


30
31
32
# File 'lib/visa_acceptance_merged_spec/models/bill_to16.rb', line 30

def administrative_area
  @administrative_area
end

#country ⇒ String

Payment card billing country. Use the two-character ISO Standard Country Codes.

Returns:

  • (String)


48
49
50
# File 'lib/visa_acceptance_merged_spec/models/bill_to16.rb', line 48

def country
  @country
end

#locality ⇒ String

Payment card billing city.

Returns:

  • (String)


24
25
26
# File 'lib/visa_acceptance_merged_spec/models/bill_to16.rb', line 24

def locality
  @locality
end

#postal_code ⇒ String

Postal code for the billing address. The postal code must consist of 5 to 9 digits. 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

Returns:

  • (String)


43
44
45
# File 'lib/visa_acceptance_merged_spec/models/bill_to16.rb', line 43

def postal_code
  @postal_code
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
# File 'lib/visa_acceptance_merged_spec/models/bill_to16.rb', line 95

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  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
  country = hash.key?('country') ? hash['country'] : 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.
  BillTo16.new(address1: address1,
               address2: address2,
               locality: locality,
               administrative_area: administrative_area,
               postal_code: postal_code,
               country: country,
               additional_properties: additional_properties)
end

.names ⇒ Object

A mapping from model property names to API property names.



51
52
53
54
55
56
57
58
59
60
# File 'lib/visa_acceptance_merged_spec/models/bill_to16.rb', line 51

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['address1'] = 'address1'
  @_hash['address2'] = 'address2'
  @_hash['locality'] = 'locality'
  @_hash['administrative_area'] = 'administrativeArea'
  @_hash['postal_code'] = 'postalCode'
  @_hash['country'] = 'country'
  @_hash
end

.nullables ⇒ Object

An array for nullable fields



75
76
77
# File 'lib/visa_acceptance_merged_spec/models/bill_to16.rb', line 75

def self.nullables
  []
end

.optionals ⇒ Object

An array for optional fields



63
64
65
66
67
68
69
70
71
72
# File 'lib/visa_acceptance_merged_spec/models/bill_to16.rb', line 63

def self.optionals
  %w[
    address1
    address2
    locality
    administrative_area
    postal_code
    country
  ]
end

Instance Method Details

#inspect ⇒ Object

Provides a debugging-friendly string with detailed object information.



133
134
135
136
137
138
139
# File 'lib/visa_acceptance_merged_spec/models/bill_to16.rb', line 133

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

#to_s ⇒ Object

Provides a human-readable string representation of the object.



125
126
127
128
129
130
# File 'lib/visa_acceptance_merged_spec/models/bill_to16.rb', line 125

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