Class: CyberSourceMergedSpec::FeeAndFundingDetail

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

Overview

Fee Funding Section

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(request_id: SKIP, interchange_per_item_fee: SKIP, interchange_description: SKIP, interchange_percentage: SKIP, interchange_percentage_amount: SKIP, discount_percentage: SKIP, discount_amount: SKIP, discount_per_item_fee: SKIP, total_fee: SKIP, fee_currency: SKIP, dues_assessments: SKIP, funding_amount: SKIP, funding_currency: SKIP, additional_properties: nil) ⇒ FeeAndFundingDetail

Returns a new instance of FeeAndFundingDetail.



108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
# File 'lib/cyber_source_merged_spec/models/fee_and_funding_detail.rb', line 108

def initialize(request_id: SKIP, interchange_per_item_fee: SKIP,
               interchange_description: SKIP, interchange_percentage: SKIP,
               interchange_percentage_amount: SKIP,
               discount_percentage: SKIP, discount_amount: SKIP,
               discount_per_item_fee: SKIP, total_fee: SKIP,
               fee_currency: SKIP, dues_assessments: SKIP,
               funding_amount: SKIP, funding_currency: SKIP,
               additional_properties: nil)
  # Add additional model properties to the instance
  additional_properties = {} if additional_properties.nil?

  @request_id = request_id unless request_id == SKIP
  @interchange_per_item_fee = interchange_per_item_fee unless interchange_per_item_fee == SKIP
  @interchange_description = interchange_description unless interchange_description == SKIP
  @interchange_percentage = interchange_percentage unless interchange_percentage == SKIP
  unless interchange_percentage_amount == SKIP
    @interchange_percentage_amount =
      interchange_percentage_amount
  end
  @discount_percentage = discount_percentage unless discount_percentage == SKIP
  @discount_amount = discount_amount unless discount_amount == SKIP
  @discount_per_item_fee = discount_per_item_fee unless discount_per_item_fee == SKIP
  @total_fee = total_fee unless total_fee == SKIP
  @fee_currency = fee_currency unless fee_currency == SKIP
  @dues_assessments = dues_assessments unless dues_assessments == SKIP
  @funding_amount = funding_amount unless funding_amount == SKIP
  @funding_currency = funding_currency unless funding_currency == SKIP
  @additional_properties = additional_properties
end

Instance Attribute Details

#discount_amountString

Discount Amount

Returns:

  • (String)


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

def discount_amount
  @discount_amount
end

#discount_per_item_feeString

Discount Per Item Fee

Returns:

  • (String)


43
44
45
# File 'lib/cyber_source_merged_spec/models/fee_and_funding_detail.rb', line 43

def discount_per_item_fee
  @discount_per_item_fee
end

#discount_percentageString

Discount Percentage

Returns:

  • (String)


35
36
37
# File 'lib/cyber_source_merged_spec/models/fee_and_funding_detail.rb', line 35

def discount_percentage
  @discount_percentage
end

#dues_assessmentsString

Dues Assessments

Returns:

  • (String)


55
56
57
# File 'lib/cyber_source_merged_spec/models/fee_and_funding_detail.rb', line 55

def dues_assessments
  @dues_assessments
end

#fee_currencyString

Fee Currency

Returns:

  • (String)


51
52
53
# File 'lib/cyber_source_merged_spec/models/fee_and_funding_detail.rb', line 51

def fee_currency
  @fee_currency
end

#funding_amountString

Funding Amount

Returns:

  • (String)


59
60
61
# File 'lib/cyber_source_merged_spec/models/fee_and_funding_detail.rb', line 59

def funding_amount
  @funding_amount
end

#funding_currencyString

Funding Currency (ISO 4217)

Returns:

  • (String)


63
64
65
# File 'lib/cyber_source_merged_spec/models/fee_and_funding_detail.rb', line 63

def funding_currency
  @funding_currency
end

#interchange_descriptionString

interchange Description

Returns:

  • (String)


23
24
25
# File 'lib/cyber_source_merged_spec/models/fee_and_funding_detail.rb', line 23

def interchange_description
  @interchange_description
end

#interchange_per_item_feeString

interchange Per Item Fee

Returns:

  • (String)


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

def interchange_per_item_fee
  @interchange_per_item_fee
end

#interchange_percentageString

interchange Percentage

Returns:

  • (String)


27
28
29
# File 'lib/cyber_source_merged_spec/models/fee_and_funding_detail.rb', line 27

def interchange_percentage
  @interchange_percentage
end

#interchange_percentage_amountString

interchange Percentage Amount

Returns:

  • (String)


31
32
33
# File 'lib/cyber_source_merged_spec/models/fee_and_funding_detail.rb', line 31

def interchange_percentage_amount
  @interchange_percentage_amount
end

#request_idString

An unique identification number assigned by CyberSource to identify the submitted request.

Returns:

  • (String)


15
16
17
# File 'lib/cyber_source_merged_spec/models/fee_and_funding_detail.rb', line 15

