Class: Wirecard::Elastic::Request::Refund
- Defined in:
- lib/wirecard/elastic/request/refund.rb
Constant Summary collapse
- PAYMENT_QUERY_MAP =
{:purchase => "payments", :debit => "paymentmethods"}.freeze
Constants inherited from Base
Instance Attribute Summary collapse
-
#merchant_id ⇒ Object
readonly
Returns the value of attribute merchant_id.
-
#parent_transaction_id ⇒ Object
readonly
Returns the value of attribute parent_transaction_id.
-
#payment_method ⇒ Object
readonly
Returns the value of attribute payment_method.
-
#request_id ⇒ Object
readonly
Returns the value of attribute request_id.
Instance Method Summary collapse
-
#body ⇒ Object
XML body we will send to the elastic API.
-
#initialize(merchant_id, parent_transaction_id, payment_method) ⇒ Refund
constructor
A new instance of Refund.
-
#parent_transaction ⇒ Object
original transaction of the refund requested remotely to elastic API.
-
#query ⇒ Object
address we want to access on the API.
-
#request ⇒ Object
calling request.
-
#response ⇒ Object
processed response.
Methods inherited from Base
Constructor Details
#initialize(merchant_id, parent_transaction_id, payment_method) ⇒ Refund
Returns a new instance of Refund.
13 14 15 16 17 18 |
# File 'lib/wirecard/elastic/request/refund.rb', line 13 def initialize(merchant_id, parent_transaction_id, payment_method) @merchant_id = merchant_id @parent_transaction_id = parent_transaction_id @request_id = SecureRandom.uuid @payment_method = payment_method end |
Instance Attribute Details
#merchant_id ⇒ Object (readonly)
Returns the value of attribute merchant_id.
11 12 13 |
# File 'lib/wirecard/elastic/request/refund.rb', line 11 def merchant_id @merchant_id end |
#parent_transaction_id ⇒ Object (readonly)
Returns the value of attribute parent_transaction_id.
11 12 13 |
# File 'lib/wirecard/elastic/request/refund.rb', line 11 def parent_transaction_id @parent_transaction_id end |
#payment_method ⇒ Object (readonly)
Returns the value of attribute payment_method.
11 12 13 |
# File 'lib/wirecard/elastic/request/refund.rb', line 11 def payment_method @payment_method end |
#request_id ⇒ Object (readonly)
Returns the value of attribute request_id.
11 12 13 |
# File 'lib/wirecard/elastic/request/refund.rb', line 11 def request_id @request_id end |
Instance Method Details
#body ⇒ Object
XML body we will send to the elastic API
36 37 38 |
# File 'lib/wirecard/elastic/request/refund.rb', line 36 def body @body ||= Body::Builder.new(self, :refund).to_xml end |
#parent_transaction ⇒ Object
original transaction of the refund requested remotely to elastic API
42 43 44 |
# File 'lib/wirecard/elastic/request/refund.rb', line 42 def parent_transaction @parent_transaction ||= Transaction.new(merchant_id, parent_transaction_id, payment_method) end |
#query ⇒ Object
address we want to access on the API
31 32 33 |
# File 'lib/wirecard/elastic/request/refund.rb', line 31 def query @query ||= PAYMENT_QUERY_MAP[parent_transaction.response.transaction_type] end |