Class: VisaAcceptanceMergedSpec::BuyerInformation1

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

Overview

BuyerInformation1 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, vat_registration_number: SKIP, personal_identification: SKIP, tax_id: SKIP, login_id: SKIP, additional_properties: nil) ⇒ BuyerInformation1

Returns a new instance of BuyerInformation1.



97
98
99
100
101
102
103
104
105
106
107
108
109
110
# File 'lib/visa_acceptance_merged_spec/models/buyer_information1.rb', line 97

def initialize(merchant_customer_id: SKIP, date_of_birth: SKIP,
               vat_registration_number: SKIP, personal_identification: SKIP,
               tax_id: SKIP, login_id: 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
  @vat_registration_number = vat_registration_number unless vat_registration_number == SKIP
  @personal_identification = personal_identification unless personal_identification == SKIP
  @tax_id = tax_id unless tax_id == SKIP
  @login_id =  unless  == 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 Visa Acceptance 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, Visa Acceptance does not forward it to the processor.

Returns:

  • (String)


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

def date_of_birth
  @date_of_birth
end

#login_idString

The buyer’s Alipay login Id, the id might be an email or mobile number. The id is partially masked for privacy. cao***@126.com or 186***22156

Returns:

  • (String)


66
67
68
# File 'lib/visa_acceptance_merged_spec/models/buyer_information1.rb', line 66

def 
  @login_id
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, Visa Acceptance 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)


33
34
35
# File 'lib/visa_acceptance_merged_spec/models/buyer_information1.rb', line 33

def merchant_customer_id
  @merchant_customer_id
end

#personal_identificationArray[PersonalIdentification]

Customer’s government-assigned tax identification number.

Tax Calculation

Optional for international and value added taxes only. Not applicable to U.S. and Canadian taxes.

Returns:



57
58
59
# File 'lib/visa_acceptance_merged_spec/models/buyer_information1.rb', line 57

def personal_identification
  @personal_identification
end

#tax_idString

The description for this field is not available.

Returns:

  • (String)


61
62
63
# File 'lib/visa_acceptance_merged_spec/models/buyer_information1.rb', line 61

def tax_id
  @tax_id
end

#vat_registration_numberString

Customer’s government-assigned tax identification number.

Tax Calculation

Optional for international and value added taxes only. Not applicable to U.S. and Canadian taxes.

Returns:

  • (String)


50
51
52
# File 'lib/visa_acceptance_merged_spec/models/buyer_information1.rb', line 50

def vat_registration_number
  @vat_registration_number
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
# File 'lib/visa_acceptance_merged_spec/models/buyer_information1.rb', line 113

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
  vat_registration_number =
    hash.key?('vatRegistrationNumber') ? hash['vatRegistrationNumber'] : SKIP
  # Parameter is an array, so we need to iterate through it
  personal_identification = nil
  unless hash['personalIdentification'].nil?
    personal_identification = []
    hash['personalIdentification'].each do |structure|
      personal_identification << (PersonalIdentification.from_hash(structure) if structure)
    end
  end

  personal_identification = SKIP unless hash.key?('personalIdentification')
  tax_id = hash.key?('taxId') ? hash['taxId'] : SKIP
   = hash.key?('loginId') ? hash['loginId'] : 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.
  BuyerInformation1.new(merchant_customer_id: merchant_customer_id,
                        date_of_birth: date_of_birth,
                        vat_registration_number: vat_registration_number,
                        personal_identification: personal_identification,
                        tax_id: tax_id,
                        login_id: ,
                        additional_properties: additional_properties)
end

.namesObject

A mapping from model property names to API property names.



69
70
71
72
73
74
75
76
77
78
# File 'lib/visa_acceptance_merged_spec/models/buyer_information1.rb', line 69

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['merchant_customer_id'] = 'merchantCustomerId'
  @_hash['date_of_birth'] = 'dateOfBirth'
  @_hash['vat_registration_number'] = 'vatRegistrationNumber'
  @_hash['personal_identification'] = 'personalIdentification'
  @_hash['tax_id'] = 'taxId'
  @_hash['login_id'] = 'loginId'
  @_hash
end

.nullablesObject

An array for nullable fields



93
94
95
# File 'lib/visa_acceptance_merged_spec/models/buyer_information1.rb', line 93

def self.nullables
  []
end

.optionalsObject

An array for optional fields



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

def self.optionals
  %w[
    merchant_customer_id
    date_of_birth
    vat_registration_number
    personal_identification
    tax_id
    login_id
  ]
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



162
163
164
165
166
167
168
# File 'lib/visa_acceptance_merged_spec/models/buyer_information1.rb', line 162

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}, vat_registration_number: #{@vat_registration_number.inspect},"\
  " personal_identification: #{@personal_identification.inspect}, tax_id: #{@tax_id.inspect},"\
  " login_id: #{@login_id.inspect}, additional_properties: #{@additional_properties}>"
end

#to_sObject

Provides a human-readable string representation of the object.



153
154
155
156
157
158
159
# File 'lib/visa_acceptance_merged_spec/models/buyer_information1.rb', line 153

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