Class: ProcessOut::TransactionOperation

Inherits:
Object
  • Object
show all
Defined in:
lib/processout/transaction_operation.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(client, data = {}) ⇒ TransactionOperation

Initializes the TransactionOperation object Params:

client

ProcessOut client instance

data

data that can be used to fill the object



189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
# File 'lib/processout/transaction_operation.rb', line 189

def initialize(client, data = {})
  @client = client

  self.id = data.fetch(:id, nil)
  self.transaction = data.fetch(:transaction, nil)
  self.transaction_id = data.fetch(:transaction_id, nil)
  self.token = data.fetch(:token, nil)
  self.token_id = data.fetch(:token_id, nil)
  self.card = data.fetch(:card, nil)
  self.card_id = data.fetch(:card_id, nil)
  self.amount = data.fetch(:amount, nil)
  self.is_attempt = data.fetch(:is_attempt, nil)
  self.has_failed = data.fetch(:has_failed, nil)
  self.is_accountable = data.fetch(:is_accountable, nil)
  self.type = data.fetch(:type, nil)
  self.gateway_operation_id = data.fetch(:gateway_operation_id, nil)
  self.error_code = data.fetch(:error_code, nil)
  self.payment_data_three_d_s_request = data.fetch(:payment_data_three_d_s_request, nil)
  self.payment_data_three_d_s_authentication = data.fetch(:payment_data_three_d_s_authentication, nil)
  self.payment_data_network_authentication = data.fetch(:payment_data_network_authentication, nil)
  self. = data.fetch(:metadata, nil)
  self.gateway_fee = data.fetch(:gateway_fee, nil)
  self.created_at = data.fetch(:created_at, nil)
  
end

Instance Attribute Details

#amountObject

Returns the value of attribute amount.



17
18
19
# File 'lib/processout/transaction_operation.rb', line 17

def amount
  @amount
end

#cardObject

Returns the value of attribute card.



15
16
17
# File 'lib/processout/transaction_operation.rb', line 15

def card
  @card
end

#card_idObject

Returns the value of attribute card_id.



16
17
18
# File 'lib/processout/transaction_operation.rb', line 16

def card_id
  @card_id
end

#created_atObject

Returns the value of attribute created_at.



29
30
31
# File 'lib/processout/transaction_operation.rb', line 29

def created_at
  @created_at
end

#error_codeObject

Returns the value of attribute error_code.



23
24
25
# File 'lib/processout/transaction_operation.rb', line 23

def error_code
  @error_code
end

#gateway_feeObject

Returns the value of attribute gateway_fee.



28
29
30
# File 'lib/processout/transaction_operation.rb', line 28

def gateway_fee
  @gateway_fee
end

#gateway_operation_idObject

Returns the value of attribute gateway_operation_id.



22
23
24
# File 'lib/processout/transaction_operation.rb', line 22

def gateway_operation_id
  @gateway_operation_id
end

#has_failedObject

Returns the value of attribute has_failed.



19
20
21
# File 'lib/processout/transaction_operation.rb', line 19

def has_failed
  @has_failed
end

#idObject

Returns the value of attribute id.



10
11
12
# File 'lib/processout/transaction_operation.rb', line 10

def id
  @id
end

#is_accountableObject

Returns the value of attribute is_accountable.



20
21
22
# File 'lib/processout/transaction_operation.rb', line 20

def is_accountable
  @is_accountable
end

#is_attemptObject

Returns the value of attribute is_attempt.



18
19
20
# File 'lib/processout/transaction_operation.rb', line 18

def is_attempt
  @is_attempt
end

#metadataObject

Returns the value of attribute metadata.



27
28
29
# File 'lib/processout/transaction_operation.rb', line 27

def 
  @metadata
end

#payment_data_network_authenticationObject

Returns the value of attribute payment_data_network_authentication.



26
27
28
# File 'lib/processout/transaction_operation.rb', line 26

def payment_data_network_authentication
  @payment_data_network_authentication
end

#payment_data_three_d_s_authenticationObject

Returns the value of attribute payment_data_three_d_s_authentication.



25
26
27
# File 'lib/processout/transaction_operation.rb', line 25

def payment_data_three_d_s_authentication
  @payment_data_three_d_s_authentication
end

#payment_data_three_d_s_requestObject

Returns the value of attribute payment_data_three_d_s_request.



24
25
26
# File 'lib/processout/transaction_operation.rb', line 24

def payment_data_three_d_s_request
  @payment_data_three_d_s_request
end

#tokenObject

Returns the value of attribute token.



13
14
15
# File 'lib/processout/transaction_operation.rb', line 13

def token
  @token
end

#token_idObject

Returns the value of attribute token_id.



