Class: CyberSourceMergedSpec::MerchantInformation1

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

Overview

MerchantInformation1 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_name: SKIP, merchant_descriptor: SKIP, category_code: SKIP, return_url: SKIP, additional_properties: nil) ⇒ MerchantInformation1

Returns a new instance of MerchantInformation1.



69
70
71
72
73
74
75
76
77
78
79
80
# File 'lib/cyber_source_merged_spec/models/merchant_information1.rb', line 69

def initialize(merchant_name: SKIP, merchant_descriptor: SKIP,
               category_code: SKIP, return_url: SKIP,
               additional_properties: nil)
  # Add additional model properties to the instance
  additional_properties = {} if additional_properties.nil?

  @merchant_name = merchant_name unless merchant_name == SKIP
  @merchant_descriptor = merchant_descriptor unless merchant_descriptor == SKIP
  @category_code = category_code unless category_code == SKIP
  @return_url = return_url unless return_url == SKIP
  @additional_properties = additional_properties
end

Instance Attribute Details

#category_codeString

The value for this field is a four-digit number that the payment card industry uses to classify merchants into market segments. A payment card company assigned one or more of these values to your business when you started accepting the payment card company's cards. When you do not include this field in your request, Cybersource uses the value in your Cybersource account. Use this field only for clearing with your acquirer.

Returns:

  • (String)


36
37
38
# File 'lib/cyber_source_merged_spec/models/merchant_information1.rb', line 36

def category_code
  @category_code
end

#merchant_descriptorMerchantDescriptor1

Use this field only if you are requesting payment with Payer Authentication serice together. Your company’s name as you want it to appear to the customer in the issuing bank’s authentication form. This value overrides the value specified by your merchant bank.

Returns:



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

def merchant_descriptor
  @merchant_descriptor
end

#merchant_nameString

Use this field only if you are requesting payment with Payer Authentication serice together. Your company’s name as you want it to appear to the customer in the issuing bank’s authentication form. This value overrides the value specified by your merchant bank.

Returns:

  • (String)


18
19
20
# File 'lib/cyber_source_merged_spec/models/merchant_information1.rb', line 18

def merchant_name
  @merchant_name
end

#return_urlString

URL for displaying payment results to the consumer (notifications) after the transaction is processed. Usually this URL belongs to merchant and its behavior is defined by merchant

Returns:

  • (String)


42
43
44
# File 'lib/cyber_source_merged_spec/models/merchant_information1.rb', line 42

def return_url
  @return_url
end

Class Method Details

.from_element(root) ⇒ Object



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

def self.from_element(root)
  merchant_name = XmlUtilities.from_element(root, 'merchantName', String)
  merchant_descriptor = XmlUtilities.from_element(root,
                                                  'MerchantDescriptor1',
                                                  MerchantDescriptor1)
  category_code = XmlUtilities.from_element(root, 'categoryCode', String)
  return_url = XmlUtilities.from_element(root, 'returnUrl', String)

  new(merchant_name: merchant_name,
      merchant_descriptor: merchant_descriptor,
      category_code: category_code,
      return_url: return_url,
      additional_properties: additional_properties)
end

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



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/merchant_information1.rb', line 83

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  merchant_name = hash.key?('merchantName') ? hash['merchantName'] : SKIP
  merchant_descriptor = MerchantDescriptor1.from_hash(hash['merchantDescriptor']) if
    hash['merchantDescriptor']
  category_code = hash.key?('categoryCode') ? hash['categoryCode'] : SKIP
  return_url = hash.key?('returnUrl') ? hash['returnUrl'] : 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.
  MerchantInformation1.new(merchant_name: merchant_name,
                           merchant_descriptor: merchant_descriptor,
                           category_code: category_code,
                           return_url: return_url,
                           additional_properties: additional_properties)
end

.namesObject

A mapping from model property names to API property names.



45
46
47
48
49
50
51
52
# File 'lib/cyber_source_merged_spec/models/merchant_information1.rb', line 45

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['merchant_name'] = 'merchantName'
  @_hash['merchant_descriptor'] = 'merchantDescriptor'
  @_hash['category_code'] = 'categoryCode'
  @_hash['return_url'] = 'returnUrl'
  @_hash
end

.nullablesObject

An array for nullable fields



65
66
67
# File 'lib/cyber_source_merged_spec/models/merchant_information1.rb', line 65

def self.nullables
  []
end

.optionalsObject

An array for optional fields



55
56
57
58
59
60
61
62
# File 'lib/cyber_source_merged_spec/models/merchant_information1.rb', line 55

def self.optionals
  %w[
    merchant_name
    merchant_descriptor
    category_code
    return_url
  ]
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



146
147
148
149
150
151
# File 'lib/cyber_source_merged_spec/models/merchant_information1.rb', line 146

def inspect
  class_name = self.class.name.split('::').last
  "<#{class_name} merchant_name: #{@merchant_name.inspect}, merchant_descriptor:"\
  " #{@merchant_descriptor.inspect}, category_code: #{@category_code.inspect}, return_url:"\
  " #{@return_url.inspect}, additional_properties: #{@additional_properties}>"
end

#to_sObject

Provides a human-readable string representation of the object.



138
139
140
141
142
143
# File 'lib/cyber_source_merged_spec/models/merchant_information1.rb', line 138

def to_s
  class_name = self.class.name.split('::').last
  "<#{class_name} merchant_name: #{@merchant_name}, merchant_descriptor:"\
  " #{@merchant_descriptor}, category_code: #{@category_code}, return_url: #{@return_url},"\
  " additional_properties: #{@additional_properties}>"
end

#to_xml_element(doc, root_name) ⇒ Object



123
124
125
126
127
128
129
130
131
132
133
134
135
# File 'lib/cyber_source_merged_spec/models/merchant_information1.rb', line 123

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

  XmlUtilities.add_as_subelement(doc, root, 'merchantName', merchant_name)
  XmlUtilities.add_as_subelement(doc, root, 'MerchantDescriptor1',
                                 merchant_descriptor)
  XmlUtilities.add_as_subelement(doc, root, 'categoryCode', category_code)
  XmlUtilities.add_as_subelement(doc, root, 'returnUrl', return_url)
  XmlUtilities.add_as_subelement(doc, root, 'additional_properties',
                                 additional_properties)

  root
end