def request_id
  @request_id
end

#total_feeString

Total Fee

Returns:

  • (String)


47
48
49
# File 'lib/cyber_source_merged_spec/models/fee_and_funding_detail.rb', line 47

def total_fee
  @total_fee
end

Class Method Details

.from_element(root) ⇒ Object



190
191
192
193
194
195
196
197
198
199
200
201
202
203
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
# File 'lib/cyber_source_merged_spec/models/fee_and_funding_detail.rb', line 190

def self.from_element(root)
  request_id = XmlUtilities.from_element(root, 'requestId', String)
  interchange_per_item_fee = XmlUtilities.from_element(
    root, 'interchangePerItemFee', String
  )
  interchange_description = XmlUtilities.from_element(
    root, 'interchangeDescription', String
  )
  interchange_percentage = XmlUtilities.from_element(
    root, 'interchangePercentage', String
  )
  interchange_percentage_amount = XmlUtilities.from_element(
    root, 'interchangePercentageAmount', String
  )
  discount_percentage = XmlUtilities.from_element(root,
                                                  'discountPercentage',
                                                  String)
  discount_amount = XmlUtilities.from_element(root, 'discountAmount',
                                              String)
  discount_per_item_fee = XmlUtilities.from_element(root,
                                                    'discountPerItemFee',
                                                    String)
  total_fee = XmlUtilities.from_element(root, 'totalFee', String)
  fee_currency = XmlUtilities.from_element(root, 'feeCurrency', String)
  dues_assessments = XmlUtilities.from_element(root, 'duesAssessments',
                                               String)
  funding_amount = XmlUtilities.from_element(root, 'fundingAmount', String)
  funding_currency = XmlUtilities.from_element(root, 'fundingCurrency',
                                               String)

  new(request_id: request_id,
      interchange_per_item_fee: interchange_per_item_fee,
      interchange_description: interchange_description,
      interchange_percentage: interchange_percentage,
      interchange_percentage_amount: interchange_percentage_amount,
      discount_percentage: discount_percentage,
      discount_amount: discount_amount,
      discount_per_item_fee: discount_per_item_fee,
      total_fee: total_fee,
      fee_currency: fee_currency,
      dues_assessments: dues_assessments,
      funding_amount: funding_amount,
      funding_currency: funding_currency,
      additional_properties: additional_properties)
end

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
# File 'lib/cyber_source_merged_spec/models/fee_and_funding_detail.rb', line 139

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  request_id = hash.key?('requestId') ? hash['requestId'] : SKIP
  interchange_per_item_fee =
    hash.key?('interchangePerItemFee') ? hash['interchangePerItemFee'] : SKIP
  interchange_description =
    hash.key?('interchangeDescription') ? hash['interchangeDescription'] : SKIP
  interchange_percentage =
    hash.key?('interchangePercentage') ? hash['interchangePercentage'] : SKIP
  interchange_percentage_amount =
    hash.key?('interchangePercentageAmount') ? hash['interchangePercentageAmount'] : SKIP
  discount_percentage =
    hash.key?('discountPercentage') ? hash['discountPercentage'] : SKIP
  discount_amount =
    hash.key?('discountAmount') ? hash['discountAmount'] : SKIP
  discount_per_item_fee =
    hash.key?('discountPerItemFee') ? hash['discountPerItemFee'] : SKIP
  total_fee = hash.key?('totalFee') ? hash['totalFee'] : SKIP
  fee_currency = hash.key?('feeCurrency') ? hash['feeCurrency'] : SKIP
  dues_assessments =
    hash.key?('duesAssessments') ? hash['duesAssessments'] : SKIP
  funding_amount = hash.key?('fundingAmount') ? hash['fundingAmount'] : SKIP
  funding_currency =
    hash.key?('fundingCurrency') ? hash['fundingCurrency'] : 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.
  FeeAndFundingDetail.new(request_id: request_id,
                          interchange_per_item_fee: interchange_per_item_fee,
                          interchange_description: interchange_description,
                          interchange_percentage: interchange_percentage,
                          interchange_percentage_amount: interchange_percentage_amount,
                          discount_percentage: discount_percentage,
                          discount_amount: discount_amount,
                          discount_per_item_fee: discount_per_item_fee,
                          total_fee: total_fee,
                          fee_currency: fee_currency,
                          dues_assessments: dues_assessments,
                          funding_amount: funding_amount,
                          funding_currency: funding_currency,
                          additional_properties: additional_properties)
end

.namesObject