14
15
16
# File 'lib/processout/transaction_operation.rb', line 14

def token_id
  @token_id
end

#transactionObject

Returns the value of attribute transaction.



11
12
13
# File 'lib/processout/transaction_operation.rb', line 11

def transaction
  @transaction
end

#transaction_idObject

Returns the value of attribute transaction_id.



12
13
14
# File 'lib/processout/transaction_operation.rb', line 12

def transaction_id
  @transaction_id
end

#typeObject

Returns the value of attribute type.



21
22
23
# File 'lib/processout/transaction_operation.rb', line 21

def type
  @type
end

Instance Method Details

#fill_with_data(data) ⇒ Object

Fills the object with data coming from the API Params:

data

Hash of data coming from the API



223
224
225
226
227
228
229
230
231
232
233
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
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
# File 'lib/processout/transaction_operation.rb', line 223

def fill_with_data(data)
  if data.nil?
    return self
  end
  if data.include? "id"
    self.id = data["id"]
  end
  if data.include? "transaction"
    self.transaction = data["transaction"]
  end
  if data.include? "transaction_id"
    self.transaction_id = data["transaction_id"]
  end
  if data.include? "token"
    self.token = data["token"]
  end
  if data.include? "token_id"
    self.token_id = data["token_id"]
  end
  if data.include? "card"
    self.card = data["card"]
  end
  if data.include? "card_id"
    self.card_id = data["card_id"]
  end
  if data.include? "amount"
    self.amount = data["amount"]
  end
  if data.include? "is_attempt"
    self.is_attempt = data["is_attempt"]
  end
  if data.include? "has_failed"
    self.has_failed = data["has_failed"]
  end
  if data.include? "is_accountable"
    self.is_accountable = data["is_accountable"]
  end
  if data.include? "type"
    self.type = data["type"]
  end
  if data.include? "gateway_operation_id"
    self.gateway_operation_id = data["gateway_operation_id"]
  end
  if data.include? "error_code"
    self.error_code = data["error_code"]
  end
  if data.include? "payment_data_three_d_s_request"
    self.payment_data_three_d_s_request = data["payment_data_three_d_s_request"]
  end
  if data.include? "payment_data_three_d_s_authentication"
    self.payment_data_three_d_s_authentication = data["payment_data_three_d_s_authentication"]
  end
  if data.include? "payment_data_network_authentication"
    self.payment_data_network_authentication = data["payment_data_network_authentication"]
  end
  if data.include? "metadata"
    self. = data["metadata"]
  end
  if data.include? "gateway_fee"
    self.gateway_fee = data["gateway_fee"]
  end
  if data.include? "created_at"
    self.created_at = data["created_at"]
  end
  
  self
end

#new(data = {}) ⇒ Object

Create a new TransactionOperation using the current client



216
217
218
# File 'lib/processout/transaction_operation.rb', line 216

def new(data = {})
  TransactionOperation.new(@client, data)
end

#prefill(data) ⇒ Object

Prefills the object with the data passed as parameters Params:

data

Hash of data



294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
# File 'lib/processout/transaction_operation.rb', line 294

def prefill(data)
  if data.nil?
    return self
  end
  self.id = data.fetch(:id, self.id)
  self.transaction = data.fetch(:transaction, self.transaction)
  self.transaction_id = data.fetch(:transaction_id, self.transaction_id)
  self.token = data.fetch(:token, self.token)
  self.token_id = data.fetch(:token_id, self.token_id)
  self.card = data.fetch(:card, self.card)
  self.card_id = data.fetch(:card_id, self.card_id)
  self.amount = data.fetch(:amount, self.amount)
  self.is_attempt = data.fetch(:is_attempt, self.is_attempt)
  self.has_failed = data.fetch(:has_failed, self.has_failed)
  self.is_accountable = data.fetch(:is_accountable, self.is_accountable)
  self.type = data.fetch(:type, self.type)
  self.gateway_operation_id = data.fetch(:gateway_operation_id, self.gateway_operation_id)
  self.error_code = data.fetch(:error_code, self.error_code)
  self.payment_data_three_d_s_request = data.fetch(:payment_data_three_d_s_request, self.payment_data_three_d_s_request)
  self.payment_data_three_d_s_authentication = data.fetch(:payment_data_three_d_s_authentication, self.payment_data_three_d_s_authentication)
  self.payment_data_network_authentication = data.fetch(:payment_data_network_authentication, self.payment_data_network_authentication)
  self. = data.fetch(:metadata, self.)
  self.gateway_fee = data.fetch(:gateway_fee, self.gateway_fee)
  self.created_at = data.fetch(:created_at, self.created_at)
  
  self
end