Class: CyberSourceMergedSpec::AcquirerInformation

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

Overview

AcquirerInformation 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(acquirer_bin: SKIP, country: SKIP, password: SKIP, merchant_id: SKIP, acquirer_merchant_id: SKIP, additional_properties: nil) ⇒ AcquirerInformation

Returns a new instance of AcquirerInformation.



66
67
68
69
70
71
72
73
74
75
76
77
78
# File 'lib/cyber_source_merged_spec/models/acquirer_information.rb', line 66

def initialize(acquirer_bin: SKIP, country: SKIP, password: SKIP,
               merchant_id: SKIP, acquirer_merchant_id: SKIP,
               additional_properties: nil)
  # Add additional model properties to the instance
  additional_properties = {} if additional_properties.nil?

  @acquirer_bin = acquirer_bin unless acquirer_bin == SKIP
  @country = country unless country == SKIP
  @password = password unless password == SKIP
  @merchant_id = merchant_id unless merchant_id == SKIP
  @acquirer_merchant_id = acquirer_merchant_id unless acquirer_merchant_id == SKIP
  @additional_properties = additional_properties
end

Instance Attribute Details

#acquirer_binString

Acquirer bank ID number that corresponds to a certificate that Cybersource already has.This ID has this format. 4XXXXX for Visa and 5XXXXX for Mastercard.

Returns:

  • (String)


16
17
18
# File 'lib/cyber_source_merged_spec/models/acquirer_information.rb', line 16

def acquirer_bin
  @acquirer_bin
end

#acquirer_merchant_idString

Acquirer assigned merchant id. Check if your processor supports this field.

Returns:

  • (String)


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

def acquirer_merchant_id
  @acquirer_merchant_id
end

#countryString

Issuers need to be aware of the Acquirer's Country Code when the Acquirer country differs from the Merchant country and the Acquirer is in the EEA (European Economic Area).

Returns:

  • (String)


22
23
24
# File 'lib/cyber_source_merged_spec/models/acquirer_information.rb', line 22

def country
  @country
end

#merchant_idString

Username for the visa directory server that is created when your acquirer sets up your account. This ID might be the same as your merchant ID. the username can be 15 or 23 characters.

Returns:

  • (String)


32
33
34
# File 'lib/cyber_source_merged_spec/models/acquirer_information.rb', line 32

def merchant_id
  @merchant_id
end

#passwordString

Registered password for the Visa directory server.

Returns:

  • (String)


26
27
28
# File 'lib/cyber_source_merged_spec/models/acquirer_information.rb', line 26

def password
  @password
end

Class Method Details

.from_element(root) ⇒ Object



108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
# File 'lib/cyber_source_merged_spec/models/acquirer_information.rb', line 108

def self.from_element(root)
  acquirer_bin = XmlUtilities.from_element(root, 'acquirerBin', String)
  country = XmlUtilities.from_element(root, 'country', String)
  password = XmlUtilities.from_element(root, 'password', String)
  merchant_id = XmlUtilities.from_element(root, 'merchantId', String)
  acquirer_merchant_id = XmlUtilities.from_element(root,
                                                   'acquirerMerchantId',
                                                   String)

  new(acquirer_bin: acquirer_bin,
      country: country,
      password: password,
      merchant_id: merchant_id,
      acquirer_merchant_id: acquirer_merchant_id,
      additional_properties: additional_properties)
end

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
# File 'lib/cyber_source_merged_spec/models/acquirer_information.rb', line 81

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  acquirer_bin = hash.key?('acquirerBin') ? hash['acquirerBin'] : SKIP
  country = hash.key?('country') ? hash['country'] : SKIP
  password = hash.key?('password') ? hash['password'] : SKIP
  merchant_id = hash.key?('merchantId') ? hash['merchantId'] : SKIP
  acquirer_merchant_id =
    hash.key?('acquirerMerchantId') ? hash['acquirerMerchantId'] : 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.
  AcquirerInformation.new(acquirer_bin: acquirer_bin,
                          country: country,
                          password: password,
                          merchant_id: merchant_id,
                          acquirer_merchant_id: acquirer_merchant_id,
                          additional_properties: additional_properties)
end

.namesObject

A mapping from model property names to API property names.



40
41
42
43
44
45
46
47
48
# File 'lib/cyber_source_merged_spec/models/acquirer_information.rb', line 40

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['acquirer_bin'] = 'acquirerBin'
  @_hash['country'] = 'country'
  @_hash['password'] = 'password'
  @_hash['merchant_id'] = 'merchantId'
  @_hash['acquirer_merchant_id'] = 'acquirerMerchantId'
  @_hash
end

.nullablesObject

An array for nullable fields



62
63
64
# File 'lib/cyber_source_merged_spec/models/acquirer_information.rb', line 62

def self.nullables
  []
end

.optionalsObject

An array for optional fields



51
52
53
54
55
56
57
58
59
# File 'lib/cyber_source_merged_spec/models/acquirer_information.rb', line 51

def self.optionals
  %w[
    acquirer_bin
    country
    password
    merchant_id
    acquirer_merchant_id
  ]
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



149
150
151
152
153
154
155
# File 'lib/cyber_source_merged_spec/models/acquirer_information.rb', line 149

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

#to_sObject

Provides a human-readable string representation of the object.



141
142
143
144
145
146
# File 'lib/cyber_source_merged_spec/models/acquirer_information.rb', line 141

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

#to_xml_element(doc, root_name) ⇒ Object



125
126
127
128
129
130
131
132
133
134
135
136
137
138
# File 'lib/cyber_source_merged_spec/models/acquirer_information.rb', line 125

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

  XmlUtilities.add_as_subelement(doc, root, 'acquirerBin', acquirer_bin)
  XmlUtilities.add_as_subelement(doc, root, 'country', country)
  XmlUtilities.add_as_subelement(doc, root, 'password', password)
  XmlUtilities.add_as_subelement(doc, root, 'merchantId', merchant_id)
  XmlUtilities.add_as_subelement(doc, root, 'acquirerMerchantId',
                                 acquirer_merchant_id)
  XmlUtilities.add_as_subelement(doc, root, 'additional_properties',
                                 additional_properties)

  root
end