A mapping from model property names to API property names.



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

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['request_id'] = 'requestId'
  @_hash['interchange_per_item_fee'] = 'interchangePerItemFee'
  @_hash['interchange_description'] = 'interchangeDescription'
  @_hash['interchange_percentage'] = 'interchangePercentage'
  @_hash['interchange_percentage_amount'] = 'interchangePercentageAmount'
  @_hash['discount_percentage'] = 'discountPercentage'
  @_hash['discount_amount'] = 'discountAmount'
  @_hash['discount_per_item_fee'] = 'discountPerItemFee'
  @_hash['total_fee'] = 'totalFee'
  @_hash['fee_currency'] = 'feeCurrency'
  @_hash['dues_assessments'] = 'duesAssessments'
  @_hash['funding_amount'] = 'fundingAmount'
  @_hash['funding_currency'] = 'fundingCurrency'
  @_hash
end

.nullablesObject

An array for nullable fields



104
105
106
# File 'lib/cyber_source_merged_spec/models/fee_and_funding_detail.rb', line 104

def self.nullables
  []
end

.optionalsObject

An array for optional fields



85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
# File 'lib/cyber_source_merged_spec/models/fee_and_funding_detail.rb', line 85

def self.optionals
  %w[
    request_id
    interchange_per_item_fee
    interchange_description
    interchange_percentage
    interchange_percentage_amount
    discount_percentage
    discount_amount
    discount_per_item_fee
    total_fee
    fee_currency
    dues_assessments
    funding_amount
    funding_currency
  ]
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



281
282
283
284
285
286
287
288
289
290
291
292
293
294
# File 'lib/cyber_source_merged_spec/models/fee_and_funding_detail.rb', line 281

def inspect
  class_name = self.class.name.split('::').last
  "<#{class_name} request_id: #{@request_id.inspect}, interchange_per_item_fee:"\
  " #{@interchange_per_item_fee.inspect}, interchange_description:"\
  " #{@interchange_description.inspect}, interchange_percentage:"\
  " #{@interchange_percentage.inspect}, interchange_percentage_amount:"\
  " #{@interchange_percentage_amount.inspect}, discount_percentage:"\
  " #{@discount_percentage.inspect}, discount_amount: #{@discount_amount.inspect},"\
  " discount_per_item_fee: #{@discount_per_item_fee.inspect}, total_fee:"\
  " #{@total_fee.inspect}, fee_currency: #{@fee_currency.inspect}, dues_assessments:"\
  " #{@dues_assessments.inspect}, funding_amount: #{@funding_amount.inspect},"\
  " funding_currency: #{@funding_currency.inspect}, additional_properties:"\
  " #{@additional_properties}>"
end

#to_sObject

Provides a human-readable string representation of the object.



268
269
270
271
272
273
274
275
276
277
278
# File 'lib/cyber_source_merged_spec/models/fee_and_funding_detail.rb', line 268

def to_s
  class_name = self.class.name.split('::').last
  "<#{class_name} request_id: #{@request_id}, interchange_per_item_fee:"\
  " #{@interchange_per_item_fee}, interchange_description: #{@interchange_description},"\
  " interchange_percentage: #{@interchange_percentage}, interchange_percentage_amount:"\
  " #{@interchange_percentage_amount}, discount_percentage: #{@discount_percentage},"\
  " discount_amount: #{@discount_amount}, discount_per_item_fee: #{@discount_per_item_fee},"\
  " total_fee: #{@total_fee}, fee_currency: #{@fee_currency}, dues_assessments:"\
  " #{@dues_assessments}, funding_amount: #{@funding_amount}, funding_currency:"\
  " #{@funding_currency}, additional_properties: #{@additional_properties}>"
end

#to_xml_element(doc, root_name) ⇒ Object



236
237
238
239
240
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
# File 'lib/cyber_source_merged_spec/models/fee_and_funding_detail.rb', line 236

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

  XmlUtilities.add_as_subelement(doc, root, 'requestId', request_id)
  XmlUtilities.add_as_subelement(doc, root, 'interchangePerItemFee',
                                 interchange_per_item_fee)
  XmlUtilities.add_as_subelement(doc, root, 'interchangeDescription',
                                 interchange_description)
  XmlUtilities.add_as_subelement(doc, root, 'interchangePercentage',
                                 interchange_percentage)
  XmlUtilities.add_as_subelement(doc, root, 'interchangePercentageAmount',
                                 interchange_percentage_amount)
  XmlUtilities.add_as_subelement(doc, root, 'discountPercentage',
                                 discount_percentage)
  XmlUtilities.add_as_subelement(doc, root, 'discountAmount',
                                 discount_amount)
  XmlUtilities.add_as_subelement(doc, root, 'discountPerItemFee',
                                 discount_per_item_fee)
  XmlUtilities.add_as_subelement(doc, root, 'totalFee', total_fee)
  XmlUtilities.add_as_subelement(doc, root, 'feeCurrency', fee_currency)
  XmlUtilities.add_as_subelement(doc, root, 'duesAssessments',
                                 dues_assessments)
  XmlUtilities.add_as_subelement(doc, root, 'fundingAmount', funding_amount)
  XmlUtilities.add_as_subelement(doc, root, 'fundingCurrency',
                                 funding_currency)
  XmlUtilities.add_as_subelement(doc, root, 'additional_properties',
                                 additional_properties)

  root
end