Class: Wirecard::Elastic::Request::Transaction

Inherits:
Base
  • Object
show all
Defined in:
lib/wirecard/elastic/request/transaction.rb

Constant Summary

Constants inherited from Base

Base::VALID_STATUS_LIST

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from Base

#safe

Constructor Details

#initialize(merchant_id, transaction_id, payment_method) ⇒ Transaction

Returns a new instance of Transaction.



9
10
11
12
13
# File 'lib/wirecard/elastic/request/transaction.rb', line 9

def initialize(merchant_id, transaction_id, payment_method)
  @merchant_id    = merchant_id
  @transaction_id = transaction_id
  @payment_method = payment_method
end

Instance Attribute Details

#merchant_idObject (readonly)

Returns the value of attribute merchant_id.



7
8
9
# File 'lib/wirecard/elastic/request/transaction.rb', line 7

def merchant_id
  @merchant_id
end

#payment_methodObject (readonly)

Returns the value of attribute payment_method.



7
8
9
# File 'lib/wirecard/elastic/request/transaction.rb', line 7

def payment_method
  @payment_method
end

#transaction_idObject (readonly)

Returns the value of attribute transaction_id.



7
8
9
# File 'lib/wirecard/elastic/request/transaction.rb', line 7

def transaction_id
  @transaction_id
end

Instance Method Details

#queryObject

address we want to access on the API



26
27
28
# File 'lib/wirecard/elastic/request/transaction.rb', line 26

def query
  @query ||= "merchants/#{merchant_id}/payments/#{transaction_id}"
end

#requestObject

calling request



16
17
18
# File 'lib/wirecard/elastic/request/transaction.rb', line 16

def request
  @request ||= Request.new(query_uri: query, payment_method: payment_method).dispatch!
end

#responseObject

processed response



21
22
23
# File 'lib/wirecard/elastic/request/transaction.rb', line 21

def response
  @response ||= Response.new(request: request, action: :transaction).dispatch!
end