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



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

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. = 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.



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

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.



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

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

#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.



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

def 
  
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

#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



297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
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
# File 'lib/processout/transaction_operation.rb', line 297

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? "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



259
260
261
# File 'lib/processout/transaction_operation.rb', line 259

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



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
409
410
411
412
413
414
# File 'lib/processout/transaction_operation.rb', line 383

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. = 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



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
290
291
292
# File 'lib/processout/transaction_operation.rb', line 264

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,
      "metadata": self.,
      "gateway_fee": self.gateway_fee,
      "created_at": self.created_at,
  }.to_json
end