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



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
# File 'lib/processout/transaction_operation.rb', line 242

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.gateway_configuration = data.fetch(:gateway_configuration, nil)
  self.gateway_configuration_id = data.fetch(:gateway_configuration_id, nil)
  self.amount = data.fetch(:amount, nil)
  self.currency = data.fetch(:currency, 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.arn = data.fetch(:arn, nil)
  self.error_code = data.fetch(:error_code, nil)
  self.gateway_data = data.fetch(:gateway_data, 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.initial_scheme_transaction_id = data.fetch(:initial_scheme_transaction_id, nil)
  self.scheme_id = data.fetch(:scheme_id, nil)
  self.payment_type = data.fetch(:payment_type, 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.



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

def amount
  @amount
end

#arnObject

Returns the value of attribute arn.



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

def arn
  @arn
end

#cardObject

Returns the value of attribute card.



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

def card
  @card
end

#card_idObject

Returns the value of attribute card_id.



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

def card_id
  @card_id
end

#created_atObject

Returns the value of attribute created_at.



38
39
40
# File 'lib/processout/transaction_operation.rb', line 38

def created_at
  @created_at
end

#currencyObject

Returns the value of attribute currency.



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

def currency
  @currency
end

#error_codeObject

Returns the value of attribute error_code.



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

def error_code
  @error_code
end

#gateway_configurationObject

Returns the value of attribute gateway_configuration.



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

def gateway_configuration
  @gateway_configuration
end

#gateway_configuration_idObject

Returns the value of attribute gateway_configuration_id.



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

def gateway_configuration_id
  @gateway_configuration_id
end

#gateway_dataObject

Returns the value of attribute gateway_data.



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

def gateway_data
  @gateway_data
end

#gateway_feeObject

Returns the value of attribute gateway_fee.



37
38
39
# File 'lib/processout/transaction_operation.rb', line 37

def gateway_fee
  @gateway_fee
end

#gateway_operation_idObject

Returns the value of attribute gateway_operation_id.



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

def gateway_operation_id
  @gateway_operation_id
end

#has_failedObject

Returns the value of attribute has_failed.



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

def has_failed
  @has_failed
end

#idObject

Returns the value of attribute id.



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

def id
  @id
end

#initial_scheme_transaction_idObject

Returns the value of attribute initial_scheme_transaction_id.



33
34
35
# File 'lib/processout/transaction_operation.rb', line 33

def initial_scheme_transaction_id
  @initial_scheme_transaction_id
end

#is_accountableObject

Returns the value of attribute is_accountable.



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

def is_accountable
  @is_accountable
end

#is_attemptObject

Returns the value of attribute is_attempt.



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

def is_attempt
  @is_attempt
end

#metadataObject

Returns the value of attribute metadata.



36
37
38
# File 'lib/processout/transaction_operation.rb', line 36

def 
  @metadata
end

#payment_data_network_authenticationObject

Returns the value of attribute payment_data_network_authentication.



32
33
34
# File 'lib/processout/transaction_operation.rb', line 32

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.



31
32
33
# File 'lib/processout/transaction_operation.rb', line 31

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.



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

def payment_data_three_d_s_request
  @payment_data_three_d_s_request
end

#payment_typeObject

Returns the value of attribute payment_type.



35
36
37
# File 'lib/processout/transaction_operation.rb', line 35

def payment_type
  @payment_type
end

#scheme_idObject

Returns the value of attribute scheme_id.



34
35
36
# File 'lib/processout/transaction_operation.rb', line 34

def scheme_id
  @scheme_id
end

#tokenObject

Returns the value of attribute token.



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

def token
  @token
end

#token_idObject

Returns the value of attribute token_id.



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

def token_id
  @token_id
end

#transactionObject

Returns the value of attribute transaction.



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

def transaction
  @transaction
end

#transaction_idObject

Returns the value of attribute transaction_id.



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

def transaction_id
  @transaction_id
end

#typeObject

Returns the value of attribute type.



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

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



318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
# File 'lib/processout/transaction_operation.rb', line 318

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? "gateway_configuration"
    self.gateway_configuration = data["gateway_configuration"]
  end
  if data.include? "gateway_configuration_id"
    self.gateway_configuration_id = data["gateway_configuration_id"]
  end
  if data.include? "amount"
    self.amount = data["amount"]
  end
  if data.include? "currency"
    self.currency = data["currency"]
  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? "arn"
    self.arn = data["arn"]
  end
  if data.include? "error_code"
    self.error_code = data["error_code"]
  end
  if data.include? "gateway_data"
    self.gateway_data = data["gateway_data"]
  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? "initial_scheme_transaction_id"
    self.initial_scheme_transaction_id = data["initial_scheme_transaction_id"]
  end
  if data.include? "scheme_id"
    self.scheme_id = data["scheme_id"]
  end
  if data.include? "payment_type"
    self.payment_type = data["payment_type"]
  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



277
278
279
# File 'lib/processout/transaction_operation.rb', line 277

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



413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
# File 'lib/processout/transaction_operation.rb', line 413

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.gateway_configuration = data.fetch(:gateway_configuration, self.gateway_configuration)
  self.gateway_configuration_id = data.fetch(:gateway_configuration_id, self.gateway_configuration_id)
  self.amount = data.fetch(:amount, self.amount)
  self.currency = data.fetch(:currency, self.currency)
  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.arn = data.fetch(:arn, self.arn)
  self.error_code = data.fetch(:error_code, self.error_code)
  self.gateway_data = data.fetch(:gateway_data, self.gateway_data)
  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.initial_scheme_transaction_id = data.fetch(:initial_scheme_transaction_id, self.initial_scheme_transaction_id)
  self.scheme_id = data.fetch(:scheme_id, self.scheme_id)
  self.payment_type = data.fetch(:payment_type, self.payment_type)
  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

#to_json(options) ⇒ Object

Overrides the JSON marshaller to only send the fields we want



282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
# File 'lib/processout/transaction_operation.rb', line 282

def to_json(options)
  {
      "id": self.id,
      "transaction": self.transaction,
      "transaction_id": self.transaction_id,
      "token": self.token,
      "token_id": self.token_id,
      "card": self.card,
      "card_id": self.card_id,
      "gateway_configuration": self.gateway_configuration,
      "gateway_configuration_id": self.gateway_configuration_id,
      "amount": self.amount,
      "currency": self.currency,
      "is_attempt": self.is_attempt,
      "has_failed": self.has_failed,
      "is_accountable": self.is_accountable,
      "type": self.type,
      "gateway_operation_id": self.gateway_operation_id,
      "arn": self.arn,
      "error_code": self.error_code,
      "gateway_data": self.gateway_data,
      "payment_data_three_d_s_request": self.payment_data_three_d_s_request,
      "payment_data_three_d_s_authentication": self.payment_data_three_d_s_authentication,
      "payment_data_network_authentication": self.payment_data_network_authentication,
      "initial_scheme_transaction_id": self.initial_scheme_transaction_id,
      "scheme_id": self.scheme_id,
      "payment_type": self.payment_type,
      "metadata": self.,
      "gateway_fee": self.gateway_fee,
      "created_at": self.created_at,
  }.to_json
end