Class: CyberSourceMergedSpec::Settlement

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

Overview

Settlement 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(request_id: SKIP, transaction_type: SKIP, submission_time: SKIP, amount: SKIP, currency_code: SKIP, payment_method: SKIP, wallet_type: SKIP, payment_type: SKIP, account_suffix: SKIP, cybersource_batch_time: SKIP, cybersource_batch_id: SKIP, card_type: SKIP, debit_network: SKIP, additional_properties: nil) ⇒ Settlement

Returns a new instance of Settlement.



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

def initialize(request_id: SKIP, transaction_type: SKIP,
               submission_time: SKIP, amount: SKIP, currency_code: SKIP,
               payment_method: SKIP, wallet_type: SKIP, payment_type: SKIP,
               account_suffix: SKIP, cybersource_batch_time: SKIP,
               cybersource_batch_id: SKIP, card_type: SKIP,
               debit_network: 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
  @transaction_type = transaction_type unless transaction_type == SKIP
  @submission_time = submission_time unless submission_time == SKIP
  @amount = amount unless amount == SKIP
  @currency_code = currency_code unless currency_code == SKIP
  @payment_method = payment_method unless payment_method == SKIP
  @wallet_type = wallet_type unless wallet_type == SKIP
  @payment_type = payment_type unless payment_type == SKIP
  @account_suffix =  unless  == SKIP
  @cybersource_batch_time = cybersource_batch_time unless cybersource_batch_time == SKIP
  @cybersource_batch_id = cybersource_batch_id unless cybersource_batch_id == SKIP
  @card_type = card_type unless card_type == SKIP
  @debit_network = debit_network unless debit_network == SKIP
  @additional_properties = additional_properties
end

Instance Attribute Details

#account_suffixString

Account Suffix

Returns:

  • (String)


48
49
50
# File 'lib/cyber_source_merged_spec/models/settlement.rb', line 48

def 
  @account_suffix
end

#amountString

Amount

Returns:

  • (String)


28
29
30
# File 'lib/cyber_source_merged_spec/models/settlement.rb', line 28

def amount
  @amount
end

#card_typeString

Card Type

Returns:

  • (String)


60
61
62
# File 'lib/cyber_source_merged_spec/models/settlement.rb', line 60

def card_type
  @card_type
end

#currency_codeString

Valid ISO 4217 ALPHA-3 currency code

Returns:

  • (String)


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

def currency_code
  @currency_code
end

#cybersource_batch_idString

Cybersource Batch Id

Returns:

  • (String)


56
57
58
# File 'lib/cyber_source_merged_spec/models/settlement.rb', line 56

def cybersource_batch_id
  @cybersource_batch_id
end

#cybersource_batch_timeDateTime

Cybersource Batch Time

Returns:

  • (DateTime)


52
53
54
# File 'lib/cyber_source_merged_spec/models/settlement.rb', line 52

def cybersource_batch_time
  @cybersource_batch_time
end

#debit_networkString

Debit Network

Returns:

  • (String)


64
65
66
# File 'lib/cyber_source_merged_spec/models/settlement.rb', line 64

def debit_network
  @debit_network
end

#payment_methodString

payment method

Returns:

  • (String)


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

def payment_method
  @payment_method
end

#payment_typeString

Payment Type

Returns:

  • (String)


44
45
46
# File 'lib/cyber_source_merged_spec/models/settlement.rb', line 44

def payment_type
  @payment_type
end

#request_idString

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

Returns:

  • (String)


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

def request_id
  @request_id
end

#submission_timeDateTime

Submission Date

Returns:

  • (DateTime)


24
25
26
# File 'lib/cyber_source_merged_spec/models/settlement.rb', line 24

def submission_time
  @submission_time
end

#transaction_typeString

Transaction Type

Returns:

  • (String)


20
21
22
# File 'lib/cyber_source_merged_spec/models/settlement.rb', line 20

def transaction_type
  @transaction_type
end

#wallet_typeString

Solution Type (Wallet)

Returns:

  • (String)


40
41
42
# File 'lib/cyber_source_merged_spec/models/settlement.rb', line 40

def wallet_type
  @wallet_type
end

Class Method Details

.from_element(root) ⇒ Object



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
# File 'lib/cyber_source_merged_spec/models/settlement.rb', line 195

def self.from_element(root)
  request_id = XmlUtilities.from_element(root, 'requestId', String)
  transaction_type = XmlUtilities.from_element(root, 'transactionType',
                                               String)
  submission_time = XmlUtilities.from_element(root, 'submissionTime',
                                              String,
                                              datetime_format: 'rfc3339')
  amount = XmlUtilities.from_element(root, 'amount', String)
  currency_code = XmlUtilities.from_element(root, 'currencyCode', String)
  payment_method = XmlUtilities.from_element(root, 'paymentMethod', String)
  wallet_type = XmlUtilities.from_element(root, 'walletType', String)
  payment_type = XmlUtilities.from_element(root, 'paymentType', String)
   = XmlUtilities.from_element(root, 'accountSuffix', String)
  cybersource_batch_time = XmlUtilities.from_element(
    root, 'cybersourceBatchTime', String,
    datetime_format: 'rfc3339'
  )
  cybersource_batch_id = XmlUtilities.from_element(root,
                                                   'cybersourceBatchId',
                                                   String)
  card_type = XmlUtilities.from_element(root, 'cardType', String)
  debit_network = XmlUtilities.from_element(root, 'debitNetwork', String)

  new(request_id: request_id,
      transaction_type: transaction_type,
      submission_time: submission_time,
      amount: amount,
      currency_code: currency_code,
      payment_method: payment_method,
      wallet_type: wallet_type,
      payment_type: payment_type,
      account_suffix: ,
      cybersource_batch_time: cybersource_batch_time,
      cybersource_batch_id: cybersource_batch_id,
      card_type: card_type,
      debit_network: debit_network,
      additional_properties: additional_properties)
end

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



135
136
137
138
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
# File 'lib/cyber_source_merged_spec/models/settlement.rb', line 135

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  request_id = hash.key?('requestId') ? hash['requestId'] : SKIP
  transaction_type =
    hash.key?('transactionType') ? hash['transactionType'] : SKIP
  submission_time = if hash.key?('submissionTime')
                      (DateTimeHelper.from_rfc3339(hash['submissionTime']) if hash['submissionTime'])
                    else
                      SKIP
                    end
  amount = hash.key?('amount') ? hash['amount'] : SKIP
  currency_code = hash.key?('currencyCode') ? hash['currencyCode'] : SKIP
  payment_method = hash.key?('paymentMethod') ? hash['paymentMethod'] : SKIP
  wallet_type = hash.key?('walletType') ? hash['walletType'] : SKIP
  payment_type = hash.key?('paymentType') ? hash['paymentType'] : SKIP
   = hash.key?('accountSuffix') ? hash['accountSuffix'] : SKIP
  cybersource_batch_time = if hash.key?('cybersourceBatchTime')
                             (DateTimeHelper.from_rfc3339(hash['cybersourceBatchTime']) if hash['cybersourceBatchTime'])
                           else
                             SKIP
                           end
  cybersource_batch_id =
    hash.key?('cybersourceBatchId') ? hash['cybersourceBatchId'] : SKIP
  card_type = hash.key?('cardType') ? hash['cardType'] : SKIP
  debit_network = hash.key?('debitNetwork') ? hash['debitNetwork'] : 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.
  Settlement.new(request_id: request_id,
                 transaction_type: transaction_type,
                 submission_time: submission_time,
                 amount: amount,
                 currency_code: currency_code,
                 payment_method: payment_method,
                 wallet_type: wallet_type,
                 payment_type: payment_type,
                 account_suffix: ,
                 cybersource_batch_time: cybersource_batch_time,
                 cybersource_batch_id: cybersource_batch_id,
                 card_type: card_type,
                 debit_network: debit_network,
                 additional_properties: additional_properties)
end

.namesObject

A mapping from model property names to API property names.



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

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['request_id'] = 'requestId'
  @_hash['transaction_type'] = 'transactionType'
  @_hash['submission_time'] = 'submissionTime'
  @_hash['amount'] = 'amount'
  @_hash['currency_code'] = 'currencyCode'
  @_hash['payment_method'] = 'paymentMethod'
  @_hash['wallet_type'] = 'walletType'
  @_hash['payment_type'] = 'paymentType'
  @_hash['account_suffix'] = 'accountSuffix'
  @_hash['cybersource_batch_time'] = 'cybersourceBatchTime'
  @_hash['cybersource_batch_id'] = 'cybersourceBatchId'
  @_hash['card_type'] = 'cardType'
  @_hash['debit_network'] = 'debitNetwork'
  @_hash
end

.nullablesObject

An array for nullable fields



105
106
107
# File 'lib/cyber_source_merged_spec/models/settlement.rb', line 105

def self.nullables
  []
end

.optionalsObject

An array for optional fields



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

def self.optionals
  %w[
    request_id
    transaction_type
    submission_time
    amount
    currency_code
    payment_method
    wallet_type
    payment_type
    account_suffix
    cybersource_batch_time
    cybersource_batch_id
    card_type
    debit_network
  ]
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



275
276
277
278
279
280
281
282
283
284
285
# File 'lib/cyber_source_merged_spec/models/settlement.rb', line 275

def inspect
  class_name = self.class.name.split('::').last
  "<#{class_name} request_id: #{@request_id.inspect}, transaction_type:"\
  " #{@transaction_type.inspect}, submission_time: #{@submission_time.inspect}, amount:"\
  " #{@amount.inspect}, currency_code: #{@currency_code.inspect}, payment_method:"\
  " #{@payment_method.inspect}, wallet_type: #{@wallet_type.inspect}, payment_type:"\
  " #{@payment_type.inspect}, account_suffix: #{@account_suffix.inspect},"\
  " cybersource_batch_time: #{@cybersource_batch_time.inspect}, cybersource_batch_id:"\
  " #{@cybersource_batch_id.inspect}, card_type: #{@card_type.inspect}, debit_network:"\
  " #{@debit_network.inspect}, additional_properties: #{@additional_properties}>"
end

#to_custom_cybersource_batch_timeObject



191
192
193
# File 'lib/cyber_source_merged_spec/models/settlement.rb', line 191

def to_custom_cybersource_batch_time
  DateTimeHelper.to_rfc3339(cybersource_batch_time)
end

#to_custom_submission_timeObject



187
188
189
# File 'lib/cyber_source_merged_spec/models/settlement.rb', line 187

def to_custom_submission_time
  DateTimeHelper.to_rfc3339(submission_time)
end

#to_sObject

Provides a human-readable string representation of the object.



263
264
265
266
267
268
269
270
271
272
# File 'lib/cyber_source_merged_spec/models/settlement.rb', line 263

def to_s
  class_name = self.class.name.split('::').last
  "<#{class_name} request_id: #{@request_id}, transaction_type: #{@transaction_type},"\
  " submission_time: #{@submission_time}, amount: #{@amount}, currency_code:"\
  " #{@currency_code}, payment_method: #{@payment_method}, wallet_type: #{@wallet_type},"\
  " payment_type: #{@payment_type}, account_suffix: #{@account_suffix},"\
  " cybersource_batch_time: #{@cybersource_batch_time}, cybersource_batch_id:"\
  " #{@cybersource_batch_id}, card_type: #{@card_type}, debit_network: #{@debit_network},"\
  " additional_properties: #{@additional_properties}>"
end

#to_xml_element(doc, root_name) ⇒ Object



234
235
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
# File 'lib/cyber_source_merged_spec/models/settlement.rb', line 234

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, 'transactionType',
                                 transaction_type)
  XmlUtilities.add_as_subelement(doc, root, 'submissionTime',
                                 submission_time,
                                 datetime_format: 'rfc3339')
  XmlUtilities.add_as_subelement(doc, root, 'amount', amount)
  XmlUtilities.add_as_subelement(doc, root, 'currencyCode', currency_code)
  XmlUtilities.add_as_subelement(doc, root, 'paymentMethod', payment_method)
  XmlUtilities.add_as_subelement(doc, root, 'walletType', wallet_type)
  XmlUtilities.add_as_subelement(doc, root, 'paymentType', payment_type)
  XmlUtilities.add_as_subelement(doc, root, 'accountSuffix', )
  XmlUtilities.add_as_subelement(doc, root, 'cybersourceBatchTime',
                                 cybersource_batch_time,
                                 datetime_format: 'rfc3339')
  XmlUtilities.add_as_subelement(doc, root, 'cybersourceBatchId',
                                 cybersource_batch_id)
  XmlUtilities.add_as_subelement(doc, root, 'cardType', card_type)
  XmlUtilities.add_as_subelement(doc, root, 'debitNetwork', debit_network)
  XmlUtilities.add_as_subelement(doc, root, 'additional_properties',
                                 additional_properties)

  root
end